afyx-engineering-kit 0.0.0-stage → 0.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.afyx-source-revision +1 -0
- package/LICENSE +21 -0
- package/README.md +377 -2
- package/SECURITY.md +74 -0
- package/afyx-context/LICENSE +21 -0
- package/afyx-context/README.md +155 -0
- package/afyx-context/afyx-context.json +30 -0
- package/afyx-context/contracts/integration-v1.schema.json +34 -0
- package/afyx-context/package-lock.json +53 -0
- package/afyx-context/package.json +34 -0
- package/afyx-context/scripts/benchmark.mjs +39 -0
- package/afyx-context/scripts/build.mjs +15 -0
- package/afyx-context/scripts/comparative-benchmark.mjs +342 -0
- package/afyx-context/scripts/comparative-worker.mjs +74 -0
- package/afyx-context/scripts/graph-integration-e2e.mjs +188 -0
- package/afyx-context/scripts/integrated-dogfood.mjs +309 -0
- package/afyx-context/src/budget.js +166 -0
- package/afyx-context/src/cli.js +110 -0
- package/afyx-context/src/coordination.js +343 -0
- package/afyx-context/src/engine.js +198 -0
- package/afyx-context/src/errors.js +14 -0
- package/afyx-context/src/graph-integration-worker.js +70 -0
- package/afyx-context/src/graph-integration.js +373 -0
- package/afyx-context/src/graph-mcp-bridge.js +103 -0
- package/afyx-context/src/index.js +25 -0
- package/afyx-context/src/integrations.js +87 -0
- package/afyx-context/src/memory.js +255 -0
- package/afyx-context/src/storage.js +364 -0
- package/afyx-context/test-fixtures/coordination-worker.mjs +52 -0
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/__init__.py +1 -0
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/__manifest__.py +4 -0
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/models/__init__.py +1 -0
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/models/sale_order.py +5 -0
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/__init__.py +1 -0
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/__manifest__.py +10 -0
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/models/__init__.py +2 -0
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/models/sale_order.py +20 -0
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/models/sale_order_audit.py +11 -0
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/security/ir.model.access.csv +2 -0
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/views/sale_order_views.xml +14 -0
- package/afyx-forge/LICENSE +55 -0
- package/afyx-forge/README.md +126 -0
- package/afyx-forge/afyx-forge.json +28 -0
- package/afyx-forge/bin/afyx-forge +4 -0
- package/afyx-forge/bin/afyx-forge.cmd +3 -0
- package/afyx-forge/bin/afyx-forge.js +16 -0
- package/afyx-forge/contracts/forge-plan-v1.schema.json +172 -0
- package/afyx-forge/package.json +26 -0
- package/afyx-forge/src/classifier.js +190 -0
- package/afyx-forge/src/cli.js +111 -0
- package/afyx-forge/src/doctor.js +105 -0
- package/afyx-forge/src/guidance.js +120 -0
- package/afyx-forge/src/index.js +273 -0
- package/afyx-forge/src/planning.js +107 -0
- package/afyx-forge/src/policy.js +109 -0
- package/afyx-forge/src/workflow-refiner.js +151 -0
- package/afyx-graph/afyx-graph.json +20 -0
- package/afyx-graph/engine/LICENSE +21 -0
- package/afyx-graph/engine/README.md +104 -0
- package/afyx-graph/engine/release/RELEASE-MANIFEST.json +21 -0
- package/afyx-graph/engine/release/SHA256SUMS +2 -0
- package/afyx-graph/engine/release/afyx-graph-linux-x64.tar.gz +0 -0
- package/afyx-graph/engine/release/afyx-graph-win32-x64.zip +0 -0
- package/afyx-graph/engine/scripts/distribution-contract.mjs +212 -0
- package/afyx-graph/engine/scripts/distribution-product.json +33 -0
- package/bin/afyx-engineering-kit.mjs +61 -0
- package/install.ps1 +1053 -0
- package/install.sh +617 -0
- package/package.json +66 -4
- package/scripts/afyx-capability-orchestrator.mjs +752 -0
- package/scripts/afyx-claude-integration.mjs +547 -0
- package/scripts/afyx-context-artifact.mjs +105 -0
- package/scripts/afyx-credential-broker.mjs +75 -0
- package/scripts/afyx-doctor.ps1 +152 -0
- package/scripts/afyx-doctor.sh +146 -0
- package/scripts/afyx-forge-artifact.mjs +183 -0
- package/scripts/afyx-global-routing-policy.md +12 -0
- package/scripts/afyx-global-routing.mjs +168 -0
- package/scripts/afyx-graph-artifact.mjs +178 -0
- package/scripts/afyx-host-adapters.mjs +543 -0
- package/scripts/afyx-host-bridge-lifecycle.mjs +174 -0
- package/scripts/afyx-host-bridge.mjs +288 -0
- package/scripts/afyx-integration-contracts.mjs +825 -0
- package/scripts/afyx-mcp-integration.mjs +528 -0
- package/scripts/afyx-modular-integration.mjs +361 -0
- package/scripts/afyx-modular-runtime.mjs +451 -0
- package/scripts/afyx-native-skill-host.mjs +124 -0
- package/scripts/afyx-npm-installer.mjs +486 -0
- package/scripts/afyx-project.ps1 +205 -0
- package/scripts/afyx-project.sh +207 -0
- package/scripts/afyx-provider-backup.mjs +1206 -0
- package/scripts/afyx-provider-integration.mjs +724 -0
- package/scripts/afyx-provider-inventory.mjs +147 -0
- package/scripts/afyx-security-auditor.mjs +224 -0
- package/scripts/afyx-skill-engineering.mjs +354 -0
- package/scripts/afyx-tool-family-routing.mjs +64 -0
- package/scripts/afyx-universal-runtime.mjs +530 -0
- package/scripts/alpha_acceptance_preflight.py +240 -0
- package/scripts/benchmark-graph-memory.mjs +96 -0
- package/scripts/benchmark_capability_orchestrator.mjs +64 -0
- package/scripts/build-windows-installer.ps1 +259 -0
- package/scripts/build_forge_synthetic_image.py +328 -0
- package/scripts/check-reference-staleness.py +71 -0
- package/scripts/components.json +254 -0
- package/scripts/contracts/afyx-capability-request-v1.schema.json +189 -0
- package/scripts/contracts/afyx-capability-result-v1.schema.json +32 -0
- package/scripts/dogfood_engineering_comparison.mjs +303 -0
- package/scripts/engineering-assurance.json +28 -0
- package/scripts/install-afyx-context.ps1 +142 -0
- package/scripts/install-afyx-context.sh +126 -0
- package/scripts/install-afyx-forge.ps1 +265 -0
- package/scripts/install-afyx-forge.sh +273 -0
- package/scripts/install-afyx-graph.ps1 +571 -0
- package/scripts/install-afyx-graph.sh +438 -0
- package/scripts/install-codex-usage-tracker.ps1 +172 -0
- package/scripts/lib/AfyxComponents.psm1 +399 -0
- package/scripts/lib/AfyxSkillLifecycle.psm1 +289 -0
- package/scripts/lib/AfyxTerminal.psm1 +838 -0
- package/scripts/lib/afyx-components.sh +256 -0
- package/scripts/lib/afyx-skill-lifecycle.sh +271 -0
- package/scripts/link-global-dev.ps1 +193 -0
- package/scripts/link-global-dev.sh +130 -0
- package/scripts/phase8-paired-evidence.mjs +195 -0
- package/scripts/phase8-representative-workload.mjs +771 -0
- package/scripts/phase8-session-recorder.mjs +157 -0
- package/scripts/phase8_event_ledger.py +248 -0
- package/scripts/phase8_evidence_discovery.py +189 -0
- package/scripts/prepare-g6-package.mjs +349 -0
- package/scripts/resolve-git-release-artifacts.mjs +321 -0
- package/scripts/stage-npm-release.mjs +94 -0
- package/scripts/validate-afyx-graph.py +203 -0
- package/scripts/validate-components.py +194 -0
- package/scripts/validate-engineering-assurance.py +281 -0
- package/scripts/verify-graph-archive.mjs +64 -0
- package/skills/afyx-context/SKILL.md +26 -0
- package/skills/afyx-engineering-expert/README.md +42 -0
- package/skills/afyx-engineering-expert/SKILL.md +70 -0
- package/skills/afyx-engineering-expert/assets/result-template.md +15 -0
- package/skills/afyx-engineering-expert/references/ai-ml-engineer.md +17 -0
- package/skills/afyx-engineering-expert/references/business-analyst.md +17 -0
- package/skills/afyx-engineering-expert/references/clean-code-engineer.md +26 -0
- package/skills/afyx-engineering-expert/references/code-reviewer.md +24 -0
- package/skills/afyx-engineering-expert/references/cybersecurity-devsecops.md +17 -0
- package/skills/afyx-engineering-expert/references/data-analyst-bi.md +24 -0
- package/skills/afyx-engineering-expert/references/data-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/database-administrator.md +17 -0
- package/skills/afyx-engineering-expert/references/debugging-specialist.md +24 -0
- package/skills/afyx-engineering-expert/references/embedded-iot-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/erp-technical-specialist.md +17 -0
- package/skills/afyx-engineering-expert/references/hardware-diagnostics-auditor.md +24 -0
- package/skills/afyx-engineering-expert/references/hardware-electronics-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/integration-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/legacy-modernization-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/llmops-prompt-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/network-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/performance-benchmark-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/platform-engineer.md +24 -0
- package/skills/afyx-engineering-expert/references/product-manager.md +17 -0
- package/skills/afyx-engineering-expert/references/qa-engineer.md +17 -0
- package/skills/afyx-engineering-expert/references/site-reliability-engineer.md +17 -0
- package/skills/afyx-engineering-expert/references/software-engineer.md +17 -0
- package/skills/afyx-engineering-expert/references/solutions-architect.md +17 -0
- package/skills/afyx-engineering-expert/references/specialists-index.md +33 -0
- package/skills/afyx-engineering-expert/references/subject-matter-expert.md +17 -0
- package/skills/afyx-engineering-expert/references/system-analyst.md +17 -0
- package/skills/afyx-engineering-expert/references/technical-project-manager.md +24 -0
- package/skills/afyx-engineering-expert/references/technical-writer.md +24 -0
- package/skills/afyx-engineering-expert/references/ui-ux-designer.md +17 -0
- package/skills/afyx-engineering-expert/workflows/ai-data-erp.md +20 -0
- package/skills/afyx-engineering-expert/workflows/debugging.md +10 -0
- package/skills/afyx-engineering-expert/workflows/discovery-design.md +11 -0
- package/skills/afyx-engineering-expert/workflows/implementation.md +12 -0
- package/skills/afyx-engineering-expert/workflows/incident-reliability.md +12 -0
- package/skills/afyx-engineering-expert/workflows/review-audit.md +13 -0
- package/skills/afyx-forge/SKILL.md +43 -0
- package/skills/afyx-forge/references/adaptive-policy.md +19 -0
- package/skills/efficient-coding/SKILL.md +33 -0
- package/skills/efficient-coding/references/investigation.md +27 -0
- package/skills/efficient-coding/references/token-efficiency.md +25 -0
- package/skills/efficient-coding/references/tool-routing.md +13 -0
- package/skills/odoo-engineering/SKILL.md +33 -0
- package/skills/odoo-engineering/references/common.md +9 -0
- package/skills/odoo-engineering/references/odoo-10.md +32 -0
- package/skills/odoo-engineering/references/odoo-11.md +26 -0
- package/skills/odoo-engineering/references/odoo-12.md +31 -0
- package/skills/odoo-engineering/references/odoo-13.md +27 -0
- package/skills/odoo-engineering/references/odoo-14.md +31 -0
- package/skills/odoo-engineering/references/odoo-15.md +34 -0
- package/skills/odoo-engineering/references/odoo-16.md +37 -0
- package/skills/odoo-engineering/references/odoo-17.md +37 -0
- package/skills/odoo-engineering/references/odoo-18.md +48 -0
- package/skills/odoo-engineering/references/odoo-19.md +43 -0
- package/skills/odoo-engineering/references/odoo-20.md +39 -0
- package/skills/odoo-engineering/references/reference-schema.md +16 -0
- package/skills/odoo-engineering/references/version-detection.md +13 -0
- package/tools/codex-usage/CodexUsage.psm1 +496 -0
- package/tools/codex-usage/codex-usage-doctor.ps1 +150 -0
- package/tools/codex-usage/codex-usage-pricing.json +25 -0
- package/tools/codex-usage/codex-usage-stop.ps1 +167 -0
- package/tools/codex-usage/codex-usage-watch.ps1 +250 -0
- package/tools/codex-usage/vscode-user-task.json +31 -0
- package/tools/windows-setup/SetupBootstrapper.cs +258 -0
- package/uninstall.ps1 +189 -0
- package/uninstall.sh +167 -0
- package/update.ps1 +95 -0
- package/update.sh +67 -0
- package/verify.ps1 +411 -0
- package/verify.sh +265 -0
package/install.sh
ADDED
|
@@ -0,0 +1,617 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
PACKAGE_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
+
BUNDLED_EFFICIENT="$PACKAGE_ROOT/skills/efficient-coding"
|
|
6
|
+
BUNDLED_ODOO="$PACKAGE_ROOT/skills/odoo-engineering"
|
|
7
|
+
BUNDLED_EXPERT="$PACKAGE_ROOT/skills/afyx-engineering-expert"
|
|
8
|
+
skills_root="${CODEX_SKILLS_ROOT:-$HOME/.agents/skills}"
|
|
9
|
+
skills_root_explicit=false
|
|
10
|
+
graph_root="${AFYX_GRAPH_RUNTIME_ROOT:-$HOME/.afyx/graph}"
|
|
11
|
+
context_root="${AFYX_CONTEXT_RUNTIME_ROOT:-$HOME/.afyx/context}"
|
|
12
|
+
forge_root="${AFYX_FORGE_RUNTIME_ROOT:-$HOME/.afyx/forge}"
|
|
13
|
+
force=false
|
|
14
|
+
validate_only=false
|
|
15
|
+
dry_run=false
|
|
16
|
+
update_installed=false
|
|
17
|
+
component_actions=()
|
|
18
|
+
component_action_count=0
|
|
19
|
+
preset=
|
|
20
|
+
custom_component_list=
|
|
21
|
+
offline=false
|
|
22
|
+
no_build_fallback=false
|
|
23
|
+
allow_dirty_source=false
|
|
24
|
+
allow_downgrade=false
|
|
25
|
+
skip_graph_mcp=false
|
|
26
|
+
provider_list=codex
|
|
27
|
+
provider_explicit=false
|
|
28
|
+
provider_scope=global
|
|
29
|
+
workspace_root="$PWD"
|
|
30
|
+
gemini_home="${AFYX_GEMINI_HOME:-$HOME/.gemini}"
|
|
31
|
+
claude_home="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
|
|
32
|
+
claude_config_dir="${CLAUDE_CONFIG_DIR:-}"
|
|
33
|
+
skip_provider_configuration=false
|
|
34
|
+
|
|
35
|
+
usage() {
|
|
36
|
+
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]'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
while (($#)); do
|
|
40
|
+
case "$1" in
|
|
41
|
+
--skills-root) (($# >= 2)) || { printf '%s\n' '--skills-root requires a value.' >&2; exit 2; }; skills_root="$2"; skills_root_explicit=true; shift 2 ;;
|
|
42
|
+
--context-runtime-root) (($# >= 2)) || { printf '%s\n' '--context-runtime-root requires a value.' >&2; exit 2; }; context_root="$2"; shift 2 ;;
|
|
43
|
+
--forge-runtime-root) (($# >= 2)) || { printf '%s\n' '--forge-runtime-root requires a value.' >&2; exit 2; }; forge_root="$2"; shift 2 ;;
|
|
44
|
+
--force) force=true; shift ;;
|
|
45
|
+
--component) (($# >= 2)) || { printf '%s\n' '--component requires a value.' >&2; exit 2; }; component_actions+=("$2"); component_action_count=$((component_action_count + 1)); shift 2 ;;
|
|
46
|
+
--preset) (($# >= 2)) || { printf '%s\n' '--preset requires a value.' >&2; exit 2; }; preset="$2"; shift 2 ;;
|
|
47
|
+
--custom-component) (($# >= 2)) || { printf '%s\n' '--custom-component requires a value.' >&2; exit 2; }; custom_component_list="${custom_component_list:+$custom_component_list;}$2"; shift 2 ;;
|
|
48
|
+
--update-installed) update_installed=true; shift ;;
|
|
49
|
+
--offline) offline=true; shift ;;
|
|
50
|
+
--no-build-fallback) no_build_fallback=true; shift ;;
|
|
51
|
+
--allow-dirty-source) allow_dirty_source=true; shift ;;
|
|
52
|
+
--allow-downgrade) allow_downgrade=true; shift ;;
|
|
53
|
+
--skip-graph-mcp) skip_graph_mcp=true; shift ;;
|
|
54
|
+
--provider) (($# >= 2)) || { printf '%s\n' '--provider requires a value.' >&2; exit 2; }; provider_list="$2"; provider_explicit=true; shift 2 ;;
|
|
55
|
+
--provider-scope) (($# >= 2)) || { printf '%s\n' '--provider-scope requires a value.' >&2; exit 2; }; provider_scope="$2"; shift 2 ;;
|
|
56
|
+
--workspace-root) (($# >= 2)) || { printf '%s\n' '--workspace-root requires a value.' >&2; exit 2; }; workspace_root="$2"; shift 2 ;;
|
|
57
|
+
--gemini-home) (($# >= 2)) || { printf '%s\n' '--gemini-home requires a value.' >&2; exit 2; }; gemini_home="$2"; shift 2 ;;
|
|
58
|
+
--claude-home) (($# >= 2)) || { printf '%s\n' '--claude-home requires a value.' >&2; exit 2; }; claude_home="$2"; shift 2 ;;
|
|
59
|
+
--claude-config-dir) (($# >= 2)) || { printf '%s\n' '--claude-config-dir requires a value.' >&2; exit 2; }; claude_config_dir="$2"; shift 2 ;;
|
|
60
|
+
--skip-provider-configuration) skip_provider_configuration=true; shift ;;
|
|
61
|
+
--validate-only) validate_only=true; shift ;;
|
|
62
|
+
--dry-run) dry_run=true; shift ;;
|
|
63
|
+
-h|--help) usage; exit 0 ;;
|
|
64
|
+
*) printf 'Unknown option: %s\n' "$1" >&2; usage >&2; exit 2 ;;
|
|
65
|
+
esac
|
|
66
|
+
done
|
|
67
|
+
|
|
68
|
+
if [[ "$provider_explicit" == false && -t 0 && -t 1 && -z "${CI:-}" ]]; then
|
|
69
|
+
detected_providers=
|
|
70
|
+
if command -v node >/dev/null 2>&1; then
|
|
71
|
+
printf 'PROVIDERS / HOST\n'
|
|
72
|
+
node "$PACKAGE_ROOT/scripts/afyx-provider-inventory.mjs" --lines
|
|
73
|
+
detected_providers="$(node "$PACKAGE_ROOT/scripts/afyx-provider-inventory.mjs" --selected)"
|
|
74
|
+
else
|
|
75
|
+
if command -v agy >/dev/null 2>&1 || command -v antigravity >/dev/null 2>&1; then detected_providers=antigravity; fi
|
|
76
|
+
if command -v claude >/dev/null 2>&1; then detected_providers="${detected_providers:+$detected_providers,}claude"; fi
|
|
77
|
+
if command -v codex >/dev/null 2>&1; then detected_providers="${detected_providers:+$detected_providers,}codex"; fi
|
|
78
|
+
printf 'Provider hosts detected: %s\n' "${detected_providers:-none}"
|
|
79
|
+
fi
|
|
80
|
+
read -r -p 'Provider selection: [A] All detected / [R] Recommended Codex / [C] Custom / [S] Skip [A]: ' provider_choice || provider_choice=
|
|
81
|
+
case "$provider_choice" in
|
|
82
|
+
[aA]|[aA][lL][lL]) provider_list="${detected_providers:-codex}" ;;
|
|
83
|
+
[cC]|[cC][uU][sS][tT][oO][mM]) read -r -p 'Provider ids (comma-separated): ' provider_list ;;
|
|
84
|
+
[sS]|[sS][kK][iI][pP]) provider_list=codex; skip_provider_configuration=true ;;
|
|
85
|
+
*) if [[ -n "$detected_providers" ]]; then provider_list="$detected_providers"; else provider_list=codex; skip_provider_configuration=true; fi ;;
|
|
86
|
+
esac
|
|
87
|
+
fi
|
|
88
|
+
|
|
89
|
+
case "$provider_scope" in global|workspace) ;; *) printf 'Unknown provider scope: %s\n' "$provider_scope" >&2; exit 2 ;; esac
|
|
90
|
+
old_ifs=$IFS; IFS=','
|
|
91
|
+
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
|
|
92
|
+
IFS=$old_ifs
|
|
93
|
+
if [[ "$skills_root_explicit" == false && "$provider_scope" == workspace && ",$provider_list," == *,antigravity,* ]]; then
|
|
94
|
+
skills_root="$workspace_root/.agents/skills"
|
|
95
|
+
fi
|
|
96
|
+
additional_skill_roots=()
|
|
97
|
+
if [[ "$provider_scope" == global && ",$provider_list," == *,antigravity,* ]]; then
|
|
98
|
+
antigravity_ide_skills="$gemini_home/config/skills"
|
|
99
|
+
antigravity_cli_skills="$gemini_home/antigravity-cli/skills"
|
|
100
|
+
if [[ "$skills_root_explicit" == false && "$provider_list" == antigravity ]]; then skills_root="$antigravity_ide_skills"; fi
|
|
101
|
+
[[ "$skills_root" == "$antigravity_ide_skills" ]] || additional_skill_roots+=("$antigravity_ide_skills")
|
|
102
|
+
[[ "$skills_root" == "$antigravity_cli_skills" ]] || additional_skill_roots+=("$antigravity_cli_skills")
|
|
103
|
+
fi
|
|
104
|
+
if [[ "$provider_scope" == global && ",$provider_list," == *,claude,* ]]; then
|
|
105
|
+
claude_skills="$claude_home/skills"
|
|
106
|
+
[[ "$skills_root" == "$claude_skills" ]] || additional_skill_roots+=("$claude_skills")
|
|
107
|
+
elif [[ "$provider_scope" == workspace && ",$provider_list," == *,claude,* ]]; then
|
|
108
|
+
claude_skills="$workspace_root/.claude/skills"
|
|
109
|
+
[[ "$skills_root" == "$claude_skills" ]] || additional_skill_roots+=("$claude_skills")
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
printf 'Afyx Engineering Kit — Linux/macOS installer (Bash)\n'
|
|
113
|
+
|
|
114
|
+
valid_manifest() { [[ -s "$1/SKILL.md" ]] && [[ "$(head -n 1 "$1/SKILL.md")" == '---' ]]; }
|
|
115
|
+
# One component truth: scripts/components.json, read through the shared library.
|
|
116
|
+
# shellcheck source=scripts/lib/afyx-components.sh
|
|
117
|
+
. "$PACKAGE_ROOT/scripts/lib/afyx-components.sh"
|
|
118
|
+
# shellcheck source=scripts/lib/afyx-skill-lifecycle.sh
|
|
119
|
+
. "$PACKAGE_ROOT/scripts/lib/afyx-skill-lifecycle.sh"
|
|
120
|
+
retired_component_error() {
|
|
121
|
+
printf "Component '%s' is retired from Afyx Kit and remains externally/user managed; no changes were made.\n" "$1" >&2
|
|
122
|
+
exit 2
|
|
123
|
+
}
|
|
124
|
+
if [[ -n "$preset" ]] && ! afyx_preset_valid "$preset"; then printf 'Unknown preset: %s\n' "$preset" >&2; exit 2; fi
|
|
125
|
+
if [[ -n "$custom_component_list" && "$preset" != custom ]]; then printf '%s\n' '--custom-component requires --preset custom.' >&2; exit 2; fi
|
|
126
|
+
if [[ -n "$preset" ]] && { ((component_action_count)) || [[ "$force" == true ]]; }; then
|
|
127
|
+
printf '%s\n' 'A preset is immutable for one operation; do not combine it with --component or --force.' >&2; exit 2
|
|
128
|
+
fi
|
|
129
|
+
old_ifs=$IFS; IFS=';'
|
|
130
|
+
for custom_id in $custom_component_list; do
|
|
131
|
+
case "$custom_id" in prompt-master|headroom) retired_component_error "$custom_id" ;; efficient-coding|odoo-engineering|afyx-engineering-expert|afyx-graph|afyx-context|afyx-forge|codex-usage-tracking) ;; *) printf 'Unknown custom component: %s\n' "$custom_id" >&2; exit 2 ;; esac
|
|
132
|
+
done
|
|
133
|
+
IFS=$old_ifs
|
|
134
|
+
for specification in ${component_actions[@]+"${component_actions[@]}"}; do
|
|
135
|
+
case "$specification" in *=*) component_id="${specification%%=*}" ;; *) continue ;; esac
|
|
136
|
+
case "$component_id" in prompt-master|headroom) retired_component_error "$component_id" ;; esac
|
|
137
|
+
done
|
|
138
|
+
component_state() {
|
|
139
|
+
local id="$1" owner target
|
|
140
|
+
afyx_component_evaluate "$id"
|
|
141
|
+
if [[ "$(afyx_component_field "$id" type)" == skill && "$AFYX_STATE" != 'NOT INSTALLED' ]]; then
|
|
142
|
+
owner="$(afyx_component_field "$id" ownership)"; target="$(afyx_component_root "$id")"
|
|
143
|
+
afyx_classify_skill "$target" "$id" "$owner"
|
|
144
|
+
case "$AFYX_OWNERSHIP_STATE" in
|
|
145
|
+
AFYX_OWNED_UNMODIFIED|EXTERNAL_UPSTREAM) ;;
|
|
146
|
+
AFYX_OWNED_MODIFIED) AFYX_STATE=DRIFTED; AFYX_DETAIL='Afyx ownership verified but installed content was modified' ;;
|
|
147
|
+
*) AFYX_STATE=UNKNOWN; AFYX_DETAIL="installed ownership is $AFYX_OWNERSHIP_STATE" ;;
|
|
148
|
+
esac
|
|
149
|
+
fi
|
|
150
|
+
printf '%s' "$AFYX_STATE"
|
|
151
|
+
}
|
|
152
|
+
component_version() { afyx_component_evaluate "$1"; printf '%s' "$AFYX_VERSION"; }
|
|
153
|
+
run() { if "$dry_run"; then printf '+ '; printf '%q ' "$@"; printf '\n'; else "$@"; fi; }
|
|
154
|
+
interactive=false
|
|
155
|
+
if [[ -t 0 && -z "${CI:-}" ]] && ! "$dry_run"; then interactive=true; fi
|
|
156
|
+
|
|
157
|
+
available_version() {
|
|
158
|
+
case "$1" in
|
|
159
|
+
efficient-coding) afyx_skill_version "$BUNDLED_EFFICIENT" ;;
|
|
160
|
+
odoo-engineering) afyx_skill_version "$BUNDLED_ODOO" ;;
|
|
161
|
+
afyx-engineering-expert) afyx_skill_version "$BUNDLED_EXPERT" ;;
|
|
162
|
+
afyx-graph) sed -n 's/.*"product_version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$PACKAGE_ROOT/afyx-graph/afyx-graph.json" ;;
|
|
163
|
+
afyx-context) sed -n 's/.*"product_version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$PACKAGE_ROOT/afyx-context/afyx-context.json" ;;
|
|
164
|
+
afyx-forge) sed -n 's/.*"product_version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$PACKAGE_ROOT/afyx-forge/afyx-forge.json" ;;
|
|
165
|
+
*) printf '' ;;
|
|
166
|
+
esac
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
version_lt() {
|
|
170
|
+
awk -v left="$1" -v right="$2" 'BEGIN {
|
|
171
|
+
split(left, l, "."); split(right, r, ".");
|
|
172
|
+
for (i=1; i<=4; i++) { if ((l[i]+0) < (r[i]+0)) exit 0; if ((l[i]+0) > (r[i]+0)) exit 1 }
|
|
173
|
+
exit 1
|
|
174
|
+
}'
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
explicit_action() {
|
|
178
|
+
local wanted="$1" specification id action
|
|
179
|
+
for specification in ${component_actions[@]+"${component_actions[@]}"}; do
|
|
180
|
+
case "$specification" in *=*) id="${specification%%=*}"; action="${specification#*=}" ;; *) printf 'Invalid --component value: %s\n' "$specification" >&2; return 2 ;; esac
|
|
181
|
+
case "$id" in prompt-master|headroom) retired_component_error "$id" ;; efficient-coding|odoo-engineering|afyx-engineering-expert|afyx-graph|afyx-context|afyx-forge|codex-usage-tracking) ;; *) printf 'Unknown selectable component: %s\n' "$id" >&2; return 2 ;; esac
|
|
182
|
+
case "$action" in skip|install|update|repair|adopt) ;; *) printf 'Invalid action for %s: %s\n' "$id" "$action" >&2; return 2 ;; esac
|
|
183
|
+
[[ "$id" == "$wanted" ]] && { printf '%s' "$action"; return 0; }
|
|
184
|
+
done
|
|
185
|
+
return 1
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
component_action() {
|
|
189
|
+
local id="$1" label="$2" state="$3" installed="$4" available action= answer default
|
|
190
|
+
available="$(available_version "$id")"
|
|
191
|
+
if action="$(explicit_action "$id")"; then :
|
|
192
|
+
elif [[ -n "$preset" ]]; then
|
|
193
|
+
afyx_control_classify "$id" "$state" "$preset" "$custom_component_list" "$provider_list"
|
|
194
|
+
if [[ "$AFYX_DESIRED" != true || "$AFYX_DRIFT" == NOT_APPLICABLE ]]; then action=skip
|
|
195
|
+
elif [[ "$AFYX_REPAIR" == BLOCKED ]]; then printf '%s drift is %s with actual ownership %s; automatic takeover is forbidden.\n' "$label" "$AFYX_DRIFT" "$AFYX_ACTUAL_OWNERSHIP" >&2; return 2
|
|
196
|
+
elif [[ "$AFYX_REPAIR" == INSTALL ]]; then action=install
|
|
197
|
+
elif [[ "$AFYX_REPAIR" == REPAIR ]]; then action=repair
|
|
198
|
+
elif [[ "$state" == HEALTHY && -n "$available" && -n "$installed" ]]; then
|
|
199
|
+
if version_lt "$installed" "$available"; then action=update
|
|
200
|
+
elif version_lt "$available" "$installed" && { "$allow_downgrade" || "$force"; }; then action=repair
|
|
201
|
+
else action=skip; fi
|
|
202
|
+
else action=skip; fi
|
|
203
|
+
elif "$force"; then
|
|
204
|
+
if [[ "$state" == UNKNOWN ]]; then printf '%s ownership is unknown; --force cannot take ownership.\n' "$label" >&2; return 2
|
|
205
|
+
elif [[ "$state" == 'NOT INSTALLED' ]]; then action=install
|
|
206
|
+
elif [[ "$state" == INCOMPLETE || "$state" == INVALID || "$state" == DRIFTED ]]; then action=repair
|
|
207
|
+
else action=update; fi
|
|
208
|
+
elif "$update_installed"; then
|
|
209
|
+
if [[ "$state" == INCOMPLETE || "$state" == INVALID || "$state" == DRIFTED ]]; then action=repair
|
|
210
|
+
elif [[ "$state" == HEALTHY && -n "$available" && -n "$installed" ]]; then
|
|
211
|
+
if version_lt "$installed" "$available"; then action=update
|
|
212
|
+
elif version_lt "$available" "$installed" && "$allow_downgrade"; then action=repair
|
|
213
|
+
else action=skip; fi
|
|
214
|
+
else action=skip; fi
|
|
215
|
+
elif ! "$interactive" || "$dry_run"; then action=skip
|
|
216
|
+
elif [[ "$state" == 'NOT INSTALLED' ]]; then
|
|
217
|
+
read -r -p "$label is not installed. installed=$installed available=$available [I] Install / [S] Skip [S]: " answer || answer=
|
|
218
|
+
case "$answer" in [iI]|[iI][nN][sS][tT][aA][lL][lL]) action=install ;; *) action=skip ;; esac
|
|
219
|
+
elif [[ "$state" == HEALTHY ]]; then
|
|
220
|
+
default=S; [[ -n "$available" && -n "$installed" ]] && version_lt "$installed" "$available" && default=U
|
|
221
|
+
read -r -p "$label is healthy. installed=$installed available=$available [U] Update / [S] Skip [$default]: " answer || answer=
|
|
222
|
+
case "$answer" in [uU]|[uU][pP][dD][aA][tT][eE]) action=update ;; '') [[ "$default" == U ]] && action=update || action=skip ;; *) action=skip ;; esac
|
|
223
|
+
elif [[ "$state" == INCOMPLETE || "$state" == INVALID || "$state" == DRIFTED ]]; then
|
|
224
|
+
read -r -p "$label is $state [R] Repair / [S] Skip [S]: " answer || answer=
|
|
225
|
+
case "$answer" in [rR]|[rR][eE][pP][aA][iI][rR]) action=repair ;; *) action=skip ;; esac
|
|
226
|
+
else
|
|
227
|
+
read -r -p "$label ownership/health is unknown. [A] Adopt verified legacy install / [S] Skip [S]: " answer || answer=
|
|
228
|
+
case "$answer" in [aA]|[aA][dD][oO][pP][tT]) action=adopt ;; *) action=skip ;; esac
|
|
229
|
+
fi
|
|
230
|
+
case "$state:$action" in
|
|
231
|
+
'NOT INSTALLED':install|'NOT INSTALLED':skip|HEALTHY:update|HEALTHY:adopt|HEALTHY:skip|INCOMPLETE:repair|INCOMPLETE:skip|INVALID:repair|INVALID:skip|DRIFTED:repair|DRIFTED:skip|UNKNOWN:adopt|UNKNOWN:skip) ;;
|
|
232
|
+
*) printf '%s state %s does not permit action %s.\n' "$label" "$state" "$action" >&2; return 2 ;;
|
|
233
|
+
esac
|
|
234
|
+
printf '%s' "$action"
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
replace_choice() {
|
|
238
|
+
local label="$1" answer
|
|
239
|
+
if "$force"; then printf Replace; return; fi
|
|
240
|
+
if ! "$interactive"; then printf Skip; return; fi
|
|
241
|
+
while :; do
|
|
242
|
+
read -r -p "$label [S] Skip / [R] Replace [S]: " answer || answer=
|
|
243
|
+
case "$answer" in ''|[sS]|[sS][kK][iI][pP]) printf Skip; return ;; [rR]|[rR][eE][pP][lL][aA][cC][eE]) printf Replace; return ;; esac
|
|
244
|
+
done
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
install_choice() {
|
|
248
|
+
local label="$1" answer
|
|
249
|
+
if ! "$interactive"; then return 1; fi
|
|
250
|
+
while :; do
|
|
251
|
+
read -r -p "$label [Y/N] [N]: " answer || answer=
|
|
252
|
+
case "$answer" in [yY]|[yY][eE][sS]) return 0 ;; ''|[nN]|[nN][oO]) return 1 ;; esac
|
|
253
|
+
done
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
replacement_authorized() {
|
|
257
|
+
local id="$1" specification
|
|
258
|
+
"$force" && return 0
|
|
259
|
+
if [[ -n "$preset" ]] && afyx_component_desired "$id" "$preset" "$custom_component_list" "$provider_list"; then return 0; fi
|
|
260
|
+
for specification in ${component_actions[@]+"${component_actions[@]}"}; do
|
|
261
|
+
[[ "$specification" == "$id="* && "$specification" != "$id=skip" ]] && return 0
|
|
262
|
+
done
|
|
263
|
+
return 1
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
safe_skill_install() {
|
|
267
|
+
local component="$1" label="$2" source="$3" target="$4" replace="$5" parent stage version authorize=false
|
|
268
|
+
if [[ -e "$target" && "$replace" != true ]]; then printf skipped; return; fi
|
|
269
|
+
if "$dry_run"; then printf 'planned'; return; fi
|
|
270
|
+
parent="$(dirname "$target")"; afyx_assert_skill_target "$skills_root" "$target"
|
|
271
|
+
stage="$(mktemp -d "$parent/.skill-stage.XXXXXX")"
|
|
272
|
+
if ! cp -a "$source/." "$stage/"; then rm -rf -- "$stage"; return 1; fi
|
|
273
|
+
version="$(afyx_skill_version "$source")"
|
|
274
|
+
replacement_authorized "$component" && authorize=true
|
|
275
|
+
if ! afyx_promote_skill "$component" "$label" "$stage" "$target" afyx "$version" '' '' "$authorize"; then
|
|
276
|
+
[[ -e "$stage" ]] && rm -rf -- "$stage"
|
|
277
|
+
return 1
|
|
278
|
+
fi
|
|
279
|
+
if [[ "$replace" == true ]]; then printf replaced; else printf installed; fi
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
adopt_legacy_skill() {
|
|
283
|
+
local component="$1" label="$2" target="$3" owner legacy_version legacy_digest repository revision provenance
|
|
284
|
+
owner="$(afyx_component_field "$component" ownership)"
|
|
285
|
+
legacy_version="$(afyx_component_field "$component" legacy_version)"
|
|
286
|
+
legacy_digest="$(afyx_component_field "$component" legacy_content_digest_bash)"
|
|
287
|
+
repository="$(afyx_component_field "$component" source)"
|
|
288
|
+
revision="$(afyx_component_field "$component" source_revision)"
|
|
289
|
+
afyx_classify_skill "$target" "$component" "$owner"
|
|
290
|
+
if [[ "$AFYX_OWNERSHIP_STATE" == AFYX_OWNED_UNMODIFIED || "$AFYX_OWNERSHIP_STATE" == EXTERNAL_UPSTREAM ]]; then
|
|
291
|
+
printf 'already adopted'; return 0
|
|
292
|
+
fi
|
|
293
|
+
afyx_legacy_skill_provenance "$target" "$component" "$owner" "$legacy_digest" "$legacy_version" "$repository" "$revision"
|
|
294
|
+
provenance="$AFYX_LEGACY_PROVENANCE"
|
|
295
|
+
[[ "$provenance" == MATCH ]] || { printf 'Refusing to adopt %s because legacy provenance is %s.\n' "$label" "$provenance" >&2; return 1; }
|
|
296
|
+
if "$dry_run"; then printf 'planned adoption'; return 0; fi
|
|
297
|
+
afyx_adopt_legacy_skill "$component" "$target" "$owner" "$legacy_version" "$legacy_digest" "$legacy_version" "$repository" "$revision"
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
valid_manifest "$BUNDLED_EFFICIENT" || { printf 'Bundled Efficient Coding is invalid.\n' >&2; exit 1; }
|
|
301
|
+
valid_manifest "$BUNDLED_ODOO" || { printf 'Bundled Odoo Engineering is invalid.\n' >&2; exit 1; }
|
|
302
|
+
valid_manifest "$BUNDLED_EXPERT" || { printf 'Bundled Afyx Engineering Expert is invalid.\n' >&2; exit 1; }
|
|
303
|
+
[[ -s "$PACKAGE_ROOT/afyx-graph/afyx-graph.json" ]] || { printf 'Bundled Afyx Graph metadata is missing.\n' >&2; exit 1; }
|
|
304
|
+
[[ -s "$PACKAGE_ROOT/afyx-context/afyx-context.json" ]] || { printf 'Bundled Afyx Context metadata is missing.\n' >&2; exit 1; }
|
|
305
|
+
[[ -s "$PACKAGE_ROOT/afyx-forge/afyx-forge.json" ]] || { printf 'Bundled Afyx Forge metadata is missing.\n' >&2; exit 1; }
|
|
306
|
+
|
|
307
|
+
efficient_target="$skills_root/efficient-coding"
|
|
308
|
+
odoo_target="$skills_root/odoo-engineering"
|
|
309
|
+
expert_target="$skills_root/afyx-engineering-expert"
|
|
310
|
+
efficient_state="$(component_state efficient-coding)"
|
|
311
|
+
odoo_state="$(component_state odoo-engineering)"
|
|
312
|
+
expert_state="$(component_state afyx-engineering-expert)"
|
|
313
|
+
afyx_graph_state="$(component_state afyx-graph)"
|
|
314
|
+
afyx_context_state="$(component_state afyx-context)"
|
|
315
|
+
afyx_forge_state="$(component_state afyx-forge)"
|
|
316
|
+
|
|
317
|
+
printf '\nComponent Inventory\n'
|
|
318
|
+
printf 'Efficient Coding: %s; installed=%s; available=%s; ownership=afyx\n' "$efficient_state" "$(component_version efficient-coding)" "$(available_version efficient-coding)"
|
|
319
|
+
printf 'Odoo Engineering: %s; installed=%s; available=%s; ownership=afyx\n' "$odoo_state" "$(component_version odoo-engineering)" "$(available_version odoo-engineering)"
|
|
320
|
+
printf 'Afyx Engineering Expert: %s; installed=%s; available=%s; ownership=afyx\n' "$expert_state" "$(component_version afyx-engineering-expert)" "$(available_version afyx-engineering-expert)"
|
|
321
|
+
printf 'Afyx Graph: %s; installed=%s; available=%s; ownership=afyx\n' "$afyx_graph_state" "$(component_version afyx-graph)" "$(available_version afyx-graph)"
|
|
322
|
+
printf 'Afyx Context Engine: %s; installed=%s; available=%s; ownership=afyx\n' "$afyx_context_state" "$(component_version afyx-context)" "$(available_version afyx-context)"
|
|
323
|
+
printf 'Afyx Forge Core: %s; installed=%s; available=%s; ownership=afyx\n' "$afyx_forge_state" "$(component_version afyx-forge)" "$(available_version afyx-forge)"
|
|
324
|
+
printf 'Usage Tracking: NOT INSTALLED (Windows-only runtime)\n'
|
|
325
|
+
if [[ -n "$preset" ]]; then
|
|
326
|
+
printf '\nDesired State Plan: %s\n' "$(afyx_control_plan_identity "$preset" "$custom_component_list" "$provider_list")"
|
|
327
|
+
for plan_id in $(afyx_component_ids); do
|
|
328
|
+
plan_state="$(component_state "$plan_id")"
|
|
329
|
+
afyx_control_classify "$plan_id" "$plan_state" "$preset" "$custom_component_list" "$provider_list"
|
|
330
|
+
printf '%s: desired=%s; actual=%s; drift=%s; ownership=%s; repair=%s\n' "$plan_id" "$AFYX_DESIRED" "$plan_state" "$AFYX_DRIFT" "$AFYX_ACTUAL_OWNERSHIP" "$AFYX_REPAIR"
|
|
331
|
+
done
|
|
332
|
+
fi
|
|
333
|
+
printf '\nProvider Plan\n'
|
|
334
|
+
if "$skip_provider_configuration"; then printf 'Provider configuration: skipped explicitly\n'; fi
|
|
335
|
+
old_ifs=$IFS; IFS=','
|
|
336
|
+
for provider_id in $provider_list; do
|
|
337
|
+
if [[ "$provider_id" == codex ]]; then
|
|
338
|
+
provider_name=Codex
|
|
339
|
+
command -v codex >/dev/null 2>&1 && provider_detected=true || provider_detected=false
|
|
340
|
+
provider_path="${CODEX_HOME:-$HOME/.codex}/config.toml"
|
|
341
|
+
elif [[ "$provider_id" == antigravity ]]; then
|
|
342
|
+
provider_name=Antigravity
|
|
343
|
+
{ command -v agy >/dev/null 2>&1 || command -v antigravity >/dev/null 2>&1; } && provider_detected=true || provider_detected=false
|
|
344
|
+
[[ "$provider_scope" == workspace ]] && provider_path="$workspace_root/.agents/mcp_config.json" || provider_path="$gemini_home/config/mcp_config.json"
|
|
345
|
+
elif [[ "$provider_id" == claude ]]; then
|
|
346
|
+
provider_name="Claude Code"
|
|
347
|
+
command -v claude >/dev/null 2>&1 && provider_detected=true || provider_detected=false
|
|
348
|
+
if [[ "$provider_scope" == workspace ]]; then
|
|
349
|
+
provider_path="$workspace_root/.mcp.json"
|
|
350
|
+
else
|
|
351
|
+
provider_path="${claude_config_dir:-$HOME}/.claude.json"
|
|
352
|
+
fi
|
|
353
|
+
fi
|
|
354
|
+
printf '%s: detected=%s; scope=%s; planned-config=%s\n' "$provider_name" "$provider_detected" "$provider_scope" "$provider_path"
|
|
355
|
+
if [[ "$provider_id" == antigravity ]]; then
|
|
356
|
+
if [[ "$provider_scope" == workspace ]]; then provider_skills="$workspace_root/.agents/skills"; else provider_skills="$gemini_home/config/skills;$gemini_home/antigravity-cli/skills"; fi
|
|
357
|
+
printf 'Antigravity planned skills: %s\n' "$provider_skills"
|
|
358
|
+
elif [[ "$provider_id" == claude ]]; then
|
|
359
|
+
if [[ "$provider_scope" == workspace ]]; then provider_skills="$workspace_root/.claude/skills"; else provider_skills="$claude_home/skills"; fi
|
|
360
|
+
printf 'Claude Code planned skills: %s\n' "$provider_skills"
|
|
361
|
+
fi
|
|
362
|
+
done
|
|
363
|
+
IFS=$old_ifs
|
|
364
|
+
if ! "$skip_graph_mcp" && ! "$skip_provider_configuration" && [[ ",$provider_list," == *,antigravity,* ]] && command -v node >/dev/null 2>&1; then
|
|
365
|
+
set +e
|
|
366
|
+
preflight_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 "$graph_root/current/lib/dist/bin/afyx-graph.js" 2>/dev/null)"; preflight_exit=$?
|
|
367
|
+
set -e
|
|
368
|
+
preflight_reason="$(printf '%s' "$preflight_json" | sed -n 's/.*"reason":"\([^"]*\)".*/\1/p')"
|
|
369
|
+
if ((preflight_exit != 0)) && [[ "$preflight_reason" != GRAPH_RUNTIME_UNAVAILABLE ]]; then
|
|
370
|
+
printf 'Antigravity provider plan is blocked before mutation: %s\n' "$preflight_json" >&2
|
|
371
|
+
exit 1
|
|
372
|
+
fi
|
|
373
|
+
fi
|
|
374
|
+
if ! "$skip_graph_mcp" && ! "$skip_provider_configuration" && [[ ",$provider_list," == *,claude,* ]] && command -v node >/dev/null 2>&1; then
|
|
375
|
+
set +e
|
|
376
|
+
claude_cmd="$(command -v claude || true)"
|
|
377
|
+
claude_pre_args=("$PACKAGE_ROOT/scripts/afyx-provider-integration.mjs" --providers claude --scope "$provider_scope" --workspace-root "$workspace_root" --node "$(command -v node)" --entry "$graph_root/current/lib/dist/bin/afyx-graph.js")
|
|
378
|
+
if [[ -n "$claude_cmd" ]]; then claude_pre_args+=(--claude "$claude_cmd"); elif "$claude_vscode_detected"; then claude_pre_args+=(--claude-extension); fi
|
|
379
|
+
[[ -n "$claude_config_dir" ]] && claude_pre_args+=(--claude-config-dir "$claude_config_dir")
|
|
380
|
+
preflight_json="$(node "${claude_pre_args[@]}" 2>/dev/null)"; preflight_exit=$?
|
|
381
|
+
set -e
|
|
382
|
+
preflight_reason="$(printf '%s' "$preflight_json" | sed -n 's/.*"reason":"\([^"]*\)".*/\1/p')"
|
|
383
|
+
if ((preflight_exit != 0)) && [[ "$preflight_reason" != GRAPH_RUNTIME_UNAVAILABLE ]]; then
|
|
384
|
+
printf 'Claude Code provider plan is blocked before mutation: %s\n' "$preflight_json" >&2
|
|
385
|
+
exit 1
|
|
386
|
+
fi
|
|
387
|
+
fi
|
|
388
|
+
|
|
389
|
+
codex_cli_detected=false; command -v codex >/dev/null 2>&1 && codex_cli_detected=true
|
|
390
|
+
antigravity_detected=false; { command -v agy >/dev/null 2>&1 || command -v antigravity >/dev/null 2>&1; } && antigravity_detected=true
|
|
391
|
+
claude_cli_detected=false; command -v claude >/dev/null 2>&1 && claude_cli_detected=true
|
|
392
|
+
claude_vscode_detected=false
|
|
393
|
+
for extension in "$HOME"/.vscode/extensions/anthropic.claude-code-*; do [[ -d "$extension" ]] && { claude_vscode_detected=true; break; }; done
|
|
394
|
+
vscode_extension_detected=false
|
|
395
|
+
for extension in "$HOME"/.vscode/extensions/openai.chatgpt-*; do [[ -d "$extension" ]] && { vscode_extension_detected=true; break; }; done
|
|
396
|
+
|
|
397
|
+
printf '\nPrerequisite Inventory\n'
|
|
398
|
+
printf '[REQUIRED] OS/architecture: %s / %s\n' "$(uname -s)" "$(uname -m)"
|
|
399
|
+
printf '[REQUIRED] Platform shell: Bash %s\n' "$BASH_VERSION"
|
|
400
|
+
if command -v git >/dev/null 2>&1; then printf '[REQUIRED] Git: %s\n' "$(git --version)"; else printf '[REQUIRED] Git: MISSING — install Git with the documented OS package manager\n'; fi
|
|
401
|
+
if "$codex_cli_detected" || "$vscode_extension_detected"; then printf '[REQUIRED] Codex host: detected\n'; else printf '[REQUIRED] Codex host: MISSING — install Codex CLI or the supported VS Code extension\n'; fi
|
|
402
|
+
if "$antigravity_detected"; then printf '[REQUIRED] Antigravity host: detected\n'; else printf '[REQUIRED] Antigravity host: not detected\n'; fi
|
|
403
|
+
if "$claude_cli_detected"; then printf '[REQUIRED] Claude Code host: detected (CLI)\n'; elif "$claude_vscode_detected"; then printf '[REQUIRED] Claude Code host: detected (VS Code extension)\n'; else printf '[REQUIRED] Claude Code host: not detected\n'; fi
|
|
404
|
+
if command -v node >/dev/null 2>&1; then printf '[COMPONENT_REQUIRED:Afyx Graph] Node.js >=22.5.0: %s\n' "$(node --version)"; else printf '[COMPONENT_REQUIRED:Afyx Graph] Node.js >=22.5.0: MISSING — install from https://nodejs.org/\n'; fi
|
|
405
|
+
if command -v npm >/dev/null 2>&1; then printf '[BUILD_ONLY:Afyx Graph] npm: %s\n' "$(npm --version)"; else printf '[BUILD_ONLY:Afyx Graph] npm: MISSING — needed only for automatic local fallback\n'; fi
|
|
406
|
+
printf '[COMPONENT_REQUIRED:Afyx Graph] Archive/checksum: tar + SHA-256 tool required\n'
|
|
407
|
+
if [ -e "$PACKAGE_ROOT/.git" ] && command -v git >/dev/null 2>&1 && git -C "$PACKAGE_ROOT" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
408
|
+
graph_channel="$(sed -n 's/^[[:space:]]*"releaseChannel"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$PACKAGE_ROOT/afyx-graph/engine/scripts/distribution-product.json" | head -n 1)"
|
|
409
|
+
printf 'Source: branch=%s; commit=%s; channel=%s\n' "$(git -C "$PACKAGE_ROOT" branch --show-current)" "$(git -C "$PACKAGE_ROOT" rev-parse HEAD)" "$graph_channel"
|
|
410
|
+
fi
|
|
411
|
+
|
|
412
|
+
if "$validate_only"; then
|
|
413
|
+
graph_version="$(sed -n 's/.*"product_version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$PACKAGE_ROOT/afyx-graph/afyx-graph.json")"
|
|
414
|
+
printf 'BundledEfficientCoding: true\nInstalledEfficientCoding: %s\nEfficientCodingState: %s\nEfficientCodingVersion: %s\n' "$([[ "$efficient_state" == HEALTHY ]] && echo true || echo false)" "$efficient_state" "$(component_version efficient-coding)"
|
|
415
|
+
printf 'BundledOdooEngineering: true\nInstalledOdooEngineering: %s\nOdooEngineeringState: %s\nOdooEngineeringVersion: %s\n' "$([[ "$odoo_state" == HEALTHY ]] && echo true || echo false)" "$odoo_state" "$(component_version odoo-engineering)"
|
|
416
|
+
printf 'BundledAfyxEngineeringExpert: true\nInstalledAfyxEngineeringExpert: %s\nAfyxEngineeringExpertState: %s\nAfyxEngineeringExpertVersion: %s\n' "$([[ "$expert_state" == HEALTHY ]] && echo true || echo false)" "$expert_state" "$(component_version afyx-engineering-expert)"
|
|
417
|
+
printf 'BundledAfyxGraphSource: true\nInstalledAfyxGraph: %s\nAfyxGraphState: %s\nAfyxGraphVersion: %s\n' "$([[ "$afyx_graph_state" == HEALTHY ]] && echo true || echo false)" "$afyx_graph_state" "$graph_version"
|
|
418
|
+
context_version="$(available_version afyx-context)"
|
|
419
|
+
printf 'BundledAfyxContextSource: true\nInstalledAfyxContext: %s\nAfyxContextState: %s\nAfyxContextVersion: %s\nAfyxContextRuntimeRoot: %s\n' "$([[ "$afyx_context_state" == HEALTHY ]] && echo true || echo false)" "$afyx_context_state" "$context_version" "$context_root"
|
|
420
|
+
forge_version="$(available_version afyx-forge)"
|
|
421
|
+
printf 'BundledAfyxForgeSource: true\nInstalledAfyxForge: %s\nAfyxForgeState: %s\nAfyxForgeVersion: %s\nAfyxForgeRuntimeRoot: %s\n' "$([[ "$afyx_forge_state" == HEALTHY ]] && echo true || echo false)" "$afyx_forge_state" "$forge_version" "$forge_root"
|
|
422
|
+
printf 'InstalledUsageTracker: false\nUsageTrackerState: NOT INSTALLED\nCodexCliDetected: %s\nVsCodeExtensionDetected: %s\n' "$codex_cli_detected" "$vscode_extension_detected"
|
|
423
|
+
exit 0
|
|
424
|
+
fi
|
|
425
|
+
|
|
426
|
+
if [[ -n "$preset" ]]; then
|
|
427
|
+
blocked_plan=
|
|
428
|
+
for plan_id in $(afyx_component_ids); do
|
|
429
|
+
plan_state="$(component_state "$plan_id")"
|
|
430
|
+
afyx_control_classify "$plan_id" "$plan_state" "$preset" "$custom_component_list" "$provider_list"
|
|
431
|
+
if [[ "$AFYX_DESIRED" == true && "$AFYX_REPAIR" == BLOCKED ]]; then
|
|
432
|
+
blocked_plan="${blocked_plan:+$blocked_plan, }$plan_id:$AFYX_DRIFT:$AFYX_ACTUAL_OWNERSHIP"
|
|
433
|
+
fi
|
|
434
|
+
done
|
|
435
|
+
[[ -z "$blocked_plan" ]] || { printf 'Desired-state plan is blocked before mutation: %s\n' "$blocked_plan" >&2; exit 1; }
|
|
436
|
+
fi
|
|
437
|
+
|
|
438
|
+
if ! "$skip_provider_configuration" && [[ ",$provider_list," == *,codex,* ]] && ! "$codex_cli_detected" && ! "$vscode_extension_detected"; then printf 'Selected Codex provider host was not detected.\n' >&2; exit 1; fi
|
|
439
|
+
if ! "$skip_provider_configuration" && [[ ",$provider_list," == *,antigravity,* ]] && ! "$antigravity_detected"; then printf 'Selected Antigravity provider host was not detected.\n' >&2; exit 1; fi
|
|
440
|
+
if ! "$skip_provider_configuration" && [[ ",$provider_list," == *,claude,* ]] && ! "$claude_cli_detected" && ! "$claude_vscode_detected"; then printf 'Selected Claude Code provider host was not detected.\n' >&2; exit 1; fi
|
|
441
|
+
command -v git >/dev/null 2>&1 || { printf 'Git is required for Afyx source validation and lifecycle updates.\n' >&2; exit 1; }
|
|
442
|
+
efficient_action="$(component_action efficient-coding 'Efficient Coding' "$efficient_state" "$(component_version efficient-coding)")"
|
|
443
|
+
odoo_action="$(component_action odoo-engineering 'Odoo Engineering' "$odoo_state" "$(component_version odoo-engineering)")"
|
|
444
|
+
expert_action="$(component_action afyx-engineering-expert 'Afyx Engineering Expert' "$expert_state" "$(component_version afyx-engineering-expert)")"
|
|
445
|
+
for additional_root in ${additional_skill_roots[@]+"${additional_skill_roots[@]}"}; do
|
|
446
|
+
for skill_spec in "efficient-coding|$efficient_action" "odoo-engineering|$odoo_action" "afyx-engineering-expert|$expert_action"; do
|
|
447
|
+
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
|
|
449
|
+
[[ "$skill_action" != skip && "$skill_action" != adopt ]] || continue
|
|
450
|
+
target="$additional_root/$skill_id"
|
|
451
|
+
afyx_classify_skill "$target" "$skill_id" afyx
|
|
452
|
+
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
|
+
done
|
|
454
|
+
done
|
|
455
|
+
run mkdir -p "$skills_root"
|
|
456
|
+
efficient_result=skipped
|
|
457
|
+
odoo_result=skipped
|
|
458
|
+
expert_result=skipped
|
|
459
|
+
if [[ "$efficient_action" == adopt ]]; then efficient_result="$(adopt_legacy_skill efficient-coding 'Efficient Coding' "$efficient_target")"
|
|
460
|
+
elif [[ "$efficient_action" != skip ]]; then efficient_result="$(safe_skill_install efficient-coding 'Efficient Coding' "$BUNDLED_EFFICIENT" "$efficient_target" "$([[ "$efficient_action" == install ]] && printf false || printf true)")"; fi
|
|
461
|
+
if [[ "$odoo_action" == adopt ]]; then odoo_result="$(adopt_legacy_skill odoo-engineering 'Odoo Engineering' "$odoo_target")"
|
|
462
|
+
elif [[ "$odoo_action" != skip ]]; then odoo_result="$(safe_skill_install odoo-engineering 'Odoo Engineering' "$BUNDLED_ODOO" "$odoo_target" "$([[ "$odoo_action" == install ]] && printf false || printf true)")"; fi
|
|
463
|
+
if [[ "$expert_action" == adopt ]]; then
|
|
464
|
+
printf 'Afyx Engineering Expert has no trusted legacy provenance and cannot be adopted.\n' >&2
|
|
465
|
+
exit 1
|
|
466
|
+
elif [[ "$expert_action" != skip ]]; then expert_result="$(safe_skill_install afyx-engineering-expert 'Afyx Engineering Expert' "$BUNDLED_EXPERT" "$expert_target" "$([[ "$expert_action" == install ]] && printf false || printf true)")"; fi
|
|
467
|
+
|
|
468
|
+
replicate_provider_skill() {
|
|
469
|
+
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
|
|
471
|
+
[[ "$action" != skip && "$action" != adopt ]] || return 0
|
|
472
|
+
for root in ${additional_skill_roots[@]+"${additional_skill_roots[@]}"}; do
|
|
473
|
+
target="$root/$id"
|
|
474
|
+
afyx_classify_skill "$target" "$id" afyx
|
|
475
|
+
case "$AFYX_OWNERSHIP_STATE" in
|
|
476
|
+
NOT_INSTALLED) replace=false ;;
|
|
477
|
+
AFYX_OWNED_UNMODIFIED)
|
|
478
|
+
if [[ "$(afyx_skill_version "$target")" == "$(afyx_skill_version "$source")" ]]; then printf '%s [%s]: skipped\n' "$label" "$root"; continue; fi
|
|
479
|
+
replace=true
|
|
480
|
+
;;
|
|
481
|
+
AFYX_OWNED_MODIFIED) replace=true ;;
|
|
482
|
+
*) printf 'Refusing to replace %s at provider skill root %s because ownership is %s.\n' "$label" "$root" "$AFYX_OWNERSHIP_STATE" >&2; exit 1 ;;
|
|
483
|
+
esac
|
|
484
|
+
result="$(safe_skill_install "$id" "$label" "$source" "$target" "$replace")"
|
|
485
|
+
printf '%s [%s]: %s\n' "$label" "$root" "$result"
|
|
486
|
+
done
|
|
487
|
+
}
|
|
488
|
+
replicate_provider_skill efficient-coding 'Efficient Coding' "$BUNDLED_EFFICIENT" "$efficient_action"
|
|
489
|
+
replicate_provider_skill odoo-engineering 'Odoo Engineering' "$BUNDLED_ODOO" "$odoo_action"
|
|
490
|
+
replicate_provider_skill afyx-engineering-expert 'Afyx Engineering Expert' "$BUNDLED_EXPERT" "$expert_action"
|
|
491
|
+
|
|
492
|
+
graph_result=skipped
|
|
493
|
+
graph_action="$(component_action afyx-graph 'Afyx Graph' "$afyx_graph_state" "$(component_version afyx-graph)")"
|
|
494
|
+
if [[ "$graph_action" != skip ]]; then
|
|
495
|
+
graph_args=()
|
|
496
|
+
[[ "$graph_action" == update ]] && graph_args+=(--update)
|
|
497
|
+
[[ "$graph_action" == repair ]] && graph_args+=(--replace)
|
|
498
|
+
"$offline" && graph_args+=(--offline)
|
|
499
|
+
"$no_build_fallback" && graph_args+=(--no-build-fallback)
|
|
500
|
+
"$allow_dirty_source" && graph_args+=(--allow-dirty-source)
|
|
501
|
+
if "$skip_graph_mcp" || "$skip_provider_configuration" || [[ ",$provider_list," != *,codex,* ]]; then graph_args+=(--skip-mcp); else graph_args+=(--configure-mcp); fi
|
|
502
|
+
"$dry_run" && graph_args+=(--validate-only)
|
|
503
|
+
bash "$PACKAGE_ROOT/scripts/install-afyx-graph.sh" "${graph_args[@]}"
|
|
504
|
+
graph_result="$graph_action"
|
|
505
|
+
fi
|
|
506
|
+
|
|
507
|
+
if ! "$skip_graph_mcp" && ! "$skip_provider_configuration" && [[ ",$provider_list," == *,antigravity,* ]]; then
|
|
508
|
+
node_cmd="$(command -v node || command -v node.exe || true)"
|
|
509
|
+
if "$dry_run"; then printf 'Dry-run: would configure Antigravity MCP at %s scope.\n' "$provider_scope"
|
|
510
|
+
elif [[ -z "$node_cmd" ]]; then printf 'Node.js is required for Antigravity provider configuration.\n' >&2; exit 1
|
|
511
|
+
elif [[ -f "$graph_root/current/lib/dist/bin/afyx-graph.js" ]]; then
|
|
512
|
+
provider_args=("$PACKAGE_ROOT/scripts/afyx-provider-integration.mjs" --providers antigravity --scope "$provider_scope" --workspace-root "$workspace_root" --gemini-home "$gemini_home" --node "$node_cmd" --entry "$graph_root/current/lib/dist/bin/afyx-graph.js")
|
|
513
|
+
provider_json="$("$node_cmd" "${provider_args[@]}" --apply)" || { printf 'Antigravity provider configuration failed: %s\n' "$provider_json" >&2; exit 1; }
|
|
514
|
+
printf 'Antigravity provider: %s\n' "$(printf '%s' "$provider_json" | sed -n 's/.*"status":"\([^"]*\)".*/\1/p')"
|
|
515
|
+
elif [[ "$graph_action" != skip ]]; then printf 'Installed Graph entry is unavailable for Antigravity configuration.\n' >&2; exit 1
|
|
516
|
+
fi
|
|
517
|
+
fi
|
|
518
|
+
|
|
519
|
+
if ! "$skip_graph_mcp" && ! "$skip_provider_configuration" && [[ ",$provider_list," == *,claude,* ]]; then
|
|
520
|
+
node_cmd="$(command -v node || command -v node.exe || true)"
|
|
521
|
+
if "$dry_run"; then printf 'Dry-run: would configure Claude Code MCP at %s scope.\n' "$provider_scope"
|
|
522
|
+
elif [[ -z "$node_cmd" ]]; then printf 'Node.js is required for Claude Code provider configuration.\n' >&2; exit 1
|
|
523
|
+
elif [[ -f "$graph_root/current/lib/dist/bin/afyx-graph.js" ]]; then
|
|
524
|
+
claude_cmd="$(command -v claude || true)"
|
|
525
|
+
claude_args=("$PACKAGE_ROOT/scripts/afyx-provider-integration.mjs" --providers claude --scope "$provider_scope" --workspace-root "$workspace_root" --node "$node_cmd" --entry "$graph_root/current/lib/dist/bin/afyx-graph.js")
|
|
526
|
+
if [[ -n "$claude_cmd" ]]; then claude_args+=(--claude "$claude_cmd"); elif "$claude_vscode_detected"; then claude_args+=(--claude-extension); fi
|
|
527
|
+
[[ -n "$claude_config_dir" ]] && claude_args+=(--claude-config-dir "$claude_config_dir")
|
|
528
|
+
provider_json="$("$node_cmd" "${claude_args[@]}" --apply)" || { printf 'Claude Code provider configuration failed: %s\n' "$provider_json" >&2; exit 1; }
|
|
529
|
+
printf 'Claude Code provider: %s\n' "$(printf '%s' "$provider_json" | sed -n 's/.*"status":"\([^"]*\)".*/\1/p')"
|
|
530
|
+
elif [[ "$graph_action" != skip ]]; then printf 'Installed Graph entry is unavailable for Claude Code configuration.\n' >&2; exit 1
|
|
531
|
+
fi
|
|
532
|
+
fi
|
|
533
|
+
|
|
534
|
+
context_result=skipped
|
|
535
|
+
context_action="$(component_action afyx-context 'Afyx Context Engine' "$afyx_context_state" "$(component_version afyx-context)")"
|
|
536
|
+
if [[ "$context_action" != skip ]]; then
|
|
537
|
+
context_args=(--runtime-root "$context_root")
|
|
538
|
+
[[ "$context_action" == update ]] && context_args+=(--update)
|
|
539
|
+
[[ "$context_action" == repair ]] && context_args+=(--repair)
|
|
540
|
+
"$dry_run" && context_args+=(--validate-only)
|
|
541
|
+
bash "$PACKAGE_ROOT/scripts/install-afyx-context.sh" "${context_args[@]}"
|
|
542
|
+
context_result="$context_action"
|
|
543
|
+
fi
|
|
544
|
+
|
|
545
|
+
# Provider companion: visible on installed supported skill surfaces and invoked
|
|
546
|
+
# only when Context optimization is useful. This does not intercept Graph MCP.
|
|
547
|
+
context_companion_desired=false
|
|
548
|
+
if [[ "$skip_provider_configuration" == false && "${AFYX_CONTEXT_OPT_IN:-}" != 0 ]]; then
|
|
549
|
+
if [[ -n "$preset" ]]; then
|
|
550
|
+
afyx_component_desired afyx-context "$preset" "$custom_component_list" "$provider_list" && context_companion_desired=true
|
|
551
|
+
elif [[ "$context_action" != skip ]]; then context_companion_desired=true; fi
|
|
552
|
+
fi
|
|
553
|
+
if "$context_companion_desired" && { [[ "$context_action" != skip ]] || [[ "$afyx_context_state" == HEALTHY ]]; }; then
|
|
554
|
+
context_skill_source="$PACKAGE_ROOT/skills/afyx-context"
|
|
555
|
+
valid_manifest "$context_skill_source" || { printf 'Invalid Afyx Context provider companion.\n' >&2; exit 1; }
|
|
556
|
+
for context_skill_root in "$skills_root" ${additional_skill_roots[@]+"${additional_skill_roots[@]}"}; do
|
|
557
|
+
context_skill_target="$context_skill_root/afyx-context"
|
|
558
|
+
afyx_classify_skill "$context_skill_target" afyx-context afyx
|
|
559
|
+
case "$AFYX_OWNERSHIP_STATE" in
|
|
560
|
+
NOT_INSTALLED) context_skill_replace=false ;;
|
|
561
|
+
AFYX_OWNED_UNMODIFIED)
|
|
562
|
+
if [[ "$(afyx_skill_version "$context_skill_target")" == "$(afyx_skill_version "$context_skill_source")" ]]; then
|
|
563
|
+
printf 'Afyx Context Companion [%s]: skipped\n' "$context_skill_root"
|
|
564
|
+
continue
|
|
565
|
+
fi
|
|
566
|
+
context_skill_replace=true
|
|
567
|
+
;;
|
|
568
|
+
*) printf 'Refusing automatic ACE companion replacement at %s because ownership is %s.\n' "$context_skill_target" "$AFYX_OWNERSHIP_STATE" >&2; exit 1 ;;
|
|
569
|
+
esac
|
|
570
|
+
# safe_skill_install uses skills_root for its ownership boundary; override
|
|
571
|
+
# it only in the subshell for the currently selected provider root.
|
|
572
|
+
context_skill_result="$(skills_root="$context_skill_root"; safe_skill_install afyx-context 'Afyx Context Companion' "$context_skill_source" "$context_skill_target" "$context_skill_replace")"
|
|
573
|
+
printf 'Afyx Context Companion [%s]: %s\n' "$context_skill_root" "$context_skill_result"
|
|
574
|
+
done
|
|
575
|
+
fi
|
|
576
|
+
|
|
577
|
+
forge_result=skipped
|
|
578
|
+
forge_action="$(component_action afyx-forge 'Afyx Forge Core' "$afyx_forge_state" "$(component_version afyx-forge)")"
|
|
579
|
+
if [[ "$forge_action" != skip ]]; then
|
|
580
|
+
forge_args=(--runtime-root "$forge_root")
|
|
581
|
+
[[ "$forge_action" == update ]] && forge_args+=(--update)
|
|
582
|
+
[[ "$forge_action" == repair ]] && forge_args+=(--repair)
|
|
583
|
+
"$dry_run" && forge_args+=(--validate-only)
|
|
584
|
+
bash "$PACKAGE_ROOT/scripts/install-afyx-forge.sh" "${forge_args[@]}"
|
|
585
|
+
forge_result="$forge_action"
|
|
586
|
+
fi
|
|
587
|
+
|
|
588
|
+
forge_companion_desired=false
|
|
589
|
+
if [[ "$skip_provider_configuration" == false ]]; then
|
|
590
|
+
if [[ -n "$preset" ]]; then
|
|
591
|
+
afyx_component_desired afyx-forge "$preset" "$custom_component_list" "$provider_list" && forge_companion_desired=true
|
|
592
|
+
elif [[ "$forge_action" != skip ]]; then forge_companion_desired=true; fi
|
|
593
|
+
fi
|
|
594
|
+
if "$forge_companion_desired" && { [[ "$forge_action" != skip ]] || [[ "$afyx_forge_state" == HEALTHY ]]; }; then
|
|
595
|
+
forge_skill_source="$PACKAGE_ROOT/skills/afyx-forge"
|
|
596
|
+
valid_manifest "$forge_skill_source" || { printf 'Invalid Afyx Forge provider companion.\n' >&2; exit 1; }
|
|
597
|
+
for forge_skill_root in "$skills_root" ${additional_skill_roots[@]+"${additional_skill_roots[@]}"}; do
|
|
598
|
+
forge_skill_target="$forge_skill_root/afyx-forge"
|
|
599
|
+
afyx_classify_skill "$forge_skill_target" afyx-forge afyx
|
|
600
|
+
case "$AFYX_OWNERSHIP_STATE" in
|
|
601
|
+
NOT_INSTALLED) forge_skill_replace=false ;;
|
|
602
|
+
AFYX_OWNED_UNMODIFIED)
|
|
603
|
+
if [[ "$(afyx_skill_version "$forge_skill_target")" == "$(afyx_skill_version "$forge_skill_source")" ]]; then
|
|
604
|
+
printf 'Afyx Forge Companion [%s]: skipped\n' "$forge_skill_root"
|
|
605
|
+
continue
|
|
606
|
+
fi
|
|
607
|
+
forge_skill_replace=true
|
|
608
|
+
;;
|
|
609
|
+
*) printf 'Refusing automatic Forge companion replacement at %s because ownership is %s.\n' "$forge_skill_target" "$AFYX_OWNERSHIP_STATE" >&2; exit 1 ;;
|
|
610
|
+
esac
|
|
611
|
+
forge_skill_result="$(skills_root="$forge_skill_root"; safe_skill_install afyx-forge 'Afyx Forge Companion' "$forge_skill_source" "$forge_skill_target" "$forge_skill_replace")"
|
|
612
|
+
printf 'Afyx Forge Companion [%s]: %s\n' "$forge_skill_root" "$forge_skill_result"
|
|
613
|
+
done
|
|
614
|
+
fi
|
|
615
|
+
|
|
616
|
+
printf '\nInstallation Summary\n[%s] Efficient Coding\n[%s] Odoo Engineering\n[%s] Afyx Engineering Expert\n[%s] Afyx Graph\n[%s] Afyx Context Engine\n[%s] Afyx Forge Core\n[SKIPPED] Usage Tracking (Windows-only)\n' "$efficient_result" "$odoo_result" "$expert_result" "$graph_result" "$context_result" "$forge_result"
|
|
617
|
+
"$dry_run" && printf 'Dry-run completed; no files or configuration were changed.\n' || printf 'Start a new Codex session to load installed components.\n'
|