afyx-engineering-kit 0.1.0-alpha.6 → 0.1.0-alpha.8
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 -1
- package/afyx-context/src/budget.js +39 -153
- package/afyx-context/src/documentation.js +116 -0
- package/afyx-context/src/index.js +2 -0
- package/afyx-context/src/memory.js +122 -229
- package/afyx-context/src/usage.js +91 -0
- package/afyx-forge/src/cli.js +14 -1
- package/afyx-forge/src/index.js +3 -0
- package/afyx-forge/src/workflow-refiner.js +48 -15
- package/afyx-forge/src/workflow.js +226 -0
- package/afyx-graph/engine/release/RELEASE-MANIFEST.json +16 -6
- package/afyx-graph/engine/release/SHA256SUMS +4 -2
- package/afyx-graph/engine/release/afyx-graph-darwin-arm64.tar.gz +0 -0
- package/afyx-graph/engine/release/afyx-graph-darwin-x64.tar.gz +0 -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/bin/afyx-engineering-kit.mjs +14 -6
- package/install.ps1 +52 -6
- package/install.sh +21 -10
- package/package.json +3 -1
- package/scripts/afyx-capability-orchestrator.mjs +159 -41
- package/scripts/afyx-graph-artifact.mjs +1 -1
- package/scripts/afyx-graph-targets.mjs +8 -0
- package/scripts/afyx-host-adapters.mjs +52 -0
- package/scripts/afyx-host-bridge-lifecycle.mjs +4 -0
- package/scripts/afyx-host-bridge.mjs +25 -0
- package/scripts/afyx-install-backend.mjs +34 -13
- package/scripts/afyx-install-contract.mjs +5 -2
- package/scripts/afyx-install-progress.mjs +88 -0
- package/scripts/afyx-installer-environment.mjs +150 -0
- package/scripts/afyx-local-link-ownership.mjs +16 -0
- package/scripts/afyx-midnight-circuit.mjs +322 -79
- package/scripts/afyx-modular-integration.mjs +3 -0
- package/scripts/afyx-modular-runtime.mjs +3 -0
- package/scripts/afyx-native-execution.mjs +168 -0
- package/scripts/afyx-native-github.mjs +155 -0
- package/scripts/afyx-npm-installer.mjs +56 -28
- package/scripts/afyx-provider-inventory.mjs +6 -3
- package/scripts/afyx-security-auditor.mjs +61 -64
- package/scripts/afyx-skill-catalog.mjs +83 -0
- package/scripts/afyx-skill-engineering.mjs +2 -0
- package/scripts/afyx-universal-runtime.mjs +74 -12
- package/scripts/install-afyx-forge.ps1 +14 -10
- package/scripts/install-afyx-forge.sh +13 -10
- package/scripts/install-afyx-graph.sh +4 -4
- package/scripts/lib/AfyxInstallerProgress.psm1 +11 -0
- package/scripts/lib/AfyxSkillLifecycle.psm1 +42 -6
- package/scripts/lib/afyx-installer-progress.sh +30 -0
- package/scripts/link-global-dev.ps1 +10 -3
- package/scripts/link-global-dev.sh +10 -8
- package/scripts/prepare-g6-package.mjs +13 -28
- package/scripts/resolve-git-release-artifacts.mjs +5 -4
- package/scripts/stage-npm-release.mjs +3 -1
- package/scripts/validate-release-zip-graph.mjs +2 -2
- package/uninstall.ps1 +2 -0
- package/verify.ps1 +9 -2
- package/verify.sh +6 -4
|
@@ -40,15 +40,47 @@ function Restore-AfyxInterruptedSkillTransaction {
|
|
|
40
40
|
|
|
41
41
|
function Get-AfyxSkillDigest {
|
|
42
42
|
[CmdletBinding()]
|
|
43
|
-
param([Parameter(Mandatory)][string]$Directory)
|
|
43
|
+
param([Parameter(Mandatory)][string]$Directory, [switch]$LegacyNls)
|
|
44
44
|
$root = [IO.Path]::GetFullPath($Directory).TrimEnd([IO.Path]::DirectorySeparatorChar, [IO.Path]::AltDirectorySeparatorChar)
|
|
45
45
|
$lines = @()
|
|
46
46
|
$files = @(Get-ChildItem -LiteralPath $root -File -Recurse -Force | Where-Object {
|
|
47
47
|
$_.Name -ne $script:MarkerName -and $_.FullName -notmatch '[\\/]\.git[\\/]'
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
})
|
|
49
|
+
[string[]]$paths = @($files | ForEach-Object { $_.FullName })
|
|
50
|
+
# Culture sorting differs between .NET Framework/NLS and .NET/ICU. New
|
|
51
|
+
# ownership digests use one stable order on both PowerShell generations.
|
|
52
|
+
$comparer = [StringComparer]::OrdinalIgnoreCase
|
|
53
|
+
if ($LegacyNls) {
|
|
54
|
+
if ($env:OS -ne 'Windows_NT') { throw 'Legacy NLS skill digests require Windows.' }
|
|
55
|
+
if (-not ('Afyx.LegacySkillPathComparer' -as [type])) {
|
|
56
|
+
Add-Type -TypeDefinition @'
|
|
57
|
+
using System;
|
|
58
|
+
using System.Collections.Generic;
|
|
59
|
+
using System.ComponentModel;
|
|
60
|
+
using System.Runtime.InteropServices;
|
|
61
|
+
namespace Afyx {
|
|
62
|
+
public sealed class LegacySkillPathComparer : IComparer<string>, System.Collections.IComparer {
|
|
63
|
+
private readonly string locale;
|
|
64
|
+
public LegacySkillPathComparer(string locale) { this.locale = locale; }
|
|
65
|
+
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
66
|
+
private static extern int CompareStringEx(string locale, uint flags, string left, int leftLength,
|
|
67
|
+
string right, int rightLength, IntPtr version, IntPtr reserved, IntPtr parameter);
|
|
68
|
+
public int Compare(string left, string right) {
|
|
69
|
+
int result = CompareStringEx(locale, 1, left, -1, right, -1, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
|
|
70
|
+
if (result == 0) throw new Win32Exception(Marshal.GetLastWin32Error());
|
|
71
|
+
return result - 2;
|
|
72
|
+
}
|
|
73
|
+
int System.Collections.IComparer.Compare(object left, object right) { return Compare((string)left, (string)right); }
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
'@
|
|
77
|
+
}
|
|
78
|
+
$comparer = New-Object Afyx.LegacySkillPathComparer ([Globalization.CultureInfo]::CurrentCulture.Name)
|
|
79
|
+
}
|
|
80
|
+
[Array]::Sort($paths, $comparer)
|
|
81
|
+
foreach ($file in $paths) {
|
|
82
|
+
$relative = $file.Substring($root.Length).TrimStart('\', '/').Replace('\', '/')
|
|
83
|
+
$lines += "$(Get-FileHash -Algorithm SHA256 -LiteralPath $file | Select-Object -ExpandProperty Hash) ./$relative"
|
|
52
84
|
}
|
|
53
85
|
$bytes = [Text.Encoding]::UTF8.GetBytes(($lines -join "`n") + "`n")
|
|
54
86
|
$sha = [Security.Cryptography.SHA256]::Create()
|
|
@@ -100,6 +132,9 @@ function Get-AfyxSkillOwnership {
|
|
|
100
132
|
if ($ExpectedOwner -eq 'afyx') {
|
|
101
133
|
if ([string]$marker.content_sha256 -notmatch '^[0-9a-f]{64}$') { return 'FOREIGN_UNPROVEN' }
|
|
102
134
|
if ((Get-AfyxSkillDigest -Directory $Target) -eq $marker.content_sha256) { return 'AFYX_OWNED_UNMODIFIED' }
|
|
135
|
+
# Legacy Windows PowerShell markers remain valid only when the
|
|
136
|
+
# complete current file set exactly reproduces their NLS digest.
|
|
137
|
+
if ($env:OS -eq 'Windows_NT' -and (Get-AfyxSkillDigest -Directory $Target -LegacyNls) -eq $marker.content_sha256) { return 'AFYX_OWNED_UNMODIFIED' }
|
|
103
138
|
return 'AFYX_OWNED_MODIFIED'
|
|
104
139
|
}
|
|
105
140
|
if (-not (Test-Path -LiteralPath (Join-Path $Target '.git'))) { return 'FOREIGN_UNPROVEN' }
|
|
@@ -127,7 +162,8 @@ function Get-AfyxLegacySkillProvenance {
|
|
|
127
162
|
if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { return 'UNKNOWN' }
|
|
128
163
|
if ($Owner -eq 'afyx') {
|
|
129
164
|
if ($LegacyContentSha256 -notmatch '^[0-9a-f]{64}$') { return 'UNKNOWN' }
|
|
130
|
-
if ((Get-AfyxSkillDigest -Directory $Target) -eq $LegacyContentSha256
|
|
165
|
+
if ((Get-AfyxSkillDigest -Directory $Target) -eq $LegacyContentSha256 -or
|
|
166
|
+
($env:OS -eq 'Windows_NT' -and (Get-AfyxSkillDigest -Directory $Target -LegacyNls) -eq $LegacyContentSha256)) { return 'MATCH' }
|
|
131
167
|
$manifest = Join-Path $Target 'SKILL.md'
|
|
132
168
|
if (-not (Test-Path -LiteralPath $manifest -PathType Leaf)) { return 'UNKNOWN' }
|
|
133
169
|
$content = Get-Content -Raw -LiteralPath $manifest -Encoding utf8
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Native Bash 3.2 adapter for the shared installer progress protocol.
|
|
2
|
+
if [[ "${AFYX_INSTALL_PROGRESS:-0}" == 1 ]]; then exec 3>&1; fi
|
|
3
|
+
afyx_progress_escape() {
|
|
4
|
+
local text="$1"
|
|
5
|
+
text="${text//\\/\\\\}"; text="${text//\"/\\\"}"
|
|
6
|
+
text="${text//$'\n'/\\n}"; text="${text//$'\r'/\\r}"; text="${text//$'\t'/\\t}"
|
|
7
|
+
printf '%s' "$text"
|
|
8
|
+
}
|
|
9
|
+
afyx_progress_event() {
|
|
10
|
+
[[ "${AFYX_INSTALL_PROGRESS:-0}" == 1 ]] || return 0
|
|
11
|
+
local operation="$1" component="$2" phase="$3" state="$4" message="$5" encoded_component=null error=null completed=null total=null
|
|
12
|
+
[[ -z "$component" ]] || encoded_component="\"$(afyx_progress_escape "$component")\""
|
|
13
|
+
[[ "$state" != failed ]] || error='"BACKEND_OPERATION_FAILED"'
|
|
14
|
+
if [[ "$state" == completed ]]; then completed=1; total=1; fi
|
|
15
|
+
printf 'AFYX_PROGRESS {"contract":"AfyxInstallerProgress/v1","operationId":"%s","componentId":%s,"phase":"%s","state":"%s","completed":%s,"total":%s,"message":"%s","timestamp":"%s","errorCode":%s}\n' \
|
|
16
|
+
"$operation" "$encoded_component" "$phase" "$state" "$completed" "$total" "$(afyx_progress_escape "$message")" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$error" >&3
|
|
17
|
+
}
|
|
18
|
+
afyx_run_install_operation() {
|
|
19
|
+
local component="$1" phase="$2" message="$3" operation="native:$RANDOM:$RANDOM" status
|
|
20
|
+
shift 3
|
|
21
|
+
case "$phase" in install|update|repair|configure|verify|cleanup|rollback) ;; *) phase=install ;; esac
|
|
22
|
+
afyx_progress_event "$operation" "$component" "$phase" running "$message"
|
|
23
|
+
if "$@"; then
|
|
24
|
+
afyx_progress_event "$operation" "$component" "$phase" completed "$message"
|
|
25
|
+
else
|
|
26
|
+
status=$?
|
|
27
|
+
afyx_progress_event "$operation" "$component" "$phase" failed "$message"
|
|
28
|
+
return "$status"
|
|
29
|
+
fi
|
|
30
|
+
}
|
|
@@ -92,21 +92,28 @@ if (-not $npmCmd) {
|
|
|
92
92
|
|
|
93
93
|
$nodeVerStr = (& $nodeCmd.Source --version).Trim()
|
|
94
94
|
$nodeMajor = [int]($nodeVerStr -replace '^v(\d+)\..*', '$1')
|
|
95
|
-
|
|
95
|
+
$nodeMinor = [int]($nodeVerStr -replace '^v\d+\.(\d+)\..*', '$1')
|
|
96
|
+
if ($nodeMajor -lt 22 -or ($nodeMajor -eq 22 -and $nodeMinor -lt 5)) {
|
|
96
97
|
Write-Step 'FAIL' 'Node.js Version' "Node.js >= 22.5.0 required (detected $nodeVerStr)"
|
|
97
98
|
exit 1
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
$globalModules = (& $npmCmd.Source root --global).Trim()
|
|
102
|
+
if ($LASTEXITCODE -ne 0) { throw 'Cannot resolve the configured npm global root.' }
|
|
103
|
+
& $nodeCmd.Source (Join-Path $RepositoryRoot 'scripts/afyx-local-link-ownership.mjs') $RepositoryRoot $globalModules
|
|
104
|
+
if ($LASTEXITCODE -ne 0) { throw 'Refusing to replace or unlink a foreign npm installation.' }
|
|
105
|
+
|
|
100
106
|
if ($Uninstall) {
|
|
101
107
|
Write-Step 'INFO' 'Uninstall' 'Unlinking global afyx-engineering-kit package...'
|
|
102
108
|
try {
|
|
103
109
|
Push-Location $RepositoryRoot
|
|
104
110
|
& $npmCmd.Source unlink --global afyx-engineering-kit 2>&1 | Out-Null
|
|
111
|
+
if ($LASTEXITCODE -ne 0) { throw 'npm unlink failed; installation state must be reviewed.' }
|
|
105
112
|
Pop-Location
|
|
106
113
|
Write-Step 'PASS' 'Uninstall' 'Successfully unlinked global afyx-engineering-kit.'
|
|
107
114
|
} catch {
|
|
108
115
|
Pop-Location
|
|
109
|
-
|
|
116
|
+
throw 'npm unlink failed; existing installation was preserved for review.'
|
|
110
117
|
}
|
|
111
118
|
exit 0
|
|
112
119
|
}
|
|
@@ -189,5 +196,5 @@ if ($npxVerExit -ne 0 -or $npxHelpExit -ne 0 -or $npxDryExit -ne 0) {
|
|
|
189
196
|
|
|
190
197
|
Write-Step 'PASS' 'BARE_NPX_ON_WINDOWS' 'Bare "npx afyx-engineering-kit install" resolved offline from temp directory.'
|
|
191
198
|
Write-Step 'PASS' 'OFFLINE_REGISTRY_ISOLATION' 'Executed with npm_config_offline=true; zero registry queries required.'
|
|
192
|
-
Write-Step '
|
|
199
|
+
Write-Step 'INFO' 'GRAPH_RUNTIME_AVAILABILITY' 'Not tested by the local-link verifier; use Full runtime acceptance separately.'
|
|
193
200
|
Write-Step 'PASS' 'LOCAL_BARE_NPX_VERIFIED' 'Local bare NPX resolution setup is healthy and verified.'
|
|
@@ -38,9 +38,6 @@ if ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then
|
|
|
38
38
|
if [ -s "${HOME:-}/.nvm/nvm.sh" ]; then
|
|
39
39
|
# shellcheck source=/dev/null
|
|
40
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
41
|
fi
|
|
45
42
|
fi
|
|
46
43
|
|
|
@@ -57,7 +54,8 @@ fi
|
|
|
57
54
|
NODE_VER="$(node --version)"
|
|
58
55
|
NODE_MAJOR="${NODE_VER%%.*}"
|
|
59
56
|
NODE_MAJOR="${NODE_MAJOR#v}"
|
|
60
|
-
|
|
57
|
+
NODE_MINOR="${NODE_VER#*.}"; NODE_MINOR="${NODE_MINOR%%.*}"
|
|
58
|
+
if [ "$NODE_MAJOR" -lt 22 ] || { [ "$NODE_MAJOR" -eq 22 ] && [ "$NODE_MINOR" -lt 5 ]; }; then
|
|
61
59
|
printf "[FAIL] Node.js Version: Node.js >= 22.5.0 required (detected %s)\n" "$NODE_VER" >&2
|
|
62
60
|
exit 1
|
|
63
61
|
fi
|
|
@@ -81,9 +79,14 @@ fi
|
|
|
81
79
|
|
|
82
80
|
chmod +x "$ENTRY_POINT" "$REPOSITORY_ROOT/install.sh" "$REPOSITORY_ROOT/verify.sh" 2>/dev/null || true
|
|
83
81
|
|
|
82
|
+
GLOBAL_MODULES="$(npm root --global)"
|
|
83
|
+
node "$SCRIPT_DIR/afyx-local-link-ownership.mjs" "$REPOSITORY_ROOT" "$GLOBAL_MODULES" || {
|
|
84
|
+
printf '[FAIL] Ownership: refusing to replace or unlink a foreign npm installation.\n' >&2; exit 1;
|
|
85
|
+
}
|
|
86
|
+
|
|
84
87
|
if [ "$MODE" = "uninstall" ]; then
|
|
85
88
|
printf "[INFO] Uninstall: Unlinking global afyx-engineering-kit package...\n"
|
|
86
|
-
(cd "$REPOSITORY_ROOT" && npm unlink --global afyx-engineering-kit
|
|
89
|
+
(cd "$REPOSITORY_ROOT" && npm unlink --global afyx-engineering-kit)
|
|
87
90
|
printf "[PASS] Uninstall: Successfully unlinked global afyx-engineering-kit.\n"
|
|
88
91
|
exit 0
|
|
89
92
|
fi
|
|
@@ -113,8 +116,7 @@ CLI_VER="$(afyx-engineering-kit --version)"
|
|
|
113
116
|
printf "[PASS] Version: %s\n" "$CLI_VER"
|
|
114
117
|
|
|
115
118
|
# Test bare npx execution offline from a temporary location
|
|
116
|
-
TEMP_TEST_DIR="
|
|
117
|
-
mkdir -p "$TEMP_TEST_DIR"
|
|
119
|
+
TEMP_TEST_DIR="$(mktemp -d "${TMPDIR:-/tmp}/afyx-npx-verify.XXXXXX")"
|
|
118
120
|
trap 'rm -rf "$TEMP_TEST_DIR"' EXIT
|
|
119
121
|
|
|
120
122
|
(
|
|
@@ -126,5 +128,5 @@ trap 'rm -rf "$TEMP_TEST_DIR"' EXIT
|
|
|
126
128
|
|
|
127
129
|
printf "[PASS] BARE_NPX_ON_WSL2: Bare \"npx afyx-engineering-kit install\" resolved offline from temp directory.\n"
|
|
128
130
|
printf "[PASS] OFFLINE_REGISTRY_ISOLATION: Executed with npm_config_offline=true; zero registry queries required.\n"
|
|
129
|
-
printf "[
|
|
131
|
+
printf "[INFO] GRAPH_RUNTIME_AVAILABILITY: Not tested by this local-link verifier; Full runtime acceptance is separate.\n"
|
|
130
132
|
printf "[PASS] LOCAL_BARE_NPX_VERIFIED: Local bare NPX resolution setup on Linux/WSL2 is healthy and verified.\n"
|
|
@@ -26,10 +26,7 @@ import { createDeterministicArchive } from '../afyx-graph/engine/scripts/determi
|
|
|
26
26
|
import { stampArtifact } from './afyx-graph-artifact.mjs';
|
|
27
27
|
import { resolveAndStageGitReleaseArtifacts } from './resolve-git-release-artifacts.mjs';
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
['afyx-graph-win32-x64.zip', 'win32-x64'],
|
|
31
|
-
['afyx-graph-linux-x64.tar.gz', 'linux-x64'],
|
|
32
|
-
]);
|
|
29
|
+
import { GRAPH_PACKAGE_TARGETS, graphArchiveName, graphManifestTargets } from './afyx-graph-targets.mjs';
|
|
33
30
|
|
|
34
31
|
export function buildGraphBundle({ root, target, revision, outputDir }) {
|
|
35
32
|
const engineRoot = join(root, 'afyx-graph', 'engine');
|
|
@@ -151,36 +148,21 @@ export function buildGraphReleaseArtifacts(root, revision) {
|
|
|
151
148
|
const releaseDir = join(root, 'afyx-graph', 'engine', 'release');
|
|
152
149
|
mkdirSync(releaseDir, { recursive: true });
|
|
153
150
|
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const sumsContent = `${linuxSum} afyx-graph-linux-x64.tar.gz\n${winSum} afyx-graph-win32-x64.zip\n`;
|
|
161
|
-
writeFileSync(join(releaseDir, 'SHA256SUMS'), sumsContent, 'utf8');
|
|
162
|
-
|
|
151
|
+
const artifacts = GRAPH_PACKAGE_TARGETS.map((target) => {
|
|
152
|
+
const archive = buildGraphBundle({ root, target, revision, outputDir: releaseDir });
|
|
153
|
+
return { file: graphArchiveName(target), target, sha256: createHash('sha256').update(readFileSync(archive)).digest('hex') };
|
|
154
|
+
});
|
|
155
|
+
writeFileSync(join(releaseDir, 'SHA256SUMS'), artifacts.map((a) => `${a.sha256} ${a.file}`).join('\n') + '\n', 'utf8');
|
|
163
156
|
const graphVersion = JSON.parse(readFileSync(join(root, 'afyx-graph', 'engine', 'package.json'), 'utf8')).version;
|
|
164
157
|
const manifest = {
|
|
165
|
-
schema:
|
|
158
|
+
schema: 2,
|
|
166
159
|
product: 'Afyx Graph',
|
|
167
160
|
product_version: graphVersion,
|
|
168
161
|
release_tag: `afyx-graph-v${graphVersion}`,
|
|
169
162
|
source_revision: revision,
|
|
170
163
|
integrity_claim: 'sha256',
|
|
171
164
|
publisher_authenticity: 'requires-independent-attestation',
|
|
172
|
-
artifacts
|
|
173
|
-
{
|
|
174
|
-
file: 'afyx-graph-linux-x64.tar.gz',
|
|
175
|
-
target: 'linux-x64',
|
|
176
|
-
sha256: linuxSum,
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
file: 'afyx-graph-win32-x64.zip',
|
|
180
|
-
target: 'win32-x64',
|
|
181
|
-
sha256: winSum,
|
|
182
|
-
},
|
|
183
|
-
],
|
|
165
|
+
artifacts,
|
|
184
166
|
};
|
|
185
167
|
writeFileSync(join(releaseDir, 'RELEASE-MANIFEST.json'), `${JSON.stringify(manifest, null, 2)}\n`, 'utf8');
|
|
186
168
|
}
|
|
@@ -200,6 +182,8 @@ export function checkGraphReleaseValid(root, revision) {
|
|
|
200
182
|
if (manifest.source_revision !== revision) return false;
|
|
201
183
|
const graphVersion = JSON.parse(readFileSync(join(root, 'afyx-graph', 'engine', 'package.json'), 'utf8')).version;
|
|
202
184
|
if (manifest.product_version !== graphVersion) return false;
|
|
185
|
+
if (manifest.artifacts?.length !== graphManifestTargets(manifest).length) return false;
|
|
186
|
+
for (const target of graphManifestTargets(manifest)) if (!manifest.artifacts.some((a) => a.target === target && a.file === graphArchiveName(target))) return false;
|
|
203
187
|
for (const artifact of manifest.artifacts) {
|
|
204
188
|
const filePath = join(release, artifact.file);
|
|
205
189
|
if (!existsSync(filePath)) return false;
|
|
@@ -221,15 +205,16 @@ export function prepareG6Package(root, revision, { autoBuild = false } = {}) {
|
|
|
221
205
|
}
|
|
222
206
|
|
|
223
207
|
const manifest = JSON.parse(readFileSync(join(release, 'RELEASE-MANIFEST.json'), 'utf8'));
|
|
208
|
+
const expected = new Map(graphManifestTargets(manifest).map((target) => [graphArchiveName(target), target]));
|
|
224
209
|
const graphVersion = JSON.parse(readFileSync(join(root, 'afyx-graph', 'engine', 'package.json'), 'utf8')).version;
|
|
225
|
-
if (manifest.schema
|
|
210
|
+
if (![1, 2].includes(manifest.schema) || manifest.product !== 'Afyx Graph' ||
|
|
226
211
|
manifest.source_revision !== revision || manifest.product_version !== graphVersion ||
|
|
227
212
|
!Array.isArray(manifest.artifacts) || manifest.artifacts.length !== expected.size) {
|
|
228
213
|
throw new Error('Graph release manifest does not match this source revision and product');
|
|
229
214
|
}
|
|
230
215
|
const sumLines = readFileSync(join(release, 'SHA256SUMS'), 'utf8').trim().split(/\r?\n/);
|
|
231
216
|
const sums = new Map(sumLines.map((line) => {
|
|
232
|
-
const match = /^([0-9a-f]{64}) (afyx-graph-(?:win32|linux
|
|
217
|
+
const match = /^([0-9a-f]{64}) (afyx-graph-(?:win32-x64|linux-x64|darwin-arm64|darwin-x64)\.(?:zip|tar\.gz))$/.exec(line);
|
|
233
218
|
if (!match) throw new Error('Malformed Graph SHA256SUMS');
|
|
234
219
|
return [match[2], match[1]];
|
|
235
220
|
}));
|
|
@@ -23,6 +23,7 @@ import { dirname, join, resolve } from 'node:path';
|
|
|
23
23
|
import { fileURLToPath } from 'node:url';
|
|
24
24
|
import { tmpdir } from 'node:os';
|
|
25
25
|
import { verifyGraphArchivePaths } from './verify-graph-archive.mjs';
|
|
26
|
+
import { graphManifestTargets, graphArchiveName } from './afyx-graph-targets.mjs';
|
|
26
27
|
|
|
27
28
|
const CANONICAL_REPO = 'a5zero7/afyx-engineering-kit';
|
|
28
29
|
const GITHUB_API_BASE = `https://api.github.com/repos/${CANONICAL_REPO}`;
|
|
@@ -36,7 +37,7 @@ const REQUIRED_ARTIFACTS = Object.freeze([
|
|
|
36
37
|
]);
|
|
37
38
|
|
|
38
39
|
export function validateReleaseChecksums(manifest, sumsText, revision) {
|
|
39
|
-
const archives =
|
|
40
|
+
const archives = graphManifestTargets(manifest).map(graphArchiveName);
|
|
40
41
|
if (manifest?.source_revision !== revision || !Array.isArray(manifest.artifacts) ||
|
|
41
42
|
manifest.artifacts.length !== archives.length) throw new Error('Incomplete or stale Graph release manifest');
|
|
42
43
|
const entries = new Map();
|
|
@@ -256,7 +257,7 @@ export async function resolveAndStageGitReleaseArtifacts(root, revision, options
|
|
|
256
257
|
const expectedSums = validateReleaseChecksums(manifestObj, sumsContent, revision);
|
|
257
258
|
|
|
258
259
|
// 4. Download and verify each required archive
|
|
259
|
-
const archivesToDownload =
|
|
260
|
+
const archivesToDownload = graphManifestTargets(manifestObj).map(graphArchiveName);
|
|
260
261
|
for (const archiveName of archivesToDownload) {
|
|
261
262
|
const archiveUrl = `${downloadBase}/${resolvedTag}/${archiveName}`;
|
|
262
263
|
const archiveBuf = await fetchArtifact(archiveUrl, { timeoutMs: 60000 });
|
|
@@ -285,7 +286,7 @@ export async function resolveAndStageGitReleaseArtifacts(root, revision, options
|
|
|
285
286
|
}
|
|
286
287
|
|
|
287
288
|
// 5. Atomically stage all verified artifacts to releaseDir
|
|
288
|
-
for (const file of
|
|
289
|
+
for (const file of ['RELEASE-MANIFEST.json', 'SHA256SUMS', ...graphManifestTargets(manifestObj).map(graphArchiveName)]) {
|
|
289
290
|
copyFileSync(join(tempStage, file), join(releaseDir, file));
|
|
290
291
|
}
|
|
291
292
|
|
|
@@ -293,7 +294,7 @@ export async function resolveAndStageGitReleaseArtifacts(root, revision, options
|
|
|
293
294
|
success: true,
|
|
294
295
|
tag: resolvedTag,
|
|
295
296
|
revision,
|
|
296
|
-
artifacts:
|
|
297
|
+
artifacts: ['RELEASE-MANIFEST.json', 'SHA256SUMS', ...graphManifestTargets(manifestObj).map(graphArchiveName)],
|
|
297
298
|
};
|
|
298
299
|
} finally {
|
|
299
300
|
if (existsSync(tempStage)) {
|
|
@@ -7,6 +7,7 @@ import { tmpdir } from 'node:os';
|
|
|
7
7
|
import { dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
9
9
|
import { buildGraphReleaseArtifacts, checkGraphReleaseValid } from './prepare-g6-package.mjs';
|
|
10
|
+
import { GRAPH_PACKAGE_TARGETS, graphArchiveName } from './afyx-graph-targets.mjs';
|
|
10
11
|
|
|
11
12
|
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
12
13
|
const args = process.argv.slice(2);
|
|
@@ -60,7 +61,7 @@ run('tar', ['-xf', archive, '-C', stage]);
|
|
|
60
61
|
writeFileSync(join(stage, '.afyx-source-revision'), `${revision}\n`, 'utf8');
|
|
61
62
|
const release = join('afyx-graph', 'engine', 'release');
|
|
62
63
|
mkdirSync(join(stage, release), { recursive: true });
|
|
63
|
-
for (const name of [
|
|
64
|
+
for (const name of [...GRAPH_PACKAGE_TARGETS.map(graphArchiveName), 'SHA256SUMS', 'RELEASE-MANIFEST.json']) {
|
|
64
65
|
const source = join(root, release, name);
|
|
65
66
|
if (!statSync(source).isFile()) throw new Error(`Missing regular Graph artifact: ${name}`);
|
|
66
67
|
copyFileSync(source, join(stage, release, name));
|
|
@@ -75,6 +76,7 @@ const fileNames = new Set(pkg.files.map((file) => file.path));
|
|
|
75
76
|
for (const required of ['.afyx-source-revision', 'bin/afyx-engineering-kit.mjs',
|
|
76
77
|
`${release.replaceAll('\\', '/')}/RELEASE-MANIFEST.json`,
|
|
77
78
|
`${release.replaceAll('\\', '/')}/afyx-graph-win32-x64.zip`,
|
|
79
|
+
...GRAPH_PACKAGE_TARGETS.filter((target) => target.startsWith('darwin')).map((target) => `${release.replaceAll('\\', '/')}/${graphArchiveName(target)}`),
|
|
78
80
|
`${release.replaceAll('\\', '/')}/afyx-graph-linux-x64.tar.gz`]) {
|
|
79
81
|
if (!fileNames.has(required)) throw new Error(`Incomplete npm package: ${required}`);
|
|
80
82
|
}
|
|
@@ -20,7 +20,7 @@ if (mode === 'build') {
|
|
|
20
20
|
const archive = join(release, archiveName);
|
|
21
21
|
const manifest = JSON.parse(readFileSync(join(release, 'RELEASE-MANIFEST.json'), 'utf8'));
|
|
22
22
|
const graphVersion = JSON.parse(readFileSync(join(root, 'afyx-graph', 'engine', 'package.json'), 'utf8')).version;
|
|
23
|
-
if (manifest.schema
|
|
23
|
+
if (![1, 2].includes(manifest.schema) || manifest.product !== 'Afyx Graph' ||
|
|
24
24
|
manifest.source_revision !== revision || manifest.product_version !== graphVersion ||
|
|
25
25
|
!Array.isArray(manifest.artifacts)) throw new Error('Graph manifest source/product mismatch');
|
|
26
26
|
const matches = manifest.artifacts.filter((item) => item.file === archiveName);
|
|
@@ -28,7 +28,7 @@ if (mode === 'build') {
|
|
|
28
28
|
throw new Error('Missing or invalid Windows x64 Graph manifest entry');
|
|
29
29
|
}
|
|
30
30
|
const lines = readFileSync(join(release, 'SHA256SUMS'), 'utf8').trim().split(/\r?\n/);
|
|
31
|
-
const sums = lines.map((line) => /^([0-9a-f]{64}) (afyx-graph-(?:win32|linux
|
|
31
|
+
const sums = lines.map((line) => /^([0-9a-f]{64}) (afyx-graph-(?:win32-x64|linux-x64|darwin-arm64|darwin-x64)\.(?:zip|tar\.gz))$/.exec(line));
|
|
32
32
|
if (sums.some((match) => !match) || sums.filter((match) => match[2] === archiveName).length !== 1) {
|
|
33
33
|
throw new Error('Missing, duplicate, or malformed Windows Graph SHA256SUMS entry');
|
|
34
34
|
}
|
package/uninstall.ps1
CHANGED
|
@@ -25,6 +25,8 @@ param(
|
|
|
25
25
|
|
|
26
26
|
Set-StrictMode -Version Latest
|
|
27
27
|
$ErrorActionPreference = 'Stop'
|
|
28
|
+
$SelectedComponent = @($SelectedComponent | ForEach-Object { $_ -split ',' } | ForEach-Object { $_.Trim() } | Where-Object { $_ })
|
|
29
|
+
$Provider = @($Provider | ForEach-Object { $_ -split ',' } | ForEach-Object { $_.Trim() } | Where-Object { $_ })
|
|
28
30
|
|
|
29
31
|
Write-Host 'Afyx Codex Engineering Kit — Windows uninstaller (PowerShell)'
|
|
30
32
|
if ($All) {
|
package/verify.ps1
CHANGED
|
@@ -20,8 +20,12 @@ param(
|
|
|
20
20
|
|
|
21
21
|
Set-StrictMode -Version Latest
|
|
22
22
|
$ErrorActionPreference = 'Stop'
|
|
23
|
+
if ($CustomComponent.Count) {
|
|
24
|
+
$CustomComponent = @($CustomComponent | ForEach-Object { $_ -split ',' } | ForEach-Object { $_.Trim() } | Where-Object { $_ })
|
|
25
|
+
}
|
|
23
26
|
$coreFailure = $false
|
|
24
27
|
$configuredProviders = @()
|
|
28
|
+
$claudeCommand = Get-Command claude -ErrorAction SilentlyContinue
|
|
25
29
|
$codexHome = if ($env:CODEX_HOME) { $env:CODEX_HOME } else { Join-Path $env:USERPROFILE '.codex' }
|
|
26
30
|
$configPath = Join-Path $codexHome 'config.toml'
|
|
27
31
|
$graphRoot = if ($GraphRuntimeRoot) { $GraphRuntimeRoot } elseif ($env:AFYX_GRAPH_RUNTIME_ROOT) { $env:AFYX_GRAPH_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\graph' }
|
|
@@ -45,6 +49,7 @@ function Write-Result([string]$State, [string]$Name, [string]$Detail = '') {
|
|
|
45
49
|
Import-Module (Join-Path $PSScriptRoot 'scripts\lib\AfyxComponents.psm1') -Force
|
|
46
50
|
Import-Module (Join-Path $PSScriptRoot 'scripts\lib\AfyxSkillLifecycle.psm1') -Force -DisableNameChecking
|
|
47
51
|
$providerIds = @(Get-AfyxProviderRegistry | ForEach-Object { [string]$_.provider })
|
|
52
|
+
$Provider = @($Provider | ForEach-Object { $_ -split ',' } | ForEach-Object { $_.Trim() } | Where-Object { $_ } | Select-Object -Unique)
|
|
48
53
|
$unknownProviders = @($Provider | Where-Object { $_ -notin $providerIds })
|
|
49
54
|
if ($unknownProviders.Count) { throw "Unknown provider(s): $($unknownProviders -join ', ')" }
|
|
50
55
|
$providerSkillRoots = @()
|
|
@@ -112,7 +117,6 @@ if ($Provider.Count -and -not $SkipProviderConfiguration) {
|
|
|
112
117
|
'--node', $nodeCommand.Source, '--entry', $entry)
|
|
113
118
|
$codexHost = Get-AfyxCodexHost
|
|
114
119
|
$codexCommand = if ($codexHost.State -eq 'CLI_READY') { [pscustomobject]@{ Source = $codexHost.Path } } else { $null }
|
|
115
|
-
$claudeCommand = Get-Command claude -ErrorAction SilentlyContinue
|
|
116
120
|
if ($codexCommand) { $providerArguments += @('--codex', $codexCommand.Source) }
|
|
117
121
|
if ($claudeCommand) { $providerArguments += @('--claude', $claudeCommand.Source) }
|
|
118
122
|
if ($ClaudeConfigDir) { $providerArguments += @('--claude-config-dir', $ClaudeConfigDir) }
|
|
@@ -236,13 +240,16 @@ if ($claudeRequired) {
|
|
|
236
240
|
if ($claude) {
|
|
237
241
|
try {
|
|
238
242
|
$version = (& claude --version 2>$null) -join ' '
|
|
243
|
+
if ($LASTEXITCODE -ne 0) { throw 'version command returned non-zero exit code' }
|
|
239
244
|
Write-Result 'OK' 'Claude Code host' "detected ($version)"
|
|
240
245
|
} catch {
|
|
241
246
|
Write-Result 'FAIL' 'Claude Code host' 'version command failed'
|
|
242
247
|
$coreFailure = $true
|
|
243
248
|
}
|
|
249
|
+
} elseif ([bool](Get-ChildItem -Path (Join-Path $env:USERPROFILE '.vscode\extensions\anthropic.claude-code-*') -Directory -ErrorAction SilentlyContinue | Select-Object -First 1)) {
|
|
250
|
+
Write-Result 'OK' 'Claude Code host' 'supported VS Code extension detected; standalone CLI is not installed'
|
|
244
251
|
} else {
|
|
245
|
-
Write-Result 'FAIL' 'Claude Code host' 'not found; install Claude Code CLI'
|
|
252
|
+
Write-Result 'FAIL' 'Claude Code host' 'not found; install Claude Code CLI or the supported Claude Code VS Code extension'
|
|
246
253
|
$coreFailure = $true
|
|
247
254
|
}
|
|
248
255
|
}
|
package/verify.sh
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
report_json=false
|
|
4
|
+
skip_provider_configuration=false
|
|
4
5
|
verification_rows=()
|
|
5
6
|
|
|
6
7
|
PACKAGE_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
@@ -32,6 +33,7 @@ while (($#)); do
|
|
|
32
33
|
--context-runtime-root) context_root="$2"; shift 2 ;;
|
|
33
34
|
--forge-runtime-root) forge_root="$2"; shift 2 ;;
|
|
34
35
|
--report-json) report_json=true; shift ;;
|
|
36
|
+
--skip-provider-configuration) skip_provider_configuration=true; shift ;;
|
|
35
37
|
--preset) preset="$2"; shift 2 ;;
|
|
36
38
|
--custom-component) custom_component_list="${custom_component_list:+$custom_component_list;}$2"; shift 2 ;;
|
|
37
39
|
--provider) provider_list="$2"; provider_explicit=true; shift 2 ;;
|
|
@@ -142,12 +144,12 @@ if command -v tar >/dev/null 2>&1 && { command -v shasum >/dev/null 2>&1 || comm
|
|
|
142
144
|
codex_detected=false
|
|
143
145
|
if command -v codex >/dev/null 2>&1; then
|
|
144
146
|
codex_detected=true
|
|
145
|
-
if version="$(codex --version 2>/dev/null)"; then result OK 'Codex CLI' "$version"; elif
|
|
147
|
+
if version="$(codex --version 2>/dev/null)"; then result OK 'Codex CLI' "$version"; elif [[ ",$provider_list," == *,codex,* ]]; then result FAIL 'Codex CLI' 'version command failed'; core_failure=true; else result WARN 'Codex CLI' 'version command failed (not selected)'; fi
|
|
146
148
|
else result SKIP 'Codex CLI' 'PROVIDER_NOT_INSTALLED'; fi
|
|
147
149
|
extension_detected=false
|
|
148
150
|
for extension in "$HOME"/.vscode/extensions/openai.chatgpt-*; do [[ -d "$extension" ]] && { extension_detected=true; break; }; done
|
|
149
151
|
if "$extension_detected"; then result OK 'VS Code extension' 'detected'; else result INFO 'VS Code extension' 'not detected'; fi
|
|
150
|
-
if "$provider_explicit"; then
|
|
152
|
+
if "$provider_explicit" && ! "$skip_provider_configuration"; then
|
|
151
153
|
if [[ ",$provider_list," == *,codex,* ]] && ! "$codex_detected"; then
|
|
152
154
|
result FAIL 'Codex provider' 'selected native Codex CLI is unavailable; VS Code extension alone cannot register MCP'; core_failure=true
|
|
153
155
|
fi
|
|
@@ -200,7 +202,7 @@ case "$AFYX_STATE" in
|
|
|
200
202
|
INVALID) result WARN 'Afyx Graph' 'invalid metadata (optional)' ;;
|
|
201
203
|
*) result WARN 'Afyx Graph' "state $AFYX_STATE: $AFYX_DETAIL (optional)" ;;
|
|
202
204
|
esac
|
|
203
|
-
if [[ "$AFYX_STATE" == HEALTHY ]] && command -v node >/dev/null 2>&1 && "$codex_detected"; then
|
|
205
|
+
if [[ "$AFYX_STATE" == HEALTHY ]] && command -v node >/dev/null 2>&1 && "$codex_detected" && ! "$skip_provider_configuration"; then
|
|
204
206
|
set +e
|
|
205
207
|
integration_json="$(node "$PACKAGE_ROOT/scripts/afyx-mcp-integration.mjs" --node "$(command -v node)" --entry "$AFYX_PATH/current/lib/dist/bin/afyx-graph.js" --codex "$(command -v codex)" --codex-home "$codex_home" 2>/dev/null)"
|
|
206
208
|
set -e
|
|
@@ -228,7 +230,7 @@ elif [[ "$AFYX_STATE" == HEALTHY ]] && command -v node >/dev/null 2>&1; then
|
|
|
228
230
|
else result FAIL 'Afyx Graph MCP' "direct standalone handshake failed: $graph_probe"; core_failure=true; fi
|
|
229
231
|
elif [[ "$AFYX_STATE" != HEALTHY ]]; then result INFO 'Afyx Graph MCP' 'MCP_BLOCKED: Graph runtime unavailable'
|
|
230
232
|
else result INFO 'Afyx Graph MCP' 'MCP_NOT_CONFIGURED'; fi
|
|
231
|
-
if [[ ",$provider_list," == *,antigravity,* && "$AFYX_STATE" == HEALTHY ]] && command -v node >/dev/null 2>&1; then
|
|
233
|
+
if [[ ",$provider_list," == *,antigravity,* && "$AFYX_STATE" == HEALTHY ]] && command -v node >/dev/null 2>&1 && ! "$skip_provider_configuration"; then
|
|
232
234
|
set +e
|
|
233
235
|
provider_json="$(node "$PACKAGE_ROOT/scripts/afyx-provider-integration.mjs" --providers antigravity --scope "$provider_scope" --workspace-root "$workspace_root" --gemini-home "$gemini_home" --node "$(command -v node)" --entry "$AFYX_PATH/current/lib/dist/bin/afyx-graph.js" 2>/dev/null)"; provider_exit=$?
|
|
234
236
|
set -e
|