chainlesschain 0.47.8 → 0.49.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 +10 -8
- package/src/assets/web-panel/.build-hash +1 -1
- package/src/assets/web-panel/assets/{AppLayout-6SPt_8Y_.js → AppLayout-Rvi759IS.js} +1 -1
- package/src/assets/web-panel/assets/Dashboard-BS-tzGNj.css +1 -0
- package/src/assets/web-panel/assets/{Dashboard-Br7kCwKJ.js → Dashboard-DBhFxXYQ.js} +2 -2
- package/src/assets/web-panel/assets/{index-tN-8TosE.js → index-uL0cZ8N_.js} +2 -2
- package/src/assets/web-panel/index.html +2 -2
- package/src/commands/activitypub.js +533 -0
- package/src/commands/codegen.js +303 -0
- package/src/commands/collab.js +482 -0
- package/src/commands/compliance.js +597 -6
- package/src/commands/crosschain.js +382 -0
- package/src/commands/dbevo.js +388 -0
- package/src/commands/dev.js +411 -0
- package/src/commands/federation.js +427 -0
- package/src/commands/fusion.js +332 -0
- package/src/commands/governance.js +505 -0
- package/src/commands/hardening.js +110 -0
- package/src/commands/incentive.js +373 -0
- package/src/commands/inference.js +304 -0
- package/src/commands/infra.js +361 -0
- package/src/commands/kg.js +371 -0
- package/src/commands/marketplace.js +326 -0
- package/src/commands/matrix.js +283 -0
- package/src/commands/mcp.js +441 -18
- package/src/commands/nlprog.js +329 -0
- package/src/commands/nostr.js +196 -7
- package/src/commands/ops.js +408 -0
- package/src/commands/perception.js +385 -0
- package/src/commands/pqc.js +34 -0
- package/src/commands/privacy.js +345 -0
- package/src/commands/quantization.js +280 -0
- package/src/commands/recommend.js +336 -0
- package/src/commands/reputation.js +349 -0
- package/src/commands/runtime.js +500 -0
- package/src/commands/sla.js +352 -0
- package/src/commands/social.js +265 -0
- package/src/commands/stress.js +252 -0
- package/src/commands/tech.js +268 -0
- package/src/commands/tenant.js +576 -0
- package/src/commands/trust.js +366 -0
- package/src/harness/mcp-client.js +330 -54
- package/src/index.js +114 -0
- package/src/lib/activitypub-bridge.js +623 -0
- package/src/lib/aiops.js +523 -0
- package/src/lib/autonomous-developer.js +524 -0
- package/src/lib/code-agent.js +442 -0
- package/src/lib/collaboration-governance.js +556 -0
- package/src/lib/community-governance.js +649 -0
- package/src/lib/compliance-framework-reporter.js +600 -0
- package/src/lib/content-recommendation.js +600 -0
- package/src/lib/cross-chain.js +669 -0
- package/src/lib/dbevo.js +669 -0
- package/src/lib/decentral-infra.js +445 -0
- package/src/lib/federation-hardening.js +587 -0
- package/src/lib/hardening-manager.js +409 -0
- package/src/lib/inference-network.js +407 -0
- package/src/lib/knowledge-graph.js +530 -0
- package/src/lib/matrix-bridge.js +252 -0
- package/src/lib/mcp-client.js +3 -0
- package/src/lib/mcp-registry.js +347 -0
- package/src/lib/mcp-scaffold.js +385 -0
- package/src/lib/multimodal.js +698 -0
- package/src/lib/nl-programming.js +595 -0
- package/src/lib/nostr-bridge.js +214 -38
- package/src/lib/perception.js +500 -0
- package/src/lib/pqc-manager.js +141 -9
- package/src/lib/privacy-computing.js +575 -0
- package/src/lib/protocol-fusion.js +535 -0
- package/src/lib/quantization.js +362 -0
- package/src/lib/reputation-optimizer.js +509 -0
- package/src/lib/skill-marketplace.js +397 -0
- package/src/lib/sla-manager.js +484 -0
- package/src/lib/social-graph.js +408 -0
- package/src/lib/stix-parser.js +167 -0
- package/src/lib/stress-tester.js +383 -0
- package/src/lib/tech-learning-engine.js +651 -0
- package/src/lib/tenant-saas.js +831 -0
- package/src/lib/threat-intel.js +268 -0
- package/src/lib/token-incentive.js +513 -0
- package/src/lib/topic-classifier.js +400 -0
- package/src/lib/trust-security.js +473 -0
- package/src/lib/ueba.js +403 -0
- package/src/lib/universal-runtime.js +771 -0
- package/src/assets/web-panel/assets/Dashboard-CKeMmCoT.css +0 -1
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cc codegen` — CLI surface for Phase 86 Code Generation Agent 2.0.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
SCAFFOLD_TEMPLATE,
|
|
9
|
+
REVIEW_SEVERITY,
|
|
10
|
+
SECURITY_RULE,
|
|
11
|
+
CICD_PLATFORM,
|
|
12
|
+
ensureCodeAgentTables,
|
|
13
|
+
createGeneration,
|
|
14
|
+
getGeneration,
|
|
15
|
+
listGenerations,
|
|
16
|
+
reviewCode,
|
|
17
|
+
getReview,
|
|
18
|
+
listReviews,
|
|
19
|
+
createScaffold,
|
|
20
|
+
getScaffold,
|
|
21
|
+
listScaffolds,
|
|
22
|
+
getCodeAgentStats,
|
|
23
|
+
} from "../lib/code-agent.js";
|
|
24
|
+
|
|
25
|
+
function _dbFromCtx(cmd) {
|
|
26
|
+
const root = cmd?.parent?.parent ?? cmd?.parent;
|
|
27
|
+
return root?._db;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function registerCodegenCommand(program) {
|
|
31
|
+
const cg = new Command("codegen")
|
|
32
|
+
.description("Code generation agent (Phase 86)")
|
|
33
|
+
.hook("preAction", (thisCmd) => {
|
|
34
|
+
const db = _dbFromCtx(thisCmd);
|
|
35
|
+
if (db) ensureCodeAgentTables(db);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/* ── Catalogs ────────────────────────────────────── */
|
|
39
|
+
|
|
40
|
+
cg.command("templates")
|
|
41
|
+
.description("List scaffold templates")
|
|
42
|
+
.option("--json", "JSON output")
|
|
43
|
+
.action((opts) => {
|
|
44
|
+
const templates = Object.values(SCAFFOLD_TEMPLATE);
|
|
45
|
+
if (opts.json) return console.log(JSON.stringify(templates, null, 2));
|
|
46
|
+
for (const t of templates) console.log(` ${t}`);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
cg.command("severities")
|
|
50
|
+
.description("List review severity levels")
|
|
51
|
+
.option("--json", "JSON output")
|
|
52
|
+
.action((opts) => {
|
|
53
|
+
const sevs = Object.values(REVIEW_SEVERITY);
|
|
54
|
+
if (opts.json) return console.log(JSON.stringify(sevs, null, 2));
|
|
55
|
+
for (const s of sevs) console.log(` ${s}`);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
cg.command("rules")
|
|
59
|
+
.description("List security rules")
|
|
60
|
+
.option("--json", "JSON output")
|
|
61
|
+
.action((opts) => {
|
|
62
|
+
const rules = Object.values(SECURITY_RULE);
|
|
63
|
+
if (opts.json) return console.log(JSON.stringify(rules, null, 2));
|
|
64
|
+
for (const r of rules) console.log(` ${r}`);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
cg.command("platforms")
|
|
68
|
+
.description("List CI/CD platforms")
|
|
69
|
+
.option("--json", "JSON output")
|
|
70
|
+
.action((opts) => {
|
|
71
|
+
const plats = Object.values(CICD_PLATFORM);
|
|
72
|
+
if (opts.json) return console.log(JSON.stringify(plats, null, 2));
|
|
73
|
+
for (const p of plats) console.log(` ${p}`);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
/* ── Code Generation ─────────────────────────────── */
|
|
77
|
+
|
|
78
|
+
cg.command("generate")
|
|
79
|
+
.description("Record a code generation session")
|
|
80
|
+
.requiredOption("-p, --prompt <text>", "Generation prompt")
|
|
81
|
+
.option("-l, --language <lang>", "Programming language")
|
|
82
|
+
.option("-f, --framework <fw>", "Framework used")
|
|
83
|
+
.option("--code <code>", "Generated code")
|
|
84
|
+
.option("--files <n>", "Files generated", parseInt)
|
|
85
|
+
.option("--tokens <n>", "Tokens consumed", parseInt)
|
|
86
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
87
|
+
.option("--json", "JSON output")
|
|
88
|
+
.action((opts) => {
|
|
89
|
+
const db = _dbFromCtx(cg);
|
|
90
|
+
const result = createGeneration(db, {
|
|
91
|
+
prompt: opts.prompt,
|
|
92
|
+
language: opts.language,
|
|
93
|
+
framework: opts.framework,
|
|
94
|
+
generatedCode: opts.code,
|
|
95
|
+
fileCount: opts.files,
|
|
96
|
+
tokenCount: opts.tokens,
|
|
97
|
+
metadata: opts.metadata,
|
|
98
|
+
});
|
|
99
|
+
if (opts.json) return console.log(JSON.stringify(result, null, 2));
|
|
100
|
+
if (result.generationId)
|
|
101
|
+
console.log(`Generation recorded: ${result.generationId}`);
|
|
102
|
+
else console.log(`Failed: ${result.reason}`);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
cg.command("show <id>")
|
|
106
|
+
.description("Show generation details")
|
|
107
|
+
.option("--json", "JSON output")
|
|
108
|
+
.action((id, opts) => {
|
|
109
|
+
const db = _dbFromCtx(cg);
|
|
110
|
+
const g = getGeneration(db, id);
|
|
111
|
+
if (!g) return console.log("Generation not found.");
|
|
112
|
+
if (opts.json) return console.log(JSON.stringify(g, null, 2));
|
|
113
|
+
console.log(`ID: ${g.id}`);
|
|
114
|
+
console.log(`Prompt: ${g.prompt.slice(0, 80)}`);
|
|
115
|
+
if (g.language) console.log(`Language: ${g.language}`);
|
|
116
|
+
if (g.framework) console.log(`Framework: ${g.framework}`);
|
|
117
|
+
console.log(`Files: ${g.file_count}`);
|
|
118
|
+
console.log(`Tokens: ${g.token_count}`);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
cg.command("list")
|
|
122
|
+
.description("List code generations")
|
|
123
|
+
.option("-l, --language <lang>", "Filter by language")
|
|
124
|
+
.option("-f, --framework <fw>", "Filter by framework")
|
|
125
|
+
.option("--limit <n>", "Max results", parseInt)
|
|
126
|
+
.option("--json", "JSON output")
|
|
127
|
+
.action((opts) => {
|
|
128
|
+
const db = _dbFromCtx(cg);
|
|
129
|
+
const gens = listGenerations(db, {
|
|
130
|
+
language: opts.language,
|
|
131
|
+
framework: opts.framework,
|
|
132
|
+
limit: opts.limit,
|
|
133
|
+
});
|
|
134
|
+
if (opts.json) return console.log(JSON.stringify(gens, null, 2));
|
|
135
|
+
if (gens.length === 0) return console.log("No generations.");
|
|
136
|
+
for (const g of gens) {
|
|
137
|
+
console.log(
|
|
138
|
+
` ${(g.language || "?").padEnd(12)} ${(g.framework || "").padEnd(14)} ${g.prompt.slice(0, 40).padEnd(42)} ${g.id.slice(0, 8)}`,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
/* ── Code Review ─────────────────────────────────── */
|
|
144
|
+
|
|
145
|
+
cg.command("review")
|
|
146
|
+
.description("Run heuristic code review")
|
|
147
|
+
.requiredOption("-c, --code <code>", "Code to review")
|
|
148
|
+
.option("-g, --generation <id>", "Link to generation ID")
|
|
149
|
+
.option("-l, --language <lang>", "Programming language")
|
|
150
|
+
.option("--json", "JSON output")
|
|
151
|
+
.action((opts) => {
|
|
152
|
+
const db = _dbFromCtx(cg);
|
|
153
|
+
const result = reviewCode(db, {
|
|
154
|
+
generationId: opts.generation,
|
|
155
|
+
code: opts.code,
|
|
156
|
+
language: opts.language,
|
|
157
|
+
});
|
|
158
|
+
if (opts.json) return console.log(JSON.stringify(result, null, 2));
|
|
159
|
+
if (result.reviewId) {
|
|
160
|
+
console.log(`Review: ${result.reviewId}`);
|
|
161
|
+
console.log(
|
|
162
|
+
`Issues: ${result.issuesFound} (${result.securityIssues} security)`,
|
|
163
|
+
);
|
|
164
|
+
for (const [sev, count] of Object.entries(result.severitySummary)) {
|
|
165
|
+
if (count > 0) console.log(` ${sev}: ${count}`);
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
console.log(`Failed: ${result.reason}`);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
cg.command("review-show <id>")
|
|
173
|
+
.description("Show review details")
|
|
174
|
+
.option("--json", "JSON output")
|
|
175
|
+
.action((id, opts) => {
|
|
176
|
+
const db = _dbFromCtx(cg);
|
|
177
|
+
const r = getReview(db, id);
|
|
178
|
+
if (!r) return console.log("Review not found.");
|
|
179
|
+
if (opts.json) return console.log(JSON.stringify(r, null, 2));
|
|
180
|
+
console.log(`ID: ${r.id}`);
|
|
181
|
+
if (r.generation_id) console.log(`Gen ID: ${r.generation_id}`);
|
|
182
|
+
console.log(`Hash: ${r.code_hash}`);
|
|
183
|
+
if (r.language) console.log(`Language: ${r.language}`);
|
|
184
|
+
console.log(
|
|
185
|
+
`Issues: ${r.issues_found} (${r.security_issues} security)`,
|
|
186
|
+
);
|
|
187
|
+
try {
|
|
188
|
+
const detail = JSON.parse(r.issues_detail);
|
|
189
|
+
for (const issue of detail) {
|
|
190
|
+
console.log(` [${issue.severity}] ${issue.rule}: ${issue.match}`);
|
|
191
|
+
}
|
|
192
|
+
} catch (_e) {
|
|
193
|
+
/* not JSON */
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
cg.command("reviews")
|
|
198
|
+
.description("List code reviews")
|
|
199
|
+
.option("-l, --language <lang>", "Filter by language")
|
|
200
|
+
.option("--limit <n>", "Max results", parseInt)
|
|
201
|
+
.option("--json", "JSON output")
|
|
202
|
+
.action((opts) => {
|
|
203
|
+
const db = _dbFromCtx(cg);
|
|
204
|
+
const revs = listReviews(db, {
|
|
205
|
+
language: opts.language,
|
|
206
|
+
limit: opts.limit,
|
|
207
|
+
});
|
|
208
|
+
if (opts.json) return console.log(JSON.stringify(revs, null, 2));
|
|
209
|
+
if (revs.length === 0) return console.log("No reviews.");
|
|
210
|
+
for (const r of revs) {
|
|
211
|
+
console.log(
|
|
212
|
+
` ${(r.language || "?").padEnd(12)} issues:${String(r.issues_found).padEnd(4)} sec:${String(r.security_issues).padEnd(4)} ${r.id.slice(0, 8)}`,
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
/* ── Scaffold ────────────────────────────────────── */
|
|
218
|
+
|
|
219
|
+
cg.command("scaffold")
|
|
220
|
+
.description("Record a scaffold generation")
|
|
221
|
+
.requiredOption(
|
|
222
|
+
"-t, --template <type>",
|
|
223
|
+
"Template (react/vue/express/fastapi/spring_boot)",
|
|
224
|
+
)
|
|
225
|
+
.requiredOption("-n, --name <name>", "Project name")
|
|
226
|
+
.option("-o, --options <json>", "Options JSON")
|
|
227
|
+
.option("--files <n>", "Files generated", parseInt)
|
|
228
|
+
.option("--output <path>", "Output path")
|
|
229
|
+
.option("--json", "JSON output")
|
|
230
|
+
.action((opts) => {
|
|
231
|
+
const db = _dbFromCtx(cg);
|
|
232
|
+
const result = createScaffold(db, {
|
|
233
|
+
template: opts.template,
|
|
234
|
+
projectName: opts.name,
|
|
235
|
+
options: opts.options,
|
|
236
|
+
filesGenerated: opts.files,
|
|
237
|
+
outputPath: opts.output,
|
|
238
|
+
});
|
|
239
|
+
if (opts.json) return console.log(JSON.stringify(result, null, 2));
|
|
240
|
+
if (result.scaffoldId)
|
|
241
|
+
console.log(`Scaffold created: ${result.scaffoldId}`);
|
|
242
|
+
else console.log(`Failed: ${result.reason}`);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
cg.command("scaffold-show <id>")
|
|
246
|
+
.description("Show scaffold details")
|
|
247
|
+
.option("--json", "JSON output")
|
|
248
|
+
.action((id, opts) => {
|
|
249
|
+
const db = _dbFromCtx(cg);
|
|
250
|
+
const s = getScaffold(db, id);
|
|
251
|
+
if (!s) return console.log("Scaffold not found.");
|
|
252
|
+
if (opts.json) return console.log(JSON.stringify(s, null, 2));
|
|
253
|
+
console.log(`ID: ${s.id}`);
|
|
254
|
+
console.log(`Template: ${s.template}`);
|
|
255
|
+
console.log(`Project: ${s.project_name}`);
|
|
256
|
+
if (s.options) console.log(`Options: ${s.options}`);
|
|
257
|
+
console.log(`Files: ${s.files_generated}`);
|
|
258
|
+
if (s.output_path) console.log(`Output: ${s.output_path}`);
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
cg.command("scaffolds")
|
|
262
|
+
.description("List scaffolds")
|
|
263
|
+
.option("-t, --template <type>", "Filter by template")
|
|
264
|
+
.option("--limit <n>", "Max results", parseInt)
|
|
265
|
+
.option("--json", "JSON output")
|
|
266
|
+
.action((opts) => {
|
|
267
|
+
const db = _dbFromCtx(cg);
|
|
268
|
+
const scfs = listScaffolds(db, {
|
|
269
|
+
template: opts.template,
|
|
270
|
+
limit: opts.limit,
|
|
271
|
+
});
|
|
272
|
+
if (opts.json) return console.log(JSON.stringify(scfs, null, 2));
|
|
273
|
+
if (scfs.length === 0) return console.log("No scaffolds.");
|
|
274
|
+
for (const s of scfs) {
|
|
275
|
+
console.log(
|
|
276
|
+
` ${s.template.padEnd(14)} ${(s.project_name || "").padEnd(20)} files:${String(s.files_generated).padEnd(4)} ${s.id.slice(0, 8)}`,
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
/* ── Stats ───────────────────────────────────────── */
|
|
282
|
+
|
|
283
|
+
cg.command("stats")
|
|
284
|
+
.description("Code agent statistics")
|
|
285
|
+
.option("--json", "JSON output")
|
|
286
|
+
.action((opts) => {
|
|
287
|
+
const db = _dbFromCtx(cg);
|
|
288
|
+
const s = getCodeAgentStats(db);
|
|
289
|
+
if (opts.json) return console.log(JSON.stringify(s, null, 2));
|
|
290
|
+
console.log(
|
|
291
|
+
`Generations: ${s.generations.total} (${s.generations.totalFiles} files, ${s.generations.totalTokens} tokens, ${s.generations.uniqueLanguages} languages)`,
|
|
292
|
+
);
|
|
293
|
+
console.log(
|
|
294
|
+
`Reviews: ${s.reviews.total} (${s.reviews.totalIssues} issues, ${s.reviews.totalSecurityIssues} security, avg ${s.reviews.avgIssuesPerReview}/review)`,
|
|
295
|
+
);
|
|
296
|
+
console.log(`Scaffolds: ${s.scaffolds.total}`);
|
|
297
|
+
for (const [tmpl, count] of Object.entries(s.scaffolds.byTemplate)) {
|
|
298
|
+
console.log(` ${tmpl.padEnd(14)} ${count}`);
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
program.addCommand(cg);
|
|
303
|
+
}
|