@jetrabbits/agentic 0.0.1
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/AGENTS.md +143 -0
- package/README.md +154 -0
- package/agentic +1615 -0
- package/areas/devops/ci-cd/AGENTS.md +48 -0
- package/areas/devops/ci-cd/PROMPTS.md +7 -0
- package/areas/devops/ci-cd/prompts/onboard-repo.md +97 -0
- package/areas/devops/ci-cd/prompts/pipeline-debug.md +103 -0
- package/areas/devops/ci-cd/prompts/release-pipeline.md +115 -0
- package/areas/devops/ci-cd/rules/pipeline-standards.md +33 -0
- package/areas/devops/ci-cd/rules/quality-gates.md +24 -0
- package/areas/devops/ci-cd/rules/supply-chain-security.md +34 -0
- package/areas/devops/ci-cd/skills/artifact-management/SKILL.md +157 -0
- package/areas/devops/ci-cd/skills/build-optimization/SKILL.md +168 -0
- package/areas/devops/ci-cd/skills/github-actions-patterns/SKILL.md +190 -0
- package/areas/devops/ci-cd/skills/gitlab-ci-patterns/SKILL.md +169 -0
- package/areas/devops/ci-cd/skills/pipeline-security/SKILL.md +161 -0
- package/areas/devops/ci-cd/workflows/onboard-repo.md +73 -0
- package/areas/devops/ci-cd/workflows/pipeline-debug.md +66 -0
- package/areas/devops/ci-cd/workflows/release-pipeline.md +115 -0
- package/areas/devops/database-ops/AGENTS.md +47 -0
- package/areas/devops/database-ops/prompts/backup-verify.md +83 -0
- package/areas/devops/database-ops/prompts/db-incident.md +127 -0
- package/areas/devops/database-ops/rules/access-control.md +20 -0
- package/areas/devops/database-ops/rules/backup-policy.md +33 -0
- package/areas/devops/database-ops/rules/migration-runbook.md +32 -0
- package/areas/devops/database-ops/skills/backup-restore/SKILL.md +226 -0
- package/areas/devops/database-ops/skills/db-performance/SKILL.md +205 -0
- package/areas/devops/database-ops/skills/migration-safety/SKILL.md +155 -0
- package/areas/devops/database-ops/skills/postgres-operations/SKILL.md +156 -0
- package/areas/devops/database-ops/skills/redis-operations/SKILL.md +174 -0
- package/areas/devops/database-ops/workflows/backup-verify.md +107 -0
- package/areas/devops/database-ops/workflows/db-incident.md +86 -0
- package/areas/devops/devsecops/AGENTS.md +47 -0
- package/areas/devops/devsecops/prompts/policy-onboard.md +79 -0
- package/areas/devops/devsecops/prompts/security-scan-pipeline.md +131 -0
- package/areas/devops/devsecops/rules/container-security.md +22 -0
- package/areas/devops/devsecops/rules/policy-as-code.md +37 -0
- package/areas/devops/devsecops/rules/shift-left-policy.md +26 -0
- package/areas/devops/devsecops/skills/container-hardening/SKILL.md +146 -0
- package/areas/devops/devsecops/skills/opa-policies/SKILL.md +188 -0
- package/areas/devops/devsecops/skills/sbom-supply-chain/SKILL.md +165 -0
- package/areas/devops/devsecops/skills/secret-detection/SKILL.md +190 -0
- package/areas/devops/devsecops/skills/sigstore-signing/SKILL.md +184 -0
- package/areas/devops/devsecops/workflows/policy-onboard.md +104 -0
- package/areas/devops/devsecops/workflows/security-scan-pipeline.md +155 -0
- package/areas/devops/infrastructure/AGENTS.md +50 -0
- package/areas/devops/infrastructure/prompts/destroy-environment.md +81 -0
- package/areas/devops/infrastructure/prompts/drift-remediation.md +71 -0
- package/areas/devops/infrastructure/prompts/module-development.md +69 -0
- package/areas/devops/infrastructure/prompts/provision-environment.md +121 -0
- package/areas/devops/infrastructure/rules/iac-standards.md +80 -0
- package/areas/devops/infrastructure/rules/immutability.md +28 -0
- package/areas/devops/infrastructure/rules/secret-hygiene.md +53 -0
- package/areas/devops/infrastructure/rules/state-management.md +47 -0
- package/areas/devops/infrastructure/skills/ansible-playbooks/SKILL.md +174 -0
- package/areas/devops/infrastructure/skills/cost-optimization/SKILL.md +177 -0
- package/areas/devops/infrastructure/skills/drift-detection/SKILL.md +178 -0
- package/areas/devops/infrastructure/skills/state-management/SKILL.md +159 -0
- package/areas/devops/infrastructure/skills/terraform-modules/SKILL.md +169 -0
- package/areas/devops/infrastructure/workflows/destroy-environment.md +96 -0
- package/areas/devops/infrastructure/workflows/drift-remediation.md +66 -0
- package/areas/devops/infrastructure/workflows/module-development.md +101 -0
- package/areas/devops/infrastructure/workflows/provision-environment.md +96 -0
- package/areas/devops/kubernetes/AGENTS.md +57 -0
- package/areas/devops/kubernetes/PROMPTS.md +9 -0
- package/areas/devops/kubernetes/prompts/cluster-bootstrap.md +67 -0
- package/areas/devops/kubernetes/prompts/debug-workload.md +91 -0
- package/areas/devops/kubernetes/prompts/onboard-service.md +101 -0
- package/areas/devops/kubernetes/prompts/upgrade-cluster.md +63 -0
- package/areas/devops/kubernetes/rules/cluster-standards.md +51 -0
- package/areas/devops/kubernetes/rules/resource-governance.md +80 -0
- package/areas/devops/kubernetes/rules/upgrade-policy.md +52 -0
- package/areas/devops/kubernetes/rules/workload-security.md +64 -0
- package/areas/devops/kubernetes/skills/cluster-operations/SKILL.md +136 -0
- package/areas/devops/kubernetes/skills/helm-charts/SKILL.md +152 -0
- package/areas/devops/kubernetes/skills/network-policies/SKILL.md +169 -0
- package/areas/devops/kubernetes/skills/pod-troubleshooting/SKILL.md +129 -0
- package/areas/devops/kubernetes/skills/rbac-design/SKILL.md +148 -0
- package/areas/devops/kubernetes/skills/resource-tuning/SKILL.md +156 -0
- package/areas/devops/kubernetes/workflows/cluster-bootstrap.md +194 -0
- package/areas/devops/kubernetes/workflows/debug-workload.md +108 -0
- package/areas/devops/kubernetes/workflows/onboard-service.md +124 -0
- package/areas/devops/kubernetes/workflows/upgrade-cluster.md +165 -0
- package/areas/devops/networking/AGENTS.md +47 -0
- package/areas/devops/networking/prompts/onboard-ingress.md +119 -0
- package/areas/devops/networking/prompts/service-mesh-onboard.md +77 -0
- package/areas/devops/networking/rules/ingress-standards.md +17 -0
- package/areas/devops/networking/rules/network-segmentation.md +24 -0
- package/areas/devops/networking/rules/tls-policy.md +32 -0
- package/areas/devops/networking/skills/dns-management/SKILL.md +169 -0
- package/areas/devops/networking/skills/ingress-patterns/SKILL.md +165 -0
- package/areas/devops/networking/skills/service-mesh/SKILL.md +206 -0
- package/areas/devops/networking/skills/tls-termination/SKILL.md +198 -0
- package/areas/devops/networking/skills/vpc-design/SKILL.md +132 -0
- package/areas/devops/networking/workflows/onboard-ingress.md +64 -0
- package/areas/devops/networking/workflows/service-mesh-onboard.md +122 -0
- package/areas/devops/observability/AGENTS.md +48 -0
- package/areas/devops/observability/prompts/alert-investigation.md +117 -0
- package/areas/devops/observability/prompts/observability-stack-setup.md +99 -0
- package/areas/devops/observability/prompts/onboard-service-monitoring.md +79 -0
- package/areas/devops/observability/rules/alerting-standards.md +36 -0
- package/areas/devops/observability/rules/data-retention.md +19 -0
- package/areas/devops/observability/rules/golden-signals.md +28 -0
- package/areas/devops/observability/skills/distributed-tracing/SKILL.md +149 -0
- package/areas/devops/observability/skills/grafana-dashboards/SKILL.md +201 -0
- package/areas/devops/observability/skills/log-aggregation/SKILL.md +159 -0
- package/areas/devops/observability/skills/prometheus-alertmanager/SKILL.md +188 -0
- package/areas/devops/observability/skills/slo-implementation/SKILL.md +189 -0
- package/areas/devops/observability/workflows/alert-investigation.md +98 -0
- package/areas/devops/observability/workflows/observability-stack-setup.md +156 -0
- package/areas/devops/observability/workflows/onboard-service-monitoring.md +83 -0
- package/areas/devops/sre/AGENTS.md +48 -0
- package/areas/devops/sre/prompts/incident-response.md +129 -0
- package/areas/devops/sre/prompts/postmortem.md +101 -0
- package/areas/devops/sre/prompts/slo-review.md +125 -0
- package/areas/devops/sre/rules/error-budget-policy.md +25 -0
- package/areas/devops/sre/rules/on-call-standards.md +25 -0
- package/areas/devops/sre/rules/slo-policy.md +31 -0
- package/areas/devops/sre/skills/capacity-planning/SKILL.md +162 -0
- package/areas/devops/sre/skills/chaos-engineering/SKILL.md +186 -0
- package/areas/devops/sre/skills/incident-command/SKILL.md +119 -0
- package/areas/devops/sre/skills/postmortem-analysis/SKILL.md +104 -0
- package/areas/devops/sre/skills/slo-sli-design/SKILL.md +145 -0
- package/areas/devops/sre/workflows/incident-response.md +66 -0
- package/areas/devops/sre/workflows/postmortem.md +90 -0
- package/areas/devops/sre/workflows/slo-review.md +95 -0
- package/areas/software/backend/AGENTS.md +59 -0
- package/areas/software/backend/PROMPTS.md +50 -0
- package/areas/software/backend/README.md +48 -0
- package/areas/software/backend/prompts/add-migration.md +93 -0
- package/areas/software/backend/prompts/create-endpoint.md +97 -0
- package/areas/software/backend/prompts/debug-issue.md +87 -0
- package/areas/software/backend/prompts/develop-epic.md +83 -0
- package/areas/software/backend/prompts/develop-feature.md +91 -0
- package/areas/software/backend/prompts/refactor-module.md +79 -0
- package/areas/software/backend/prompts/test-feature.md +89 -0
- package/areas/software/backend/rules/architecture.md +20 -0
- package/areas/software/backend/rules/data_access.md +20 -0
- package/areas/software/backend/rules/security.md +20 -0
- package/areas/software/backend/rules/testing.md +19 -0
- package/areas/software/backend/skills/api-design/SKILL.md +170 -0
- package/areas/software/backend/skills/async-processing/SKILL.md +152 -0
- package/areas/software/backend/skills/database-modeling/SKILL.md +173 -0
- package/areas/software/backend/skills/observability/SKILL.md +162 -0
- package/areas/software/backend/skills/troubleshooting/SKILL.md +139 -0
- package/areas/software/backend/workflows/add-migration.md +79 -0
- package/areas/software/backend/workflows/create-endpoint.md +89 -0
- package/areas/software/backend/workflows/debug-issue.md +77 -0
- package/areas/software/backend/workflows/develop-epic.md +78 -0
- package/areas/software/backend/workflows/develop-feature.md +98 -0
- package/areas/software/backend/workflows/refactor-module.md +73 -0
- package/areas/software/backend/workflows/test-feature.md +67 -0
- package/areas/software/data-engineering/AGENTS.md +59 -0
- package/areas/software/data-engineering/PROMPTS.md +32 -0
- package/areas/software/data-engineering/prompts/backfill-data.md +107 -0
- package/areas/software/data-engineering/prompts/data-quality-incident.md +109 -0
- package/areas/software/data-engineering/prompts/lineage-trace.md +121 -0
- package/areas/software/data-engineering/prompts/new-model.md +117 -0
- package/areas/software/data-engineering/prompts/schema-migration.md +111 -0
- package/areas/software/data-engineering/rules/data-governance.md +11 -0
- package/areas/software/data-engineering/rules/pii-handling.md +19 -0
- package/areas/software/data-engineering/rules/pipeline-integrity.md +11 -0
- package/areas/software/data-engineering/rules/schema-management.md +21 -0
- package/areas/software/data-engineering/skills/data-modeling/SKILL.md +49 -0
- package/areas/software/data-engineering/skills/dbt-patterns/SKILL.md +43 -0
- package/areas/software/data-engineering/skills/lineage-governance/SKILL.md +38 -0
- package/areas/software/data-engineering/skills/orchestration/SKILL.md +35 -0
- package/areas/software/data-engineering/skills/quality-checks/SKILL.md +50 -0
- package/areas/software/data-engineering/skills/sql-optimization/SKILL.md +47 -0
- package/areas/software/data-engineering/skills/streaming-patterns/SKILL.md +48 -0
- package/areas/software/data-engineering/workflows/backfill-data.md +59 -0
- package/areas/software/data-engineering/workflows/data-quality-incident.md +64 -0
- package/areas/software/data-engineering/workflows/lineage-trace.md +56 -0
- package/areas/software/data-engineering/workflows/new-model.md +71 -0
- package/areas/software/data-engineering/workflows/schema-migration.md +67 -0
- package/areas/software/frontend/AGENTS.md +60 -0
- package/areas/software/frontend/PROMPTS.md +32 -0
- package/areas/software/frontend/prompts/a11y-fix.md +75 -0
- package/areas/software/frontend/prompts/bundle-analyze.md +75 -0
- package/areas/software/frontend/prompts/release-prep.md +83 -0
- package/areas/software/frontend/prompts/scaffold-component.md +69 -0
- package/areas/software/frontend/prompts/visual-regression.md +73 -0
- package/areas/software/frontend/rules/accessibility.md +16 -0
- package/areas/software/frontend/rules/architecture.md +29 -0
- package/areas/software/frontend/rules/performance.md +23 -0
- package/areas/software/frontend/rules/quality.md +12 -0
- package/areas/software/frontend/skills/a11y-audit/SKILL.md +61 -0
- package/areas/software/frontend/skills/api-integration/SKILL.md +58 -0
- package/areas/software/frontend/skills/component-design/SKILL.md +171 -0
- package/areas/software/frontend/skills/css-architecture/SKILL.md +146 -0
- package/areas/software/frontend/skills/error-handling/SKILL.md +55 -0
- package/areas/software/frontend/skills/performance-tuning/SKILL.md +58 -0
- package/areas/software/frontend/skills/state-management/SKILL.md +54 -0
- package/areas/software/frontend/skills/testing-patterns/SKILL.md +69 -0
- package/areas/software/frontend/workflows/a11y-fix.md +63 -0
- package/areas/software/frontend/workflows/bundle-analyze.md +56 -0
- package/areas/software/frontend/workflows/release-prep.md +66 -0
- package/areas/software/frontend/workflows/scaffold-component.md +67 -0
- package/areas/software/frontend/workflows/visual-regression.md +65 -0
- package/areas/software/full-stack/AGENTS.md +72 -0
- package/areas/software/full-stack/PROMPTS.md +66 -0
- package/areas/software/full-stack/prompts/backend-project-full-cycle.md +141 -0
- package/areas/software/full-stack/prompts/debug-issue.md +115 -0
- package/areas/software/full-stack/prompts/develop-feature.md +119 -0
- package/areas/software/full-stack/prompts/feature-implementation-flow.md +137 -0
- package/areas/software/full-stack/prompts/testing-ci-pipeline.md +119 -0
- package/areas/software/full-stack/rules/api-design-guide.md +24 -0
- package/areas/software/full-stack/rules/async-concurrency-guide.md +21 -0
- package/areas/software/full-stack/rules/backend-architecture-rule.md +41 -0
- package/areas/software/full-stack/rules/background-jobs-guide.md +20 -0
- package/areas/software/full-stack/rules/code-quality-guide.md +22 -0
- package/areas/software/full-stack/rules/database-access-guide.md +24 -0
- package/areas/software/full-stack/rules/database-migrations-guide.md +24 -0
- package/areas/software/full-stack/rules/domain-models-guide.md +28 -0
- package/areas/software/full-stack/rules/e2e-test-guide.md +18 -0
- package/areas/software/full-stack/rules/env-settings-guide.md +34 -0
- package/areas/software/full-stack/rules/error-handling-guide.md +20 -0
- package/areas/software/full-stack/rules/logging-observability-guide.md +22 -0
- package/areas/software/full-stack/rules/project-guide.md +34 -0
- package/areas/software/full-stack/rules/python-venv-guide.md +23 -0
- package/areas/software/full-stack/rules/security-guide.md +22 -0
- package/areas/software/full-stack/rules/svt-test-guide.md +17 -0
- package/areas/software/full-stack/rules/testing-ci-guide.md +25 -0
- package/areas/software/full-stack/skills/api-design-principles/SKILL.md +125 -0
- package/areas/software/full-stack/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/areas/software/full-stack/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/areas/software/full-stack/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/areas/software/full-stack/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/areas/software/full-stack/skills/api-design-principles/resources/implementation-playbook.md +513 -0
- package/areas/software/full-stack/skills/api-patterns/SKILL.md +81 -0
- package/areas/software/full-stack/skills/api-patterns/api-style.md +42 -0
- package/areas/software/full-stack/skills/api-patterns/auth.md +24 -0
- package/areas/software/full-stack/skills/api-patterns/documentation.md +26 -0
- package/areas/software/full-stack/skills/api-patterns/graphql.md +41 -0
- package/areas/software/full-stack/skills/api-patterns/rate-limiting.md +31 -0
- package/areas/software/full-stack/skills/api-patterns/response.md +37 -0
- package/areas/software/full-stack/skills/api-patterns/rest.md +40 -0
- package/areas/software/full-stack/skills/api-patterns/scripts/api_validator.py +211 -0
- package/areas/software/full-stack/skills/api-patterns/security-testing.md +122 -0
- package/areas/software/full-stack/skills/api-patterns/trpc.md +41 -0
- package/areas/software/full-stack/skills/api-patterns/versioning.md +22 -0
- package/areas/software/full-stack/skills/app-builder/SKILL.md +135 -0
- package/areas/software/full-stack/skills/app-builder/agent-coordination.md +71 -0
- package/areas/software/full-stack/skills/app-builder/feature-building.md +53 -0
- package/areas/software/full-stack/skills/app-builder/project-detection.md +34 -0
- package/areas/software/full-stack/skills/app-builder/scaffolding.md +118 -0
- package/areas/software/full-stack/skills/app-builder/tech-stack.md +40 -0
- package/areas/software/full-stack/skills/app-builder/templates/SKILL.md +39 -0
- package/areas/software/full-stack/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
- package/areas/software/full-stack/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
- package/areas/software/full-stack/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/areas/software/full-stack/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
- package/areas/software/full-stack/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
- package/areas/software/full-stack/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
- package/areas/software/full-stack/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
- package/areas/software/full-stack/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +82 -0
- package/areas/software/full-stack/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +100 -0
- package/areas/software/full-stack/skills/app-builder/templates/nextjs-static/TEMPLATE.md +106 -0
- package/areas/software/full-stack/skills/app-builder/templates/nuxt-app/TEMPLATE.md +101 -0
- package/areas/software/full-stack/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
- package/areas/software/full-stack/skills/app-builder/templates/react-native-app/TEMPLATE.md +93 -0
- package/areas/software/full-stack/skills/backend-developer/SKILL.md +58 -0
- package/areas/software/full-stack/skills/bash-pro/SKILL.md +310 -0
- package/areas/software/full-stack/skills/blackbox-test/SKILL.md +84 -0
- package/areas/software/full-stack/skills/prompt-project-planner/SKILL.md +130 -0
- package/areas/software/full-stack/skills/prompt-project-planner/output.schema.md +68 -0
- package/areas/software/full-stack/skills/prompt-project-planner/questions.md +80 -0
- package/areas/software/full-stack/skills/python-pro/SKILL.md +158 -0
- package/areas/software/full-stack/skills/skill-creator/LICENSE.txt +202 -0
- package/areas/software/full-stack/skills/skill-creator/SKILL.md +356 -0
- package/areas/software/full-stack/skills/skill-creator/references/output-patterns.md +82 -0
- package/areas/software/full-stack/skills/skill-creator/references/workflows.md +28 -0
- package/areas/software/full-stack/skills/skill-creator/scripts/init_skill.py +303 -0
- package/areas/software/full-stack/skills/skill-creator/scripts/package_skill.py +110 -0
- package/areas/software/full-stack/skills/skill-creator/scripts/quick_validate.py +95 -0
- package/areas/software/full-stack/workflows/backend-project-full-cycle.md +132 -0
- package/areas/software/full-stack/workflows/debug-issue.md +70 -0
- package/areas/software/full-stack/workflows/develop-feature.md +85 -0
- package/areas/software/full-stack/workflows/feature-implementation-flow.md +78 -0
- package/areas/software/full-stack/workflows/testing-ci-pipeline.md +65 -0
- package/areas/software/general/AGENTS.md +68 -0
- package/areas/software/general/prompts/code-review-workflow.md +87 -0
- package/areas/software/general/prompts/development-cycle-workflow.md +83 -0
- package/areas/software/general/prompts/project-setup-workflow.md +93 -0
- package/areas/software/general/rules/code-style-guide.md +31 -0
- package/areas/software/general/rules/docker-compose-guide.md +27 -0
- package/areas/software/general/rules/git-workflow-guide.md +27 -0
- package/areas/software/general/rules/github-workflow-guide.md +27 -0
- package/areas/software/general/rules/gitlab-ci-guide.md +27 -0
- package/areas/software/general/rules/lint-format-guide.md +29 -0
- package/areas/software/general/rules/makefile-guide.md +34 -0
- package/areas/software/general/rules/readme-sync-guide.md +40 -0
- package/areas/software/general/rules/sdlc-methodology-guide.md +27 -0
- package/areas/software/general/rules/sdlc-role-responsibilities.md +108 -0
- package/areas/software/general/skills/general-dev-tools/SKILL.md +324 -0
- package/areas/software/general/workflows/code-review-workflow.md +84 -0
- package/areas/software/general/workflows/development-cycle-workflow.md +85 -0
- package/areas/software/general/workflows/project-setup-workflow.md +94 -0
- package/areas/software/mlops/AGENTS.md +57 -0
- package/areas/software/mlops/PROMPTS.md +32 -0
- package/areas/software/mlops/prompts/champion-challenger.md +87 -0
- package/areas/software/mlops/prompts/deploy-endpoint.md +91 -0
- package/areas/software/mlops/prompts/evaluate-model.md +87 -0
- package/areas/software/mlops/prompts/model-incident.md +87 -0
- package/areas/software/mlops/prompts/train-experiment.md +83 -0
- package/areas/software/mlops/rules/data-integrity.md +9 -0
- package/areas/software/mlops/rules/model-governance.md +9 -0
- package/areas/software/mlops/rules/production-safety.md +9 -0
- package/areas/software/mlops/rules/reproducibility.md +9 -0
- package/areas/software/mlops/skills/experiment-tracking/SKILL.md +29 -0
- package/areas/software/mlops/skills/feature-engineering/SKILL.md +44 -0
- package/areas/software/mlops/skills/inference-serving/SKILL.md +35 -0
- package/areas/software/mlops/skills/model-evaluation/SKILL.md +40 -0
- package/areas/software/mlops/skills/model-monitoring/SKILL.md +32 -0
- package/areas/software/mlops/workflows/champion-challenger.md +65 -0
- package/areas/software/mlops/workflows/deploy-endpoint.md +70 -0
- package/areas/software/mlops/workflows/evaluate-model.md +63 -0
- package/areas/software/mlops/workflows/model-incident.md +64 -0
- package/areas/software/mlops/workflows/train-experiment.md +56 -0
- package/areas/software/mobile/AGENTS.md +58 -0
- package/areas/software/mobile/PROMPTS.md +32 -0
- package/areas/software/mobile/prompts/crash-triage.md +63 -0
- package/areas/software/mobile/prompts/device-testing.md +83 -0
- package/areas/software/mobile/prompts/ota-update.md +75 -0
- package/areas/software/mobile/prompts/release-build.md +67 -0
- package/areas/software/mobile/prompts/store-submission.md +79 -0
- package/areas/software/mobile/rules/offline-first.md +10 -0
- package/areas/software/mobile/rules/performance-budget.md +20 -0
- package/areas/software/mobile/rules/platform-compliance.md +17 -0
- package/areas/software/mobile/rules/security-mobile.md +9 -0
- package/areas/software/mobile/skills/app-store-prep/SKILL.md +27 -0
- package/areas/software/mobile/skills/mobile-testing/SKILL.md +36 -0
- package/areas/software/mobile/skills/native-modules/SKILL.md +38 -0
- package/areas/software/mobile/skills/navigation-patterns/SKILL.md +49 -0
- package/areas/software/mobile/skills/push-notifications/SKILL.md +40 -0
- package/areas/software/mobile/skills/state-sync/SKILL.md +48 -0
- package/areas/software/mobile/workflows/crash-triage.md +63 -0
- package/areas/software/mobile/workflows/device-testing.md +54 -0
- package/areas/software/mobile/workflows/ota-update.md +54 -0
- package/areas/software/mobile/workflows/release-build.md +67 -0
- package/areas/software/mobile/workflows/store-submission.md +63 -0
- package/areas/software/platform/AGENTS.md +67 -0
- package/areas/software/platform/PROMPTS.md +32 -0
- package/areas/software/platform/prompts/cost-audit.md +117 -0
- package/areas/software/platform/prompts/deploy-production.md +109 -0
- package/areas/software/platform/prompts/drift-check.md +107 -0
- package/areas/software/platform/prompts/incident-response.md +121 -0
- package/areas/software/platform/prompts/provision-env.md +113 -0
- package/areas/software/platform/rules/cost-governance.md +11 -0
- package/areas/software/platform/rules/immutability.md +17 -0
- package/areas/software/platform/rules/reliability.md +19 -0
- package/areas/software/platform/rules/security-posture.md +12 -0
- package/areas/software/platform/skills/ci-cd-pipelines/SKILL.md +58 -0
- package/areas/software/platform/skills/incident-response/SKILL.md +41 -0
- package/areas/software/platform/skills/k8s-manifests/SKILL.md +56 -0
- package/areas/software/platform/skills/networking/SKILL.md +44 -0
- package/areas/software/platform/skills/observability-setup/SKILL.md +49 -0
- package/areas/software/platform/skills/secrets-management/SKILL.md +43 -0
- package/areas/software/platform/skills/terraform-patterns/SKILL.md +75 -0
- package/areas/software/platform/workflows/cost-audit.md +61 -0
- package/areas/software/platform/workflows/deploy-production.md +67 -0
- package/areas/software/platform/workflows/drift-check.md +61 -0
- package/areas/software/platform/workflows/incident-response.md +69 -0
- package/areas/software/platform/workflows/provision-env.md +77 -0
- package/areas/software/qa/AGENTS.md +58 -0
- package/areas/software/qa/PROMPTS.md +32 -0
- package/areas/software/qa/prompts/flakiness-investigation.md +61 -0
- package/areas/software/qa/prompts/performance-audit.md +65 -0
- package/areas/software/qa/prompts/regression-suite.md +61 -0
- package/areas/software/qa/prompts/smoke-test.md +65 -0
- package/areas/software/qa/prompts/test-coverage-report.md +61 -0
- package/areas/software/qa/rules/flakiness-policy.md +12 -0
- package/areas/software/qa/rules/quality-gates.md +28 -0
- package/areas/software/qa/rules/test-data.md +9 -0
- package/areas/software/qa/rules/test-strategy.md +11 -0
- package/areas/software/qa/skills/accessibility-testing/SKILL.md +139 -0
- package/areas/software/qa/skills/api-testing/SKILL.md +140 -0
- package/areas/software/qa/skills/e2e-patterns/SKILL.md +152 -0
- package/areas/software/qa/skills/performance-testing/SKILL.md +177 -0
- package/areas/software/qa/skills/test-data-management/SKILL.md +161 -0
- package/areas/software/qa/skills/test-pyramid/SKILL.md +127 -0
- package/areas/software/qa/workflows/flakiness-investigation.md +63 -0
- package/areas/software/qa/workflows/performance-audit.md +59 -0
- package/areas/software/qa/workflows/regression-suite.md +59 -0
- package/areas/software/qa/workflows/smoke-test.md +64 -0
- package/areas/software/qa/workflows/test-coverage-report.md +57 -0
- package/areas/software/security/AGENTS.md +58 -0
- package/areas/software/security/PROMPTS.md +32 -0
- package/areas/software/security/prompts/compliance-report.md +113 -0
- package/areas/software/security/prompts/pen-test-sim.md +113 -0
- package/areas/software/security/prompts/secret-rotation.md +115 -0
- package/areas/software/security/prompts/security-scan.md +91 -0
- package/areas/software/security/prompts/threat-model-review.md +105 -0
- package/areas/software/security/rules/compliance-baseline.md +23 -0
- package/areas/software/security/rules/dependency-policy.md +12 -0
- package/areas/software/security/rules/secrets-policy.md +22 -0
- package/areas/software/security/rules/secure-coding.md +22 -0
- package/areas/software/security/skills/auth-patterns/SKILL.md +42 -0
- package/areas/software/security/skills/crypto-standards/SKILL.md +42 -0
- package/areas/software/security/skills/dependency-audit/SKILL.md +29 -0
- package/areas/software/security/skills/sast-dast-interpretation/SKILL.md +33 -0
- package/areas/software/security/skills/security-headers/SKILL.md +29 -0
- package/areas/software/security/skills/threat-modeling/SKILL.md +36 -0
- package/areas/software/security/workflows/compliance-report.md +57 -0
- package/areas/software/security/workflows/pen-test-sim.md +63 -0
- package/areas/software/security/workflows/secret-rotation.md +67 -0
- package/areas/software/security/workflows/security-scan.md +64 -0
- package/areas/software/security/workflows/threat-model-review.md +62 -0
- package/areas/template/AGENTS-area.tmpl.md +61 -0
- package/areas/template/AGENTS.tmpl.md +67 -0
- package/areas/template/GUIDE.md +102 -0
- package/areas/template/PROMPTS.tmpl.md +29 -0
- package/areas/template/README.md +57 -0
- package/areas/template/README.tmpl.md +51 -0
- package/areas/template/prompt.tmpl.md +101 -0
- package/areas/template/rule.tmpl.md +71 -0
- package/areas/template/skill.tmpl.md +108 -0
- package/areas/template/workflow.tmpl.md +104 -0
- package/bin/agentic.js +24 -0
- package/extensions/antigravity/GEMINI.md +10 -0
- package/extensions/claude/CLAUDE.md +10 -0
- package/extensions/codex/AGENTS.override.md +93 -0
- package/extensions/gemini/GEMINI.md +10 -0
- package/extensions/opencode/agents/designer.md +65 -0
- package/extensions/opencode/agents/developer.md +63 -0
- package/extensions/opencode/agents/devops-engineer.md +69 -0
- package/extensions/opencode/agents/pm.md +61 -0
- package/extensions/opencode/agents/product-owner.md +76 -0
- package/extensions/opencode/agents/qa.md +66 -0
- package/extensions/opencode/agents/team-lead.md +67 -0
- package/extensions/opencode/commands/feature.md +75 -0
- package/extensions/opencode/opencode.json +93 -0
- package/extensions/opencode/plugins/model-checker.json +14 -0
- package/extensions/opencode/plugins/model-checker.ts +279 -0
- package/extensions/opencode/plugins/sound-notification.ts +13 -0
- package/extensions/opencode/plugins/telegram-notification.ts +86 -0
- package/extensions/opencode/skills/code_review_expert/SKILL.md +144 -0
- package/extensions/opencode/skills/design_expert/SKILL.md +42 -0
- package/extensions/opencode/skills/qa_expert/SKILL.md +116 -0
- package/package.json +19 -0
package/agentic
ADDED
|
@@ -0,0 +1,1615 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
shopt -s inherit_errexit 2>/dev/null || true
|
|
5
|
+
|
|
6
|
+
SCRIPT_SOURCE="${BASH_SOURCE[0]}"
|
|
7
|
+
SCRIPT_DIR="$(cd -- "$(dirname -- "$SCRIPT_SOURCE")" && pwd -P)"
|
|
8
|
+
SCRIPT_NAME="$(basename -- "$SCRIPT_SOURCE")"
|
|
9
|
+
|
|
10
|
+
APP_NAME="agentic"
|
|
11
|
+
APP_TITLE="Agentic Installer"
|
|
12
|
+
APP_TUI_TITLE="Agentic installer (TUI mode)"
|
|
13
|
+
APP_REPO_URL="https://github.com/sawrus/agent-guides.git"
|
|
14
|
+
|
|
15
|
+
DEFAULT_AGENT_OS="default"
|
|
16
|
+
STATIC_AGENT_OS=(default opencode codex claude antigravity cursor agents)
|
|
17
|
+
INSTALL_DIRS=(rules skills workflows prompts)
|
|
18
|
+
THEME_CHOICES=(auto dark light)
|
|
19
|
+
|
|
20
|
+
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
|
21
|
+
XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
|
22
|
+
APP_CONFIG_DIR="$XDG_CONFIG_HOME/$APP_NAME"
|
|
23
|
+
APP_CONFIG_FILE="$APP_CONFIG_DIR/config"
|
|
24
|
+
APP_DATA_DIR="$XDG_DATA_HOME/$APP_NAME"
|
|
25
|
+
APP_REPO_DIR="$APP_DATA_DIR/repo"
|
|
26
|
+
|
|
27
|
+
REPO_ROOT=""
|
|
28
|
+
AREAS_ROOT=""
|
|
29
|
+
EXTENSIONS_ROOT=""
|
|
30
|
+
ROOT_AGENTS_FILE=""
|
|
31
|
+
THEME_LOADED_FROM_CONFIG=false
|
|
32
|
+
|
|
33
|
+
DRY_RUN=false
|
|
34
|
+
PROJECT_DIR=""
|
|
35
|
+
THEME="auto"
|
|
36
|
+
THEME_EXPLICIT=false
|
|
37
|
+
ACTIVE_THEME="dark"
|
|
38
|
+
|
|
39
|
+
SELECTED_AGENT_OS=("$DEFAULT_AGENT_OS")
|
|
40
|
+
SELECTED_AREAS=()
|
|
41
|
+
SELECTED_SPECS=()
|
|
42
|
+
|
|
43
|
+
SELF_INSTALL_FORCE=false
|
|
44
|
+
SELF_INSTALL_BIN_DIR="${HOME}/.local/bin"
|
|
45
|
+
SELF_INSTALL_NAME="$APP_NAME"
|
|
46
|
+
SELF_INSTALL_WITH_FZF=false
|
|
47
|
+
|
|
48
|
+
CREATED_PATHS=()
|
|
49
|
+
COPIED_PATHS=()
|
|
50
|
+
WARNINGS=()
|
|
51
|
+
|
|
52
|
+
COLOR_RESET=""
|
|
53
|
+
COLOR_HEADER=""
|
|
54
|
+
COLOR_INFO=""
|
|
55
|
+
COLOR_WARN=""
|
|
56
|
+
COLOR_ERROR=""
|
|
57
|
+
COLOR_DIM=""
|
|
58
|
+
|
|
59
|
+
FZF_COLOR_ARGS=()
|
|
60
|
+
|
|
61
|
+
usage() {
|
|
62
|
+
cat <<USAGE
|
|
63
|
+
$APP_TITLE
|
|
64
|
+
|
|
65
|
+
Usage:
|
|
66
|
+
$SCRIPT_NAME list [agentos|areas|specs --area <name>]
|
|
67
|
+
$SCRIPT_NAME install --project-dir <dir> [--agent-os <comma_list>] --areas <comma_list> --specializations <comma_list> [--theme auto|dark|light]
|
|
68
|
+
$SCRIPT_NAME tui [--theme auto|dark|light]
|
|
69
|
+
$SCRIPT_NAME upgrade
|
|
70
|
+
$SCRIPT_NAME self-install [--bin-dir <dir>] [--force] [--install-fzf] [--dry-run]
|
|
71
|
+
|
|
72
|
+
Behavior:
|
|
73
|
+
- No arguments in interactive terminal: runs TUI mode
|
|
74
|
+
- No arguments in non-interactive mode: prints usage and exits with code 1
|
|
75
|
+
- Installed mode bootstraps a local knowledge-base checkout on first use
|
|
76
|
+
|
|
77
|
+
Options:
|
|
78
|
+
--project-dir Target project directory (created if missing)
|
|
79
|
+
--agent-os Comma-separated agent OS list (default: ${DEFAULT_AGENT_OS})
|
|
80
|
+
--areas Comma-separated area list (example: software)
|
|
81
|
+
--specializations Comma-separated specializations in area.spec format (example: software.backend,software.frontend)
|
|
82
|
+
--theme Interface theme: auto|dark|light (default: config value or auto)
|
|
83
|
+
--bin-dir Installation directory for self-install (default: ~/.local/bin)
|
|
84
|
+
--force Overwrite existing binary for self-install
|
|
85
|
+
--install-fzf During self-install, try to auto-install fzf (optional)
|
|
86
|
+
--dry-run Show actions without writing files
|
|
87
|
+
-h, --help Show this help
|
|
88
|
+
|
|
89
|
+
Examples:
|
|
90
|
+
$SCRIPT_NAME list agentos
|
|
91
|
+
$SCRIPT_NAME install --project-dir /tmp/demo --agent-os opencode,codex --areas software --specializations software.backend,software.frontend
|
|
92
|
+
$SCRIPT_NAME tui --theme dark
|
|
93
|
+
$SCRIPT_NAME upgrade
|
|
94
|
+
$SCRIPT_NAME self-install --force
|
|
95
|
+
USAGE
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
is_interactive_terminal() {
|
|
99
|
+
if [[ "${AGENTIC_FORCE_INTERACTIVE:-${AGENTOS_FORCE_INTERACTIVE:-}}" == "1" ]]; then
|
|
100
|
+
return 0
|
|
101
|
+
fi
|
|
102
|
+
[[ -t 0 && -t 1 ]]
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
supports_color() {
|
|
106
|
+
[[ -t 1 ]] || return 1
|
|
107
|
+
[[ -n "${NO_COLOR:-}" ]] && return 1
|
|
108
|
+
command -v tput >/dev/null 2>&1 || return 1
|
|
109
|
+
local colors
|
|
110
|
+
colors="$(tput colors 2>/dev/null || echo 0)"
|
|
111
|
+
[[ "$colors" =~ ^[0-9]+$ ]] || return 1
|
|
112
|
+
(( colors >= 8 ))
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
detect_platform() {
|
|
116
|
+
if [[ -n "${AGENTIC_PLATFORM_OVERRIDE:-${AGENTOS_PLATFORM_OVERRIDE:-}}" ]]; then
|
|
117
|
+
echo "${AGENTIC_PLATFORM_OVERRIDE:-${AGENTOS_PLATFORM_OVERRIDE:-}}"
|
|
118
|
+
return
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
local uname_s
|
|
122
|
+
uname_s="$(uname -s 2>/dev/null || echo unknown)"
|
|
123
|
+
case "$uname_s" in
|
|
124
|
+
Linux)
|
|
125
|
+
echo "linux"
|
|
126
|
+
;;
|
|
127
|
+
Darwin)
|
|
128
|
+
echo "macos"
|
|
129
|
+
;;
|
|
130
|
+
CYGWIN*|MINGW*|MSYS*)
|
|
131
|
+
echo "windows"
|
|
132
|
+
;;
|
|
133
|
+
*)
|
|
134
|
+
echo "unknown"
|
|
135
|
+
;;
|
|
136
|
+
esac
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
detect_auto_theme() {
|
|
140
|
+
local bg
|
|
141
|
+
bg="${COLORFGBG:-}"
|
|
142
|
+
if [[ "$bg" =~ \;([0-9]{1,2})$ ]]; then
|
|
143
|
+
local code="${BASH_REMATCH[1]}"
|
|
144
|
+
case "$code" in
|
|
145
|
+
0|1|2|3|4|5|6|8|15)
|
|
146
|
+
echo "light"
|
|
147
|
+
return
|
|
148
|
+
;;
|
|
149
|
+
*)
|
|
150
|
+
echo "dark"
|
|
151
|
+
return
|
|
152
|
+
;;
|
|
153
|
+
esac
|
|
154
|
+
fi
|
|
155
|
+
echo "dark"
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
set_theme_colors() {
|
|
159
|
+
COLOR_RESET=""
|
|
160
|
+
COLOR_HEADER=""
|
|
161
|
+
COLOR_INFO=""
|
|
162
|
+
COLOR_WARN=""
|
|
163
|
+
COLOR_ERROR=""
|
|
164
|
+
COLOR_DIM=""
|
|
165
|
+
FZF_COLOR_ARGS=()
|
|
166
|
+
local use_ansi=false
|
|
167
|
+
if supports_color; then
|
|
168
|
+
use_ansi=true
|
|
169
|
+
fi
|
|
170
|
+
|
|
171
|
+
local resolved="$THEME"
|
|
172
|
+
if [[ "$resolved" == "auto" ]]; then
|
|
173
|
+
resolved="$(detect_auto_theme)"
|
|
174
|
+
fi
|
|
175
|
+
ACTIVE_THEME="$resolved"
|
|
176
|
+
|
|
177
|
+
case "$ACTIVE_THEME" in
|
|
178
|
+
light)
|
|
179
|
+
if [[ "$use_ansi" == true ]]; then
|
|
180
|
+
COLOR_RESET=$'\033[0m'
|
|
181
|
+
COLOR_HEADER=$'\033[1;34m'
|
|
182
|
+
COLOR_INFO=$'\033[1;36m'
|
|
183
|
+
COLOR_WARN=$'\033[1;33m'
|
|
184
|
+
COLOR_ERROR=$'\033[1;31m'
|
|
185
|
+
COLOR_DIM=$'\033[2;30m'
|
|
186
|
+
fi
|
|
187
|
+
FZF_COLOR_ARGS=(
|
|
188
|
+
"--color=fg:#1f2937,bg:#f8fafc,hl:#2563eb"
|
|
189
|
+
"--color=fg+:#111827,bg+:#dbeafe,hl+:#1d4ed8"
|
|
190
|
+
"--color=prompt:#0f766e,pointer:#dc2626,marker:#16a34a,spinner:#2563eb,header:#334155"
|
|
191
|
+
)
|
|
192
|
+
;;
|
|
193
|
+
dark|*)
|
|
194
|
+
ACTIVE_THEME="dark"
|
|
195
|
+
if [[ "$use_ansi" == true ]]; then
|
|
196
|
+
COLOR_RESET=$'\033[0m'
|
|
197
|
+
COLOR_HEADER=$'\033[1;36m'
|
|
198
|
+
COLOR_INFO=$'\033[1;32m'
|
|
199
|
+
COLOR_WARN=$'\033[1;33m'
|
|
200
|
+
COLOR_ERROR=$'\033[1;31m'
|
|
201
|
+
COLOR_DIM=$'\033[2;37m'
|
|
202
|
+
fi
|
|
203
|
+
FZF_COLOR_ARGS=(
|
|
204
|
+
"--color=fg:#e5e7eb,bg:#111827,hl:#60a5fa"
|
|
205
|
+
"--color=fg+:#ffffff,bg+:#1f2937,hl+:#93c5fd"
|
|
206
|
+
"--color=query:#e5e7eb,prompt:#22c55e,pointer:#f97316,marker:#a3e635,spinner:#06b6d4,header:#d1d5db"
|
|
207
|
+
)
|
|
208
|
+
;;
|
|
209
|
+
esac
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
log() {
|
|
213
|
+
printf '%s[agentic]%s %s\n' "$COLOR_INFO" "$COLOR_RESET" "$1"
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
warn() {
|
|
217
|
+
printf '%s[agentic][warn]%s %s\n' "$COLOR_WARN" "$COLOR_RESET" "$1"
|
|
218
|
+
WARNINGS+=("$1")
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
error() {
|
|
222
|
+
printf '%s[agentic][error]%s %s\n' "$COLOR_ERROR" "$COLOR_RESET" "$1" >&2
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
unique_append() {
|
|
226
|
+
local value="$1"
|
|
227
|
+
local arr_name="$2"
|
|
228
|
+
local item
|
|
229
|
+
eval "for item in \"\${${arr_name}[@]:-}\"; do
|
|
230
|
+
if [[ \"\$item\" == \"\$value\" ]]; then
|
|
231
|
+
return
|
|
232
|
+
fi
|
|
233
|
+
done"
|
|
234
|
+
eval "${arr_name}+=(\"\$value\")"
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
trim() {
|
|
238
|
+
local s="$1"
|
|
239
|
+
s="${s#${s%%[![:space:]]*}}"
|
|
240
|
+
s="${s%${s##*[![:space:]]}}"
|
|
241
|
+
printf '%s\n' "$s"
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
readlines() {
|
|
245
|
+
local arr_name="$1"
|
|
246
|
+
local line
|
|
247
|
+
while IFS= read -r line || [[ -n "$line" ]]; do
|
|
248
|
+
eval "${arr_name}+=(\"\$line\")"
|
|
249
|
+
done
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
split_csv() {
|
|
253
|
+
local raw="$1"
|
|
254
|
+
local arr_name="$2"
|
|
255
|
+
local part
|
|
256
|
+
local parts=()
|
|
257
|
+
IFS=',' read -r -a parts <<< "$raw"
|
|
258
|
+
for part in "${parts[@]}"; do
|
|
259
|
+
part="$(trim "$part")"
|
|
260
|
+
[[ -n "$part" ]] && eval "${arr_name}+=(\"\$part\")"
|
|
261
|
+
done
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
validate_theme() {
|
|
265
|
+
local theme="$1"
|
|
266
|
+
local item
|
|
267
|
+
for item in "${THEME_CHOICES[@]}"; do
|
|
268
|
+
if [[ "$item" == "$theme" ]]; then
|
|
269
|
+
return 0
|
|
270
|
+
fi
|
|
271
|
+
done
|
|
272
|
+
return 1
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
is_repo_root() {
|
|
276
|
+
local dir="$1"
|
|
277
|
+
[[ -n "$dir" ]] || return 1
|
|
278
|
+
[[ -d "$dir/areas" ]] && [[ -d "$dir/extensions" ]] && [[ -f "$dir/AGENTS.md" ]]
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
resolve_dev_repo_root() {
|
|
282
|
+
local candidates=(
|
|
283
|
+
"$SCRIPT_DIR"
|
|
284
|
+
"$(cd -- "$SCRIPT_DIR/.." 2>/dev/null && pwd -P || true)"
|
|
285
|
+
)
|
|
286
|
+
local candidate
|
|
287
|
+
for candidate in "${candidates[@]}"; do
|
|
288
|
+
[[ -n "$candidate" ]] || continue
|
|
289
|
+
if is_repo_root "$candidate"; then
|
|
290
|
+
printf '%s\n' "$candidate"
|
|
291
|
+
return 0
|
|
292
|
+
fi
|
|
293
|
+
done
|
|
294
|
+
return 1
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
resolve_data_repo_root() {
|
|
298
|
+
if is_repo_root "$APP_REPO_DIR"; then
|
|
299
|
+
printf '%s\n' "$APP_REPO_DIR"
|
|
300
|
+
return 0
|
|
301
|
+
fi
|
|
302
|
+
return 1
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
refresh_repo_paths() {
|
|
306
|
+
local resolved_root=""
|
|
307
|
+
if resolved_root="$(resolve_dev_repo_root 2>/dev/null)"; then
|
|
308
|
+
:
|
|
309
|
+
elif resolved_root="$(resolve_data_repo_root 2>/dev/null)"; then
|
|
310
|
+
:
|
|
311
|
+
else
|
|
312
|
+
resolved_root="$APP_REPO_DIR"
|
|
313
|
+
fi
|
|
314
|
+
|
|
315
|
+
REPO_ROOT="$resolved_root"
|
|
316
|
+
AREAS_ROOT="$REPO_ROOT/areas"
|
|
317
|
+
EXTENSIONS_ROOT="$REPO_ROOT/extensions"
|
|
318
|
+
ROOT_AGENTS_FILE="$REPO_ROOT/AGENTS.md"
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
ensure_repo_layout() {
|
|
322
|
+
refresh_repo_paths
|
|
323
|
+
if ! is_repo_root "$REPO_ROOT"; then
|
|
324
|
+
error "knowledge base checkout is not available at '$REPO_ROOT'"
|
|
325
|
+
error "Run '$APP_NAME upgrade' or any supported command again after bootstrap succeeds."
|
|
326
|
+
exit 1
|
|
327
|
+
fi
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
ensure_git_available() {
|
|
331
|
+
if ! command -v git >/dev/null 2>&1; then
|
|
332
|
+
error "git is required to bootstrap or upgrade the local knowledge base checkout"
|
|
333
|
+
exit 1
|
|
334
|
+
fi
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
clone_repo_checkout() {
|
|
338
|
+
ensure_git_available
|
|
339
|
+
ensure_dir "$APP_DATA_DIR"
|
|
340
|
+
|
|
341
|
+
if [[ -e "$APP_REPO_DIR" ]]; then
|
|
342
|
+
warn "Replacing invalid knowledge base checkout at $APP_REPO_DIR"
|
|
343
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
344
|
+
log "DRY-RUN rm -rf $APP_REPO_DIR"
|
|
345
|
+
else
|
|
346
|
+
rm -rf -- "$APP_REPO_DIR"
|
|
347
|
+
fi
|
|
348
|
+
fi
|
|
349
|
+
|
|
350
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
351
|
+
log "DRY-RUN git clone $APP_REPO_URL $APP_REPO_DIR"
|
|
352
|
+
return
|
|
353
|
+
fi
|
|
354
|
+
|
|
355
|
+
log "Bootstrapping knowledge base checkout into $APP_REPO_DIR"
|
|
356
|
+
git clone "$APP_REPO_URL" "$APP_REPO_DIR"
|
|
357
|
+
refresh_repo_paths
|
|
358
|
+
if ! is_repo_root "$APP_REPO_DIR"; then
|
|
359
|
+
error "Bootstrapped checkout is invalid: expected areas/, extensions/, and AGENTS.md in $APP_REPO_DIR"
|
|
360
|
+
exit 1
|
|
361
|
+
fi
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
ensure_repo_checkout() {
|
|
365
|
+
refresh_repo_paths
|
|
366
|
+
if is_repo_root "$REPO_ROOT"; then
|
|
367
|
+
return 0
|
|
368
|
+
fi
|
|
369
|
+
clone_repo_checkout
|
|
370
|
+
refresh_repo_paths
|
|
371
|
+
ensure_repo_layout
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
ensure_repo_available_for_command() {
|
|
375
|
+
if resolve_dev_repo_root >/dev/null 2>&1; then
|
|
376
|
+
refresh_repo_paths
|
|
377
|
+
return
|
|
378
|
+
fi
|
|
379
|
+
ensure_repo_checkout
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
load_user_config() {
|
|
383
|
+
local line key value
|
|
384
|
+
THEME_LOADED_FROM_CONFIG=false
|
|
385
|
+
|
|
386
|
+
if [[ ! -f "$APP_CONFIG_FILE" ]]; then
|
|
387
|
+
return
|
|
388
|
+
fi
|
|
389
|
+
|
|
390
|
+
while IFS= read -r line || [[ -n "$line" ]]; do
|
|
391
|
+
line="$(trim "$line")"
|
|
392
|
+
[[ -z "$line" ]] && continue
|
|
393
|
+
[[ "$line" == \#* ]] && continue
|
|
394
|
+
if [[ "$line" != *=* ]]; then
|
|
395
|
+
warn "Ignoring malformed config line in $APP_CONFIG_FILE: $line"
|
|
396
|
+
continue
|
|
397
|
+
fi
|
|
398
|
+
|
|
399
|
+
key="${line%%=*}"
|
|
400
|
+
value="${line#*=}"
|
|
401
|
+
key="$(trim "$key")"
|
|
402
|
+
value="$(trim "$value")"
|
|
403
|
+
|
|
404
|
+
case "$key" in
|
|
405
|
+
theme)
|
|
406
|
+
if validate_theme "$value"; then
|
|
407
|
+
THEME="$value"
|
|
408
|
+
THEME_LOADED_FROM_CONFIG=true
|
|
409
|
+
else
|
|
410
|
+
warn "Ignoring invalid theme '$value' in $APP_CONFIG_FILE; falling back to auto"
|
|
411
|
+
THEME="auto"
|
|
412
|
+
fi
|
|
413
|
+
;;
|
|
414
|
+
*)
|
|
415
|
+
;;
|
|
416
|
+
esac
|
|
417
|
+
done < "$APP_CONFIG_FILE"
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
save_user_config() {
|
|
421
|
+
ensure_dir "$APP_CONFIG_DIR"
|
|
422
|
+
|
|
423
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
424
|
+
log "DRY-RUN write config to $APP_CONFIG_FILE"
|
|
425
|
+
return
|
|
426
|
+
fi
|
|
427
|
+
|
|
428
|
+
cat > "$APP_CONFIG_FILE" <<CONFIG
|
|
429
|
+
# $APP_NAME user configuration
|
|
430
|
+
theme=$THEME
|
|
431
|
+
CONFIG
|
|
432
|
+
unique_append "$APP_CONFIG_FILE" COPIED_PATHS
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
# Agent-specific directory mappings using case statements for Bash 3.2 compatibility
|
|
436
|
+
get_agent_dir_mapping() {
|
|
437
|
+
local agent_os="$1"
|
|
438
|
+
case "$agent_os" in
|
|
439
|
+
opencode) echo ".opencode/rules .opencode/skills .opencode/commands -" ;;
|
|
440
|
+
cursor) echo ".cursor/rules .cursor/skills - -" ;;
|
|
441
|
+
kilocode) echo ".kilocode/rules .kilocode/skills .kilocode/workflows -" ;;
|
|
442
|
+
antigravity) echo ".kilocode/rules .kilocode/skills .kilocode/workflows -" ;;
|
|
443
|
+
*) echo "" ;;
|
|
444
|
+
esac
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
get_dest_dir() {
|
|
448
|
+
local agent_os="$1"
|
|
449
|
+
local bucket="$2"
|
|
450
|
+
|
|
451
|
+
local mapping
|
|
452
|
+
mapping="$(get_agent_dir_mapping "$agent_os")"
|
|
453
|
+
if [[ -n "$mapping" ]]; then
|
|
454
|
+
local parts=()
|
|
455
|
+
read -r -a parts <<< "$mapping"
|
|
456
|
+
local dir
|
|
457
|
+
case "$bucket" in
|
|
458
|
+
rules) dir="${parts[0]}" ;;
|
|
459
|
+
skills) dir="${parts[1]}" ;;
|
|
460
|
+
workflows) dir="${parts[2]}" ;;
|
|
461
|
+
prompts) dir="${parts[3]:-}" ;;
|
|
462
|
+
*) dir=".agent/$bucket" ;;
|
|
463
|
+
esac
|
|
464
|
+
printf '%s\n' "$dir"
|
|
465
|
+
else
|
|
466
|
+
printf '%s\n' ".agent/$bucket"
|
|
467
|
+
fi
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
get_dynamic_agentos() {
|
|
471
|
+
if [[ -d "$EXTENSIONS_ROOT" ]]; then
|
|
472
|
+
find "$EXTENSIONS_ROOT" -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | sort
|
|
473
|
+
fi
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
get_agentos_choices() {
|
|
477
|
+
local seen=()
|
|
478
|
+
local name
|
|
479
|
+
for name in "${STATIC_AGENT_OS[@]}"; do
|
|
480
|
+
unique_append "$name" seen
|
|
481
|
+
done
|
|
482
|
+
while IFS= read -r name; do
|
|
483
|
+
[[ -z "$name" ]] && continue
|
|
484
|
+
unique_append "$name" seen
|
|
485
|
+
done < <(get_dynamic_agentos)
|
|
486
|
+
printf '%s\n' "${seen[@]}"
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
list_areas() {
|
|
490
|
+
find "$AREAS_ROOT" -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | sort | grep -v '^template$'
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
list_specs() {
|
|
494
|
+
local area="$1"
|
|
495
|
+
find "$AREAS_ROOT/$area" -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | sort
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
ensure_dir() {
|
|
499
|
+
local path="$1"
|
|
500
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
501
|
+
log "DRY-RUN mkdir -p $path"
|
|
502
|
+
else
|
|
503
|
+
mkdir -p "$path"
|
|
504
|
+
fi
|
|
505
|
+
unique_append "$path" CREATED_PATHS
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
path_ref_for_shell_export() {
|
|
509
|
+
local dir="$1"
|
|
510
|
+
if [[ "$dir" == "$HOME/"* ]]; then
|
|
511
|
+
printf '$HOME/%s\n' "${dir#"$HOME/"}"
|
|
512
|
+
return
|
|
513
|
+
fi
|
|
514
|
+
printf '%s\n' "$dir"
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
profile_has_path_export() {
|
|
518
|
+
local profile_file="$1"
|
|
519
|
+
local dir="$2"
|
|
520
|
+
[[ -f "$profile_file" ]] || return 1
|
|
521
|
+
|
|
522
|
+
local path_ref
|
|
523
|
+
path_ref="$(path_ref_for_shell_export "$dir")"
|
|
524
|
+
|
|
525
|
+
if grep -Fq "$dir" "$profile_file"; then
|
|
526
|
+
return 0
|
|
527
|
+
fi
|
|
528
|
+
|
|
529
|
+
grep -Fq "$path_ref" "$profile_file"
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
self_install_profile_file() {
|
|
533
|
+
local shell_name
|
|
534
|
+
shell_name="$(basename -- "${SHELL:-}")"
|
|
535
|
+
case "$shell_name" in
|
|
536
|
+
zsh)
|
|
537
|
+
printf '%s\n' "$HOME/.zshrc"
|
|
538
|
+
;;
|
|
539
|
+
bash)
|
|
540
|
+
printf '%s\n' "$HOME/.bashrc"
|
|
541
|
+
;;
|
|
542
|
+
*)
|
|
543
|
+
printf '%s\n' "$HOME/.profile"
|
|
544
|
+
;;
|
|
545
|
+
esac
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
ensure_bin_dir_in_shell_path() {
|
|
549
|
+
local bin_dir="$1"
|
|
550
|
+
local profile_file
|
|
551
|
+
profile_file="$(self_install_profile_file)"
|
|
552
|
+
|
|
553
|
+
local path_ref
|
|
554
|
+
path_ref="$(path_ref_for_shell_export "$bin_dir")"
|
|
555
|
+
local export_line="export PATH=\"$path_ref:\$PATH\""
|
|
556
|
+
|
|
557
|
+
if profile_has_path_export "$profile_file" "$bin_dir"; then
|
|
558
|
+
log "PATH hint already present in $profile_file"
|
|
559
|
+
return
|
|
560
|
+
fi
|
|
561
|
+
|
|
562
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
563
|
+
log "DRY-RUN append PATH export to $profile_file"
|
|
564
|
+
log "DRY-RUN line: $export_line"
|
|
565
|
+
return
|
|
566
|
+
fi
|
|
567
|
+
|
|
568
|
+
if [[ ! -e "$profile_file" ]]; then
|
|
569
|
+
: > "$profile_file"
|
|
570
|
+
unique_append "$profile_file" COPIED_PATHS
|
|
571
|
+
fi
|
|
572
|
+
|
|
573
|
+
{
|
|
574
|
+
echo
|
|
575
|
+
echo "# Added by $APP_NAME self-install on $(date +%Y-%m-%d)"
|
|
576
|
+
echo "$export_line"
|
|
577
|
+
} >> "$profile_file"
|
|
578
|
+
log "Added PATH export to $profile_file"
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
copy_dir_contents() {
|
|
582
|
+
local src="$1"
|
|
583
|
+
local dest="$2"
|
|
584
|
+
ensure_dir "$dest"
|
|
585
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
586
|
+
log "DRY-RUN cp -a $src/. $dest/"
|
|
587
|
+
else
|
|
588
|
+
cp -a "$src/." "$dest/"
|
|
589
|
+
fi
|
|
590
|
+
unique_append "$dest" COPIED_PATHS
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
normalize_selected_agent_os() {
|
|
594
|
+
local normalized=()
|
|
595
|
+
local agent
|
|
596
|
+
if [[ "${#SELECTED_AGENT_OS[@]}" -eq 0 ]]; then
|
|
597
|
+
SELECTED_AGENT_OS=("$DEFAULT_AGENT_OS")
|
|
598
|
+
return
|
|
599
|
+
fi
|
|
600
|
+
for agent in "${SELECTED_AGENT_OS[@]}"; do
|
|
601
|
+
agent="$(trim "$agent")"
|
|
602
|
+
[[ -z "$agent" ]] && continue
|
|
603
|
+
unique_append "$agent" normalized
|
|
604
|
+
done
|
|
605
|
+
if [[ "${#normalized[@]}" -eq 0 ]]; then
|
|
606
|
+
normalized=("$DEFAULT_AGENT_OS")
|
|
607
|
+
fi
|
|
608
|
+
SELECTED_AGENT_OS=("${normalized[@]}")
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
copy_extension_for_agent() {
|
|
612
|
+
local agent_os="$1"
|
|
613
|
+
local project_dir="$2"
|
|
614
|
+
|
|
615
|
+
if [[ "$agent_os" == "$DEFAULT_AGENT_OS" ]] || [[ "$agent_os" == "agents" ]]; then
|
|
616
|
+
log "Agent OS '$agent_os': skipping extension copy"
|
|
617
|
+
return
|
|
618
|
+
fi
|
|
619
|
+
|
|
620
|
+
local src="$EXTENSIONS_ROOT/$agent_os"
|
|
621
|
+
local dest="$project_dir/.$agent_os"
|
|
622
|
+
|
|
623
|
+
if [[ ! -d "$src" ]]; then
|
|
624
|
+
warn "No extension directory found for '$agent_os' at $src (skipped)"
|
|
625
|
+
return
|
|
626
|
+
fi
|
|
627
|
+
|
|
628
|
+
log "Copy extension: $src -> $dest"
|
|
629
|
+
copy_dir_contents "$src" "$dest"
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
copy_extensions() {
|
|
633
|
+
local project_dir="$1"
|
|
634
|
+
local agent_os
|
|
635
|
+
for agent_os in "${SELECTED_AGENT_OS[@]}"; do
|
|
636
|
+
copy_extension_for_agent "$agent_os" "$project_dir"
|
|
637
|
+
done
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
copy_specialization_assets() {
|
|
641
|
+
local project_dir="$1"
|
|
642
|
+
local spec_key
|
|
643
|
+
|
|
644
|
+
for spec_key in "${SELECTED_SPECS[@]}"; do
|
|
645
|
+
local area="${spec_key%%.*}"
|
|
646
|
+
local spec="${spec_key#*.}"
|
|
647
|
+
local src_root="$AREAS_ROOT/$area/$spec"
|
|
648
|
+
|
|
649
|
+
if [[ ! -d "$src_root" ]]; then
|
|
650
|
+
warn "Specialization path not found: $src_root"
|
|
651
|
+
continue
|
|
652
|
+
fi
|
|
653
|
+
|
|
654
|
+
local bucket
|
|
655
|
+
for bucket in "${INSTALL_DIRS[@]}"; do
|
|
656
|
+
local src="$src_root/$bucket"
|
|
657
|
+
if [[ ! -d "$src" ]]; then
|
|
658
|
+
continue
|
|
659
|
+
fi
|
|
660
|
+
|
|
661
|
+
local targets=()
|
|
662
|
+
local target
|
|
663
|
+
for target in "${SELECTED_AGENT_OS[@]}"; do
|
|
664
|
+
unique_append "$target" targets
|
|
665
|
+
done
|
|
666
|
+
unique_append "agents" targets
|
|
667
|
+
|
|
668
|
+
local dest_dirs=()
|
|
669
|
+
for target in "${targets[@]}"; do
|
|
670
|
+
local dest_dir
|
|
671
|
+
dest_dir="$(get_dest_dir "$target" "$bucket")"
|
|
672
|
+
if [[ "$dest_dir" == "-" ]]; then
|
|
673
|
+
log "Skip $spec_key/$bucket (not supported by '$target')"
|
|
674
|
+
continue
|
|
675
|
+
fi
|
|
676
|
+
unique_append "$dest_dir" dest_dirs
|
|
677
|
+
done
|
|
678
|
+
|
|
679
|
+
local resolved_dir
|
|
680
|
+
for resolved_dir in "${dest_dirs[@]}"; do
|
|
681
|
+
local dest="$project_dir/$resolved_dir"
|
|
682
|
+
log "Copy $spec_key/$bucket -> $dest"
|
|
683
|
+
copy_dir_contents "$src" "$dest"
|
|
684
|
+
done
|
|
685
|
+
done
|
|
686
|
+
done
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
build_header() {
|
|
690
|
+
local out="$1"
|
|
691
|
+
local rules_dir
|
|
692
|
+
rules_dir="$(get_dest_dir "${SELECTED_AGENT_OS[0]}" "rules")"
|
|
693
|
+
{
|
|
694
|
+
echo "# Agentic Project Guidelines"
|
|
695
|
+
echo
|
|
696
|
+
echo "Generated by $SCRIPT_NAME on $(date -u +'%Y-%m-%dT%H:%M:%SZ')."
|
|
697
|
+
echo
|
|
698
|
+
echo "## Installation Context"
|
|
699
|
+
echo "- Agent OS targets: ${SELECTED_AGENT_OS[*]}"
|
|
700
|
+
echo "- Primary agent rules directory: $rules_dir"
|
|
701
|
+
echo "- Areas: ${SELECTED_AREAS[*]}"
|
|
702
|
+
echo "- Specializations: ${SELECTED_SPECS[*]}"
|
|
703
|
+
echo
|
|
704
|
+
echo "---"
|
|
705
|
+
echo
|
|
706
|
+
} > "$out"
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
append_specialization_template() {
|
|
710
|
+
local out="$1"
|
|
711
|
+
local spec_key="$2"
|
|
712
|
+
local area="${spec_key%%.*}"
|
|
713
|
+
local spec="${spec_key#*.}"
|
|
714
|
+
local src="$AREAS_ROOT/$area/$spec/AGENTS.md"
|
|
715
|
+
|
|
716
|
+
{
|
|
717
|
+
echo "## ${area}/${spec}"
|
|
718
|
+
echo
|
|
719
|
+
if [[ -f "$src" ]]; then
|
|
720
|
+
cat "$src"
|
|
721
|
+
else
|
|
722
|
+
echo "No specialization AGENTS.md template found for ${spec_key}."
|
|
723
|
+
fi
|
|
724
|
+
echo
|
|
725
|
+
echo "---"
|
|
726
|
+
echo
|
|
727
|
+
} >> "$out"
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
append_root_agents_template() {
|
|
731
|
+
local out="$1"
|
|
732
|
+
local src="$ROOT_AGENTS_FILE"
|
|
733
|
+
|
|
734
|
+
{
|
|
735
|
+
echo "## Shared guidance"
|
|
736
|
+
echo
|
|
737
|
+
if [[ -f "$src" ]]; then
|
|
738
|
+
cat "$src"
|
|
739
|
+
else
|
|
740
|
+
echo "No root AGENTS.md template found."
|
|
741
|
+
fi
|
|
742
|
+
echo
|
|
743
|
+
echo "---"
|
|
744
|
+
echo
|
|
745
|
+
} >> "$out"
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
generate_agents_md() {
|
|
749
|
+
local project_dir="$1"
|
|
750
|
+
local out="$project_dir/AGENTS.md"
|
|
751
|
+
|
|
752
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
753
|
+
log "DRY-RUN generate $out"
|
|
754
|
+
unique_append "$out" COPIED_PATHS
|
|
755
|
+
return
|
|
756
|
+
fi
|
|
757
|
+
|
|
758
|
+
ensure_dir "$project_dir"
|
|
759
|
+
build_header "$out"
|
|
760
|
+
append_root_agents_template "$out"
|
|
761
|
+
|
|
762
|
+
local spec_key
|
|
763
|
+
for spec_key in "${SELECTED_SPECS[@]}"; do
|
|
764
|
+
append_specialization_template "$out" "$spec_key"
|
|
765
|
+
done
|
|
766
|
+
|
|
767
|
+
unique_append "$out" COPIED_PATHS
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
validate_inputs() {
|
|
771
|
+
local available_areas
|
|
772
|
+
available_areas="$(list_areas || true)"
|
|
773
|
+
|
|
774
|
+
if [[ -z "$PROJECT_DIR" ]]; then
|
|
775
|
+
error "--project-dir is required"
|
|
776
|
+
exit 1
|
|
777
|
+
fi
|
|
778
|
+
|
|
779
|
+
if [[ "${#SELECTED_AREAS[@]}" -eq 0 ]]; then
|
|
780
|
+
error "--areas is required"
|
|
781
|
+
exit 1
|
|
782
|
+
fi
|
|
783
|
+
|
|
784
|
+
if [[ "${#SELECTED_SPECS[@]}" -eq 0 ]]; then
|
|
785
|
+
error "--specializations is required"
|
|
786
|
+
exit 1
|
|
787
|
+
fi
|
|
788
|
+
|
|
789
|
+
local area
|
|
790
|
+
for area in "${SELECTED_AREAS[@]}"; do
|
|
791
|
+
if ! grep -qx "$area" <<< "$available_areas"; then
|
|
792
|
+
error "unknown area '$area'"
|
|
793
|
+
exit 1
|
|
794
|
+
fi
|
|
795
|
+
done
|
|
796
|
+
|
|
797
|
+
local spec_key
|
|
798
|
+
for spec_key in "${SELECTED_SPECS[@]}"; do
|
|
799
|
+
if [[ "$spec_key" != *.* ]]; then
|
|
800
|
+
error "specialization must be in area.spec format: $spec_key"
|
|
801
|
+
exit 1
|
|
802
|
+
fi
|
|
803
|
+
|
|
804
|
+
local area_name="${spec_key%%.*}"
|
|
805
|
+
local spec_name="${spec_key#*.}"
|
|
806
|
+
if [[ ! -d "$AREAS_ROOT/$area_name/$spec_name" ]]; then
|
|
807
|
+
error "specialization not found: $spec_key"
|
|
808
|
+
exit 1
|
|
809
|
+
fi
|
|
810
|
+
|
|
811
|
+
local found=false
|
|
812
|
+
local selected_area
|
|
813
|
+
for selected_area in "${SELECTED_AREAS[@]}"; do
|
|
814
|
+
if [[ "$selected_area" == "$area_name" ]]; then
|
|
815
|
+
found=true
|
|
816
|
+
break
|
|
817
|
+
fi
|
|
818
|
+
done
|
|
819
|
+
if [[ "$found" == false ]]; then
|
|
820
|
+
error "specialization '$spec_key' not included by selected areas"
|
|
821
|
+
exit 1
|
|
822
|
+
fi
|
|
823
|
+
done
|
|
824
|
+
|
|
825
|
+
local agentos_choices
|
|
826
|
+
agentos_choices="$(get_agentos_choices)"
|
|
827
|
+
local agent
|
|
828
|
+
for agent in "${SELECTED_AGENT_OS[@]}"; do
|
|
829
|
+
if ! grep -qx "$agent" <<< "$agentos_choices"; then
|
|
830
|
+
error "unknown agent OS '$agent'"
|
|
831
|
+
exit 1
|
|
832
|
+
fi
|
|
833
|
+
done
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
print_report() {
|
|
837
|
+
echo
|
|
838
|
+
echo "${COLOR_HEADER}=== Installation report ===${COLOR_RESET}"
|
|
839
|
+
echo "Project dir: $PROJECT_DIR"
|
|
840
|
+
echo "Knowledge base repo: $REPO_ROOT"
|
|
841
|
+
echo "Config file: $APP_CONFIG_FILE"
|
|
842
|
+
echo "Agent OS targets: ${SELECTED_AGENT_OS[*]}"
|
|
843
|
+
echo "Areas: ${SELECTED_AREAS[*]}"
|
|
844
|
+
echo "Specializations: ${SELECTED_SPECS[*]}"
|
|
845
|
+
|
|
846
|
+
echo
|
|
847
|
+
echo "Created directories:"
|
|
848
|
+
if [[ "${#CREATED_PATHS[@]}" -eq 0 ]]; then
|
|
849
|
+
echo "- (none)"
|
|
850
|
+
else
|
|
851
|
+
printf -- '- %s\n' "${CREATED_PATHS[@]}"
|
|
852
|
+
fi
|
|
853
|
+
|
|
854
|
+
echo
|
|
855
|
+
echo "Copied/generated paths:"
|
|
856
|
+
if [[ "${#COPIED_PATHS[@]}" -eq 0 ]]; then
|
|
857
|
+
echo "- (none)"
|
|
858
|
+
else
|
|
859
|
+
printf -- '- %s\n' "${COPIED_PATHS[@]}"
|
|
860
|
+
fi
|
|
861
|
+
|
|
862
|
+
echo
|
|
863
|
+
echo "Warnings:"
|
|
864
|
+
if [[ "${#WARNINGS[@]}" -eq 0 ]]; then
|
|
865
|
+
echo "- (none)"
|
|
866
|
+
else
|
|
867
|
+
printf -- '- %s\n' "${WARNINGS[@]}"
|
|
868
|
+
fi
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
run_install() {
|
|
872
|
+
ensure_repo_layout
|
|
873
|
+
normalize_selected_agent_os
|
|
874
|
+
validate_inputs
|
|
875
|
+
|
|
876
|
+
ensure_dir "$PROJECT_DIR"
|
|
877
|
+
copy_extensions "$PROJECT_DIR"
|
|
878
|
+
copy_specialization_assets "$PROJECT_DIR"
|
|
879
|
+
generate_agents_md "$PROJECT_DIR"
|
|
880
|
+
print_report
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
ascii_banner() {
|
|
884
|
+
if [[ -n "$COLOR_HEADER" ]]; then
|
|
885
|
+
printf '%s' "$COLOR_HEADER"
|
|
886
|
+
fi
|
|
887
|
+
cat <<'ART'
|
|
888
|
+
_ ____ _____ _ _ _____ ___ ____
|
|
889
|
+
/ \ / ___| ____| \ | |_ _|_ _/ ___|
|
|
890
|
+
/ _ \| | _| _| | \| | | | | | |
|
|
891
|
+
/ ___ \ |_| | |___| |\ | | | | | |___
|
|
892
|
+
/_/ \_\____|_____|_| \_| |_| |___\____|
|
|
893
|
+
ART
|
|
894
|
+
if [[ -n "$COLOR_RESET" ]]; then
|
|
895
|
+
printf '%s' "$COLOR_RESET"
|
|
896
|
+
fi
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
prompt_with_default() {
|
|
900
|
+
local prompt="$1"
|
|
901
|
+
local default="$2"
|
|
902
|
+
local answer
|
|
903
|
+
read -r -p "$prompt [$default]: " answer
|
|
904
|
+
answer="$(trim "$answer")"
|
|
905
|
+
if [[ -z "$answer" ]]; then
|
|
906
|
+
printf '%s\n' "$default"
|
|
907
|
+
else
|
|
908
|
+
printf '%s\n' "$answer"
|
|
909
|
+
fi
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
prompt_with_default_fzf() {
|
|
913
|
+
local prompt="$1"
|
|
914
|
+
local default="$2"
|
|
915
|
+
local fzf_args=(
|
|
916
|
+
--ansi
|
|
917
|
+
--border
|
|
918
|
+
--height=70%
|
|
919
|
+
--layout=reverse
|
|
920
|
+
--cycle
|
|
921
|
+
--no-sort
|
|
922
|
+
--phony
|
|
923
|
+
--print-query
|
|
924
|
+
--bind "enter:accept"
|
|
925
|
+
--prompt "$prompt "
|
|
926
|
+
--header "Type path and press Enter to confirm (empty = $default)"
|
|
927
|
+
)
|
|
928
|
+
if [[ "${#FZF_COLOR_ARGS[@]}" -gt 0 ]]; then
|
|
929
|
+
fzf_args+=("${FZF_COLOR_ARGS[@]}")
|
|
930
|
+
fi
|
|
931
|
+
|
|
932
|
+
local output
|
|
933
|
+
# Keep one selectable row so Enter confirms query instead of canceling on 0/0.
|
|
934
|
+
if ! output="$(printf '%s\n' "<press Enter to confirm path>" | fzf "${fzf_args[@]}")"; then
|
|
935
|
+
error "Directory input canceled"
|
|
936
|
+
exit 1
|
|
937
|
+
fi
|
|
938
|
+
|
|
939
|
+
local selected
|
|
940
|
+
selected="$(printf '%s\n' "$output" | sed -n '1p')"
|
|
941
|
+
selected="$(trim "$selected")"
|
|
942
|
+
if [[ -n "$selected" ]]; then
|
|
943
|
+
printf '%s\n' "$selected"
|
|
944
|
+
return
|
|
945
|
+
fi
|
|
946
|
+
printf '%s\n' "$default"
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
choose_single_by_index() {
|
|
950
|
+
local prompt="$1"
|
|
951
|
+
shift
|
|
952
|
+
local options=("$@")
|
|
953
|
+
local i
|
|
954
|
+
echo "$prompt" >&2
|
|
955
|
+
for i in "${!options[@]}"; do
|
|
956
|
+
echo " $((i + 1))) ${options[$i]}" >&2
|
|
957
|
+
done
|
|
958
|
+
local answer
|
|
959
|
+
read -r -p "Select one (empty=1): " answer
|
|
960
|
+
answer="$(trim "$answer")"
|
|
961
|
+
if [[ -z "$answer" ]]; then
|
|
962
|
+
printf '%s\n' "${options[0]}"
|
|
963
|
+
return
|
|
964
|
+
fi
|
|
965
|
+
if [[ ! "$answer" =~ ^[0-9]+$ ]] || (( answer < 1 || answer > ${#options[@]} )); then
|
|
966
|
+
error "Invalid choice"
|
|
967
|
+
exit 1
|
|
968
|
+
fi
|
|
969
|
+
printf '%s\n' "${options[$((answer - 1))]}"
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
choose_multi_by_index() {
|
|
973
|
+
local prompt="$1"
|
|
974
|
+
shift
|
|
975
|
+
local options=("$@")
|
|
976
|
+
local i
|
|
977
|
+
echo "$prompt" >&2
|
|
978
|
+
for i in "${!options[@]}"; do
|
|
979
|
+
echo " $((i + 1))) ${options[$i]}" >&2
|
|
980
|
+
done
|
|
981
|
+
local answer
|
|
982
|
+
read -r -p "Select one or more (comma-separated indexes): " answer
|
|
983
|
+
answer="$(trim "$answer")"
|
|
984
|
+
if [[ -z "$answer" ]]; then
|
|
985
|
+
echo ""
|
|
986
|
+
return
|
|
987
|
+
fi
|
|
988
|
+
|
|
989
|
+
local out=()
|
|
990
|
+
local idx
|
|
991
|
+
local indexes=()
|
|
992
|
+
IFS=',' read -r -a indexes <<< "$answer"
|
|
993
|
+
for idx in "${indexes[@]}"; do
|
|
994
|
+
idx="$(trim "$idx")"
|
|
995
|
+
if [[ ! "$idx" =~ ^[0-9]+$ ]] || (( idx < 1 || idx > ${#options[@]} )); then
|
|
996
|
+
error "Invalid selection index: $idx"
|
|
997
|
+
exit 1
|
|
998
|
+
fi
|
|
999
|
+
unique_append "${options[$((idx - 1))]}" out
|
|
1000
|
+
done
|
|
1001
|
+
|
|
1002
|
+
printf '%s\n' "${out[@]}"
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
fzf_available() {
|
|
1006
|
+
command -v fzf >/dev/null 2>&1
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
run_with_sudo_if_needed() {
|
|
1010
|
+
if (( EUID == 0 )); then
|
|
1011
|
+
"$@"
|
|
1012
|
+
return
|
|
1013
|
+
fi
|
|
1014
|
+
|
|
1015
|
+
if command -v sudo >/dev/null 2>&1; then
|
|
1016
|
+
sudo "$@"
|
|
1017
|
+
return
|
|
1018
|
+
fi
|
|
1019
|
+
|
|
1020
|
+
"$@"
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
auto_install_fzf_linux() {
|
|
1024
|
+
if command -v apt-get >/dev/null 2>&1; then
|
|
1025
|
+
run_with_sudo_if_needed apt-get update
|
|
1026
|
+
run_with_sudo_if_needed apt-get install -y fzf
|
|
1027
|
+
return 0
|
|
1028
|
+
fi
|
|
1029
|
+
if command -v dnf >/dev/null 2>&1; then
|
|
1030
|
+
run_with_sudo_if_needed dnf install -y fzf
|
|
1031
|
+
return 0
|
|
1032
|
+
fi
|
|
1033
|
+
if command -v yum >/dev/null 2>&1; then
|
|
1034
|
+
run_with_sudo_if_needed yum install -y fzf
|
|
1035
|
+
return 0
|
|
1036
|
+
fi
|
|
1037
|
+
if command -v pacman >/dev/null 2>&1; then
|
|
1038
|
+
run_with_sudo_if_needed pacman -Sy --noconfirm fzf
|
|
1039
|
+
return 0
|
|
1040
|
+
fi
|
|
1041
|
+
if command -v zypper >/dev/null 2>&1; then
|
|
1042
|
+
run_with_sudo_if_needed zypper --non-interactive install fzf
|
|
1043
|
+
return 0
|
|
1044
|
+
fi
|
|
1045
|
+
if command -v apk >/dev/null 2>&1; then
|
|
1046
|
+
run_with_sudo_if_needed apk add --no-cache fzf
|
|
1047
|
+
return 0
|
|
1048
|
+
fi
|
|
1049
|
+
return 1
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
auto_install_fzf_windows() {
|
|
1053
|
+
if command -v winget >/dev/null 2>&1; then
|
|
1054
|
+
winget install --id junegunn.fzf -e --accept-source-agreements --accept-package-agreements
|
|
1055
|
+
return 0
|
|
1056
|
+
fi
|
|
1057
|
+
if command -v choco >/dev/null 2>&1; then
|
|
1058
|
+
choco install fzf -y
|
|
1059
|
+
return 0
|
|
1060
|
+
fi
|
|
1061
|
+
if command -v scoop >/dev/null 2>&1; then
|
|
1062
|
+
scoop install fzf
|
|
1063
|
+
return 0
|
|
1064
|
+
fi
|
|
1065
|
+
return 1
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
auto_install_fzf_macos() {
|
|
1069
|
+
if command -v brew >/dev/null 2>&1; then
|
|
1070
|
+
brew install fzf
|
|
1071
|
+
return 0
|
|
1072
|
+
fi
|
|
1073
|
+
return 1
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
auto_install_fzf() {
|
|
1077
|
+
local platform
|
|
1078
|
+
platform="$(detect_platform)"
|
|
1079
|
+
|
|
1080
|
+
case "$platform" in
|
|
1081
|
+
linux)
|
|
1082
|
+
auto_install_fzf_linux
|
|
1083
|
+
;;
|
|
1084
|
+
windows)
|
|
1085
|
+
auto_install_fzf_windows
|
|
1086
|
+
;;
|
|
1087
|
+
macos)
|
|
1088
|
+
auto_install_fzf_macos
|
|
1089
|
+
;;
|
|
1090
|
+
*)
|
|
1091
|
+
return 1
|
|
1092
|
+
;;
|
|
1093
|
+
esac
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
self_install_fzf_optional() {
|
|
1097
|
+
if [[ "$SELF_INSTALL_WITH_FZF" != true ]]; then
|
|
1098
|
+
return 0
|
|
1099
|
+
fi
|
|
1100
|
+
|
|
1101
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
1102
|
+
log "DRY-RUN would try to auto-install fzf for platform: $(detect_platform)"
|
|
1103
|
+
return 0
|
|
1104
|
+
fi
|
|
1105
|
+
|
|
1106
|
+
if fzf_available; then
|
|
1107
|
+
log "fzf already available"
|
|
1108
|
+
return 0
|
|
1109
|
+
fi
|
|
1110
|
+
|
|
1111
|
+
log "Trying to install fzf for platform: $(detect_platform)"
|
|
1112
|
+
if auto_install_fzf && fzf_available; then
|
|
1113
|
+
log "fzf installed successfully"
|
|
1114
|
+
return 0
|
|
1115
|
+
fi
|
|
1116
|
+
|
|
1117
|
+
warn "Could not auto-install fzf. TUI will use index-based fallback menus."
|
|
1118
|
+
return 0
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
ensure_fzf_or_fallback() {
|
|
1122
|
+
if fzf_available; then
|
|
1123
|
+
return 0
|
|
1124
|
+
fi
|
|
1125
|
+
|
|
1126
|
+
warn "fzf is not installed. Falling back to index menus unless auto-install succeeds."
|
|
1127
|
+
|
|
1128
|
+
if ! is_interactive_terminal; then
|
|
1129
|
+
return 1
|
|
1130
|
+
fi
|
|
1131
|
+
|
|
1132
|
+
local answer
|
|
1133
|
+
read -r -p "Install fzf automatically now? [Y/n]: " answer
|
|
1134
|
+
answer="$(trim "${answer:-}")"
|
|
1135
|
+
if [[ -z "$answer" ]] || [[ "$answer" =~ ^[Yy]$ ]]; then
|
|
1136
|
+
if auto_install_fzf && fzf_available; then
|
|
1137
|
+
log "fzf installed successfully"
|
|
1138
|
+
return 0
|
|
1139
|
+
fi
|
|
1140
|
+
warn "Automatic fzf installation failed or fzf still unavailable."
|
|
1141
|
+
return 1
|
|
1142
|
+
fi
|
|
1143
|
+
|
|
1144
|
+
warn "User declined automatic fzf installation."
|
|
1145
|
+
return 1
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
choose_single_fzf() {
|
|
1149
|
+
local prompt="$1"
|
|
1150
|
+
shift
|
|
1151
|
+
local options=("$@")
|
|
1152
|
+
|
|
1153
|
+
if [[ "${#options[@]}" -eq 0 ]]; then
|
|
1154
|
+
return
|
|
1155
|
+
fi
|
|
1156
|
+
|
|
1157
|
+
local fzf_args=(
|
|
1158
|
+
--ansi
|
|
1159
|
+
--border
|
|
1160
|
+
--height=70%
|
|
1161
|
+
--layout=reverse
|
|
1162
|
+
--cycle
|
|
1163
|
+
--no-sort
|
|
1164
|
+
--prompt "$prompt "
|
|
1165
|
+
--header "Use ↑/↓ to navigate • Enter to select"
|
|
1166
|
+
)
|
|
1167
|
+
if [[ "${#FZF_COLOR_ARGS[@]}" -gt 0 ]]; then
|
|
1168
|
+
fzf_args+=("${FZF_COLOR_ARGS[@]}")
|
|
1169
|
+
fi
|
|
1170
|
+
|
|
1171
|
+
printf '%s\n' "${options[@]}" | fzf "${fzf_args[@]}"
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
choose_multi_fzf() {
|
|
1175
|
+
local prompt="$1"
|
|
1176
|
+
shift
|
|
1177
|
+
local options=("$@")
|
|
1178
|
+
|
|
1179
|
+
if [[ "${#options[@]}" -eq 0 ]]; then
|
|
1180
|
+
return
|
|
1181
|
+
fi
|
|
1182
|
+
|
|
1183
|
+
local fzf_args=(
|
|
1184
|
+
--ansi
|
|
1185
|
+
--border
|
|
1186
|
+
--height=75%
|
|
1187
|
+
--layout=reverse
|
|
1188
|
+
--cycle
|
|
1189
|
+
--no-sort
|
|
1190
|
+
--multi
|
|
1191
|
+
--bind "space:toggle"
|
|
1192
|
+
--bind "tab:toggle+down"
|
|
1193
|
+
--prompt "$prompt "
|
|
1194
|
+
--header "Use ↑/↓ to navigate • Space to select • Enter to confirm"
|
|
1195
|
+
)
|
|
1196
|
+
if [[ "${#FZF_COLOR_ARGS[@]}" -gt 0 ]]; then
|
|
1197
|
+
fzf_args+=("${FZF_COLOR_ARGS[@]}")
|
|
1198
|
+
fi
|
|
1199
|
+
|
|
1200
|
+
printf '%s\n' "${options[@]}" | fzf "${fzf_args[@]}"
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
pick_theme_if_needed() {
|
|
1204
|
+
if [[ "$THEME_EXPLICIT" == true ]] || [[ "$THEME_LOADED_FROM_CONFIG" == true ]]; then
|
|
1205
|
+
return
|
|
1206
|
+
fi
|
|
1207
|
+
|
|
1208
|
+
local selected
|
|
1209
|
+
if fzf_available; then
|
|
1210
|
+
selected="$(choose_single_fzf "Select interface theme:" "${THEME_CHOICES[@]}")"
|
|
1211
|
+
else
|
|
1212
|
+
selected="$(choose_single_by_index "Select interface theme:" "${THEME_CHOICES[@]}")"
|
|
1213
|
+
fi
|
|
1214
|
+
|
|
1215
|
+
selected="$(trim "$selected")"
|
|
1216
|
+
if [[ -n "$selected" ]]; then
|
|
1217
|
+
THEME="$selected"
|
|
1218
|
+
fi
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
run_tui() {
|
|
1222
|
+
ensure_repo_layout
|
|
1223
|
+
|
|
1224
|
+
if ! is_interactive_terminal; then
|
|
1225
|
+
error "TUI mode requires an interactive terminal"
|
|
1226
|
+
exit 1
|
|
1227
|
+
fi
|
|
1228
|
+
|
|
1229
|
+
pick_theme_if_needed
|
|
1230
|
+
set_theme_colors
|
|
1231
|
+
|
|
1232
|
+
ascii_banner
|
|
1233
|
+
echo "${COLOR_HEADER}$APP_TUI_TITLE${COLOR_RESET}"
|
|
1234
|
+
echo "${COLOR_DIM}Theme: $THEME (resolved: $ACTIVE_THEME)${COLOR_RESET}"
|
|
1235
|
+
echo
|
|
1236
|
+
|
|
1237
|
+
local use_fzf=false
|
|
1238
|
+
if fzf_available; then
|
|
1239
|
+
use_fzf=true
|
|
1240
|
+
elif ensure_fzf_or_fallback; then
|
|
1241
|
+
use_fzf=true
|
|
1242
|
+
# Re-apply color profile in case auto-install affected terminal capabilities.
|
|
1243
|
+
set_theme_colors
|
|
1244
|
+
fi
|
|
1245
|
+
|
|
1246
|
+
if [[ "$use_fzf" == true ]]; then
|
|
1247
|
+
PROJECT_DIR="$(prompt_with_default_fzf "Target project directory [/tmp/agentic-project]:" "/tmp/agentic-project")"
|
|
1248
|
+
else
|
|
1249
|
+
PROJECT_DIR="$(prompt_with_default "Target project directory" "/tmp/agentic-project")"
|
|
1250
|
+
fi
|
|
1251
|
+
|
|
1252
|
+
local agentos_choices=()
|
|
1253
|
+
readlines agentos_choices < <(get_agentos_choices)
|
|
1254
|
+
|
|
1255
|
+
local picked_agent_os=()
|
|
1256
|
+
if [[ "$use_fzf" == true ]]; then
|
|
1257
|
+
readlines picked_agent_os < <(choose_multi_fzf "Select Agent OS target(s):" "${agentos_choices[@]}")
|
|
1258
|
+
else
|
|
1259
|
+
readlines picked_agent_os < <(choose_multi_by_index "Select Agent OS target(s):" "${agentos_choices[@]}")
|
|
1260
|
+
fi
|
|
1261
|
+
if [[ "${#picked_agent_os[@]}" -eq 0 ]]; then
|
|
1262
|
+
SELECTED_AGENT_OS=("$DEFAULT_AGENT_OS")
|
|
1263
|
+
else
|
|
1264
|
+
SELECTED_AGENT_OS=("${picked_agent_os[@]}")
|
|
1265
|
+
fi
|
|
1266
|
+
|
|
1267
|
+
local areas=()
|
|
1268
|
+
readlines areas < <(list_areas)
|
|
1269
|
+
|
|
1270
|
+
local picked_areas=()
|
|
1271
|
+
if [[ "$use_fzf" == true ]]; then
|
|
1272
|
+
readlines picked_areas < <(choose_multi_fzf "Select area(s):" "${areas[@]}")
|
|
1273
|
+
else
|
|
1274
|
+
readlines picked_areas < <(choose_multi_by_index "Select area(s):" "${areas[@]}")
|
|
1275
|
+
fi
|
|
1276
|
+
|
|
1277
|
+
if [[ "${#picked_areas[@]}" -eq 0 ]]; then
|
|
1278
|
+
SELECTED_AREAS=(software)
|
|
1279
|
+
else
|
|
1280
|
+
SELECTED_AREAS=("${picked_areas[@]}")
|
|
1281
|
+
fi
|
|
1282
|
+
|
|
1283
|
+
SELECTED_SPECS=()
|
|
1284
|
+
local area
|
|
1285
|
+
for area in "${SELECTED_AREAS[@]}"; do
|
|
1286
|
+
local specs=()
|
|
1287
|
+
readlines specs < <(list_specs "$area")
|
|
1288
|
+
|
|
1289
|
+
local chosen_specs=()
|
|
1290
|
+
if [[ "$use_fzf" == true ]]; then
|
|
1291
|
+
readlines chosen_specs < <(choose_multi_fzf "Select specialization(s) for '$area':" "${specs[@]}")
|
|
1292
|
+
else
|
|
1293
|
+
readlines chosen_specs < <(choose_multi_by_index "Select specialization(s) for '$area':" "${specs[@]}")
|
|
1294
|
+
fi
|
|
1295
|
+
|
|
1296
|
+
if [[ "${#chosen_specs[@]}" -eq 0 ]]; then
|
|
1297
|
+
error "No specialization selected for $area"
|
|
1298
|
+
exit 1
|
|
1299
|
+
fi
|
|
1300
|
+
|
|
1301
|
+
local spec
|
|
1302
|
+
for spec in "${chosen_specs[@]}"; do
|
|
1303
|
+
SELECTED_SPECS+=("$area.$spec")
|
|
1304
|
+
done
|
|
1305
|
+
done
|
|
1306
|
+
|
|
1307
|
+
save_user_config
|
|
1308
|
+
run_install
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
self_install() {
|
|
1312
|
+
local source_path="$SCRIPT_SOURCE"
|
|
1313
|
+
if [[ ! -r "$source_path" ]]; then
|
|
1314
|
+
error "Cannot read installer source at '$source_path'."
|
|
1315
|
+
error "Tip: download to a local file, then run self-install from that file."
|
|
1316
|
+
exit 1
|
|
1317
|
+
fi
|
|
1318
|
+
|
|
1319
|
+
local bin_dir="$SELF_INSTALL_BIN_DIR"
|
|
1320
|
+
if [[ "$bin_dir" == "~/.local/bin" ]]; then
|
|
1321
|
+
bin_dir="${HOME}/.local/bin"
|
|
1322
|
+
fi
|
|
1323
|
+
|
|
1324
|
+
local target="$bin_dir/$SELF_INSTALL_NAME"
|
|
1325
|
+
|
|
1326
|
+
ensure_dir "$bin_dir"
|
|
1327
|
+
|
|
1328
|
+
if [[ -e "$target" ]] && [[ "$SELF_INSTALL_FORCE" != true ]]; then
|
|
1329
|
+
error "Target already exists: $target"
|
|
1330
|
+
error "Use --force to overwrite"
|
|
1331
|
+
exit 1
|
|
1332
|
+
fi
|
|
1333
|
+
|
|
1334
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
1335
|
+
log "DRY-RUN install script to $target"
|
|
1336
|
+
else
|
|
1337
|
+
cp "$source_path" "$target"
|
|
1338
|
+
chmod +x "$target"
|
|
1339
|
+
unique_append "$target" COPIED_PATHS
|
|
1340
|
+
log "Installed: $target"
|
|
1341
|
+
fi
|
|
1342
|
+
|
|
1343
|
+
self_install_fzf_optional
|
|
1344
|
+
|
|
1345
|
+
case ":$PATH:" in
|
|
1346
|
+
*":$bin_dir:"*)
|
|
1347
|
+
log "PATH already includes $bin_dir"
|
|
1348
|
+
;;
|
|
1349
|
+
*)
|
|
1350
|
+
warn "PATH does not include $bin_dir"
|
|
1351
|
+
ensure_bin_dir_in_shell_path "$bin_dir"
|
|
1352
|
+
warn "Open a new terminal or run: export PATH=\"$(path_ref_for_shell_export "$bin_dir"):\$PATH\""
|
|
1353
|
+
;;
|
|
1354
|
+
esac
|
|
1355
|
+
|
|
1356
|
+
echo
|
|
1357
|
+
echo "${COLOR_HEADER}=== Self-install report ===${COLOR_RESET}"
|
|
1358
|
+
echo "Source: $source_path"
|
|
1359
|
+
echo "Target binary: $target"
|
|
1360
|
+
echo "Config directory: $APP_CONFIG_DIR"
|
|
1361
|
+
echo "Knowledge base repo: $APP_REPO_DIR"
|
|
1362
|
+
echo "Install fzf requested: $SELF_INSTALL_WITH_FZF"
|
|
1363
|
+
echo "Dry-run: $DRY_RUN"
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
upgrade_repo_checkout() {
|
|
1367
|
+
refresh_repo_paths
|
|
1368
|
+
|
|
1369
|
+
if resolve_dev_repo_root >/dev/null 2>&1; then
|
|
1370
|
+
ensure_git_available
|
|
1371
|
+
log "Updating development checkout at $REPO_ROOT"
|
|
1372
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
1373
|
+
log "DRY-RUN git -C $REPO_ROOT pull --ff-only"
|
|
1374
|
+
return
|
|
1375
|
+
fi
|
|
1376
|
+
git -C "$REPO_ROOT" pull --ff-only
|
|
1377
|
+
return
|
|
1378
|
+
fi
|
|
1379
|
+
|
|
1380
|
+
if ! resolve_data_repo_root >/dev/null 2>&1; then
|
|
1381
|
+
log "Knowledge base checkout not found; bootstrapping initial clone first"
|
|
1382
|
+
ensure_repo_checkout
|
|
1383
|
+
return
|
|
1384
|
+
fi
|
|
1385
|
+
|
|
1386
|
+
ensure_git_available
|
|
1387
|
+
log "Updating installed knowledge base checkout at $APP_REPO_DIR"
|
|
1388
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
1389
|
+
log "DRY-RUN git -C $APP_REPO_DIR pull --ff-only"
|
|
1390
|
+
return
|
|
1391
|
+
fi
|
|
1392
|
+
git -C "$APP_REPO_DIR" pull --ff-only
|
|
1393
|
+
refresh_repo_paths
|
|
1394
|
+
ensure_repo_layout
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
parse_theme_option() {
|
|
1398
|
+
local value="${1:-}"
|
|
1399
|
+
if [[ -z "$value" ]]; then
|
|
1400
|
+
error "Missing --theme value. Allowed: auto|dark|light"
|
|
1401
|
+
exit 1
|
|
1402
|
+
fi
|
|
1403
|
+
if ! validate_theme "$value"; then
|
|
1404
|
+
error "Invalid --theme value '$value'. Allowed: auto|dark|light"
|
|
1405
|
+
exit 1
|
|
1406
|
+
fi
|
|
1407
|
+
THEME="$value"
|
|
1408
|
+
THEME_EXPLICIT=true
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
handle_no_args() {
|
|
1412
|
+
if is_interactive_terminal; then
|
|
1413
|
+
ensure_repo_available_for_command
|
|
1414
|
+
run_tui
|
|
1415
|
+
exit 0
|
|
1416
|
+
fi
|
|
1417
|
+
|
|
1418
|
+
usage
|
|
1419
|
+
exit 1
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
load_user_config
|
|
1423
|
+
set_theme_colors
|
|
1424
|
+
refresh_repo_paths
|
|
1425
|
+
|
|
1426
|
+
if [[ $# -eq 0 ]]; then
|
|
1427
|
+
handle_no_args
|
|
1428
|
+
fi
|
|
1429
|
+
|
|
1430
|
+
COMMAND="$1"
|
|
1431
|
+
shift
|
|
1432
|
+
|
|
1433
|
+
case "$COMMAND" in
|
|
1434
|
+
list)
|
|
1435
|
+
ensure_repo_available_for_command
|
|
1436
|
+
ensure_repo_layout
|
|
1437
|
+
SUBCOMMAND="${1:-}"
|
|
1438
|
+
case "$SUBCOMMAND" in
|
|
1439
|
+
agentos)
|
|
1440
|
+
get_agentos_choices
|
|
1441
|
+
;;
|
|
1442
|
+
areas)
|
|
1443
|
+
list_areas
|
|
1444
|
+
;;
|
|
1445
|
+
specs)
|
|
1446
|
+
shift || true
|
|
1447
|
+
if [[ "${1:-}" != "--area" ]] || [[ -z "${2:-}" ]]; then
|
|
1448
|
+
error "Usage: $SCRIPT_NAME list specs --area <name>"
|
|
1449
|
+
exit 1
|
|
1450
|
+
fi
|
|
1451
|
+
list_specs "$2"
|
|
1452
|
+
;;
|
|
1453
|
+
*)
|
|
1454
|
+
usage
|
|
1455
|
+
exit 1
|
|
1456
|
+
;;
|
|
1457
|
+
esac
|
|
1458
|
+
;;
|
|
1459
|
+
|
|
1460
|
+
install)
|
|
1461
|
+
while [[ $# -gt 0 ]]; do
|
|
1462
|
+
case "$1" in
|
|
1463
|
+
--project-dir)
|
|
1464
|
+
PROJECT_DIR="$2"
|
|
1465
|
+
shift 2
|
|
1466
|
+
;;
|
|
1467
|
+
--agent-os)
|
|
1468
|
+
split_csv "$2" SELECTED_AGENT_OS
|
|
1469
|
+
shift 2
|
|
1470
|
+
;;
|
|
1471
|
+
--areas)
|
|
1472
|
+
split_csv "$2" SELECTED_AREAS
|
|
1473
|
+
shift 2
|
|
1474
|
+
;;
|
|
1475
|
+
--specializations)
|
|
1476
|
+
split_csv "$2" SELECTED_SPECS
|
|
1477
|
+
shift 2
|
|
1478
|
+
;;
|
|
1479
|
+
--theme)
|
|
1480
|
+
parse_theme_option "${2:-}"
|
|
1481
|
+
shift 2
|
|
1482
|
+
;;
|
|
1483
|
+
--theme=*)
|
|
1484
|
+
parse_theme_option "${1#*=}"
|
|
1485
|
+
shift
|
|
1486
|
+
;;
|
|
1487
|
+
--dry-run)
|
|
1488
|
+
DRY_RUN=true
|
|
1489
|
+
shift
|
|
1490
|
+
;;
|
|
1491
|
+
-h|--help)
|
|
1492
|
+
usage
|
|
1493
|
+
exit 0
|
|
1494
|
+
;;
|
|
1495
|
+
*)
|
|
1496
|
+
error "Unknown option: $1"
|
|
1497
|
+
usage
|
|
1498
|
+
exit 1
|
|
1499
|
+
;;
|
|
1500
|
+
esac
|
|
1501
|
+
done
|
|
1502
|
+
ensure_repo_available_for_command
|
|
1503
|
+
ensure_repo_layout
|
|
1504
|
+
set_theme_colors
|
|
1505
|
+
run_install
|
|
1506
|
+
if [[ "$THEME_EXPLICIT" == true ]]; then
|
|
1507
|
+
save_user_config
|
|
1508
|
+
fi
|
|
1509
|
+
;;
|
|
1510
|
+
|
|
1511
|
+
tui)
|
|
1512
|
+
while [[ $# -gt 0 ]]; do
|
|
1513
|
+
case "$1" in
|
|
1514
|
+
--theme)
|
|
1515
|
+
parse_theme_option "${2:-}"
|
|
1516
|
+
shift 2
|
|
1517
|
+
;;
|
|
1518
|
+
--theme=*)
|
|
1519
|
+
parse_theme_option "${1#*=}"
|
|
1520
|
+
shift
|
|
1521
|
+
;;
|
|
1522
|
+
--dry-run)
|
|
1523
|
+
DRY_RUN=true
|
|
1524
|
+
shift
|
|
1525
|
+
;;
|
|
1526
|
+
-h|--help)
|
|
1527
|
+
usage
|
|
1528
|
+
exit 0
|
|
1529
|
+
;;
|
|
1530
|
+
*)
|
|
1531
|
+
error "Unknown option: $1"
|
|
1532
|
+
usage
|
|
1533
|
+
exit 1
|
|
1534
|
+
;;
|
|
1535
|
+
esac
|
|
1536
|
+
done
|
|
1537
|
+
ensure_repo_available_for_command
|
|
1538
|
+
run_tui
|
|
1539
|
+
;;
|
|
1540
|
+
|
|
1541
|
+
upgrade)
|
|
1542
|
+
while [[ $# -gt 0 ]]; do
|
|
1543
|
+
case "$1" in
|
|
1544
|
+
--dry-run)
|
|
1545
|
+
DRY_RUN=true
|
|
1546
|
+
shift
|
|
1547
|
+
;;
|
|
1548
|
+
-h|--help)
|
|
1549
|
+
usage
|
|
1550
|
+
exit 0
|
|
1551
|
+
;;
|
|
1552
|
+
*)
|
|
1553
|
+
error "Unknown option: $1"
|
|
1554
|
+
usage
|
|
1555
|
+
exit 1
|
|
1556
|
+
;;
|
|
1557
|
+
esac
|
|
1558
|
+
done
|
|
1559
|
+
upgrade_repo_checkout
|
|
1560
|
+
;;
|
|
1561
|
+
|
|
1562
|
+
self-install)
|
|
1563
|
+
while [[ $# -gt 0 ]]; do
|
|
1564
|
+
case "$1" in
|
|
1565
|
+
--bin-dir)
|
|
1566
|
+
SELF_INSTALL_BIN_DIR="$2"
|
|
1567
|
+
shift 2
|
|
1568
|
+
;;
|
|
1569
|
+
--force)
|
|
1570
|
+
SELF_INSTALL_FORCE=true
|
|
1571
|
+
shift
|
|
1572
|
+
;;
|
|
1573
|
+
--install-fzf)
|
|
1574
|
+
SELF_INSTALL_WITH_FZF=true
|
|
1575
|
+
shift
|
|
1576
|
+
;;
|
|
1577
|
+
--theme)
|
|
1578
|
+
parse_theme_option "${2:-}"
|
|
1579
|
+
shift 2
|
|
1580
|
+
;;
|
|
1581
|
+
--theme=*)
|
|
1582
|
+
parse_theme_option "${1#*=}"
|
|
1583
|
+
shift
|
|
1584
|
+
;;
|
|
1585
|
+
--dry-run)
|
|
1586
|
+
DRY_RUN=true
|
|
1587
|
+
shift
|
|
1588
|
+
;;
|
|
1589
|
+
-h|--help)
|
|
1590
|
+
usage
|
|
1591
|
+
exit 0
|
|
1592
|
+
;;
|
|
1593
|
+
*)
|
|
1594
|
+
error "Unknown option: $1"
|
|
1595
|
+
usage
|
|
1596
|
+
exit 1
|
|
1597
|
+
;;
|
|
1598
|
+
esac
|
|
1599
|
+
done
|
|
1600
|
+
set_theme_colors
|
|
1601
|
+
self_install
|
|
1602
|
+
if [[ "$THEME_EXPLICIT" == true ]]; then
|
|
1603
|
+
save_user_config
|
|
1604
|
+
fi
|
|
1605
|
+
;;
|
|
1606
|
+
|
|
1607
|
+
-h|--help)
|
|
1608
|
+
usage
|
|
1609
|
+
;;
|
|
1610
|
+
|
|
1611
|
+
*)
|
|
1612
|
+
usage
|
|
1613
|
+
exit 1
|
|
1614
|
+
;;
|
|
1615
|
+
esac
|