fito-tui 0.2.1 → 0.4.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.
- package/README.md +2 -86
- package/package.json +8 -4
- package/prompts/fito-auth-refresh.md +3 -3
- package/prompts/fito-evaluate.md +10 -5
- package/prompts/fito-login.md +3 -3
- package/prompts/fito-logout.md +3 -3
- package/prompts/fito-push-knowledge.md +61 -65
- package/prompts/fito-submit.md +7 -2
- package/shared/competences/competence-list.js +1 -1
- package/shared/competences/competence-list.ts +1 -1
- package/shared/fito-api/README.md +1 -1
- package/shared/fito-api/client.js +7 -11
- package/shared/fito-api/client.ts +8 -12
- package/shared/fito-session/credentials.js +27 -15
- package/shared/fito-session/credentials.ts +33 -15
- package/shared/fito-session/session.js +7 -5
- package/shared/fito-session/session.ts +10 -7
- package/shared/fito-url/fito-url.js +29 -0
- package/shared/fito-url/fito-url.ts +32 -0
- package/shared/knowledge-components/knowledge-fetch.js +1 -1
- package/shared/knowledge-components/knowledge-fetch.ts +1 -1
- package/shared/knowledge-components/knowledge-search.js +1 -1
- package/shared/knowledge-components/knowledge-search.ts +1 -1
- package/shared/knowledge-components/technology-fetch.js +1 -1
- package/shared/knowledge-components/technology-fetch.ts +1 -1
- package/{skills/fito-case-author → shared/semver}/semver.js +8 -0
- package/{skills/fito-case-author → shared/semver}/semver.ts +9 -0
- package/skills/fito-auth/SKILL.md +12 -19
- package/skills/fito-auth/auth-refresh.js +3 -2
- package/skills/fito-auth/auth-refresh.ts +3 -2
- package/skills/fito-auth/login.js +7 -6
- package/skills/fito-auth/login.ts +7 -6
- package/skills/fito-auth/logout.js +3 -2
- package/skills/fito-auth/logout.ts +3 -2
- package/skills/fito-case-author/SKILL.md +1 -3
- package/skills/fito-case-author/publish-version.js +5 -5
- package/skills/fito-case-author/publish-version.ts +7 -7
- package/skills/fito-case-author/publish.js +5 -5
- package/skills/fito-case-author/publish.ts +7 -7
- package/skills/fito-case-runner/SKILL.md +10 -6
- package/skills/fito-case-runner/case-component-names.ts +1 -1
- package/skills/fito-case-runner/fito-url.js +8 -0
- package/skills/fito-case-runner/fito-url.ts +9 -0
- package/skills/fito-case-runner/open.ts +1 -1
- package/skills/fito-competence-write/SKILL.md +0 -6
- package/skills/fito-knowledge-push/SKILL.md +55 -76
- package/skills/fito-knowledge-push/push.js +169 -77
- package/skills/fito-knowledge-push/push.ts +210 -84
- package/skills/fito-source-ingestion/SKILL.md +0 -6
- package/skills/fito-source-ingestion/authoring-check.ts +1 -1
- package/skills/fito-technology-write/SKILL.md +0 -6
|
@@ -33,6 +33,7 @@ import { manifestSchema } from "../../shared/case-validation/case-schema.ts";
|
|
|
33
33
|
import { FitoApiError, createFitoApiClient } from "../../shared/fito-api/client.ts";
|
|
34
34
|
import type { FitoApiClient, PublishCaseVersionInput } from "../../shared/fito-api/client.ts";
|
|
35
35
|
import { resolveFitoSession } from "../../shared/fito-session/session.ts";
|
|
36
|
+
import { fitoApiUrl, fitoUrl } from "../../shared/fito-url/fito-url.ts";
|
|
36
37
|
import { parseGithubUrl } from "../../shared/github-url/parse.ts";
|
|
37
38
|
import type { Executor, ShellCommand } from "../../shared/shell-exec/exec.ts";
|
|
38
39
|
import {
|
|
@@ -44,7 +45,7 @@ import {
|
|
|
44
45
|
} from "./github-publish.ts";
|
|
45
46
|
import { buildCaseVersionPayload, readCasePublishFacts } from "./publish-payload.ts";
|
|
46
47
|
import { PublishRejectedError, reconcileSolutionBranchCase, validateOrThrow } from "./publish.ts";
|
|
47
|
-
import { isStrictlyGreaterSemVer } from "
|
|
48
|
+
import { isStrictlyGreaterSemVer } from "../../shared/semver/semver.ts";
|
|
48
49
|
import { deprecatedRefusal, gateStatus } from "./status-gate.ts";
|
|
49
50
|
|
|
50
51
|
/** Spawns one `{command, args}` in `cwd` and resolves its stdout (the shared `shell-exec` contract). */
|
|
@@ -69,7 +70,7 @@ export interface RunPublishVersionOptions {
|
|
|
69
70
|
/** `--overview`: the author-approved storefront markdown (`.authoring/description-overview.md`). */
|
|
70
71
|
overviewFile: string;
|
|
71
72
|
home?: string;
|
|
72
|
-
/** Environment (
|
|
73
|
+
/** Environment (FITO_URL); defaults to `process.env`. */
|
|
73
74
|
env?: Record<string, string | undefined>;
|
|
74
75
|
client?: VersionPublishClient;
|
|
75
76
|
exec?: Executor;
|
|
@@ -86,7 +87,7 @@ export interface RunPublishVersionResult {
|
|
|
86
87
|
/** Whether the solution branch's `.case/` had diverged and was reconciled before the push (Task 9a.7). */
|
|
87
88
|
caseReconciled: boolean;
|
|
88
89
|
title: string;
|
|
89
|
-
/** The case's web address
|
|
90
|
+
/** The case's web address, under Fito's — where the new version is now served. */
|
|
90
91
|
webUrl: string;
|
|
91
92
|
/**
|
|
92
93
|
* Set when the best-effort post-publish refresh failed (Task 12a.8, F58) — the version itself is
|
|
@@ -202,7 +203,7 @@ export async function runPublishVersion(options: RunPublishVersionOptions): Prom
|
|
|
202
203
|
const caseDir = path.resolve(options.caseDir);
|
|
203
204
|
const home = options.home ?? os.homedir();
|
|
204
205
|
const env = options.env ?? process.env;
|
|
205
|
-
const client = options.client ?? createFitoApiClient();
|
|
206
|
+
const client = options.client ?? createFitoApiClient({ baseUrl: fitoApiUrl(env) });
|
|
206
207
|
const exec = options.exec ?? (await import("../../shared/shell-exec/exec.ts")).shellExec;
|
|
207
208
|
const run = (command: ShellCommand): Promise<string> => exec(command, { cwd: caseDir });
|
|
208
209
|
|
|
@@ -271,7 +272,7 @@ export async function runPublishVersion(options: RunPublishVersionOptions): Prom
|
|
|
271
272
|
);
|
|
272
273
|
}
|
|
273
274
|
|
|
274
|
-
const session = await resolveFitoSession(client, home);
|
|
275
|
+
const session = await resolveFitoSession(client, home, fitoUrl(env));
|
|
275
276
|
const detail = await client.getCase(origin.caseId, session.tokens.accessToken);
|
|
276
277
|
gateStatus(detail, "publishVersion");
|
|
277
278
|
|
|
@@ -316,7 +317,6 @@ export async function runPublishVersion(options: RunPublishVersionOptions): Prom
|
|
|
316
317
|
// re-run, and a re-run re-cuts the same unregistered refs, so refreshing them would be noise.
|
|
317
318
|
const refreshWarning = await refreshLocalRepoView(run);
|
|
318
319
|
|
|
319
|
-
const webOrigin = env.FITO_WEB_ORIGIN ?? "http://localhost:5173";
|
|
320
320
|
return {
|
|
321
321
|
caseId: response.id,
|
|
322
322
|
status: response.status,
|
|
@@ -326,7 +326,7 @@ export async function runPublishVersion(options: RunPublishVersionOptions): Prom
|
|
|
326
326
|
versionRef: response.versionRef,
|
|
327
327
|
caseReconciled,
|
|
328
328
|
title: facts.title,
|
|
329
|
-
webUrl: `${
|
|
329
|
+
webUrl: `${fitoUrl(env)}/cases/${response.id}`,
|
|
330
330
|
...(refreshWarning === undefined ? {} : { refreshWarning }),
|
|
331
331
|
};
|
|
332
332
|
}
|
|
@@ -23,8 +23,9 @@ import * as path from "node:path";
|
|
|
23
23
|
import { fileURLToPath } from "node:url";
|
|
24
24
|
import { loadCaseDir } from "../../shared/case-validation/case-loader.js";
|
|
25
25
|
import { validateCaseContent } from "../../shared/case-validation/case-schema.js";
|
|
26
|
-
import {
|
|
26
|
+
import { FitoApiError, createFitoApiClient } from "../../shared/fito-api/client.js";
|
|
27
27
|
import { resolveFitoSession } from "../../shared/fito-session/session.js";
|
|
28
|
+
import { fitoApiUrl, fitoUrl } from "../../shared/fito-url/fito-url.js";
|
|
28
29
|
import { caseRepoHttpsUrl, ghAuthStatusCommand, ghCurrentLoginCommand, ghRepoCreateCommand, ghRepoViewCommand, gitCaseParityDiffCommand, gitCheckoutCommand, gitCommitCaseParityCommand, gitCurrentBranchCommand, gitListLocalBranchCommand, gitPushCaseRefsCommand, gitRestoreCaseDirCommand, gitStatusPorcelainCommand, parseRepoArg, withoutAuthoringHarnessPaths, } from "./github-publish.js";
|
|
29
30
|
import { buildCaseWritePayloads, readCasePublishFacts } from "./publish-payload.js";
|
|
30
31
|
import { clearPublishState, readPublishState, writePublishState } from "./publish-state.js";
|
|
@@ -45,7 +46,7 @@ export async function runPublish(options) {
|
|
|
45
46
|
const caseDir = path.resolve(options.caseDir);
|
|
46
47
|
const home = options.home ?? os.homedir();
|
|
47
48
|
const env = options.env ?? process.env;
|
|
48
|
-
const apiBaseUrl = options.apiBaseUrl ??
|
|
49
|
+
const apiBaseUrl = options.apiBaseUrl ?? fitoApiUrl(env);
|
|
49
50
|
const client = options.client ?? createFitoApiClient({ baseUrl: apiBaseUrl });
|
|
50
51
|
const exec = options.exec ?? (await import("../../shared/shell-exec/exec.js")).shellExec;
|
|
51
52
|
const run = (command) => exec(command, { cwd: caseDir });
|
|
@@ -75,7 +76,7 @@ export async function runPublish(options) {
|
|
|
75
76
|
"executed outside Fito), then re-run.");
|
|
76
77
|
}
|
|
77
78
|
const ghLogin = (await run(ghCurrentLoginCommand())).trim();
|
|
78
|
-
const session = await resolveFitoSession(client, home);
|
|
79
|
+
const session = await resolveFitoSession(client, home, fitoUrl(env));
|
|
79
80
|
// Decision 4 (2026-07-08): a gh↔Fito identity mismatch warns and stops for the author's explicit
|
|
80
81
|
// confirmation — never refuses outright (publishing under an org is supported).
|
|
81
82
|
const linkedLogin = session.user.githubLogin ?? null;
|
|
@@ -140,7 +141,6 @@ export async function runPublish(options) {
|
|
|
140
141
|
await publishOnce(client, session.tokens.accessToken, caseId, payloads.publish);
|
|
141
142
|
}
|
|
142
143
|
clearPublishState(repositoryUrl, home);
|
|
143
|
-
const webOrigin = env.FITO_WEB_ORIGIN ?? "http://localhost:5173";
|
|
144
144
|
return {
|
|
145
145
|
caseId,
|
|
146
146
|
status: "PUBLISHED",
|
|
@@ -150,7 +150,7 @@ export async function runPublish(options) {
|
|
|
150
150
|
caseReconciled,
|
|
151
151
|
ghLogin,
|
|
152
152
|
title: facts.title,
|
|
153
|
-
webUrl: `${
|
|
153
|
+
webUrl: `${fitoUrl(env)}/cases/${caseId}`,
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
@@ -25,9 +25,10 @@ import { fileURLToPath } from "node:url";
|
|
|
25
25
|
import { loadCaseDir } from "../../shared/case-validation/case-loader.ts";
|
|
26
26
|
import { validateCaseContent } from "../../shared/case-validation/case-schema.ts";
|
|
27
27
|
import type { Attestation, CaseContent, ValidationError } from "../../shared/case-validation/case-schema.ts";
|
|
28
|
-
import {
|
|
28
|
+
import { FitoApiError, createFitoApiClient } from "../../shared/fito-api/client.ts";
|
|
29
29
|
import type { FitoApiClient } from "../../shared/fito-api/client.ts";
|
|
30
30
|
import { resolveFitoSession } from "../../shared/fito-session/session.ts";
|
|
31
|
+
import { fitoApiUrl, fitoUrl } from "../../shared/fito-url/fito-url.ts";
|
|
31
32
|
import type { Executor } from "../../shared/shell-exec/exec.ts";
|
|
32
33
|
import {
|
|
33
34
|
caseRepoHttpsUrl,
|
|
@@ -70,7 +71,7 @@ export interface RunPublishOptions {
|
|
|
70
71
|
home?: string;
|
|
71
72
|
/** The backend origin — must match the client's; also stamps the retry state. */
|
|
72
73
|
apiBaseUrl?: string;
|
|
73
|
-
/** Environment (FITO_PUBLISH_GITHUB_OWNER,
|
|
74
|
+
/** Environment (FITO_PUBLISH_GITHUB_OWNER, FITO_URL); defaults to `process.env`. */
|
|
74
75
|
env?: Record<string, string | undefined>;
|
|
75
76
|
client?: PublishClient;
|
|
76
77
|
exec?: Executor;
|
|
@@ -87,7 +88,7 @@ export interface RunPublishResult {
|
|
|
87
88
|
caseReconciled: boolean;
|
|
88
89
|
ghLogin: string;
|
|
89
90
|
title: string;
|
|
90
|
-
/** The case's web address
|
|
91
|
+
/** The case's web address, under Fito's — where it is now listed and openable. */
|
|
91
92
|
webUrl: string;
|
|
92
93
|
}
|
|
93
94
|
|
|
@@ -110,7 +111,7 @@ export async function runPublish(options: RunPublishOptions): Promise<RunPublish
|
|
|
110
111
|
const caseDir = path.resolve(options.caseDir);
|
|
111
112
|
const home = options.home ?? os.homedir();
|
|
112
113
|
const env = options.env ?? process.env;
|
|
113
|
-
const apiBaseUrl = options.apiBaseUrl ??
|
|
114
|
+
const apiBaseUrl = options.apiBaseUrl ?? fitoApiUrl(env);
|
|
114
115
|
const client = options.client ?? createFitoApiClient({ baseUrl: apiBaseUrl });
|
|
115
116
|
const exec = options.exec ?? (await import("../../shared/shell-exec/exec.ts")).shellExec;
|
|
116
117
|
const run = (command: ShellCommand): Promise<string> => exec(command, { cwd: caseDir });
|
|
@@ -150,7 +151,7 @@ export async function runPublish(options: RunPublishOptions): Promise<RunPublish
|
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
const ghLogin = (await run(ghCurrentLoginCommand())).trim();
|
|
153
|
-
const session = await resolveFitoSession(client, home);
|
|
154
|
+
const session = await resolveFitoSession(client, home, fitoUrl(env));
|
|
154
155
|
|
|
155
156
|
// Decision 4 (2026-07-08): a gh↔Fito identity mismatch warns and stops for the author's explicit
|
|
156
157
|
// confirmation — never refuses outright (publishing under an org is supported).
|
|
@@ -227,7 +228,6 @@ export async function runPublish(options: RunPublishOptions): Promise<RunPublish
|
|
|
227
228
|
}
|
|
228
229
|
|
|
229
230
|
clearPublishState(repositoryUrl, home);
|
|
230
|
-
const webOrigin = env.FITO_WEB_ORIGIN ?? "http://localhost:5173";
|
|
231
231
|
return {
|
|
232
232
|
caseId,
|
|
233
233
|
status: "PUBLISHED",
|
|
@@ -237,7 +237,7 @@ export async function runPublish(options: RunPublishOptions): Promise<RunPublish
|
|
|
237
237
|
caseReconciled,
|
|
238
238
|
ghLogin,
|
|
239
239
|
title: facts.title,
|
|
240
|
-
webUrl: `${
|
|
240
|
+
webUrl: `${fitoUrl(env)}/cases/${caseId}`,
|
|
241
241
|
};
|
|
242
242
|
}
|
|
243
243
|
|
|
@@ -23,12 +23,6 @@ per-case checkout at `~/.fito/cases/<case-id>/`, so open and submit always agree
|
|
|
23
23
|
the learner's Fito-linked GitHub identity via `GET /me`; open needs no login (the case read is
|
|
24
24
|
public — a logged-in open additionally records participation, see below).
|
|
25
25
|
|
|
26
|
-
## Configuration
|
|
27
|
-
|
|
28
|
-
| Env var | Default | Purpose |
|
|
29
|
-
|---|---|---|
|
|
30
|
-
| `FITO_API_BASE_URL` | `http://localhost:8080` | Backend origin (case lookup) |
|
|
31
|
-
|
|
32
26
|
## Open a case
|
|
33
27
|
|
|
34
28
|
```bash
|
|
@@ -102,6 +96,15 @@ case detail (`GET /cases/{id}` — public, no login) and prints one `<id>\t<labe
|
|
|
102
96
|
id, where `<label>` is `name (id)` for a declared learning objective/prerequisite, or the bare id for a
|
|
103
97
|
rubric-only component. Pass the distinct `knowledgeComponent` ids from the reviewer's results.
|
|
104
98
|
|
|
99
|
+
## Print Fito's address (for feedback links)
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
node <fito-case-runner skill dir>/fito-url.js
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Prints one line: the address `/fito-submit` and `/fito-evaluate` put in front of each
|
|
106
|
+
`/knowledge/...` link.
|
|
107
|
+
|
|
105
108
|
## Files
|
|
106
109
|
|
|
107
110
|
| File | Role |
|
|
@@ -112,6 +115,7 @@ rubric-only component. Pass the distinct `knowledgeComponent` ids from the revie
|
|
|
112
115
|
| `manifest.ts` | Read `submission.target_branch` / `student_branch` and derive the checkout's `versionRef` (the submission's version pin, Task 9.4) from the manifest |
|
|
113
116
|
| `case-detail.ts` | Fetch the case pointer + map API errors |
|
|
114
117
|
| `case-component-names.ts` | Resolve KC names for feedback — fetch case detail, label each id `name (id)` (id fallback) |
|
|
118
|
+
| `fito-url.ts` | Print Fito's address — the prefix of the feedback's `/knowledge/...` links |
|
|
115
119
|
| `report.ts` | Render the malformed-case backstop report |
|
|
116
120
|
| — | The real `gh`/`git` executor is the shared `../../shared/shell-exec/exec.ts` (ADR-006) |
|
|
117
121
|
| `workdir.ts` | Resolve `~/.fito/cases/<case-id>/` |
|
|
@@ -21,7 +21,7 @@ export interface ResolveCaseComponentNamesOptions {
|
|
|
21
21
|
caseId: string;
|
|
22
22
|
/** The component ids to label — the distinct `knowledgeComponent` ids from the reviewer's results. */
|
|
23
23
|
componentIds: string[];
|
|
24
|
-
/** Injectable for tests; defaults to a client reading `
|
|
24
|
+
/** Injectable for tests; defaults to a client reading `FITO_URL`. Only the public case read is used. */
|
|
25
25
|
client?: Pick<FitoApiClient, "getCase">;
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `node fito-url.js` — print the address of the Fito this TUI uses (Task 15d.9a). `/fito-submit`
|
|
3
|
+
* and `/fito-evaluate` run it to make each `/knowledge/...` link in their feedback clickable: a
|
|
4
|
+
* user sets no variable, and the model cannot see an address held in code, so a script hands it
|
|
5
|
+
* over. The address itself lives in `shared/fito-url/`.
|
|
6
|
+
*/
|
|
7
|
+
import { fitoUrl } from "../../shared/fito-url/fito-url.js";
|
|
8
|
+
console.log(fitoUrl());
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `node fito-url.js` — print the address of the Fito this TUI uses (Task 15d.9a). `/fito-submit`
|
|
3
|
+
* and `/fito-evaluate` run it to make each `/knowledge/...` link in their feedback clickable: a
|
|
4
|
+
* user sets no variable, and the model cannot see an address held in code, so a script hands it
|
|
5
|
+
* over. The address itself lives in `shared/fito-url/`.
|
|
6
|
+
*/
|
|
7
|
+
import { fitoUrl } from "../../shared/fito-url/fito-url.ts";
|
|
8
|
+
|
|
9
|
+
console.log(fitoUrl());
|
|
@@ -34,7 +34,7 @@ export interface RunOpenOptions {
|
|
|
34
34
|
home?: string;
|
|
35
35
|
/**
|
|
36
36
|
* Backend client (case fetch, the deprecated-case participant gate — Task 9.6, and the
|
|
37
|
-
* best-effort enrollment record — Task 9.5); defaults to the real one (reads `
|
|
37
|
+
* best-effort enrollment record — Task 9.5); defaults to the real one (reads `FITO_URL`).
|
|
38
38
|
*/
|
|
39
39
|
client?: Pick<FitoApiClient, "getCase" | "meWithRefresh" | "createCaseEnrollment" | "getCaseParticipation">;
|
|
40
40
|
exec?: Executor;
|
|
@@ -27,12 +27,6 @@ itself.
|
|
|
27
27
|
- **The competence's id** — `update.js` and `delete.js` address a competence by it. `create.js` prints
|
|
28
28
|
it, and `fito_competence_list` reports it for every competence a technology demands.
|
|
29
29
|
|
|
30
|
-
## Configuration
|
|
31
|
-
|
|
32
|
-
| Env var | Default | Purpose |
|
|
33
|
-
|---|---|---|
|
|
34
|
-
| `FITO_API_BASE_URL` | `http://localhost:8080` | Backend origin |
|
|
35
|
-
|
|
36
30
|
## Create the competence
|
|
37
31
|
|
|
38
32
|
```bash
|
|
@@ -1,114 +1,93 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: fito-knowledge-push
|
|
3
3
|
description: >
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
or acknowledged override). Driven by /fito-push-knowledge.
|
|
4
|
+
Store generated knowledge component files in Fito — the PUSH step of
|
|
5
|
+
the Fito knowledge pipeline. One file per run; a similar or duplicate
|
|
6
|
+
component stops the push for the author's choice (Link, Supersede,
|
|
7
|
+
Skip, or Create new component). Driven by /fito-push-knowledge.
|
|
9
8
|
allowed-tools: bash
|
|
10
9
|
---
|
|
11
10
|
|
|
12
11
|
# Fito Knowledge Push
|
|
13
12
|
|
|
14
13
|
Run the script from wherever you are — the command below names this
|
|
15
|
-
skill's directory itself. One
|
|
16
|
-
`/fito-push-knowledge` orchestrator loops over the generated files, so every
|
|
17
|
-
|
|
14
|
+
skill's directory itself. One component file per run — the
|
|
15
|
+
`/fito-push-knowledge` orchestrator loops over the generated files, so every store (and every
|
|
16
|
+
stop) is an explicit, per-component action.
|
|
18
17
|
|
|
19
18
|
## Prerequisites
|
|
20
19
|
|
|
21
20
|
- **Fito login** — `/fito-login`. Knowledge writes are bearer-authenticated; the script fails
|
|
22
21
|
with that guidance when no session exists.
|
|
23
|
-
- **Backend reachable**, with the knowledge vocabulary seeded and the
|
|
22
|
+
- **Backend reachable**, with the knowledge vocabulary seeded and the file's technology
|
|
24
23
|
provisioned — every push pulls the registered `Template`s for the component type and the
|
|
25
24
|
technology whose `kind` selects among them.
|
|
26
25
|
|
|
27
|
-
##
|
|
28
|
-
|
|
29
|
-
| Env var | Default | Purpose |
|
|
30
|
-
|---|---|---|
|
|
31
|
-
| `FITO_API_BASE_URL` | `http://localhost:8080` | Backend origin |
|
|
32
|
-
|
|
33
|
-
## Push one payload
|
|
26
|
+
## Store one component file
|
|
34
27
|
|
|
35
28
|
```bash
|
|
36
|
-
node <fito-knowledge-push skill dir>/push.js <
|
|
29
|
+
node <fito-knowledge-push skill dir>/push.js <component-file> [--version <label>]
|
|
37
30
|
```
|
|
38
31
|
|
|
39
|
-
`<
|
|
32
|
+
`<component-file>` is one generator output (`{metadata, content}` JSON, e.g.
|
|
40
33
|
`./output/3-generate/concept_content/1-dependency-injection.json`). The script validates the
|
|
41
|
-
|
|
34
|
+
file's shape, resolves the registered template — by component type and by the technology's `kind`,
|
|
42
35
|
which selects the variant when a type has more than one — maps it onto the write contract
|
|
43
|
-
(`technology`, `templateId`, `name`, `version`, `content`),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
**Done when** it prints `✓ Created <canonical-reference> — "<name>" (version <v>)` — record
|
|
48
|
-
that reference for the flow's final report.
|
|
49
|
-
|
|
50
|
-
## Similar components (advisory probe) — the author decides
|
|
51
|
-
|
|
52
|
-
Before storing, the plain push probes for existing components similar to the payload — including
|
|
53
|
-
genuine near-duplicates *reframed* below the hard duplicate bar, which the 409 gate alone would
|
|
54
|
-
let coexist unseen (the Task 8.6 smoke-run finding). On any match the script exits **non-zero**
|
|
55
|
-
with nothing stored, printing each match with its similarity and the choices:
|
|
36
|
+
(`technology`, `templateId`, `name`, `version`, `content`), runs the **similar-components check**
|
|
37
|
+
(nothing stored yet — see the next section), and POSTs `POST /knowledge/{type}`. `--version`
|
|
38
|
+
labels the component's revision; omitted, the backend defaults `1.0.0`.
|
|
56
39
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
- **skip** — push nothing; move to the next payload.
|
|
60
|
-
- **proceed** — `--proceed`: store an independent component that will **coexist** with the
|
|
61
|
-
matches. This is the author's call after seeing the similarities; a match at the hard duplicate
|
|
62
|
-
bar still rejects the proceed with the near-duplicate 409 and its override echo.
|
|
40
|
+
**Done when** it prints `✓ Stored "<name>" as <reference id> (revision <label>), from
|
|
41
|
+
<component-file>` — record that reference id for the flow's final report.
|
|
63
42
|
|
|
64
|
-
|
|
65
|
-
decision point exactly like the 409.
|
|
43
|
+
## Stops — the author decides
|
|
66
44
|
|
|
67
|
-
|
|
45
|
+
A stop exits **non-zero** with nothing stored. Its message is written for the author and ends at
|
|
46
|
+
the line `--- Commands for the agent ---`: show the author everything above that line word for
|
|
47
|
+
word, ask with exactly the choices it lists, and run the command below the line that matches the
|
|
48
|
+
author's choice. Never pick for the author, and never re-run without their choice.
|
|
68
49
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
- **
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
**skip**: the payload is already in the vocabulary.
|
|
93
|
-
|
|
94
|
-
**Done when** the author's chosen re-run prints `✓ Created …` (or the author chose skip).
|
|
50
|
+
| Stop | Why it stops | Choice → flag |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| **Similar components** | the similar-components check (the backend's near-duplicate probe) found components above the soft similarity floor — including near-duplicates *reframed* below the hard duplicate bar, which the 409 gate alone would let coexist unseen (the Task 8.6 smoke-run finding) | Link `--link`, Supersede `--supersede`, Skip (none), Create new component `--proceed` |
|
|
53
|
+
| **Duplicate** | the backend refused the create as a near-duplicate (409 `duplicateId`) | Link `--link`, Supersede `--supersede`, Skip (none), Create new component `--override` |
|
|
54
|
+
| **Revision label** | a Supersede ran without `--version`, or with a label that is not SemVer or not newer than the target's revision | re-run with the author's label as `--version` |
|
|
55
|
+
| **Newer revision** | the Supersede target already has a successor (409 `supersededBy`) — version chains are linear | re-run `--supersede` against the newest revision |
|
|
56
|
+
|
|
57
|
+
- **Link** stores an alternative definition of the match; **Supersede** stores its next revision.
|
|
58
|
+
Both are preferred over Create new component.
|
|
59
|
+
- **Create new component** stores an independent component that will **coexist** with the match.
|
|
60
|
+
After `--proceed`, a match at the hard duplicate bar still refuses it with the Duplicate stop.
|
|
61
|
+
`--override` echoes the exact reported reference as `overrideAcknowledging` — the false-positive
|
|
62
|
+
escape; a blind or stale echo does not bypass the check.
|
|
63
|
+
- **Supersede** needs a revision label newer than the target's — the backend would otherwise store
|
|
64
|
+
`1.0.0`, the same label as a first revision. The stops' Supersede command carries no label, so
|
|
65
|
+
its first run prints the Revision label stop, which asks the author for one. A target whose own
|
|
66
|
+
revision is not SemVer accepts any SemVer label.
|
|
67
|
+
|
|
68
|
+
**Re-pushing an already-pushed file** (an interrupted or repeated run over the same folder) stops
|
|
69
|
+
on the component created from that very file earlier (same name, matching content). The expected
|
|
70
|
+
choice there is **Skip**: the component is already in Fito.
|
|
71
|
+
|
|
72
|
+
**Done when** the author's chosen re-run prints `✓ Stored …` (or the author chose Skip).
|
|
95
73
|
|
|
96
74
|
## Other failures
|
|
97
75
|
|
|
98
|
-
Malformed
|
|
99
|
-
|
|
100
|
-
|
|
76
|
+
Malformed files, an unknown technology, and field-schema violations (422 — the backend itemizes
|
|
77
|
+
the offending fields) fail with the reason printed (`✗ …`). The script never retries by itself and
|
|
78
|
+
is safe to re-run — each run POSTs at most once.
|
|
101
79
|
|
|
102
|
-
**
|
|
103
|
-
guard on its source), and the flow never edits one to make it pass — a wrong
|
|
104
|
-
|
|
80
|
+
**Component files are read-only inputs.** `push.js` only ever reads them (tripwired by a static
|
|
81
|
+
guard on its source), and the flow never edits one to make it pass — a wrong file is surfaced to
|
|
82
|
+
the author, whose fix is regeneration, not an in-place patch.
|
|
105
83
|
|
|
106
84
|
## Files
|
|
107
85
|
|
|
108
86
|
| File | Role |
|
|
109
87
|
|---|---|
|
|
110
|
-
| `push.ts` | CLI + `runPush` testable core — read/validate
|
|
88
|
+
| `push.ts` | CLI + `runPush` testable core — read/validate the file, resolve session + template, probe, check a supersede's label, POST, render the stops' messages |
|
|
111
89
|
|
|
112
|
-
|
|
90
|
+
File→request mapping and template resolution live in
|
|
113
91
|
[`shared/knowledge-components/push-payload.ts`](../../shared/knowledge-components/push-payload.ts);
|
|
114
|
-
transport in [the fito-api client](../../shared/fito-api/README.md)
|
|
92
|
+
transport in [the fito-api client](../../shared/fito-api/README.md); the SemVer label check in
|
|
93
|
+
[`shared/semver/`](../../shared/semver/semver.ts).
|