@kaddo/cli 3.116.0 → 3.117.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 +19 -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 +163 -12
- package/dist/index.js +722 -306
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -116,6 +116,7 @@ function buildConfig(meta) {
|
|
|
116
116
|
project:
|
|
117
117
|
name: "${meta.name}"
|
|
118
118
|
state: ${meta.state}
|
|
119
|
+
mode: ${meta.mode}
|
|
119
120
|
structure: ${meta.structure}
|
|
120
121
|
language: ${meta.language}${meta.role ? `
|
|
121
122
|
role: ${meta.role}` : ""}
|
|
@@ -306,9 +307,49 @@ _What comes after the current cycle._
|
|
|
306
307
|
_Ideas and intentions not yet committed._
|
|
307
308
|
`;
|
|
308
309
|
}
|
|
309
|
-
|
|
310
|
+
function buildPoc(projectName) {
|
|
311
|
+
return `---
|
|
312
|
+
type: poc
|
|
313
|
+
status: active
|
|
314
|
+
generated_by: kaddo-init
|
|
315
|
+
template_version: 1
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
# ${projectName} \u2014 Proof of Concept
|
|
319
|
+
|
|
320
|
+
## Hypothesis
|
|
321
|
+
|
|
322
|
+
_What assumption are we testing?_
|
|
323
|
+
|
|
324
|
+
## Success Criteria
|
|
325
|
+
|
|
326
|
+
- [ ] _Observable result that would support the hypothesis._
|
|
327
|
+
|
|
328
|
+
## Constraints
|
|
329
|
+
|
|
330
|
+
_Technical, time, budget, compliance, or operational constraints._
|
|
331
|
+
|
|
332
|
+
## Non-goals
|
|
333
|
+
|
|
334
|
+
_What this experiment intentionally will not prove or deliver._
|
|
335
|
+
|
|
336
|
+
## Evidence
|
|
337
|
+
|
|
338
|
+
_Link experiments, Work Items, measurements, and observations here._
|
|
339
|
+
|
|
340
|
+
## Conclusion
|
|
341
|
+
|
|
342
|
+
Status: pending
|
|
343
|
+
`;
|
|
344
|
+
}
|
|
345
|
+
async function runInit(opts = {}) {
|
|
310
346
|
const dir = cwd();
|
|
311
347
|
intro("kaddo init");
|
|
348
|
+
if (opts.mode !== void 0 && opts.mode !== "standard" && opts.mode !== "poc") {
|
|
349
|
+
console.error("Project mode must be `standard` or `poc`.");
|
|
350
|
+
process.exitCode = 1;
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
312
353
|
if (!hasGit(dir)) {
|
|
313
354
|
log.warn("No Git repository detected. Kaddo works best inside a Git repo.");
|
|
314
355
|
}
|
|
@@ -378,6 +419,14 @@ async function runInit() {
|
|
|
378
419
|
],
|
|
379
420
|
initialValue: "pre-ai"
|
|
380
421
|
});
|
|
422
|
+
const mode = opts.mode ?? await select({
|
|
423
|
+
message: "Project mode",
|
|
424
|
+
options: [
|
|
425
|
+
{ value: "standard", label: "Standard", hint: "Product and delivery lifecycle" },
|
|
426
|
+
{ value: "poc", label: "Proof of Concept", hint: "Test a hypothesis with focused evidence" }
|
|
427
|
+
],
|
|
428
|
+
initialValue: "standard"
|
|
429
|
+
});
|
|
381
430
|
const language = await select({
|
|
382
431
|
message: "Project knowledge language (the CLI stays in English)",
|
|
383
432
|
options: [
|
|
@@ -399,6 +448,7 @@ async function runInit() {
|
|
|
399
448
|
const meta = {
|
|
400
449
|
name: projectName.trim(),
|
|
401
450
|
state,
|
|
451
|
+
mode,
|
|
402
452
|
teamSize,
|
|
403
453
|
structure,
|
|
404
454
|
language,
|
|
@@ -422,10 +472,15 @@ async function runInit() {
|
|
|
422
472
|
if (!exists(join(dir, ARCH_DIR, "tech", "codebase.md"))) {
|
|
423
473
|
writeFile(join(dir, ARCH_DIR, "tech", "codebase.md"), buildKnowledge(projectName.trim()));
|
|
424
474
|
}
|
|
475
|
+
if (mode === "poc") {
|
|
476
|
+
ensureDir(join(dir, ARCH_DIR, "delivery", "work-items"));
|
|
477
|
+
writeFile(join(dir, ARCH_DIR, "delivery", "poc.md"), buildPoc(projectName.trim()));
|
|
478
|
+
log.success("Created knowledge/delivery/poc.md");
|
|
479
|
+
}
|
|
425
480
|
log.success("Created knowledge/tech/module/module-context.md");
|
|
426
481
|
log.success("Created knowledge/tech/current-state.md");
|
|
427
482
|
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.");
|
|
483
|
+
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
484
|
} else if (role === "core") {
|
|
430
485
|
const sysName = systemName3?.trim() ?? projectName.trim();
|
|
431
486
|
ensureDir(join(dir, ARCH_DIR, "delivery", "work-items"));
|
|
@@ -434,12 +489,14 @@ async function runInit() {
|
|
|
434
489
|
ensureDir(join(dir, ARCH_DIR, "agents"));
|
|
435
490
|
ensureDir(join(dir, ARCH_DIR, "skills"));
|
|
436
491
|
writeFile(join(dir, ARCH_DIR, "knowledge.md"), buildKnowledge(projectName.trim()));
|
|
437
|
-
writeFile(join(dir, ARCH_DIR, "delivery", "
|
|
492
|
+
if (mode === "poc") writeFile(join(dir, ARCH_DIR, "delivery", "poc.md"), buildPoc(projectName.trim()));
|
|
493
|
+
else writeFile(join(dir, ARCH_DIR, "delivery", "roadmap.md"), buildRoadmap(projectName.trim()));
|
|
438
494
|
writeFile(join(dir, ARCH_DIR, "tech", "system", "system-context.md"), buildSystemContext(sysName));
|
|
439
495
|
writeFile(join(dir, ARCH_DIR, "tech", "modules", "modules.md"), buildModulesFile(sysName));
|
|
440
496
|
writeFile(join(dir, KADDO_DIR, "modules.yml"), buildModulesYml(sysName));
|
|
441
497
|
log.success("Created knowledge/knowledge.md");
|
|
442
|
-
log.success("Created knowledge/delivery/
|
|
498
|
+
if (mode === "poc") log.success("Created knowledge/delivery/poc.md");
|
|
499
|
+
else log.success("Created knowledge/delivery/roadmap.md");
|
|
443
500
|
log.success("Created knowledge/tech/system/system-context.md");
|
|
444
501
|
log.success("Created knowledge/tech/modules/modules.md");
|
|
445
502
|
log.success("Created .kaddo/modules.yml");
|
|
@@ -447,11 +504,13 @@ async function runInit() {
|
|
|
447
504
|
} else {
|
|
448
505
|
ensureDir(join(dir, ARCH_DIR, "delivery", "work-items"));
|
|
449
506
|
writeFile(join(dir, ARCH_DIR, "knowledge.md"), buildKnowledge(projectName.trim()));
|
|
450
|
-
writeFile(join(dir, ARCH_DIR, "delivery", "
|
|
507
|
+
if (mode === "poc") writeFile(join(dir, ARCH_DIR, "delivery", "poc.md"), buildPoc(projectName.trim()));
|
|
508
|
+
else writeFile(join(dir, ARCH_DIR, "delivery", "roadmap.md"), buildRoadmap(projectName.trim()));
|
|
451
509
|
log.success("Created knowledge/knowledge.md");
|
|
452
|
-
log.success("Created knowledge/delivery/
|
|
510
|
+
if (mode === "poc") log.success("Created knowledge/delivery/poc.md");
|
|
511
|
+
else log.success("Created knowledge/delivery/roadmap.md");
|
|
453
512
|
log.success("Created knowledge/delivery/work-items/");
|
|
454
|
-
log.info("Next: run `kaddo scan` to detect your stack.");
|
|
513
|
+
log.info(mode === "poc" ? "Next: define the POC hypothesis and success criteria, then complete the minimal baseline with `kaddo bootstrap`." : "Next: run `kaddo scan` to detect your stack.");
|
|
455
514
|
}
|
|
456
515
|
if (isInteractive()) {
|
|
457
516
|
const enableTelemetry = await confirm({
|
|
@@ -465,6 +524,222 @@ async function runInit() {
|
|
|
465
524
|
outro("Kaddo initialized.");
|
|
466
525
|
}
|
|
467
526
|
|
|
527
|
+
// src/core/config.ts
|
|
528
|
+
import { z } from "zod";
|
|
529
|
+
import { parse as parseYaml2, stringify as stringifyYaml2 } from "yaml";
|
|
530
|
+
var PROJECT_STATES = ["new", "pre-ai", "legacy", "ai-assisted"];
|
|
531
|
+
var PROJECT_MODES = ["standard", "poc"];
|
|
532
|
+
var TEAM_SIZES = ["indie", "small", "medium", "enterprise"];
|
|
533
|
+
var REPOSITORY_STRUCTURES = ["monorepo", "multirepo"];
|
|
534
|
+
var PROJECT_LANGUAGES = ["en", "es"];
|
|
535
|
+
var DEFAULTS = {
|
|
536
|
+
state: "pre-ai",
|
|
537
|
+
mode: "standard",
|
|
538
|
+
structure: "monorepo",
|
|
539
|
+
teamSize: "indie",
|
|
540
|
+
language: "en"
|
|
541
|
+
};
|
|
542
|
+
function languageLabel(lang) {
|
|
543
|
+
return lang === "es" ? "Spanish" : "English";
|
|
544
|
+
}
|
|
545
|
+
function projectLanguage(config) {
|
|
546
|
+
const lang = config.project.language;
|
|
547
|
+
return lang === "es" ? "es" : "en";
|
|
548
|
+
}
|
|
549
|
+
function projectMode(config) {
|
|
550
|
+
return config.project.mode === "poc" ? "poc" : "standard";
|
|
551
|
+
}
|
|
552
|
+
var ConfigError = class extends Error {
|
|
553
|
+
constructor(message) {
|
|
554
|
+
super(message);
|
|
555
|
+
this.name = "ConfigError";
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
var projectStateSchema = z.enum(["new", "pre-ai", "legacy", "ai-assisted"], {
|
|
559
|
+
errorMap: () => ({
|
|
560
|
+
message: `project.state must be one of: ${PROJECT_STATES.join(", ")}`
|
|
561
|
+
})
|
|
562
|
+
});
|
|
563
|
+
var projectModeSchema = z.enum(["standard", "poc"], {
|
|
564
|
+
errorMap: () => ({
|
|
565
|
+
message: `project.mode must be one of: ${PROJECT_MODES.join(", ")}`
|
|
566
|
+
})
|
|
567
|
+
});
|
|
568
|
+
var teamSizeSchema = z.enum(["indie", "small", "medium", "enterprise"], {
|
|
569
|
+
errorMap: () => ({
|
|
570
|
+
message: `team.size must be one of: ${TEAM_SIZES.join(", ")}`
|
|
571
|
+
})
|
|
572
|
+
});
|
|
573
|
+
var structureSchema = z.enum(["monorepo", "multirepo"], {
|
|
574
|
+
errorMap: () => ({
|
|
575
|
+
message: `project.structure must be one of: ${REPOSITORY_STRUCTURES.join(", ")}`
|
|
576
|
+
})
|
|
577
|
+
});
|
|
578
|
+
var languageSchema = z.enum(["en", "es"], {
|
|
579
|
+
errorMap: () => ({
|
|
580
|
+
message: `project.language must be one of: ${PROJECT_LANGUAGES.join(", ")}`
|
|
581
|
+
})
|
|
582
|
+
});
|
|
583
|
+
var multirepoRoleSchema = z.enum(["core", "module"]).optional();
|
|
584
|
+
var configSchema = z.object({
|
|
585
|
+
version: z.union([z.string(), z.number()]).optional(),
|
|
586
|
+
project: z.object({
|
|
587
|
+
name: z.string().default("project"),
|
|
588
|
+
state: projectStateSchema.default(DEFAULTS.state),
|
|
589
|
+
mode: projectModeSchema.default(DEFAULTS.mode),
|
|
590
|
+
structure: structureSchema.default(DEFAULTS.structure),
|
|
591
|
+
language: languageSchema.default(DEFAULTS.language),
|
|
592
|
+
role: multirepoRoleSchema,
|
|
593
|
+
domains: z.array(z.string()).optional()
|
|
594
|
+
}).passthrough().default({}),
|
|
595
|
+
team: z.object({
|
|
596
|
+
size: teamSizeSchema.default(DEFAULTS.teamSize)
|
|
597
|
+
}).passthrough().default({}),
|
|
598
|
+
system: z.object({
|
|
599
|
+
name: z.string().optional()
|
|
600
|
+
}).passthrough().optional(),
|
|
601
|
+
multirepo: z.object({
|
|
602
|
+
role: multirepoRoleSchema,
|
|
603
|
+
modules_file: z.string().optional(),
|
|
604
|
+
parent_system: z.string().optional(),
|
|
605
|
+
workspace_roots: z.array(z.string()).optional()
|
|
606
|
+
}).passthrough().optional(),
|
|
607
|
+
module: z.object({
|
|
608
|
+
id: z.string().optional()
|
|
609
|
+
}).passthrough().optional(),
|
|
610
|
+
knowledge: z.unknown().optional(),
|
|
611
|
+
guard: z.unknown().optional(),
|
|
612
|
+
scan: z.unknown().optional(),
|
|
613
|
+
telemetry: z.object({
|
|
614
|
+
consent: z.enum(["enabled", "disabled"]).optional(),
|
|
615
|
+
consentVersion: z.number().optional(),
|
|
616
|
+
enabled: z.boolean().optional()
|
|
617
|
+
}).passthrough().optional()
|
|
618
|
+
}).passthrough();
|
|
619
|
+
function configPathFor(dir) {
|
|
620
|
+
return join(dir, ".kaddo", "config.yml");
|
|
621
|
+
}
|
|
622
|
+
function loadConfig(dir) {
|
|
623
|
+
const configPath = configPathFor(dir);
|
|
624
|
+
if (!exists(configPath)) return null;
|
|
625
|
+
let raw;
|
|
626
|
+
try {
|
|
627
|
+
raw = parseYaml2(readFile(configPath));
|
|
628
|
+
} catch (err) {
|
|
629
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
630
|
+
throw new ConfigError(`Could not parse .kaddo/config.yml: ${detail}`);
|
|
631
|
+
}
|
|
632
|
+
const parsed = configSchema.safeParse(raw ?? {});
|
|
633
|
+
if (!parsed.success) {
|
|
634
|
+
const issues = parsed.error.issues.map((i) => {
|
|
635
|
+
const path13 = i.path.join(".");
|
|
636
|
+
return path13 ? ` - ${path13}: ${i.message}` : ` - ${i.message}`;
|
|
637
|
+
}).join("\n");
|
|
638
|
+
throw new ConfigError(`Invalid .kaddo/config.yml:
|
|
639
|
+
${issues}`);
|
|
640
|
+
}
|
|
641
|
+
return parsed.data;
|
|
642
|
+
}
|
|
643
|
+
function setProjectMode(dir, mode) {
|
|
644
|
+
const configPath = configPathFor(dir);
|
|
645
|
+
if (!exists(configPath)) throw new ConfigError("No .kaddo/config.yml found. Run `kaddo init` first.");
|
|
646
|
+
let raw;
|
|
647
|
+
try {
|
|
648
|
+
raw = parseYaml2(readFile(configPath)) ?? {};
|
|
649
|
+
} catch (err) {
|
|
650
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
651
|
+
throw new ConfigError(`Could not parse .kaddo/config.yml: ${detail}`);
|
|
652
|
+
}
|
|
653
|
+
const project = raw.project && typeof raw.project === "object" && !Array.isArray(raw.project) ? raw.project : {};
|
|
654
|
+
raw.project = { ...project, mode };
|
|
655
|
+
writeFile(configPath, stringifyYaml2(raw));
|
|
656
|
+
const updated = loadConfig(dir);
|
|
657
|
+
if (!updated) throw new ConfigError("Could not reload .kaddo/config.yml after updating project.mode.");
|
|
658
|
+
return updated;
|
|
659
|
+
}
|
|
660
|
+
function requireConfig(dir) {
|
|
661
|
+
let config;
|
|
662
|
+
try {
|
|
663
|
+
config = loadConfig(dir);
|
|
664
|
+
} catch (err) {
|
|
665
|
+
const message = err instanceof ConfigError ? err.message : String(err);
|
|
666
|
+
console.error(message);
|
|
667
|
+
process.exit(1);
|
|
668
|
+
}
|
|
669
|
+
if (!config) {
|
|
670
|
+
console.error("No .kaddo/config.yml found. Run `kaddo init` first.");
|
|
671
|
+
process.exit(1);
|
|
672
|
+
}
|
|
673
|
+
return config;
|
|
674
|
+
}
|
|
675
|
+
function nextStepsForState(state) {
|
|
676
|
+
switch (state) {
|
|
677
|
+
case "new":
|
|
678
|
+
return "Define initial knowledge, create your first work item, and grow the roadmap gradually.";
|
|
679
|
+
case "legacy":
|
|
680
|
+
return "Use this baseline to identify risks, unknowns and safe modernization candidates before changing code.";
|
|
681
|
+
case "pre-ai":
|
|
682
|
+
default:
|
|
683
|
+
return "Use this baseline to create a context pack and understand the existing system with LLM agents.";
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
function createGuidanceForState(state) {
|
|
687
|
+
switch (state) {
|
|
688
|
+
case "new":
|
|
689
|
+
return "Create the first work item to shape the product.";
|
|
690
|
+
case "legacy":
|
|
691
|
+
return "Prefer small, low-risk work items and capture unknowns.";
|
|
692
|
+
case "pre-ai":
|
|
693
|
+
default:
|
|
694
|
+
return "Create this work item from existing context or roadmap when available.";
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
function describeProject(config) {
|
|
698
|
+
const state = config.project.state;
|
|
699
|
+
const stateLabel3 = state === "pre-ai" ? "pre-AI" : state;
|
|
700
|
+
const role = projectRole(config);
|
|
701
|
+
const roleSuffix = role ? ` (${role})` : "";
|
|
702
|
+
return `${stateLabel3} ${config.project.structure}${roleSuffix}`;
|
|
703
|
+
}
|
|
704
|
+
function projectRole(config) {
|
|
705
|
+
return config.project.role ?? config.multirepo?.role;
|
|
706
|
+
}
|
|
707
|
+
function isModule(config) {
|
|
708
|
+
return projectRole(config) === "module";
|
|
709
|
+
}
|
|
710
|
+
function isCore(config) {
|
|
711
|
+
return projectRole(config) === "core";
|
|
712
|
+
}
|
|
713
|
+
function systemName(config) {
|
|
714
|
+
return config.system?.name;
|
|
715
|
+
}
|
|
716
|
+
function workspaceRoots(config) {
|
|
717
|
+
return config.multirepo?.workspace_roots ?? [".."];
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
// src/commands/project.ts
|
|
721
|
+
function runProjectMode(mode) {
|
|
722
|
+
const dir = cwd();
|
|
723
|
+
try {
|
|
724
|
+
if (mode === void 0) {
|
|
725
|
+
const config = loadConfig(dir);
|
|
726
|
+
if (!config) throw new ConfigError("No .kaddo/config.yml found. Run `kaddo init` first.");
|
|
727
|
+
console.log(`Project mode: ${projectMode(config)}`);
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
if (mode !== "standard" && mode !== "poc") {
|
|
731
|
+
console.error("Project mode must be `standard` or `poc`.");
|
|
732
|
+
process.exitCode = 1;
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
setProjectMode(dir, mode);
|
|
736
|
+
console.log(`Project mode set to: ${mode}`);
|
|
737
|
+
} catch (err) {
|
|
738
|
+
console.error(err instanceof ConfigError ? err.message : String(err));
|
|
739
|
+
process.exitCode = 1;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
468
743
|
// src/core/scan-signals.ts
|
|
469
744
|
function emptySignals() {
|
|
470
745
|
return {
|
|
@@ -1180,10 +1455,10 @@ function scan(dir) {
|
|
|
1180
1455
|
}
|
|
1181
1456
|
|
|
1182
1457
|
// src/commands/scan.ts
|
|
1183
|
-
import { parse as parseYaml4, stringify as
|
|
1458
|
+
import { parse as parseYaml4, stringify as stringifyYaml3 } from "yaml";
|
|
1184
1459
|
|
|
1185
1460
|
// src/core/scan-baseline.ts
|
|
1186
|
-
import { parse as
|
|
1461
|
+
import { parse as parseYaml3 } from "yaml";
|
|
1187
1462
|
var SCAN_BASELINE_VERSION = "1";
|
|
1188
1463
|
var UNKNOWN = "unknown";
|
|
1189
1464
|
function meaningful(...values) {
|
|
@@ -1198,264 +1473,99 @@ function readProjectContext(dir) {
|
|
|
1198
1473
|
const configPath = join(dir, ".kaddo", "config.yml");
|
|
1199
1474
|
if (!exists(configPath)) return context;
|
|
1200
1475
|
try {
|
|
1201
|
-
const config =
|
|
1476
|
+
const config = parseYaml3(readFile(configPath));
|
|
1202
1477
|
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;
|
|
1400
|
-
}
|
|
1401
|
-
function requireConfig(dir) {
|
|
1402
|
-
let config;
|
|
1403
|
-
try {
|
|
1404
|
-
config = loadConfig(dir);
|
|
1405
|
-
} catch (err) {
|
|
1406
|
-
const message = err instanceof ConfigError ? err.message : String(err);
|
|
1407
|
-
console.error(message);
|
|
1408
|
-
process.exit(1);
|
|
1409
|
-
}
|
|
1410
|
-
if (!config) {
|
|
1411
|
-
console.error("No .kaddo/config.yml found. Run `kaddo init` first.");
|
|
1412
|
-
process.exit(1);
|
|
1478
|
+
const team = config.team ?? {};
|
|
1479
|
+
if (typeof project.state === "string") context.state = project.state;
|
|
1480
|
+
if (typeof project.structure === "string") context.structure = project.structure;
|
|
1481
|
+
if (typeof team.size === "string") context.teamSize = team.size;
|
|
1482
|
+
} catch {
|
|
1413
1483
|
}
|
|
1414
|
-
return
|
|
1484
|
+
return context;
|
|
1415
1485
|
}
|
|
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.";
|
|
1486
|
+
function buildOpenQuestions(result, context) {
|
|
1487
|
+
const questions = [];
|
|
1488
|
+
for (const domain of result.suggestedDomains) {
|
|
1489
|
+
const clean = domain.replace(/^#\s*/, "").trim();
|
|
1490
|
+
if (clean) {
|
|
1491
|
+
questions.push(`Confirm whether the '${clean}' domain reflects a real bounded context.`);
|
|
1492
|
+
}
|
|
1425
1493
|
}
|
|
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.";
|
|
1494
|
+
if (result.testDirs.length === 0) {
|
|
1495
|
+
questions.push("No test directory detected \u2014 confirm how this project is tested.");
|
|
1436
1496
|
}
|
|
1497
|
+
if (context.state === "legacy") {
|
|
1498
|
+
questions.push("Legacy project: identify the highest-risk areas before changing them.");
|
|
1499
|
+
}
|
|
1500
|
+
return questions;
|
|
1437
1501
|
}
|
|
1438
|
-
function
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1502
|
+
function buildBaseline(result, context, now = /* @__PURE__ */ new Date()) {
|
|
1503
|
+
return {
|
|
1504
|
+
version: SCAN_BASELINE_VERSION,
|
|
1505
|
+
generatedAt: now.toISOString(),
|
|
1506
|
+
project: context,
|
|
1507
|
+
detected: {
|
|
1508
|
+
languages: meaningful(result.language),
|
|
1509
|
+
frameworks: meaningful(result.framework),
|
|
1510
|
+
packageManagers: meaningful(result.packageManager),
|
|
1511
|
+
sourceDirectories: result.codeDirs,
|
|
1512
|
+
migrationDirectories: result.migrationDirs,
|
|
1513
|
+
contractFiles: result.contractFiles,
|
|
1514
|
+
infrastructureFiles: result.infraFiles,
|
|
1515
|
+
testDirectories: result.testDirs
|
|
1516
|
+
},
|
|
1517
|
+
signals: result.signals,
|
|
1518
|
+
suggestions: {
|
|
1519
|
+
possibleDomains: result.suggestedDomains.map((d) => d.replace(/^#\s*/, "").trim()).filter(Boolean),
|
|
1520
|
+
openQuestions: buildOpenQuestions(result, context)
|
|
1521
|
+
}
|
|
1522
|
+
};
|
|
1450
1523
|
}
|
|
1451
|
-
function
|
|
1452
|
-
return
|
|
1524
|
+
function serializeBaseline(baseline) {
|
|
1525
|
+
return JSON.stringify(baseline, null, 2) + "\n";
|
|
1453
1526
|
}
|
|
1454
|
-
|
|
1455
|
-
|
|
1527
|
+
|
|
1528
|
+
// src/templates/inventory-template.ts
|
|
1529
|
+
function section(title, items, emptyNote = "_(none detected)_") {
|
|
1530
|
+
const body = items.length > 0 ? items.map((i) => `- ${i}`).join("\n") : emptyNote;
|
|
1531
|
+
return `## ${title}
|
|
1532
|
+
|
|
1533
|
+
${body}
|
|
1534
|
+
`;
|
|
1456
1535
|
}
|
|
1457
|
-
function
|
|
1458
|
-
|
|
1536
|
+
function renderInventory(baseline) {
|
|
1537
|
+
const { project, detected, suggestions } = baseline;
|
|
1538
|
+
const parts = [];
|
|
1539
|
+
parts.push("# Project Inventory\n");
|
|
1540
|
+
parts.push(
|
|
1541
|
+
"> Generated by `kaddo scan`. Deterministic technical baseline \u2014 not an interpretation of the system.\n"
|
|
1542
|
+
);
|
|
1543
|
+
parts.push(
|
|
1544
|
+
section("Project Context", [
|
|
1545
|
+
`State: ${project.state}`,
|
|
1546
|
+
`Structure: ${project.structure}`,
|
|
1547
|
+
`Team size: ${project.teamSize}`
|
|
1548
|
+
])
|
|
1549
|
+
);
|
|
1550
|
+
parts.push(
|
|
1551
|
+
section("Detected Stack", [
|
|
1552
|
+
`Language: ${detected.languages.join(", ") || "unknown"}`,
|
|
1553
|
+
`Framework: ${detected.frameworks.join(", ") || "unknown"}`,
|
|
1554
|
+
`Package manager: ${detected.packageManagers.join(", ") || "unknown"}`
|
|
1555
|
+
])
|
|
1556
|
+
);
|
|
1557
|
+
parts.push(section("Source Directories", detected.sourceDirectories.map((d) => `${d}/`)));
|
|
1558
|
+
parts.push(section("Migrations", detected.migrationDirectories.map((d) => `${d}/`)));
|
|
1559
|
+
parts.push(section("Contracts", detected.contractFiles));
|
|
1560
|
+
parts.push(section("Infrastructure", detected.infrastructureFiles));
|
|
1561
|
+
parts.push(section("Tests", detected.testDirectories.map((d) => `${d}/`)));
|
|
1562
|
+
if (signalCount(baseline.signals) > 0) {
|
|
1563
|
+
parts.push("## Detected Signals\n");
|
|
1564
|
+
parts.push(renderSignalsInventory(baseline.signals));
|
|
1565
|
+
}
|
|
1566
|
+
parts.push(section("Possible Domains", suggestions.possibleDomains));
|
|
1567
|
+
parts.push(section("Open Questions", suggestions.openQuestions));
|
|
1568
|
+
return parts.join("\n");
|
|
1459
1569
|
}
|
|
1460
1570
|
|
|
1461
1571
|
// src/core/command-help.ts
|
|
@@ -1611,7 +1721,7 @@ function updateConfig(dir, result) {
|
|
|
1611
1721
|
if (project && Array.isArray(project.domains) && project.domains.length === 0 && result.suggestedDomains.length > 0) {
|
|
1612
1722
|
project.domains = result.suggestedDomains.map((d) => `# ${d}`);
|
|
1613
1723
|
}
|
|
1614
|
-
writeFile(configPath,
|
|
1724
|
+
writeFile(configPath, stringifyYaml3(config));
|
|
1615
1725
|
} catch {
|
|
1616
1726
|
}
|
|
1617
1727
|
}
|
|
@@ -7058,7 +7168,7 @@ function analyzeGuard(touchedFiles, artifacts, silentWithoutOwnership) {
|
|
|
7058
7168
|
}
|
|
7059
7169
|
|
|
7060
7170
|
// src/services/ignore-store.ts
|
|
7061
|
-
import { parse as parseYaml5, stringify as
|
|
7171
|
+
import { parse as parseYaml5, stringify as stringifyYaml4 } from "yaml";
|
|
7062
7172
|
var IGNORE_FILE = ".kaddo/ignores.yml";
|
|
7063
7173
|
function loadIgnores(dir) {
|
|
7064
7174
|
const path13 = join(dir, IGNORE_FILE);
|
|
@@ -7080,7 +7190,7 @@ function saveIgnore(dir, entry) {
|
|
|
7080
7190
|
} else {
|
|
7081
7191
|
existing.push(entry);
|
|
7082
7192
|
}
|
|
7083
|
-
writeFile(path13,
|
|
7193
|
+
writeFile(path13, stringifyYaml4(existing));
|
|
7084
7194
|
}
|
|
7085
7195
|
function isIgnored(ignores, artifactId) {
|
|
7086
7196
|
return ignores.find((e) => e.artifact_id === artifactId);
|
|
@@ -7090,7 +7200,7 @@ function removeIgnore(dir, artifactId) {
|
|
|
7090
7200
|
const existing = loadIgnores(dir);
|
|
7091
7201
|
const filtered = existing.filter((e) => e.artifact_id !== artifactId);
|
|
7092
7202
|
if (filtered.length === existing.length) return false;
|
|
7093
|
-
writeFile(path13,
|
|
7203
|
+
writeFile(path13, stringifyYaml4(filtered));
|
|
7094
7204
|
return true;
|
|
7095
7205
|
}
|
|
7096
7206
|
|
|
@@ -7916,14 +8026,14 @@ var RISKS_PATH = "knowledge/legacy/risks.md";
|
|
|
7916
8026
|
function parseRisks(content) {
|
|
7917
8027
|
const risks = [];
|
|
7918
8028
|
const sections = content.split(/^## /gm).slice(1);
|
|
7919
|
-
for (const
|
|
7920
|
-
const headerMatch =
|
|
8029
|
+
for (const section4 of sections) {
|
|
8030
|
+
const headerMatch = section4.match(/^(RISK-\d+):\s*(.+)$/m);
|
|
7921
8031
|
if (!headerMatch) continue;
|
|
7922
8032
|
const id = headerMatch[1];
|
|
7923
8033
|
const title = headerMatch[2].trim();
|
|
7924
|
-
const areaMatch =
|
|
7925
|
-
const blastMatch =
|
|
7926
|
-
const confMatch =
|
|
8034
|
+
const areaMatch = section4.match(/\*\*Area:\*\*\s*(.+)/i);
|
|
8035
|
+
const blastMatch = section4.match(/\*\*Blast radius:\*\*\s*(\w+)/i);
|
|
8036
|
+
const confMatch = section4.match(/\*\*Confidence:\*\*\s*(\w+)/i);
|
|
7927
8037
|
const area = areaMatch?.[1]?.trim() ?? "";
|
|
7928
8038
|
const blastRadius = blastMatch?.[1]?.trim() ?? "unknown";
|
|
7929
8039
|
const confidence = confMatch?.[1]?.trim() ?? "unknown";
|
|
@@ -8575,10 +8685,10 @@ function assessPhase(input) {
|
|
|
8575
8685
|
|
|
8576
8686
|
// src/core/capsule.ts
|
|
8577
8687
|
import matter3 from "gray-matter";
|
|
8578
|
-
import { parse as parseYaml11, stringify as
|
|
8688
|
+
import { parse as parseYaml11, stringify as stringifyYaml7 } from "yaml";
|
|
8579
8689
|
|
|
8580
8690
|
// src/commands/modules-map.ts
|
|
8581
|
-
import { parse as parseYaml10, stringify as
|
|
8691
|
+
import { parse as parseYaml10, stringify as stringifyYaml6 } from "yaml";
|
|
8582
8692
|
|
|
8583
8693
|
// src/templates/registry.ts
|
|
8584
8694
|
var QUALITY = "## Quality checklist";
|
|
@@ -10119,7 +10229,7 @@ function getTemplate(id) {
|
|
|
10119
10229
|
|
|
10120
10230
|
// src/commands/modules-discover.ts
|
|
10121
10231
|
import path5 from "path";
|
|
10122
|
-
import { parse as parseYaml9, stringify as
|
|
10232
|
+
import { parse as parseYaml9, stringify as stringifyYaml5 } from "yaml";
|
|
10123
10233
|
var CONFIG_PATH3 = ".kaddo/config.yml";
|
|
10124
10234
|
var MODULES_YML = ".kaddo/modules.yml";
|
|
10125
10235
|
var MODULES_MD = "knowledge/tech/modules/modules.md";
|
|
@@ -10152,7 +10262,7 @@ function readModulesYml(dir) {
|
|
|
10152
10262
|
}
|
|
10153
10263
|
}
|
|
10154
10264
|
function writeModulesYml(dir, yml) {
|
|
10155
|
-
writeFile(join(dir, MODULES_YML),
|
|
10265
|
+
writeFile(join(dir, MODULES_YML), stringifyYaml5(yml));
|
|
10156
10266
|
}
|
|
10157
10267
|
function readRepoConfig(repoDir) {
|
|
10158
10268
|
const configPath = join(repoDir, CONFIG_PATH3);
|
|
@@ -10508,7 +10618,7 @@ function readModulesDescriptor(dir) {
|
|
|
10508
10618
|
}
|
|
10509
10619
|
}
|
|
10510
10620
|
function writeModulesDescriptor(dir, descriptor) {
|
|
10511
|
-
writeFile(join(dir, DESCRIPTOR_PATH2),
|
|
10621
|
+
writeFile(join(dir, DESCRIPTOR_PATH2), stringifyYaml6(descriptor));
|
|
10512
10622
|
}
|
|
10513
10623
|
function moduleDir(id) {
|
|
10514
10624
|
return `knowledge/tech/modules/${id}`;
|
|
@@ -10854,7 +10964,7 @@ function loadExternalRegistry(dir) {
|
|
|
10854
10964
|
}
|
|
10855
10965
|
}
|
|
10856
10966
|
function serializeExternalRegistry(entries) {
|
|
10857
|
-
return
|
|
10967
|
+
return stringifyYaml7({ external: entries });
|
|
10858
10968
|
}
|
|
10859
10969
|
function sectionList(md, title) {
|
|
10860
10970
|
const re = new RegExp(`^##\\s+${title}\\s*$`, "im");
|
|
@@ -12788,6 +12898,43 @@ function buildTechDecisions(dir) {
|
|
|
12788
12898
|
};
|
|
12789
12899
|
}
|
|
12790
12900
|
|
|
12901
|
+
// src/core/poc.ts
|
|
12902
|
+
var POC_ARTIFACT_PATH = "knowledge/delivery/poc.md";
|
|
12903
|
+
var PLACEHOLDER = /^[_<].*[_>]$|^(describe|list|document|what|how)\b/i;
|
|
12904
|
+
function section3(markdown, heading) {
|
|
12905
|
+
const match = markdown.match(new RegExp(`^##\\s+${heading}\\s*$([\\s\\S]*?)(?=^##\\s+|(?![\\s\\S]))`, "im"));
|
|
12906
|
+
return match?.[1] ?? "";
|
|
12907
|
+
}
|
|
12908
|
+
function meaningful2(text2) {
|
|
12909
|
+
return text2.split(/\r?\n/).some((line) => {
|
|
12910
|
+
const value = line.trim().replace(/^[-*]\s+(?:\[[^\]]+\]\s*)?/, "");
|
|
12911
|
+
return Boolean(value) && !PLACEHOLDER.test(value) && !/^status:\s*(pending|tbd)$/i.test(value);
|
|
12912
|
+
});
|
|
12913
|
+
}
|
|
12914
|
+
function readPocSummary(dir) {
|
|
12915
|
+
const path13 = join(dir, POC_ARTIFACT_PATH);
|
|
12916
|
+
if (!exists(path13)) {
|
|
12917
|
+
return { exists: false, hypothesisDefined: false, successCriteriaCount: 0, constraintsDefined: false, nonGoalsDefined: false, conclusion: "pending" };
|
|
12918
|
+
}
|
|
12919
|
+
let markdown = "";
|
|
12920
|
+
try {
|
|
12921
|
+
markdown = readFile(path13);
|
|
12922
|
+
} catch {
|
|
12923
|
+
return { exists: false, hypothesisDefined: false, successCriteriaCount: 0, constraintsDefined: false, nonGoalsDefined: false, conclusion: "pending" };
|
|
12924
|
+
}
|
|
12925
|
+
const criteria = section3(markdown, "Success Criteria").split(/\r?\n/).filter((line) => /^\s*[-*]\s+(?:\[[ xX]\]\s+)?/.test(line)).filter((line) => meaningful2(line)).length;
|
|
12926
|
+
const conclusionBody = section3(markdown, "Conclusion");
|
|
12927
|
+
const conclusionMatch = conclusionBody.match(/\b(?:status|outcome)\s*:\s*(validated|rejected|inconclusive)\b/i);
|
|
12928
|
+
return {
|
|
12929
|
+
exists: true,
|
|
12930
|
+
hypothesisDefined: meaningful2(section3(markdown, "Hypothesis")),
|
|
12931
|
+
successCriteriaCount: criteria,
|
|
12932
|
+
constraintsDefined: meaningful2(section3(markdown, "Constraints")),
|
|
12933
|
+
nonGoalsDefined: meaningful2(section3(markdown, "Non-goals")),
|
|
12934
|
+
conclusion: conclusionMatch ? conclusionMatch[1].toLowerCase() : "pending"
|
|
12935
|
+
};
|
|
12936
|
+
}
|
|
12937
|
+
|
|
12791
12938
|
// src/core/next-step.ts
|
|
12792
12939
|
function buildDeliveryState(dir) {
|
|
12793
12940
|
const wis = discoverWorkItems(dir);
|
|
@@ -12875,6 +13022,40 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
|
|
|
12875
13022
|
return { id: "init", phase: "Setup", label: "Run `kaddo init` to initialize Kaddo.", command: "kaddo init", reason: "Kaddo is not initialized in this project." };
|
|
12876
13023
|
}
|
|
12877
13024
|
const state = config.project.state;
|
|
13025
|
+
if (projectMode(config) === "poc") {
|
|
13026
|
+
const poc = readPocSummary(dir);
|
|
13027
|
+
if (!poc.exists) {
|
|
13028
|
+
return { id: "bootstrap", phase: "Setup", label: "Run `kaddo bootstrap` to create the POC knowledge baseline.", command: "kaddo bootstrap", reason: `Missing ${POC_ARTIFACT_PATH}.` };
|
|
13029
|
+
}
|
|
13030
|
+
if (!poc.hypothesisDefined) {
|
|
13031
|
+
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." };
|
|
13032
|
+
}
|
|
13033
|
+
if (poc.successCriteriaCount === 0) {
|
|
13034
|
+
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." };
|
|
13035
|
+
}
|
|
13036
|
+
const qCurrentState2 = analyzeKnowledgeArtifact(dir, CS);
|
|
13037
|
+
const qCodebase2 = analyzeKnowledgeArtifact(dir, CB);
|
|
13038
|
+
if (qCurrentState2 !== "useful" || qCodebase2 !== "useful") {
|
|
13039
|
+
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." };
|
|
13040
|
+
}
|
|
13041
|
+
if (!exists(join(dir, "knowledge", "resources"))) {
|
|
13042
|
+
return { id: "poc-resources", phase: "POC Discovery", label: "Identify the project resources relevant to the experiment.", command: "kaddo resources list", reason: "No project resource catalog is available for the experiment context." };
|
|
13043
|
+
}
|
|
13044
|
+
const delivery = buildDeliveryState(dir);
|
|
13045
|
+
if (delivery.total_work_items === 0) {
|
|
13046
|
+
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." };
|
|
13047
|
+
}
|
|
13048
|
+
if (delivery.in_progress_work_items > 0) {
|
|
13049
|
+
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.` };
|
|
13050
|
+
}
|
|
13051
|
+
if (delivery.ready_work_items > 0 || delivery.draft_work_items > 0 || delivery.blocked_work_items > 0) {
|
|
13052
|
+
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." };
|
|
13053
|
+
}
|
|
13054
|
+
if (poc.conclusion === "pending") {
|
|
13055
|
+
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." };
|
|
13056
|
+
}
|
|
13057
|
+
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." };
|
|
13058
|
+
}
|
|
12878
13059
|
const q = (rel) => analyzeKnowledgeArtifact(dir, rel);
|
|
12879
13060
|
const resolveAgent = (agent) => {
|
|
12880
13061
|
const file = agent.endsWith(".md") ? agent : `${agent}.md`;
|
|
@@ -13879,6 +14060,47 @@ var LEGACY_STEPS = [
|
|
|
13879
14060
|
runGuard2,
|
|
13880
14061
|
captureLearning
|
|
13881
14062
|
];
|
|
14063
|
+
var definePocHypothesis = {
|
|
14064
|
+
id: "poc-hypothesis",
|
|
14065
|
+
label: "Define hypothesis",
|
|
14066
|
+
evaluate: (ctx) => {
|
|
14067
|
+
const poc = readPocSummary(ctx.dir);
|
|
14068
|
+
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." };
|
|
14069
|
+
}
|
|
14070
|
+
};
|
|
14071
|
+
var definePocCriteria = {
|
|
14072
|
+
id: "poc-success-criteria",
|
|
14073
|
+
label: "Define success criteria",
|
|
14074
|
+
evaluate: (ctx) => {
|
|
14075
|
+
const poc = readPocSummary(ctx.dir);
|
|
14076
|
+
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." };
|
|
14077
|
+
}
|
|
14078
|
+
};
|
|
14079
|
+
var describePocTech = { ...describeArchitecture, id: "poc-technical-context", label: "Document minimal technical context" };
|
|
14080
|
+
var identifyPocResources = {
|
|
14081
|
+
id: "poc-resources",
|
|
14082
|
+
label: "Identify relevant resources",
|
|
14083
|
+
evaluate: (ctx) => exists(join(ctx.dir, "knowledge/resources")) ? { status: "done", evidence: ["knowledge/resources/"] } : { status: "pending", command: "kaddo resources list" }
|
|
14084
|
+
};
|
|
14085
|
+
var createPocExperiment = {
|
|
14086
|
+
id: "poc-create-experiment",
|
|
14087
|
+
label: "Create experiment Work Item",
|
|
14088
|
+
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." }
|
|
14089
|
+
};
|
|
14090
|
+
var capturePocEvidence = {
|
|
14091
|
+
id: "poc-evidence",
|
|
14092
|
+
label: "Capture experiment evidence",
|
|
14093
|
+
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." }
|
|
14094
|
+
};
|
|
14095
|
+
var concludePoc = {
|
|
14096
|
+
id: "poc-evaluate",
|
|
14097
|
+
label: "Evaluate and conclude",
|
|
14098
|
+
evaluate: (ctx) => {
|
|
14099
|
+
const conclusion = readPocSummary(ctx.dir).conclusion;
|
|
14100
|
+
return conclusion === "pending" ? { status: "pending", reason: "Record validated, rejected, or inconclusive from the evidence." } : { status: "done", evidence: [POC_ARTIFACT_PATH], reason: `Conclusion: ${conclusion}.` };
|
|
14101
|
+
}
|
|
14102
|
+
};
|
|
14103
|
+
var POC_STEPS = [enableKaddo, bootstrapBaseline, definePocHypothesis, definePocCriteria, describePocTech, identifyPocResources, createPocExperiment, capturePocEvidence, concludePoc];
|
|
13882
14104
|
function stepsForState(state) {
|
|
13883
14105
|
switch (state) {
|
|
13884
14106
|
case "new":
|
|
@@ -13975,14 +14197,21 @@ function mapNextStepId(id) {
|
|
|
13975
14197
|
"init-module-context": "enable-kaddo",
|
|
13976
14198
|
"module-ready": "ready-for-core-orchestration",
|
|
13977
14199
|
"validate-work-item-modules": "validate-module-knowledge",
|
|
13978
|
-
"modules-discover": "enable-kaddo"
|
|
14200
|
+
"modules-discover": "enable-kaddo",
|
|
14201
|
+
"poc-hypothesis": "poc-hypothesis",
|
|
14202
|
+
"poc-success-criteria": "poc-success-criteria",
|
|
14203
|
+
"poc-technical-context": "poc-technical-context",
|
|
14204
|
+
"poc-resources": "poc-resources",
|
|
14205
|
+
"poc-create-experiment": "poc-create-experiment",
|
|
14206
|
+
"poc-evaluate": "poc-evaluate",
|
|
14207
|
+
"poc-complete": "poc-evaluate"
|
|
13979
14208
|
};
|
|
13980
14209
|
return MAP[id] ?? id;
|
|
13981
14210
|
}
|
|
13982
14211
|
function buildProjectRoute(dir) {
|
|
13983
14212
|
const config = loadConfig(dir);
|
|
13984
14213
|
const state = config?.project.state ?? "pre-ai";
|
|
13985
|
-
const defs = config && isModule(config) ? MODULE_STEPS : stepsForState(state);
|
|
14214
|
+
const defs = config && projectMode(config) === "poc" ? POC_STEPS : config && isModule(config) ? MODULE_STEPS : stepsForState(state);
|
|
13986
14215
|
const ctx = buildRouteContext(dir);
|
|
13987
14216
|
const steps = defs.map((d) => {
|
|
13988
14217
|
const result = d.evaluate(ctx);
|
|
@@ -15106,6 +15335,7 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
|
|
|
15106
15335
|
missing.push("No work items found.");
|
|
15107
15336
|
}
|
|
15108
15337
|
const state = config.project.state;
|
|
15338
|
+
const mode = projectMode(config);
|
|
15109
15339
|
const roadmapPath = join(dir, ARCH_DIR6, "delivery", "roadmap.md");
|
|
15110
15340
|
const materialized = allArtifacts.filter(
|
|
15111
15341
|
(a) => a.filePath.replace(/\\/g, "/").includes("/delivery/work-items/") && Boolean(a.type)
|
|
@@ -15198,6 +15428,7 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
|
|
|
15198
15428
|
project: {
|
|
15199
15429
|
name: config.project.name,
|
|
15200
15430
|
state,
|
|
15431
|
+
mode,
|
|
15201
15432
|
teamSize: config.team.size,
|
|
15202
15433
|
structure: config.project.structure,
|
|
15203
15434
|
language: languageLabel(projectLanguage(config))
|
|
@@ -15223,6 +15454,7 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
|
|
|
15223
15454
|
allWorkItems: allWorkItemArtifacts.map(toContextWorkItem),
|
|
15224
15455
|
artifacts: allArtifacts.filter((a) => a.codeGlobs.length > 0).map(toContextArtifact)
|
|
15225
15456
|
},
|
|
15457
|
+
...mode === "poc" ? { poc: readPocSummary(dir) } : {},
|
|
15226
15458
|
layers,
|
|
15227
15459
|
knowledgeQuality,
|
|
15228
15460
|
roadmap,
|
|
@@ -15326,11 +15558,23 @@ function renderContextPack(pack) {
|
|
|
15326
15558
|
[
|
|
15327
15559
|
`- Name: ${project.name}`,
|
|
15328
15560
|
`- State: ${project.state}`,
|
|
15561
|
+
`- Mode: ${project.mode}`,
|
|
15329
15562
|
`- Team size: ${project.teamSize}`,
|
|
15330
15563
|
`- Structure: ${project.structure}`,
|
|
15331
15564
|
`- Language: ${project.language}`
|
|
15332
15565
|
].join("\n") + "\n"
|
|
15333
15566
|
);
|
|
15567
|
+
if (pack.poc) {
|
|
15568
|
+
parts.push("## Proof of Concept\n");
|
|
15569
|
+
parts.push([
|
|
15570
|
+
`- Hypothesis: ${pack.poc.hypothesisDefined ? "defined" : "missing"}`,
|
|
15571
|
+
`- Success criteria: ${pack.poc.successCriteriaCount}`,
|
|
15572
|
+
`- Constraints: ${pack.poc.constraintsDefined ? "defined" : "missing"}`,
|
|
15573
|
+
`- Non-goals: ${pack.poc.nonGoalsDefined ? "defined" : "missing"}`,
|
|
15574
|
+
`- Conclusion: ${pack.poc.conclusion}`,
|
|
15575
|
+
"- Canonical artifact: `knowledge/delivery/poc.md`"
|
|
15576
|
+
].join("\n") + "\n");
|
|
15577
|
+
}
|
|
15334
15578
|
parts.push("## Current Phase\n");
|
|
15335
15579
|
parts.push(`Phase: ${pack.phase.phase}
|
|
15336
15580
|
`);
|
|
@@ -15414,27 +15658,29 @@ function renderContextPack(pack) {
|
|
|
15414
15658
|
}
|
|
15415
15659
|
parts.push("## Current Knowledge\n");
|
|
15416
15660
|
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) {
|
|
15661
|
+
if (project.mode !== "poc") {
|
|
15662
|
+
parts.push("## Roadmap Status\n");
|
|
15663
|
+
if (pack.roadmap.present) {
|
|
15428
15664
|
parts.push(
|
|
15429
|
-
|
|
15665
|
+
[
|
|
15666
|
+
`- Initiatives: ${pack.roadmap.initiatives}`,
|
|
15667
|
+
`- Work Item candidates: ${pack.roadmap.work_item_candidates}`,
|
|
15668
|
+
`- Materialized Work Items: ${pack.roadmap.materialized_work_items}`,
|
|
15669
|
+
`- Remaining Work Item candidates: ${pack.roadmap.remaining_work_item_candidates}`
|
|
15670
|
+
].join("\n") + "\n"
|
|
15430
15671
|
);
|
|
15672
|
+
if (pack.roadmap.remaining_work_item_candidates > 0) {
|
|
15673
|
+
parts.push(
|
|
15674
|
+
"Work Item candidates are not yet Work Items. Materialize them with `kaddo create --from roadmap`.\n"
|
|
15675
|
+
);
|
|
15676
|
+
}
|
|
15431
15677
|
}
|
|
15678
|
+
parts.push((knowledge.roadmapSummary || "No roadmap baseline found.") + "\n");
|
|
15432
15679
|
}
|
|
15433
|
-
parts.push((knowledge.roadmapSummary || "No roadmap baseline found.") + "\n");
|
|
15434
15680
|
const rq = pack.roadmapQuality;
|
|
15435
15681
|
const rqi = rq.initiatives;
|
|
15436
15682
|
const rqw = rq.work_item_candidates;
|
|
15437
|
-
if (rqi.total > 0 || rqw.total > 0) {
|
|
15683
|
+
if (project.mode !== "poc" && (rqi.total > 0 || rqw.total > 0)) {
|
|
15438
15684
|
parts.push("## Roadmap Quality\n");
|
|
15439
15685
|
if (rqi.total > 0) {
|
|
15440
15686
|
parts.push(
|
|
@@ -15688,7 +15934,13 @@ function runContext(opts = {}) {
|
|
|
15688
15934
|
function agentIsInstalled(dir, fileName) {
|
|
15689
15935
|
return exists(join(dir, agentInstallPath(fileName))) || exists(join(dir, "knowledge", "agents", fileName));
|
|
15690
15936
|
}
|
|
15691
|
-
function flowForState(state) {
|
|
15937
|
+
function flowForState(state, mode) {
|
|
15938
|
+
if (mode === "poc") {
|
|
15939
|
+
return [
|
|
15940
|
+
{ agent: "architecture-agent.md", output: "knowledge/tech/current-state.md" },
|
|
15941
|
+
{ agent: "work-item-agent.md", output: "knowledge/delivery/poc.md" }
|
|
15942
|
+
];
|
|
15943
|
+
}
|
|
15692
15944
|
switch (state) {
|
|
15693
15945
|
case "new":
|
|
15694
15946
|
return [
|
|
@@ -15713,9 +15965,10 @@ function flowForState(state) {
|
|
|
15713
15965
|
}
|
|
15714
15966
|
function buildUnderstandPlan(dir, config) {
|
|
15715
15967
|
const state = config.project.state;
|
|
15968
|
+
const mode = projectMode(config);
|
|
15716
15969
|
if (isModule(config)) {
|
|
15717
15970
|
return {
|
|
15718
|
-
project: { name: config.project.name, state, teamSize: config.team.size, structure: config.project.structure, language: "English" },
|
|
15971
|
+
project: { name: config.project.name, state, mode, teamSize: config.team.size, structure: config.project.structure, language: "English" },
|
|
15719
15972
|
steps: [],
|
|
15720
15973
|
missingAgents: [],
|
|
15721
15974
|
agentsInstalled: true,
|
|
@@ -15723,7 +15976,7 @@ function buildUnderstandPlan(dir, config) {
|
|
|
15723
15976
|
contextPackPath: ".kaddo/context-pack.md"
|
|
15724
15977
|
};
|
|
15725
15978
|
}
|
|
15726
|
-
const flow = flowForState(state).filter((s) => !exists(join(dir, s.output)));
|
|
15979
|
+
const flow = flowForState(state, mode).filter((s) => !exists(join(dir, s.output)));
|
|
15727
15980
|
const steps = flow.map((s) => {
|
|
15728
15981
|
const installed = agentIsInstalled(dir, s.agent);
|
|
15729
15982
|
return { agent: s.agent, output: s.output, installed };
|
|
@@ -15734,6 +15987,7 @@ function buildUnderstandPlan(dir, config) {
|
|
|
15734
15987
|
project: {
|
|
15735
15988
|
name: config.project.name,
|
|
15736
15989
|
state,
|
|
15990
|
+
mode,
|
|
15737
15991
|
teamSize: config.team.size,
|
|
15738
15992
|
structure: config.project.structure,
|
|
15739
15993
|
language: "English"
|
|
@@ -16825,7 +17079,7 @@ function runHistory(opts = {}) {
|
|
|
16825
17079
|
}
|
|
16826
17080
|
|
|
16827
17081
|
// src/commands/add.ts
|
|
16828
|
-
import { parse as parseYaml16, stringify as
|
|
17082
|
+
import { parse as parseYaml16, stringify as stringifyYaml8 } from "yaml";
|
|
16829
17083
|
var CONFIG_PATH7 = ".kaddo/config.yml";
|
|
16830
17084
|
function readProjectState(dir) {
|
|
16831
17085
|
const configPath = join(dir, CONFIG_PATH7);
|
|
@@ -16860,7 +17114,7 @@ function markModuleInstalled(dir, configKey, moduleName) {
|
|
|
16860
17114
|
const modules = config.modules ?? [];
|
|
16861
17115
|
if (!modules.includes(moduleName)) modules.push(moduleName);
|
|
16862
17116
|
config.modules = modules;
|
|
16863
|
-
writeFile(configPath,
|
|
17117
|
+
writeFile(configPath, stringifyYaml8(config));
|
|
16864
17118
|
} catch {
|
|
16865
17119
|
}
|
|
16866
17120
|
}
|
|
@@ -17693,20 +17947,166 @@ _Controlled modernization steps._
|
|
|
17693
17947
|
## Later
|
|
17694
17948
|
|
|
17695
17949
|
_Deferred modernization ideas._
|
|
17950
|
+
`
|
|
17951
|
+
},
|
|
17952
|
+
poc: {
|
|
17953
|
+
new: `# Proof of Concept
|
|
17954
|
+
|
|
17955
|
+
## Hypothesis
|
|
17956
|
+
|
|
17957
|
+
_What assumption are we testing?_
|
|
17958
|
+
|
|
17959
|
+
## Success Criteria
|
|
17960
|
+
|
|
17961
|
+
- [ ] _Observable result that would support the hypothesis._
|
|
17962
|
+
|
|
17963
|
+
## Constraints
|
|
17964
|
+
|
|
17965
|
+
_Technical, time, budget, compliance, or operational constraints._
|
|
17966
|
+
|
|
17967
|
+
## Non-goals
|
|
17968
|
+
|
|
17969
|
+
_What this experiment intentionally will not prove or deliver._
|
|
17970
|
+
|
|
17971
|
+
## Evidence
|
|
17972
|
+
|
|
17973
|
+
_Link experiments, Work Items, measurements, and observations here._
|
|
17974
|
+
|
|
17975
|
+
## Conclusion
|
|
17976
|
+
|
|
17977
|
+
Status: pending
|
|
17978
|
+
|
|
17979
|
+
_Record validated, rejected, or inconclusive only after reviewing evidence._
|
|
17980
|
+
`,
|
|
17981
|
+
"pre-ai": `# Proof of Concept
|
|
17982
|
+
|
|
17983
|
+
## Hypothesis
|
|
17984
|
+
|
|
17985
|
+
_What assumption about this existing system 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
|
+
legacy: `# Proof of Concept
|
|
18010
|
+
|
|
18011
|
+
## Hypothesis
|
|
18012
|
+
|
|
18013
|
+
_What assumption can be tested safely without disrupting the legacy system?_
|
|
18014
|
+
|
|
18015
|
+
## Success Criteria
|
|
18016
|
+
|
|
18017
|
+
- [ ] _Observable result that would support the hypothesis._
|
|
18018
|
+
|
|
18019
|
+
## Constraints
|
|
18020
|
+
|
|
18021
|
+
_Change-safety, technical, time, 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._
|
|
17696
18036
|
`
|
|
17697
18037
|
}
|
|
17698
18038
|
};
|
|
17699
18039
|
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
18040
|
var DIAGRAM_KINDS = /* @__PURE__ */ new Set(["business", "product", "capabilities", "codebase", "current-state"]);
|
|
17701
|
-
function baselineTemplate(kind, state) {
|
|
18041
|
+
function baselineTemplate(kind, state, mode = "standard") {
|
|
17702
18042
|
const st = state === "pre-ai" || state === "legacy" ? state : "new";
|
|
18043
|
+
if (mode === "poc" && kind === "business") {
|
|
18044
|
+
return fm(kind, st) + `# Business Context
|
|
18045
|
+
|
|
18046
|
+
## Problem
|
|
18047
|
+
|
|
18048
|
+
_What problem makes this experiment worth running?_
|
|
18049
|
+
|
|
18050
|
+
## Expected value
|
|
18051
|
+
|
|
18052
|
+
_What decision or outcome could this POC unlock?_
|
|
18053
|
+
`;
|
|
18054
|
+
}
|
|
18055
|
+
if (mode === "poc" && kind === "product") {
|
|
18056
|
+
return fm(kind, st) + `# Product Context
|
|
18057
|
+
|
|
18058
|
+
## Scenario
|
|
18059
|
+
|
|
18060
|
+
_Which user or system scenario is being tested?_
|
|
18061
|
+
|
|
18062
|
+
## Expected behavior
|
|
18063
|
+
|
|
18064
|
+
_What minimal behavior should the experiment demonstrate?_
|
|
18065
|
+
|
|
18066
|
+
## Non-goals
|
|
18067
|
+
|
|
18068
|
+
_What product scope is deliberately excluded?_
|
|
18069
|
+
`;
|
|
18070
|
+
}
|
|
18071
|
+
if (mode === "poc" && kind === "current-state") {
|
|
18072
|
+
return fm(kind, st) + `# Minimal Technical Context
|
|
18073
|
+
|
|
18074
|
+
## Technical hypothesis
|
|
18075
|
+
|
|
18076
|
+
_What technical assumption is being tested?_
|
|
18077
|
+
|
|
18078
|
+
## Minimal architecture
|
|
18079
|
+
|
|
18080
|
+
_Only the components, boundaries, and dependencies required for this experiment._
|
|
18081
|
+
|
|
18082
|
+
## Constraints
|
|
18083
|
+
|
|
18084
|
+
_Constraints that can affect the experiment or its interpretation._
|
|
18085
|
+
`;
|
|
18086
|
+
}
|
|
18087
|
+
if (mode === "poc" && kind === "codebase") {
|
|
18088
|
+
return fm(kind, st) + `# Experiment Surface
|
|
18089
|
+
|
|
18090
|
+
## Relevant areas
|
|
18091
|
+
|
|
18092
|
+
_List only the repository areas, services, or resources needed by this experiment._
|
|
18093
|
+
|
|
18094
|
+
## How to run
|
|
18095
|
+
|
|
18096
|
+
_Document the smallest reproducible experiment path._
|
|
18097
|
+
|
|
18098
|
+
## How to observe
|
|
18099
|
+
|
|
18100
|
+
_Document logs, metrics, tests, or manual evidence to inspect._
|
|
18101
|
+
`;
|
|
18102
|
+
}
|
|
17703
18103
|
const body = T[kind][st] + (DIAGRAM_KINDS.has(kind) ? DIAGRAM_GUIDANCE : "");
|
|
17704
18104
|
return fm(kind, st) + body;
|
|
17705
18105
|
}
|
|
17706
18106
|
|
|
17707
18107
|
// src/commands/bootstrap.ts
|
|
17708
18108
|
var CONFIG_PATH9 = ".kaddo/config.yml";
|
|
17709
|
-
var
|
|
18109
|
+
var STANDARD_FILE_TARGETS = [
|
|
17710
18110
|
{ path: "knowledge/business/business.md", kind: "business" },
|
|
17711
18111
|
{ path: "knowledge/product/product.md", kind: "product" },
|
|
17712
18112
|
{ path: "knowledge/product/capabilities.md", kind: "capabilities" },
|
|
@@ -17714,6 +18114,13 @@ var FILE_TARGETS = [
|
|
|
17714
18114
|
{ path: "knowledge/tech/current-state.md", kind: "current-state" },
|
|
17715
18115
|
{ path: "knowledge/delivery/roadmap.md", kind: "roadmap" }
|
|
17716
18116
|
];
|
|
18117
|
+
var POC_FILE_TARGETS = [
|
|
18118
|
+
{ path: "knowledge/business/business.md", kind: "business" },
|
|
18119
|
+
{ path: "knowledge/product/product.md", kind: "product" },
|
|
18120
|
+
{ path: "knowledge/tech/codebase.md", kind: "codebase" },
|
|
18121
|
+
{ path: "knowledge/tech/current-state.md", kind: "current-state" },
|
|
18122
|
+
{ path: "knowledge/delivery/poc.md", kind: "poc" }
|
|
18123
|
+
];
|
|
17717
18124
|
var DIR_TARGETS = ["knowledge/tech/decisions", "knowledge/tech/discovery", "knowledge/delivery/work-items"];
|
|
17718
18125
|
function withLanguageDirective(content, language) {
|
|
17719
18126
|
if (language !== "es") return content;
|
|
@@ -17728,22 +18135,24 @@ function bootstrap(dir) {
|
|
|
17728
18135
|
const skipped = [];
|
|
17729
18136
|
const createdDirs = [];
|
|
17730
18137
|
let state = "new";
|
|
18138
|
+
let mode = "standard";
|
|
17731
18139
|
let language = "en";
|
|
17732
18140
|
try {
|
|
17733
18141
|
const config = loadConfig(dir);
|
|
17734
18142
|
if (config) {
|
|
17735
18143
|
state = config.project.state;
|
|
18144
|
+
mode = projectMode(config);
|
|
17736
18145
|
language = projectLanguage(config);
|
|
17737
18146
|
}
|
|
17738
18147
|
} catch {
|
|
17739
18148
|
}
|
|
17740
|
-
for (const target of
|
|
18149
|
+
for (const target of mode === "poc" ? POC_FILE_TARGETS : STANDARD_FILE_TARGETS) {
|
|
17741
18150
|
const full = join(dir, target.path);
|
|
17742
18151
|
if (exists(full)) {
|
|
17743
18152
|
skipped.push(target.path);
|
|
17744
18153
|
continue;
|
|
17745
18154
|
}
|
|
17746
|
-
const content = withLanguageDirective(baselineTemplate(target.kind, state), language);
|
|
18155
|
+
const content = withLanguageDirective(baselineTemplate(target.kind, state, mode), language);
|
|
17747
18156
|
writeFile(full, content.endsWith("\n") ? content : `${content}
|
|
17748
18157
|
`);
|
|
17749
18158
|
written.push(target.path);
|
|
@@ -17758,7 +18167,7 @@ function bootstrap(dir) {
|
|
|
17758
18167
|
writeFile(join(full, ".gitkeep"), "");
|
|
17759
18168
|
createdDirs.push(`${d}/`);
|
|
17760
18169
|
}
|
|
17761
|
-
return { state, written, skipped, createdDirs };
|
|
18170
|
+
return { state, mode, written, skipped, createdDirs };
|
|
17762
18171
|
}
|
|
17763
18172
|
async function runBootstrap(dir = cwd()) {
|
|
17764
18173
|
intro("kaddo bootstrap");
|
|
@@ -17768,16 +18177,19 @@ async function runBootstrap(dir = cwd()) {
|
|
|
17768
18177
|
process.exit(1);
|
|
17769
18178
|
}
|
|
17770
18179
|
let state = "new";
|
|
18180
|
+
let mode = "standard";
|
|
17771
18181
|
try {
|
|
17772
18182
|
const config = loadConfig(dir);
|
|
17773
18183
|
state = config?.project.state ?? "new";
|
|
18184
|
+
if (config) mode = projectMode(config);
|
|
17774
18185
|
} catch (err) {
|
|
17775
18186
|
console.error(err instanceof ConfigError ? err.message : String(err));
|
|
17776
18187
|
process.exit(1);
|
|
17777
18188
|
}
|
|
17778
18189
|
const stateLabel3 = state === "pre-ai" ? "pre-ai" : state;
|
|
17779
18190
|
log.info(`Project state: ${stateLabel3}`);
|
|
17780
|
-
log.info(`
|
|
18191
|
+
log.info(`Project mode: ${mode}`);
|
|
18192
|
+
log.info(`Creating ${mode === "poc" ? "POC" : stateLabel3} knowledge baseline.`);
|
|
17781
18193
|
log.info("Existing files will not be overwritten.");
|
|
17782
18194
|
const result = bootstrap(dir);
|
|
17783
18195
|
console.log("");
|
|
@@ -17797,7 +18209,7 @@ async function runBootstrap(dir = cwd()) {
|
|
|
17797
18209
|
);
|
|
17798
18210
|
printCommandFooter("bootstrap");
|
|
17799
18211
|
outro(
|
|
17800
|
-
`${stateLabel3} knowledge baseline ready. Next: \`kaddo add agents\` (then \`kaddo add skills\`), and refine the knowledge with the relevant agents
|
|
18212
|
+
`${mode === "poc" ? "POC" : stateLabel3} knowledge baseline ready. Next: \`kaddo add agents\` (then \`kaddo add skills\`), ` + (mode === "poc" ? "then define the POC hypothesis and success criteria." : "and refine the knowledge with the relevant agents.")
|
|
17801
18213
|
);
|
|
17802
18214
|
}
|
|
17803
18215
|
|
|
@@ -17908,7 +18320,7 @@ function runGraphExport(opts = {}) {
|
|
|
17908
18320
|
}
|
|
17909
18321
|
|
|
17910
18322
|
// src/core/system-topology.ts
|
|
17911
|
-
import { parse as parseYaml17, stringify as
|
|
18323
|
+
import { parse as parseYaml17, stringify as stringifyYaml9 } from "yaml";
|
|
17912
18324
|
import fs4 from "fs";
|
|
17913
18325
|
import path8 from "path";
|
|
17914
18326
|
import crypto from "crypto";
|
|
@@ -18073,7 +18485,7 @@ function serializeTopology(entities, relationships) {
|
|
|
18073
18485
|
})),
|
|
18074
18486
|
relationships: relationships.map((r) => ({ from: r.from, to: r.to, type: r.type, ...r.evidence.length ? { evidence: r.evidence } : {} }))
|
|
18075
18487
|
};
|
|
18076
|
-
return
|
|
18488
|
+
return stringifyYaml9(doc);
|
|
18077
18489
|
}
|
|
18078
18490
|
function atomicWrite(filePath, content) {
|
|
18079
18491
|
fs4.mkdirSync(path8.dirname(filePath), { recursive: true });
|
|
@@ -18547,7 +18959,7 @@ async function runResourcesDelete(id, opts = {}, dir = cwd()) {
|
|
|
18547
18959
|
|
|
18548
18960
|
// src/services/integrations.ts
|
|
18549
18961
|
import matter14 from "gray-matter";
|
|
18550
|
-
import { parse as parseYaml18, stringify as
|
|
18962
|
+
import { parse as parseYaml18, stringify as stringifyYaml10 } from "yaml";
|
|
18551
18963
|
|
|
18552
18964
|
// src/core/work-item-write.ts
|
|
18553
18965
|
import fs6 from "fs";
|
|
@@ -23643,8 +24055,12 @@ var require2 = createRequire(import.meta.url);
|
|
|
23643
24055
|
var { version } = require2("../package.json");
|
|
23644
24056
|
var program = new Command();
|
|
23645
24057
|
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();
|
|
24058
|
+
program.command("init").description("Initialize Kaddo in the current project").option("--mode <mode>", "Project mode: standard or poc").action(async (opts) => {
|
|
24059
|
+
await runInit(opts);
|
|
24060
|
+
});
|
|
24061
|
+
var projectCmd = program.command("project").description("Inspect and configure project metadata");
|
|
24062
|
+
projectCmd.command("mode [mode]").description("Show or set the project mode: standard or poc").action((mode) => {
|
|
24063
|
+
runProjectMode(mode);
|
|
23648
24064
|
});
|
|
23649
24065
|
program.command("scan").description("Detect project stack and suggest domains").action(async () => {
|
|
23650
24066
|
await runScan();
|