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,88 @@
1
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { parse as parseYaml } from "yaml";
4
+ import { REQUIRED_FILES, validateCaseContent } from "./case-schema.js";
5
+ /**
6
+ * The thin filesystem loader for the structural validator (`case-schema.ts`). It reads
7
+ * a local `.case/` checkout, records which files are present (the one rule a Zod schema
8
+ * cannot express), parses each `.case/` YAML file via the `yaml` package, and hands the
9
+ * parsed content to `validateCaseContent`.
10
+ *
11
+ * Hybrid-H0 (ADR-005): there is no backend "remote mode" — this only ever runs against a
12
+ * local checkout. Reused by the case-runner consumption backstop (Task 5.2) and the
13
+ * case-generate pre-publish check (Tasks 9.2/9.3).
14
+ */
15
+ /** `CaseContent` key → its path relative to `.case/`. */
16
+ export const YAML_FILES = {
17
+ manifest: "manifest.yaml",
18
+ artifacts: "artifacts.yaml",
19
+ learningObjectives: "learning_objectives.yaml",
20
+ prerequisites: "prerequisites.yaml",
21
+ rubric: "rubric.yaml",
22
+ solution: "solution.yaml",
23
+ situation: "situation/situation.yaml",
24
+ deliverables: "task/deliverables.yaml",
25
+ knownState: "starter_state/known_state.yaml",
26
+ quiz: "quiz.yaml",
27
+ };
28
+ /** Recursively list every file under `dir`, as `/`-joined paths relative to it. */
29
+ function listFiles(dir) {
30
+ const found = new Set();
31
+ const walk = (abs, rel) => {
32
+ for (const entry of readdirSync(abs, { withFileTypes: true })) {
33
+ const childRel = rel ? `${rel}/${entry.name}` : entry.name;
34
+ if (entry.isDirectory()) {
35
+ walk(join(abs, entry.name), childRel);
36
+ }
37
+ else if (entry.isFile()) {
38
+ found.add(childRel);
39
+ }
40
+ }
41
+ };
42
+ if (existsSync(dir))
43
+ walk(dir, "");
44
+ return found;
45
+ }
46
+ /** Read and parse the `.case/` directory under `repoRoot` (the case repo checkout root). */
47
+ export function loadCaseDir(repoRoot) {
48
+ const caseDir = join(repoRoot, ".case");
49
+ const presentFiles = listFiles(caseDir);
50
+ const content = {};
51
+ const parseErrors = [];
52
+ for (const key of Object.keys(YAML_FILES)) {
53
+ const rel = YAML_FILES[key];
54
+ if (!presentFiles.has(rel))
55
+ continue;
56
+ const text = readFileSync(join(caseDir, rel), "utf8");
57
+ try {
58
+ // An empty / comment-only `.case/` YAML map parses to null — treat it as `{}`.
59
+ content[key] = parseYaml(text) ?? {};
60
+ }
61
+ catch (err) {
62
+ const message = err instanceof Error ? err.message : String(err);
63
+ parseErrors.push({ file: rel, message: `YAML parse error: ${message}` });
64
+ }
65
+ }
66
+ return { caseDir, presentFiles, content, parseErrors };
67
+ }
68
+ /**
69
+ * Validate an already-loaded `.case/` checkout. YAML parse failures are surfaced as
70
+ * structural errors alongside any schema/rule violations.
71
+ *
72
+ * Split out of `validateCaseDir` so a caller that needs the parsed content as well — the
73
+ * authoring CLI, which also derives the optional-field inventory from it — validates and
74
+ * reads **one** snapshot instead of loading the tree twice, without restating this merge.
75
+ */
76
+ export function validateLoadedCase(loaded) {
77
+ const result = validateCaseContent({ content: loaded.content, presentFiles: loaded.presentFiles });
78
+ if (loaded.parseErrors.length === 0)
79
+ return result;
80
+ const errors = [...loaded.parseErrors, ...(result.ok ? [] : result.errors)];
81
+ return { ok: false, errors };
82
+ }
83
+ /** Validate the local `.case/` checkout under `repoRoot` — load it, then validate what loaded. */
84
+ export function validateCaseDir(repoRoot) {
85
+ return validateLoadedCase(loadCaseDir(repoRoot));
86
+ }
87
+ /** Re-exported so callers can import the loader and the canonical required-file list together. */
88
+ export { REQUIRED_FILES };
@@ -0,0 +1,106 @@
1
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
2
+ import { join } from "node:path";
3
+
4
+ import { parse as parseYaml } from "yaml";
5
+
6
+ import { REQUIRED_FILES, validateCaseContent } from "./case-schema.ts";
7
+ import type { CaseContent, ValidationError, ValidationResult } from "./case-schema.ts";
8
+
9
+ /**
10
+ * The thin filesystem loader for the structural validator (`case-schema.ts`). It reads
11
+ * a local `.case/` checkout, records which files are present (the one rule a Zod schema
12
+ * cannot express), parses each `.case/` YAML file via the `yaml` package, and hands the
13
+ * parsed content to `validateCaseContent`.
14
+ *
15
+ * Hybrid-H0 (ADR-005): there is no backend "remote mode" — this only ever runs against a
16
+ * local checkout. Reused by the case-runner consumption backstop (Task 5.2) and the
17
+ * case-generate pre-publish check (Tasks 9.2/9.3).
18
+ */
19
+
20
+ /** `CaseContent` key → its path relative to `.case/`. */
21
+ export const YAML_FILES: Record<keyof CaseContent, string> = {
22
+ manifest: "manifest.yaml",
23
+ artifacts: "artifacts.yaml",
24
+ learningObjectives: "learning_objectives.yaml",
25
+ prerequisites: "prerequisites.yaml",
26
+ rubric: "rubric.yaml",
27
+ solution: "solution.yaml",
28
+ situation: "situation/situation.yaml",
29
+ deliverables: "task/deliverables.yaml",
30
+ knownState: "starter_state/known_state.yaml",
31
+ quiz: "quiz.yaml",
32
+ };
33
+
34
+ export interface LoadedCase {
35
+ /** Absolute path to the `.case/` directory that was loaded. */
36
+ caseDir: string;
37
+ /** Every file found under `.case/`, as paths relative to `.case/`. */
38
+ presentFiles: Set<string>;
39
+ /** Parsed YAML content, keyed by concern (absent files are omitted). */
40
+ content: CaseContent;
41
+ /** Files present on disk that failed to parse as YAML. */
42
+ parseErrors: ValidationError[];
43
+ }
44
+
45
+ /** Recursively list every file under `dir`, as `/`-joined paths relative to it. */
46
+ function listFiles(dir: string): Set<string> {
47
+ const found = new Set<string>();
48
+ const walk = (abs: string, rel: string): void => {
49
+ for (const entry of readdirSync(abs, { withFileTypes: true })) {
50
+ const childRel = rel ? `${rel}/${entry.name}` : entry.name;
51
+ if (entry.isDirectory()) {
52
+ walk(join(abs, entry.name), childRel);
53
+ } else if (entry.isFile()) {
54
+ found.add(childRel);
55
+ }
56
+ }
57
+ };
58
+ if (existsSync(dir)) walk(dir, "");
59
+ return found;
60
+ }
61
+
62
+ /** Read and parse the `.case/` directory under `repoRoot` (the case repo checkout root). */
63
+ export function loadCaseDir(repoRoot: string): LoadedCase {
64
+ const caseDir = join(repoRoot, ".case");
65
+ const presentFiles = listFiles(caseDir);
66
+ const content: CaseContent = {};
67
+ const parseErrors: ValidationError[] = [];
68
+
69
+ for (const key of Object.keys(YAML_FILES) as (keyof CaseContent)[]) {
70
+ const rel = YAML_FILES[key];
71
+ if (!presentFiles.has(rel)) continue;
72
+ const text = readFileSync(join(caseDir, rel), "utf8");
73
+ try {
74
+ // An empty / comment-only `.case/` YAML map parses to null — treat it as `{}`.
75
+ content[key] = parseYaml(text) ?? {};
76
+ } catch (err) {
77
+ const message = err instanceof Error ? err.message : String(err);
78
+ parseErrors.push({ file: rel, message: `YAML parse error: ${message}` });
79
+ }
80
+ }
81
+
82
+ return { caseDir, presentFiles, content, parseErrors };
83
+ }
84
+
85
+ /**
86
+ * Validate an already-loaded `.case/` checkout. YAML parse failures are surfaced as
87
+ * structural errors alongside any schema/rule violations.
88
+ *
89
+ * Split out of `validateCaseDir` so a caller that needs the parsed content as well — the
90
+ * authoring CLI, which also derives the optional-field inventory from it — validates and
91
+ * reads **one** snapshot instead of loading the tree twice, without restating this merge.
92
+ */
93
+ export function validateLoadedCase(loaded: LoadedCase): ValidationResult {
94
+ const result = validateCaseContent({ content: loaded.content, presentFiles: loaded.presentFiles });
95
+ if (loaded.parseErrors.length === 0) return result;
96
+ const errors = [...loaded.parseErrors, ...(result.ok ? [] : result.errors)];
97
+ return { ok: false, errors };
98
+ }
99
+
100
+ /** Validate the local `.case/` checkout under `repoRoot` — load it, then validate what loaded. */
101
+ export function validateCaseDir(repoRoot: string): ValidationResult {
102
+ return validateLoadedCase(loadCaseDir(repoRoot));
103
+ }
104
+
105
+ /** Re-exported so callers can import the loader and the canonical required-file list together. */
106
+ export { REQUIRED_FILES };