@kaddo/cli 3.13.2 → 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 +64 -6
- 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
|
}
|
|
@@ -5271,7 +5309,8 @@ function buildProjectExplanation(dir) {
|
|
|
5271
5309
|
name: config?.project.name ?? "unknown",
|
|
5272
5310
|
state: config?.project.state ?? "unknown",
|
|
5273
5311
|
teamSize: config?.team.size ?? "unknown",
|
|
5274
|
-
structure: config?.project.structure ?? "unknown"
|
|
5312
|
+
structure: config?.project.structure ?? "unknown",
|
|
5313
|
+
language: config ? languageLabel(projectLanguage(config)) : "English"
|
|
5275
5314
|
};
|
|
5276
5315
|
const scan2 = loadScan(dir);
|
|
5277
5316
|
const stack = scan2 ? {
|
|
@@ -5417,6 +5456,7 @@ function renderExplanationHuman(exp) {
|
|
|
5417
5456
|
lines.push(`- State: ${stateLabel(exp.project.state)}`);
|
|
5418
5457
|
lines.push(`- Team: ${exp.project.teamSize}`);
|
|
5419
5458
|
lines.push(`- Structure: ${exp.project.structure}`);
|
|
5459
|
+
lines.push(`- Project language: ${exp.project.language}`);
|
|
5420
5460
|
lines.push("");
|
|
5421
5461
|
lines.push("## Knowledge Layers");
|
|
5422
5462
|
lines.push(renderLayersMarkdown(exp.layers));
|
|
@@ -5886,7 +5926,8 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
|
|
|
5886
5926
|
name: config.project.name,
|
|
5887
5927
|
state,
|
|
5888
5928
|
teamSize: config.team.size,
|
|
5889
|
-
structure: config.project.structure
|
|
5929
|
+
structure: config.project.structure,
|
|
5930
|
+
language: languageLabel(projectLanguage(config))
|
|
5890
5931
|
},
|
|
5891
5932
|
scan: {
|
|
5892
5933
|
available: scanJson !== null,
|
|
@@ -5942,7 +5983,8 @@ function renderContextPack(pack) {
|
|
|
5942
5983
|
`- Name: ${project.name}`,
|
|
5943
5984
|
`- State: ${project.state}`,
|
|
5944
5985
|
`- Team size: ${project.teamSize}`,
|
|
5945
|
-
`- Structure: ${project.structure}
|
|
5986
|
+
`- Structure: ${project.structure}`,
|
|
5987
|
+
`- Language: ${project.language}`
|
|
5946
5988
|
].join("\n") + "\n"
|
|
5947
5989
|
);
|
|
5948
5990
|
parts.push("## Current Phase\n");
|
|
@@ -6365,6 +6407,7 @@ function runUnderstand() {
|
|
|
6365
6407
|
);
|
|
6366
6408
|
}
|
|
6367
6409
|
console.log(renderUnderstandTerminal(plan));
|
|
6410
|
+
console.log(`Project language: ${pack.project.language} (knowledge artifacts are written in this language)`);
|
|
6368
6411
|
const exp = buildProjectExplanation(dir);
|
|
6369
6412
|
const assessment = assessPhase(exp);
|
|
6370
6413
|
console.log("");
|
|
@@ -9003,6 +9046,12 @@ var BOOTSTRAP_LAYERS = ["Business", "Product", "Tech"];
|
|
|
9003
9046
|
function bootstrap(dir) {
|
|
9004
9047
|
const written = [];
|
|
9005
9048
|
const skipped = [];
|
|
9049
|
+
let language = "en";
|
|
9050
|
+
try {
|
|
9051
|
+
const config = loadConfig(dir);
|
|
9052
|
+
if (config) language = projectLanguage(config);
|
|
9053
|
+
} catch {
|
|
9054
|
+
}
|
|
9006
9055
|
for (const target of TARGETS) {
|
|
9007
9056
|
const full = join(dir, target.path);
|
|
9008
9057
|
if (exists(full)) {
|
|
@@ -9010,13 +9059,22 @@ function bootstrap(dir) {
|
|
|
9010
9059
|
continue;
|
|
9011
9060
|
}
|
|
9012
9061
|
const tpl = getTemplate(target.templateId);
|
|
9013
|
-
const
|
|
9062
|
+
const base = tpl ? tpl.content : "";
|
|
9063
|
+
const content = withLanguageDirective(base, language);
|
|
9014
9064
|
writeFile(full, content.endsWith("\n") ? content : `${content}
|
|
9015
9065
|
`);
|
|
9016
9066
|
written.push(target.path);
|
|
9017
9067
|
}
|
|
9018
9068
|
return { written, skipped, layers: BOOTSTRAP_LAYERS };
|
|
9019
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
|
+
}
|
|
9020
9078
|
async function runBootstrap(dir = cwd()) {
|
|
9021
9079
|
intro2("kaddo bootstrap");
|
|
9022
9080
|
if (!exists(join(dir, CONFIG_PATH8))) {
|