mdkg 0.3.7 → 0.3.9

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 (53) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/CLI_COMMAND_MATRIX.md +85 -24
  3. package/README.md +51 -26
  4. package/dist/cli.js +72 -35
  5. package/dist/command-contract.json +354 -9
  6. package/dist/commands/capability.js +1 -0
  7. package/dist/commands/doctor.js +7 -7
  8. package/dist/commands/format.js +40 -1
  9. package/dist/commands/handoff.js +6 -0
  10. package/dist/commands/init.js +84 -3
  11. package/dist/commands/new.js +12 -3
  12. package/dist/commands/skill.js +1 -1
  13. package/dist/commands/skill_mirror.js +22 -17
  14. package/dist/commands/skill_support.js +1 -1
  15. package/dist/commands/spec.js +76 -17
  16. package/dist/commands/subgraph.js +7 -4
  17. package/dist/commands/upgrade.js +137 -30
  18. package/dist/commands/validate.js +106 -3
  19. package/dist/commands/work.js +12 -5
  20. package/dist/core/config.js +132 -0
  21. package/dist/graph/agent_file_types.js +59 -20
  22. package/dist/graph/capabilities_indexer.js +45 -3
  23. package/dist/graph/indexer.js +5 -0
  24. package/dist/graph/template_schema.js +37 -17
  25. package/dist/graph/validate_graph.js +11 -5
  26. package/dist/init/AGENT_START.md +10 -9
  27. package/dist/init/CLI_COMMAND_MATRIX.md +30 -17
  28. package/dist/init/README.md +11 -9
  29. package/dist/init/config.json +15 -0
  30. package/dist/init/core/COLLABORATION.md +45 -0
  31. package/dist/init/core/HUMAN.md +7 -1
  32. package/dist/init/core/core.md +1 -0
  33. package/dist/init/core/rule-1-mdkg-conventions.md +3 -0
  34. package/dist/init/core/rule-3-cli-contract.md +5 -5
  35. package/dist/init/init-manifest.json +78 -13
  36. package/dist/init/llms.txt +2 -1
  37. package/dist/init/skills/default/author-mdkg-skill/SKILL.md +211 -0
  38. package/dist/init/skills/default/pursue-mdkg-goal/SKILL.md +10 -0
  39. package/dist/init/skills/default/select-work-and-ground-context/SKILL.md +8 -0
  40. package/dist/init/skills/default/verify-close-and-checkpoint/SKILL.md +73 -9
  41. package/dist/init/templates/default/manifest.md +45 -0
  42. package/dist/init/templates/specs/agent.MANIFEST.md +80 -0
  43. package/dist/init/templates/specs/api.MANIFEST.md +33 -0
  44. package/dist/init/templates/specs/base.MANIFEST.md +120 -0
  45. package/dist/init/templates/specs/capability.MANIFEST.md +45 -0
  46. package/dist/init/templates/specs/integration.MANIFEST.md +25 -0
  47. package/dist/init/templates/specs/model.MANIFEST.md +21 -0
  48. package/dist/init/templates/specs/project.MANIFEST.md +39 -0
  49. package/dist/init/templates/specs/runtime-agent.MANIFEST.md +49 -0
  50. package/dist/init/templates/specs/runtime-image.MANIFEST.md +21 -0
  51. package/dist/init/templates/specs/tool.MANIFEST.md +25 -0
  52. package/dist/util/argparse.js +3 -0
  53. package/package.json +19 -3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": 1,
3
3
  "tool": "mdkg",
4
- "package_version": "0.3.7",
4
+ "package_version": "0.3.9",
5
5
  "source": {
6
6
  "help_targets": "scripts/cli_help_targets.js",
7
7
  "command_matrix": "CLI_COMMAND_MATRIX.md"
@@ -2572,7 +2572,7 @@
2572
2572
  "summary": "mdkg format command",
2573
2573
  "usage": [
2574
2574
  " mdkg format",
2575
- " mdkg format --headings [--dry-run|--apply] [--json]"
2575
+ " mdkg format --headings [--dry-run|--apply] [--summary] [--limit <n>] [--json]"
2576
2576
  ],
2577
2577
  "args": [],
2578
2578
  "flags": [
@@ -2586,7 +2586,7 @@
2586
2586
  "name": "--headings",
2587
2587
  "value": "[--dry-run|--apply]",
2588
2588
  "required": false,
2589
- "description": "mdkg format --headings [--dry-run|--apply] [--json]"
2589
+ "description": "mdkg format --headings [--dry-run|--apply] [--summary] [--limit <n>] [--json]"
2590
2590
  },
2591
2591
  {
2592
2592
  "name": "--help",
@@ -2594,12 +2594,24 @@
2594
2594
  "required": false,
2595
2595
  "description": "--help, -h Show help"
2596
2596
  },
2597
+ {
2598
+ "name": "--limit",
2599
+ "value": "controls",
2600
+ "required": false,
2601
+ "description": "--summary emits bounded heading-change samples for agent/CI logs; --limit controls the sample size."
2602
+ },
2597
2603
  {
2598
2604
  "name": "--root",
2599
2605
  "value": null,
2600
2606
  "required": false,
2601
2607
  "description": "--root, -r <path> Run against a specific repo root"
2602
2608
  },
2609
+ {
2610
+ "name": "--summary",
2611
+ "value": "emits",
2612
+ "required": false,
2613
+ "description": "--summary emits bounded heading-change samples for agent/CI logs; --limit controls the sample size."
2614
+ },
2603
2615
  {
2604
2616
  "name": "--version",
2605
2617
  "value": null,
@@ -2646,7 +2658,7 @@
2646
2658
  ],
2647
2659
  "examples": [
2648
2660
  " mdkg format",
2649
- " mdkg format --headings [--dry-run|--apply] [--json]"
2661
+ " mdkg format --headings [--dry-run|--apply] [--summary] [--limit <n>] [--json]"
2650
2662
  ],
2651
2663
  "docs": {
2652
2664
  "help_target": "mdkg help format",
@@ -4720,6 +4732,315 @@
4720
4732
  "command_matrix": "CLI_COMMAND_MATRIX.md"
4721
4733
  }
4722
4734
  },
4735
+ {
4736
+ "key": "manifest",
4737
+ "path": [
4738
+ "manifest"
4739
+ ],
4740
+ "category": "manifest",
4741
+ "status": "stable",
4742
+ "visibility": "public",
4743
+ "summary": "mdkg manifest command",
4744
+ "usage": [
4745
+ " mdkg manifest list [--json]",
4746
+ " mdkg manifest show <id-or-qid-or-alias> [--json]",
4747
+ " mdkg manifest validate [<id-or-qid-or-alias>] [--json]"
4748
+ ],
4749
+ "args": [
4750
+ {
4751
+ "name": "id-or-qid-or-alias",
4752
+ "required": true,
4753
+ "source": "<id-or-qid-or-alias>"
4754
+ }
4755
+ ],
4756
+ "flags": [
4757
+ {
4758
+ "name": "--help",
4759
+ "value": null,
4760
+ "required": false,
4761
+ "description": "--help, -h Show help"
4762
+ },
4763
+ {
4764
+ "name": "--root",
4765
+ "value": null,
4766
+ "required": false,
4767
+ "description": "--root, -r <path> Run against a specific repo root"
4768
+ },
4769
+ {
4770
+ "name": "--version",
4771
+ "value": null,
4772
+ "required": false,
4773
+ "description": "--version, -V Show version"
4774
+ }
4775
+ ],
4776
+ "output_formats": [
4777
+ "text",
4778
+ "json"
4779
+ ],
4780
+ "json_schema_ref": "mdkg.command_output.v1",
4781
+ "side_effects": [
4782
+ "none"
4783
+ ],
4784
+ "read_paths": [
4785
+ ".mdkg/**"
4786
+ ],
4787
+ "write_paths": [],
4788
+ "dry_run": {
4789
+ "supported": false
4790
+ },
4791
+ "lock_policy": "none-read-only",
4792
+ "atomic_write_policy": "none-read-only",
4793
+ "receipts": [],
4794
+ "danger_level": "read-only",
4795
+ "aliases": [],
4796
+ "exit_codes": [
4797
+ {
4798
+ "code": 0,
4799
+ "meaning": "success"
4800
+ },
4801
+ {
4802
+ "code": 1,
4803
+ "meaning": "validation-or-runtime-error"
4804
+ }
4805
+ ],
4806
+ "examples": [
4807
+ " mdkg manifest list [--json]",
4808
+ " mdkg manifest show <id-or-qid-or-alias> [--json]",
4809
+ " mdkg manifest validate [<id-or-qid-or-alias>] [--json]"
4810
+ ],
4811
+ "docs": {
4812
+ "help_target": "mdkg help manifest",
4813
+ "command_matrix": "CLI_COMMAND_MATRIX.md"
4814
+ }
4815
+ },
4816
+ {
4817
+ "key": "manifest list",
4818
+ "path": [
4819
+ "manifest",
4820
+ "list"
4821
+ ],
4822
+ "category": "manifest",
4823
+ "status": "stable",
4824
+ "visibility": "public",
4825
+ "summary": "mdkg manifest list command",
4826
+ "usage": [
4827
+ " mdkg manifest list [--json]"
4828
+ ],
4829
+ "args": [],
4830
+ "flags": [
4831
+ {
4832
+ "name": "--help",
4833
+ "value": null,
4834
+ "required": false,
4835
+ "description": "--help, -h Show help"
4836
+ },
4837
+ {
4838
+ "name": "--root",
4839
+ "value": null,
4840
+ "required": false,
4841
+ "description": "--root, -r <path> Run against a specific repo root"
4842
+ },
4843
+ {
4844
+ "name": "--version",
4845
+ "value": null,
4846
+ "required": false,
4847
+ "description": "--version, -V Show version"
4848
+ }
4849
+ ],
4850
+ "output_formats": [
4851
+ "text",
4852
+ "json"
4853
+ ],
4854
+ "json_schema_ref": "mdkg.command_output.v1",
4855
+ "side_effects": [
4856
+ "none"
4857
+ ],
4858
+ "read_paths": [
4859
+ ".mdkg/**"
4860
+ ],
4861
+ "write_paths": [],
4862
+ "dry_run": {
4863
+ "supported": false
4864
+ },
4865
+ "lock_policy": "none-read-only",
4866
+ "atomic_write_policy": "none-read-only",
4867
+ "receipts": [],
4868
+ "danger_level": "read-only",
4869
+ "aliases": [],
4870
+ "exit_codes": [
4871
+ {
4872
+ "code": 0,
4873
+ "meaning": "success"
4874
+ },
4875
+ {
4876
+ "code": 1,
4877
+ "meaning": "validation-or-runtime-error"
4878
+ }
4879
+ ],
4880
+ "examples": [
4881
+ " mdkg manifest list [--json]"
4882
+ ],
4883
+ "docs": {
4884
+ "help_target": "mdkg help manifest list",
4885
+ "command_matrix": "CLI_COMMAND_MATRIX.md"
4886
+ }
4887
+ },
4888
+ {
4889
+ "key": "manifest show",
4890
+ "path": [
4891
+ "manifest",
4892
+ "show"
4893
+ ],
4894
+ "category": "manifest",
4895
+ "status": "stable",
4896
+ "visibility": "public",
4897
+ "summary": "mdkg manifest show command",
4898
+ "usage": [
4899
+ " mdkg manifest show <id-or-qid-or-alias> [--json]"
4900
+ ],
4901
+ "args": [
4902
+ {
4903
+ "name": "id-or-qid-or-alias",
4904
+ "required": true,
4905
+ "source": "<id-or-qid-or-alias>"
4906
+ }
4907
+ ],
4908
+ "flags": [
4909
+ {
4910
+ "name": "--help",
4911
+ "value": null,
4912
+ "required": false,
4913
+ "description": "--help, -h Show help"
4914
+ },
4915
+ {
4916
+ "name": "--root",
4917
+ "value": null,
4918
+ "required": false,
4919
+ "description": "--root, -r <path> Run against a specific repo root"
4920
+ },
4921
+ {
4922
+ "name": "--version",
4923
+ "value": null,
4924
+ "required": false,
4925
+ "description": "--version, -V Show version"
4926
+ }
4927
+ ],
4928
+ "output_formats": [
4929
+ "text",
4930
+ "json"
4931
+ ],
4932
+ "json_schema_ref": "mdkg.command_output.v1",
4933
+ "side_effects": [
4934
+ "none"
4935
+ ],
4936
+ "read_paths": [
4937
+ ".mdkg/**"
4938
+ ],
4939
+ "write_paths": [],
4940
+ "dry_run": {
4941
+ "supported": false
4942
+ },
4943
+ "lock_policy": "none-read-only",
4944
+ "atomic_write_policy": "none-read-only",
4945
+ "receipts": [],
4946
+ "danger_level": "read-only",
4947
+ "aliases": [],
4948
+ "exit_codes": [
4949
+ {
4950
+ "code": 0,
4951
+ "meaning": "success"
4952
+ },
4953
+ {
4954
+ "code": 1,
4955
+ "meaning": "validation-or-runtime-error"
4956
+ }
4957
+ ],
4958
+ "examples": [
4959
+ " mdkg manifest show <id-or-qid-or-alias> [--json]"
4960
+ ],
4961
+ "docs": {
4962
+ "help_target": "mdkg help manifest show",
4963
+ "command_matrix": "CLI_COMMAND_MATRIX.md"
4964
+ }
4965
+ },
4966
+ {
4967
+ "key": "manifest validate",
4968
+ "path": [
4969
+ "manifest",
4970
+ "validate"
4971
+ ],
4972
+ "category": "manifest",
4973
+ "status": "stable",
4974
+ "visibility": "public",
4975
+ "summary": "mdkg manifest validate command",
4976
+ "usage": [
4977
+ " mdkg manifest validate [<id-or-qid-or-alias>] [--json]"
4978
+ ],
4979
+ "args": [
4980
+ {
4981
+ "name": "id-or-qid-or-alias",
4982
+ "required": true,
4983
+ "source": "<id-or-qid-or-alias>"
4984
+ }
4985
+ ],
4986
+ "flags": [
4987
+ {
4988
+ "name": "--help",
4989
+ "value": null,
4990
+ "required": false,
4991
+ "description": "--help, -h Show help"
4992
+ },
4993
+ {
4994
+ "name": "--root",
4995
+ "value": null,
4996
+ "required": false,
4997
+ "description": "--root, -r <path> Run against a specific repo root"
4998
+ },
4999
+ {
5000
+ "name": "--version",
5001
+ "value": null,
5002
+ "required": false,
5003
+ "description": "--version, -V Show version"
5004
+ }
5005
+ ],
5006
+ "output_formats": [
5007
+ "text",
5008
+ "json"
5009
+ ],
5010
+ "json_schema_ref": "mdkg.command_output.v1",
5011
+ "side_effects": [
5012
+ "none"
5013
+ ],
5014
+ "read_paths": [
5015
+ ".mdkg/**"
5016
+ ],
5017
+ "write_paths": [],
5018
+ "dry_run": {
5019
+ "supported": false
5020
+ },
5021
+ "lock_policy": "none-read-only",
5022
+ "atomic_write_policy": "none-read-only",
5023
+ "receipts": [],
5024
+ "danger_level": "read-only",
5025
+ "aliases": [],
5026
+ "exit_codes": [
5027
+ {
5028
+ "code": 0,
5029
+ "meaning": "success"
5030
+ },
5031
+ {
5032
+ "code": 1,
5033
+ "meaning": "validation-or-runtime-error"
5034
+ }
5035
+ ],
5036
+ "examples": [
5037
+ " mdkg manifest validate [<id-or-qid-or-alias>] [--json]"
5038
+ ],
5039
+ "docs": {
5040
+ "help_target": "mdkg help manifest validate",
5041
+ "command_matrix": "CLI_COMMAND_MATRIX.md"
5042
+ }
5043
+ },
4723
5044
  {
4724
5045
  "key": "mcp",
4725
5046
  "path": [
@@ -7921,7 +8242,7 @@
7921
8242
  "visibility": "public",
7922
8243
  "summary": "mdkg validate command",
7923
8244
  "usage": [
7924
- " mdkg validate [--out <path>] [--quiet] [--changed-only] [--json]"
8245
+ " mdkg validate [--out <path>] [--json-out <path>] [--quiet] [--changed-only] [--summary] [--limit <n>] [--json]"
7925
8246
  ],
7926
8247
  "args": [],
7927
8248
  "flags": [
@@ -7937,12 +8258,36 @@
7937
8258
  "required": false,
7938
8259
  "description": "--help, -h Show help"
7939
8260
  },
8261
+ {
8262
+ "name": "--json-out",
8263
+ "value": "writes",
8264
+ "required": false,
8265
+ "description": "--out writes the compatibility text report; --json-out writes a clean full JSON receipt."
8266
+ },
8267
+ {
8268
+ "name": "--limit",
8269
+ "value": "controls",
8270
+ "required": false,
8271
+ "description": "--summary emits bounded warning samples for agent/CI logs; --limit controls the sample size."
8272
+ },
8273
+ {
8274
+ "name": "--out",
8275
+ "value": "writes",
8276
+ "required": false,
8277
+ "description": "--out writes the compatibility text report; --json-out writes a clean full JSON receipt."
8278
+ },
7940
8279
  {
7941
8280
  "name": "--root",
7942
8281
  "value": null,
7943
8282
  "required": false,
7944
8283
  "description": "--root, -r <path> Run against a specific repo root"
7945
8284
  },
8285
+ {
8286
+ "name": "--summary",
8287
+ "value": "emits",
8288
+ "required": false,
8289
+ "description": "--summary emits bounded warning samples for agent/CI logs; --limit controls the sample size."
8290
+ },
7946
8291
  {
7947
8292
  "name": "--version",
7948
8293
  "value": null,
@@ -7981,7 +8326,7 @@
7981
8326
  }
7982
8327
  ],
7983
8328
  "examples": [
7984
- " mdkg validate [--out <path>] [--quiet] [--changed-only] [--json]"
8329
+ " mdkg validate [--out <path>] [--json-out <path>] [--quiet] [--changed-only] [--summary] [--limit <n>] [--json]"
7985
8330
  ],
7986
8331
  "docs": {
7987
8332
  "help_target": "mdkg help validate",
@@ -8619,7 +8964,7 @@
8619
8964
  "visibility": "public",
8620
8965
  "summary": "mdkg work validate command",
8621
8966
  "usage": [
8622
- " mdkg work validate [<id-or-qid>] [--type spec|work|work_order|receipt|feedback|dispute|proposal] [--json]"
8967
+ " mdkg work validate [<id-or-qid>] [--type manifest|spec|work|work_order|receipt|feedback|dispute|proposal] [--json]"
8623
8968
  ],
8624
8969
  "args": [
8625
8970
  {
@@ -8681,7 +9026,7 @@
8681
9026
  }
8682
9027
  ],
8683
9028
  "examples": [
8684
- " mdkg work validate [<id-or-qid>] [--type spec|work|work_order|receipt|feedback|dispute|proposal] [--json]"
9029
+ " mdkg work validate [<id-or-qid>] [--type manifest|spec|work|work_order|receipt|feedback|dispute|proposal] [--json]"
8685
9030
  ],
8686
9031
  "docs": {
8687
9032
  "help_target": "mdkg help work validate",
@@ -8783,5 +9128,5 @@
8783
9128
  }
8784
9129
  }
8785
9130
  ],
8786
- "contract_hash": "e6b42d5850cb4e76b9cb29a21bb643b50c042667bb09c598ec3c7dd87f7cccdd"
9131
+ "contract_hash": "3c13c572c740f1e40db33fa5867fa227a8347df0750ef3beb0696d5931761a6c"
8787
9132
  }
@@ -79,6 +79,7 @@ function capabilitySearchText(record) {
79
79
  ...record.aliases,
80
80
  ...record.links,
81
81
  ...record.headings.map((heading) => heading.text),
82
+ JSON.stringify(record.manifest ?? {}),
82
83
  JSON.stringify(record.spec ?? {}),
83
84
  JSON.stringify(record.work ?? {}),
84
85
  JSON.stringify(record.linkage ?? {}),
@@ -164,8 +164,8 @@ function runArchiveStorageCheck(root) {
164
164
  name: "archive-storage",
165
165
  ok: true,
166
166
  level: "warn",
167
- detail: `stray uncompressed archive file(s) found without managed sidecars: ${strayRaw.join(", ")}; run \`mdkg archive add <file>\` or move raw files under a managed archive source directory`,
168
- remediation: "Run `mdkg archive add <file>` or move raw files under a managed archive source directory.",
167
+ detail: `stray uncompressed archive file(s) found without managed sidecars: ${strayRaw.join(", ")}; these are storage hygiene warnings, not source defects`,
168
+ remediation: "Either run `mdkg archive add <file>` to create a managed sidecar, move raw files under an existing managed archive source directory, or remove unintended local files before committing.",
169
169
  refs: strayRaw,
170
170
  });
171
171
  }
@@ -255,8 +255,8 @@ function runProjectDbRuntimePolicyCheck(root) {
255
255
  name: "project-db-runtime",
256
256
  ok: true,
257
257
  level: "warn",
258
- detail: `active project DB runtime/transient file(s) are local-only and should not be committed: ${files.join(", ")}`,
259
- remediation: "Keep runtime DB and transient files ignored; commit sealed state only by explicit repo policy.",
258
+ detail: `active project DB runtime/transient file(s) are local-only and should not be committed: ${files.join(", ")}; this is expected local state when \`mdkg db verify\` passes`,
259
+ remediation: "Keep runtime DB and transient files ignored, run `mdkg db verify --json` if DB health is in question, and commit sealed state only by explicit repo policy.",
260
260
  refs: files,
261
261
  });
262
262
  }
@@ -386,7 +386,7 @@ function runSelectedGoalChecks(root, config, options) {
386
386
  ok: true,
387
387
  level: "warn",
388
388
  detail: selected.warning,
389
- remediation: "Run `mdkg goal select <goal-id>` or `mdkg goal clear`.",
389
+ remediation: "Run `mdkg goal clear --json` when no repo-local goal should be selected, or create/select a repo-local active goal only when work is continuing.",
390
390
  strictFail: true,
391
391
  }),
392
392
  ];
@@ -418,7 +418,7 @@ function runSelectedGoalChecks(root, config, options) {
418
418
  ok: true,
419
419
  level: "warn",
420
420
  detail: `selected goal ${selected.state.qid} is missing from the graph`,
421
- remediation: "Run `mdkg goal select <active-goal>` or `mdkg goal clear`.",
421
+ remediation: "Run `mdkg goal clear --json` when no repo-local goal should be selected, or `mdkg goal activate <goal-id> --json` for the next active repo-local goal.",
422
422
  refs: [selected.state.qid],
423
423
  strictFail: true,
424
424
  }),
@@ -433,7 +433,7 @@ function runSelectedGoalChecks(root, config, options) {
433
433
  ok: true,
434
434
  level: "warn",
435
435
  detail: `selected goal ${selected.state.qid} is achieved but still current`,
436
- remediation: "Run `mdkg goal select <active-goal>` or `mdkg goal clear`.",
436
+ remediation: "Run `mdkg goal clear --json` for an achieved current goal, or `mdkg goal activate <goal-id> --json` only when a new repo-local goal should become active. Root orchestrators should not mutate dirty child repos without approval.",
437
437
  refs: [selected.state.qid],
438
438
  strictFail: true,
439
439
  }),
@@ -68,6 +68,41 @@ function appendMissingHeadings(body, headings) {
68
68
  const prefix = trimmed.length > 0 ? `${trimmed}\n\n` : "";
69
69
  return `${prefix}${headings.map((heading) => `# ${heading}\n`).join("\n")}`;
70
70
  }
71
+ function countBuckets(values) {
72
+ const counts = new Map();
73
+ for (const value of values) {
74
+ if (!value) {
75
+ continue;
76
+ }
77
+ counts.set(value, (counts.get(value) ?? 0) + 1);
78
+ }
79
+ return Array.from(counts.entries())
80
+ .map(([key, count]) => ({ key, count }))
81
+ .sort((a, b) => b.count - a.count || a.key.localeCompare(b.key));
82
+ }
83
+ function normalizeLimit(limit) {
84
+ if (limit === undefined) {
85
+ return 50;
86
+ }
87
+ if (!Number.isInteger(limit) || limit < 0) {
88
+ throw new errors_1.ValidationError("--limit must be a non-negative integer");
89
+ }
90
+ return limit;
91
+ }
92
+ function buildHeadingsSummary(changes, limit) {
93
+ const effectiveLimit = limit === null || limit === undefined ? changes.length : limit;
94
+ const emitted = Math.min(changes.length, effectiveLimit);
95
+ return {
96
+ total: changes.length,
97
+ emitted,
98
+ truncated: emitted < changes.length,
99
+ omitted_count: changes.length - emitted,
100
+ limit: limit === undefined ? null : limit,
101
+ affected_file_count: new Set(changes.map((change) => change.path)).size,
102
+ by_node_type: countBuckets(changes.map((change) => change.type)),
103
+ top_paths: countBuckets(changes.map((change) => change.path)).slice(0, 25),
104
+ };
105
+ }
71
106
  function normalizeScalar(value) {
72
107
  return value.trim();
73
108
  }
@@ -348,13 +383,17 @@ function runHeadingFormatCommandLocked(options) {
348
383
  (0, atomic_1.atomicWriteFile)(change.filePath, change.content);
349
384
  }
350
385
  }
386
+ const publicChanges = changes.map(({ filePath: _filePath, content: _content, ...change }) => change);
387
+ const summaryLimit = options.summary ? normalizeLimit(options.limit) : undefined;
388
+ const emittedChanges = options.summary ? publicChanges.slice(0, summaryLimit) : publicChanges;
351
389
  const receipt = {
352
390
  action: "format.headings",
353
391
  ok: true,
354
392
  dry_run: !apply,
355
393
  applied: apply,
356
394
  changed_count: changes.length,
357
- changes: changes.map(({ filePath: _filePath, content: _content, ...change }) => change),
395
+ summary: buildHeadingsSummary(publicChanges, summaryLimit),
396
+ changes: emittedChanges,
358
397
  };
359
398
  if (options.json) {
360
399
  console.log(JSON.stringify(receipt, null, 2));
@@ -268,6 +268,12 @@ function runHandoffCreateCommand(options) {
268
268
  },
269
269
  output_path: outPath ? path_1.default.relative(options.root, outPath).split(path_1.default.sep).join("/") : null,
270
270
  content_sha256: contentHash,
271
+ warning_count: warnings.length + buildResult.warnings.length,
272
+ warnings: [...warnings, ...buildResult.warnings],
273
+ index_warning_count: warnings.length,
274
+ index_warnings: warnings,
275
+ pack_warning_count: buildResult.warnings.length,
276
+ pack_warnings: buildResult.warnings,
271
277
  raw_marker_warning_count: rawWarnings.length,
272
278
  raw_marker_warnings: rawWarnings,
273
279
  latest_checkpoint_qid: buildResult.pack.meta.latest_checkpoint_qid ?? null,