mdkg 0.3.0 → 0.3.2
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/CHANGELOG.md +90 -1
- package/CLI_COMMAND_MATRIX.md +1188 -0
- package/README.md +86 -5
- package/dist/cli.js +130 -10
- package/dist/command-contract.json +7473 -0
- package/dist/commands/doctor.js +370 -86
- package/dist/commands/fix.js +934 -0
- package/dist/commands/format.js +8 -2
- package/dist/commands/goal.js +1 -1
- package/dist/commands/next.js +2 -2
- package/dist/commands/skill.js +13 -3
- package/dist/commands/skill_support.js +3 -3
- package/dist/commands/status.js +270 -0
- package/dist/commands/subgraph.js +300 -0
- package/dist/commands/task.js +2 -2
- package/dist/commands/validate.js +12 -1
- package/dist/commands/workspace.js +19 -7
- package/dist/graph/goal_scope.js +1 -1
- package/dist/graph/node.js +2 -1
- package/dist/init/CLI_COMMAND_MATRIX.md +20 -2
- package/dist/init/README.md +35 -2
- package/dist/init/core/rule-5-release-and-versioning.md +13 -4
- package/dist/init/init-manifest.json +9 -4
- package/dist/init/templates/default/spike.md +81 -0
- package/dist/pack/order.js +3 -2
- package/dist/util/argparse.js +1 -0
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ mdkg stays deliberately boring:
|
|
|
14
14
|
- first-class rebuildable SQLite cache through built-in `node:sqlite`
|
|
15
15
|
- no daemon, hosted index, or vector DB
|
|
16
16
|
|
|
17
|
-
Current package version in source: `0.
|
|
17
|
+
Current package version in source: `0.3.1`
|
|
18
18
|
|
|
19
19
|
mdkg is still pre-v1 public alpha software. The public package is usable, but graph, cache, bundle, and DAL contracts may continue to change quickly while the project converges on a stable v1 surface.
|
|
20
20
|
|
|
@@ -48,10 +48,16 @@ Initialize mdkg in a repo:
|
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
50
|
mdkg init --agent
|
|
51
|
+
mdkg index
|
|
51
52
|
```
|
|
52
53
|
|
|
53
54
|
This is the canonical AI-agent bootstrap path. It creates `.mdkg/`, `AGENT_START.md`, `AGENTS.md`, `CLAUDE.md`, `llms.txt`, `CLI_COMMAND_MATRIX.md`, strict-node `SOUL.md` / `HUMAN.md`, the three default mdkg usage skills, `events.jsonl`, the skill registry, core pin updates, and mirrored skill folders under `.agents/skills/` and `.claude/skills/`. It also updates `.gitignore` / `.npmignore` by default. Use `--no-update-ignores` to opt out of those ignore-file updates.
|
|
54
55
|
|
|
56
|
+
Run `mdkg index` after a fresh init before using `mdkg status --json` or
|
|
57
|
+
`mdkg doctor --strict --json` as health gates. Init writes source scaffold
|
|
58
|
+
files; indexing creates the generated graph, skill, capability, subgraph, and
|
|
59
|
+
SQLite caches that strict doctor expects.
|
|
60
|
+
|
|
55
61
|
For a non-agent markdown graph only, run `mdkg init`.
|
|
56
62
|
|
|
57
63
|
Preview safe scaffold upgrades in an existing mdkg workspace:
|
|
@@ -86,7 +92,28 @@ mdkg goal next goal-1
|
|
|
86
92
|
mdkg goal evaluate goal-1 --json
|
|
87
93
|
```
|
|
88
94
|
|
|
89
|
-
Goal nodes capture a measurable end condition, recursive loop state, required skills, required checks, and completion evidence. They guide agent harnesses through repeated graph-backed progress, while tasks, bugs, tests, and features remain the concrete executable work units. In this release `mdkg goal evaluate` is report-only: it lists required checks and evidence state, but does not execute scripts.
|
|
95
|
+
Goal nodes capture a measurable end condition, recursive loop state, required skills, required checks, and completion evidence. They guide agent harnesses through repeated graph-backed progress, while tasks, bugs, tests, spikes, and features remain the concrete executable work units. In this release `mdkg goal evaluate` is report-only: it lists required checks and evidence state, but does not execute scripts.
|
|
96
|
+
|
|
97
|
+
Create a research spike when the next useful work is investigation, planning,
|
|
98
|
+
or grounding a future implementation:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
mdkg new spike "research mdkg.dev launch guide" --status todo --priority 1
|
|
102
|
+
mdkg task start spike-1
|
|
103
|
+
mdkg show spike-1
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Spikes are task-like work nodes, not autonomous research agents. mdkg does not
|
|
107
|
+
perform web search, execute research, create follow-up nodes, or generate
|
|
108
|
+
`SKILL.md` files automatically. Record sources, findings, tradeoffs,
|
|
109
|
+
recommendations, follow-up node ideas, and skill candidates in the spike body,
|
|
110
|
+
then create follow-up work intentionally:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
mdkg new task "write mdkg.dev quickstart guide" --parent spike-1 --status todo --priority 1
|
|
114
|
+
mdkg new test "validate mdkg.dev docs examples" --parent spike-1 --status todo --priority 1
|
|
115
|
+
mdkg new task "author mdkg.dev launch planning skill" --parent spike-1 --status todo --priority 2
|
|
116
|
+
```
|
|
90
117
|
|
|
91
118
|
Create an agent workflow document with a semantic portable id:
|
|
92
119
|
|
|
@@ -133,6 +160,8 @@ mdkg show child_repo:work.example
|
|
|
133
160
|
mdkg pack child_repo:work.example --dry-run --stats
|
|
134
161
|
mdkg capability resolve "child capability" --json
|
|
135
162
|
mdkg subgraph verify child_repo --json
|
|
163
|
+
mdkg subgraph audit child_repo --target .mdkg/subgraphs --json
|
|
164
|
+
mdkg subgraph upgrade-plan child_repo --json
|
|
136
165
|
```
|
|
137
166
|
|
|
138
167
|
When the child repo is available under a configured root-relative `source_path`, refresh the root-owned bundle snapshot explicitly:
|
|
@@ -142,6 +171,8 @@ mdkg subgraph sync child_repo --dry-run --json
|
|
|
142
171
|
mdkg subgraph sync child_repo --json
|
|
143
172
|
```
|
|
144
173
|
|
|
174
|
+
`audit` is read-only and reports source-path Git state, dirty tracked child files, bundle validity/freshness, root-owned bundle-path safety, optional materialized-target marker safety, and count-only capability summaries. `upgrade-plan` is also read-only, returns `apply_supported: false`, and proposes safe sync/verify/materialize next steps without writing bundles or child files.
|
|
175
|
+
|
|
145
176
|
`sync` inspects the child Git repo, refuses dirty tracked changes by default, builds the configured private/public bundle into the root-owned source path, verifies it, and records `<branch>@<sha>` in `source_repo`. It never commits, pulls, pushes, checks out, resets, or mutates child mdkg Markdown. Use `--allow-dirty` only when the dirty state is intentional and must be recorded in the receipt.
|
|
146
177
|
|
|
147
178
|
Generate a local read-only inspection tree when humans need to browse extracted child graph files:
|
|
@@ -246,7 +277,7 @@ The root docs below are the canonical fast-start set for humans and agents:
|
|
|
246
277
|
mdkg lives under a hidden root directory:
|
|
247
278
|
- `.mdkg/core/` rules and pinned docs
|
|
248
279
|
- `.mdkg/design/` product, design, and decision docs
|
|
249
|
-
- `.mdkg/work/` tasks, bugs, tests, epics, checkpoints
|
|
280
|
+
- `.mdkg/work/` tasks, bugs, tests, spikes, epics, checkpoints
|
|
250
281
|
- `.mdkg/templates/` templates used by `mdkg new`
|
|
251
282
|
- `.mdkg/skills/` Agent Skills packages
|
|
252
283
|
- `.mdkg/archive/` sidecar metadata plus deterministic compressed source/artifact caches
|
|
@@ -277,6 +308,8 @@ These are the commands new users and agents should learn first:
|
|
|
277
308
|
- `mdkg goal`
|
|
278
309
|
- `mdkg task`
|
|
279
310
|
- `mdkg validate`
|
|
311
|
+
- `mdkg status`
|
|
312
|
+
- `mdkg fix`
|
|
280
313
|
|
|
281
314
|
Advanced / maintenance commands still exist, but they are not the first-run story:
|
|
282
315
|
- `mdkg event`
|
|
@@ -284,9 +317,34 @@ Advanced / maintenance commands still exist, but they are not the first-run stor
|
|
|
284
317
|
- `mdkg index`
|
|
285
318
|
- `mdkg guide`
|
|
286
319
|
- `mdkg format`
|
|
287
|
-
- `mdkg doctor`
|
|
320
|
+
- `mdkg doctor --strict --json`
|
|
321
|
+
- `mdkg fix plan --json`
|
|
288
322
|
- `mdkg workspace`
|
|
289
323
|
|
|
324
|
+
## Operator health
|
|
325
|
+
|
|
326
|
+
Use `mdkg status --json` for a read-only operator summary before mutating a
|
|
327
|
+
repo. It reports package/release state, Git cleanliness, graph validity,
|
|
328
|
+
selected-goal state, project DB verification state, and generated cache
|
|
329
|
+
freshness without rebuilding indexes, running migrations, repairing files, or
|
|
330
|
+
changing selected-goal state.
|
|
331
|
+
|
|
332
|
+
Use `mdkg doctor --strict --json` when a CI job or agent needs actionable
|
|
333
|
+
typed checks. Strict doctor keeps the existing diagnostic command read-only and
|
|
334
|
+
adds stable check fields: `id`, `status`, `severity`, `message`,
|
|
335
|
+
`remediation`, and optional `refs`. Strict mode fails on invalid graph state,
|
|
336
|
+
stale generated graph/capability cache state, stale or achieved selected-goal
|
|
337
|
+
state, and enabled project DB verification failures. Warnings such as dirty
|
|
338
|
+
runtime DB files, archive size guidance, and bundle handoff guidance remain
|
|
339
|
+
warnings unless their underlying check fails.
|
|
340
|
+
|
|
341
|
+
Use `mdkg fix plan --json` when you want repair guidance without mutation. It
|
|
342
|
+
emits a receipt-shaped plan for generated index/cache repair, missing graph
|
|
343
|
+
references, and duplicate local ids. Planned changes include affected paths,
|
|
344
|
+
risk, reason codes, command hints, and `apply_supported: false`. `fix apply` is
|
|
345
|
+
not exposed; apply behavior is deferred until the dry-run plan contract has
|
|
346
|
+
enough evidence.
|
|
347
|
+
|
|
290
348
|
## Skills
|
|
291
349
|
|
|
292
350
|
mdkg supports Agent Skills as procedural memory.
|
|
@@ -403,12 +461,35 @@ as sealed state.
|
|
|
403
461
|
|
|
404
462
|
Goal nodes are durable recursive objective contracts. Use `mdkg new goal "<objective>"` when a human or agent needs to keep working across multiple concrete nodes until a measurable end condition is achieved.
|
|
405
463
|
|
|
406
|
-
`goal` is work-like but distinct from `task`: it can have status, priority, graph links, skills, explicit `scope_refs`, and structured goal fields, but normal `mdkg next` does not select goals. Use `mdkg goal select <goal-id>` once, then `mdkg goal next` to choose the next local feature, task, bug, or
|
|
464
|
+
`goal` is work-like but distinct from `task`: it can have status, priority, graph links, skills, explicit `scope_refs`, and structured goal fields, but normal `mdkg next` does not select goals. Use `mdkg goal select <goal-id>` once, then `mdkg goal next` to choose the next local feature, task, bug, test, or spike inside that goal. `mdkg goal next <goal-id>` remains available for explicit selection. Epics organize goal scope recursively but are not returned as executable work.
|
|
407
465
|
|
|
408
466
|
Use `mdkg goal claim [goal-id] <work-id>` to durably set `active_node` after choosing the next scoped item. `goal next` is read-only. Use `mdkg goal pause|resume|done` to update goal state after review.
|
|
409
467
|
|
|
410
468
|
Required checks are stored as report-only guidance. Agents should run the checks themselves, record evidence in the goal or active work item, then use `mdkg goal evaluate` to summarize the current evidence state. During normal goal execution, skill improvements should be recorded as improvement candidates or proposal nodes; edit `SKILL.md` files only when the active node is explicit skill-maintenance work.
|
|
411
469
|
|
|
470
|
+
## Research spikes
|
|
471
|
+
|
|
472
|
+
Spikes are first-class actionable work nodes for research and planning. Use
|
|
473
|
+
`mdkg new spike "<question>"` when the right output is a documented
|
|
474
|
+
recommendation, not code. They share the existing task lifecycle:
|
|
475
|
+
|
|
476
|
+
```bash
|
|
477
|
+
mdkg new spike "research queue-backed materializer UX" --status todo --priority 1
|
|
478
|
+
mdkg task start spike-1
|
|
479
|
+
mdkg task update spike-1 --status review --add-refs task-250
|
|
480
|
+
mdkg task done spike-1
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
The default spike template includes sections for research question, context,
|
|
484
|
+
search plan, findings, options and tradeoffs, recommendation, follow-up nodes,
|
|
485
|
+
skill candidates, data-structure and algorithm notes, UX notes, security notes,
|
|
486
|
+
mdkg.dev launch implications, and evidence/sources.
|
|
487
|
+
|
|
488
|
+
Spikes deliberately do not expose a `mdkg spike ...` namespace in this release,
|
|
489
|
+
do not run browser or web-search tools, do not create tasks/tests/goals, and do
|
|
490
|
+
not write `SKILL.md` files. They make the research output reviewable so humans
|
|
491
|
+
or agents can intentionally create the next nodes with normal mdkg commands.
|
|
492
|
+
|
|
412
493
|
## Agent workflow files
|
|
413
494
|
|
|
414
495
|
mdkg recognizes a small set of canonical agent workflow documents:
|
package/dist/cli.js
CHANGED
|
@@ -18,6 +18,8 @@ const next_1 = require("./commands/next");
|
|
|
18
18
|
const validate_1 = require("./commands/validate");
|
|
19
19
|
const format_1 = require("./commands/format");
|
|
20
20
|
const doctor_1 = require("./commands/doctor");
|
|
21
|
+
const status_1 = require("./commands/status");
|
|
22
|
+
const fix_1 = require("./commands/fix");
|
|
21
23
|
const db_1 = require("./commands/db");
|
|
22
24
|
const capability_1 = require("./commands/capability");
|
|
23
25
|
const spec_1 = require("./commands/spec");
|
|
@@ -67,12 +69,14 @@ function printUsage(log) {
|
|
|
67
69
|
log(" spec List, show, and validate optional SPEC.md capability records");
|
|
68
70
|
log(" archive Add, list, show, verify, and compress archive sidecars");
|
|
69
71
|
log(" bundle Create, list, show, and verify full graph snapshot bundles");
|
|
70
|
-
log(" subgraph Register, sync, materialize, and verify read-only child graph snapshots");
|
|
72
|
+
log(" subgraph Register, audit, plan, sync, materialize, and verify read-only child graph snapshots");
|
|
71
73
|
log(" work Create and update work contracts, orders, receipts, and artifacts");
|
|
72
74
|
log(" goal Inspect and advance recursive goal nodes");
|
|
73
75
|
log(" task Start, update, and complete task-like nodes");
|
|
74
76
|
log(" next Suggest the next work item");
|
|
75
77
|
log(" validate Validate frontmatter + graph");
|
|
78
|
+
log(" status Show read-only operator health summary");
|
|
79
|
+
log(" fix Plan read-only repairs with receipt-shaped JSON");
|
|
76
80
|
log("\nAdvanced / maintenance commands:");
|
|
77
81
|
log(" db Project database and index-cache commands");
|
|
78
82
|
log(" event Enable or append episodic event logs");
|
|
@@ -132,7 +136,7 @@ function printNewHelp(log) {
|
|
|
132
136
|
log("Usage:");
|
|
133
137
|
log(' mdkg new <type> "<title>" [options] [--json]');
|
|
134
138
|
log("\nTypes:");
|
|
135
|
-
log(" rule prd edd dec prop goal epic feat task bug checkpoint test");
|
|
139
|
+
log(" rule prd edd dec prop goal epic feat task bug spike checkpoint test");
|
|
136
140
|
log("\nAgent workflow file types:");
|
|
137
141
|
log(" spec work work_order receipt feedback dispute proposal");
|
|
138
142
|
log(" Use --id <portable-id> with these types for semantic ids like agent.image-worker.");
|
|
@@ -153,6 +157,9 @@ function printNewHelp(log) {
|
|
|
153
157
|
log(" --owners <owner,owner,...> Owners");
|
|
154
158
|
log("\nNotes:");
|
|
155
159
|
log(" spec/work scaffold as validation-clean docs; relational workflow docs need real refs.");
|
|
160
|
+
log(" spike creates actionable research/planning work; use `mdkg task ...` for lifecycle.");
|
|
161
|
+
log(" record spike research evidence by editing the Markdown body sections.");
|
|
162
|
+
log(" spikes do not run web search, create follow-up nodes, generate SKILL.md, or expose `mdkg spike ...`.");
|
|
156
163
|
printGlobalOptions(log);
|
|
157
164
|
}
|
|
158
165
|
function printGuideHelp(log) {
|
|
@@ -514,7 +521,7 @@ function printBundleHelp(log, subcommand) {
|
|
|
514
521
|
switch ((subcommand ?? "").toLowerCase()) {
|
|
515
522
|
case "import":
|
|
516
523
|
log("Usage:");
|
|
517
|
-
log(" mdkg subgraph add/list/show/rm/enable/disable/verify/refresh/sync/materialize ...");
|
|
524
|
+
log(" mdkg subgraph add/list/show/rm/enable/disable/verify/refresh/audit/upgrade-plan/sync/materialize ...");
|
|
518
525
|
log("\n`mdkg bundle import` has been replaced by `mdkg subgraph`.");
|
|
519
526
|
break;
|
|
520
527
|
case "create":
|
|
@@ -582,6 +589,20 @@ function printSubgraphHelp(log, subcommand) {
|
|
|
582
589
|
log("Usage:");
|
|
583
590
|
log(" mdkg subgraph refresh [alias|--all] [--json]");
|
|
584
591
|
break;
|
|
592
|
+
case "audit":
|
|
593
|
+
log("Usage:");
|
|
594
|
+
log(" mdkg subgraph audit [alias|--all] [--target <path>] [--json]");
|
|
595
|
+
log("\nNotes:");
|
|
596
|
+
log(" - read-only audit for configured bundle health, source_path Git state, root-owned bundle paths, and optional materialize target safety");
|
|
597
|
+
log(" - exits nonzero only for error-level safety failures; warning-level drift stays in the receipt");
|
|
598
|
+
break;
|
|
599
|
+
case "upgrade-plan":
|
|
600
|
+
log("Usage:");
|
|
601
|
+
log(" mdkg subgraph upgrade-plan [alias|--all] [--json]");
|
|
602
|
+
log("\nNotes:");
|
|
603
|
+
log(" - read-only downstream upgrade planning receipt; apply_supported is false");
|
|
604
|
+
log(" - plans safe sync/verify/materialize next steps without mutating child repos or root bundles");
|
|
605
|
+
break;
|
|
585
606
|
case "sync":
|
|
586
607
|
log("Usage:");
|
|
587
608
|
log(" mdkg subgraph sync [alias|--all] [--dry-run] [--allow-dirty] [--json]");
|
|
@@ -600,12 +621,15 @@ function printSubgraphHelp(log, subcommand) {
|
|
|
600
621
|
log(" mdkg subgraph disable <alias> [--json]");
|
|
601
622
|
log(" mdkg subgraph verify [alias|--all] [--json]");
|
|
602
623
|
log(" mdkg subgraph refresh [alias|--all] [--json]");
|
|
624
|
+
log(" mdkg subgraph audit [alias|--all] [--target <path>] [--json]");
|
|
625
|
+
log(" mdkg subgraph upgrade-plan [alias|--all] [--json]");
|
|
603
626
|
log(" mdkg subgraph sync [alias|--all] [--dry-run] [--allow-dirty] [--json]");
|
|
604
627
|
log(" mdkg subgraph materialize [alias|--all] --target <path> [--clean] [--gitignore] [--json]");
|
|
605
628
|
log("\nNotes:");
|
|
606
629
|
log(" - subgraphs are read-only graph views backed by explicit bundle snapshots");
|
|
607
630
|
log(" - default permissions are read-only and default freshness is 3600 seconds");
|
|
608
631
|
log(" - refresh reloads configured bundle sources only; it does not build child bundles");
|
|
632
|
+
log(" - audit and upgrade-plan are read-only safety receipts for downstream orchestration");
|
|
609
633
|
log(" - sync builds root-owned bundles from clean configured child source_path repos");
|
|
610
634
|
log(" - materialize extracts bundle contents into generated inspection trees");
|
|
611
635
|
}
|
|
@@ -669,7 +693,7 @@ function printTaskHelp(log, subcommand) {
|
|
|
669
693
|
log("Usage:");
|
|
670
694
|
log(' mdkg task start <id-or-qid> [--ws <alias>] [--run-id <id>] [--note "<text>"] [--json]');
|
|
671
695
|
log("\nWhen to use:");
|
|
672
|
-
log(" Move a task, bug, or
|
|
696
|
+
log(" Move a task-like node (feat, task, bug, test, or spike) into progress as a structured state change.");
|
|
673
697
|
log(" If `events.jsonl` is missing, mdkg prints a short reminder about `mdkg event enable`.");
|
|
674
698
|
printGlobalOptions(log);
|
|
675
699
|
return;
|
|
@@ -698,7 +722,8 @@ function printTaskHelp(log, subcommand) {
|
|
|
698
722
|
log(" mdkg task update <id-or-qid> [options] [--json]");
|
|
699
723
|
log(' mdkg task done <id-or-qid> [--checkpoint "<title>"] [options] [--json]');
|
|
700
724
|
log("\nNotes:");
|
|
701
|
-
log(" `mdkg task ...` only supports feat, task, bug, and
|
|
725
|
+
log(" `mdkg task ...` only supports feat, task, bug, test, and spike nodes.");
|
|
726
|
+
log(" Spikes use this lifecycle; there is no separate `mdkg spike ...` command family.");
|
|
702
727
|
log(" Feat and epic closeout remain checkpoint-first guidance plus manual parent updates.");
|
|
703
728
|
printGlobalOptions(log);
|
|
704
729
|
}
|
|
@@ -716,7 +741,7 @@ function printGoalHelp(log, subcommand) {
|
|
|
716
741
|
log("Usage:");
|
|
717
742
|
log(" mdkg goal next [goal-id-or-qid] [--ws <alias>] [--json]");
|
|
718
743
|
log("\nWhen to use:");
|
|
719
|
-
log(" Select the next local feature, task, bug, or
|
|
744
|
+
log(" Select the next local feature, task, bug, test, or spike inside a recursive goal without mutating active_node.");
|
|
720
745
|
log(" If no goal id is supplied, mdkg uses the selected goal or the unique active goal.");
|
|
721
746
|
printGlobalOptions(log);
|
|
722
747
|
return;
|
|
@@ -776,7 +801,7 @@ function printGoalHelp(log, subcommand) {
|
|
|
776
801
|
log(" mdkg goal clear [--json]");
|
|
777
802
|
log(" mdkg goal pause|resume|done <goal-id-or-qid> [--json]");
|
|
778
803
|
log("\nNotes:");
|
|
779
|
-
log(" - goals orchestrate recursive progress; features, tasks, bugs, and
|
|
804
|
+
log(" - goals orchestrate recursive progress; features, tasks, bugs, tests, and spikes are iterable work units");
|
|
780
805
|
log(" - `mdkg goal next` is read-only; use `mdkg goal claim` to update active_node");
|
|
781
806
|
log(" - goal evaluation is report-only and never executes required_checks");
|
|
782
807
|
log(" - subgraph goal qids are read-only; update the source workspace instead");
|
|
@@ -824,6 +849,47 @@ function printValidateHelp(log) {
|
|
|
824
849
|
log(" mdkg validate [--out <path>] [--quiet] [--json]");
|
|
825
850
|
printGlobalOptions(log);
|
|
826
851
|
}
|
|
852
|
+
function printStatusHelp(log) {
|
|
853
|
+
log("Usage:");
|
|
854
|
+
log(" mdkg status [--json]");
|
|
855
|
+
log("\nChecks:");
|
|
856
|
+
log(" - release/package and CHANGELOG summary");
|
|
857
|
+
log(" - git branch, dirty state, and upstream ahead/behind counts");
|
|
858
|
+
log(" - graph index load, validation errors, and generated cache freshness");
|
|
859
|
+
log(" - selected goal existence, achieved state, and active node");
|
|
860
|
+
log(" - project DB enabled/verify summary");
|
|
861
|
+
log("\nBoundaries:");
|
|
862
|
+
log(" - read-only operator summary; does not rebuild indexes or repair files");
|
|
863
|
+
log(" - use `mdkg doctor` for diagnostic detail and future strict check IDs");
|
|
864
|
+
log("\nOptions:");
|
|
865
|
+
log(" --json Emit machine-readable JSON output");
|
|
866
|
+
printGlobalOptions(log);
|
|
867
|
+
}
|
|
868
|
+
function printFixHelp(log, subcommand) {
|
|
869
|
+
switch ((subcommand ?? "").toLowerCase()) {
|
|
870
|
+
case "plan":
|
|
871
|
+
log("Usage:");
|
|
872
|
+
log(" mdkg fix plan [--family index|refs|ids|all] [--target <id-or-qid>] [--json]");
|
|
873
|
+
log("\nBoundaries:");
|
|
874
|
+
log(" - read-only repair planning; writes no files and does not rebuild indexes");
|
|
875
|
+
log(" - emits a deterministic receipt-shaped JSON plan with paths, risks, and reason codes");
|
|
876
|
+
log(" - initial families are index/cache, graph refs, and duplicate ids");
|
|
877
|
+
log(" - `fix apply` is intentionally not available in this release slice");
|
|
878
|
+
log("\nOptions:");
|
|
879
|
+
log(" --family <family> Select index, refs, ids, or all (default all)");
|
|
880
|
+
log(" --target <id-or-qid> Optional node target for family planners");
|
|
881
|
+
log(" --json Emit machine-readable JSON output");
|
|
882
|
+
printGlobalOptions(log);
|
|
883
|
+
return;
|
|
884
|
+
default:
|
|
885
|
+
log("Usage:");
|
|
886
|
+
log(" mdkg fix plan [--family index|refs|ids|all] [--target <id-or-qid>] [--json]");
|
|
887
|
+
log("\nNotes:");
|
|
888
|
+
log(" - fix planning is dry-run only and writes nothing");
|
|
889
|
+
log(" - apply behavior is deferred until the receipt contract is proven");
|
|
890
|
+
printGlobalOptions(log);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
827
893
|
function printFormatHelp(log) {
|
|
828
894
|
log("Usage:");
|
|
829
895
|
log(" mdkg format");
|
|
@@ -831,10 +897,12 @@ function printFormatHelp(log) {
|
|
|
831
897
|
}
|
|
832
898
|
function printDoctorHelp(log) {
|
|
833
899
|
log("Usage:");
|
|
834
|
-
log(" mdkg doctor [--json]");
|
|
900
|
+
log(" mdkg doctor [--strict] [--json]");
|
|
835
901
|
log("\nChecks:");
|
|
836
902
|
log(" - Node.js version compatibility");
|
|
837
903
|
log(" - mdkg repo root + .mdkg/config.json");
|
|
904
|
+
log(" - Selected-goal stale or achieved state");
|
|
905
|
+
log(" - Project DB verification when enabled");
|
|
838
906
|
log(" - Template schema availability");
|
|
839
907
|
log(" - Archive sidecar storage hygiene");
|
|
840
908
|
log(" - Bundle snapshot storage guidance");
|
|
@@ -843,6 +911,7 @@ function printDoctorHelp(log) {
|
|
|
843
911
|
log(" - Capability cache load/rebuild health");
|
|
844
912
|
log(" - SQLite cache health when enabled");
|
|
845
913
|
log("\nOptions:");
|
|
914
|
+
log(" --strict Fail on stale selected-goal, DB, and generated cache health issues");
|
|
846
915
|
log(" --json Emit machine-readable JSON output");
|
|
847
916
|
printGlobalOptions(log);
|
|
848
917
|
}
|
|
@@ -924,6 +993,12 @@ function printCommandHelp(log, command, subcommand) {
|
|
|
924
993
|
case "validate":
|
|
925
994
|
printValidateHelp(log);
|
|
926
995
|
return;
|
|
996
|
+
case "status":
|
|
997
|
+
printStatusHelp(log);
|
|
998
|
+
return;
|
|
999
|
+
case "fix":
|
|
1000
|
+
printFixHelp(log, subcommand);
|
|
1001
|
+
return;
|
|
927
1002
|
case "format":
|
|
928
1003
|
printFormatHelp(log);
|
|
929
1004
|
return;
|
|
@@ -1648,6 +1723,25 @@ function runSubgraphSubcommand(parsed, root) {
|
|
|
1648
1723
|
(0, subgraph_1.runSubgraphRefreshCommand)({ root, alias, all, json });
|
|
1649
1724
|
return 0;
|
|
1650
1725
|
}
|
|
1726
|
+
case "audit": {
|
|
1727
|
+
if (parsed.positionals.length > 3) {
|
|
1728
|
+
throw new errors_1.UsageError("subgraph audit accepts at most one alias");
|
|
1729
|
+
}
|
|
1730
|
+
const alias = parsed.positionals[2];
|
|
1731
|
+
const all = parseBooleanFlag("--all", parsed.flags["--all"]);
|
|
1732
|
+
const target = requireFlagValue("--target", parsed.flags["--target"]);
|
|
1733
|
+
(0, subgraph_1.runSubgraphAuditCommand)({ root, alias, all, target, json });
|
|
1734
|
+
return 0;
|
|
1735
|
+
}
|
|
1736
|
+
case "upgrade-plan": {
|
|
1737
|
+
if (parsed.positionals.length > 3) {
|
|
1738
|
+
throw new errors_1.UsageError("subgraph upgrade-plan accepts at most one alias");
|
|
1739
|
+
}
|
|
1740
|
+
const alias = parsed.positionals[2];
|
|
1741
|
+
const all = parseBooleanFlag("--all", parsed.flags["--all"]);
|
|
1742
|
+
(0, subgraph_1.runSubgraphUpgradePlanCommand)({ root, alias, all, json });
|
|
1743
|
+
return 0;
|
|
1744
|
+
}
|
|
1651
1745
|
case "sync": {
|
|
1652
1746
|
if (parsed.positionals.length > 3) {
|
|
1653
1747
|
throw new errors_1.UsageError("subgraph sync accepts at most one alias");
|
|
@@ -1675,7 +1769,7 @@ function runSubgraphSubcommand(parsed, root) {
|
|
|
1675
1769
|
return 0;
|
|
1676
1770
|
}
|
|
1677
1771
|
default:
|
|
1678
|
-
throw new errors_1.UsageError("subgraph requires add/list/show/rm/enable/disable/verify/refresh/sync/materialize");
|
|
1772
|
+
throw new errors_1.UsageError("subgraph requires add/list/show/rm/enable/disable/verify/refresh/audit/upgrade-plan/sync/materialize");
|
|
1679
1773
|
}
|
|
1680
1774
|
}
|
|
1681
1775
|
function runWorkSubcommand(parsed, root) {
|
|
@@ -2530,6 +2624,31 @@ function runCommand(parsed, root, runtime) {
|
|
|
2530
2624
|
(0, validate_1.runValidateCommand)({ root, out, quiet, json });
|
|
2531
2625
|
return 0;
|
|
2532
2626
|
}
|
|
2627
|
+
case "status": {
|
|
2628
|
+
if (parsed.positionals.length > 1) {
|
|
2629
|
+
throw new errors_1.UsageError("status does not accept positional arguments");
|
|
2630
|
+
}
|
|
2631
|
+
const json = parseBooleanFlag("--json", parsed.flags["--json"]);
|
|
2632
|
+
(0, status_1.runStatusCommand)({ root, json });
|
|
2633
|
+
return 0;
|
|
2634
|
+
}
|
|
2635
|
+
case "fix": {
|
|
2636
|
+
const sub = (parsed.positionals[1] ?? "").toLowerCase();
|
|
2637
|
+
if (!sub) {
|
|
2638
|
+
throw new errors_1.UsageError("fix requires a subcommand");
|
|
2639
|
+
}
|
|
2640
|
+
if (sub !== "plan") {
|
|
2641
|
+
throw new errors_1.UsageError(`unknown fix subcommand: ${sub}`);
|
|
2642
|
+
}
|
|
2643
|
+
if (parsed.positionals.length > 2) {
|
|
2644
|
+
throw new errors_1.UsageError("fix plan does not accept positional arguments");
|
|
2645
|
+
}
|
|
2646
|
+
const family = requireFlagValue("--family", parsed.flags["--family"]);
|
|
2647
|
+
const target = requireFlagValue("--target", parsed.flags["--target"]);
|
|
2648
|
+
const json = parseBooleanFlag("--json", parsed.flags["--json"]);
|
|
2649
|
+
(0, fix_1.runFixPlanCommand)({ root, family, target, json });
|
|
2650
|
+
return 0;
|
|
2651
|
+
}
|
|
2533
2652
|
case "format":
|
|
2534
2653
|
if (parsed.positionals.length > 1) {
|
|
2535
2654
|
throw new errors_1.UsageError("format does not accept positional arguments");
|
|
@@ -2543,7 +2662,8 @@ function runCommand(parsed, root, runtime) {
|
|
|
2543
2662
|
const noCache = parseBooleanFlag("--no-cache", parsed.flags["--no-cache"]);
|
|
2544
2663
|
const noReindex = parseBooleanFlag("--no-reindex", parsed.flags["--no-reindex"]);
|
|
2545
2664
|
const json = parseBooleanFlag("--json", parsed.flags["--json"]);
|
|
2546
|
-
|
|
2665
|
+
const strict = parseBooleanFlag("--strict", parsed.flags["--strict"]);
|
|
2666
|
+
(0, doctor_1.runDoctorCommand)({ root, noCache, noReindex, json, strict });
|
|
2547
2667
|
return 0;
|
|
2548
2668
|
}
|
|
2549
2669
|
default:
|