chainlesschain 0.81.0 → 0.143.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/bin/chainlesschain.js +0 -0
  2. package/package.json +1 -1
  3. package/src/commands/a2a.js +62 -0
  4. package/src/commands/activitypub.js +61 -0
  5. package/src/commands/agent-network.js +254 -1
  6. package/src/commands/agent.js +117 -0
  7. package/src/commands/audit.js +302 -0
  8. package/src/commands/automation.js +271 -1
  9. package/src/commands/bi.js +61 -0
  10. package/src/commands/bm25.js +78 -0
  11. package/src/commands/browse.js +64 -0
  12. package/src/commands/ccron.js +78 -0
  13. package/src/commands/codegen.js +224 -0
  14. package/src/commands/collab.js +341 -0
  15. package/src/commands/compliance.js +1075 -0
  16. package/src/commands/compt.js +78 -0
  17. package/src/commands/consol.js +231 -0
  18. package/src/commands/cowork.js +263 -0
  19. package/src/commands/crosschain.js +62 -0
  20. package/src/commands/dao.js +62 -0
  21. package/src/commands/dbevo.js +284 -0
  22. package/src/commands/dev.js +252 -0
  23. package/src/commands/did.js +358 -0
  24. package/src/commands/dlp.js +61 -0
  25. package/src/commands/economy.js +56 -0
  26. package/src/commands/encrypt.js +341 -0
  27. package/src/commands/evolution.js +56 -0
  28. package/src/commands/evomap.js +61 -0
  29. package/src/commands/export.js +256 -1
  30. package/src/commands/fflag.js +178 -0
  31. package/src/commands/fusion.js +258 -0
  32. package/src/commands/git.js +45 -0
  33. package/src/commands/governance.js +325 -0
  34. package/src/commands/hardening.js +411 -0
  35. package/src/commands/hmemory.js +56 -0
  36. package/src/commands/hook.js +148 -0
  37. package/src/commands/import.js +252 -0
  38. package/src/commands/incentive.js +322 -0
  39. package/src/commands/inference.js +42 -0
  40. package/src/commands/infra.js +244 -0
  41. package/src/commands/instinct.js +260 -0
  42. package/src/commands/ipfs.js +318 -0
  43. package/src/commands/itbudget.js +45 -0
  44. package/src/commands/kg.js +387 -0
  45. package/src/commands/llm.js +263 -0
  46. package/src/commands/lowcode.js +44 -0
  47. package/src/commands/matrix.js +62 -0
  48. package/src/commands/mcp.js +221 -0
  49. package/src/commands/mcpscaf.js +41 -0
  50. package/src/commands/meminj.js +41 -0
  51. package/src/commands/memory.js +248 -0
  52. package/src/commands/multimodal.js +296 -0
  53. package/src/commands/nlprog.js +356 -0
  54. package/src/commands/nostr.js +62 -0
  55. package/src/commands/note.js +244 -0
  56. package/src/commands/ops.js +354 -0
  57. package/src/commands/orchestrate.js +166 -0
  58. package/src/commands/orchgov.js +45 -0
  59. package/src/commands/org.js +277 -0
  60. package/src/commands/p2p.js +390 -0
  61. package/src/commands/pdfp.js +78 -0
  62. package/src/commands/perception.js +290 -0
  63. package/src/commands/perf.js +39 -0
  64. package/src/commands/perm.js +45 -0
  65. package/src/commands/permmem.js +251 -0
  66. package/src/commands/pipeline.js +57 -1
  67. package/src/commands/planmode.js +45 -0
  68. package/src/commands/plugin-ecosystem.js +273 -0
  69. package/src/commands/pqc.js +393 -0
  70. package/src/commands/promcomp.js +82 -0
  71. package/src/commands/quantization.js +351 -0
  72. package/src/commands/rcache.js +271 -0
  73. package/src/commands/recommend.js +382 -0
  74. package/src/commands/runtime.js +307 -0
  75. package/src/commands/scim.js +262 -0
  76. package/src/commands/seshhook.js +41 -0
  77. package/src/commands/seshsearch.js +41 -0
  78. package/src/commands/seshtail.js +41 -0
  79. package/src/commands/seshu.js +41 -0
  80. package/src/commands/session.js +258 -0
  81. package/src/commands/sganal.js +78 -0
  82. package/src/commands/siem.js +40 -0
  83. package/src/commands/skill.js +267 -1
  84. package/src/commands/slotfill.js +41 -0
  85. package/src/commands/social.js +290 -0
  86. package/src/commands/sso.js +186 -1
  87. package/src/commands/svccont.js +45 -0
  88. package/src/commands/sync.js +256 -0
  89. package/src/commands/tech.js +338 -0
  90. package/src/commands/tenant.js +351 -0
  91. package/src/commands/tms.js +45 -0
  92. package/src/commands/tokens.js +269 -0
  93. package/src/commands/topiccls.js +45 -0
  94. package/src/commands/trust.js +249 -0
  95. package/src/commands/uprof.js +45 -0
  96. package/src/commands/vcheck.js +78 -0
  97. package/src/commands/wallet.js +277 -0
  98. package/src/commands/webfetch.js +41 -0
  99. package/src/commands/workflow.js +171 -0
  100. package/src/commands/zkp.js +62 -0
  101. package/src/harness/prompt-compressor.js +331 -0
  102. package/src/index.js +65 -1
  103. package/src/lib/a2a-protocol.js +105 -0
  104. package/src/lib/activitypub-bridge.js +105 -0
  105. package/src/lib/agent-coordinator.js +325 -0
  106. package/src/lib/agent-economy.js +105 -0
  107. package/src/lib/agent-network.js +387 -0
  108. package/src/lib/agent-router.js +395 -0
  109. package/src/lib/aiops.js +478 -0
  110. package/src/lib/app-builder.js +105 -0
  111. package/src/lib/audit-logger.js +379 -0
  112. package/src/lib/automation-engine.js +330 -0
  113. package/src/lib/autonomous-agent.js +105 -0
  114. package/src/lib/autonomous-developer.js +350 -0
  115. package/src/lib/bi-engine.js +105 -0
  116. package/src/lib/bm25-search.js +81 -0
  117. package/src/lib/browser-automation.js +105 -0
  118. package/src/lib/code-agent.js +323 -0
  119. package/src/lib/collaboration-governance.js +364 -0
  120. package/src/lib/community-governance.js +436 -0
  121. package/src/lib/compliance-framework-reporter.js +105 -0
  122. package/src/lib/compliance-manager.js +434 -0
  123. package/src/lib/compression-telemetry.js +81 -0
  124. package/src/lib/content-recommendation.js +469 -0
  125. package/src/lib/content-recommender.js +105 -0
  126. package/src/lib/cowork-cron.js +81 -0
  127. package/src/lib/cowork-task-runner.js +105 -0
  128. package/src/lib/cross-chain.js +105 -0
  129. package/src/lib/crypto-manager.js +350 -0
  130. package/src/lib/dao-governance.js +105 -0
  131. package/src/lib/dbevo.js +338 -0
  132. package/src/lib/decentral-infra.js +340 -0
  133. package/src/lib/did-manager.js +367 -0
  134. package/src/lib/dlp-engine.js +105 -0
  135. package/src/lib/evolution-system.js +105 -0
  136. package/src/lib/evomap-manager.js +105 -0
  137. package/src/lib/execution-backend.js +105 -0
  138. package/src/lib/feature-flags.js +85 -0
  139. package/src/lib/git-integration.js +105 -0
  140. package/src/lib/hardening-manager.js +348 -0
  141. package/src/lib/hierarchical-memory.js +105 -0
  142. package/src/lib/hook-manager.js +380 -0
  143. package/src/lib/inference-network.js +105 -0
  144. package/src/lib/instinct-manager.js +332 -0
  145. package/src/lib/ipfs-storage.js +334 -0
  146. package/src/lib/iteration-budget.js +105 -0
  147. package/src/lib/knowledge-exporter.js +381 -0
  148. package/src/lib/knowledge-graph.js +432 -0
  149. package/src/lib/knowledge-importer.js +379 -0
  150. package/src/lib/llm-providers.js +391 -0
  151. package/src/lib/matrix-bridge.js +105 -0
  152. package/src/lib/mcp-registry.js +333 -0
  153. package/src/lib/mcp-scaffold.js +81 -0
  154. package/src/lib/memory-injection.js +81 -0
  155. package/src/lib/memory-manager.js +330 -0
  156. package/src/lib/multimodal.js +346 -0
  157. package/src/lib/nl-programming.js +343 -0
  158. package/src/lib/nostr-bridge.js +105 -0
  159. package/src/lib/note-versioning.js +327 -0
  160. package/src/lib/orchestrator.js +105 -0
  161. package/src/lib/org-manager.js +323 -0
  162. package/src/lib/p2p-manager.js +387 -0
  163. package/src/lib/pdf-parser.js +81 -0
  164. package/src/lib/perception.js +346 -0
  165. package/src/lib/perf-tuning.js +109 -1
  166. package/src/lib/permanent-memory.js +320 -0
  167. package/src/lib/permission-engine.js +81 -0
  168. package/src/lib/pipeline-orchestrator.js +105 -0
  169. package/src/lib/plan-mode.js +81 -0
  170. package/src/lib/plugin-ecosystem.js +377 -0
  171. package/src/lib/pqc-manager.js +368 -0
  172. package/src/lib/prompt-compressor.js +1 -10
  173. package/src/lib/protocol-fusion.js +417 -0
  174. package/src/lib/quantization.js +325 -0
  175. package/src/lib/response-cache.js +327 -0
  176. package/src/lib/scim-manager.js +329 -0
  177. package/src/lib/service-container.js +81 -0
  178. package/src/lib/session-consolidator.js +105 -0
  179. package/src/lib/session-hooks.js +81 -0
  180. package/src/lib/session-manager.js +329 -0
  181. package/src/lib/session-search.js +81 -0
  182. package/src/lib/session-tail.js +81 -0
  183. package/src/lib/session-usage.js +83 -0
  184. package/src/lib/siem-exporter.js +105 -0
  185. package/src/lib/skill-loader.js +377 -0
  186. package/src/lib/slot-filler.js +81 -0
  187. package/src/lib/social-graph-analytics.js +81 -0
  188. package/src/lib/social-graph.js +81 -0
  189. package/src/lib/social-manager.js +326 -0
  190. package/src/lib/sso-manager.js +332 -0
  191. package/src/lib/sub-agent-registry.js +110 -0
  192. package/src/lib/sync-manager.js +326 -0
  193. package/src/lib/task-model-selector.js +81 -0
  194. package/src/lib/tech-learning-engine.js +369 -0
  195. package/src/lib/tenant-saas.js +460 -0
  196. package/src/lib/threat-intel.js +335 -0
  197. package/src/lib/todo-manager.js +105 -0
  198. package/src/lib/token-incentive.js +293 -0
  199. package/src/lib/token-tracker.js +329 -0
  200. package/src/lib/topic-classifier.js +105 -0
  201. package/src/lib/trust-security.js +390 -0
  202. package/src/lib/ueba.js +389 -0
  203. package/src/lib/universal-runtime.js +325 -0
  204. package/src/lib/user-profile.js +81 -0
  205. package/src/lib/version-checker.js +81 -0
  206. package/src/lib/wallet-manager.js +326 -0
  207. package/src/lib/web-fetch.js +81 -0
  208. package/src/lib/workflow-engine.js +322 -0
  209. package/src/lib/zkp-engine.js +105 -0
@@ -24,8 +24,49 @@ import {
24
24
  detectLanguage,
25
25
  getTranslationStats,
26
26
  getProtocolFusionStats,
27
+ BRIDGE_MATURITY_V2,
28
+ TRANSLATION_RUN_V2,
29
+ getMaxActiveBridgesPerOperator,
30
+ setMaxActiveBridgesPerOperator,
31
+ getMaxRunningTranslationsPerBridge,
32
+ setMaxRunningTranslationsPerBridge,
33
+ getBridgeIdleMs,
34
+ setBridgeIdleMs,
35
+ getTranslationStuckMs,
36
+ setTranslationStuckMs,
37
+ getActiveBridgeCount,
38
+ getRunningTranslationCount,
39
+ registerBridgeV2,
40
+ getBridgeV2,
41
+ listBridgesV2,
42
+ setBridgeMaturityV2,
43
+ activateBridge,
44
+ degradeBridge,
45
+ deprecateBridge,
46
+ retireBridge,
47
+ touchBridgeUsage,
48
+ enqueueTranslationV2,
49
+ getTranslationV2,
50
+ listTranslationsV2,
51
+ setTranslationStatusV2,
52
+ startTranslation,
53
+ succeedTranslation,
54
+ failTranslation,
55
+ cancelTranslation,
56
+ autoRetireIdleBridges,
57
+ autoFailStuckRunningTranslations,
58
+ getProtocolFusionStatsV2,
27
59
  } from "../lib/protocol-fusion.js";
28
60
 
61
+ function _parseJson(s) {
62
+ if (!s) return undefined;
63
+ try {
64
+ return JSON.parse(s);
65
+ } catch {
66
+ throw new Error(`invalid JSON: ${s}`);
67
+ }
68
+ }
69
+
29
70
  function _dbFromCtx(cmd) {
30
71
  const root = cmd?.parent?.parent ?? cmd?.parent;
31
72
  return root?._db;
@@ -328,5 +369,222 @@ export function registerFusionCommand(program) {
328
369
  );
329
370
  });
330
371
 
372
+ /* ── V2 Surface (Phase 72-73) ─────────────────────────── */
373
+
374
+ fu.command("bridge-maturities-v2")
375
+ .description("List BRIDGE_MATURITY_V2 enum values")
376
+ .action(() => {
377
+ for (const v of Object.values(BRIDGE_MATURITY_V2)) console.log(` ${v}`);
378
+ });
379
+
380
+ fu.command("translation-runs-v2")
381
+ .description("List TRANSLATION_RUN_V2 enum values")
382
+ .action(() => {
383
+ for (const v of Object.values(TRANSLATION_RUN_V2)) console.log(` ${v}`);
384
+ });
385
+
386
+ fu.command("max-active-bridges-per-operator")
387
+ .description("Get current max-active-bridges-per-operator cap")
388
+ .action(() => console.log(getMaxActiveBridgesPerOperator()));
389
+ fu.command("set-max-active-bridges-per-operator <n>")
390
+ .description("Set max-active-bridges-per-operator cap")
391
+ .action((n) => console.log(setMaxActiveBridgesPerOperator(Number(n))));
392
+
393
+ fu.command("max-running-translations-per-bridge")
394
+ .description("Get current max-running-translations-per-bridge cap")
395
+ .action(() => console.log(getMaxRunningTranslationsPerBridge()));
396
+ fu.command("set-max-running-translations-per-bridge <n>")
397
+ .description("Set max-running-translations-per-bridge cap")
398
+ .action((n) => console.log(setMaxRunningTranslationsPerBridge(Number(n))));
399
+
400
+ fu.command("bridge-idle-ms")
401
+ .description("Get current bridge-idle-ms threshold")
402
+ .action(() => console.log(getBridgeIdleMs()));
403
+ fu.command("set-bridge-idle-ms <n>")
404
+ .description("Set bridge-idle-ms threshold")
405
+ .action((n) => console.log(setBridgeIdleMs(Number(n))));
406
+
407
+ fu.command("translation-stuck-ms")
408
+ .description("Get current translation-stuck-ms threshold")
409
+ .action(() => console.log(getTranslationStuckMs()));
410
+ fu.command("set-translation-stuck-ms <n>")
411
+ .description("Set translation-stuck-ms threshold")
412
+ .action((n) => console.log(setTranslationStuckMs(Number(n))));
413
+
414
+ fu.command("active-bridge-count")
415
+ .description(
416
+ "Count non-retired, non-provisional bridges (optionally by operator)",
417
+ )
418
+ .option("-o, --operator <operator>", "scope to operator")
419
+ .action((opts) => console.log(getActiveBridgeCount(opts.operator)));
420
+
421
+ fu.command("running-translation-count")
422
+ .description("Count RUNNING translations (optionally by bridge)")
423
+ .option("-b, --bridge <bridge>", "scope to bridge")
424
+ .action((opts) => console.log(getRunningTranslationCount(opts.bridge)));
425
+
426
+ fu.command("register-bridge-v2 <bridge-id>")
427
+ .description("Register V2 bridge (provisional by default)")
428
+ .requiredOption("-o, --operator <operator>", "operator id")
429
+ .requiredOption("-s, --source <protocol>", "source protocol")
430
+ .requiredOption("-t, --target <protocol>", "target protocol")
431
+ .option(
432
+ "-i, --initial <status>",
433
+ "initial status",
434
+ BRIDGE_MATURITY_V2.PROVISIONAL,
435
+ )
436
+ .option("--metadata <json>", "metadata JSON")
437
+ .action((id, opts) => {
438
+ const b = registerBridgeV2({
439
+ id,
440
+ operator: opts.operator,
441
+ sourceProtocol: opts.source,
442
+ targetProtocol: opts.target,
443
+ initialStatus: opts.initial,
444
+ metadata: _parseJson(opts.metadata),
445
+ });
446
+ console.log(JSON.stringify(b, null, 2));
447
+ });
448
+
449
+ fu.command("bridge-v2 <bridge-id>")
450
+ .description("Show V2 bridge state")
451
+ .action((id) => {
452
+ const b = getBridgeV2(id);
453
+ if (!b) return console.error(`bridge ${id} not found`);
454
+ console.log(JSON.stringify(b, null, 2));
455
+ });
456
+
457
+ fu.command("list-bridges-v2")
458
+ .description("List V2 bridges")
459
+ .option("-o, --operator <operator>", "filter by operator")
460
+ .option("-s, --status <status>", "filter by status")
461
+ .action((opts) => {
462
+ console.log(JSON.stringify(listBridgesV2(opts), null, 2));
463
+ });
464
+
465
+ fu.command("set-bridge-maturity-v2 <bridge-id> <status>")
466
+ .description("Transition V2 bridge maturity")
467
+ .option("-r, --reason <reason>", "transition reason")
468
+ .option("--metadata <json>", "metadata patch JSON")
469
+ .action((id, status, opts) => {
470
+ const b = setBridgeMaturityV2(id, status, {
471
+ reason: opts.reason,
472
+ metadata: _parseJson(opts.metadata),
473
+ });
474
+ console.log(JSON.stringify(b, null, 2));
475
+ });
476
+
477
+ for (const [name, fn] of [
478
+ ["activate-bridge", activateBridge],
479
+ ["degrade-bridge", degradeBridge],
480
+ ["deprecate-bridge", deprecateBridge],
481
+ ["retire-bridge", retireBridge],
482
+ ]) {
483
+ fu.command(`${name} <bridge-id>`)
484
+ .description(`Shortcut for ${name.replace("-bridge", "")} transition`)
485
+ .option("-r, --reason <reason>", "transition reason")
486
+ .action((id, opts) => {
487
+ const b = fn(id, { reason: opts.reason });
488
+ console.log(JSON.stringify(b, null, 2));
489
+ });
490
+ }
491
+
492
+ fu.command("touch-bridge-usage <bridge-id>")
493
+ .description("Mark V2 bridge as used now (for idle auto-retire)")
494
+ .action((id) => {
495
+ const b = touchBridgeUsage(id);
496
+ console.log(JSON.stringify(b, null, 2));
497
+ });
498
+
499
+ fu.command("enqueue-translation-v2 <translation-id>")
500
+ .description("Enqueue a V2 translation run")
501
+ .requiredOption("-b, --bridge <bridge>", "bridge id")
502
+ .requiredOption("-t, --target <lang>", "target language")
503
+ .requiredOption("-x, --text <text>", "text to translate")
504
+ .option("-s, --source <lang>", "source language", "auto")
505
+ .option("--metadata <json>", "metadata JSON")
506
+ .action((id, opts) => {
507
+ const t = enqueueTranslationV2({
508
+ id,
509
+ bridgeId: opts.bridge,
510
+ targetLang: opts.target,
511
+ text: opts.text,
512
+ sourceLang: opts.source,
513
+ metadata: _parseJson(opts.metadata),
514
+ });
515
+ console.log(JSON.stringify(t, null, 2));
516
+ });
517
+
518
+ fu.command("translation-v2 <translation-id>")
519
+ .description("Show V2 translation state")
520
+ .action((id) => {
521
+ const t = getTranslationV2(id);
522
+ if (!t) return console.error(`translation ${id} not found`);
523
+ console.log(JSON.stringify(t, null, 2));
524
+ });
525
+
526
+ fu.command("list-translations-v2")
527
+ .description("List V2 translations")
528
+ .option("-b, --bridge <bridge>", "filter by bridge")
529
+ .option("-s, --status <status>", "filter by status")
530
+ .action((opts) => {
531
+ console.log(JSON.stringify(listTranslationsV2(opts), null, 2));
532
+ });
533
+
534
+ fu.command("set-translation-status-v2 <translation-id> <status>")
535
+ .description("Transition V2 translation status")
536
+ .option("-r, --reason <reason>", "transition reason")
537
+ .option("--metadata <json>", "metadata patch JSON")
538
+ .option("--result <json>", "result JSON (on success)")
539
+ .action((id, status, opts) => {
540
+ const t = setTranslationStatusV2(id, status, {
541
+ reason: opts.reason,
542
+ metadata: _parseJson(opts.metadata),
543
+ result: _parseJson(opts.result),
544
+ });
545
+ console.log(JSON.stringify(t, null, 2));
546
+ });
547
+
548
+ for (const [name, fn] of [
549
+ ["start-translation", startTranslation],
550
+ ["succeed-translation", succeedTranslation],
551
+ ["fail-translation", failTranslation],
552
+ ["cancel-translation", cancelTranslation],
553
+ ]) {
554
+ fu.command(`${name} <translation-id>`)
555
+ .description(
556
+ `Shortcut for ${name.replace("-translation", "")} transition`,
557
+ )
558
+ .option("-r, --reason <reason>", "transition reason")
559
+ .action((id, opts) => {
560
+ const t = fn(id, { reason: opts.reason });
561
+ console.log(JSON.stringify(t, null, 2));
562
+ });
563
+ }
564
+
565
+ fu.command("auto-retire-idle-bridges")
566
+ .description(
567
+ "Bulk-retire ACTIVE/DEGRADED/DEPRECATED bridges whose lastUsedAt is older than bridgeIdleMs",
568
+ )
569
+ .action(() => {
570
+ const flipped = autoRetireIdleBridges();
571
+ console.log(JSON.stringify({ flipped }, null, 2));
572
+ });
573
+
574
+ fu.command("auto-fail-stuck-running-translations")
575
+ .description(
576
+ "Bulk-fail RUNNING translations whose startedAt is older than translationStuckMs",
577
+ )
578
+ .action(() => {
579
+ const flipped = autoFailStuckRunningTranslations();
580
+ console.log(JSON.stringify({ flipped }, null, 2));
581
+ });
582
+
583
+ fu.command("stats-v2")
584
+ .description("Show V2 stats with all-enum zero-initialized counters")
585
+ .action(() => {
586
+ console.log(JSON.stringify(getProtocolFusionStatsV2(), null, 2));
587
+ });
588
+
331
589
  program.addCommand(fu);
332
590
  }
@@ -212,4 +212,49 @@ export function registerGitCommand(program) {
212
212
  process.exit(1);
213
213
  }
214
214
  });
215
+
216
+ _registerGitV2(git);
217
+ }
218
+
219
+
220
+ import {
221
+ GIT_REPO_MATURITY_V2, GIT_COMMIT_LIFECYCLE_V2,
222
+ setMaxActiveGitReposPerOwnerV2, setMaxPendingGitCommitsPerRepoV2, setGitRepoIdleMsV2, setGitCommitStuckMsV2,
223
+ registerGitRepoV2, activateGitRepoV2, archiveGitRepoV2, decommissionGitRepoV2, touchGitRepoV2, getGitRepoV2, listGitReposV2,
224
+ createGitCommitV2, startGitCommitV2, commitGitCommitV2, failGitCommitV2, cancelGitCommitV2, getGitCommitV2, listGitCommitsV2,
225
+ autoArchiveIdleGitReposV2, autoFailStuckGitCommitsV2, getGitIntegrationGovStatsV2,
226
+ } from "../lib/git-integration.js";
227
+
228
+ function _registerGitV2(parent) {
229
+ parent.command("enums-v2").description("List Git V2 enums").option("--json", "JSON").action((opts) => {
230
+ const out = { repoMaturity: GIT_REPO_MATURITY_V2, commitLifecycle: GIT_COMMIT_LIFECYCLE_V2 };
231
+ if (opts.json) console.log(JSON.stringify(out, null, 2)); else console.log(out);
232
+ });
233
+ parent.command("config-set-v2").description("Set Git V2 caps/thresholds").option("--max-active <n>", "max active repos per owner").option("--max-pending <n>", "max pending commits per repo").option("--idle-ms <n>", "repo idle ms").option("--stuck-ms <n>", "commit stuck ms").action((opts) => {
234
+ if (opts.maxActive) setMaxActiveGitReposPerOwnerV2(parseInt(opts.maxActive, 10));
235
+ if (opts.maxPending) setMaxPendingGitCommitsPerRepoV2(parseInt(opts.maxPending, 10));
236
+ if (opts.idleMs) setGitRepoIdleMsV2(parseInt(opts.idleMs, 10));
237
+ if (opts.stuckMs) setGitCommitStuckMsV2(parseInt(opts.stuckMs, 10));
238
+ console.log("ok");
239
+ });
240
+ parent.command("register-repo-v2 <id>").description("Register Git V2 repo").requiredOption("--owner <owner>", "owner").option("--branch <branch>", "branch").option("--json", "JSON").action((id, opts) => {
241
+ const r = registerGitRepoV2({ id, owner: opts.owner, branch: opts.branch });
242
+ if (opts.json) console.log(JSON.stringify(r, null, 2)); else console.log(r);
243
+ });
244
+ parent.command("activate-repo-v2 <id>").description("Activate Git V2 repo").action((id) => { console.log(activateGitRepoV2(id)); });
245
+ parent.command("archive-repo-v2 <id>").description("Archive Git V2 repo").action((id) => { console.log(archiveGitRepoV2(id)); });
246
+ parent.command("decommission-repo-v2 <id>").description("Decommission Git V2 repo").action((id) => { console.log(decommissionGitRepoV2(id)); });
247
+ parent.command("touch-repo-v2 <id>").description("Touch Git V2 repo").action((id) => { console.log(touchGitRepoV2(id)); });
248
+ parent.command("get-repo-v2 <id>").description("Get Git V2 repo").option("--json", "JSON").action((id, opts) => { const r = getGitRepoV2(id); if (opts.json) console.log(JSON.stringify(r, null, 2)); else console.log(r); });
249
+ parent.command("list-repos-v2").description("List Git V2 repos").option("--json", "JSON").action((opts) => { const r = listGitReposV2(); if (opts.json) console.log(JSON.stringify(r, null, 2)); else console.log(r); });
250
+ parent.command("create-commit-v2 <id>").description("Create Git V2 commit").requiredOption("--repo-id <repoId>", "repo id").option("--message <msg>", "commit message").action((id, opts) => { console.log(createGitCommitV2({ id, repoId: opts.repoId, message: opts.message })); });
251
+ parent.command("start-commit-v2 <id>").description("Start Git V2 commit").action((id) => { console.log(startGitCommitV2(id)); });
252
+ parent.command("commit-commit-v2 <id>").description("Commit Git V2 commit").action((id) => { console.log(commitGitCommitV2(id)); });
253
+ parent.command("fail-commit-v2 <id>").description("Fail Git V2 commit").option("--reason <r>", "reason").action((id, opts) => { console.log(failGitCommitV2(id, opts.reason)); });
254
+ parent.command("cancel-commit-v2 <id>").description("Cancel Git V2 commit").option("--reason <r>", "reason").action((id, opts) => { console.log(cancelGitCommitV2(id, opts.reason)); });
255
+ parent.command("get-commit-v2 <id>").description("Get Git V2 commit").action((id) => { console.log(getGitCommitV2(id)); });
256
+ parent.command("list-commits-v2").description("List Git V2 commits").action(() => { console.log(listGitCommitsV2()); });
257
+ parent.command("auto-archive-repos-v2").description("Auto-archive idle Git V2 repos").action(() => { console.log(autoArchiveIdleGitReposV2()); });
258
+ parent.command("auto-fail-commits-v2").description("Auto-fail stuck Git V2 commits").action(() => { console.log(autoFailStuckGitCommitsV2()); });
259
+ parent.command("gov-stats-v2").description("Git V2 governance stats").option("--json", "JSON").action((opts) => { const s = getGitIntegrationGovStatsV2(); if (opts.json) console.log(JSON.stringify(s, null, 2)); else console.log(s); });
215
260
  }
@@ -25,6 +25,38 @@ import {
25
25
  analyzeImpact,
26
26
  predictVote,
27
27
  getGovernanceStats,
28
+ PROPOSER_MATURITY_V2,
29
+ DELEGATION_LIFECYCLE_V2,
30
+ getDefaultMaxActiveProposersPerRealmV2,
31
+ getMaxActiveProposersPerRealmV2,
32
+ setMaxActiveProposersPerRealmV2,
33
+ getDefaultMaxActiveDelegationsPerDelegatorV2,
34
+ getMaxActiveDelegationsPerDelegatorV2,
35
+ setMaxActiveDelegationsPerDelegatorV2,
36
+ getDefaultProposerIdleMsV2,
37
+ getProposerIdleMsV2,
38
+ setProposerIdleMsV2,
39
+ getDefaultPendingDelegationMsV2,
40
+ getPendingDelegationMsV2,
41
+ setPendingDelegationMsV2,
42
+ registerProposerV2,
43
+ getProposerV2,
44
+ setProposerMaturityV2,
45
+ activateProposer,
46
+ suspendProposer,
47
+ retireProposer,
48
+ touchProposerActivity,
49
+ createDelegationV2,
50
+ getDelegationV2,
51
+ setDelegationStatusV2,
52
+ activateDelegation,
53
+ revokeDelegation,
54
+ expireDelegation,
55
+ getActiveProposerCount,
56
+ getActiveDelegationCount,
57
+ autoRetireIdleProposers,
58
+ autoExpireStalePendingDelegations,
59
+ getGovernanceStatsV2,
28
60
  } from "../lib/community-governance.js";
29
61
 
30
62
  function _dbFromCtx(ctx) {
@@ -502,4 +534,297 @@ export function registerGovernanceCommand(program) {
502
534
  process.exit(1);
503
535
  }
504
536
  });
537
+
538
+ /* ═════════════════════════════════════════════════════════════
539
+ * Phase 54 V2 — Proposer + Delegation V2 subcommands (in-memory,
540
+ * no DB bootstrap needed)
541
+ * ═══════════════════════════════════════════════════════════ */
542
+
543
+ gov
544
+ .command("proposer-maturities-v2")
545
+ .description("List proposer V2 maturity states")
546
+ .option("--json", "JSON output")
547
+ .action((opts) => {
548
+ const s = Object.values(PROPOSER_MATURITY_V2);
549
+ if (opts.json) console.log(JSON.stringify(s));
550
+ else s.forEach((v) => console.log(v));
551
+ });
552
+
553
+ gov
554
+ .command("delegation-lifecycles-v2")
555
+ .description("List delegation V2 lifecycle states")
556
+ .option("--json", "JSON output")
557
+ .action((opts) => {
558
+ const s = Object.values(DELEGATION_LIFECYCLE_V2);
559
+ if (opts.json) console.log(JSON.stringify(s));
560
+ else s.forEach((v) => console.log(v));
561
+ });
562
+
563
+ gov
564
+ .command("default-max-active-proposers-per-realm")
565
+ .description("Default per-realm active proposer cap")
566
+ .action(() => console.log(getDefaultMaxActiveProposersPerRealmV2()));
567
+
568
+ gov
569
+ .command("max-active-proposers-per-realm")
570
+ .description("Current per-realm active proposer cap")
571
+ .action(() => console.log(getMaxActiveProposersPerRealmV2()));
572
+
573
+ gov
574
+ .command("set-max-active-proposers-per-realm <n>")
575
+ .description("Set per-realm active proposer cap")
576
+ .action((n) => console.log(setMaxActiveProposersPerRealmV2(Number(n))));
577
+
578
+ gov
579
+ .command("default-max-active-delegations-per-delegator")
580
+ .description("Default per-delegator active delegation cap")
581
+ .action(() => console.log(getDefaultMaxActiveDelegationsPerDelegatorV2()));
582
+
583
+ gov
584
+ .command("max-active-delegations-per-delegator")
585
+ .description("Current per-delegator active delegation cap")
586
+ .action(() => console.log(getMaxActiveDelegationsPerDelegatorV2()));
587
+
588
+ gov
589
+ .command("set-max-active-delegations-per-delegator <n>")
590
+ .description("Set per-delegator active delegation cap")
591
+ .action((n) =>
592
+ console.log(setMaxActiveDelegationsPerDelegatorV2(Number(n))),
593
+ );
594
+
595
+ gov
596
+ .command("default-proposer-idle-ms")
597
+ .description("Default proposer idle window (ms)")
598
+ .action(() => console.log(getDefaultProposerIdleMsV2()));
599
+
600
+ gov
601
+ .command("proposer-idle-ms")
602
+ .description("Current proposer idle window (ms)")
603
+ .action(() => console.log(getProposerIdleMsV2()));
604
+
605
+ gov
606
+ .command("set-proposer-idle-ms <ms>")
607
+ .description("Set proposer idle window (ms)")
608
+ .action((ms) => console.log(setProposerIdleMsV2(Number(ms))));
609
+
610
+ gov
611
+ .command("default-pending-delegation-ms")
612
+ .description("Default pending delegation window (ms)")
613
+ .action(() => console.log(getDefaultPendingDelegationMsV2()));
614
+
615
+ gov
616
+ .command("pending-delegation-ms")
617
+ .description("Current pending delegation window (ms)")
618
+ .action(() => console.log(getPendingDelegationMsV2()));
619
+
620
+ gov
621
+ .command("set-pending-delegation-ms <ms>")
622
+ .description("Set pending delegation window (ms)")
623
+ .action((ms) => console.log(setPendingDelegationMsV2(Number(ms))));
624
+
625
+ gov
626
+ .command("active-proposer-count")
627
+ .description("Count active V2 proposers (scope by realm)")
628
+ .option("-r, --realm <realm>", "Realm scope")
629
+ .action((opts) => console.log(getActiveProposerCount(opts.realm)));
630
+
631
+ gov
632
+ .command("active-delegation-count")
633
+ .description("Count active V2 delegations (scope by delegator)")
634
+ .option("-d, --delegator <id>", "Delegator scope")
635
+ .action((opts) => console.log(getActiveDelegationCount(opts.delegator)));
636
+
637
+ gov
638
+ .command("register-proposer-v2 <proposer-id>")
639
+ .description("Register a V2 proposer")
640
+ .requiredOption("-r, --realm <realm>", "Realm")
641
+ .option("-n, --display-name <name>", "Display name")
642
+ .option(
643
+ "-i, --initial-status <status>",
644
+ "Initial status (default onboarding)",
645
+ )
646
+ .option("-m, --metadata <json>", "Metadata JSON")
647
+ .action((proposerId, opts) => {
648
+ const config = { proposerId, realm: opts.realm };
649
+ if (opts.displayName) config.displayName = opts.displayName;
650
+ if (opts.initialStatus) config.initialStatus = opts.initialStatus;
651
+ if (opts.metadata) config.metadata = JSON.parse(opts.metadata);
652
+ console.log(JSON.stringify(registerProposerV2(null, config), null, 2));
653
+ });
654
+
655
+ gov
656
+ .command("proposer-v2 <proposer-id>")
657
+ .description("Get V2 proposer record")
658
+ .action((proposerId) => {
659
+ console.log(JSON.stringify(getProposerV2(proposerId), null, 2));
660
+ });
661
+
662
+ gov
663
+ .command("set-proposer-maturity-v2 <proposer-id> <status>")
664
+ .description("Set proposer V2 maturity status")
665
+ .option("-r, --reason <reason>", "Reason")
666
+ .option("-m, --metadata <json>", "Metadata JSON patch")
667
+ .action((proposerId, status, opts) => {
668
+ const patch = {};
669
+ if (opts.reason !== undefined) patch.reason = opts.reason;
670
+ if (opts.metadata) patch.metadata = JSON.parse(opts.metadata);
671
+ console.log(
672
+ JSON.stringify(
673
+ setProposerMaturityV2(null, proposerId, status, patch),
674
+ null,
675
+ 2,
676
+ ),
677
+ );
678
+ });
679
+
680
+ gov
681
+ .command("activate-proposer <proposer-id>")
682
+ .description("Activate V2 proposer")
683
+ .option("-r, --reason <reason>", "Reason")
684
+ .action((proposerId, opts) => {
685
+ console.log(
686
+ JSON.stringify(
687
+ activateProposer(null, proposerId, opts.reason),
688
+ null,
689
+ 2,
690
+ ),
691
+ );
692
+ });
693
+
694
+ gov
695
+ .command("suspend-proposer <proposer-id>")
696
+ .description("Suspend V2 proposer")
697
+ .option("-r, --reason <reason>", "Reason")
698
+ .action((proposerId, opts) => {
699
+ console.log(
700
+ JSON.stringify(suspendProposer(null, proposerId, opts.reason), null, 2),
701
+ );
702
+ });
703
+
704
+ gov
705
+ .command("retire-proposer <proposer-id>")
706
+ .description("Retire V2 proposer (terminal)")
707
+ .option("-r, --reason <reason>", "Reason")
708
+ .action((proposerId, opts) => {
709
+ console.log(
710
+ JSON.stringify(retireProposer(null, proposerId, opts.reason), null, 2),
711
+ );
712
+ });
713
+
714
+ gov
715
+ .command("touch-proposer-activity <proposer-id>")
716
+ .description("Touch V2 proposer lastActivityAt")
717
+ .action((proposerId) => {
718
+ console.log(JSON.stringify(touchProposerActivity(proposerId), null, 2));
719
+ });
720
+
721
+ gov
722
+ .command("create-delegation-v2 <delegation-id>")
723
+ .description("Create V2 vote delegation")
724
+ .requiredOption("-d, --delegator <id>", "Delegator ID")
725
+ .requiredOption("-t, --delegatee <id>", "Delegatee ID")
726
+ .requiredOption("-s, --scope <scope>", "Scope")
727
+ .option("-e, --expires-at <ms>", "Expires-at epoch ms")
728
+ .option("-m, --metadata <json>", "Metadata JSON")
729
+ .action((delegationId, opts) => {
730
+ const config = {
731
+ delegationId,
732
+ delegatorId: opts.delegator,
733
+ delegateeId: opts.delegatee,
734
+ scope: opts.scope,
735
+ };
736
+ if (opts.expiresAt) config.expiresAt = Number(opts.expiresAt);
737
+ if (opts.metadata) config.metadata = JSON.parse(opts.metadata);
738
+ console.log(JSON.stringify(createDelegationV2(null, config), null, 2));
739
+ });
740
+
741
+ gov
742
+ .command("delegation-v2 <delegation-id>")
743
+ .description("Get V2 delegation record")
744
+ .action((delegationId) => {
745
+ console.log(JSON.stringify(getDelegationV2(delegationId), null, 2));
746
+ });
747
+
748
+ gov
749
+ .command("set-delegation-status-v2 <delegation-id> <status>")
750
+ .description("Set delegation V2 status")
751
+ .option("-r, --reason <reason>", "Reason")
752
+ .option("-m, --metadata <json>", "Metadata JSON patch")
753
+ .action((delegationId, status, opts) => {
754
+ const patch = {};
755
+ if (opts.reason !== undefined) patch.reason = opts.reason;
756
+ if (opts.metadata) patch.metadata = JSON.parse(opts.metadata);
757
+ console.log(
758
+ JSON.stringify(
759
+ setDelegationStatusV2(null, delegationId, status, patch),
760
+ null,
761
+ 2,
762
+ ),
763
+ );
764
+ });
765
+
766
+ gov
767
+ .command("activate-delegation <delegation-id>")
768
+ .description("Activate V2 delegation")
769
+ .option("-r, --reason <reason>", "Reason")
770
+ .action((delegationId, opts) => {
771
+ console.log(
772
+ JSON.stringify(
773
+ activateDelegation(null, delegationId, opts.reason),
774
+ null,
775
+ 2,
776
+ ),
777
+ );
778
+ });
779
+
780
+ gov
781
+ .command("revoke-delegation <delegation-id>")
782
+ .description("Revoke V2 delegation (terminal)")
783
+ .option("-r, --reason <reason>", "Reason")
784
+ .action((delegationId, opts) => {
785
+ console.log(
786
+ JSON.stringify(
787
+ revokeDelegation(null, delegationId, opts.reason),
788
+ null,
789
+ 2,
790
+ ),
791
+ );
792
+ });
793
+
794
+ gov
795
+ .command("expire-delegation <delegation-id>")
796
+ .description("Expire V2 delegation (terminal)")
797
+ .option("-r, --reason <reason>", "Reason")
798
+ .action((delegationId, opts) => {
799
+ console.log(
800
+ JSON.stringify(
801
+ expireDelegation(null, delegationId, opts.reason),
802
+ null,
803
+ 2,
804
+ ),
805
+ );
806
+ });
807
+
808
+ gov
809
+ .command("auto-retire-idle-proposers")
810
+ .description("Auto-retire active/suspended proposers past idle window")
811
+ .action(() => {
812
+ console.log(JSON.stringify(autoRetireIdleProposers(null), null, 2));
813
+ });
814
+
815
+ gov
816
+ .command("auto-expire-stale-pending-delegations")
817
+ .description("Auto-expire pending delegations past window")
818
+ .action(() => {
819
+ console.log(
820
+ JSON.stringify(autoExpireStalePendingDelegations(null), null, 2),
821
+ );
822
+ });
823
+
824
+ gov
825
+ .command("stats-v2")
826
+ .description("V2 governance statistics")
827
+ .action(() => {
828
+ console.log(JSON.stringify(getGovernanceStatsV2(), null, 2));
829
+ });
505
830
  }