chainlesschain 0.66.0 → 0.132.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.
- package/bin/chainlesschain.js +0 -0
- package/package.json +1 -1
- package/src/commands/a2a.js +380 -0
- package/src/commands/agent-network.js +254 -1
- package/src/commands/audit.js +302 -0
- package/src/commands/automation.js +271 -1
- package/src/commands/bi.js +348 -0
- package/src/commands/codegen.js +224 -0
- package/src/commands/collab.js +341 -0
- package/src/commands/compliance.js +1035 -0
- package/src/commands/cowork.js +221 -0
- package/src/commands/crosschain.js +218 -0
- package/src/commands/dbevo.js +284 -0
- package/src/commands/dev.js +252 -0
- package/src/commands/did.js +358 -0
- package/src/commands/dlp.js +341 -0
- package/src/commands/encrypt.js +341 -0
- package/src/commands/evomap.js +394 -0
- package/src/commands/export.js +256 -1
- package/src/commands/federation.js +283 -0
- package/src/commands/fusion.js +258 -0
- package/src/commands/governance.js +325 -0
- package/src/commands/hardening.js +411 -0
- package/src/commands/hook.js +148 -0
- package/src/commands/import.js +252 -0
- package/src/commands/incentive.js +322 -0
- package/src/commands/inference.js +318 -0
- package/src/commands/infra.js +244 -0
- package/src/commands/instinct.js +260 -0
- package/src/commands/ipfs.js +318 -0
- package/src/commands/kg.js +387 -0
- package/src/commands/llm.js +263 -0
- package/src/commands/lowcode.js +356 -0
- package/src/commands/marketplace.js +256 -0
- package/src/commands/mcp.js +221 -0
- package/src/commands/memory.js +248 -0
- package/src/commands/multimodal.js +296 -0
- package/src/commands/nlprog.js +356 -0
- package/src/commands/note.js +244 -0
- package/src/commands/ops.js +354 -0
- package/src/commands/orchestrate.js +166 -0
- package/src/commands/org.js +277 -0
- package/src/commands/p2p.js +390 -0
- package/src/commands/perception.js +290 -0
- package/src/commands/permmem.js +251 -0
- package/src/commands/plugin-ecosystem.js +273 -0
- package/src/commands/pqc.js +393 -0
- package/src/commands/privacy.js +321 -0
- package/src/commands/quantization.js +351 -0
- package/src/commands/rcache.js +271 -0
- package/src/commands/recommend.js +340 -0
- package/src/commands/reputation.js +261 -0
- package/src/commands/runtime.js +307 -0
- package/src/commands/scim.js +262 -0
- package/src/commands/session.js +258 -0
- package/src/commands/siem.js +246 -0
- package/src/commands/skill.js +267 -1
- package/src/commands/sla.js +259 -0
- package/src/commands/social.js +256 -0
- package/src/commands/sso.js +186 -1
- package/src/commands/stress.js +230 -0
- package/src/commands/sync.js +256 -0
- package/src/commands/tech.js +338 -0
- package/src/commands/tenant.js +351 -0
- package/src/commands/terraform.js +245 -0
- package/src/commands/tokens.js +269 -0
- package/src/commands/trust.js +249 -0
- package/src/commands/wallet.js +277 -0
- package/src/commands/workflow.js +171 -0
- package/src/commands/zkp.js +335 -0
- package/src/index.js +4 -0
- package/src/lib/a2a-protocol.js +451 -0
- package/src/lib/agent-coordinator.js +325 -0
- package/src/lib/agent-network.js +387 -0
- package/src/lib/agent-router.js +395 -0
- package/src/lib/aiops.js +478 -0
- package/src/lib/app-builder.js +239 -0
- package/src/lib/audit-logger.js +379 -0
- package/src/lib/automation-engine.js +330 -0
- package/src/lib/autonomous-developer.js +350 -0
- package/src/lib/bi-engine.js +338 -0
- package/src/lib/code-agent.js +323 -0
- package/src/lib/collaboration-governance.js +364 -0
- package/src/lib/community-governance.js +436 -0
- package/src/lib/compliance-manager.js +434 -0
- package/src/lib/content-recommendation.js +469 -0
- package/src/lib/cross-chain.js +345 -0
- package/src/lib/crypto-manager.js +350 -0
- package/src/lib/dbevo.js +338 -0
- package/src/lib/decentral-infra.js +340 -0
- package/src/lib/did-manager.js +367 -0
- package/src/lib/dlp-engine.js +389 -0
- package/src/lib/evomap-federation.js +177 -0
- package/src/lib/evomap-governance.js +276 -0
- package/src/lib/federation-hardening.js +259 -0
- package/src/lib/hardening-manager.js +348 -0
- package/src/lib/hook-manager.js +380 -0
- package/src/lib/inference-network.js +330 -0
- package/src/lib/instinct-manager.js +332 -0
- package/src/lib/ipfs-storage.js +334 -0
- package/src/lib/knowledge-exporter.js +381 -0
- package/src/lib/knowledge-graph.js +432 -0
- package/src/lib/knowledge-importer.js +379 -0
- package/src/lib/llm-providers.js +391 -0
- package/src/lib/mcp-registry.js +333 -0
- package/src/lib/memory-manager.js +330 -0
- package/src/lib/multimodal.js +346 -0
- package/src/lib/nl-programming.js +343 -0
- package/src/lib/note-versioning.js +327 -0
- package/src/lib/org-manager.js +323 -0
- package/src/lib/p2p-manager.js +387 -0
- package/src/lib/perception.js +346 -0
- package/src/lib/perf-tuning.js +4 -1
- package/src/lib/permanent-memory.js +320 -0
- package/src/lib/plugin-ecosystem.js +377 -0
- package/src/lib/pqc-manager.js +368 -0
- package/src/lib/privacy-computing.js +427 -0
- package/src/lib/protocol-fusion.js +417 -0
- package/src/lib/quantization.js +325 -0
- package/src/lib/reputation-optimizer.js +299 -0
- package/src/lib/response-cache.js +327 -0
- package/src/lib/scim-manager.js +329 -0
- package/src/lib/session-manager.js +329 -0
- package/src/lib/siem-exporter.js +333 -0
- package/src/lib/skill-loader.js +377 -0
- package/src/lib/skill-marketplace.js +325 -0
- package/src/lib/sla-manager.js +275 -0
- package/src/lib/social-manager.js +326 -0
- package/src/lib/sso-manager.js +332 -0
- package/src/lib/stress-tester.js +330 -0
- package/src/lib/sync-manager.js +326 -0
- package/src/lib/tech-learning-engine.js +369 -0
- package/src/lib/tenant-saas.js +460 -0
- package/src/lib/terraform-manager.js +363 -0
- package/src/lib/threat-intel.js +335 -0
- package/src/lib/token-incentive.js +293 -0
- package/src/lib/token-tracker.js +329 -0
- package/src/lib/trust-security.js +390 -0
- package/src/lib/ueba.js +389 -0
- package/src/lib/universal-runtime.js +325 -0
- package/src/lib/wallet-manager.js +326 -0
- package/src/lib/workflow-engine.js +322 -0
- package/src/lib/zkp-engine.js +274 -0
package/src/commands/note.js
CHANGED
|
@@ -14,6 +14,35 @@ import {
|
|
|
14
14
|
simpleDiff,
|
|
15
15
|
formatDiff,
|
|
16
16
|
revertToVersion,
|
|
17
|
+
NOTE_MATURITY_V2,
|
|
18
|
+
REVISION_LIFECYCLE_V2,
|
|
19
|
+
getMaxActiveNotesPerAuthorV2,
|
|
20
|
+
setMaxActiveNotesPerAuthorV2,
|
|
21
|
+
getMaxOpenRevsPerNoteV2,
|
|
22
|
+
setMaxOpenRevsPerNoteV2,
|
|
23
|
+
getNoteIdleMsV2,
|
|
24
|
+
setNoteIdleMsV2,
|
|
25
|
+
getRevStuckMsV2,
|
|
26
|
+
setRevStuckMsV2,
|
|
27
|
+
getActiveNoteCountV2,
|
|
28
|
+
getOpenRevCountV2,
|
|
29
|
+
registerNoteV2,
|
|
30
|
+
getNoteV2,
|
|
31
|
+
listNotesV2,
|
|
32
|
+
activateNoteV2,
|
|
33
|
+
lockNoteV2,
|
|
34
|
+
archiveNoteV2,
|
|
35
|
+
touchNoteV2,
|
|
36
|
+
createRevisionV2,
|
|
37
|
+
getRevisionV2,
|
|
38
|
+
listRevisionsV2,
|
|
39
|
+
reviewRevisionV2,
|
|
40
|
+
applyRevisionV2,
|
|
41
|
+
supersedeRevisionV2,
|
|
42
|
+
discardRevisionV2,
|
|
43
|
+
autoLockIdleNotesV2,
|
|
44
|
+
autoDiscardStaleRevisionsV2,
|
|
45
|
+
getNoteVersioningStatsV2,
|
|
17
46
|
} from "../lib/note-versioning.js";
|
|
18
47
|
|
|
19
48
|
/**
|
|
@@ -486,4 +515,219 @@ export function registerNoteCommand(program) {
|
|
|
486
515
|
process.exit(1);
|
|
487
516
|
}
|
|
488
517
|
});
|
|
518
|
+
|
|
519
|
+
// ─── V2 governance surface ─────────────────────────────────
|
|
520
|
+
|
|
521
|
+
note
|
|
522
|
+
.command("note-maturities-v2")
|
|
523
|
+
.description("List V2 note maturity states")
|
|
524
|
+
.action(() => {
|
|
525
|
+
console.log(JSON.stringify(Object.values(NOTE_MATURITY_V2), null, 2));
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
note
|
|
529
|
+
.command("revision-lifecycles-v2")
|
|
530
|
+
.description("List V2 revision lifecycle states")
|
|
531
|
+
.action(() => {
|
|
532
|
+
console.log(
|
|
533
|
+
JSON.stringify(Object.values(REVISION_LIFECYCLE_V2), null, 2),
|
|
534
|
+
);
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
note
|
|
538
|
+
.command("stats-v2")
|
|
539
|
+
.description("Show V2 governance stats")
|
|
540
|
+
.action(() => {
|
|
541
|
+
console.log(JSON.stringify(getNoteVersioningStatsV2(), null, 2));
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
note
|
|
545
|
+
.command("get-max-active-notes-v2")
|
|
546
|
+
.description("Get max active notes per author")
|
|
547
|
+
.action(() => console.log(getMaxActiveNotesPerAuthorV2()));
|
|
548
|
+
|
|
549
|
+
note
|
|
550
|
+
.command("set-max-active-notes-v2 <n>")
|
|
551
|
+
.description("Set max active notes per author")
|
|
552
|
+
.action((n) => {
|
|
553
|
+
setMaxActiveNotesPerAuthorV2(Number(n));
|
|
554
|
+
console.log(getMaxActiveNotesPerAuthorV2());
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
note
|
|
558
|
+
.command("get-max-open-revs-v2")
|
|
559
|
+
.description("Get max open revisions per note")
|
|
560
|
+
.action(() => console.log(getMaxOpenRevsPerNoteV2()));
|
|
561
|
+
|
|
562
|
+
note
|
|
563
|
+
.command("set-max-open-revs-v2 <n>")
|
|
564
|
+
.description("Set max open revisions per note")
|
|
565
|
+
.action((n) => {
|
|
566
|
+
setMaxOpenRevsPerNoteV2(Number(n));
|
|
567
|
+
console.log(getMaxOpenRevsPerNoteV2());
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
note
|
|
571
|
+
.command("get-note-idle-ms-v2")
|
|
572
|
+
.description("Get note idle threshold (ms)")
|
|
573
|
+
.action(() => console.log(getNoteIdleMsV2()));
|
|
574
|
+
|
|
575
|
+
note
|
|
576
|
+
.command("set-note-idle-ms-v2 <n>")
|
|
577
|
+
.description("Set note idle threshold (ms)")
|
|
578
|
+
.action((n) => {
|
|
579
|
+
setNoteIdleMsV2(Number(n));
|
|
580
|
+
console.log(getNoteIdleMsV2());
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
note
|
|
584
|
+
.command("get-rev-stuck-ms-v2")
|
|
585
|
+
.description("Get revision stuck threshold (ms)")
|
|
586
|
+
.action(() => console.log(getRevStuckMsV2()));
|
|
587
|
+
|
|
588
|
+
note
|
|
589
|
+
.command("set-rev-stuck-ms-v2 <n>")
|
|
590
|
+
.description("Set revision stuck threshold (ms)")
|
|
591
|
+
.action((n) => {
|
|
592
|
+
setRevStuckMsV2(Number(n));
|
|
593
|
+
console.log(getRevStuckMsV2());
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
note
|
|
597
|
+
.command("active-note-count-v2 <authorId>")
|
|
598
|
+
.description("Count active notes for an author")
|
|
599
|
+
.action((authorId) => console.log(getActiveNoteCountV2(authorId)));
|
|
600
|
+
|
|
601
|
+
note
|
|
602
|
+
.command("open-rev-count-v2 <noteId>")
|
|
603
|
+
.description("Count open revisions for a note")
|
|
604
|
+
.action((noteId) => console.log(getOpenRevCountV2(noteId)));
|
|
605
|
+
|
|
606
|
+
note
|
|
607
|
+
.command("register-note-v2 <id>")
|
|
608
|
+
.description("Register a V2 note")
|
|
609
|
+
.requiredOption("-a, --author <authorId>", "Author id")
|
|
610
|
+
.requiredOption("-t, --title <title>", "Title")
|
|
611
|
+
.action((id, opts) => {
|
|
612
|
+
const n = registerNoteV2(id, {
|
|
613
|
+
authorId: opts.author,
|
|
614
|
+
title: opts.title,
|
|
615
|
+
});
|
|
616
|
+
console.log(JSON.stringify(n, null, 2));
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
note
|
|
620
|
+
.command("get-note-v2 <id>")
|
|
621
|
+
.description("Get a V2 note")
|
|
622
|
+
.action((id) => {
|
|
623
|
+
const n = getNoteV2(id);
|
|
624
|
+
console.log(n ? JSON.stringify(n, null, 2) : "null");
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
note
|
|
628
|
+
.command("list-notes-v2")
|
|
629
|
+
.description("List V2 notes")
|
|
630
|
+
.option("-a, --author <authorId>", "Filter by author")
|
|
631
|
+
.option("-s, --status <status>", "Filter by status")
|
|
632
|
+
.action((opts) => {
|
|
633
|
+
console.log(
|
|
634
|
+
JSON.stringify(
|
|
635
|
+
listNotesV2({ authorId: opts.author, status: opts.status }),
|
|
636
|
+
null,
|
|
637
|
+
2,
|
|
638
|
+
),
|
|
639
|
+
);
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
note
|
|
643
|
+
.command("activate-note-v2 <id>")
|
|
644
|
+
.description("draft|locked → active")
|
|
645
|
+
.action((id) => console.log(JSON.stringify(activateNoteV2(id), null, 2)));
|
|
646
|
+
|
|
647
|
+
note
|
|
648
|
+
.command("lock-note-v2 <id>")
|
|
649
|
+
.description("active → locked")
|
|
650
|
+
.action((id) => console.log(JSON.stringify(lockNoteV2(id), null, 2)));
|
|
651
|
+
|
|
652
|
+
note
|
|
653
|
+
.command("archive-note-v2 <id>")
|
|
654
|
+
.description("→ archived (terminal)")
|
|
655
|
+
.action((id) => console.log(JSON.stringify(archiveNoteV2(id), null, 2)));
|
|
656
|
+
|
|
657
|
+
note
|
|
658
|
+
.command("touch-note-v2 <id>")
|
|
659
|
+
.description("Update lastSeenAt")
|
|
660
|
+
.action((id) => console.log(JSON.stringify(touchNoteV2(id), null, 2)));
|
|
661
|
+
|
|
662
|
+
note
|
|
663
|
+
.command("create-revision-v2 <id>")
|
|
664
|
+
.description("Create a V2 revision")
|
|
665
|
+
.requiredOption("-n, --note <noteId>", "Note id")
|
|
666
|
+
.requiredOption("-s, --summary <summary>", "Summary")
|
|
667
|
+
.action((id, opts) => {
|
|
668
|
+
const r = createRevisionV2(id, {
|
|
669
|
+
noteId: opts.note,
|
|
670
|
+
summary: opts.summary,
|
|
671
|
+
});
|
|
672
|
+
console.log(JSON.stringify(r, null, 2));
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
note
|
|
676
|
+
.command("get-revision-v2 <id>")
|
|
677
|
+
.description("Get a V2 revision")
|
|
678
|
+
.action((id) => {
|
|
679
|
+
const r = getRevisionV2(id);
|
|
680
|
+
console.log(r ? JSON.stringify(r, null, 2) : "null");
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
note
|
|
684
|
+
.command("list-revisions-v2")
|
|
685
|
+
.description("List V2 revisions")
|
|
686
|
+
.option("-n, --note <noteId>", "Filter by note")
|
|
687
|
+
.option("-s, --status <status>", "Filter by status")
|
|
688
|
+
.action((opts) => {
|
|
689
|
+
console.log(
|
|
690
|
+
JSON.stringify(
|
|
691
|
+
listRevisionsV2({ noteId: opts.note, status: opts.status }),
|
|
692
|
+
null,
|
|
693
|
+
2,
|
|
694
|
+
),
|
|
695
|
+
);
|
|
696
|
+
});
|
|
697
|
+
|
|
698
|
+
note
|
|
699
|
+
.command("review-revision-v2 <id>")
|
|
700
|
+
.description("proposed → reviewed")
|
|
701
|
+
.action((id) => console.log(JSON.stringify(reviewRevisionV2(id), null, 2)));
|
|
702
|
+
|
|
703
|
+
note
|
|
704
|
+
.command("apply-revision-v2 <id>")
|
|
705
|
+
.description("reviewed → applied (non-terminal)")
|
|
706
|
+
.action((id) => console.log(JSON.stringify(applyRevisionV2(id), null, 2)));
|
|
707
|
+
|
|
708
|
+
note
|
|
709
|
+
.command("supersede-revision-v2 <id>")
|
|
710
|
+
.description("reviewed|applied → superseded (terminal)")
|
|
711
|
+
.action((id) =>
|
|
712
|
+
console.log(JSON.stringify(supersedeRevisionV2(id), null, 2)),
|
|
713
|
+
);
|
|
714
|
+
|
|
715
|
+
note
|
|
716
|
+
.command("discard-revision-v2 <id>")
|
|
717
|
+
.description("→ discarded (terminal)")
|
|
718
|
+
.action((id) =>
|
|
719
|
+
console.log(JSON.stringify(discardRevisionV2(id), null, 2)),
|
|
720
|
+
);
|
|
721
|
+
|
|
722
|
+
note
|
|
723
|
+
.command("auto-lock-idle-notes-v2")
|
|
724
|
+
.description("Flip idle active notes → locked")
|
|
725
|
+
.action(() => console.log(JSON.stringify(autoLockIdleNotesV2(), null, 2)));
|
|
726
|
+
|
|
727
|
+
note
|
|
728
|
+
.command("auto-discard-stale-revisions-v2")
|
|
729
|
+
.description("Flip stale proposed/reviewed → discarded")
|
|
730
|
+
.action(() =>
|
|
731
|
+
console.log(JSON.stringify(autoDiscardStaleRevisionsV2(), null, 2)),
|
|
732
|
+
);
|
|
489
733
|
}
|
package/src/commands/ops.js
CHANGED
|
@@ -27,6 +27,39 @@ import {
|
|
|
27
27
|
listPlaybooks,
|
|
28
28
|
generatePostmortem,
|
|
29
29
|
getOpsStats,
|
|
30
|
+
PLAYBOOK_MATURITY_V2,
|
|
31
|
+
REMEDIATION_LIFECYCLE_V2,
|
|
32
|
+
getDefaultMaxActivePlaybooksPerOwnerV2,
|
|
33
|
+
getMaxActivePlaybooksPerOwnerV2,
|
|
34
|
+
setMaxActivePlaybooksPerOwnerV2,
|
|
35
|
+
getDefaultMaxPendingRemediationsPerOwnerV2,
|
|
36
|
+
getMaxPendingRemediationsPerOwnerV2,
|
|
37
|
+
setMaxPendingRemediationsPerOwnerV2,
|
|
38
|
+
getDefaultPlaybookStaleMsV2,
|
|
39
|
+
getPlaybookStaleMsV2,
|
|
40
|
+
setPlaybookStaleMsV2,
|
|
41
|
+
getDefaultRemediationTimeoutMsV2,
|
|
42
|
+
getRemediationTimeoutMsV2,
|
|
43
|
+
setRemediationTimeoutMsV2,
|
|
44
|
+
registerPlaybookV2,
|
|
45
|
+
getPlaybookV2,
|
|
46
|
+
setPlaybookMaturityV2,
|
|
47
|
+
activatePlaybook,
|
|
48
|
+
deprecatePlaybookV2,
|
|
49
|
+
retirePlaybook,
|
|
50
|
+
touchPlaybookActivity,
|
|
51
|
+
submitRemediationV2,
|
|
52
|
+
getRemediationV2,
|
|
53
|
+
setRemediationStatusV2,
|
|
54
|
+
startRemediation,
|
|
55
|
+
completeRemediation,
|
|
56
|
+
failRemediation,
|
|
57
|
+
abortRemediation,
|
|
58
|
+
getActivePlaybookCount,
|
|
59
|
+
getPendingRemediationCount,
|
|
60
|
+
autoRetireStalePlaybooks,
|
|
61
|
+
autoTimeoutStuckRemediations,
|
|
62
|
+
getAiOpsStatsV2,
|
|
30
63
|
} from "../lib/aiops.js";
|
|
31
64
|
|
|
32
65
|
function _dbFromCtx(cmd) {
|
|
@@ -404,5 +437,326 @@ export function registerOpsCommand(program) {
|
|
|
404
437
|
console.log(`Baselines: ${s.baselines.total} metrics`);
|
|
405
438
|
});
|
|
406
439
|
|
|
440
|
+
/* ── V2: Playbook Maturity + Remediation Lifecycle ───────── */
|
|
441
|
+
|
|
442
|
+
ops
|
|
443
|
+
.command("playbook-maturities-v2")
|
|
444
|
+
.description("List playbook V2 maturity states")
|
|
445
|
+
.option("--json", "JSON output")
|
|
446
|
+
.action((opts) => {
|
|
447
|
+
const s = Object.values(PLAYBOOK_MATURITY_V2);
|
|
448
|
+
if (opts.json) console.log(JSON.stringify(s));
|
|
449
|
+
else s.forEach((v) => console.log(v));
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
ops
|
|
453
|
+
.command("remediation-lifecycles-v2")
|
|
454
|
+
.description("List remediation V2 lifecycle states")
|
|
455
|
+
.option("--json", "JSON output")
|
|
456
|
+
.action((opts) => {
|
|
457
|
+
const s = Object.values(REMEDIATION_LIFECYCLE_V2);
|
|
458
|
+
if (opts.json) console.log(JSON.stringify(s));
|
|
459
|
+
else s.forEach((v) => console.log(v));
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
ops
|
|
463
|
+
.command("default-max-active-playbooks-per-owner")
|
|
464
|
+
.description("Show default max-active-playbooks-per-owner")
|
|
465
|
+
.action(() => console.log(getDefaultMaxActivePlaybooksPerOwnerV2()));
|
|
466
|
+
ops
|
|
467
|
+
.command("max-active-playbooks-per-owner")
|
|
468
|
+
.description("Show current max-active-playbooks-per-owner")
|
|
469
|
+
.action(() => console.log(getMaxActivePlaybooksPerOwnerV2()));
|
|
470
|
+
ops
|
|
471
|
+
.command("set-max-active-playbooks-per-owner <n>")
|
|
472
|
+
.description("Set max-active-playbooks-per-owner")
|
|
473
|
+
.action((n) => {
|
|
474
|
+
setMaxActivePlaybooksPerOwnerV2(n);
|
|
475
|
+
console.log(getMaxActivePlaybooksPerOwnerV2());
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
ops
|
|
479
|
+
.command("default-max-pending-remediations-per-owner")
|
|
480
|
+
.description("Show default max-pending-remediations-per-owner")
|
|
481
|
+
.action(() => console.log(getDefaultMaxPendingRemediationsPerOwnerV2()));
|
|
482
|
+
ops
|
|
483
|
+
.command("max-pending-remediations-per-owner")
|
|
484
|
+
.description("Show current max-pending-remediations-per-owner")
|
|
485
|
+
.action(() => console.log(getMaxPendingRemediationsPerOwnerV2()));
|
|
486
|
+
ops
|
|
487
|
+
.command("set-max-pending-remediations-per-owner <n>")
|
|
488
|
+
.description("Set max-pending-remediations-per-owner")
|
|
489
|
+
.action((n) => {
|
|
490
|
+
setMaxPendingRemediationsPerOwnerV2(n);
|
|
491
|
+
console.log(getMaxPendingRemediationsPerOwnerV2());
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
ops
|
|
495
|
+
.command("default-playbook-stale-ms")
|
|
496
|
+
.description("Show default playbook-stale-ms")
|
|
497
|
+
.action(() => console.log(getDefaultPlaybookStaleMsV2()));
|
|
498
|
+
ops
|
|
499
|
+
.command("playbook-stale-ms")
|
|
500
|
+
.description("Show current playbook-stale-ms")
|
|
501
|
+
.action(() => console.log(getPlaybookStaleMsV2()));
|
|
502
|
+
ops
|
|
503
|
+
.command("set-playbook-stale-ms <ms>")
|
|
504
|
+
.description("Set playbook-stale-ms")
|
|
505
|
+
.action((ms) => {
|
|
506
|
+
setPlaybookStaleMsV2(ms);
|
|
507
|
+
console.log(getPlaybookStaleMsV2());
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
ops
|
|
511
|
+
.command("default-remediation-timeout-ms")
|
|
512
|
+
.description("Show default remediation-timeout-ms")
|
|
513
|
+
.action(() => console.log(getDefaultRemediationTimeoutMsV2()));
|
|
514
|
+
ops
|
|
515
|
+
.command("remediation-timeout-ms")
|
|
516
|
+
.description("Show current remediation-timeout-ms")
|
|
517
|
+
.action(() => console.log(getRemediationTimeoutMsV2()));
|
|
518
|
+
ops
|
|
519
|
+
.command("set-remediation-timeout-ms <ms>")
|
|
520
|
+
.description("Set remediation-timeout-ms")
|
|
521
|
+
.action((ms) => {
|
|
522
|
+
setRemediationTimeoutMsV2(ms);
|
|
523
|
+
console.log(getRemediationTimeoutMsV2());
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
ops
|
|
527
|
+
.command("active-playbook-count")
|
|
528
|
+
.description("Active playbook count (optionally scoped by owner)")
|
|
529
|
+
.option("-o, --owner <id>", "Owner ID")
|
|
530
|
+
.action((opts) => console.log(getActivePlaybookCount(opts.owner)));
|
|
531
|
+
|
|
532
|
+
ops
|
|
533
|
+
.command("pending-remediation-count")
|
|
534
|
+
.description(
|
|
535
|
+
"Pending/executing remediation count (optionally scoped by owner)",
|
|
536
|
+
)
|
|
537
|
+
.option("-o, --owner <id>", "Owner ID")
|
|
538
|
+
.action((opts) => console.log(getPendingRemediationCount(opts.owner)));
|
|
539
|
+
|
|
540
|
+
ops
|
|
541
|
+
.command("register-playbook-v2 <playbook-id>")
|
|
542
|
+
.description("Register a V2 playbook")
|
|
543
|
+
.requiredOption("-o, --owner <id>", "Owner ID")
|
|
544
|
+
.option("-n, --name <name>", "Name")
|
|
545
|
+
.option("-i, --initial-status <status>", "Initial status (default draft)")
|
|
546
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
547
|
+
.action((playbookId, opts, cmd) => {
|
|
548
|
+
const db = _dbFromCtx(cmd);
|
|
549
|
+
const config = { playbookId, ownerId: opts.owner };
|
|
550
|
+
if (opts.name) config.name = opts.name;
|
|
551
|
+
if (opts.initialStatus) config.initialStatus = opts.initialStatus;
|
|
552
|
+
if (opts.metadata) config.metadata = JSON.parse(opts.metadata);
|
|
553
|
+
console.log(JSON.stringify(registerPlaybookV2(db, config), null, 2));
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
ops
|
|
557
|
+
.command("playbook-v2 <playbook-id>")
|
|
558
|
+
.description("Get V2 playbook record")
|
|
559
|
+
.action((playbookId) => {
|
|
560
|
+
const rec = getPlaybookV2(playbookId);
|
|
561
|
+
console.log(rec ? JSON.stringify(rec, null, 2) : "null");
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
ops
|
|
565
|
+
.command("set-playbook-maturity-v2 <playbook-id> <status>")
|
|
566
|
+
.description("Set playbook V2 maturity status")
|
|
567
|
+
.option("-r, --reason <reason>", "Reason")
|
|
568
|
+
.option("-m, --metadata <json>", "Metadata JSON patch")
|
|
569
|
+
.action((playbookId, status, opts, cmd) => {
|
|
570
|
+
const db = _dbFromCtx(cmd);
|
|
571
|
+
const patch = {};
|
|
572
|
+
if (opts.reason !== undefined) patch.reason = opts.reason;
|
|
573
|
+
if (opts.metadata) patch.metadata = JSON.parse(opts.metadata);
|
|
574
|
+
console.log(
|
|
575
|
+
JSON.stringify(
|
|
576
|
+
setPlaybookMaturityV2(db, playbookId, status, patch),
|
|
577
|
+
null,
|
|
578
|
+
2,
|
|
579
|
+
),
|
|
580
|
+
);
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
ops
|
|
584
|
+
.command("activate-playbook <playbook-id>")
|
|
585
|
+
.description("Transition playbook → active")
|
|
586
|
+
.option("-r, --reason <reason>", "Reason")
|
|
587
|
+
.action((playbookId, opts, cmd) => {
|
|
588
|
+
const db = _dbFromCtx(cmd);
|
|
589
|
+
console.log(
|
|
590
|
+
JSON.stringify(activatePlaybook(db, playbookId, opts.reason), null, 2),
|
|
591
|
+
);
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
ops
|
|
595
|
+
.command("deprecate-playbook-v2 <playbook-id>")
|
|
596
|
+
.description("Transition playbook → deprecated")
|
|
597
|
+
.option("-r, --reason <reason>", "Reason")
|
|
598
|
+
.action((playbookId, opts, cmd) => {
|
|
599
|
+
const db = _dbFromCtx(cmd);
|
|
600
|
+
console.log(
|
|
601
|
+
JSON.stringify(
|
|
602
|
+
deprecatePlaybookV2(db, playbookId, opts.reason),
|
|
603
|
+
null,
|
|
604
|
+
2,
|
|
605
|
+
),
|
|
606
|
+
);
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
ops
|
|
610
|
+
.command("retire-playbook <playbook-id>")
|
|
611
|
+
.description("Transition playbook → retired (terminal)")
|
|
612
|
+
.option("-r, --reason <reason>", "Reason")
|
|
613
|
+
.action((playbookId, opts, cmd) => {
|
|
614
|
+
const db = _dbFromCtx(cmd);
|
|
615
|
+
console.log(
|
|
616
|
+
JSON.stringify(retirePlaybook(db, playbookId, opts.reason), null, 2),
|
|
617
|
+
);
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
ops
|
|
621
|
+
.command("touch-playbook-activity <playbook-id>")
|
|
622
|
+
.description("Bump lastUsedAt for a playbook")
|
|
623
|
+
.action((playbookId) => {
|
|
624
|
+
console.log(JSON.stringify(touchPlaybookActivity(playbookId), null, 2));
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
ops
|
|
628
|
+
.command("submit-remediation-v2 <remediation-id>")
|
|
629
|
+
.description("Submit a V2 remediation")
|
|
630
|
+
.requiredOption("-o, --owner <id>", "Owner ID")
|
|
631
|
+
.requiredOption("-p, --playbook <id>", "Playbook ID")
|
|
632
|
+
.option("-i, --incident <id>", "Incident ID")
|
|
633
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
634
|
+
.action((remediationId, opts, cmd) => {
|
|
635
|
+
const db = _dbFromCtx(cmd);
|
|
636
|
+
const config = {
|
|
637
|
+
remediationId,
|
|
638
|
+
ownerId: opts.owner,
|
|
639
|
+
playbookId: opts.playbook,
|
|
640
|
+
};
|
|
641
|
+
if (opts.incident) config.incidentId = opts.incident;
|
|
642
|
+
if (opts.metadata) config.metadata = JSON.parse(opts.metadata);
|
|
643
|
+
console.log(JSON.stringify(submitRemediationV2(db, config), null, 2));
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
ops
|
|
647
|
+
.command("remediation-v2 <remediation-id>")
|
|
648
|
+
.description("Get V2 remediation record")
|
|
649
|
+
.action((remediationId) => {
|
|
650
|
+
const rec = getRemediationV2(remediationId);
|
|
651
|
+
console.log(rec ? JSON.stringify(rec, null, 2) : "null");
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
ops
|
|
655
|
+
.command("set-remediation-status-v2 <remediation-id> <status>")
|
|
656
|
+
.description("Set remediation V2 status")
|
|
657
|
+
.option("-r, --reason <reason>", "Reason")
|
|
658
|
+
.option("-m, --metadata <json>", "Metadata JSON patch")
|
|
659
|
+
.action((remediationId, status, opts, cmd) => {
|
|
660
|
+
const db = _dbFromCtx(cmd);
|
|
661
|
+
const patch = {};
|
|
662
|
+
if (opts.reason !== undefined) patch.reason = opts.reason;
|
|
663
|
+
if (opts.metadata) patch.metadata = JSON.parse(opts.metadata);
|
|
664
|
+
console.log(
|
|
665
|
+
JSON.stringify(
|
|
666
|
+
setRemediationStatusV2(db, remediationId, status, patch),
|
|
667
|
+
null,
|
|
668
|
+
2,
|
|
669
|
+
),
|
|
670
|
+
);
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
ops
|
|
674
|
+
.command("start-remediation <remediation-id>")
|
|
675
|
+
.description("Transition remediation → executing")
|
|
676
|
+
.option("-r, --reason <reason>", "Reason")
|
|
677
|
+
.action((remediationId, opts, cmd) => {
|
|
678
|
+
const db = _dbFromCtx(cmd);
|
|
679
|
+
console.log(
|
|
680
|
+
JSON.stringify(
|
|
681
|
+
startRemediation(db, remediationId, opts.reason),
|
|
682
|
+
null,
|
|
683
|
+
2,
|
|
684
|
+
),
|
|
685
|
+
);
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
ops
|
|
689
|
+
.command("complete-remediation <remediation-id>")
|
|
690
|
+
.description("Transition remediation → succeeded (terminal)")
|
|
691
|
+
.option("-r, --reason <reason>", "Reason")
|
|
692
|
+
.action((remediationId, opts, cmd) => {
|
|
693
|
+
const db = _dbFromCtx(cmd);
|
|
694
|
+
console.log(
|
|
695
|
+
JSON.stringify(
|
|
696
|
+
completeRemediation(db, remediationId, opts.reason),
|
|
697
|
+
null,
|
|
698
|
+
2,
|
|
699
|
+
),
|
|
700
|
+
);
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
ops
|
|
704
|
+
.command("fail-remediation <remediation-id>")
|
|
705
|
+
.description("Transition remediation → failed (terminal)")
|
|
706
|
+
.option("-r, --reason <reason>", "Reason")
|
|
707
|
+
.action((remediationId, opts, cmd) => {
|
|
708
|
+
const db = _dbFromCtx(cmd);
|
|
709
|
+
console.log(
|
|
710
|
+
JSON.stringify(
|
|
711
|
+
failRemediation(db, remediationId, opts.reason),
|
|
712
|
+
null,
|
|
713
|
+
2,
|
|
714
|
+
),
|
|
715
|
+
);
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
ops
|
|
719
|
+
.command("abort-remediation <remediation-id>")
|
|
720
|
+
.description("Transition remediation → aborted (terminal)")
|
|
721
|
+
.option("-r, --reason <reason>", "Reason")
|
|
722
|
+
.action((remediationId, opts, cmd) => {
|
|
723
|
+
const db = _dbFromCtx(cmd);
|
|
724
|
+
console.log(
|
|
725
|
+
JSON.stringify(
|
|
726
|
+
abortRemediation(db, remediationId, opts.reason),
|
|
727
|
+
null,
|
|
728
|
+
2,
|
|
729
|
+
),
|
|
730
|
+
);
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
ops
|
|
734
|
+
.command("auto-retire-stale-playbooks")
|
|
735
|
+
.description("Bulk-flip stale playbooks → retired")
|
|
736
|
+
.action((_opts, cmd) => {
|
|
737
|
+
const db = _dbFromCtx(cmd);
|
|
738
|
+
const flipped = autoRetireStalePlaybooks(db);
|
|
739
|
+
console.log(JSON.stringify(flipped));
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
ops
|
|
743
|
+
.command("auto-timeout-stuck-remediations")
|
|
744
|
+
.description("Bulk-flip stuck executing remediations → failed")
|
|
745
|
+
.action((_opts, cmd) => {
|
|
746
|
+
const db = _dbFromCtx(cmd);
|
|
747
|
+
const flipped = autoTimeoutStuckRemediations(db);
|
|
748
|
+
console.log(JSON.stringify(flipped));
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
ops
|
|
752
|
+
.command("stats-v2")
|
|
753
|
+
.description("Show V2 AIOps stats (all-enum-key)")
|
|
754
|
+
.option("--json", "JSON output")
|
|
755
|
+
.action((opts) => {
|
|
756
|
+
const s = getAiOpsStatsV2();
|
|
757
|
+
if (opts.json) console.log(JSON.stringify(s));
|
|
758
|
+
else console.log(JSON.stringify(s, null, 2));
|
|
759
|
+
});
|
|
760
|
+
|
|
407
761
|
program.addCommand(ops);
|
|
408
762
|
}
|