avorelo 0.1.0 → 0.3.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 (260) hide show
  1. package/LICENSE +23 -16
  2. package/README.md +90 -51
  3. package/bin/avorelo.mjs +7 -0
  4. package/dist/avorelo.mjs +19741 -0
  5. package/package.json +135 -120
  6. package/bin/avorelo +0 -9
  7. package/scripts/README.md +0 -40
  8. package/scripts/cco-dashboard.js +0 -252
  9. package/scripts/cco-status.js +0 -430
  10. package/scripts/lib/activation/account-state.js +0 -37
  11. package/scripts/lib/activation/activation-runner.js +0 -546
  12. package/scripts/lib/activation/activation-self-healing.js +0 -480
  13. package/scripts/lib/activation/activation-state.js +0 -83
  14. package/scripts/lib/activation/activation-summary.js +0 -191
  15. package/scripts/lib/activation/adapters/claude-code.js +0 -77
  16. package/scripts/lib/activation/adapters/codex-cli.js +0 -52
  17. package/scripts/lib/activation/adapters/cursor.js +0 -37
  18. package/scripts/lib/activation/adapters/github-agent.js +0 -39
  19. package/scripts/lib/activation/adapters/terminal.js +0 -42
  20. package/scripts/lib/activation/adapters/vscode.js +0 -39
  21. package/scripts/lib/activation/adapters/windsurf.js +0 -37
  22. package/scripts/lib/activation/ai-surface-detector.js +0 -151
  23. package/scripts/lib/activation/connect-account.js +0 -145
  24. package/scripts/lib/activation/detect-environment.js +0 -75
  25. package/scripts/lib/activation/detect-hosts.js +0 -62
  26. package/scripts/lib/activation/format-activation-output.js +0 -109
  27. package/scripts/lib/activation/next-action.js +0 -43
  28. package/scripts/lib/activation/repair-engine.js +0 -219
  29. package/scripts/lib/activation-distribution-readiness.js +0 -507
  30. package/scripts/lib/adapter-conformance.js +0 -176
  31. package/scripts/lib/adapter-readiness.js +0 -417
  32. package/scripts/lib/adapter-safety-boundaries.js +0 -335
  33. package/scripts/lib/adapter-technical-readiness-gate.js +0 -205
  34. package/scripts/lib/agent-access-governance.js +0 -455
  35. package/scripts/lib/agent-enforcement.js +0 -765
  36. package/scripts/lib/agent-policy-profile.js +0 -210
  37. package/scripts/lib/agent-security/action-evaluator.js +0 -507
  38. package/scripts/lib/agent-security/adapter-registry.js +0 -98
  39. package/scripts/lib/agent-security/auto-policy.js +0 -139
  40. package/scripts/lib/agent-security/bounded-scan.js +0 -93
  41. package/scripts/lib/agent-security/enforcement-adapter.js +0 -174
  42. package/scripts/lib/agent-security/enforcement-engine.js +0 -1129
  43. package/scripts/lib/agent-security/file-write-adapter.js +0 -183
  44. package/scripts/lib/agent-security/file-write-rules.js +0 -178
  45. package/scripts/lib/agent-security/index.js +0 -3342
  46. package/scripts/lib/agent-security/instruction-risk.js +0 -181
  47. package/scripts/lib/agent-security/mcp-action-adapter.js +0 -185
  48. package/scripts/lib/agent-security/mcp-action-rules.js +0 -184
  49. package/scripts/lib/agent-security/package-action-adapter.js +0 -175
  50. package/scripts/lib/agent-security/package-action-rules.js +0 -233
  51. package/scripts/lib/agent-security/performance.js +0 -148
  52. package/scripts/lib/agent-security/permission-minimizer.js +0 -403
  53. package/scripts/lib/agent-security/scan-cache.js +0 -74
  54. package/scripts/lib/agent-security/source-trust.js +0 -146
  55. package/scripts/lib/ai-install-prompt.js +0 -288
  56. package/scripts/lib/ai-workspace-hygiene.js +0 -1499
  57. package/scripts/lib/alpha-activation.js +0 -520
  58. package/scripts/lib/alpha-feedback.js +0 -263
  59. package/scripts/lib/alpha-readiness-gate.js +0 -332
  60. package/scripts/lib/anti-gaming.js +0 -169
  61. package/scripts/lib/artifact-health.js +0 -431
  62. package/scripts/lib/attribution.js +0 -180
  63. package/scripts/lib/audit.js +0 -289
  64. package/scripts/lib/avorelo-skill-registry.js +0 -810
  65. package/scripts/lib/batch-jobs.js +0 -71
  66. package/scripts/lib/brain-pack.js +0 -578
  67. package/scripts/lib/brand-boundary.js +0 -424
  68. package/scripts/lib/brand.js +0 -74
  69. package/scripts/lib/browser-capability.js +0 -1048
  70. package/scripts/lib/browser-proof-preflight.js +0 -321
  71. package/scripts/lib/cache-readiness.js +0 -187
  72. package/scripts/lib/canonical-reentry.js +0 -162
  73. package/scripts/lib/capability-packs.js +0 -314
  74. package/scripts/lib/capability-recommender.js +0 -512
  75. package/scripts/lib/capability-registry.js +0 -1059
  76. package/scripts/lib/carry-forward-surfacing.js +0 -194
  77. package/scripts/lib/ccusage-adapter.js +0 -188
  78. package/scripts/lib/company-loop.js +0 -1149
  79. package/scripts/lib/config.js +0 -637
  80. package/scripts/lib/context-acquisition-plan.js +0 -287
  81. package/scripts/lib/context-budget-guard.js +0 -170
  82. package/scripts/lib/context-budget-scanner.js +0 -257
  83. package/scripts/lib/context-optimizer.js +0 -715
  84. package/scripts/lib/context-reduction-plan.js +0 -178
  85. package/scripts/lib/context-safety.js +0 -88
  86. package/scripts/lib/context-savings-engine.js +0 -158
  87. package/scripts/lib/cost-evidence.js +0 -254
  88. package/scripts/lib/cross-host-install-plan.js +0 -308
  89. package/scripts/lib/cross-host-install-readiness.js +0 -237
  90. package/scripts/lib/cross-host-value-flow.js +0 -268
  91. package/scripts/lib/dashboard.js +0 -900
  92. package/scripts/lib/design-partner-feedback.js +0 -346
  93. package/scripts/lib/entitlements.js +0 -100
  94. package/scripts/lib/execution-packet.js +0 -559
  95. package/scripts/lib/experimentation-events.js +0 -547
  96. package/scripts/lib/external-capability-compliance.js +0 -107
  97. package/scripts/lib/external-user-simulation.js +0 -166
  98. package/scripts/lib/failure-recovery-readiness.js +0 -81
  99. package/scripts/lib/failure-recovery.js +0 -419
  100. package/scripts/lib/feedback-intelligence.js +0 -537
  101. package/scripts/lib/feedback-signals.js +0 -205
  102. package/scripts/lib/file-integrity.js +0 -68
  103. package/scripts/lib/fsx.js +0 -127
  104. package/scripts/lib/full-readiness-gate.js +0 -451
  105. package/scripts/lib/guidance-builder.js +0 -174
  106. package/scripts/lib/hook-apply.js +0 -1019
  107. package/scripts/lib/hook-baseline.js +0 -310
  108. package/scripts/lib/hook-config-preview.js +0 -275
  109. package/scripts/lib/hook-contracts.js +0 -290
  110. package/scripts/lib/hook-safety-boundary-readiness.js +0 -80
  111. package/scripts/lib/host-capability-matrix.js +0 -351
  112. package/scripts/lib/host-support-context.js +0 -254
  113. package/scripts/lib/http-hook-action.js +0 -538
  114. package/scripts/lib/install-ai-readiness.js +0 -84
  115. package/scripts/lib/install-intake-risk.js +0 -1037
  116. package/scripts/lib/install-journey-intelligence.js +0 -329
  117. package/scripts/lib/intervention-guidance.js +0 -57
  118. package/scripts/lib/known-limitations.js +0 -115
  119. package/scripts/lib/l8-path-truth.js +0 -146
  120. package/scripts/lib/launch-hardening-gate.js +0 -436
  121. package/scripts/lib/launch-readiness.js +0 -628
  122. package/scripts/lib/learning-memory.js +0 -686
  123. package/scripts/lib/lifecycle-hooks.js +0 -802
  124. package/scripts/lib/local-package-smoke.js +0 -423
  125. package/scripts/lib/local-pricing.js +0 -299
  126. package/scripts/lib/mcp-enforcement.js +0 -311
  127. package/scripts/lib/mcp-least-privilege-policy.js +0 -303
  128. package/scripts/lib/mcp-tool-inventory.js +0 -388
  129. package/scripts/lib/mcp-tool-risk.js +0 -0
  130. package/scripts/lib/memory.js +0 -335
  131. package/scripts/lib/metrics.js +0 -699
  132. package/scripts/lib/micro-proof.js +0 -133
  133. package/scripts/lib/next-run-context.js +0 -436
  134. package/scripts/lib/operating-value.js +0 -1648
  135. package/scripts/lib/optimization-v3.js +0 -122
  136. package/scripts/lib/orchestration/adapters/_shared.js +0 -49
  137. package/scripts/lib/orchestration/adapters/aider.js +0 -18
  138. package/scripts/lib/orchestration/adapters/claude-code.js +0 -35
  139. package/scripts/lib/orchestration/adapters/codex.js +0 -35
  140. package/scripts/lib/orchestration/adapters/gemini-cli.js +0 -18
  141. package/scripts/lib/orchestration/adapters/git.js +0 -25
  142. package/scripts/lib/orchestration/adapters/index.js +0 -31
  143. package/scripts/lib/orchestration/adapters/lm-studio.js +0 -18
  144. package/scripts/lib/orchestration/adapters/ollama.js +0 -18
  145. package/scripts/lib/orchestration/adapters/opencode.js +0 -18
  146. package/scripts/lib/orchestration/adapters/openrouter.js +0 -18
  147. package/scripts/lib/orchestration/adapters/test-runner.js +0 -25
  148. package/scripts/lib/orchestration/cli.js +0 -438
  149. package/scripts/lib/orchestration/execution-manager.js +0 -279
  150. package/scripts/lib/orchestration/handoff.js +0 -314
  151. package/scripts/lib/orchestration/index.js +0 -456
  152. package/scripts/lib/orchestration/inventory.js +0 -47
  153. package/scripts/lib/orchestration/model-discovery.js +0 -498
  154. package/scripts/lib/orchestration/model-profiler.js +0 -170
  155. package/scripts/lib/orchestration/model-profiles.js +0 -252
  156. package/scripts/lib/orchestration/model-refresh-policy.js +0 -72
  157. package/scripts/lib/orchestration/proof-writer.js +0 -349
  158. package/scripts/lib/orchestration/provider-discovery/aider.js +0 -49
  159. package/scripts/lib/orchestration/provider-discovery/claude-code.js +0 -56
  160. package/scripts/lib/orchestration/provider-discovery/codex.js +0 -49
  161. package/scripts/lib/orchestration/provider-discovery/common.js +0 -186
  162. package/scripts/lib/orchestration/provider-discovery/gemini.js +0 -106
  163. package/scripts/lib/orchestration/provider-discovery/lm-studio.js +0 -118
  164. package/scripts/lib/orchestration/provider-discovery/models-dev.js +0 -12
  165. package/scripts/lib/orchestration/provider-discovery/ollama.js +0 -100
  166. package/scripts/lib/orchestration/provider-discovery/opencode.js +0 -47
  167. package/scripts/lib/orchestration/provider-discovery/openrouter.js +0 -44
  168. package/scripts/lib/orchestration/risk-classifier.js +0 -130
  169. package/scripts/lib/orchestration/routing-policy.js +0 -486
  170. package/scripts/lib/orchestration/settings.js +0 -112
  171. package/scripts/lib/orchestration/state.js +0 -165
  172. package/scripts/lib/orchestration/verification-manager.js +0 -138
  173. package/scripts/lib/output-profiles.js +0 -146
  174. package/scripts/lib/package-content-audit.js +0 -368
  175. package/scripts/lib/package-runtime.js +0 -278
  176. package/scripts/lib/plan-surface.js +0 -53
  177. package/scripts/lib/plans.js +0 -2318
  178. package/scripts/lib/policy-provider.js +0 -27
  179. package/scripts/lib/prelaunch-activation-readiness.js +0 -409
  180. package/scripts/lib/prelaunch-evidence-store.js +0 -816
  181. package/scripts/lib/prelaunch-intelligence.js +0 -869
  182. package/scripts/lib/pricing-experiment.js +0 -118
  183. package/scripts/lib/pro-moment-events.js +0 -77
  184. package/scripts/lib/pro-moment-state.js +0 -227
  185. package/scripts/lib/pro-moments.js +0 -1216
  186. package/scripts/lib/product-learning-events.js +0 -629
  187. package/scripts/lib/project-profile.js +0 -555
  188. package/scripts/lib/prompt-compiler.js +0 -280
  189. package/scripts/lib/prompt-lint.js +0 -32
  190. package/scripts/lib/prompt-suggestions.js +0 -52
  191. package/scripts/lib/proof-canonical.js +0 -398
  192. package/scripts/lib/proof-drilldown.js +0 -383
  193. package/scripts/lib/proof-events.js +0 -342
  194. package/scripts/lib/proof-history.js +0 -243
  195. package/scripts/lib/proof-metrics.js +0 -296
  196. package/scripts/lib/proof-outcome-evidence.js +0 -134
  197. package/scripts/lib/proof-receipt.js +0 -335
  198. package/scripts/lib/proof-record.js +0 -461
  199. package/scripts/lib/public-activation-distribution-gate.js +0 -258
  200. package/scripts/lib/public-cli.js +0 -3891
  201. package/scripts/lib/public-distribution-truth.js +0 -211
  202. package/scripts/lib/public-install-claim-checker.js +0 -294
  203. package/scripts/lib/publish-provenance-readiness.js +0 -283
  204. package/scripts/lib/readiness-delta.js +0 -218
  205. package/scripts/lib/readiness-evidence-closure.js +0 -196
  206. package/scripts/lib/reentry-memory-capture.js +0 -241
  207. package/scripts/lib/reentry-memory-retrieval.js +0 -302
  208. package/scripts/lib/reentry-memory-status.js +0 -146
  209. package/scripts/lib/reentry-memory-store.js +0 -178
  210. package/scripts/lib/reentry-state.js +0 -66
  211. package/scripts/lib/release-candidate-bundle.js +0 -166
  212. package/scripts/lib/remediation.js +0 -81
  213. package/scripts/lib/repo-map.js +0 -391
  214. package/scripts/lib/run-improvements-lifecycle.js +0 -330
  215. package/scripts/lib/run-improvements.js +0 -789
  216. package/scripts/lib/runtime-decision-policy.js +0 -387
  217. package/scripts/lib/safe-path-engine.js +0 -705
  218. package/scripts/lib/safe-run-controller.js +0 -887
  219. package/scripts/lib/score.js +0 -262
  220. package/scripts/lib/seamless-enforcement.js +0 -329
  221. package/scripts/lib/seamless-outcome.js +0 -689
  222. package/scripts/lib/seamless-reality-gate.js +0 -5043
  223. package/scripts/lib/security-risk-classifier.js +0 -511
  224. package/scripts/lib/security-scan.js +0 -384
  225. package/scripts/lib/session-context-optimizer.js +0 -1211
  226. package/scripts/lib/session-timing.js +0 -315
  227. package/scripts/lib/skill-hygiene.js +0 -805
  228. package/scripts/lib/skill-packs.js +0 -161
  229. package/scripts/lib/skills-operating-layer.js +0 -580
  230. package/scripts/lib/smart-work-routing.js +0 -768
  231. package/scripts/lib/source-catalog.js +0 -700
  232. package/scripts/lib/status-value-summary.js +0 -32
  233. package/scripts/lib/support-bundle.js +0 -578
  234. package/scripts/lib/task-continuation.js +0 -440
  235. package/scripts/lib/test-helpers.js +0 -15
  236. package/scripts/lib/tier.js +0 -38
  237. package/scripts/lib/token-context-quality-gate.js +0 -370
  238. package/scripts/lib/token-cost-capture.js +0 -187
  239. package/scripts/lib/token-cost-intelligence.js +0 -358
  240. package/scripts/lib/token-efficiency-evidence.js +0 -213
  241. package/scripts/lib/token-evidence.js +0 -699
  242. package/scripts/lib/tokenish.js +0 -17
  243. package/scripts/lib/tool-output-sandbox.js +0 -304
  244. package/scripts/lib/trust-audit.js +0 -136
  245. package/scripts/lib/unified-events.js +0 -396
  246. package/scripts/lib/upgrade-interruption-recovery.js +0 -407
  247. package/scripts/lib/usage-ledger.js +0 -201
  248. package/scripts/lib/value-ledger.js +0 -130
  249. package/scripts/lib/value-proof-calibration.js +0 -531
  250. package/scripts/lib/visual-qa.js +0 -231
  251. package/scripts/lib/voice-alpha.js +0 -29
  252. package/scripts/lib/work-aware-orchestration.js +0 -976
  253. package/scripts/lib/work-control-receipts.js +0 -577
  254. package/scripts/lib/work-ledger.js +0 -1123
  255. package/scripts/lib/work-panel-preview.js +0 -352
  256. package/scripts/lib/workflow-discipline.js +0 -280
  257. package/scripts/lib/workflow-signals.js +0 -419
  258. package/scripts/lib/workspace-map.js +0 -281
  259. package/scripts/lib/workspace-registry.js +0 -1367
  260. package/scripts/lib/workspace-resolver.js +0 -480
@@ -1,191 +0,0 @@
1
- "use strict";
2
-
3
- const fs = require("fs");
4
- const path = require("path");
5
-
6
- const { safeReadJson } = require("../fsx");
7
- const {
8
- ACTIVATION_STATE_REL,
9
- readActivationState,
10
- } = require("./activation-state");
11
- const {
12
- USER_STATE_REL,
13
- readAccountState,
14
- } = require("./account-state");
15
-
16
- const PUBLIC_ACTIVATE_COMMAND = "npx avorelo@latest activate";
17
-
18
- function safeActivateNextAction() {
19
- return {
20
- label: "Activate Avorelo",
21
- command: PUBLIC_ACTIVATE_COMMAND,
22
- reason: "Activation has not run yet in this project.",
23
- blocking: false,
24
- };
25
- }
26
-
27
- function isNonEmptyObject(value) {
28
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
29
- }
30
-
31
- function probeJson(cwd, relPath) {
32
- const abs = path.join(cwd, relPath);
33
- const exists = fs.existsSync(abs);
34
- const raw = safeReadJson(cwd, relPath, null);
35
- return {
36
- exists,
37
- raw,
38
- unreadable: exists && !isNonEmptyObject(raw),
39
- };
40
- }
41
-
42
- function normalizeEnabledIntegrations(list) {
43
- if (!Array.isArray(list)) return [];
44
- return list.filter((item) => typeof item === "string" && item.trim()).map((item) => item.trim());
45
- }
46
-
47
- function normalizeNextAction(nextAction, status, firstValueAvailable) {
48
- if (!isNonEmptyObject(nextAction)) {
49
- if (status === "first_value_ready" || status === "active") {
50
- return {
51
- label: "Continue working",
52
- command: null,
53
- reason: firstValueAvailable
54
- ? "Activation already produced a first-value result in this project."
55
- : "Activation has already completed in this project.",
56
- blocking: false,
57
- };
58
- }
59
- return safeActivateNextAction();
60
- }
61
-
62
- const label = typeof nextAction.label === "string" && nextAction.label.trim()
63
- ? nextAction.label.trim()
64
- : "Continue working";
65
- const command = typeof nextAction.command === "string" && nextAction.command.trim()
66
- ? nextAction.command.trim()
67
- : null;
68
- const reason = typeof nextAction.reason === "string" && nextAction.reason.trim()
69
- ? nextAction.reason.trim()
70
- : (status === "first_value_ready" || status === "active"
71
- ? "Activation has already completed in this project."
72
- : "Activation has not run yet in this project.");
73
- const blocking = nextAction.blocking === true;
74
-
75
- if ((status === "first_value_ready" || status === "active") && command === PUBLIC_ACTIVATE_COMMAND) {
76
- return {
77
- label: "Continue working",
78
- command: null,
79
- reason: firstValueAvailable
80
- ? "Activation already produced a first-value result in this project."
81
- : "Activation has already completed in this project.",
82
- blocking: false,
83
- };
84
- }
85
-
86
- return { label, command, reason, blocking };
87
- }
88
-
89
- function normalizeFirstValue(firstValue) {
90
- if (!isNonEmptyObject(firstValue)) {
91
- return {
92
- available: false,
93
- summary: null,
94
- };
95
- }
96
- return {
97
- available: firstValue.available === true,
98
- summary: typeof firstValue.summary === "string" && firstValue.summary.trim() ? firstValue.summary.trim() : null,
99
- };
100
- }
101
-
102
- function buildActivationSummary(cwd) {
103
- const warnings = [];
104
- const activationProbe = probeJson(cwd, ACTIVATION_STATE_REL);
105
- const accountProbe = probeJson(cwd, USER_STATE_REL);
106
- const activationState = readActivationState(cwd);
107
- const accountState = readAccountState(cwd);
108
-
109
- if (activationProbe.unreadable) {
110
- warnings.push("Activation state is unreadable; rerun activation to refresh local state.");
111
- }
112
- if (accountProbe.unreadable) {
113
- warnings.push("Account state is unreadable; using safe local defaults.");
114
- }
115
-
116
- const activationStatus = typeof activationState?.status === "string" && activationState.status.trim()
117
- ? activationState.status.trim()
118
- : "not_started";
119
- const firstValue = normalizeFirstValue(activationState?.firstValue);
120
- const enabledIntegrations = normalizeEnabledIntegrations(activationState?.enabledIntegrations);
121
- const activationAccount = isNonEmptyObject(activationState?.account) ? activationState.account : {};
122
- const connected = accountProbe.exists
123
- ? accountState.connected
124
- : activationAccount.connected === true;
125
- const plan = accountProbe.exists
126
- ? accountState.plan
127
- : (typeof activationAccount.plan === "string" && activationAccount.plan.trim()
128
- ? String(activationAccount.plan).trim().toLowerCase()
129
- : "free");
130
- const localOnly = accountProbe.exists
131
- ? accountState.localOnly
132
- : connected !== true;
133
- const present = activationProbe.exists
134
- && !activationProbe.unreadable
135
- && activationStatus !== "not_started";
136
-
137
- const nextAction = present
138
- ? normalizeNextAction(activationState?.nextAction, activationStatus, firstValue.available)
139
- : safeActivateNextAction();
140
-
141
- return {
142
- present,
143
- status: present ? activationStatus : "not_started",
144
- firstValue,
145
- account: {
146
- connected,
147
- plan,
148
- localOnly,
149
- },
150
- enabledIntegrations,
151
- nextAction,
152
- warnings,
153
- };
154
- }
155
-
156
- function summarizeIntegrationList(enabledIntegrations) {
157
- const visible = normalizeEnabledIntegrations(enabledIntegrations).filter((item) => {
158
- if (item === "local") return false;
159
- if (item.endsWith("-project-ready")) return false;
160
- if (item.endsWith("-context-pack")) return false;
161
- if (item.endsWith("-local-layer")) return false;
162
- return true;
163
- });
164
- return visible.length ? visible.join(",") : "none";
165
- }
166
-
167
- function formatActivationStatusLine(summary) {
168
- if (!summary?.present) {
169
- return `Activation: not activated · run ${PUBLIC_ACTIVATE_COMMAND}`;
170
- }
171
-
172
- const statusLabel = summary.status === "first_value_ready"
173
- ? "ready"
174
- : summary.status === "not_started"
175
- ? "not activated"
176
- : summary.status;
177
- const modeLabel = summary.account?.connected === true ? "connected" : "local-only";
178
- const plan = summary.account?.plan || "unknown";
179
- const integrations = summarizeIntegrationList(summary.enabledIntegrations);
180
- let line = `Activation: ${statusLabel} · ${modeLabel} · ${plan} · ${integrations}`;
181
- if (Array.isArray(summary.warnings) && summary.warnings.length) {
182
- line += ` · warning: ${summary.warnings[0]}`;
183
- }
184
- return line;
185
- }
186
-
187
- module.exports = {
188
- PUBLIC_ACTIVATE_COMMAND,
189
- buildActivationSummary,
190
- formatActivationStatusLine,
191
- };
@@ -1,77 +0,0 @@
1
- "use strict";
2
-
3
- const fs = require("fs");
4
- const path = require("path");
5
- const { safeWriteJson, safeWriteText, nowIso } = require("../../fsx");
6
-
7
- function hasLocalAvoreloState(cwd) {
8
- return fs.existsSync(path.join(cwd, ".claude", "cco", "config.json"));
9
- }
10
-
11
- function getActivationStatus(cwd) {
12
- try {
13
- const raw = fs.readFileSync(path.join(cwd, ".claude", "cco", "state", "activation.json"), "utf8");
14
- return JSON.parse(raw).status || null;
15
- } catch {
16
- return null;
17
- }
18
- }
19
-
20
- module.exports = {
21
- id: "claude-code",
22
- label: "Claude Code",
23
- depth: "deep",
24
- canAutoConfigure: true,
25
- detect(cwd) {
26
- return (
27
- fs.existsSync(path.join(cwd, ".claude")) ||
28
- fs.existsSync(path.join(cwd, "CLAUDE.md")) ||
29
- fs.existsSync(path.join(cwd, ".claude-plugin"))
30
- );
31
- },
32
- getInstallState(cwd) {
33
- const status = getActivationStatus(cwd);
34
- if (status === "active") return "active";
35
- if (hasLocalAvoreloState(cwd)) return "configured";
36
- return this.detect(cwd) ? "available" : "not_installed";
37
- },
38
- getRecommendedActions() {
39
- return [
40
- {
41
- label: "Install the Claude Code plugin",
42
- command: "/plugin install avorelo@avorelo-marketplace",
43
- reason: "Claude Code can provide the deepest Avorelo integration once the plugin is installed.",
44
- },
45
- ];
46
- },
47
- configureIfSafe(cwd, options = {}) {
48
- const rel = ".claude/cco/state/hosts/claude-code.json";
49
- safeWriteJson(cwd, rel, {
50
- id: "claude-code",
51
- configuredAt: nowIso(),
52
- contextPack: options.contextPackRel || null,
53
- manualStepRequired: true,
54
- });
55
- safeWriteText(
56
- cwd,
57
- ".claude/cco/reports/claude-code-activation.md",
58
- [
59
- "# Claude Code Setup",
60
- "",
61
- "Run this inside Claude Code:",
62
- "",
63
- "/plugin install avorelo@avorelo-marketplace",
64
- ].join("\n")
65
- );
66
- return {
67
- applied: true,
68
- integrationId: "claude-code-project-ready",
69
- wrote: [rel, ".claude/cco/reports/claude-code-activation.md"],
70
- };
71
- },
72
- getLimitations() {
73
- return [
74
- "Plugin installation still requires a manual command inside Claude Code.",
75
- ];
76
- },
77
- };
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- const fs = require("fs");
4
- const path = require("path");
5
- const { commandExists } = require("../detect-environment");
6
- const { safeWriteJson, nowIso } = require("../../fsx");
7
-
8
- module.exports = {
9
- id: "codex-cli",
10
- label: "Codex CLI",
11
- depth: "host-aware",
12
- canAutoConfigure: true,
13
- detect(cwd, options = {}) {
14
- const env = options.env || process.env;
15
- return (
16
- fs.existsSync(path.join(cwd, ".codex")) ||
17
- Boolean(env.CODEX_HOME) ||
18
- commandExists("codex", env)
19
- );
20
- },
21
- getInstallState(cwd, options = {}) {
22
- return this.detect(cwd, options) ? "configured" : "not_installed";
23
- },
24
- getRecommendedActions() {
25
- return [
26
- {
27
- label: "Use the local context pack from Codex",
28
- command: "avorelo status",
29
- reason: "Codex CLI can pick up the same local project state once activation completes.",
30
- },
31
- ];
32
- },
33
- configureIfSafe(cwd, options = {}) {
34
- const rel = ".claude/cco/state/hosts/codex-cli.json";
35
- safeWriteJson(cwd, rel, {
36
- id: "codex-cli",
37
- configuredAt: nowIso(),
38
- contextPack: options.contextPackRel || null,
39
- mode: "project-local",
40
- });
41
- return {
42
- applied: true,
43
- integrationId: "codex-cli-context-pack",
44
- wrote: [rel],
45
- };
46
- },
47
- getLimitations() {
48
- return [
49
- "Activation Router v1 does not mutate global Codex configuration.",
50
- ];
51
- },
52
- };
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- const fs = require("fs");
4
- const path = require("path");
5
-
6
- module.exports = {
7
- id: "cursor",
8
- label: "Cursor",
9
- depth: "host-aware",
10
- canAutoConfigure: false,
11
- detect(cwd) {
12
- return (
13
- fs.existsSync(path.join(cwd, ".cursor")) ||
14
- fs.existsSync(path.join(cwd, ".cursorignore"))
15
- );
16
- },
17
- getInstallState(cwd) {
18
- return this.detect(cwd) ? "available" : "not_installed";
19
- },
20
- getRecommendedActions() {
21
- return [
22
- {
23
- label: "Keep using local Avorelo status in Cursor",
24
- command: "avorelo status",
25
- reason: "Cursor can benefit from the same project-scoped Avorelo context without extra setup.",
26
- },
27
- ];
28
- },
29
- configureIfSafe() {
30
- return { applied: false, reason: "Activation Router v1 keeps Cursor setup project-local and non-invasive." };
31
- },
32
- getLimitations() {
33
- return [
34
- "Cursor-specific settings are not mutated automatically.",
35
- ];
36
- },
37
- };
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- const fs = require("fs");
4
- const path = require("path");
5
- const { commandExists } = require("../detect-environment");
6
-
7
- module.exports = {
8
- id: "github-agent",
9
- label: "GitHub Agent Workflows",
10
- depth: "host-aware",
11
- canAutoConfigure: false,
12
- detect(cwd, options = {}) {
13
- const env = options.env || process.env;
14
- return (
15
- fs.existsSync(path.join(cwd, ".github")) ||
16
- commandExists("gh", env)
17
- );
18
- },
19
- getInstallState(cwd, options = {}) {
20
- return this.detect(cwd, options) ? "available" : "not_installed";
21
- },
22
- getRecommendedActions() {
23
- return [
24
- {
25
- label: "Review GitHub agent workflows later",
26
- command: null,
27
- reason: "GitHub agent integration is intentionally optional in Activation Router v1.",
28
- },
29
- ];
30
- },
31
- configureIfSafe() {
32
- return { applied: false, reason: "Activation Router v1 does not change GitHub workflows automatically." };
33
- },
34
- getLimitations() {
35
- return [
36
- "GitHub agent integration remains optional and manual in Activation Router v1.",
37
- ];
38
- },
39
- };
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- const { safeWriteJson, nowIso } = require("../../fsx");
4
-
5
- module.exports = {
6
- id: "terminal",
7
- label: "Terminal",
8
- depth: "local",
9
- canAutoConfigure: true,
10
- detect() {
11
- return true;
12
- },
13
- getInstallState(cwd) {
14
- return "active";
15
- },
16
- getRecommendedActions() {
17
- return [
18
- {
19
- label: "Run compact Avorelo status from the terminal",
20
- command: "avorelo status --text",
21
- reason: "The universal local layer works immediately from the terminal.",
22
- },
23
- ];
24
- },
25
- configureIfSafe(cwd, options = {}) {
26
- const rel = ".claude/cco/state/hosts/terminal.json";
27
- safeWriteJson(cwd, rel, {
28
- id: "terminal",
29
- configuredAt: nowIso(),
30
- contextPack: options.contextPackRel || null,
31
- ready: true,
32
- });
33
- return {
34
- applied: true,
35
- integrationId: "terminal-local-layer",
36
- wrote: [rel],
37
- };
38
- },
39
- getLimitations() {
40
- return [];
41
- },
42
- };
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- const fs = require("fs");
4
- const path = require("path");
5
-
6
- module.exports = {
7
- id: "vscode",
8
- label: "VS Code",
9
- depth: "host-aware",
10
- canAutoConfigure: false,
11
- detect(cwd) {
12
- if (fs.existsSync(path.join(cwd, ".vscode"))) return true;
13
- try {
14
- return fs.readdirSync(cwd).some((name) => name.endsWith(".code-workspace"));
15
- } catch {
16
- return false;
17
- }
18
- },
19
- getInstallState(cwd) {
20
- return this.detect(cwd) ? "available" : "not_installed";
21
- },
22
- getRecommendedActions() {
23
- return [
24
- {
25
- label: "Open this project in VS Code",
26
- command: null,
27
- reason: "Avorelo local state is ready and VS Code can use the same project-scoped signals.",
28
- },
29
- ];
30
- },
31
- configureIfSafe() {
32
- return { applied: false, reason: "No project-scoped VS Code mutation is required for Activation Router v1." };
33
- },
34
- getLimitations() {
35
- return [
36
- "Activation Router v1 does not modify VS Code settings automatically.",
37
- ];
38
- },
39
- };
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- const fs = require("fs");
4
- const path = require("path");
5
-
6
- module.exports = {
7
- id: "windsurf",
8
- label: "Windsurf",
9
- depth: "host-aware",
10
- canAutoConfigure: false,
11
- detect(cwd) {
12
- return (
13
- fs.existsSync(path.join(cwd, ".windsurf")) ||
14
- fs.existsSync(path.join(cwd, ".windsurfrules"))
15
- );
16
- },
17
- getInstallState(cwd) {
18
- return this.detect(cwd) ? "available" : "not_installed";
19
- },
20
- getRecommendedActions() {
21
- return [
22
- {
23
- label: "Use Avorelo local status from Windsurf",
24
- command: "avorelo status",
25
- reason: "Windsurf can reuse the same local Avorelo signals once project state exists.",
26
- },
27
- ];
28
- },
29
- configureIfSafe() {
30
- return { applied: false, reason: "Activation Router v1 does not write Windsurf settings automatically." };
31
- },
32
- getLimitations() {
33
- return [
34
- "Windsurf deep integration is deferred beyond Activation Router v1.",
35
- ];
36
- },
37
- };
@@ -1,151 +0,0 @@
1
- "use strict";
2
-
3
- const fs = require("fs");
4
- const path = require("path");
5
- const net = require("net");
6
-
7
- // AI surface file markers
8
- const AI_SURFACE_MARKERS = Object.freeze([
9
- { id: "claude_md", label: "CLAUDE.md", rel: "CLAUDE.md" },
10
- { id: "claude_dir", label: ".claude directory", rel: ".claude" },
11
- { id: "agents_md", label: "AGENTS.md", rel: "AGENTS.md" },
12
- { id: "cursor_rules", label: "Cursor rules", rel: ".cursor/rules" },
13
- { id: "cursor_dir", label: ".cursor directory", rel: ".cursor" },
14
- { id: "windsurf_rules", label: "Windsurf rules", rel: ".windsurf/rules" },
15
- { id: "windsurf_dir", label: ".windsurf directory", rel: ".windsurf" },
16
- { id: "gemini_md", label: "GEMINI.md", rel: "GEMINI.md" },
17
- { id: "copilot", label: "Copilot instructions", rel: ".github/copilot-instructions.md" },
18
- { id: "vscode_ws", label: "VS Code workspace", rel: ".vscode" },
19
- { id: "avorelo_guidance", label: "Avorelo guidance", rel: ".claude/cco" },
20
- { id: "llms_txt", label: "llms.txt", rel: "llms.txt" },
21
- ]);
22
-
23
- const MODEL_PROVIDER_ENV_KEYS = Object.freeze([
24
- { id: "anthropic_api_key", key: "ANTHROPIC_API_KEY", label: "Anthropic API" },
25
- { id: "openai_api_key", key: "OPENAI_API_KEY", label: "OpenAI API" },
26
- { id: "google_api_key", key: "GOOGLE_API_KEY", label: "Google API" },
27
- { id: "anthropic_base_url", key: "ANTHROPIC_BASE_URL", label: "Anthropic base URL override" },
28
- { id: "openai_base_url", key: "OPENAI_BASE_URL", label: "OpenAI base URL override" },
29
- { id: "litellm_api_key", key: "LITELLM_API_KEY", label: "LiteLLM API key" },
30
- { id: "ollama_host", key: "OLLAMA_HOST", label: "Ollama host override" },
31
- ]);
32
-
33
- const LOCAL_ENDPOINTS = Object.freeze([
34
- { id: "litellm_4000", host: "127.0.0.1", port: 4000, label: "LiteLLM (4000)" },
35
- { id: "litellm_4001", host: "127.0.0.1", port: 4001, label: "LiteLLM (4001)" },
36
- { id: "ollama_11434", host: "127.0.0.1", port: 11434, label: "Ollama (11434)" },
37
- { id: "lmstudio_1234", host: "127.0.0.1", port: 1234, label: "LM Studio (1234)" },
38
- ]);
39
-
40
- function detectAiSurfaces(cwd, options = {}) {
41
- const surfaces = [];
42
- for (const marker of AI_SURFACE_MARKERS) {
43
- try {
44
- const abs = path.join(cwd, marker.rel);
45
- if (fs.existsSync(abs)) {
46
- const stat = fs.statSync(abs);
47
- surfaces.push({
48
- id: marker.id,
49
- label: marker.label,
50
- rel: marker.rel,
51
- isDir: stat.isDirectory(),
52
- });
53
- }
54
- } catch {
55
- // skip
56
- }
57
- }
58
- return surfaces;
59
- }
60
-
61
- function detectModelRoutingEnv(env) {
62
- const env_ = env || process.env;
63
- const detected = [];
64
- for (const { id, key, label } of MODEL_PROVIDER_ENV_KEYS) {
65
- if (env_[key] !== undefined && env_[key] !== "") {
66
- detected.push({ id, key, label, present: true });
67
- }
68
- }
69
- return detected;
70
- }
71
-
72
- // Safe TCP probe: short timeout, no data sent, no prompt sent
73
- function probeLocalPort(host, port, timeoutMs = 300) {
74
- return new Promise((resolve) => {
75
- const socket = new net.Socket();
76
- let resolved = false;
77
- const done = (result) => {
78
- if (!resolved) {
79
- resolved = true;
80
- socket.destroy();
81
- resolve(result);
82
- }
83
- };
84
- socket.setTimeout(timeoutMs);
85
- socket.once("connect", () => done(true));
86
- socket.once("error", () => done(false));
87
- socket.once("timeout", () => done(false));
88
- try {
89
- socket.connect(port, host);
90
- } catch {
91
- done(false);
92
- }
93
- });
94
- }
95
-
96
- async function detectLocalEndpoints(options = {}) {
97
- const results = [];
98
- const probeEnabled = options.probeLocalEndpoints !== false;
99
- for (const ep of LOCAL_ENDPOINTS) {
100
- let listening = false;
101
- if (probeEnabled) {
102
- try {
103
- listening = await probeLocalPort(ep.host, ep.port);
104
- } catch {
105
- listening = false;
106
- }
107
- }
108
- results.push({ ...ep, listening });
109
- }
110
- return results;
111
- }
112
-
113
- function detectLocalEndpointsSync(options = {}) {
114
- // Sync version - no probing, just report config hints from env
115
- return LOCAL_ENDPOINTS.map((ep) => ({ ...ep, listening: false, syncOnly: true }));
116
- }
117
-
118
- function deriveRoutingStatus(envProviders, localEndpoints) {
119
- const hasEnvKey = envProviders.length > 0;
120
- const hasListening = localEndpoints.some((ep) => ep.listening);
121
- if (hasEnvKey && hasListening) return "ready";
122
- if (hasEnvKey || hasListening) return "partial";
123
- return "unknown";
124
- }
125
-
126
- function detectModelRouting(cwd, options = {}) {
127
- const env = options.env || process.env;
128
- const envProviders = detectModelRoutingEnv(env);
129
- const localEndpoints = detectLocalEndpointsSync(options);
130
- const routingStatus = deriveRoutingStatus(envProviders, localEndpoints);
131
- return {
132
- status: routingStatus,
133
- envProviders,
134
- localEndpoints,
135
- redacted: true,
136
- note: "Env key names only — values not included.",
137
- };
138
- }
139
-
140
- module.exports = {
141
- AI_SURFACE_MARKERS,
142
- MODEL_PROVIDER_ENV_KEYS,
143
- LOCAL_ENDPOINTS,
144
- detectAiSurfaces,
145
- detectModelRoutingEnv,
146
- probeLocalPort,
147
- detectLocalEndpoints,
148
- detectLocalEndpointsSync,
149
- deriveRoutingStatus,
150
- detectModelRouting,
151
- };