infernoflow 0.33.0 โ†’ 0.34.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 (84) hide show
  1. package/README.md +208 -120
  2. package/dist/bin/infernoflow.mjs +271 -85
  3. package/dist/lib/adopters/angular.mjs +128 -1
  4. package/dist/lib/adopters/css.mjs +111 -1
  5. package/dist/lib/adopters/react.mjs +104 -1
  6. package/dist/lib/ai/ideDetection.mjs +31 -1
  7. package/dist/lib/ai/localProvider.mjs +88 -1
  8. package/dist/lib/ai/providerRouter.mjs +295 -2
  9. package/dist/lib/commands/adopt.mjs +869 -20
  10. package/dist/lib/commands/adoptWizard.mjs +320 -9
  11. package/dist/lib/commands/agent.mjs +191 -5
  12. package/dist/lib/commands/ai.mjs +407 -2
  13. package/dist/lib/commands/ask.mjs +299 -0
  14. package/dist/lib/commands/audit.mjs +300 -13
  15. package/dist/lib/commands/changelog.mjs +594 -26
  16. package/dist/lib/commands/check.mjs +184 -3
  17. package/dist/lib/commands/ci.mjs +208 -3
  18. package/dist/lib/commands/claudeMd.mjs +139 -28
  19. package/dist/lib/commands/cloud.mjs +521 -5
  20. package/dist/lib/commands/context.mjs +346 -34
  21. package/dist/lib/commands/coverage.mjs +282 -2
  22. package/dist/lib/commands/dashboard.mjs +635 -123
  23. package/dist/lib/commands/demo.mjs +465 -8
  24. package/dist/lib/commands/diff.mjs +274 -5
  25. package/dist/lib/commands/docGate.mjs +81 -2
  26. package/dist/lib/commands/doctor.mjs +321 -3
  27. package/dist/lib/commands/explain.mjs +438 -8
  28. package/dist/lib/commands/export.mjs +239 -10
  29. package/dist/lib/commands/generateSkills.mjs +163 -38
  30. package/dist/lib/commands/graph.mjs +378 -11
  31. package/dist/lib/commands/health.mjs +309 -2
  32. package/dist/lib/commands/impact.mjs +325 -2
  33. package/dist/lib/commands/implement.mjs +103 -7
  34. package/dist/lib/commands/init.mjs +545 -23
  35. package/dist/lib/commands/installCursorHooks.mjs +36 -1
  36. package/dist/lib/commands/installVsCodeCopilotHooks.mjs +37 -1
  37. package/dist/lib/commands/link.mjs +342 -2
  38. package/dist/lib/commands/log.mjs +164 -16
  39. package/dist/lib/commands/monorepo.mjs +428 -4
  40. package/dist/lib/commands/notify.mjs +258 -4
  41. package/dist/lib/commands/onboard.mjs +296 -4
  42. package/dist/lib/commands/prComment.mjs +361 -2
  43. package/dist/lib/commands/prImpact.mjs +157 -2
  44. package/dist/lib/commands/publish.mjs +316 -15
  45. package/dist/lib/commands/recap.mjs +359 -0
  46. package/dist/lib/commands/report.mjs +272 -28
  47. package/dist/lib/commands/review.mjs +223 -9
  48. package/dist/lib/commands/run.mjs +336 -8
  49. package/dist/lib/commands/scaffold.mjs +419 -54
  50. package/dist/lib/commands/scan.mjs +1118 -5
  51. package/dist/lib/commands/scout.mjs +291 -2
  52. package/dist/lib/commands/setup.mjs +310 -5
  53. package/dist/lib/commands/share.mjs +196 -13
  54. package/dist/lib/commands/snapshot.mjs +383 -3
  55. package/dist/lib/commands/stability.mjs +293 -2
  56. package/dist/lib/commands/stats.mjs +402 -0
  57. package/dist/lib/commands/status.mjs +172 -4
  58. package/dist/lib/commands/suggest.mjs +563 -21
  59. package/dist/lib/commands/switch.mjs +310 -0
  60. package/dist/lib/commands/syncAuto.mjs +96 -1
  61. package/dist/lib/commands/synthesize.mjs +228 -10
  62. package/dist/lib/commands/teamSync.mjs +388 -2
  63. package/dist/lib/commands/test.mjs +363 -6
  64. package/dist/lib/commands/theme.mjs +195 -18
  65. package/dist/lib/commands/upgrade.mjs +153 -0
  66. package/dist/lib/commands/version.mjs +282 -2
  67. package/dist/lib/commands/vibe.mjs +357 -7
  68. package/dist/lib/commands/watch.mjs +203 -4
  69. package/dist/lib/commands/why.mjs +358 -4
  70. package/dist/lib/cursorHooksInstall.mjs +60 -1
  71. package/dist/lib/draftToolingInstall.mjs +68 -7
  72. package/dist/lib/git/detect-drift.mjs +208 -4
  73. package/dist/lib/learning/adapt.mjs +101 -6
  74. package/dist/lib/learning/observe.mjs +119 -1
  75. package/dist/lib/learning/patternDetector.mjs +298 -1
  76. package/dist/lib/learning/profile.mjs +279 -2
  77. package/dist/lib/learning/skillSynthesizer.mjs +145 -24
  78. package/dist/lib/templates/index.mjs +131 -1
  79. package/dist/lib/theme/scanner.mjs +343 -4
  80. package/dist/lib/ui/errors.mjs +142 -1
  81. package/dist/lib/ui/output.mjs +72 -6
  82. package/dist/lib/ui/prompts.mjs +147 -6
  83. package/dist/lib/vsCodeCopilotHooksInstall.mjs +42 -1
  84. package/package.json +1 -1
@@ -1,9 +1,280 @@
1
- import*as E from"node:fs";import*as x from"node:path";import{bold as u,cyan as z,gray as c,green as A,yellow as $,red as k}from"../ui/output.mjs";function S(t){try{return JSON.parse(E.readFileSync(t,"utf8"))}catch{return null}}function B(t){return t?.stability||"experimental"}const w={frozen:"\u{1F9CA}",stable:"\u3030\uFE0F ",experimental:"\u{1F30A}"},C={frozen:k,stable:$,experimental:A};function T(t,i){const l={},a={},d={},n=new Map;for(const e of t){const r=i.find(o=>o.id===e.id)||{};l[e.id]={id:e.id,name:e.name||r.name||r.title||e.id,stability:r.stability||"experimental",functions:e.codeAnalysis?.functions||[],calls:e.codeAnalysis?.calls||[],services:e.codeAnalysis?.services||[],dbCalls:e.codeAnalysis?.dbCalls||[],httpCalls:e.codeAnalysis?.httpCalls||[]},a[e.id]=new Set,d[e.id]=new Set;for(const o of e.codeAnalysis?.functions||[]){const s=o.replace(/\(\)$/,"");n.set(s,e.id),n.set(s.toLowerCase(),e.id)}}for(const[e,r]of Object.entries(l))for(const o of r.calls){const s=o.replace(/\(\)$/,""),g=n.get(s)||n.get(s.toLowerCase());g&&g!==e&&(a[e].add(g),d[g].add(e))}const f={},p={};for(const e of Object.keys(l))f[e]=[...a[e]],p[e]=[...d[e]];return{nodes:l,edges:f,reverse:p}}function O(t){const{nodes:i,edges:l,reverse:a}=t,d=Object.keys(i).sort();console.log(),console.log(u(" Capability Dependency Graph")),console.log(c(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log();let n=!1;for(const p of d){const e=i[p],r=l[p]||[],o=a[p]||[],s=w[e.stability]||"\u{1F30A}",g=C[e.stability]||A;if(!(r.length===0&&o.length===0)){if(n=!0,console.log(` ${s} ${u(g(p))}`),r.length>0){console.log(c(" calls \u2192"));for(const h of r){const y=i[h],j=w[y?.stability]||"\u{1F30A}";console.log(c(` ${j} ${h}`))}}if(o.length>0){console.log(c(" called by \u2190"));for(const h of o){const y=w[i[h]?.stability]||"\u{1F30A}";console.log(c(` ${y} ${h}`))}}console.log()}}n||(console.log(c(" No inter-capability dependencies detected.")),console.log(c(" Run `infernoflow scan` first to populate call data.")),console.log());const f=Object.values(t.edges).reduce((p,e)=>p+e.length,0);console.log(c(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(c(` ${d.length} capabilities \xB7 ${f} dependency edge(s)`)),console.log()}function W(t,i){const{nodes:l,edges:a,reverse:d}=i,n=l[t];n||(console.error(k(`\u2717 Capability "${t}" not found in graph.`)),process.exit(1));const f=w[n.stability]||"\u{1F30A}",p=C[n.stability]||A;console.log(),console.log(u(` ${f} ${p(t)}`)+c(` (${n.stability})`)),n.services?.length&&console.log(c(" external: ")+z(n.services.join(", "))),console.log();const e=a[t]||[],r=d[t]||[];if(e.length>0){console.log(u(" Calls (downstream dependencies):"));for(const o of e){const s=l[o],g=C[s?.stability]||A,h=w[s?.stability]||"\u{1F30A}";console.log(` ${h} ${g(o)}`+c(s?.services?.length?` [${s.services.join(", ")}]`:""))}console.log()}else console.log(c(" No downstream dependencies.")),console.log();if(r.length>0){console.log(u(" Called by (upstream dependents):"));for(const o of r){const s=l[o],g=C[s?.stability]||A,h=w[s?.stability]||"\u{1F30A}";console.log(` ${h} ${g(o)}`)}console.log()}else console.log(c(" No capabilities call this one.")),console.log();if((n.stability==="frozen"||n.stability==="stable")&&r.length>0){const o=n.stability==="frozen"?k:$;console.log(o(` \u26A0 This capability is ${n.stability}. Changing it may break:`));for(const s of r)console.log(o(` \u2022 ${s}`));console.log()}}function H(t,i){const l=[];if(!t||!i)return l;for(const[a,d]of Object.entries(i.nodes)){if(d.stability==="experimental")continue;const n=new Set(t.reverse?.[a]||[]),p=[...new Set(i.reverse[a]||[])].filter(e=>!n.has(e));if(p.length>0&&l.push({type:"new-dependents",capId:a,stability:d.stability,detail:`${p.join(", ")} now depend on this`}),d.stability==="frozen"){const e=new Set(t.edges?.[a]||[]),r=new Set(i.edges[a]||[]),o=[...r].filter(g=>!e.has(g)),s=[...e].filter(g=>!r.has(g));(o.length>0||s.length>0)&&l.push({type:"frozen-internals-changed",capId:a,stability:d.stability,detail:[o.length?`added calls: ${o.join(", ")}`:"",s.length?`removed calls: ${s.join(", ")}`:""].filter(Boolean).join("; ")})}}return l}function M(t){const i=t.nodes||{},l=t.deps||{},a=Object.keys(i),d=[];for(const[f,p]of Object.entries(l))for(const e of p)d.push({from:f,to:e});return`<!DOCTYPE html>
1
+ /**
2
+ * infernoflow graph
3
+ *
4
+ * Builds a capability dependency graph from scan.json.
5
+ * Shows which capabilities call which โ€” so changing one reveals its downstream impact.
6
+ *
7
+ * Usage:
8
+ * infernoflow graph Print full dependency tree
9
+ * infernoflow graph --cap auth-login Show deps for one capability (up + down)
10
+ * infernoflow graph --json Machine-readable graph.json to stdout
11
+ * infernoflow graph --check Warn if frozen/stable caps have new dependents
12
+ */
13
+
14
+ import * as fs from "node:fs";
15
+ import * as path from "node:path";
16
+ import { bold, cyan, gray, green, yellow, red } from "../ui/output.mjs";
17
+
18
+ // โ”€โ”€ helpers โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
19
+
20
+ function loadJson(p) {
21
+ try { return JSON.parse(fs.readFileSync(p, "utf8")); }
22
+ catch { return null; }
23
+ }
24
+
25
+ function getLevel(cap) {
26
+ return cap?.stability || "experimental";
27
+ }
28
+
29
+ const LEVEL_ICON = { frozen: "๐ŸงŠ", stable: "ใ€ฐ๏ธ ", experimental: "๐ŸŒŠ" };
30
+ const LEVEL_COLOR = { frozen: red, stable: yellow, experimental: green };
31
+
32
+ // โ”€โ”€ graph builder โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
33
+
34
+ /**
35
+ * Build edges: capA โ†’ capB if any function in capA calls a function in capB.
36
+ *
37
+ * Strategy:
38
+ * 1. Build a function-name โ†’ capId index from scan data
39
+ * 2. For each cap, check its calls[] against the index
40
+ * 3. If a call matches a function in another cap โ†’ edge
41
+ */
42
+ function buildGraph(scanCaps, allCaps) {
43
+ // capId โ†’ { id, name, stability, functions[], calls[], services[], dbCalls[], httpCalls[] }
44
+ const nodes = {};
45
+ // capId โ†’ Set<capId> (edges: this cap calls that cap)
46
+ const edges = {};
47
+ // capId โ†’ Set<capId> (reverse: this cap is called by those caps)
48
+ const reverse = {};
49
+
50
+ // Build function โ†’ capId index
51
+ // Use Map (not plain object) to avoid collisions with inherited properties like toString, constructor, etc.
52
+ const funcIndex = new Map(); // functionName โ†’ capId
53
+ for (const entry of scanCaps) {
54
+ const capFull = allCaps.find(c => c.id === entry.id) || {};
55
+ nodes[entry.id] = {
56
+ id: entry.id,
57
+ name: entry.name || capFull.name || capFull.title || entry.id,
58
+ stability: capFull.stability || "experimental",
59
+ functions: entry.codeAnalysis?.functions || [],
60
+ calls: entry.codeAnalysis?.calls || [],
61
+ services: entry.codeAnalysis?.services || [],
62
+ dbCalls: entry.codeAnalysis?.dbCalls || [],
63
+ httpCalls: entry.codeAnalysis?.httpCalls || [],
64
+ };
65
+ edges[entry.id] = new Set();
66
+ reverse[entry.id] = new Set();
67
+
68
+ for (const fn of (entry.codeAnalysis?.functions || [])) {
69
+ const bare = fn.replace(/\(\)$/, "");
70
+ funcIndex.set(bare, entry.id);
71
+ funcIndex.set(bare.toLowerCase(), entry.id);
72
+ }
73
+ }
74
+
75
+ // Build edges from calls[]
76
+ for (const [capId, node] of Object.entries(nodes)) {
77
+ for (const call of node.calls) {
78
+ const bare = call.replace(/\(\)$/, "");
79
+ const target = funcIndex.get(bare) || funcIndex.get(bare.toLowerCase());
80
+ if (target && target !== capId) {
81
+ edges[capId].add(target);
82
+ reverse[target].add(capId);
83
+ }
84
+ }
85
+ }
86
+
87
+ // Serialise Sets to arrays
88
+ const serialisedEdges = {};
89
+ const serialisedReverse = {};
90
+ for (const id of Object.keys(nodes)) {
91
+ serialisedEdges[id] = [...edges[id]];
92
+ serialisedReverse[id] = [...reverse[id]];
93
+ }
94
+
95
+ return { nodes, edges: serialisedEdges, reverse: serialisedReverse };
96
+ }
97
+
98
+ // โ”€โ”€ terminal reporters โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
99
+
100
+ function printFullGraph(graph) {
101
+ const { nodes, edges, reverse } = graph;
102
+ const ids = Object.keys(nodes).sort();
103
+
104
+ console.log();
105
+ console.log(bold(" Capability Dependency Graph"));
106
+ console.log(gray(" โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€"));
107
+ console.log();
108
+
109
+ let hasDeps = false;
110
+ for (const id of ids) {
111
+ const node = nodes[id];
112
+ const deps = edges[id] || [];
113
+ const callers = reverse[id] || [];
114
+ const icon = LEVEL_ICON[node.stability] || "๐ŸŒŠ";
115
+ const color = LEVEL_COLOR[node.stability] || green;
116
+
117
+ if (deps.length === 0 && callers.length === 0) continue;
118
+ hasDeps = true;
119
+
120
+ console.log(` ${icon} ${bold(color(id))}`);
121
+
122
+ if (deps.length > 0) {
123
+ console.log(gray(" calls โ†’"));
124
+ for (const dep of deps) {
125
+ const depNode = nodes[dep];
126
+ const depIcon = LEVEL_ICON[depNode?.stability] || "๐ŸŒŠ";
127
+ console.log(gray(` ${depIcon} ${dep}`));
128
+ }
129
+ }
130
+ if (callers.length > 0) {
131
+ console.log(gray(" called by โ†"));
132
+ for (const caller of callers) {
133
+ const callerIcon = LEVEL_ICON[nodes[caller]?.stability] || "๐ŸŒŠ";
134
+ console.log(gray(` ${callerIcon} ${caller}`));
135
+ }
136
+ }
137
+ console.log();
138
+ }
139
+
140
+ if (!hasDeps) {
141
+ console.log(gray(" No inter-capability dependencies detected."));
142
+ console.log(gray(" Run `infernoflow scan` first to populate call data."));
143
+ console.log();
144
+ }
145
+
146
+ // Summary stats
147
+ const totalEdges = Object.values(graph.edges).reduce((n, arr) => n + arr.length, 0);
148
+ console.log(gray(` โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€`));
149
+ console.log(gray(` ${ids.length} capabilities ยท ${totalEdges} dependency edge(s)`));
150
+ console.log();
151
+ }
152
+
153
+ function printCapGraph(capId, graph) {
154
+ const { nodes, edges, reverse } = graph;
155
+ const node = nodes[capId];
156
+ if (!node) {
157
+ console.error(red(`โœ— Capability "${capId}" not found in graph.`));
158
+ process.exit(1);
159
+ }
160
+
161
+ const icon = LEVEL_ICON[node.stability] || "๐ŸŒŠ";
162
+ const color = LEVEL_COLOR[node.stability] || green;
163
+
164
+ console.log();
165
+ console.log(bold(` ${icon} ${color(capId)}`) + gray(` (${node.stability})`));
166
+ if (node.services?.length) console.log(gray(` external: `) + cyan(node.services.join(", ")));
167
+ console.log();
168
+
169
+ const deps = edges[capId] || [];
170
+ const callers = reverse[capId] || [];
171
+
172
+ if (deps.length > 0) {
173
+ console.log(bold(" Calls (downstream dependencies):"));
174
+ for (const dep of deps) {
175
+ const d = nodes[dep];
176
+ const dColor = LEVEL_COLOR[d?.stability] || green;
177
+ const dIcon = LEVEL_ICON[d?.stability] || "๐ŸŒŠ";
178
+ console.log(` ${dIcon} ${dColor(dep)}` + gray(d?.services?.length ? ` [${d.services.join(", ")}]` : ""));
179
+ }
180
+ console.log();
181
+ } else {
182
+ console.log(gray(" No downstream dependencies."));
183
+ console.log();
184
+ }
185
+
186
+ if (callers.length > 0) {
187
+ console.log(bold(" Called by (upstream dependents):"));
188
+ for (const caller of callers) {
189
+ const c = nodes[caller];
190
+ const cColor = LEVEL_COLOR[c?.stability] || green;
191
+ const cIcon = LEVEL_ICON[c?.stability] || "๐ŸŒŠ";
192
+ console.log(` ${cIcon} ${cColor(caller)}`);
193
+ }
194
+ console.log();
195
+ } else {
196
+ console.log(gray(" No capabilities call this one."));
197
+ console.log();
198
+ }
199
+
200
+ // Impact warning for frozen/stable
201
+ if ((node.stability === "frozen" || node.stability === "stable") && callers.length > 0) {
202
+ const color2 = node.stability === "frozen" ? red : yellow;
203
+ console.log(color2(` โš  This capability is ${node.stability}. Changing it may break:`));
204
+ for (const caller of callers) console.log(color2(` โ€ข ${caller}`));
205
+ console.log();
206
+ }
207
+ }
208
+
209
+ // โ”€โ”€ breaking change checker โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
210
+
211
+ /**
212
+ * Compare previous graph.json with new graph to detect:
213
+ * - frozen/stable caps that have gained new callers (more dependents = higher risk)
214
+ * - frozen caps that have new outgoing deps (their internals changed)
215
+ */
216
+ function checkBreakingChanges(prevGraph, newGraph) {
217
+ const warnings = [];
218
+ if (!prevGraph || !newGraph) return warnings;
219
+
220
+ for (const [capId, node] of Object.entries(newGraph.nodes)) {
221
+ if (node.stability === "experimental") continue;
222
+
223
+ const prevCallers = new Set(prevGraph.reverse?.[capId] || []);
224
+ const newCallers = new Set(newGraph.reverse[capId] || []);
225
+ const addedCallers = [...newCallers].filter(c => !prevCallers.has(c));
226
+
227
+ if (addedCallers.length > 0) {
228
+ warnings.push({
229
+ type: "new-dependents",
230
+ capId,
231
+ stability: node.stability,
232
+ detail: `${addedCallers.join(", ")} now depend on this`,
233
+ });
234
+ }
235
+
236
+ if (node.stability === "frozen") {
237
+ const prevDeps = new Set(prevGraph.edges?.[capId] || []);
238
+ const newDeps = new Set(newGraph.edges[capId] || []);
239
+ const addedDeps = [...newDeps].filter(d => !prevDeps.has(d));
240
+ const removedDeps = [...prevDeps].filter(d => !newDeps.has(d));
241
+
242
+ if (addedDeps.length > 0 || removedDeps.length > 0) {
243
+ warnings.push({
244
+ type: "frozen-internals-changed",
245
+ capId,
246
+ stability: node.stability,
247
+ detail: [
248
+ addedDeps.length ? `added calls: ${addedDeps.join(", ")}` : "",
249
+ removedDeps.length ? `removed calls: ${removedDeps.join(", ")}` : "",
250
+ ].filter(Boolean).join("; "),
251
+ });
252
+ }
253
+ }
254
+ }
255
+
256
+ return warnings;
257
+ }
258
+
259
+ // โ”€โ”€ HTML graph generator โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
260
+
261
+ export function buildGraphHtml(graphData) {
262
+ const nodes = graphData.nodes || {};
263
+ const edges = graphData.deps || {};
264
+ const allIds = Object.keys(nodes);
265
+ const edgeList = [];
266
+ for (const [from, targets] of Object.entries(edges)) {
267
+ for (const to of targets) edgeList.push({ from, to });
268
+ }
269
+
270
+ const dataJson = JSON.stringify({ nodes: allIds, edges: edgeList });
271
+
272
+ return `<!DOCTYPE html>
2
273
  <html lang="en">
3
274
  <head>
4
275
  <meta charset="UTF-8">
5
276
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <title>infernoflow \u2014 Capability Graph</title>
277
+ <title>infernoflow โ€” Capability Graph</title>
7
278
  <style>
8
279
  *{box-sizing:border-box;margin:0;padding:0}
9
280
  body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;background:#0f1117;color:#e2e8f0;height:100vh;display:flex;flex-direction:column}
@@ -31,8 +302,8 @@ import*as E from"node:fs";import*as x from"node:path";import{bold as u,cyan as z
31
302
  </head>
32
303
  <body>
33
304
  <header>
34
- <span style="font-size:18px">\u{1F525}</span>
35
- <h1>infernoflow \u2014 Capability Graph</h1>
305
+ <span style="font-size:18px">๐Ÿ”ฅ</span>
306
+ <h1>infernoflow โ€” Capability Graph</h1>
36
307
  <span id="project-name"></span>
37
308
  <span id="stats"></span>
38
309
  </header>
@@ -51,7 +322,7 @@ import*as E from"node:fs";import*as x from"node:path";import{bold as u,cyan as z
51
322
  </div>
52
323
  </div>
53
324
  <script>
54
- const DATA = ${JSON.stringify({nodes:a,edges:d})};
325
+ const DATA = ${dataJson};
55
326
  const NW=120, NH=34;
56
327
 
57
328
  // Separate connected vs isolated nodes
@@ -180,15 +451,15 @@ function render() {
180
451
  svg.appendChild(g);
181
452
  });
182
453
 
183
- document.getElementById("stats").textContent = \`\${DATA.nodes.length} capabilities \xB7 \${DATA.edges.length} edges\`;
454
+ document.getElementById("stats").textContent = \`\${DATA.nodes.length} capabilities ยท \${DATA.edges.length} edges\`;
184
455
  }
185
456
 
186
457
  function showTip(id, evt) {
187
458
  const calls = DATA.edges.filter(e=>e.from===id).map(e=>e.to);
188
459
  const callers = DATA.edges.filter(e=>e.to===id).map(e=>e.from);
189
- let html = \`<strong>\u{1F30A} \${id}</strong>\`;
190
- if (calls.length) html += \`<div style="margin-top:6px">calls \u2192<br>\${calls.map(c=>\`<span class="tag calls">\${c}</span>\`).join('')}</div>\`;
191
- if (callers.length) html += \`<div style="margin-top:6px">\u2190 called by<br>\${callers.map(c=>\`<span class="tag callers">\${c}</span>\`).join('')}</div>\`;
460
+ let html = \`<strong>๐ŸŒŠ \${id}</strong>\`;
461
+ if (calls.length) html += \`<div style="margin-top:6px">calls โ†’<br>\${calls.map(c=>\`<span class="tag calls">\${c}</span>\`).join('')}</div>\`;
462
+ if (callers.length) html += \`<div style="margin-top:6px">โ† called by<br>\${callers.map(c=>\`<span class="tag callers">\${c}</span>\`).join('')}</div>\`;
192
463
  if (!calls.length && !callers.length) html += \`<div style="margin-top:6px;color:#475569;font-size:11px">No inter-capability dependencies</div>\`;
193
464
  const tip=document.getElementById("tip");
194
465
  tip.innerHTML=html; tip.style.opacity="1";
@@ -216,5 +487,101 @@ render();
216
487
  window.addEventListener("resize", render);
217
488
  </script>
218
489
  </body>
219
- </html>`}async function F(t){const i=(t||[]).slice(1),l=i.includes("--json"),a=i.includes("--check"),d=i.includes("--html"),n=i.indexOf("--cap"),f=n!==-1?i[n+1]:null,p=process.cwd(),e=x.join(p,"inferno"),r=x.join(e,"scan.json"),o=x.join(e,"graph.json"),s=x.join(e,"capabilities.json"),g=S(r);g||(console.error(k("\u2717 inferno/scan.json not found \u2014 run `infernoflow scan` first.")),process.exit(1));let h=[];const y=S(s);y&&(h=Array.isArray(y)?y:y.capabilities||[]);const j=g.capabilities||[],m=T(j,h),L=S(o),D=H(L,m),v={builtAt:new Date().toISOString(),capabilities:Object.keys(m.nodes).length,edges:Object.values(m.edges).reduce((b,N)=>b+N.length,0),nodes:m.nodes,deps:m.edges,dependents:m.reverse};if(l||E.writeFileSync(o,JSON.stringify(v,null,2)),d){const b=x.join(e,"graph.html");E.writeFileSync(b,M(v)),console.log(c(`
220
- infernoflow graph \u2192 HTML`)),console.log(c(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(` ${u("graph.html")} written \u2192 ${z("inferno/graph.html")}`),console.log(c(` ${v.capabilities} capabilities \xB7 ${v.edges} dependency edge(s)`)),console.log(),console.log(c(" Open in browser: ")+z("inferno/graph.html")),console.log();return}if(l){console.log(JSON.stringify(v,null,2));return}if(f?W(f,m):O(m),D.length>0){console.log($(" \u26A0 Dependency changes detected:"));for(const b of D){const N=b.stability==="frozen"?k("\u{1F9CA}"):$("\u3030\uFE0F ");console.log(` ${N} ${u(b.capId)} \u2014 ${b.detail}`)}console.log(),a&&process.exit(1)}l||console.log(c(" Graph saved \u2192 inferno/graph.json"))}function X(t){return S(x.join(t,"graph.json"))}export{M as buildGraphHtml,F as graphCommand,X as loadGraph};
490
+ </html>`;
491
+ }
492
+
493
+ // โ”€โ”€ entry point โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
494
+
495
+ export async function graphCommand(rawArgs) {
496
+ const args = (rawArgs || []).slice(1); // skip command name
497
+ const jsonMode = args.includes("--json");
498
+ const checkMode = args.includes("--check");
499
+ const htmlMode = args.includes("--html");
500
+ const capIdx = args.indexOf("--cap");
501
+ const capFilter = capIdx !== -1 ? args[capIdx + 1] : null;
502
+
503
+ const cwd = process.cwd();
504
+ const infernoDir = path.join(cwd, "inferno");
505
+ const scanPath = path.join(infernoDir, "scan.json");
506
+ const graphPath = path.join(infernoDir, "graph.json");
507
+ const capsPath = path.join(infernoDir, "capabilities.json");
508
+
509
+ // Load scan data
510
+ const scan = loadJson(scanPath);
511
+ if (!scan) {
512
+ console.error(red("โœ— inferno/scan.json not found โ€” run `infernoflow scan` first."));
513
+ process.exit(1);
514
+ }
515
+
516
+ // Load capabilities (for stability info)
517
+ let allCaps = [];
518
+ const rawCaps = loadJson(capsPath);
519
+ if (rawCaps) allCaps = Array.isArray(rawCaps) ? rawCaps : (rawCaps.capabilities || []);
520
+
521
+ // Build graph
522
+ const scanCaps = scan.capabilities || [];
523
+ const graph = buildGraph(scanCaps, allCaps);
524
+
525
+ // Check for breaking changes vs saved graph
526
+ const prevGraph = loadJson(graphPath);
527
+ const breakingWarnings = checkMode || true ? checkBreakingChanges(prevGraph, graph) : [];
528
+
529
+ // Save graph.json
530
+ const graphData = {
531
+ builtAt: new Date().toISOString(),
532
+ capabilities: Object.keys(graph.nodes).length,
533
+ edges: Object.values(graph.edges).reduce((n, arr) => n + arr.length, 0),
534
+ nodes: graph.nodes,
535
+ deps: graph.edges,
536
+ dependents: graph.reverse,
537
+ };
538
+
539
+ if (!jsonMode) {
540
+ fs.writeFileSync(graphPath, JSON.stringify(graphData, null, 2));
541
+ }
542
+
543
+ // HTML output
544
+ if (htmlMode) {
545
+ const htmlPath = path.join(infernoDir, "graph.html");
546
+ fs.writeFileSync(htmlPath, buildGraphHtml(graphData));
547
+ console.log(gray(`\n infernoflow graph โ†’ HTML`));
548
+ console.log(gray(" โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€"));
549
+ console.log(` ${bold("graph.html")} written โ†’ ${cyan("inferno/graph.html")}`);
550
+ console.log(gray(` ${graphData.capabilities} capabilities ยท ${graphData.edges} dependency edge(s)`));
551
+ console.log();
552
+ console.log(gray(` Open in browser: `) + cyan(`inferno/graph.html`));
553
+ console.log();
554
+ return;
555
+ }
556
+
557
+ // Output
558
+ if (jsonMode) {
559
+ console.log(JSON.stringify(graphData, null, 2));
560
+ return;
561
+ }
562
+
563
+ if (capFilter) {
564
+ printCapGraph(capFilter, graph);
565
+ } else {
566
+ printFullGraph(graph);
567
+ }
568
+
569
+ // Breaking change warnings
570
+ if (breakingWarnings.length > 0) {
571
+ console.log(yellow(" โš  Dependency changes detected:"));
572
+ for (const w of breakingWarnings) {
573
+ const icon = w.stability === "frozen" ? red("๐ŸงŠ") : yellow("ใ€ฐ๏ธ ");
574
+ console.log(` ${icon} ${bold(w.capId)} โ€” ${w.detail}`);
575
+ }
576
+ console.log();
577
+ if (checkMode) process.exit(1);
578
+ }
579
+
580
+ if (!jsonMode) console.log(gray(` Graph saved โ†’ inferno/graph.json`));
581
+ }
582
+
583
+ // โ”€โ”€ exported utility for other commands โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
584
+
585
+ export function loadGraph(infernoDir) {
586
+ return loadJson(path.join(infernoDir, "graph.json"));
587
+ }