@kaddo/cli 3.116.0 → 3.118.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 +25 -0
- package/dist/admin-dist/assets/{architectureDiagram-3BPJPVTR-DP6srEcc.js → architectureDiagram-3BPJPVTR-VNE4N202.js} +1 -1
- package/dist/admin-dist/assets/{chunk-727SXJPM-DnQC9siX.js → chunk-727SXJPM-Dycfm5kx.js} +1 -1
- package/dist/admin-dist/assets/{chunk-AQP2D5EJ-BpyJpCJ-.js → chunk-AQP2D5EJ-CZfRVDeZ.js} +1 -1
- package/dist/admin-dist/assets/{classDiagram-v2-Q7XG4LA2-CGoPFtaR.js → classDiagram-4FO5ZUOK-ZqEUMLi9.js} +1 -1
- package/dist/admin-dist/assets/{classDiagram-4FO5ZUOK-CGoPFtaR.js → classDiagram-v2-Q7XG4LA2-ZqEUMLi9.js} +1 -1
- package/dist/admin-dist/assets/{dagre-BM42HDAG-CRZz5h6U.js → dagre-BM42HDAG-BPoktDQ7.js} +1 -1
- package/dist/admin-dist/assets/{diagram-2AECGRRQ-2IUax-pn.js → diagram-2AECGRRQ-DX6VsCIO.js} +1 -1
- package/dist/admin-dist/assets/{diagram-5GNKFQAL-Dbar3g31.js → diagram-5GNKFQAL-DaVO8tr4.js} +1 -1
- package/dist/admin-dist/assets/{diagram-LMA3HP47-CDpppwwZ.js → diagram-LMA3HP47-C7OMxYl7.js} +1 -1
- package/dist/admin-dist/assets/{diagram-OG6HWLK6-CxJNrhOa.js → diagram-OG6HWLK6-Ba7L6sdv.js} +1 -1
- package/dist/admin-dist/assets/{erDiagram-TEJ5UH35-CqGkUDrY.js → erDiagram-TEJ5UH35-B8GR6jN8.js} +1 -1
- package/dist/admin-dist/assets/{flowDiagram-I6XJVG4X-Dj-jj3Xs.js → flowDiagram-I6XJVG4X-GnYF-YSu.js} +1 -1
- package/dist/admin-dist/assets/{ganttDiagram-6RSMTGT7-BsslcFFi.js → ganttDiagram-6RSMTGT7-Ci5gXlfB.js} +1 -1
- package/dist/admin-dist/assets/{index-DVXcBuvj.js → index-BQS_UR2v.js} +4 -4
- package/dist/admin-dist/assets/{infoDiagram-5YYISTIA-Bm8y-W5K.js → infoDiagram-5YYISTIA-CXCqRy3V.js} +1 -1
- package/dist/admin-dist/assets/{ishikawaDiagram-YF4QCWOH-B1q-JfoS.js → ishikawaDiagram-YF4QCWOH-CHnyKPlH.js} +1 -1
- package/dist/admin-dist/assets/{kanban-definition-UN3LZRKU-iEF70R2u.js → kanban-definition-UN3LZRKU-DZ2E5eRA.js} +1 -1
- package/dist/admin-dist/assets/{linear-Cp_M7piX.js → linear-CBbecos1.js} +1 -1
- package/dist/admin-dist/assets/{mindmap-definition-RKZ34NQL-IS3zSxy4.js → mindmap-definition-RKZ34NQL-C_PLO1RL.js} +1 -1
- package/dist/admin-dist/assets/{pieDiagram-4H26LBE5-FRW3jbwa.js → pieDiagram-4H26LBE5-Bnzx1mbG.js} +1 -1
- package/dist/admin-dist/assets/{quadrantDiagram-W4KKPZXB-BWvrA0U2.js → quadrantDiagram-W4KKPZXB-vDV6emR-.js} +1 -1
- package/dist/admin-dist/assets/{requirementDiagram-4Y6WPE33-BDo5C4-W.js → requirementDiagram-4Y6WPE33-BS-WaBoL.js} +1 -1
- package/dist/admin-dist/assets/{sequenceDiagram-3UESZ5HK-BqkNcdXk.js → sequenceDiagram-3UESZ5HK-DHBKXsre.js} +1 -1
- package/dist/admin-dist/assets/{stateDiagram-AJRCARHV-BPRhmY_L.js → stateDiagram-AJRCARHV-Cvrc0x1G.js} +1 -1
- package/dist/admin-dist/assets/{stateDiagram-v2-BHNVJYJU-DqC9KnuP.js → stateDiagram-v2-BHNVJYJU-B9k2LCWQ.js} +1 -1
- package/dist/admin-dist/assets/{timeline-definition-PNZ67QCA-BKU6Xg5t.js → timeline-definition-PNZ67QCA-BPg3zrWH.js} +1 -1
- package/dist/admin-dist/assets/{vennDiagram-CIIHVFJN-BRePJms1.js → vennDiagram-CIIHVFJN-Cr5_ruRl.js} +1 -1
- package/dist/admin-dist/assets/{wardleyDiagram-YWT4CUSO-BZP5Do-p.js → wardleyDiagram-YWT4CUSO-CCFwsa6d.js} +1 -1
- package/dist/admin-dist/assets/{xychartDiagram-2RQKCTM6-Cf0SjuRr.js → xychartDiagram-2RQKCTM6-zM8ePcPG.js} +1 -1
- package/dist/admin-dist/index.html +1 -1
- package/dist/admin-server/index.js +17 -0
- package/dist/core.js +169 -12
- package/dist/index.js +772 -329
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -94,6 +94,97 @@ async function ensureTelemetryConsent(dir, config) {
|
|
|
94
94
|
persistConsent(dir, accepted ? "enabled" : "disabled");
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
// src/core/poc.ts
|
|
98
|
+
var POC_ARTIFACT_PATH = "knowledge/delivery/poc.md";
|
|
99
|
+
function pocTemplate(projectName) {
|
|
100
|
+
return `---
|
|
101
|
+
type: poc
|
|
102
|
+
status: active
|
|
103
|
+
generated_by: kaddo-init
|
|
104
|
+
template_version: 1
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
# ${projectName} \u2014 Proof of Concept
|
|
108
|
+
|
|
109
|
+
## Problem
|
|
110
|
+
|
|
111
|
+
_What are we trying to understand or solve?_
|
|
112
|
+
|
|
113
|
+
## Hypothesis
|
|
114
|
+
|
|
115
|
+
_What assumption are we testing?_
|
|
116
|
+
|
|
117
|
+
## Expected Value
|
|
118
|
+
|
|
119
|
+
_Why is validating this worth doing?_
|
|
120
|
+
|
|
121
|
+
## Scenario
|
|
122
|
+
|
|
123
|
+
_What concrete scenario will demonstrate the hypothesis?_
|
|
124
|
+
|
|
125
|
+
## Success Criteria
|
|
126
|
+
|
|
127
|
+
- [ ] _Observable result that would support the hypothesis._
|
|
128
|
+
|
|
129
|
+
## Constraints
|
|
130
|
+
|
|
131
|
+
_Technical, time, budget, compliance, or operational constraints._
|
|
132
|
+
|
|
133
|
+
## Non-goals
|
|
134
|
+
|
|
135
|
+
_What this experiment intentionally will not prove or deliver._
|
|
136
|
+
|
|
137
|
+
## Evidence
|
|
138
|
+
|
|
139
|
+
_Link experiments, Work Items, measurements, and observations here._
|
|
140
|
+
|
|
141
|
+
## Conclusion
|
|
142
|
+
|
|
143
|
+
Status: pending
|
|
144
|
+
`;
|
|
145
|
+
}
|
|
146
|
+
function ensurePocArtifact(dir, projectName) {
|
|
147
|
+
const path13 = join(dir, POC_ARTIFACT_PATH);
|
|
148
|
+
if (exists(path13)) return false;
|
|
149
|
+
ensureDir(join(dir, "knowledge", "delivery"));
|
|
150
|
+
writeFile(path13, pocTemplate(projectName));
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
var PLACEHOLDER = /^[_<].*[_>]$|^(describe|list|document|what|how)\b/i;
|
|
154
|
+
function section(markdown, heading) {
|
|
155
|
+
const match = markdown.match(new RegExp(`^##\\s+${heading}\\s*$([\\s\\S]*?)(?=^##\\s+|(?![\\s\\S]))`, "im"));
|
|
156
|
+
return match?.[1] ?? "";
|
|
157
|
+
}
|
|
158
|
+
function meaningful(text2) {
|
|
159
|
+
return text2.split(/\r?\n/).some((line) => {
|
|
160
|
+
const value = line.trim().replace(/^[-*]\s+(?:\[[^\]]+\]\s*)?/, "");
|
|
161
|
+
return Boolean(value) && !PLACEHOLDER.test(value) && !/^status:\s*(pending|tbd)$/i.test(value);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function readPocSummary(dir) {
|
|
165
|
+
const path13 = join(dir, POC_ARTIFACT_PATH);
|
|
166
|
+
if (!exists(path13)) {
|
|
167
|
+
return { exists: false, hypothesisDefined: false, successCriteriaCount: 0, constraintsDefined: false, nonGoalsDefined: false, conclusion: "pending" };
|
|
168
|
+
}
|
|
169
|
+
let markdown = "";
|
|
170
|
+
try {
|
|
171
|
+
markdown = readFile(path13);
|
|
172
|
+
} catch {
|
|
173
|
+
return { exists: false, hypothesisDefined: false, successCriteriaCount: 0, constraintsDefined: false, nonGoalsDefined: false, conclusion: "pending" };
|
|
174
|
+
}
|
|
175
|
+
const criteria = section(markdown, "Success Criteria").split(/\r?\n/).filter((line) => /^\s*[-*]\s+(?:\[[ xX]\]\s+)?/.test(line)).filter((line) => meaningful(line)).length;
|
|
176
|
+
const conclusionBody = section(markdown, "Conclusion");
|
|
177
|
+
const conclusionMatch = conclusionBody.match(/\b(?:status|outcome)\s*:\s*(validated|rejected|inconclusive)\b/i);
|
|
178
|
+
return {
|
|
179
|
+
exists: true,
|
|
180
|
+
hypothesisDefined: meaningful(section(markdown, "Hypothesis")),
|
|
181
|
+
successCriteriaCount: criteria,
|
|
182
|
+
constraintsDefined: meaningful(section(markdown, "Constraints")),
|
|
183
|
+
nonGoalsDefined: meaningful(section(markdown, "Non-goals")),
|
|
184
|
+
conclusion: conclusionMatch ? conclusionMatch[1].toLowerCase() : "pending"
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
97
188
|
// src/commands/init.ts
|
|
98
189
|
var KADDO_DIR = ".kaddo";
|
|
99
190
|
var ARCH_DIR = "knowledge";
|
|
@@ -116,6 +207,7 @@ function buildConfig(meta) {
|
|
|
116
207
|
project:
|
|
117
208
|
name: "${meta.name}"
|
|
118
209
|
state: ${meta.state}
|
|
210
|
+
mode: ${meta.mode}
|
|
119
211
|
structure: ${meta.structure}
|
|
120
212
|
language: ${meta.language}${meta.role ? `
|
|
121
213
|
role: ${meta.role}` : ""}
|
|
@@ -306,9 +398,14 @@ _What comes after the current cycle._
|
|
|
306
398
|
_Ideas and intentions not yet committed._
|
|
307
399
|
`;
|
|
308
400
|
}
|
|
309
|
-
async function runInit() {
|
|
401
|
+
async function runInit(opts = {}) {
|
|
310
402
|
const dir = cwd();
|
|
311
403
|
intro("kaddo init");
|
|
404
|
+
if (opts.mode !== void 0 && opts.mode !== "standard" && opts.mode !== "poc") {
|
|
405
|
+
console.error("Project mode must be `standard` or `poc`.");
|
|
406
|
+
process.exitCode = 1;
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
312
409
|
if (!hasGit(dir)) {
|
|
313
410
|
log.warn("No Git repository detected. Kaddo works best inside a Git repo.");
|
|
314
411
|
}
|
|
@@ -378,6 +475,14 @@ async function runInit() {
|
|
|
378
475
|
],
|
|
379
476
|
initialValue: "pre-ai"
|
|
380
477
|
});
|
|
478
|
+
const mode = opts.mode ?? await select({
|
|
479
|
+
message: "Project mode",
|
|
480
|
+
options: [
|
|
481
|
+
{ value: "standard", label: "Standard", hint: "Product and delivery lifecycle" },
|
|
482
|
+
{ value: "poc", label: "Proof of Concept", hint: "Test a hypothesis with focused evidence" }
|
|
483
|
+
],
|
|
484
|
+
initialValue: "standard"
|
|
485
|
+
});
|
|
381
486
|
const language = await select({
|
|
382
487
|
message: "Project knowledge language (the CLI stays in English)",
|
|
383
488
|
options: [
|
|
@@ -399,6 +504,7 @@ async function runInit() {
|
|
|
399
504
|
const meta = {
|
|
400
505
|
name: projectName.trim(),
|
|
401
506
|
state,
|
|
507
|
+
mode,
|
|
402
508
|
teamSize,
|
|
403
509
|
structure,
|
|
404
510
|
language,
|
|
@@ -422,10 +528,15 @@ async function runInit() {
|
|
|
422
528
|
if (!exists(join(dir, ARCH_DIR, "tech", "codebase.md"))) {
|
|
423
529
|
writeFile(join(dir, ARCH_DIR, "tech", "codebase.md"), buildKnowledge(projectName.trim()));
|
|
424
530
|
}
|
|
531
|
+
if (mode === "poc") {
|
|
532
|
+
ensureDir(join(dir, ARCH_DIR, "delivery", "work-items"));
|
|
533
|
+
writeFile(join(dir, ARCH_DIR, "delivery", "poc.md"), pocTemplate(projectName.trim()));
|
|
534
|
+
log.success("Created knowledge/delivery/poc.md");
|
|
535
|
+
}
|
|
425
536
|
log.success("Created knowledge/tech/module/module-context.md");
|
|
426
537
|
log.success("Created knowledge/tech/current-state.md");
|
|
427
538
|
log.success("Created knowledge/tech/codebase.md");
|
|
428
|
-
log.info("Next: run `kaddo scan` to detect your stack, then use module-context-agent to refine module-context.md.");
|
|
539
|
+
log.info(mode === "poc" ? "Next: define the POC hypothesis and success criteria, then document the minimal experiment context." : "Next: run `kaddo scan` to detect your stack, then use module-context-agent to refine module-context.md.");
|
|
429
540
|
} else if (role === "core") {
|
|
430
541
|
const sysName = systemName3?.trim() ?? projectName.trim();
|
|
431
542
|
ensureDir(join(dir, ARCH_DIR, "delivery", "work-items"));
|
|
@@ -434,12 +545,14 @@ async function runInit() {
|
|
|
434
545
|
ensureDir(join(dir, ARCH_DIR, "agents"));
|
|
435
546
|
ensureDir(join(dir, ARCH_DIR, "skills"));
|
|
436
547
|
writeFile(join(dir, ARCH_DIR, "knowledge.md"), buildKnowledge(projectName.trim()));
|
|
437
|
-
writeFile(join(dir, ARCH_DIR, "delivery", "
|
|
548
|
+
if (mode === "poc") writeFile(join(dir, ARCH_DIR, "delivery", "poc.md"), pocTemplate(projectName.trim()));
|
|
549
|
+
else writeFile(join(dir, ARCH_DIR, "delivery", "roadmap.md"), buildRoadmap(projectName.trim()));
|
|
438
550
|
writeFile(join(dir, ARCH_DIR, "tech", "system", "system-context.md"), buildSystemContext(sysName));
|
|
439
551
|
writeFile(join(dir, ARCH_DIR, "tech", "modules", "modules.md"), buildModulesFile(sysName));
|
|
440
552
|
writeFile(join(dir, KADDO_DIR, "modules.yml"), buildModulesYml(sysName));
|
|
441
553
|
log.success("Created knowledge/knowledge.md");
|
|
442
|
-
log.success("Created knowledge/delivery/
|
|
554
|
+
if (mode === "poc") log.success("Created knowledge/delivery/poc.md");
|
|
555
|
+
else log.success("Created knowledge/delivery/roadmap.md");
|
|
443
556
|
log.success("Created knowledge/tech/system/system-context.md");
|
|
444
557
|
log.success("Created knowledge/tech/modules/modules.md");
|
|
445
558
|
log.success("Created .kaddo/modules.yml");
|
|
@@ -447,11 +560,13 @@ async function runInit() {
|
|
|
447
560
|
} else {
|
|
448
561
|
ensureDir(join(dir, ARCH_DIR, "delivery", "work-items"));
|
|
449
562
|
writeFile(join(dir, ARCH_DIR, "knowledge.md"), buildKnowledge(projectName.trim()));
|
|
450
|
-
writeFile(join(dir, ARCH_DIR, "delivery", "
|
|
563
|
+
if (mode === "poc") writeFile(join(dir, ARCH_DIR, "delivery", "poc.md"), pocTemplate(projectName.trim()));
|
|
564
|
+
else writeFile(join(dir, ARCH_DIR, "delivery", "roadmap.md"), buildRoadmap(projectName.trim()));
|
|
451
565
|
log.success("Created knowledge/knowledge.md");
|
|
452
|
-
log.success("Created knowledge/delivery/
|
|
566
|
+
if (mode === "poc") log.success("Created knowledge/delivery/poc.md");
|
|
567
|
+
else log.success("Created knowledge/delivery/roadmap.md");
|
|
453
568
|
log.success("Created knowledge/delivery/work-items/");
|
|
454
|
-
log.info("Next: run `kaddo scan` to detect your stack.");
|
|
569
|
+
log.info(mode === "poc" ? "Next: define the POC hypothesis and success criteria in `knowledge/delivery/poc.md`." : "Next: run `kaddo scan` to detect your stack.");
|
|
455
570
|
}
|
|
456
571
|
if (isInteractive()) {
|
|
457
572
|
const enableTelemetry = await confirm({
|
|
@@ -465,6 +580,225 @@ async function runInit() {
|
|
|
465
580
|
outro("Kaddo initialized.");
|
|
466
581
|
}
|
|
467
582
|
|
|
583
|
+
// src/core/config.ts
|
|
584
|
+
import { z } from "zod";
|
|
585
|
+
import { parse as parseYaml2, stringify as stringifyYaml2 } from "yaml";
|
|
586
|
+
var PROJECT_STATES = ["new", "pre-ai", "legacy", "ai-assisted"];
|
|
587
|
+
var PROJECT_MODES = ["standard", "poc"];
|
|
588
|
+
var TEAM_SIZES = ["indie", "small", "medium", "enterprise"];
|
|
589
|
+
var REPOSITORY_STRUCTURES = ["monorepo", "multirepo"];
|
|
590
|
+
var PROJECT_LANGUAGES = ["en", "es"];
|
|
591
|
+
var DEFAULTS = {
|
|
592
|
+
state: "pre-ai",
|
|
593
|
+
mode: "standard",
|
|
594
|
+
structure: "monorepo",
|
|
595
|
+
teamSize: "indie",
|
|
596
|
+
language: "en"
|
|
597
|
+
};
|
|
598
|
+
function languageLabel(lang) {
|
|
599
|
+
return lang === "es" ? "Spanish" : "English";
|
|
600
|
+
}
|
|
601
|
+
function projectLanguage(config) {
|
|
602
|
+
const lang = config.project.language;
|
|
603
|
+
return lang === "es" ? "es" : "en";
|
|
604
|
+
}
|
|
605
|
+
function projectMode(config) {
|
|
606
|
+
return config.project.mode === "poc" ? "poc" : "standard";
|
|
607
|
+
}
|
|
608
|
+
var ConfigError = class extends Error {
|
|
609
|
+
constructor(message) {
|
|
610
|
+
super(message);
|
|
611
|
+
this.name = "ConfigError";
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
var projectStateSchema = z.enum(["new", "pre-ai", "legacy", "ai-assisted"], {
|
|
615
|
+
errorMap: () => ({
|
|
616
|
+
message: `project.state must be one of: ${PROJECT_STATES.join(", ")}`
|
|
617
|
+
})
|
|
618
|
+
});
|
|
619
|
+
var projectModeSchema = z.enum(["standard", "poc"], {
|
|
620
|
+
errorMap: () => ({
|
|
621
|
+
message: `project.mode must be one of: ${PROJECT_MODES.join(", ")}`
|
|
622
|
+
})
|
|
623
|
+
});
|
|
624
|
+
var teamSizeSchema = z.enum(["indie", "small", "medium", "enterprise"], {
|
|
625
|
+
errorMap: () => ({
|
|
626
|
+
message: `team.size must be one of: ${TEAM_SIZES.join(", ")}`
|
|
627
|
+
})
|
|
628
|
+
});
|
|
629
|
+
var structureSchema = z.enum(["monorepo", "multirepo"], {
|
|
630
|
+
errorMap: () => ({
|
|
631
|
+
message: `project.structure must be one of: ${REPOSITORY_STRUCTURES.join(", ")}`
|
|
632
|
+
})
|
|
633
|
+
});
|
|
634
|
+
var languageSchema = z.enum(["en", "es"], {
|
|
635
|
+
errorMap: () => ({
|
|
636
|
+
message: `project.language must be one of: ${PROJECT_LANGUAGES.join(", ")}`
|
|
637
|
+
})
|
|
638
|
+
});
|
|
639
|
+
var multirepoRoleSchema = z.enum(["core", "module"]).optional();
|
|
640
|
+
var configSchema = z.object({
|
|
641
|
+
version: z.union([z.string(), z.number()]).optional(),
|
|
642
|
+
project: z.object({
|
|
643
|
+
name: z.string().default("project"),
|
|
644
|
+
state: projectStateSchema.default(DEFAULTS.state),
|
|
645
|
+
mode: projectModeSchema.default(DEFAULTS.mode),
|
|
646
|
+
structure: structureSchema.default(DEFAULTS.structure),
|
|
647
|
+
language: languageSchema.default(DEFAULTS.language),
|
|
648
|
+
role: multirepoRoleSchema,
|
|
649
|
+
domains: z.array(z.string()).optional()
|
|
650
|
+
}).passthrough().default({}),
|
|
651
|
+
team: z.object({
|
|
652
|
+
size: teamSizeSchema.default(DEFAULTS.teamSize)
|
|
653
|
+
}).passthrough().default({}),
|
|
654
|
+
system: z.object({
|
|
655
|
+
name: z.string().optional()
|
|
656
|
+
}).passthrough().optional(),
|
|
657
|
+
multirepo: z.object({
|
|
658
|
+
role: multirepoRoleSchema,
|
|
659
|
+
modules_file: z.string().optional(),
|
|
660
|
+
parent_system: z.string().optional(),
|
|
661
|
+
workspace_roots: z.array(z.string()).optional()
|
|
662
|
+
}).passthrough().optional(),
|
|
663
|
+
module: z.object({
|
|
664
|
+
id: z.string().optional()
|
|
665
|
+
}).passthrough().optional(),
|
|
666
|
+
knowledge: z.unknown().optional(),
|
|
667
|
+
guard: z.unknown().optional(),
|
|
668
|
+
scan: z.unknown().optional(),
|
|
669
|
+
telemetry: z.object({
|
|
670
|
+
consent: z.enum(["enabled", "disabled"]).optional(),
|
|
671
|
+
consentVersion: z.number().optional(),
|
|
672
|
+
enabled: z.boolean().optional()
|
|
673
|
+
}).passthrough().optional()
|
|
674
|
+
}).passthrough();
|
|
675
|
+
function configPathFor(dir) {
|
|
676
|
+
return join(dir, ".kaddo", "config.yml");
|
|
677
|
+
}
|
|
678
|
+
function loadConfig(dir) {
|
|
679
|
+
const configPath = configPathFor(dir);
|
|
680
|
+
if (!exists(configPath)) return null;
|
|
681
|
+
let raw;
|
|
682
|
+
try {
|
|
683
|
+
raw = parseYaml2(readFile(configPath));
|
|
684
|
+
} catch (err) {
|
|
685
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
686
|
+
throw new ConfigError(`Could not parse .kaddo/config.yml: ${detail}`);
|
|
687
|
+
}
|
|
688
|
+
const parsed = configSchema.safeParse(raw ?? {});
|
|
689
|
+
if (!parsed.success) {
|
|
690
|
+
const issues = parsed.error.issues.map((i) => {
|
|
691
|
+
const path13 = i.path.join(".");
|
|
692
|
+
return path13 ? ` - ${path13}: ${i.message}` : ` - ${i.message}`;
|
|
693
|
+
}).join("\n");
|
|
694
|
+
throw new ConfigError(`Invalid .kaddo/config.yml:
|
|
695
|
+
${issues}`);
|
|
696
|
+
}
|
|
697
|
+
return parsed.data;
|
|
698
|
+
}
|
|
699
|
+
function setProjectMode(dir, mode) {
|
|
700
|
+
const configPath = configPathFor(dir);
|
|
701
|
+
if (!exists(configPath)) throw new ConfigError("No .kaddo/config.yml found. Run `kaddo init` first.");
|
|
702
|
+
let raw;
|
|
703
|
+
try {
|
|
704
|
+
raw = parseYaml2(readFile(configPath)) ?? {};
|
|
705
|
+
} catch (err) {
|
|
706
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
707
|
+
throw new ConfigError(`Could not parse .kaddo/config.yml: ${detail}`);
|
|
708
|
+
}
|
|
709
|
+
const project = raw.project && typeof raw.project === "object" && !Array.isArray(raw.project) ? raw.project : {};
|
|
710
|
+
raw.project = { ...project, mode };
|
|
711
|
+
writeFile(configPath, stringifyYaml2(raw));
|
|
712
|
+
const updated = loadConfig(dir);
|
|
713
|
+
if (!updated) throw new ConfigError("Could not reload .kaddo/config.yml after updating project.mode.");
|
|
714
|
+
return updated;
|
|
715
|
+
}
|
|
716
|
+
function requireConfig(dir) {
|
|
717
|
+
let config;
|
|
718
|
+
try {
|
|
719
|
+
config = loadConfig(dir);
|
|
720
|
+
} catch (err) {
|
|
721
|
+
const message = err instanceof ConfigError ? err.message : String(err);
|
|
722
|
+
console.error(message);
|
|
723
|
+
process.exit(1);
|
|
724
|
+
}
|
|
725
|
+
if (!config) {
|
|
726
|
+
console.error("No .kaddo/config.yml found. Run `kaddo init` first.");
|
|
727
|
+
process.exit(1);
|
|
728
|
+
}
|
|
729
|
+
return config;
|
|
730
|
+
}
|
|
731
|
+
function nextStepsForState(state) {
|
|
732
|
+
switch (state) {
|
|
733
|
+
case "new":
|
|
734
|
+
return "Define initial knowledge, create your first work item, and grow the roadmap gradually.";
|
|
735
|
+
case "legacy":
|
|
736
|
+
return "Use this baseline to identify risks, unknowns and safe modernization candidates before changing code.";
|
|
737
|
+
case "pre-ai":
|
|
738
|
+
default:
|
|
739
|
+
return "Use this baseline to create a context pack and understand the existing system with LLM agents.";
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
function createGuidanceForState(state) {
|
|
743
|
+
switch (state) {
|
|
744
|
+
case "new":
|
|
745
|
+
return "Create the first work item to shape the product.";
|
|
746
|
+
case "legacy":
|
|
747
|
+
return "Prefer small, low-risk work items and capture unknowns.";
|
|
748
|
+
case "pre-ai":
|
|
749
|
+
default:
|
|
750
|
+
return "Create this work item from existing context or roadmap when available.";
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
function describeProject(config) {
|
|
754
|
+
const state = config.project.state;
|
|
755
|
+
const stateLabel3 = state === "pre-ai" ? "pre-AI" : state;
|
|
756
|
+
const role = projectRole(config);
|
|
757
|
+
const roleSuffix = role ? ` (${role})` : "";
|
|
758
|
+
return `${stateLabel3} ${config.project.structure}${roleSuffix}`;
|
|
759
|
+
}
|
|
760
|
+
function projectRole(config) {
|
|
761
|
+
return config.project.role ?? config.multirepo?.role;
|
|
762
|
+
}
|
|
763
|
+
function isModule(config) {
|
|
764
|
+
return projectRole(config) === "module";
|
|
765
|
+
}
|
|
766
|
+
function isCore(config) {
|
|
767
|
+
return projectRole(config) === "core";
|
|
768
|
+
}
|
|
769
|
+
function systemName(config) {
|
|
770
|
+
return config.system?.name;
|
|
771
|
+
}
|
|
772
|
+
function workspaceRoots(config) {
|
|
773
|
+
return config.multirepo?.workspace_roots ?? [".."];
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
// src/commands/project.ts
|
|
777
|
+
function runProjectMode(mode) {
|
|
778
|
+
const dir = cwd();
|
|
779
|
+
try {
|
|
780
|
+
if (mode === void 0) {
|
|
781
|
+
const config2 = loadConfig(dir);
|
|
782
|
+
if (!config2) throw new ConfigError("No .kaddo/config.yml found. Run `kaddo init` first.");
|
|
783
|
+
console.log(`Project mode: ${projectMode(config2)}`);
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
if (mode !== "standard" && mode !== "poc") {
|
|
787
|
+
console.error("Project mode must be `standard` or `poc`.");
|
|
788
|
+
process.exitCode = 1;
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
const config = setProjectMode(dir, mode);
|
|
792
|
+
if (mode === "poc" && ensurePocArtifact(dir, config.project.name)) {
|
|
793
|
+
console.log("Created knowledge/delivery/poc.md");
|
|
794
|
+
}
|
|
795
|
+
console.log(`Project mode set to: ${mode}`);
|
|
796
|
+
} catch (err) {
|
|
797
|
+
console.error(err instanceof ConfigError ? err.message : String(err));
|
|
798
|
+
process.exitCode = 1;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
|
|
468
802
|
// src/core/scan-signals.ts
|
|
469
803
|
function emptySignals() {
|
|
470
804
|
return {
|
|
@@ -1180,282 +1514,117 @@ function scan(dir) {
|
|
|
1180
1514
|
}
|
|
1181
1515
|
|
|
1182
1516
|
// src/commands/scan.ts
|
|
1183
|
-
import { parse as parseYaml4, stringify as
|
|
1184
|
-
|
|
1185
|
-
// src/core/scan-baseline.ts
|
|
1186
|
-
import { parse as
|
|
1187
|
-
var SCAN_BASELINE_VERSION = "1";
|
|
1188
|
-
var UNKNOWN = "unknown";
|
|
1189
|
-
function
|
|
1190
|
-
return values.filter((v) => v && v !== UNKNOWN && v !== "none");
|
|
1191
|
-
}
|
|
1192
|
-
function readProjectContext(dir) {
|
|
1193
|
-
const context = {
|
|
1194
|
-
state: UNKNOWN,
|
|
1195
|
-
structure: UNKNOWN,
|
|
1196
|
-
teamSize: UNKNOWN
|
|
1197
|
-
};
|
|
1198
|
-
const configPath = join(dir, ".kaddo", "config.yml");
|
|
1199
|
-
if (!exists(configPath)) return context;
|
|
1200
|
-
try {
|
|
1201
|
-
const config = parseYaml2(readFile(configPath));
|
|
1202
|
-
const project = config.project ?? {};
|
|
1203
|
-
const team = config.team ?? {};
|
|
1204
|
-
if (typeof project.state === "string") context.state = project.state;
|
|
1205
|
-
if (typeof project.structure === "string") context.structure = project.structure;
|
|
1206
|
-
if (typeof team.size === "string") context.teamSize = team.size;
|
|
1207
|
-
} catch {
|
|
1208
|
-
}
|
|
1209
|
-
return context;
|
|
1210
|
-
}
|
|
1211
|
-
function buildOpenQuestions(result, context) {
|
|
1212
|
-
const questions = [];
|
|
1213
|
-
for (const domain of result.suggestedDomains) {
|
|
1214
|
-
const clean = domain.replace(/^#\s*/, "").trim();
|
|
1215
|
-
if (clean) {
|
|
1216
|
-
questions.push(`Confirm whether the '${clean}' domain reflects a real bounded context.`);
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
if (result.testDirs.length === 0) {
|
|
1220
|
-
questions.push("No test directory detected \u2014 confirm how this project is tested.");
|
|
1221
|
-
}
|
|
1222
|
-
if (context.state === "legacy") {
|
|
1223
|
-
questions.push("Legacy project: identify the highest-risk areas before changing them.");
|
|
1224
|
-
}
|
|
1225
|
-
return questions;
|
|
1226
|
-
}
|
|
1227
|
-
function buildBaseline(result, context, now = /* @__PURE__ */ new Date()) {
|
|
1228
|
-
return {
|
|
1229
|
-
version: SCAN_BASELINE_VERSION,
|
|
1230
|
-
generatedAt: now.toISOString(),
|
|
1231
|
-
project: context,
|
|
1232
|
-
detected: {
|
|
1233
|
-
languages: meaningful(result.language),
|
|
1234
|
-
frameworks: meaningful(result.framework),
|
|
1235
|
-
packageManagers: meaningful(result.packageManager),
|
|
1236
|
-
sourceDirectories: result.codeDirs,
|
|
1237
|
-
migrationDirectories: result.migrationDirs,
|
|
1238
|
-
contractFiles: result.contractFiles,
|
|
1239
|
-
infrastructureFiles: result.infraFiles,
|
|
1240
|
-
testDirectories: result.testDirs
|
|
1241
|
-
},
|
|
1242
|
-
signals: result.signals,
|
|
1243
|
-
suggestions: {
|
|
1244
|
-
possibleDomains: result.suggestedDomains.map((d) => d.replace(/^#\s*/, "").trim()).filter(Boolean),
|
|
1245
|
-
openQuestions: buildOpenQuestions(result, context)
|
|
1246
|
-
}
|
|
1247
|
-
};
|
|
1248
|
-
}
|
|
1249
|
-
function serializeBaseline(baseline) {
|
|
1250
|
-
return JSON.stringify(baseline, null, 2) + "\n";
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
// src/templates/inventory-template.ts
|
|
1254
|
-
function section(title, items, emptyNote = "_(none detected)_") {
|
|
1255
|
-
const body = items.length > 0 ? items.map((i) => `- ${i}`).join("\n") : emptyNote;
|
|
1256
|
-
return `## ${title}
|
|
1257
|
-
|
|
1258
|
-
${body}
|
|
1259
|
-
`;
|
|
1260
|
-
}
|
|
1261
|
-
function renderInventory(baseline) {
|
|
1262
|
-
const { project, detected, suggestions } = baseline;
|
|
1263
|
-
const parts = [];
|
|
1264
|
-
parts.push("# Project Inventory\n");
|
|
1265
|
-
parts.push(
|
|
1266
|
-
"> Generated by `kaddo scan`. Deterministic technical baseline \u2014 not an interpretation of the system.\n"
|
|
1267
|
-
);
|
|
1268
|
-
parts.push(
|
|
1269
|
-
section("Project Context", [
|
|
1270
|
-
`State: ${project.state}`,
|
|
1271
|
-
`Structure: ${project.structure}`,
|
|
1272
|
-
`Team size: ${project.teamSize}`
|
|
1273
|
-
])
|
|
1274
|
-
);
|
|
1275
|
-
parts.push(
|
|
1276
|
-
section("Detected Stack", [
|
|
1277
|
-
`Language: ${detected.languages.join(", ") || "unknown"}`,
|
|
1278
|
-
`Framework: ${detected.frameworks.join(", ") || "unknown"}`,
|
|
1279
|
-
`Package manager: ${detected.packageManagers.join(", ") || "unknown"}`
|
|
1280
|
-
])
|
|
1281
|
-
);
|
|
1282
|
-
parts.push(section("Source Directories", detected.sourceDirectories.map((d) => `${d}/`)));
|
|
1283
|
-
parts.push(section("Migrations", detected.migrationDirectories.map((d) => `${d}/`)));
|
|
1284
|
-
parts.push(section("Contracts", detected.contractFiles));
|
|
1285
|
-
parts.push(section("Infrastructure", detected.infrastructureFiles));
|
|
1286
|
-
parts.push(section("Tests", detected.testDirectories.map((d) => `${d}/`)));
|
|
1287
|
-
if (signalCount(baseline.signals) > 0) {
|
|
1288
|
-
parts.push("## Detected Signals\n");
|
|
1289
|
-
parts.push(renderSignalsInventory(baseline.signals));
|
|
1290
|
-
}
|
|
1291
|
-
parts.push(section("Possible Domains", suggestions.possibleDomains));
|
|
1292
|
-
parts.push(section("Open Questions", suggestions.openQuestions));
|
|
1293
|
-
return parts.join("\n");
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
// src/core/config.ts
|
|
1297
|
-
import { z } from "zod";
|
|
1298
|
-
import { parse as parseYaml3 } from "yaml";
|
|
1299
|
-
var PROJECT_STATES = ["new", "pre-ai", "legacy", "ai-assisted"];
|
|
1300
|
-
var TEAM_SIZES = ["indie", "small", "medium", "enterprise"];
|
|
1301
|
-
var REPOSITORY_STRUCTURES = ["monorepo", "multirepo"];
|
|
1302
|
-
var PROJECT_LANGUAGES = ["en", "es"];
|
|
1303
|
-
var DEFAULTS = {
|
|
1304
|
-
state: "pre-ai",
|
|
1305
|
-
structure: "monorepo",
|
|
1306
|
-
teamSize: "indie",
|
|
1307
|
-
language: "en"
|
|
1308
|
-
};
|
|
1309
|
-
function languageLabel(lang) {
|
|
1310
|
-
return lang === "es" ? "Spanish" : "English";
|
|
1311
|
-
}
|
|
1312
|
-
function projectLanguage(config) {
|
|
1313
|
-
const lang = config.project.language;
|
|
1314
|
-
return lang === "es" ? "es" : "en";
|
|
1315
|
-
}
|
|
1316
|
-
var ConfigError = class extends Error {
|
|
1317
|
-
constructor(message) {
|
|
1318
|
-
super(message);
|
|
1319
|
-
this.name = "ConfigError";
|
|
1320
|
-
}
|
|
1321
|
-
};
|
|
1322
|
-
var projectStateSchema = z.enum(["new", "pre-ai", "legacy", "ai-assisted"], {
|
|
1323
|
-
errorMap: () => ({
|
|
1324
|
-
message: `project.state must be one of: ${PROJECT_STATES.join(", ")}`
|
|
1325
|
-
})
|
|
1326
|
-
});
|
|
1327
|
-
var teamSizeSchema = z.enum(["indie", "small", "medium", "enterprise"], {
|
|
1328
|
-
errorMap: () => ({
|
|
1329
|
-
message: `team.size must be one of: ${TEAM_SIZES.join(", ")}`
|
|
1330
|
-
})
|
|
1331
|
-
});
|
|
1332
|
-
var structureSchema = z.enum(["monorepo", "multirepo"], {
|
|
1333
|
-
errorMap: () => ({
|
|
1334
|
-
message: `project.structure must be one of: ${REPOSITORY_STRUCTURES.join(", ")}`
|
|
1335
|
-
})
|
|
1336
|
-
});
|
|
1337
|
-
var languageSchema = z.enum(["en", "es"], {
|
|
1338
|
-
errorMap: () => ({
|
|
1339
|
-
message: `project.language must be one of: ${PROJECT_LANGUAGES.join(", ")}`
|
|
1340
|
-
})
|
|
1341
|
-
});
|
|
1342
|
-
var multirepoRoleSchema = z.enum(["core", "module"]).optional();
|
|
1343
|
-
var configSchema = z.object({
|
|
1344
|
-
version: z.union([z.string(), z.number()]).optional(),
|
|
1345
|
-
project: z.object({
|
|
1346
|
-
name: z.string().default("project"),
|
|
1347
|
-
state: projectStateSchema.default(DEFAULTS.state),
|
|
1348
|
-
structure: structureSchema.default(DEFAULTS.structure),
|
|
1349
|
-
language: languageSchema.default(DEFAULTS.language),
|
|
1350
|
-
role: multirepoRoleSchema,
|
|
1351
|
-
domains: z.array(z.string()).optional()
|
|
1352
|
-
}).passthrough().default({}),
|
|
1353
|
-
team: z.object({
|
|
1354
|
-
size: teamSizeSchema.default(DEFAULTS.teamSize)
|
|
1355
|
-
}).passthrough().default({}),
|
|
1356
|
-
system: z.object({
|
|
1357
|
-
name: z.string().optional()
|
|
1358
|
-
}).passthrough().optional(),
|
|
1359
|
-
multirepo: z.object({
|
|
1360
|
-
role: multirepoRoleSchema,
|
|
1361
|
-
modules_file: z.string().optional(),
|
|
1362
|
-
parent_system: z.string().optional(),
|
|
1363
|
-
workspace_roots: z.array(z.string()).optional()
|
|
1364
|
-
}).passthrough().optional(),
|
|
1365
|
-
module: z.object({
|
|
1366
|
-
id: z.string().optional()
|
|
1367
|
-
}).passthrough().optional(),
|
|
1368
|
-
knowledge: z.unknown().optional(),
|
|
1369
|
-
guard: z.unknown().optional(),
|
|
1370
|
-
scan: z.unknown().optional(),
|
|
1371
|
-
telemetry: z.object({
|
|
1372
|
-
consent: z.enum(["enabled", "disabled"]).optional(),
|
|
1373
|
-
consentVersion: z.number().optional(),
|
|
1374
|
-
enabled: z.boolean().optional()
|
|
1375
|
-
}).passthrough().optional()
|
|
1376
|
-
}).passthrough();
|
|
1377
|
-
function configPathFor(dir) {
|
|
1378
|
-
return join(dir, ".kaddo", "config.yml");
|
|
1379
|
-
}
|
|
1380
|
-
function loadConfig(dir) {
|
|
1381
|
-
const configPath = configPathFor(dir);
|
|
1382
|
-
if (!exists(configPath)) return null;
|
|
1383
|
-
let raw;
|
|
1384
|
-
try {
|
|
1385
|
-
raw = parseYaml3(readFile(configPath));
|
|
1386
|
-
} catch (err) {
|
|
1387
|
-
const detail = err instanceof Error ? err.message : String(err);
|
|
1388
|
-
throw new ConfigError(`Could not parse .kaddo/config.yml: ${detail}`);
|
|
1389
|
-
}
|
|
1390
|
-
const parsed = configSchema.safeParse(raw ?? {});
|
|
1391
|
-
if (!parsed.success) {
|
|
1392
|
-
const issues = parsed.error.issues.map((i) => {
|
|
1393
|
-
const path13 = i.path.join(".");
|
|
1394
|
-
return path13 ? ` - ${path13}: ${i.message}` : ` - ${i.message}`;
|
|
1395
|
-
}).join("\n");
|
|
1396
|
-
throw new ConfigError(`Invalid .kaddo/config.yml:
|
|
1397
|
-
${issues}`);
|
|
1398
|
-
}
|
|
1399
|
-
return parsed.data;
|
|
1517
|
+
import { parse as parseYaml4, stringify as stringifyYaml3 } from "yaml";
|
|
1518
|
+
|
|
1519
|
+
// src/core/scan-baseline.ts
|
|
1520
|
+
import { parse as parseYaml3 } from "yaml";
|
|
1521
|
+
var SCAN_BASELINE_VERSION = "1";
|
|
1522
|
+
var UNKNOWN = "unknown";
|
|
1523
|
+
function meaningful2(...values) {
|
|
1524
|
+
return values.filter((v) => v && v !== UNKNOWN && v !== "none");
|
|
1400
1525
|
}
|
|
1401
|
-
function
|
|
1402
|
-
|
|
1526
|
+
function readProjectContext(dir) {
|
|
1527
|
+
const context = {
|
|
1528
|
+
state: UNKNOWN,
|
|
1529
|
+
structure: UNKNOWN,
|
|
1530
|
+
teamSize: UNKNOWN
|
|
1531
|
+
};
|
|
1532
|
+
const configPath = join(dir, ".kaddo", "config.yml");
|
|
1533
|
+
if (!exists(configPath)) return context;
|
|
1403
1534
|
try {
|
|
1404
|
-
config =
|
|
1405
|
-
|
|
1406
|
-
const
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
console.error("No .kaddo/config.yml found. Run `kaddo init` first.");
|
|
1412
|
-
process.exit(1);
|
|
1535
|
+
const config = parseYaml3(readFile(configPath));
|
|
1536
|
+
const project = config.project ?? {};
|
|
1537
|
+
const team = config.team ?? {};
|
|
1538
|
+
if (typeof project.state === "string") context.state = project.state;
|
|
1539
|
+
if (typeof project.structure === "string") context.structure = project.structure;
|
|
1540
|
+
if (typeof team.size === "string") context.teamSize = team.size;
|
|
1541
|
+
} catch {
|
|
1413
1542
|
}
|
|
1414
|
-
return
|
|
1543
|
+
return context;
|
|
1415
1544
|
}
|
|
1416
|
-
function
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
default:
|
|
1424
|
-
return "Use this baseline to create a context pack and understand the existing system with LLM agents.";
|
|
1545
|
+
function buildOpenQuestions(result, context) {
|
|
1546
|
+
const questions = [];
|
|
1547
|
+
for (const domain of result.suggestedDomains) {
|
|
1548
|
+
const clean = domain.replace(/^#\s*/, "").trim();
|
|
1549
|
+
if (clean) {
|
|
1550
|
+
questions.push(`Confirm whether the '${clean}' domain reflects a real bounded context.`);
|
|
1551
|
+
}
|
|
1425
1552
|
}
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
switch (state) {
|
|
1429
|
-
case "new":
|
|
1430
|
-
return "Create the first work item to shape the product.";
|
|
1431
|
-
case "legacy":
|
|
1432
|
-
return "Prefer small, low-risk work items and capture unknowns.";
|
|
1433
|
-
case "pre-ai":
|
|
1434
|
-
default:
|
|
1435
|
-
return "Create this work item from existing context or roadmap when available.";
|
|
1553
|
+
if (result.testDirs.length === 0) {
|
|
1554
|
+
questions.push("No test directory detected \u2014 confirm how this project is tested.");
|
|
1436
1555
|
}
|
|
1556
|
+
if (context.state === "legacy") {
|
|
1557
|
+
questions.push("Legacy project: identify the highest-risk areas before changing them.");
|
|
1558
|
+
}
|
|
1559
|
+
return questions;
|
|
1437
1560
|
}
|
|
1438
|
-
function
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1561
|
+
function buildBaseline(result, context, now = /* @__PURE__ */ new Date()) {
|
|
1562
|
+
return {
|
|
1563
|
+
version: SCAN_BASELINE_VERSION,
|
|
1564
|
+
generatedAt: now.toISOString(),
|
|
1565
|
+
project: context,
|
|
1566
|
+
detected: {
|
|
1567
|
+
languages: meaningful2(result.language),
|
|
1568
|
+
frameworks: meaningful2(result.framework),
|
|
1569
|
+
packageManagers: meaningful2(result.packageManager),
|
|
1570
|
+
sourceDirectories: result.codeDirs,
|
|
1571
|
+
migrationDirectories: result.migrationDirs,
|
|
1572
|
+
contractFiles: result.contractFiles,
|
|
1573
|
+
infrastructureFiles: result.infraFiles,
|
|
1574
|
+
testDirectories: result.testDirs
|
|
1575
|
+
},
|
|
1576
|
+
signals: result.signals,
|
|
1577
|
+
suggestions: {
|
|
1578
|
+
possibleDomains: result.suggestedDomains.map((d) => d.replace(/^#\s*/, "").trim()).filter(Boolean),
|
|
1579
|
+
openQuestions: buildOpenQuestions(result, context)
|
|
1580
|
+
}
|
|
1581
|
+
};
|
|
1450
1582
|
}
|
|
1451
|
-
function
|
|
1452
|
-
return
|
|
1583
|
+
function serializeBaseline(baseline) {
|
|
1584
|
+
return JSON.stringify(baseline, null, 2) + "\n";
|
|
1453
1585
|
}
|
|
1454
|
-
|
|
1455
|
-
|
|
1586
|
+
|
|
1587
|
+
// src/templates/inventory-template.ts
|
|
1588
|
+
function section2(title, items, emptyNote = "_(none detected)_") {
|
|
1589
|
+
const body = items.length > 0 ? items.map((i) => `- ${i}`).join("\n") : emptyNote;
|
|
1590
|
+
return `## ${title}
|
|
1591
|
+
|
|
1592
|
+
${body}
|
|
1593
|
+
`;
|
|
1456
1594
|
}
|
|
1457
|
-
function
|
|
1458
|
-
|
|
1595
|
+
function renderInventory(baseline) {
|
|
1596
|
+
const { project, detected, suggestions } = baseline;
|
|
1597
|
+
const parts = [];
|
|
1598
|
+
parts.push("# Project Inventory\n");
|
|
1599
|
+
parts.push(
|
|
1600
|
+
"> Generated by `kaddo scan`. Deterministic technical baseline \u2014 not an interpretation of the system.\n"
|
|
1601
|
+
);
|
|
1602
|
+
parts.push(
|
|
1603
|
+
section2("Project Context", [
|
|
1604
|
+
`State: ${project.state}`,
|
|
1605
|
+
`Structure: ${project.structure}`,
|
|
1606
|
+
`Team size: ${project.teamSize}`
|
|
1607
|
+
])
|
|
1608
|
+
);
|
|
1609
|
+
parts.push(
|
|
1610
|
+
section2("Detected Stack", [
|
|
1611
|
+
`Language: ${detected.languages.join(", ") || "unknown"}`,
|
|
1612
|
+
`Framework: ${detected.frameworks.join(", ") || "unknown"}`,
|
|
1613
|
+
`Package manager: ${detected.packageManagers.join(", ") || "unknown"}`
|
|
1614
|
+
])
|
|
1615
|
+
);
|
|
1616
|
+
parts.push(section2("Source Directories", detected.sourceDirectories.map((d) => `${d}/`)));
|
|
1617
|
+
parts.push(section2("Migrations", detected.migrationDirectories.map((d) => `${d}/`)));
|
|
1618
|
+
parts.push(section2("Contracts", detected.contractFiles));
|
|
1619
|
+
parts.push(section2("Infrastructure", detected.infrastructureFiles));
|
|
1620
|
+
parts.push(section2("Tests", detected.testDirectories.map((d) => `${d}/`)));
|
|
1621
|
+
if (signalCount(baseline.signals) > 0) {
|
|
1622
|
+
parts.push("## Detected Signals\n");
|
|
1623
|
+
parts.push(renderSignalsInventory(baseline.signals));
|
|
1624
|
+
}
|
|
1625
|
+
parts.push(section2("Possible Domains", suggestions.possibleDomains));
|
|
1626
|
+
parts.push(section2("Open Questions", suggestions.openQuestions));
|
|
1627
|
+
return parts.join("\n");
|
|
1459
1628
|
}
|
|
1460
1629
|
|
|
1461
1630
|
// src/core/command-help.ts
|
|
@@ -1611,7 +1780,7 @@ function updateConfig(dir, result) {
|
|
|
1611
1780
|
if (project && Array.isArray(project.domains) && project.domains.length === 0 && result.suggestedDomains.length > 0) {
|
|
1612
1781
|
project.domains = result.suggestedDomains.map((d) => `# ${d}`);
|
|
1613
1782
|
}
|
|
1614
|
-
writeFile(configPath,
|
|
1783
|
+
writeFile(configPath, stringifyYaml3(config));
|
|
1615
1784
|
} catch {
|
|
1616
1785
|
}
|
|
1617
1786
|
}
|
|
@@ -7058,7 +7227,7 @@ function analyzeGuard(touchedFiles, artifacts, silentWithoutOwnership) {
|
|
|
7058
7227
|
}
|
|
7059
7228
|
|
|
7060
7229
|
// src/services/ignore-store.ts
|
|
7061
|
-
import { parse as parseYaml5, stringify as
|
|
7230
|
+
import { parse as parseYaml5, stringify as stringifyYaml4 } from "yaml";
|
|
7062
7231
|
var IGNORE_FILE = ".kaddo/ignores.yml";
|
|
7063
7232
|
function loadIgnores(dir) {
|
|
7064
7233
|
const path13 = join(dir, IGNORE_FILE);
|
|
@@ -7080,7 +7249,7 @@ function saveIgnore(dir, entry) {
|
|
|
7080
7249
|
} else {
|
|
7081
7250
|
existing.push(entry);
|
|
7082
7251
|
}
|
|
7083
|
-
writeFile(path13,
|
|
7252
|
+
writeFile(path13, stringifyYaml4(existing));
|
|
7084
7253
|
}
|
|
7085
7254
|
function isIgnored(ignores, artifactId) {
|
|
7086
7255
|
return ignores.find((e) => e.artifact_id === artifactId);
|
|
@@ -7090,7 +7259,7 @@ function removeIgnore(dir, artifactId) {
|
|
|
7090
7259
|
const existing = loadIgnores(dir);
|
|
7091
7260
|
const filtered = existing.filter((e) => e.artifact_id !== artifactId);
|
|
7092
7261
|
if (filtered.length === existing.length) return false;
|
|
7093
|
-
writeFile(path13,
|
|
7262
|
+
writeFile(path13, stringifyYaml4(filtered));
|
|
7094
7263
|
return true;
|
|
7095
7264
|
}
|
|
7096
7265
|
|
|
@@ -7916,14 +8085,14 @@ var RISKS_PATH = "knowledge/legacy/risks.md";
|
|
|
7916
8085
|
function parseRisks(content) {
|
|
7917
8086
|
const risks = [];
|
|
7918
8087
|
const sections = content.split(/^## /gm).slice(1);
|
|
7919
|
-
for (const
|
|
7920
|
-
const headerMatch =
|
|
8088
|
+
for (const section4 of sections) {
|
|
8089
|
+
const headerMatch = section4.match(/^(RISK-\d+):\s*(.+)$/m);
|
|
7921
8090
|
if (!headerMatch) continue;
|
|
7922
8091
|
const id = headerMatch[1];
|
|
7923
8092
|
const title = headerMatch[2].trim();
|
|
7924
|
-
const areaMatch =
|
|
7925
|
-
const blastMatch =
|
|
7926
|
-
const confMatch =
|
|
8093
|
+
const areaMatch = section4.match(/\*\*Area:\*\*\s*(.+)/i);
|
|
8094
|
+
const blastMatch = section4.match(/\*\*Blast radius:\*\*\s*(\w+)/i);
|
|
8095
|
+
const confMatch = section4.match(/\*\*Confidence:\*\*\s*(\w+)/i);
|
|
7927
8096
|
const area = areaMatch?.[1]?.trim() ?? "";
|
|
7928
8097
|
const blastRadius = blastMatch?.[1]?.trim() ?? "unknown";
|
|
7929
8098
|
const confidence = confMatch?.[1]?.trim() ?? "unknown";
|
|
@@ -8575,10 +8744,10 @@ function assessPhase(input) {
|
|
|
8575
8744
|
|
|
8576
8745
|
// src/core/capsule.ts
|
|
8577
8746
|
import matter3 from "gray-matter";
|
|
8578
|
-
import { parse as parseYaml11, stringify as
|
|
8747
|
+
import { parse as parseYaml11, stringify as stringifyYaml7 } from "yaml";
|
|
8579
8748
|
|
|
8580
8749
|
// src/commands/modules-map.ts
|
|
8581
|
-
import { parse as parseYaml10, stringify as
|
|
8750
|
+
import { parse as parseYaml10, stringify as stringifyYaml6 } from "yaml";
|
|
8582
8751
|
|
|
8583
8752
|
// src/templates/registry.ts
|
|
8584
8753
|
var QUALITY = "## Quality checklist";
|
|
@@ -10119,7 +10288,7 @@ function getTemplate(id) {
|
|
|
10119
10288
|
|
|
10120
10289
|
// src/commands/modules-discover.ts
|
|
10121
10290
|
import path5 from "path";
|
|
10122
|
-
import { parse as parseYaml9, stringify as
|
|
10291
|
+
import { parse as parseYaml9, stringify as stringifyYaml5 } from "yaml";
|
|
10123
10292
|
var CONFIG_PATH3 = ".kaddo/config.yml";
|
|
10124
10293
|
var MODULES_YML = ".kaddo/modules.yml";
|
|
10125
10294
|
var MODULES_MD = "knowledge/tech/modules/modules.md";
|
|
@@ -10152,7 +10321,7 @@ function readModulesYml(dir) {
|
|
|
10152
10321
|
}
|
|
10153
10322
|
}
|
|
10154
10323
|
function writeModulesYml(dir, yml) {
|
|
10155
|
-
writeFile(join(dir, MODULES_YML),
|
|
10324
|
+
writeFile(join(dir, MODULES_YML), stringifyYaml5(yml));
|
|
10156
10325
|
}
|
|
10157
10326
|
function readRepoConfig(repoDir) {
|
|
10158
10327
|
const configPath = join(repoDir, CONFIG_PATH3);
|
|
@@ -10508,7 +10677,7 @@ function readModulesDescriptor(dir) {
|
|
|
10508
10677
|
}
|
|
10509
10678
|
}
|
|
10510
10679
|
function writeModulesDescriptor(dir, descriptor) {
|
|
10511
|
-
writeFile(join(dir, DESCRIPTOR_PATH2),
|
|
10680
|
+
writeFile(join(dir, DESCRIPTOR_PATH2), stringifyYaml6(descriptor));
|
|
10512
10681
|
}
|
|
10513
10682
|
function moduleDir(id) {
|
|
10514
10683
|
return `knowledge/tech/modules/${id}`;
|
|
@@ -10794,7 +10963,7 @@ function buildModuleCapsule(dir, moduleId, config) {
|
|
|
10794
10963
|
usageNotes: []
|
|
10795
10964
|
};
|
|
10796
10965
|
}
|
|
10797
|
-
function
|
|
10966
|
+
function section3(title, items, placeholder) {
|
|
10798
10967
|
if (items.length === 0) return `## ${title}
|
|
10799
10968
|
|
|
10800
10969
|
_${placeholder}_
|
|
@@ -10825,15 +10994,15 @@ function renderCapsuleMarkdown(c) {
|
|
|
10825
10994
|
|
|
10826
10995
|
${c.purpose || "_To be completed by the capsule-agent._"}
|
|
10827
10996
|
`,
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10997
|
+
section3("Responsibilities", c.responsibilities, "List what this system is responsible for."),
|
|
10998
|
+
section3("Exposed Capabilities", c.capabilities, "List the capabilities this system exposes."),
|
|
10999
|
+
section3("Public Contracts", c.contracts, "List public APIs and events (e.g. `POST /orders`, `OrderCreated`)."),
|
|
11000
|
+
section3("Dependencies", c.dependencies, "List systems this one depends on."),
|
|
11001
|
+
section3("Known Risks", c.knownRisks, "List integration risks consumers should know."),
|
|
11002
|
+
section3("Relevant ADRs", c.adrs, "List decisions that affect how to integrate."),
|
|
11003
|
+
section3("Owners", c.owners, "Who owns this system."),
|
|
11004
|
+
section3("Out of Scope", c.outOfScope, "What this capsule deliberately does not cover."),
|
|
11005
|
+
section3("Usage Notes", c.usageNotes, "How consumers should integrate."),
|
|
10837
11006
|
"> Security: this capsule must never contain secrets, tokens, credentials, PII or source code.",
|
|
10838
11007
|
""
|
|
10839
11008
|
];
|
|
@@ -10854,7 +11023,7 @@ function loadExternalRegistry(dir) {
|
|
|
10854
11023
|
}
|
|
10855
11024
|
}
|
|
10856
11025
|
function serializeExternalRegistry(entries) {
|
|
10857
|
-
return
|
|
11026
|
+
return stringifyYaml7({ external: entries });
|
|
10858
11027
|
}
|
|
10859
11028
|
function sectionList(md, title) {
|
|
10860
11029
|
const re = new RegExp(`^##\\s+${title}\\s*$`, "im");
|
|
@@ -12875,6 +13044,37 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
|
|
|
12875
13044
|
return { id: "init", phase: "Setup", label: "Run `kaddo init` to initialize Kaddo.", command: "kaddo init", reason: "Kaddo is not initialized in this project." };
|
|
12876
13045
|
}
|
|
12877
13046
|
const state = config.project.state;
|
|
13047
|
+
if (projectMode(config) === "poc") {
|
|
13048
|
+
const poc = readPocSummary(dir);
|
|
13049
|
+
if (!poc.exists) {
|
|
13050
|
+
return { id: "poc-artifact", phase: "POC Definition", label: "Create or restore the POC artifact.", command: "kaddo project mode poc", target: POC_ARTIFACT_PATH, reason: `Missing ${POC_ARTIFACT_PATH}.` };
|
|
13051
|
+
}
|
|
13052
|
+
if (!poc.hypothesisDefined) {
|
|
13053
|
+
return { id: "poc-hypothesis", phase: "POC Definition", label: "Define the POC hypothesis.", target: POC_ARTIFACT_PATH, reason: "The POC needs a testable hypothesis before work begins." };
|
|
13054
|
+
}
|
|
13055
|
+
if (poc.successCriteriaCount === 0) {
|
|
13056
|
+
return { id: "poc-success-criteria", phase: "POC Definition", label: "Define observable POC success criteria.", target: POC_ARTIFACT_PATH, reason: "No success criteria are defined for the hypothesis." };
|
|
13057
|
+
}
|
|
13058
|
+
const qCurrentState2 = analyzeKnowledgeArtifact(dir, CS);
|
|
13059
|
+
const qCodebase2 = analyzeKnowledgeArtifact(dir, CB);
|
|
13060
|
+
if (exists(join(dir, ".kaddo", "scan.json")) && (qCurrentState2 !== "useful" || qCodebase2 !== "useful")) {
|
|
13061
|
+
return { id: "poc-technical-context", phase: "POC Discovery", label: "Document the minimal technical context for the experiment.", target: qCurrentState2 !== "useful" ? CS : CB, agent: "architecture-agent", reason: "The experiment surface and constraints are not yet sufficiently documented." };
|
|
13062
|
+
}
|
|
13063
|
+
const delivery = buildDeliveryState(dir);
|
|
13064
|
+
if (delivery.total_work_items === 0) {
|
|
13065
|
+
return { id: "poc-create-experiment", phase: "Experiment", label: "Create the first experiment Work Item (prefer `spike`).", command: "kaddo create spike", reason: "The POC has no Work Item to produce evidence." };
|
|
13066
|
+
}
|
|
13067
|
+
if (delivery.in_progress_work_items > 0) {
|
|
13068
|
+
return { id: "guard", phase: "Experiment", label: "Run `kaddo guard` and capture evidence from the experiment.", command: "kaddo guard", reason: `${delivery.in_progress_work_items} experiment Work Item(s) are in progress.` };
|
|
13069
|
+
}
|
|
13070
|
+
if (delivery.ready_work_items > 0 || delivery.draft_work_items > 0 || delivery.blocked_work_items > 0) {
|
|
13071
|
+
return { id: delivery.ready_work_items > 0 ? "implement-work-item" : "refine-work-item", phase: "Experiment", label: delivery.ready_work_items > 0 ? "Implement the ready experiment Work Item and collect evidence." : "Refine the experiment Work Item before running it.", agent: "work-item-agent", reason: "The POC evidence Work Item is not complete yet." };
|
|
13072
|
+
}
|
|
13073
|
+
if (poc.conclusion === "pending") {
|
|
13074
|
+
return { id: "poc-evaluate", phase: "Evaluation", label: "Evaluate the experiment evidence and record the POC conclusion.", target: POC_ARTIFACT_PATH, reason: "Experiment Work Items are complete but the POC conclusion is pending." };
|
|
13075
|
+
}
|
|
13076
|
+
return { id: "poc-complete", phase: "Conclusion", label: `POC concluded: ${poc.conclusion}. Decide whether to graduate it to standard delivery.`, target: POC_ARTIFACT_PATH, reason: "The POC conclusion is recorded from experiment evidence." };
|
|
13077
|
+
}
|
|
12878
13078
|
const q = (rel) => analyzeKnowledgeArtifact(dir, rel);
|
|
12879
13079
|
const resolveAgent = (agent) => {
|
|
12880
13080
|
const file = agent.endsWith(".md") ? agent : `${agent}.md`;
|
|
@@ -13879,6 +14079,56 @@ var LEGACY_STEPS = [
|
|
|
13879
14079
|
runGuard2,
|
|
13880
14080
|
captureLearning
|
|
13881
14081
|
];
|
|
14082
|
+
var definePocHypothesis = {
|
|
14083
|
+
id: "poc-hypothesis",
|
|
14084
|
+
label: "Define hypothesis",
|
|
14085
|
+
evaluate: (ctx) => {
|
|
14086
|
+
const poc = readPocSummary(ctx.dir);
|
|
14087
|
+
return { status: poc.hypothesisDefined ? "done" : "current", evidence: poc.hypothesisDefined ? [POC_ARTIFACT_PATH] : void 0, reason: poc.hypothesisDefined ? void 0 : "A POC starts with one testable hypothesis." };
|
|
14088
|
+
}
|
|
14089
|
+
};
|
|
14090
|
+
var ensurePocArtifact2 = {
|
|
14091
|
+
id: "poc-artifact",
|
|
14092
|
+
label: "Create POC artifact",
|
|
14093
|
+
evaluate: (ctx) => exists(join(ctx.dir, POC_ARTIFACT_PATH)) ? { status: "done", evidence: [POC_ARTIFACT_PATH] } : { status: "current", command: "kaddo project mode poc", reason: "Create the canonical POC artifact before defining the experiment." }
|
|
14094
|
+
};
|
|
14095
|
+
var definePocCriteria = {
|
|
14096
|
+
id: "poc-success-criteria",
|
|
14097
|
+
label: "Define success criteria",
|
|
14098
|
+
evaluate: (ctx) => {
|
|
14099
|
+
const poc = readPocSummary(ctx.dir);
|
|
14100
|
+
return { status: poc.successCriteriaCount > 0 ? "done" : "pending", evidence: poc.successCriteriaCount > 0 ? [POC_ARTIFACT_PATH] : void 0, reason: poc.successCriteriaCount > 0 ? void 0 : "Define observable evidence for the hypothesis." };
|
|
14101
|
+
}
|
|
14102
|
+
};
|
|
14103
|
+
var describePocTech = {
|
|
14104
|
+
id: "poc-technical-context",
|
|
14105
|
+
label: "Document minimal technical context",
|
|
14106
|
+
evaluate: (ctx) => ctx.hasScan ? describeArchitecture.evaluate(ctx) : { status: "optional", command: "kaddo scan", reason: "Add technical context only when the experiment needs to inspect existing code." }
|
|
14107
|
+
};
|
|
14108
|
+
var identifyPocResources = {
|
|
14109
|
+
id: "poc-resources",
|
|
14110
|
+
label: "Identify relevant resources",
|
|
14111
|
+
evaluate: (ctx) => exists(join(ctx.dir, "knowledge/resources")) ? { status: "done", evidence: ["knowledge/resources/"] } : { status: "optional", command: "kaddo resources list", reason: "Add Project Resources only when the experiment depends on external systems." }
|
|
14112
|
+
};
|
|
14113
|
+
var createPocExperiment = {
|
|
14114
|
+
id: "poc-create-experiment",
|
|
14115
|
+
label: "Create experiment Work Item",
|
|
14116
|
+
evaluate: (ctx) => ctx.totalWorkItems > 0 ? { status: "done", evidence: ["knowledge/delivery/work-items/"] } : { status: "pending", command: "kaddo create spike", reason: "Prefer a spike for a focused experiment." }
|
|
14117
|
+
};
|
|
14118
|
+
var capturePocEvidence = {
|
|
14119
|
+
id: "poc-evidence",
|
|
14120
|
+
label: "Capture experiment evidence",
|
|
14121
|
+
evaluate: (ctx) => ctx.completedWorkItems > 0 ? { status: "done", evidence: ["knowledge/delivery/work-items/"] } : { status: "pending", reason: "Complete an experiment Work Item and link its evidence in the POC artifact." }
|
|
14122
|
+
};
|
|
14123
|
+
var concludePoc = {
|
|
14124
|
+
id: "poc-evaluate",
|
|
14125
|
+
label: "Evaluate and conclude",
|
|
14126
|
+
evaluate: (ctx) => {
|
|
14127
|
+
const conclusion = readPocSummary(ctx.dir).conclusion;
|
|
14128
|
+
return conclusion === "pending" ? { status: "pending", reason: "Record validated, rejected, or inconclusive from the evidence." } : { status: "done", evidence: [POC_ARTIFACT_PATH], reason: `Conclusion: ${conclusion}.` };
|
|
14129
|
+
}
|
|
14130
|
+
};
|
|
14131
|
+
var POC_STEPS = [enableKaddo, ensurePocArtifact2, definePocHypothesis, definePocCriteria, describePocTech, identifyPocResources, createPocExperiment, capturePocEvidence, concludePoc];
|
|
13882
14132
|
function stepsForState(state) {
|
|
13883
14133
|
switch (state) {
|
|
13884
14134
|
case "new":
|
|
@@ -13975,14 +14225,21 @@ function mapNextStepId(id) {
|
|
|
13975
14225
|
"init-module-context": "enable-kaddo",
|
|
13976
14226
|
"module-ready": "ready-for-core-orchestration",
|
|
13977
14227
|
"validate-work-item-modules": "validate-module-knowledge",
|
|
13978
|
-
"modules-discover": "enable-kaddo"
|
|
14228
|
+
"modules-discover": "enable-kaddo",
|
|
14229
|
+
"poc-hypothesis": "poc-hypothesis",
|
|
14230
|
+
"poc-success-criteria": "poc-success-criteria",
|
|
14231
|
+
"poc-technical-context": "poc-technical-context",
|
|
14232
|
+
"poc-resources": "poc-resources",
|
|
14233
|
+
"poc-create-experiment": "poc-create-experiment",
|
|
14234
|
+
"poc-evaluate": "poc-evaluate",
|
|
14235
|
+
"poc-complete": "poc-evaluate"
|
|
13979
14236
|
};
|
|
13980
14237
|
return MAP[id] ?? id;
|
|
13981
14238
|
}
|
|
13982
14239
|
function buildProjectRoute(dir) {
|
|
13983
14240
|
const config = loadConfig(dir);
|
|
13984
14241
|
const state = config?.project.state ?? "pre-ai";
|
|
13985
|
-
const defs = config && isModule(config) ? MODULE_STEPS : stepsForState(state);
|
|
14242
|
+
const defs = config && projectMode(config) === "poc" ? POC_STEPS : config && isModule(config) ? MODULE_STEPS : stepsForState(state);
|
|
13986
14243
|
const ctx = buildRouteContext(dir);
|
|
13987
14244
|
const steps = defs.map((d) => {
|
|
13988
14245
|
const result = d.evaluate(ctx);
|
|
@@ -15106,6 +15363,7 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
|
|
|
15106
15363
|
missing.push("No work items found.");
|
|
15107
15364
|
}
|
|
15108
15365
|
const state = config.project.state;
|
|
15366
|
+
const mode = projectMode(config);
|
|
15109
15367
|
const roadmapPath = join(dir, ARCH_DIR6, "delivery", "roadmap.md");
|
|
15110
15368
|
const materialized = allArtifacts.filter(
|
|
15111
15369
|
(a) => a.filePath.replace(/\\/g, "/").includes("/delivery/work-items/") && Boolean(a.type)
|
|
@@ -15198,6 +15456,7 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
|
|
|
15198
15456
|
project: {
|
|
15199
15457
|
name: config.project.name,
|
|
15200
15458
|
state,
|
|
15459
|
+
mode,
|
|
15201
15460
|
teamSize: config.team.size,
|
|
15202
15461
|
structure: config.project.structure,
|
|
15203
15462
|
language: languageLabel(projectLanguage(config))
|
|
@@ -15223,6 +15482,7 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
|
|
|
15223
15482
|
allWorkItems: allWorkItemArtifacts.map(toContextWorkItem),
|
|
15224
15483
|
artifacts: allArtifacts.filter((a) => a.codeGlobs.length > 0).map(toContextArtifact)
|
|
15225
15484
|
},
|
|
15485
|
+
...mode === "poc" ? { poc: readPocSummary(dir) } : {},
|
|
15226
15486
|
layers,
|
|
15227
15487
|
knowledgeQuality,
|
|
15228
15488
|
roadmap,
|
|
@@ -15326,11 +15586,23 @@ function renderContextPack(pack) {
|
|
|
15326
15586
|
[
|
|
15327
15587
|
`- Name: ${project.name}`,
|
|
15328
15588
|
`- State: ${project.state}`,
|
|
15589
|
+
`- Mode: ${project.mode}`,
|
|
15329
15590
|
`- Team size: ${project.teamSize}`,
|
|
15330
15591
|
`- Structure: ${project.structure}`,
|
|
15331
15592
|
`- Language: ${project.language}`
|
|
15332
15593
|
].join("\n") + "\n"
|
|
15333
15594
|
);
|
|
15595
|
+
if (pack.poc) {
|
|
15596
|
+
parts.push("## Proof of Concept\n");
|
|
15597
|
+
parts.push([
|
|
15598
|
+
`- Hypothesis: ${pack.poc.hypothesisDefined ? "defined" : "missing"}`,
|
|
15599
|
+
`- Success criteria: ${pack.poc.successCriteriaCount}`,
|
|
15600
|
+
`- Constraints: ${pack.poc.constraintsDefined ? "defined" : "missing"}`,
|
|
15601
|
+
`- Non-goals: ${pack.poc.nonGoalsDefined ? "defined" : "missing"}`,
|
|
15602
|
+
`- Conclusion: ${pack.poc.conclusion}`,
|
|
15603
|
+
"- Canonical artifact: `knowledge/delivery/poc.md`"
|
|
15604
|
+
].join("\n") + "\n");
|
|
15605
|
+
}
|
|
15334
15606
|
parts.push("## Current Phase\n");
|
|
15335
15607
|
parts.push(`Phase: ${pack.phase.phase}
|
|
15336
15608
|
`);
|
|
@@ -15414,27 +15686,29 @@ function renderContextPack(pack) {
|
|
|
15414
15686
|
}
|
|
15415
15687
|
parts.push("## Current Knowledge\n");
|
|
15416
15688
|
parts.push((knowledge.summary || "No project knowledge summary found yet.") + "\n");
|
|
15417
|
-
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
[
|
|
15421
|
-
`- Initiatives: ${pack.roadmap.initiatives}`,
|
|
15422
|
-
`- Work Item candidates: ${pack.roadmap.work_item_candidates}`,
|
|
15423
|
-
`- Materialized Work Items: ${pack.roadmap.materialized_work_items}`,
|
|
15424
|
-
`- Remaining Work Item candidates: ${pack.roadmap.remaining_work_item_candidates}`
|
|
15425
|
-
].join("\n") + "\n"
|
|
15426
|
-
);
|
|
15427
|
-
if (pack.roadmap.remaining_work_item_candidates > 0) {
|
|
15689
|
+
if (project.mode !== "poc") {
|
|
15690
|
+
parts.push("## Roadmap Status\n");
|
|
15691
|
+
if (pack.roadmap.present) {
|
|
15428
15692
|
parts.push(
|
|
15429
|
-
|
|
15693
|
+
[
|
|
15694
|
+
`- Initiatives: ${pack.roadmap.initiatives}`,
|
|
15695
|
+
`- Work Item candidates: ${pack.roadmap.work_item_candidates}`,
|
|
15696
|
+
`- Materialized Work Items: ${pack.roadmap.materialized_work_items}`,
|
|
15697
|
+
`- Remaining Work Item candidates: ${pack.roadmap.remaining_work_item_candidates}`
|
|
15698
|
+
].join("\n") + "\n"
|
|
15430
15699
|
);
|
|
15700
|
+
if (pack.roadmap.remaining_work_item_candidates > 0) {
|
|
15701
|
+
parts.push(
|
|
15702
|
+
"Work Item candidates are not yet Work Items. Materialize them with `kaddo create --from roadmap`.\n"
|
|
15703
|
+
);
|
|
15704
|
+
}
|
|
15431
15705
|
}
|
|
15706
|
+
parts.push((knowledge.roadmapSummary || "No roadmap baseline found.") + "\n");
|
|
15432
15707
|
}
|
|
15433
|
-
parts.push((knowledge.roadmapSummary || "No roadmap baseline found.") + "\n");
|
|
15434
15708
|
const rq = pack.roadmapQuality;
|
|
15435
15709
|
const rqi = rq.initiatives;
|
|
15436
15710
|
const rqw = rq.work_item_candidates;
|
|
15437
|
-
if (rqi.total > 0 || rqw.total > 0) {
|
|
15711
|
+
if (project.mode !== "poc" && (rqi.total > 0 || rqw.total > 0)) {
|
|
15438
15712
|
parts.push("## Roadmap Quality\n");
|
|
15439
15713
|
if (rqi.total > 0) {
|
|
15440
15714
|
parts.push(
|
|
@@ -15688,7 +15962,13 @@ function runContext(opts = {}) {
|
|
|
15688
15962
|
function agentIsInstalled(dir, fileName) {
|
|
15689
15963
|
return exists(join(dir, agentInstallPath(fileName))) || exists(join(dir, "knowledge", "agents", fileName));
|
|
15690
15964
|
}
|
|
15691
|
-
function flowForState(state) {
|
|
15965
|
+
function flowForState(state, mode) {
|
|
15966
|
+
if (mode === "poc") {
|
|
15967
|
+
return [
|
|
15968
|
+
{ agent: "architecture-agent.md", output: "knowledge/tech/current-state.md" },
|
|
15969
|
+
{ agent: "work-item-agent.md", output: "knowledge/delivery/poc.md" }
|
|
15970
|
+
];
|
|
15971
|
+
}
|
|
15692
15972
|
switch (state) {
|
|
15693
15973
|
case "new":
|
|
15694
15974
|
return [
|
|
@@ -15713,9 +15993,10 @@ function flowForState(state) {
|
|
|
15713
15993
|
}
|
|
15714
15994
|
function buildUnderstandPlan(dir, config) {
|
|
15715
15995
|
const state = config.project.state;
|
|
15996
|
+
const mode = projectMode(config);
|
|
15716
15997
|
if (isModule(config)) {
|
|
15717
15998
|
return {
|
|
15718
|
-
project: { name: config.project.name, state, teamSize: config.team.size, structure: config.project.structure, language: "English" },
|
|
15999
|
+
project: { name: config.project.name, state, mode, teamSize: config.team.size, structure: config.project.structure, language: "English" },
|
|
15719
16000
|
steps: [],
|
|
15720
16001
|
missingAgents: [],
|
|
15721
16002
|
agentsInstalled: true,
|
|
@@ -15723,7 +16004,7 @@ function buildUnderstandPlan(dir, config) {
|
|
|
15723
16004
|
contextPackPath: ".kaddo/context-pack.md"
|
|
15724
16005
|
};
|
|
15725
16006
|
}
|
|
15726
|
-
const flow = flowForState(state).filter((s) => !exists(join(dir, s.output)));
|
|
16007
|
+
const flow = flowForState(state, mode).filter((s) => !exists(join(dir, s.output)));
|
|
15727
16008
|
const steps = flow.map((s) => {
|
|
15728
16009
|
const installed = agentIsInstalled(dir, s.agent);
|
|
15729
16010
|
return { agent: s.agent, output: s.output, installed };
|
|
@@ -15734,6 +16015,7 @@ function buildUnderstandPlan(dir, config) {
|
|
|
15734
16015
|
project: {
|
|
15735
16016
|
name: config.project.name,
|
|
15736
16017
|
state,
|
|
16018
|
+
mode,
|
|
15737
16019
|
teamSize: config.team.size,
|
|
15738
16020
|
structure: config.project.structure,
|
|
15739
16021
|
language: "English"
|
|
@@ -16825,7 +17107,7 @@ function runHistory(opts = {}) {
|
|
|
16825
17107
|
}
|
|
16826
17108
|
|
|
16827
17109
|
// src/commands/add.ts
|
|
16828
|
-
import { parse as parseYaml16, stringify as
|
|
17110
|
+
import { parse as parseYaml16, stringify as stringifyYaml8 } from "yaml";
|
|
16829
17111
|
var CONFIG_PATH7 = ".kaddo/config.yml";
|
|
16830
17112
|
function readProjectState(dir) {
|
|
16831
17113
|
const configPath = join(dir, CONFIG_PATH7);
|
|
@@ -16860,7 +17142,7 @@ function markModuleInstalled(dir, configKey, moduleName) {
|
|
|
16860
17142
|
const modules = config.modules ?? [];
|
|
16861
17143
|
if (!modules.includes(moduleName)) modules.push(moduleName);
|
|
16862
17144
|
config.modules = modules;
|
|
16863
|
-
writeFile(configPath,
|
|
17145
|
+
writeFile(configPath, stringifyYaml8(config));
|
|
16864
17146
|
} catch {
|
|
16865
17147
|
}
|
|
16866
17148
|
}
|
|
@@ -17693,20 +17975,166 @@ _Controlled modernization steps._
|
|
|
17693
17975
|
## Later
|
|
17694
17976
|
|
|
17695
17977
|
_Deferred modernization ideas._
|
|
17978
|
+
`
|
|
17979
|
+
},
|
|
17980
|
+
poc: {
|
|
17981
|
+
new: `# Proof of Concept
|
|
17982
|
+
|
|
17983
|
+
## Hypothesis
|
|
17984
|
+
|
|
17985
|
+
_What assumption are we testing?_
|
|
17986
|
+
|
|
17987
|
+
## Success Criteria
|
|
17988
|
+
|
|
17989
|
+
- [ ] _Observable result that would support the hypothesis._
|
|
17990
|
+
|
|
17991
|
+
## Constraints
|
|
17992
|
+
|
|
17993
|
+
_Technical, time, budget, compliance, or operational constraints._
|
|
17994
|
+
|
|
17995
|
+
## Non-goals
|
|
17996
|
+
|
|
17997
|
+
_What this experiment intentionally will not prove or deliver._
|
|
17998
|
+
|
|
17999
|
+
## Evidence
|
|
18000
|
+
|
|
18001
|
+
_Link experiments, Work Items, measurements, and observations here._
|
|
18002
|
+
|
|
18003
|
+
## Conclusion
|
|
18004
|
+
|
|
18005
|
+
Status: pending
|
|
18006
|
+
|
|
18007
|
+
_Record validated, rejected, or inconclusive only after reviewing evidence._
|
|
18008
|
+
`,
|
|
18009
|
+
"pre-ai": `# Proof of Concept
|
|
18010
|
+
|
|
18011
|
+
## Hypothesis
|
|
18012
|
+
|
|
18013
|
+
_What assumption about this existing system are we testing?_
|
|
18014
|
+
|
|
18015
|
+
## Success Criteria
|
|
18016
|
+
|
|
18017
|
+
- [ ] _Observable result that would support the hypothesis._
|
|
18018
|
+
|
|
18019
|
+
## Constraints
|
|
18020
|
+
|
|
18021
|
+
_Technical, time, budget, compliance, or operational constraints._
|
|
18022
|
+
|
|
18023
|
+
## Non-goals
|
|
18024
|
+
|
|
18025
|
+
_What this experiment intentionally will not prove or deliver._
|
|
18026
|
+
|
|
18027
|
+
## Evidence
|
|
18028
|
+
|
|
18029
|
+
_Link experiments, Work Items, measurements, and observations here._
|
|
18030
|
+
|
|
18031
|
+
## Conclusion
|
|
18032
|
+
|
|
18033
|
+
Status: pending
|
|
18034
|
+
|
|
18035
|
+
_Record validated, rejected, or inconclusive only after reviewing evidence._
|
|
18036
|
+
`,
|
|
18037
|
+
legacy: `# Proof of Concept
|
|
18038
|
+
|
|
18039
|
+
## Hypothesis
|
|
18040
|
+
|
|
18041
|
+
_What assumption can be tested safely without disrupting the legacy system?_
|
|
18042
|
+
|
|
18043
|
+
## Success Criteria
|
|
18044
|
+
|
|
18045
|
+
- [ ] _Observable result that would support the hypothesis._
|
|
18046
|
+
|
|
18047
|
+
## Constraints
|
|
18048
|
+
|
|
18049
|
+
_Change-safety, technical, time, compliance, or operational constraints._
|
|
18050
|
+
|
|
18051
|
+
## Non-goals
|
|
18052
|
+
|
|
18053
|
+
_What this experiment intentionally will not prove or deliver._
|
|
18054
|
+
|
|
18055
|
+
## Evidence
|
|
18056
|
+
|
|
18057
|
+
_Link experiments, Work Items, measurements, and observations here._
|
|
18058
|
+
|
|
18059
|
+
## Conclusion
|
|
18060
|
+
|
|
18061
|
+
Status: pending
|
|
18062
|
+
|
|
18063
|
+
_Record validated, rejected, or inconclusive only after reviewing evidence._
|
|
17696
18064
|
`
|
|
17697
18065
|
}
|
|
17698
18066
|
};
|
|
17699
18067
|
var DIAGRAM_GUIDANCE = "\n## Diagrams\n\n_Optional. Add Mermaid diagrams (```mermaid fenced blocks) when relationships or flows are easier to understand visually. Keep them grounded in the knowledge above \u2014 do not invent entities or relationships, and do not add an empty diagram just to fill this section._\n";
|
|
17700
18068
|
var DIAGRAM_KINDS = /* @__PURE__ */ new Set(["business", "product", "capabilities", "codebase", "current-state"]);
|
|
17701
|
-
function baselineTemplate(kind, state) {
|
|
18069
|
+
function baselineTemplate(kind, state, mode = "standard") {
|
|
17702
18070
|
const st = state === "pre-ai" || state === "legacy" ? state : "new";
|
|
18071
|
+
if (mode === "poc" && kind === "business") {
|
|
18072
|
+
return fm(kind, st) + `# Business Context
|
|
18073
|
+
|
|
18074
|
+
## Problem
|
|
18075
|
+
|
|
18076
|
+
_What problem makes this experiment worth running?_
|
|
18077
|
+
|
|
18078
|
+
## Expected value
|
|
18079
|
+
|
|
18080
|
+
_What decision or outcome could this POC unlock?_
|
|
18081
|
+
`;
|
|
18082
|
+
}
|
|
18083
|
+
if (mode === "poc" && kind === "product") {
|
|
18084
|
+
return fm(kind, st) + `# Product Context
|
|
18085
|
+
|
|
18086
|
+
## Scenario
|
|
18087
|
+
|
|
18088
|
+
_Which user or system scenario is being tested?_
|
|
18089
|
+
|
|
18090
|
+
## Expected behavior
|
|
18091
|
+
|
|
18092
|
+
_What minimal behavior should the experiment demonstrate?_
|
|
18093
|
+
|
|
18094
|
+
## Non-goals
|
|
18095
|
+
|
|
18096
|
+
_What product scope is deliberately excluded?_
|
|
18097
|
+
`;
|
|
18098
|
+
}
|
|
18099
|
+
if (mode === "poc" && kind === "current-state") {
|
|
18100
|
+
return fm(kind, st) + `# Minimal Technical Context
|
|
18101
|
+
|
|
18102
|
+
## Technical hypothesis
|
|
18103
|
+
|
|
18104
|
+
_What technical assumption is being tested?_
|
|
18105
|
+
|
|
18106
|
+
## Minimal architecture
|
|
18107
|
+
|
|
18108
|
+
_Only the components, boundaries, and dependencies required for this experiment._
|
|
18109
|
+
|
|
18110
|
+
## Constraints
|
|
18111
|
+
|
|
18112
|
+
_Constraints that can affect the experiment or its interpretation._
|
|
18113
|
+
`;
|
|
18114
|
+
}
|
|
18115
|
+
if (mode === "poc" && kind === "codebase") {
|
|
18116
|
+
return fm(kind, st) + `# Experiment Surface
|
|
18117
|
+
|
|
18118
|
+
## Relevant areas
|
|
18119
|
+
|
|
18120
|
+
_List only the repository areas, services, or resources needed by this experiment._
|
|
18121
|
+
|
|
18122
|
+
## How to run
|
|
18123
|
+
|
|
18124
|
+
_Document the smallest reproducible experiment path._
|
|
18125
|
+
|
|
18126
|
+
## How to observe
|
|
18127
|
+
|
|
18128
|
+
_Document logs, metrics, tests, or manual evidence to inspect._
|
|
18129
|
+
`;
|
|
18130
|
+
}
|
|
17703
18131
|
const body = T[kind][st] + (DIAGRAM_KINDS.has(kind) ? DIAGRAM_GUIDANCE : "");
|
|
17704
18132
|
return fm(kind, st) + body;
|
|
17705
18133
|
}
|
|
17706
18134
|
|
|
17707
18135
|
// src/commands/bootstrap.ts
|
|
17708
18136
|
var CONFIG_PATH9 = ".kaddo/config.yml";
|
|
17709
|
-
var
|
|
18137
|
+
var STANDARD_FILE_TARGETS = [
|
|
17710
18138
|
{ path: "knowledge/business/business.md", kind: "business" },
|
|
17711
18139
|
{ path: "knowledge/product/product.md", kind: "product" },
|
|
17712
18140
|
{ path: "knowledge/product/capabilities.md", kind: "capabilities" },
|
|
@@ -17728,22 +18156,25 @@ function bootstrap(dir) {
|
|
|
17728
18156
|
const skipped = [];
|
|
17729
18157
|
const createdDirs = [];
|
|
17730
18158
|
let state = "new";
|
|
18159
|
+
let mode = "standard";
|
|
17731
18160
|
let language = "en";
|
|
17732
18161
|
try {
|
|
17733
18162
|
const config = loadConfig(dir);
|
|
17734
18163
|
if (config) {
|
|
17735
18164
|
state = config.project.state;
|
|
18165
|
+
mode = projectMode(config);
|
|
17736
18166
|
language = projectLanguage(config);
|
|
17737
18167
|
}
|
|
17738
18168
|
} catch {
|
|
17739
18169
|
}
|
|
17740
|
-
|
|
18170
|
+
if (mode === "poc") return { state, mode, written, skipped, createdDirs };
|
|
18171
|
+
for (const target of STANDARD_FILE_TARGETS) {
|
|
17741
18172
|
const full = join(dir, target.path);
|
|
17742
18173
|
if (exists(full)) {
|
|
17743
18174
|
skipped.push(target.path);
|
|
17744
18175
|
continue;
|
|
17745
18176
|
}
|
|
17746
|
-
const content = withLanguageDirective(baselineTemplate(target.kind, state), language);
|
|
18177
|
+
const content = withLanguageDirective(baselineTemplate(target.kind, state, mode), language);
|
|
17747
18178
|
writeFile(full, content.endsWith("\n") ? content : `${content}
|
|
17748
18179
|
`);
|
|
17749
18180
|
written.push(target.path);
|
|
@@ -17758,7 +18189,7 @@ function bootstrap(dir) {
|
|
|
17758
18189
|
writeFile(join(full, ".gitkeep"), "");
|
|
17759
18190
|
createdDirs.push(`${d}/`);
|
|
17760
18191
|
}
|
|
17761
|
-
return { state, written, skipped, createdDirs };
|
|
18192
|
+
return { state, mode, written, skipped, createdDirs };
|
|
17762
18193
|
}
|
|
17763
18194
|
async function runBootstrap(dir = cwd()) {
|
|
17764
18195
|
intro("kaddo bootstrap");
|
|
@@ -17768,15 +18199,23 @@ async function runBootstrap(dir = cwd()) {
|
|
|
17768
18199
|
process.exit(1);
|
|
17769
18200
|
}
|
|
17770
18201
|
let state = "new";
|
|
18202
|
+
let mode = "standard";
|
|
17771
18203
|
try {
|
|
17772
18204
|
const config = loadConfig(dir);
|
|
17773
18205
|
state = config?.project.state ?? "new";
|
|
18206
|
+
if (config) mode = projectMode(config);
|
|
17774
18207
|
} catch (err) {
|
|
17775
18208
|
console.error(err instanceof ConfigError ? err.message : String(err));
|
|
17776
18209
|
process.exit(1);
|
|
17777
18210
|
}
|
|
17778
18211
|
const stateLabel3 = state === "pre-ai" ? "pre-ai" : state;
|
|
17779
18212
|
log.info(`Project state: ${stateLabel3}`);
|
|
18213
|
+
log.info(`Project mode: ${mode}`);
|
|
18214
|
+
if (mode === "poc") {
|
|
18215
|
+
log.info("POC mode does not require a standard bootstrap. Define the hypothesis and success criteria in `knowledge/delivery/poc.md`.");
|
|
18216
|
+
outro("Nothing changed. POC mode uses a proportional, experiment-first baseline.");
|
|
18217
|
+
return;
|
|
18218
|
+
}
|
|
17780
18219
|
log.info(`Creating ${stateLabel3} knowledge baseline.`);
|
|
17781
18220
|
log.info("Existing files will not be overwritten.");
|
|
17782
18221
|
const result = bootstrap(dir);
|
|
@@ -17908,7 +18347,7 @@ function runGraphExport(opts = {}) {
|
|
|
17908
18347
|
}
|
|
17909
18348
|
|
|
17910
18349
|
// src/core/system-topology.ts
|
|
17911
|
-
import { parse as parseYaml17, stringify as
|
|
18350
|
+
import { parse as parseYaml17, stringify as stringifyYaml9 } from "yaml";
|
|
17912
18351
|
import fs4 from "fs";
|
|
17913
18352
|
import path8 from "path";
|
|
17914
18353
|
import crypto from "crypto";
|
|
@@ -18073,7 +18512,7 @@ function serializeTopology(entities, relationships) {
|
|
|
18073
18512
|
})),
|
|
18074
18513
|
relationships: relationships.map((r) => ({ from: r.from, to: r.to, type: r.type, ...r.evidence.length ? { evidence: r.evidence } : {} }))
|
|
18075
18514
|
};
|
|
18076
|
-
return
|
|
18515
|
+
return stringifyYaml9(doc);
|
|
18077
18516
|
}
|
|
18078
18517
|
function atomicWrite(filePath, content) {
|
|
18079
18518
|
fs4.mkdirSync(path8.dirname(filePath), { recursive: true });
|
|
@@ -18547,7 +18986,7 @@ async function runResourcesDelete(id, opts = {}, dir = cwd()) {
|
|
|
18547
18986
|
|
|
18548
18987
|
// src/services/integrations.ts
|
|
18549
18988
|
import matter14 from "gray-matter";
|
|
18550
|
-
import { parse as parseYaml18, stringify as
|
|
18989
|
+
import { parse as parseYaml18, stringify as stringifyYaml10 } from "yaml";
|
|
18551
18990
|
|
|
18552
18991
|
// src/core/work-item-write.ts
|
|
18553
18992
|
import fs6 from "fs";
|
|
@@ -23643,8 +24082,12 @@ var require2 = createRequire(import.meta.url);
|
|
|
23643
24082
|
var { version } = require2("../package.json");
|
|
23644
24083
|
var program = new Command();
|
|
23645
24084
|
program.name("kaddo").description("Knowledge Driven Development toolkit").version(version);
|
|
23646
|
-
program.command("init").description("Initialize Kaddo in the current project").action(async () => {
|
|
23647
|
-
await runInit();
|
|
24085
|
+
program.command("init").description("Initialize Kaddo in the current project").option("--mode <mode>", "Project mode: standard or poc").action(async (opts) => {
|
|
24086
|
+
await runInit(opts);
|
|
24087
|
+
});
|
|
24088
|
+
var projectCmd = program.command("project").description("Inspect and configure project metadata");
|
|
24089
|
+
projectCmd.command("mode [mode]").description("Show or set the project mode: standard or poc").action((mode) => {
|
|
24090
|
+
runProjectMode(mode);
|
|
23648
24091
|
});
|
|
23649
24092
|
program.command("scan").description("Detect project stack and suggest domains").action(async () => {
|
|
23650
24093
|
await runScan();
|