@kaddo/cli 3.115.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-YcMJYo0g.js → architectureDiagram-3BPJPVTR-VNE4N202.js} +1 -1
- package/dist/admin-dist/assets/{chunk-727SXJPM-BVnKaPXl.js → chunk-727SXJPM-Dycfm5kx.js} +1 -1
- package/dist/admin-dist/assets/{chunk-AQP2D5EJ-D_Hcj3zm.js → chunk-AQP2D5EJ-CZfRVDeZ.js} +1 -1
- package/dist/admin-dist/assets/{classDiagram-v2-Q7XG4LA2-C1j2IJF8.js → classDiagram-4FO5ZUOK-ZqEUMLi9.js} +1 -1
- package/dist/admin-dist/assets/{classDiagram-4FO5ZUOK-C1j2IJF8.js → classDiagram-v2-Q7XG4LA2-ZqEUMLi9.js} +1 -1
- package/dist/admin-dist/assets/{dagre-BM42HDAG-ADdKf6j1.js → dagre-BM42HDAG-BPoktDQ7.js} +1 -1
- package/dist/admin-dist/assets/{diagram-2AECGRRQ-Z_xeHBlY.js → diagram-2AECGRRQ-DX6VsCIO.js} +1 -1
- package/dist/admin-dist/assets/{diagram-5GNKFQAL-Wgzw55l3.js → diagram-5GNKFQAL-DaVO8tr4.js} +1 -1
- package/dist/admin-dist/assets/{diagram-LMA3HP47-Dj6c7SSM.js → diagram-LMA3HP47-C7OMxYl7.js} +1 -1
- package/dist/admin-dist/assets/{diagram-OG6HWLK6-hHqRSSZr.js → diagram-OG6HWLK6-Ba7L6sdv.js} +1 -1
- package/dist/admin-dist/assets/{erDiagram-TEJ5UH35-BTGBIaZr.js → erDiagram-TEJ5UH35-B8GR6jN8.js} +1 -1
- package/dist/admin-dist/assets/{flowDiagram-I6XJVG4X-RZJDjzR6.js → flowDiagram-I6XJVG4X-GnYF-YSu.js} +1 -1
- package/dist/admin-dist/assets/{ganttDiagram-6RSMTGT7-DI5Lr-xB.js → ganttDiagram-6RSMTGT7-Ci5gXlfB.js} +1 -1
- package/dist/admin-dist/assets/{index-RwMAZcWr.js → index-BQS_UR2v.js} +5 -5
- package/dist/admin-dist/assets/{infoDiagram-5YYISTIA-T5KZWjTy.js → infoDiagram-5YYISTIA-CXCqRy3V.js} +1 -1
- package/dist/admin-dist/assets/{ishikawaDiagram-YF4QCWOH-C6Gyb7TQ.js → ishikawaDiagram-YF4QCWOH-CHnyKPlH.js} +1 -1
- package/dist/admin-dist/assets/{kanban-definition-UN3LZRKU-Dg8kSuqH.js → kanban-definition-UN3LZRKU-DZ2E5eRA.js} +1 -1
- package/dist/admin-dist/assets/{linear-NG3wfuct.js → linear-CBbecos1.js} +1 -1
- package/dist/admin-dist/assets/{mindmap-definition-RKZ34NQL-B1dMo93T.js → mindmap-definition-RKZ34NQL-C_PLO1RL.js} +1 -1
- package/dist/admin-dist/assets/{pieDiagram-4H26LBE5-iIbw9aCq.js → pieDiagram-4H26LBE5-Bnzx1mbG.js} +1 -1
- package/dist/admin-dist/assets/{quadrantDiagram-W4KKPZXB-CBsaVubF.js → quadrantDiagram-W4KKPZXB-vDV6emR-.js} +1 -1
- package/dist/admin-dist/assets/{requirementDiagram-4Y6WPE33-CobNACNF.js → requirementDiagram-4Y6WPE33-BS-WaBoL.js} +1 -1
- package/dist/admin-dist/assets/{sequenceDiagram-3UESZ5HK-CpE56jux.js → sequenceDiagram-3UESZ5HK-DHBKXsre.js} +1 -1
- package/dist/admin-dist/assets/{stateDiagram-AJRCARHV-pSzN5IAu.js → stateDiagram-AJRCARHV-Cvrc0x1G.js} +1 -1
- package/dist/admin-dist/assets/{stateDiagram-v2-BHNVJYJU-LhQFrdKp.js → stateDiagram-v2-BHNVJYJU-B9k2LCWQ.js} +1 -1
- package/dist/admin-dist/assets/{timeline-definition-PNZ67QCA-q4yUdZjI.js → timeline-definition-PNZ67QCA-BPg3zrWH.js} +1 -1
- package/dist/admin-dist/assets/{vennDiagram-CIIHVFJN-D5DxPuNK.js → vennDiagram-CIIHVFJN-Cr5_ruRl.js} +1 -1
- package/dist/admin-dist/assets/{wardleyDiagram-YWT4CUSO-451b1uEN.js → wardleyDiagram-YWT4CUSO-CCFwsa6d.js} +1 -1
- package/dist/admin-dist/assets/{xychartDiagram-2RQKCTM6-DnOwq6Mk.js → xychartDiagram-2RQKCTM6-zM8ePcPG.js} +1 -1
- package/dist/admin-dist/index.html +1 -1
- package/dist/admin-server/index.js +105 -0
- package/dist/core.js +447 -97
- package/dist/index.js +1066 -318
- 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,7 +1473,7 @@ 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
1478
|
const team = config.team ?? {};
|
|
1204
1479
|
if (typeof project.state === "string") context.state = project.state;
|
|
@@ -1293,171 +1568,6 @@ function renderInventory(baseline) {
|
|
|
1293
1568
|
return parts.join("\n");
|
|
1294
1569
|
}
|
|
1295
1570
|
|
|
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 path12 = i.path.join(".");
|
|
1394
|
-
return path12 ? ` - ${path12}: ${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);
|
|
1413
|
-
}
|
|
1414
|
-
return config;
|
|
1415
|
-
}
|
|
1416
|
-
function nextStepsForState(state) {
|
|
1417
|
-
switch (state) {
|
|
1418
|
-
case "new":
|
|
1419
|
-
return "Define initial knowledge, create your first work item, and grow the roadmap gradually.";
|
|
1420
|
-
case "legacy":
|
|
1421
|
-
return "Use this baseline to identify risks, unknowns and safe modernization candidates before changing code.";
|
|
1422
|
-
case "pre-ai":
|
|
1423
|
-
default:
|
|
1424
|
-
return "Use this baseline to create a context pack and understand the existing system with LLM agents.";
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
function createGuidanceForState(state) {
|
|
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.";
|
|
1436
|
-
}
|
|
1437
|
-
}
|
|
1438
|
-
function describeProject(config) {
|
|
1439
|
-
const state = config.project.state;
|
|
1440
|
-
const stateLabel3 = state === "pre-ai" ? "pre-AI" : state;
|
|
1441
|
-
const role = projectRole(config);
|
|
1442
|
-
const roleSuffix = role ? ` (${role})` : "";
|
|
1443
|
-
return `${stateLabel3} ${config.project.structure}${roleSuffix}`;
|
|
1444
|
-
}
|
|
1445
|
-
function projectRole(config) {
|
|
1446
|
-
return config.project.role ?? config.multirepo?.role;
|
|
1447
|
-
}
|
|
1448
|
-
function isModule(config) {
|
|
1449
|
-
return projectRole(config) === "module";
|
|
1450
|
-
}
|
|
1451
|
-
function isCore(config) {
|
|
1452
|
-
return projectRole(config) === "core";
|
|
1453
|
-
}
|
|
1454
|
-
function systemName(config) {
|
|
1455
|
-
return config.system?.name;
|
|
1456
|
-
}
|
|
1457
|
-
function workspaceRoots(config) {
|
|
1458
|
-
return config.multirepo?.workspace_roots ?? [".."];
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
1571
|
// src/core/command-help.ts
|
|
1462
1572
|
var COMMAND_HELP = {
|
|
1463
1573
|
init: { question: "How do I start a Kaddo project?", next: "kaddo bootstrap" },
|
|
@@ -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
|
}
|
|
@@ -3685,6 +3795,16 @@ supporting notes as \`knowledge/tech/discovery/architecture-notes.md\` and decis
|
|
|
3685
3795
|
under \`knowledge/tech/decisions/\`. Kaddo still reads the legacy root locations for backward
|
|
3686
3796
|
compatibility, but new output should use \`discovery/\`.
|
|
3687
3797
|
|
|
3798
|
+
## Project Resource candidates
|
|
3799
|
+
|
|
3800
|
+
When the knowledge describes an external system the project depends on (a database, cloud account,
|
|
3801
|
+
API, queue, storage, service\u2026), you may propose it as a **candidate** Project Resource \u2014 never create
|
|
3802
|
+
it silently. Discovery \u2260 creation: present candidates for human review and materialize only through
|
|
3803
|
+
\`kaddo_create_resource\` / \`kaddo resources create\` with explicit confirmation. Ground every
|
|
3804
|
+
candidate in the knowledge (no guessing from ambiguous names). Model the stable system, not its access
|
|
3805
|
+
interface (CLI/MCP/SQL/API are interfaces); keep \`resources\` separate from \`affected_modules\`; and
|
|
3806
|
+
never include secret values \u2014 only reference names.
|
|
3807
|
+
|
|
3688
3808
|
## Quality Checklist
|
|
3689
3809
|
|
|
3690
3810
|
- Every component is backed by evidence from the context pack.
|
|
@@ -6449,8 +6569,8 @@ async function runCreate(type, opts = {}) {
|
|
|
6449
6569
|
answers[question.frontMatterField] = answer.trim();
|
|
6450
6570
|
}
|
|
6451
6571
|
const id = nextWorkItemId(dir);
|
|
6452
|
-
const
|
|
6453
|
-
const fileName = `${id}-${
|
|
6572
|
+
const slug5 = slugify(title);
|
|
6573
|
+
const fileName = `${id}-${slug5}.md`;
|
|
6454
6574
|
const filePath = join(dir, DRAFT_DIR, fileName);
|
|
6455
6575
|
const frontMatter2 = buildFrontMatter(id, workItemType, level, title.trim(), answers);
|
|
6456
6576
|
const body = buildBody(workItemType, level, title.trim(), answers, levelDef.qualityGate);
|
|
@@ -6483,8 +6603,8 @@ async function runCreateModule(dir, modType) {
|
|
|
6483
6603
|
answers[q.frontMatterField] = answer.trim();
|
|
6484
6604
|
}
|
|
6485
6605
|
const id = nextWorkItemId(dir);
|
|
6486
|
-
const
|
|
6487
|
-
const fileName = `${id}-${
|
|
6606
|
+
const slug5 = slugify(title);
|
|
6607
|
+
const fileName = `${id}-${slug5}.md`;
|
|
6488
6608
|
const filePath = join(dir, DRAFT_DIR, fileName);
|
|
6489
6609
|
const frontMatter2 = buildModuleFrontMatter(id, modType, title.trim(), answers);
|
|
6490
6610
|
const body = buildModuleBody(modType, title.trim(), answers);
|
|
@@ -6649,8 +6769,8 @@ function buildRoadmapWorkItem(opts) {
|
|
|
6649
6769
|
const { id, type, level, candidate } = opts;
|
|
6650
6770
|
const answers = opts.answers ?? {};
|
|
6651
6771
|
const title = candidate.title.trim();
|
|
6652
|
-
const
|
|
6653
|
-
const fileName = `${id}-${
|
|
6772
|
+
const slug5 = slugify(title);
|
|
6773
|
+
const fileName = `${id}-${slug5}.md`;
|
|
6654
6774
|
const qualityGate = getLevel(level).qualityGate;
|
|
6655
6775
|
const frontMatter2 = buildRoadmapFrontMatter(id, type, level, title, candidate, answers);
|
|
6656
6776
|
const body = buildRoadmapBody(type, level, title, candidate, answers, qualityGate);
|
|
@@ -7048,13 +7168,13 @@ function analyzeGuard(touchedFiles, artifacts, silentWithoutOwnership) {
|
|
|
7048
7168
|
}
|
|
7049
7169
|
|
|
7050
7170
|
// src/services/ignore-store.ts
|
|
7051
|
-
import { parse as parseYaml5, stringify as
|
|
7171
|
+
import { parse as parseYaml5, stringify as stringifyYaml4 } from "yaml";
|
|
7052
7172
|
var IGNORE_FILE = ".kaddo/ignores.yml";
|
|
7053
7173
|
function loadIgnores(dir) {
|
|
7054
|
-
const
|
|
7055
|
-
if (!exists(
|
|
7174
|
+
const path13 = join(dir, IGNORE_FILE);
|
|
7175
|
+
if (!exists(path13)) return [];
|
|
7056
7176
|
try {
|
|
7057
|
-
const raw = readFile(
|
|
7177
|
+
const raw = readFile(path13);
|
|
7058
7178
|
const parsed = parseYaml5(raw);
|
|
7059
7179
|
return Array.isArray(parsed) ? parsed : [];
|
|
7060
7180
|
} catch {
|
|
@@ -7062,7 +7182,7 @@ function loadIgnores(dir) {
|
|
|
7062
7182
|
}
|
|
7063
7183
|
}
|
|
7064
7184
|
function saveIgnore(dir, entry) {
|
|
7065
|
-
const
|
|
7185
|
+
const path13 = join(dir, IGNORE_FILE);
|
|
7066
7186
|
const existing = loadIgnores(dir);
|
|
7067
7187
|
const idx = existing.findIndex((e) => e.artifact_id === entry.artifact_id);
|
|
7068
7188
|
if (idx >= 0) {
|
|
@@ -7070,17 +7190,17 @@ function saveIgnore(dir, entry) {
|
|
|
7070
7190
|
} else {
|
|
7071
7191
|
existing.push(entry);
|
|
7072
7192
|
}
|
|
7073
|
-
writeFile(
|
|
7193
|
+
writeFile(path13, stringifyYaml4(existing));
|
|
7074
7194
|
}
|
|
7075
7195
|
function isIgnored(ignores, artifactId) {
|
|
7076
7196
|
return ignores.find((e) => e.artifact_id === artifactId);
|
|
7077
7197
|
}
|
|
7078
7198
|
function removeIgnore(dir, artifactId) {
|
|
7079
|
-
const
|
|
7199
|
+
const path13 = join(dir, IGNORE_FILE);
|
|
7080
7200
|
const existing = loadIgnores(dir);
|
|
7081
7201
|
const filtered = existing.filter((e) => e.artifact_id !== artifactId);
|
|
7082
7202
|
if (filtered.length === existing.length) return false;
|
|
7083
|
-
writeFile(
|
|
7203
|
+
writeFile(path13, stringifyYaml4(filtered));
|
|
7084
7204
|
return true;
|
|
7085
7205
|
}
|
|
7086
7206
|
|
|
@@ -7102,11 +7222,11 @@ function moduleArtifactCoverage(dir, id) {
|
|
|
7102
7222
|
};
|
|
7103
7223
|
}
|
|
7104
7224
|
function loadMappedModules(dir) {
|
|
7105
|
-
const
|
|
7106
|
-
if (!exists(
|
|
7225
|
+
const path13 = join(dir, DESCRIPTOR_PATH);
|
|
7226
|
+
if (!exists(path13)) return [];
|
|
7107
7227
|
let parsed;
|
|
7108
7228
|
try {
|
|
7109
|
-
parsed = parseYaml6(readFile(
|
|
7229
|
+
parsed = parseYaml6(readFile(path13));
|
|
7110
7230
|
} catch {
|
|
7111
7231
|
return [];
|
|
7112
7232
|
}
|
|
@@ -7850,7 +7970,7 @@ function buildGuardHistory(dir) {
|
|
|
7850
7970
|
const d = hotspotDir(t.code_path);
|
|
7851
7971
|
hotspotMap.set(d, (hotspotMap.get(d) ?? 0) + 1);
|
|
7852
7972
|
}
|
|
7853
|
-
const hotspots = [...hotspotMap.entries()].map(([
|
|
7973
|
+
const hotspots = [...hotspotMap.entries()].map(([path13, warnings]) => ({ path: path13, warnings })).sort((a, b) => b.warnings - a.warnings);
|
|
7854
7974
|
return {
|
|
7855
7975
|
available: true,
|
|
7856
7976
|
total_runs: sorted.length,
|
|
@@ -7906,14 +8026,14 @@ var RISKS_PATH = "knowledge/legacy/risks.md";
|
|
|
7906
8026
|
function parseRisks(content) {
|
|
7907
8027
|
const risks = [];
|
|
7908
8028
|
const sections = content.split(/^## /gm).slice(1);
|
|
7909
|
-
for (const
|
|
7910
|
-
const headerMatch =
|
|
8029
|
+
for (const section4 of sections) {
|
|
8030
|
+
const headerMatch = section4.match(/^(RISK-\d+):\s*(.+)$/m);
|
|
7911
8031
|
if (!headerMatch) continue;
|
|
7912
8032
|
const id = headerMatch[1];
|
|
7913
8033
|
const title = headerMatch[2].trim();
|
|
7914
|
-
const areaMatch =
|
|
7915
|
-
const blastMatch =
|
|
7916
|
-
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);
|
|
7917
8037
|
const area = areaMatch?.[1]?.trim() ?? "";
|
|
7918
8038
|
const blastRadius = blastMatch?.[1]?.trim() ?? "unknown";
|
|
7919
8039
|
const confidence = confMatch?.[1]?.trim() ?? "unknown";
|
|
@@ -8565,10 +8685,10 @@ function assessPhase(input) {
|
|
|
8565
8685
|
|
|
8566
8686
|
// src/core/capsule.ts
|
|
8567
8687
|
import matter3 from "gray-matter";
|
|
8568
|
-
import { parse as parseYaml11, stringify as
|
|
8688
|
+
import { parse as parseYaml11, stringify as stringifyYaml7 } from "yaml";
|
|
8569
8689
|
|
|
8570
8690
|
// src/commands/modules-map.ts
|
|
8571
|
-
import { parse as parseYaml10, stringify as
|
|
8691
|
+
import { parse as parseYaml10, stringify as stringifyYaml6 } from "yaml";
|
|
8572
8692
|
|
|
8573
8693
|
// src/templates/registry.ts
|
|
8574
8694
|
var QUALITY = "## Quality checklist";
|
|
@@ -10109,7 +10229,7 @@ function getTemplate(id) {
|
|
|
10109
10229
|
|
|
10110
10230
|
// src/commands/modules-discover.ts
|
|
10111
10231
|
import path5 from "path";
|
|
10112
|
-
import { parse as parseYaml9, stringify as
|
|
10232
|
+
import { parse as parseYaml9, stringify as stringifyYaml5 } from "yaml";
|
|
10113
10233
|
var CONFIG_PATH3 = ".kaddo/config.yml";
|
|
10114
10234
|
var MODULES_YML = ".kaddo/modules.yml";
|
|
10115
10235
|
var MODULES_MD = "knowledge/tech/modules/modules.md";
|
|
@@ -10142,7 +10262,7 @@ function readModulesYml(dir) {
|
|
|
10142
10262
|
}
|
|
10143
10263
|
}
|
|
10144
10264
|
function writeModulesYml(dir, yml) {
|
|
10145
|
-
writeFile(join(dir, MODULES_YML),
|
|
10265
|
+
writeFile(join(dir, MODULES_YML), stringifyYaml5(yml));
|
|
10146
10266
|
}
|
|
10147
10267
|
function readRepoConfig(repoDir) {
|
|
10148
10268
|
const configPath = join(repoDir, CONFIG_PATH3);
|
|
@@ -10488,17 +10608,17 @@ function slugify2(name) {
|
|
|
10488
10608
|
return name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
10489
10609
|
}
|
|
10490
10610
|
function readModulesDescriptor(dir) {
|
|
10491
|
-
const
|
|
10492
|
-
if (!exists(
|
|
10611
|
+
const path13 = join(dir, DESCRIPTOR_PATH2);
|
|
10612
|
+
if (!exists(path13)) return { version: 1, modules: [] };
|
|
10493
10613
|
try {
|
|
10494
|
-
const parsed = parseYaml10(readFile(
|
|
10614
|
+
const parsed = parseYaml10(readFile(path13));
|
|
10495
10615
|
return { version: parsed.version ?? 1, modules: parsed.modules ?? [] };
|
|
10496
10616
|
} catch {
|
|
10497
10617
|
return { version: 1, modules: [] };
|
|
10498
10618
|
}
|
|
10499
10619
|
}
|
|
10500
10620
|
function writeModulesDescriptor(dir, descriptor) {
|
|
10501
|
-
writeFile(join(dir, DESCRIPTOR_PATH2),
|
|
10621
|
+
writeFile(join(dir, DESCRIPTOR_PATH2), stringifyYaml6(descriptor));
|
|
10502
10622
|
}
|
|
10503
10623
|
function moduleDir(id) {
|
|
10504
10624
|
return `knowledge/tech/modules/${id}`;
|
|
@@ -10844,7 +10964,7 @@ function loadExternalRegistry(dir) {
|
|
|
10844
10964
|
}
|
|
10845
10965
|
}
|
|
10846
10966
|
function serializeExternalRegistry(entries) {
|
|
10847
|
-
return
|
|
10967
|
+
return stringifyYaml7({ external: entries });
|
|
10848
10968
|
}
|
|
10849
10969
|
function sectionList(md, title) {
|
|
10850
10970
|
const re = new RegExp(`^##\\s+${title}\\s*$`, "im");
|
|
@@ -10871,7 +10991,7 @@ function sectionParagraph(md, title) {
|
|
|
10871
10991
|
}
|
|
10872
10992
|
return "";
|
|
10873
10993
|
}
|
|
10874
|
-
function parseCapsule(id,
|
|
10994
|
+
function parseCapsule(id, path13, md) {
|
|
10875
10995
|
const { data } = matter3(md);
|
|
10876
10996
|
const updatedAt = data.updated_at ? String(data.updated_at) : void 0;
|
|
10877
10997
|
let ageDays = null;
|
|
@@ -10881,7 +11001,7 @@ function parseCapsule(id, path12, md) {
|
|
|
10881
11001
|
}
|
|
10882
11002
|
return {
|
|
10883
11003
|
id,
|
|
10884
|
-
path:
|
|
11004
|
+
path: path13,
|
|
10885
11005
|
system: data.system ? String(data.system) : id,
|
|
10886
11006
|
owner: data.owner ? String(data.owner) : void 0,
|
|
10887
11007
|
updatedAt,
|
|
@@ -11107,6 +11227,18 @@ function computeInitiativeProgress(dir, ini) {
|
|
|
11107
11227
|
// src/core/resources.ts
|
|
11108
11228
|
import matter5 from "gray-matter";
|
|
11109
11229
|
var RESOURCE_ARTIFACT_TYPE = "project-resource";
|
|
11230
|
+
var RESOURCE_TYPES = [
|
|
11231
|
+
"database",
|
|
11232
|
+
"cloud",
|
|
11233
|
+
"api",
|
|
11234
|
+
"queue",
|
|
11235
|
+
"storage",
|
|
11236
|
+
"repository",
|
|
11237
|
+
"platform",
|
|
11238
|
+
"service",
|
|
11239
|
+
"other"
|
|
11240
|
+
];
|
|
11241
|
+
var INTERFACE_TYPES = ["cli", "mcp", "api", "sql", "sdk", "iac", "console", "other"];
|
|
11110
11242
|
function str(v) {
|
|
11111
11243
|
return typeof v === "string" && v.trim() ? v.trim() : null;
|
|
11112
11244
|
}
|
|
@@ -11150,6 +11282,18 @@ function parseAuth(v) {
|
|
|
11150
11282
|
const refs = strArray(o.refs).filter((r) => !r.includes("=") && /^[A-Za-z0-9_.-]+$/.test(r));
|
|
11151
11283
|
return { mode: str(o.mode), refs };
|
|
11152
11284
|
}
|
|
11285
|
+
function parseScope(v) {
|
|
11286
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return null;
|
|
11287
|
+
const o = v;
|
|
11288
|
+
const type = str(o.type);
|
|
11289
|
+
if (!type) return null;
|
|
11290
|
+
return { type, module: str(o.module) };
|
|
11291
|
+
}
|
|
11292
|
+
function purposeFromBody(body) {
|
|
11293
|
+
const m = body.match(/^#{1,2}\s+Purpose\s*\n+([\s\S]*?)(?=\n#{1,2}\s|\s*$)/m);
|
|
11294
|
+
const text2 = m ? m[1].trim() : "";
|
|
11295
|
+
return text2 || null;
|
|
11296
|
+
}
|
|
11153
11297
|
function toDetail(filePath, relPath, raw) {
|
|
11154
11298
|
const parsed = matter5(raw);
|
|
11155
11299
|
const fm2 = parsed.data ?? {};
|
|
@@ -11161,8 +11305,10 @@ function toDetail(filePath, relPath, raw) {
|
|
|
11161
11305
|
resourceType: str(fm2.resource_type),
|
|
11162
11306
|
provider: str(fm2.provider),
|
|
11163
11307
|
environments: strArray(fm2.environments),
|
|
11308
|
+
scope: parseScope(fm2.scope),
|
|
11309
|
+
modules: strArray(fm2.modules),
|
|
11164
11310
|
path: relPath,
|
|
11165
|
-
purpose: str(fm2.purpose),
|
|
11311
|
+
purpose: str(fm2.purpose) ?? purposeFromBody(body),
|
|
11166
11312
|
interfaces: parseInterfaces(fm2.access_interfaces),
|
|
11167
11313
|
boundaries: parseBoundaries(fm2.access_boundaries),
|
|
11168
11314
|
...(() => {
|
|
@@ -11181,6 +11327,8 @@ function getResources(dir) {
|
|
|
11181
11327
|
resourceType: str(fm2.resource_type),
|
|
11182
11328
|
provider: str(fm2.provider),
|
|
11183
11329
|
environments: strArray(fm2.environments),
|
|
11330
|
+
scope: parseScope(fm2.scope),
|
|
11331
|
+
modules: strArray(fm2.modules),
|
|
11184
11332
|
path: a.relPath
|
|
11185
11333
|
};
|
|
11186
11334
|
}).sort((x, y) => x.id.localeCompare(y.id));
|
|
@@ -11251,9 +11399,9 @@ function buildGraph(dir, config, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
11251
11399
|
];
|
|
11252
11400
|
const presentLayers = [];
|
|
11253
11401
|
for (const layer2 of layerDocs) {
|
|
11254
|
-
const
|
|
11255
|
-
if (
|
|
11256
|
-
addNode({ id: layer2.id, type: layer2.type, label: layer2.label, path:
|
|
11402
|
+
const path13 = layer2.files.map((f) => `${KNOWLEDGE3}/${f}`).find((rel) => exists(join(dir, rel)));
|
|
11403
|
+
if (path13) {
|
|
11404
|
+
addNode({ id: layer2.id, type: layer2.type, label: layer2.label, path: path13 });
|
|
11257
11405
|
presentLayers.push(layer2.id);
|
|
11258
11406
|
}
|
|
11259
11407
|
}
|
|
@@ -11296,12 +11444,20 @@ function buildGraph(dir, config, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
11296
11444
|
const resourceTitleById = /* @__PURE__ */ new Map();
|
|
11297
11445
|
for (const r of getResources(dir)) {
|
|
11298
11446
|
resourceTitleById.set(r.id, r.title);
|
|
11447
|
+
const resId = `resource:${r.id}`;
|
|
11299
11448
|
addNode({
|
|
11300
|
-
id:
|
|
11449
|
+
id: resId,
|
|
11301
11450
|
type: "project-resource",
|
|
11302
11451
|
label: r.title ? `${r.id} ${r.title}`.trim() : r.id,
|
|
11303
11452
|
path: r.path
|
|
11304
11453
|
});
|
|
11454
|
+
const depModules = new Set(r.modules);
|
|
11455
|
+
if (r.scope?.type === "module" && r.scope.module) depModules.add(r.scope.module);
|
|
11456
|
+
for (const mod of depModules) {
|
|
11457
|
+
const modId = `module:${mod}`;
|
|
11458
|
+
addNode({ id: modId, type: "module", label: mod });
|
|
11459
|
+
addEdge(modId, resId, "depends_on");
|
|
11460
|
+
}
|
|
11305
11461
|
}
|
|
11306
11462
|
for (const wi of selectedWIs) {
|
|
11307
11463
|
const id = wi.id || wi.title;
|
|
@@ -12742,6 +12898,43 @@ function buildTechDecisions(dir) {
|
|
|
12742
12898
|
};
|
|
12743
12899
|
}
|
|
12744
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
|
+
|
|
12745
12938
|
// src/core/next-step.ts
|
|
12746
12939
|
function buildDeliveryState(dir) {
|
|
12747
12940
|
const wis = discoverWorkItems(dir);
|
|
@@ -12829,13 +13022,47 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
|
|
|
12829
13022
|
return { id: "init", phase: "Setup", label: "Run `kaddo init` to initialize Kaddo.", command: "kaddo init", reason: "Kaddo is not initialized in this project." };
|
|
12830
13023
|
}
|
|
12831
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
|
+
}
|
|
12832
13059
|
const q = (rel) => analyzeKnowledgeArtifact(dir, rel);
|
|
12833
13060
|
const resolveAgent = (agent) => {
|
|
12834
13061
|
const file = agent.endsWith(".md") ? agent : `${agent}.md`;
|
|
12835
|
-
const
|
|
12836
|
-
const installed = isFile(join(dir,
|
|
13062
|
+
const path13 = agentInstallPath(file);
|
|
13063
|
+
const installed = isFile(join(dir, path13));
|
|
12837
13064
|
const group = agentGroupOf(file);
|
|
12838
|
-
return { agentPath:
|
|
13065
|
+
return { agentPath: path13, agentInstalled: installed, installCommand: installed ? void 0 : `kaddo add agents --group ${group}` };
|
|
12839
13066
|
};
|
|
12840
13067
|
const moduleRepo = isModule(config);
|
|
12841
13068
|
const coreRepo = isCore(config);
|
|
@@ -13833,6 +14060,47 @@ var LEGACY_STEPS = [
|
|
|
13833
14060
|
runGuard2,
|
|
13834
14061
|
captureLearning
|
|
13835
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];
|
|
13836
14104
|
function stepsForState(state) {
|
|
13837
14105
|
switch (state) {
|
|
13838
14106
|
case "new":
|
|
@@ -13929,14 +14197,21 @@ function mapNextStepId(id) {
|
|
|
13929
14197
|
"init-module-context": "enable-kaddo",
|
|
13930
14198
|
"module-ready": "ready-for-core-orchestration",
|
|
13931
14199
|
"validate-work-item-modules": "validate-module-knowledge",
|
|
13932
|
-
"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"
|
|
13933
14208
|
};
|
|
13934
14209
|
return MAP[id] ?? id;
|
|
13935
14210
|
}
|
|
13936
14211
|
function buildProjectRoute(dir) {
|
|
13937
14212
|
const config = loadConfig(dir);
|
|
13938
14213
|
const state = config?.project.state ?? "pre-ai";
|
|
13939
|
-
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);
|
|
13940
14215
|
const ctx = buildRouteContext(dir);
|
|
13941
14216
|
const steps = defs.map((d) => {
|
|
13942
14217
|
const result = d.evaluate(ctx);
|
|
@@ -15060,6 +15335,7 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
|
|
|
15060
15335
|
missing.push("No work items found.");
|
|
15061
15336
|
}
|
|
15062
15337
|
const state = config.project.state;
|
|
15338
|
+
const mode = projectMode(config);
|
|
15063
15339
|
const roadmapPath = join(dir, ARCH_DIR6, "delivery", "roadmap.md");
|
|
15064
15340
|
const materialized = allArtifacts.filter(
|
|
15065
15341
|
(a) => a.filePath.replace(/\\/g, "/").includes("/delivery/work-items/") && Boolean(a.type)
|
|
@@ -15152,6 +15428,7 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
|
|
|
15152
15428
|
project: {
|
|
15153
15429
|
name: config.project.name,
|
|
15154
15430
|
state,
|
|
15431
|
+
mode,
|
|
15155
15432
|
teamSize: config.team.size,
|
|
15156
15433
|
structure: config.project.structure,
|
|
15157
15434
|
language: languageLabel(projectLanguage(config))
|
|
@@ -15177,6 +15454,7 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
|
|
|
15177
15454
|
allWorkItems: allWorkItemArtifacts.map(toContextWorkItem),
|
|
15178
15455
|
artifacts: allArtifacts.filter((a) => a.codeGlobs.length > 0).map(toContextArtifact)
|
|
15179
15456
|
},
|
|
15457
|
+
...mode === "poc" ? { poc: readPocSummary(dir) } : {},
|
|
15180
15458
|
layers,
|
|
15181
15459
|
knowledgeQuality,
|
|
15182
15460
|
roadmap,
|
|
@@ -15280,11 +15558,23 @@ function renderContextPack(pack) {
|
|
|
15280
15558
|
[
|
|
15281
15559
|
`- Name: ${project.name}`,
|
|
15282
15560
|
`- State: ${project.state}`,
|
|
15561
|
+
`- Mode: ${project.mode}`,
|
|
15283
15562
|
`- Team size: ${project.teamSize}`,
|
|
15284
15563
|
`- Structure: ${project.structure}`,
|
|
15285
15564
|
`- Language: ${project.language}`
|
|
15286
15565
|
].join("\n") + "\n"
|
|
15287
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
|
+
}
|
|
15288
15578
|
parts.push("## Current Phase\n");
|
|
15289
15579
|
parts.push(`Phase: ${pack.phase.phase}
|
|
15290
15580
|
`);
|
|
@@ -15368,27 +15658,29 @@ function renderContextPack(pack) {
|
|
|
15368
15658
|
}
|
|
15369
15659
|
parts.push("## Current Knowledge\n");
|
|
15370
15660
|
parts.push((knowledge.summary || "No project knowledge summary found yet.") + "\n");
|
|
15371
|
-
|
|
15372
|
-
|
|
15373
|
-
|
|
15374
|
-
[
|
|
15375
|
-
`- Initiatives: ${pack.roadmap.initiatives}`,
|
|
15376
|
-
`- Work Item candidates: ${pack.roadmap.work_item_candidates}`,
|
|
15377
|
-
`- Materialized Work Items: ${pack.roadmap.materialized_work_items}`,
|
|
15378
|
-
`- Remaining Work Item candidates: ${pack.roadmap.remaining_work_item_candidates}`
|
|
15379
|
-
].join("\n") + "\n"
|
|
15380
|
-
);
|
|
15381
|
-
if (pack.roadmap.remaining_work_item_candidates > 0) {
|
|
15661
|
+
if (project.mode !== "poc") {
|
|
15662
|
+
parts.push("## Roadmap Status\n");
|
|
15663
|
+
if (pack.roadmap.present) {
|
|
15382
15664
|
parts.push(
|
|
15383
|
-
|
|
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"
|
|
15384
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
|
+
}
|
|
15385
15677
|
}
|
|
15678
|
+
parts.push((knowledge.roadmapSummary || "No roadmap baseline found.") + "\n");
|
|
15386
15679
|
}
|
|
15387
|
-
parts.push((knowledge.roadmapSummary || "No roadmap baseline found.") + "\n");
|
|
15388
15680
|
const rq = pack.roadmapQuality;
|
|
15389
15681
|
const rqi = rq.initiatives;
|
|
15390
15682
|
const rqw = rq.work_item_candidates;
|
|
15391
|
-
if (rqi.total > 0 || rqw.total > 0) {
|
|
15683
|
+
if (project.mode !== "poc" && (rqi.total > 0 || rqw.total > 0)) {
|
|
15392
15684
|
parts.push("## Roadmap Quality\n");
|
|
15393
15685
|
if (rqi.total > 0) {
|
|
15394
15686
|
parts.push(
|
|
@@ -15642,7 +15934,13 @@ function runContext(opts = {}) {
|
|
|
15642
15934
|
function agentIsInstalled(dir, fileName) {
|
|
15643
15935
|
return exists(join(dir, agentInstallPath(fileName))) || exists(join(dir, "knowledge", "agents", fileName));
|
|
15644
15936
|
}
|
|
15645
|
-
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
|
+
}
|
|
15646
15944
|
switch (state) {
|
|
15647
15945
|
case "new":
|
|
15648
15946
|
return [
|
|
@@ -15667,9 +15965,10 @@ function flowForState(state) {
|
|
|
15667
15965
|
}
|
|
15668
15966
|
function buildUnderstandPlan(dir, config) {
|
|
15669
15967
|
const state = config.project.state;
|
|
15968
|
+
const mode = projectMode(config);
|
|
15670
15969
|
if (isModule(config)) {
|
|
15671
15970
|
return {
|
|
15672
|
-
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" },
|
|
15673
15972
|
steps: [],
|
|
15674
15973
|
missingAgents: [],
|
|
15675
15974
|
agentsInstalled: true,
|
|
@@ -15677,7 +15976,7 @@ function buildUnderstandPlan(dir, config) {
|
|
|
15677
15976
|
contextPackPath: ".kaddo/context-pack.md"
|
|
15678
15977
|
};
|
|
15679
15978
|
}
|
|
15680
|
-
const flow = flowForState(state).filter((s) => !exists(join(dir, s.output)));
|
|
15979
|
+
const flow = flowForState(state, mode).filter((s) => !exists(join(dir, s.output)));
|
|
15681
15980
|
const steps = flow.map((s) => {
|
|
15682
15981
|
const installed = agentIsInstalled(dir, s.agent);
|
|
15683
15982
|
return { agent: s.agent, output: s.output, installed };
|
|
@@ -15688,6 +15987,7 @@ function buildUnderstandPlan(dir, config) {
|
|
|
15688
15987
|
project: {
|
|
15689
15988
|
name: config.project.name,
|
|
15690
15989
|
state,
|
|
15990
|
+
mode,
|
|
15691
15991
|
teamSize: config.team.size,
|
|
15692
15992
|
structure: config.project.structure,
|
|
15693
15993
|
language: "English"
|
|
@@ -16779,7 +17079,7 @@ function runHistory(opts = {}) {
|
|
|
16779
17079
|
}
|
|
16780
17080
|
|
|
16781
17081
|
// src/commands/add.ts
|
|
16782
|
-
import { parse as parseYaml16, stringify as
|
|
17082
|
+
import { parse as parseYaml16, stringify as stringifyYaml8 } from "yaml";
|
|
16783
17083
|
var CONFIG_PATH7 = ".kaddo/config.yml";
|
|
16784
17084
|
function readProjectState(dir) {
|
|
16785
17085
|
const configPath = join(dir, CONFIG_PATH7);
|
|
@@ -16814,7 +17114,7 @@ function markModuleInstalled(dir, configKey, moduleName) {
|
|
|
16814
17114
|
const modules = config.modules ?? [];
|
|
16815
17115
|
if (!modules.includes(moduleName)) modules.push(moduleName);
|
|
16816
17116
|
config.modules = modules;
|
|
16817
|
-
writeFile(configPath,
|
|
17117
|
+
writeFile(configPath, stringifyYaml8(config));
|
|
16818
17118
|
} catch {
|
|
16819
17119
|
}
|
|
16820
17120
|
}
|
|
@@ -17647,20 +17947,166 @@ _Controlled modernization steps._
|
|
|
17647
17947
|
## Later
|
|
17648
17948
|
|
|
17649
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._
|
|
17650
18036
|
`
|
|
17651
18037
|
}
|
|
17652
18038
|
};
|
|
17653
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";
|
|
17654
18040
|
var DIAGRAM_KINDS = /* @__PURE__ */ new Set(["business", "product", "capabilities", "codebase", "current-state"]);
|
|
17655
|
-
function baselineTemplate(kind, state) {
|
|
18041
|
+
function baselineTemplate(kind, state, mode = "standard") {
|
|
17656
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
|
+
}
|
|
17657
18103
|
const body = T[kind][st] + (DIAGRAM_KINDS.has(kind) ? DIAGRAM_GUIDANCE : "");
|
|
17658
18104
|
return fm(kind, st) + body;
|
|
17659
18105
|
}
|
|
17660
18106
|
|
|
17661
18107
|
// src/commands/bootstrap.ts
|
|
17662
18108
|
var CONFIG_PATH9 = ".kaddo/config.yml";
|
|
17663
|
-
var
|
|
18109
|
+
var STANDARD_FILE_TARGETS = [
|
|
17664
18110
|
{ path: "knowledge/business/business.md", kind: "business" },
|
|
17665
18111
|
{ path: "knowledge/product/product.md", kind: "product" },
|
|
17666
18112
|
{ path: "knowledge/product/capabilities.md", kind: "capabilities" },
|
|
@@ -17668,6 +18114,13 @@ var FILE_TARGETS = [
|
|
|
17668
18114
|
{ path: "knowledge/tech/current-state.md", kind: "current-state" },
|
|
17669
18115
|
{ path: "knowledge/delivery/roadmap.md", kind: "roadmap" }
|
|
17670
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
|
+
];
|
|
17671
18124
|
var DIR_TARGETS = ["knowledge/tech/decisions", "knowledge/tech/discovery", "knowledge/delivery/work-items"];
|
|
17672
18125
|
function withLanguageDirective(content, language) {
|
|
17673
18126
|
if (language !== "es") return content;
|
|
@@ -17682,22 +18135,24 @@ function bootstrap(dir) {
|
|
|
17682
18135
|
const skipped = [];
|
|
17683
18136
|
const createdDirs = [];
|
|
17684
18137
|
let state = "new";
|
|
18138
|
+
let mode = "standard";
|
|
17685
18139
|
let language = "en";
|
|
17686
18140
|
try {
|
|
17687
18141
|
const config = loadConfig(dir);
|
|
17688
18142
|
if (config) {
|
|
17689
18143
|
state = config.project.state;
|
|
18144
|
+
mode = projectMode(config);
|
|
17690
18145
|
language = projectLanguage(config);
|
|
17691
18146
|
}
|
|
17692
18147
|
} catch {
|
|
17693
18148
|
}
|
|
17694
|
-
for (const target of
|
|
18149
|
+
for (const target of mode === "poc" ? POC_FILE_TARGETS : STANDARD_FILE_TARGETS) {
|
|
17695
18150
|
const full = join(dir, target.path);
|
|
17696
18151
|
if (exists(full)) {
|
|
17697
18152
|
skipped.push(target.path);
|
|
17698
18153
|
continue;
|
|
17699
18154
|
}
|
|
17700
|
-
const content = withLanguageDirective(baselineTemplate(target.kind, state), language);
|
|
18155
|
+
const content = withLanguageDirective(baselineTemplate(target.kind, state, mode), language);
|
|
17701
18156
|
writeFile(full, content.endsWith("\n") ? content : `${content}
|
|
17702
18157
|
`);
|
|
17703
18158
|
written.push(target.path);
|
|
@@ -17712,7 +18167,7 @@ function bootstrap(dir) {
|
|
|
17712
18167
|
writeFile(join(full, ".gitkeep"), "");
|
|
17713
18168
|
createdDirs.push(`${d}/`);
|
|
17714
18169
|
}
|
|
17715
|
-
return { state, written, skipped, createdDirs };
|
|
18170
|
+
return { state, mode, written, skipped, createdDirs };
|
|
17716
18171
|
}
|
|
17717
18172
|
async function runBootstrap(dir = cwd()) {
|
|
17718
18173
|
intro("kaddo bootstrap");
|
|
@@ -17722,16 +18177,19 @@ async function runBootstrap(dir = cwd()) {
|
|
|
17722
18177
|
process.exit(1);
|
|
17723
18178
|
}
|
|
17724
18179
|
let state = "new";
|
|
18180
|
+
let mode = "standard";
|
|
17725
18181
|
try {
|
|
17726
18182
|
const config = loadConfig(dir);
|
|
17727
18183
|
state = config?.project.state ?? "new";
|
|
18184
|
+
if (config) mode = projectMode(config);
|
|
17728
18185
|
} catch (err) {
|
|
17729
18186
|
console.error(err instanceof ConfigError ? err.message : String(err));
|
|
17730
18187
|
process.exit(1);
|
|
17731
18188
|
}
|
|
17732
18189
|
const stateLabel3 = state === "pre-ai" ? "pre-ai" : state;
|
|
17733
18190
|
log.info(`Project state: ${stateLabel3}`);
|
|
17734
|
-
log.info(`
|
|
18191
|
+
log.info(`Project mode: ${mode}`);
|
|
18192
|
+
log.info(`Creating ${mode === "poc" ? "POC" : stateLabel3} knowledge baseline.`);
|
|
17735
18193
|
log.info("Existing files will not be overwritten.");
|
|
17736
18194
|
const result = bootstrap(dir);
|
|
17737
18195
|
console.log("");
|
|
@@ -17751,7 +18209,7 @@ async function runBootstrap(dir = cwd()) {
|
|
|
17751
18209
|
);
|
|
17752
18210
|
printCommandFooter("bootstrap");
|
|
17753
18211
|
outro(
|
|
17754
|
-
`${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.")
|
|
17755
18213
|
);
|
|
17756
18214
|
}
|
|
17757
18215
|
|
|
@@ -17862,7 +18320,7 @@ function runGraphExport(opts = {}) {
|
|
|
17862
18320
|
}
|
|
17863
18321
|
|
|
17864
18322
|
// src/core/system-topology.ts
|
|
17865
|
-
import { parse as parseYaml17, stringify as
|
|
18323
|
+
import { parse as parseYaml17, stringify as stringifyYaml9 } from "yaml";
|
|
17866
18324
|
import fs4 from "fs";
|
|
17867
18325
|
import path8 from "path";
|
|
17868
18326
|
import crypto from "crypto";
|
|
@@ -18027,7 +18485,7 @@ function serializeTopology(entities, relationships) {
|
|
|
18027
18485
|
})),
|
|
18028
18486
|
relationships: relationships.map((r) => ({ from: r.from, to: r.to, type: r.type, ...r.evidence.length ? { evidence: r.evidence } : {} }))
|
|
18029
18487
|
};
|
|
18030
|
-
return
|
|
18488
|
+
return stringifyYaml9(doc);
|
|
18031
18489
|
}
|
|
18032
18490
|
function atomicWrite(filePath, content) {
|
|
18033
18491
|
fs4.mkdirSync(path8.dirname(filePath), { recursive: true });
|
|
@@ -18142,7 +18600,171 @@ async function runTopologyApply(file, opts = {}) {
|
|
|
18142
18600
|
}
|
|
18143
18601
|
}
|
|
18144
18602
|
|
|
18603
|
+
// src/core/resource-write.ts
|
|
18604
|
+
import fs5 from "fs";
|
|
18605
|
+
import path9 from "path";
|
|
18606
|
+
import matter12 from "gray-matter";
|
|
18607
|
+
var RESOURCES_DIR = "knowledge/tech/resources";
|
|
18608
|
+
var ResourceWriteError = class extends Error {
|
|
18609
|
+
constructor(code, message) {
|
|
18610
|
+
super(message);
|
|
18611
|
+
this.code = code;
|
|
18612
|
+
this.name = "ResourceWriteError";
|
|
18613
|
+
}
|
|
18614
|
+
code;
|
|
18615
|
+
};
|
|
18616
|
+
function slug4(s) {
|
|
18617
|
+
return s.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60);
|
|
18618
|
+
}
|
|
18619
|
+
function atomicWrite2(filePath, content) {
|
|
18620
|
+
const tmp = `${filePath}.tmp-${process.pid}-${Date.now()}`;
|
|
18621
|
+
fs5.writeFileSync(tmp, content, "utf-8");
|
|
18622
|
+
fs5.renameSync(tmp, filePath);
|
|
18623
|
+
}
|
|
18624
|
+
function sanitizeRefs(refs) {
|
|
18625
|
+
if (!Array.isArray(refs)) return [];
|
|
18626
|
+
return refs.map((r) => String(r).trim()).filter((r) => r && !r.includes("=") && /^[A-Za-z0-9_.-]+$/.test(r));
|
|
18627
|
+
}
|
|
18628
|
+
function allResourceArtifacts(dir) {
|
|
18629
|
+
return discoverKnowledge(dir).filter((a) => a.type === RESOURCE_ARTIFACT_TYPE);
|
|
18630
|
+
}
|
|
18631
|
+
function nextResourceId(dir, title, explicit) {
|
|
18632
|
+
const existing = new Set(allResourceArtifacts(dir).map((a) => (a.id || "").toUpperCase()));
|
|
18633
|
+
if (explicit && explicit.trim()) return explicit.trim();
|
|
18634
|
+
const base = `RES-${slug4(title) || "resource"}`;
|
|
18635
|
+
if (!existing.has(base.toUpperCase())) return base;
|
|
18636
|
+
for (let i = 2; i < 1e3; i++) {
|
|
18637
|
+
const candidate = `${base}-${i}`;
|
|
18638
|
+
if (!existing.has(candidate.toUpperCase())) return candidate;
|
|
18639
|
+
}
|
|
18640
|
+
throw new ResourceWriteError("ID_EXHAUSTED", `Could not derive a unique id for "${title}".`);
|
|
18641
|
+
}
|
|
18642
|
+
function validateResource(dir, input) {
|
|
18643
|
+
const findings = [];
|
|
18644
|
+
if (input.resourceType && !RESOURCE_TYPES.includes(input.resourceType)) {
|
|
18645
|
+
findings.push({ level: "warning", message: `Unknown resource_type "${input.resourceType}" (not in the known set).` });
|
|
18646
|
+
}
|
|
18647
|
+
for (const i of input.accessInterfaces ?? []) {
|
|
18648
|
+
if (i.type && !INTERFACE_TYPES.includes(i.type)) {
|
|
18649
|
+
findings.push({ level: "warning", message: `Unknown access interface type "${i.type}".` });
|
|
18650
|
+
}
|
|
18651
|
+
}
|
|
18652
|
+
const mapped = loadMappedModules(dir).map((m) => m.id);
|
|
18653
|
+
if (mapped.length > 0) {
|
|
18654
|
+
const refs = /* @__PURE__ */ new Set();
|
|
18655
|
+
if (input.scope?.type === "module" && input.scope.module) refs.add(input.scope.module);
|
|
18656
|
+
for (const m of input.modules ?? []) refs.add(m);
|
|
18657
|
+
for (const m of refs) {
|
|
18658
|
+
if (!mapped.includes(m)) findings.push({ level: "warning", message: `Module "${m}" is not in .kaddo/modules.yml.` });
|
|
18659
|
+
}
|
|
18660
|
+
}
|
|
18661
|
+
if (input.scope && input.scope.type === "module" && !input.scope.module) {
|
|
18662
|
+
findings.push({ level: "error", message: 'scope.type "module" requires a module id.' });
|
|
18663
|
+
}
|
|
18664
|
+
return findings;
|
|
18665
|
+
}
|
|
18666
|
+
function buildFrontmatter(id, input, base = {}) {
|
|
18667
|
+
const data = { ...base };
|
|
18668
|
+
data.type = RESOURCE_ARTIFACT_TYPE;
|
|
18669
|
+
data.id = id;
|
|
18670
|
+
if (input.title != null) data.title = input.title;
|
|
18671
|
+
if (input.resourceType != null) data.resource_type = input.resourceType;
|
|
18672
|
+
if (input.provider != null) data.provider = input.provider;
|
|
18673
|
+
if (input.environments != null) data.environments = input.environments;
|
|
18674
|
+
if (input.scope != null) data.scope = input.scope.module ? { type: input.scope.type, module: input.scope.module } : { type: input.scope.type };
|
|
18675
|
+
if (input.modules != null) data.modules = input.modules;
|
|
18676
|
+
if (input.accessInterfaces != null) data.access_interfaces = input.accessInterfaces;
|
|
18677
|
+
if (input.accessBoundaries != null) data.access_boundaries = input.accessBoundaries;
|
|
18678
|
+
if (input.authentication != null) {
|
|
18679
|
+
const mode = input.authentication.mode;
|
|
18680
|
+
const refs = sanitizeRefs(input.authentication.refs);
|
|
18681
|
+
data.authentication = { ...mode ? { mode } : {}, ...refs.length ? { refs } : {} };
|
|
18682
|
+
}
|
|
18683
|
+
return data;
|
|
18684
|
+
}
|
|
18685
|
+
function serialize(data, body) {
|
|
18686
|
+
return matter12.stringify(`
|
|
18687
|
+
${body.trim()}
|
|
18688
|
+
`, data);
|
|
18689
|
+
}
|
|
18690
|
+
function createResource(dir, input) {
|
|
18691
|
+
const title = (input.title ?? "").trim();
|
|
18692
|
+
if (!title) throw new ResourceWriteError("INVALID_INPUT", "A resource title is required.");
|
|
18693
|
+
const resourceType = (input.resourceType ?? "").trim();
|
|
18694
|
+
if (!resourceType) throw new ResourceWriteError("INVALID_INPUT", "A resource_type is required.");
|
|
18695
|
+
const findings = validateResource(dir, input);
|
|
18696
|
+
if (findings.some((f) => f.level === "error")) {
|
|
18697
|
+
throw new ResourceWriteError("VALIDATION_FAILED", findings.filter((f) => f.level === "error").map((f) => f.message).join("; "));
|
|
18698
|
+
}
|
|
18699
|
+
const existing = allResourceArtifacts(dir);
|
|
18700
|
+
if (input.id && existing.some((a) => (a.id || "").toUpperCase() === input.id.toUpperCase())) {
|
|
18701
|
+
throw new ResourceWriteError("DUPLICATE", `A resource with id "${input.id}" already exists.`);
|
|
18702
|
+
}
|
|
18703
|
+
if (existing.some((a) => (a.title || "").toLowerCase() === title.toLowerCase())) {
|
|
18704
|
+
throw new ResourceWriteError("DUPLICATE", `A resource titled "${title}" already exists.`);
|
|
18705
|
+
}
|
|
18706
|
+
const id = nextResourceId(dir, title, input.id);
|
|
18707
|
+
const data = buildFrontmatter(id, input);
|
|
18708
|
+
const body = `# Purpose
|
|
18709
|
+
|
|
18710
|
+
${(input.purpose ?? "").trim() || "TODO: describe what this resource is for."}`;
|
|
18711
|
+
const relPath = `${RESOURCES_DIR}/${slug4(title) || slug4(id)}.md`;
|
|
18712
|
+
const filePath = join(dir, relPath);
|
|
18713
|
+
if (exists(filePath)) throw new ResourceWriteError("DUPLICATE", `Resource file already exists: ${relPath}`);
|
|
18714
|
+
ensureDir(path9.dirname(filePath));
|
|
18715
|
+
atomicWrite2(filePath, serialize(data, body));
|
|
18716
|
+
return { id, path: relPath, findings };
|
|
18717
|
+
}
|
|
18718
|
+
function updateResource(dir, id, input) {
|
|
18719
|
+
const match = allResourceArtifacts(dir).find((a) => a.id === id || a.title === id);
|
|
18720
|
+
if (!match) throw new ResourceWriteError("NOT_FOUND", `Project Resource "${id}" not found.`);
|
|
18721
|
+
const findings = validateResource(dir, input);
|
|
18722
|
+
if (findings.some((f) => f.level === "error")) {
|
|
18723
|
+
throw new ResourceWriteError("VALIDATION_FAILED", findings.filter((f) => f.level === "error").map((f) => f.message).join("; "));
|
|
18724
|
+
}
|
|
18725
|
+
const raw = readFile(match.filePath);
|
|
18726
|
+
const parsed = matter12(raw);
|
|
18727
|
+
const base = parsed.data ?? {};
|
|
18728
|
+
const data = buildFrontmatter(match.id || id, input, base);
|
|
18729
|
+
let body = parsed.content.trim();
|
|
18730
|
+
if (input.purpose != null) {
|
|
18731
|
+
const purpose = `# Purpose
|
|
18732
|
+
|
|
18733
|
+
${input.purpose.trim()}`;
|
|
18734
|
+
body = /^#\s+Purpose/m.test(body) ? body.replace(/#\s+Purpose[\s\S]*?(?=\n#\s|\n*$)/, purpose + "\n") : `${purpose}
|
|
18735
|
+
|
|
18736
|
+
${body}`.trim();
|
|
18737
|
+
}
|
|
18738
|
+
atomicWrite2(match.filePath, serialize(data, body));
|
|
18739
|
+
return { id: match.id || id, path: match.relPath, findings };
|
|
18740
|
+
}
|
|
18741
|
+
function getResourceReferences(dir, id) {
|
|
18742
|
+
const refs = [];
|
|
18743
|
+
for (const wi of discoverWorkItems(dir)) {
|
|
18744
|
+
for (const rel of parseWorkItemResources(wi.rawFrontmatter)) {
|
|
18745
|
+
if (rel.id === id) refs.push({ kind: "work-item", id: wi.id || wi.title, role: rel.role, path: wi.relPath });
|
|
18746
|
+
}
|
|
18747
|
+
}
|
|
18748
|
+
return refs;
|
|
18749
|
+
}
|
|
18750
|
+
function deleteResource(dir, id, opts = {}) {
|
|
18751
|
+
const match = allResourceArtifacts(dir).find((a) => a.id === id || a.title === id);
|
|
18752
|
+
if (!match) throw new ResourceWriteError("NOT_FOUND", `Project Resource "${id}" not found.`);
|
|
18753
|
+
const references = getResourceReferences(dir, match.id || id);
|
|
18754
|
+
if (!opts.confirm) {
|
|
18755
|
+
return { deleted: false, preview: { id: match.id || id, references } };
|
|
18756
|
+
}
|
|
18757
|
+
fs5.rmSync(match.filePath, { force: true });
|
|
18758
|
+
return { deleted: true, path: match.relPath };
|
|
18759
|
+
}
|
|
18760
|
+
|
|
18145
18761
|
// src/commands/resources.ts
|
|
18762
|
+
function printFindings2(findings) {
|
|
18763
|
+
for (const f of findings) {
|
|
18764
|
+
if (f.level === "error") log.error(f.message);
|
|
18765
|
+
else log.warn(f.message);
|
|
18766
|
+
}
|
|
18767
|
+
}
|
|
18146
18768
|
function runResourcesList(dir = cwd(), opts = {}) {
|
|
18147
18769
|
const resources = getResources(dir);
|
|
18148
18770
|
if (opts.json) {
|
|
@@ -18219,16 +18841,131 @@ function runResourcesGet(id, dir = cwd(), opts = {}) {
|
|
|
18219
18841
|
}
|
|
18220
18842
|
console.log("");
|
|
18221
18843
|
}
|
|
18844
|
+
async function runResourcesCreate(opts = {}, dir = cwd()) {
|
|
18845
|
+
let title = opts.title?.trim();
|
|
18846
|
+
let type = opts.type?.trim();
|
|
18847
|
+
let provider = opts.provider?.trim();
|
|
18848
|
+
let scopeType = opts.scope?.trim() || (opts.module ? "module" : "system");
|
|
18849
|
+
let moduleId = opts.module?.trim();
|
|
18850
|
+
const interactive = !opts.json && process.stdin.isTTY && (!title || !type);
|
|
18851
|
+
if (interactive) {
|
|
18852
|
+
intro("kaddo resources create");
|
|
18853
|
+
if (!title) title = (await text({ message: "Resource name", placeholder: "Supabase Main" })).trim();
|
|
18854
|
+
if (!type) type = await select({
|
|
18855
|
+
message: "Resource type",
|
|
18856
|
+
options: ["database", "cloud", "api", "queue", "storage", "repository", "platform", "service", "other"].map((v) => ({ value: v, label: v }))
|
|
18857
|
+
});
|
|
18858
|
+
if (!provider) provider = (await text({ message: "Provider (optional)", placeholder: "supabase", defaultValue: "" })).trim() || void 0;
|
|
18859
|
+
scopeType = await select({ message: "Scope", options: [{ value: "system", label: "system" }, { value: "module", label: "module" }] });
|
|
18860
|
+
if (scopeType === "module") moduleId = (await text({ message: "Module id", placeholder: "orders-api" })).trim();
|
|
18861
|
+
}
|
|
18862
|
+
if (!title || !type) {
|
|
18863
|
+
console.error("A resource title and type are required. Use --title and --type (or run interactively).");
|
|
18864
|
+
process.exit(1);
|
|
18865
|
+
}
|
|
18866
|
+
const input = { title, resourceType: type };
|
|
18867
|
+
if (provider) input.provider = provider;
|
|
18868
|
+
input.scope = scopeType === "module" ? { type: "module", module: moduleId } : { type: "system" };
|
|
18869
|
+
try {
|
|
18870
|
+
const res = createResource(dir, input);
|
|
18871
|
+
if (opts.json) {
|
|
18872
|
+
console.log(JSON.stringify(res, null, 2));
|
|
18873
|
+
return;
|
|
18874
|
+
}
|
|
18875
|
+
printFindings2(res.findings);
|
|
18876
|
+
log.success(`Created ${res.id}`);
|
|
18877
|
+
if (interactive) outro(`Resource created at ${res.path}. Enrich it with \`kaddo resources update ${res.id}\`.`);
|
|
18878
|
+
else {
|
|
18879
|
+
console.log(` ${res.path}`);
|
|
18880
|
+
console.log(` Enrich it later with: kaddo resources update ${res.id}`);
|
|
18881
|
+
}
|
|
18882
|
+
} catch (err) {
|
|
18883
|
+
console.error(err instanceof ResourceWriteError ? err.message : String(err));
|
|
18884
|
+
process.exit(1);
|
|
18885
|
+
}
|
|
18886
|
+
}
|
|
18887
|
+
function runResourcesUpdate(id, opts = {}, dir = cwd()) {
|
|
18888
|
+
const input = {};
|
|
18889
|
+
if (opts.title != null) input.title = opts.title;
|
|
18890
|
+
if (opts.type != null) input.resourceType = opts.type;
|
|
18891
|
+
if (opts.provider != null) input.provider = opts.provider;
|
|
18892
|
+
if (opts.purpose != null) input.purpose = opts.purpose;
|
|
18893
|
+
if (opts.scope != null || opts.module != null) {
|
|
18894
|
+
const scopeType = opts.scope || (opts.module ? "module" : "system");
|
|
18895
|
+
input.scope = scopeType === "module" ? { type: "module", module: opts.module } : { type: "system" };
|
|
18896
|
+
}
|
|
18897
|
+
if (Object.keys(input).length === 0) {
|
|
18898
|
+
console.error("Nothing to update. Pass at least one field (e.g. --provider, --purpose, --module).");
|
|
18899
|
+
process.exit(1);
|
|
18900
|
+
}
|
|
18901
|
+
try {
|
|
18902
|
+
const res = updateResource(dir, id, input);
|
|
18903
|
+
if (opts.json) {
|
|
18904
|
+
console.log(JSON.stringify(res, null, 2));
|
|
18905
|
+
return;
|
|
18906
|
+
}
|
|
18907
|
+
printFindings2(res.findings);
|
|
18908
|
+
console.log(`Updated ${res.id} (${res.path}).`);
|
|
18909
|
+
} catch (err) {
|
|
18910
|
+
console.error(err instanceof ResourceWriteError ? err.message : String(err));
|
|
18911
|
+
process.exit(1);
|
|
18912
|
+
}
|
|
18913
|
+
}
|
|
18914
|
+
async function runResourcesDelete(id, opts = {}, dir = cwd()) {
|
|
18915
|
+
let preview;
|
|
18916
|
+
try {
|
|
18917
|
+
preview = deleteResource(dir, id);
|
|
18918
|
+
} catch (err) {
|
|
18919
|
+
console.error(err instanceof ResourceWriteError ? err.message : String(err));
|
|
18920
|
+
process.exit(1);
|
|
18921
|
+
}
|
|
18922
|
+
const refs = preview.preview?.references ?? [];
|
|
18923
|
+
if (opts.json && !opts.yes) {
|
|
18924
|
+
console.log(JSON.stringify(preview.preview, null, 2));
|
|
18925
|
+
return;
|
|
18926
|
+
}
|
|
18927
|
+
if (refs.length > 0) {
|
|
18928
|
+
console.log("");
|
|
18929
|
+
console.log(`Resource "${id}" is referenced by:`);
|
|
18930
|
+
for (const r of refs) console.log(` - ${r.id} (${r.kind}, role: ${r.role})`);
|
|
18931
|
+
console.log("");
|
|
18932
|
+
console.log("Deleting the resource will NOT remove these references.");
|
|
18933
|
+
}
|
|
18934
|
+
let proceed = opts.yes === true;
|
|
18935
|
+
if (!proceed) {
|
|
18936
|
+
if (process.stdin.isTTY) {
|
|
18937
|
+
proceed = await confirm({ message: `Delete resource "${id}"?`, initialValue: false });
|
|
18938
|
+
} else {
|
|
18939
|
+
console.error(`Refusing to delete without confirmation. Re-run with --yes to delete "${id}".`);
|
|
18940
|
+
process.exit(1);
|
|
18941
|
+
}
|
|
18942
|
+
}
|
|
18943
|
+
if (!proceed) {
|
|
18944
|
+
console.log("Aborted.");
|
|
18945
|
+
return;
|
|
18946
|
+
}
|
|
18947
|
+
try {
|
|
18948
|
+
const done = deleteResource(dir, id, { confirm: true });
|
|
18949
|
+
if (opts.json) {
|
|
18950
|
+
console.log(JSON.stringify(done, null, 2));
|
|
18951
|
+
return;
|
|
18952
|
+
}
|
|
18953
|
+
log.success(`Deleted ${id} (${done.path}).`);
|
|
18954
|
+
} catch (err) {
|
|
18955
|
+
console.error(err instanceof ResourceWriteError ? err.message : String(err));
|
|
18956
|
+
process.exit(1);
|
|
18957
|
+
}
|
|
18958
|
+
}
|
|
18222
18959
|
|
|
18223
18960
|
// src/services/integrations.ts
|
|
18224
|
-
import
|
|
18225
|
-
import { parse as parseYaml18, stringify as
|
|
18961
|
+
import matter14 from "gray-matter";
|
|
18962
|
+
import { parse as parseYaml18, stringify as stringifyYaml10 } from "yaml";
|
|
18226
18963
|
|
|
18227
18964
|
// src/core/work-item-write.ts
|
|
18228
|
-
import
|
|
18229
|
-
import
|
|
18965
|
+
import fs6 from "fs";
|
|
18966
|
+
import path10 from "path";
|
|
18230
18967
|
import crypto2 from "crypto";
|
|
18231
|
-
import
|
|
18968
|
+
import matter13 from "gray-matter";
|
|
18232
18969
|
var WORK_ITEMS_DIR3 = "knowledge/delivery/work-items";
|
|
18233
18970
|
var WorkItemWriteError = class extends Error {
|
|
18234
18971
|
constructor(code, message) {
|
|
@@ -18249,7 +18986,7 @@ function nextWorkItemId2(dir) {
|
|
|
18249
18986
|
let max = 0;
|
|
18250
18987
|
const walk = (d) => {
|
|
18251
18988
|
if (!exists(d)) return;
|
|
18252
|
-
for (const entry of
|
|
18989
|
+
for (const entry of fs6.readdirSync(d)) {
|
|
18253
18990
|
const full = join(d, entry);
|
|
18254
18991
|
if (isFile(full)) {
|
|
18255
18992
|
const m = entry.match(/WI-(\d+)/);
|
|
@@ -18262,15 +18999,15 @@ function nextWorkItemId2(dir) {
|
|
|
18262
18999
|
walk(wiDir);
|
|
18263
19000
|
return `WI-${String(max + 1).padStart(3, "0")}`;
|
|
18264
19001
|
}
|
|
18265
|
-
function
|
|
18266
|
-
|
|
19002
|
+
function atomicWrite3(filePath, content) {
|
|
19003
|
+
fs6.mkdirSync(path10.dirname(filePath), { recursive: true });
|
|
18267
19004
|
const tmp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
18268
|
-
|
|
19005
|
+
fs6.writeFileSync(tmp, content, "utf-8");
|
|
18269
19006
|
try {
|
|
18270
|
-
|
|
19007
|
+
fs6.renameSync(tmp, filePath);
|
|
18271
19008
|
} catch (err) {
|
|
18272
19009
|
try {
|
|
18273
|
-
|
|
19010
|
+
fs6.rmSync(tmp, { force: true });
|
|
18274
19011
|
} catch {
|
|
18275
19012
|
}
|
|
18276
19013
|
throw err;
|
|
@@ -18331,8 +19068,8 @@ function ensureH1(body, title) {
|
|
|
18331
19068
|
|
|
18332
19069
|
${trimmed}`;
|
|
18333
19070
|
}
|
|
18334
|
-
function
|
|
18335
|
-
return
|
|
19071
|
+
function serialize2(data, body) {
|
|
19072
|
+
return matter13.stringify(`
|
|
18336
19073
|
${body.trim()}
|
|
18337
19074
|
`, data);
|
|
18338
19075
|
}
|
|
@@ -18400,8 +19137,8 @@ function createWorkItem(dir, opts) {
|
|
|
18400
19137
|
const relPath = `${WORK_ITEMS_DIR3}/draft/${id}-${slugify5(title)}.md`;
|
|
18401
19138
|
const filePath = join(dir, relPath);
|
|
18402
19139
|
if (exists(filePath)) throw new WorkItemWriteError("INVALID_INPUT", `Work Item file already exists: ${relPath}`);
|
|
18403
|
-
const raw =
|
|
18404
|
-
|
|
19140
|
+
const raw = serialize2(data, body);
|
|
19141
|
+
atomicWrite3(filePath, raw);
|
|
18405
19142
|
return { id, path: relPath, revision: revisionOf(raw) };
|
|
18406
19143
|
}
|
|
18407
19144
|
|
|
@@ -19089,8 +19826,8 @@ async function handleJiraResponse(res) {
|
|
|
19089
19826
|
}
|
|
19090
19827
|
return await res.json();
|
|
19091
19828
|
}
|
|
19092
|
-
async function jiraFetch(baseUrl,
|
|
19093
|
-
const url = new URL(
|
|
19829
|
+
async function jiraFetch(baseUrl, path13, auth, timeoutMs, params) {
|
|
19830
|
+
const url = new URL(path13, baseUrl + "/");
|
|
19094
19831
|
if (params) for (const [k, v] of Object.entries(params)) url.searchParams.set(k, v);
|
|
19095
19832
|
const controller = new AbortController();
|
|
19096
19833
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
@@ -19108,8 +19845,8 @@ async function jiraFetch(baseUrl, path12, auth, timeoutMs, params) {
|
|
|
19108
19845
|
clearTimeout(timer);
|
|
19109
19846
|
}
|
|
19110
19847
|
}
|
|
19111
|
-
async function jiraPost(baseUrl,
|
|
19112
|
-
const url = new URL(
|
|
19848
|
+
async function jiraPost(baseUrl, path13, auth, timeoutMs, body) {
|
|
19849
|
+
const url = new URL(path13, baseUrl + "/");
|
|
19113
19850
|
const controller = new AbortController();
|
|
19114
19851
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
19115
19852
|
try {
|
|
@@ -19409,7 +20146,7 @@ function findLinkedWorkItem(dir, integrationId, externalId) {
|
|
|
19409
20146
|
for (const art of discoverWorkItems(dir)) {
|
|
19410
20147
|
let data;
|
|
19411
20148
|
try {
|
|
19412
|
-
data =
|
|
20149
|
+
data = matter14(readFile(art.filePath)).data;
|
|
19413
20150
|
} catch {
|
|
19414
20151
|
continue;
|
|
19415
20152
|
}
|
|
@@ -19622,7 +20359,7 @@ async function runIntegrationsImport(dir, id, externalId, opts) {
|
|
|
19622
20359
|
}
|
|
19623
20360
|
|
|
19624
20361
|
// src/core/impact-report.ts
|
|
19625
|
-
import
|
|
20362
|
+
import matter15 from "gray-matter";
|
|
19626
20363
|
function isBroadGlob(glob) {
|
|
19627
20364
|
if (!glob.endsWith("/**")) return false;
|
|
19628
20365
|
const prefix = glob.slice(0, -3);
|
|
@@ -19691,7 +20428,7 @@ function buildImpactReport(dir, opts = {}, now = /* @__PURE__ */ new Date()) {
|
|
|
19691
20428
|
}
|
|
19692
20429
|
}
|
|
19693
20430
|
try {
|
|
19694
|
-
const body =
|
|
20431
|
+
const body = matter15(readFile(wi.filePath)).content;
|
|
19695
20432
|
if (hasSection(body, /acceptance|criterios de aceptaci/i)) withAcceptance++;
|
|
19696
20433
|
else gaps.missing_acceptance_criteria.push(gapItem(wi, "Add an `## Acceptance Criteria` section."));
|
|
19697
20434
|
if (hasSection(body, /definition of done|^#{1,6}\s*dod\b|definici[oó]n de (terminado|hecho)/i)) withDoD++;
|
|
@@ -20768,7 +21505,7 @@ function runAdr(opts = {}) {
|
|
|
20768
21505
|
}
|
|
20769
21506
|
|
|
20770
21507
|
// src/commands/tech.ts
|
|
20771
|
-
import
|
|
21508
|
+
import fs7 from "fs";
|
|
20772
21509
|
var DISCOVERY_FILES = ["architecture-notes.md", "decision-candidates.md"];
|
|
20773
21510
|
var DISCOVERY_DIR = "knowledge/tech/discovery";
|
|
20774
21511
|
function runTechOrganize(dir = cwd()) {
|
|
@@ -20785,7 +21522,7 @@ function runTechOrganize(dir = cwd()) {
|
|
|
20785
21522
|
continue;
|
|
20786
21523
|
}
|
|
20787
21524
|
ensureDir(join(dir, DISCOVERY_DIR));
|
|
20788
|
-
|
|
21525
|
+
fs7.renameSync(from, to);
|
|
20789
21526
|
moved.push(`knowledge/tech/${file} \u2192 ${DISCOVERY_DIR}/${file}`);
|
|
20790
21527
|
}
|
|
20791
21528
|
if (moved.length > 0) {
|
|
@@ -20867,9 +21604,9 @@ function runAssetsUpdate(kind, opts = {}) {
|
|
|
20867
21604
|
}
|
|
20868
21605
|
|
|
20869
21606
|
// src/commands/ready.ts
|
|
20870
|
-
import
|
|
20871
|
-
import
|
|
20872
|
-
import
|
|
21607
|
+
import fs8 from "fs";
|
|
21608
|
+
import path11 from "path";
|
|
21609
|
+
import matter16 from "gray-matter";
|
|
20873
21610
|
function validateReadiness(content, frontmatter) {
|
|
20874
21611
|
const warnings = [];
|
|
20875
21612
|
const body = content.replace(/^---[\s\S]*?---/, "").trim();
|
|
@@ -20923,18 +21660,18 @@ function isResolvedSection(text2) {
|
|
|
20923
21660
|
}
|
|
20924
21661
|
function transitionToReady(filePath) {
|
|
20925
21662
|
const raw = readFile(filePath);
|
|
20926
|
-
const { data, content } =
|
|
21663
|
+
const { data, content } = matter16(raw);
|
|
20927
21664
|
const today3 = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
20928
21665
|
data.status = "ready";
|
|
20929
21666
|
data.ready_at = today3;
|
|
20930
|
-
const newContent =
|
|
21667
|
+
const newContent = matter16.stringify(content, data);
|
|
20931
21668
|
const posix = filePath.replace(/\\/g, "/");
|
|
20932
21669
|
let newPath = filePath;
|
|
20933
21670
|
if (posix.includes("/work-items/draft/")) {
|
|
20934
|
-
const readyDir =
|
|
21671
|
+
const readyDir = path11.dirname(filePath).replace(/[/\\]draft$/, path11.sep + "ready");
|
|
20935
21672
|
ensureDir(readyDir);
|
|
20936
|
-
const fileName =
|
|
20937
|
-
newPath =
|
|
21673
|
+
const fileName = path11.basename(filePath);
|
|
21674
|
+
newPath = path11.join(readyDir, fileName);
|
|
20938
21675
|
}
|
|
20939
21676
|
return { newPath, newContent };
|
|
20940
21677
|
}
|
|
@@ -20967,7 +21704,7 @@ async function runReady(id, opts = {}) {
|
|
|
20967
21704
|
process.exit(1);
|
|
20968
21705
|
}
|
|
20969
21706
|
const raw = readFile(wi.filePath);
|
|
20970
|
-
const { data } =
|
|
21707
|
+
const { data } = matter16(raw);
|
|
20971
21708
|
const source = parseWorkItemSource(data);
|
|
20972
21709
|
const warnings = validateReadiness(raw, data);
|
|
20973
21710
|
log.info(`Work Item found:`);
|
|
@@ -21002,11 +21739,11 @@ async function runReady(id, opts = {}) {
|
|
|
21002
21739
|
const { newPath, newContent } = transitionToReady(wi.filePath);
|
|
21003
21740
|
if (newPath !== wi.filePath) {
|
|
21004
21741
|
writeFile(newPath, newContent);
|
|
21005
|
-
|
|
21742
|
+
fs8.unlinkSync(wi.filePath);
|
|
21006
21743
|
log.success(`Updated status: ready`);
|
|
21007
21744
|
log.success(`Moved file:`);
|
|
21008
|
-
log.info(` ${
|
|
21009
|
-
log.info(` \u2192 ${
|
|
21745
|
+
log.info(` ${path11.relative(dir, wi.filePath)}`);
|
|
21746
|
+
log.info(` \u2192 ${path11.relative(dir, newPath)}`);
|
|
21010
21747
|
} else {
|
|
21011
21748
|
writeFile(wi.filePath, newContent);
|
|
21012
21749
|
log.success(`Updated status: ready`);
|
|
@@ -21017,7 +21754,7 @@ async function runReady(id, opts = {}) {
|
|
|
21017
21754
|
}
|
|
21018
21755
|
|
|
21019
21756
|
// src/commands/admin.ts
|
|
21020
|
-
import
|
|
21757
|
+
import path12 from "path";
|
|
21021
21758
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
21022
21759
|
import net from "net";
|
|
21023
21760
|
function isPortAvailable(port, host) {
|
|
@@ -21032,17 +21769,17 @@ function isPortAvailable(port, host) {
|
|
|
21032
21769
|
});
|
|
21033
21770
|
}
|
|
21034
21771
|
function resolveStaticDir() {
|
|
21035
|
-
const __dirname =
|
|
21772
|
+
const __dirname = path12.dirname(fileURLToPath2(import.meta.url));
|
|
21036
21773
|
const candidates = [
|
|
21037
21774
|
// Monorepo development: prefer the freshly built admin over the copy bundled into the CLI dist.
|
|
21038
21775
|
// The CLI build copies admin/dist into dist/admin-dist, but that copy can be stale when the admin
|
|
21039
21776
|
// was rebuilt after the CLI (build order is not guaranteed in `pnpm -r build`). Serving the admin
|
|
21040
21777
|
// package's own dist first ensures `kaddo admin` always shows the current frontend in dev. This
|
|
21041
21778
|
// path does not exist in a published npm install (admin is private), so it falls back below.
|
|
21042
|
-
|
|
21043
|
-
|
|
21779
|
+
path12.resolve(__dirname, "..", "..", "admin", "dist"),
|
|
21780
|
+
path12.resolve(__dirname, "..", "node_modules", "@kaddo", "admin", "dist"),
|
|
21044
21781
|
// Bundled inside CLI dist (npm install)
|
|
21045
|
-
|
|
21782
|
+
path12.resolve(__dirname, "admin-dist")
|
|
21046
21783
|
];
|
|
21047
21784
|
for (const c of candidates) {
|
|
21048
21785
|
if (exists(join(c, "index.html"))) return c;
|
|
@@ -21084,8 +21821,8 @@ async function runAdmin(opts = {}) {
|
|
|
21084
21821
|
}
|
|
21085
21822
|
let adminServer;
|
|
21086
21823
|
try {
|
|
21087
|
-
const __dirname =
|
|
21088
|
-
const bundled =
|
|
21824
|
+
const __dirname = path12.dirname(fileURLToPath2(import.meta.url));
|
|
21825
|
+
const bundled = path12.resolve(__dirname, "admin-server", "index.js");
|
|
21089
21826
|
if (exists(bundled)) {
|
|
21090
21827
|
const { pathToFileURL } = await import("url");
|
|
21091
21828
|
adminServer = await import(pathToFileURL(bundled).href);
|
|
@@ -21142,11 +21879,11 @@ async function runAdmin(opts = {}) {
|
|
|
21142
21879
|
|
|
21143
21880
|
// src/core/work-item-import.ts
|
|
21144
21881
|
import crypto3 from "crypto";
|
|
21145
|
-
import
|
|
21146
|
-
import
|
|
21882
|
+
import fs9 from "fs";
|
|
21883
|
+
import matter18 from "gray-matter";
|
|
21147
21884
|
|
|
21148
21885
|
// src/core/work-items.ts
|
|
21149
|
-
import
|
|
21886
|
+
import matter17 from "gray-matter";
|
|
21150
21887
|
function computeRefinementStatus(wi) {
|
|
21151
21888
|
const aspects = {
|
|
21152
21889
|
outcome: Boolean(wi.currentBehavior?.trim() || wi.targetBehavior?.trim()),
|
|
@@ -21224,8 +21961,8 @@ function parseGraphReason(v) {
|
|
|
21224
21961
|
if (!v || typeof v !== "object") return null;
|
|
21225
21962
|
const o = v;
|
|
21226
21963
|
const relationship = typeof o.relationship === "string" && o.relationship.trim() ? o.relationship.trim() : null;
|
|
21227
|
-
const
|
|
21228
|
-
return relationship ||
|
|
21964
|
+
const path13 = Array.isArray(o.path) ? o.path.map(String).filter(Boolean) : [];
|
|
21965
|
+
return relationship || path13.length ? { relationship, path: path13 } : null;
|
|
21229
21966
|
}
|
|
21230
21967
|
function parseExplain(o) {
|
|
21231
21968
|
const refs = Array.isArray(o.evidence) ? o.evidence : Array.isArray(o.evidence_refs) ? o.evidence_refs : [];
|
|
@@ -21280,7 +22017,7 @@ function parseOriginalSnapshot(fm2) {
|
|
|
21280
22017
|
function readBody(filePath) {
|
|
21281
22018
|
try {
|
|
21282
22019
|
const raw = readFile(filePath);
|
|
21283
|
-
return
|
|
22020
|
+
return matter17(raw).content;
|
|
21284
22021
|
} catch {
|
|
21285
22022
|
return "";
|
|
21286
22023
|
}
|
|
@@ -21739,7 +22476,7 @@ function detectFormat(raw) {
|
|
|
21739
22476
|
if (!trimmed) throw new ImportError("EMPTY_INPUT", "Import content is empty.");
|
|
21740
22477
|
if (trimmed.startsWith("---")) {
|
|
21741
22478
|
try {
|
|
21742
|
-
const { data } =
|
|
22479
|
+
const { data } = matter18(trimmed);
|
|
21743
22480
|
if (data && typeof data === "object" && Object.keys(data).length > 0) {
|
|
21744
22481
|
const d = data;
|
|
21745
22482
|
if (d.type === "work-item" || d.id && typeof d.id === "string" && /^WI-\d+/.test(d.id)) {
|
|
@@ -21761,7 +22498,7 @@ function parseContent(raw) {
|
|
|
21761
22498
|
let bodyText = trimmed;
|
|
21762
22499
|
if (format === "kaddo-frontmatter" || format === "markdown-frontmatter") {
|
|
21763
22500
|
try {
|
|
21764
|
-
const parsed =
|
|
22501
|
+
const parsed = matter18(trimmed);
|
|
21765
22502
|
frontmatterFields = parsed.data ?? {};
|
|
21766
22503
|
bodyText = parsed.content.trim();
|
|
21767
22504
|
} catch {
|
|
@@ -21858,7 +22595,7 @@ function findDuplicateByHash(dir, hash) {
|
|
|
21858
22595
|
const raw = readFile(item.filePath);
|
|
21859
22596
|
if (!raw) continue;
|
|
21860
22597
|
try {
|
|
21861
|
-
const { data } =
|
|
22598
|
+
const { data } = matter18(raw);
|
|
21862
22599
|
const source = data?.source;
|
|
21863
22600
|
if (source && typeof source === "object" && !Array.isArray(source)) {
|
|
21864
22601
|
const s = source;
|
|
@@ -21925,7 +22662,7 @@ function importWorkItem(dir, opts) {
|
|
|
21925
22662
|
};
|
|
21926
22663
|
}
|
|
21927
22664
|
if (opts.onConflict === "replace") {
|
|
21928
|
-
|
|
22665
|
+
fs9.rmSync(existing.filePath, { force: true });
|
|
21929
22666
|
replacedWorkItem = existing.workItemId;
|
|
21930
22667
|
}
|
|
21931
22668
|
}
|
|
@@ -22074,7 +22811,7 @@ async function runWorkItemImport(dir, fileOrText, opts) {
|
|
|
22074
22811
|
}
|
|
22075
22812
|
|
|
22076
22813
|
// src/commands/verify.ts
|
|
22077
|
-
import
|
|
22814
|
+
import matter19 from "gray-matter";
|
|
22078
22815
|
|
|
22079
22816
|
// src/core/implementation-evidence.ts
|
|
22080
22817
|
var WorkItemNotInProgressError = class extends Error {
|
|
@@ -22351,7 +23088,7 @@ async function runVerify(workItemId, opts = {}) {
|
|
|
22351
23088
|
}
|
|
22352
23089
|
const changedPaths = await getModifiedFiles("head");
|
|
22353
23090
|
const raw = readFile(match.filePath);
|
|
22354
|
-
const parsed =
|
|
23091
|
+
const parsed = matter19(raw);
|
|
22355
23092
|
const fm2 = parsed.data;
|
|
22356
23093
|
const acs = extractACsFromBody(parsed.content);
|
|
22357
23094
|
const existingEvidence = fm2.implementation_evidence;
|
|
@@ -22468,13 +23205,13 @@ async function runVerify(workItemId, opts = {}) {
|
|
|
22468
23205
|
if (shouldPersist) {
|
|
22469
23206
|
const filePath = match.filePath;
|
|
22470
23207
|
const wiRaw = readFile(filePath);
|
|
22471
|
-
const wiParsed =
|
|
23208
|
+
const wiParsed = matter19(wiRaw);
|
|
22472
23209
|
const data = wiParsed.data;
|
|
22473
23210
|
data.implementation_evidence = verification.implementationEvidence;
|
|
22474
23211
|
data.implementation_status = verification.implementationStatus;
|
|
22475
23212
|
data.validation_status = verification.validationStatus;
|
|
22476
23213
|
data.verified_at = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
22477
|
-
const newRaw =
|
|
23214
|
+
const newRaw = matter19.stringify(wiParsed.content, data);
|
|
22478
23215
|
writeFile(filePath, newRaw);
|
|
22479
23216
|
log.success("Work Item frontmatter updated with verification evidence.");
|
|
22480
23217
|
}
|
|
@@ -22524,9 +23261,9 @@ function markRegistered(dir, identity) {
|
|
|
22524
23261
|
ensureDir(join(dir, TELEMETRY_DIR));
|
|
22525
23262
|
writeFile(identityPath(dir), JSON.stringify(identity, null, 2));
|
|
22526
23263
|
}
|
|
22527
|
-
function signPayload(identity, method,
|
|
23264
|
+
function signPayload(identity, method, path13, timestamp, nonce, bodySha256) {
|
|
22528
23265
|
const canonical = `${method}
|
|
22529
|
-
${
|
|
23266
|
+
${path13}
|
|
22530
23267
|
${identity.installationId}
|
|
22531
23268
|
${timestamp}
|
|
22532
23269
|
${nonce}
|
|
@@ -22752,7 +23489,7 @@ function runTelemetryDisable() {
|
|
|
22752
23489
|
}
|
|
22753
23490
|
|
|
22754
23491
|
// src/core/initiative-write.ts
|
|
22755
|
-
import
|
|
23492
|
+
import matter20 from "gray-matter";
|
|
22756
23493
|
var WORK_ITEMS_DIR4 = "knowledge/delivery/work-items";
|
|
22757
23494
|
var DRAFT_DIR2 = `${WORK_ITEMS_DIR4}/draft`;
|
|
22758
23495
|
var InitiativeWriteError = class extends Error {
|
|
@@ -22864,7 +23601,7 @@ function buildInitiativeContent(id, input) {
|
|
|
22864
23601
|
if (input.priority) data.priority = input.priority;
|
|
22865
23602
|
if (input.source) data.source = input.source;
|
|
22866
23603
|
if (input.sourceId) data.source_id = input.sourceId;
|
|
22867
|
-
return
|
|
23604
|
+
return matter20.stringify("\n" + (input.body ?? defaultBody(input.title.trim())), data);
|
|
22868
23605
|
}
|
|
22869
23606
|
function createInitiative(dir, input) {
|
|
22870
23607
|
if (!input.title?.trim()) throw new InitiativeWriteError("Initiative title is required.");
|
|
@@ -22888,10 +23625,10 @@ function transitionInitiative(dir, id, to) {
|
|
|
22888
23625
|
throw new InitiativeWriteError(`Invalid transition ${ini.status} \u2192 ${to}.`);
|
|
22889
23626
|
}
|
|
22890
23627
|
const raw = readFile(ini.filePath);
|
|
22891
|
-
const { data, content } =
|
|
23628
|
+
const { data, content } = matter20(raw, {});
|
|
22892
23629
|
data.status = to;
|
|
22893
23630
|
if (to === "completed") data.completed_at = today2();
|
|
22894
|
-
const newContent =
|
|
23631
|
+
const newContent = matter20.stringify(content, data);
|
|
22895
23632
|
writeFile(ini.filePath, newContent);
|
|
22896
23633
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
22897
23634
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after transition.");
|
|
@@ -22960,7 +23697,7 @@ function buildWorkItemContent(wiId, iniId, candidate) {
|
|
|
22960
23697
|
"_What did we learn? Update after completion._",
|
|
22961
23698
|
""
|
|
22962
23699
|
].join("\n");
|
|
22963
|
-
return
|
|
23700
|
+
return matter20.stringify("\n" + body, data);
|
|
22964
23701
|
}
|
|
22965
23702
|
function materializeCandidate(dir, id, candidateId) {
|
|
22966
23703
|
const ini = getInitiative(dir, id);
|
|
@@ -22977,13 +23714,13 @@ function materializeCandidate(dir, id, candidateId) {
|
|
|
22977
23714
|
ensureDir(join(dir, DRAFT_DIR2));
|
|
22978
23715
|
writeFile(join(dir, DRAFT_DIR2, fileName), buildWorkItemContent(wiId, ini.id, candidate));
|
|
22979
23716
|
const raw = readFile(ini.filePath);
|
|
22980
|
-
const { data, content } =
|
|
23717
|
+
const { data, content } = matter20(raw, {});
|
|
22981
23718
|
const cands = Array.isArray(data.candidates) ? data.candidates : [];
|
|
22982
23719
|
for (const c of cands) {
|
|
22983
23720
|
if (c && typeof c === "object" && String(c.id) === candidateId) c.materialized_as = wiId;
|
|
22984
23721
|
}
|
|
22985
23722
|
data.candidates = cands;
|
|
22986
|
-
const newContent =
|
|
23723
|
+
const newContent = matter20.stringify(content, data);
|
|
22987
23724
|
writeFile(ini.filePath, newContent);
|
|
22988
23725
|
const updated = parseInitiative(dir, ini.filePath, newContent);
|
|
22989
23726
|
if (!updated) throw new InitiativeWriteError("Failed to parse the Initiative after materialization.");
|
|
@@ -23318,8 +24055,12 @@ var require2 = createRequire(import.meta.url);
|
|
|
23318
24055
|
var { version } = require2("../package.json");
|
|
23319
24056
|
var program = new Command();
|
|
23320
24057
|
program.name("kaddo").description("Knowledge Driven Development toolkit").version(version);
|
|
23321
|
-
program.command("init").description("Initialize Kaddo in the current project").action(async () => {
|
|
23322
|
-
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);
|
|
23323
24064
|
});
|
|
23324
24065
|
program.command("scan").description("Detect project stack and suggest domains").action(async () => {
|
|
23325
24066
|
await runScan();
|
|
@@ -23337,8 +24078,8 @@ var capsuleCmd = program.command("capsule").description("Export this project as
|
|
|
23337
24078
|
capsuleCmd.command("export").description("Write a Knowledge Capsule about this project to .kaddo/exports/").option("--scope <scope>", 'Export scope: "system" includes all mapped modules').option("--module <id>", "Export a capsule for a specific mapped module").action((opts) => {
|
|
23338
24079
|
runCapsuleExport(opts);
|
|
23339
24080
|
});
|
|
23340
|
-
capsuleCmd.command("add <path>").description("Register an external Knowledge Capsule as project context (.kaddo/external.yml)").action((
|
|
23341
|
-
runCapsuleAdd(
|
|
24081
|
+
capsuleCmd.command("add <path>").description("Register an external Knowledge Capsule as project context (.kaddo/external.yml)").action((path13) => {
|
|
24082
|
+
runCapsuleAdd(path13);
|
|
23342
24083
|
});
|
|
23343
24084
|
var graphCmd = program.command("graph").description("Export the lightweight, file-based knowledge graph of the project");
|
|
23344
24085
|
graphCmd.command("export").description("Write the knowledge graph to .kaddo/graph.json and .kaddo/graph.mmd").option("--scope <scope>", "Graph scope: active (default) or all").option("--format <format>", "Output format: json, mermaid (default: both)").action((opts) => {
|
|
@@ -23354,6 +24095,13 @@ topologyCmd.command("apply <file>").description("Apply a validated topology prop
|
|
|
23354
24095
|
var resourcesCmd = program.command("resources").description("List and inspect Project Resources \u2014 external systems the project uses (read-only, no secrets)");
|
|
23355
24096
|
resourcesCmd.command("list").description("List Project Resources defined under knowledge/tech/resources/").option("--json", "Output JSON").action((opts) => runResourcesList(cwd(), opts));
|
|
23356
24097
|
resourcesCmd.command("get <id>").description("Show one Project Resource: purpose, interfaces, boundaries and auth references").option("--json", "Output JSON").action((id, opts) => runResourcesGet(id, cwd(), opts));
|
|
24098
|
+
resourcesCmd.command("create").description("Create a Project Resource (interactive, or with --title/--type). Writes via Core.").option("--title <title>", "Resource name").option("--type <type>", "Resource type (database, cloud, api, queue, storage, repository, platform, service, other)").option("--provider <provider>", "Provider/platform").option("--scope <scope>", "Ownership scope: system | module").option("--module <id>", "Module id (implies module scope)").option("--json", "Output JSON").action(async (opts) => {
|
|
24099
|
+
await runResourcesCreate(opts, cwd());
|
|
24100
|
+
});
|
|
24101
|
+
resourcesCmd.command("update <id>").description("Update a Project Resource (no-lossy). Pass the fields to change.").option("--title <title>", "New title").option("--type <type>", "New resource type").option("--provider <provider>", "New provider").option("--purpose <purpose>", "New purpose").option("--scope <scope>", "Ownership scope: system | module").option("--module <id>", "Module id (implies module scope)").option("--json", "Output JSON").action((id, opts) => runResourcesUpdate(id, opts, cwd()));
|
|
24102
|
+
resourcesCmd.command("delete <id>").description("Delete a Project Resource after showing what references it (requires confirmation)").option("-y, --yes", "Skip the confirmation prompt").option("--json", "Output JSON").action(async (id, opts) => {
|
|
24103
|
+
await runResourcesDelete(id, opts, cwd());
|
|
24104
|
+
});
|
|
23357
24105
|
var integrationsCmd = program.command("integrations").description("Connect Kaddo to external work systems (read-first; import requires human confirmation)");
|
|
23358
24106
|
integrationsCmd.command("list").description("List configured integrations and their capabilities").option("--json", "Output JSON").action((opts) => runIntegrationsList(cwd(), opts));
|
|
23359
24107
|
integrationsCmd.command("status").description("Verify each enabled integration and report its connection status").option("--json", "Output JSON").action(async (opts) => {
|