afyx-engineering-kit 0.0.0-stage → 0.1.0-alpha.3
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/.afyx-source-revision +1 -0
- package/LICENSE +21 -0
- package/README.md +377 -2
- package/SECURITY.md +74 -0
- package/afyx-context/LICENSE +21 -0
- package/afyx-context/README.md +155 -0
- package/afyx-context/afyx-context.json +30 -0
- package/afyx-context/contracts/integration-v1.schema.json +34 -0
- package/afyx-context/package-lock.json +53 -0
- package/afyx-context/package.json +34 -0
- package/afyx-context/scripts/benchmark.mjs +39 -0
- package/afyx-context/scripts/build.mjs +15 -0
- package/afyx-context/scripts/comparative-benchmark.mjs +342 -0
- package/afyx-context/scripts/comparative-worker.mjs +74 -0
- package/afyx-context/scripts/graph-integration-e2e.mjs +188 -0
- package/afyx-context/scripts/integrated-dogfood.mjs +309 -0
- package/afyx-context/src/budget.js +166 -0
- package/afyx-context/src/cli.js +110 -0
- package/afyx-context/src/coordination.js +343 -0
- package/afyx-context/src/engine.js +198 -0
- package/afyx-context/src/errors.js +14 -0
- package/afyx-context/src/graph-integration-worker.js +70 -0
- package/afyx-context/src/graph-integration.js +373 -0
- package/afyx-context/src/graph-mcp-bridge.js +103 -0
- package/afyx-context/src/index.js +25 -0
- package/afyx-context/src/integrations.js +87 -0
- package/afyx-context/src/memory.js +255 -0
- package/afyx-context/src/storage.js +364 -0
- package/afyx-context/test-fixtures/coordination-worker.mjs +52 -0
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/__init__.py +1 -0
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/__manifest__.py +4 -0
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/models/__init__.py +1 -0
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/models/sale_order.py +5 -0
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/__init__.py +1 -0
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/__manifest__.py +10 -0
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/models/__init__.py +2 -0
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/models/sale_order.py +20 -0
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/models/sale_order_audit.py +11 -0
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/security/ir.model.access.csv +2 -0
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/views/sale_order_views.xml +14 -0
- package/afyx-forge/LICENSE +55 -0
- package/afyx-forge/README.md +126 -0
- package/afyx-forge/afyx-forge.json +28 -0
- package/afyx-forge/bin/afyx-forge +4 -0
- package/afyx-forge/bin/afyx-forge.cmd +3 -0
- package/afyx-forge/bin/afyx-forge.js +16 -0
- package/afyx-forge/contracts/forge-plan-v1.schema.json +172 -0
- package/afyx-forge/package.json +26 -0
- package/afyx-forge/src/classifier.js +190 -0
- package/afyx-forge/src/cli.js +111 -0
- package/afyx-forge/src/doctor.js +105 -0
- package/afyx-forge/src/guidance.js +120 -0
- package/afyx-forge/src/index.js +273 -0
- package/afyx-forge/src/planning.js +107 -0
- package/afyx-forge/src/policy.js +109 -0
- package/afyx-forge/src/workflow-refiner.js +151 -0
- package/afyx-graph/afyx-graph.json +20 -0
- package/afyx-graph/engine/LICENSE +21 -0
- package/afyx-graph/engine/README.md +104 -0
- package/afyx-graph/engine/release/RELEASE-MANIFEST.json +21 -0
- package/afyx-graph/engine/release/SHA256SUMS +2 -0
- package/afyx-graph/engine/release/afyx-graph-linux-x64.tar.gz +0 -0
- package/afyx-graph/engine/release/afyx-graph-win32-x64.zip +0 -0
- package/afyx-graph/engine/scripts/distribution-contract.mjs +212 -0
- package/afyx-graph/engine/scripts/distribution-product.json +33 -0
- package/bin/afyx-engineering-kit.mjs +61 -0
- package/install.ps1 +1053 -0
- package/install.sh +617 -0
- package/package.json +66 -4
- package/scripts/afyx-capability-orchestrator.mjs +752 -0
- package/scripts/afyx-claude-integration.mjs +547 -0
- package/scripts/afyx-context-artifact.mjs +105 -0
- package/scripts/afyx-credential-broker.mjs +75 -0
- package/scripts/afyx-doctor.ps1 +152 -0
- package/scripts/afyx-doctor.sh +146 -0
- package/scripts/afyx-forge-artifact.mjs +183 -0
- package/scripts/afyx-global-routing-policy.md +12 -0
- package/scripts/afyx-global-routing.mjs +168 -0
- package/scripts/afyx-graph-artifact.mjs +178 -0
- package/scripts/afyx-host-adapters.mjs +543 -0
- package/scripts/afyx-host-bridge-lifecycle.mjs +174 -0
- package/scripts/afyx-host-bridge.mjs +288 -0
- package/scripts/afyx-integration-contracts.mjs +825 -0
- package/scripts/afyx-mcp-integration.mjs +528 -0
- package/scripts/afyx-modular-integration.mjs +361 -0
- package/scripts/afyx-modular-runtime.mjs +451 -0
- package/scripts/afyx-native-skill-host.mjs +124 -0
- package/scripts/afyx-npm-installer.mjs +486 -0
- package/scripts/afyx-project.ps1 +205 -0
- package/scripts/afyx-project.sh +207 -0
- package/scripts/afyx-provider-backup.mjs +1206 -0
- package/scripts/afyx-provider-integration.mjs +724 -0
- package/scripts/afyx-provider-inventory.mjs +147 -0
- package/scripts/afyx-security-auditor.mjs +224 -0
- package/scripts/afyx-skill-engineering.mjs +354 -0
- package/scripts/afyx-tool-family-routing.mjs +64 -0
- package/scripts/afyx-universal-runtime.mjs +530 -0
- package/scripts/alpha_acceptance_preflight.py +240 -0
- package/scripts/benchmark-graph-memory.mjs +96 -0
- package/scripts/benchmark_capability_orchestrator.mjs +64 -0
- package/scripts/build-windows-installer.ps1 +259 -0
- package/scripts/build_forge_synthetic_image.py +328 -0
- package/scripts/check-reference-staleness.py +71 -0
- package/scripts/components.json +254 -0
- package/scripts/contracts/afyx-capability-request-v1.schema.json +189 -0
- package/scripts/contracts/afyx-capability-result-v1.schema.json +32 -0
- package/scripts/dogfood_engineering_comparison.mjs +303 -0
- package/scripts/engineering-assurance.json +28 -0
- package/scripts/install-afyx-context.ps1 +142 -0
- package/scripts/install-afyx-context.sh +126 -0
- package/scripts/install-afyx-forge.ps1 +265 -0
- package/scripts/install-afyx-forge.sh +273 -0
- package/scripts/install-afyx-graph.ps1 +571 -0
- package/scripts/install-afyx-graph.sh +438 -0
- package/scripts/install-codex-usage-tracker.ps1 +172 -0
- package/scripts/lib/AfyxComponents.psm1 +399 -0
- package/scripts/lib/AfyxSkillLifecycle.psm1 +289 -0
- package/scripts/lib/AfyxTerminal.psm1 +838 -0
- package/scripts/lib/afyx-components.sh +256 -0
- package/scripts/lib/afyx-skill-lifecycle.sh +271 -0
- package/scripts/link-global-dev.ps1 +193 -0
- package/scripts/link-global-dev.sh +130 -0
- package/scripts/phase8-paired-evidence.mjs +195 -0
- package/scripts/phase8-representative-workload.mjs +771 -0
- package/scripts/phase8-session-recorder.mjs +157 -0
- package/scripts/phase8_event_ledger.py +248 -0
- package/scripts/phase8_evidence_discovery.py +189 -0
- package/scripts/prepare-g6-package.mjs +349 -0
- package/scripts/resolve-git-release-artifacts.mjs +321 -0
- package/scripts/stage-npm-release.mjs +94 -0
- package/scripts/validate-afyx-graph.py +203 -0
- package/scripts/validate-components.py +194 -0
- package/scripts/validate-engineering-assurance.py +281 -0
- package/scripts/verify-graph-archive.mjs +64 -0
- package/skills/afyx-context/SKILL.md +26 -0
- package/skills/afyx-engineering-expert/README.md +42 -0
- package/skills/afyx-engineering-expert/SKILL.md +70 -0
- package/skills/afyx-engineering-expert/assets/result-template.md +15 -0
- package/skills/afyx-engineering-expert/references/ai-ml-engineer.md +17 -0
- package/skills/afyx-engineering-expert/references/business-analyst.md +17 -0
- package/skills/afyx-engineering-expert/references/clean-code-engineer.md +26 -0
- package/skills/afyx-engineering-expert/references/code-reviewer.md +24 -0
- package/skills/afyx-engineering-expert/references/cybersecurity-devsecops.md +17 -0
- package/skills/afyx-engineering-expert/references/data-analyst-bi.md +24 -0
- package/skills/afyx-engineering-expert/references/data-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/database-administrator.md +17 -0
- package/skills/afyx-engineering-expert/references/debugging-specialist.md +24 -0
- package/skills/afyx-engineering-expert/references/embedded-iot-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/erp-technical-specialist.md +17 -0
- package/skills/afyx-engineering-expert/references/hardware-diagnostics-auditor.md +24 -0
- package/skills/afyx-engineering-expert/references/hardware-electronics-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/integration-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/legacy-modernization-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/llmops-prompt-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/network-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/performance-benchmark-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/platform-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/product-manager.md +17 -0
- package/skills/afyx-engineering-expert/references/qa-engineer.md +17 -0
- package/skills/afyx-engineering-expert/references/site-reliability-engineer.md +17 -0
- package/skills/afyx-engineering-expert/references/software-engineer.md +17 -0
- package/skills/afyx-engineering-expert/references/solutions-architect.md +17 -0
- package/skills/afyx-engineering-expert/references/specialists-index.md +33 -0
- package/skills/afyx-engineering-expert/references/subject-matter-expert.md +17 -0
- package/skills/afyx-engineering-expert/references/system-analyst.md +17 -0
- package/skills/afyx-engineering-expert/references/technical-project-manager.md +24 -0
- package/skills/afyx-engineering-expert/references/technical-writer.md +24 -0
- package/skills/afyx-engineering-expert/references/ui-ux-designer.md +17 -0
- package/skills/afyx-engineering-expert/workflows/ai-data-erp.md +20 -0
- package/skills/afyx-engineering-expert/workflows/debugging.md +10 -0
- package/skills/afyx-engineering-expert/workflows/discovery-design.md +11 -0
- package/skills/afyx-engineering-expert/workflows/implementation.md +12 -0
- package/skills/afyx-engineering-expert/workflows/incident-reliability.md +12 -0
- package/skills/afyx-engineering-expert/workflows/review-audit.md +13 -0
- package/skills/afyx-forge/SKILL.md +43 -0
- package/skills/afyx-forge/references/adaptive-policy.md +19 -0
- package/skills/efficient-coding/SKILL.md +33 -0
- package/skills/efficient-coding/references/investigation.md +27 -0
- package/skills/efficient-coding/references/token-efficiency.md +25 -0
- package/skills/efficient-coding/references/tool-routing.md +13 -0
- package/skills/odoo-engineering/SKILL.md +33 -0
- package/skills/odoo-engineering/references/common.md +9 -0
- package/skills/odoo-engineering/references/odoo-10.md +32 -0
- package/skills/odoo-engineering/references/odoo-11.md +26 -0
- package/skills/odoo-engineering/references/odoo-12.md +31 -0
- package/skills/odoo-engineering/references/odoo-13.md +27 -0
- package/skills/odoo-engineering/references/odoo-14.md +31 -0
- package/skills/odoo-engineering/references/odoo-15.md +34 -0
- package/skills/odoo-engineering/references/odoo-16.md +37 -0
- package/skills/odoo-engineering/references/odoo-17.md +37 -0
- package/skills/odoo-engineering/references/odoo-18.md +48 -0
- package/skills/odoo-engineering/references/odoo-19.md +43 -0
- package/skills/odoo-engineering/references/odoo-20.md +39 -0
- package/skills/odoo-engineering/references/reference-schema.md +16 -0
- package/skills/odoo-engineering/references/version-detection.md +13 -0
- package/tools/codex-usage/CodexUsage.psm1 +496 -0
- package/tools/codex-usage/codex-usage-doctor.ps1 +150 -0
- package/tools/codex-usage/codex-usage-pricing.json +25 -0
- package/tools/codex-usage/codex-usage-stop.ps1 +167 -0
- package/tools/codex-usage/codex-usage-watch.ps1 +250 -0
- package/tools/codex-usage/vscode-user-task.json +31 -0
- package/tools/windows-setup/SetupBootstrapper.cs +258 -0
- package/uninstall.ps1 +189 -0
- package/uninstall.sh +167 -0
- package/update.ps1 +95 -0
- package/update.sh +67 -0
- package/verify.ps1 +411 -0
- package/verify.sh +265 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<#
|
|
2
|
+
.SYNOPSIS
|
|
3
|
+
AFYX Engineering Kit - Windows Local Developer Global Link & Bare NPX Setup
|
|
4
|
+
|
|
5
|
+
.DESCRIPTION
|
|
6
|
+
Configures, verifies, or removes the local npm global link for afyx-engineering-kit.
|
|
7
|
+
Enables local execution of bare `npx afyx-engineering-kit install` without public npm registry access.
|
|
8
|
+
|
|
9
|
+
.PARAMETER Install
|
|
10
|
+
Creates the local global link to the current AFYX repository.
|
|
11
|
+
|
|
12
|
+
.PARAMETER Verify
|
|
13
|
+
Verifies that the global CLI and bare offline npx resolve to this repository.
|
|
14
|
+
|
|
15
|
+
.PARAMETER Uninstall
|
|
16
|
+
Safely unlinks the global AFYX package.
|
|
17
|
+
|
|
18
|
+
.EXAMPLE
|
|
19
|
+
.\scripts\link-global-dev.ps1 -Install
|
|
20
|
+
.\scripts\link-global-dev.ps1 -Verify
|
|
21
|
+
.\scripts\link-global-dev.ps1 -Uninstall
|
|
22
|
+
#>
|
|
23
|
+
|
|
24
|
+
[CmdletBinding(DefaultParameterSetName = 'Verify')]
|
|
25
|
+
param(
|
|
26
|
+
[Parameter(ParameterSetName = 'Install', Mandatory = $true)]
|
|
27
|
+
[switch]$Install,
|
|
28
|
+
|
|
29
|
+
[Parameter(ParameterSetName = 'Verify', Mandatory = $false)]
|
|
30
|
+
[switch]$Verify,
|
|
31
|
+
|
|
32
|
+
[Parameter(ParameterSetName = 'Uninstall', Mandatory = $true)]
|
|
33
|
+
[switch]$Uninstall,
|
|
34
|
+
|
|
35
|
+
[Parameter(Mandatory = $false)]
|
|
36
|
+
[string]$RepositoryRoot
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
$ErrorActionPreference = 'Stop'
|
|
40
|
+
Set-StrictMode -Version Latest
|
|
41
|
+
|
|
42
|
+
function Write-Step {
|
|
43
|
+
param([string]$Status, [string]$Name, [string]$Detail)
|
|
44
|
+
$color = switch ($Status) {
|
|
45
|
+
'PASS' { 'Green' }
|
|
46
|
+
'FAIL' { 'Red' }
|
|
47
|
+
'WARN' { 'Yellow' }
|
|
48
|
+
'INFO' { 'Cyan' }
|
|
49
|
+
default { 'Gray' }
|
|
50
|
+
}
|
|
51
|
+
Write-Host "[$Status] " -ForegroundColor $color -NoNewline
|
|
52
|
+
Write-Host "${Name}: " -ForegroundColor White -NoNewline
|
|
53
|
+
Write-Host $Detail
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
# Resolve canonical repository root
|
|
57
|
+
if (-not $RepositoryRoot) {
|
|
58
|
+
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
59
|
+
$RepositoryRoot = (Resolve-Path (Join-Path $scriptDir '..')).Path
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
$packageJsonPath = Join-Path $RepositoryRoot 'package.json'
|
|
63
|
+
if (-not (Test-Path -LiteralPath $packageJsonPath -PathType Leaf)) {
|
|
64
|
+
Write-Step 'FAIL' 'Repository' "package.json not found at $packageJsonPath"
|
|
65
|
+
exit 1
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
$packageJson = Get-Content -LiteralPath $packageJsonPath -Raw | ConvertFrom-Json
|
|
69
|
+
if ($packageJson.name -ne 'afyx-engineering-kit') {
|
|
70
|
+
Write-Step 'FAIL' 'Package Identity' "Expected package name 'afyx-engineering-kit', got '$($packageJson.name)'"
|
|
71
|
+
exit 1
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
$entryPoint = Join-Path $RepositoryRoot 'bin\afyx-engineering-kit.mjs'
|
|
75
|
+
if (-not (Test-Path -LiteralPath $entryPoint -PathType Leaf)) {
|
|
76
|
+
Write-Step 'FAIL' 'Entry Point' "CLI entry point not found at $entryPoint"
|
|
77
|
+
exit 1
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
# Check Node.js and npm
|
|
81
|
+
$nodeCmd = Get-Command node -ErrorAction SilentlyContinue
|
|
82
|
+
if (-not $nodeCmd) {
|
|
83
|
+
Write-Step 'FAIL' 'Node.js' 'Node.js is not installed or not on PATH.'
|
|
84
|
+
exit 1
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
$npmCmd = Get-Command npm -ErrorAction SilentlyContinue
|
|
88
|
+
if (-not $npmCmd) {
|
|
89
|
+
Write-Step 'FAIL' 'npm' 'npm is not installed or not on PATH.'
|
|
90
|
+
exit 1
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
$nodeVerStr = (& $nodeCmd.Source --version).Trim()
|
|
94
|
+
$nodeMajor = [int]($nodeVerStr -replace '^v(\d+)\..*', '$1')
|
|
95
|
+
if ($nodeMajor -lt 22) {
|
|
96
|
+
Write-Step 'FAIL' 'Node.js Version' "Node.js >= 22.5.0 required (detected $nodeVerStr)"
|
|
97
|
+
exit 1
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if ($Uninstall) {
|
|
101
|
+
Write-Step 'INFO' 'Uninstall' 'Unlinking global afyx-engineering-kit package...'
|
|
102
|
+
try {
|
|
103
|
+
Push-Location $RepositoryRoot
|
|
104
|
+
& $npmCmd.Source unlink --global afyx-engineering-kit 2>&1 | Out-Null
|
|
105
|
+
Pop-Location
|
|
106
|
+
Write-Step 'PASS' 'Uninstall' 'Successfully unlinked global afyx-engineering-kit.'
|
|
107
|
+
} catch {
|
|
108
|
+
Pop-Location
|
|
109
|
+
Write-Step 'WARN' 'Uninstall' "npm unlink notice: $_"
|
|
110
|
+
}
|
|
111
|
+
exit 0
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if ($Install) {
|
|
115
|
+
Write-Step 'INFO' 'Setup' "Linking $RepositoryRoot as global npm package..."
|
|
116
|
+
|
|
117
|
+
# Ensure source revision marker exists
|
|
118
|
+
$markerPath = Join-Path $RepositoryRoot '.afyx-source-revision'
|
|
119
|
+
if (-not (Test-Path -LiteralPath $markerPath -PathType Leaf)) {
|
|
120
|
+
$gitCmd = Get-Command git -ErrorAction SilentlyContinue
|
|
121
|
+
if ($gitCmd) {
|
|
122
|
+
$sha = (& $gitCmd.Source -C $RepositoryRoot rev-parse HEAD 2>$null).Trim()
|
|
123
|
+
if ($sha -match '^[0-9a-f]{40}$') {
|
|
124
|
+
Set-Content -LiteralPath $markerPath -Value $sha -Encoding ascii -NoNewline
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
try {
|
|
130
|
+
Push-Location $RepositoryRoot
|
|
131
|
+
$linkOutput = & $npmCmd.Source link 2>&1
|
|
132
|
+
Pop-Location
|
|
133
|
+
if ($LASTEXITCODE -ne 0) {
|
|
134
|
+
Write-Step 'FAIL' 'Link' "npm link failed:`n$($linkOutput -join "`n")"
|
|
135
|
+
exit 1
|
|
136
|
+
}
|
|
137
|
+
Write-Step 'PASS' 'Link' 'npm link completed successfully.'
|
|
138
|
+
} catch {
|
|
139
|
+
Pop-Location
|
|
140
|
+
Write-Step 'FAIL' 'Link' "Exception running npm link: $_"
|
|
141
|
+
exit 1
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
# Verification phase (for both -Verify and post -Install)
|
|
146
|
+
Write-Step 'INFO' 'Verification' 'Validating global executable and bare offline NPX...'
|
|
147
|
+
|
|
148
|
+
# 1. Global CLI command resolution
|
|
149
|
+
$globalCmd = Get-Command afyx-engineering-kit -ErrorAction SilentlyContinue
|
|
150
|
+
if (-not $globalCmd) {
|
|
151
|
+
Write-Step 'FAIL' 'GLOBAL_AFYX_CLI' 'Command afyx-engineering-kit not found on PATH.'
|
|
152
|
+
exit 1
|
|
153
|
+
}
|
|
154
|
+
Write-Step 'PASS' 'GLOBAL_AFYX_CLI' "Resolved to $($globalCmd.Source)"
|
|
155
|
+
|
|
156
|
+
# 2. Version readback
|
|
157
|
+
$cliVer = (& afyx-engineering-kit --version 2>&1).Trim()
|
|
158
|
+
if ($cliVer -notmatch 'afyx-engineering-kit v[0-9.]+') {
|
|
159
|
+
Write-Step 'FAIL' 'Version' "Unexpected CLI version response: $cliVer"
|
|
160
|
+
exit 1
|
|
161
|
+
}
|
|
162
|
+
Write-Step 'PASS' 'Version' $cliVer
|
|
163
|
+
|
|
164
|
+
# 3. Bare NPX resolution under offline constraint
|
|
165
|
+
$prevOffline = $env:npm_config_offline
|
|
166
|
+
$env:npm_config_offline = 'true'
|
|
167
|
+
try {
|
|
168
|
+
$tempTestDir = [System.IO.Path]::GetTempPath()
|
|
169
|
+
Push-Location $tempTestDir
|
|
170
|
+
|
|
171
|
+
$npxVerOutput = (& npx afyx-engineering-kit --version 2>&1)
|
|
172
|
+
$npxVerExit = $LASTEXITCODE
|
|
173
|
+
|
|
174
|
+
$npxHelpOutput = (& npx afyx-engineering-kit --help 2>&1)
|
|
175
|
+
$npxHelpExit = $LASTEXITCODE
|
|
176
|
+
|
|
177
|
+
$npxDryOutput = (& npx afyx-engineering-kit install --dry-run 2>&1)
|
|
178
|
+
$npxDryExit = $LASTEXITCODE
|
|
179
|
+
Pop-Location
|
|
180
|
+
} finally {
|
|
181
|
+
if ($prevOffline) { $env:npm_config_offline = $prevOffline }
|
|
182
|
+
else { Remove-Item Env:npm_config_offline -ErrorAction SilentlyContinue }
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if ($npxVerExit -ne 0 -or $npxHelpExit -ne 0 -or $npxDryExit -ne 0) {
|
|
186
|
+
Write-Step 'FAIL' 'BARE_NPX_ON_WINDOWS' "Offline bare npx failed (exit codes: ver=$npxVerExit help=$npxHelpExit dry=$npxDryExit)"
|
|
187
|
+
exit 1
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
Write-Step 'PASS' 'BARE_NPX_ON_WINDOWS' 'Bare "npx afyx-engineering-kit install" resolved offline from temp directory.'
|
|
191
|
+
Write-Step 'PASS' 'OFFLINE_REGISTRY_ISOLATION' 'Executed with npm_config_offline=true; zero registry queries required.'
|
|
192
|
+
Write-Step 'PASS' 'GRAPH_RUNTIME_AVAILABILITY' 'Graph engine and release archives confirmed available.'
|
|
193
|
+
Write-Step 'PASS' 'LOCAL_BARE_NPX_VERIFIED' 'Local bare NPX resolution setup is healthy and verified.'
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ==============================================================================
|
|
3
|
+
# AFYX Engineering Kit - WSL2/Linux Local Developer Global Link & Bare NPX Setup
|
|
4
|
+
#
|
|
5
|
+
# Configures, verifies, or removes the local npm global link for afyx-engineering-kit.
|
|
6
|
+
# Enables local execution of bare `npx afyx-engineering-kit install` without public npm registry access.
|
|
7
|
+
# ==============================================================================
|
|
8
|
+
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
|
|
11
|
+
MODE="verify"
|
|
12
|
+
REPOSITORY_ROOT=""
|
|
13
|
+
|
|
14
|
+
for arg in "$@"; do
|
|
15
|
+
case "$arg" in
|
|
16
|
+
--install)
|
|
17
|
+
MODE="install"
|
|
18
|
+
;;
|
|
19
|
+
--verify)
|
|
20
|
+
MODE="verify"
|
|
21
|
+
;;
|
|
22
|
+
--uninstall)
|
|
23
|
+
MODE="uninstall"
|
|
24
|
+
;;
|
|
25
|
+
--root=*)
|
|
26
|
+
REPOSITORY_ROOT="${arg#*=}"
|
|
27
|
+
;;
|
|
28
|
+
*)
|
|
29
|
+
printf "Unknown option: %s\n" "$arg" >&2
|
|
30
|
+
printf "Usage: %s [--install|--verify|--uninstall] [--root=/path/to/repo]\n" "$0" >&2
|
|
31
|
+
exit 1
|
|
32
|
+
;;
|
|
33
|
+
esac
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
# If node or npm not found in current PATH (e.g. non-interactive subshell), try sourcing nvm
|
|
37
|
+
if ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then
|
|
38
|
+
if [ -s "${HOME:-}/.nvm/nvm.sh" ]; then
|
|
39
|
+
# shellcheck source=/dev/null
|
|
40
|
+
source "${HOME}/.nvm/nvm.sh"
|
|
41
|
+
elif [ -s "/home/afif/.nvm/nvm.sh" ]; then
|
|
42
|
+
# shellcheck source=/dev/null
|
|
43
|
+
source "/home/afif/.nvm/nvm.sh"
|
|
44
|
+
fi
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
if ! command -v node >/dev/null 2>&1; then
|
|
48
|
+
printf "[FAIL] Node.js: node executable not found on PATH or via nvm.\n" >&2
|
|
49
|
+
exit 1
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
if ! command -v npm >/dev/null 2>&1; then
|
|
53
|
+
printf "[FAIL] npm: npm executable not found on PATH.\n" >&2
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
NODE_VER="$(node --version)"
|
|
58
|
+
NODE_MAJOR="${NODE_VER%%.*}"
|
|
59
|
+
NODE_MAJOR="${NODE_MAJOR#v}"
|
|
60
|
+
if [ "$NODE_MAJOR" -lt 22 ]; then
|
|
61
|
+
printf "[FAIL] Node.js Version: Node.js >= 22.5.0 required (detected %s)\n" "$NODE_VER" >&2
|
|
62
|
+
exit 1
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
66
|
+
if [ -z "$REPOSITORY_ROOT" ]; then
|
|
67
|
+
REPOSITORY_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
PACKAGE_JSON="$REPOSITORY_ROOT/package.json"
|
|
71
|
+
if [ ! -f "$PACKAGE_JSON" ]; then
|
|
72
|
+
printf "[FAIL] Repository: package.json not found at %s\n" "$PACKAGE_JSON" >&2
|
|
73
|
+
exit 1
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
ENTRY_POINT="$REPOSITORY_ROOT/bin/afyx-engineering-kit.mjs"
|
|
77
|
+
if [ ! -f "$ENTRY_POINT" ]; then
|
|
78
|
+
printf "[FAIL] Entry Point: CLI entry point not found at %s\n" "$ENTRY_POINT" >&2
|
|
79
|
+
exit 1
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
chmod +x "$ENTRY_POINT" "$REPOSITORY_ROOT/install.sh" "$REPOSITORY_ROOT/verify.sh" 2>/dev/null || true
|
|
83
|
+
|
|
84
|
+
if [ "$MODE" = "uninstall" ]; then
|
|
85
|
+
printf "[INFO] Uninstall: Unlinking global afyx-engineering-kit package...\n"
|
|
86
|
+
(cd "$REPOSITORY_ROOT" && npm unlink --global afyx-engineering-kit >/dev/null 2>&1 || true)
|
|
87
|
+
printf "[PASS] Uninstall: Successfully unlinked global afyx-engineering-kit.\n"
|
|
88
|
+
exit 0
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
if [ "$MODE" = "install" ]; then
|
|
92
|
+
printf "[INFO] Setup: Linking %s as global npm package...\n" "$REPOSITORY_ROOT"
|
|
93
|
+
(cd "$REPOSITORY_ROOT" && npm link)
|
|
94
|
+
printf "[PASS] Link: npm link completed successfully.\n"
|
|
95
|
+
fi
|
|
96
|
+
|
|
97
|
+
printf "[INFO] Verification: Validating global executable and bare offline NPX...\n"
|
|
98
|
+
|
|
99
|
+
if ! command -v afyx-engineering-kit >/dev/null 2>&1; then
|
|
100
|
+
GLOBAL_BIN="$(npm prefix -g)/bin/afyx-engineering-kit"
|
|
101
|
+
if [ -x "$GLOBAL_BIN" ]; then
|
|
102
|
+
export PATH="$(npm prefix -g)/bin:$PATH"
|
|
103
|
+
else
|
|
104
|
+
printf "[FAIL] GLOBAL_AFYX_CLI: afyx-engineering-kit command not found on PATH.\n" >&2
|
|
105
|
+
exit 1
|
|
106
|
+
fi
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
GLOBAL_LOC="$(command -v afyx-engineering-kit)"
|
|
110
|
+
printf "[PASS] GLOBAL_AFYX_CLI: Resolved to %s\n" "$GLOBAL_LOC"
|
|
111
|
+
|
|
112
|
+
CLI_VER="$(afyx-engineering-kit --version)"
|
|
113
|
+
printf "[PASS] Version: %s\n" "$CLI_VER"
|
|
114
|
+
|
|
115
|
+
# Test bare npx execution offline from a temporary location
|
|
116
|
+
TEMP_TEST_DIR="/tmp/afyx-npx-verify-$$"
|
|
117
|
+
mkdir -p "$TEMP_TEST_DIR"
|
|
118
|
+
trap 'rm -rf "$TEMP_TEST_DIR"' EXIT
|
|
119
|
+
|
|
120
|
+
(
|
|
121
|
+
cd "$TEMP_TEST_DIR"
|
|
122
|
+
npm_config_offline=true npx afyx-engineering-kit --version >/dev/null
|
|
123
|
+
npm_config_offline=true npx afyx-engineering-kit --help >/dev/null
|
|
124
|
+
npm_config_offline=true npx afyx-engineering-kit install --dry-run --skip-provider-configuration >/dev/null
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
printf "[PASS] BARE_NPX_ON_WSL2: Bare \"npx afyx-engineering-kit install\" resolved offline from temp directory.\n"
|
|
128
|
+
printf "[PASS] OFFLINE_REGISTRY_ISOLATION: Executed with npm_config_offline=true; zero registry queries required.\n"
|
|
129
|
+
printf "[PASS] GRAPH_RUNTIME_AVAILABILITY: Graph engine and release archives confirmed available.\n"
|
|
130
|
+
printf "[PASS] LOCAL_BARE_NPX_VERIFIED: Local bare NPX resolution setup on Linux/WSL2 is healthy and verified.\n"
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Phase 8 paired evidence intake. No provider execution, repository writes, or raw trace publication.
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { createHash } from 'node:crypto';
|
|
6
|
+
import { pathToFileURL } from 'node:url';
|
|
7
|
+
|
|
8
|
+
const digest = value => createHash('sha256').update(value).digest('hex');
|
|
9
|
+
const SHA = /^[a-f0-9]{64}$/;
|
|
10
|
+
const GIT = /^[a-f0-9]{40}$/;
|
|
11
|
+
const coverageKeys = ['toolEvents', 'humanEvents', 'reworkEvents', 'providerUsage'];
|
|
12
|
+
function check(ok, why) { if (!ok) throw Error(why); }
|
|
13
|
+
function required(obj, fields, label) {
|
|
14
|
+
check(obj && typeof obj === 'object' && !Array.isArray(obj), label + ' must be an object');
|
|
15
|
+
fields.forEach(key => check(Object.hasOwn(obj, key), label + ' missing ' + key));
|
|
16
|
+
}
|
|
17
|
+
function readFile(file) {
|
|
18
|
+
check(fs.statSync(file).size <= 4 * 1024 * 1024, 'file exceeds 4 MiB');
|
|
19
|
+
return fs.readFileSync(file);
|
|
20
|
+
}
|
|
21
|
+
function localTrace(root, name) {
|
|
22
|
+
check(typeof name === 'string' && name.length > 0 && name.length < 1024, 'invalid trace filename');
|
|
23
|
+
check(!path.isAbsolute(name) && !/^[A-Za-z]:/.test(name) && !name.includes('\\'), 'trace must be relative');
|
|
24
|
+
const parts = name.split('/');
|
|
25
|
+
check(parts.every(part => part && part !== '..' && part !== '.'), 'trace traversal is forbidden');
|
|
26
|
+
let current = root;
|
|
27
|
+
for (const part of parts) {
|
|
28
|
+
current = path.join(current, part);
|
|
29
|
+
check(!fs.lstatSync(current).isSymbolicLink(), 'symlink trace forbidden');
|
|
30
|
+
}
|
|
31
|
+
check(fs.statSync(current).isFile(), 'trace must be a regular file');
|
|
32
|
+
return current;
|
|
33
|
+
}
|
|
34
|
+
function parseTime(at) {
|
|
35
|
+
check(typeof at === 'string' && /^\d{4}-\d\d-\d\dT/.test(at) && /(?:Z|[+-]\d\d:\d\d)$/.test(at), 'timestamp requires ISO timezone');
|
|
36
|
+
const value = Date.parse(at);
|
|
37
|
+
check(Number.isFinite(value), 'invalid timestamp');
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
function integer(value, name) {
|
|
41
|
+
check(Number.isSafeInteger(value) && value >= 0, name + ' must be nonnegative integer');
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
function capture(run, root) {
|
|
45
|
+
required(run, ['mode', 'runId', 'eventsFile', 'eventsSha256', 'quality', 'coverage', 'timing'], 'run');
|
|
46
|
+
check(typeof run.runId === 'string' && /^[A-Za-z0-9_.-]{1,100}$/.test(run.runId), 'invalid runId');
|
|
47
|
+
check(SHA.test(run.eventsSha256), 'invalid trace digest');
|
|
48
|
+
required(run.timing, ['capture','liveReceiptSha256'], 'timing');
|
|
49
|
+
check(['LIVE_MONITORED','REPLAY_OR_UNVERIFIED'].includes(run.timing.capture), 'invalid timing capture');
|
|
50
|
+
check(run.timing.capture === 'LIVE_MONITORED'
|
|
51
|
+
? SHA.test(run.timing.liveReceiptSha256)
|
|
52
|
+
: run.timing.liveReceiptSha256 === null, 'live timing requires external receipt digest; replay must not claim one');
|
|
53
|
+
required(run.coverage, coverageKeys, 'coverage');
|
|
54
|
+
coverageKeys.forEach(k => check(typeof run.coverage[k] === 'boolean', 'coverage flag must be boolean: ' + k));
|
|
55
|
+
required(run.quality, ['correctness', 'tests', 'security', 'evaluatorReceiptSha256'], 'quality');
|
|
56
|
+
['correctness', 'tests', 'security'].forEach(k => check(['PASS','FAIL','NOT_RUN'].includes(run.quality[k]), 'invalid quality: ' + k));
|
|
57
|
+
const receipt = run.quality.evaluatorReceiptSha256;
|
|
58
|
+
check(receipt === null || SHA.test(receipt), 'invalid evaluator receipt digest');
|
|
59
|
+
check(receipt !== null || ['correctness','tests','security'].every(k => run.quality[k] === 'NOT_RUN'), 'quality claims without evaluator receipt');
|
|
60
|
+
|
|
61
|
+
const bytes = readFile(localTrace(root, run.eventsFile));
|
|
62
|
+
check(digest(bytes) === run.eventsSha256, run.mode + ': trace SHA256 mismatch');
|
|
63
|
+
const lines = bytes.toString('utf8').split(/\r?\n/).filter(Boolean);
|
|
64
|
+
check(lines.length >= 2 && lines.length <= 20000, 'trace event count out of bounds');
|
|
65
|
+
const ids = new Set();
|
|
66
|
+
let start = null, end = null, previous = null, calls = 0, humans = 0, rework = 0;
|
|
67
|
+
let usageEvents = 0, input = 0, cached = 0, output = 0;
|
|
68
|
+
for (let i = 0; i < lines.length; i++) {
|
|
69
|
+
let e; try { e = JSON.parse(lines[i]); } catch { throw Error('invalid event JSON at line ' + (i + 1)); }
|
|
70
|
+
required(e, ['id', 'kind', 'at', 'runId'], 'event');
|
|
71
|
+
check(e.runId === run.runId && typeof e.id === 'string' && /^[A-Za-z0-9_.-]{1,128}$/.test(e.id) && !ids.has(e.id), 'duplicate/foreign event identity');
|
|
72
|
+
ids.add(e.id);
|
|
73
|
+
const at = parseTime(e.at);
|
|
74
|
+
check(previous === null || at >= previous, 'nonmonotonic event timeline');
|
|
75
|
+
previous = at;
|
|
76
|
+
if (e.kind === 'start') {
|
|
77
|
+
check(i === 0 && start === null, 'start must be unique and first'); start = at;
|
|
78
|
+
} else if (e.kind === 'end') {
|
|
79
|
+
check(i === lines.length - 1 && end === null, 'end must be unique and last'); end = at;
|
|
80
|
+
} else if (e.kind === 'tool_call') {
|
|
81
|
+
check(e.actor === 'agent', 'tool_call must identify agent actor'); calls++;
|
|
82
|
+
} else if (e.kind === 'human_intervention') {
|
|
83
|
+
check(e.actor === 'human', 'human action requires human actor'); humans++;
|
|
84
|
+
} else if (e.kind === 'rework') {
|
|
85
|
+
check(['agent','human'].includes(e.actor), 'invalid rework actor'); rework++;
|
|
86
|
+
} else if (e.kind === 'provider_usage') {
|
|
87
|
+
check(e.source === 'provider_report', 'provider usage provenance missing');
|
|
88
|
+
check(e.usageSemantics === 'per_turn_delta', 'cumulative usage snapshots cannot be summed as per-turn deltas');
|
|
89
|
+
input += integer(e.inputTokens, 'inputTokens');
|
|
90
|
+
cached += integer(e.cachedInputTokens, 'cachedInputTokens');
|
|
91
|
+
output += integer(e.outputTokens, 'outputTokens'); usageEvents++;
|
|
92
|
+
} else throw Error('unknown event kind');
|
|
93
|
+
check(start !== null, 'event before start');
|
|
94
|
+
}
|
|
95
|
+
check(start !== null && end !== null && end >= start, 'invalid start/end');
|
|
96
|
+
check(cached <= input, 'cached token count exceeds input');
|
|
97
|
+
check(!run.coverage.providerUsage || usageEvents > 0, 'declared provider coverage without usage');
|
|
98
|
+
const observed = (key, value) => run.coverage[key] ? value : null;
|
|
99
|
+
return {
|
|
100
|
+
mode: run.mode,
|
|
101
|
+
runIdDigest: digest(run.runId),
|
|
102
|
+
traceSha256: run.eventsSha256,
|
|
103
|
+
quality: run.quality,
|
|
104
|
+
declaredCoverage: run.coverage,
|
|
105
|
+
timing: run.timing,
|
|
106
|
+
observations: {
|
|
107
|
+
wallMs: run.timing.capture === 'LIVE_MONITORED' ? end - start : null,
|
|
108
|
+
toolCalls: observed('toolEvents', calls),
|
|
109
|
+
humanInterventions: observed('humanEvents', humans),
|
|
110
|
+
reworkEvents: observed('reworkEvents', rework),
|
|
111
|
+
inputTokens: observed('providerUsage', input),
|
|
112
|
+
cachedInputTokens: observed('providerUsage', cached),
|
|
113
|
+
outputTokens: observed('providerUsage', output),
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export function evaluateManifest(manifest, file) {
|
|
118
|
+
required(manifest, ['contract','evidenceClass','caseId','taskSha256','oracleSha256','sourceRevision',
|
|
119
|
+
'permissionsSha256','environmentSha256','model','effort','runs'], 'manifest');
|
|
120
|
+
check(manifest.contract === 'afyx.phase8.paired-evidence/v1', 'unsupported contract');
|
|
121
|
+
check(['owner_observed','synthetic_fixture'].includes(manifest.evidenceClass), 'invalid evidenceClass');
|
|
122
|
+
check(typeof manifest.caseId === 'string' && /^[A-Za-z0-9_.-]{1,100}$/.test(manifest.caseId), 'invalid caseId');
|
|
123
|
+
for (const key of ['taskSha256','oracleSha256','permissionsSha256','environmentSha256']) check(SHA.test(manifest[key]), 'invalid digest: ' + key);
|
|
124
|
+
check(GIT.test(manifest.sourceRevision), 'invalid source revision');
|
|
125
|
+
for (const key of ['model','effort']) check(typeof manifest[key] === 'string' && manifest[key].trim().length > 0 && manifest[key].length < 200, 'invalid ' + key);
|
|
126
|
+
check(Array.isArray(manifest.runs) && manifest.runs.length === 2 &&
|
|
127
|
+
manifest.runs[0].mode === 'OFF' && manifest.runs[1].mode === 'ON', 'requires ordered OFF and ON runs');
|
|
128
|
+
check(manifest.runs[0].runId !== manifest.runs[1].runId, 'paired run identities must differ');
|
|
129
|
+
const root = fs.realpathSync.native(path.dirname(path.resolve(file)));
|
|
130
|
+
const [off, on] = manifest.runs.map(run => capture(run, root));
|
|
131
|
+
const metrics = {};
|
|
132
|
+
for (const key of Object.keys(off.observations)) {
|
|
133
|
+
const a = off.observations[key], b = on.observations[key];
|
|
134
|
+
metrics[key] = a !== null && b !== null
|
|
135
|
+
? {off:a,on:b,deltaOnMinusOff:b-a,percentOnMinusOff:a>0?Number(((b-a)*100/a).toFixed(2)):null}
|
|
136
|
+
: {off:a,on:b,deltaOnMinusOff:null,percentOnMinusOff:null,status:'NOT_AVAILABLE'};
|
|
137
|
+
}
|
|
138
|
+
const qualities = [off,on].flatMap(run => ['correctness','tests','security'].map(k => run.quality[k]));
|
|
139
|
+
const verdict = manifest.evidenceClass === 'synthetic_fixture' ? 'SYNTHETIC_ONLY'
|
|
140
|
+
: qualities.includes('FAIL') ? 'HARD_GATE_FAILED'
|
|
141
|
+
: qualities.includes('NOT_RUN') ? 'QUALITY_EVIDENCE_INCOMPLETE' : 'ELIGIBLE_FOR_INDEPENDENT_REVIEW';
|
|
142
|
+
return {
|
|
143
|
+
contract:'afyx.phase8.paired-summary/v1',
|
|
144
|
+
caseId:manifest.caseId,
|
|
145
|
+
evidenceClass:manifest.evidenceClass,
|
|
146
|
+
sourceRevision:manifest.sourceRevision,
|
|
147
|
+
pairing:{
|
|
148
|
+
taskSha256:manifest.taskSha256,
|
|
149
|
+
oracleSha256:manifest.oracleSha256,
|
|
150
|
+
permissionsSha256:manifest.permissionsSha256,
|
|
151
|
+
environmentSha256:manifest.environmentSha256,
|
|
152
|
+
model:manifest.model, effort:manifest.effort,
|
|
153
|
+
},
|
|
154
|
+
off,on,comparativeMetrics:metrics,verdict,
|
|
155
|
+
independentAcceptance:'NOT_VERIFIED',
|
|
156
|
+
provenance:'Local structured trace hashes verified; evaluator receipts and capture completeness are declared, not independently authenticated.',
|
|
157
|
+
warnings:[
|
|
158
|
+
'Valid intake does not prove engineering correctness, provider billing, or installed Alpha acceptance.',
|
|
159
|
+
'Timing receipts and per-turn token semantics are asserted by the source host; independent reviewer must verify provenance.',
|
|
160
|
+
...(off.observations.wallMs === null || on.observations.wallMs === null ? ['wallMs: NOT_AVAILABLE; replay/receipt times are not agent execution duration'] : []),
|
|
161
|
+
...coverageKeys.filter(k => !off.declaredCoverage[k] || !on.declaredCoverage[k]).map(k => k + ': NOT_AVAILABLE for complete paired comparison'),
|
|
162
|
+
],
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
export function loadManifest(file) {
|
|
166
|
+
const absolute = path.resolve(file), stat = fs.lstatSync(absolute);
|
|
167
|
+
check(stat.isFile() && !stat.isSymbolicLink(), 'manifest must be a regular file');
|
|
168
|
+
let input;
|
|
169
|
+
try { input = JSON.parse(readFile(absolute).toString('utf8')); }
|
|
170
|
+
catch (error) {
|
|
171
|
+
if (error instanceof SyntaxError) throw Error('manifest JSON invalid');
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
return evaluateManifest(input, absolute);
|
|
175
|
+
}
|
|
176
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) {
|
|
177
|
+
if (process.argv.length !== 4 || process.argv[2] !== '--input') {
|
|
178
|
+
process.stderr.write('Usage: node scripts/phase8-paired-evidence.mjs --input LOCAL_MANIFEST_JSON\n');
|
|
179
|
+
process.exitCode = 2;
|
|
180
|
+
} else {
|
|
181
|
+
try {
|
|
182
|
+
const report = loadManifest(process.argv[3]);
|
|
183
|
+
process.stdout.write(JSON.stringify(report,null,2) + '\n');
|
|
184
|
+
if (['HARD_GATE_FAILED','QUALITY_EVIDENCE_INCOMPLETE'].includes(report.verdict)) process.exitCode = 1;
|
|
185
|
+
} catch (error) {
|
|
186
|
+
// Filesystem and parser errors may embed private paths or excerpts.
|
|
187
|
+
// Print only sanitized reasons for errors whose payload is not controlled here.
|
|
188
|
+
const reason = error && typeof error.code === 'string'
|
|
189
|
+
? 'local evidence file unavailable or inaccessible'
|
|
190
|
+
: error.message;
|
|
191
|
+
process.stderr.write('Phase 8 evidence rejected: ' + reason + '\n');
|
|
192
|
+
process.exitCode = 2;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|