@openclawbrain/cli 0.4.34 → 0.4.36
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/dist/src/cli.d.ts +69 -1
- package/dist/src/cli.js +817 -4
- package/dist/src/graphify-compiled-artifacts.d.ts +127 -0
- package/dist/src/graphify-compiled-artifacts.js +1185 -0
- package/dist/src/graphify-import-slice.js +1091 -0
- package/dist/src/graphify-lints.js +977 -0
- package/dist/src/graphify-maintenance-diff.d.ts +167 -0
- package/dist/src/graphify-maintenance-diff.js +1288 -0
- package/dist/src/graphify-runner.js +745 -0
- package/dist/src/import-export.d.ts +127 -0
- package/dist/src/import-export.js +938 -26
- package/dist/src/index.js +4 -2
- package/dist/src/session-store.js +37 -0
- package/dist/src/session-tail.js +111 -2
- package/package.json +9 -9
package/dist/src/cli.js
CHANGED
|
@@ -7,7 +7,11 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
7
7
|
const __dirname = path.dirname(__filename);
|
|
8
8
|
import { DEFAULT_OLLAMA_EMBEDDING_MODEL, createOllamaEmbedder } from "@openclawbrain/compiler";
|
|
9
9
|
import { describeManagedLearnerServiceRuntimeGuard, ensureManagedLearnerServiceForActivationRoot, inspectManagedLearnerService, removeManagedLearnerServiceForActivationRoot, parseDaemonArgs, runDaemonCommand } from "./daemon.js";
|
|
10
|
-
import { exportBrain, importBrain } from "./import-export.js";
|
|
10
|
+
import { exportBrain, exportGraphifyCompiledArtifactsPack, exportGraphifyProjection, exportGraphifySourceBundle, importBrain } from "./import-export.js";
|
|
11
|
+
import { parseGraphifyImportSliceCliArgs, runGraphifyImportSlice } from "./graphify-import-slice.js";
|
|
12
|
+
import { runManagedGraphifyRunner } from "./graphify-runner.js";
|
|
13
|
+
import { parseGraphifyDeterministicLintCliArgs, runGraphifyDeterministicLints } from "./graphify-lints.js";
|
|
14
|
+
import { parseGraphifyMaintenanceDiffCliArgs, runGraphifyMaintenanceDiff } from "./graphify-maintenance-diff.js";
|
|
11
15
|
import { buildNormalizedEventExport } from "@openclawbrain/contracts";
|
|
12
16
|
import { buildTeacherSupervisionArtifactsFromNormalizedEventExport, createAlwaysOnLearningRuntimeState, describeAlwaysOnLearningRuntimeState, drainAlwaysOnLearningRuntime, loadOrInitBaseline, materializeAlwaysOnLearningCandidatePack, persistBaseline } from "./local-learner.js";
|
|
13
17
|
import { inspectActivationState, loadPackFromActivation, promoteCandidatePack, resolveLearningSpineLogPath, stageCandidatePack } from "@openclawbrain/pack-format";
|
|
@@ -557,7 +561,14 @@ function operatorCliHelp() {
|
|
|
557
561
|
" openclawbrain scan --session <trace.json> --root <path> [options]",
|
|
558
562
|
" openclawbrain scan --live <event-export-path> --workspace <workspace.json> [options]",
|
|
559
563
|
" openclawbrain learn [--activation-root <path>|--openclaw-home <path>] [--json]",
|
|
564
|
+
" openclawbrain graphify-export --activation-root <path> [options]",
|
|
565
|
+
" openclawbrain graphify-run --source-bundle <path> [--output-root <path>] [options]",
|
|
566
|
+
" openclawbrain graphify-compiled-artifacts [--bundle-id <id>] [--output-dir <path>] [options]",
|
|
567
|
+
" openclawbrain graphify-import-slice --bundle-root <path> [--output-root <path>] [options]",
|
|
568
|
+
" openclawbrain graphify-lints --bundle-root <path> [--repo-root <path>] [--workspace-root <path>] [--output-root <path>] [--run-id <id>] [--json]",
|
|
569
|
+
" openclawbrain graphify-maintenance-diff --graphify-root <path> --ocb-root <path> [--repo-root <path>] [--workspace-root <path>] [--output-root <path>] [--run-id <id>] [--json]",
|
|
560
570
|
proofHelp.usage,
|
|
571
|
+
" openclawbrain source-bundle --openclaw-home <path> --output-dir <path> [options]",
|
|
561
572
|
" openclawbrain-ops <status|rollback> [--activation-root <path>|--openclaw-home <path>] [options] # compatibility alias",
|
|
562
573
|
" openclawbrain-ops scan --session <trace.json> --root <path> [options] # compatibility alias",
|
|
563
574
|
"",
|
|
@@ -586,8 +597,45 @@ function operatorCliHelp() {
|
|
|
586
597
|
" --limit <N> Maximum number of history entries to show (default: 20, history only).",
|
|
587
598
|
" --scan-root <path> Event-export scan root for watch mode (defaults to <activation-root>/event-exports).",
|
|
588
599
|
" --interval <seconds> Polling interval for watch mode (default: 30).",
|
|
589
|
-
|
|
600
|
+
" --output-root <dir> Root directory for graphify-export bundles (default: ./artifacts/graphify-source-bundles).",
|
|
601
|
+
" --run-id <id> Run identifier for graphify-export bundle subdirectory (default: timestamp token).",
|
|
602
|
+
" --repo-root <path> Repository root used for the docs/code mirror tree in graphify-export.",
|
|
603
|
+
" --workspace-root <path> Workspace root used to source MEMORY.md and TASKS.md in graphify-export.",
|
|
604
|
+
" --session-key <key> Session key used for graphify-export session projection path (default: current-session).",
|
|
605
|
+
" --session-source <path> Optional session source markdown/json/text to project into graphify-export sessions/.",
|
|
606
|
+
" --proof-summary-source <path> Optional proof summary source markdown/text to project into graphify-export proof/summary.md.",
|
|
607
|
+
" --docs-root <path> Docs directory to mirror or symlink for graphify-export (default: <repo-root>/docs).",
|
|
608
|
+
" --code-root <path> Code directory to mirror or symlink for graphify-export (default: <repo-root>/packages/cli/dist/src).",
|
|
609
|
+
" --generated-at <iso> Override the graphify-export bundle timestamp used in markdown provenance.",
|
|
610
|
+
" --source-bundle <path> Source bundle root or bundle file for graphify-run.",
|
|
611
|
+
" --graphify-version <text> Recorded Graphify version string (probed from --graphify-command when omitted).",
|
|
612
|
+
" --graphify-mode <mode> Recorded Graphify mode label (default: managed-off-path).",
|
|
613
|
+
" --graphify-command <cmd> Optional executable to invoke under managed Graphify execution.",
|
|
614
|
+
" --graphify-arg <value> Repeatable Graphify command arg. Passed through when --graphify-command is set.",
|
|
615
|
+
" --graphify-flag <value> Repeatable Graphify flag label recorded in bundle metadata.",
|
|
616
|
+
" --graphify-config-json <json> Graphify config payload serialized into bundle metadata.",
|
|
617
|
+
" --label <value> Repeatable bundle label recorded in labels.json.",
|
|
618
|
+
" --bundle-id <id> Graphify compiled-artifact bundle id seed (graphify-compiled-artifacts only).",
|
|
619
|
+
" --output-dir <path> Output directory for graphify-compiled-artifacts (defaults under artifacts/teacher-v3-proof).",
|
|
620
|
+
" --bundle-started-at <iso> Timestamp used as the bundle start time for graphify-compiled-artifacts.",
|
|
621
|
+
" --graphify-run-id <id> Graphify managed-run id that feeds compiled-artifact bundle provenance.",
|
|
622
|
+
" --source-bundle-id <id> Source bundle id carried into graphify-compiled-artifacts provenance.",
|
|
623
|
+
" --source-bundle-hash <hash> Source bundle hash carried into graphify-compiled-artifacts provenance.",
|
|
624
|
+
" --graph-hash <hash> Graph hash recorded in graphify-compiled-artifacts provenance.",
|
|
625
|
+
" --config-hash <hash> Config hash recorded in graphify-compiled-artifacts provenance.",
|
|
626
|
+
" --labels-hash <hash> Labels hash recorded in graphify-compiled-artifacts provenance.",
|
|
627
|
+
" --bundle-root <path> Graphify compiled-artifact pack root for graphify-import-slice; graphify-lints also reuses this for bundle inspection.",
|
|
628
|
+
" --output-root <path> Root directory for graphify-import-slice bundles (default: ./artifacts/graphify-imports).",
|
|
629
|
+
" --run-id <id> Run identifier for graphify-import-slice bundle subdirectory (default: timestamp token).",
|
|
630
|
+
" --repo-root <path> Repository root for graphify-import-slice source-reference checks.",
|
|
631
|
+
" --workspace-root <path> Workspace root used to source relative paths for graphify-import-slice.",
|
|
632
|
+
" --bundle-root <path> Graphify pre-lint bundle root for graphify-lints.",
|
|
633
|
+
" --repo-root <path> Repository root for graphify-lints source-reference checks.",
|
|
634
|
+
" --workspace-root <path> Workspace root for graphify-lints release/docs checks.",
|
|
635
|
+
" --graphify-root <path> Current Graphify surface root for graphify-maintenance-diff.",
|
|
636
|
+
" --ocb-root <path> OCB inspectable surface root for graphify-maintenance-diff.",
|
|
590
637
|
" --json Emit machine-readable JSON instead of text.",
|
|
638
|
+
...proofHelp.optionLines,
|
|
591
639
|
" --help Show this help.",
|
|
592
640
|
"",
|
|
593
641
|
"Lifecycle flow:",
|
|
@@ -612,6 +660,13 @@ function operatorCliHelp() {
|
|
|
612
660
|
" rollback preview or apply active <- previous, active -> candidate pointer movement",
|
|
613
661
|
" scan inspect one recorded session or live event export without claiming a daemon is running",
|
|
614
662
|
" learn one-shot local-session learning pass against the resolved activation root",
|
|
663
|
+
" source-bundle canonical Graphify source-bundle export with runtime-status and proof snapshots",
|
|
664
|
+
" graphify-export project the canonical machine export into non-authoritative Graphify surfaces",
|
|
665
|
+
" graphify-run run the managed off-path Graphify compiler step and emit a reproducible run bundle",
|
|
666
|
+
" graphify-compiled-artifacts derive a Graphify-shaped compiled-artifact pack from docs/fixture source truth",
|
|
667
|
+
" graphify-import-slice conservatively slice EXTRACTED-only Graphify priors into removable candidate-pack input material from a compiled-artifact pack",
|
|
668
|
+
" graphify-lints deterministic pre-lint for Graphify/OCB bundles before any semantic lint or graph mutation",
|
|
669
|
+
" graphify-maintenance-diff compare current Graphify graph/import surfaces against OCB candidate/compiled/promoted inspectable surfaces",
|
|
615
670
|
proofHelp.advanced,
|
|
616
671
|
" status --teacher-snapshot keeps the current live-first / principal-priority / passive-backfill learner order visible when that snapshot exists",
|
|
617
672
|
" native package installs still need the openclawbrain CLI available because install/attach pin the activation root for that package copy",
|
|
@@ -626,7 +681,14 @@ function operatorCliHelp() {
|
|
|
626
681
|
" detach: 0 on successful unhook, 1 on input/read failure.",
|
|
627
682
|
" uninstall: 0 on successful unhook/cleanup, 1 on input/read failure.",
|
|
628
683
|
" scan: 0 on successful replay/scan, 1 on input/read failure.",
|
|
629
|
-
"
|
|
684
|
+
" graphify-export: 0 on successful projection bundle capture, 1 on input/read failure.",
|
|
685
|
+
" graphify-run: 0 on successful managed Graphify bundle capture, 1 on input/read failure.",
|
|
686
|
+
" graphify-compiled-artifacts: 0 on successful pack capture, 1 on input/read failure.",
|
|
687
|
+
" graphify-import-slice: 0 on successful EXTRACTED-only slice capture, 1 on input/read failure.",
|
|
688
|
+
" graphify-lints: 0 on successful pre-lint capture, 1 on input/read failure.",
|
|
689
|
+
" graphify-maintenance-diff: 0 on successful diagnostic capture, 1 on input/read failure.",
|
|
690
|
+
" proof: 0 on successful bundle capture, 1 on input/read failure.",
|
|
691
|
+
" source-bundle: 0 on successful canonical source export, 1 on input/read failure."
|
|
630
692
|
].join("\n");
|
|
631
693
|
}
|
|
632
694
|
function yesNo(value) {
|
|
@@ -2455,12 +2517,514 @@ export function parseOperatorCliArgs(argv) {
|
|
|
2455
2517
|
args.shift();
|
|
2456
2518
|
return parseDaemonArgs(args);
|
|
2457
2519
|
}
|
|
2458
|
-
if (args[0] === "status" || args[0] === "rollback" || args[0] === "scan" || args[0] === "attach" || args[0] === "install" || args[0] === "detach" || args[0] === "uninstall" || args[0] === "context" || args[0] === "history" || args[0] === "learn" || args[0] === "watch" || args[0] === "export" || args[0] === "import" || args[0] === "reset" || args[0] === "proof") {
|
|
2520
|
+
if (args[0] === "status" || args[0] === "rollback" || args[0] === "scan" || args[0] === "attach" || args[0] === "install" || args[0] === "detach" || args[0] === "uninstall" || args[0] === "context" || args[0] === "history" || args[0] === "learn" || args[0] === "watch" || args[0] === "export" || args[0] === "import" || args[0] === "reset" || args[0] === "proof" || args[0] === "source-bundle" || args[0] === "graphify-export" || args[0] === "graphify-run" || args[0] === "graphify-compiled-artifacts" || args[0] === "graphify-import-slice" || args[0] === "graphify-lints" || args[0] === "graphify-maintenance-diff") {
|
|
2459
2521
|
command = args.shift();
|
|
2460
2522
|
}
|
|
2461
2523
|
if (command === "proof") {
|
|
2462
2524
|
return parseProofCliArgs(args);
|
|
2463
2525
|
}
|
|
2526
|
+
if (command === "graphify-export") {
|
|
2527
|
+
let outputRoot = null;
|
|
2528
|
+
let runId = null;
|
|
2529
|
+
let repoRoot = null;
|
|
2530
|
+
let workspaceRoot = null;
|
|
2531
|
+
let sessionKey = null;
|
|
2532
|
+
let sessionSourcePath = null;
|
|
2533
|
+
let proofSummarySourcePath = null;
|
|
2534
|
+
let docsRoot = null;
|
|
2535
|
+
let codeRoot = null;
|
|
2536
|
+
let generatedAt = null;
|
|
2537
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
2538
|
+
const arg = args[index];
|
|
2539
|
+
if (arg === "--help" || arg === "-h") {
|
|
2540
|
+
help = true;
|
|
2541
|
+
continue;
|
|
2542
|
+
}
|
|
2543
|
+
if (arg === "--json") {
|
|
2544
|
+
json = true;
|
|
2545
|
+
continue;
|
|
2546
|
+
}
|
|
2547
|
+
if (arg === "--activation-root") {
|
|
2548
|
+
const next = args[index + 1];
|
|
2549
|
+
if (next === undefined) {
|
|
2550
|
+
throw new Error("--activation-root requires a value");
|
|
2551
|
+
}
|
|
2552
|
+
activationRoot = next;
|
|
2553
|
+
index += 1;
|
|
2554
|
+
continue;
|
|
2555
|
+
}
|
|
2556
|
+
if (arg === "--openclaw-home") {
|
|
2557
|
+
const next = args[index + 1];
|
|
2558
|
+
if (next === undefined) {
|
|
2559
|
+
throw new Error("--openclaw-home requires a value");
|
|
2560
|
+
}
|
|
2561
|
+
openclawHome = next;
|
|
2562
|
+
index += 1;
|
|
2563
|
+
continue;
|
|
2564
|
+
}
|
|
2565
|
+
if (arg === "--output-root") {
|
|
2566
|
+
const next = args[index + 1];
|
|
2567
|
+
if (next === undefined) {
|
|
2568
|
+
throw new Error("--output-root requires a value");
|
|
2569
|
+
}
|
|
2570
|
+
outputRoot = next;
|
|
2571
|
+
index += 1;
|
|
2572
|
+
continue;
|
|
2573
|
+
}
|
|
2574
|
+
if (arg === "--run-id") {
|
|
2575
|
+
const next = args[index + 1];
|
|
2576
|
+
if (next === undefined) {
|
|
2577
|
+
throw new Error("--run-id requires a value");
|
|
2578
|
+
}
|
|
2579
|
+
runId = next;
|
|
2580
|
+
index += 1;
|
|
2581
|
+
continue;
|
|
2582
|
+
}
|
|
2583
|
+
if (arg === "--repo-root") {
|
|
2584
|
+
const next = args[index + 1];
|
|
2585
|
+
if (next === undefined) {
|
|
2586
|
+
throw new Error("--repo-root requires a value");
|
|
2587
|
+
}
|
|
2588
|
+
repoRoot = next;
|
|
2589
|
+
index += 1;
|
|
2590
|
+
continue;
|
|
2591
|
+
}
|
|
2592
|
+
if (arg === "--workspace-root") {
|
|
2593
|
+
const next = args[index + 1];
|
|
2594
|
+
if (next === undefined) {
|
|
2595
|
+
throw new Error("--workspace-root requires a value");
|
|
2596
|
+
}
|
|
2597
|
+
workspaceRoot = next;
|
|
2598
|
+
index += 1;
|
|
2599
|
+
continue;
|
|
2600
|
+
}
|
|
2601
|
+
if (arg === "--session-key") {
|
|
2602
|
+
const next = args[index + 1];
|
|
2603
|
+
if (next === undefined) {
|
|
2604
|
+
throw new Error("--session-key requires a value");
|
|
2605
|
+
}
|
|
2606
|
+
sessionKey = next;
|
|
2607
|
+
index += 1;
|
|
2608
|
+
continue;
|
|
2609
|
+
}
|
|
2610
|
+
if (arg === "--session-source") {
|
|
2611
|
+
const next = args[index + 1];
|
|
2612
|
+
if (next === undefined) {
|
|
2613
|
+
throw new Error("--session-source requires a value");
|
|
2614
|
+
}
|
|
2615
|
+
sessionSourcePath = next;
|
|
2616
|
+
index += 1;
|
|
2617
|
+
continue;
|
|
2618
|
+
}
|
|
2619
|
+
if (arg === "--proof-summary-source") {
|
|
2620
|
+
const next = args[index + 1];
|
|
2621
|
+
if (next === undefined) {
|
|
2622
|
+
throw new Error("--proof-summary-source requires a value");
|
|
2623
|
+
}
|
|
2624
|
+
proofSummarySourcePath = next;
|
|
2625
|
+
index += 1;
|
|
2626
|
+
continue;
|
|
2627
|
+
}
|
|
2628
|
+
if (arg === "--docs-root") {
|
|
2629
|
+
const next = args[index + 1];
|
|
2630
|
+
if (next === undefined) {
|
|
2631
|
+
throw new Error("--docs-root requires a value");
|
|
2632
|
+
}
|
|
2633
|
+
docsRoot = next;
|
|
2634
|
+
index += 1;
|
|
2635
|
+
continue;
|
|
2636
|
+
}
|
|
2637
|
+
if (arg === "--code-root") {
|
|
2638
|
+
const next = args[index + 1];
|
|
2639
|
+
if (next === undefined) {
|
|
2640
|
+
throw new Error("--code-root requires a value");
|
|
2641
|
+
}
|
|
2642
|
+
codeRoot = next;
|
|
2643
|
+
index += 1;
|
|
2644
|
+
continue;
|
|
2645
|
+
}
|
|
2646
|
+
if (arg === "--generated-at") {
|
|
2647
|
+
const next = args[index + 1];
|
|
2648
|
+
if (next === undefined) {
|
|
2649
|
+
throw new Error("--generated-at requires a value");
|
|
2650
|
+
}
|
|
2651
|
+
generatedAt = next;
|
|
2652
|
+
index += 1;
|
|
2653
|
+
continue;
|
|
2654
|
+
}
|
|
2655
|
+
if (arg.startsWith("--")) {
|
|
2656
|
+
throw new Error(`unknown argument for graphify-export: ${arg}`);
|
|
2657
|
+
}
|
|
2658
|
+
}
|
|
2659
|
+
if (help) {
|
|
2660
|
+
return {
|
|
2661
|
+
command,
|
|
2662
|
+
activationRoot: "",
|
|
2663
|
+
outputRoot: "",
|
|
2664
|
+
runId: "",
|
|
2665
|
+
repoRoot: "",
|
|
2666
|
+
workspaceRoot: "",
|
|
2667
|
+
sessionKey: "",
|
|
2668
|
+
sessionSourcePath: null,
|
|
2669
|
+
proofSummarySourcePath: null,
|
|
2670
|
+
docsRoot: "",
|
|
2671
|
+
codeRoot: "",
|
|
2672
|
+
generatedAt: null,
|
|
2673
|
+
json,
|
|
2674
|
+
help
|
|
2675
|
+
};
|
|
2676
|
+
}
|
|
2677
|
+
return {
|
|
2678
|
+
command,
|
|
2679
|
+
activationRoot: resolveCliActivationRoot(activationRoot, openclawHome),
|
|
2680
|
+
outputRoot: normalizeOptionalCliString(outputRoot) === null ? null : path.resolve(normalizeOptionalCliString(outputRoot)),
|
|
2681
|
+
runId: normalizeOptionalCliString(runId),
|
|
2682
|
+
repoRoot: normalizeOptionalCliString(repoRoot) === null ? null : path.resolve(normalizeOptionalCliString(repoRoot)),
|
|
2683
|
+
workspaceRoot: normalizeOptionalCliString(workspaceRoot) === null ? null : path.resolve(normalizeOptionalCliString(workspaceRoot)),
|
|
2684
|
+
sessionKey: normalizeOptionalCliString(sessionKey),
|
|
2685
|
+
sessionSourcePath: normalizeOptionalCliString(sessionSourcePath) === null ? null : path.resolve(normalizeOptionalCliString(sessionSourcePath)),
|
|
2686
|
+
proofSummarySourcePath: normalizeOptionalCliString(proofSummarySourcePath) === null ? null : path.resolve(normalizeOptionalCliString(proofSummarySourcePath)),
|
|
2687
|
+
docsRoot: normalizeOptionalCliString(docsRoot) === null ? null : path.resolve(normalizeOptionalCliString(docsRoot)),
|
|
2688
|
+
codeRoot: normalizeOptionalCliString(codeRoot) === null ? null : path.resolve(normalizeOptionalCliString(codeRoot)),
|
|
2689
|
+
generatedAt: normalizeOptionalCliString(generatedAt),
|
|
2690
|
+
json,
|
|
2691
|
+
help
|
|
2692
|
+
};
|
|
2693
|
+
}
|
|
2694
|
+
if (command === "graphify-run") {
|
|
2695
|
+
let sourceBundlePath = null;
|
|
2696
|
+
let outputRoot = null;
|
|
2697
|
+
let runId = null;
|
|
2698
|
+
let graphifyVersion = null;
|
|
2699
|
+
let graphifyMode = null;
|
|
2700
|
+
let graphifyCommand = null;
|
|
2701
|
+
const graphifyArgs = [];
|
|
2702
|
+
const graphifyFlags = [];
|
|
2703
|
+
let graphifyConfigJson = null;
|
|
2704
|
+
const graphifyLabels = [];
|
|
2705
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
2706
|
+
const arg = args[index];
|
|
2707
|
+
if (arg === "--help" || arg === "-h") {
|
|
2708
|
+
help = true;
|
|
2709
|
+
continue;
|
|
2710
|
+
}
|
|
2711
|
+
if (arg === "--json") {
|
|
2712
|
+
json = true;
|
|
2713
|
+
continue;
|
|
2714
|
+
}
|
|
2715
|
+
if (arg === "--source-bundle") {
|
|
2716
|
+
const next = args[index + 1];
|
|
2717
|
+
if (next === undefined) {
|
|
2718
|
+
throw new Error("--source-bundle requires a value");
|
|
2719
|
+
}
|
|
2720
|
+
sourceBundlePath = next;
|
|
2721
|
+
index += 1;
|
|
2722
|
+
continue;
|
|
2723
|
+
}
|
|
2724
|
+
if (arg === "--output-root") {
|
|
2725
|
+
const next = args[index + 1];
|
|
2726
|
+
if (next === undefined) {
|
|
2727
|
+
throw new Error("--output-root requires a value");
|
|
2728
|
+
}
|
|
2729
|
+
outputRoot = next;
|
|
2730
|
+
index += 1;
|
|
2731
|
+
continue;
|
|
2732
|
+
}
|
|
2733
|
+
if (arg === "--run-id") {
|
|
2734
|
+
const next = args[index + 1];
|
|
2735
|
+
if (next === undefined) {
|
|
2736
|
+
throw new Error("--run-id requires a value");
|
|
2737
|
+
}
|
|
2738
|
+
runId = next;
|
|
2739
|
+
index += 1;
|
|
2740
|
+
continue;
|
|
2741
|
+
}
|
|
2742
|
+
if (arg === "--graphify-version") {
|
|
2743
|
+
const next = args[index + 1];
|
|
2744
|
+
if (next === undefined) {
|
|
2745
|
+
throw new Error("--graphify-version requires a value");
|
|
2746
|
+
}
|
|
2747
|
+
graphifyVersion = next;
|
|
2748
|
+
index += 1;
|
|
2749
|
+
continue;
|
|
2750
|
+
}
|
|
2751
|
+
if (arg === "--graphify-mode") {
|
|
2752
|
+
const next = args[index + 1];
|
|
2753
|
+
if (next === undefined) {
|
|
2754
|
+
throw new Error("--graphify-mode requires a value");
|
|
2755
|
+
}
|
|
2756
|
+
graphifyMode = next;
|
|
2757
|
+
index += 1;
|
|
2758
|
+
continue;
|
|
2759
|
+
}
|
|
2760
|
+
if (arg === "--graphify-command") {
|
|
2761
|
+
const next = args[index + 1];
|
|
2762
|
+
if (next === undefined) {
|
|
2763
|
+
throw new Error("--graphify-command requires a value");
|
|
2764
|
+
}
|
|
2765
|
+
graphifyCommand = next;
|
|
2766
|
+
index += 1;
|
|
2767
|
+
continue;
|
|
2768
|
+
}
|
|
2769
|
+
if (arg === "--graphify-arg") {
|
|
2770
|
+
const next = args[index + 1];
|
|
2771
|
+
if (next === undefined) {
|
|
2772
|
+
throw new Error("--graphify-arg requires a value");
|
|
2773
|
+
}
|
|
2774
|
+
graphifyArgs.push(next);
|
|
2775
|
+
index += 1;
|
|
2776
|
+
continue;
|
|
2777
|
+
}
|
|
2778
|
+
if (arg === "--graphify-flag") {
|
|
2779
|
+
const next = args[index + 1];
|
|
2780
|
+
if (next === undefined) {
|
|
2781
|
+
throw new Error("--graphify-flag requires a value");
|
|
2782
|
+
}
|
|
2783
|
+
graphifyFlags.push(next);
|
|
2784
|
+
index += 1;
|
|
2785
|
+
continue;
|
|
2786
|
+
}
|
|
2787
|
+
if (arg === "--graphify-config-json") {
|
|
2788
|
+
const next = args[index + 1];
|
|
2789
|
+
if (next === undefined) {
|
|
2790
|
+
throw new Error("--graphify-config-json requires a value");
|
|
2791
|
+
}
|
|
2792
|
+
graphifyConfigJson = next;
|
|
2793
|
+
index += 1;
|
|
2794
|
+
continue;
|
|
2795
|
+
}
|
|
2796
|
+
if (arg === "--label") {
|
|
2797
|
+
const next = args[index + 1];
|
|
2798
|
+
if (next === undefined) {
|
|
2799
|
+
throw new Error("--label requires a value");
|
|
2800
|
+
}
|
|
2801
|
+
graphifyLabels.push(next);
|
|
2802
|
+
index += 1;
|
|
2803
|
+
continue;
|
|
2804
|
+
}
|
|
2805
|
+
if (arg.startsWith("--")) {
|
|
2806
|
+
throw new Error(`unknown argument for graphify-run: ${arg}`);
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
if (help) {
|
|
2810
|
+
return {
|
|
2811
|
+
command,
|
|
2812
|
+
sourceBundlePath: "",
|
|
2813
|
+
outputRoot: "",
|
|
2814
|
+
runId: null,
|
|
2815
|
+
graphifyVersion: null,
|
|
2816
|
+
graphifyMode: null,
|
|
2817
|
+
graphifyCommand: null,
|
|
2818
|
+
graphifyArgs: [],
|
|
2819
|
+
graphifyFlags: [],
|
|
2820
|
+
graphifyConfig: {},
|
|
2821
|
+
labels: [],
|
|
2822
|
+
json,
|
|
2823
|
+
help,
|
|
2824
|
+
};
|
|
2825
|
+
}
|
|
2826
|
+
if (sourceBundlePath === null) {
|
|
2827
|
+
throw new Error("--source-bundle is required for graphify-run");
|
|
2828
|
+
}
|
|
2829
|
+
let graphifyConfig = {};
|
|
2830
|
+
if (graphifyConfigJson !== null) {
|
|
2831
|
+
try {
|
|
2832
|
+
graphifyConfig = JSON.parse(graphifyConfigJson);
|
|
2833
|
+
}
|
|
2834
|
+
catch (error) {
|
|
2835
|
+
throw new Error(`--graphify-config-json must be valid JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
return {
|
|
2839
|
+
command,
|
|
2840
|
+
sourceBundlePath: path.resolve(sourceBundlePath),
|
|
2841
|
+
outputRoot: outputRoot === null ? null : path.resolve(outputRoot),
|
|
2842
|
+
runId,
|
|
2843
|
+
graphifyVersion,
|
|
2844
|
+
graphifyMode,
|
|
2845
|
+
graphifyCommand,
|
|
2846
|
+
graphifyArgs,
|
|
2847
|
+
graphifyFlags,
|
|
2848
|
+
graphifyConfig,
|
|
2849
|
+
labels: graphifyLabels,
|
|
2850
|
+
json,
|
|
2851
|
+
help,
|
|
2852
|
+
};
|
|
2853
|
+
}
|
|
2854
|
+
if (command === "graphify-compiled-artifacts") {
|
|
2855
|
+
let bundleId = null;
|
|
2856
|
+
let outputDir = null;
|
|
2857
|
+
let bundleStartedAt = null;
|
|
2858
|
+
let graphifyRunId = null;
|
|
2859
|
+
let graphifyVersion = null;
|
|
2860
|
+
let graphifyCommand = null;
|
|
2861
|
+
let sourceBundleId = null;
|
|
2862
|
+
let sourceBundleHash = null;
|
|
2863
|
+
let graphHash = null;
|
|
2864
|
+
let configHash = null;
|
|
2865
|
+
let labelsHash = null;
|
|
2866
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
2867
|
+
const arg = args[index];
|
|
2868
|
+
if (arg === "--help" || arg === "-h") {
|
|
2869
|
+
help = true;
|
|
2870
|
+
continue;
|
|
2871
|
+
}
|
|
2872
|
+
if (arg === "--json") {
|
|
2873
|
+
json = true;
|
|
2874
|
+
continue;
|
|
2875
|
+
}
|
|
2876
|
+
if (arg === "--bundle-id") {
|
|
2877
|
+
const next = args[index + 1];
|
|
2878
|
+
if (next === undefined) {
|
|
2879
|
+
throw new Error("--bundle-id requires a value");
|
|
2880
|
+
}
|
|
2881
|
+
bundleId = next;
|
|
2882
|
+
index += 1;
|
|
2883
|
+
continue;
|
|
2884
|
+
}
|
|
2885
|
+
if (arg === "--output-dir") {
|
|
2886
|
+
const next = args[index + 1];
|
|
2887
|
+
if (next === undefined) {
|
|
2888
|
+
throw new Error("--output-dir requires a value");
|
|
2889
|
+
}
|
|
2890
|
+
outputDir = next;
|
|
2891
|
+
index += 1;
|
|
2892
|
+
continue;
|
|
2893
|
+
}
|
|
2894
|
+
if (arg === "--bundle-started-at") {
|
|
2895
|
+
const next = args[index + 1];
|
|
2896
|
+
if (next === undefined) {
|
|
2897
|
+
throw new Error("--bundle-started-at requires a value");
|
|
2898
|
+
}
|
|
2899
|
+
bundleStartedAt = next;
|
|
2900
|
+
index += 1;
|
|
2901
|
+
continue;
|
|
2902
|
+
}
|
|
2903
|
+
if (arg === "--graphify-run-id") {
|
|
2904
|
+
const next = args[index + 1];
|
|
2905
|
+
if (next === undefined) {
|
|
2906
|
+
throw new Error("--graphify-run-id requires a value");
|
|
2907
|
+
}
|
|
2908
|
+
graphifyRunId = next;
|
|
2909
|
+
index += 1;
|
|
2910
|
+
continue;
|
|
2911
|
+
}
|
|
2912
|
+
if (arg === "--graphify-version") {
|
|
2913
|
+
const next = args[index + 1];
|
|
2914
|
+
if (next === undefined) {
|
|
2915
|
+
throw new Error("--graphify-version requires a value");
|
|
2916
|
+
}
|
|
2917
|
+
graphifyVersion = next;
|
|
2918
|
+
index += 1;
|
|
2919
|
+
continue;
|
|
2920
|
+
}
|
|
2921
|
+
if (arg === "--graphify-command") {
|
|
2922
|
+
const next = args[index + 1];
|
|
2923
|
+
if (next === undefined) {
|
|
2924
|
+
throw new Error("--graphify-command requires a value");
|
|
2925
|
+
}
|
|
2926
|
+
graphifyCommand = next;
|
|
2927
|
+
index += 1;
|
|
2928
|
+
continue;
|
|
2929
|
+
}
|
|
2930
|
+
if (arg === "--source-bundle-id") {
|
|
2931
|
+
const next = args[index + 1];
|
|
2932
|
+
if (next === undefined) {
|
|
2933
|
+
throw new Error("--source-bundle-id requires a value");
|
|
2934
|
+
}
|
|
2935
|
+
sourceBundleId = next;
|
|
2936
|
+
index += 1;
|
|
2937
|
+
continue;
|
|
2938
|
+
}
|
|
2939
|
+
if (arg === "--source-bundle-hash") {
|
|
2940
|
+
const next = args[index + 1];
|
|
2941
|
+
if (next === undefined) {
|
|
2942
|
+
throw new Error("--source-bundle-hash requires a value");
|
|
2943
|
+
}
|
|
2944
|
+
sourceBundleHash = next;
|
|
2945
|
+
index += 1;
|
|
2946
|
+
continue;
|
|
2947
|
+
}
|
|
2948
|
+
if (arg === "--graph-hash") {
|
|
2949
|
+
const next = args[index + 1];
|
|
2950
|
+
if (next === undefined) {
|
|
2951
|
+
throw new Error("--graph-hash requires a value");
|
|
2952
|
+
}
|
|
2953
|
+
graphHash = next;
|
|
2954
|
+
index += 1;
|
|
2955
|
+
continue;
|
|
2956
|
+
}
|
|
2957
|
+
if (arg === "--config-hash") {
|
|
2958
|
+
const next = args[index + 1];
|
|
2959
|
+
if (next === undefined) {
|
|
2960
|
+
throw new Error("--config-hash requires a value");
|
|
2961
|
+
}
|
|
2962
|
+
configHash = next;
|
|
2963
|
+
index += 1;
|
|
2964
|
+
continue;
|
|
2965
|
+
}
|
|
2966
|
+
if (arg === "--labels-hash") {
|
|
2967
|
+
const next = args[index + 1];
|
|
2968
|
+
if (next === undefined) {
|
|
2969
|
+
throw new Error("--labels-hash requires a value");
|
|
2970
|
+
}
|
|
2971
|
+
labelsHash = next;
|
|
2972
|
+
index += 1;
|
|
2973
|
+
continue;
|
|
2974
|
+
}
|
|
2975
|
+
if (arg.startsWith("--")) {
|
|
2976
|
+
throw new Error(`unknown argument for graphify-compiled-artifacts: ${arg}`);
|
|
2977
|
+
}
|
|
2978
|
+
if (bundleId === null) {
|
|
2979
|
+
bundleId = arg;
|
|
2980
|
+
continue;
|
|
2981
|
+
}
|
|
2982
|
+
throw new Error(`unexpected positional argument: ${arg}`);
|
|
2983
|
+
}
|
|
2984
|
+
if (help) {
|
|
2985
|
+
return {
|
|
2986
|
+
command,
|
|
2987
|
+
bundleId: "",
|
|
2988
|
+
outputDir: "",
|
|
2989
|
+
bundleStartedAt: "",
|
|
2990
|
+
graphifyRunId: "",
|
|
2991
|
+
graphifyVersion: "",
|
|
2992
|
+
graphifyCommand: "",
|
|
2993
|
+
sourceBundleId: "",
|
|
2994
|
+
sourceBundleHash: "",
|
|
2995
|
+
graphHash: "",
|
|
2996
|
+
configHash: "",
|
|
2997
|
+
labelsHash: "",
|
|
2998
|
+
json,
|
|
2999
|
+
help,
|
|
3000
|
+
};
|
|
3001
|
+
}
|
|
3002
|
+
return {
|
|
3003
|
+
command,
|
|
3004
|
+
bundleId,
|
|
3005
|
+
outputDir: outputDir === null ? null : path.resolve(outputDir),
|
|
3006
|
+
bundleStartedAt,
|
|
3007
|
+
graphifyRunId,
|
|
3008
|
+
graphifyVersion,
|
|
3009
|
+
graphifyCommand,
|
|
3010
|
+
sourceBundleId,
|
|
3011
|
+
sourceBundleHash,
|
|
3012
|
+
graphHash,
|
|
3013
|
+
configHash,
|
|
3014
|
+
labelsHash,
|
|
3015
|
+
json,
|
|
3016
|
+
help,
|
|
3017
|
+
};
|
|
3018
|
+
}
|
|
3019
|
+
if (command === "graphify-import-slice") {
|
|
3020
|
+
return parseGraphifyImportSliceCliArgs(args);
|
|
3021
|
+
}
|
|
3022
|
+
if (command === "graphify-lints") {
|
|
3023
|
+
return parseGraphifyDeterministicLintCliArgs(args);
|
|
3024
|
+
}
|
|
3025
|
+
if (command === "graphify-maintenance-diff") {
|
|
3026
|
+
return parseGraphifyMaintenanceDiffCliArgs(args);
|
|
3027
|
+
}
|
|
2464
3028
|
if (command === "learn") {
|
|
2465
3029
|
for (let index = 0; index < args.length; index += 1) {
|
|
2466
3030
|
const arg = args[index];
|
|
@@ -2780,6 +3344,69 @@ export function parseOperatorCliArgs(argv) {
|
|
|
2780
3344
|
help,
|
|
2781
3345
|
};
|
|
2782
3346
|
}
|
|
3347
|
+
if (command === "source-bundle") {
|
|
3348
|
+
let outputDir = null;
|
|
3349
|
+
let homeDir = null;
|
|
3350
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
3351
|
+
const arg = args[index];
|
|
3352
|
+
if (arg === "--help" || arg === "-h") {
|
|
3353
|
+
help = true;
|
|
3354
|
+
continue;
|
|
3355
|
+
}
|
|
3356
|
+
if (arg === "--json") {
|
|
3357
|
+
json = true;
|
|
3358
|
+
continue;
|
|
3359
|
+
}
|
|
3360
|
+
if (arg === "--activation-root") {
|
|
3361
|
+
const next = args[index + 1];
|
|
3362
|
+
if (next === undefined)
|
|
3363
|
+
throw new Error("--activation-root requires a value");
|
|
3364
|
+
activationRoot = next;
|
|
3365
|
+
index += 1;
|
|
3366
|
+
continue;
|
|
3367
|
+
}
|
|
3368
|
+
if (arg === "--openclaw-home") {
|
|
3369
|
+
const next = args[index + 1];
|
|
3370
|
+
if (next === undefined)
|
|
3371
|
+
throw new Error("--openclaw-home requires a value");
|
|
3372
|
+
openclawHome = next;
|
|
3373
|
+
index += 1;
|
|
3374
|
+
continue;
|
|
3375
|
+
}
|
|
3376
|
+
if (arg === "--home-dir") {
|
|
3377
|
+
const next = args[index + 1];
|
|
3378
|
+
if (next === undefined)
|
|
3379
|
+
throw new Error("--home-dir requires a value");
|
|
3380
|
+
homeDir = next;
|
|
3381
|
+
index += 1;
|
|
3382
|
+
continue;
|
|
3383
|
+
}
|
|
3384
|
+
if (arg === "-o" || arg === "--output-dir") {
|
|
3385
|
+
const next = args[index + 1];
|
|
3386
|
+
if (next === undefined)
|
|
3387
|
+
throw new Error("-o / --output-dir requires a value");
|
|
3388
|
+
outputDir = next;
|
|
3389
|
+
index += 1;
|
|
3390
|
+
continue;
|
|
3391
|
+
}
|
|
3392
|
+
if (arg.startsWith("--"))
|
|
3393
|
+
throw new Error(`unknown argument for source-bundle: ${arg}`);
|
|
3394
|
+
throw new Error(`unexpected positional argument: ${arg}`);
|
|
3395
|
+
}
|
|
3396
|
+
if (help)
|
|
3397
|
+
return { command, openclawHome: "", activationRoot: "", outputDir: "", homeDir: "", json, help };
|
|
3398
|
+
if (outputDir === null)
|
|
3399
|
+
throw new Error("source-bundle requires --output-dir <path>");
|
|
3400
|
+
return {
|
|
3401
|
+
command,
|
|
3402
|
+
openclawHome: openclawHome === null ? null : path.resolve(openclawHome),
|
|
3403
|
+
activationRoot: activationRoot === null ? null : path.resolve(activationRoot),
|
|
3404
|
+
outputDir: path.resolve(outputDir),
|
|
3405
|
+
homeDir: homeDir === null ? null : path.resolve(homeDir),
|
|
3406
|
+
json,
|
|
3407
|
+
help,
|
|
3408
|
+
};
|
|
3409
|
+
}
|
|
2783
3410
|
if (command === "reset") {
|
|
2784
3411
|
let yes = false;
|
|
2785
3412
|
for (let index = 0; index < args.length; index += 1) {
|
|
@@ -6552,6 +7179,192 @@ export function runOperatorCli(argv = process.argv.slice(2)) {
|
|
|
6552
7179
|
if (parsed.command === "proof") {
|
|
6553
7180
|
return runProofCommand(parsed);
|
|
6554
7181
|
}
|
|
7182
|
+
if (parsed.command === "source-bundle") {
|
|
7183
|
+
const result = exportGraphifySourceBundle({
|
|
7184
|
+
openclawHome: parsed.openclawHome ?? undefined,
|
|
7185
|
+
activationRoot: parsed.activationRoot ?? undefined,
|
|
7186
|
+
outputDir: parsed.outputDir,
|
|
7187
|
+
homeDir: parsed.homeDir ?? undefined,
|
|
7188
|
+
});
|
|
7189
|
+
if (parsed.json) {
|
|
7190
|
+
console.log(JSON.stringify(result, null, 2));
|
|
7191
|
+
}
|
|
7192
|
+
else if (result.ok) {
|
|
7193
|
+
console.log(`SOURCE BUNDLE ok`);
|
|
7194
|
+
console.log(` Bundle: ${result.bundleDir}`);
|
|
7195
|
+
console.log(` Bundle id: ${result.bundleId}`);
|
|
7196
|
+
console.log(` Corpus id: ${result.corpusId}`);
|
|
7197
|
+
console.log(` Corpus digest: ${result.corpusDigest}`);
|
|
7198
|
+
}
|
|
7199
|
+
else {
|
|
7200
|
+
console.error(`SOURCE BUNDLE failed: ${result.error}`);
|
|
7201
|
+
}
|
|
7202
|
+
return result.ok ? 0 : 1;
|
|
7203
|
+
}
|
|
7204
|
+
if (parsed.command === "graphify-export") {
|
|
7205
|
+
if (parsed.help) {
|
|
7206
|
+
console.log(operatorCliHelp());
|
|
7207
|
+
return 0;
|
|
7208
|
+
}
|
|
7209
|
+
const result = exportGraphifyProjection({
|
|
7210
|
+
activationRoot: parsed.activationRoot,
|
|
7211
|
+
outputRoot: parsed.outputRoot ?? undefined,
|
|
7212
|
+
runId: parsed.runId ?? undefined,
|
|
7213
|
+
repoRoot: parsed.repoRoot ?? undefined,
|
|
7214
|
+
workspaceRoot: parsed.workspaceRoot ?? undefined,
|
|
7215
|
+
sessionKey: parsed.sessionKey ?? undefined,
|
|
7216
|
+
sessionTimestamp: parsed.generatedAt ?? undefined,
|
|
7217
|
+
sessionSourcePath: parsed.sessionSourcePath ?? undefined,
|
|
7218
|
+
proofSummarySourcePath: parsed.proofSummarySourcePath ?? undefined,
|
|
7219
|
+
docsRoot: parsed.docsRoot ?? undefined,
|
|
7220
|
+
codeRoot: parsed.codeRoot ?? undefined,
|
|
7221
|
+
generatedAt: parsed.generatedAt ?? undefined,
|
|
7222
|
+
});
|
|
7223
|
+
if (parsed.json) {
|
|
7224
|
+
console.log(JSON.stringify(result, null, 2));
|
|
7225
|
+
}
|
|
7226
|
+
else if (result.ok) {
|
|
7227
|
+
console.log([
|
|
7228
|
+
"GRAPHIFY EXPORT ok",
|
|
7229
|
+
`bundle ${result.bundleRoot}`,
|
|
7230
|
+
`runId ${result.runId}`,
|
|
7231
|
+
`sourceHash ${result.sourceBundleHash ?? "none"}`,
|
|
7232
|
+
`archive ${result.canonicalArchivePath}`,
|
|
7233
|
+
`session ${result.sessionProjectionPath ?? "none"}`,
|
|
7234
|
+
`workspace MEMORY=${result.workspaceMemoryPath ?? "none"} TASKS=${result.workspaceTasksPath ?? "none"}`,
|
|
7235
|
+
`proof ${result.proofSummaryPath ?? "none"}`,
|
|
7236
|
+
`mirrors docs=${result.docsMirrorRoot ?? "none"} code=${result.codeMirrorRoot ?? "none"}`,
|
|
7237
|
+
`manifest ${result.manifestPath ?? "none"}`,
|
|
7238
|
+
`warnings ${(result.warnings ?? []).length === 0 ? "none" : result.warnings.join("; ")}`,
|
|
7239
|
+
].join("\n"));
|
|
7240
|
+
}
|
|
7241
|
+
else {
|
|
7242
|
+
console.error(`GRAPHIFY EXPORT failed: ${result.error}`);
|
|
7243
|
+
}
|
|
7244
|
+
return result.ok ? 0 : 1;
|
|
7245
|
+
}
|
|
7246
|
+
if (parsed.command === "graphify-run") {
|
|
7247
|
+
if (parsed.help) {
|
|
7248
|
+
console.log(operatorCliHelp());
|
|
7249
|
+
return 0;
|
|
7250
|
+
}
|
|
7251
|
+
const result = runManagedGraphifyRunner({
|
|
7252
|
+
sourceBundlePath: parsed.sourceBundlePath,
|
|
7253
|
+
outputRoot: parsed.outputRoot ?? undefined,
|
|
7254
|
+
runId: parsed.runId ?? undefined,
|
|
7255
|
+
graphifyVersion: parsed.graphifyVersion ?? undefined,
|
|
7256
|
+
graphifyMode: parsed.graphifyMode ?? undefined,
|
|
7257
|
+
graphifyCommand: parsed.graphifyCommand ?? undefined,
|
|
7258
|
+
graphifyArgs: parsed.graphifyArgs,
|
|
7259
|
+
graphifyFlags: parsed.graphifyFlags,
|
|
7260
|
+
graphifyConfig: parsed.graphifyConfig,
|
|
7261
|
+
labels: parsed.labels,
|
|
7262
|
+
});
|
|
7263
|
+
if (parsed.json) {
|
|
7264
|
+
console.log(JSON.stringify(result, null, 2));
|
|
7265
|
+
}
|
|
7266
|
+
else {
|
|
7267
|
+
console.log(`GRAPHIFY RUN ok`);
|
|
7268
|
+
console.log(` Run id: ${result.runId}`);
|
|
7269
|
+
console.log(` Source bundle: ${result.sourceBundlePath}`);
|
|
7270
|
+
console.log(` Source hash: ${result.sourceBundleHash}`);
|
|
7271
|
+
console.log(` Graphify version: ${result.graphifyVersion}`);
|
|
7272
|
+
console.log(` Graphify mode: ${result.graphifyMode}`);
|
|
7273
|
+
console.log(` Output root: ${result.outputRoot}`);
|
|
7274
|
+
console.log(` Run dir: ${result.runDir}`);
|
|
7275
|
+
console.log(` Graph nodes/edges: ${result.graph.nodeCount}/${result.graph.edgeCount}`);
|
|
7276
|
+
console.log(` Execution state: ${result.execution.state}`);
|
|
7277
|
+
if (result.execution.failure !== null) {
|
|
7278
|
+
console.log(` Execution failure: ${result.execution.failure}`);
|
|
7279
|
+
}
|
|
7280
|
+
}
|
|
7281
|
+
return 0;
|
|
7282
|
+
}
|
|
7283
|
+
if (parsed.command === "graphify-compiled-artifacts") {
|
|
7284
|
+
if (parsed.help) {
|
|
7285
|
+
console.log(operatorCliHelp());
|
|
7286
|
+
return 0;
|
|
7287
|
+
}
|
|
7288
|
+
const result = exportGraphifyCompiledArtifactsPack({
|
|
7289
|
+
bundleId: parsed.bundleId,
|
|
7290
|
+
outputDir: parsed.outputDir,
|
|
7291
|
+
bundleStartedAt: parsed.bundleStartedAt,
|
|
7292
|
+
graphifyRunId: parsed.graphifyRunId,
|
|
7293
|
+
graphifyVersion: parsed.graphifyVersion,
|
|
7294
|
+
graphifyCommand: parsed.graphifyCommand,
|
|
7295
|
+
sourceBundleId: parsed.sourceBundleId,
|
|
7296
|
+
sourceBundleHash: parsed.sourceBundleHash,
|
|
7297
|
+
graphHash: parsed.graphHash,
|
|
7298
|
+
configHash: parsed.configHash,
|
|
7299
|
+
labelsHash: parsed.labelsHash,
|
|
7300
|
+
});
|
|
7301
|
+
if (parsed.json) {
|
|
7302
|
+
console.log(JSON.stringify(result, null, 2));
|
|
7303
|
+
}
|
|
7304
|
+
else if (result.ok) {
|
|
7305
|
+
console.log(`GRAPHIFY COMPILED ARTIFACTS ok`);
|
|
7306
|
+
console.log(` Pack: ${result.packId}`);
|
|
7307
|
+
console.log(` Proposal: ${result.proposalId}`);
|
|
7308
|
+
console.log(` Output: ${result.outputDir}`);
|
|
7309
|
+
console.log(` Artifacts:${result.artifactCount}`);
|
|
7310
|
+
console.log(` Verdict: ${result.validation?.ok ? "valid" : "invalid"}`);
|
|
7311
|
+
}
|
|
7312
|
+
else {
|
|
7313
|
+
console.error(`GRAPHIFY COMPILED ARTIFACTS failed: ${result.error}`);
|
|
7314
|
+
}
|
|
7315
|
+
return result.ok ? 0 : 1;
|
|
7316
|
+
}
|
|
7317
|
+
if (parsed.command === "graphify-import-slice") {
|
|
7318
|
+
if (parsed.help) {
|
|
7319
|
+
console.log(operatorCliHelp());
|
|
7320
|
+
return 0;
|
|
7321
|
+
}
|
|
7322
|
+
const result = runGraphifyImportSlice({
|
|
7323
|
+
bundleRoot: parsed.bundleRoot,
|
|
7324
|
+
repoRoot: parsed.repoRoot,
|
|
7325
|
+
workspaceRoot: parsed.workspaceRoot,
|
|
7326
|
+
outputRoot: parsed.outputRoot ?? undefined,
|
|
7327
|
+
runId: parsed.runId ?? undefined,
|
|
7328
|
+
});
|
|
7329
|
+
if (parsed.json) {
|
|
7330
|
+
console.log(JSON.stringify(result, null, 2));
|
|
7331
|
+
}
|
|
7332
|
+
else if (result.ok) {
|
|
7333
|
+
console.log(result.summary);
|
|
7334
|
+
}
|
|
7335
|
+
else {
|
|
7336
|
+
console.error(`GRAPHIFY IMPORT SLICE failed: ${result.error}`);
|
|
7337
|
+
}
|
|
7338
|
+
return result.ok ? 0 : 1;
|
|
7339
|
+
}
|
|
7340
|
+
if (parsed.command === "graphify-lints") {
|
|
7341
|
+
const result = runGraphifyDeterministicLints(parsed);
|
|
7342
|
+
if (result.help) {
|
|
7343
|
+
console.log(operatorCliHelp());
|
|
7344
|
+
return 0;
|
|
7345
|
+
}
|
|
7346
|
+
if (result.json) {
|
|
7347
|
+
console.log(JSON.stringify({ ok: result.ok, report: result.report, verdict: result.verdict, proposalEnvelope: result.proposalEnvelope, paths: result.paths }, null, 2));
|
|
7348
|
+
}
|
|
7349
|
+
else {
|
|
7350
|
+
console.log(result.summary);
|
|
7351
|
+
}
|
|
7352
|
+
return result.ok ? 0 : 1;
|
|
7353
|
+
}
|
|
7354
|
+
if (parsed.command === "graphify-maintenance-diff") {
|
|
7355
|
+
const result = runGraphifyMaintenanceDiff(parsed);
|
|
7356
|
+
if (result.help) {
|
|
7357
|
+
console.log(operatorCliHelp());
|
|
7358
|
+
return 0;
|
|
7359
|
+
}
|
|
7360
|
+
if (result.json) {
|
|
7361
|
+
console.log(JSON.stringify({ ok: result.ok, report: result.report, proposalSuggestion: result.proposalSuggestion, verdict: result.verdict, paths: result.paths }, null, 2));
|
|
7362
|
+
}
|
|
7363
|
+
else {
|
|
7364
|
+
console.log(result.summary);
|
|
7365
|
+
}
|
|
7366
|
+
return result.ok ? 0 : 1;
|
|
7367
|
+
}
|
|
6555
7368
|
if (parsed.help) {
|
|
6556
7369
|
console.log(operatorCliHelp());
|
|
6557
7370
|
return 0;
|