afyx-engineering-kit 0.1.0-alpha.4 → 0.1.0-alpha.7
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/README.md +12 -0
- package/afyx-graph/engine/release/RELEASE-MANIFEST.json +3 -3
- package/afyx-graph/engine/release/SHA256SUMS +2 -2
- 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 +22 -1
- package/install.ps1 +84 -13
- package/install.sh +91 -4
- package/package.json +2 -1
- package/scripts/afyx-install-backend.mjs +46 -0
- package/scripts/afyx-install-contract.mjs +139 -0
- package/scripts/afyx-midnight-circuit.mjs +328 -0
- package/scripts/afyx-npm-installer.mjs +27 -5
- package/scripts/install-afyx-forge.ps1 +14 -10
- package/scripts/install-afyx-forge.sh +13 -10
- package/scripts/install-afyx-graph.ps1 +75 -29
- package/scripts/lib/AfyxPlatform.ps1 +133 -0
- package/scripts/lib/AfyxPlatform.psm1 +6 -0
- package/scripts/package-release-zip.ps1 +124 -0
- package/scripts/validate-release-zip-graph.mjs +55 -0
- package/verify.ps1 +27 -10
- package/verify.sh +10 -2
- package/afyx-context/test-fixtures/coordination-worker.mjs +0 -52
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/__init__.py +0 -1
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/__manifest__.py +0 -4
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/models/__init__.py +0 -1
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/models/sale_order.py +0 -5
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/__init__.py +0 -1
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/__manifest__.py +0 -10
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/models/__init__.py +0 -2
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/models/sale_order.py +0 -20
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/models/sale_order_audit.py +0 -11
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/security/ir.model.access.csv +0 -2
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/views/sale_order_views.xml +0 -14
package/.afyx-source-revision
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
251f73a8f91cd7b9194a2bd730966c1d92f86da0
|
package/README.md
CHANGED
|
@@ -150,6 +150,11 @@ With Node.js 22.5 or newer, the intended public registry command is:
|
|
|
150
150
|
npx afyx-engineering-kit install
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
+
In a release containing Midnight Circuit, an interactive ANSI terminal shows
|
|
154
|
+
Detect → Select → Configure → Review/Apply → Finish. Use `--ui plain` for text
|
|
155
|
+
output; CI and terminals without ANSI support use the text flow automatically.
|
|
156
|
+
macOS does not yet have a verified Full Graph archive.
|
|
157
|
+
|
|
153
158
|
Use `--preset recommended` for core engineering skills or `--preset full`
|
|
154
159
|
for the prebuilt Graph, Context, Forge, and applicable skills. `full` requires
|
|
155
160
|
Windows x64 or Linux x64 for Graph. Provider configuration is optional and
|
|
@@ -185,6 +190,13 @@ To remove the link:
|
|
|
185
190
|
|
|
186
191
|
### GitHub prerelease tarball fallback
|
|
187
192
|
|
|
193
|
+
The GitHub-generated `dev.zip` is a source snapshot. It does not include the
|
|
194
|
+
revision-matched Graph runtime needed by the Full preset. A Windows x64 Full
|
|
195
|
+
release ZIP is built separately from an immutable commit with a verified Graph
|
|
196
|
+
archive and `.afyx-source-revision` marker. Its download link will be added
|
|
197
|
+
after the public release and anonymous installation checks pass. Node.js 22.5+
|
|
198
|
+
is required; Windows PowerShell 5.1 and PowerShell 7 are the intended hosts.
|
|
199
|
+
|
|
188
200
|
Alternatively, use the prebuilt tarball from the [v0.1.0-alpha.2 GitHub prerelease](https://github.com/a5zero7/afyx-engineering-kit/releases/tag/v0.1.0-alpha.2):
|
|
189
201
|
|
|
190
202
|
```bash
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
"product": "Afyx Graph",
|
|
4
4
|
"product_version": "1.0.0",
|
|
5
5
|
"release_tag": "afyx-graph-v1.0.0",
|
|
6
|
-
"source_revision": "
|
|
6
|
+
"source_revision": "251f73a8f91cd7b9194a2bd730966c1d92f86da0",
|
|
7
7
|
"integrity_claim": "sha256",
|
|
8
8
|
"publisher_authenticity": "requires-independent-attestation",
|
|
9
9
|
"artifacts": [
|
|
10
10
|
{
|
|
11
11
|
"file": "afyx-graph-linux-x64.tar.gz",
|
|
12
12
|
"target": "linux-x64",
|
|
13
|
-
"sha256": "
|
|
13
|
+
"sha256": "5c657a46f86652d9f32f1b8045c60a41ab8c6f2bc46aeb55a943db1b65ea0b83"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"file": "afyx-graph-win32-x64.zip",
|
|
17
17
|
"target": "win32-x64",
|
|
18
|
-
"sha256": "
|
|
18
|
+
"sha256": "720878c50518e4650a529cd6a766d4c8cdec173863799b8ea9c966c36601bd25"
|
|
19
19
|
}
|
|
20
20
|
]
|
|
21
21
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
5c657a46f86652d9f32f1b8045c60a41ab8c6f2bc46aeb55a943db1b65ea0b83 afyx-graph-linux-x64.tar.gz
|
|
2
|
+
720878c50518e4650a529cd6a766d4c8cdec173863799b8ea9c966c36601bd25 afyx-graph-win32-x64.zip
|
|
Binary file
|
|
Binary file
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
buildSubprocessCall,
|
|
13
13
|
executeSubprocess,
|
|
14
14
|
} from '../scripts/afyx-npm-installer.mjs';
|
|
15
|
+
import { runMidnightCircuit, terminalMode } from '../scripts/afyx-midnight-circuit.mjs';
|
|
15
16
|
|
|
16
17
|
function verifyNodeRuntime() {
|
|
17
18
|
const version = process.versions.node;
|
|
@@ -44,12 +45,32 @@ async function main() {
|
|
|
44
45
|
process.exit(1);
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
let finish;
|
|
49
|
+
if (parsed.command === 'install') {
|
|
50
|
+
const mode = terminalMode({ requested: parsed.options.ui || 'auto' });
|
|
51
|
+
const hasSelections = parsed.options.preset || parsed.options.provider || parsed.options.providerScope ||
|
|
52
|
+
parsed.options.skipProviderConfiguration || parsed.options.componentActions.length || parsed.options.customComponents.length;
|
|
53
|
+
if (parsed.options.ui === 'tui' && (hasSelections || parsed.options.nonInteractive || parsed.options.dryRun || parsed.options.validateOnly)) {
|
|
54
|
+
throw new Error('--ui tui runs the interactive installer; remove scripted selection/preview flags or use --ui plain.');
|
|
55
|
+
}
|
|
56
|
+
if (mode === 'tui' && !hasSelections &&
|
|
57
|
+
!parsed.options.nonInteractive && !parsed.options.dryRun && !parsed.options.validateOnly) {
|
|
58
|
+
const selection = await runMidnightCircuit({ options: parsed.options });
|
|
59
|
+
if (!selection) { console.log('Installation canceled without changes.'); return; }
|
|
60
|
+
finish = selection.finish;
|
|
61
|
+
Object.assign(parsed.options, selection);
|
|
62
|
+
delete parsed.options.finish;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
47
65
|
const callInfo = buildSubprocessCall(parsed.command, parsed.options);
|
|
66
|
+
if (parsed.options.ui === 'plain') callInfo.env = { ...callInfo.env, NO_COLOR: '1' };
|
|
48
67
|
|
|
49
68
|
try {
|
|
50
69
|
const exitCode = await executeSubprocess(callInfo);
|
|
51
|
-
|
|
70
|
+
const finalCode = finish ? await finish(exitCode) : exitCode;
|
|
71
|
+
process.exit(finalCode);
|
|
52
72
|
} catch (err) {
|
|
73
|
+
if (finish) await finish(1);
|
|
53
74
|
console.error(`Failed to launch installer lifecycle subprocess (${callInfo.executable}):`, err.message);
|
|
54
75
|
process.exit(1);
|
|
55
76
|
}
|
package/install.ps1
CHANGED
|
@@ -22,8 +22,11 @@ param(
|
|
|
22
22
|
[string]$ClaudeHome = $(if ($env:CLAUDE_CONFIG_DIR) { $env:CLAUDE_CONFIG_DIR } else { Join-Path $env:USERPROFILE '.claude' }),
|
|
23
23
|
[string]$ClaudeConfigDir = $(if ($env:CLAUDE_CONFIG_DIR) { $env:CLAUDE_CONFIG_DIR } else { '' }),
|
|
24
24
|
[switch]$SkipProviderConfiguration,
|
|
25
|
+
[switch]$PlanJson,
|
|
26
|
+
[string]$ExpectedPlan = '',
|
|
25
27
|
[string]$ContextRuntimeRoot = $(if ($env:AFYX_CONTEXT_RUNTIME_ROOT) { $env:AFYX_CONTEXT_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\context' }),
|
|
26
28
|
[string]$ForgeRuntimeRoot = $(if ($env:AFYX_FORGE_RUNTIME_ROOT) { $env:AFYX_FORGE_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\forge' }),
|
|
29
|
+
[string]$GraphRuntimeRoot = $(if ($env:AFYX_GRAPH_RUNTIME_ROOT) { $env:AFYX_GRAPH_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\graph' }),
|
|
27
30
|
[string]$AfyxInstallRoot = $(if ($env:AFYX_INSTALL_ROOT) { $env:AFYX_INSTALL_ROOT } else { Join-Path $env:USERPROFILE '.afyx' }),
|
|
28
31
|
[string]$HostBridgeRuntimeRoot = $(if ($env:AFYX_HOST_BRIDGE_RUNTIME_ROOT) { $env:AFYX_HOST_BRIDGE_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\host-bridge' })
|
|
29
32
|
)
|
|
@@ -32,6 +35,7 @@ Set-StrictMode -Version Latest
|
|
|
32
35
|
$ErrorActionPreference = 'Stop'
|
|
33
36
|
|
|
34
37
|
$packageRoot = $PSScriptRoot
|
|
38
|
+
if (($PlanJson -or $ExpectedPlan) -and -not $Preset) { throw 'Structured planning requires an explicit preset.' }
|
|
35
39
|
if ($CustomComponent.Count) {
|
|
36
40
|
$CustomComponent = @($CustomComponent | ForEach-Object { $_ -split ',' } | ForEach-Object { $_.Trim() } | Where-Object { $_ })
|
|
37
41
|
}
|
|
@@ -53,13 +57,14 @@ $contextCompanionSource = Join-Path $packageRoot 'skills\afyx-context'
|
|
|
53
57
|
$forgeInstaller = Join-Path $packageRoot 'scripts\install-afyx-forge.ps1'
|
|
54
58
|
$forgeMetadataPath = Join-Path $packageRoot 'afyx-forge\afyx-forge.json'
|
|
55
59
|
$forgeCompanionSource = Join-Path $packageRoot 'skills\afyx-forge'
|
|
56
|
-
$graphRuntimeRoot = if ($env:AFYX_GRAPH_RUNTIME_ROOT) { $env:AFYX_GRAPH_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\graph' }
|
|
60
|
+
$graphRuntimeRoot = if ($GraphRuntimeRoot) { $GraphRuntimeRoot } elseif ($env:AFYX_GRAPH_RUNTIME_ROOT) { $env:AFYX_GRAPH_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\graph' }
|
|
57
61
|
$codexHome = if ($env:CODEX_HOME) { $env:CODEX_HOME } else { Join-Path $env:USERPROFILE '.codex' }
|
|
58
62
|
|
|
59
63
|
if ($InstallUsageTracker -and $SkipUsageTracker) { throw '-InstallUsageTracker and -SkipUsageTracker cannot be used together.' }
|
|
60
64
|
|
|
61
65
|
# One component truth: scripts/components.json, read through the shared module.
|
|
62
66
|
Import-Module (Join-Path $packageRoot 'scripts\lib\AfyxComponents.psm1') -Force
|
|
67
|
+
Import-Module (Join-Path $packageRoot 'scripts\lib\AfyxPlatform.psm1') -Force
|
|
63
68
|
Import-Module (Join-Path $packageRoot 'scripts\lib\AfyxSkillLifecycle.psm1') -Force -DisableNameChecking
|
|
64
69
|
Import-Module (Join-Path $packageRoot 'scripts\lib\AfyxTerminal.psm1') -Force
|
|
65
70
|
$terminal = New-AfyxTerminalContext
|
|
@@ -464,6 +469,60 @@ if ($controlPlan) {
|
|
|
464
469
|
}
|
|
465
470
|
}
|
|
466
471
|
|
|
472
|
+
if ($PlanJson -or $ExpectedPlan) {
|
|
473
|
+
$planRows = @()
|
|
474
|
+
foreach ($component in (Get-AfyxComponentContract)) {
|
|
475
|
+
$id = [string]$component.id
|
|
476
|
+
$state = $componentStates[$id]
|
|
477
|
+
$item = @($controlPlan.Components | Where-Object { $_.Id -eq $id })[0]
|
|
478
|
+
$planRows += [ordered]@{
|
|
479
|
+
id = $id; name = [string]$component.name; type = [string]$component.type
|
|
480
|
+
currentState = [string]$state.State; desired = [bool]$item.Desired
|
|
481
|
+
backendAction = [string]$actionDecisions[$id]; target = [string]$state.Path
|
|
482
|
+
ownership = [string]$item.ActualOwnership; version = [string]$state.Version
|
|
483
|
+
availableVersion = Get-AvailableVersion $id
|
|
484
|
+
compatibility = $(if ($item.Drift -eq 'NOT_APPLICABLE') { 'NOT SUPPORTED' } else { 'SUPPORTED' })
|
|
485
|
+
detail = [string]$state.Detail
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
$configurationPaths = @()
|
|
489
|
+
if (-not $SkipProviderConfiguration) {
|
|
490
|
+
if ('codex' -in $Provider) { $configurationPaths += (Join-Path $codexHome 'config.toml') }
|
|
491
|
+
if ('antigravity' -in $Provider) { $configurationPaths += $(if ($ProviderScope -eq 'workspace') { Join-Path $WorkspaceRoot '.agents\mcp_config.json' } else { Join-Path $GeminiHome 'config\mcp_config.json' }) }
|
|
492
|
+
if ('claude' -in $Provider) { $configurationPaths += $(if ($ProviderScope -eq 'workspace') { Join-Path $WorkspaceRoot '.mcp.json' } else { Join-Path $(if ($ClaudeConfigDir) { $ClaudeConfigDir } else { $env:USERPROFILE }) '.claude.json' }) }
|
|
493
|
+
}
|
|
494
|
+
$planInput = [ordered]@{ preset = $Preset; providers = ($Provider -join ','); scope = $ProviderScope
|
|
495
|
+
configureProviders = -not [bool]$SkipProviderConfiguration; workspaceRoot = $WorkspaceRoot
|
|
496
|
+
sourceRoot = $packageRoot; platform = 'windows'; components = $planRows
|
|
497
|
+
configurationPaths = $configurationPaths; expectedFingerprint = $ExpectedPlan }
|
|
498
|
+
$planInput.blockers = @()
|
|
499
|
+
$planInput.additionalTargets = @()
|
|
500
|
+
foreach ($root in @($SkillsRoot) + @($additionalSkillRoots)) {
|
|
501
|
+
foreach ($item in @($controlPlan.Components | Where-Object { $_.Desired })) {
|
|
502
|
+
if ($item.Id -in @('efficient-coding', 'odoo-engineering', 'afyx-engineering-expert') -or
|
|
503
|
+
(-not $SkipProviderConfiguration -and $item.Id -in @('afyx-context', 'afyx-forge'))) {
|
|
504
|
+
$planInput.additionalTargets += [ordered]@{ id = $item.Id; type = 'skill'; target = (Join-Path $root $item.Id) }
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (-not $SkipProviderConfiguration -and $Provider.Count) {
|
|
509
|
+
$planInput.additionalTargets += [ordered]@{ id = 'afyx-host-bridge'; type = 'runtime'; target = $HostBridgeRuntimeRoot }
|
|
510
|
+
}
|
|
511
|
+
if (-not (Get-Command git -ErrorAction SilentlyContinue)) { $planInput.blockers += 'Git is required by the installer.' }
|
|
512
|
+
if (-not $SkipProviderConfiguration) {
|
|
513
|
+
if ('codex' -in $Provider -and -not ($codexCommandDetected -or $vscodeExtensionDetected)) { $planInput.blockers += 'Selected Codex host is unavailable.' }
|
|
514
|
+
if ('antigravity' -in $Provider -and -not ($antigravityCommandDetected -or $antigravityIdeDetected)) { $planInput.blockers += 'Selected Antigravity host is unavailable.' }
|
|
515
|
+
if ('claude' -in $Provider -and -not ($claudeCommandDetected -or $claudeVsCodeDetected)) { $planInput.blockers += 'Selected Claude Code host is unavailable.' }
|
|
516
|
+
}
|
|
517
|
+
$previousOutputEncoding = $OutputEncoding
|
|
518
|
+
try {
|
|
519
|
+
$OutputEncoding = [Text.UTF8Encoding]::new($false)
|
|
520
|
+
$planOutput = $planInput | ConvertTo-Json -Depth 8 -Compress | & node (Join-Path $packageRoot 'scripts\afyx-install-contract.mjs') plan
|
|
521
|
+
if ($LASTEXITCODE -ne 0) { throw 'PLAN_CHANGED or backend plan could not be created; review a new plan before applying.' }
|
|
522
|
+
} finally { $OutputEncoding = $previousOutputEncoding }
|
|
523
|
+
if ($PlanJson) { Write-Output $planOutput; return }
|
|
524
|
+
}
|
|
525
|
+
|
|
467
526
|
$codexCliDetected = [bool]$codexCommandDetected
|
|
468
527
|
$graphMetadata = Get-Content -Raw -LiteralPath $graphMetadataPath | ConvertFrom-Json
|
|
469
528
|
$distProductPath = Join-Path $packageRoot 'afyx-graph\engine\scripts\distribution-product.json'
|
|
@@ -513,7 +572,7 @@ Write-AfyxSection -Title 'Prerequisite Inventory' -Terminal $terminal
|
|
|
513
572
|
$gitVersion = try { (& git --version 2>$null) -join ' ' } catch { '' }
|
|
514
573
|
$nodeVersion = try { (& node --version 2>$null) -join ' ' } catch { '' }
|
|
515
574
|
$npmVersion = try { (& npm --version 2>$null) -join ' ' } catch { '' }
|
|
516
|
-
Write-AfyxStatus -Status HEALTHY -Name 'OS/architecture [REQUIRED]' -Detail
|
|
575
|
+
Write-AfyxStatus -Status HEALTHY -Name 'OS/architecture [REQUIRED]' -Detail (Get-AfyxPlatformDescription) -Terminal $terminal
|
|
517
576
|
Write-AfyxStatus -Status HEALTHY -Name 'Platform shell [REQUIRED]' -Detail "PowerShell $($PSVersionTable.PSVersion)" -Terminal $terminal
|
|
518
577
|
Write-AfyxStatus -Status $(if ($gitVersion) { 'HEALTHY' } else { 'BLOCKED' }) -Name 'Git [REQUIRED]' -Detail $(if ($gitVersion) { $gitVersion } else { 'missing; install Git for Windows from https://git-scm.com/' }) -Terminal $terminal
|
|
519
578
|
$codexRequired = 'codex' -in $Provider -or -not $Provider.Count
|
|
@@ -688,18 +747,22 @@ if ($graphAction -ne 'skip') {
|
|
|
688
747
|
$gitCmd = Get-Command git -ErrorAction SilentlyContinue
|
|
689
748
|
$tarCmd = Get-Command tar -ErrorAction SilentlyContinue
|
|
690
749
|
$enginePackage = Join-Path $packageRoot 'afyx-graph\engine\package.json'
|
|
691
|
-
if (
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
750
|
+
if ($Offline) {
|
|
751
|
+
if (-not (Test-Path -LiteralPath $enginePackage -PathType Leaf)) {
|
|
752
|
+
throw "Afyx Graph installation is BLOCKED: release cache is absent and source engine is missing at $enginePackage."
|
|
753
|
+
}
|
|
754
|
+
if (-not $sourceIsCheckout -or -not $gitCmd -or -not $tarCmd) {
|
|
755
|
+
throw "Afyx Graph installation is BLOCKED: offline installation requires a precompiled release cache or a clean Git checkout with tar."
|
|
756
|
+
}
|
|
696
757
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
758
|
+
if ($sourceIsCheckout -and $gitCmd) {
|
|
759
|
+
$gitStatus = & $gitCmd.Source -C $packageRoot status --porcelain -- afyx-graph 2>$null
|
|
760
|
+
$graphSourceDirty = [bool]($gitStatus -join '')
|
|
761
|
+
if ($graphSourceDirty -and -not $AllowDirtySource) {
|
|
762
|
+
$headCommit = (& $gitCmd.Source -C $packageRoot rev-parse HEAD 2>$null).Trim()
|
|
763
|
+
if (-not $headCommit -or $headCommit -notmatch '^[0-9a-f]{7,64}$') {
|
|
764
|
+
throw "Afyx Graph installation is BLOCKED: local afyx-graph source has uncommitted changes and HEAD commit is unavailable. Commit the changes or specify -AllowDirtySource for development builds."
|
|
765
|
+
}
|
|
703
766
|
}
|
|
704
767
|
}
|
|
705
768
|
}
|
|
@@ -796,6 +859,14 @@ function Invoke-AfyxInstallStage {
|
|
|
796
859
|
|
|
797
860
|
if ($wizardMode) { Show-AfyxStep -Current 4 -Terminal $terminal }
|
|
798
861
|
|
|
862
|
+
if ($ExpectedPlan) {
|
|
863
|
+
$previousOutputEncoding = $OutputEncoding
|
|
864
|
+
try {
|
|
865
|
+
$OutputEncoding = [Text.UTF8Encoding]::new($false)
|
|
866
|
+
$null = $planInput | ConvertTo-Json -Depth 8 -Compress | & node (Join-Path $packageRoot 'scripts\afyx-install-contract.mjs') plan
|
|
867
|
+
if ($LASTEXITCODE -ne 0) { throw 'PLAN_CHANGED: state changed before mutation; review a new plan.' }
|
|
868
|
+
} finally { $OutputEncoding = $previousOutputEncoding }
|
|
869
|
+
}
|
|
799
870
|
$summary = [ordered]@{}
|
|
800
871
|
$changesApplied = $false
|
|
801
872
|
$skillActions = @{}
|
package/install.sh
CHANGED
|
@@ -17,6 +17,7 @@ update_installed=false
|
|
|
17
17
|
component_actions=()
|
|
18
18
|
component_action_count=0
|
|
19
19
|
preset=
|
|
20
|
+
implicit_preset=false
|
|
20
21
|
custom_component_list=
|
|
21
22
|
offline=false
|
|
22
23
|
no_build_fallback=false
|
|
@@ -31,6 +32,10 @@ gemini_home="${AFYX_GEMINI_HOME:-$HOME/.gemini}"
|
|
|
31
32
|
claude_home="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
|
|
32
33
|
claude_config_dir="${CLAUDE_CONFIG_DIR:-}"
|
|
33
34
|
skip_provider_configuration=false
|
|
35
|
+
plan_json=false
|
|
36
|
+
expected_plan=
|
|
37
|
+
contract_plan_ready=false
|
|
38
|
+
contract_plan_actions=()
|
|
34
39
|
|
|
35
40
|
usage() {
|
|
36
41
|
printf '%s\n' 'Usage: ./install.sh [--skills-root PATH] [--context-runtime-root PATH] [--forge-runtime-root PATH] [--provider codex|antigravity|claude[,..]] [--provider-scope global|workspace] [--workspace-root PATH] [--gemini-home PATH] [--claude-home PATH] [--claude-config-dir PATH] [--skip-provider-configuration] [--preset minimal|recommended|full|custom] [--custom-component ID] [--component ID=skip|install|update|repair|adopt] [--update-installed] [--force] [--validate-only] [--dry-run]'
|
|
@@ -58,12 +63,17 @@ while (($#)); do
|
|
|
58
63
|
--claude-home) (($# >= 2)) || { printf '%s\n' '--claude-home requires a value.' >&2; exit 2; }; claude_home="$2"; shift 2 ;;
|
|
59
64
|
--claude-config-dir) (($# >= 2)) || { printf '%s\n' '--claude-config-dir requires a value.' >&2; exit 2; }; claude_config_dir="$2"; shift 2 ;;
|
|
60
65
|
--skip-provider-configuration) skip_provider_configuration=true; shift ;;
|
|
66
|
+
--plan-json) plan_json=true; shift ;;
|
|
67
|
+
--expected-plan) (($# >= 2)) || exit 2; expected_plan="$2"; shift 2 ;;
|
|
61
68
|
--validate-only) validate_only=true; shift ;;
|
|
62
69
|
--dry-run) dry_run=true; shift ;;
|
|
63
70
|
-h|--help) usage; exit 0 ;;
|
|
64
71
|
*) printf 'Unknown option: %s\n' "$1" >&2; usage >&2; exit 2 ;;
|
|
65
72
|
esac
|
|
66
73
|
done
|
|
74
|
+
if { "$plan_json" || [[ -n "$expected_plan" ]]; } && [[ -z "$preset" ]]; then
|
|
75
|
+
printf 'Structured planning requires an explicit preset.\n' >&2; exit 2
|
|
76
|
+
fi
|
|
67
77
|
|
|
68
78
|
if [[ "$provider_explicit" == false && -t 0 && -t 1 && -z "${CI:-}" ]]; then
|
|
69
79
|
detected_providers=
|
|
@@ -86,6 +96,17 @@ if [[ "$provider_explicit" == false && -t 0 && -t 1 && -z "${CI:-}" ]]; then
|
|
|
86
96
|
esac
|
|
87
97
|
fi
|
|
88
98
|
|
|
99
|
+
# An implicit provider is optional when its host is absent. Explicit selections
|
|
100
|
+
# still fail the host preflight below instead of silently skipping registration.
|
|
101
|
+
if [[ "$provider_explicit" == false && "$provider_list" == codex && "$skip_provider_configuration" == false ]] &&
|
|
102
|
+
! command -v codex >/dev/null 2>&1; then
|
|
103
|
+
codex_extension_present=false
|
|
104
|
+
for extension in "$HOME"/.vscode/extensions/openai.chatgpt-*; do
|
|
105
|
+
[[ -d "$extension" ]] && { codex_extension_present=true; break; }
|
|
106
|
+
done
|
|
107
|
+
if ! "$codex_extension_present"; then skip_provider_configuration=true; fi
|
|
108
|
+
fi
|
|
109
|
+
|
|
89
110
|
case "$provider_scope" in global|workspace) ;; *) printf 'Unknown provider scope: %s\n' "$provider_scope" >&2; exit 2 ;; esac
|
|
90
111
|
old_ifs=$IFS; IFS=','
|
|
91
112
|
for provider_id in $provider_list; do case "$provider_id" in codex|antigravity|claude) ;; *) printf 'Unknown provider: %s\n' "$provider_id" >&2; exit 2 ;; esac; done
|
|
@@ -153,6 +174,11 @@ component_version() { afyx_component_evaluate "$1"; printf '%s' "$AFYX_VERSION";
|
|
|
153
174
|
run() { if "$dry_run"; then printf '+ '; printf '%q ' "$@"; printf '\n'; else "$@"; fi; }
|
|
154
175
|
interactive=false
|
|
155
176
|
if [[ -t 0 && -z "${CI:-}" ]] && ! "$dry_run"; then interactive=true; fi
|
|
177
|
+
if [[ -z "$preset" && "$component_action_count" -eq 0 && "$interactive" == false &&
|
|
178
|
+
"$validate_only" == false && "$update_installed" == false && "$force" == false ]]; then
|
|
179
|
+
preset=recommended
|
|
180
|
+
implicit_preset=true
|
|
181
|
+
fi
|
|
156
182
|
|
|
157
183
|
available_version() {
|
|
158
184
|
case "$1" in
|
|
@@ -187,8 +213,17 @@ explicit_action() {
|
|
|
187
213
|
|
|
188
214
|
component_action() {
|
|
189
215
|
local id="$1" label="$2" state="$3" installed="$4" available action= answer default
|
|
216
|
+
if "$contract_plan_ready"; then
|
|
217
|
+
local contract_decision
|
|
218
|
+
for contract_decision in ${contract_plan_actions[@]+"${contract_plan_actions[@]}"}; do
|
|
219
|
+
if [[ "${contract_decision%%=*}" == "$id" ]]; then printf '%s' "${contract_decision#*=}"; return; fi
|
|
220
|
+
done
|
|
221
|
+
fi
|
|
190
222
|
available="$(available_version "$id")"
|
|
191
223
|
if action="$(explicit_action "$id")"; then :
|
|
224
|
+
elif "$implicit_preset" && [[ "$state" == DRIFTED && "$(afyx_component_field "$id" type)" == skill ]]; then
|
|
225
|
+
# A default selection does not authorize discarding local skill edits.
|
|
226
|
+
action=skip
|
|
192
227
|
elif [[ -n "$preset" ]]; then
|
|
193
228
|
afyx_control_classify "$id" "$state" "$preset" "$custom_component_list" "$provider_list"
|
|
194
229
|
if [[ "$AFYX_DESIRED" != true || "$AFYX_DRIFT" == NOT_APPLICABLE ]]; then action=skip
|
|
@@ -331,7 +366,7 @@ if [[ -n "$preset" ]]; then
|
|
|
331
366
|
done
|
|
332
367
|
fi
|
|
333
368
|
printf '\nProvider Plan\n'
|
|
334
|
-
if "$skip_provider_configuration"; then printf 'Provider configuration: skipped
|
|
369
|
+
if "$skip_provider_configuration"; then printf 'Provider configuration: skipped (requested or no implicit host)\n'; fi
|
|
335
370
|
old_ifs=$IFS; IFS=','
|
|
336
371
|
for provider_id in $provider_list; do
|
|
337
372
|
if [[ "$provider_id" == codex ]]; then
|
|
@@ -423,6 +458,53 @@ if "$validate_only"; then
|
|
|
423
458
|
exit 0
|
|
424
459
|
fi
|
|
425
460
|
|
|
461
|
+
if "$plan_json" || [[ -n "$expected_plan" ]]; then
|
|
462
|
+
command -v node >/dev/null 2>&1 || { printf 'Node.js is required for structured planning.\n' >&2; exit 1; }
|
|
463
|
+
contract_args=(plan-rows "$preset" "$provider_list" "$provider_scope" "$([[ "$skip_provider_configuration" == true ]] && printf false || printf true)" "$workspace_root" "$PACKAGE_ROOT" "$(afyx_platform)" "$expected_plan")
|
|
464
|
+
command -v git >/dev/null 2>&1 || contract_args+=(--block 'Git is required by the installer.')
|
|
465
|
+
if ! "$skip_provider_configuration"; then
|
|
466
|
+
if [[ ",$provider_list," == *,codex,* ]] && ! "$codex_cli_detected" && ! "$vscode_extension_detected"; then contract_args+=(--block 'Selected Codex host is unavailable.'); fi
|
|
467
|
+
if [[ ",$provider_list," == *,antigravity,* ]] && ! "$antigravity_detected"; then contract_args+=(--block 'Selected Antigravity host is unavailable.'); fi
|
|
468
|
+
if [[ ",$provider_list," == *,claude,* ]] && ! "$claude_cli_detected" && ! "$claude_vscode_detected"; then contract_args+=(--block 'Selected Claude Code host is unavailable.'); fi
|
|
469
|
+
fi
|
|
470
|
+
for plan_id in $(afyx_component_ids); do
|
|
471
|
+
plan_state="$(component_state "$plan_id")"
|
|
472
|
+
afyx_component_evaluate "$plan_id"
|
|
473
|
+
plan_detail="$AFYX_DETAIL"; plan_version="$AFYX_VERSION"
|
|
474
|
+
afyx_control_classify "$plan_id" "$plan_state" "$preset" "$custom_component_list" "$provider_list"
|
|
475
|
+
plan_desired="$AFYX_DESIRED"; plan_ownership="$AFYX_ACTUAL_OWNERSHIP"
|
|
476
|
+
plan_compatibility=SUPPORTED
|
|
477
|
+
[[ "$AFYX_DRIFT" == NOT_APPLICABLE ]] && plan_compatibility='NOT SUPPORTED'
|
|
478
|
+
if [[ "$AFYX_REPAIR" == BLOCKED ]]; then plan_action=blocked
|
|
479
|
+
else plan_action="$(component_action "$plan_id" "$(afyx_component_field "$plan_id" name)" "$plan_state" "$plan_version")"; fi
|
|
480
|
+
contract_plan_actions+=("$plan_id=$plan_action")
|
|
481
|
+
contract_args+=(--component "$plan_id" "$(afyx_component_field "$plan_id" name)" "$(afyx_component_field "$plan_id" type)" "$plan_state" "$plan_desired" "$plan_action" "$(afyx_component_root "$plan_id")" "$plan_ownership" "$plan_version" "$(available_version "$plan_id")" "$plan_compatibility" "$plan_detail")
|
|
482
|
+
done
|
|
483
|
+
for plan_root in "$skills_root" ${additional_skill_roots[@]+"${additional_skill_roots[@]}"}; do
|
|
484
|
+
for plan_id in $(afyx_component_ids); do
|
|
485
|
+
afyx_component_desired "$plan_id" "$preset" "$custom_component_list" "$provider_list" || continue
|
|
486
|
+
if [[ "$(afyx_component_field "$plan_id" type)" == skill ]] ||
|
|
487
|
+
{ ! "$skip_provider_configuration" && [[ "$plan_id" == afyx-context || "$plan_id" == afyx-forge ]]; }; then
|
|
488
|
+
contract_args+=(--extra-target "$plan_id" skill "$plan_root/$plan_id")
|
|
489
|
+
fi
|
|
490
|
+
done
|
|
491
|
+
done
|
|
492
|
+
if ! "$skip_provider_configuration"; then
|
|
493
|
+
[[ ",$provider_list," != *,codex,* ]] || contract_args+=(--config "${CODEX_HOME:-$HOME/.codex}/config.toml")
|
|
494
|
+
if [[ ",$provider_list," == *,antigravity,* ]]; then
|
|
495
|
+
if [[ "$provider_scope" == workspace ]]; then contract_args+=(--config "$workspace_root/.agents/mcp_config.json")
|
|
496
|
+
else contract_args+=(--config "$gemini_home/config/mcp_config.json"); fi
|
|
497
|
+
fi
|
|
498
|
+
if [[ ",$provider_list," == *,claude,* ]]; then
|
|
499
|
+
if [[ "$provider_scope" == workspace ]]; then contract_args+=(--config "$workspace_root/.mcp.json")
|
|
500
|
+
else contract_args+=(--config "${claude_config_dir:-$HOME}/.claude.json"); fi
|
|
501
|
+
fi
|
|
502
|
+
fi
|
|
503
|
+
contract_output="$(node "$PACKAGE_ROOT/scripts/afyx-install-contract.mjs" "${contract_args[@]}")" || exit $?
|
|
504
|
+
if "$plan_json"; then printf '%s\n' "$contract_output"; exit 0; fi
|
|
505
|
+
contract_plan_ready=true
|
|
506
|
+
fi
|
|
507
|
+
|
|
426
508
|
if [[ -n "$preset" ]]; then
|
|
427
509
|
blocked_plan=
|
|
428
510
|
for plan_id in $(afyx_component_ids); do
|
|
@@ -445,13 +527,16 @@ expert_action="$(component_action afyx-engineering-expert 'Afyx Engineering Expe
|
|
|
445
527
|
for additional_root in ${additional_skill_roots[@]+"${additional_skill_roots[@]}"}; do
|
|
446
528
|
for skill_spec in "efficient-coding|$efficient_action" "odoo-engineering|$odoo_action" "afyx-engineering-expert|$expert_action"; do
|
|
447
529
|
skill_id="${skill_spec%%|*}"; skill_action="${skill_spec#*|}"
|
|
448
|
-
if [[ -n "$preset" ]] && afyx_component_desired "$skill_id" "$preset" "$custom_component_list" "$provider_list"; then skill_action=install; fi
|
|
530
|
+
if ! "$implicit_preset" && [[ -n "$preset" ]] && afyx_component_desired "$skill_id" "$preset" "$custom_component_list" "$provider_list"; then skill_action=install; fi
|
|
449
531
|
[[ "$skill_action" != skip && "$skill_action" != adopt ]] || continue
|
|
450
532
|
target="$additional_root/$skill_id"
|
|
451
533
|
afyx_classify_skill "$target" "$skill_id" afyx
|
|
452
534
|
case "$AFYX_OWNERSHIP_STATE" in NOT_INSTALLED|AFYX_OWNED_UNMODIFIED|AFYX_OWNED_MODIFIED) ;; *) printf 'Provider skill plan is blocked at %s because ownership is %s.\n' "$target" "$AFYX_OWNERSHIP_STATE" >&2; exit 1 ;; esac
|
|
453
535
|
done
|
|
454
536
|
done
|
|
537
|
+
if [[ -n "$expected_plan" ]]; then
|
|
538
|
+
node "$PACKAGE_ROOT/scripts/afyx-install-contract.mjs" "${contract_args[@]}" >/dev/null || exit $?
|
|
539
|
+
fi
|
|
455
540
|
run mkdir -p "$skills_root"
|
|
456
541
|
efficient_result=skipped
|
|
457
542
|
odoo_result=skipped
|
|
@@ -467,7 +552,7 @@ elif [[ "$expert_action" != skip ]]; then expert_result="$(safe_skill_install af
|
|
|
467
552
|
|
|
468
553
|
replicate_provider_skill() {
|
|
469
554
|
local id="$1" label="$2" source="$3" action="$4" root target replace result
|
|
470
|
-
if [[ -n "$preset" ]] && afyx_component_desired "$id" "$preset" "$custom_component_list" "$provider_list"; then action=install; fi
|
|
555
|
+
if ! "$implicit_preset" && [[ -n "$preset" ]] && afyx_component_desired "$id" "$preset" "$custom_component_list" "$provider_list"; then action=install; fi
|
|
471
556
|
[[ "$action" != skip && "$action" != adopt ]] || return 0
|
|
472
557
|
for root in ${additional_skill_roots[@]+"${additional_skill_roots[@]}"}; do
|
|
473
558
|
target="$root/$id"
|
|
@@ -478,7 +563,9 @@ replicate_provider_skill() {
|
|
|
478
563
|
if [[ "$(afyx_skill_version "$target")" == "$(afyx_skill_version "$source")" ]]; then printf '%s [%s]: skipped\n' "$label" "$root"; continue; fi
|
|
479
564
|
replace=true
|
|
480
565
|
;;
|
|
481
|
-
AFYX_OWNED_MODIFIED)
|
|
566
|
+
AFYX_OWNED_MODIFIED)
|
|
567
|
+
if "$implicit_preset"; then printf '%s [%s]: modified content preserved; explicit repair required\n' "$label" "$root"; continue; fi
|
|
568
|
+
replace=true ;;
|
|
482
569
|
*) printf 'Refusing to replace %s at provider skill root %s because ownership is %s.\n' "$label" "$root" "$AFYX_OWNERSHIP_STATE" >&2; exit 1 ;;
|
|
483
570
|
esac
|
|
484
571
|
result="$(safe_skill_install "$id" "$label" "$source" "$target" "$replace")"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "afyx-engineering-kit",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.7",
|
|
4
4
|
"description": "Universal cross-platform CLI installer and lifecycle manager for AFYX Engineering Kit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./bin/afyx-engineering-kit.mjs",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"skills/",
|
|
26
26
|
"afyx-context/",
|
|
27
27
|
"!afyx-context/test/**",
|
|
28
|
+
"!afyx-context/test-fixtures/**",
|
|
28
29
|
"!afyx-context/benchmark/**",
|
|
29
30
|
"afyx-forge/",
|
|
30
31
|
"!afyx-forge/test/**",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { buildSubprocessCall, PACKAGE_ROOT, subprocessEnvironment } from './afyx-npm-installer.mjs';
|
|
3
|
+
import { decodeContract } from './afyx-install-contract.mjs';
|
|
4
|
+
|
|
5
|
+
function capture(call) {
|
|
6
|
+
const invoke = (program) => spawnSync(program, call.args, {
|
|
7
|
+
encoding: 'utf8', windowsHide: true, timeout: 300000, maxBuffer: 8 * 1024 * 1024,
|
|
8
|
+
env: subprocessEnvironment(program, { ...call.env, CI: '1', NO_COLOR: '1' }),
|
|
9
|
+
});
|
|
10
|
+
let result = invoke(call.executable);
|
|
11
|
+
if (result.error?.code === 'ENOENT' && call.fallbackExecutable) result = invoke(call.fallbackExecutable);
|
|
12
|
+
if (result.error) throw result.error;
|
|
13
|
+
return { exitCode: result.status ?? 1, output: `${result.stdout || ''}\n${result.stderr || ''}` };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function createBackendAdapter({ platform = process.platform, pkgRoot = PACKAGE_ROOT } = {}) {
|
|
17
|
+
return {
|
|
18
|
+
plan(options) {
|
|
19
|
+
const { expectedPlan: _expectedPlan, ...query } = options;
|
|
20
|
+
const result = capture(buildSubprocessCall('install', { ...query, planJson: true, nonInteractive: true }, platform, pkgRoot));
|
|
21
|
+
if (result.exitCode !== 0) throw new Error(`Backend plan failed (${result.exitCode}): ${result.output}`);
|
|
22
|
+
return decodeContract(result.output, 'AfyxInstallPlan/v1');
|
|
23
|
+
},
|
|
24
|
+
verify(options) {
|
|
25
|
+
const allowed = ['preset', 'provider', 'providerScope', 'workspaceRoot', 'skillsRoot',
|
|
26
|
+
'contextRuntimeRoot', 'forgeRuntimeRoot', 'graphRuntimeRoot', 'customComponents', 'skipProviderConfiguration'];
|
|
27
|
+
const query = Object.fromEntries(allowed.filter((key) => options[key] !== undefined).map((key) => [key, options[key]]));
|
|
28
|
+
const result = capture(buildSubprocessCall('verify', { ...query, reportJson: true }, platform, pkgRoot));
|
|
29
|
+
return { ...decodeContract(result.output, 'AfyxVerification/v1'), exitCode: result.exitCode };
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function summarizeExecution(plan, verification, installerExit, reviewedPlan = plan) {
|
|
35
|
+
const rows = Array.isArray(verification.rows) ? verification.rows : [];
|
|
36
|
+
const components = plan.components.map((entry) => {
|
|
37
|
+
const reviewed = reviewedPlan.components.find((item) => item.id === entry.id);
|
|
38
|
+
const status = !entry.desired ? 'SKIPPED' : entry.compatibility === 'NOT SUPPORTED' ? 'NOT SUPPORTED'
|
|
39
|
+
: entry.currentState === 'HEALTHY' ? 'PASS' : 'FAILED';
|
|
40
|
+
const completed = { install: 'INSTALLED', update: 'UPDATED', downgrade: 'UPDATED', repair: 'REPAIRED', adopt: 'ADOPTED', skip: 'SKIPPED' };
|
|
41
|
+
const outcome = status === 'PASS' ? completed[reviewed?.backendAction] || 'VERIFIED' : status;
|
|
42
|
+
return { id: entry.id, name: entry.name, version: entry.version, status, outcome, detail: entry.detail };
|
|
43
|
+
});
|
|
44
|
+
const failed = installerExit !== 0 || verification.exitCode !== 0 || components.some((entry) => entry.status === 'FAILED');
|
|
45
|
+
return { status: failed ? 'FAILED' : 'PASS', components, rows };
|
|
46
|
+
}
|