mdkg 0.1.3 → 0.1.5
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 +45 -1
- package/README.md +34 -10
- package/dist/cli.js +354 -87
- package/dist/commands/bundle.js +7 -7
- package/dist/commands/capability.js +118 -4
- package/dist/commands/doctor.js +15 -15
- package/dist/commands/goal.js +548 -0
- package/dist/commands/index.js +1 -1
- package/dist/commands/init.js +1 -0
- package/dist/commands/list.js +1 -1
- package/dist/commands/new.js +7 -1
- package/dist/commands/next.js +1 -1
- package/dist/commands/node_card.js +1 -1
- package/dist/commands/pack.js +1 -1
- package/dist/commands/search.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/subgraph.js +312 -0
- package/dist/commands/task.js +1 -1
- package/dist/commands/upgrade.js +54 -7
- package/dist/commands/validate.js +39 -7
- package/dist/commands/work.js +1 -1
- package/dist/core/config.js +95 -39
- package/dist/graph/frontmatter.js +8 -0
- package/dist/graph/goal_scope.js +127 -0
- package/dist/graph/index_cache.js +12 -12
- package/dist/graph/indexer.js +1 -1
- package/dist/graph/node.js +80 -1
- package/dist/graph/reindex.js +6 -6
- package/dist/graph/sqlite_index.js +6 -6
- package/dist/graph/{bundle_imports.js → subgraphs.js} +214 -140
- package/dist/graph/validate_graph.js +41 -0
- package/dist/graph/visibility.js +3 -3
- package/dist/init/AGENT_START.md +17 -1
- package/dist/init/CLI_COMMAND_MATRIX.md +43 -7
- package/dist/init/README.md +9 -8
- package/dist/init/config.json +1 -1
- package/dist/init/core/rule-3-cli-contract.md +56 -23
- package/dist/init/core/rule-4-repo-safety-and-ignores.md +7 -2
- package/dist/init/core/rule-6-templates-and-schemas.md +10 -1
- package/dist/init/init-manifest.json +20 -10
- package/dist/init/skills/default/pursue-mdkg-goal/SKILL.md +68 -0
- package/dist/init/skills/default/select-work-and-ground-context/SKILL.md +9 -7
- package/dist/init/skills/default/verify-close-and-checkpoint/SKILL.md +11 -10
- package/dist/init/templates/default/goal.md +91 -0
- package/dist/pack/order.js +2 -1
- package/dist/pack/pack.js +17 -0
- package/dist/util/argparse.js +2 -0
- package/package.json +8 -6
- package/dist/commands/bundle_import.js +0 -255
package/dist/cli.js
CHANGED
|
@@ -21,12 +21,13 @@ const doctor_1 = require("./commands/doctor");
|
|
|
21
21
|
const capability_1 = require("./commands/capability");
|
|
22
22
|
const archive_1 = require("./commands/archive");
|
|
23
23
|
const bundle_1 = require("./commands/bundle");
|
|
24
|
-
const
|
|
24
|
+
const subgraph_1 = require("./commands/subgraph");
|
|
25
25
|
const checkpoint_1 = require("./commands/checkpoint");
|
|
26
26
|
const init_1 = require("./commands/init");
|
|
27
27
|
const new_1 = require("./commands/new");
|
|
28
28
|
const guide_1 = require("./commands/guide");
|
|
29
29
|
const upgrade_1 = require("./commands/upgrade");
|
|
30
|
+
const goal_1 = require("./commands/goal");
|
|
30
31
|
const event_1 = require("./commands/event");
|
|
31
32
|
const skill_1 = require("./commands/skill");
|
|
32
33
|
const task_1 = require("./commands/task");
|
|
@@ -60,10 +61,12 @@ function printUsage(log) {
|
|
|
60
61
|
log(" search Search nodes by query");
|
|
61
62
|
log(" pack Generate a context pack");
|
|
62
63
|
log(" skill Create, list, show, search, and validate skills");
|
|
63
|
-
log(" capability List, search, and
|
|
64
|
+
log(" capability List, search, show, and resolve cached capability surfaces");
|
|
64
65
|
log(" archive Add, list, show, verify, and compress archive sidecars");
|
|
65
66
|
log(" bundle Create, list, show, and verify full graph snapshot bundles");
|
|
67
|
+
log(" subgraph Register and verify read-only child graph snapshots");
|
|
66
68
|
log(" work Create and update work contracts, orders, receipts, and artifacts");
|
|
69
|
+
log(" goal Inspect and advance recursive goal nodes");
|
|
67
70
|
log(" task Start, update, and complete task-like nodes");
|
|
68
71
|
log(" next Suggest the next work item");
|
|
69
72
|
log(" validate Validate frontmatter + graph");
|
|
@@ -125,7 +128,7 @@ function printNewHelp(log) {
|
|
|
125
128
|
log("Usage:");
|
|
126
129
|
log(' mdkg new <type> "<title>" [options] [--json]');
|
|
127
130
|
log("\nTypes:");
|
|
128
|
-
log(" rule prd edd dec prop epic feat task bug checkpoint test");
|
|
131
|
+
log(" rule prd edd dec prop goal epic feat task bug checkpoint test");
|
|
129
132
|
log("\nAgent workflow file types:");
|
|
130
133
|
log(" spec work work_order receipt feedback dispute proposal");
|
|
131
134
|
log(" Use --id <portable-id> with these types for semantic ids like agent.image-worker.");
|
|
@@ -171,7 +174,7 @@ function printIndexHelp(log) {
|
|
|
171
174
|
log(" - .mdkg/index/global.json");
|
|
172
175
|
log(" - .mdkg/index/skills.json");
|
|
173
176
|
log(" - .mdkg/index/capabilities.json");
|
|
174
|
-
log(" - .mdkg/index/
|
|
177
|
+
log(" - .mdkg/index/subgraphs.json when subgraphs are configured");
|
|
175
178
|
log(" - .mdkg/index/mdkg.sqlite when index.backend is sqlite");
|
|
176
179
|
printGlobalOptions(log);
|
|
177
180
|
}
|
|
@@ -322,14 +325,23 @@ function printCapabilityHelp(log, subcommand) {
|
|
|
322
325
|
log(" mdkg capability show <id-or-qid-or-slug> [--json]");
|
|
323
326
|
printGlobalOptions(log);
|
|
324
327
|
return;
|
|
328
|
+
case "resolve":
|
|
329
|
+
log("Usage:");
|
|
330
|
+
log(' mdkg capability resolve [query] [--requires <capability>] [--fresh-only] [--json]');
|
|
331
|
+
log("\nNotes:");
|
|
332
|
+
log(" Resolves local and subgraph capabilities with deterministic ranking.");
|
|
333
|
+
printGlobalOptions(log);
|
|
334
|
+
return;
|
|
325
335
|
default:
|
|
326
336
|
log("Usage:");
|
|
327
337
|
log(" mdkg capability list [--kind <kind>] [--visibility <level>] [--json]");
|
|
328
338
|
log(' mdkg capability search "<query>" [--kind <kind>] [--visibility <level>] [--json]');
|
|
329
339
|
log(" mdkg capability show <id-or-qid-or-slug> [--json]");
|
|
340
|
+
log(' mdkg capability resolve [query] [--requires <capability>] [--fresh-only] [--json]');
|
|
330
341
|
log("\nNotes:");
|
|
331
342
|
log(" Capability records are deterministic cache projections from Markdown.");
|
|
332
343
|
log(" Cached kinds: skill, spec, work, core, design.");
|
|
344
|
+
log(" Resolve includes read-only subgraph capability records when configured.");
|
|
333
345
|
printGlobalOptions(log);
|
|
334
346
|
}
|
|
335
347
|
}
|
|
@@ -375,12 +387,8 @@ function printBundleHelp(log, subcommand) {
|
|
|
375
387
|
switch ((subcommand ?? "").toLowerCase()) {
|
|
376
388
|
case "import":
|
|
377
389
|
log("Usage:");
|
|
378
|
-
log(" mdkg
|
|
379
|
-
log("
|
|
380
|
-
log(" mdkg bundle import rm <alias> [--json]");
|
|
381
|
-
log(" mdkg bundle import enable <alias> [--json]");
|
|
382
|
-
log(" mdkg bundle import disable <alias> [--json]");
|
|
383
|
-
log(" mdkg bundle import verify [alias|--all] [--json]");
|
|
390
|
+
log(" mdkg subgraph add/list/show/rm/enable/disable/verify/refresh ...");
|
|
391
|
+
log("\n`mdkg bundle import` has been replaced by `mdkg subgraph`.");
|
|
384
392
|
break;
|
|
385
393
|
case "create":
|
|
386
394
|
log("Usage:");
|
|
@@ -404,15 +412,66 @@ function printBundleHelp(log, subcommand) {
|
|
|
404
412
|
log(" mdkg bundle verify [bundle-path] [--json]");
|
|
405
413
|
log(" mdkg bundle show <bundle-path> [--json]");
|
|
406
414
|
log(" mdkg bundle list [--json]");
|
|
407
|
-
log(" mdkg bundle import add/list/rm/enable/disable/verify ...");
|
|
408
415
|
log("\nNotes:");
|
|
409
416
|
log(" - bundles are explicit full .mdkg graph snapshots, not task context packs");
|
|
410
|
-
log(" - bundle
|
|
417
|
+
log(" - use `mdkg subgraph ...` to register bundle snapshots as read-only planning views");
|
|
411
418
|
log(" - private is the default profile; public bundles fail closed on private refs");
|
|
412
419
|
log(" - .mdkg/bundles/ is commit-eligible when your repo tracks snapshot bundles");
|
|
413
420
|
}
|
|
414
421
|
printGlobalOptions(log);
|
|
415
422
|
}
|
|
423
|
+
function printSubgraphHelp(log, subcommand) {
|
|
424
|
+
switch ((subcommand ?? "").toLowerCase()) {
|
|
425
|
+
case "add":
|
|
426
|
+
log("Usage:");
|
|
427
|
+
log(" mdkg subgraph add <alias> <bundle-path> [--visibility private|internal|public] [--profile private|public] [--source-path <path>] [--source-repo <ref>] [--max-stale-seconds <seconds>] [--json]");
|
|
428
|
+
break;
|
|
429
|
+
case "list":
|
|
430
|
+
log("Usage:");
|
|
431
|
+
log(" mdkg subgraph list [--json]");
|
|
432
|
+
break;
|
|
433
|
+
case "show":
|
|
434
|
+
log("Usage:");
|
|
435
|
+
log(" mdkg subgraph show <alias> [--json]");
|
|
436
|
+
break;
|
|
437
|
+
case "rm":
|
|
438
|
+
case "remove":
|
|
439
|
+
log("Usage:");
|
|
440
|
+
log(" mdkg subgraph rm <alias> [--json]");
|
|
441
|
+
break;
|
|
442
|
+
case "enable":
|
|
443
|
+
log("Usage:");
|
|
444
|
+
log(" mdkg subgraph enable <alias> [--json]");
|
|
445
|
+
break;
|
|
446
|
+
case "disable":
|
|
447
|
+
log("Usage:");
|
|
448
|
+
log(" mdkg subgraph disable <alias> [--json]");
|
|
449
|
+
break;
|
|
450
|
+
case "verify":
|
|
451
|
+
log("Usage:");
|
|
452
|
+
log(" mdkg subgraph verify [alias|--all] [--json]");
|
|
453
|
+
break;
|
|
454
|
+
case "refresh":
|
|
455
|
+
log("Usage:");
|
|
456
|
+
log(" mdkg subgraph refresh [alias|--all] [--json]");
|
|
457
|
+
break;
|
|
458
|
+
default:
|
|
459
|
+
log("Usage:");
|
|
460
|
+
log(" mdkg subgraph add <alias> <bundle-path> [--visibility private|internal|public] [--profile private|public] [--source-path <path>] [--source-repo <ref>] [--max-stale-seconds <seconds>] [--json]");
|
|
461
|
+
log(" mdkg subgraph list [--json]");
|
|
462
|
+
log(" mdkg subgraph show <alias> [--json]");
|
|
463
|
+
log(" mdkg subgraph rm <alias> [--json]");
|
|
464
|
+
log(" mdkg subgraph enable <alias> [--json]");
|
|
465
|
+
log(" mdkg subgraph disable <alias> [--json]");
|
|
466
|
+
log(" mdkg subgraph verify [alias|--all] [--json]");
|
|
467
|
+
log(" mdkg subgraph refresh [alias|--all] [--json]");
|
|
468
|
+
log("\nNotes:");
|
|
469
|
+
log(" - subgraphs are read-only graph views backed by explicit bundle snapshots");
|
|
470
|
+
log(" - default permissions are read-only and default freshness is 3600 seconds");
|
|
471
|
+
log(" - refresh reloads configured bundle sources only; it does not build child bundles");
|
|
472
|
+
}
|
|
473
|
+
printGlobalOptions(log);
|
|
474
|
+
}
|
|
416
475
|
function printWorkHelp(log, subcommand) {
|
|
417
476
|
switch ((subcommand ?? "").toLowerCase()) {
|
|
418
477
|
case "contract":
|
|
@@ -444,7 +503,7 @@ function printWorkHelp(log, subcommand) {
|
|
|
444
503
|
log(" - production order, receipt, feedback, dispute, payment, ledger, marketplace inventory, fulfillment, and execution state remains canonical outside mdkg");
|
|
445
504
|
log(" - do not store raw secrets, credentials, live payment state, ledger mutations, or canonical marketplace state in work mirrors");
|
|
446
505
|
log(" - artifact:// refs identify external/runtime-managed artifacts; archive:// refs identify committed mdkg archive sidecars");
|
|
447
|
-
log(" - update and artifact commands accept local ids or local qids;
|
|
506
|
+
log(" - update and artifact commands accept local ids or local qids; subgraph qids are read-only");
|
|
448
507
|
}
|
|
449
508
|
printGlobalOptions(log);
|
|
450
509
|
}
|
|
@@ -488,6 +547,86 @@ function printTaskHelp(log, subcommand) {
|
|
|
488
547
|
printGlobalOptions(log);
|
|
489
548
|
}
|
|
490
549
|
}
|
|
550
|
+
function printGoalHelp(log, subcommand) {
|
|
551
|
+
switch ((subcommand ?? "").toLowerCase()) {
|
|
552
|
+
case "show":
|
|
553
|
+
log("Usage:");
|
|
554
|
+
log(" mdkg goal show <goal-id-or-qid> [--ws <alias>] [--json]");
|
|
555
|
+
log("\nWhen to use:");
|
|
556
|
+
log(" Inspect a goal condition, current goal state, active node, required skills, and required checks.");
|
|
557
|
+
printGlobalOptions(log);
|
|
558
|
+
return;
|
|
559
|
+
case "next":
|
|
560
|
+
log("Usage:");
|
|
561
|
+
log(" mdkg goal next [goal-id-or-qid] [--ws <alias>] [--json]");
|
|
562
|
+
log("\nWhen to use:");
|
|
563
|
+
log(" Select the next local feature, task, bug, or test inside a recursive goal without mutating active_node.");
|
|
564
|
+
log(" If no goal id is supplied, mdkg uses the selected goal or the unique active goal.");
|
|
565
|
+
printGlobalOptions(log);
|
|
566
|
+
return;
|
|
567
|
+
case "select":
|
|
568
|
+
log("Usage:");
|
|
569
|
+
log(" mdkg goal select <goal-id-or-qid> [--ws <alias>] [--json]");
|
|
570
|
+
log("\nWhen to use:");
|
|
571
|
+
log(" Store a local selected goal so `mdkg goal next` can omit the goal id.");
|
|
572
|
+
printGlobalOptions(log);
|
|
573
|
+
return;
|
|
574
|
+
case "current":
|
|
575
|
+
log("Usage:");
|
|
576
|
+
log(" mdkg goal current [--ws <alias>] [--json]");
|
|
577
|
+
log("\nWhen to use:");
|
|
578
|
+
log(" Inspect the selected goal or unique active goal fallback.");
|
|
579
|
+
printGlobalOptions(log);
|
|
580
|
+
return;
|
|
581
|
+
case "clear":
|
|
582
|
+
log("Usage:");
|
|
583
|
+
log(" mdkg goal clear [--json]");
|
|
584
|
+
log("\nWhen to use:");
|
|
585
|
+
log(" Remove local selected-goal state.");
|
|
586
|
+
printGlobalOptions(log);
|
|
587
|
+
return;
|
|
588
|
+
case "claim":
|
|
589
|
+
log("Usage:");
|
|
590
|
+
log(" mdkg goal claim <work-id-or-qid> [--ws <alias>] [--json]");
|
|
591
|
+
log(" mdkg goal claim <goal-id-or-qid> <work-id-or-qid> [--ws <alias>] [--json]");
|
|
592
|
+
log("\nWhen to use:");
|
|
593
|
+
log(" Write active_node explicitly after accepting a goal-scoped next item.");
|
|
594
|
+
printGlobalOptions(log);
|
|
595
|
+
return;
|
|
596
|
+
case "evaluate":
|
|
597
|
+
log("Usage:");
|
|
598
|
+
log(" mdkg goal evaluate <goal-id-or-qid> [--ws <alias>] [--json]");
|
|
599
|
+
log("\nNotes:");
|
|
600
|
+
log(" Evaluation is report-only; mdkg lists required checks but does not execute scripts.");
|
|
601
|
+
printGlobalOptions(log);
|
|
602
|
+
return;
|
|
603
|
+
case "pause":
|
|
604
|
+
case "resume":
|
|
605
|
+
case "done":
|
|
606
|
+
log("Usage:");
|
|
607
|
+
log(` mdkg goal ${subcommand} <goal-id-or-qid> [--ws <alias>] [--json]`);
|
|
608
|
+
log("\nWhen to use:");
|
|
609
|
+
log(" Update durable goal state after agent or human review.");
|
|
610
|
+
printGlobalOptions(log);
|
|
611
|
+
return;
|
|
612
|
+
default:
|
|
613
|
+
log("Usage:");
|
|
614
|
+
log(" mdkg goal show <goal-id-or-qid> [--json]");
|
|
615
|
+
log(" mdkg goal select <goal-id-or-qid> [--json]");
|
|
616
|
+
log(" mdkg goal current [--json]");
|
|
617
|
+
log(" mdkg goal next [goal-id-or-qid] [--json]");
|
|
618
|
+
log(" mdkg goal claim [goal-id-or-qid] <work-id-or-qid> [--json]");
|
|
619
|
+
log(" mdkg goal evaluate <goal-id-or-qid> [--json]");
|
|
620
|
+
log(" mdkg goal clear [--json]");
|
|
621
|
+
log(" mdkg goal pause|resume|done <goal-id-or-qid> [--json]");
|
|
622
|
+
log("\nNotes:");
|
|
623
|
+
log(" - goals orchestrate recursive progress; features, tasks, bugs, and tests are iterable work units");
|
|
624
|
+
log(" - `mdkg goal next` is read-only; use `mdkg goal claim` to update active_node");
|
|
625
|
+
log(" - goal evaluation is report-only and never executes required_checks");
|
|
626
|
+
log(" - subgraph goal qids are read-only; update the source workspace instead");
|
|
627
|
+
printGlobalOptions(log);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
491
630
|
function printEventHelp(log, subcommand) {
|
|
492
631
|
switch ((subcommand ?? "").toLowerCase()) {
|
|
493
632
|
case "enable":
|
|
@@ -599,12 +738,18 @@ function printCommandHelp(log, command, subcommand) {
|
|
|
599
738
|
case "bundle":
|
|
600
739
|
printBundleHelp(log, subcommand);
|
|
601
740
|
return;
|
|
741
|
+
case "subgraph":
|
|
742
|
+
printSubgraphHelp(log, subcommand);
|
|
743
|
+
return;
|
|
602
744
|
case "work":
|
|
603
745
|
printWorkHelp(log, subcommand);
|
|
604
746
|
return;
|
|
605
747
|
case "task":
|
|
606
748
|
printTaskHelp(log, subcommand);
|
|
607
749
|
return;
|
|
750
|
+
case "goal":
|
|
751
|
+
printGoalHelp(log, subcommand);
|
|
752
|
+
return;
|
|
608
753
|
case "event":
|
|
609
754
|
printEventHelp(log, subcommand);
|
|
610
755
|
return;
|
|
@@ -871,8 +1016,20 @@ function runCapabilitySubcommand(parsed, root) {
|
|
|
871
1016
|
(0, capability_1.runCapabilityShowCommand)({ root, id, json, noCache, noReindex });
|
|
872
1017
|
return 0;
|
|
873
1018
|
}
|
|
1019
|
+
case "resolve": {
|
|
1020
|
+
const query = parsed.positionals.slice(2).join(" ") || undefined;
|
|
1021
|
+
const kind = requireFlagValue("--kind", parsed.flags["--kind"]);
|
|
1022
|
+
const visibility = requireFlagValue("--visibility", parsed.flags["--visibility"]);
|
|
1023
|
+
const requires = requireFlagValue("--requires", parsed.flags["--requires"]);
|
|
1024
|
+
const freshOnly = parseBooleanFlag("--fresh-only", parsed.flags["--fresh-only"]);
|
|
1025
|
+
const json = parseBooleanFlag("--json", parsed.flags["--json"]);
|
|
1026
|
+
const noCache = parseBooleanFlag("--no-cache", parsed.flags["--no-cache"]);
|
|
1027
|
+
const noReindex = parseBooleanFlag("--no-reindex", parsed.flags["--no-reindex"]);
|
|
1028
|
+
(0, capability_1.runCapabilityResolveCommand)({ root, query, kind, visibility, requires, freshOnly, json, noCache, noReindex });
|
|
1029
|
+
return 0;
|
|
1030
|
+
}
|
|
874
1031
|
default:
|
|
875
|
-
throw new errors_1.UsageError("capability requires list/search/show");
|
|
1032
|
+
throw new errors_1.UsageError("capability requires list/search/show/resolve");
|
|
876
1033
|
}
|
|
877
1034
|
}
|
|
878
1035
|
function runArchiveSubcommand(parsed, root) {
|
|
@@ -944,78 +1101,7 @@ function runBundleSubcommand(parsed, root) {
|
|
|
944
1101
|
const subcommand = (parsed.positionals[1] ?? "").toLowerCase();
|
|
945
1102
|
switch (subcommand) {
|
|
946
1103
|
case "import": {
|
|
947
|
-
|
|
948
|
-
const json = parseBooleanFlag("--json", parsed.flags["--json"]);
|
|
949
|
-
switch (action) {
|
|
950
|
-
case "add": {
|
|
951
|
-
const alias = parsed.positionals[3];
|
|
952
|
-
const bundlePath = parsed.positionals[4];
|
|
953
|
-
if (!alias || !bundlePath || parsed.positionals.length > 5) {
|
|
954
|
-
throw new errors_1.UsageError("bundle import add requires <alias> <bundle-path>");
|
|
955
|
-
}
|
|
956
|
-
const visibility = requireFlagValue("--visibility", parsed.flags["--visibility"]);
|
|
957
|
-
const profile = requireFlagValue("--profile", parsed.flags["--pack-profile"]);
|
|
958
|
-
const sourcePath = requireFlagValue("--source-path", parsed.flags["--source-path"]);
|
|
959
|
-
const sourceRepo = requireFlagValue("--source-repo", parsed.flags["--source-repo"]);
|
|
960
|
-
const maxStaleRaw = requireFlagValue("--max-stale-seconds", parsed.flags["--max-stale-seconds"]);
|
|
961
|
-
const maxStaleSeconds = maxStaleRaw === undefined ? undefined : Number.parseInt(maxStaleRaw, 10);
|
|
962
|
-
(0, bundle_import_1.runBundleImportAddCommand)({
|
|
963
|
-
root,
|
|
964
|
-
alias,
|
|
965
|
-
bundlePath,
|
|
966
|
-
visibility,
|
|
967
|
-
profile,
|
|
968
|
-
sourcePath,
|
|
969
|
-
sourceRepo,
|
|
970
|
-
maxStaleSeconds,
|
|
971
|
-
json,
|
|
972
|
-
});
|
|
973
|
-
return 0;
|
|
974
|
-
}
|
|
975
|
-
case "list": {
|
|
976
|
-
if (parsed.positionals.length > 3) {
|
|
977
|
-
throw new errors_1.UsageError("bundle import list does not accept positional arguments");
|
|
978
|
-
}
|
|
979
|
-
(0, bundle_import_1.runBundleImportListCommand)({ root, json });
|
|
980
|
-
return 0;
|
|
981
|
-
}
|
|
982
|
-
case "rm":
|
|
983
|
-
case "remove": {
|
|
984
|
-
const alias = parsed.positionals[3];
|
|
985
|
-
if (!alias || parsed.positionals.length > 4) {
|
|
986
|
-
throw new errors_1.UsageError("bundle import rm requires <alias>");
|
|
987
|
-
}
|
|
988
|
-
(0, bundle_import_1.runBundleImportRemoveCommand)({ root, alias, json });
|
|
989
|
-
return 0;
|
|
990
|
-
}
|
|
991
|
-
case "enable": {
|
|
992
|
-
const alias = parsed.positionals[3];
|
|
993
|
-
if (!alias || parsed.positionals.length > 4) {
|
|
994
|
-
throw new errors_1.UsageError("bundle import enable requires <alias>");
|
|
995
|
-
}
|
|
996
|
-
(0, bundle_import_1.runBundleImportEnableCommand)({ root, alias, json });
|
|
997
|
-
return 0;
|
|
998
|
-
}
|
|
999
|
-
case "disable": {
|
|
1000
|
-
const alias = parsed.positionals[3];
|
|
1001
|
-
if (!alias || parsed.positionals.length > 4) {
|
|
1002
|
-
throw new errors_1.UsageError("bundle import disable requires <alias>");
|
|
1003
|
-
}
|
|
1004
|
-
(0, bundle_import_1.runBundleImportDisableCommand)({ root, alias, json });
|
|
1005
|
-
return 0;
|
|
1006
|
-
}
|
|
1007
|
-
case "verify": {
|
|
1008
|
-
if (parsed.positionals.length > 4) {
|
|
1009
|
-
throw new errors_1.UsageError("bundle import verify accepts at most one alias");
|
|
1010
|
-
}
|
|
1011
|
-
const alias = parsed.positionals[3];
|
|
1012
|
-
const all = parseBooleanFlag("--all", parsed.flags["--all"]);
|
|
1013
|
-
(0, bundle_import_1.runBundleImportVerifyCommand)({ root, alias, all, json });
|
|
1014
|
-
return 0;
|
|
1015
|
-
}
|
|
1016
|
-
default:
|
|
1017
|
-
throw new errors_1.UsageError("bundle import requires add/list/rm/enable/disable/verify");
|
|
1018
|
-
}
|
|
1104
|
+
throw new errors_1.UsageError("mdkg bundle import has been replaced by mdkg subgraph; run `mdkg upgrade --apply` to migrate legacy bundle_imports config");
|
|
1019
1105
|
}
|
|
1020
1106
|
case "create": {
|
|
1021
1107
|
if (parsed.positionals.length > 2) {
|
|
@@ -1055,7 +1141,98 @@ function runBundleSubcommand(parsed, root) {
|
|
|
1055
1141
|
return 0;
|
|
1056
1142
|
}
|
|
1057
1143
|
default:
|
|
1058
|
-
throw new errors_1.UsageError("bundle requires create/list/show/verify
|
|
1144
|
+
throw new errors_1.UsageError("bundle requires create/list/show/verify");
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
function runSubgraphSubcommand(parsed, root) {
|
|
1148
|
+
const subcommand = (parsed.positionals[1] ?? "").toLowerCase();
|
|
1149
|
+
const json = parseBooleanFlag("--json", parsed.flags["--json"]);
|
|
1150
|
+
switch (subcommand) {
|
|
1151
|
+
case "add": {
|
|
1152
|
+
const alias = parsed.positionals[2];
|
|
1153
|
+
const bundlePath = parsed.positionals[3];
|
|
1154
|
+
if (!alias || !bundlePath || parsed.positionals.length > 4) {
|
|
1155
|
+
throw new errors_1.UsageError("subgraph add requires <alias> <bundle-path>");
|
|
1156
|
+
}
|
|
1157
|
+
const visibility = requireFlagValue("--visibility", parsed.flags["--visibility"]);
|
|
1158
|
+
const profile = requireFlagValue("--profile", parsed.flags["--pack-profile"]);
|
|
1159
|
+
const sourcePath = requireFlagValue("--source-path", parsed.flags["--source-path"]);
|
|
1160
|
+
const sourceRepo = requireFlagValue("--source-repo", parsed.flags["--source-repo"]);
|
|
1161
|
+
const maxStaleRaw = requireFlagValue("--max-stale-seconds", parsed.flags["--max-stale-seconds"]);
|
|
1162
|
+
const maxStaleSeconds = maxStaleRaw === undefined ? undefined : Number.parseInt(maxStaleRaw, 10);
|
|
1163
|
+
(0, subgraph_1.runSubgraphAddCommand)({
|
|
1164
|
+
root,
|
|
1165
|
+
alias,
|
|
1166
|
+
bundlePath,
|
|
1167
|
+
visibility,
|
|
1168
|
+
profile,
|
|
1169
|
+
sourcePath,
|
|
1170
|
+
sourceRepo,
|
|
1171
|
+
maxStaleSeconds,
|
|
1172
|
+
json,
|
|
1173
|
+
});
|
|
1174
|
+
return 0;
|
|
1175
|
+
}
|
|
1176
|
+
case "list": {
|
|
1177
|
+
if (parsed.positionals.length > 2) {
|
|
1178
|
+
throw new errors_1.UsageError("subgraph list does not accept positional arguments");
|
|
1179
|
+
}
|
|
1180
|
+
(0, subgraph_1.runSubgraphListCommand)({ root, json });
|
|
1181
|
+
return 0;
|
|
1182
|
+
}
|
|
1183
|
+
case "show": {
|
|
1184
|
+
const alias = parsed.positionals[2];
|
|
1185
|
+
if (!alias || parsed.positionals.length > 3) {
|
|
1186
|
+
throw new errors_1.UsageError("subgraph show requires <alias>");
|
|
1187
|
+
}
|
|
1188
|
+
(0, subgraph_1.runSubgraphShowCommand)({ root, alias, json });
|
|
1189
|
+
return 0;
|
|
1190
|
+
}
|
|
1191
|
+
case "rm":
|
|
1192
|
+
case "remove": {
|
|
1193
|
+
const alias = parsed.positionals[2];
|
|
1194
|
+
if (!alias || parsed.positionals.length > 3) {
|
|
1195
|
+
throw new errors_1.UsageError("subgraph rm requires <alias>");
|
|
1196
|
+
}
|
|
1197
|
+
(0, subgraph_1.runSubgraphRemoveCommand)({ root, alias, json });
|
|
1198
|
+
return 0;
|
|
1199
|
+
}
|
|
1200
|
+
case "enable": {
|
|
1201
|
+
const alias = parsed.positionals[2];
|
|
1202
|
+
if (!alias || parsed.positionals.length > 3) {
|
|
1203
|
+
throw new errors_1.UsageError("subgraph enable requires <alias>");
|
|
1204
|
+
}
|
|
1205
|
+
(0, subgraph_1.runSubgraphEnableCommand)({ root, alias, json });
|
|
1206
|
+
return 0;
|
|
1207
|
+
}
|
|
1208
|
+
case "disable": {
|
|
1209
|
+
const alias = parsed.positionals[2];
|
|
1210
|
+
if (!alias || parsed.positionals.length > 3) {
|
|
1211
|
+
throw new errors_1.UsageError("subgraph disable requires <alias>");
|
|
1212
|
+
}
|
|
1213
|
+
(0, subgraph_1.runSubgraphDisableCommand)({ root, alias, json });
|
|
1214
|
+
return 0;
|
|
1215
|
+
}
|
|
1216
|
+
case "verify": {
|
|
1217
|
+
if (parsed.positionals.length > 3) {
|
|
1218
|
+
throw new errors_1.UsageError("subgraph verify accepts at most one alias");
|
|
1219
|
+
}
|
|
1220
|
+
const alias = parsed.positionals[2];
|
|
1221
|
+
const all = parseBooleanFlag("--all", parsed.flags["--all"]);
|
|
1222
|
+
(0, subgraph_1.runSubgraphVerifyCommand)({ root, alias, all, json });
|
|
1223
|
+
return 0;
|
|
1224
|
+
}
|
|
1225
|
+
case "refresh": {
|
|
1226
|
+
if (parsed.positionals.length > 3) {
|
|
1227
|
+
throw new errors_1.UsageError("subgraph refresh accepts at most one alias");
|
|
1228
|
+
}
|
|
1229
|
+
const alias = parsed.positionals[2];
|
|
1230
|
+
const all = parseBooleanFlag("--all", parsed.flags["--all"]);
|
|
1231
|
+
(0, subgraph_1.runSubgraphRefreshCommand)({ root, alias, all, json });
|
|
1232
|
+
return 0;
|
|
1233
|
+
}
|
|
1234
|
+
default:
|
|
1235
|
+
throw new errors_1.UsageError("subgraph requires add/list/show/rm/enable/disable/verify/refresh");
|
|
1059
1236
|
}
|
|
1060
1237
|
}
|
|
1061
1238
|
function runWorkSubcommand(parsed, root) {
|
|
@@ -1314,6 +1491,92 @@ function runSkillSubcommand(parsed, root) {
|
|
|
1314
1491
|
throw new errors_1.UsageError("skill requires new/list/show/search/validate/sync");
|
|
1315
1492
|
}
|
|
1316
1493
|
}
|
|
1494
|
+
function runGoalSubcommand(parsed, root) {
|
|
1495
|
+
const subcommand = (parsed.positionals[1] ?? "").toLowerCase();
|
|
1496
|
+
const ws = requireFlagValue("--ws", parsed.flags["--ws"]);
|
|
1497
|
+
const json = parseBooleanFlag("--json", parsed.flags["--json"]);
|
|
1498
|
+
switch (subcommand) {
|
|
1499
|
+
case "show": {
|
|
1500
|
+
const id = parsed.positionals[2];
|
|
1501
|
+
if (!id || parsed.positionals.length > 3) {
|
|
1502
|
+
throw new errors_1.UsageError("goal show requires <goal-id-or-qid>");
|
|
1503
|
+
}
|
|
1504
|
+
(0, goal_1.runGoalShowCommand)({ root, id, ws, json });
|
|
1505
|
+
return 0;
|
|
1506
|
+
}
|
|
1507
|
+
case "select": {
|
|
1508
|
+
const id = parsed.positionals[2];
|
|
1509
|
+
if (!id || parsed.positionals.length > 3) {
|
|
1510
|
+
throw new errors_1.UsageError("goal select requires <goal-id-or-qid>");
|
|
1511
|
+
}
|
|
1512
|
+
(0, goal_1.runGoalSelectCommand)({ root, id, ws, json });
|
|
1513
|
+
return 0;
|
|
1514
|
+
}
|
|
1515
|
+
case "current":
|
|
1516
|
+
if (parsed.positionals.length > 2) {
|
|
1517
|
+
throw new errors_1.UsageError("goal current does not accept positional arguments");
|
|
1518
|
+
}
|
|
1519
|
+
(0, goal_1.runGoalCurrentCommand)({ root, ws, json });
|
|
1520
|
+
return 0;
|
|
1521
|
+
case "clear":
|
|
1522
|
+
if (parsed.positionals.length > 2) {
|
|
1523
|
+
throw new errors_1.UsageError("goal clear does not accept positional arguments");
|
|
1524
|
+
}
|
|
1525
|
+
(0, goal_1.runGoalClearCommand)({ root, json });
|
|
1526
|
+
return 0;
|
|
1527
|
+
case "next": {
|
|
1528
|
+
const id = parsed.positionals[2];
|
|
1529
|
+
if (parsed.positionals.length > 3) {
|
|
1530
|
+
throw new errors_1.UsageError("goal next accepts at most one goal id");
|
|
1531
|
+
}
|
|
1532
|
+
(0, goal_1.runGoalNextCommand)({ root, id, ws, json });
|
|
1533
|
+
return 0;
|
|
1534
|
+
}
|
|
1535
|
+
case "claim": {
|
|
1536
|
+
const first = parsed.positionals[2];
|
|
1537
|
+
const second = parsed.positionals[3];
|
|
1538
|
+
if (!first || parsed.positionals.length > 4) {
|
|
1539
|
+
throw new errors_1.UsageError("goal claim requires <work-id-or-qid> or <goal-id-or-qid> <work-id-or-qid>");
|
|
1540
|
+
}
|
|
1541
|
+
(0, goal_1.runGoalClaimCommand)({ root, id: second ? first : undefined, workId: second ?? first, ws, json });
|
|
1542
|
+
return 0;
|
|
1543
|
+
}
|
|
1544
|
+
case "evaluate": {
|
|
1545
|
+
const id = parsed.positionals[2];
|
|
1546
|
+
if (!id || parsed.positionals.length > 3) {
|
|
1547
|
+
throw new errors_1.UsageError("goal evaluate requires <goal-id-or-qid>");
|
|
1548
|
+
}
|
|
1549
|
+
(0, goal_1.runGoalEvaluateCommand)({ root, id, ws, json });
|
|
1550
|
+
return 0;
|
|
1551
|
+
}
|
|
1552
|
+
case "pause": {
|
|
1553
|
+
const id = parsed.positionals[2];
|
|
1554
|
+
if (!id || parsed.positionals.length > 3) {
|
|
1555
|
+
throw new errors_1.UsageError("goal pause requires <goal-id-or-qid>");
|
|
1556
|
+
}
|
|
1557
|
+
(0, goal_1.runGoalPauseCommand)({ root, id, ws, json });
|
|
1558
|
+
return 0;
|
|
1559
|
+
}
|
|
1560
|
+
case "resume": {
|
|
1561
|
+
const id = parsed.positionals[2];
|
|
1562
|
+
if (!id || parsed.positionals.length > 3) {
|
|
1563
|
+
throw new errors_1.UsageError("goal resume requires <goal-id-or-qid>");
|
|
1564
|
+
}
|
|
1565
|
+
(0, goal_1.runGoalResumeCommand)({ root, id, ws, json });
|
|
1566
|
+
return 0;
|
|
1567
|
+
}
|
|
1568
|
+
case "done": {
|
|
1569
|
+
const id = parsed.positionals[2];
|
|
1570
|
+
if (!id || parsed.positionals.length > 3) {
|
|
1571
|
+
throw new errors_1.UsageError("goal done requires <goal-id-or-qid>");
|
|
1572
|
+
}
|
|
1573
|
+
(0, goal_1.runGoalDoneCommand)({ root, id, ws, json });
|
|
1574
|
+
return 0;
|
|
1575
|
+
}
|
|
1576
|
+
default:
|
|
1577
|
+
throw new errors_1.UsageError("goal requires show/select/current/clear/next/claim/evaluate/pause/resume/done");
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1317
1580
|
function runTaskSubcommand(parsed, root) {
|
|
1318
1581
|
const subcommand = (parsed.positionals[1] ?? "").toLowerCase();
|
|
1319
1582
|
switch (subcommand) {
|
|
@@ -1567,8 +1830,12 @@ function runCommand(parsed, root, runtime) {
|
|
|
1567
1830
|
return runArchiveSubcommand(parsed, root);
|
|
1568
1831
|
case "bundle":
|
|
1569
1832
|
return runBundleSubcommand(parsed, root);
|
|
1833
|
+
case "subgraph":
|
|
1834
|
+
return runSubgraphSubcommand(parsed, root);
|
|
1570
1835
|
case "work":
|
|
1571
1836
|
return runWorkSubcommand(parsed, root);
|
|
1837
|
+
case "goal":
|
|
1838
|
+
return runGoalSubcommand(parsed, root);
|
|
1572
1839
|
case "task":
|
|
1573
1840
|
return runTaskSubcommand(parsed, root);
|
|
1574
1841
|
case "event":
|
package/dist/commands/bundle.js
CHANGED
|
@@ -13,7 +13,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
13
13
|
const child_process_1 = require("child_process");
|
|
14
14
|
const config_1 = require("../core/config");
|
|
15
15
|
const capabilities_indexer_1 = require("../graph/capabilities_indexer");
|
|
16
|
-
const
|
|
16
|
+
const subgraphs_1 = require("../graph/subgraphs");
|
|
17
17
|
const indexer_1 = require("../graph/indexer");
|
|
18
18
|
const skills_indexer_1 = require("../graph/skills_indexer");
|
|
19
19
|
const zip_1 = require("../util/zip");
|
|
@@ -386,11 +386,11 @@ function collectStringValues(value, out) {
|
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
function
|
|
390
|
-
const
|
|
389
|
+
function publicSubgraphReferenceErrors(config, index, includedQids) {
|
|
390
|
+
const privateSubgraphAliases = new Set(Object.entries(config.subgraphs)
|
|
391
391
|
.filter(([, entry]) => entry.enabled && entry.visibility !== "public")
|
|
392
392
|
.map(([alias]) => alias));
|
|
393
|
-
if (
|
|
393
|
+
if (privateSubgraphAliases.size === 0) {
|
|
394
394
|
return [];
|
|
395
395
|
}
|
|
396
396
|
const errors = [];
|
|
@@ -404,8 +404,8 @@ function publicImportReferenceErrors(config, index, includedQids) {
|
|
|
404
404
|
values.push(...node.links, ...node.artifacts, ...node.refs, ...node.aliases);
|
|
405
405
|
for (const value of values) {
|
|
406
406
|
const [alias] = value.split(":");
|
|
407
|
-
if (alias &&
|
|
408
|
-
errors.push(`${node.qid} references private
|
|
407
|
+
if (alias && privateSubgraphAliases.has(alias)) {
|
|
408
|
+
errors.push(`${node.qid} references private subgraph ${value}`);
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
}
|
|
@@ -465,7 +465,7 @@ function buildBundle(options) {
|
|
|
465
465
|
const filteredIndex = filterIndex(index, config, selectedSet, profile);
|
|
466
466
|
if (profile === "public") {
|
|
467
467
|
const includedQids = new Set(Object.keys(filteredIndex.nodes));
|
|
468
|
-
const mergedIndex = (0,
|
|
468
|
+
const mergedIndex = (0, subgraphs_1.mergeSubgraphsIntoIndex)(index, (0, subgraphs_1.buildSubgraphsIndex)(options.root, config));
|
|
469
469
|
const errors = (0, visibility_1.visibilityViolationMessages)((0, visibility_1.collectVisibilityViolations)(mergedIndex, config, {
|
|
470
470
|
includedQids,
|
|
471
471
|
scope: "public",
|