seance-cli 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +40 -2
- package/dist/commands/init.d.ts +29 -0
- package/dist/commands/init.js +310 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mcp.d.ts +19 -0
- package/dist/commands/mcp.js +38 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/quiz.d.ts +23 -0
- package/dist/commands/quiz.js +187 -0
- package/dist/commands/quiz.js.map +1 -0
- package/dist/commands/review.d.ts +4 -0
- package/dist/commands/review.js +115 -0
- package/dist/commands/review.js.map +1 -0
- package/dist/commands/sync.d.ts +17 -0
- package/dist/commands/sync.js +367 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/git.d.ts +33 -0
- package/dist/git.js +103 -0
- package/dist/git.js.map +1 -0
- package/dist/hosted-api.d.ts +24 -0
- package/dist/hosted-api.js +85 -0
- package/dist/hosted-api.js.map +1 -0
- package/dist/hosted-consent.d.ts +8 -0
- package/dist/hosted-consent.js +37 -0
- package/dist/hosted-consent.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +108 -0
- package/dist/index.js.map +1 -0
- package/dist/init-fs.d.ts +51 -0
- package/dist/init-fs.js +220 -0
- package/dist/init-fs.js.map +1 -0
- package/dist/init-questions.d.ts +21 -0
- package/dist/init-questions.js +161 -0
- package/dist/init-questions.js.map +1 -0
- package/dist/mcp-handlers.d.ts +22 -0
- package/dist/mcp-handlers.js +185 -0
- package/dist/mcp-handlers.js.map +1 -0
- package/dist/mcp-server.d.ts +4 -0
- package/dist/mcp-server.js +39 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/prompter.d.ts +29 -0
- package/dist/prompter.js +42 -0
- package/dist/prompter.js.map +1 -0
- package/dist/quiz-backend.d.ts +40 -0
- package/dist/quiz-backend.js +116 -0
- package/dist/quiz-backend.js.map +1 -0
- package/dist/quiz-input.d.ts +12 -0
- package/dist/quiz-input.js +52 -0
- package/dist/quiz-input.js.map +1 -0
- package/dist/quiz-io.d.ts +30 -0
- package/dist/quiz-io.js +83 -0
- package/dist/quiz-io.js.map +1 -0
- package/dist/quiz-ui.d.ts +18 -0
- package/dist/quiz-ui.js +51 -0
- package/dist/quiz-ui.js.map +1 -0
- package/node_modules/@seance/ai/LICENSE +21 -0
- package/node_modules/@seance/ai/dist/chain.d.ts +31 -0
- package/node_modules/@seance/ai/dist/chain.js +114 -0
- package/node_modules/@seance/ai/dist/chain.js.map +1 -0
- package/node_modules/@seance/ai/dist/grade.d.ts +14 -0
- package/node_modules/@seance/ai/dist/grade.js +44 -0
- package/node_modules/@seance/ai/dist/grade.js.map +1 -0
- package/node_modules/@seance/ai/dist/hosted-config.d.ts +9 -0
- package/node_modules/@seance/ai/dist/hosted-config.js +27 -0
- package/node_modules/@seance/ai/dist/hosted-config.js.map +1 -0
- package/node_modules/@seance/ai/dist/index.d.ts +9 -0
- package/node_modules/@seance/ai/dist/index.js +9 -0
- package/node_modules/@seance/ai/dist/index.js.map +1 -0
- package/node_modules/@seance/ai/dist/providers.d.ts +54 -0
- package/node_modules/@seance/ai/dist/providers.js +149 -0
- package/node_modules/@seance/ai/dist/providers.js.map +1 -0
- package/node_modules/@seance/ai/dist/quiz.d.ts +26 -0
- package/node_modules/@seance/ai/dist/quiz.js +41 -0
- package/node_modules/@seance/ai/dist/quiz.js.map +1 -0
- package/node_modules/@seance/ai/package.json +25 -0
- package/node_modules/@seance/core/LICENSE +21 -0
- package/node_modules/@seance/core/dist/ai-check.d.ts +58 -0
- package/node_modules/@seance/core/dist/ai-check.js +460 -0
- package/node_modules/@seance/core/dist/ai-check.js.map +1 -0
- package/node_modules/@seance/core/dist/ai-prompts.d.ts +29 -0
- package/node_modules/@seance/core/dist/ai-prompts.js +221 -0
- package/node_modules/@seance/core/dist/ai-prompts.js.map +1 -0
- package/node_modules/@seance/core/dist/ai-schemas.d.ts +155 -0
- package/node_modules/@seance/core/dist/ai-schemas.js +92 -0
- package/node_modules/@seance/core/dist/ai-schemas.js.map +1 -0
- package/node_modules/@seance/core/dist/api-client.d.ts +26 -0
- package/node_modules/@seance/core/dist/api-client.js +71 -0
- package/node_modules/@seance/core/dist/api-client.js.map +1 -0
- package/node_modules/@seance/core/dist/api-errors.d.ts +37 -0
- package/node_modules/@seance/core/dist/api-errors.js +66 -0
- package/node_modules/@seance/core/dist/api-errors.js.map +1 -0
- package/node_modules/@seance/core/dist/api-schemas.d.ts +284 -0
- package/node_modules/@seance/core/dist/api-schemas.js +67 -0
- package/node_modules/@seance/core/dist/api-schemas.js.map +1 -0
- package/node_modules/@seance/core/dist/decision-log.d.ts +73 -0
- package/node_modules/@seance/core/dist/decision-log.js +239 -0
- package/node_modules/@seance/core/dist/decision-log.js.map +1 -0
- package/node_modules/@seance/core/dist/dependency-guard.d.ts +20 -0
- package/node_modules/@seance/core/dist/dependency-guard.js +732 -0
- package/node_modules/@seance/core/dist/dependency-guard.js.map +1 -0
- package/node_modules/@seance/core/dist/gate.d.ts +11 -0
- package/node_modules/@seance/core/dist/gate.js +26 -0
- package/node_modules/@seance/core/dist/gate.js.map +1 -0
- package/node_modules/@seance/core/dist/git-parse.d.ts +11 -0
- package/node_modules/@seance/core/dist/git-parse.js +23 -0
- package/node_modules/@seance/core/dist/git-parse.js.map +1 -0
- package/node_modules/@seance/core/dist/index.d.ts +65 -0
- package/node_modules/@seance/core/dist/index.js +47 -0
- package/node_modules/@seance/core/dist/index.js.map +1 -0
- package/node_modules/@seance/core/dist/init-checklist.d.ts +153 -0
- package/node_modules/@seance/core/dist/init-checklist.js +200 -0
- package/node_modules/@seance/core/dist/init-checklist.js.map +1 -0
- package/node_modules/@seance/core/dist/init-detect.d.ts +9 -0
- package/node_modules/@seance/core/dist/init-detect.js +84 -0
- package/node_modules/@seance/core/dist/init-detect.js.map +1 -0
- package/node_modules/@seance/core/dist/init-templates.d.ts +36 -0
- package/node_modules/@seance/core/dist/init-templates.js +257 -0
- package/node_modules/@seance/core/dist/init-templates.js.map +1 -0
- package/node_modules/@seance/core/dist/map-basics.d.ts +13 -0
- package/node_modules/@seance/core/dist/map-basics.js +19 -0
- package/node_modules/@seance/core/dist/map-basics.js.map +1 -0
- package/node_modules/@seance/core/dist/map-summary.d.ts +5 -0
- package/node_modules/@seance/core/dist/map-summary.js +50 -0
- package/node_modules/@seance/core/dist/map-summary.js.map +1 -0
- package/node_modules/@seance/core/dist/markers.d.ts +51 -0
- package/node_modules/@seance/core/dist/markers.js +84 -0
- package/node_modules/@seance/core/dist/markers.js.map +1 -0
- package/node_modules/@seance/core/dist/mcp-quiz.d.ts +94 -0
- package/node_modules/@seance/core/dist/mcp-quiz.js +130 -0
- package/node_modules/@seance/core/dist/mcp-quiz.js.map +1 -0
- package/node_modules/@seance/core/dist/mcp-tools.d.ts +82 -0
- package/node_modules/@seance/core/dist/mcp-tools.js +136 -0
- package/node_modules/@seance/core/dist/mcp-tools.js.map +1 -0
- package/node_modules/@seance/core/dist/mcp-views.d.ts +21 -0
- package/node_modules/@seance/core/dist/mcp-views.js +83 -0
- package/node_modules/@seance/core/dist/mcp-views.js.map +1 -0
- package/node_modules/@seance/core/dist/quiz-assembly.d.ts +21 -0
- package/node_modules/@seance/core/dist/quiz-assembly.js +43 -0
- package/node_modules/@seance/core/dist/quiz-assembly.js.map +1 -0
- package/node_modules/@seance/core/dist/quiz-cards.d.ts +183 -0
- package/node_modules/@seance/core/dist/quiz-cards.js +215 -0
- package/node_modules/@seance/core/dist/quiz-cards.js.map +1 -0
- package/node_modules/@seance/core/dist/quiz-session.d.ts +67 -0
- package/node_modules/@seance/core/dist/quiz-session.js +141 -0
- package/node_modules/@seance/core/dist/quiz-session.js.map +1 -0
- package/node_modules/@seance/core/dist/quiz-subjects.d.ts +13 -0
- package/node_modules/@seance/core/dist/quiz-subjects.js +63 -0
- package/node_modules/@seance/core/dist/quiz-subjects.js.map +1 -0
- package/node_modules/@seance/core/dist/rate-limit.d.ts +33 -0
- package/node_modules/@seance/core/dist/rate-limit.js +114 -0
- package/node_modules/@seance/core/dist/rate-limit.js.map +1 -0
- package/node_modules/@seance/core/dist/scoring.d.ts +48 -0
- package/node_modules/@seance/core/dist/scoring.js +95 -0
- package/node_modules/@seance/core/dist/scoring.js.map +1 -0
- package/node_modules/@seance/core/dist/seance-config.d.ts +177 -0
- package/node_modules/@seance/core/dist/seance-config.js +43 -0
- package/node_modules/@seance/core/dist/seance-config.js.map +1 -0
- package/node_modules/@seance/core/dist/seance-state.d.ts +125 -0
- package/node_modules/@seance/core/dist/seance-state.js +61 -0
- package/node_modules/@seance/core/dist/seance-state.js.map +1 -0
- package/node_modules/@seance/core/dist/sm2.d.ts +18 -0
- package/node_modules/@seance/core/dist/sm2.js +87 -0
- package/node_modules/@seance/core/dist/sm2.js.map +1 -0
- package/node_modules/@seance/core/dist/stored-schemas.d.ts +29 -0
- package/node_modules/@seance/core/dist/stored-schemas.js +29 -0
- package/node_modules/@seance/core/dist/stored-schemas.js.map +1 -0
- package/node_modules/@seance/core/dist/structural-questions.d.ts +31 -0
- package/node_modules/@seance/core/dist/structural-questions.js +575 -0
- package/node_modules/@seance/core/dist/structural-questions.js.map +1 -0
- package/node_modules/@seance/core/dist/structure-map-schema.d.ts +84 -0
- package/node_modules/@seance/core/dist/structure-map-schema.js +73 -0
- package/node_modules/@seance/core/dist/structure-map-schema.js.map +1 -0
- package/node_modules/@seance/core/dist/structure-map.d.ts +78 -0
- package/node_modules/@seance/core/dist/structure-map.js +750 -0
- package/node_modules/@seance/core/dist/structure-map.js.map +1 -0
- package/node_modules/@seance/core/dist/sync-changes.d.ts +38 -0
- package/node_modules/@seance/core/dist/sync-changes.js +89 -0
- package/node_modules/@seance/core/dist/sync-changes.js.map +1 -0
- package/node_modules/@seance/core/dist/sync-render.d.ts +28 -0
- package/node_modules/@seance/core/dist/sync-render.js +113 -0
- package/node_modules/@seance/core/dist/sync-render.js.map +1 -0
- package/node_modules/@seance/core/dist/terminal-text.d.ts +8 -0
- package/node_modules/@seance/core/dist/terminal-text.js +33 -0
- package/node_modules/@seance/core/dist/terminal-text.js.map +1 -0
- package/node_modules/@seance/core/dist/write-plan.d.ts +51 -0
- package/node_modules/@seance/core/dist/write-plan.js +173 -0
- package/node_modules/@seance/core/dist/write-plan.js.map +1 -0
- package/node_modules/@seance/core/package.json +26 -0
- package/package.json +42 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-guard.js","sourceRoot":"","sources":["../src/dependency-guard.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,2GAA2G;AAC3G,sHAAsH;AAOtH,qHAAqH;AACrH,MAAM,aAAa,GAAG,gEAAgE,CAAC;AACvF,MAAM,WAAW,GACf,2UAA2U,CAAC;AAE9U,+EAA+E;AAC/E,MAAM,UAAU,YAAY,CAAC,QAAkB;IAC7C,OAAO,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC;AAC3D,CAAC;AAED,6GAA6G;AAC7G,SAAS,QAAQ,CAAC,IAAY,EAAE,IAAY;IAC1C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,IAAI,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE;QAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5F,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,mHAAmH;AACnH,uHAAuH;AACvH,yHAAyH;AACzH,kEAAkE;AAClE,MAAM,gBAAgB,GAAgD;IACpE,GAAG,EAAE;QACH,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK;QACnG,GAAG,QAAQ,CAAC,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
|
2
|
+
export type GateReason = "passed" | "gate-off" | "soft-below" | "strict-below";
|
|
3
|
+
export interface GateResult {
|
|
4
|
+
/** May the developer continue? */
|
|
5
|
+
allowed: boolean;
|
|
6
|
+
/** Did the score reach the pass mark? (true or false in every mode) */
|
|
7
|
+
understood: boolean;
|
|
8
|
+
reason: GateReason;
|
|
9
|
+
}
|
|
10
|
+
export declare const DEFAULT_PASS_MARK = 0.7;
|
|
11
|
+
export declare function gateDecision(score: number, passMark?: number, mode?: GateMode): GateResult;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Learning gate: decides if the developer may move on after a quiz score.
|
|
2
|
+
// Pure function. "strict" blocks below the pass mark, "soft" only warns, "off" never blocks.
|
|
3
|
+
export const DEFAULT_PASS_MARK = 0.7;
|
|
4
|
+
const MODES = ["off", "soft", "strict"];
|
|
5
|
+
/** Throws RangeError unless the value is a finite number from 0 to 1. */
|
|
6
|
+
function checkFraction(value, field) {
|
|
7
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0 || value > 1) {
|
|
8
|
+
throw new RangeError(`${field} must be a finite number in [0, 1], got ${String(value)}`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function gateDecision(score, passMark = DEFAULT_PASS_MARK, mode = "strict") {
|
|
12
|
+
checkFraction(score, "score");
|
|
13
|
+
checkFraction(passMark, "passMark");
|
|
14
|
+
if (!MODES.includes(mode)) {
|
|
15
|
+
throw new RangeError(`mode must be "off", "soft" or "strict", got ${String(mode)}`);
|
|
16
|
+
}
|
|
17
|
+
const understood = score >= passMark;
|
|
18
|
+
if (mode === "off")
|
|
19
|
+
return { allowed: true, understood, reason: "gate-off" };
|
|
20
|
+
if (understood)
|
|
21
|
+
return { allowed: true, understood: true, reason: "passed" };
|
|
22
|
+
if (mode === "soft")
|
|
23
|
+
return { allowed: true, understood: false, reason: "soft-below" };
|
|
24
|
+
return { allowed: false, understood: false, reason: "strict-below" };
|
|
25
|
+
}
|
|
26
|
+
//# s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IAAI,KAAK,MAAM;QAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;IACvF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** One changed file of `git diff --numstat`. A binary file has no line counts, so both are 0. */
|
|
2
|
+
export interface NumstatEntry {
|
|
3
|
+
path: string;
|
|
4
|
+
added: number;
|
|
5
|
+
deleted: number;
|
|
6
|
+
binary: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Reads `git diff --numstat -z --no-renames`: records `<added>\t<deleted>\t<path>` separated by NUL. */
|
|
9
|
+
export declare function parseNumstatZ(output: string): NumstatEntry[];
|
|
10
|
+
/** Reads `git ls-files -z` or `git diff --name-only -z`: paths separated by NUL, empty strings dropped. */
|
|
11
|
+
export declare function parseNulPaths(output: string): string[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const NUMSTAT_RECORD = /^(\d+|-)\t(\d+|-)\t(.+)$/s;
|
|
2
|
+
/** Reads `git diff --numstat -z --no-renames`: records `<added>\t<deleted>\t<path>` separated by NUL. */
|
|
3
|
+
export function parseNumstatZ(output) {
|
|
4
|
+
const entries = [];
|
|
5
|
+
for (const record of output.split("\0")) {
|
|
6
|
+
const match = NUMSTAT_RECORD.exec(record);
|
|
7
|
+
if (match === null)
|
|
8
|
+
continue;
|
|
9
|
+
const [, added = "", deleted = "", path = ""] = match;
|
|
10
|
+
if (added === "-" && deleted === "-") {
|
|
11
|
+
entries.push({ path, added: 0, deleted: 0, binary: true });
|
|
12
|
+
}
|
|
13
|
+
else if (added !== "-" && deleted !== "-") {
|
|
14
|
+
entries.push({ path, added: Number(added), deleted: Number(deleted), binary: false });
|
|
15
|
+
} // a record that mixes `-` and a number is skipped
|
|
16
|
+
}
|
|
17
|
+
return entries;
|
|
18
|
+
}
|
|
19
|
+
/** Reads `git ls-files -z` or `git diff --name-only -z`: paths separated by NUL, empty strings dropped. */
|
|
20
|
+
export function parseNulPaths(output) {
|
|
21
|
+
return output.split("\0").filter((path) => path !== "");
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=git-parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-parse.js","sourceRoot":"","sources":["../src/git-parse.ts"],"names":[],"mappings":"AASA,MAAM,cAAc,GAAG,2BAA2B,CAAC;AACnD,yGAAyG;AACzG,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,MAAM,OAAO,GAAmB,EAAE,CAAC;IACnC,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,KAAK,KAAK,IAAI;YAAE,SAAS;QAC7B,MAAM,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,OAAO,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;QACtD,IAAI,KAAK,KAAK,GAAG,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;YACrC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7D,CAAC;aAAM,IAAI,KAAK,KAAK,GAAG,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;YAC5C,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QACxF,CAAC,CAAC,kDAAkD;IACtD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AACD,2GAA2G;AAC3G,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export { MAX_INTERVAL_DAYS, newCard, nextReview } from "./sm2.js";
|
|
2
|
+
export type { Card, Quality } from "./sm2.js";
|
|
3
|
+
export { DEFAULT_PASS_MARK, gateDecision } from "./gate.js";
|
|
4
|
+
export type { GateMode, GateReason, GateResult } from "./gate.js";
|
|
5
|
+
export { EXPLAIN_MISS_BELOW, scoreQuiz } from "./scoring.js";
|
|
6
|
+
export type { QuizAnswer, QuizQuestion, QuizResult, Rubric, SourceRef } from "./scoring.js";
|
|
7
|
+
export { buildStructureMap, MAP_LIMITS, normalisePath } from "./structure-map.js";
|
|
8
|
+
export type { ClassEntry, ExportEntry, FileEntry, FunctionEntry, ImportEntry, Language, MethodEntry, ParseIssue, SourceFile, StructureMap, } from "./structure-map.js";
|
|
9
|
+
export { fnv1a32, generateStructuralQuestions } from "./structural-questions.js";
|
|
10
|
+
export type { StructuralConcept, StructuralQuestion, StructuralQuestionOptions } from "./structural-questions.js";
|
|
11
|
+
export { AI_LIMITS, AiEnvelopeSchema, AiGradeSchema, AiQuestionSchema, CODE_CONCEPTS, DECISION_CONCEPT, EXTRA_CONCEPTS, QUIZ_CONCEPTS, QuizItemSchema, STRUCTURAL_CONCEPTS, } from "./ai-schemas.js";
|
|
12
|
+
export type { AiQuestion, QuizConcept, QuizItem } from "./ai-schemas.js";
|
|
13
|
+
export { BLANK_ANSWER_FEEDBACK, isBlankAnswer, checkAiQuiz, checkGrade, extractJson, fillQuiz, keyTerms, keywordGrade, mapNames } from "./ai-check.js";
|
|
14
|
+
export type { CheckFailure, Checked } from "./ai-check.js";
|
|
15
|
+
export { DECISION_PROMPT_RULES, buildGradeMessages, buildQuizMessages, selectExcerpts, summarizeMap } from "./ai-prompts.js";
|
|
16
|
+
export type { ChatMessage, Excerpt } from "./ai-prompts.js";
|
|
17
|
+
export { AUTO_END, AUTO_START, RULES_END, RULES_START, appendBlock, findBlock, hasAutoSection, mergeAutoSections, replaceBlockBody, } from "./markers.js";
|
|
18
|
+
export type { AutoMerge, BlockState } from "./markers.js";
|
|
19
|
+
export { MAX_MANIFEST_RECORDS, ManifestSchema, SeanceConfigSchema, TEMPLATE_VERSION, firstIssuePath } from "./seance-config.js";
|
|
20
|
+
export type { InitSettings, Manifest, ManifestRecord, SeanceConfig, Target } from "./seance-config.js";
|
|
21
|
+
export { MANIFEST_PATH, contentHash, decideFileWrite, normaliseForHash, planInit } from "./write-plan.js";
|
|
22
|
+
export type { Existing, FileAction, InitPlan, PlanAction, PlannedWrite } from "./write-plan.js";
|
|
23
|
+
export { DEPENDENCY_GUARD_SCRIPT, classifyShellCommand, guardMessage } from "./dependency-guard.js";
|
|
24
|
+
export type { GuardVerdict } from "./dependency-guard.js";
|
|
25
|
+
export { DECISIONS_TEMPLATE, renderInitFiles } from "./init-templates.js";
|
|
26
|
+
export type { RenderedUnit } from "./init-templates.js";
|
|
27
|
+
export { CHECKLIST, CHECKLIST_IDS, InitAnswersSchema, cleanAnswerText, evaluateChecklist } from "./init-checklist.js";
|
|
28
|
+
export { detectProject } from "./init-detect.js";
|
|
29
|
+
export type { Detected, FolderSnapshot } from "./init-detect.js";
|
|
30
|
+
export type { Answer, AnswerSource, ChecklistId, ChecklistItem, ChecklistResult, InitAnswers, Suggestion, } from "./init-checklist.js";
|
|
31
|
+
export { STATE_LIMITS, STATE_PATH, SeanceStateSchema, emptyState, serializeState } from "./seance-state.js";
|
|
32
|
+
export type { LastSync, PendingQuiz, SeanceState, SnapshotValue } from "./seance-state.js";
|
|
33
|
+
export { parseNulPaths, parseNumstatZ } from "./git-parse.js";
|
|
34
|
+
export type { NumstatEntry } from "./git-parse.js";
|
|
35
|
+
export { MAX_CHANGED_FILES, MAX_MAP_FILES, buildSnapshot, changeFingerprint, isExcludedPath, mergeChangeLists, pickMapFiles, selectNewChanges, } from "./sync-changes.js";
|
|
36
|
+
export type { ChangeKind, ChangedFile, RawChange } from "./sync-changes.js";
|
|
37
|
+
export { ENTRY_PATTERN, MAX_CHANGELOG, MAX_ENTRY_CHARS, MAX_TABLE_ROWS, cleanInline, formatChangelogEntry, parseChangelog, renderAutoBody } from "./sync-render.js";
|
|
38
|
+
export type { SyncSummary } from "./sync-render.js";
|
|
39
|
+
export { toPlainText } from "./terminal-text.js";
|
|
40
|
+
export type { PlainTextOptions } from "./terminal-text.js";
|
|
41
|
+
export { MAX_SUMMARY_FILES, formatMapSummary } from "./map-summary.js";
|
|
42
|
+
export { answerChoice, answerGraded, currentQuestion, finishSession, formatQuizResult, isComplete, pickQuizSource, qualityFor, reorderChoices, startSession, } from "./quiz-session.js";
|
|
43
|
+
export type { AnswerOutcome, QuizSession, QuizSource, QuizSummary } from "./quiz-session.js";
|
|
44
|
+
export { MAX_QUIZ_FILES, MAX_REVIEW_PER_SESSION, QuizProgressSchema, ReviewCardSchema, applyQuizResult, applyReviewResult, cardKey, promptKey, dueCards, nextDueDate, pickQuizFiles, quizSeed, readProgress, } from "./quiz-cards.js";
|
|
45
|
+
export type { DueCard, QuizApply, QuizProgress, QuizRecord, ReviewCard, ReviewOutcome } from "./quiz-cards.js";
|
|
46
|
+
export { MAP_SCHEMA_LIMITS, StructureMapSchema } from "./structure-map-schema.js";
|
|
47
|
+
export { API_LIMITS, GradeRequestSchema, GradeResponseSchema, QuizRequestSchema, QuizResponseSchema, SERVED_BY_GRADE, SERVED_BY_QUIZ, SourceFilesSchema, StructureRequestSchema, StructureResponseSchema, } from "./api-schemas.js";
|
|
48
|
+
export type { GradeResponse, QuizResponse } from "./api-schemas.js";
|
|
49
|
+
export { API_ERROR_CODES, ApiErrorSchema, apiError } from "./api-errors.js";
|
|
50
|
+
export type { ApiErrorCode, ApiErrorResponse } from "./api-errors.js";
|
|
51
|
+
export { HOSTED_RATE_RULES, RATE_MAX_KEYS, createRateLimiter, rateKey } from "./rate-limit.js";
|
|
52
|
+
export type { RateDecision, RateLimiter, RateRule } from "./rate-limit.js";
|
|
53
|
+
export { fitQuizFiles, parseApiUrl, parseGradeResponse, parseQuizResponse } from "./api-client.js";
|
|
54
|
+
export { QUIZ_SIZE, assembleQuiz } from "./quiz-assembly.js";
|
|
55
|
+
export type { AssembledQuiz } from "./quiz-assembly.js";
|
|
56
|
+
export { ConsentSchema, LastResultSchema, STORED_LIMITS } from "./stored-schemas.js";
|
|
57
|
+
export type { LastResult } from "./stored-schemas.js";
|
|
58
|
+
export { DECISIONS_PATH, DECISION_FIELDS, DECISION_LABELS, DECISION_LIMITS, DecisionLogStateSchema, compareDecisionLog, decisionCheck, decisionKey, decisionLogState, decisionPromptText, hasChoice, latestDecision, parseDecisionLog, renderDecisionEntry, } from "./decision-log.js";
|
|
59
|
+
export type { DecisionCompare, DecisionEntry, DecisionField, DecisionLog, DecisionLogState, DecisionRead } from "./decision-log.js";
|
|
60
|
+
export { EmptyInputSchema, GetDecisionsInputSchema, MCP_ERRORS, MCP_INPUT_SCHEMAS, MCP_LIMITS, MCP_TOOL_NAMES, QUIZ_ID_PATTERN, SubmitAnswerInputSchema, capJsonText, fitList, isSafeRelativePath, mcpError, replyFromJson, toolText, } from "./mcp-tools.js";
|
|
61
|
+
export type { McpErrorCode, McpToolName, ToolReply } from "./mcp-tools.js";
|
|
62
|
+
export { emptyStore, findQuiz, openQuiz, pruneStore, publicQuestion, shownQuestionId, submitAnswer } from "./mcp-quiz.js";
|
|
63
|
+
export type { McpQuiz, McpQuizStore, PublicQuestion, Reveal, SubmitInput, SubmitResult } from "./mcp-quiz.js";
|
|
64
|
+
export { decisionsView, dueReviewsView, projectContextView } from "./mcp-views.js";
|
|
65
|
+
export { dropRepeatedSubjects, normalizeSubject, subjectKey, subjectOf } from "./quiz-subjects.js";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Public entry point for @seance/core.
|
|
2
|
+
// Re-exports the review engine (sm2, gate, scoring) and the structure map with its question generator.
|
|
3
|
+
// Task 4 adds the AI schemas, prompt builders and response checks (no network here; that is @seance/ai).
|
|
4
|
+
// Task 7 adds the quiz and review modules (listed at the end of this file).
|
|
5
|
+
// Task 5 (`seance init`) adds markers, the manifest, write decisions, the checklist and project detection.
|
|
6
|
+
export { MAX_INTERVAL_DAYS, newCard, nextReview } from "./sm2.js";
|
|
7
|
+
export { DEFAULT_PASS_MARK, gateDecision } from "./gate.js";
|
|
8
|
+
export { EXPLAIN_MISS_BELOW, scoreQuiz } from "./scoring.js";
|
|
9
|
+
export { buildStructureMap, MAP_LIMITS, normalisePath } from "./structure-map.js";
|
|
10
|
+
export { fnv1a32, generateStructuralQuestions } from "./structural-questions.js";
|
|
11
|
+
export { AI_LIMITS, AiEnvelopeSchema, AiGradeSchema, AiQuestionSchema, CODE_CONCEPTS, DECISION_CONCEPT, EXTRA_CONCEPTS, QUIZ_CONCEPTS, QuizItemSchema, STRUCTURAL_CONCEPTS, } from "./ai-schemas.js";
|
|
12
|
+
export { BLANK_ANSWER_FEEDBACK, isBlankAnswer, checkAiQuiz, checkGrade, extractJson, fillQuiz, keyTerms, keywordGrade, mapNames } from "./ai-check.js";
|
|
13
|
+
export { DECISION_PROMPT_RULES, buildGradeMessages, buildQuizMessages, selectExcerpts, summarizeMap } from "./ai-prompts.js";
|
|
14
|
+
export { AUTO_END, AUTO_START, RULES_END, RULES_START, appendBlock, findBlock, hasAutoSection, mergeAutoSections, replaceBlockBody, } from "./markers.js";
|
|
15
|
+
export { MAX_MANIFEST_RECORDS, ManifestSchema, SeanceConfigSchema, TEMPLATE_VERSION, firstIssuePath } from "./seance-config.js";
|
|
16
|
+
export { MANIFEST_PATH, contentHash, decideFileWrite, normaliseForHash, planInit } from "./write-plan.js";
|
|
17
|
+
export { DEPENDENCY_GUARD_SCRIPT, classifyShellCommand, guardMessage } from "./dependency-guard.js";
|
|
18
|
+
export { DECISIONS_TEMPLATE, renderInitFiles } from "./init-templates.js";
|
|
19
|
+
export { CHECKLIST, CHECKLIST_IDS, InitAnswersSchema, cleanAnswerText, evaluateChecklist } from "./init-checklist.js";
|
|
20
|
+
export { detectProject } from "./init-detect.js";
|
|
21
|
+
export { STATE_LIMITS, STATE_PATH, SeanceStateSchema, emptyState, serializeState } from "./seance-state.js";
|
|
22
|
+
export { parseNulPaths, parseNumstatZ } from "./git-parse.js";
|
|
23
|
+
export { MAX_CHANGED_FILES, MAX_MAP_FILES, buildSnapshot, changeFingerprint, isExcludedPath, mergeChangeLists, pickMapFiles, selectNewChanges, } from "./sync-changes.js";
|
|
24
|
+
export { ENTRY_PATTERN, MAX_CHANGELOG, MAX_ENTRY_CHARS, MAX_TABLE_ROWS, cleanInline, formatChangelogEntry, parseChangelog, renderAutoBody } from "./sync-render.js";
|
|
25
|
+
// Task 7 (`seance quiz`, `seance review`): terminal-safe text, map summary, quiz session, review cards and state updates.
|
|
26
|
+
export { toPlainText } from "./terminal-text.js";
|
|
27
|
+
export { MAX_SUMMARY_FILES, formatMapSummary } from "./map-summary.js";
|
|
28
|
+
export { answerChoice, answerGraded, currentQuestion, finishSession, formatQuizResult, isComplete, pickQuizSource, qualityFor, reorderChoices, startSession, } from "./quiz-session.js";
|
|
29
|
+
export { MAX_QUIZ_FILES, MAX_REVIEW_PER_SESSION, QuizProgressSchema, ReviewCardSchema, applyQuizResult, applyReviewResult, cardKey, promptKey, dueCards, nextDueDate, pickQuizFiles, quizSeed, readProgress, } from "./quiz-cards.js";
|
|
30
|
+
// Task 8 (hosted API): capped map schema, API request/response schemas, errors, rate limiter and CLI client helpers.
|
|
31
|
+
export { MAP_SCHEMA_LIMITS, StructureMapSchema } from "./structure-map-schema.js";
|
|
32
|
+
export { API_LIMITS, GradeRequestSchema, GradeResponseSchema, QuizRequestSchema, QuizResponseSchema, SERVED_BY_GRADE, SERVED_BY_QUIZ, SourceFilesSchema, StructureRequestSchema, StructureResponseSchema, } from "./api-schemas.js";
|
|
33
|
+
export { API_ERROR_CODES, ApiErrorSchema, apiError } from "./api-errors.js";
|
|
34
|
+
export { HOSTED_RATE_RULES, RATE_MAX_KEYS, createRateLimiter, rateKey } from "./rate-limit.js";
|
|
35
|
+
export { fitQuizFiles, parseApiUrl, parseGradeResponse, parseQuizResponse } from "./api-client.js";
|
|
36
|
+
// Task 9 (web app): quiz assembly from an API reply or the map alone.
|
|
37
|
+
export { QUIZ_SIZE, assembleQuiz } from "./quiz-assembly.js";
|
|
38
|
+
// Task 9 review: strict schemas for the last result and the consent flag the web app stores.
|
|
39
|
+
export { ConsentSchema, LastResultSchema, STORED_LIMITS } from "./stored-schemas.js";
|
|
40
|
+
// Task 13 (decision log): the DECISIONS.md format, parser, state compare and the sync check. The template is exported with the init templates above.
|
|
41
|
+
export { DECISIONS_PATH, DECISION_FIELDS, DECISION_LABELS, DECISION_LIMITS, DecisionLogStateSchema, compareDecisionLog, decisionCheck, decisionKey, decisionLogState, decisionPromptText, hasChoice, latestDecision, parseDecisionLog, renderDecisionEntry, } from "./decision-log.js";
|
|
42
|
+
// Task 11 (MCP server): limits, tool names, input schemas, fixed errors, quiz sessions and the three read-only views.
|
|
43
|
+
export { EmptyInputSchema, GetDecisionsInputSchema, MCP_ERRORS, MCP_INPUT_SCHEMAS, MCP_LIMITS, MCP_TOOL_NAMES, QUIZ_ID_PATTERN, SubmitAnswerInputSchema, capJsonText, fitList, isSafeRelativePath, mcpError, replyFromJson, toolText, } from "./mcp-tools.js";
|
|
44
|
+
export { emptyStore, findQuiz, openQuiz, pruneStore, publicQuestion, shownQuestionId, submitAnswer } from "./mcp-quiz.js";
|
|
45
|
+
export { decisionsView, dueReviewsView, projectContextView } from "./mcp-views.js";
|
|
46
|
+
export { dropRepeatedSubjects, normalizeSubject, subjectKey, subjectOf } from "./quiz-subjects.js";
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
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QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE1H,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CHECKLIST_IDS: readonly ["projectName", "description", "audience", "language", "framework", "packageManager", "testRunner", "experience", "outOfScope", "conventions"];
|
|
3
|
+
export type ChecklistId = (typeof CHECKLIST_IDS)[number];
|
|
4
|
+
/** Where an answer came from. `undecided` means the user does not know yet (the value is ""). */
|
|
5
|
+
export type AnswerSource = "user" | "suggested" | "detected" | "default" | "undecided";
|
|
6
|
+
export interface Answer {
|
|
7
|
+
value: string;
|
|
8
|
+
source: AnswerSource;
|
|
9
|
+
}
|
|
10
|
+
/** A missing id counts as undecided. */
|
|
11
|
+
export type InitAnswers = Partial<Record<ChecklistId, Answer>>;
|
|
12
|
+
export interface Suggestion {
|
|
13
|
+
value: string;
|
|
14
|
+
label: string;
|
|
15
|
+
reason: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ChecklistItem {
|
|
18
|
+
id: ChecklistId;
|
|
19
|
+
question: string;
|
|
20
|
+
required: boolean;
|
|
21
|
+
kind: "text" | "choice";
|
|
22
|
+
maxLength: number;
|
|
23
|
+
choices?: readonly string[];
|
|
24
|
+
allowOther?: boolean;
|
|
25
|
+
suggestions?: readonly Suggestion[];
|
|
26
|
+
decideLater: boolean;
|
|
27
|
+
default?: string;
|
|
28
|
+
}
|
|
29
|
+
/** The ten items in the order `init` asks them. */
|
|
30
|
+
export declare const CHECKLIST: readonly ChecklistItem[];
|
|
31
|
+
export interface ChecklistResult {
|
|
32
|
+
percent: number;
|
|
33
|
+
complete: boolean;
|
|
34
|
+
missingRequired: ChecklistId[];
|
|
35
|
+
undecided: ChecklistId[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Counts what we know. Required items share 90 points and optional items share 10, so the result is at least 90
|
|
39
|
+
* exactly when every required item is answered. The sum is done in whole numbers to avoid rounding surprises.
|
|
40
|
+
*/
|
|
41
|
+
export declare function evaluateChecklist(answers: InitAnswers): ChecklistResult;
|
|
42
|
+
/**
|
|
43
|
+
* Makes free text safe to put into Markdown: control characters and line breaks become spaces, comment markers
|
|
44
|
+
* (`<!--`, `-->`) are removed until none are left, whitespace is collapsed, then the text is cut to `maxLength`
|
|
45
|
+
* characters (code points, so an emoji is never split). Cleaning twice gives the same text.
|
|
46
|
+
*/
|
|
47
|
+
export declare function cleanAnswerText(text: string, maxLength: number): string;
|
|
48
|
+
/**
|
|
49
|
+
* zod schema for `InitAnswers`, built from CHECKLIST. Every id is optional. An answered item must pass the
|
|
50
|
+
* item's rules; an undecided one must have an empty value. `renderInitFiles` relies on this check.
|
|
51
|
+
*/
|
|
52
|
+
export declare const InitAnswersSchema: z.ZodObject<{
|
|
53
|
+
audience: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
value: z.ZodString;
|
|
55
|
+
source: z.ZodEnum<{
|
|
56
|
+
default: "default";
|
|
57
|
+
detected: "detected";
|
|
58
|
+
suggested: "suggested";
|
|
59
|
+
undecided: "undecided";
|
|
60
|
+
user: "user";
|
|
61
|
+
}>;
|
|
62
|
+
}, z.core.$strip>>;
|
|
63
|
+
conventions: z.ZodOptional<z.ZodObject<{
|
|
64
|
+
value: z.ZodString;
|
|
65
|
+
source: z.ZodEnum<{
|
|
66
|
+
default: "default";
|
|
67
|
+
detected: "detected";
|
|
68
|
+
suggested: "suggested";
|
|
69
|
+
undecided: "undecided";
|
|
70
|
+
user: "user";
|
|
71
|
+
}>;
|
|
72
|
+
}, z.core.$strip>>;
|
|
73
|
+
description: z.ZodOptional<z.ZodObject<{
|
|
74
|
+
value: z.ZodString;
|
|
75
|
+
source: z.ZodEnum<{
|
|
76
|
+
default: "default";
|
|
77
|
+
detected: "detected";
|
|
78
|
+
suggested: "suggested";
|
|
79
|
+
undecided: "undecided";
|
|
80
|
+
user: "user";
|
|
81
|
+
}>;
|
|
82
|
+
}, z.core.$strip>>;
|
|
83
|
+
experience: z.ZodOptional<z.ZodObject<{
|
|
84
|
+
value: z.ZodString;
|
|
85
|
+
source: z.ZodEnum<{
|
|
86
|
+
default: "default";
|
|
87
|
+
detected: "detected";
|
|
88
|
+
suggested: "suggested";
|
|
89
|
+
undecided: "undecided";
|
|
90
|
+
user: "user";
|
|
91
|
+
}>;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
framework: z.ZodOptional<z.ZodObject<{
|
|
94
|
+
value: z.ZodString;
|
|
95
|
+
source: z.ZodEnum<{
|
|
96
|
+
default: "default";
|
|
97
|
+
detected: "detected";
|
|
98
|
+
suggested: "suggested";
|
|
99
|
+
undecided: "undecided";
|
|
100
|
+
user: "user";
|
|
101
|
+
}>;
|
|
102
|
+
}, z.core.$strip>>;
|
|
103
|
+
language: z.ZodOptional<z.ZodObject<{
|
|
104
|
+
value: z.ZodString;
|
|
105
|
+
source: z.ZodEnum<{
|
|
106
|
+
default: "default";
|
|
107
|
+
detected: "detected";
|
|
108
|
+
suggested: "suggested";
|
|
109
|
+
undecided: "undecided";
|
|
110
|
+
user: "user";
|
|
111
|
+
}>;
|
|
112
|
+
}, z.core.$strip>>;
|
|
113
|
+
outOfScope: z.ZodOptional<z.ZodObject<{
|
|
114
|
+
value: z.ZodString;
|
|
115
|
+
source: z.ZodEnum<{
|
|
116
|
+
default: "default";
|
|
117
|
+
detected: "detected";
|
|
118
|
+
suggested: "suggested";
|
|
119
|
+
undecided: "undecided";
|
|
120
|
+
user: "user";
|
|
121
|
+
}>;
|
|
122
|
+
}, z.core.$strip>>;
|
|
123
|
+
packageManager: z.ZodOptional<z.ZodObject<{
|
|
124
|
+
value: z.ZodString;
|
|
125
|
+
source: z.ZodEnum<{
|
|
126
|
+
default: "default";
|
|
127
|
+
detected: "detected";
|
|
128
|
+
suggested: "suggested";
|
|
129
|
+
undecided: "undecided";
|
|
130
|
+
user: "user";
|
|
131
|
+
}>;
|
|
132
|
+
}, z.core.$strip>>;
|
|
133
|
+
projectName: z.ZodOptional<z.ZodObject<{
|
|
134
|
+
value: z.ZodString;
|
|
135
|
+
source: z.ZodEnum<{
|
|
136
|
+
default: "default";
|
|
137
|
+
detected: "detected";
|
|
138
|
+
suggested: "suggested";
|
|
139
|
+
undecided: "undecided";
|
|
140
|
+
user: "user";
|
|
141
|
+
}>;
|
|
142
|
+
}, z.core.$strip>>;
|
|
143
|
+
testRunner: z.ZodOptional<z.ZodObject<{
|
|
144
|
+
value: z.ZodString;
|
|
145
|
+
source: z.ZodEnum<{
|
|
146
|
+
default: "default";
|
|
147
|
+
detected: "detected";
|
|
148
|
+
suggested: "suggested";
|
|
149
|
+
undecided: "undecided";
|
|
150
|
+
user: "user";
|
|
151
|
+
}>;
|
|
152
|
+
}, z.core.$strip>>;
|
|
153
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// The `seance init` checklist: the facts an AI agent needs about a project, how complete our knowledge is,
|
|
2
|
+
// how free text is cleaned, and the zod schema for the answers. Pure: no prompts, no file access.
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
export const CHECKLIST_IDS = [
|
|
5
|
+
"projectName",
|
|
6
|
+
"description",
|
|
7
|
+
"audience",
|
|
8
|
+
"language",
|
|
9
|
+
"framework",
|
|
10
|
+
"packageManager",
|
|
11
|
+
"testRunner",
|
|
12
|
+
"experience",
|
|
13
|
+
"outOfScope",
|
|
14
|
+
"conventions",
|
|
15
|
+
];
|
|
16
|
+
const ANSWER_SOURCES = ["user", "suggested", "detected", "default", "undecided"];
|
|
17
|
+
/** The ten items in the order `init` asks them. */
|
|
18
|
+
export const CHECKLIST = [
|
|
19
|
+
{
|
|
20
|
+
id: "projectName",
|
|
21
|
+
question: "Project name?",
|
|
22
|
+
required: true,
|
|
23
|
+
kind: "text",
|
|
24
|
+
maxLength: 80,
|
|
25
|
+
decideLater: false,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "description",
|
|
29
|
+
question: "What does it do, in one sentence?",
|
|
30
|
+
required: true,
|
|
31
|
+
kind: "text",
|
|
32
|
+
maxLength: 200,
|
|
33
|
+
decideLater: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "audience",
|
|
37
|
+
question: "Who will use it?",
|
|
38
|
+
required: true,
|
|
39
|
+
kind: "text",
|
|
40
|
+
maxLength: 120,
|
|
41
|
+
decideLater: true,
|
|
42
|
+
suggestions: [
|
|
43
|
+
{ value: "Just me, a learning project", label: "Just me, a learning project", reason: "keeps the AI's advice simple: no accounts, no scaling" },
|
|
44
|
+
{ value: "Classmates or a bootcamp cohort", label: "Classmates or a bootcamp cohort", reason: "a small group, so setup steps must be easy to follow" },
|
|
45
|
+
{ value: "Public users on the web", label: "Public users on the web", reason: "means the AI must care about security and error messages" },
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "language",
|
|
50
|
+
question: "Main language?",
|
|
51
|
+
required: true,
|
|
52
|
+
kind: "choice",
|
|
53
|
+
maxLength: 20,
|
|
54
|
+
choices: ["TypeScript", "JavaScript"],
|
|
55
|
+
decideLater: true,
|
|
56
|
+
suggestions: [
|
|
57
|
+
{ value: "TypeScript", label: "TypeScript", reason: "types catch mistakes before you run the code" },
|
|
58
|
+
{ value: "JavaScript", label: "JavaScript", reason: "nothing to compile, fewer files" },
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "framework",
|
|
63
|
+
question: "Main framework?",
|
|
64
|
+
required: true,
|
|
65
|
+
kind: "choice",
|
|
66
|
+
maxLength: 60,
|
|
67
|
+
choices: ["Next.js", "React", "Vue", "Svelte", "Express", "Fastify", "Hono", "Node.js CLI"],
|
|
68
|
+
allowOther: true,
|
|
69
|
+
decideLater: true,
|
|
70
|
+
suggestions: [
|
|
71
|
+
{ value: "React + Vite (web page)", label: "React + Vite (web page)", reason: "the most common way to build a web page, with many tutorials" },
|
|
72
|
+
{ value: "Express (HTTP API)", label: "Express (HTTP API)", reason: "a small, widely used way to build a server" },
|
|
73
|
+
{ value: "Node.js CLI", label: "Node.js CLI", reason: "a command line tool needs no browser or server" },
|
|
74
|
+
{ value: "None (a plain library)", label: "None (a plain library)", reason: "just functions other code can import" },
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "packageManager",
|
|
79
|
+
question: "Package manager?",
|
|
80
|
+
required: true,
|
|
81
|
+
kind: "choice",
|
|
82
|
+
maxLength: 20,
|
|
83
|
+
choices: ["npm", "pnpm", "yarn", "bun"],
|
|
84
|
+
decideLater: true,
|
|
85
|
+
default: "npm",
|
|
86
|
+
suggestions: [
|
|
87
|
+
{ value: "npm", label: "npm", reason: "comes with Node, nothing to install" },
|
|
88
|
+
{ value: "pnpm", label: "pnpm", reason: "faster, saves disk space" },
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "testRunner",
|
|
93
|
+
question: "Test runner?",
|
|
94
|
+
required: true,
|
|
95
|
+
kind: "choice",
|
|
96
|
+
maxLength: 20,
|
|
97
|
+
// "mocha" is only here so a detected mocha project passes validation (requirements open question 27).
|
|
98
|
+
choices: ["vitest", "jest", "node:test", "mocha", "none"],
|
|
99
|
+
decideLater: true,
|
|
100
|
+
suggestions: [
|
|
101
|
+
{ value: "vitest", label: "vitest", reason: "fast, works with TypeScript and ESM out of the box" },
|
|
102
|
+
{ value: "node:test", label: "node:test", reason: "built into Node, no dependency" },
|
|
103
|
+
{ value: "jest", label: "jest", reason: "the best known test runner, many examples online" },
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: "experience",
|
|
108
|
+
question: "Your coding experience?",
|
|
109
|
+
required: true,
|
|
110
|
+
kind: "choice",
|
|
111
|
+
maxLength: 20,
|
|
112
|
+
choices: ["beginner", "intermediate", "experienced"],
|
|
113
|
+
decideLater: false,
|
|
114
|
+
default: "beginner",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: "outOfScope",
|
|
118
|
+
question: "Anything the AI must not build? (optional)",
|
|
119
|
+
required: false,
|
|
120
|
+
kind: "text",
|
|
121
|
+
maxLength: 200,
|
|
122
|
+
decideLater: false,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: "conventions",
|
|
126
|
+
question: "Extra rules for the AI? (optional)",
|
|
127
|
+
required: false,
|
|
128
|
+
kind: "text",
|
|
129
|
+
maxLength: 200,
|
|
130
|
+
decideLater: false,
|
|
131
|
+
},
|
|
132
|
+
];
|
|
133
|
+
function isAnswered(answers, id) {
|
|
134
|
+
const answer = answers[id];
|
|
135
|
+
return answer !== undefined && answer.source !== "undecided";
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Counts what we know. Required items share 90 points and optional items share 10, so the result is at least 90
|
|
139
|
+
* exactly when every required item is answered. The sum is done in whole numbers to avoid rounding surprises.
|
|
140
|
+
*/
|
|
141
|
+
export function evaluateChecklist(answers) {
|
|
142
|
+
const required = CHECKLIST.filter((item) => item.required);
|
|
143
|
+
const optional = CHECKLIST.filter((item) => !item.required);
|
|
144
|
+
const requiredDone = required.filter((item) => isAnswered(answers, item.id)).length;
|
|
145
|
+
const optionalDone = optional.filter((item) => isAnswered(answers, item.id)).length;
|
|
146
|
+
// 90 * requiredDone / required.length + 10 * optionalDone / optional.length, over one common denominator.
|
|
147
|
+
const percent = Math.floor((90 * requiredDone * optional.length + 10 * optionalDone * required.length) / (required.length * optional.length));
|
|
148
|
+
const missingRequired = required.filter((item) => !isAnswered(answers, item.id)).map((item) => item.id);
|
|
149
|
+
return { percent, complete: missingRequired.length === 0, missingRequired, undecided: [...missingRequired] };
|
|
150
|
+
}
|
|
151
|
+
// Control characters and line separators (C0, DEL, C1, U+2028, U+2029).
|
|
152
|
+
const CONTROL_CHARS = /[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g;
|
|
153
|
+
const HAS_CONTROL_CHAR = /[\u0000-\u001f\u007f-\u009f\u2028\u2029]/;
|
|
154
|
+
/**
|
|
155
|
+
* Makes free text safe to put into Markdown: control characters and line breaks become spaces, comment markers
|
|
156
|
+
* (`<!--`, `-->`) are removed until none are left, whitespace is collapsed, then the text is cut to `maxLength`
|
|
157
|
+
* characters (code points, so an emoji is never split). Cleaning twice gives the same text.
|
|
158
|
+
*/
|
|
159
|
+
export function cleanAnswerText(text, maxLength) {
|
|
160
|
+
let result = text.replace(CONTROL_CHARS, " ");
|
|
161
|
+
// Removing one marker can join the pieces around it into a new one ("<!<!---->--"), so repeat.
|
|
162
|
+
for (let previous = ""; previous !== result;) {
|
|
163
|
+
previous = result;
|
|
164
|
+
result = result.replaceAll("<!--", "").replaceAll("-->", "");
|
|
165
|
+
}
|
|
166
|
+
result = result.replace(/\s+/g, " ").trim();
|
|
167
|
+
return Array.from(result).slice(0, Math.max(0, maxLength)).join("").trim();
|
|
168
|
+
}
|
|
169
|
+
/** Checks one text value of an answered item: right length, no control characters, no comment markers. */
|
|
170
|
+
function textProblem(value, maxLength) {
|
|
171
|
+
if (value === "")
|
|
172
|
+
return "must not be empty";
|
|
173
|
+
if (Array.from(value).length > maxLength)
|
|
174
|
+
return `must be at most ${maxLength} characters`;
|
|
175
|
+
if (HAS_CONTROL_CHAR.test(value))
|
|
176
|
+
return "must not contain control characters or line breaks";
|
|
177
|
+
if (value.includes("<!--") || value.includes("-->"))
|
|
178
|
+
return "must not contain comment markers";
|
|
179
|
+
return undefined;
|
|
180
|
+
}
|
|
181
|
+
/** The problem with an answered value for this item, or undefined when it is fine. */
|
|
182
|
+
function valueProblem(item, value) {
|
|
183
|
+
if (item.kind === "choice" && item.choices !== undefined && item.allowOther !== true) {
|
|
184
|
+
return item.choices.includes(value) ? undefined : `must be one of: ${item.choices.join(", ")}`;
|
|
185
|
+
}
|
|
186
|
+
return textProblem(value, item.maxLength);
|
|
187
|
+
}
|
|
188
|
+
const answerSchemaFor = (item) => z
|
|
189
|
+
.object({ value: z.string().max(1_000), source: z.enum(ANSWER_SOURCES) })
|
|
190
|
+
.superRefine((answer, ctx) => {
|
|
191
|
+
const problem = answer.source === "undecided" ? (answer.value === "" ? undefined : "must be empty when undecided") : valueProblem(item, answer.value);
|
|
192
|
+
if (problem !== undefined)
|
|
193
|
+
ctx.addIssue({ code: "custom", message: problem, path: ["value"] });
|
|
194
|
+
});
|
|
195
|
+
/**
|
|
196
|
+
* zod schema for `InitAnswers`, built from CHECKLIST. Every id is optional. An answered item must pass the
|
|
197
|
+
* item's rules; an undecided one must have an empty value. `renderInitFiles` relies on this check.
|
|
198
|
+
*/
|
|
199
|
+
export const InitAnswersSchema = z.object(Object.fromEntries(CHECKLIST.map((item) => [item.id, answerSchemaFor(item).optional()])));
|
|
200
|
+
//# sourceMappingURL=init-checklist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-checklist.js","sourceRoot":"","sources":["../src/init-checklist.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,kGAAkG;AAClG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,aAAa;IACb,aAAa;IACb,UAAU;IACV,UAAU;IACV,WAAW;IACX,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,aAAa;CACL,CAAC;AAKX,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,CAA4C,CAAC;AA6B5H,mDAAmD;AACnD,MAAM,CAAC,MAAM,SAAS,GAA6B;IACjD;QACE,EAAE,EAAE,aAAa;QACjB,QAAQ,EAAE,eAAe;QACzB,QAAQ,EAAE,IAAI;QACd,IAAI,EAA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target folder. `rootNames` are the file and folder names directly in the root. */
|
|
2
|
+
export interface FolderSnapshot {
|
|
3
|
+
folderName: string;
|
|
4
|
+
packageJson?: string;
|
|
5
|
+
rootNames: string[];
|
|
6
|
+
}
|
|
7
|
+
export type Detected = Partial<Record<"projectName" | "description" | "language" | "framework" | "packageManager" | "testRunner", string>>;
|
|
8
|
+
/** Guesses project name, description, language, framework, package manager and test runner. Never throws. */
|
|
9
|
+
export declare function detectProject(snapshot: FolderSnapshot): Detected;
|