@kaddo/cli 3.13.1 → 3.14.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/dist/index.js +85 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -101,6 +101,7 @@ project:
|
|
|
101
101
|
name: "${meta.name}"
|
|
102
102
|
state: ${meta.state}
|
|
103
103
|
structure: ${meta.structure}
|
|
104
|
+
language: ${meta.language}
|
|
104
105
|
domains: []
|
|
105
106
|
team:
|
|
106
107
|
size: ${meta.teamSize}
|
|
@@ -210,11 +211,20 @@ async function runInit() {
|
|
|
210
211
|
],
|
|
211
212
|
initialValue: "monorepo"
|
|
212
213
|
});
|
|
214
|
+
const language = await select2({
|
|
215
|
+
message: "Project knowledge language (the CLI stays in English)",
|
|
216
|
+
options: [
|
|
217
|
+
{ value: "en", label: "English" },
|
|
218
|
+
{ value: "es", label: "Spanish" }
|
|
219
|
+
],
|
|
220
|
+
initialValue: "en"
|
|
221
|
+
});
|
|
213
222
|
const meta = {
|
|
214
223
|
name: projectName.trim(),
|
|
215
224
|
state,
|
|
216
225
|
teamSize,
|
|
217
|
-
structure
|
|
226
|
+
structure,
|
|
227
|
+
language
|
|
218
228
|
};
|
|
219
229
|
const kaddoConfigPath = join(dir, KADDO_DIR, "config.yml");
|
|
220
230
|
writeFile(kaddoConfigPath, buildConfig(meta));
|
|
@@ -510,11 +520,20 @@ import { parse as parseYaml2 } from "yaml";
|
|
|
510
520
|
var PROJECT_STATES = ["new", "pre-ai", "legacy"];
|
|
511
521
|
var TEAM_SIZES = ["indie", "small", "medium", "enterprise"];
|
|
512
522
|
var REPOSITORY_STRUCTURES = ["monorepo", "multirepo"];
|
|
523
|
+
var PROJECT_LANGUAGES = ["en", "es"];
|
|
513
524
|
var DEFAULTS = {
|
|
514
525
|
state: "pre-ai",
|
|
515
526
|
structure: "monorepo",
|
|
516
|
-
teamSize: "indie"
|
|
527
|
+
teamSize: "indie",
|
|
528
|
+
language: "en"
|
|
517
529
|
};
|
|
530
|
+
function languageLabel(lang) {
|
|
531
|
+
return lang === "es" ? "Spanish" : "English";
|
|
532
|
+
}
|
|
533
|
+
function projectLanguage(config) {
|
|
534
|
+
const lang = config.project.language;
|
|
535
|
+
return lang === "es" ? "es" : "en";
|
|
536
|
+
}
|
|
518
537
|
var ConfigError = class extends Error {
|
|
519
538
|
constructor(message) {
|
|
520
539
|
super(message);
|
|
@@ -536,12 +555,18 @@ var structureSchema = z.enum(["monorepo", "multirepo"], {
|
|
|
536
555
|
message: `project.structure must be one of: ${REPOSITORY_STRUCTURES.join(", ")}`
|
|
537
556
|
})
|
|
538
557
|
});
|
|
558
|
+
var languageSchema = z.enum(["en", "es"], {
|
|
559
|
+
errorMap: () => ({
|
|
560
|
+
message: `project.language must be one of: ${PROJECT_LANGUAGES.join(", ")}`
|
|
561
|
+
})
|
|
562
|
+
});
|
|
539
563
|
var configSchema = z.object({
|
|
540
564
|
version: z.union([z.string(), z.number()]).optional(),
|
|
541
565
|
project: z.object({
|
|
542
566
|
name: z.string().default("project"),
|
|
543
567
|
state: projectStateSchema.default(DEFAULTS.state),
|
|
544
568
|
structure: structureSchema.default(DEFAULTS.structure),
|
|
569
|
+
language: languageSchema.default(DEFAULTS.language),
|
|
545
570
|
domains: z.array(z.string()).optional()
|
|
546
571
|
}).passthrough().default({}),
|
|
547
572
|
team: z.object({
|
|
@@ -1654,11 +1679,24 @@ function renderAgentTrace(agent) {
|
|
|
1654
1679
|
""
|
|
1655
1680
|
].join("\n");
|
|
1656
1681
|
}
|
|
1682
|
+
function renderLanguageRule() {
|
|
1683
|
+
return [
|
|
1684
|
+
"## Project Language",
|
|
1685
|
+
"",
|
|
1686
|
+
"The project knowledge language is defined in `.kaddo/config.yml` (`project.language`) and shown",
|
|
1687
|
+
"in the context pack's Project Metadata (`Language:`). Write **all** generated knowledge",
|
|
1688
|
+
"artifacts in that language (default: English).",
|
|
1689
|
+
"",
|
|
1690
|
+
"Do not translate: code, file names, CLI commands or configuration keys.",
|
|
1691
|
+
""
|
|
1692
|
+
].join("\n");
|
|
1693
|
+
}
|
|
1657
1694
|
function withResponsibilityTrace(fileName, content) {
|
|
1658
1695
|
const agent = fileName.replace(/\.md$/, "");
|
|
1659
1696
|
if (!RESPONSIBILITY_MATRIX[agent]) return content;
|
|
1660
1697
|
return `${content.trimEnd()}
|
|
1661
1698
|
|
|
1699
|
+
${renderLanguageRule()}
|
|
1662
1700
|
${renderAgentBoundaries(agent)}
|
|
1663
1701
|
${renderAgentTrace(agent)}`;
|
|
1664
1702
|
}
|
|
@@ -2214,10 +2252,12 @@ A refined Work Item intended to be saved under the lifecycle workspace:
|
|
|
2214
2252
|
Keep \`chore\` for maintenance/tooling/config/infra work \u2014 never upgrade a chore to a feature.
|
|
2215
2253
|
4. Validate the Knowledge Level (K0\u2013K4) and propose a different one if needed.
|
|
2216
2254
|
5. Propose acceptance criteria.
|
|
2217
|
-
6. Propose Out of scope
|
|
2218
|
-
7. Propose
|
|
2219
|
-
|
|
2220
|
-
|
|
2255
|
+
6. Propose an Out of scope section.
|
|
2256
|
+
7. Propose **how to test it** \u2014 concrete validation steps (commands to run, manual steps, or
|
|
2257
|
+
test cases) that prove the change works once implemented. This is mandatory.
|
|
2258
|
+
8. Propose a Definition of Done.
|
|
2259
|
+
9. Identify open questions and assumptions.
|
|
2260
|
+
10. Suggest ownership candidates (code globs) if evident.
|
|
2221
2261
|
|
|
2222
2262
|
## Constraints
|
|
2223
2263
|
|
|
@@ -2241,7 +2281,11 @@ A refined Work Item intended to be saved under the lifecycle workspace:
|
|
|
2241
2281
|
|
|
2242
2282
|
**Out of scope:**
|
|
2243
2283
|
|
|
2244
|
-
**
|
|
2284
|
+
**How to test it (validation):**
|
|
2285
|
+
<!-- concrete steps to verify once implemented, e.g.:
|
|
2286
|
+
1. \`pnpm test path/to/spec\` (or the project's test command)
|
|
2287
|
+
2. Manual: <action> \u2192 expected <result>
|
|
2288
|
+
3. \`kaddo guard\` shows no unexpected drift -->
|
|
2245
2289
|
|
|
2246
2290
|
**Definition of Done:**
|
|
2247
2291
|
|
|
@@ -2261,7 +2305,7 @@ and \`blocked\` as active work; \`completed\` and \`archived\` are historical kn
|
|
|
2261
2305
|
When the Work Item is refined and ready to build, **hand off to the implementation-agent**.
|
|
2262
2306
|
You do **not** suggest branches, commits or pull requests \u2014 implementation (including any Git
|
|
2263
2307
|
branch suggestion) is the implementation-agent's responsibility, and only by respecting the
|
|
2264
|
-
project Git strategy. Your job ends at a clear, traceable Work Item
|
|
2308
|
+
project Git strategy. Your job ends at a clear, traceable Work Item that **states how to test it**.
|
|
2265
2309
|
|
|
2266
2310
|
## Quality Checklist
|
|
2267
2311
|
|
|
@@ -2269,7 +2313,8 @@ project Git strategy. Your job ends at a clear, traceable Work Item.
|
|
|
2269
2313
|
- Large candidates are split.
|
|
2270
2314
|
- Knowledge Level is justified.
|
|
2271
2315
|
- Acceptance criteria are testable.
|
|
2272
|
-
- Out of scope
|
|
2316
|
+
- Out of scope is stated.
|
|
2317
|
+
- **How to test it** is concrete (commands, manual steps, or test cases).
|
|
2273
2318
|
- Open questions are explicit.
|
|
2274
2319
|
- Handoff: next step is the implementation-agent (never a branch or commit).
|
|
2275
2320
|
`;
|
|
@@ -2822,7 +2867,9 @@ Conventional Commit message \u2014 as suggestions, never executed.
|
|
|
2822
2867
|
4. Suggest running \`kaddo owners suggest\` and confirm the \`code:\` globs.
|
|
2823
2868
|
5. Suggest running \`kaddo guard\` before committing to detect knowledge drift.
|
|
2824
2869
|
6. Update affected knowledge (ADR / capabilities.md / current-state.md).
|
|
2825
|
-
7.
|
|
2870
|
+
7. **Explain how to test it** \u2014 the exact commands and/or manual steps to verify the change works
|
|
2871
|
+
(run the Work Item's "How to test it" steps and report the result).
|
|
2872
|
+
8. Suggest a Conventional Commit message and **wait for explicit human confirmation**. Never
|
|
2826
2873
|
commit, push or merge on your own.
|
|
2827
2874
|
|
|
2828
2875
|
## Constraints
|
|
@@ -2845,6 +2892,9 @@ Conventional Commit message \u2014 as suggestions, never executed.
|
|
|
2845
2892
|
|
|
2846
2893
|
## Tests
|
|
2847
2894
|
|
|
2895
|
+
## How to test it
|
|
2896
|
+
<!-- exact commands and/or manual steps to verify, e.g. run the test suite, start the app then <action> -->
|
|
2897
|
+
|
|
2848
2898
|
## Knowledge to update
|
|
2849
2899
|
|
|
2850
2900
|
## Suggested commit (await human confirmation)
|
|
@@ -2858,6 +2908,7 @@ Code, tests and migrations live in the repository. Knowledge updates go under \`
|
|
|
2858
2908
|
|
|
2859
2909
|
- A branch is suggested per the Git strategy (never executed).
|
|
2860
2910
|
- Tests accompany the change.
|
|
2911
|
+
- **How to test it** is stated (exact commands / manual steps to verify).
|
|
2861
2912
|
- \`kaddo scan\` / \`owners suggest\` / \`guard\` are suggested at the right moments.
|
|
2862
2913
|
- Affected knowledge is updated.
|
|
2863
2914
|
- Commit is suggested and awaits human confirmation \u2014 never run automatically.
|
|
@@ -5258,7 +5309,8 @@ function buildProjectExplanation(dir) {
|
|
|
5258
5309
|
name: config?.project.name ?? "unknown",
|
|
5259
5310
|
state: config?.project.state ?? "unknown",
|
|
5260
5311
|
teamSize: config?.team.size ?? "unknown",
|
|
5261
|
-
structure: config?.project.structure ?? "unknown"
|
|
5312
|
+
structure: config?.project.structure ?? "unknown",
|
|
5313
|
+
language: config ? languageLabel(projectLanguage(config)) : "English"
|
|
5262
5314
|
};
|
|
5263
5315
|
const scan2 = loadScan(dir);
|
|
5264
5316
|
const stack = scan2 ? {
|
|
@@ -5404,6 +5456,7 @@ function renderExplanationHuman(exp) {
|
|
|
5404
5456
|
lines.push(`- State: ${stateLabel(exp.project.state)}`);
|
|
5405
5457
|
lines.push(`- Team: ${exp.project.teamSize}`);
|
|
5406
5458
|
lines.push(`- Structure: ${exp.project.structure}`);
|
|
5459
|
+
lines.push(`- Project language: ${exp.project.language}`);
|
|
5407
5460
|
lines.push("");
|
|
5408
5461
|
lines.push("## Knowledge Layers");
|
|
5409
5462
|
lines.push(renderLayersMarkdown(exp.layers));
|
|
@@ -5873,7 +5926,8 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
|
|
|
5873
5926
|
name: config.project.name,
|
|
5874
5927
|
state,
|
|
5875
5928
|
teamSize: config.team.size,
|
|
5876
|
-
structure: config.project.structure
|
|
5929
|
+
structure: config.project.structure,
|
|
5930
|
+
language: languageLabel(projectLanguage(config))
|
|
5877
5931
|
},
|
|
5878
5932
|
scan: {
|
|
5879
5933
|
available: scanJson !== null,
|
|
@@ -5929,7 +5983,8 @@ function renderContextPack(pack) {
|
|
|
5929
5983
|
`- Name: ${project.name}`,
|
|
5930
5984
|
`- State: ${project.state}`,
|
|
5931
5985
|
`- Team size: ${project.teamSize}`,
|
|
5932
|
-
`- Structure: ${project.structure}
|
|
5986
|
+
`- Structure: ${project.structure}`,
|
|
5987
|
+
`- Language: ${project.language}`
|
|
5933
5988
|
].join("\n") + "\n"
|
|
5934
5989
|
);
|
|
5935
5990
|
parts.push("## Current Phase\n");
|
|
@@ -6352,6 +6407,7 @@ function runUnderstand() {
|
|
|
6352
6407
|
);
|
|
6353
6408
|
}
|
|
6354
6409
|
console.log(renderUnderstandTerminal(plan));
|
|
6410
|
+
console.log(`Project language: ${pack.project.language} (knowledge artifacts are written in this language)`);
|
|
6355
6411
|
const exp = buildProjectExplanation(dir);
|
|
6356
6412
|
const assessment = assessPhase(exp);
|
|
6357
6413
|
console.log("");
|
|
@@ -8990,6 +9046,12 @@ var BOOTSTRAP_LAYERS = ["Business", "Product", "Tech"];
|
|
|
8990
9046
|
function bootstrap(dir) {
|
|
8991
9047
|
const written = [];
|
|
8992
9048
|
const skipped = [];
|
|
9049
|
+
let language = "en";
|
|
9050
|
+
try {
|
|
9051
|
+
const config = loadConfig(dir);
|
|
9052
|
+
if (config) language = projectLanguage(config);
|
|
9053
|
+
} catch {
|
|
9054
|
+
}
|
|
8993
9055
|
for (const target of TARGETS) {
|
|
8994
9056
|
const full = join(dir, target.path);
|
|
8995
9057
|
if (exists(full)) {
|
|
@@ -8997,13 +9059,22 @@ function bootstrap(dir) {
|
|
|
8997
9059
|
continue;
|
|
8998
9060
|
}
|
|
8999
9061
|
const tpl = getTemplate(target.templateId);
|
|
9000
|
-
const
|
|
9062
|
+
const base = tpl ? tpl.content : "";
|
|
9063
|
+
const content = withLanguageDirective(base, language);
|
|
9001
9064
|
writeFile(full, content.endsWith("\n") ? content : `${content}
|
|
9002
9065
|
`);
|
|
9003
9066
|
written.push(target.path);
|
|
9004
9067
|
}
|
|
9005
9068
|
return { written, skipped, layers: BOOTSTRAP_LAYERS };
|
|
9006
9069
|
}
|
|
9070
|
+
function withLanguageDirective(content, language) {
|
|
9071
|
+
if (language !== "es") return content;
|
|
9072
|
+
const note = "> Idioma del proyecto: **espa\xF1ol**. Escribe este conocimiento en espa\xF1ol. Mant\xE9n en ingl\xE9s el c\xF3digo, los nombres de archivo, los comandos y las claves de configuraci\xF3n.\n";
|
|
9073
|
+
const fm = content.match(/^---\n[\s\S]*?\n---\n/);
|
|
9074
|
+
if (fm) return content.slice(0, fm[0].length) + "\n" + note + content.slice(fm[0].length);
|
|
9075
|
+
return `${note}
|
|
9076
|
+
${content}`;
|
|
9077
|
+
}
|
|
9007
9078
|
async function runBootstrap(dir = cwd()) {
|
|
9008
9079
|
intro2("kaddo bootstrap");
|
|
9009
9080
|
if (!exists(join(dir, CONFIG_PATH8))) {
|