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.
- package/bin/chainlesschain.js +0 -0
- package/package.json +1 -1
- package/src/commands/a2a.js +62 -0
- package/src/commands/activitypub.js +61 -0
- package/src/commands/agent-network.js +254 -1
- package/src/commands/agent.js +117 -0
- package/src/commands/audit.js +302 -0
- package/src/commands/automation.js +271 -1
- package/src/commands/bi.js +61 -0
- package/src/commands/bm25.js +78 -0
- package/src/commands/browse.js +64 -0
- package/src/commands/ccron.js +78 -0
- package/src/commands/codegen.js +224 -0
- package/src/commands/collab.js +341 -0
- package/src/commands/compliance.js +1075 -0
- package/src/commands/compt.js +78 -0
- package/src/commands/consol.js +231 -0
- package/src/commands/cowork.js +263 -0
- package/src/commands/crosschain.js +62 -0
- package/src/commands/dao.js +62 -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 +61 -0
- package/src/commands/economy.js +56 -0
- package/src/commands/encrypt.js +341 -0
- package/src/commands/evolution.js +56 -0
- package/src/commands/evomap.js +61 -0
- package/src/commands/export.js +256 -1
- package/src/commands/fflag.js +178 -0
- package/src/commands/fusion.js +258 -0
- package/src/commands/git.js +45 -0
- package/src/commands/governance.js +325 -0
- package/src/commands/hardening.js +411 -0
- package/src/commands/hmemory.js +56 -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 +42 -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/itbudget.js +45 -0
- package/src/commands/kg.js +387 -0
- package/src/commands/llm.js +263 -0
- package/src/commands/lowcode.js +44 -0
- package/src/commands/matrix.js +62 -0
- package/src/commands/mcp.js +221 -0
- package/src/commands/mcpscaf.js +41 -0
- package/src/commands/meminj.js +41 -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/nostr.js +62 -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/orchgov.js +45 -0
- package/src/commands/org.js +277 -0
- package/src/commands/p2p.js +390 -0
- package/src/commands/pdfp.js +78 -0
- package/src/commands/perception.js +290 -0
- package/src/commands/perf.js +39 -0
- package/src/commands/perm.js +45 -0
- package/src/commands/permmem.js +251 -0
- package/src/commands/pipeline.js +57 -1
- package/src/commands/planmode.js +45 -0
- package/src/commands/plugin-ecosystem.js +273 -0
- package/src/commands/pqc.js +393 -0
- package/src/commands/promcomp.js +82 -0
- package/src/commands/quantization.js +351 -0
- package/src/commands/rcache.js +271 -0
- package/src/commands/recommend.js +382 -0
- package/src/commands/runtime.js +307 -0
- package/src/commands/scim.js +262 -0
- package/src/commands/seshhook.js +41 -0
- package/src/commands/seshsearch.js +41 -0
- package/src/commands/seshtail.js +41 -0
- package/src/commands/seshu.js +41 -0
- package/src/commands/session.js +258 -0
- package/src/commands/sganal.js +78 -0
- package/src/commands/siem.js +40 -0
- package/src/commands/skill.js +267 -1
- package/src/commands/slotfill.js +41 -0
- package/src/commands/social.js +290 -0
- package/src/commands/sso.js +186 -1
- package/src/commands/svccont.js +45 -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/tms.js +45 -0
- package/src/commands/tokens.js +269 -0
- package/src/commands/topiccls.js +45 -0
- package/src/commands/trust.js +249 -0
- package/src/commands/uprof.js +45 -0
- package/src/commands/vcheck.js +78 -0
- package/src/commands/wallet.js +277 -0
- package/src/commands/webfetch.js +41 -0
- package/src/commands/workflow.js +171 -0
- package/src/commands/zkp.js +62 -0
- package/src/harness/prompt-compressor.js +331 -0
- package/src/index.js +65 -1
- package/src/lib/a2a-protocol.js +105 -0
- package/src/lib/activitypub-bridge.js +105 -0
- package/src/lib/agent-coordinator.js +325 -0
- package/src/lib/agent-economy.js +105 -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 +105 -0
- package/src/lib/audit-logger.js +379 -0
- package/src/lib/automation-engine.js +330 -0
- package/src/lib/autonomous-agent.js +105 -0
- package/src/lib/autonomous-developer.js +350 -0
- package/src/lib/bi-engine.js +105 -0
- package/src/lib/bm25-search.js +81 -0
- package/src/lib/browser-automation.js +105 -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-framework-reporter.js +105 -0
- package/src/lib/compliance-manager.js +434 -0
- package/src/lib/compression-telemetry.js +81 -0
- package/src/lib/content-recommendation.js +469 -0
- package/src/lib/content-recommender.js +105 -0
- package/src/lib/cowork-cron.js +81 -0
- package/src/lib/cowork-task-runner.js +105 -0
- package/src/lib/cross-chain.js +105 -0
- package/src/lib/crypto-manager.js +350 -0
- package/src/lib/dao-governance.js +105 -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 +105 -0
- package/src/lib/evolution-system.js +105 -0
- package/src/lib/evomap-manager.js +105 -0
- package/src/lib/execution-backend.js +105 -0
- package/src/lib/feature-flags.js +85 -0
- package/src/lib/git-integration.js +105 -0
- package/src/lib/hardening-manager.js +348 -0
- package/src/lib/hierarchical-memory.js +105 -0
- package/src/lib/hook-manager.js +380 -0
- package/src/lib/inference-network.js +105 -0
- package/src/lib/instinct-manager.js +332 -0
- package/src/lib/ipfs-storage.js +334 -0
- package/src/lib/iteration-budget.js +105 -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/matrix-bridge.js +105 -0
- package/src/lib/mcp-registry.js +333 -0
- package/src/lib/mcp-scaffold.js +81 -0
- package/src/lib/memory-injection.js +81 -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/nostr-bridge.js +105 -0
- package/src/lib/note-versioning.js +327 -0
- package/src/lib/orchestrator.js +105 -0
- package/src/lib/org-manager.js +323 -0
- package/src/lib/p2p-manager.js +387 -0
- package/src/lib/pdf-parser.js +81 -0
- package/src/lib/perception.js +346 -0
- package/src/lib/perf-tuning.js +109 -1
- package/src/lib/permanent-memory.js +320 -0
- package/src/lib/permission-engine.js +81 -0
- package/src/lib/pipeline-orchestrator.js +105 -0
- package/src/lib/plan-mode.js +81 -0
- package/src/lib/plugin-ecosystem.js +377 -0
- package/src/lib/pqc-manager.js +368 -0
- package/src/lib/prompt-compressor.js +1 -10
- package/src/lib/protocol-fusion.js +417 -0
- package/src/lib/quantization.js +325 -0
- package/src/lib/response-cache.js +327 -0
- package/src/lib/scim-manager.js +329 -0
- package/src/lib/service-container.js +81 -0
- package/src/lib/session-consolidator.js +105 -0
- package/src/lib/session-hooks.js +81 -0
- package/src/lib/session-manager.js +329 -0
- package/src/lib/session-search.js +81 -0
- package/src/lib/session-tail.js +81 -0
- package/src/lib/session-usage.js +83 -0
- package/src/lib/siem-exporter.js +105 -0
- package/src/lib/skill-loader.js +377 -0
- package/src/lib/slot-filler.js +81 -0
- package/src/lib/social-graph-analytics.js +81 -0
- package/src/lib/social-graph.js +81 -0
- package/src/lib/social-manager.js +326 -0
- package/src/lib/sso-manager.js +332 -0
- package/src/lib/sub-agent-registry.js +110 -0
- package/src/lib/sync-manager.js +326 -0
- package/src/lib/task-model-selector.js +81 -0
- package/src/lib/tech-learning-engine.js +369 -0
- package/src/lib/tenant-saas.js +460 -0
- package/src/lib/threat-intel.js +335 -0
- package/src/lib/todo-manager.js +105 -0
- package/src/lib/token-incentive.js +293 -0
- package/src/lib/token-tracker.js +329 -0
- package/src/lib/topic-classifier.js +105 -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/user-profile.js +81 -0
- package/src/lib/version-checker.js +81 -0
- package/src/lib/wallet-manager.js +326 -0
- package/src/lib/web-fetch.js +81 -0
- package/src/lib/workflow-engine.js +322 -0
- package/src/lib/zkp-engine.js +105 -0
package/src/commands/export.js
CHANGED
|
@@ -8,7 +8,41 @@ import ora from "ora";
|
|
|
8
8
|
import { resolve } from "path";
|
|
9
9
|
import { logger } from "../lib/logger.js";
|
|
10
10
|
import { bootstrap, shutdown } from "../runtime/bootstrap.js";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
exportToMarkdown,
|
|
13
|
+
exportToSite,
|
|
14
|
+
TARGET_MATURITY_V2,
|
|
15
|
+
EXPORT_JOB_LIFECYCLE_V2,
|
|
16
|
+
getMaxActiveTargetsPerOwnerV2,
|
|
17
|
+
setMaxActiveTargetsPerOwnerV2,
|
|
18
|
+
getMaxPendingJobsPerTargetV2,
|
|
19
|
+
setMaxPendingJobsPerTargetV2,
|
|
20
|
+
getTargetIdleMsV2,
|
|
21
|
+
setTargetIdleMsV2,
|
|
22
|
+
getJobStuckMsV2,
|
|
23
|
+
setJobStuckMsV2,
|
|
24
|
+
registerTargetV2,
|
|
25
|
+
getTargetV2,
|
|
26
|
+
listTargetsV2,
|
|
27
|
+
setTargetStatusV2,
|
|
28
|
+
activateTargetV2,
|
|
29
|
+
pauseTargetV2,
|
|
30
|
+
archiveTargetV2,
|
|
31
|
+
touchTargetV2,
|
|
32
|
+
getActiveTargetCountV2,
|
|
33
|
+
createExportJobV2,
|
|
34
|
+
getExportJobV2,
|
|
35
|
+
listExportJobsV2,
|
|
36
|
+
setExportJobStatusV2,
|
|
37
|
+
startExportJobV2,
|
|
38
|
+
completeExportJobV2,
|
|
39
|
+
failExportJobV2,
|
|
40
|
+
cancelExportJobV2,
|
|
41
|
+
getPendingJobCountV2,
|
|
42
|
+
autoPauseIdleTargetsV2,
|
|
43
|
+
autoFailStuckExportJobsV2,
|
|
44
|
+
getKnowledgeExporterStatsV2,
|
|
45
|
+
} from "../lib/knowledge-exporter.js";
|
|
12
46
|
|
|
13
47
|
export function registerExportCommand(program) {
|
|
14
48
|
const exp = program
|
|
@@ -122,4 +156,225 @@ export function registerExportCommand(program) {
|
|
|
122
156
|
process.exit(1);
|
|
123
157
|
}
|
|
124
158
|
});
|
|
159
|
+
|
|
160
|
+
// ─── V2 Governance Layer ──────────────────────────────────────────
|
|
161
|
+
const out = (obj) => console.log(JSON.stringify(obj, null, 2));
|
|
162
|
+
const tryRun = (fn) => {
|
|
163
|
+
try {
|
|
164
|
+
fn();
|
|
165
|
+
} catch (err) {
|
|
166
|
+
logger.error(err.message);
|
|
167
|
+
process.exit(1);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
exp
|
|
172
|
+
.command("target-maturities-v2")
|
|
173
|
+
.description("List V2 target maturity states")
|
|
174
|
+
.action(() => out(Object.values(TARGET_MATURITY_V2)));
|
|
175
|
+
|
|
176
|
+
exp
|
|
177
|
+
.command("export-job-lifecycles-v2")
|
|
178
|
+
.description("List V2 export-job lifecycle states")
|
|
179
|
+
.action(() => out(Object.values(EXPORT_JOB_LIFECYCLE_V2)));
|
|
180
|
+
|
|
181
|
+
exp
|
|
182
|
+
.command("stats-v2")
|
|
183
|
+
.description("V2 knowledge-exporter stats")
|
|
184
|
+
.action(() => out(getKnowledgeExporterStatsV2()));
|
|
185
|
+
|
|
186
|
+
exp
|
|
187
|
+
.command("get-max-active-targets-v2")
|
|
188
|
+
.description("Get max active targets per owner (V2)")
|
|
189
|
+
.action(() =>
|
|
190
|
+
out({ maxActiveTargetsPerOwner: getMaxActiveTargetsPerOwnerV2() }),
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
exp
|
|
194
|
+
.command("set-max-active-targets-v2 <n>")
|
|
195
|
+
.description("Set max active targets per owner (V2)")
|
|
196
|
+
.action((n) =>
|
|
197
|
+
tryRun(() => {
|
|
198
|
+
setMaxActiveTargetsPerOwnerV2(Number(n));
|
|
199
|
+
out({ maxActiveTargetsPerOwner: getMaxActiveTargetsPerOwnerV2() });
|
|
200
|
+
}),
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
exp
|
|
204
|
+
.command("get-max-pending-jobs-v2")
|
|
205
|
+
.description("Get max pending jobs per target (V2)")
|
|
206
|
+
.action(() =>
|
|
207
|
+
out({ maxPendingJobsPerTarget: getMaxPendingJobsPerTargetV2() }),
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
exp
|
|
211
|
+
.command("set-max-pending-jobs-v2 <n>")
|
|
212
|
+
.description("Set max pending jobs per target (V2)")
|
|
213
|
+
.action((n) =>
|
|
214
|
+
tryRun(() => {
|
|
215
|
+
setMaxPendingJobsPerTargetV2(Number(n));
|
|
216
|
+
out({ maxPendingJobsPerTarget: getMaxPendingJobsPerTargetV2() });
|
|
217
|
+
}),
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
exp
|
|
221
|
+
.command("get-target-idle-ms-v2")
|
|
222
|
+
.description("Get target idle threshold (V2)")
|
|
223
|
+
.action(() => out({ targetIdleMs: getTargetIdleMsV2() }));
|
|
224
|
+
|
|
225
|
+
exp
|
|
226
|
+
.command("set-target-idle-ms-v2 <ms>")
|
|
227
|
+
.description("Set target idle threshold (V2)")
|
|
228
|
+
.action((ms) =>
|
|
229
|
+
tryRun(() => {
|
|
230
|
+
setTargetIdleMsV2(Number(ms));
|
|
231
|
+
out({ targetIdleMs: getTargetIdleMsV2() });
|
|
232
|
+
}),
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
exp
|
|
236
|
+
.command("get-job-stuck-ms-v2")
|
|
237
|
+
.description("Get export-job stuck threshold (V2)")
|
|
238
|
+
.action(() => out({ jobStuckMs: getJobStuckMsV2() }));
|
|
239
|
+
|
|
240
|
+
exp
|
|
241
|
+
.command("set-job-stuck-ms-v2 <ms>")
|
|
242
|
+
.description("Set export-job stuck threshold (V2)")
|
|
243
|
+
.action((ms) =>
|
|
244
|
+
tryRun(() => {
|
|
245
|
+
setJobStuckMsV2(Number(ms));
|
|
246
|
+
out({ jobStuckMs: getJobStuckMsV2() });
|
|
247
|
+
}),
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
exp
|
|
251
|
+
.command("active-target-count-v2 <ownerId>")
|
|
252
|
+
.description("Active target count for owner (V2)")
|
|
253
|
+
.action((ownerId) =>
|
|
254
|
+
out({ ownerId, count: getActiveTargetCountV2(ownerId) }),
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
exp
|
|
258
|
+
.command("pending-job-count-v2 <targetId>")
|
|
259
|
+
.description("Pending export-job count for target (V2)")
|
|
260
|
+
.action((targetId) =>
|
|
261
|
+
out({ targetId, count: getPendingJobCountV2(targetId) }),
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
exp
|
|
265
|
+
.command("register-target-v2 <id>")
|
|
266
|
+
.description("Register a V2 export target")
|
|
267
|
+
.requiredOption("-o, --owner <id>", "owner id")
|
|
268
|
+
.requiredOption("-l, --label <label>", "target label")
|
|
269
|
+
.option("-f, --format <format>", "target format", "markdown")
|
|
270
|
+
.action((id, opts) =>
|
|
271
|
+
tryRun(() =>
|
|
272
|
+
out(
|
|
273
|
+
registerTargetV2(id, {
|
|
274
|
+
ownerId: opts.owner,
|
|
275
|
+
label: opts.label,
|
|
276
|
+
format: opts.format,
|
|
277
|
+
}),
|
|
278
|
+
),
|
|
279
|
+
),
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
exp
|
|
283
|
+
.command("get-target-v2 <id>")
|
|
284
|
+
.description("Get a V2 target")
|
|
285
|
+
.action((id) => out(getTargetV2(id)));
|
|
286
|
+
|
|
287
|
+
exp
|
|
288
|
+
.command("list-targets-v2")
|
|
289
|
+
.description("List V2 targets")
|
|
290
|
+
.option("-o, --owner <id>", "filter by owner")
|
|
291
|
+
.option("-s, --status <status>", "filter by status")
|
|
292
|
+
.action((opts) =>
|
|
293
|
+
out(listTargetsV2({ ownerId: opts.owner, status: opts.status })),
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
exp
|
|
297
|
+
.command("set-target-status-v2 <id> <next>")
|
|
298
|
+
.description("Set V2 target status")
|
|
299
|
+
.action((id, next) => tryRun(() => out(setTargetStatusV2(id, next))));
|
|
300
|
+
|
|
301
|
+
exp
|
|
302
|
+
.command("activate-target-v2 <id>")
|
|
303
|
+
.description("Activate a V2 target")
|
|
304
|
+
.action((id) => tryRun(() => out(activateTargetV2(id))));
|
|
305
|
+
|
|
306
|
+
exp
|
|
307
|
+
.command("pause-target-v2 <id>")
|
|
308
|
+
.description("Pause a V2 target")
|
|
309
|
+
.action((id) => tryRun(() => out(pauseTargetV2(id))));
|
|
310
|
+
|
|
311
|
+
exp
|
|
312
|
+
.command("archive-target-v2 <id>")
|
|
313
|
+
.description("Archive a V2 target")
|
|
314
|
+
.action((id) => tryRun(() => out(archiveTargetV2(id))));
|
|
315
|
+
|
|
316
|
+
exp
|
|
317
|
+
.command("touch-target-v2 <id>")
|
|
318
|
+
.description("Touch a V2 target")
|
|
319
|
+
.action((id) => tryRun(() => out(touchTargetV2(id))));
|
|
320
|
+
|
|
321
|
+
exp
|
|
322
|
+
.command("create-export-job-v2 <id>")
|
|
323
|
+
.description("Create a V2 export job")
|
|
324
|
+
.requiredOption("-t, --target <id>", "target id")
|
|
325
|
+
.option("-k, --kind <kind>", "job kind", "snapshot")
|
|
326
|
+
.action((id, opts) =>
|
|
327
|
+
tryRun(() =>
|
|
328
|
+
out(createExportJobV2(id, { targetId: opts.target, kind: opts.kind })),
|
|
329
|
+
),
|
|
330
|
+
);
|
|
331
|
+
|
|
332
|
+
exp
|
|
333
|
+
.command("get-export-job-v2 <id>")
|
|
334
|
+
.description("Get a V2 export job")
|
|
335
|
+
.action((id) => out(getExportJobV2(id)));
|
|
336
|
+
|
|
337
|
+
exp
|
|
338
|
+
.command("list-export-jobs-v2")
|
|
339
|
+
.description("List V2 export jobs")
|
|
340
|
+
.option("-t, --target <id>", "filter by target")
|
|
341
|
+
.option("-s, --status <status>", "filter by status")
|
|
342
|
+
.action((opts) =>
|
|
343
|
+
out(listExportJobsV2({ targetId: opts.target, status: opts.status })),
|
|
344
|
+
);
|
|
345
|
+
|
|
346
|
+
exp
|
|
347
|
+
.command("set-export-job-status-v2 <id> <next>")
|
|
348
|
+
.description("Set V2 export-job status")
|
|
349
|
+
.action((id, next) => tryRun(() => out(setExportJobStatusV2(id, next))));
|
|
350
|
+
|
|
351
|
+
exp
|
|
352
|
+
.command("start-export-job-v2 <id>")
|
|
353
|
+
.description("Start a V2 export job")
|
|
354
|
+
.action((id) => tryRun(() => out(startExportJobV2(id))));
|
|
355
|
+
|
|
356
|
+
exp
|
|
357
|
+
.command("complete-export-job-v2 <id>")
|
|
358
|
+
.description("Complete a V2 export job")
|
|
359
|
+
.action((id) => tryRun(() => out(completeExportJobV2(id))));
|
|
360
|
+
|
|
361
|
+
exp
|
|
362
|
+
.command("fail-export-job-v2 <id>")
|
|
363
|
+
.description("Fail a V2 export job")
|
|
364
|
+
.action((id) => tryRun(() => out(failExportJobV2(id))));
|
|
365
|
+
|
|
366
|
+
exp
|
|
367
|
+
.command("cancel-export-job-v2 <id>")
|
|
368
|
+
.description("Cancel a V2 export job")
|
|
369
|
+
.action((id) => tryRun(() => out(cancelExportJobV2(id))));
|
|
370
|
+
|
|
371
|
+
exp
|
|
372
|
+
.command("auto-pause-idle-targets-v2")
|
|
373
|
+
.description("Auto-pause idle V2 targets")
|
|
374
|
+
.action(() => out(autoPauseIdleTargetsV2()));
|
|
375
|
+
|
|
376
|
+
exp
|
|
377
|
+
.command("auto-fail-stuck-export-jobs-v2")
|
|
378
|
+
.description("Auto-fail stuck V2 export jobs")
|
|
379
|
+
.action(() => out(autoFailStuckExportJobsV2()));
|
|
125
380
|
}
|
|
@@ -0,0 +1,178 @@
|
|
|
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) => console.log(JSON.stringify(registerFflagProfileV2(o), null, 2)));
|
|
60
|
+
fflag
|
|
61
|
+
.command("activate-profile-v2 <id>")
|
|
62
|
+
.description("Transition profile to active")
|
|
63
|
+
.action((id) => console.log(JSON.stringify(activateFflagProfileV2(id), null, 2)));
|
|
64
|
+
fflag
|
|
65
|
+
.command("pause-profile-v2 <id>")
|
|
66
|
+
.description("Transition profile to paused")
|
|
67
|
+
.action((id) => console.log(JSON.stringify(pauseFflagProfileV2(id), null, 2)));
|
|
68
|
+
fflag
|
|
69
|
+
.command("archive-profile-v2 <id>")
|
|
70
|
+
.description("Transition profile to archived (terminal)")
|
|
71
|
+
.action((id) => console.log(JSON.stringify(archiveFflagProfileV2(id), null, 2)));
|
|
72
|
+
fflag
|
|
73
|
+
.command("touch-profile-v2 <id>")
|
|
74
|
+
.description("Refresh lastTouchedAt")
|
|
75
|
+
.action((id) => console.log(JSON.stringify(touchFflagProfileV2(id), null, 2)));
|
|
76
|
+
fflag
|
|
77
|
+
.command("get-profile-v2 <id>")
|
|
78
|
+
.description("Get a profile by id")
|
|
79
|
+
.action((id) => console.log(JSON.stringify(getFflagProfileV2(id), null, 2)));
|
|
80
|
+
fflag
|
|
81
|
+
.command("list-profiles-v2")
|
|
82
|
+
.description("List all profiles")
|
|
83
|
+
.action(() => console.log(JSON.stringify(listFflagProfilesV2(), null, 2)));
|
|
84
|
+
|
|
85
|
+
fflag
|
|
86
|
+
.command("create-eval-v2")
|
|
87
|
+
.description("Create an eval (queued)")
|
|
88
|
+
.requiredOption("--id <id>")
|
|
89
|
+
.requiredOption("--profile-id <profileId>")
|
|
90
|
+
.option("--key <key>", "flag key", "")
|
|
91
|
+
.action((o) =>
|
|
92
|
+
console.log(JSON.stringify(createFflagEvalV2(o), null, 2)),
|
|
93
|
+
);
|
|
94
|
+
fflag
|
|
95
|
+
.command("evaluating-eval-v2 <id>")
|
|
96
|
+
.description("Mark eval as evaluating")
|
|
97
|
+
.action((id) => console.log(JSON.stringify(evaluatingFflagEvalV2(id), null, 2)));
|
|
98
|
+
fflag
|
|
99
|
+
.command("evaluate-eval-v2 <id>")
|
|
100
|
+
.description("Mark eval as evaluated (terminal)")
|
|
101
|
+
.action((id) => console.log(JSON.stringify(evaluateFflagEvalV2(id), null, 2)));
|
|
102
|
+
fflag
|
|
103
|
+
.command("fail-eval-v2 <id>")
|
|
104
|
+
.description("Mark eval as failed (terminal)")
|
|
105
|
+
.option("--reason <reason>")
|
|
106
|
+
.action((id, o) => console.log(JSON.stringify(failFflagEvalV2(id, o.reason), null, 2)));
|
|
107
|
+
fflag
|
|
108
|
+
.command("cancel-eval-v2 <id>")
|
|
109
|
+
.description("Mark eval as cancelled (terminal)")
|
|
110
|
+
.option("--reason <reason>")
|
|
111
|
+
.action((id, o) => console.log(JSON.stringify(cancelFflagEvalV2(id, o.reason), null, 2)));
|
|
112
|
+
fflag
|
|
113
|
+
.command("get-eval-v2 <id>")
|
|
114
|
+
.description("Get an eval by id")
|
|
115
|
+
.action((id) => console.log(JSON.stringify(getFflagEvalV2(id), null, 2)));
|
|
116
|
+
fflag
|
|
117
|
+
.command("list-evals-v2")
|
|
118
|
+
.description("List all evals")
|
|
119
|
+
.action(() => console.log(JSON.stringify(listFflagEvalsV2(), null, 2)));
|
|
120
|
+
|
|
121
|
+
fflag
|
|
122
|
+
.command("config-v2")
|
|
123
|
+
.description("Show V2 config (caps + idle/stuck windows)")
|
|
124
|
+
.action(() => {
|
|
125
|
+
console.log(
|
|
126
|
+
JSON.stringify(
|
|
127
|
+
{
|
|
128
|
+
maxActiveFflagProfilesPerOwner: getMaxActiveFflagProfilesPerOwnerV2(),
|
|
129
|
+
maxPendingFflagEvalsPerProfile: getMaxPendingFflagEvalsPerProfileV2(),
|
|
130
|
+
fflagProfileIdleMs: getFflagProfileIdleMsV2(),
|
|
131
|
+
fflagEvalStuckMs: getFflagEvalStuckMsV2(),
|
|
132
|
+
},
|
|
133
|
+
null,
|
|
134
|
+
2,
|
|
135
|
+
),
|
|
136
|
+
);
|
|
137
|
+
});
|
|
138
|
+
fflag
|
|
139
|
+
.command("set-max-active-profiles-v2 <n>")
|
|
140
|
+
.description("Set max active profiles per owner")
|
|
141
|
+
.action((n) => {
|
|
142
|
+
setMaxActiveFflagProfilesPerOwnerV2(Number(n));
|
|
143
|
+
console.log(JSON.stringify({ maxActiveFflagProfilesPerOwner: getMaxActiveFflagProfilesPerOwnerV2() }, null, 2));
|
|
144
|
+
});
|
|
145
|
+
fflag
|
|
146
|
+
.command("set-max-pending-evals-v2 <n>")
|
|
147
|
+
.description("Set max pending evals per profile")
|
|
148
|
+
.action((n) => {
|
|
149
|
+
setMaxPendingFflagEvalsPerProfileV2(Number(n));
|
|
150
|
+
console.log(JSON.stringify({ maxPendingFflagEvalsPerProfile: getMaxPendingFflagEvalsPerProfileV2() }, null, 2));
|
|
151
|
+
});
|
|
152
|
+
fflag
|
|
153
|
+
.command("set-profile-idle-ms-v2 <ms>")
|
|
154
|
+
.description("Set profile idle window")
|
|
155
|
+
.action((ms) => {
|
|
156
|
+
setFflagProfileIdleMsV2(Number(ms));
|
|
157
|
+
console.log(JSON.stringify({ fflagProfileIdleMs: getFflagProfileIdleMsV2() }, null, 2));
|
|
158
|
+
});
|
|
159
|
+
fflag
|
|
160
|
+
.command("set-eval-stuck-ms-v2 <ms>")
|
|
161
|
+
.description("Set eval stuck window")
|
|
162
|
+
.action((ms) => {
|
|
163
|
+
setFflagEvalStuckMsV2(Number(ms));
|
|
164
|
+
console.log(JSON.stringify({ fflagEvalStuckMs: getFflagEvalStuckMsV2() }, null, 2));
|
|
165
|
+
});
|
|
166
|
+
fflag
|
|
167
|
+
.command("auto-pause-idle-v2")
|
|
168
|
+
.description("Auto-pause idle active profiles")
|
|
169
|
+
.action(() => console.log(JSON.stringify(autoPauseIdleFflagProfilesV2(), null, 2)));
|
|
170
|
+
fflag
|
|
171
|
+
.command("auto-fail-stuck-v2")
|
|
172
|
+
.description("Auto-fail stuck evaluating evals")
|
|
173
|
+
.action(() => console.log(JSON.stringify(autoFailStuckFflagEvalsV2(), null, 2)));
|
|
174
|
+
fflag
|
|
175
|
+
.command("gov-stats-v2")
|
|
176
|
+
.description("Show V2 governance stats")
|
|
177
|
+
.action(() => console.log(JSON.stringify(getFeatureFlagsGovStatsV2(), null, 2)));
|
|
178
|
+
}
|