File size: 11,516 Bytes
28677d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
from __future__ import annotations

from dataclasses import dataclass
from typing import Iterable


@dataclass(frozen=True)
class DocsSource:
    id: str
    track: str
    provider: str
    title: str
    url: str
    category: str
    tags: tuple[str, ...] = ()
    role: str = "reference"
    enabled: bool = True


DOCS_SOURCES: tuple[DocsSource, ...] = (
    DocsSource(
        "manual-az104-basic",
        "azure",
        "Microsoft Learn",
        "AZ-104 study guide",
        "https://learn.microsoft.com/en-us/credentials/certifications/resources/study-guides/az-104",
        "exam-guide",
        ("az-104", "study-guide"),
    ),
    DocsSource(
        "azure-vnet-overview",
        "azure",
        "Microsoft Learn",
        "Azure Virtual Network overview",
        "https://learn.microsoft.com/en-us/azure/virtual-network/virtual-networks-overview",
        "network",
        ("vnet", "subnet", "networking"),
    ),
    DocsSource(
        "azure-nsg-overview",
        "azure",
        "Microsoft Learn",
        "Network security groups",
        "https://learn.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview",
        "network",
        ("nsg", "security"),
    ),
    DocsSource(
        "azure-private-endpoint",
        "azure",
        "Microsoft Learn",
        "Private Endpoint overview",
        "https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-overview",
        "network",
        ("private-link", "private-endpoint"),
    ),
    DocsSource(
        "azure-load-balancer",
        "azure",
        "Microsoft Learn",
        "Azure Load Balancer overview",
        "https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-overview",
        "network",
        ("load-balancer",),
    ),
    DocsSource(
        "azure-vm-overview",
        "azure",
        "Microsoft Learn",
        "Azure Virtual Machines overview",
        "https://learn.microsoft.com/en-us/azure/virtual-machines/overview",
        "compute",
        ("vm", "compute"),
    ),
    DocsSource(
        "azure-storage-account",
        "azure",
        "Microsoft Learn",
        "Storage account overview",
        "https://learn.microsoft.com/en-us/azure/storage/common/storage-account-overview",
        "storage",
        ("storage-account", "blob"),
    ),
    DocsSource(
        "azure-rbac-overview",
        "azure",
        "Microsoft Learn",
        "Azure RBAC overview",
        "https://learn.microsoft.com/en-us/azure/role-based-access-control/overview",
        "identity",
        ("rbac", "role"),
    ),
    DocsSource(
        "azure-monitor-overview",
        "azure",
        "Microsoft Learn",
        "Azure Monitor overview",
        "https://learn.microsoft.com/en-us/azure/azure-monitor/overview",
        "monitor",
        ("monitor", "log-analytics"),
    ),
    DocsSource(
        "azure-backup-overview",
        "azure",
        "Microsoft Learn",
        "Azure Backup overview",
        "https://learn.microsoft.com/en-us/azure/backup/backup-overview",
        "backup",
        ("backup", "recovery"),
    ),
    DocsSource(
        "azure-policy-overview",
        "azure",
        "Microsoft Learn",
        "Azure Policy overview",
        "https://learn.microsoft.com/en-us/azure/governance/policy/overview",
        "governance",
        ("policy", "initiative", "compliance"),
    ),
    DocsSource(
        "azure-app-gateway-overview",
        "azure",
        "Microsoft Learn",
        "Application Gateway overview",
        "https://learn.microsoft.com/en-us/azure/application-gateway/overview",
        "network",
        ("application-gateway", "waf", "layer-7"),
    ),
    DocsSource(
        "azure-dns-overview",
        "azure",
        "Microsoft Learn",
        "Azure DNS overview",
        "https://learn.microsoft.com/en-us/azure/dns/dns-overview",
        "network",
        ("dns", "private-dns", "resolver"),
    ),
    DocsSource(
        "azure-blob-access-tiers",
        "azure",
        "Microsoft Learn",
        "Blob access tiers",
        "https://learn.microsoft.com/en-us/azure/storage/blobs/access-tiers-overview",
        "storage",
        ("blob", "hot", "cool", "archive"),
    ),
    DocsSource(
        "azure-vmss-overview",
        "azure",
        "Microsoft Learn",
        "Virtual Machine Scale Sets overview",
        "https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/overview",
        "compute",
        ("vmss", "autoscale", "availability"),
    ),
    DocsSource(
        "azure-log-analytics-overview",
        "azure",
        "Microsoft Learn",
        "Log Analytics overview",
        "https://learn.microsoft.com/en-us/azure/azure-monitor/logs/log-analytics-overview",
        "monitor",
        ("log-analytics", "kql", "monitor"),
    ),
    DocsSource(
        "azure-recovery-services-vault",
        "azure",
        "Microsoft Learn",
        "Recovery Services vault overview",
        "https://learn.microsoft.com/en-us/azure/backup/backup-azure-recovery-services-vault-overview",
        "backup",
        ("recovery-services-vault", "backup-policy"),
    ),
    DocsSource(
        "azure-bastion-overview",
        "azure",
        "Microsoft Learn",
        "Azure Bastion overview",
        "https://learn.microsoft.com/en-us/azure/bastion/bastion-overview",
        "network",
        ("bastion", "ssh", "rdp"),
    ),
    DocsSource(
        "azure-nat-gateway",
        "azure",
        "Microsoft Learn",
        "Azure NAT Gateway overview",
        "https://learn.microsoft.com/en-us/azure/nat-gateway/nat-overview",
        "network",
        ("nat-gateway", "outbound"),
    ),
    DocsSource(
        "azure-app-service-overview",
        "azure",
        "Microsoft Learn",
        "App Service overview",
        "https://learn.microsoft.com/en-us/azure/app-service/overview",
        "compute",
        ("app-service", "web-app"),
    ),
    DocsSource(
        "azure-container-instances",
        "azure",
        "Microsoft Learn",
        "Azure Container Instances overview",
        "https://learn.microsoft.com/en-us/azure/container-instances/container-instances-overview",
        "compute",
        ("aci", "container"),
    ),
    DocsSource(
        "azure-key-vault-overview",
        "azure",
        "Microsoft Learn",
        "Azure Key Vault overview",
        "https://learn.microsoft.com/en-us/azure/key-vault/general/overview",
        "security",
        ("key-vault", "secret", "key"),
    ),
    DocsSource(
        "manual-linux-basic",
        "linux",
        "GNU Coreutils Manual",
        "GNU Coreutils basic operations",
        "https://www.gnu.org/software/coreutils/manual/coreutils.html",
        "essential-commands",
        ("pwd", "ls", "mkdir", "touch", "chmod"),
        "command-reference",
    ),
    DocsSource(
        "linux-bash-cd",
        "linux",
        "GNU Bash Manual",
        "Bash builtins",
        "https://www.gnu.org/software/bash/manual/html_node/Bourne-Shell-Builtins.html",
        "shell",
        ("cd", "shell-builtin"),
        "command-reference",
    ),
    DocsSource(
        "linux-grep-manual",
        "linux",
        "GNU Grep Manual",
        "GNU Grep manual",
        "https://www.gnu.org/software/grep/manual/grep.html",
        "text-processing",
        ("grep", "search"),
        "command-reference",
    ),
    DocsSource(
        "linux-systemd-systemctl",
        "linux",
        "freedesktop.org",
        "systemctl manual",
        "https://www.freedesktop.org/software/systemd/man/latest/systemctl.html",
        "services",
        ("systemctl", "service"),
        "command-reference",
    ),
    DocsSource(
        "linux-man7-ip",
        "linux",
        "man7.org",
        "ip command manual",
        "https://man7.org/linux/man-pages/man8/ip.8.html",
        "networking",
        ("ip", "networking"),
        "command-reference",
    ),
    DocsSource(
        "ubuntu-server-docs",
        "linux",
        "Ubuntu Server Docs",
        "Ubuntu Server documentation",
        "https://ubuntu.com/server/docs/",
        "server-operations",
        ("ubuntu", "server", "operations"),
        "practice-guide",
    ),
    DocsSource(
        "ubuntu-package-management",
        "linux",
        "Ubuntu Server Docs",
        "Install and manage packages",
        "https://ubuntu.com/server/docs/how-to/software/package-management/",
        "package-management",
        ("apt", "package", "software"),
        "practice-guide",
    ),
    DocsSource(
        "ubuntu-user-management",
        "linux",
        "Ubuntu Server Docs",
        "User management",
        "https://ubuntu.com/server/docs/how-to/security/user-management/",
        "users-groups",
        ("user", "group", "sudo"),
        "practice-guide",
    ),
    DocsSource(
        "ubuntu-networking",
        "linux",
        "Ubuntu Server Docs",
        "Networking",
        "https://ubuntu.com/server/docs/how-to/networking/",
        "networking",
        ("netplan", "dns", "network-tools"),
        "practice-guide",
    ),
    DocsSource(
        "ubuntu-firewall",
        "linux",
        "Ubuntu Server Docs",
        "Firewall",
        "https://ubuntu.com/server/docs/how-to/security/firewalls/",
        "security",
        ("ufw", "firewall", "port"),
        "practice-guide",
    ),
    DocsSource(
        "ubuntu-storage",
        "linux",
        "Ubuntu Server Docs",
        "Storage",
        "https://ubuntu.com/server/docs/how-to/storage/",
        "storage",
        ("lvm", "storage", "iscsi"),
        "practice-guide",
    ),
    DocsSource(
        "official-docs-ollama",
        "tool_docs",
        "Ollama Docs",
        "Ollama documentation",
        "https://docs.ollama.com/",
        "ollama",
        ("ollama", "local-model"),
    ),
    DocsSource(
        "official-docs-langchain",
        "tool_docs",
        "LangChain Docs",
        "LangChain documentation",
        "https://python.langchain.com/docs/",
        "langchain",
        ("langchain", "rag"),
    ),
    DocsSource(
        "official-docs-streamlit",
        "tool_docs",
        "Streamlit Docs",
        "Streamlit documentation",
        "https://docs.streamlit.io/",
        "streamlit",
        ("streamlit", "session-state"),
    ),
    DocsSource(
        "official-docs-huggingface",
        "tool_docs",
        "Hugging Face Docs",
        "Hugging Face documentation",
        "https://huggingface.co/docs",
        "huggingface",
        ("huggingface", "spaces"),
    ),
)


def active_docs_sources(track_id: str | None = None) -> list[DocsSource]:
    sources = [source for source in DOCS_SOURCES if source.enabled]
    if track_id and track_id != "all":
        sources = [source for source in sources if source.track == track_id]
    return sources


def doc_source_by_id(source_id: str | None) -> DocsSource | None:
    if not source_id:
        return None
    return next((source for source in DOCS_SOURCES if source.id == source_id), None)


def doc_source_urls(track_id: str | None = None) -> list[str]:
    return [source.url for source in active_docs_sources(track_id)]


def docs_source_options() -> list[tuple[str, str]]:
    return [
        ("all", "전체 Docs"),
        ("azure", "Azure Docs"),
        ("linux", "Linux Docs"),
        ("tool_docs", "Tool Docs"),
    ]


def urls_from_sources(sources: Iterable[DocsSource]) -> list[str]:
    return [source.url for source in sources]