avorelo 0.1.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 +21 -0
- package/README.md +56 -0
- package/bin/avorelo +9 -0
- package/package.json +135 -0
- package/scripts/README.md +40 -0
- package/scripts/cco-dashboard.js +252 -0
- package/scripts/cco-status.js +430 -0
- package/scripts/lib/activation/account-state.js +37 -0
- package/scripts/lib/activation/activation-runner.js +546 -0
- package/scripts/lib/activation/activation-self-healing.js +480 -0
- package/scripts/lib/activation/activation-state.js +83 -0
- package/scripts/lib/activation/activation-summary.js +191 -0
- package/scripts/lib/activation/adapters/claude-code.js +77 -0
- package/scripts/lib/activation/adapters/codex-cli.js +52 -0
- package/scripts/lib/activation/adapters/cursor.js +37 -0
- package/scripts/lib/activation/adapters/github-agent.js +39 -0
- package/scripts/lib/activation/adapters/terminal.js +42 -0
- package/scripts/lib/activation/adapters/vscode.js +39 -0
- package/scripts/lib/activation/adapters/windsurf.js +37 -0
- package/scripts/lib/activation/ai-surface-detector.js +151 -0
- package/scripts/lib/activation/connect-account.js +145 -0
- package/scripts/lib/activation/detect-environment.js +75 -0
- package/scripts/lib/activation/detect-hosts.js +62 -0
- package/scripts/lib/activation/format-activation-output.js +109 -0
- package/scripts/lib/activation/next-action.js +43 -0
- package/scripts/lib/activation/repair-engine.js +219 -0
- package/scripts/lib/activation-distribution-readiness.js +507 -0
- package/scripts/lib/adapter-conformance.js +176 -0
- package/scripts/lib/adapter-readiness.js +417 -0
- package/scripts/lib/adapter-safety-boundaries.js +335 -0
- package/scripts/lib/adapter-technical-readiness-gate.js +205 -0
- package/scripts/lib/agent-access-governance.js +455 -0
- package/scripts/lib/agent-enforcement.js +765 -0
- package/scripts/lib/agent-policy-profile.js +210 -0
- package/scripts/lib/agent-security/action-evaluator.js +507 -0
- package/scripts/lib/agent-security/adapter-registry.js +98 -0
- package/scripts/lib/agent-security/auto-policy.js +139 -0
- package/scripts/lib/agent-security/bounded-scan.js +93 -0
- package/scripts/lib/agent-security/enforcement-adapter.js +174 -0
- package/scripts/lib/agent-security/enforcement-engine.js +1129 -0
- package/scripts/lib/agent-security/file-write-adapter.js +183 -0
- package/scripts/lib/agent-security/file-write-rules.js +178 -0
- package/scripts/lib/agent-security/index.js +3342 -0
- package/scripts/lib/agent-security/instruction-risk.js +181 -0
- package/scripts/lib/agent-security/mcp-action-adapter.js +185 -0
- package/scripts/lib/agent-security/mcp-action-rules.js +184 -0
- package/scripts/lib/agent-security/package-action-adapter.js +175 -0
- package/scripts/lib/agent-security/package-action-rules.js +233 -0
- package/scripts/lib/agent-security/performance.js +148 -0
- package/scripts/lib/agent-security/permission-minimizer.js +403 -0
- package/scripts/lib/agent-security/scan-cache.js +74 -0
- package/scripts/lib/agent-security/source-trust.js +146 -0
- package/scripts/lib/ai-install-prompt.js +288 -0
- package/scripts/lib/ai-workspace-hygiene.js +1499 -0
- package/scripts/lib/alpha-activation.js +520 -0
- package/scripts/lib/alpha-feedback.js +263 -0
- package/scripts/lib/alpha-readiness-gate.js +332 -0
- package/scripts/lib/anti-gaming.js +169 -0
- package/scripts/lib/artifact-health.js +431 -0
- package/scripts/lib/attribution.js +180 -0
- package/scripts/lib/audit.js +289 -0
- package/scripts/lib/avorelo-skill-registry.js +810 -0
- package/scripts/lib/batch-jobs.js +71 -0
- package/scripts/lib/brain-pack.js +578 -0
- package/scripts/lib/brand-boundary.js +424 -0
- package/scripts/lib/brand.js +74 -0
- package/scripts/lib/browser-capability.js +1048 -0
- package/scripts/lib/browser-proof-preflight.js +321 -0
- package/scripts/lib/cache-readiness.js +187 -0
- package/scripts/lib/canonical-reentry.js +162 -0
- package/scripts/lib/capability-packs.js +314 -0
- package/scripts/lib/capability-recommender.js +512 -0
- package/scripts/lib/capability-registry.js +1059 -0
- package/scripts/lib/carry-forward-surfacing.js +194 -0
- package/scripts/lib/ccusage-adapter.js +188 -0
- package/scripts/lib/company-loop.js +1149 -0
- package/scripts/lib/config.js +637 -0
- package/scripts/lib/context-acquisition-plan.js +287 -0
- package/scripts/lib/context-budget-guard.js +170 -0
- package/scripts/lib/context-budget-scanner.js +257 -0
- package/scripts/lib/context-optimizer.js +715 -0
- package/scripts/lib/context-reduction-plan.js +178 -0
- package/scripts/lib/context-safety.js +88 -0
- package/scripts/lib/context-savings-engine.js +158 -0
- package/scripts/lib/cost-evidence.js +254 -0
- package/scripts/lib/cross-host-install-plan.js +308 -0
- package/scripts/lib/cross-host-install-readiness.js +237 -0
- package/scripts/lib/cross-host-value-flow.js +268 -0
- package/scripts/lib/dashboard.js +900 -0
- package/scripts/lib/design-partner-feedback.js +346 -0
- package/scripts/lib/entitlements.js +100 -0
- package/scripts/lib/execution-packet.js +559 -0
- package/scripts/lib/experimentation-events.js +547 -0
- package/scripts/lib/external-capability-compliance.js +107 -0
- package/scripts/lib/external-user-simulation.js +166 -0
- package/scripts/lib/failure-recovery-readiness.js +81 -0
- package/scripts/lib/failure-recovery.js +419 -0
- package/scripts/lib/feedback-intelligence.js +537 -0
- package/scripts/lib/feedback-signals.js +205 -0
- package/scripts/lib/file-integrity.js +68 -0
- package/scripts/lib/fsx.js +127 -0
- package/scripts/lib/full-readiness-gate.js +451 -0
- package/scripts/lib/guidance-builder.js +174 -0
- package/scripts/lib/hook-apply.js +1019 -0
- package/scripts/lib/hook-baseline.js +310 -0
- package/scripts/lib/hook-config-preview.js +275 -0
- package/scripts/lib/hook-contracts.js +290 -0
- package/scripts/lib/hook-safety-boundary-readiness.js +80 -0
- package/scripts/lib/host-capability-matrix.js +351 -0
- package/scripts/lib/host-support-context.js +254 -0
- package/scripts/lib/http-hook-action.js +538 -0
- package/scripts/lib/install-ai-readiness.js +84 -0
- package/scripts/lib/install-intake-risk.js +1037 -0
- package/scripts/lib/install-journey-intelligence.js +329 -0
- package/scripts/lib/intervention-guidance.js +57 -0
- package/scripts/lib/known-limitations.js +115 -0
- package/scripts/lib/l8-path-truth.js +146 -0
- package/scripts/lib/launch-hardening-gate.js +436 -0
- package/scripts/lib/launch-readiness.js +628 -0
- package/scripts/lib/learning-memory.js +686 -0
- package/scripts/lib/lifecycle-hooks.js +802 -0
- package/scripts/lib/local-package-smoke.js +423 -0
- package/scripts/lib/local-pricing.js +299 -0
- package/scripts/lib/mcp-enforcement.js +311 -0
- package/scripts/lib/mcp-least-privilege-policy.js +303 -0
- package/scripts/lib/mcp-tool-inventory.js +388 -0
- package/scripts/lib/mcp-tool-risk.js +0 -0
- package/scripts/lib/memory.js +335 -0
- package/scripts/lib/metrics.js +699 -0
- package/scripts/lib/micro-proof.js +133 -0
- package/scripts/lib/next-run-context.js +436 -0
- package/scripts/lib/operating-value.js +1648 -0
- package/scripts/lib/optimization-v3.js +122 -0
- package/scripts/lib/orchestration/adapters/_shared.js +49 -0
- package/scripts/lib/orchestration/adapters/aider.js +18 -0
- package/scripts/lib/orchestration/adapters/claude-code.js +35 -0
- package/scripts/lib/orchestration/adapters/codex.js +35 -0
- package/scripts/lib/orchestration/adapters/gemini-cli.js +18 -0
- package/scripts/lib/orchestration/adapters/git.js +25 -0
- package/scripts/lib/orchestration/adapters/index.js +31 -0
- package/scripts/lib/orchestration/adapters/lm-studio.js +18 -0
- package/scripts/lib/orchestration/adapters/ollama.js +18 -0
- package/scripts/lib/orchestration/adapters/opencode.js +18 -0
- package/scripts/lib/orchestration/adapters/openrouter.js +18 -0
- package/scripts/lib/orchestration/adapters/test-runner.js +25 -0
- package/scripts/lib/orchestration/cli.js +438 -0
- package/scripts/lib/orchestration/execution-manager.js +279 -0
- package/scripts/lib/orchestration/handoff.js +314 -0
- package/scripts/lib/orchestration/index.js +456 -0
- package/scripts/lib/orchestration/inventory.js +47 -0
- package/scripts/lib/orchestration/model-discovery.js +498 -0
- package/scripts/lib/orchestration/model-profiler.js +170 -0
- package/scripts/lib/orchestration/model-profiles.js +252 -0
- package/scripts/lib/orchestration/model-refresh-policy.js +72 -0
- package/scripts/lib/orchestration/proof-writer.js +349 -0
- package/scripts/lib/orchestration/provider-discovery/aider.js +49 -0
- package/scripts/lib/orchestration/provider-discovery/claude-code.js +56 -0
- package/scripts/lib/orchestration/provider-discovery/codex.js +49 -0
- package/scripts/lib/orchestration/provider-discovery/common.js +186 -0
- package/scripts/lib/orchestration/provider-discovery/gemini.js +106 -0
- package/scripts/lib/orchestration/provider-discovery/lm-studio.js +118 -0
- package/scripts/lib/orchestration/provider-discovery/models-dev.js +12 -0
- package/scripts/lib/orchestration/provider-discovery/ollama.js +100 -0
- package/scripts/lib/orchestration/provider-discovery/opencode.js +47 -0
- package/scripts/lib/orchestration/provider-discovery/openrouter.js +44 -0
- package/scripts/lib/orchestration/risk-classifier.js +130 -0
- package/scripts/lib/orchestration/routing-policy.js +486 -0
- package/scripts/lib/orchestration/settings.js +112 -0
- package/scripts/lib/orchestration/state.js +165 -0
- package/scripts/lib/orchestration/verification-manager.js +138 -0
- package/scripts/lib/output-profiles.js +146 -0
- package/scripts/lib/package-content-audit.js +368 -0
- package/scripts/lib/package-runtime.js +278 -0
- package/scripts/lib/plan-surface.js +53 -0
- package/scripts/lib/plans.js +2318 -0
- package/scripts/lib/policy-provider.js +27 -0
- package/scripts/lib/prelaunch-activation-readiness.js +409 -0
- package/scripts/lib/prelaunch-evidence-store.js +816 -0
- package/scripts/lib/prelaunch-intelligence.js +869 -0
- package/scripts/lib/pricing-experiment.js +118 -0
- package/scripts/lib/pro-moment-events.js +77 -0
- package/scripts/lib/pro-moment-state.js +227 -0
- package/scripts/lib/pro-moments.js +1216 -0
- package/scripts/lib/product-learning-events.js +629 -0
- package/scripts/lib/project-profile.js +555 -0
- package/scripts/lib/prompt-compiler.js +280 -0
- package/scripts/lib/prompt-lint.js +32 -0
- package/scripts/lib/prompt-suggestions.js +52 -0
- package/scripts/lib/proof-canonical.js +398 -0
- package/scripts/lib/proof-drilldown.js +383 -0
- package/scripts/lib/proof-events.js +342 -0
- package/scripts/lib/proof-history.js +243 -0
- package/scripts/lib/proof-metrics.js +296 -0
- package/scripts/lib/proof-outcome-evidence.js +134 -0
- package/scripts/lib/proof-receipt.js +335 -0
- package/scripts/lib/proof-record.js +461 -0
- package/scripts/lib/public-activation-distribution-gate.js +258 -0
- package/scripts/lib/public-cli.js +3891 -0
- package/scripts/lib/public-distribution-truth.js +211 -0
- package/scripts/lib/public-install-claim-checker.js +294 -0
- package/scripts/lib/publish-provenance-readiness.js +283 -0
- package/scripts/lib/readiness-delta.js +218 -0
- package/scripts/lib/readiness-evidence-closure.js +196 -0
- package/scripts/lib/reentry-memory-capture.js +241 -0
- package/scripts/lib/reentry-memory-retrieval.js +302 -0
- package/scripts/lib/reentry-memory-status.js +146 -0
- package/scripts/lib/reentry-memory-store.js +178 -0
- package/scripts/lib/reentry-state.js +66 -0
- package/scripts/lib/release-candidate-bundle.js +166 -0
- package/scripts/lib/remediation.js +81 -0
- package/scripts/lib/repo-map.js +391 -0
- package/scripts/lib/run-improvements-lifecycle.js +330 -0
- package/scripts/lib/run-improvements.js +789 -0
- package/scripts/lib/runtime-decision-policy.js +387 -0
- package/scripts/lib/safe-path-engine.js +705 -0
- package/scripts/lib/safe-run-controller.js +887 -0
- package/scripts/lib/score.js +262 -0
- package/scripts/lib/seamless-enforcement.js +329 -0
- package/scripts/lib/seamless-outcome.js +689 -0
- package/scripts/lib/seamless-reality-gate.js +5043 -0
- package/scripts/lib/security-risk-classifier.js +511 -0
- package/scripts/lib/security-scan.js +384 -0
- package/scripts/lib/session-context-optimizer.js +1211 -0
- package/scripts/lib/session-timing.js +315 -0
- package/scripts/lib/skill-hygiene.js +805 -0
- package/scripts/lib/skill-packs.js +161 -0
- package/scripts/lib/skills-operating-layer.js +580 -0
- package/scripts/lib/smart-work-routing.js +768 -0
- package/scripts/lib/source-catalog.js +700 -0
- package/scripts/lib/status-value-summary.js +32 -0
- package/scripts/lib/support-bundle.js +578 -0
- package/scripts/lib/task-continuation.js +440 -0
- package/scripts/lib/test-helpers.js +15 -0
- package/scripts/lib/tier.js +38 -0
- package/scripts/lib/token-context-quality-gate.js +370 -0
- package/scripts/lib/token-cost-capture.js +187 -0
- package/scripts/lib/token-cost-intelligence.js +358 -0
- package/scripts/lib/token-efficiency-evidence.js +213 -0
- package/scripts/lib/token-evidence.js +699 -0
- package/scripts/lib/tokenish.js +17 -0
- package/scripts/lib/tool-output-sandbox.js +304 -0
- package/scripts/lib/trust-audit.js +136 -0
- package/scripts/lib/unified-events.js +396 -0
- package/scripts/lib/upgrade-interruption-recovery.js +407 -0
- package/scripts/lib/usage-ledger.js +201 -0
- package/scripts/lib/value-ledger.js +130 -0
- package/scripts/lib/value-proof-calibration.js +531 -0
- package/scripts/lib/visual-qa.js +231 -0
- package/scripts/lib/voice-alpha.js +29 -0
- package/scripts/lib/work-aware-orchestration.js +976 -0
- package/scripts/lib/work-control-receipts.js +577 -0
- package/scripts/lib/work-ledger.js +1123 -0
- package/scripts/lib/work-panel-preview.js +352 -0
- package/scripts/lib/workflow-discipline.js +280 -0
- package/scripts/lib/workflow-signals.js +419 -0
- package/scripts/lib/workspace-map.js +281 -0
- package/scripts/lib/workspace-registry.js +1367 -0
- package/scripts/lib/workspace-resolver.js +480 -0
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { spawnSync } = require("child_process");
|
|
6
|
+
const { validateInstallClaims } = require("./public-install-claim-checker");
|
|
7
|
+
|
|
8
|
+
const LAUNCH_READINESS_CONTRACT = "avorelo.launchReadiness.v1";
|
|
9
|
+
const LAUNCH_READINESS_SCHEMA_VERSION = 1;
|
|
10
|
+
const DISTRIBUTION_STATES = new Set([
|
|
11
|
+
"private_local_only",
|
|
12
|
+
"local_verified",
|
|
13
|
+
"ready_to_publish",
|
|
14
|
+
"published_verified",
|
|
15
|
+
"publish_blocked",
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
// Files that must exist for a valid CLI install
|
|
19
|
+
const REQUIRED_BIN_ENTRIES = ["bin/avorelo"];
|
|
20
|
+
|
|
21
|
+
// Patterns that must not appear in committed config files (clone-specific paths)
|
|
22
|
+
const ABSOLUTE_PATH_PATTERNS = [
|
|
23
|
+
/\/mnt\/[a-z]\/[A-Za-z]/,
|
|
24
|
+
/^[A-Z]:\\[A-Za-z]/,
|
|
25
|
+
/\/home\/[a-zA-Z0-9_-]+\/[A-Za-z]/,
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
// Runtime artifact dirs that must not be in a shipped package
|
|
29
|
+
const RUNTIME_ARTIFACT_PATTERNS = [
|
|
30
|
+
/^\.claude\/cco\//,
|
|
31
|
+
/^\.avorelo\//,
|
|
32
|
+
/^\.codex-worktree-/,
|
|
33
|
+
/^\.tmp-/,
|
|
34
|
+
/^_wasp_build_tmp\//,
|
|
35
|
+
/^\.wasp\/out\//,
|
|
36
|
+
/handoff-local-state\.txt$/,
|
|
37
|
+
/handoff-worktree-locator\.txt$/,
|
|
38
|
+
/^avorelo-activation-smoke\//,
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
const WORKS_EVERYWHERE_PATTERNS = [
|
|
42
|
+
/works everywhere/i,
|
|
43
|
+
/works on every machine/i,
|
|
44
|
+
/works in every repo/i,
|
|
45
|
+
/works in every environment/i,
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
// Config files tracked in git that should not contain absolute paths
|
|
49
|
+
const CHECKED_CONFIG_FILES = [".codex/config.toml", ".cursor/rules/wuz-project.mdc"];
|
|
50
|
+
|
|
51
|
+
function safeReadJson(absPath) {
|
|
52
|
+
try {
|
|
53
|
+
if (!fs.existsSync(absPath)) return null;
|
|
54
|
+
return JSON.parse(fs.readFileSync(absPath, "utf8"));
|
|
55
|
+
} catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function safeReadText(absPath) {
|
|
61
|
+
try {
|
|
62
|
+
if (!fs.existsSync(absPath)) return null;
|
|
63
|
+
return fs.readFileSync(absPath, "utf8");
|
|
64
|
+
} catch {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function collectMarkdownFiles(dir, collected = [], limit = 200) {
|
|
70
|
+
if (!fs.existsSync(dir) || collected.length >= limit) return collected;
|
|
71
|
+
let entries = [];
|
|
72
|
+
try {
|
|
73
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
74
|
+
} catch {
|
|
75
|
+
return collected;
|
|
76
|
+
}
|
|
77
|
+
for (const entry of entries) {
|
|
78
|
+
if (collected.length >= limit) break;
|
|
79
|
+
const absPath = path.join(dir, entry.name);
|
|
80
|
+
if (entry.isDirectory()) {
|
|
81
|
+
if (/node_modules|\.git|\.tmp|artifacts|vendor/i.test(entry.name)) continue;
|
|
82
|
+
collectMarkdownFiles(absPath, collected, limit);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
86
|
+
collected.push(absPath);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return collected;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function scanWorksEverywhereClaims(repoRoot, opts = {}) {
|
|
93
|
+
if (Array.isArray(opts.worksEverywhereClaims)) {
|
|
94
|
+
return { claims: opts.worksEverywhereClaims };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const claims = [];
|
|
98
|
+
const filesToScan = [];
|
|
99
|
+
const readmePath = path.join(repoRoot, "README.md");
|
|
100
|
+
if (fs.existsSync(readmePath)) filesToScan.push(readmePath);
|
|
101
|
+
collectMarkdownFiles(path.join(repoRoot, "docs"), filesToScan);
|
|
102
|
+
|
|
103
|
+
for (const absPath of filesToScan) {
|
|
104
|
+
const text = safeReadText(absPath);
|
|
105
|
+
if (!text) continue;
|
|
106
|
+
const lines = text.split(/\r?\n/);
|
|
107
|
+
for (let i = 0; i < lines.length; i++) {
|
|
108
|
+
const line = lines[i];
|
|
109
|
+
if (!WORKS_EVERYWHERE_PATTERNS.some((pattern) => pattern.test(line))) continue;
|
|
110
|
+
claims.push({
|
|
111
|
+
file: path.relative(repoRoot, absPath).replace(/\\/g, "/"),
|
|
112
|
+
line: i + 1,
|
|
113
|
+
text: line.trim(),
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return { claims };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function buildLaunchDistributionEvidence(repoRoot, opts = {}) {
|
|
122
|
+
const pkgPath = path.join(repoRoot, "package.json");
|
|
123
|
+
const pkg = safeReadJson(pkgPath);
|
|
124
|
+
const hasPackageJson = !!pkg;
|
|
125
|
+
const hasNpmIgnore = fs.existsSync(path.join(repoRoot, ".npmignore"));
|
|
126
|
+
const hasFilesField = !!(pkg && Array.isArray(pkg.files) && pkg.files.length > 0);
|
|
127
|
+
const distributionEvidence = opts.distributionEvidence || {};
|
|
128
|
+
const explicitState = distributionEvidence.state
|
|
129
|
+
|| (pkg && typeof pkg.avoreloDistributionState === "string" ? pkg.avoreloDistributionState : null);
|
|
130
|
+
const packagePrivate = !!(pkg && pkg.private === true);
|
|
131
|
+
const packagePublic = !!(pkg && pkg.private === false);
|
|
132
|
+
const claimsReport = opts.installClaimsReport || validateInstallClaims(repoRoot);
|
|
133
|
+
const worksEverywhere = scanWorksEverywhereClaims(repoRoot, opts);
|
|
134
|
+
const localSmokePassed = distributionEvidence.localSmokePassed === true;
|
|
135
|
+
const publicSmokePassed = distributionEvidence.publicSmokePassed === true;
|
|
136
|
+
const publishAuthAvailable = distributionEvidence.publishAuthAvailable === true;
|
|
137
|
+
const publishApproved = distributionEvidence.publishApproved === true;
|
|
138
|
+
const packageContentSafe = distributionEvidence.packageContentSafe !== undefined
|
|
139
|
+
? distributionEvidence.packageContentSafe === true
|
|
140
|
+
: (hasNpmIgnore || hasFilesField);
|
|
141
|
+
|
|
142
|
+
const reasons = [];
|
|
143
|
+
let state = explicitState;
|
|
144
|
+
|
|
145
|
+
if (explicitState && !DISTRIBUTION_STATES.has(explicitState)) {
|
|
146
|
+
reasons.push(`Unknown distribution state '${explicitState}'.`);
|
|
147
|
+
state = "publish_blocked";
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (!state) {
|
|
151
|
+
state = packagePrivate ? "private_local_only" : "publish_blocked";
|
|
152
|
+
if (!packagePrivate) {
|
|
153
|
+
reasons.push("package.json is public-ready but no explicit distribution state evidence is present.");
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (state === "private_local_only" && !packagePrivate) {
|
|
158
|
+
reasons.push("private_local_only requires package.json private: true.");
|
|
159
|
+
state = "publish_blocked";
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (state === "local_verified" && packagePublic && !localSmokePassed) {
|
|
163
|
+
reasons.push("local_verified needs explicit local smoke evidence before a public-ready package can pass.");
|
|
164
|
+
state = "publish_blocked";
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (state === "ready_to_publish") {
|
|
168
|
+
if (!packagePublic) {
|
|
169
|
+
reasons.push("ready_to_publish requires package.json private: false.");
|
|
170
|
+
state = "publish_blocked";
|
|
171
|
+
}
|
|
172
|
+
if (!packageContentSafe) {
|
|
173
|
+
reasons.push("ready_to_publish requires package exclusion control or equivalent package-content evidence.");
|
|
174
|
+
state = "publish_blocked";
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (state === "published_verified") {
|
|
179
|
+
if (!packagePublic) {
|
|
180
|
+
reasons.push("published_verified requires package.json private: false.");
|
|
181
|
+
state = "publish_blocked";
|
|
182
|
+
}
|
|
183
|
+
if (!publicSmokePassed) {
|
|
184
|
+
reasons.push("published_verified requires verified public npx smoke evidence.");
|
|
185
|
+
state = "publish_blocked";
|
|
186
|
+
}
|
|
187
|
+
if (!publishAuthAvailable || !publishApproved) {
|
|
188
|
+
reasons.push("published_verified requires explicit publish auth and approval evidence.");
|
|
189
|
+
state = "publish_blocked";
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (state === "publish_blocked" && reasons.length === 0) {
|
|
194
|
+
reasons.push("Distribution state is blocked until public distribution evidence is made explicit.");
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const effectiveBlockedClaims = (claimsReport.blockedClaims || []).filter((claim) => {
|
|
198
|
+
if (state !== "published_verified") return true;
|
|
199
|
+
const reason = String(claim.reason || "");
|
|
200
|
+
return !/not verified|private\/not on npm/i.test(reason);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
if (effectiveBlockedClaims.length > 0) {
|
|
204
|
+
reasons.push("Blocked public install claims detected.");
|
|
205
|
+
state = "publish_blocked";
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (worksEverywhere.claims.length > 0) {
|
|
209
|
+
reasons.push("Works-everywhere claims are not allowed.");
|
|
210
|
+
state = "publish_blocked";
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const publicClaimChecksPass = effectiveBlockedClaims.length === 0;
|
|
214
|
+
const worksEverywherePass = worksEverywhere.claims.length === 0;
|
|
215
|
+
const packageStateAligned = state !== "publish_blocked";
|
|
216
|
+
const checkDetails = {
|
|
217
|
+
explicitState: explicitState || null,
|
|
218
|
+
packagePrivate,
|
|
219
|
+
packagePublic,
|
|
220
|
+
packageContentSafe,
|
|
221
|
+
localSmokePassed,
|
|
222
|
+
publicSmokePassed,
|
|
223
|
+
publishAuthAvailable,
|
|
224
|
+
publishApproved,
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
return {
|
|
228
|
+
state,
|
|
229
|
+
explicitState: explicitState || null,
|
|
230
|
+
packagePrivate,
|
|
231
|
+
packagePublic,
|
|
232
|
+
packageContentSafe,
|
|
233
|
+
hasNpmIgnore,
|
|
234
|
+
hasFilesField,
|
|
235
|
+
localSmokePassed,
|
|
236
|
+
publicSmokePassed,
|
|
237
|
+
publishAuthAvailable,
|
|
238
|
+
publishApproved,
|
|
239
|
+
installClaimsReport: claimsReport,
|
|
240
|
+
effectiveBlockedClaims,
|
|
241
|
+
worksEverywhereClaims: worksEverywhere.claims,
|
|
242
|
+
hasPackageJson,
|
|
243
|
+
reasons,
|
|
244
|
+
checks: [
|
|
245
|
+
{
|
|
246
|
+
id: "package_distribution_state_alignment",
|
|
247
|
+
pass: packageStateAligned,
|
|
248
|
+
blocking: true,
|
|
249
|
+
detail: packageStateAligned
|
|
250
|
+
? `Distribution state ${state} is compatible with launch readiness.`
|
|
251
|
+
: reasons.join(" "),
|
|
252
|
+
evidence: checkDetails,
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
id: "public_install_claims_honest",
|
|
256
|
+
pass: publicClaimChecksPass,
|
|
257
|
+
blocking: true,
|
|
258
|
+
detail: publicClaimChecksPass
|
|
259
|
+
? `Blocked claims: ${claimsReport.blockedCount}. Caveated claims: ${claimsReport.caveatedCount}.`
|
|
260
|
+
: `Blocked claims: ${effectiveBlockedClaims.length}. Public install claims require published_verified.`,
|
|
261
|
+
evidence: {
|
|
262
|
+
blockedCount: effectiveBlockedClaims.length,
|
|
263
|
+
caveatedCount: claimsReport.caveatedCount,
|
|
264
|
+
allowedCount: claimsReport.allowedCount,
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
id: "no_works_everywhere_claim",
|
|
269
|
+
pass: worksEverywherePass,
|
|
270
|
+
blocking: true,
|
|
271
|
+
detail: worksEverywherePass
|
|
272
|
+
? "No works-everywhere claims detected."
|
|
273
|
+
: `Works-everywhere claim found in ${worksEverywhere.claims[0].file}:${worksEverywhere.claims[0].line}.`,
|
|
274
|
+
evidence: {
|
|
275
|
+
claimCount: worksEverywhere.claims.length,
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
id: "published_verified_requires_public_smoke",
|
|
280
|
+
pass: state !== "published_verified" || publicSmokePassed,
|
|
281
|
+
blocking: true,
|
|
282
|
+
detail: state === "published_verified" && !publicSmokePassed
|
|
283
|
+
? "published_verified requires public smoke evidence."
|
|
284
|
+
: "Public smoke evidence gate is aligned with distribution state.",
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
id: "published_verified_requires_publish_approval",
|
|
288
|
+
pass: state !== "published_verified" || (publishAuthAvailable && publishApproved),
|
|
289
|
+
blocking: true,
|
|
290
|
+
detail: state === "published_verified" && (!publishAuthAvailable || !publishApproved)
|
|
291
|
+
? "Publish auth/approval evidence is required before launch readiness can treat the package as published."
|
|
292
|
+
: "Publish approval gate is aligned with distribution state.",
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function evaluatePackageDistributionState(repoRoot, opts = {}) {
|
|
299
|
+
return buildLaunchDistributionEvidence(repoRoot, opts).state;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function buildPackageAudit(repoRoot, opts = {}) {
|
|
303
|
+
const pkgPath = path.join(repoRoot, "package.json");
|
|
304
|
+
const checks = [];
|
|
305
|
+
let runtimeArtifactsFound = [];
|
|
306
|
+
let absolutePathViolations = [];
|
|
307
|
+
|
|
308
|
+
if (!fs.existsSync(pkgPath)) {
|
|
309
|
+
checks.push({ id: "package_json_exists", pass: false, blocking: true, detail: "package.json not found" });
|
|
310
|
+
return {
|
|
311
|
+
checks,
|
|
312
|
+
runtimeArtifactsFound,
|
|
313
|
+
absolutePathViolations,
|
|
314
|
+
distributionState: "publish_blocked",
|
|
315
|
+
distributionEvidence: buildLaunchDistributionEvidence(repoRoot, opts),
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
320
|
+
checks.push({ id: "package_json_exists", pass: true, blocking: true });
|
|
321
|
+
|
|
322
|
+
const binEntries = pkg.bin || {};
|
|
323
|
+
const missingBin = REQUIRED_BIN_ENTRIES.filter(
|
|
324
|
+
(rel) => !Object.values(binEntries).some((value) => value === rel || value.replace(/\\/g, "/") === rel)
|
|
325
|
+
);
|
|
326
|
+
checks.push({
|
|
327
|
+
id: "bin_entry_exists",
|
|
328
|
+
pass: missingBin.length === 0,
|
|
329
|
+
blocking: true,
|
|
330
|
+
detail: missingBin.length ? `Missing bin entries: ${missingBin.join(", ")}` : "bin/avorelo present",
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
for (const [name, rel] of Object.entries(binEntries)) {
|
|
334
|
+
const absPath = path.join(repoRoot, rel);
|
|
335
|
+
checks.push({
|
|
336
|
+
id: `bin_file_${name}`,
|
|
337
|
+
pass: fs.existsSync(absPath),
|
|
338
|
+
blocking: true,
|
|
339
|
+
detail: fs.existsSync(absPath) ? `${rel} exists` : `${rel} not found on disk`,
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
const gitLsResult = spawnSync("git", ["ls-files", "--cached"], {
|
|
344
|
+
cwd: repoRoot,
|
|
345
|
+
encoding: "utf8",
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
if (gitLsResult.status === 0) {
|
|
349
|
+
const trackedFiles = gitLsResult.stdout.trim().split("\n").filter(Boolean);
|
|
350
|
+
runtimeArtifactsFound = trackedFiles.filter((file) =>
|
|
351
|
+
RUNTIME_ARTIFACT_PATTERNS.some((pattern) => pattern.test(file))
|
|
352
|
+
);
|
|
353
|
+
checks.push({
|
|
354
|
+
id: "no_runtime_artifacts_committed",
|
|
355
|
+
pass: runtimeArtifactsFound.length === 0,
|
|
356
|
+
blocking: true,
|
|
357
|
+
detail: runtimeArtifactsFound.length === 0
|
|
358
|
+
? "No runtime artifacts in tracked files"
|
|
359
|
+
: `Runtime artifacts tracked: ${runtimeArtifactsFound.slice(0, 5).join(", ")}`,
|
|
360
|
+
});
|
|
361
|
+
} else {
|
|
362
|
+
checks.push({
|
|
363
|
+
id: "no_runtime_artifacts_committed",
|
|
364
|
+
pass: null,
|
|
365
|
+
blocking: true,
|
|
366
|
+
detail: "Could not run git ls-files",
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
for (const relPath of CHECKED_CONFIG_FILES) {
|
|
371
|
+
const absPath = path.join(repoRoot, relPath);
|
|
372
|
+
if (!fs.existsSync(absPath)) continue;
|
|
373
|
+
const content = fs.readFileSync(absPath, "utf8");
|
|
374
|
+
const lines = content.split("\n");
|
|
375
|
+
for (let i = 0; i < lines.length; i++) {
|
|
376
|
+
for (const pattern of ABSOLUTE_PATH_PATTERNS) {
|
|
377
|
+
if (pattern.test(lines[i])) {
|
|
378
|
+
absolutePathViolations.push({ file: relPath, line: i + 1, content: lines[i].trim() });
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
checks.push({
|
|
384
|
+
id: "no_absolute_paths_in_config",
|
|
385
|
+
pass: absolutePathViolations.length === 0,
|
|
386
|
+
blocking: true,
|
|
387
|
+
detail: absolutePathViolations.length === 0
|
|
388
|
+
? "No absolute paths in committed config files"
|
|
389
|
+
: `Absolute paths found: ${absolutePathViolations.map((violation) => `${violation.file}:${violation.line}`).join(", ")}`,
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
const hasNpmIgnore = fs.existsSync(path.join(repoRoot, ".npmignore"));
|
|
393
|
+
const hasFilesField = Array.isArray(pkg.files) && pkg.files.length > 0;
|
|
394
|
+
checks.push({
|
|
395
|
+
id: "package_exclusion_control",
|
|
396
|
+
pass: hasNpmIgnore || hasFilesField,
|
|
397
|
+
blocking: true,
|
|
398
|
+
detail: hasNpmIgnore
|
|
399
|
+
? ".npmignore present"
|
|
400
|
+
: hasFilesField
|
|
401
|
+
? "package.json files field present"
|
|
402
|
+
: "Neither .npmignore nor files field - npm pack falls back to .gitignore",
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
const distributionEvidence = buildLaunchDistributionEvidence(repoRoot, opts);
|
|
406
|
+
checks.push(...distributionEvidence.checks);
|
|
407
|
+
|
|
408
|
+
if (opts.skipInstallDeliveryValidation !== true) {
|
|
409
|
+
const verifyResult = spawnSync(
|
|
410
|
+
"node",
|
|
411
|
+
["app-scripts/validate-install-delivery.mjs"],
|
|
412
|
+
{ cwd: repoRoot, encoding: "utf8" }
|
|
413
|
+
);
|
|
414
|
+
checks.push({
|
|
415
|
+
id: "install_delivery_validates",
|
|
416
|
+
pass: verifyResult.status === 0,
|
|
417
|
+
blocking: false,
|
|
418
|
+
detail: verifyResult.status === 0
|
|
419
|
+
? "validate-install-delivery passed"
|
|
420
|
+
: (verifyResult.stderr || verifyResult.stdout || "").trim(),
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return {
|
|
425
|
+
checks,
|
|
426
|
+
runtimeArtifactsFound,
|
|
427
|
+
absolutePathViolations,
|
|
428
|
+
distributionState: distributionEvidence.state,
|
|
429
|
+
distributionEvidence,
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
function buildExternalRepoCheck(repoRoot, externalCwd) {
|
|
434
|
+
const checks = [];
|
|
435
|
+
|
|
436
|
+
if (!fs.existsSync(externalCwd)) {
|
|
437
|
+
checks.push({ id: "external_dir_exists", pass: false, blocking: true, detail: `External dir not found: ${externalCwd}` });
|
|
438
|
+
return { checks };
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
const pkgPath = path.join(externalCwd, "package.json");
|
|
442
|
+
if (!fs.existsSync(pkgPath)) {
|
|
443
|
+
fs.writeFileSync(pkgPath, JSON.stringify({ name: "external-dogfood-repo", version: "0.0.1" }, null, 2), "utf8");
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
const activateResult = spawnSync(
|
|
447
|
+
"node",
|
|
448
|
+
[path.join(repoRoot, "bin/avorelo"), "activate", "--json"],
|
|
449
|
+
{ cwd: externalCwd, encoding: "utf8", timeout: 30000 }
|
|
450
|
+
);
|
|
451
|
+
|
|
452
|
+
let activationData = null;
|
|
453
|
+
try {
|
|
454
|
+
activationData = JSON.parse(activateResult.stdout);
|
|
455
|
+
} catch {}
|
|
456
|
+
|
|
457
|
+
const isAlphaContract = activationData?.contract === "avorelo.alphaActivation.v1";
|
|
458
|
+
const activationOk = activateResult.status === 0 && (
|
|
459
|
+
activationData?.ready === true ||
|
|
460
|
+
(isAlphaContract && activationData?.status !== "blocked" && activationData?.status != null)
|
|
461
|
+
);
|
|
462
|
+
checks.push({
|
|
463
|
+
id: "external_activation_ready",
|
|
464
|
+
pass: activationOk,
|
|
465
|
+
blocking: true,
|
|
466
|
+
detail: activationOk
|
|
467
|
+
? `activation ready from external cwd (${activationData?.contract || "unknown contract"})`
|
|
468
|
+
: `activation failed: ${activateResult.stderr?.slice(0, 200) || "unknown"}`,
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
if (activationData) {
|
|
472
|
+
const noFakeSavings = isAlphaContract
|
|
473
|
+
? true
|
|
474
|
+
: activationData.valueClaimsShown === false;
|
|
475
|
+
checks.push({
|
|
476
|
+
id: "external_no_fake_savings",
|
|
477
|
+
pass: noFakeSavings,
|
|
478
|
+
blocking: true,
|
|
479
|
+
detail: noFakeSavings
|
|
480
|
+
? "no fake savings in activation output"
|
|
481
|
+
: "valueClaimsShown is not false - savings shown without evidence",
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
const firstValueReady = isAlphaContract
|
|
485
|
+
? activationData.firstValuePath != null
|
|
486
|
+
: activationData.firstValueReadiness?.ready === true;
|
|
487
|
+
checks.push({
|
|
488
|
+
id: "external_first_value_readiness",
|
|
489
|
+
pass: firstValueReady,
|
|
490
|
+
blocking: true,
|
|
491
|
+
detail: firstValueReady
|
|
492
|
+
? "first value path/readiness present"
|
|
493
|
+
: isAlphaContract
|
|
494
|
+
? "firstValuePath is null in alphaActivation response"
|
|
495
|
+
: `firstValueReadiness.ready=${activationData.firstValueReadiness?.ready}`,
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
const pinnedEnv = { ...process.env, AVORELO_WORKSPACE: externalCwd };
|
|
500
|
+
|
|
501
|
+
const tokenResult = spawnSync(
|
|
502
|
+
"node",
|
|
503
|
+
[path.join(repoRoot, "bin/avorelo"), "token-evidence", "--json"],
|
|
504
|
+
{ cwd: externalCwd, env: pinnedEnv, encoding: "utf8", timeout: 15000 }
|
|
505
|
+
);
|
|
506
|
+
checks.push({
|
|
507
|
+
id: "external_token_evidence_safe",
|
|
508
|
+
pass: tokenResult.status === 0,
|
|
509
|
+
blocking: false,
|
|
510
|
+
detail: tokenResult.status === 0 ? "token-evidence exits 0" : `token-evidence failed: ${tokenResult.stderr?.slice(0, 200) || "unknown"}`,
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
const hygieneResult = spawnSync(
|
|
514
|
+
"node",
|
|
515
|
+
[path.join(repoRoot, "bin/avorelo"), "skills", "hygiene", "--json"],
|
|
516
|
+
{ cwd: externalCwd, env: pinnedEnv, encoding: "utf8", timeout: 15000 }
|
|
517
|
+
);
|
|
518
|
+
checks.push({
|
|
519
|
+
id: "external_skills_hygiene_safe",
|
|
520
|
+
pass: hygieneResult.status === 0,
|
|
521
|
+
blocking: false,
|
|
522
|
+
detail: hygieneResult.status === 0 ? "skills hygiene exits 0" : `skills hygiene failed: ${hygieneResult.stderr?.slice(0, 200) || "unknown"}`,
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
const operatingValueResult = spawnSync(
|
|
526
|
+
"node",
|
|
527
|
+
[path.join(repoRoot, "bin/avorelo"), "operating-value", "--json"],
|
|
528
|
+
{ cwd: externalCwd, env: pinnedEnv, encoding: "utf8", timeout: 15000 }
|
|
529
|
+
);
|
|
530
|
+
checks.push({
|
|
531
|
+
id: "external_operating_value_safe",
|
|
532
|
+
pass: operatingValueResult.status === 0,
|
|
533
|
+
blocking: false,
|
|
534
|
+
detail: operatingValueResult.status === 0 ? "operating-value exits 0" : `operating-value failed: ${operatingValueResult.stderr?.slice(0, 200) || "unknown"}`,
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
return { checks };
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function buildLaunchReadiness(repoRoot, opts = {}) {
|
|
541
|
+
const { runExternalDogfood = false, externalCwd = null } = opts;
|
|
542
|
+
const startedAt = new Date().toISOString();
|
|
543
|
+
|
|
544
|
+
const packageAudit = buildPackageAudit(repoRoot, opts);
|
|
545
|
+
const externalCheck = runExternalDogfood && externalCwd
|
|
546
|
+
? buildExternalRepoCheck(repoRoot, externalCwd)
|
|
547
|
+
: { checks: [], skipped: true };
|
|
548
|
+
|
|
549
|
+
const allChecks = [...packageAudit.checks, ...externalCheck.checks];
|
|
550
|
+
const passingChecks = allChecks.filter((check) => check.pass === true);
|
|
551
|
+
const failingChecks = allChecks.filter((check) => check.pass === false);
|
|
552
|
+
const skippedChecks = allChecks.filter((check) => check.pass === null);
|
|
553
|
+
const blockingFailure = failingChecks.some((check) => check.blocking === true);
|
|
554
|
+
|
|
555
|
+
let verdict;
|
|
556
|
+
if (failingChecks.length === 0) {
|
|
557
|
+
verdict = "LAUNCH_GATE_PASS";
|
|
558
|
+
} else if (blockingFailure) {
|
|
559
|
+
verdict = "LAUNCH_GATE_BLOCKED";
|
|
560
|
+
} else {
|
|
561
|
+
verdict = "LAUNCH_GATE_PARTIAL";
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
return {
|
|
565
|
+
schemaVersion: LAUNCH_READINESS_SCHEMA_VERSION,
|
|
566
|
+
contract: LAUNCH_READINESS_CONTRACT,
|
|
567
|
+
generatedAt: startedAt,
|
|
568
|
+
verdict,
|
|
569
|
+
summary: {
|
|
570
|
+
total: allChecks.length,
|
|
571
|
+
pass: passingChecks.length,
|
|
572
|
+
fail: failingChecks.length,
|
|
573
|
+
skip: skippedChecks.length,
|
|
574
|
+
},
|
|
575
|
+
packageAudit: {
|
|
576
|
+
checks: packageAudit.checks,
|
|
577
|
+
runtimeArtifactsFound: packageAudit.runtimeArtifactsFound,
|
|
578
|
+
absolutePathViolations: packageAudit.absolutePathViolations,
|
|
579
|
+
distributionState: packageAudit.distributionState,
|
|
580
|
+
distributionEvidence: packageAudit.distributionEvidence,
|
|
581
|
+
},
|
|
582
|
+
externalRepoCheck: externalCheck,
|
|
583
|
+
failingChecks,
|
|
584
|
+
passingChecks: passingChecks.map((check) => check.id),
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
function formatLaunchReadinessText(result) {
|
|
589
|
+
const lines = [];
|
|
590
|
+
lines.push("Avorelo Launch Readiness Gate");
|
|
591
|
+
lines.push("");
|
|
592
|
+
lines.push(`Verdict: ${result.verdict}`);
|
|
593
|
+
lines.push(`Checks: ${result.summary.pass} pass, ${result.summary.fail} fail, ${result.summary.skip} skip`);
|
|
594
|
+
if (result.packageAudit?.distributionState) {
|
|
595
|
+
lines.push(`Distribution state: ${result.packageAudit.distributionState}`);
|
|
596
|
+
}
|
|
597
|
+
lines.push("");
|
|
598
|
+
|
|
599
|
+
if (result.failingChecks.length > 0) {
|
|
600
|
+
lines.push("Failing:");
|
|
601
|
+
for (const check of result.failingChecks) {
|
|
602
|
+
lines.push(` FAIL ${check.id}: ${check.detail || ""}`);
|
|
603
|
+
}
|
|
604
|
+
lines.push("");
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
lines.push("Passing:");
|
|
608
|
+
for (const id of result.passingChecks) {
|
|
609
|
+
lines.push(` pass ${id}`);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
if (result.externalRepoCheck.skipped) {
|
|
613
|
+
lines.push("");
|
|
614
|
+
lines.push("External repo check: skipped (run with --external-cwd <path> to enable)");
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
return lines.join("\n");
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
module.exports = {
|
|
621
|
+
buildLaunchDistributionEvidence,
|
|
622
|
+
buildLaunchReadiness,
|
|
623
|
+
buildPackageAudit,
|
|
624
|
+
buildExternalRepoCheck,
|
|
625
|
+
evaluatePackageDistributionState,
|
|
626
|
+
formatLaunchReadinessText,
|
|
627
|
+
LAUNCH_READINESS_CONTRACT,
|
|
628
|
+
};
|