avorelo 0.1.0 → 0.2.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/LICENSE +23 -16
- package/README.md +91 -51
- package/bin/avorelo.mjs +7 -0
- package/dist/avorelo.mjs +14337 -0
- package/package.json +106 -120
- package/bin/avorelo +0 -9
- package/scripts/README.md +0 -40
- package/scripts/cco-dashboard.js +0 -252
- package/scripts/cco-status.js +0 -430
- package/scripts/lib/activation/account-state.js +0 -37
- package/scripts/lib/activation/activation-runner.js +0 -546
- package/scripts/lib/activation/activation-self-healing.js +0 -480
- package/scripts/lib/activation/activation-state.js +0 -83
- package/scripts/lib/activation/activation-summary.js +0 -191
- package/scripts/lib/activation/adapters/claude-code.js +0 -77
- package/scripts/lib/activation/adapters/codex-cli.js +0 -52
- package/scripts/lib/activation/adapters/cursor.js +0 -37
- package/scripts/lib/activation/adapters/github-agent.js +0 -39
- package/scripts/lib/activation/adapters/terminal.js +0 -42
- package/scripts/lib/activation/adapters/vscode.js +0 -39
- package/scripts/lib/activation/adapters/windsurf.js +0 -37
- package/scripts/lib/activation/ai-surface-detector.js +0 -151
- package/scripts/lib/activation/connect-account.js +0 -145
- package/scripts/lib/activation/detect-environment.js +0 -75
- package/scripts/lib/activation/detect-hosts.js +0 -62
- package/scripts/lib/activation/format-activation-output.js +0 -109
- package/scripts/lib/activation/next-action.js +0 -43
- package/scripts/lib/activation/repair-engine.js +0 -219
- package/scripts/lib/activation-distribution-readiness.js +0 -507
- package/scripts/lib/adapter-conformance.js +0 -176
- package/scripts/lib/adapter-readiness.js +0 -417
- package/scripts/lib/adapter-safety-boundaries.js +0 -335
- package/scripts/lib/adapter-technical-readiness-gate.js +0 -205
- package/scripts/lib/agent-access-governance.js +0 -455
- package/scripts/lib/agent-enforcement.js +0 -765
- package/scripts/lib/agent-policy-profile.js +0 -210
- package/scripts/lib/agent-security/action-evaluator.js +0 -507
- package/scripts/lib/agent-security/adapter-registry.js +0 -98
- package/scripts/lib/agent-security/auto-policy.js +0 -139
- package/scripts/lib/agent-security/bounded-scan.js +0 -93
- package/scripts/lib/agent-security/enforcement-adapter.js +0 -174
- package/scripts/lib/agent-security/enforcement-engine.js +0 -1129
- package/scripts/lib/agent-security/file-write-adapter.js +0 -183
- package/scripts/lib/agent-security/file-write-rules.js +0 -178
- package/scripts/lib/agent-security/index.js +0 -3342
- package/scripts/lib/agent-security/instruction-risk.js +0 -181
- package/scripts/lib/agent-security/mcp-action-adapter.js +0 -185
- package/scripts/lib/agent-security/mcp-action-rules.js +0 -184
- package/scripts/lib/agent-security/package-action-adapter.js +0 -175
- package/scripts/lib/agent-security/package-action-rules.js +0 -233
- package/scripts/lib/agent-security/performance.js +0 -148
- package/scripts/lib/agent-security/permission-minimizer.js +0 -403
- package/scripts/lib/agent-security/scan-cache.js +0 -74
- package/scripts/lib/agent-security/source-trust.js +0 -146
- package/scripts/lib/ai-install-prompt.js +0 -288
- package/scripts/lib/ai-workspace-hygiene.js +0 -1499
- package/scripts/lib/alpha-activation.js +0 -520
- package/scripts/lib/alpha-feedback.js +0 -263
- package/scripts/lib/alpha-readiness-gate.js +0 -332
- package/scripts/lib/anti-gaming.js +0 -169
- package/scripts/lib/artifact-health.js +0 -431
- package/scripts/lib/attribution.js +0 -180
- package/scripts/lib/audit.js +0 -289
- package/scripts/lib/avorelo-skill-registry.js +0 -810
- package/scripts/lib/batch-jobs.js +0 -71
- package/scripts/lib/brain-pack.js +0 -578
- package/scripts/lib/brand-boundary.js +0 -424
- package/scripts/lib/brand.js +0 -74
- package/scripts/lib/browser-capability.js +0 -1048
- package/scripts/lib/browser-proof-preflight.js +0 -321
- package/scripts/lib/cache-readiness.js +0 -187
- package/scripts/lib/canonical-reentry.js +0 -162
- package/scripts/lib/capability-packs.js +0 -314
- package/scripts/lib/capability-recommender.js +0 -512
- package/scripts/lib/capability-registry.js +0 -1059
- package/scripts/lib/carry-forward-surfacing.js +0 -194
- package/scripts/lib/ccusage-adapter.js +0 -188
- package/scripts/lib/company-loop.js +0 -1149
- package/scripts/lib/config.js +0 -637
- package/scripts/lib/context-acquisition-plan.js +0 -287
- package/scripts/lib/context-budget-guard.js +0 -170
- package/scripts/lib/context-budget-scanner.js +0 -257
- package/scripts/lib/context-optimizer.js +0 -715
- package/scripts/lib/context-reduction-plan.js +0 -178
- package/scripts/lib/context-safety.js +0 -88
- package/scripts/lib/context-savings-engine.js +0 -158
- package/scripts/lib/cost-evidence.js +0 -254
- package/scripts/lib/cross-host-install-plan.js +0 -308
- package/scripts/lib/cross-host-install-readiness.js +0 -237
- package/scripts/lib/cross-host-value-flow.js +0 -268
- package/scripts/lib/dashboard.js +0 -900
- package/scripts/lib/design-partner-feedback.js +0 -346
- package/scripts/lib/entitlements.js +0 -100
- package/scripts/lib/execution-packet.js +0 -559
- package/scripts/lib/experimentation-events.js +0 -547
- package/scripts/lib/external-capability-compliance.js +0 -107
- package/scripts/lib/external-user-simulation.js +0 -166
- package/scripts/lib/failure-recovery-readiness.js +0 -81
- package/scripts/lib/failure-recovery.js +0 -419
- package/scripts/lib/feedback-intelligence.js +0 -537
- package/scripts/lib/feedback-signals.js +0 -205
- package/scripts/lib/file-integrity.js +0 -68
- package/scripts/lib/fsx.js +0 -127
- package/scripts/lib/full-readiness-gate.js +0 -451
- package/scripts/lib/guidance-builder.js +0 -174
- package/scripts/lib/hook-apply.js +0 -1019
- package/scripts/lib/hook-baseline.js +0 -310
- package/scripts/lib/hook-config-preview.js +0 -275
- package/scripts/lib/hook-contracts.js +0 -290
- package/scripts/lib/hook-safety-boundary-readiness.js +0 -80
- package/scripts/lib/host-capability-matrix.js +0 -351
- package/scripts/lib/host-support-context.js +0 -254
- package/scripts/lib/http-hook-action.js +0 -538
- package/scripts/lib/install-ai-readiness.js +0 -84
- package/scripts/lib/install-intake-risk.js +0 -1037
- package/scripts/lib/install-journey-intelligence.js +0 -329
- package/scripts/lib/intervention-guidance.js +0 -57
- package/scripts/lib/known-limitations.js +0 -115
- package/scripts/lib/l8-path-truth.js +0 -146
- package/scripts/lib/launch-hardening-gate.js +0 -436
- package/scripts/lib/launch-readiness.js +0 -628
- package/scripts/lib/learning-memory.js +0 -686
- package/scripts/lib/lifecycle-hooks.js +0 -802
- package/scripts/lib/local-package-smoke.js +0 -423
- package/scripts/lib/local-pricing.js +0 -299
- package/scripts/lib/mcp-enforcement.js +0 -311
- package/scripts/lib/mcp-least-privilege-policy.js +0 -303
- package/scripts/lib/mcp-tool-inventory.js +0 -388
- package/scripts/lib/mcp-tool-risk.js +0 -0
- package/scripts/lib/memory.js +0 -335
- package/scripts/lib/metrics.js +0 -699
- package/scripts/lib/micro-proof.js +0 -133
- package/scripts/lib/next-run-context.js +0 -436
- package/scripts/lib/operating-value.js +0 -1648
- package/scripts/lib/optimization-v3.js +0 -122
- package/scripts/lib/orchestration/adapters/_shared.js +0 -49
- package/scripts/lib/orchestration/adapters/aider.js +0 -18
- package/scripts/lib/orchestration/adapters/claude-code.js +0 -35
- package/scripts/lib/orchestration/adapters/codex.js +0 -35
- package/scripts/lib/orchestration/adapters/gemini-cli.js +0 -18
- package/scripts/lib/orchestration/adapters/git.js +0 -25
- package/scripts/lib/orchestration/adapters/index.js +0 -31
- package/scripts/lib/orchestration/adapters/lm-studio.js +0 -18
- package/scripts/lib/orchestration/adapters/ollama.js +0 -18
- package/scripts/lib/orchestration/adapters/opencode.js +0 -18
- package/scripts/lib/orchestration/adapters/openrouter.js +0 -18
- package/scripts/lib/orchestration/adapters/test-runner.js +0 -25
- package/scripts/lib/orchestration/cli.js +0 -438
- package/scripts/lib/orchestration/execution-manager.js +0 -279
- package/scripts/lib/orchestration/handoff.js +0 -314
- package/scripts/lib/orchestration/index.js +0 -456
- package/scripts/lib/orchestration/inventory.js +0 -47
- package/scripts/lib/orchestration/model-discovery.js +0 -498
- package/scripts/lib/orchestration/model-profiler.js +0 -170
- package/scripts/lib/orchestration/model-profiles.js +0 -252
- package/scripts/lib/orchestration/model-refresh-policy.js +0 -72
- package/scripts/lib/orchestration/proof-writer.js +0 -349
- package/scripts/lib/orchestration/provider-discovery/aider.js +0 -49
- package/scripts/lib/orchestration/provider-discovery/claude-code.js +0 -56
- package/scripts/lib/orchestration/provider-discovery/codex.js +0 -49
- package/scripts/lib/orchestration/provider-discovery/common.js +0 -186
- package/scripts/lib/orchestration/provider-discovery/gemini.js +0 -106
- package/scripts/lib/orchestration/provider-discovery/lm-studio.js +0 -118
- package/scripts/lib/orchestration/provider-discovery/models-dev.js +0 -12
- package/scripts/lib/orchestration/provider-discovery/ollama.js +0 -100
- package/scripts/lib/orchestration/provider-discovery/opencode.js +0 -47
- package/scripts/lib/orchestration/provider-discovery/openrouter.js +0 -44
- package/scripts/lib/orchestration/risk-classifier.js +0 -130
- package/scripts/lib/orchestration/routing-policy.js +0 -486
- package/scripts/lib/orchestration/settings.js +0 -112
- package/scripts/lib/orchestration/state.js +0 -165
- package/scripts/lib/orchestration/verification-manager.js +0 -138
- package/scripts/lib/output-profiles.js +0 -146
- package/scripts/lib/package-content-audit.js +0 -368
- package/scripts/lib/package-runtime.js +0 -278
- package/scripts/lib/plan-surface.js +0 -53
- package/scripts/lib/plans.js +0 -2318
- package/scripts/lib/policy-provider.js +0 -27
- package/scripts/lib/prelaunch-activation-readiness.js +0 -409
- package/scripts/lib/prelaunch-evidence-store.js +0 -816
- package/scripts/lib/prelaunch-intelligence.js +0 -869
- package/scripts/lib/pricing-experiment.js +0 -118
- package/scripts/lib/pro-moment-events.js +0 -77
- package/scripts/lib/pro-moment-state.js +0 -227
- package/scripts/lib/pro-moments.js +0 -1216
- package/scripts/lib/product-learning-events.js +0 -629
- package/scripts/lib/project-profile.js +0 -555
- package/scripts/lib/prompt-compiler.js +0 -280
- package/scripts/lib/prompt-lint.js +0 -32
- package/scripts/lib/prompt-suggestions.js +0 -52
- package/scripts/lib/proof-canonical.js +0 -398
- package/scripts/lib/proof-drilldown.js +0 -383
- package/scripts/lib/proof-events.js +0 -342
- package/scripts/lib/proof-history.js +0 -243
- package/scripts/lib/proof-metrics.js +0 -296
- package/scripts/lib/proof-outcome-evidence.js +0 -134
- package/scripts/lib/proof-receipt.js +0 -335
- package/scripts/lib/proof-record.js +0 -461
- package/scripts/lib/public-activation-distribution-gate.js +0 -258
- package/scripts/lib/public-cli.js +0 -3891
- package/scripts/lib/public-distribution-truth.js +0 -211
- package/scripts/lib/public-install-claim-checker.js +0 -294
- package/scripts/lib/publish-provenance-readiness.js +0 -283
- package/scripts/lib/readiness-delta.js +0 -218
- package/scripts/lib/readiness-evidence-closure.js +0 -196
- package/scripts/lib/reentry-memory-capture.js +0 -241
- package/scripts/lib/reentry-memory-retrieval.js +0 -302
- package/scripts/lib/reentry-memory-status.js +0 -146
- package/scripts/lib/reentry-memory-store.js +0 -178
- package/scripts/lib/reentry-state.js +0 -66
- package/scripts/lib/release-candidate-bundle.js +0 -166
- package/scripts/lib/remediation.js +0 -81
- package/scripts/lib/repo-map.js +0 -391
- package/scripts/lib/run-improvements-lifecycle.js +0 -330
- package/scripts/lib/run-improvements.js +0 -789
- package/scripts/lib/runtime-decision-policy.js +0 -387
- package/scripts/lib/safe-path-engine.js +0 -705
- package/scripts/lib/safe-run-controller.js +0 -887
- package/scripts/lib/score.js +0 -262
- package/scripts/lib/seamless-enforcement.js +0 -329
- package/scripts/lib/seamless-outcome.js +0 -689
- package/scripts/lib/seamless-reality-gate.js +0 -5043
- package/scripts/lib/security-risk-classifier.js +0 -511
- package/scripts/lib/security-scan.js +0 -384
- package/scripts/lib/session-context-optimizer.js +0 -1211
- package/scripts/lib/session-timing.js +0 -315
- package/scripts/lib/skill-hygiene.js +0 -805
- package/scripts/lib/skill-packs.js +0 -161
- package/scripts/lib/skills-operating-layer.js +0 -580
- package/scripts/lib/smart-work-routing.js +0 -768
- package/scripts/lib/source-catalog.js +0 -700
- package/scripts/lib/status-value-summary.js +0 -32
- package/scripts/lib/support-bundle.js +0 -578
- package/scripts/lib/task-continuation.js +0 -440
- package/scripts/lib/test-helpers.js +0 -15
- package/scripts/lib/tier.js +0 -38
- package/scripts/lib/token-context-quality-gate.js +0 -370
- package/scripts/lib/token-cost-capture.js +0 -187
- package/scripts/lib/token-cost-intelligence.js +0 -358
- package/scripts/lib/token-efficiency-evidence.js +0 -213
- package/scripts/lib/token-evidence.js +0 -699
- package/scripts/lib/tokenish.js +0 -17
- package/scripts/lib/tool-output-sandbox.js +0 -304
- package/scripts/lib/trust-audit.js +0 -136
- package/scripts/lib/unified-events.js +0 -396
- package/scripts/lib/upgrade-interruption-recovery.js +0 -407
- package/scripts/lib/usage-ledger.js +0 -201
- package/scripts/lib/value-ledger.js +0 -130
- package/scripts/lib/value-proof-calibration.js +0 -531
- package/scripts/lib/visual-qa.js +0 -231
- package/scripts/lib/voice-alpha.js +0 -29
- package/scripts/lib/work-aware-orchestration.js +0 -976
- package/scripts/lib/work-control-receipts.js +0 -577
- package/scripts/lib/work-ledger.js +0 -1123
- package/scripts/lib/work-panel-preview.js +0 -352
- package/scripts/lib/workflow-discipline.js +0 -280
- package/scripts/lib/workflow-signals.js +0 -419
- package/scripts/lib/workspace-map.js +0 -281
- package/scripts/lib/workspace-registry.js +0 -1367
- package/scripts/lib/workspace-resolver.js +0 -480
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const fs = require("node:fs");
|
|
4
|
-
const path = require("node:path");
|
|
5
|
-
|
|
6
|
-
const CONTRACT = "avorelo.adapterReadiness.v1";
|
|
7
|
-
const SCHEMA_VERSION = 1;
|
|
8
|
-
|
|
9
|
-
const READINESS_DIR_REL = ".claude/cco/orchestration/adapter-readiness";
|
|
10
|
-
const LATEST_READINESS_REL = `${READINESS_DIR_REL}/latest-readiness.json`;
|
|
11
|
-
|
|
12
|
-
// Host detection config — expanded to all 7 hosts (PR #163)
|
|
13
|
-
const HOST_CONFIGS = Object.freeze([
|
|
14
|
-
{
|
|
15
|
-
host: "cli",
|
|
16
|
-
label: "CLI (local)",
|
|
17
|
-
configPaths: [],
|
|
18
|
-
hookConfigPath: null,
|
|
19
|
-
markers: [],
|
|
20
|
-
fallback: true,
|
|
21
|
-
alwaysAvailable: true,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
host: "claude_code",
|
|
25
|
-
label: "Claude Code",
|
|
26
|
-
configPaths: [".claude/settings.json", ".claude/settings.local.json"],
|
|
27
|
-
hookConfigPath: ".claude/settings.json",
|
|
28
|
-
markers: [".claude"],
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
host: "codex",
|
|
32
|
-
label: "Codex CLI",
|
|
33
|
-
configPaths: ["codex.yaml", ".codex/config.yaml"],
|
|
34
|
-
hookConfigPath: null,
|
|
35
|
-
markers: ["codex.yaml", ".codex"],
|
|
36
|
-
partialOnly: true,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
host: "vscode",
|
|
40
|
-
label: "VS Code",
|
|
41
|
-
configPaths: [".vscode/settings.json"],
|
|
42
|
-
hookConfigPath: null,
|
|
43
|
-
markers: [".vscode"],
|
|
44
|
-
partialOnly: true,
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
host: "cursor",
|
|
48
|
-
label: "Cursor",
|
|
49
|
-
configPaths: [".cursor/settings.json"],
|
|
50
|
-
hookConfigPath: null,
|
|
51
|
-
markers: [".cursor"],
|
|
52
|
-
partialOnly: true,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
host: "openhands",
|
|
56
|
-
label: "OpenHands",
|
|
57
|
-
configPaths: [".openhands/config.yaml", ".openhands/hooks.json"],
|
|
58
|
-
hookConfigPath: ".openhands/hooks.json",
|
|
59
|
-
markers: [".openhands"],
|
|
60
|
-
unsupportedUnlessDetected: true,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
host: "unknown",
|
|
64
|
-
label: "Unknown/Generic",
|
|
65
|
-
configPaths: [],
|
|
66
|
-
hookConfigPath: null,
|
|
67
|
-
markers: [],
|
|
68
|
-
fallback: true,
|
|
69
|
-
},
|
|
70
|
-
]);
|
|
71
|
-
|
|
72
|
-
function ensureDir(dir) {
|
|
73
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function nowIso() {
|
|
77
|
-
return new Date().toISOString();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function safeWriteJson(filePath, data) {
|
|
81
|
-
ensureDir(path.dirname(filePath));
|
|
82
|
-
fs.writeFileSync(filePath, `${JSON.stringify(data, null, 2)}\n`, "utf8");
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function safeExists(p) {
|
|
86
|
-
try {
|
|
87
|
-
return fs.existsSync(p);
|
|
88
|
-
} catch {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function safeReadJson(filePath) {
|
|
94
|
-
try {
|
|
95
|
-
return JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
96
|
-
} catch {
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function detectHost(cwd, hostConfig) {
|
|
102
|
-
if (hostConfig.fallback) {
|
|
103
|
-
return {
|
|
104
|
-
host: hostConfig.host,
|
|
105
|
-
label: hostConfig.label,
|
|
106
|
-
detected: false, // generic_cli is a fallback, not detected via markers
|
|
107
|
-
fallback: true,
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
for (const marker of hostConfig.markers) {
|
|
112
|
-
if (safeExists(path.join(cwd, marker))) {
|
|
113
|
-
return {
|
|
114
|
-
host: hostConfig.host,
|
|
115
|
-
label: hostConfig.label,
|
|
116
|
-
detected: true,
|
|
117
|
-
fallback: false,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return {
|
|
123
|
-
host: hostConfig.host,
|
|
124
|
-
label: hostConfig.label,
|
|
125
|
-
detected: false,
|
|
126
|
-
fallback: false,
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function inspectHostConfig(cwd, hostConfig) {
|
|
131
|
-
const detection = detectHost(cwd, hostConfig);
|
|
132
|
-
const result = {
|
|
133
|
-
host: hostConfig.host,
|
|
134
|
-
label: hostConfig.label,
|
|
135
|
-
detected: detection.detected,
|
|
136
|
-
fallback: detection.fallback || false,
|
|
137
|
-
configPath: hostConfig.hookConfigPath,
|
|
138
|
-
existingConfig: null,
|
|
139
|
-
configValid: null,
|
|
140
|
-
safeToAutoModify: false, // Always false — never auto-modify
|
|
141
|
-
previewAvailable: false,
|
|
142
|
-
reasonCodes: [],
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
if (!detection.detected && !detection.fallback) {
|
|
146
|
-
result.reasonCodes.push("HOST_NOT_DETECTED");
|
|
147
|
-
return result;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Check for existing hook config
|
|
151
|
-
if (hostConfig.hookConfigPath) {
|
|
152
|
-
const configAbs = path.join(cwd, hostConfig.hookConfigPath);
|
|
153
|
-
if (safeExists(configAbs)) {
|
|
154
|
-
const parsed = safeReadJson(configAbs);
|
|
155
|
-
if (parsed !== null) {
|
|
156
|
-
result.existingConfig = { present: true, valid: true, redacted: true };
|
|
157
|
-
result.configValid = true;
|
|
158
|
-
result.reasonCodes.push("CONFIG_FOUND", "CONFIG_VALID");
|
|
159
|
-
} else {
|
|
160
|
-
result.existingConfig = { present: true, valid: false, redacted: true };
|
|
161
|
-
result.configValid = false;
|
|
162
|
-
result.reasonCodes.push("CONFIG_FOUND", "CONFIG_INVALID_JSON");
|
|
163
|
-
}
|
|
164
|
-
} else {
|
|
165
|
-
result.existingConfig = { present: false };
|
|
166
|
-
result.configValid = null;
|
|
167
|
-
result.reasonCodes.push("NO_EXISTING_CONFIG");
|
|
168
|
-
}
|
|
169
|
-
// Preview is available for any detected host with a known config path
|
|
170
|
-
result.previewAvailable = true;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (detection.fallback) {
|
|
174
|
-
result.previewAvailable = true;
|
|
175
|
-
result.reasonCodes.push("GENERIC_CLI_FALLBACK");
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return result;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function detectAdapterReadiness(cwd, options = {}) {
|
|
182
|
-
const hosts = HOST_CONFIGS.map((hc) => inspectHostConfig(cwd, hc));
|
|
183
|
-
|
|
184
|
-
const detectedHosts = hosts.filter((h) => h.detected && !h.fallback);
|
|
185
|
-
const hasDetected = detectedHosts.length > 0;
|
|
186
|
-
|
|
187
|
-
let status;
|
|
188
|
-
if (hasDetected) {
|
|
189
|
-
const allValid = detectedHosts.every((h) => h.configValid !== false);
|
|
190
|
-
const anyInvalid = detectedHosts.some((h) => h.configValid === false);
|
|
191
|
-
if (anyInvalid) {
|
|
192
|
-
status = "needs_review";
|
|
193
|
-
} else {
|
|
194
|
-
status = "partial"; // detected but hooks not installed yet
|
|
195
|
-
}
|
|
196
|
-
} else {
|
|
197
|
-
status = "partial"; // generic_cli fallback available
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return { hosts, status, hasDetected };
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// ── Adapter Signal Collection (PR #163) ──────────────────────────────────────
|
|
204
|
-
|
|
205
|
-
function collectAdapterSignals(cwd, options) {
|
|
206
|
-
options = options || {};
|
|
207
|
-
function safeArtifact(rel) {
|
|
208
|
-
try {
|
|
209
|
-
const p = path.join(cwd, rel);
|
|
210
|
-
if (!fs.existsSync(p)) return null;
|
|
211
|
-
return JSON.parse(fs.readFileSync(p, "utf8").replace(/^/, ""));
|
|
212
|
-
} catch { return null; }
|
|
213
|
-
}
|
|
214
|
-
return {
|
|
215
|
-
hostCapabilityMatrix: safeArtifact(".claude/cco/orchestration/adapter-readiness/latest-host-capability-matrix.json"),
|
|
216
|
-
crossHostInstall: safeArtifact(".claude/cco/orchestration/adapter-readiness/latest-cross-host-install.json"),
|
|
217
|
-
crossHostInstallPlan: safeArtifact(".claude/cco/orchestration/adapter-readiness/latest-install-plan.json"),
|
|
218
|
-
crossHostValueFlow: safeArtifact(".claude/cco/orchestration/adapter-readiness/latest-cross-host-value-flow.json"),
|
|
219
|
-
adapterSafetyBoundaries: safeArtifact(".claude/cco/orchestration/adapter-readiness/latest-adapter-safety-boundaries.json"),
|
|
220
|
-
hostSupportContext: safeArtifact(".claude/cco/orchestration/adapter-readiness/latest-host-support-context.json"),
|
|
221
|
-
browserProofPreflight: safeArtifact(".claude/cco/orchestration/adapter-readiness/latest-browser-proof-preflight.json"),
|
|
222
|
-
technicalGate: safeArtifact(".claude/cco/orchestration/adapter-readiness/latest-technical-gate.json"),
|
|
223
|
-
supportBundle: safeArtifact(".claude/cco/support/latest-support-bundle.json"),
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function scoreAdapterReadiness(signals, options) {
|
|
228
|
-
options = options || {};
|
|
229
|
-
// If technical gate is available, use its score
|
|
230
|
-
if (signals && signals.technicalGate && typeof signals.technicalGate.score === "number") {
|
|
231
|
-
return {
|
|
232
|
-
score: signals.technicalGate.score,
|
|
233
|
-
verdict: signals.technicalGate.verdict || (signals.technicalGate.score >= 90 ? "adapter_ready" : signals.technicalGate.score >= 60 ? "adapter_partial" : "adapter_not_ready"),
|
|
234
|
-
basis: "technical_gate",
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
// Compute from sub-signal statuses
|
|
238
|
-
const weights = { adapterSafetyBoundaries: 25, crossHostValueFlow: 20, hostCapabilityMatrix: 15, crossHostInstall: 15, hostSupportContext: 15, browserProofPreflight: 10 };
|
|
239
|
-
const statusScore = { pass: 1.0, warn: 0.5, blocked: 0.0, info: 1.0 };
|
|
240
|
-
let earned = 0;
|
|
241
|
-
const total = Object.values(weights).reduce(function(a, b) { return a + b; }, 0);
|
|
242
|
-
Object.keys(weights).forEach(function(key) {
|
|
243
|
-
const sig = signals && signals[key];
|
|
244
|
-
const s = (sig && sig.status) || "warn";
|
|
245
|
-
earned += weights[key] * (statusScore[s] != null ? statusScore[s] : 0.5);
|
|
246
|
-
});
|
|
247
|
-
const score = Math.round((earned / total) * 100);
|
|
248
|
-
return {
|
|
249
|
-
score,
|
|
250
|
-
verdict: score >= 90 ? "adapter_ready" : score >= 60 ? "adapter_partial" : "adapter_not_ready",
|
|
251
|
-
basis: "signal_aggregation",
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
function detectHostCapabilities(cwd, options) {
|
|
256
|
-
// Returns per-host detection + capabilities from host-capability-matrix if available
|
|
257
|
-
try {
|
|
258
|
-
const { HOST_DEFS, inspectHostCapabilities } = require("./host-capability-matrix");
|
|
259
|
-
return HOST_DEFS.map(function(def) { return inspectHostCapabilities(cwd, def); });
|
|
260
|
-
} catch (e) {
|
|
261
|
-
// Fallback: use local HOST_CONFIGS
|
|
262
|
-
return HOST_CONFIGS.map(function(hc) { return inspectHostConfig(cwd, hc); });
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
function classifyHostStatus(hostConfig, inspected) {
|
|
267
|
-
// cli/unknown/generic_cli fallback: always ready
|
|
268
|
-
if (hostConfig.alwaysAvailable || hostConfig.host === "cli" || hostConfig.host === "unknown") return "ready";
|
|
269
|
-
if (inspected.detected) {
|
|
270
|
-
// Never claim fully "ready" without verified evidence — use "partial"
|
|
271
|
-
return "partial";
|
|
272
|
-
}
|
|
273
|
-
// Not detected
|
|
274
|
-
if (hostConfig.unsupportedUnlessDetected) return "unsupported";
|
|
275
|
-
if (hostConfig.partialOnly) return "unknown";
|
|
276
|
-
return "unknown";
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
function buildAdapterReadiness(cwd, options = {}) {
|
|
280
|
-
const { hosts, status: detectedStatus, hasDetected } = detectAdapterReadiness(cwd, options);
|
|
281
|
-
const signals = collectAdapterSignals(cwd, options);
|
|
282
|
-
const { score, verdict, basis } = scoreAdapterReadiness(signals, options);
|
|
283
|
-
|
|
284
|
-
// Build hostStatuses from detection
|
|
285
|
-
const hostStatuses = {};
|
|
286
|
-
HOST_CONFIGS.forEach(function(hc) {
|
|
287
|
-
const inspected = hosts.find(function(h) { return h.host === hc.host; }) || { detected: false };
|
|
288
|
-
hostStatuses[hc.host] = classifyHostStatus(hc, inspected);
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
const readyHosts = Object.keys(hostStatuses).filter(function(k) { return hostStatuses[k] === "ready"; });
|
|
292
|
-
const partialHosts = Object.keys(hostStatuses).filter(function(k) { return hostStatuses[k] === "partial"; });
|
|
293
|
-
const unsupportedHosts = Object.keys(hostStatuses).filter(function(k) { return hostStatuses[k] === "unsupported"; });
|
|
294
|
-
|
|
295
|
-
const blockers = [];
|
|
296
|
-
const warnings = [];
|
|
297
|
-
|
|
298
|
-
// CLI must always be ready
|
|
299
|
-
if (!readyHosts.includes("cli")) {
|
|
300
|
-
blockers.push({ id: "cli_not_ready", message: "CLI host is not available — local path broken." });
|
|
301
|
-
}
|
|
302
|
-
if (unsupportedHosts.length > 0) {
|
|
303
|
-
warnings.push({ id: "unsupported_hosts", message: "Unsupported hosts caveated: " + unsupportedHosts.join(", ") });
|
|
304
|
-
}
|
|
305
|
-
if (score < 60 && !blockers.length) {
|
|
306
|
-
warnings.push({ id: "low_score", message: "Adapter readiness score " + score + "/100 — run sub-module commands to improve." });
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
const status = blockers.length > 0 ? "blocked" : (score >= 90 && !warnings.length) ? "pass" : "warn";
|
|
310
|
-
|
|
311
|
-
let recommendedNextPr;
|
|
312
|
-
if (blockers.length > 0) recommendedNextPr = "Repair: CLI adapter path broken";
|
|
313
|
-
else if (score >= 90) recommendedNextPr = "Alpha Launch Candidate Prep";
|
|
314
|
-
else if (score >= 60) recommendedNextPr = "Run cross-host sub-module commands to improve score";
|
|
315
|
-
else recommendedNextPr = "Run: node bin/avorelo adapter-readiness-technical --json";
|
|
316
|
-
|
|
317
|
-
const recommendedMode = "preview_only";
|
|
318
|
-
let nextAction;
|
|
319
|
-
if (detectedStatus === "needs_review") {
|
|
320
|
-
nextAction = "Review invalid config file(s) before applying hook preview.";
|
|
321
|
-
} else if (hasDetected) {
|
|
322
|
-
nextAction = "Review the generated hook config preview. Apply requires explicit user approval.";
|
|
323
|
-
} else {
|
|
324
|
-
nextAction = "No host adapter detected. CLI fallback available.";
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
return {
|
|
328
|
-
contract: CONTRACT,
|
|
329
|
-
schemaVersion: SCHEMA_VERSION,
|
|
330
|
-
createdAt: nowIso(),
|
|
331
|
-
status,
|
|
332
|
-
score,
|
|
333
|
-
verdict,
|
|
334
|
-
scoreBasis: basis,
|
|
335
|
-
hosts,
|
|
336
|
-
hostStatuses,
|
|
337
|
-
readyHosts,
|
|
338
|
-
partialHosts,
|
|
339
|
-
unsupportedHosts,
|
|
340
|
-
blockers,
|
|
341
|
-
warnings,
|
|
342
|
-
recommendedNextPr,
|
|
343
|
-
recommendedMode,
|
|
344
|
-
nextAction,
|
|
345
|
-
approvalRequiredBeforeApply: true,
|
|
346
|
-
noWorksEverywhereClaim: true,
|
|
347
|
-
noPublicLaunchClaim: true,
|
|
348
|
-
redacted: true,
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
function writeAdapterReadiness(cwd, readiness) {
|
|
353
|
-
const absPath = path.join(cwd, LATEST_READINESS_REL);
|
|
354
|
-
ensureDir(path.dirname(absPath));
|
|
355
|
-
safeWriteJson(absPath, readiness);
|
|
356
|
-
return { path: LATEST_READINESS_REL, written: true };
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
function buildAdapterReadinessSurface(cwd, options = {}) {
|
|
360
|
-
const readiness = buildAdapterReadiness(cwd, options);
|
|
361
|
-
const writeResult = writeAdapterReadiness(cwd, readiness);
|
|
362
|
-
return { readiness, writeResult };
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
function formatAdapterReadinessText(readiness, options = {}) {
|
|
366
|
-
const debug = options.debug || false;
|
|
367
|
-
const lines = [`Avorelo adapter readiness: ${readiness.status}.`, ""];
|
|
368
|
-
|
|
369
|
-
const detected = (readiness.hosts || []).filter((h) => h.detected && !h.fallback);
|
|
370
|
-
const fallback = (readiness.hosts || []).filter((h) => h.fallback);
|
|
371
|
-
|
|
372
|
-
if (detected.length > 0) {
|
|
373
|
-
lines.push("Detected hosts:");
|
|
374
|
-
for (const h of detected) {
|
|
375
|
-
const configNote = h.existingConfig && h.existingConfig.present && h.existingConfig.valid
|
|
376
|
-
? "existing config valid"
|
|
377
|
-
: h.existingConfig && h.existingConfig.present && h.existingConfig.valid === false
|
|
378
|
-
? "existing config invalid — needs review"
|
|
379
|
-
: "no existing config";
|
|
380
|
-
lines.push(` - ${h.label}: ${configNote}`);
|
|
381
|
-
}
|
|
382
|
-
} else {
|
|
383
|
-
lines.push("No host adapter detected. Generic CLI fallback available.");
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
lines.push("", `Recommended mode: ${readiness.recommendedMode}`);
|
|
387
|
-
lines.push("Safe to auto-modify: false (approval required before any config change)");
|
|
388
|
-
lines.push(`Next: ${readiness.nextAction}`);
|
|
389
|
-
|
|
390
|
-
if (debug) {
|
|
391
|
-
lines.push("", "All hosts:");
|
|
392
|
-
for (const h of readiness.hosts || []) {
|
|
393
|
-
lines.push(` [${h.host}] detected=${h.detected} previewAvailable=${h.previewAvailable} configPath=${h.configPath || "none"}`);
|
|
394
|
-
if (h.reasonCodes && h.reasonCodes.length > 0) {
|
|
395
|
-
lines.push(` Reason codes: ${h.reasonCodes.join(", ")}`);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
return lines.join("\n");
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
module.exports = {
|
|
404
|
-
CONTRACT,
|
|
405
|
-
SCHEMA_VERSION,
|
|
406
|
-
LATEST_READINESS_REL,
|
|
407
|
-
HOST_CONFIGS,
|
|
408
|
-
detectAdapterReadiness,
|
|
409
|
-
buildAdapterReadiness,
|
|
410
|
-
writeAdapterReadiness,
|
|
411
|
-
collectAdapterSignals,
|
|
412
|
-
scoreAdapterReadiness,
|
|
413
|
-
detectHostCapabilities,
|
|
414
|
-
classifyHostStatus,
|
|
415
|
-
buildAdapterReadinessSurface,
|
|
416
|
-
formatAdapterReadinessText,
|
|
417
|
-
};
|