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,307 @@
1
+ # Execution Fact Tool Content Template
2
+
3
+ This template is the per-field authoring guidance the `fito-tool-execution-fact-content-generator`
4
+ agent follows when producing an ExecutionFact knowledge component's `content`. It mirrors
5
+ the **registered `ExecutionFactTemplate` field-schema** (v1.0.0) in the backend Knowledge
6
+ Repository — the authoritative structure the generated `content` map must conform to.
7
+ Each section below corresponds to one registered field; if this file and the registered
8
+ schema ever disagree on structure, the registered schema wins.
9
+
10
+ Two levels of structure must not be conflated:
11
+
12
+ - **Field structure (Level A)** — `content` is a map of the named fields below, each
13
+ with a type (`TEXT` or `LIST`) and a requirement. It is **not** markdown.
14
+ - **Field value (Level B)** — each `TEXT` field's value is a **markdown fragment**;
15
+ each `LIST` field's value is a list of markdown fragments. Markdown is the rich-text
16
+ format *inside* a field — it never defines the field structure.
17
+
18
+ Markdown rules for every field value: fenced code blocks always carry a language
19
+ info-string; **no in-field H1** (the component's `name` is the H1 — internal headings
20
+ demote to H3 or below); no raw/inline HTML; component cross-references stay plain
21
+ markdown text (e.g. `execution-fact:nextjs.props-embedded-in-initial-html`), not links.
22
+
23
+ Every **mandatory** field must be present and non-blank, in the order listed below.
24
+ The two **trigger-controlled** fields are included only when the execution fact's
25
+ categories match the specified trigger conditions — and when included, they MUST be
26
+ fully populated (never blank) **and** listed in the `optional_sections_included`
27
+ control field. Populating without listing, or listing without populating, is a
28
+ contradiction and is forbidden.
29
+
30
+ ## The Component Name
31
+
32
+ The component's `name` (metadata — rendered as the page H1, never repeated inside a
33
+ field value) must be a **proper, readable English sentence** that summarizes the
34
+ execution fact. It is NOT a slug conversion and NOT a copy of the fact statement.
35
+
36
+ Derive the name from the fact statement, making it concise and human-readable.
37
+ The goal is that a developer scanning a list of names understands immediately
38
+ what the fact is about.
39
+
40
+ Examples of BAD names (from slug conversion):
41
+ - "Delivers Html Chunks Browser"
42
+ - "Error File Route Level"
43
+ - "Server Runs Getserversideprops Function"
44
+
45
+ Examples of GOOD names (readable, informative):
46
+ - "Next.js Streams HTML Chunks Progressively as Server Data Resolves"
47
+ - "error.tsx Catches Route-Level Errors; ErrorBoundary Catches Component-Level Errors"
48
+ - "getServerSideProps Runs on Every Request Before the Page is Sent to the Browser"
49
+
50
+ ## Mandatory Fields
51
+
52
+ ### 1. `tl_dr` (TEXT) — TL;DR
53
+
54
+ A 2–3 sentence standalone summary that lets a developer decide in seconds whether
55
+ this execution fact is relevant. It should convey: what construct(s) are involved,
56
+ what happens at runtime, and the single most important takeaway.
57
+
58
+ Write it as a plain paragraph — no bullet points, no headings, no cross-references
59
+ to other fields. Generated **last** by the distiller pass.
60
+
61
+ **Quality gate**: If the TL;DR could apply to a different execution fact with only
62
+ minor word changes, it is too generic. Rewrite it.
63
+
64
+ **FORBIDDEN**:
65
+ - Do NOT end the TL;DR with "Key constructs: X, Y" or any similar construct list.
66
+ - Do NOT simply restate the fact statement verbatim. Synthesize and expand.
67
+ - Do NOT write a generic filler sentence like "Understanding this fact is critical
68
+ for architecting applications."
69
+
70
+ ### 2. `definition` (TEXT) — Definition
71
+
72
+ A precise, declarative explanation of the execution fact in narrative form. Write
73
+ in exactly two paragraphs:
74
+
75
+ - **Paragraph 1 — What happens**: State the execution fact as a behavioral claim,
76
+ written as authoritative reference documentation. This paragraph must reference
77
+ ALL primary constructs involved — types, methods, properties, parameters, or
78
+ annotations — woven naturally into the explanation. The constructs appear because
79
+ you are explaining the behavior that involves them, not because you are listing them.
80
+ Do NOT copy the fact statement verbatim. Expand it: add precision, reference
81
+ the constructs by name, and explain the mechanism.
82
+
83
+ - **Paragraph 2 — Why and when**: Elaborate on the conditions under which the fact
84
+ holds. Address preconditions, environment constraints, and practical significance.
85
+ If the fact is version-specific, state the version constraint here. If the fact
86
+ has known edge cases or boundary conditions, mention them. Connect the behavioral
87
+ claim to its practical consequences.
88
+
89
+ **FORBIDDEN in this field**:
90
+ - Do NOT write "The primary constructs involved are X, Y, Z." Constructs must be
91
+ woven into the narrative, not announced in a list.
92
+ - Do NOT copy the fact statement as Paragraph 1. The statement is your starting
93
+ point; expand it with precision and mechanism.
94
+ - Do NOT write "This behavior applies in the context of [tool] [version]." when the
95
+ version is already in the component metadata. Mention version only when it matters
96
+ for understanding the behavior.
97
+ - Do NOT write "Understanding this execution fact is critical for properly
98
+ architecting applications..." or any similar generic filler. Every sentence must
99
+ carry specific information about this specific fact.
100
+
101
+ ### 3. `primitives_involved` (LIST) — Primitives Involved in the Execution
102
+
103
+ A concise definition/explanation of each **primary** construct involved in the
104
+ execution fact. Primary constructs are those central to the fact. Trivially obvious
105
+ constructs (primitive types, universally known base classes like `Object` or `String`)
106
+ may be skipped at the agent's judgment for intermediate/advanced audiences.
107
+
108
+ A LIST field: **one markdown fragment per construct**, ordered by importance to the
109
+ execution fact (not alphabetically), each shaped:
110
+
111
+ ```markdown
112
+ **`constructName`** (*kind*) — Definition: what this construct IS and what it does
113
+ in the tool's API — a genuine, informative definition, as you would find in a
114
+ dictionary or API reference.
115
+
116
+ **Role in this fact**: how this specific construct participates in the execution
117
+ fact being documented. Be specific: what does the construct do or produce in the
118
+ context of this fact?
119
+ ```
120
+
121
+ The *kind* is one of: `type`, `method`, `property`, `parameter`, `annotation/decorator`,
122
+ `configuration`, `event`, or `other`. The definition part must cover what the construct
123
+ is, what it represents, what it does, and what its role is in the tool's design. Do NOT
124
+ say that it "participates in" or "enables" the execution fact — that is what the role
125
+ line is for.
126
+
127
+ **FORBIDDEN in construct definitions**:
128
+ - Do NOT write "[Construct] is the primary construct enabling the execution fact
129
+ described above." That is a self-reference to the component, not a definition.
130
+ - Do NOT open the definition with "In this execution fact, [Construct]..." — the role
131
+ line handles the fact-specific context.
132
+ - Do NOT write "[Construct] is a method that triggers or participates in this
133
+ behavior." — that is a circular placeholder, not a definition.
134
+ - Do NOT write "[Construct] is a React or Next.js API construct central to this
135
+ behavior." — that says nothing about what the construct actually is.
136
+ - Do NOT write "[Construct] is a configuration parameter in this API." — define
137
+ what the parameter DOES, not just that it is a parameter.
138
+
139
+ Good examples:
140
+ - `getServerSideProps`: "An async function exported from a Next.js Pages Router
141
+ page file. Next.js calls it on the server for every incoming request to that
142
+ page, before rendering the component. Its return value (`{ props }`) is passed
143
+ as props to the page component. It has access to the request context (`req`,
144
+ `res`, `query`) and can perform server-side data fetching, authentication checks,
145
+ and redirects."
146
+ - `Suspense`: "A React built-in component that lets you display a fallback UI while
147
+ its children are loading. It acts as an error boundary counterpart for asynchronous
148
+ rendering: when a child component suspends (by throwing a Promise), Suspense
149
+ catches it and renders the fallback instead. In Next.js App Router, it is the
150
+ foundation of streaming SSR."
151
+
152
+ ### 4. `code_example` (TEXT) — Code Example
153
+
154
+ One markdown fragment: the smallest possible source code snippet that demonstrates the
155
+ execution fact in practice using the tool, in a **language-tagged fenced code block**.
156
+ The goal is to make the behavioral claim **observable**.
157
+
158
+ Rules by abstraction level:
159
+ - **Low/mid-level facts**: Real, executable code is mandatory.
160
+ - **High-level facts**: Real code is strongly preferred. Conceptual illustration is
161
+ allowed only when no single snippet can capture the fact (use a ```` ```text ````
162
+ fence and note in the fragment why real code is not feasible).
163
+
164
+ Requirements:
165
+ - **Minimal**: Only what is necessary to illustrate the fact.
166
+ - **Annotated**: *Why* comments, not *what* comments.
167
+ - **Version-consistent**: Valid for the specified tool version.
168
+ - After the code block: 2–4 sentences on what the code shows and how it confirms
169
+ the behavioral claim. Do not restate the inline comments. Add a one-line
170
+ prerequisites note when setup is needed.
171
+
172
+ ### 5. `related_execution_facts` (TEXT) — Related Execution Facts
173
+
174
+ A narrative — not a flat list — discussing related execution facts and how they
175
+ technically compose with or differ from this one.
176
+
177
+ For each related fact, state the **specific relationship type**:
178
+ - **Prerequisite**: Must hold before this fact applies
179
+ - **Consequence**: Follows from or is triggered by this fact
180
+ - **Alternative**: A different way to achieve a similar effect
181
+ - **Commonly confused**: Appears similar but differs in a key way
182
+ - **Complementary**: Works together with this fact in typical usage
183
+ - **Overrides**: Supersedes this fact under certain conditions
184
+
185
+ Where a related fact exists as a live component in the backend Knowledge Repository,
186
+ reference it by its canonical id as plain markdown text; otherwise describe the
187
+ behavior in prose. Never reference identify-pipeline ids — the component must stand
188
+ alone in the Knowledge Repository.
189
+
190
+ **FORBIDDEN in this field**:
191
+ - Do NOT use "related" as a relationship type — every relationship must be one of
192
+ the specific types listed above.
193
+ - Do NOT write the narrative as a bulleted list of truncated statements. Write real
194
+ prose that explains HOW the facts technically connect.
195
+ - Do NOT end with generic filler like "Understanding how these facts compose helps
196
+ in architecting efficient applications." — every sentence must carry specific
197
+ technical content.
198
+ - Do NOT write "Other execution facts address related aspects..." as a substitute
199
+ for actual references.
200
+
201
+ Good example of a `related_execution_facts` narrative:
202
+ "A direct prerequisite is that a Suspense boundary containing pending data renders
203
+ its fallback (`execution-fact:nextjs.suspense-renders-fallback-while-pending`) —
204
+ this fact is the mechanism that creates those Suspense boundaries automatically from
205
+ `loading.tsx`, so that fact explains what happens inside the boundary this one
206
+ creates. The downstream consequence is how the HTML chunks actually arrive at the
207
+ browser and how React hydrates them as they land."
208
+
209
+ ### 6. `misconceptions_and_pitfalls` (TEXT) — Common Misconceptions and Pitfalls
210
+
211
+ Things developers frequently get wrong about this execution fact. One markdown
212
+ fragment holding every entry, each under an **H3 title**, following the pattern:
213
+
214
+ - **Misconception**: What developers commonly believe or assume
215
+ - **Reality**: What is actually true according to the tool's behavior
216
+ - **Why it matters**: What goes wrong in practice
217
+
218
+ **FORBIDDEN in this field**:
219
+ - Do NOT include "This behavior is inconsistently documented across versions" as a
220
+ misconception. That is a complaint about documentation, not a developer
221
+ misconception about the tool's behavior.
222
+ - Do NOT include "Inconsistent documentation" or any variant of it.
223
+ - Do NOT invent generic filler misconceptions. Only include ones that are
224
+ practically significant — bugs, crashes, degraded performance, wrong output.
225
+
226
+ If no significant misconceptions exist, the field's value is the single statement:
227
+ "No significant misconceptions identified for this execution fact." The field is
228
+ required regardless.
229
+
230
+ ## Trigger-Controlled Fields
231
+
232
+ **CRITICAL**: When a trigger-controlled field is included, it is fully populated
233
+ AND its key is listed in the `optional_sections_included` control field. When not
234
+ triggered, the field is **absent** from `content` entirely (and its key absent from
235
+ `optional_sections_included`).
236
+
237
+ ### 7. `formal_signature` (TEXT, trigger-controlled) — Formal Signature
238
+
239
+ **Trigger categories**: `constructor-output`, `parameter-semantics`, `return-value`,
240
+ or any fact where the primary construct is a callable (function, method, constructor).
241
+
242
+ One markdown fragment providing API-reference-style documentation for the callable
243
+ construct at the center of the execution fact — what you find in jQuery API docs,
244
+ FastAPI reference, or javadoc:
245
+
246
+ - **Full signature**: The complete function/constructor/method signature with
247
+ parameter names, types, default values, and return type, in a language-tagged
248
+ fenced block. Use the tool's own type notation conventions.
249
+ - **Parameter table**: a GFM table — Name | Type | Default | Description. For each
250
+ parameter, explain what it controls and its effect on behavior — not just its type.
251
+ - **Returns line**: What the callable returns and under what conditions, including
252
+ edge cases.
253
+
254
+ Example (for `getServerSideProps`):
255
+
256
+ ```typescript
257
+ export async function getServerSideProps(context)
258
+ ```
259
+
260
+ | Parameter | Type | Default | Description |
261
+ |-----------|------|---------|-------------|
262
+ | context | GetServerSidePropsContext | required | Contains `req`, `res`, `params`, `query`, `preview`, `previewData`, `resolvedUrl`, `locale`, `locales`, `defaultLocale` |
263
+
264
+ **Returns**: `GetServerSidePropsResult<Props>` — An object with one of: `{ props }`,
265
+ `{ redirect }`, or `{ notFound: true }`. Returning `{ props }` passes the data
266
+ to the page component. Returning `{ notFound: true }` renders the 404 page.
267
+ Returning `{ redirect }` sends an HTTP redirect response.
268
+
269
+ ### 8. `observable_effects` (TEXT, trigger-controlled) — Observable Effects
270
+
271
+ **Trigger categories**: `side-effect`, `state-transition`, `property-effect`
272
+
273
+ One markdown fragment: a structured description of the observable changes that occur
274
+ when this execution fact's behavior is triggered. Makes the "side" of side-effects
275
+ explicit and verifiable.
276
+
277
+ For each observable effect, describe (bold effect title, then a short bullet list):
278
+
279
+ - **What changes**: The state or external resource that is modified (before → after)
280
+ - **Where visible**: DOM, console, network, object state, GPU memory, etc.
281
+ - **How to verify**: A concrete inspection technique a developer can use to confirm
282
+ the effect occurred
283
+
284
+ ### 9. `optional_sections_included` (LIST, control field)
285
+
286
+ The control field gating the trigger-controlled fields: a list of the exact keys of
287
+ the trigger-controlled fields populated for this fact (`"formal_signature"`,
288
+ `"observable_effects"`). It validates like any field but is **never rendered** as a
289
+ page section. Omit it when neither trigger fired.
290
+
291
+ ## Field Order
292
+
293
+ Fields appear in this fixed order in the `content` map:
294
+
295
+ 1. `tl_dr` *(mandatory — generated last by the distiller)*
296
+ 2. `definition` *(mandatory)*
297
+ 3. `primitives_involved` *(mandatory)*
298
+ 4. `formal_signature` *(trigger-controlled — when the fact involves callable constructs)*
299
+ 5. `observable_effects` *(trigger-controlled — when the fact involves side-effects/state-transitions/property-effects)*
300
+ 6. `code_example` *(mandatory)*
301
+ 7. `related_execution_facts` *(mandatory)*
302
+ 8. `misconceptions_and_pitfalls` *(mandatory)*
303
+ 9. `optional_sections_included` *(control field — lists the trigger-controlled keys populated)*
304
+
305
+ Trigger-controlled fields that are not triggered are omitted entirely (absent from
306
+ `content` and from `optional_sections_included`). When triggered, they MUST be fully
307
+ populated and listed.
@@ -0,0 +1,248 @@
1
+ # Usage Scenario Content Template
2
+
3
+ This template is the per-field authoring guidance the `fito-tool-usage-scenario-content-generator`
4
+ and `fito-practice-usage-scenario-content-generator` agents follow when producing a
5
+ UsageScenario knowledge component's `content`. It mirrors
6
+ the **registered `UsageScenarioTemplate` field-schema** (v1.0.0) in the backend Knowledge
7
+ Repository — the authoritative structure the generated `content` map must conform to.
8
+ 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
+ A usage scenario component is a **cookbook recipe** for a developer problem: it states
12
+ the problem, walks through the steps that solve it (each step grounded in a domain
13
+ concept or execution fact), shows the complete assembled solution, explains how the
14
+ whole thing works, positions the scenario among related ones, and warns about common
15
+ mistakes.
16
+
17
+ Two levels of structure must not be conflated:
18
+
19
+ - **Field structure (Level A)** — `content` is a map of the named fields below, each
20
+ with a type (`TEXT` or `LIST`) and a requirement. It is **not** markdown.
21
+ - **Field value (Level B)** — each `TEXT` field's value is a **markdown fragment**;
22
+ each `LIST` field's value is a list of markdown fragments. Markdown is the rich-text
23
+ format *inside* a field — it never defines the field structure.
24
+
25
+ Markdown rules for every field value: fenced code blocks always carry a language
26
+ info-string; **no in-field H1** (the component's `name` is the H1 — internal headings
27
+ demote to H3 or below); no raw/inline HTML; component cross-references stay plain
28
+ markdown text (e.g. `usage-scenario:typeorm.configuring-a-data-source`), not links.
29
+
30
+ Every field is REQUIRED and must be non-blank, in the order listed below — except
31
+ **`alternative_flows`**, which is OPTIONAL: include it only when the scenario genuinely
32
+ admits more than one way to solve the same problem, and omit the key entirely otherwise.
33
+
34
+ ## The Component Name
35
+
36
+ The component's `name` (metadata — rendered as the page H1, never repeated inside a
37
+ field value) must be a **readable phrase that names the developer problem the scenario
38
+ solves**, optionally with a qualifier. It is NOT a slug conversion and NOT a verbatim
39
+ copy of the scenario's `goal` string.
40
+
41
+ The goal is that a developer scanning a list of names understands immediately what
42
+ problem each scenario addresses.
43
+
44
+ Examples of BAD names (slug-style or raw goal copy):
45
+ - "Persisting Data Table Typeorm"
46
+ - "Store entity data in a relational database table using TypeORM's Data Mapper pattern."
47
+
48
+ Examples of GOOD names (readable, problem-framed):
49
+ - "Persisting Entity Data to a Relational Table with TypeORM's Data Mapper"
50
+ - "Handling File Uploads Securely in a Spring Boot Service"
51
+ - "Drawing a Filled Rectangle on an HTML Canvas"
52
+
53
+ ## Fields
54
+
55
+ ### 1. `tl_dr` (TEXT) — TL;DR
56
+
57
+ A 2–3 sentence standalone summary that lets a developer decide in seconds whether this
58
+ scenario is relevant to their problem. It should convey: the problem being solved, the
59
+ core approach (the central constructs/steps), and the single most important takeaway.
60
+
61
+ Write it as a plain paragraph — no bullet points, no headings, no cross-references to
62
+ other fields. Generated **last** by the distiller pass, as a faithful distillation of
63
+ the finished component.
64
+
65
+ **Quality gate**: If the TL;DR could apply to a different scenario with only minor word
66
+ changes, it is too generic. Rewrite it.
67
+
68
+ **FORBIDDEN**:
69
+ - Do NOT simply restate the scenario `goal` verbatim. Synthesize and expand.
70
+ - Do NOT end with a step list or a construct list ("Steps: …", "Key constructs: …").
71
+ - Do NOT write generic filler like "This scenario is essential for building robust
72
+ applications."
73
+
74
+ ### 2. `problem_motivation` (TEXT) — Problem / Motivation
75
+
76
+ Explain the concrete problem this scenario solves for the developer and **why it is
77
+ worth using this tool/API/library to solve it**. This is the "why bother" — the
78
+ motivation a developer needs before investing in the steps.
79
+
80
+ Address:
81
+ - What specific problem or need does the developer have?
82
+ - Why is this tool a good fit for solving it? What would be painful, error-prone, or
83
+ impossible without it (or with a naive hand-rolled approach)?
84
+ - In what real situations does this problem arise?
85
+
86
+ 1–2 paragraphs. Frame it from the developer's working perspective, not academically.
87
+
88
+ **FORBIDDEN**:
89
+ - Do NOT describe how to solve the problem here — that belongs in `steps`.
90
+ - Do NOT define domain concepts in the abstract — reference them only as motivation.
91
+
92
+ ### 3. `how_it_works` (TEXT) — How It Works
93
+
94
+ A consolidated, high-level explanation of the **overall mechanism** — how the approach
95
+ works as a whole and how the steps that follow fit together to solve the problem. Placed
96
+ before the steps, it gives the reader the mental model they need to make sense of the
97
+ individual moves. This is distinct from:
98
+ - **`problem_motivation`** (the *why bother*), and
99
+ - the per-step **rationale** (the local *why this line*).
100
+
101
+ Address the system-level picture:
102
+ - How does the approach work overall? How do the steps fit together to produce the
103
+ result, and what is the flow of control or data across them?
104
+ - Which key domain concepts and execution facts make the whole approach work, and how
105
+ do they interact?
106
+ - What non-obvious tool behavior is leveraged or worked around at the level of the whole
107
+ recipe (not a single step)?
108
+
109
+ 1–3 paragraphs. Narrative prose. This is the field that gives the reader genuine
110
+ understanding of *why the recipe is shaped the way it is* before they walk through it.
111
+
112
+ ### 4. `steps` (LIST) — Steps (Main Flow)
113
+
114
+ The ordered sequence of steps that solves the problem. This is the heart of the
115
+ recipe. A LIST field: **one markdown fragment per step**, in the sequence a developer
116
+ performs them. Step granularity is calibrated so that a step typically corresponds to
117
+ the use of **one execution fact** of the tool — a single meaningful behavioral move
118
+ (call this API, configure that, annotate this class). Avoid steps so fine-grained that
119
+ they describe a single trivial token, and avoid steps so coarse that they bundle
120
+ several independent behaviors.
121
+
122
+ Each step fragment has four parts, as markdown:
123
+
124
+ - **Step title** (a bold lead line): A short imperative phrase naming what this step
125
+ accomplishes (e.g., "Annotate the entity class", "Obtain the repository from the
126
+ data source").
127
+ - **Description**: A concise statement of *what the developer must do* in this step and
128
+ *what the accompanying code does* — a brief explanation of the snippet below. This is
129
+ the *what/how* (the rationale that follows is the *why*). Keep it tight: one to three
130
+ sentences. Do not let it grow into a full tutorial paragraph — conciseness here keeps
131
+ the overall scenario from becoming bloated.
132
+ - **Code**: The smallest snippet (or API call / command / configuration) that
133
+ realizes the step, in a **language-tagged fenced code block**. Annotate with *why*
134
+ comments, not *what* comments. Snippets across the steps should compose into the
135
+ `consolidated_example`.
136
+ - **Rationale** (a `**Why**:` lead): The *why* behind the step. This is where domain
137
+ concepts and execution facts appear — **named from the tool's own vocabulary**, not by
138
+ reference to other components. Explain the reasoning: which domain concept the code is
139
+ organized around (a pattern, algorithm, convention) and/or which execution fact about
140
+ the tool's behavior the step depends on or works around (e.g., "`rect()` only *defines*
141
+ a path; nothing is drawn until you call `fill()` or `stroke()`, so this step must
142
+ follow the path definition").
143
+
144
+ **FORBIDDEN**:
145
+ - Do NOT reference pipeline ids or other generated components inside steps. Name
146
+ concepts and behaviors in prose instead; cross-document linking is a separate,
147
+ later concern.
148
+ - Do NOT pad with steps that have no code/operation and no real rationale.
149
+
150
+ ### 5. `alternative_flows` (TEXT, optional) — Alternative Flows
151
+
152
+ Included only when the scenario admits **more than one set of execution facts** that
153
+ solve the same problem end-to-end (analogous to alternative flows in a use case). Omit
154
+ the key entirely when there is only one sensible approach — do not invent weak
155
+ alternatives to fill it.
156
+
157
+ One markdown fragment covering every alternative flow. Each alternative sits under an
158
+ **H3 heading** with:
159
+
160
+ - **Name** (the H3 heading): A short label distinguishing it from the main flow (e.g.,
161
+ "Using the Active Record pattern instead of Data Mapper").
162
+ - **When to prefer it** (a `**When to prefer it**:` lead): The conditions under which a
163
+ developer should choose this alternative over the main flow (trade-offs, constraints,
164
+ context).
165
+ - **Steps**: A complete ordered run of steps with the same title/description/code/
166
+ rationale shape as the main flow. Each alternative is self-contained — a reader
167
+ should be able to follow it without reconstructing it from the main flow.
168
+
169
+ A variation that only tweaks one or two steps of the main flow without changing the
170
+ overall approach is NOT an alternative flow — mention such tweaks in the rationale of
171
+ the affected main-flow step instead.
172
+
173
+ ### 6. `consolidated_example` (TEXT) — Consolidated Example
174
+
175
+ The complete, assembled solution for the **main flow**, as a single code unit in a
176
+ **language-tagged fenced code block**. This is the "here is the whole thing working
177
+ together" block.
178
+
179
+ Requirements:
180
+ - **Runnable when feasible**: include imports, declarations, and an entry point so a
181
+ developer can copy-paste and run it. When a fully runnable example is not feasible
182
+ (requires a database, external service, or complex project setup), provide a minimal
183
+ but representative complete fragment and add a one-line prerequisites note at the end
184
+ of the fragment.
185
+ - **Coherent with the steps**: the consolidated code must be the composition of the
186
+ per-step snippets — no new, unexplained moves appear here.
187
+ - **Annotated lightly**: brief *why* comments at the points that matter; do not
188
+ re-narrate every line already explained in the steps.
189
+ - **Version-consistent**: valid for the tool version in the metadata.
190
+
191
+ After the code block, include 1–3 sentences on what running it produces — the
192
+ observable result that confirms the problem is solved. Alternative flows do not each
193
+ require their own consolidated block; their step snippets suffice.
194
+
195
+ ### 7. `related_usage_scenarios` (TEXT) — Related Usage Scenarios
196
+
197
+ A narrative — not a flat list — that positions this scenario among others, helping the
198
+ reader understand its utility and how it composes with neighboring scenarios.
199
+
200
+ Where a related scenario exists as a live component in the backend Knowledge
201
+ Repository, reference it by its canonical id as plain markdown text (e.g.
202
+ "…`usage-scenario:typeorm.configuring-a-data-source` is a prerequisite…"). Scenarios
203
+ not (yet) in the repository — including relevant ones from the broader domain — are
204
+ named in prose. Never reference identify-pipeline numeric ids — the component must
205
+ stand alone in the Knowledge Repository.
206
+
207
+ For each related scenario, state the **specific relationship type**:
208
+ - **Prerequisite**: should be done/understood before this one.
209
+ - **Composes-with**: commonly combined with this scenario to build something larger.
210
+ - **Alternative-goal**: solves a different but adjacent problem the reader might
211
+ actually want instead.
212
+ - **Commonly-confused**: looks similar but addresses a different problem.
213
+
214
+ Then explain in a sentence or two *why* the relationship holds.
215
+
216
+ **FORBIDDEN**:
217
+ - Do NOT use "related" as a relationship type — use one of the specific types above.
218
+ - Do NOT end with generic filler like "Understanding these scenarios helps build better
219
+ applications."
220
+
221
+ ### 8. `misconceptions_and_pitfalls` (TEXT) — Common Misconceptions and Pitfalls
222
+
223
+ Things developers frequently get wrong about this scenario — mistakes in *how to apply*
224
+ the tool to this problem, wrong assumptions about the workflow, steps people skip or
225
+ reorder incorrectly, and traps that produce subtle bugs. One markdown fragment holding
226
+ every entry, each under an **H3 title**, following the pattern:
227
+
228
+ - **Misconception / Pitfall**: what developers commonly believe or do wrong.
229
+ - **Reality**: what is actually true / the correct approach.
230
+ - **Why it matters**: what goes wrong in practice (bugs, security holes, performance
231
+ problems, wasted time).
232
+
233
+ This field is required. Include only genuinely significant entries. If no meaningful
234
+ misconceptions exist for a scenario, the field's value is the single statement:
235
+ "No significant misconceptions identified for this scenario." Do not invent weak entries.
236
+
237
+ ## Field Order
238
+
239
+ Fields appear in this fixed order in the `content` map:
240
+
241
+ 1. `tl_dr` *(generated last by the distiller)*
242
+ 2. `problem_motivation`
243
+ 3. `how_it_works`
244
+ 4. `steps`
245
+ 5. `alternative_flows` *(only when the scenario admits more than one full approach)*
246
+ 6. `consolidated_example`
247
+ 7. `related_usage_scenarios`
248
+ 8. `misconceptions_and_pitfalls`