fito-tui 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/README.md +88 -0
  2. package/agents/fito-case-source-planner.md +265 -0
  3. package/agents/fito-performance-reviewer.md +231 -0
  4. package/agents/fito-practice-concept-content-generator.md +318 -0
  5. package/agents/fito-practice-concept-identifier.md +482 -0
  6. package/agents/fito-practice-execution-fact-content-generator.md +299 -0
  7. package/agents/fito-practice-execution-fact-identifier.md +367 -0
  8. package/agents/fito-practice-usage-scenario-content-generator.md +331 -0
  9. package/agents/fito-practice-usage-scenario-identifier.md +397 -0
  10. package/agents/fito-subagent-selftest.md +27 -0
  11. package/agents/fito-technology-generator.md +207 -0
  12. package/agents/fito-tool-concept-content-generator.md +282 -0
  13. package/agents/fito-tool-concept-identifier.md +384 -0
  14. package/agents/fito-tool-execution-fact-content-generator.md +382 -0
  15. package/agents/fito-tool-execution-fact-identifier.md +360 -0
  16. package/agents/fito-tool-usage-scenario-content-generator.md +381 -0
  17. package/agents/fito-tool-usage-scenario-identifier.md +432 -0
  18. package/agents/fito-tutor.md +185 -0
  19. package/extensions/fito-delegate.js +539 -0
  20. package/extensions/fito-delegate.ts +691 -0
  21. package/extensions/fito-fetch-tools.js +380 -0
  22. package/extensions/fito-fetch-tools.ts +419 -0
  23. package/extensions/fito-startup.js +166 -0
  24. package/extensions/fito-startup.ts +188 -0
  25. package/package.json +56 -0
  26. package/prompts/fito-auth-refresh.md +15 -0
  27. package/prompts/fito-case-design.md +506 -0
  28. package/prompts/fito-case-edit.md +91 -0
  29. package/prompts/fito-case-generate.md +222 -0
  30. package/prompts/fito-case-open.md +124 -0
  31. package/prompts/fito-case-plan-source.md +114 -0
  32. package/prompts/fito-create-or-update-competence.md +261 -0
  33. package/prompts/fito-create-or-update-technology.md +199 -0
  34. package/prompts/fito-delete-competence.md +147 -0
  35. package/prompts/fito-evaluate.md +148 -0
  36. package/prompts/fito-fetch-urls-content.md +35 -0
  37. package/prompts/fito-generate-domain-concepts.md +85 -0
  38. package/prompts/fito-generate-execution-facts.md +85 -0
  39. package/prompts/fito-generate-usage-scenarios.md +85 -0
  40. package/prompts/fito-identify-domain-concepts.md +49 -0
  41. package/prompts/fito-identify-execution-facts.md +49 -0
  42. package/prompts/fito-identify-usage-scenarios.md +49 -0
  43. package/prompts/fito-login.md +21 -0
  44. package/prompts/fito-logout.md +14 -0
  45. package/prompts/fito-publish-case.md +266 -0
  46. package/prompts/fito-push-knowledge.md +84 -0
  47. package/prompts/fito-submit.md +208 -0
  48. package/prompts/fito-tutor.md +120 -0
  49. package/shared/case-briefing/briefing.js +221 -0
  50. package/shared/case-briefing/briefing.ts +261 -0
  51. package/shared/case-quiz/scoring.js +16 -0
  52. package/shared/case-quiz/scoring.ts +61 -0
  53. package/shared/case-validation/case-loader.js +88 -0
  54. package/shared/case-validation/case-loader.ts +106 -0
  55. package/shared/case-validation/case-schema.js +716 -0
  56. package/shared/case-validation/case-schema.ts +895 -0
  57. package/shared/competences/competence-list.js +29 -0
  58. package/shared/competences/competence-list.ts +32 -0
  59. package/shared/fito-api/README.md +192 -0
  60. package/shared/fito-api/client.js +731 -0
  61. package/shared/fito-api/client.ts +1426 -0
  62. package/shared/fito-session/credentials.js +79 -0
  63. package/shared/fito-session/credentials.ts +88 -0
  64. package/shared/fito-session/session.js +16 -0
  65. package/shared/fito-session/session.ts +35 -0
  66. package/shared/github-url/parse.js +26 -0
  67. package/shared/github-url/parse.ts +35 -0
  68. package/shared/knowledge-components/component-names.js +35 -0
  69. package/shared/knowledge-components/component-names.ts +39 -0
  70. package/shared/knowledge-components/knowledge-fetch.js +46 -0
  71. package/shared/knowledge-components/knowledge-fetch.ts +57 -0
  72. package/shared/knowledge-components/knowledge-search.js +101 -0
  73. package/shared/knowledge-components/knowledge-search.ts +144 -0
  74. package/shared/knowledge-components/push-payload.js +104 -0
  75. package/shared/knowledge-components/push-payload.ts +129 -0
  76. package/shared/knowledge-components/reference.js +24 -0
  77. package/shared/knowledge-components/reference.ts +43 -0
  78. package/shared/knowledge-components/technology-fetch.js +30 -0
  79. package/shared/knowledge-components/technology-fetch.ts +38 -0
  80. package/shared/shell-exec/exec.js +22 -0
  81. package/shared/shell-exec/exec.ts +46 -0
  82. package/skills/fito-auth/SKILL.md +68 -0
  83. package/skills/fito-auth/auth-refresh.js +23 -0
  84. package/skills/fito-auth/auth-refresh.ts +25 -0
  85. package/skills/fito-auth/browser.js +35 -0
  86. package/skills/fito-auth/browser.ts +57 -0
  87. package/skills/fito-auth/callback-server.js +152 -0
  88. package/skills/fito-auth/callback-server.ts +189 -0
  89. package/skills/fito-auth/login.js +37 -0
  90. package/skills/fito-auth/login.ts +42 -0
  91. package/skills/fito-auth/logout.js +24 -0
  92. package/skills/fito-auth/logout.ts +25 -0
  93. package/skills/fito-case-author/SKILL.md +179 -0
  94. package/skills/fito-case-author/checkout.js +222 -0
  95. package/skills/fito-case-author/checkout.ts +281 -0
  96. package/skills/fito-case-author/github-publish.js +218 -0
  97. package/skills/fito-case-author/github-publish.ts +251 -0
  98. package/skills/fito-case-author/publish-payload.js +108 -0
  99. package/skills/fito-case-author/publish-payload.ts +186 -0
  100. package/skills/fito-case-author/publish-state.js +72 -0
  101. package/skills/fito-case-author/publish-state.ts +87 -0
  102. package/skills/fito-case-author/publish-version.js +364 -0
  103. package/skills/fito-case-author/publish-version.ts +495 -0
  104. package/skills/fito-case-author/publish.js +284 -0
  105. package/skills/fito-case-author/publish.ts +394 -0
  106. package/skills/fito-case-author/semver.js +55 -0
  107. package/skills/fito-case-author/semver.ts +63 -0
  108. package/skills/fito-case-author/status-gate.js +34 -0
  109. package/skills/fito-case-author/status-gate.ts +54 -0
  110. package/skills/fito-case-author/validate.js +62 -0
  111. package/skills/fito-case-author/validate.ts +64 -0
  112. package/skills/fito-case-runner/SKILL.md +119 -0
  113. package/skills/fito-case-runner/case-component-names.js +45 -0
  114. package/skills/fito-case-runner/case-component-names.ts +65 -0
  115. package/skills/fito-case-runner/case-detail.js +20 -0
  116. package/skills/fito-case-runner/case-detail.ts +20 -0
  117. package/skills/fito-case-runner/github.js +234 -0
  118. package/skills/fito-case-runner/github.ts +287 -0
  119. package/skills/fito-case-runner/manifest.js +56 -0
  120. package/skills/fito-case-runner/manifest.ts +73 -0
  121. package/skills/fito-case-runner/open.js +175 -0
  122. package/skills/fito-case-runner/open.ts +241 -0
  123. package/skills/fito-case-runner/report.js +22 -0
  124. package/skills/fito-case-runner/report.ts +24 -0
  125. package/skills/fito-case-runner/runner.js +158 -0
  126. package/skills/fito-case-runner/runner.ts +304 -0
  127. package/skills/fito-case-runner/score-quiz-mc.js +85 -0
  128. package/skills/fito-case-runner/score-quiz-mc.ts +99 -0
  129. package/skills/fito-case-runner/submit-evaluation.js +73 -0
  130. package/skills/fito-case-runner/submit-evaluation.ts +98 -0
  131. package/skills/fito-case-runner/submit-quiz-result.js +75 -0
  132. package/skills/fito-case-runner/submit-quiz-result.ts +100 -0
  133. package/skills/fito-case-runner/submit.js +85 -0
  134. package/skills/fito-case-runner/submit.ts +111 -0
  135. package/skills/fito-case-runner/workdir.js +10 -0
  136. package/skills/fito-case-runner/workdir.ts +11 -0
  137. package/skills/fito-competence-write/SKILL.md +155 -0
  138. package/skills/fito-competence-write/create.js +64 -0
  139. package/skills/fito-competence-write/create.ts +80 -0
  140. package/skills/fito-competence-write/delete.js +136 -0
  141. package/skills/fito-competence-write/delete.ts +166 -0
  142. package/skills/fito-competence-write/display.js +20 -0
  143. package/skills/fito-competence-write/display.ts +21 -0
  144. package/skills/fito-competence-write/payload.js +96 -0
  145. package/skills/fito-competence-write/payload.ts +115 -0
  146. package/skills/fito-competence-write/update.js +155 -0
  147. package/skills/fito-competence-write/update.ts +206 -0
  148. package/skills/fito-evaluator/SKILL.md +73 -0
  149. package/skills/fito-evaluator/criterion-exec.js +64 -0
  150. package/skills/fito-evaluator/criterion-exec.ts +73 -0
  151. package/skills/fito-evaluator/evaluate-automated.js +57 -0
  152. package/skills/fito-evaluator/evaluate-automated.ts +84 -0
  153. package/skills/fito-evaluator/evaluate.js +28 -0
  154. package/skills/fito-evaluator/evaluate.ts +86 -0
  155. package/skills/fito-evaluator/report.js +112 -0
  156. package/skills/fito-evaluator/report.ts +128 -0
  157. package/skills/fito-evaluator/rubric.js +90 -0
  158. package/skills/fito-evaluator/rubric.ts +170 -0
  159. package/skills/fito-knowledge-push/SKILL.md +114 -0
  160. package/skills/fito-knowledge-push/push.js +282 -0
  161. package/skills/fito-knowledge-push/push.ts +360 -0
  162. package/skills/fito-source-ingestion/SKILL.md +77 -0
  163. package/skills/fito-source-ingestion/authoring-check.js +128 -0
  164. package/skills/fito-source-ingestion/authoring-check.ts +155 -0
  165. package/skills/fito-source-ingestion/bundle.js +198 -0
  166. package/skills/fito-source-ingestion/bundle.ts +246 -0
  167. package/skills/fito-technology-write/SKILL.md +108 -0
  168. package/skills/fito-technology-write/create.js +134 -0
  169. package/skills/fito-technology-write/create.ts +161 -0
  170. package/skills/fito-technology-write/payload.js +64 -0
  171. package/skills/fito-technology-write/payload.ts +70 -0
  172. package/skills/fito-technology-write/update.js +122 -0
  173. package/skills/fito-technology-write/update.ts +171 -0
  174. package/skills/fito-url-content-fetcher/SKILL.md +213 -0
  175. package/templates/concept-practice-content-template.md +281 -0
  176. package/templates/concept-tool-content-template.md +207 -0
  177. package/templates/execution-fact-practice-content-template.md +372 -0
  178. package/templates/execution-fact-tool-content-template.md +307 -0
  179. package/templates/usage-scenario-content-template.md +248 -0
@@ -0,0 +1,171 @@
1
+ /**
2
+ * `node update.js <payload-file> [--overview] [--version-prose]` — write the confirmed descriptions
3
+ * of a technology that already exists onto the two axes ADR-011 Decision 2 keeps apart: the
4
+ * version-agnostic overview (`PATCH /technologies/{slug}`) and the declared major line's prose
5
+ * (`PATCH /technologies/{slug}/versions/{versionSlug}`). This is the create-or-update tail of
6
+ * `/fito-create-or-update-technology` (PLAN Task 9b.7, ADR-012 Decision 5) — the only path by which
7
+ * author-confirmed prose reaches a row `create.ts` reused rather than created.
8
+ *
9
+ * The flags are what makes an update deliberate: each names one axis the author confirmed, so a run
10
+ * never overwrites prose the author did not look at. Both endpoints are enrichment and have no
11
+ * "clear it" path, so an ungrounded (`null`) or blank description is refused here rather than sent
12
+ * as a 400.
13
+ *
14
+ * `runUpdate` is the testable core (injectable client/home); `main` is the thin CLI wrapper.
15
+ */
16
+ import * as os from "node:os";
17
+ import * as path from "node:path";
18
+ import { fileURLToPath } from "node:url";
19
+
20
+ import {
21
+ FitoApiError,
22
+ createFitoApiClient,
23
+ type FitoApiClient,
24
+ type TechnologyVersion,
25
+ type WrittenTechnology,
26
+ } from "../../shared/fito-api/client.ts";
27
+ import { resolveFitoSession } from "../../shared/fito-session/session.ts";
28
+ import { loadTechnologyPayload, type TechnologyPayload } from "./payload.ts";
29
+
30
+ /** The fito-api surface this flow needs: the session lookup and the two PATCHes. */
31
+ type UpdateClient = Pick<
32
+ FitoApiClient,
33
+ "meWithRefresh" | "updateTechnologyDescription" | "updateTechnologyVersionDescription"
34
+ >;
35
+
36
+ export interface RunUpdateOptions {
37
+ /** Path to the confirmed technology payload (`technology.yaml`). */
38
+ payloadPath: string;
39
+ /** Write `technology.description` — the version-agnostic overview. */
40
+ overview?: boolean;
41
+ /** Write `version.description` — the declared major line's compatibility prose. */
42
+ versionProse?: boolean;
43
+ home?: string;
44
+ client?: UpdateClient;
45
+ }
46
+
47
+ /**
48
+ * What a run wrote: only the axes it was asked for, each carrying the row the backend read back.
49
+ * `slug` is the technology both writes address — it identifies a version-prose-only run, whose
50
+ * `TechnologyVersion` names its own major line but not the technology it hangs off.
51
+ */
52
+ export interface UpdateResult {
53
+ slug: string;
54
+ overview?: WrittenTechnology;
55
+ versionProse?: TechnologyVersion;
56
+ }
57
+
58
+ /**
59
+ * Write the named axes. Every named description is checked for substance **before** the first
60
+ * request, so a run that cannot write one axis writes neither — a half-applied update would leave
61
+ * the author guessing which half landed. Backend rejections (an unknown technology or major line →
62
+ * 404) propagate as `FitoApiError` for the caller to surface verbatim.
63
+ */
64
+ export async function runUpdate(options: RunUpdateOptions): Promise<UpdateResult> {
65
+ const home = options.home ?? os.homedir();
66
+ const client = options.client ?? createFitoApiClient();
67
+
68
+ if (!options.overview && !options.versionProse) {
69
+ throw new Error(
70
+ "Name the description to write: --overview (the version-agnostic overview), --version-prose " +
71
+ "(the declared major line), or both. An update writes what the author confirmed, not everything " +
72
+ "the payload happens to carry.",
73
+ );
74
+ }
75
+ const payload = loadTechnologyPayload(options.payloadPath);
76
+ const overview = options.overview ? requireProse(payload, "technology") : undefined;
77
+ const versionProse = options.versionProse ? requireProse(payload, "version") : undefined;
78
+
79
+ const { tokens } = await resolveFitoSession(client, home);
80
+ const slug = payload.technology.slug;
81
+
82
+ const result: UpdateResult = { slug };
83
+ if (overview !== undefined) {
84
+ result.overview = await client.updateTechnologyDescription(tokens.accessToken, slug, overview);
85
+ }
86
+ if (versionProse !== undefined) {
87
+ result.versionProse = await client.updateTechnologyVersionDescription(
88
+ tokens.accessToken,
89
+ slug,
90
+ payload.version.slug,
91
+ versionProse,
92
+ );
93
+ }
94
+ return result;
95
+ }
96
+
97
+ /**
98
+ * The description on one axis, or an actionable refusal. `null` is the generator's honest "the
99
+ * sources ground nothing here" and blank is the same gap spelled with whitespace; neither is prose
100
+ * worth putting on a field every author and learner afterwards reads, and the endpoints reject both
101
+ * anyway. The fix is the author supplementing the draft, not a request.
102
+ */
103
+ function requireProse(payload: TechnologyPayload, axis: "technology" | "version"): string {
104
+ const description = payload[axis].description;
105
+ if (description === null) {
106
+ throw new Error(
107
+ `The payload's ${axis}.description is \`null\` — the sources grounded nothing for it, and there ` +
108
+ "is no way to write an empty description. Supplement the draft with the author's own prose, " +
109
+ "then re-run.",
110
+ );
111
+ }
112
+ if (description.trim() === "") {
113
+ throw new Error(
114
+ `The payload's ${axis}.description is blank — there is no way to write an empty description. ` +
115
+ "Supplement the draft with the author's own prose, then re-run.",
116
+ );
117
+ }
118
+ return description;
119
+ }
120
+
121
+ /** The success line: which axes were written, on which technology and major line. */
122
+ export function describeUpdate(result: UpdateResult, payloadPath: string): string {
123
+ const written: string[] = [];
124
+ if (result.overview) written.push(`the ${result.slug} overview`);
125
+ if (result.versionProse) written.push(`the ${result.slug}@${result.versionProse.slug} major line`);
126
+ return `✓ Updated ${written.join(" and ")} ← ${payloadPath}`;
127
+ }
128
+
129
+ const USAGE = "Usage: node update.js <payload-file> [--overview] [--version-prose]";
130
+
131
+ function parseArgs(argv: string[]): RunUpdateOptions | undefined {
132
+ const [payloadPath, ...rest] = argv;
133
+ if (!payloadPath) return undefined;
134
+ const options: RunUpdateOptions = { payloadPath };
135
+ for (const flag of rest) {
136
+ if (flag === "--overview") {
137
+ options.overview = true;
138
+ } else if (flag === "--version-prose") {
139
+ options.versionProse = true;
140
+ } else {
141
+ return undefined;
142
+ }
143
+ }
144
+ return options;
145
+ }
146
+
147
+ async function main(): Promise<void> {
148
+ const options = parseArgs(process.argv.slice(2));
149
+ if (!options) {
150
+ console.error(USAGE);
151
+ process.exitCode = 1;
152
+ return;
153
+ }
154
+ try {
155
+ console.log(describeUpdate(await runUpdate(options), options.payloadPath));
156
+ } catch (error) {
157
+ if (error instanceof FitoApiError) {
158
+ console.error(`✗ Update failed (${error.status}): ${error.message}`);
159
+ } else {
160
+ console.error(`✗ ${error instanceof Error ? error.message : String(error)}`);
161
+ }
162
+ process.exitCode = 1;
163
+ }
164
+ }
165
+
166
+ /** Only auto-invoke the CLI when run directly (`node update.js …`), not when imported. */
167
+ const entry = process.argv[1];
168
+ const isMainModule = !!entry && path.resolve(entry) === fileURLToPath(import.meta.url);
169
+ if (isMainModule) {
170
+ void main();
171
+ }
@@ -0,0 +1,213 @@
1
+ ---
2
+ name: fito-url-content-fetcher
3
+ description: >
4
+ Use when processing a list of URLs to fetch content
5
+ (including YouTube transcripts), clean it, and save
6
+ as raw markdown files — the fallback / supplemental
7
+ ingestion source for the Fito knowledge pipeline
8
+ (the preferred source is the case's own source tree
9
+ via fito-source-ingestion). Driven by the
10
+ /fito-fetch-urls-content command.
11
+ allowed-tools: bash
12
+ ---
13
+
14
+ # Fito URL Content Fetcher
15
+
16
+ Process URLs from a file by writing and executing Python
17
+ scripts. Do NOT fetch the URLs one by one with a built-in
18
+ fetch tool — it doesn't support batch processing from files.
19
+
20
+ ## Leave no trace
21
+
22
+ The only thing a run leaves in the working directory is the
23
+ documents it writes under
24
+ `./output/1-ingest/extracted_links_content/`. Every
25
+ temporary file it creates on the way — a `.venv/`, a
26
+ generated `fetch_urls.py`, any subtitle or HTML
27
+ intermediate — lives in a scratch workspace outside the
28
+ working directory, and is removed when the run ends. This
29
+ is absolute: it holds regardless of how many URLs the list
30
+ carries, and on the failure path exactly as on the success
31
+ path.
32
+
33
+ Whatever the working directory already held is none of the
34
+ run's business — a source clone, sibling pipeline stages
35
+ under `output/`, the URL list itself: the run neither adds
36
+ to them nor removes them.
37
+
38
+ Create the workspace with `mktemp -d` and carry the path it
39
+ prints forward literally, in place of `<workspace>` below.
40
+ Each `bash` call is a fresh shell, so a variable set in one
41
+ call is empty in the next, and a `trap … EXIT` would delete
42
+ the workspace on the way out of the call that created it.
43
+
44
+ ```bash
45
+ mktemp -d
46
+ # → this run's workspace; substitute what it printed for <workspace>
47
+
48
+ # a PEP 668-protected box refuses a bare `pip install`;
49
+ # add any fallback package the same way
50
+ python3 -m venv <workspace>/venv
51
+ <workspace>/venv/bin/pip install trafilatura youtube-transcript-api
52
+
53
+ # write the fetch script to <workspace>/fetch_urls.py, then run it from
54
+ # the working directory — never `cd` into the workspace, or the script's
55
+ # ./output/… paths move with you
56
+ <workspace>/venv/bin/python <workspace>/fetch_urls.py urls.txt
57
+
58
+ # the run's last act, before the summary — failed runs included
59
+ rm -rf <workspace>
60
+ ```
61
+
62
+ ## URL Detection
63
+
64
+ - YouTube: match `youtube.com/watch`, `youtu.be/`,
65
+ `youtube.com/shorts/`
66
+ - Everything else: treat as a web page
67
+
68
+ ## Fetching
69
+
70
+ ### YouTube Videos
71
+ Use the `youtube-transcript-api` Python package. Extract
72
+ the transcript text, video title, and channel name.
73
+
74
+ Accept transcripts in any available language. Do not
75
+ attempt to translate or restrict to English. If
76
+ multiple languages are available, prefer manual
77
+ captions over auto-generated ones.
78
+
79
+ If no transcript is available at all, fall back to
80
+ auto-generated subtitles, landing them in the workspace:
81
+
82
+ ```bash
83
+ <workspace>/venv/bin/yt-dlp --write-auto-sub --skip-download -P <workspace> <url>
84
+ ```
85
+
86
+ Then read and clean the resulting .vtt file there
87
+ (deduplicate overlapping subtitle lines).
88
+
89
+ ### Web Pages
90
+ Use a content-extraction library (e.g. `trafilatura`,
91
+ `readability-lxml`) to fetch AND extract the main
92
+ content in a single step. These libraries handle
93
+ boilerplate removal automatically.
94
+
95
+ After extraction, validate that the result is
96
+ substantive: it must contain more than 200 characters
97
+ of actual content (not just a title, a single code
98
+ block, or a short fragment). If the extracted content
99
+ appears incomplete or suspiciously short relative to
100
+ what the page title suggests, the page is likely
101
+ JavaScript-rendered and the initial extraction missed
102
+ the real content.
103
+
104
+ For JS-rendered pages, fall back to these approaches
105
+ in order:
106
+ 1. `requests-html` with `.html.render()` to execute
107
+ JavaScript, then extract with trafilatura from
108
+ the rendered HTML
109
+ 2. `playwright` or `selenium` to get the fully
110
+ rendered page, then extract with trafilatura
111
+ from the rendered HTML
112
+
113
+ Only fall back to `requests` + `beautifulsoup4` if
114
+ all extraction methods fail.
115
+
116
+ ## Cleaning Rules
117
+
118
+ ### Strip extraction library metadata
119
+
120
+ Content-extraction libraries like trafilatura often
121
+ prepend their own metadata block at the top of the
122
+ extracted text. This block typically looks like:
123
+
124
+ ---
125
+ title: ...
126
+ url: ...
127
+ hostname: ...
128
+ sitename: ...
129
+ date: ...
130
+ tags: [...]
131
+ ---
132
+
133
+ This metadata block MUST be detected and completely
134
+ removed from the content before writing the file.
135
+ It will be redundant with the frontmatter the skill
136
+ generates. Strip everything from the opening `---`
137
+ to the closing `---` if it appears at the very start
138
+ of the extracted content and contains key-value pairs
139
+ like `title:`, `url:`, `hostname:`, or `sitename:`.
140
+
141
+ ### Content cleanup
142
+
143
+ After removing the extraction metadata, ensure the
144
+ output contains ONLY:
145
+ - The main article/transcript text
146
+ - Heading hierarchy (as markdown ##)
147
+ - Inline links (as markdown [text](url))
148
+ - Lists, blockquotes, code blocks in markdown format
149
+
150
+ Remove if still present after extraction:
151
+ - Nav, footer, sidebar, ads, cookie banners
152
+ - Social buttons, related links, signup blocks
153
+ - Excessive blank lines
154
+
155
+ For YouTube transcripts specifically:
156
+ - Remove duplicate/overlapping lines from auto-captions
157
+ - Break into natural paragraphs (don't leave it as
158
+ one giant wall of text — insert paragraph breaks
159
+ at topic shifts or pauses)
160
+
161
+ Do NOT add any notes, warnings, or disclaimers about
162
+ the content language, transcript type (auto-generated
163
+ vs manual), or extraction method. Save the content
164
+ as-is without commentary.
165
+
166
+ ## Output
167
+
168
+ Save each result to:
169
+ `./output/1-ingest/extracted_links_content/{slugified-title}.md`
170
+
171
+ Create the directory if it doesn't exist.
172
+
173
+ ### Summary generation
174
+
175
+ After cleaning the content, generate a summary of
176
+ the actual page content in your own words. The summary
177
+ must be a coherent sentence or two describing what
178
+ the page is about, max 50 words. Do NOT truncate
179
+ the content or copy its first lines — write an
180
+ original summary.
181
+
182
+ ### File structure
183
+
184
+ Each file must follow this structure:
185
+
186
+ ---
187
+ source_url: {URL}
188
+ title: {title}
189
+ type: youtube | webpage
190
+ fetched_at: {ISO 8601}
191
+ author: {if available}
192
+ summary: >
193
+ {Your original 50-word-max summary of the
194
+ cleaned content}
195
+ ---
196
+
197
+ # {Title}
198
+
199
+ {cleaned content — with NO metadata block
200
+ from the extraction library}
201
+
202
+ ### Error logging
203
+
204
+ Log failures to
205
+ `./output/1-ingest/extracted_links_content/_errors.md`
206
+ with the URL and error reason.
207
+
208
+ Only log actual failures — URLs that produced no
209
+ output file. Do NOT log successful extractions in
210
+ a different language as errors or partial failures.
211
+ A transcript in any language is a success.
212
+
213
+ Skip duplicate URLs. Use 15s timeout per web request.
@@ -0,0 +1,281 @@
1
+ # Concept Practice Content Template
2
+
3
+ This template is the per-field authoring guidance the `fito-practice-concept-content-generator`
4
+ agent follows when producing a Concept knowledge component's `content` for a **practice** —
5
+ a technique, methodology, discipline, architectural approach, or heuristic. It mirrors the
6
+ **registered `ConceptTemplate` field-schema** (v1.0.0, the practice variant) in the backend
7
+ Knowledge Repository — the authoritative structure the generated `content` map must conform
8
+ to. Each section below corresponds to one registered field; if this file and the registered
9
+ schema ever disagree on structure, the registered schema wins.
10
+
11
+ The practice variant differs from the tool one in exactly one field. Where the tool row
12
+ carries `code_example` ("Code Example"), this row carries `application_example` ("Example in
13
+ an Application"), reusing the key and label the practice execution-fact row already uses. The
14
+ reason is not cosmetic: a registered label is rendered as the section heading a learner reads,
15
+ and a practice's terms are not all embodied in code. A heading promising code over a
16
+ definition-of-done checklist is a false claim, and it invites a worker to satisfy it by
17
+ inventing code the sources never showed. The other eight fields, their types and their
18
+ requirements are identical to the tool row.
19
+
20
+ Two levels of structure must not be conflated:
21
+
22
+ - **Field structure (Level A)** — `content` is a map of the named fields below, each
23
+ with a type (`TEXT` or `LIST`) and a requirement. It is **not** markdown.
24
+ - **Field value (Level B)** — each `TEXT` field's value is a **markdown fragment**;
25
+ each `LIST` field's value is a list of markdown fragments. Markdown is the rich-text
26
+ format *inside* a field — it never defines the field structure.
27
+
28
+ Markdown rules for every field value: fenced code blocks always carry a language
29
+ info-string (```` ```text ```` for a process artifact); **no in-field H1** (the component's
30
+ `name` is the H1 — internal headings demote to H3 or below); no raw/inline HTML; component
31
+ cross-references stay plain markdown text (e.g. `concept:hexagonal-architecture.port`), not
32
+ links.
33
+
34
+ All nine fields are REQUIRED and must be non-blank, in the order listed below. This schema
35
+ has no trigger-controlled fields and no control field, so every field is emitted every time.
36
+
37
+ ## What the Fields Are Carrying
38
+
39
+ The identifier settled what a practice domain concept is, and every field below serves that
40
+ claim: a **term the practice's own material relies on the reader having already fixed**,
41
+ drawn from two sources — **borrowed** ideas the practice takes a position on, and **coined**
42
+ roles, artifacts, structures and occasions it names into existence — and passing two checks:
43
+ it **fixes a meaning** rather than asserting a constraint, and it has **a referent a reader
44
+ could point at**.
45
+
46
+ Two values from the identify record govern several fields below and are named where they do:
47
+
48
+ - **`origin`** (`borrowed` | `coined`) — whether the term has a life outside this practice to
49
+ explain, or is the practice's own coinage to define from scratch.
50
+ - **`embodiment`** (`code` | `process` | `none`) — where a developer would find the term made
51
+ concrete in an application of the practice. It is the identifier's reading of the evidence
52
+ it cited, not a judgment to revisit while writing.
53
+
54
+ ## Fields
55
+
56
+ ### 1. `tl_dr` (TEXT) — TL;DR
57
+
58
+ A 2–3 sentence standalone summary that lets a developer decide in seconds whether
59
+ this content is relevant. It should convey: what the term names, why a reader of the
60
+ practice's material needs it fixed, and the single most important takeaway.
61
+
62
+ Write it as a plain paragraph — no bullet points, no headings, no cross-references
63
+ to other fields. A reader who reads only this field should walk away able to recognize
64
+ the thing the term names.
65
+
66
+ **Quality gate**: If the TL;DR could apply to a different concept with only minor
67
+ word changes, it is too generic. Rewrite it.
68
+
69
+ ### 2. `definition` (TEXT) — Definition
70
+
71
+ A precise statement of what the term names. This is the field the practice-side inclusion
72
+ test is made of: fixing a meaning *is* what qualifies a concept, so this field carries more
73
+ of the claim here than it does on the tool side. Write in 2–3 paragraphs:
74
+
75
+ - **Paragraph 1 — Core definition**: what the word names, stated precisely and
76
+ self-containedly. For a **coined** term, define it in the practice's own structure —
77
+ the practice is the only authority there is. For a **borrowed** term, define the idea as
78
+ its originating field holds it, then state the position this practice takes on it.
79
+ - **Paragraph 2 — Elaboration**: scope and boundaries. What counts as one and what does
80
+ not? What distinguishes it from the term next to it in the practice's vocabulary (a port
81
+ from an adapter, a sprint from a release)? Definitional distinctions only — not usage,
82
+ not context.
83
+ - **Paragraph 3 — Contested readings (optional)**: include only when rival authors within
84
+ the practice genuinely fix the term differently (classical versus mockist *unit*). State
85
+ the declared formulation's reading as the definition and name the divergence as contested.
86
+ Omit entirely when the term is settled — do not pad this paragraph.
87
+
88
+ **Quality gate — the misuse/violation check.** A definition can be **misused** (the wrong
89
+ thing called by this name) but never **broken**: there is no state of a codebase or process
90
+ that contradicts it. Read back what you wrote and ask what an application that got this wrong
91
+ actually did. If the answer is "it built the thing correctly and then broke a relation", you
92
+ have written an execution fact wearing a noun, and it belongs to
93
+ `fito-practice-execution-fact-identifier`'s catalog, not to this component. Rewrite the field
94
+ as what the term names, and let the constraint be someone else's.
95
+
96
+ **FORBIDDEN in this field**:
97
+ - Do NOT state the practice's rules about the term here. "A port must never be referenced by
98
+ the application core" is a constraint; "a port is an interface owned by the application
99
+ core" is a definition.
100
+ - Do NOT define a coined term by the framework that happens to demonstrate it. An annotation
101
+ is that tool's construct; the term is the practice's.
102
+
103
+ ### 3. `contextualization` (TEXT) — Contextualization
104
+
105
+ Where this term sits and why the practice needed it fixed. The `origin` value decides which
106
+ way this field faces, and both readings have a sharp answer:
107
+
108
+ - **Borrowed** — orient the reader in the term's **originating field**: which discipline it
109
+ comes from (project management, software design, systems thinking, software quality), what
110
+ broader problem it addresses there, and what this practice adopted it *for*.
111
+ - **Coined** — orient the reader in **the practice's own structure**: which part of the
112
+ practice the term belongs to (its structural vocabulary, its process roles, its planning
113
+ artifacts), what the practice could not say without it, and why the originator named it
114
+ rather than reaching for an existing word.
115
+
116
+ 1–2 paragraphs. The goal is orientation, not a history of the practice.
117
+
118
+ ### 4. `terminology_mapping` (TEXT) — Terminology Mapping
119
+
120
+ How this practice's use of the word relates to the word's use elsewhere. The field earns its
121
+ place under both origins, and the honest content differs:
122
+
123
+ - **Borrowed** — the term often arrives **renamed or redefined**. Scrum's *done* is not the
124
+ everyday sense; TDD's *unit* is contested and means different things to different schools.
125
+ State the standard term, state what this practice made of it, and name the divergence
126
+ plainly: it is exactly what a developer coming from elsewhere gets wrong.
127
+ - **Coined** — the honest content is the **false friend**. Outside this practice the word
128
+ usually already names something else: a *port* is a hardware connector or a network
129
+ endpoint, a *sprint* is a short run, a *story* is a piece of fiction. Say what the word
130
+ does **not** mean here, so a reader carrying the other sense drops it.
131
+
132
+ This field may be brief (1–2 sentences) when the practice's usage is unremarkable, or longer
133
+ when the divergence is the point. Never leave it thin by writing that the practice uses the
134
+ term directly — for a practice term there is almost always either a redefinition or a false
135
+ friend to name.
136
+
137
+ ### 5. `application_example` (TEXT) — Example in an Application
138
+
139
+ One markdown fragment: the smallest honest demonstration of the term as a developer would
140
+ meet it in an application of the practice. The goal is to make the term **recognizable** —
141
+ after this field, a reader should be able to look at their own codebase or process and sort
142
+ what is one from what is not.
143
+
144
+ **Rules by `embodiment`** — the identify record's value governs, and it fixes what is
145
+ available to you:
146
+
147
+ - **`code`** — real, minimal code in a language-tagged fenced code block, showing the thing
148
+ the term names as it appears in a codebase. A contrasting near-miss may follow when the
149
+ contrast is what makes the term recognizable (an interface that is a port beside one that
150
+ is not).
151
+ - **`process`** — the process artifact that **is** an instance of the term, in a fenced block
152
+ (```` ```text ```` or the artifact's own format): a definition-of-done checklist, a sprint
153
+ board snapshot, a retrospective note, a review record. Show the artifact, then say what
154
+ makes it one.
155
+ - **`none`** — the term has no single thing to point at, so show it **in use**: a short worked
156
+ passage applying the term to a concrete situation, or a contrast pair (one thing the term
157
+ covers, one it does not, and what separates them). Prose here is the honest answer, not a
158
+ shortfall.
159
+
160
+ Requirements:
161
+ - **Minimal**: only what is necessary to make the term recognizable. Strip everything else.
162
+ - **Annotated**: *why* comments, not *what* comments — connect the example to the term.
163
+ - **Practice-level takeaway**: a demonstrating tool in the example is scaffolding. After the
164
+ block, 2–4 sentences on what in the example *is* the thing the term names, stated over the
165
+ practice's own vocabulary — never over the scaffolding's API. Do not restate the comments.
166
+
167
+ **FORBIDDEN in this field**:
168
+ - Do NOT fabricate code for a term whose embodiment is `process` or `none`. Forcing code
169
+ where the practice puts nothing invents what the sources never showed — the exact failure
170
+ the label change to "Example in an Application" exists to stop inviting.
171
+ - Do NOT fabricate a process artifact for a `code`-embodied term either. The rule runs both
172
+ ways; the artifact must be the one the practice actually produces.
173
+ - Do NOT re-label the embodiment to suit the example you would rather write. A value the
174
+ record contradicts is **reported**, never quietly changed: re-labelling `process` to `code`
175
+ is how invented code gets licensed rather than committed, and no later check catches it.
176
+ - Do NOT let the example demonstrate a framework's construct instead of the practice's term.
177
+
178
+ ### 6. `practical_relevance` (TEXT) — Practical Relevance
179
+
180
+ When and why a developer applying this practice needs the term fixed. This field
181
+ answers: "Why should I care about this in my day-to-day work?" Address:
182
+
183
+ - In which concrete situations does having this term fixed decide something?
184
+ - What judgment does it let a developer make that they could not make without it?
185
+ - What goes wrong when the term is carried loosely — which of the practice's rules becomes
186
+ unreadable, or which thing gets built under the wrong name?
187
+
188
+ Frame this from the developer's working perspective, not from an academic one.
189
+
190
+ ### 7. `misconceptions_and_pitfalls` (TEXT) — Common Misconceptions and Pitfalls
191
+
192
+ Things developers frequently get wrong about this term. One markdown fragment
193
+ holding every entry, each under an **H3 title**, following the pattern:
194
+
195
+ - **Misconception**: what people commonly believe or assume
196
+ - **Reality**: what is actually true
197
+ - **Why it matters**: what goes wrong in practice if the misconception is not corrected
198
+
199
+ The highest-value entries on the practice side are the two the term's own sources create:
200
+
201
+ - **The false friend carried in** — the reader applies the word's outside meaning (a *port*
202
+ as a network endpoint), and every rule stated over the term then reads wrong.
203
+ - **The redefined borrowing** — the reader applies the standard meaning of a term the
204
+ practice deliberately narrowed or widened (*done*, *unit*, *customer*), and conforms to the
205
+ wrong bar while believing they conform.
206
+
207
+ Also genuine confusions with the neighboring term in the practice's own vocabulary.
208
+
209
+ This field is required. Include only misconceptions that are practically significant.
210
+ If no meaningful misconceptions exist, the field's value is the single statement:
211
+ "No significant misconceptions identified for this concept." Do not invent weak entries.
212
+
213
+ ### 8. `key_characteristics` (LIST) — Key Characteristics
214
+
215
+ The essential attributes that let a reader sort what is one from what is not — this field is
216
+ the identifier's **referent check** made concrete, and it is where an abstract term earns its
217
+ keep. A LIST field: **one markdown fragment per characteristic**, each shaped
218
+ `**Characteristic**: description`. Each characteristic should be:
219
+
220
+ - **Distinctive**: it separates this term from the one beside it in the practice's vocabulary
221
+ - **Observable**: a reader can check it against a real codebase or process to decide whether the
222
+ thing in front of them **is one** — never whether it is being done correctly
223
+ - **Relevant**: it matters when applying the practice, not only when describing it
224
+
225
+ Do not exhaustively enumerate. Focus on what a reader would use to decide, in front of a real
226
+ artifact, whether they are looking at one of these.
227
+
228
+ **Quality gate — the misuse/violation check, run once per characteristic.** §2 runs it over the
229
+ definition; this is the field where it gets skipped, and where an attribute slides into a rule. A
230
+ characteristic states part of what the term means, so a conforming codebase or process can
231
+ **misuse** it (the wrong thing called by this name) but never **break** it. If a team could name
232
+ the thing correctly and still fail the characteristic, you have written an execution fact: it
233
+ belongs to `fito-practice-execution-fact-identifier`'s catalog, and what goes here in its place is
234
+ what the term names. Nothing downstream catches this one — the repository's duplicate check only
235
+ ever compares a concept with another concept, so a restated fact ships under this term's canonical
236
+ id.
237
+
238
+ The pair, both written for the same term (*acceptance test*): "**Authored before implementation**:
239
+ written collaboratively during specifying, not executed as a post-development gate" is
240
+ **breakable** — a team can call something an acceptance test and write it afterwards — so it
241
+ states a rule the practice makes, not what the word names. "**Synonymous with specification**: a
242
+ refined specification with examples *is* the acceptance test — one artifact, not two" fixes an
243
+ identity: misusable (two artifacts called one), never broken.
244
+
245
+ ### 9. `related_concepts` (TEXT) — Related Concepts
246
+
247
+ A narrative — not a flat list — that explains how this term relates to the rest of the
248
+ practice's vocabulary. Practice vocabularies are densely interlinked, and a term is usually
249
+ unreadable without its neighbors (port, adapter and application core define one another), so
250
+ this field carries real weight here. For each related concept, state the nature of the
251
+ relationship:
252
+
253
+ - Parent/child (specialization/generalization)
254
+ - Sibling (the term it is most often paired with, or its counterpart)
255
+ - Prerequisite (must be fixed before this one can be)
256
+ - Commonly confused (two terms of this practice that look alike and differ in a key way)
257
+
258
+ Where a related concept exists as a live component in the backend Knowledge
259
+ Repository, reference it by its canonical id as plain markdown text (e.g.
260
+ "…is implemented by `concept:hexagonal-architecture.driven-adapter`…"). Concepts not (yet) in
261
+ the repository are named in prose — including the ones identified in the same run, which
262
+ almost always exist for a practice whose vocabulary is being ingested as a set. Never
263
+ reference identify-pipeline numeric ids — the component must stand alone in the Knowledge
264
+ Repository.
265
+
266
+ ## Field Order
267
+
268
+ Fields appear in this fixed order in the `content` map:
269
+
270
+ 1. `tl_dr`
271
+ 2. `definition`
272
+ 3. `contextualization`
273
+ 4. `terminology_mapping`
274
+ 5. `application_example`
275
+ 6. `practical_relevance`
276
+ 7. `misconceptions_and_pitfalls`
277
+ 8. `key_characteristics`
278
+ 9. `related_concepts`
279
+
280
+ Every field is mandatory and always present — this schema has no trigger-controlled
281
+ fields and no control field.