chainlesschain 0.47.9 → 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.
Files changed (70) hide show
  1. package/bin/chainlesschain.js +0 -0
  2. package/package.json +1 -1
  3. package/src/assets/web-panel/.build-hash +1 -1
  4. package/src/assets/web-panel/assets/{AppLayout-6SPt_8Y_.js → AppLayout-Rvi759IS.js} +1 -1
  5. package/src/assets/web-panel/assets/Dashboard-BS-tzGNj.css +1 -0
  6. package/src/assets/web-panel/assets/{Dashboard-Br7kCwKJ.js → Dashboard-DBhFxXYQ.js} +2 -2
  7. package/src/assets/web-panel/assets/{index-tN-8TosE.js → index-uL0cZ8N_.js} +2 -2
  8. package/src/assets/web-panel/index.html +2 -2
  9. package/src/commands/codegen.js +303 -0
  10. package/src/commands/collab.js +482 -0
  11. package/src/commands/crosschain.js +382 -0
  12. package/src/commands/dbevo.js +388 -0
  13. package/src/commands/dev.js +411 -0
  14. package/src/commands/federation.js +427 -0
  15. package/src/commands/fusion.js +332 -0
  16. package/src/commands/governance.js +505 -0
  17. package/src/commands/hardening.js +110 -0
  18. package/src/commands/incentive.js +373 -0
  19. package/src/commands/inference.js +304 -0
  20. package/src/commands/infra.js +361 -0
  21. package/src/commands/kg.js +371 -0
  22. package/src/commands/marketplace.js +326 -0
  23. package/src/commands/mcp.js +97 -18
  24. package/src/commands/nlprog.js +329 -0
  25. package/src/commands/ops.js +408 -0
  26. package/src/commands/perception.js +385 -0
  27. package/src/commands/pqc.js +34 -0
  28. package/src/commands/privacy.js +345 -0
  29. package/src/commands/quantization.js +280 -0
  30. package/src/commands/recommend.js +336 -0
  31. package/src/commands/reputation.js +349 -0
  32. package/src/commands/runtime.js +500 -0
  33. package/src/commands/sla.js +352 -0
  34. package/src/commands/stress.js +252 -0
  35. package/src/commands/tech.js +268 -0
  36. package/src/commands/tenant.js +576 -0
  37. package/src/commands/trust.js +366 -0
  38. package/src/harness/mcp-client.js +330 -54
  39. package/src/index.js +112 -0
  40. package/src/lib/aiops.js +523 -0
  41. package/src/lib/autonomous-developer.js +524 -0
  42. package/src/lib/code-agent.js +442 -0
  43. package/src/lib/collaboration-governance.js +556 -0
  44. package/src/lib/community-governance.js +649 -0
  45. package/src/lib/content-recommendation.js +600 -0
  46. package/src/lib/cross-chain.js +669 -0
  47. package/src/lib/dbevo.js +669 -0
  48. package/src/lib/decentral-infra.js +445 -0
  49. package/src/lib/federation-hardening.js +587 -0
  50. package/src/lib/hardening-manager.js +409 -0
  51. package/src/lib/inference-network.js +407 -0
  52. package/src/lib/knowledge-graph.js +530 -0
  53. package/src/lib/mcp-client.js +3 -0
  54. package/src/lib/multimodal.js +698 -0
  55. package/src/lib/nl-programming.js +595 -0
  56. package/src/lib/perception.js +500 -0
  57. package/src/lib/pqc-manager.js +141 -9
  58. package/src/lib/privacy-computing.js +575 -0
  59. package/src/lib/protocol-fusion.js +535 -0
  60. package/src/lib/quantization.js +362 -0
  61. package/src/lib/reputation-optimizer.js +509 -0
  62. package/src/lib/skill-marketplace.js +397 -0
  63. package/src/lib/sla-manager.js +484 -0
  64. package/src/lib/stress-tester.js +383 -0
  65. package/src/lib/tech-learning-engine.js +651 -0
  66. package/src/lib/tenant-saas.js +831 -0
  67. package/src/lib/token-incentive.js +513 -0
  68. package/src/lib/trust-security.js +473 -0
  69. package/src/lib/universal-runtime.js +771 -0
  70. package/src/assets/web-panel/assets/Dashboard-CKeMmCoT.css +0 -1
@@ -0,0 +1,268 @@
1
+ /**
2
+ * Tech Learning Engine commands (Phase 62)
3
+ * chainlesschain tech analyze|profile|detect|practice|practices|recommend|types
4
+ */
5
+
6
+ import chalk from "chalk";
7
+ import { logger } from "../lib/logger.js";
8
+ import { bootstrap, shutdown } from "../runtime/bootstrap.js";
9
+ import {
10
+ ensureTechLearningTables,
11
+ analyzeTechStack,
12
+ getProfile,
13
+ detectAntiPatterns,
14
+ recordPractice,
15
+ listPractices,
16
+ getRecommendations,
17
+ TECH_TYPES,
18
+ PRACTICE_LEVELS,
19
+ ANTI_PATTERNS,
20
+ } from "../lib/tech-learning-engine.js";
21
+
22
+ function _dbFromCtx(ctx) {
23
+ if (!ctx.db) {
24
+ logger.error("Database not available");
25
+ process.exit(1);
26
+ }
27
+ const db = ctx.db.getDatabase();
28
+ ensureTechLearningTables(db);
29
+ return db;
30
+ }
31
+
32
+ export function registerTechCommand(program) {
33
+ const tech = program
34
+ .command("tech")
35
+ .description(
36
+ "Tech Learning Engine — stack analysis, anti-pattern detection, practice store",
37
+ );
38
+
39
+ tech
40
+ .command("types")
41
+ .description("List known tech types, practice levels, anti-patterns")
42
+ .option("--json", "Output as JSON")
43
+ .action((options) => {
44
+ const payload = {
45
+ techTypes: Object.values(TECH_TYPES),
46
+ practiceLevels: Object.values(PRACTICE_LEVELS),
47
+ antiPatterns: Object.values(ANTI_PATTERNS),
48
+ };
49
+ if (options.json) {
50
+ console.log(JSON.stringify(payload, null, 2));
51
+ } else {
52
+ logger.log(
53
+ ` ${chalk.bold("Tech types:")} ${payload.techTypes.join(", ")}`,
54
+ );
55
+ logger.log(
56
+ ` ${chalk.bold("Practice levels:")} ${payload.practiceLevels.join(", ")}`,
57
+ );
58
+ logger.log(
59
+ ` ${chalk.bold("Anti-patterns:")} ${payload.antiPatterns.join(", ")}`,
60
+ );
61
+ }
62
+ });
63
+
64
+ tech
65
+ .command("analyze [path]")
66
+ .description("Analyze tech stack of a project directory")
67
+ .option("--json", "Output as JSON")
68
+ .action(async (projectPath, options) => {
69
+ try {
70
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
71
+ const db = _dbFromCtx(ctx);
72
+ const profile = analyzeTechStack(db, projectPath || process.cwd());
73
+ if (options.json) {
74
+ console.log(JSON.stringify(profile, null, 2));
75
+ } else {
76
+ logger.success("Tech stack analyzed");
77
+ logger.log(` ${chalk.bold("Path:")} ${profile.projectPath}`);
78
+ logger.log(
79
+ ` ${chalk.bold("Languages:")} ${profile.languages.join(", ") || "(none)"}`,
80
+ );
81
+ logger.log(
82
+ ` ${chalk.bold("Frameworks:")} ${profile.frameworks.join(", ") || "(none)"}`,
83
+ );
84
+ logger.log(
85
+ ` ${chalk.bold("Databases:")} ${profile.databases.join(", ") || "(none)"}`,
86
+ );
87
+ logger.log(
88
+ ` ${chalk.bold("Tools:")} ${profile.tools.join(", ") || "(none)"}`,
89
+ );
90
+ logger.log(
91
+ ` ${chalk.bold("Total deps:")} ${profile.totalDependencies}`,
92
+ );
93
+ }
94
+ await shutdown();
95
+ } catch (err) {
96
+ logger.error(`Failed: ${err.message}`);
97
+ process.exit(1);
98
+ }
99
+ });
100
+
101
+ tech
102
+ .command("profile [path]")
103
+ .description("Show the last analyzed profile for a path")
104
+ .option("--json", "Output as JSON")
105
+ .action(async (projectPath, options) => {
106
+ try {
107
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
108
+ _dbFromCtx(ctx);
109
+ const profile = getProfile(projectPath || process.cwd());
110
+ if (!profile) {
111
+ logger.info("No profile cached. Run `tech analyze` first.");
112
+ } else if (options.json) {
113
+ console.log(JSON.stringify(profile, null, 2));
114
+ } else {
115
+ logger.log(
116
+ ` ${chalk.bold("Languages:")} ${profile.languages.join(", ")}`,
117
+ );
118
+ logger.log(
119
+ ` ${chalk.bold("Frameworks:")} ${profile.frameworks.join(", ") || "(none)"}`,
120
+ );
121
+ logger.log(
122
+ ` ${chalk.bold("Libraries:")} ${profile.libraries.length}`,
123
+ );
124
+ }
125
+ await shutdown();
126
+ } catch (err) {
127
+ logger.error(`Failed: ${err.message}`);
128
+ process.exit(1);
129
+ }
130
+ });
131
+
132
+ tech
133
+ .command("detect <file>")
134
+ .description("Detect anti-patterns in a single file")
135
+ .option("--json", "Output as JSON")
136
+ .action(async (file, options) => {
137
+ try {
138
+ const r = detectAntiPatterns(file);
139
+ if (options.json) {
140
+ console.log(JSON.stringify(r, null, 2));
141
+ } else if (r.totalFindings === 0) {
142
+ logger.success(
143
+ `No anti-patterns detected (${r.lines} lines, ${r.functionCount} funcs)`,
144
+ );
145
+ } else {
146
+ logger.warn(`${r.totalFindings} anti-pattern finding(s):`);
147
+ for (const f of r.findings) {
148
+ logger.log(
149
+ ` ${chalk.yellow(f.type.padEnd(22))} [${f.severity}] ${f.detail}`,
150
+ );
151
+ }
152
+ }
153
+ } catch (err) {
154
+ logger.error(`Failed: ${err.message}`);
155
+ process.exit(1);
156
+ }
157
+ });
158
+
159
+ tech
160
+ .command("practice <tech-type> <tech-name> <pattern> <level>")
161
+ .description(
162
+ "Record a learned practice (tech-type: language|framework|library|database|tool|pattern)",
163
+ )
164
+ .option("-d, --description <text>", "Description", "")
165
+ .option("-s, --score <n>", "Score 0..1", parseFloat, 0)
166
+ .option("--source <tag>", "Source tag", "manual")
167
+ .option("--json", "Output as JSON")
168
+ .action(async (techType, techName, patternName, level, options) => {
169
+ try {
170
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
171
+ const db = _dbFromCtx(ctx);
172
+ const p = recordPractice(db, {
173
+ techType,
174
+ techName,
175
+ patternName,
176
+ level,
177
+ description: options.description,
178
+ score: options.score,
179
+ source: options.source,
180
+ });
181
+ if (options.json) {
182
+ console.log(JSON.stringify(p, null, 2));
183
+ } else {
184
+ logger.success("Practice recorded");
185
+ logger.log(
186
+ ` ${chalk.bold("ID:")} ${chalk.cyan(p.practiceId.slice(0, 8))}`,
187
+ );
188
+ logger.log(` ${chalk.bold("Tech:")} ${p.techType}/${p.techName}`);
189
+ logger.log(` ${chalk.bold("Pattern:")} ${p.patternName}`);
190
+ logger.log(` ${chalk.bold("Level:")} ${p.level}`);
191
+ }
192
+ await shutdown();
193
+ } catch (err) {
194
+ logger.error(`Failed: ${err.message}`);
195
+ process.exit(1);
196
+ }
197
+ });
198
+
199
+ tech
200
+ .command("practices")
201
+ .description("List recorded practices")
202
+ .option("-t, --type <type>", "Filter by tech type")
203
+ .option("-n, --name <name>", "Filter by tech name")
204
+ .option("-l, --level <level>", "Filter by level")
205
+ .option("--limit <n>", "Maximum entries", parseInt, 50)
206
+ .option("--json", "Output as JSON")
207
+ .action(async (options) => {
208
+ try {
209
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
210
+ _dbFromCtx(ctx);
211
+ const rows = listPractices({
212
+ techType: options.type,
213
+ techName: options.name,
214
+ level: options.level,
215
+ limit: options.limit,
216
+ });
217
+ if (options.json) {
218
+ console.log(JSON.stringify(rows, null, 2));
219
+ } else if (rows.length === 0) {
220
+ logger.info("No practices recorded.");
221
+ } else {
222
+ for (const p of rows) {
223
+ logger.log(
224
+ ` ${chalk.cyan(p.practiceId.slice(0, 8))} ${p.techType.padEnd(10)} ${p.techName.padEnd(14)} [${p.level.padEnd(12)}] ${p.patternName}`,
225
+ );
226
+ }
227
+ }
228
+ await shutdown();
229
+ } catch (err) {
230
+ logger.error(`Failed: ${err.message}`);
231
+ process.exit(1);
232
+ }
233
+ });
234
+
235
+ tech
236
+ .command("recommend")
237
+ .description("Recommend practices based on the analyzed stack")
238
+ .option("--limit <n>", "Maximum entries", parseInt, 20)
239
+ .option("--json", "Output as JSON")
240
+ .action(async (options) => {
241
+ try {
242
+ const ctx = await bootstrap({ verbose: program.opts().verbose });
243
+ _dbFromCtx(ctx);
244
+ const r = getRecommendations({ limit: options.limit });
245
+ if (options.json) {
246
+ console.log(JSON.stringify(r, null, 2));
247
+ } else if (r.recommendations.length === 0) {
248
+ logger.info(
249
+ r.message ||
250
+ `${r.totalPractices} practice(s) stored; 0 match the analyzed stack.`,
251
+ );
252
+ } else {
253
+ logger.log(
254
+ ` ${chalk.bold("Matches:")} ${r.totalMatches}/${r.totalPractices}`,
255
+ );
256
+ for (const p of r.recommendations) {
257
+ logger.log(
258
+ ` ${chalk.cyan(p.techName.padEnd(14))} [${p.level.padEnd(12)}] ${p.patternName}`,
259
+ );
260
+ }
261
+ }
262
+ await shutdown();
263
+ } catch (err) {
264
+ logger.error(`Failed: ${err.message}`);
265
+ process.exit(1);
266
+ }
267
+ });
268
+ }