mdkg 0.3.5 → 0.3.7

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 (49) hide show
  1. package/CHANGELOG.md +97 -2
  2. package/CLI_COMMAND_MATRIX.md +90 -10
  3. package/README.md +54 -7
  4. package/dist/cli.js +222 -13
  5. package/dist/command-contract.json +587 -19
  6. package/dist/commands/bundle.js +2 -0
  7. package/dist/commands/checkpoint.js +139 -1
  8. package/dist/commands/db.js +8 -0
  9. package/dist/commands/format.js +116 -0
  10. package/dist/commands/goal.js +60 -0
  11. package/dist/commands/graph.js +280 -10
  12. package/dist/commands/handoff.js +295 -0
  13. package/dist/commands/mcp.js +656 -0
  14. package/dist/commands/pack.js +3 -1
  15. package/dist/commands/query_output.js +2 -0
  16. package/dist/commands/show.js +8 -0
  17. package/dist/commands/status.js +1 -0
  18. package/dist/commands/task.js +2 -0
  19. package/dist/commands/upgrade.js +61 -0
  20. package/dist/commands/validate.js +162 -3
  21. package/dist/commands/work.js +164 -0
  22. package/dist/core/project_db_queue_contract.js +101 -0
  23. package/dist/graph/edges.js +15 -0
  24. package/dist/graph/frontmatter.js +4 -1
  25. package/dist/graph/indexer.js +8 -0
  26. package/dist/graph/node.js +12 -1
  27. package/dist/graph/sqlite_index.js +2 -0
  28. package/dist/graph/subgraphs.js +2 -0
  29. package/dist/graph/validate_graph.js +5 -0
  30. package/dist/graph/visibility.js +6 -0
  31. package/dist/init/AGENT_START.md +4 -1
  32. package/dist/init/CLI_COMMAND_MATRIX.md +36 -4
  33. package/dist/init/README.md +26 -3
  34. package/dist/init/init-manifest.json +12 -12
  35. package/dist/init/templates/default/bug.md +2 -0
  36. package/dist/init/templates/default/chk.md +3 -0
  37. package/dist/init/templates/default/epic.md +2 -0
  38. package/dist/init/templates/default/feat.md +2 -0
  39. package/dist/init/templates/default/goal.md +3 -0
  40. package/dist/init/templates/default/spike.md +2 -0
  41. package/dist/init/templates/default/task.md +2 -0
  42. package/dist/init/templates/default/test.md +2 -0
  43. package/dist/pack/export_json.js +20 -8
  44. package/dist/pack/export_md.js +15 -4
  45. package/dist/pack/export_xml.js +9 -4
  46. package/dist/pack/metrics.js +12 -4
  47. package/dist/pack/pack.js +9 -1
  48. package/dist/util/argparse.js +1 -0
  49. package/package.json +7 -2
@@ -18,6 +18,12 @@ function estimateTokensFromChars(chars) {
18
18
  return Math.ceil(chars / 4);
19
19
  }
20
20
  function renderNodeMetricsText(node) {
21
+ const links = node.links ?? [];
22
+ const artifacts = node.artifacts ?? [];
23
+ const refs = node.refs ?? [];
24
+ const contextRefs = node.context_refs ?? [];
25
+ const evidenceRefs = node.evidence_refs ?? [];
26
+ const aliases = node.aliases ?? [];
21
27
  const lines = [];
22
28
  lines.push(`qid: ${node.qid}`);
23
29
  lines.push(`id: ${node.id}`);
@@ -31,10 +37,12 @@ function renderNodeMetricsText(node) {
31
37
  lines.push(`priority: ${node.priority}`);
32
38
  }
33
39
  lines.push(`path: ${node.path}`);
34
- lines.push(`links: ${node.links.join(",")}`);
35
- lines.push(`artifacts: ${node.artifacts.join(",")}`);
36
- lines.push(`refs: ${node.refs.join(",")}`);
37
- lines.push(`aliases: ${node.aliases.join(",")}`);
40
+ lines.push(`links: ${links.join(",")}`);
41
+ lines.push(`artifacts: ${artifacts.join(",")}`);
42
+ lines.push(`refs: ${refs.join(",")}`);
43
+ lines.push(`context_refs: ${contextRefs.join(",")}`);
44
+ lines.push(`evidence_refs: ${evidenceRefs.join(",")}`);
45
+ lines.push(`aliases: ${aliases.join(",")}`);
38
46
  if (node.body.length > 0) {
39
47
  lines.push("");
40
48
  lines.push(node.body);
package/dist/pack/pack.js CHANGED
@@ -6,7 +6,7 @@ const node_body_1 = require("../graph/node_body");
6
6
  const qid_1 = require("../util/qid");
7
7
  const order_1 = require("./order");
8
8
  const verbose_core_1 = require("./verbose_core");
9
- const EDGE_KEYS = ["parent", "epic", "relates", "blocked_by", "blocks", "prev", "next"];
9
+ const EDGE_KEYS = ["parent", "epic", "relates", "blocked_by", "blocks", "prev", "next", "context_refs", "evidence_refs"];
10
10
  function normalizeEdgeList(edges) {
11
11
  const seen = new Set();
12
12
  const result = [];
@@ -59,6 +59,12 @@ function getNeighbors(index, qid, edges) {
59
59
  case "blocks":
60
60
  neighbors.push(...node.edges.blocks);
61
61
  break;
62
+ case "context_refs":
63
+ neighbors.push(...(node.edges.context_refs ?? []));
64
+ break;
65
+ case "evidence_refs":
66
+ neighbors.push(...(node.edges.evidence_refs ?? []));
67
+ break;
62
68
  default:
63
69
  break;
64
70
  }
@@ -113,6 +119,8 @@ function buildPackNode(root, index, qid) {
113
119
  links: node.links,
114
120
  artifacts: node.artifacts,
115
121
  refs: node.refs,
122
+ context_refs: node.edges.context_refs ?? [],
123
+ evidence_refs: node.edges.evidence_refs ?? [],
116
124
  aliases: node.aliases,
117
125
  attributes: node.attributes ?? {},
118
126
  ...(node.source ? { source: node.source } : {}),
@@ -135,6 +135,7 @@ const BOOLEAN_FLAGS = new Set([
135
135
  "--clean",
136
136
  "--gitignore",
137
137
  "--select-goal",
138
+ "--stdio",
138
139
  ]);
139
140
  const FLAG_ALIASES = {
140
141
  "--o": "--out",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdkg",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "Markdown Knowledge Graph",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -32,8 +32,13 @@
32
32
  "smoke:command-docs": "npm run build && node scripts/smoke-command-docs.js",
33
33
  "smoke:spike": "npm run build && node scripts/smoke-spike.js",
34
34
  "smoke:goal-lifecycle": "npm run build && node scripts/smoke-goal-lifecycle.js",
35
+ "smoke:semantic-refs": "npm run build && node scripts/smoke-semantic-refs.js",
36
+ "smoke:checkpoint-templates": "npm run build && node scripts/smoke-checkpoint-templates.js",
37
+ "smoke:handoff": "npm run build && node scripts/smoke-handoff.js",
38
+ "smoke:integration-ux": "npm run build && node scripts/smoke-integration-ux.js",
35
39
  "smoke:bundle": "npm run build && node scripts/smoke-bundle.js",
36
40
  "smoke:graph-clone": "npm run build && node scripts/smoke-graph-clone.js",
41
+ "smoke:mcp": "npm run build && node scripts/smoke-mcp.js",
37
42
  "smoke:bundle-import": "npm run smoke:subgraph",
38
43
  "smoke:visibility": "npm run build && node scripts/smoke-visibility.js",
39
44
  "smoke:sqlite": "npm run build && node scripts/smoke-sqlite.js",
@@ -43,7 +48,7 @@
43
48
  "cli:check": "npm run build && node scripts/cli_help_snapshot.js --check",
44
49
  "cli:contract": "npm run build && node scripts/generate-command-contract.js --check",
45
50
  "prepack": "npm run build && node scripts/assert-publish-ready.js",
46
- "prepublishOnly": "npm run test && npm run cli:check && npm run cli:contract && node dist/cli.js validate && npm run smoke:consumer && npm run smoke:matrix && npm run smoke:upgrade && npm run smoke:init && npm run smoke:capabilities && npm run smoke:db && npm run smoke:db-queue && npm run smoke:db-queue-cli && npm run smoke:db-events && npm run smoke:db-materializer && npm run smoke:db-snapshot && npm run smoke:archive-work && npm run smoke:work-invocation && npm run smoke:cli-ux-polish && npm run smoke:operator-health && npm run smoke:fix-plan && npm run smoke:branch-conflicts && npm run smoke:id-repair && npm run smoke:command-docs && npm run smoke:spike && npm run smoke:goal-lifecycle && npm run smoke:bundle && npm run smoke:graph-clone && npm run smoke:subgraph && npm run smoke:visibility && npm run smoke:sqlite && npm run smoke:parallel && npm run smoke:goal && node scripts/assert-publish-ready.js",
51
+ "prepublishOnly": "npm run test && npm run cli:check && npm run cli:contract && node dist/cli.js validate && npm run smoke:consumer && npm run smoke:matrix && npm run smoke:upgrade && npm run smoke:init && npm run smoke:capabilities && npm run smoke:db && npm run smoke:db-queue && npm run smoke:db-queue-cli && npm run smoke:db-events && npm run smoke:db-materializer && npm run smoke:db-snapshot && npm run smoke:archive-work && npm run smoke:work-invocation && npm run smoke:cli-ux-polish && npm run smoke:operator-health && npm run smoke:fix-plan && npm run smoke:branch-conflicts && npm run smoke:id-repair && npm run smoke:command-docs && npm run smoke:spike && npm run smoke:goal-lifecycle && npm run smoke:semantic-refs && npm run smoke:checkpoint-templates && npm run smoke:handoff && npm run smoke:integration-ux && npm run smoke:bundle && npm run smoke:graph-clone && npm run smoke:mcp && npm run smoke:subgraph && npm run smoke:visibility && npm run smoke:sqlite && npm run smoke:parallel && npm run smoke:goal && node scripts/assert-publish-ready.js",
47
52
  "postinstall": "node scripts/postinstall.js",
48
53
  "smoke:subgraph": "npm run build && node scripts/smoke-subgraph.js"
49
54
  },