afyx-engineering-kit 0.0.0-stage → 0.1.0-alpha.4
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,258 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Diagnostics;
|
|
3
|
+
using System.IO;
|
|
4
|
+
using System.IO.Compression;
|
|
5
|
+
using System.Reflection;
|
|
6
|
+
|
|
7
|
+
namespace Afyx.WindowsSetup
|
|
8
|
+
{
|
|
9
|
+
class Program
|
|
10
|
+
{
|
|
11
|
+
static int Main(string[] args)
|
|
12
|
+
{
|
|
13
|
+
Console.WriteLine("====================================================================");
|
|
14
|
+
Console.WriteLine(" Afyx Code Engineering Kit — Unified Windows Setup (7 Components)");
|
|
15
|
+
Console.WriteLine(" Midnight Circuit Architecture | Technical Alpha Candidate");
|
|
16
|
+
Console.WriteLine("====================================================================");
|
|
17
|
+
|
|
18
|
+
string currentExePath = Assembly.GetExecutingAssembly().Location;
|
|
19
|
+
string exeDir = Path.GetDirectoryName(currentExePath);
|
|
20
|
+
|
|
21
|
+
// Parse setup-level CLI flags
|
|
22
|
+
bool showHelp = false;
|
|
23
|
+
bool extractOnly = false;
|
|
24
|
+
string extractTarget = null;
|
|
25
|
+
bool runVerify = false;
|
|
26
|
+
bool runUninstall = false;
|
|
27
|
+
string forwardArgs = "";
|
|
28
|
+
|
|
29
|
+
for (int i = 0; i < args.Length; i++)
|
|
30
|
+
{
|
|
31
|
+
string a = args[i];
|
|
32
|
+
if (a == "--help" || a == "-h" || a == "/?")
|
|
33
|
+
{
|
|
34
|
+
showHelp = true;
|
|
35
|
+
}
|
|
36
|
+
else if (a == "--extract" || a == "-x")
|
|
37
|
+
{
|
|
38
|
+
extractOnly = true;
|
|
39
|
+
if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
|
|
40
|
+
{
|
|
41
|
+
extractTarget = args[++i];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else if (a == "--verify")
|
|
45
|
+
{
|
|
46
|
+
runVerify = true;
|
|
47
|
+
}
|
|
48
|
+
else if (a == "--uninstall")
|
|
49
|
+
{
|
|
50
|
+
runUninstall = true;
|
|
51
|
+
}
|
|
52
|
+
else
|
|
53
|
+
{
|
|
54
|
+
// Forward remaining arguments to underlying PowerShell script
|
|
55
|
+
if (a.Contains(" ") && !a.StartsWith("\""))
|
|
56
|
+
{
|
|
57
|
+
forwardArgs += " \"" + a + "\"";
|
|
58
|
+
}
|
|
59
|
+
else
|
|
60
|
+
{
|
|
61
|
+
forwardArgs += " " + a;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (showHelp)
|
|
67
|
+
{
|
|
68
|
+
PrintHelp();
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Locate payload: either embedded resource or adjacent .afyx-payload.zip
|
|
73
|
+
Stream payloadStream = null;
|
|
74
|
+
var asm = Assembly.GetExecutingAssembly();
|
|
75
|
+
string[] resNames = asm.GetManifestResourceNames();
|
|
76
|
+
foreach (string name in resNames)
|
|
77
|
+
{
|
|
78
|
+
if (name.EndsWith(".zip", StringComparison.OrdinalIgnoreCase) || name.Contains("payload"))
|
|
79
|
+
{
|
|
80
|
+
payloadStream = asm.GetManifestResourceStream(name);
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
string adjacentPayload = Path.Combine(exeDir, "afyx-kit-payload.zip");
|
|
86
|
+
if (payloadStream == null && File.Exists(adjacentPayload))
|
|
87
|
+
{
|
|
88
|
+
payloadStream = File.OpenRead(adjacentPayload);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (payloadStream == null)
|
|
92
|
+
{
|
|
93
|
+
Console.ForegroundColor = ConsoleColor.Red;
|
|
94
|
+
Console.WriteLine("ERROR: Setup payload package not found inside executable or adjacent directory.");
|
|
95
|
+
Console.ResetColor();
|
|
96
|
+
return 1;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Determine extraction folder
|
|
100
|
+
bool isTempExtract = false;
|
|
101
|
+
string stagingDir = extractTarget;
|
|
102
|
+
if (string.IsNullOrEmpty(stagingDir))
|
|
103
|
+
{
|
|
104
|
+
if (extractOnly)
|
|
105
|
+
{
|
|
106
|
+
stagingDir = Path.Combine(Directory.GetCurrentDirectory(), "afyx-kit");
|
|
107
|
+
}
|
|
108
|
+
else
|
|
109
|
+
{
|
|
110
|
+
isTempExtract = true;
|
|
111
|
+
stagingDir = Path.Combine(Path.GetTempPath(), "afyx-setup-" + Guid.NewGuid().ToString("N").Substring(0, 8));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
try
|
|
116
|
+
{
|
|
117
|
+
Console.WriteLine("Extracting setup components to: " + stagingDir);
|
|
118
|
+
Directory.CreateDirectory(stagingDir);
|
|
119
|
+
|
|
120
|
+
using (var archive = new ZipArchive(payloadStream, ZipArchiveMode.Read, false))
|
|
121
|
+
{
|
|
122
|
+
string fullStagingDir = Path.GetFullPath(stagingDir);
|
|
123
|
+
if (!fullStagingDir.EndsWith(Path.DirectorySeparatorChar.ToString()))
|
|
124
|
+
{
|
|
125
|
+
fullStagingDir += Path.DirectorySeparatorChar;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
foreach (var entry in archive.Entries)
|
|
129
|
+
{
|
|
130
|
+
if (string.IsNullOrEmpty(entry.Name) && (entry.FullName.EndsWith("/") || entry.FullName.EndsWith("\\")))
|
|
131
|
+
{
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
string destPath = Path.Combine(stagingDir, entry.FullName.Replace('/', Path.DirectorySeparatorChar));
|
|
135
|
+
string fullDestPath = Path.GetFullPath(destPath);
|
|
136
|
+
if (!fullDestPath.StartsWith(fullStagingDir, StringComparison.OrdinalIgnoreCase))
|
|
137
|
+
{
|
|
138
|
+
throw new InvalidOperationException("Security violation: Zip path traversal detected in entry '" + entry.FullName + "'");
|
|
139
|
+
}
|
|
140
|
+
string destDir = Path.GetDirectoryName(destPath);
|
|
141
|
+
if (!Directory.Exists(destDir))
|
|
142
|
+
{
|
|
143
|
+
Directory.CreateDirectory(destDir);
|
|
144
|
+
}
|
|
145
|
+
entry.ExtractToFile(destPath, true);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (extractOnly)
|
|
150
|
+
{
|
|
151
|
+
Console.ForegroundColor = ConsoleColor.Green;
|
|
152
|
+
Console.WriteLine("Payload successfully extracted to: " + stagingDir);
|
|
153
|
+
Console.ResetColor();
|
|
154
|
+
return 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Locate script to run
|
|
158
|
+
string scriptName = "install.ps1";
|
|
159
|
+
if (runVerify) scriptName = "verify.ps1";
|
|
160
|
+
if (runUninstall) scriptName = "uninstall.ps1";
|
|
161
|
+
|
|
162
|
+
string targetScript = Path.Combine(stagingDir, scriptName);
|
|
163
|
+
if (!File.Exists(targetScript))
|
|
164
|
+
{
|
|
165
|
+
Console.ForegroundColor = ConsoleColor.Red;
|
|
166
|
+
Console.WriteLine("ERROR: Target script not found: " + targetScript);
|
|
167
|
+
Console.ResetColor();
|
|
168
|
+
return 1;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Determine shell: prefer pwsh.exe, fallback to powershell.exe
|
|
172
|
+
string shellExe = "pwsh.exe";
|
|
173
|
+
if (!IsCommandAvailable("pwsh.exe"))
|
|
174
|
+
{
|
|
175
|
+
shellExe = "powershell.exe";
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
Console.WriteLine("Launching setup using " + shellExe + " -> " + scriptName);
|
|
179
|
+
string psArgs = "-NoProfile -ExecutionPolicy Bypass -File \"" + targetScript + "\"" + forwardArgs;
|
|
180
|
+
|
|
181
|
+
var psi = new ProcessStartInfo
|
|
182
|
+
{
|
|
183
|
+
FileName = shellExe,
|
|
184
|
+
Arguments = psArgs,
|
|
185
|
+
UseShellExecute = false,
|
|
186
|
+
WorkingDirectory = stagingDir
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
using (var proc = Process.Start(psi))
|
|
190
|
+
{
|
|
191
|
+
proc.WaitForExit();
|
|
192
|
+
return proc.ExitCode;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
catch (Exception ex)
|
|
196
|
+
{
|
|
197
|
+
Console.ForegroundColor = ConsoleColor.Red;
|
|
198
|
+
Console.WriteLine("Setup failed: " + ex.Message);
|
|
199
|
+
Console.ResetColor();
|
|
200
|
+
return 1;
|
|
201
|
+
}
|
|
202
|
+
finally
|
|
203
|
+
{
|
|
204
|
+
payloadStream.Dispose();
|
|
205
|
+
if (isTempExtract && Directory.Exists(stagingDir))
|
|
206
|
+
{
|
|
207
|
+
try
|
|
208
|
+
{
|
|
209
|
+
Directory.Delete(stagingDir, true);
|
|
210
|
+
}
|
|
211
|
+
catch { }
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
static bool IsCommandAvailable(string cmd)
|
|
217
|
+
{
|
|
218
|
+
try
|
|
219
|
+
{
|
|
220
|
+
var psi = new ProcessStartInfo
|
|
221
|
+
{
|
|
222
|
+
FileName = "where.exe",
|
|
223
|
+
Arguments = cmd,
|
|
224
|
+
UseShellExecute = false,
|
|
225
|
+
CreateNoWindow = true,
|
|
226
|
+
RedirectStandardOutput = true,
|
|
227
|
+
RedirectStandardError = true
|
|
228
|
+
};
|
|
229
|
+
using (var p = Process.Start(psi))
|
|
230
|
+
{
|
|
231
|
+
p.WaitForExit();
|
|
232
|
+
return p.ExitCode == 0;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
catch { return false; }
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
static void PrintHelp()
|
|
239
|
+
{
|
|
240
|
+
Console.WriteLine("Usage: AfyxSetup.exe [options] [-- <PowerShell arguments>]");
|
|
241
|
+
Console.WriteLine();
|
|
242
|
+
Console.WriteLine("Options:");
|
|
243
|
+
Console.WriteLine(" --help, -h Show this help message and exit.");
|
|
244
|
+
Console.WriteLine(" --extract, -x [dir] Extract the full kit payload without running installation.");
|
|
245
|
+
Console.WriteLine(" --verify Execute verification against installed components.");
|
|
246
|
+
Console.WriteLine(" --uninstall Execute uninstallation workflow.");
|
|
247
|
+
Console.WriteLine(" -Preset <preset> Specify preset: minimal, recommended, full, or custom.");
|
|
248
|
+
Console.WriteLine(" -CustomComponent <list> Specify components: efficient-coding, odoo-engineering,");
|
|
249
|
+
Console.WriteLine(" afyx-engineering-expert, afyx-graph, afyx-context,");
|
|
250
|
+
Console.WriteLine(" afyx-forge, codex-usage-tracking.");
|
|
251
|
+
Console.WriteLine(" -ValidateOnly Run read-only pre-flight checks without making changes.");
|
|
252
|
+
Console.WriteLine(" -WhatIf Preview actions without making changes.");
|
|
253
|
+
Console.WriteLine(" -Provider <providers> Configure providers (codex, antigravity, claude).");
|
|
254
|
+
Console.WriteLine();
|
|
255
|
+
Console.WriteLine("When executed with no arguments, interactive setup wizard will launch.");
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
package/uninstall.ps1
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
[CmdletBinding(SupportsShouldProcess)]
|
|
2
|
+
param(
|
|
3
|
+
[string]$SkillsRoot = (Join-Path $env:USERPROFILE '.agents\skills'),
|
|
4
|
+
[Alias('Component')][string[]]$SelectedComponent = @(),
|
|
5
|
+
[switch]$RemovePromptMaster,
|
|
6
|
+
[switch]$RemoveUsageTracker,
|
|
7
|
+
[switch]$RemoveAfyxGraph,
|
|
8
|
+
[switch]$RemoveAfyxContext,
|
|
9
|
+
[switch]$RemoveAfyxForge,
|
|
10
|
+
[switch]$RemoveHostBridge,
|
|
11
|
+
[switch]$RemoveProviderConfiguration,
|
|
12
|
+
[switch]$All,
|
|
13
|
+
[string[]]$Provider = @('codex'),
|
|
14
|
+
[ValidateSet('global', 'workspace')][string]$ProviderScope = 'global',
|
|
15
|
+
[string]$WorkspaceRoot = (Get-Location).Path,
|
|
16
|
+
[string]$GeminiHome = $(if ($env:AFYX_GEMINI_HOME) { $env:AFYX_GEMINI_HOME } else { Join-Path $env:USERPROFILE '.gemini' }),
|
|
17
|
+
[string]$ClaudeHome = $(if ($env:CLAUDE_CONFIG_DIR) { $env:CLAUDE_CONFIG_DIR } else { Join-Path $env:USERPROFILE '.claude' }),
|
|
18
|
+
[string]$ClaudeConfigDir = $(if ($env:CLAUDE_CONFIG_DIR) { $env:CLAUDE_CONFIG_DIR } else { '' }),
|
|
19
|
+
[string]$GraphRuntimeRoot = $(if ($env:AFYX_GRAPH_RUNTIME_ROOT) { $env:AFYX_GRAPH_RUNTIME_ROOT } else { Join-Path (Join-Path $env:USERPROFILE '.afyx') 'graph' }),
|
|
20
|
+
[string]$ContextRuntimeRoot = $(if ($env:AFYX_CONTEXT_RUNTIME_ROOT) { $env:AFYX_CONTEXT_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\context' }),
|
|
21
|
+
[string]$ForgeRuntimeRoot = $(if ($env:AFYX_FORGE_RUNTIME_ROOT) { $env:AFYX_FORGE_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\forge' }),
|
|
22
|
+
[string]$AfyxInstallRoot = $(if ($env:AFYX_INSTALL_ROOT) { $env:AFYX_INSTALL_ROOT } else { Join-Path $env:USERPROFILE '.afyx' }),
|
|
23
|
+
[string]$HostBridgeRuntimeRoot = $(if ($env:AFYX_HOST_BRIDGE_RUNTIME_ROOT) { $env:AFYX_HOST_BRIDGE_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\host-bridge' })
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
Set-StrictMode -Version Latest
|
|
27
|
+
$ErrorActionPreference = 'Stop'
|
|
28
|
+
|
|
29
|
+
Write-Host 'Afyx Codex Engineering Kit — Windows uninstaller (PowerShell)'
|
|
30
|
+
if ($All) {
|
|
31
|
+
$RemoveUsageTracker = $true
|
|
32
|
+
$RemoveAfyxGraph = $true
|
|
33
|
+
$RemoveAfyxContext = $true
|
|
34
|
+
$RemoveAfyxForge = $true
|
|
35
|
+
$RemoveHostBridge = $true
|
|
36
|
+
$RemoveProviderConfiguration = $true
|
|
37
|
+
}
|
|
38
|
+
$providerSkillRoots = @()
|
|
39
|
+
if ('codex' -in $Provider) {
|
|
40
|
+
$providerSkillRoots += $(if ($PSBoundParameters.ContainsKey('SkillsRoot')) { $SkillsRoot } else { Join-Path $env:USERPROFILE '.agents\skills' })
|
|
41
|
+
}
|
|
42
|
+
if ('antigravity' -in $Provider) {
|
|
43
|
+
if ($ProviderScope -eq 'workspace') { $providerSkillRoots += (Join-Path $WorkspaceRoot '.agents\skills') }
|
|
44
|
+
else { $providerSkillRoots += @((Join-Path $GeminiHome 'config\skills'), (Join-Path $GeminiHome 'antigravity-cli\skills')) }
|
|
45
|
+
}
|
|
46
|
+
if ('claude' -in $Provider) {
|
|
47
|
+
$providerSkillRoots += $(if ($ProviderScope -eq 'workspace') { Join-Path $WorkspaceRoot '.claude\skills' } else { Join-Path $ClaudeHome 'skills' })
|
|
48
|
+
}
|
|
49
|
+
if (-not $PSBoundParameters.ContainsKey('SkillsRoot') -and $providerSkillRoots.Count) { $SkillsRoot = $providerSkillRoots[0] }
|
|
50
|
+
$primarySkillsPath = [System.IO.Path]::GetFullPath($SkillsRoot)
|
|
51
|
+
$additionalSkillRoots = @($providerSkillRoots |
|
|
52
|
+
Where-Object { [System.IO.Path]::GetFullPath($_) -ne $primarySkillsPath } |
|
|
53
|
+
Select-Object -Unique)
|
|
54
|
+
|
|
55
|
+
# One component truth: scripts/components.json. Only Afyx-owned skills are removable.
|
|
56
|
+
Import-Module (Join-Path $PSScriptRoot 'scripts\lib\AfyxComponents.psm1') -Force
|
|
57
|
+
Import-Module (Join-Path $PSScriptRoot 'scripts\lib\AfyxSkillLifecycle.psm1') -Force
|
|
58
|
+
Import-Module (Join-Path $PSScriptRoot 'scripts\lib\AfyxTerminal.psm1') -Force
|
|
59
|
+
$providerIds = @(Get-AfyxProviderRegistry | ForEach-Object { [string]$_.provider })
|
|
60
|
+
$unknownProviders = @($Provider | Where-Object { $_ -notin $providerIds })
|
|
61
|
+
if ($unknownProviders.Count) { throw "Unknown provider(s): $($unknownProviders -join ', ')" }
|
|
62
|
+
$componentContext = New-AfyxComponentContext -SkillsRoot $SkillsRoot -GraphRoot $GraphRuntimeRoot -ContextRoot $ContextRuntimeRoot -ForgeRoot $ForgeRuntimeRoot
|
|
63
|
+
$contract = @(Get-AfyxComponentContract)
|
|
64
|
+
if ($RemovePromptMaster) {
|
|
65
|
+
throw "Component 'prompt-master' is retired from Afyx Kit and remains externally/user managed; no changes were made."
|
|
66
|
+
}
|
|
67
|
+
foreach ($id in $SelectedComponent) {
|
|
68
|
+
if ($id -in @('prompt-master', 'headroom')) {
|
|
69
|
+
throw "Component '$id' is retired from Afyx Kit and remains externally/user managed; no changes were made."
|
|
70
|
+
}
|
|
71
|
+
$selected = @($contract | Where-Object { $_.id -eq $id -and $_.type -eq 'skill' -and $_.ownership -eq 'afyx' })
|
|
72
|
+
if ($selected.Count -ne 1) { throw "Unknown or non-removable Afyx skill component: $id" }
|
|
73
|
+
}
|
|
74
|
+
$targets = @()
|
|
75
|
+
foreach ($component in $contract) {
|
|
76
|
+
if ($component.type -ne 'skill') { continue }
|
|
77
|
+
$selectedAfyx = $component.ownership -eq 'afyx' -and ($SelectedComponent.Count -eq 0 -or [string]$component.id -in $SelectedComponent)
|
|
78
|
+
if ($selectedAfyx) {
|
|
79
|
+
$targets += [pscustomobject]@{
|
|
80
|
+
Component = [string]$component.id
|
|
81
|
+
Owner = [string]$component.ownership
|
|
82
|
+
Target = Get-AfyxComponentRoot -Component $component -Context $componentContext
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
foreach ($entry in $targets) {
|
|
88
|
+
Remove-AfyxSkillSafely -SkillsRoot $SkillsRoot -Component $entry.Component -Target $entry.Target -ExpectedOwner $entry.Owner -Confirm:$false -WhatIf:$WhatIfPreference
|
|
89
|
+
}
|
|
90
|
+
foreach ($additionalRoot in $additionalSkillRoots) {
|
|
91
|
+
foreach ($component in $contract | Where-Object { $_.type -eq 'skill' -and $_.ownership -eq 'afyx' }) {
|
|
92
|
+
if ($SelectedComponent.Count -and [string]$component.id -notin $SelectedComponent) { continue }
|
|
93
|
+
$target = Join-Path $additionalRoot ([string]$component.install_path)
|
|
94
|
+
Remove-AfyxSkillSafely -SkillsRoot $additionalRoot -Component ([string]$component.id) -Target $target -ExpectedOwner ([string]$component.ownership) -Confirm:$false -WhatIf:$WhatIfPreference
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if ($RemoveUsageTracker) {
|
|
99
|
+
$trackerInstaller = Join-Path $PSScriptRoot 'scripts\install-codex-usage-tracker.ps1'
|
|
100
|
+
& $trackerInstaller -Uninstall -Confirm:$false -WhatIf:$WhatIfPreference
|
|
101
|
+
if (-not $?) { throw 'Codex Usage Tracking removal failed.' }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
$graphRoot = $componentContext.GraphRoot
|
|
105
|
+
if ($RemoveProviderConfiguration) {
|
|
106
|
+
$nodeCommand = Get-Command node -ErrorAction SilentlyContinue
|
|
107
|
+
$codexHost = Get-AfyxCodexHost
|
|
108
|
+
$codexCommand = if ($codexHost.State -eq 'CLI_READY') { [pscustomobject]@{ Source = $codexHost.Path } } else { $null }
|
|
109
|
+
$claudeCommand = Get-Command claude -ErrorAction SilentlyContinue
|
|
110
|
+
$installedEntry = Join-Path $graphRoot 'current\lib\dist\bin\afyx-graph.js'
|
|
111
|
+
if (-not $nodeCommand) { throw 'Node.js is required to remove owned provider entries.' }
|
|
112
|
+
if ('codex' -in $Provider -and -not $codexCommand) { throw "Codex MCP removal requires a native Codex CLI. $($codexHost.Detail)" }
|
|
113
|
+
$codexHome = if ($env:CODEX_HOME) { $env:CODEX_HOME } else { Join-Path $env:USERPROFILE '.codex' }
|
|
114
|
+
$arguments = @((Join-Path $PSScriptRoot 'scripts\afyx-provider-integration.mjs'), '--providers', ($Provider -join ','), '--scope', $ProviderScope,
|
|
115
|
+
'--workspace-root', $WorkspaceRoot, '--gemini-home', $GeminiHome, '--codex-home', $codexHome, '--node', $nodeCommand.Source,
|
|
116
|
+
'--entry', $installedEntry, '--uninstall')
|
|
117
|
+
if ($codexCommand) { $arguments += @('--codex', $codexCommand.Source) }
|
|
118
|
+
if ($claudeCommand) { $arguments += @('--claude', $claudeCommand.Source) }
|
|
119
|
+
if ($ClaudeConfigDir) { $arguments += @('--claude-config-dir', $ClaudeConfigDir) }
|
|
120
|
+
if (-not $WhatIfPreference) { $arguments += '--apply' }
|
|
121
|
+
if ($WhatIfPreference) { Write-Host "WhatIf: would remove only Afyx-owned provider MCP entries at $ProviderScope scope" }
|
|
122
|
+
else {
|
|
123
|
+
$providerJson = (& $nodeCommand.Source @arguments) -join ''
|
|
124
|
+
$providerResult = $providerJson | ConvertFrom-AfyxJson -Depth 20
|
|
125
|
+
Write-Host "Provider removal: $($providerResult.status)"
|
|
126
|
+
if ($LASTEXITCODE -ne 0 -or $providerResult.status -eq 'BLOCKED') { throw "Provider removal failed: $providerJson" }
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
$workflowProviders = @($Provider | Where-Object { $_ -eq 'antigravity' -or ($_ -eq 'claude' -and $ProviderScope -eq 'workspace') })
|
|
130
|
+
if ($workflowProviders.Count) {
|
|
131
|
+
$hostBridgeEntry = Join-Path $HostBridgeRuntimeRoot 'current\afyx-host-bridge.mjs'
|
|
132
|
+
$wfArguments = @((Join-Path $PSScriptRoot 'scripts\afyx-provider-integration.mjs'), '--providers', ($workflowProviders -join ','), '--scope', $ProviderScope,
|
|
133
|
+
'--workspace-root', $WorkspaceRoot, '--gemini-home', $GeminiHome, '--codex-home', $codexHome, '--node', $nodeCommand.Source,
|
|
134
|
+
'--entry', $hostBridgeEntry, '--server', 'afyx_workflow', '--mode', 'workflow', '--tool', 'afyx_workflow',
|
|
135
|
+
'--install-root', $AfyxInstallRoot, '--authorize', 'afyx-graph,afyx-context', '--uninstall')
|
|
136
|
+
if ($claudeCommand) { $wfArguments += @('--claude', $claudeCommand.Source) }
|
|
137
|
+
if ($ClaudeConfigDir) { $wfArguments += @('--claude-config-dir', $ClaudeConfigDir) }
|
|
138
|
+
if (-not $WhatIfPreference) { $wfArguments += '--apply' }
|
|
139
|
+
if (-not $WhatIfPreference) {
|
|
140
|
+
$wfJson = (& $nodeCommand.Source @wfArguments) -join ''
|
|
141
|
+
$wfResult = $wfJson | ConvertFrom-AfyxJson -Depth 20
|
|
142
|
+
if ($LASTEXITCODE -ne 0 -or $wfResult.status -eq 'BLOCKED') { throw "Host bridge provider removal failed: $wfJson" }
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (Test-Path -LiteralPath $graphRoot) {
|
|
147
|
+
$removeGraph = $RemoveAfyxGraph
|
|
148
|
+
if (-not $removeGraph -and -not $WhatIfPreference -and -not $env:CI -and -not [Console]::IsInputRedirected) {
|
|
149
|
+
do { $answer = (Read-Host 'Afyx Graph detected. Remove Afyx Graph? [Y/N] [N]').Trim() } until ($answer -match '(?i)^(|y|yes|n|no)$')
|
|
150
|
+
$removeGraph = $answer -match '(?i)^(y|yes)$'
|
|
151
|
+
}
|
|
152
|
+
if ($removeGraph) {
|
|
153
|
+
& (Join-Path $PSScriptRoot 'scripts\install-afyx-graph.ps1') -Uninstall -RuntimeRoot $graphRoot -Confirm:$false -WhatIf:$WhatIfPreference
|
|
154
|
+
if (-not $?) { throw 'Afyx Graph removal failed.' }
|
|
155
|
+
} else { Write-Host 'Afyx Graph: kept' }
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if ($RemoveAfyxContext) {
|
|
159
|
+
# Remove only ownership-verified ACE companions for selected providers.
|
|
160
|
+
# A foreign or user-modified skill is never adopted or deleted implicitly.
|
|
161
|
+
foreach ($root in @($providerSkillRoots | Select-Object -Unique)) {
|
|
162
|
+
$target = Join-Path $root 'afyx-context'
|
|
163
|
+
Remove-AfyxSkillSafely -SkillsRoot $root -Component 'afyx-context' -Target $target -ExpectedOwner 'afyx' -Confirm:$false -WhatIf:$WhatIfPreference
|
|
164
|
+
}
|
|
165
|
+
& (Join-Path $PSScriptRoot 'scripts\install-afyx-context.ps1') -RuntimeRoot $ContextRuntimeRoot -Uninstall -Confirm:$false -WhatIf:$WhatIfPreference
|
|
166
|
+
if (-not $?) { throw 'Afyx Context removal failed.' }
|
|
167
|
+
} elseif (Test-Path -LiteralPath $ContextRuntimeRoot) { Write-Host 'Afyx Context Engine: kept' }
|
|
168
|
+
|
|
169
|
+
if ($RemoveAfyxForge) {
|
|
170
|
+
foreach ($root in @($providerSkillRoots | Select-Object -Unique)) {
|
|
171
|
+
$target = Join-Path $root 'afyx-forge'
|
|
172
|
+
Remove-AfyxSkillSafely -SkillsRoot $root -Component 'afyx-forge' -Target $target -ExpectedOwner 'afyx' -Confirm:$false -WhatIf:$WhatIfPreference
|
|
173
|
+
}
|
|
174
|
+
& (Join-Path $PSScriptRoot 'scripts\install-afyx-forge.ps1') -RuntimeRoot $ForgeRuntimeRoot -Uninstall -Confirm:$false -WhatIf:$WhatIfPreference
|
|
175
|
+
if (-not $?) { throw 'Afyx Forge removal failed.' }
|
|
176
|
+
} elseif (Test-Path -LiteralPath $ForgeRuntimeRoot) { Write-Host 'Afyx Forge Core: kept' }
|
|
177
|
+
|
|
178
|
+
if ($RemoveHostBridge) {
|
|
179
|
+
$nodeCommand = Get-Command node -ErrorAction SilentlyContinue
|
|
180
|
+
if (-not $nodeCommand) { throw 'Node.js is required to remove the owned host bridge runtime.' }
|
|
181
|
+
if ($WhatIfPreference) { Write-Host "WhatIf: would remove owned host bridge runtime at $HostBridgeRuntimeRoot" }
|
|
182
|
+
else {
|
|
183
|
+
& $nodeCommand.Source (Join-Path $PSScriptRoot 'scripts\afyx-host-bridge-lifecycle.mjs') `
|
|
184
|
+
'--uninstall' '--runtime-root' $HostBridgeRuntimeRoot
|
|
185
|
+
if ($LASTEXITCODE -ne 0) { throw 'Afyx Universal Host Bridge removal failed.' }
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
Write-Host 'ACE user state, project indexes, external software, and unrelated Codex configuration were not changed.'
|
package/uninstall.sh
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
+
skills_root="${CODEX_SKILLS_ROOT:-$HOME/.agents/skills}"
|
|
6
|
+
skills_root_explicit=false
|
|
7
|
+
remove_prompt_master=false
|
|
8
|
+
remove_afyx_graph=false
|
|
9
|
+
remove_afyx_context=false
|
|
10
|
+
remove_afyx_forge=false
|
|
11
|
+
context_root="${AFYX_CONTEXT_RUNTIME_ROOT:-$HOME/.afyx/context}"
|
|
12
|
+
forge_root="${AFYX_FORGE_RUNTIME_ROOT:-$HOME/.afyx/forge}"
|
|
13
|
+
dry_run=false
|
|
14
|
+
selected_components=()
|
|
15
|
+
selected_component_count=0
|
|
16
|
+
remove_provider_configuration=false
|
|
17
|
+
provider_list=codex
|
|
18
|
+
provider_scope=global
|
|
19
|
+
workspace_root="$PWD"
|
|
20
|
+
gemini_home="${AFYX_GEMINI_HOME:-$HOME/.gemini}"
|
|
21
|
+
|
|
22
|
+
printf 'Afyx Codex Engineering Kit — Linux/macOS uninstaller (Bash)\n'
|
|
23
|
+
|
|
24
|
+
usage() {
|
|
25
|
+
printf '%s\n' 'Usage: ./uninstall.sh [--skills-root PATH] [--context-runtime-root PATH] [--forge-runtime-root PATH] [--component AFYX-SKILL-ID] [--remove-provider-configuration] [--provider codex|antigravity[,..]] [--provider-scope global|workspace] [--workspace-root PATH] [--gemini-home PATH] [--remove-afyx-graph] [--remove-afyx-context] [--remove-afyx-forge] [--dry-run]'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
while (($#)); do
|
|
29
|
+
case "$1" in
|
|
30
|
+
--skills-root) (($# >= 2)) || { printf '%s\n' '--skills-root requires a value.' >&2; exit 2; }; skills_root="$2"; skills_root_explicit=true; shift 2 ;;
|
|
31
|
+
--component) (($# >= 2)) || { printf '%s\n' '--component requires a value.' >&2; exit 2; }; selected_components+=("$2"); selected_component_count=$((selected_component_count + 1)); shift 2 ;;
|
|
32
|
+
--context-runtime-root) (($# >= 2)) || { printf '%s\n' '--context-runtime-root requires a value.' >&2; exit 2; }; context_root="$2"; shift 2 ;;
|
|
33
|
+
--forge-runtime-root) (($# >= 2)) || { printf '%s\n' '--forge-runtime-root requires a value.' >&2; exit 2; }; forge_root="$2"; shift 2 ;;
|
|
34
|
+
--remove-prompt-master) remove_prompt_master=true; shift ;;
|
|
35
|
+
--remove-afyx-graph) remove_afyx_graph=true; shift ;;
|
|
36
|
+
--remove-afyx-context) remove_afyx_context=true; shift ;;
|
|
37
|
+
--remove-afyx-forge) remove_afyx_forge=true; shift ;;
|
|
38
|
+
--remove-provider-configuration) remove_provider_configuration=true; shift ;;
|
|
39
|
+
--provider) provider_list="$2"; shift 2 ;;
|
|
40
|
+
--provider-scope) provider_scope="$2"; shift 2 ;;
|
|
41
|
+
--workspace-root) workspace_root="$2"; shift 2 ;;
|
|
42
|
+
--gemini-home) gemini_home="$2"; shift 2 ;;
|
|
43
|
+
--dry-run) dry_run=true; shift ;;
|
|
44
|
+
-h|--help) usage; exit 0 ;;
|
|
45
|
+
*) printf 'Unknown option: %s\n' "$1" >&2; usage >&2; exit 2 ;;
|
|
46
|
+
esac
|
|
47
|
+
done
|
|
48
|
+
case "$provider_scope" in global|workspace) ;; *) printf 'Unknown provider scope: %s\n' "$provider_scope" >&2; exit 2 ;; esac
|
|
49
|
+
old_ifs=$IFS; IFS=','
|
|
50
|
+
for provider_id in $provider_list; do case "$provider_id" in codex|antigravity) ;; *) printf 'Unknown provider: %s\n' "$provider_id" >&2; exit 2 ;; esac; done
|
|
51
|
+
IFS=$old_ifs
|
|
52
|
+
if [[ "$skills_root_explicit" == false && "$provider_scope" == workspace && ",$provider_list," == *,antigravity,* ]]; then
|
|
53
|
+
skills_root="$workspace_root/.agents/skills"
|
|
54
|
+
fi
|
|
55
|
+
additional_skill_roots=()
|
|
56
|
+
if [[ "$provider_scope" == global && ",$provider_list," == *,antigravity,* ]]; then
|
|
57
|
+
antigravity_ide_skills="$gemini_home/config/skills"
|
|
58
|
+
antigravity_cli_skills="$gemini_home/antigravity-cli/skills"
|
|
59
|
+
if [[ "$skills_root_explicit" == false && "$provider_list" == antigravity ]]; then skills_root="$antigravity_ide_skills"; fi
|
|
60
|
+
[[ "$skills_root" == "$antigravity_ide_skills" ]] || additional_skill_roots+=("$antigravity_ide_skills")
|
|
61
|
+
[[ "$skills_root" == "$antigravity_cli_skills" ]] || additional_skill_roots+=("$antigravity_cli_skills")
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
# One component truth: scripts/components.json. Only Afyx-owned skills are removable.
|
|
65
|
+
# shellcheck source=scripts/lib/afyx-components.sh
|
|
66
|
+
. "$root/scripts/lib/afyx-components.sh"
|
|
67
|
+
. "$root/scripts/lib/afyx-skill-lifecycle.sh"
|
|
68
|
+
retired_component_error() {
|
|
69
|
+
printf "Component '%s' is retired from Afyx Kit and remains externally/user managed; no changes were made.\n" "$1" >&2
|
|
70
|
+
exit 2
|
|
71
|
+
}
|
|
72
|
+
"$remove_prompt_master" && retired_component_error prompt-master
|
|
73
|
+
component_selected() {
|
|
74
|
+
local wanted="$1" selected
|
|
75
|
+
((selected_component_count == 0)) && return 0
|
|
76
|
+
for selected in "${selected_components[@]}"; do [[ "$selected" == "$wanted" ]] && return 0; done
|
|
77
|
+
return 1
|
|
78
|
+
}
|
|
79
|
+
if ((selected_component_count > 0)); then
|
|
80
|
+
for selected in "${selected_components[@]}"; do
|
|
81
|
+
case "$selected" in prompt-master|headroom) retired_component_error "$selected" ;; esac
|
|
82
|
+
[[ "$(afyx_component_field "$selected" type)" == skill && "$(afyx_component_field "$selected" ownership)" == afyx ]] || {
|
|
83
|
+
printf 'Unknown or non-removable Afyx skill component: %s\n' "$selected" >&2
|
|
84
|
+
exit 2
|
|
85
|
+
}
|
|
86
|
+
done
|
|
87
|
+
fi
|
|
88
|
+
for component_id in $(afyx_component_ids); do
|
|
89
|
+
[[ "$(afyx_component_field "$component_id" type)" == skill ]] || continue
|
|
90
|
+
ownership="$(afyx_component_field "$component_id" ownership)"
|
|
91
|
+
if [[ "$ownership" == afyx ]] && component_selected "$component_id"; then
|
|
92
|
+
target="$(afyx_component_root "$component_id")"
|
|
93
|
+
if "$dry_run"; then
|
|
94
|
+
afyx_classify_skill "$target" "$component_id" "$ownership"
|
|
95
|
+
case "$AFYX_OWNERSHIP_STATE" in
|
|
96
|
+
NOT_INSTALLED) ;;
|
|
97
|
+
AFYX_OWNED_UNMODIFIED|EXTERNAL_UPSTREAM) printf '+ ownership-verified remove %q\n' "$target" ;;
|
|
98
|
+
*) printf 'Refusing to remove %s because installed ownership is %s.\n' "$target" "$AFYX_OWNERSHIP_STATE" >&2; exit 1 ;;
|
|
99
|
+
esac
|
|
100
|
+
else
|
|
101
|
+
afyx_remove_skill "$component_id" "$target" "$ownership"
|
|
102
|
+
fi
|
|
103
|
+
fi
|
|
104
|
+
done
|
|
105
|
+
for additional_root in ${additional_skill_roots[@]+"${additional_skill_roots[@]}"}; do
|
|
106
|
+
for component_id in $(afyx_component_ids); do
|
|
107
|
+
[[ "$(afyx_component_field "$component_id" type)" == skill && "$(afyx_component_field "$component_id" ownership)" == afyx ]] || continue
|
|
108
|
+
component_selected "$component_id" || continue
|
|
109
|
+
target="$additional_root/$(afyx_component_field "$component_id" install_path)"
|
|
110
|
+
if "$dry_run"; then
|
|
111
|
+
afyx_classify_skill "$target" "$component_id" afyx
|
|
112
|
+
case "$AFYX_OWNERSHIP_STATE" in NOT_INSTALLED) ;; AFYX_OWNED_UNMODIFIED) printf '+ ownership-verified remove %q\n' "$target" ;; *) printf 'Refusing to remove %s because installed ownership is %s.\n' "$target" "$AFYX_OWNERSHIP_STATE" >&2; exit 1 ;; esac
|
|
113
|
+
else afyx_remove_skill "$component_id" "$target" afyx; fi
|
|
114
|
+
done
|
|
115
|
+
done
|
|
116
|
+
if "$remove_provider_configuration"; then
|
|
117
|
+
provider_args=("$root/scripts/afyx-provider-integration.mjs" --providers "$provider_list" --scope "$provider_scope" --workspace-root "$workspace_root" --gemini-home "$gemini_home" --codex-home "${CODEX_HOME:-$HOME/.codex}" --node "$(command -v node)" --entry "$graph_root/current/lib/dist/bin/afyx-graph.js" --uninstall)
|
|
118
|
+
command -v codex >/dev/null 2>&1 && provider_args+=(--codex "$(command -v codex)")
|
|
119
|
+
if "$dry_run"; then printf 'Dry-run: would remove only Afyx-owned provider MCP entries at %s scope.\n' "$provider_scope"
|
|
120
|
+
else provider_json="$(node "${provider_args[@]}" --apply)" || { printf 'Provider removal failed: %s\n' "$provider_json" >&2; exit 1; }; fi
|
|
121
|
+
fi
|
|
122
|
+
if [[ -e "$graph_root" ]]; then
|
|
123
|
+
if ! "$remove_afyx_graph" && [[ -t 0 && -z "${CI:-}" ]] && ! "$dry_run"; then
|
|
124
|
+
read -r -p 'Afyx Graph detected. Remove Afyx Graph? [Y/N] [N]: ' answer || answer=
|
|
125
|
+
case "$answer" in [yY]|[yY][eE][sS]) remove_afyx_graph=true ;; esac
|
|
126
|
+
fi
|
|
127
|
+
if "$remove_afyx_graph"; then
|
|
128
|
+
if "$dry_run"; then printf '+ scripts/install-afyx-graph.sh --uninstall\n'; else bash "$root/scripts/install-afyx-graph.sh" --uninstall; fi
|
|
129
|
+
else printf 'Afyx Graph: kept\n'; fi
|
|
130
|
+
fi
|
|
131
|
+
if "$remove_afyx_context"; then
|
|
132
|
+
# Separate provider companion is removed only under the explicit Context
|
|
133
|
+
# uninstall operation and only after existing Afyx ownership is verified.
|
|
134
|
+
for context_skill_root in "$skills_root" ${additional_skill_roots[@]+"${additional_skill_roots[@]}"}; do
|
|
135
|
+
context_skill_target="$context_skill_root/afyx-context"
|
|
136
|
+
if "$dry_run"; then
|
|
137
|
+
afyx_classify_skill "$context_skill_target" afyx-context afyx
|
|
138
|
+
case "$AFYX_OWNERSHIP_STATE" in
|
|
139
|
+
NOT_INSTALLED) ;;
|
|
140
|
+
AFYX_OWNED_UNMODIFIED) printf '+ ownership-verified ACE companion remove %q\n' "$context_skill_target" ;;
|
|
141
|
+
*) printf 'Refusing to remove ACE companion %s because ownership is %s.\n' "$context_skill_target" "$AFYX_OWNERSHIP_STATE" >&2; exit 1 ;;
|
|
142
|
+
esac
|
|
143
|
+
else
|
|
144
|
+
(skills_root="$context_skill_root"; afyx_remove_skill afyx-context "$context_skill_target" afyx)
|
|
145
|
+
fi
|
|
146
|
+
done
|
|
147
|
+
if "$dry_run"; then bash "$root/scripts/install-afyx-context.sh" --runtime-root "$context_root" --validate-only
|
|
148
|
+
else bash "$root/scripts/install-afyx-context.sh" --runtime-root "$context_root" --uninstall; fi
|
|
149
|
+
elif [[ -e "$context_root" ]]; then printf 'Afyx Context Engine: kept\n'; fi
|
|
150
|
+
if "$remove_afyx_forge"; then
|
|
151
|
+
for forge_skill_root in "$skills_root" ${additional_skill_roots[@]+"${additional_skill_roots[@]}"}; do
|
|
152
|
+
forge_skill_target="$forge_skill_root/afyx-forge"
|
|
153
|
+
if "$dry_run"; then
|
|
154
|
+
afyx_classify_skill "$forge_skill_target" afyx-forge afyx
|
|
155
|
+
case "$AFYX_OWNERSHIP_STATE" in
|
|
156
|
+
NOT_INSTALLED) ;;
|
|
157
|
+
AFYX_OWNED_UNMODIFIED) printf '+ ownership-verified Forge companion remove %q\n' "$forge_skill_target" ;;
|
|
158
|
+
*) printf 'Refusing to remove Forge companion %s because ownership is %s.\n' "$forge_skill_target" "$AFYX_OWNERSHIP_STATE" >&2; exit 1 ;;
|
|
159
|
+
esac
|
|
160
|
+
else
|
|
161
|
+
(skills_root="$forge_skill_root"; afyx_remove_skill afyx-forge "$forge_skill_target" afyx)
|
|
162
|
+
fi
|
|
163
|
+
done
|
|
164
|
+
if "$dry_run"; then bash "$root/scripts/install-afyx-forge.sh" --runtime-root "$forge_root" --validate-only
|
|
165
|
+
else bash "$root/scripts/install-afyx-forge.sh" --runtime-root "$forge_root" --uninstall; fi
|
|
166
|
+
elif [[ -e "$forge_root" ]]; then printf 'Afyx Forge Core: kept\n'; fi
|
|
167
|
+
printf 'ACE user state, project indexes, external software, and Codex configuration were not changed.\n'
|