@kaddo/mcp 3.63.0 → 3.64.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.
Files changed (2) hide show
  1. package/dist/index.js +148 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -693,6 +693,34 @@ function firstUnrefinedLayerAgent(layers) {
693
693
  return { agent: "architecture-agent", step: "Use architecture-agent to complete knowledge/tech/current-state.md" };
694
694
  }
695
695
  function assessPhase(input) {
696
+ if (input.isModuleRepo) {
697
+ const techStatus = layer(input.layers, "Tech");
698
+ const techReady = !NOT_READY_LAYER.includes(techStatus);
699
+ if (techReady) {
700
+ return {
701
+ phase: "Active Delivery",
702
+ reasons: ["Module repo \u2014 Tech layer ready", "Business/Product managed by core"],
703
+ recommendedAgents: [],
704
+ nextStep: "Module knowledge is ready for core orchestration.",
705
+ llmInstructions: [
706
+ "This is a module repo. Business, Product, and Delivery are managed by the core repo.",
707
+ "Do not create business, product, roadmap or Work Items here."
708
+ ]
709
+ };
710
+ }
711
+ return {
712
+ phase: "Knowledge Refinement",
713
+ reasons: ["Module repo \u2014 Tech layer incomplete", "Business/Product managed by core"],
714
+ recommendedAgents: ["module-context-agent"],
715
+ nextStep: "Use module-context-agent to refine knowledge/tech/module/module-context.md",
716
+ llmInstructions: [
717
+ "Use the module-context-agent to refine the module context.",
718
+ "Do not create business, product, roadmap or Work Items in this module.",
719
+ "Do not install agents or skills.",
720
+ "Do not write application code."
721
+ ]
722
+ };
723
+ }
696
724
  const phase = determinePhase(input);
697
725
  const reasons = buildReasons(input);
698
726
  const bs = input.workItems.byState;
@@ -3009,6 +3037,21 @@ function layerQuality(dir, layer2) {
3009
3037
  return worst;
3010
3038
  }
3011
3039
  function knowledgeLayers(dir) {
3040
+ const config = loadConfig(dir);
3041
+ if (config && isModule(config)) {
3042
+ return [
3043
+ { layer: "Business", status: "Not applicable", detected: [] },
3044
+ { layer: "Product", status: "Not applicable", detected: [] },
3045
+ ...discoverLayers(dir).filter((l2) => l2.layer === "Tech").map((l2) => {
3046
+ if (l2.status !== "Consolidated" && l2.status !== "Structured") return l2;
3047
+ const q3 = layerQuality(dir, l2.layer);
3048
+ if (q3 === "placeholder") return { ...l2, status: "Placeholder" };
3049
+ if (q3 === "weak") return { ...l2, status: "Weak" };
3050
+ return l2;
3051
+ }),
3052
+ { layer: "Delivery", status: "Managed by core", detected: [] }
3053
+ ];
3054
+ }
3012
3055
  return discoverLayers(dir).map((l2) => {
3013
3056
  if (l2.status !== "Consolidated" && l2.status !== "Structured") return l2;
3014
3057
  const q3 = layerQuality(dir, l2.layer);
@@ -3918,6 +3961,13 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
3918
3961
  }
3919
3962
  const state = config.project.state;
3920
3963
  const q3 = (rel) => analyzeKnowledgeArtifact(dir, rel);
3964
+ const resolveAgent = (agent) => {
3965
+ const file = agent.endsWith(".md") ? agent : `${agent}.md`;
3966
+ const path4 = agentInstallPath(file);
3967
+ const installed = isFile(join(dir, path4));
3968
+ const group = agentGroupOf(file);
3969
+ return { agentPath: path4, agentInstalled: installed, installCommand: installed ? void 0 : `kaddo add agents --group ${group}` };
3970
+ };
3921
3971
  const moduleRepo = isModule(config);
3922
3972
  const coreRepo = isCore(config);
3923
3973
  const MC = exists(join(dir, "knowledge/tech/module/module-context.md")) ? "knowledge/tech/module/module-context.md" : "knowledge/module/module-context.md";
@@ -3933,15 +3983,26 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
3933
3983
  return { id: "context", phase: "Discovery", label: "Run `kaddo context` to prepare the LLM context pack.", command: "kaddo context", reason: "No context pack has been generated yet." };
3934
3984
  }
3935
3985
  if (qMC !== "useful") {
3986
+ const ar = resolveAgent("module-context-agent");
3936
3987
  return {
3937
3988
  id: "refine-module-context",
3938
3989
  phase: "Knowledge Refinement",
3939
- label: "Use module-context-agent to refine `knowledge/module/module-context.md`.",
3990
+ label: "Use module-context-agent to refine `knowledge/tech/module/module-context.md`.",
3940
3991
  agent: "module-context-agent",
3941
3992
  skill: "module-context-refinement",
3942
3993
  target: MC,
3994
+ agentPath: ar.agentPath,
3995
+ agentInstalled: ar.agentInstalled,
3996
+ installCommand: ar.installCommand,
3943
3997
  reason: "Module context is still a placeholder.",
3944
- instructions: ["Refine the module context with real knowledge about this module.", "Do not create business.md or product.md.", "Do not write code."]
3998
+ instructions: [
3999
+ "Refine the module context using evidence from this repository.",
4000
+ "Use the parent system context when available.",
4001
+ "Do not create business, product, roadmap or Work Items in this module.",
4002
+ "Do not install agents or skills in this module.",
4003
+ "Do not write application code.",
4004
+ "Preserve frontmatter and record unknowns as open questions."
4005
+ ]
3945
4006
  };
3946
4007
  }
3947
4008
  const qCurrentState2 = q3(CS), qCodebase2 = q3(CB);
@@ -3970,7 +4031,7 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
3970
4031
  if (!exists(join(dir, ".kaddo", "understand.md"))) {
3971
4032
  return { id: "understand", phase: "Discovery", label: "Run `kaddo understand` to summarize the project context.", command: "kaddo understand", reason: "No understand handoff has been generated yet." };
3972
4033
  }
3973
- return { id: "module-ready", phase: "Active Delivery", label: "Module context is complete. Create and manage Work Items from the core repository.", reason: "This module's knowledge is ready. Work Items are created and tracked in the core." };
4034
+ return { id: "module-ready", phase: "Ready for Core Orchestration", label: "Module knowledge is complete. Create and manage Work Items from the core repository.", reason: "This module's knowledge is ready for core orchestration. Work Items are created and tracked in the core." };
3974
4035
  }
3975
4036
  const qBusiness = q3(B2), qProduct = q3(P2), qCap = q3(CAP), qCurrentState = q3(CS), qCodebase = q3(CB);
3976
4037
  if (!coreRepo && (qBusiness === "missing" || qProduct === "missing")) {
@@ -3996,13 +4057,6 @@ function resolveNextStep(dir, now = /* @__PURE__ */ new Date()) {
3996
4057
  return { id: "context", phase: "Discovery", label: "Run `kaddo context` to prepare the LLM context pack.", command: "kaddo context", reason: "No context pack has been generated yet." };
3997
4058
  }
3998
4059
  const discovery = state === "pre-ai" || state === "legacy";
3999
- const resolveAgent = (agent) => {
4000
- const file = agent.endsWith(".md") ? agent : `${agent}.md`;
4001
- const path4 = agentInstallPath(file);
4002
- const installed = isFile(join(dir, path4));
4003
- const group = agentGroupOf(file);
4004
- return { agentPath: path4, agentInstalled: installed, installCommand: installed ? void 0 : `kaddo add agents --group ${group}` };
4005
- };
4006
4060
  const refine = (id, agent, target, quality, verb = "complete") => {
4007
4061
  const ar = resolveAgent(agent);
4008
4062
  return {
@@ -7602,6 +7656,67 @@ var identifyRisks = {
7602
7656
  return { status: hasLegacy ? "done" : "pending", agent: hasLegacy ? void 0 : "legacy-agent" };
7603
7657
  }
7604
7658
  };
7659
+ var refineModuleContext = {
7660
+ id: "refine-module-context",
7661
+ label: "Refine module context",
7662
+ evaluate: (ctx) => {
7663
+ const newPath = join(ctx.dir, "knowledge/tech/module/module-context.md");
7664
+ const legacyPath = join(ctx.dir, "knowledge/module/module-context.md");
7665
+ const mcPath = exists(newPath) ? "knowledge/tech/module/module-context.md" : exists(legacyPath) ? "knowledge/module/module-context.md" : null;
7666
+ if (!mcPath) return { status: "pending", agent: "module-context-agent", skill: "module-context-refinement" };
7667
+ const q3 = analyzeKnowledgeArtifact(ctx.dir, mcPath);
7668
+ if (q3 === "useful") return { status: "done", evidence: [mcPath] };
7669
+ return { status: "current", agent: "module-context-agent", skill: "module-context-refinement", evidence: [mcPath], reason: "Module context is still a placeholder." };
7670
+ }
7671
+ };
7672
+ var describeModuleCurrentState = {
7673
+ id: "describe-current-state",
7674
+ label: "Describe current state",
7675
+ evaluate: (ctx) => ({
7676
+ status: isUseful(ctx.qCurrentState) ? "done" : "pending",
7677
+ evidence: isUseful(ctx.qCurrentState) ? ["knowledge/tech/current-state.md"] : void 0,
7678
+ agent: isUseful(ctx.qCurrentState) ? void 0 : "architecture-agent"
7679
+ })
7680
+ };
7681
+ var mapModuleCodebase = {
7682
+ id: "map-codebase",
7683
+ label: "Map codebase",
7684
+ evaluate: (ctx) => ({
7685
+ status: isUseful(ctx.qCodebase) ? "done" : "pending",
7686
+ evidence: isUseful(ctx.qCodebase) ? ["knowledge/tech/codebase.md"] : void 0,
7687
+ agent: isUseful(ctx.qCodebase) ? void 0 : "architecture-agent"
7688
+ })
7689
+ };
7690
+ var validateModuleKnowledge = {
7691
+ id: "validate-module-knowledge",
7692
+ label: "Validate module knowledge",
7693
+ evaluate: (ctx) => {
7694
+ const hasUnderstand = exists(join(ctx.dir, ".kaddo/understand.md"));
7695
+ if (hasUnderstand) return { status: "done", evidence: [".kaddo/understand.md"] };
7696
+ return { status: "pending", command: "kaddo understand" };
7697
+ }
7698
+ };
7699
+ var readyForCoreOrchestration = {
7700
+ id: "ready-for-core-orchestration",
7701
+ label: "Ready for core orchestration",
7702
+ evaluate: (ctx) => {
7703
+ const newPath = join(ctx.dir, "knowledge/tech/module/module-context.md");
7704
+ const legacyPath = join(ctx.dir, "knowledge/module/module-context.md");
7705
+ const mcPath = exists(newPath) ? "knowledge/tech/module/module-context.md" : exists(legacyPath) ? "knowledge/module/module-context.md" : null;
7706
+ const mcUseful = mcPath ? analyzeKnowledgeArtifact(ctx.dir, mcPath) === "useful" : false;
7707
+ const allDone = mcUseful && isUseful(ctx.qCurrentState) && isUseful(ctx.qCodebase);
7708
+ return { status: allDone ? "done" : "pending", reason: allDone ? void 0 : "Module knowledge is not yet complete." };
7709
+ }
7710
+ };
7711
+ var MODULE_STEPS = [
7712
+ enableKaddo,
7713
+ scanRepository,
7714
+ refineModuleContext,
7715
+ describeModuleCurrentState,
7716
+ mapModuleCodebase,
7717
+ validateModuleKnowledge,
7718
+ readyForCoreOrchestration
7719
+ ];
7605
7720
  var NEW_STEPS = [
7606
7721
  enableKaddo,
7607
7722
  defineBusiness,
@@ -7742,10 +7857,10 @@ function mapNextStepId(id) {
7742
7857
  "review-work-item": "refine-work-item",
7743
7858
  "prepare-implementation": "prepare-implementation",
7744
7859
  "implement-work-item": "prepare-implementation",
7745
- "refine-module-context": "refine-work-item",
7860
+ "refine-module-context": "refine-module-context",
7746
7861
  "init-module-context": "enable-kaddo",
7747
- "module-ready": "prepare-implementation",
7748
- "validate-work-item-modules": "prepare-implementation",
7862
+ "module-ready": "ready-for-core-orchestration",
7863
+ "validate-work-item-modules": "validate-module-knowledge",
7749
7864
  "modules-discover": "enable-kaddo"
7750
7865
  };
7751
7866
  return MAP[id] ?? id;
@@ -7753,7 +7868,7 @@ function mapNextStepId(id) {
7753
7868
  function buildProjectRoute(dir) {
7754
7869
  const config = loadConfig(dir);
7755
7870
  const state = config?.project.state ?? "pre-ai";
7756
- const defs = stepsForState(state);
7871
+ const defs = config && isModule(config) ? MODULE_STEPS : stepsForState(state);
7757
7872
  const ctx = buildRouteContext(dir);
7758
7873
  const steps = defs.map((d3) => {
7759
7874
  const result = d3.evaluate(ctx);
@@ -8140,7 +8255,8 @@ function buildProjectExplanation(dir) {
8140
8255
  roadmapQuality: buildRoadmapQuality(dir),
8141
8256
  projectRoute: buildProjectRoute(dir),
8142
8257
  scanSignals: loadScanSignals(dir),
8143
- metadataHealth: analyzeMetadataHealth(dir)
8258
+ metadataHealth: analyzeMetadataHealth(dir),
8259
+ isModuleRepo: config != null && isModule(config)
8144
8260
  };
8145
8261
  }
8146
8262
  function stateLabel(state) {
@@ -10588,15 +10704,16 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
10588
10704
  if (!knowledgeSummary) {
10589
10705
  missing.push("No project knowledge summary found yet.");
10590
10706
  }
10707
+ const moduleRepo = config != null && isModule(config);
10591
10708
  const roadmapSummary = readMarkdownSummary(dir, "delivery/roadmap.md") ?? "";
10592
- if (!roadmapSummary) {
10709
+ if (!roadmapSummary && !moduleRepo) {
10593
10710
  missing.push("No roadmap baseline found.");
10594
10711
  }
10595
10712
  const allArtifacts = discoverKnowledge(dir);
10596
10713
  const workItems = allArtifacts.filter(
10597
10714
  (a2) => isDeliveryWorkItem(a2) && isActiveState(lifecycleStateOf({ status: a2.status, filePath: a2.filePath }))
10598
10715
  );
10599
- if (workItems.length === 0) {
10716
+ if (workItems.length === 0 && !moduleRepo) {
10600
10717
  missing.push("No work items found.");
10601
10718
  }
10602
10719
  const state = config.project.state;
@@ -10628,8 +10745,8 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
10628
10745
  tech: { status: layerStatusOf("Tech"), artifacts: { "knowledge/tech/codebase.md": qCodebase, "knowledge/tech/current-state.md": qCurrentState } },
10629
10746
  delivery: { status: layerStatusOf("Delivery"), artifacts: { "knowledge/delivery/roadmap.md": qRoadmap } }
10630
10747
  };
10631
- if (qBusiness === "placeholder") missing.push("Business context exists but still looks like a bootstrap placeholder.");
10632
- if (qProduct === "placeholder" || qCapabilities === "placeholder") missing.push("Product capabilities exist but still look like a bootstrap placeholder.");
10748
+ if (qBusiness === "placeholder" && !moduleRepo) missing.push("Business context exists but still looks like a bootstrap placeholder.");
10749
+ if ((qProduct === "placeholder" || qCapabilities === "placeholder") && !moduleRepo) missing.push("Product capabilities exist but still look like a bootstrap placeholder.");
10633
10750
  if (qCurrentState === "placeholder") missing.push("Current state exists but still looks like a bootstrap placeholder.");
10634
10751
  if (qCodebase === "placeholder") missing.push("Codebase map exists but still looks like a bootstrap placeholder.");
10635
10752
  const allWorkItems = allArtifacts.filter((a2) => a2.isWorkItem);
@@ -10652,7 +10769,8 @@ function buildContextPack(dir, config, now = /* @__PURE__ */ new Date()) {
10652
10769
  workItemsTotal: allWorkItems.length,
10653
10770
  workItemsWithOwnership: wiWithOwnership,
10654
10771
  workItemsMissingOwnership: allWorkItems.length - wiWithOwnership
10655
- }
10772
+ },
10773
+ isModuleRepo: config != null && isModule(config)
10656
10774
  });
10657
10775
  const nextStepRecommendation = resolveNextStep(dir, now);
10658
10776
  const techDecisions = buildTechDecisions(dir);
@@ -11134,6 +11252,16 @@ function flowForState(state) {
11134
11252
  }
11135
11253
  function buildUnderstandPlan(dir, config) {
11136
11254
  const state = config.project.state;
11255
+ if (isModule(config)) {
11256
+ return {
11257
+ project: { name: config.project.name, state, teamSize: config.team.size, structure: config.project.structure, language: "English" },
11258
+ steps: [],
11259
+ missingAgents: [],
11260
+ agentsInstalled: true,
11261
+ scanAvailable: exists(join(dir, ".kaddo", "scan.json")),
11262
+ contextPackPath: ".kaddo/context-pack.md"
11263
+ };
11264
+ }
11137
11265
  const flow = flowForState(state).filter((s) => !exists(join(dir, s.output)));
11138
11266
  const steps = flow.map((s) => {
11139
11267
  const installed = agentIsInstalled(dir, s.agent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaddo/mcp",
3
- "version": "3.63.0",
3
+ "version": "3.64.0",
4
4
  "description": "MCP server for Kaddo project knowledge: read-only resources/tools/prompts plus safe derived generation under .kaddo/.",
5
5
  "license": "MIT",
6
6
  "repository": {