chainlesschain 0.132.0 → 0.145.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 (135) hide show
  1. package/package.json +1 -1
  2. package/src/commands/a2a.js +230 -0
  3. package/src/commands/activitypub.js +191 -0
  4. package/src/commands/agent.js +601 -0
  5. package/src/commands/audit.js +206 -0
  6. package/src/commands/bi.js +186 -0
  7. package/src/commands/bm25.js +162 -0
  8. package/src/commands/browse.js +225 -0
  9. package/src/commands/ccron.js +178 -0
  10. package/src/commands/chat.js +207 -0
  11. package/src/commands/compliance.js +420 -0
  12. package/src/commands/compt.js +176 -0
  13. package/src/commands/consol.js +237 -0
  14. package/src/commands/cowork.js +588 -0
  15. package/src/commands/crosschain.js +216 -0
  16. package/src/commands/dao.js +216 -0
  17. package/src/commands/dlp.js +206 -0
  18. package/src/commands/economy.js +211 -0
  19. package/src/commands/evolution.js +209 -0
  20. package/src/commands/evomap.js +216 -0
  21. package/src/commands/fflag.js +230 -0
  22. package/src/commands/git.js +185 -0
  23. package/src/commands/hardening.js +209 -0
  24. package/src/commands/hmemory.js +210 -0
  25. package/src/commands/incentive.js +209 -0
  26. package/src/commands/inference.js +178 -0
  27. package/src/commands/itbudget.js +161 -0
  28. package/src/commands/kg.js +206 -0
  29. package/src/commands/lowcode.js +201 -0
  30. package/src/commands/marketplace.js +206 -0
  31. package/src/commands/matrix.js +214 -0
  32. package/src/commands/mcpscaf.js +153 -0
  33. package/src/commands/meminj.js +153 -0
  34. package/src/commands/nostr.js +213 -0
  35. package/src/commands/orchestrate.js +217 -0
  36. package/src/commands/orchgov.js +156 -0
  37. package/src/commands/pdfp.js +160 -0
  38. package/src/commands/perf.js +176 -0
  39. package/src/commands/perm.js +156 -0
  40. package/src/commands/pipeline.js +211 -0
  41. package/src/commands/planmode.js +154 -0
  42. package/src/commands/privacy.js +203 -0
  43. package/src/commands/promcomp.js +166 -0
  44. package/src/commands/recommend.js +185 -0
  45. package/src/commands/reputation.js +208 -0
  46. package/src/commands/sandbox.js +206 -0
  47. package/src/commands/seshhook.js +153 -0
  48. package/src/commands/seshsearch.js +149 -0
  49. package/src/commands/seshtail.js +152 -0
  50. package/src/commands/seshu.js +160 -0
  51. package/src/commands/sganal.js +172 -0
  52. package/src/commands/siem.js +207 -0
  53. package/src/commands/sla.js +212 -0
  54. package/src/commands/slotfill.js +154 -0
  55. package/src/commands/social.js +159 -0
  56. package/src/commands/stress.js +206 -0
  57. package/src/commands/svccont.js +157 -0
  58. package/src/commands/terraform.js +206 -0
  59. package/src/commands/tms.js +183 -0
  60. package/src/commands/topiccls.js +158 -0
  61. package/src/commands/uprof.js +154 -0
  62. package/src/commands/vcheck.js +172 -0
  63. package/src/commands/webfetch.js +150 -0
  64. package/src/commands/zkp.js +218 -0
  65. package/src/harness/prompt-compressor.js +331 -0
  66. package/src/index.js +101 -1
  67. package/src/lib/a2a-protocol.js +373 -0
  68. package/src/lib/activitypub-bridge.js +343 -0
  69. package/src/lib/agent-economy.js +358 -0
  70. package/src/lib/app-builder.js +338 -0
  71. package/src/lib/audit-logger.js +321 -0
  72. package/src/lib/autonomous-agent.js +341 -0
  73. package/src/lib/bi-engine.js +339 -0
  74. package/src/lib/bm25-search.js +333 -0
  75. package/src/lib/browser-automation.js +352 -0
  76. package/src/lib/chat-core.js +336 -0
  77. package/src/lib/claude-code-bridge.js +341 -0
  78. package/src/lib/compliance-framework-reporter.js +359 -0
  79. package/src/lib/compliance-manager.js +330 -0
  80. package/src/lib/compression-telemetry.js +333 -0
  81. package/src/lib/content-recommender.js +370 -0
  82. package/src/lib/cowork-cron.js +330 -0
  83. package/src/lib/cowork-learning.js +333 -0
  84. package/src/lib/cowork-task-runner.js +362 -0
  85. package/src/lib/cowork-workflow.js +327 -0
  86. package/src/lib/cross-chain.js +365 -0
  87. package/src/lib/dao-governance.js +339 -0
  88. package/src/lib/dlp-engine.js +343 -0
  89. package/src/lib/evolution-system.js +336 -0
  90. package/src/lib/evomap-manager.js +339 -0
  91. package/src/lib/execution-backend.js +351 -0
  92. package/src/lib/feature-flags.js +330 -0
  93. package/src/lib/git-integration.js +343 -0
  94. package/src/lib/hardening-manager.js +341 -0
  95. package/src/lib/hierarchical-memory.js +341 -0
  96. package/src/lib/inference-network.js +362 -0
  97. package/src/lib/iteration-budget.js +357 -0
  98. package/src/lib/knowledge-graph.js +333 -0
  99. package/src/lib/matrix-bridge.js +339 -0
  100. package/src/lib/mcp-scaffold.js +345 -0
  101. package/src/lib/memory-injection.js +320 -0
  102. package/src/lib/nostr-bridge.js +342 -0
  103. package/src/lib/orchestrator.js +350 -0
  104. package/src/lib/pdf-parser.js +330 -0
  105. package/src/lib/perf-tuning.js +364 -0
  106. package/src/lib/permission-engine.js +319 -0
  107. package/src/lib/pipeline-orchestrator.js +345 -0
  108. package/src/lib/plan-mode.js +328 -0
  109. package/src/lib/privacy-computing.js +335 -0
  110. package/src/lib/prompt-compressor.js +1 -10
  111. package/src/lib/reputation-optimizer.js +340 -0
  112. package/src/lib/sandbox-v2.js +327 -0
  113. package/src/lib/service-container.js +342 -0
  114. package/src/lib/session-consolidator.js +352 -0
  115. package/src/lib/session-hooks.js +340 -0
  116. package/src/lib/session-search.js +334 -0
  117. package/src/lib/session-tail.js +320 -0
  118. package/src/lib/session-usage.js +329 -0
  119. package/src/lib/siem-exporter.js +352 -0
  120. package/src/lib/skill-marketplace.js +345 -0
  121. package/src/lib/sla-manager.js +341 -0
  122. package/src/lib/slot-filler.js +333 -0
  123. package/src/lib/social-graph-analytics.js +327 -0
  124. package/src/lib/social-graph.js +304 -0
  125. package/src/lib/stress-tester.js +342 -0
  126. package/src/lib/sub-agent-registry.js +359 -0
  127. package/src/lib/task-model-selector.js +333 -0
  128. package/src/lib/terraform-manager.js +333 -0
  129. package/src/lib/todo-manager.js +339 -0
  130. package/src/lib/token-incentive.js +341 -0
  131. package/src/lib/topic-classifier.js +353 -0
  132. package/src/lib/user-profile.js +325 -0
  133. package/src/lib/version-checker.js +335 -0
  134. package/src/lib/web-fetch.js +322 -0
  135. package/src/lib/zkp-engine.js +342 -0
@@ -0,0 +1,230 @@
1
+ /**
2
+ * Feature Flags V2 governance commands — `cc fflag ...`
3
+ * 在内存中治理 FF profile(pending/active/paused/archived)+ eval 生命周期。
4
+ */
5
+ import {
6
+ FFLAG_PROFILE_MATURITY_V2,
7
+ FFLAG_EVAL_LIFECYCLE_V2,
8
+ registerFflagProfileV2,
9
+ activateFflagProfileV2,
10
+ pauseFflagProfileV2,
11
+ archiveFflagProfileV2,
12
+ touchFflagProfileV2,
13
+ getFflagProfileV2,
14
+ listFflagProfilesV2,
15
+ createFflagEvalV2,
16
+ evaluatingFflagEvalV2,
17
+ evaluateFflagEvalV2,
18
+ failFflagEvalV2,
19
+ cancelFflagEvalV2,
20
+ getFflagEvalV2,
21
+ listFflagEvalsV2,
22
+ setMaxActiveFflagProfilesPerOwnerV2,
23
+ getMaxActiveFflagProfilesPerOwnerV2,
24
+ setMaxPendingFflagEvalsPerProfileV2,
25
+ getMaxPendingFflagEvalsPerProfileV2,
26
+ setFflagProfileIdleMsV2,
27
+ getFflagProfileIdleMsV2,
28
+ setFflagEvalStuckMsV2,
29
+ getFflagEvalStuckMsV2,
30
+ autoPauseIdleFflagProfilesV2,
31
+ autoFailStuckFflagEvalsV2,
32
+ getFeatureFlagsGovStatsV2,
33
+ } from "../lib/feature-flags.js";
34
+
35
+ export function registerFflagCommand(program) {
36
+ const fflag = program
37
+ .command("fflag")
38
+ .description("Feature Flags V2 governance (in-memory, CLI v0.143.0)");
39
+
40
+ fflag
41
+ .command("enums-v2")
42
+ .description("Show V2 maturity + lifecycle enums")
43
+ .action(() => {
44
+ console.log(
45
+ JSON.stringify(
46
+ { FFLAG_PROFILE_MATURITY_V2, FFLAG_EVAL_LIFECYCLE_V2 },
47
+ null,
48
+ 2,
49
+ ),
50
+ );
51
+ });
52
+
53
+ fflag
54
+ .command("register-profile-v2")
55
+ .description("Register a feature flag profile (pending)")
56
+ .requiredOption("--id <id>")
57
+ .requiredOption("--owner <owner>")
58
+ .option("--scope <scope>", "scope tag", "*")
59
+ .action((o) =>
60
+ console.log(JSON.stringify(registerFflagProfileV2(o), null, 2)),
61
+ );
62
+ fflag
63
+ .command("activate-profile-v2 <id>")
64
+ .description("Transition profile to active")
65
+ .action((id) =>
66
+ console.log(JSON.stringify(activateFflagProfileV2(id), null, 2)),
67
+ );
68
+ fflag
69
+ .command("pause-profile-v2 <id>")
70
+ .description("Transition profile to paused")
71
+ .action((id) =>
72
+ console.log(JSON.stringify(pauseFflagProfileV2(id), null, 2)),
73
+ );
74
+ fflag
75
+ .command("archive-profile-v2 <id>")
76
+ .description("Transition profile to archived (terminal)")
77
+ .action((id) =>
78
+ console.log(JSON.stringify(archiveFflagProfileV2(id), null, 2)),
79
+ );
80
+ fflag
81
+ .command("touch-profile-v2 <id>")
82
+ .description("Refresh lastTouchedAt")
83
+ .action((id) =>
84
+ console.log(JSON.stringify(touchFflagProfileV2(id), null, 2)),
85
+ );
86
+ fflag
87
+ .command("get-profile-v2 <id>")
88
+ .description("Get a profile by id")
89
+ .action((id) =>
90
+ console.log(JSON.stringify(getFflagProfileV2(id), null, 2)),
91
+ );
92
+ fflag
93
+ .command("list-profiles-v2")
94
+ .description("List all profiles")
95
+ .action(() => console.log(JSON.stringify(listFflagProfilesV2(), null, 2)));
96
+
97
+ fflag
98
+ .command("create-eval-v2")
99
+ .description("Create an eval (queued)")
100
+ .requiredOption("--id <id>")
101
+ .requiredOption("--profile-id <profileId>")
102
+ .option("--key <key>", "flag key", "")
103
+ .action((o) => console.log(JSON.stringify(createFflagEvalV2(o), null, 2)));
104
+ fflag
105
+ .command("evaluating-eval-v2 <id>")
106
+ .description("Mark eval as evaluating")
107
+ .action((id) =>
108
+ console.log(JSON.stringify(evaluatingFflagEvalV2(id), null, 2)),
109
+ );
110
+ fflag
111
+ .command("evaluate-eval-v2 <id>")
112
+ .description("Mark eval as evaluated (terminal)")
113
+ .action((id) =>
114
+ console.log(JSON.stringify(evaluateFflagEvalV2(id), null, 2)),
115
+ );
116
+ fflag
117
+ .command("fail-eval-v2 <id>")
118
+ .description("Mark eval as failed (terminal)")
119
+ .option("--reason <reason>")
120
+ .action((id, o) =>
121
+ console.log(JSON.stringify(failFflagEvalV2(id, o.reason), null, 2)),
122
+ );
123
+ fflag
124
+ .command("cancel-eval-v2 <id>")
125
+ .description("Mark eval as cancelled (terminal)")
126
+ .option("--reason <reason>")
127
+ .action((id, o) =>
128
+ console.log(JSON.stringify(cancelFflagEvalV2(id, o.reason), null, 2)),
129
+ );
130
+ fflag
131
+ .command("get-eval-v2 <id>")
132
+ .description("Get an eval by id")
133
+ .action((id) => console.log(JSON.stringify(getFflagEvalV2(id), null, 2)));
134
+ fflag
135
+ .command("list-evals-v2")
136
+ .description("List all evals")
137
+ .action(() => console.log(JSON.stringify(listFflagEvalsV2(), null, 2)));
138
+
139
+ fflag
140
+ .command("config-v2")
141
+ .description("Show V2 config (caps + idle/stuck windows)")
142
+ .action(() => {
143
+ console.log(
144
+ JSON.stringify(
145
+ {
146
+ maxActiveFflagProfilesPerOwner:
147
+ getMaxActiveFflagProfilesPerOwnerV2(),
148
+ maxPendingFflagEvalsPerProfile:
149
+ getMaxPendingFflagEvalsPerProfileV2(),
150
+ fflagProfileIdleMs: getFflagProfileIdleMsV2(),
151
+ fflagEvalStuckMs: getFflagEvalStuckMsV2(),
152
+ },
153
+ null,
154
+ 2,
155
+ ),
156
+ );
157
+ });
158
+ fflag
159
+ .command("set-max-active-profiles-v2 <n>")
160
+ .description("Set max active profiles per owner")
161
+ .action((n) => {
162
+ setMaxActiveFflagProfilesPerOwnerV2(Number(n));
163
+ console.log(
164
+ JSON.stringify(
165
+ {
166
+ maxActiveFflagProfilesPerOwner:
167
+ getMaxActiveFflagProfilesPerOwnerV2(),
168
+ },
169
+ null,
170
+ 2,
171
+ ),
172
+ );
173
+ });
174
+ fflag
175
+ .command("set-max-pending-evals-v2 <n>")
176
+ .description("Set max pending evals per profile")
177
+ .action((n) => {
178
+ setMaxPendingFflagEvalsPerProfileV2(Number(n));
179
+ console.log(
180
+ JSON.stringify(
181
+ {
182
+ maxPendingFflagEvalsPerProfile:
183
+ getMaxPendingFflagEvalsPerProfileV2(),
184
+ },
185
+ null,
186
+ 2,
187
+ ),
188
+ );
189
+ });
190
+ fflag
191
+ .command("set-profile-idle-ms-v2 <ms>")
192
+ .description("Set profile idle window")
193
+ .action((ms) => {
194
+ setFflagProfileIdleMsV2(Number(ms));
195
+ console.log(
196
+ JSON.stringify(
197
+ { fflagProfileIdleMs: getFflagProfileIdleMsV2() },
198
+ null,
199
+ 2,
200
+ ),
201
+ );
202
+ });
203
+ fflag
204
+ .command("set-eval-stuck-ms-v2 <ms>")
205
+ .description("Set eval stuck window")
206
+ .action((ms) => {
207
+ setFflagEvalStuckMsV2(Number(ms));
208
+ console.log(
209
+ JSON.stringify({ fflagEvalStuckMs: getFflagEvalStuckMsV2() }, null, 2),
210
+ );
211
+ });
212
+ fflag
213
+ .command("auto-pause-idle-v2")
214
+ .description("Auto-pause idle active profiles")
215
+ .action(() =>
216
+ console.log(JSON.stringify(autoPauseIdleFflagProfilesV2(), null, 2)),
217
+ );
218
+ fflag
219
+ .command("auto-fail-stuck-v2")
220
+ .description("Auto-fail stuck evaluating evals")
221
+ .action(() =>
222
+ console.log(JSON.stringify(autoFailStuckFflagEvalsV2(), null, 2)),
223
+ );
224
+ fflag
225
+ .command("gov-stats-v2")
226
+ .description("Show V2 governance stats")
227
+ .action(() =>
228
+ console.log(JSON.stringify(getFeatureFlagsGovStatsV2(), null, 2)),
229
+ );
230
+ }
@@ -212,4 +212,189 @@ export function registerGitCommand(program) {
212
212
  process.exit(1);
213
213
  }
214
214
  });
215
+
216
+ _registerGitV2(git);
217
+ }
218
+
219
+ import {
220
+ GIT_REPO_MATURITY_V2,
221
+ GIT_COMMIT_LIFECYCLE_V2,
222
+ setMaxActiveGitReposPerOwnerV2,
223
+ setMaxPendingGitCommitsPerRepoV2,
224
+ setGitRepoIdleMsV2,
225
+ setGitCommitStuckMsV2,
226
+ registerGitRepoV2,
227
+ activateGitRepoV2,
228
+ archiveGitRepoV2,
229
+ decommissionGitRepoV2,
230
+ touchGitRepoV2,
231
+ getGitRepoV2,
232
+ listGitReposV2,
233
+ createGitCommitV2,
234
+ startGitCommitV2,
235
+ commitGitCommitV2,
236
+ failGitCommitV2,
237
+ cancelGitCommitV2,
238
+ getGitCommitV2,
239
+ listGitCommitsV2,
240
+ autoArchiveIdleGitReposV2,
241
+ autoFailStuckGitCommitsV2,
242
+ getGitIntegrationGovStatsV2,
243
+ } from "../lib/git-integration.js";
244
+
245
+ function _registerGitV2(parent) {
246
+ parent
247
+ .command("enums-v2")
248
+ .description("List Git V2 enums")
249
+ .option("--json", "JSON")
250
+ .action((opts) => {
251
+ const out = {
252
+ repoMaturity: GIT_REPO_MATURITY_V2,
253
+ commitLifecycle: GIT_COMMIT_LIFECYCLE_V2,
254
+ };
255
+ if (opts.json) console.log(JSON.stringify(out, null, 2));
256
+ else console.log(out);
257
+ });
258
+ parent
259
+ .command("config-set-v2")
260
+ .description("Set Git V2 caps/thresholds")
261
+ .option("--max-active <n>", "max active repos per owner")
262
+ .option("--max-pending <n>", "max pending commits per repo")
263
+ .option("--idle-ms <n>", "repo idle ms")
264
+ .option("--stuck-ms <n>", "commit stuck ms")
265
+ .action((opts) => {
266
+ if (opts.maxActive)
267
+ setMaxActiveGitReposPerOwnerV2(parseInt(opts.maxActive, 10));
268
+ if (opts.maxPending)
269
+ setMaxPendingGitCommitsPerRepoV2(parseInt(opts.maxPending, 10));
270
+ if (opts.idleMs) setGitRepoIdleMsV2(parseInt(opts.idleMs, 10));
271
+ if (opts.stuckMs) setGitCommitStuckMsV2(parseInt(opts.stuckMs, 10));
272
+ console.log("ok");
273
+ });
274
+ parent
275
+ .command("register-repo-v2 <id>")
276
+ .description("Register Git V2 repo")
277
+ .requiredOption("--owner <owner>", "owner")
278
+ .option("--branch <branch>", "branch")
279
+ .option("--json", "JSON")
280
+ .action((id, opts) => {
281
+ const r = registerGitRepoV2({
282
+ id,
283
+ owner: opts.owner,
284
+ branch: opts.branch,
285
+ });
286
+ if (opts.json) console.log(JSON.stringify(r, null, 2));
287
+ else console.log(r);
288
+ });
289
+ parent
290
+ .command("activate-repo-v2 <id>")
291
+ .description("Activate Git V2 repo")
292
+ .action((id) => {
293
+ console.log(activateGitRepoV2(id));
294
+ });
295
+ parent
296
+ .command("archive-repo-v2 <id>")
297
+ .description("Archive Git V2 repo")
298
+ .action((id) => {
299
+ console.log(archiveGitRepoV2(id));
300
+ });
301
+ parent
302
+ .command("decommission-repo-v2 <id>")
303
+ .description("Decommission Git V2 repo")
304
+ .action((id) => {
305
+ console.log(decommissionGitRepoV2(id));
306
+ });
307
+ parent
308
+ .command("touch-repo-v2 <id>")
309
+ .description("Touch Git V2 repo")
310
+ .action((id) => {
311
+ console.log(touchGitRepoV2(id));
312
+ });
313
+ parent
314
+ .command("get-repo-v2 <id>")
315
+ .description("Get Git V2 repo")
316
+ .option("--json", "JSON")
317
+ .action((id, opts) => {
318
+ const r = getGitRepoV2(id);
319
+ if (opts.json) console.log(JSON.stringify(r, null, 2));
320
+ else console.log(r);
321
+ });
322
+ parent
323
+ .command("list-repos-v2")
324
+ .description("List Git V2 repos")
325
+ .option("--json", "JSON")
326
+ .action((opts) => {
327
+ const r = listGitReposV2();
328
+ if (opts.json) console.log(JSON.stringify(r, null, 2));
329
+ else console.log(r);
330
+ });
331
+ parent
332
+ .command("create-commit-v2 <id>")
333
+ .description("Create Git V2 commit")
334
+ .requiredOption("--repo-id <repoId>", "repo id")
335
+ .option("--message <msg>", "commit message")
336
+ .action((id, opts) => {
337
+ console.log(
338
+ createGitCommitV2({ id, repoId: opts.repoId, message: opts.message }),
339
+ );
340
+ });
341
+ parent
342
+ .command("start-commit-v2 <id>")
343
+ .description("Start Git V2 commit")
344
+ .action((id) => {
345
+ console.log(startGitCommitV2(id));
346
+ });
347
+ parent
348
+ .command("commit-commit-v2 <id>")
349
+ .description("Commit Git V2 commit")
350
+ .action((id) => {
351
+ console.log(commitGitCommitV2(id));
352
+ });
353
+ parent
354
+ .command("fail-commit-v2 <id>")
355
+ .description("Fail Git V2 commit")
356
+ .option("--reason <r>", "reason")
357
+ .action((id, opts) => {
358
+ console.log(failGitCommitV2(id, opts.reason));
359
+ });
360
+ parent
361
+ .command("cancel-commit-v2 <id>")
362
+ .description("Cancel Git V2 commit")
363
+ .option("--reason <r>", "reason")
364
+ .action((id, opts) => {
365
+ console.log(cancelGitCommitV2(id, opts.reason));
366
+ });
367
+ parent
368
+ .command("get-commit-v2 <id>")
369
+ .description("Get Git V2 commit")
370
+ .action((id) => {
371
+ console.log(getGitCommitV2(id));
372
+ });
373
+ parent
374
+ .command("list-commits-v2")
375
+ .description("List Git V2 commits")
376
+ .action(() => {
377
+ console.log(listGitCommitsV2());
378
+ });
379
+ parent
380
+ .command("auto-archive-repos-v2")
381
+ .description("Auto-archive idle Git V2 repos")
382
+ .action(() => {
383
+ console.log(autoArchiveIdleGitReposV2());
384
+ });
385
+ parent
386
+ .command("auto-fail-commits-v2")
387
+ .description("Auto-fail stuck Git V2 commits")
388
+ .action(() => {
389
+ console.log(autoFailStuckGitCommitsV2());
390
+ });
391
+ parent
392
+ .command("gov-stats-v2")
393
+ .description("Git V2 governance stats")
394
+ .option("--json", "JSON")
395
+ .action((opts) => {
396
+ const s = getGitIntegrationGovStatsV2();
397
+ if (opts.json) console.log(JSON.stringify(s, null, 2));
398
+ else console.log(s);
399
+ });
215
400
  }
@@ -749,3 +749,212 @@ export function registerHardeningCommand(program) {
749
749
  );
750
750
  });
751
751
  }
752
+
753
+ // === Iter17 V2 governance overlay ===
754
+ export function registerHardgovV2Commands(program) {
755
+ const parent = program.commands.find((c) => c.name() === "hardening");
756
+ if (!parent) return;
757
+ const L = async () => await import("../lib/hardening-manager.js");
758
+ parent
759
+ .command("hardgov-enums-v2")
760
+ .description("Show V2 enums")
761
+ .action(async () => {
762
+ const m = await L();
763
+ console.log(
764
+ JSON.stringify(
765
+ {
766
+ profileMaturity: m.HARDGOV_PROFILE_MATURITY_V2,
767
+ scanLifecycle: m.HARDGOV_SCAN_LIFECYCLE_V2,
768
+ },
769
+ null,
770
+ 2,
771
+ ),
772
+ );
773
+ });
774
+ parent
775
+ .command("hardgov-config-v2")
776
+ .description("Show V2 config")
777
+ .action(async () => {
778
+ const m = await L();
779
+ console.log(
780
+ JSON.stringify(
781
+ {
782
+ maxActive: m.getMaxActiveHardgovProfilesPerOwnerV2(),
783
+ maxPending: m.getMaxPendingHardgovScansPerProfileV2(),
784
+ idleMs: m.getHardgovProfileIdleMsV2(),
785
+ stuckMs: m.getHardgovScanStuckMsV2(),
786
+ },
787
+ null,
788
+ 2,
789
+ ),
790
+ );
791
+ });
792
+ parent
793
+ .command("hardgov-set-max-active-v2 <n>")
794
+ .description("Set max active")
795
+ .action(async (n) => {
796
+ (await L()).setMaxActiveHardgovProfilesPerOwnerV2(Number(n));
797
+ console.log("ok");
798
+ });
799
+ parent
800
+ .command("hardgov-set-max-pending-v2 <n>")
801
+ .description("Set max pending")
802
+ .action(async (n) => {
803
+ (await L()).setMaxPendingHardgovScansPerProfileV2(Number(n));
804
+ console.log("ok");
805
+ });
806
+ parent
807
+ .command("hardgov-set-idle-ms-v2 <n>")
808
+ .description("Set idle threshold ms")
809
+ .action(async (n) => {
810
+ (await L()).setHardgovProfileIdleMsV2(Number(n));
811
+ console.log("ok");
812
+ });
813
+ parent
814
+ .command("hardgov-set-stuck-ms-v2 <n>")
815
+ .description("Set stuck threshold ms")
816
+ .action(async (n) => {
817
+ (await L()).setHardgovScanStuckMsV2(Number(n));
818
+ console.log("ok");
819
+ });
820
+ parent
821
+ .command("hardgov-register-v2 <id> <owner>")
822
+ .description("Register V2 profile")
823
+ .option("--category <v>", "category")
824
+ .action(async (id, owner, o) => {
825
+ const m = await L();
826
+ console.log(
827
+ JSON.stringify(
828
+ m.registerHardgovProfileV2({ id, owner, category: o.category }),
829
+ null,
830
+ 2,
831
+ ),
832
+ );
833
+ });
834
+ parent
835
+ .command("hardgov-activate-v2 <id>")
836
+ .description("Activate profile")
837
+ .action(async (id) => {
838
+ console.log(
839
+ JSON.stringify((await L()).activateHardgovProfileV2(id), null, 2),
840
+ );
841
+ });
842
+ parent
843
+ .command("hardgov-disable-v2 <id>")
844
+ .description("Disable profile")
845
+ .action(async (id) => {
846
+ console.log(
847
+ JSON.stringify((await L()).disableHardgovProfileV2(id), null, 2),
848
+ );
849
+ });
850
+ parent
851
+ .command("hardgov-archive-v2 <id>")
852
+ .description("Archive profile")
853
+ .action(async (id) => {
854
+ console.log(
855
+ JSON.stringify((await L()).archiveHardgovProfileV2(id), null, 2),
856
+ );
857
+ });
858
+ parent
859
+ .command("hardgov-touch-v2 <id>")
860
+ .description("Touch profile")
861
+ .action(async (id) => {
862
+ console.log(
863
+ JSON.stringify((await L()).touchHardgovProfileV2(id), null, 2),
864
+ );
865
+ });
866
+ parent
867
+ .command("hardgov-get-v2 <id>")
868
+ .description("Get profile")
869
+ .action(async (id) => {
870
+ console.log(JSON.stringify((await L()).getHardgovProfileV2(id), null, 2));
871
+ });
872
+ parent
873
+ .command("hardgov-list-v2")
874
+ .description("List profiles")
875
+ .action(async () => {
876
+ console.log(JSON.stringify((await L()).listHardgovProfilesV2(), null, 2));
877
+ });
878
+ parent
879
+ .command("hardgov-create-scan-v2 <id> <profileId>")
880
+ .description("Create scan")
881
+ .option("--target <v>", "target")
882
+ .action(async (id, profileId, o) => {
883
+ const m = await L();
884
+ console.log(
885
+ JSON.stringify(
886
+ m.createHardgovScanV2({ id, profileId, target: o.target }),
887
+ null,
888
+ 2,
889
+ ),
890
+ );
891
+ });
892
+ parent
893
+ .command("hardgov-scanning-scan-v2 <id>")
894
+ .description("Mark scan as scanning")
895
+ .action(async (id) => {
896
+ console.log(
897
+ JSON.stringify((await L()).scanningHardgovScanV2(id), null, 2),
898
+ );
899
+ });
900
+ parent
901
+ .command("hardgov-complete-scan-v2 <id>")
902
+ .description("Complete scan")
903
+ .action(async (id) => {
904
+ console.log(
905
+ JSON.stringify((await L()).completeScanHardgovV2(id), null, 2),
906
+ );
907
+ });
908
+ parent
909
+ .command("hardgov-fail-scan-v2 <id> [reason]")
910
+ .description("Fail scan")
911
+ .action(async (id, reason) => {
912
+ console.log(
913
+ JSON.stringify((await L()).failHardgovScanV2(id, reason), null, 2),
914
+ );
915
+ });
916
+ parent
917
+ .command("hardgov-cancel-scan-v2 <id> [reason]")
918
+ .description("Cancel scan")
919
+ .action(async (id, reason) => {
920
+ console.log(
921
+ JSON.stringify((await L()).cancelHardgovScanV2(id, reason), null, 2),
922
+ );
923
+ });
924
+ parent
925
+ .command("hardgov-get-scan-v2 <id>")
926
+ .description("Get scan")
927
+ .action(async (id) => {
928
+ console.log(JSON.stringify((await L()).getHardgovScanV2(id), null, 2));
929
+ });
930
+ parent
931
+ .command("hardgov-list-scans-v2")
932
+ .description("List scans")
933
+ .action(async () => {
934
+ console.log(JSON.stringify((await L()).listHardgovScansV2(), null, 2));
935
+ });
936
+ parent
937
+ .command("hardgov-auto-disable-idle-v2")
938
+ .description("Auto-disable idle")
939
+ .action(async () => {
940
+ console.log(
941
+ JSON.stringify((await L()).autoDisableIdleHardgovProfilesV2(), null, 2),
942
+ );
943
+ });
944
+ parent
945
+ .command("hardgov-auto-fail-stuck-v2")
946
+ .description("Auto-fail stuck scans")
947
+ .action(async () => {
948
+ console.log(
949
+ JSON.stringify((await L()).autoFailStuckHardgovScansV2(), null, 2),
950
+ );
951
+ });
952
+ parent
953
+ .command("hardgov-gov-stats-v2")
954
+ .description("V2 gov stats")
955
+ .action(async () => {
956
+ console.log(
957
+ JSON.stringify((await L()).getHardeningManagerGovStatsV2(), null, 2),
958
+ );
959
+ });
960
+ }