claudecode-omc 5.11.0 → 5.12.0
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/bundled/manifest.json +3 -3
- package/bundled/upstream/anthropic-skills/.omc-source/bundle.json +2 -2
- package/bundled/upstream/anthropic-skills/.omc-source/provenance.json +394 -390
- package/bundled/upstream/anthropic-skills/skills/claude-api/SKILL.md +60 -29
- package/bundled/upstream/anthropic-skills/skills/claude-api/csharp/claude-api.md +46 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/curl/examples.md +2 -2
- package/bundled/upstream/anthropic-skills/skills/claude-api/curl/managed-agents.md +3 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/go/claude-api.md +23 -4
- package/bundled/upstream/anthropic-skills/skills/claude-api/java/claude-api.md +32 -3
- package/bundled/upstream/anthropic-skills/skills/claude-api/php/claude-api.md +27 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/README.md +123 -7
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/batches.md +13 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/files-api.md +7 -2
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/streaming.md +18 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/managed-agents/README.md +9 -7
- package/bundled/upstream/anthropic-skills/skills/claude-api/ruby/claude-api.md +27 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/agent-design.md +1 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/anthropic-cli.md +246 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/claude-platform-on-aws.md +59 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/error-codes.md +24 -4
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/live-sources.md +8 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-api-reference.md +48 -4
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-client-patterns.md +3 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-core.md +15 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-environments.md +10 -6
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-events.md +25 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-onboarding.md +48 -18
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-overview.md +8 -5
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-scheduled-deployments.md +144 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-self-hosted-sandboxes.md +2 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-tools.md +46 -9
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/model-migration.md +259 -3
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/models.md +17 -9
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/prompt-caching.md +55 -3
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/token-counting.md +56 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/tool-use-concepts.md +22 -2
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/README.md +45 -6
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/streaming.md +1 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/managed-agents/README.md +10 -12
- package/bundled/upstream/anthropic-skills/skills/frontend-design/SKILL.md +39 -26
- package/bundled/upstream/ecc/.omc-source/bundle.json +2 -2
- package/bundled/upstream/ecc/.omc-source/manifests/.claude-plugin/marketplace.json +2 -2
- package/bundled/upstream/ecc/.omc-source/provenance.json +602 -550
- package/bundled/upstream/ecc/agents/agent-evaluator.md +206 -0
- package/bundled/upstream/ecc/agents/performance-optimizer.md +9 -9
- package/bundled/upstream/ecc/agents/php-reviewer.md +109 -0
- package/bundled/upstream/ecc/agents/spec-miner.md +217 -0
- package/bundled/upstream/ecc/agents/vue-reviewer.md +206 -0
- package/bundled/upstream/ecc/commands/cost-report.md +58 -84
- package/bundled/upstream/ecc/commands/epic-claim.md +26 -0
- package/bundled/upstream/ecc/commands/epic-decompose.md +23 -0
- package/bundled/upstream/ecc/commands/epic-publish.md +23 -0
- package/bundled/upstream/ecc/commands/epic-review.md +23 -0
- package/bundled/upstream/ecc/commands/epic-sync.md +23 -0
- package/bundled/upstream/ecc/commands/epic-unblock.md +22 -0
- package/bundled/upstream/ecc/commands/epic-validate.md +22 -0
- package/bundled/upstream/ecc/commands/instinct-status.md +8 -8
- package/bundled/upstream/ecc/commands/multi-backend.md +2 -0
- package/bundled/upstream/ecc/commands/multi-execute.md +2 -0
- package/bundled/upstream/ecc/commands/multi-frontend.md +2 -0
- package/bundled/upstream/ecc/commands/multi-plan.md +2 -0
- package/bundled/upstream/ecc/commands/multi-workflow.md +2 -0
- package/bundled/upstream/ecc/commands/orch-add-feature.md +36 -0
- package/bundled/upstream/ecc/commands/orch-build-mvp.md +36 -0
- package/bundled/upstream/ecc/commands/orch-change-feature.md +38 -0
- package/bundled/upstream/ecc/commands/orch-fix-defect.md +38 -0
- package/bundled/upstream/ecc/commands/orch-refine-code.md +39 -0
- package/bundled/upstream/ecc/commands/quality-gate.md +34 -16
- package/bundled/upstream/ecc/commands/vue-review.md +174 -0
- package/bundled/upstream/ecc/skills/accessibility/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/agent-architecture-audit/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/agent-eval/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/agent-harness-construction/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/agent-introspection-debugging/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/agent-payment-x402/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/agent-self-evaluation/SKILL.md +182 -0
- package/bundled/upstream/ecc/skills/agent-self-evaluation/examples/high-score-example.md +87 -0
- package/bundled/upstream/ecc/skills/agent-self-evaluation/examples/low-score-example.md +86 -0
- package/bundled/upstream/ecc/skills/agent-self-evaluation/references/evaluation-criteria.md +71 -0
- package/bundled/upstream/ecc/skills/agent-self-evaluation/references/hook-integration.md +64 -0
- package/bundled/upstream/ecc/skills/agent-self-evaluation/scripts/evaluate.py +408 -0
- package/bundled/upstream/ecc/skills/agent-self-evaluation/templates/evaluation-report.md +86 -0
- package/bundled/upstream/ecc/skills/agent-sort/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/agentic-engineering/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/agentic-os/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/ai-first-engineering/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/ai-regression-testing/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/android-clean-architecture/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/angular-developer/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/api-connector-builder/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/api-design/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/architecture-decision-records/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/article-writing/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/automation-audit-ops/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/autonomous-agent-harness/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/autonomous-loops/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/backend-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/benchmark/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/benchmark-methodology/SKILL.md +190 -0
- package/bundled/upstream/ecc/skills/benchmark-optimization-loop/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/blender-motion-state-inspection/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/blueprint/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/brand-discovery/SKILL.md +145 -0
- package/bundled/upstream/ecc/skills/brand-discovery/references/10_purpose-why.md +40 -0
- package/bundled/upstream/ecc/skills/brand-discovery/references/20_positioning.md +44 -0
- package/bundled/upstream/ecc/skills/brand-discovery/references/30_audience-niche.md +52 -0
- package/bundled/upstream/ecc/skills/brand-discovery/references/40_personality-archetype.md +57 -0
- package/bundled/upstream/ecc/skills/brand-discovery/references/50_voice-tone.md +59 -0
- package/bundled/upstream/ecc/skills/brand-discovery/references/60_narrative-story.md +50 -0
- package/bundled/upstream/ecc/skills/brand-discovery/references/70_founder-tension.md +49 -0
- package/bundled/upstream/ecc/skills/brand-discovery/references/90_SYNTHESIS.md +133 -0
- package/bundled/upstream/ecc/skills/brand-voice/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/browser-qa/SKILL.md +22 -4
- package/bundled/upstream/ecc/skills/bun-runtime/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/canary-watch/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/carrier-relationship-management/SKILL.md +1 -1
- package/bundled/upstream/ecc/skills/cisco-ios-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/ck/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/claude-devfleet/SKILL.md +11 -2
- package/bundled/upstream/ecc/skills/click-path-audit/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/clickhouse-io/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/code-tour/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/codebase-onboarding/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/codehealth-mcp/SKILL.md +167 -0
- package/bundled/upstream/ecc/skills/coding-standards/SKILL.md +4 -2
- package/bundled/upstream/ecc/skills/competitive-platform-analysis/SKILL.md +214 -0
- package/bundled/upstream/ecc/skills/competitive-report-structure/SKILL.md +162 -0
- package/bundled/upstream/ecc/skills/compose-multiplatform-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/config-gc/SKILL.md +120 -0
- package/bundled/upstream/ecc/skills/configure-ecc/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/connections-optimizer/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/content-engine/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/content-hash-cache-pattern/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/context-budget/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/continuous-agent-loop/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/continuous-learning/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/continuous-learning-v2/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/continuous-learning-v2/agents/observer-loop.sh +14 -1
- package/bundled/upstream/ecc/skills/continuous-learning-v2/hooks/observe.sh +31 -7
- package/bundled/upstream/ecc/skills/continuous-learning-v2/scripts/instinct-cli.py +90 -2
- package/bundled/upstream/ecc/skills/continuous-learning-v2/scripts/test_parse_instinct.py +27 -0
- package/bundled/upstream/ecc/skills/cost-aware-llm-pipeline/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/cost-tracking/SKILL.md +58 -108
- package/bundled/upstream/ecc/skills/council/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/cpp-coding-standards/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/cpp-testing/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/crosspost/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/csharp-testing/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/customer-billing-ops/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/customs-trade-compliance/SKILL.md +1 -1
- package/bundled/upstream/ecc/skills/dart-flutter-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/dashboard-builder/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/data-scraper-agent/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/data-throughput-accelerator/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/database-migrations/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/deep-research/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/defi-amm-security/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/deployment-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/design-system/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/django-celery/SKILL.md +3 -2
- package/bundled/upstream/ecc/skills/django-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/django-security/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/django-tdd/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/django-verification/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/dmux-workflows/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/docker-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/documentation-lookup/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/dotnet-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/dynamic-workflow-mode/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/e2e-testing/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/ecc-guide/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/ecc-tools-cost-audit/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/email-ops/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/energy-procurement/SKILL.md +1 -1
- package/bundled/upstream/ecc/skills/enterprise-agent-ops/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/error-handling/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/eval-harness/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/evm-token-decimals/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/exa-search/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/fal-ai-media/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/fastapi-patterns/SKILL.md +375 -188
- package/bundled/upstream/ecc/skills/finance-billing-ops/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/flox-environments/SKILL.md +3 -2
- package/bundled/upstream/ecc/skills/flutter-dart-code-review/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/frontend-a11y/SKILL.md +3 -3
- package/bundled/upstream/ecc/skills/frontend-design-direction/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/frontend-patterns/SKILL.md +23 -8
- package/bundled/upstream/ecc/skills/frontend-slides/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/frontend-slides/scripts/export-pdf.sh +1 -1
- package/bundled/upstream/ecc/skills/fsharp-testing/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/gan-style-harness/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/gateguard/SKILL.md +9 -1
- package/bundled/upstream/ecc/skills/generating-python-installer/SKILL.md +820 -0
- package/bundled/upstream/ecc/skills/git-workflow/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/github-ops/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/golang-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/golang-testing/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/google-workspace-ops/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/healthcare-cdss-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/healthcare-emr-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/healthcare-eval-harness/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/healthcare-phi-compliance/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/hermes-imports/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/hexagonal-architecture/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/hipaa-compliance/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/homelab-network-readiness/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/homelab-network-setup/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/homelab-pihole-dns/SKILL.md +10 -9
- package/bundled/upstream/ecc/skills/homelab-vlan-segmentation/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/homelab-wireguard-vpn/SKILL.md +4 -3
- package/bundled/upstream/ecc/skills/inherit-legacy-style/SKILL.md +157 -0
- package/bundled/upstream/ecc/skills/intent-driven-development/SKILL.md +360 -0
- package/bundled/upstream/ecc/skills/inventory-demand-planning/SKILL.md +1 -1
- package/bundled/upstream/ecc/skills/investor-materials/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/investor-outreach/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/ios-icon-gen/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/iterative-retrieval/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/ito-basket-compare/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/ito-data-atlas-agent/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/ito-market-intelligence/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/ito-trade-planner/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/java-coding-standards/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/jira-integration/SKILL.md +17 -7
- package/bundled/upstream/ecc/skills/jpa-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/knowledge-ops/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/kotlin-coroutines-flows/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/kotlin-exposed-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/kotlin-ktor-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/kotlin-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/kotlin-testing/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/kubernetes-patterns/SKILL.md +756 -0
- package/bundled/upstream/ecc/skills/laravel-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/laravel-plugin-discovery/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/laravel-security/SKILL.md +826 -163
- package/bundled/upstream/ecc/skills/laravel-tdd/SKILL.md +541 -149
- package/bundled/upstream/ecc/skills/laravel-verification/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/latency-critical-systems/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/lead-intelligence/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/llm-trading-agent-security/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/logistics-exception-management/SKILL.md +1 -1
- package/bundled/upstream/ecc/skills/make-interfaces-feel-better/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/manim-video/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/market-research/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/marketing-campaign/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/mcp-server-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/messages-ops/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/ml-adoption-playbook/SKILL.md +57 -0
- package/bundled/upstream/ecc/skills/mle-workflow/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/motion-patterns/SKILL.md +1 -2
- package/bundled/upstream/ecc/skills/motion-ui/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/mysql-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/nanoclaw-repl/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/nestjs-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/netmiko-ssh-automation/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/network-bgp-diagnostics/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/network-config-validation/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/network-interface-health/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/nextjs-turbopack/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/nodejs-keccak256/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/nutrient-document-processing/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/nuxt4-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/openclaw-persona-forge/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/opensource-pipeline/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/orch-add-feature/SKILL.md +45 -0
- package/bundled/upstream/ecc/skills/orch-build-mvp/SKILL.md +49 -0
- package/bundled/upstream/ecc/skills/orch-change-feature/SKILL.md +43 -0
- package/bundled/upstream/ecc/skills/orch-fix-defect/SKILL.md +43 -0
- package/bundled/upstream/ecc/skills/orch-pipeline/SKILL.md +121 -0
- package/bundled/upstream/ecc/skills/orch-refine-code/SKILL.md +44 -0
- package/bundled/upstream/ecc/skills/parallel-execution-optimizer/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/perl-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/perl-security/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/perl-testing/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/plan-orchestrate/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/plankton-code-quality/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/postgres-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/prediction-market-oracle-research/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/prediction-market-risk-review/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/prisma-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/product-capability/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/product-lens/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/production-audit/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/production-scheduling/SKILL.md +1 -1
- package/bundled/upstream/ecc/skills/project-flow-ops/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/prompt-optimizer/SKILL.md +1 -1
- package/bundled/upstream/ecc/skills/python-patterns/SKILL.md +4 -3
- package/bundled/upstream/ecc/skills/python-testing/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/pytorch-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/quality-nonconformance/SKILL.md +1 -1
- package/bundled/upstream/ecc/skills/quarkus-patterns/SKILL.md +51 -50
- package/bundled/upstream/ecc/skills/quarkus-security/SKILL.md +25 -24
- package/bundled/upstream/ecc/skills/quarkus-tdd/SKILL.md +73 -72
- package/bundled/upstream/ecc/skills/quarkus-verification/SKILL.md +8 -7
- package/bundled/upstream/ecc/skills/ralphinho-rfc-pipeline/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/react-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/react-performance/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/react-testing/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/recsys-pipeline-architect/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/recursive-decision-ledger/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/redis-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/regex-vs-llm-structured-text/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/repo-scan/SKILL.md +64 -63
- package/bundled/upstream/ecc/skills/research-ops/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/returns-reverse-logistics/SKILL.md +1 -1
- package/bundled/upstream/ecc/skills/rules-distill/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/rust-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/rust-testing/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/safety-guard/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/santa-method/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/scientific-db-pubmed-database/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/scientific-db-uspto-database/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/scientific-pkg-gget/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/scientific-thinking-literature-review/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/scientific-thinking-scholar-evaluation/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/search-first/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/security-bounty-hunter/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/security-review/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/security-scan/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/seo/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/skill-comply/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/skill-comply/scripts/runner.py +8 -0
- package/bundled/upstream/ecc/skills/skill-scout/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/skill-stocktake/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/social-graph-ranker/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/social-publisher/SKILL.md +17 -2
- package/bundled/upstream/ecc/skills/springboot-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/springboot-security/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/springboot-tdd/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/springboot-verification/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/strategic-compact/SKILL.md +10 -5
- package/bundled/upstream/ecc/skills/swift-actor-persistence/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/swift-protocol-di-testing/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/taste/SKILL.md +264 -0
- package/bundled/upstream/ecc/skills/taste/references/genre-taxonomy.md +87 -0
- package/bundled/upstream/ecc/skills/tdd-workflow/SKILL.md +64 -1
- package/bundled/upstream/ecc/skills/team-agent-orchestration/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/team-builder/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/terminal-ops/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/tinystruct-patterns/SKILL.md +77 -1
- package/bundled/upstream/ecc/skills/token-budget-advisor/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/ui-demo/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/ui-to-vue/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/uncloud/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/unified-notifications-ops/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/verification-loop/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/video-editing/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/videodb/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/vite-patterns/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/vue-patterns/SKILL.md +471 -0
- package/bundled/upstream/ecc/skills/windows-desktop-e2e/SKILL.md +9 -8
- package/bundled/upstream/ecc/skills/workspace-surface-audit/SKILL.md +2 -1
- package/bundled/upstream/ecc/skills/x-api/SKILL.md +2 -1
- package/bundled/upstream/impeccable/.omc-source/bundle.json +2 -2
- package/bundled/upstream/impeccable/.omc-source/provenance.json +30 -25
- package/bundled/upstream/impeccable/skills/impeccable/SKILL.md +2 -2
- package/bundled/upstream/impeccable/skills/impeccable/reference/hooks.md +10 -8
- package/bundled/upstream/impeccable/skills/impeccable/reference/live.md +1 -1
- package/bundled/upstream/impeccable/skills/impeccable/scripts/context.mjs +707 -26
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/browser/injected/index.mjs +202 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/cli/main.mjs +57 -11
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/design-system.mjs +750 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +231 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/detect-antipatterns.mjs +7 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +29 -4
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +20 -4
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +2 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +27 -1
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/registry/antipatterns.mjs +29 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/shared/inline-ignores.mjs +148 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/hook-admin.mjs +135 -48
- package/bundled/upstream/impeccable/skills/impeccable/scripts/hook-before-edit.mjs +5 -2
- package/bundled/upstream/impeccable/skills/impeccable/scripts/hook-lib.mjs +375 -29
- package/bundled/upstream/impeccable/skills/impeccable/scripts/lib/design-parser.mjs +8 -1
- package/bundled/upstream/impeccable/skills/impeccable/scripts/lib/impeccable-config.mjs +638 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/lib/impeccable-paths.mjs +37 -35
- package/bundled/upstream/impeccable/skills/impeccable/scripts/lib/target-args.mjs +42 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-browser.js +159 -72
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-poll.mjs +16 -11
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-server.mjs +9 -8
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-target.mjs +30 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-wrap.mjs +1 -1
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live.mjs +72 -21
- package/bundled/upstream/oh-my-claudecode/.omc-source/bundle.json +2 -2
- package/bundled/upstream/oh-my-claudecode/.omc-source/provenance.json +103 -103
- package/bundled/upstream/oh-my-claudecode/agents/analyst.md +6 -0
- package/bundled/upstream/oh-my-claudecode/agents/architect.md +6 -0
- package/bundled/upstream/oh-my-claudecode/agents/code-reviewer.md +6 -0
- package/bundled/upstream/oh-my-claudecode/agents/critic.md +6 -0
- package/bundled/upstream/oh-my-claudecode/agents/debugger.md +6 -0
- package/bundled/upstream/oh-my-claudecode/agents/security-reviewer.md +6 -0
- package/bundled/upstream/oh-my-claudecode/agents/tracer.md +6 -0
- package/bundled/upstream/oh-my-claudecode/agents/verifier.md +7 -0
- package/bundled/upstream/oh-my-claudecode/hooks/hooks.json +9 -2
- package/bundled/upstream/oh-my-claudecode/skills/ask/SKILL.md +15 -4
- package/bundled/upstream/oh-my-claudecode/skills/autopilot/SKILL.md +30 -1
- package/bundled/upstream/oh-my-claudecode/skills/cancel/SKILL.md +29 -35
- package/bundled/upstream/oh-my-claudecode/skills/ccg/SKILL.md +20 -9
- package/bundled/upstream/oh-my-claudecode/skills/configure-notifications/SKILL.md +2 -2
- package/bundled/upstream/oh-my-claudecode/skills/omc-reference/SKILL.md +6 -4
- package/bundled/upstream/oh-my-claudecode/skills/omc-setup/phases/02-configure.md +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/omc-setup/phases/03-integrations.md +2 -1
- package/bundled/upstream/oh-my-claudecode/skills/omc-setup/phases/04-welcome.md +2 -2
- package/bundled/upstream/oh-my-claudecode/skills/omc-teams/SKILL.md +29 -18
- package/bundled/upstream/oh-my-claudecode/skills/team/SKILL.md +127 -165
- package/bundled/upstream/superpowers/.omc-source/bundle.json +2 -2
- package/bundled/upstream/superpowers/.omc-source/provenance.json +59 -52
- package/bundled/upstream/superpowers/hooks/hooks-codex.json +16 -0
- package/bundled/upstream/superpowers/hooks/session-start +4 -12
- package/bundled/upstream/superpowers/hooks/session-start-codex +26 -0
- package/bundled/upstream/superpowers/skills/brainstorming/SKILL.md +5 -10
- package/bundled/upstream/superpowers/skills/brainstorming/scripts/frame-template.html +25 -26
- package/bundled/upstream/superpowers/skills/brainstorming/scripts/helper.js +101 -22
- package/bundled/upstream/superpowers/skills/brainstorming/scripts/server.cjs +399 -30
- package/bundled/upstream/superpowers/skills/brainstorming/scripts/start-server.sh +70 -9
- package/bundled/upstream/superpowers/skills/brainstorming/scripts/stop-server.sh +66 -2
- package/bundled/upstream/superpowers/skills/brainstorming/spec-document-reviewer-prompt.md +1 -1
- package/bundled/upstream/superpowers/skills/brainstorming/visual-companion.md +33 -22
- package/bundled/upstream/superpowers/skills/dispatching-parallel-agents/SKILL.md +9 -6
- package/bundled/upstream/superpowers/skills/executing-plans/SKILL.md +2 -2
- package/bundled/upstream/superpowers/skills/finishing-a-development-branch/SKILL.md +2 -12
- package/bundled/upstream/superpowers/skills/receiving-code-review/SKILL.md +2 -2
- package/bundled/upstream/superpowers/skills/requesting-code-review/SKILL.md +2 -2
- package/bundled/upstream/superpowers/skills/requesting-code-review/code-reviewer.md +15 -11
- package/bundled/upstream/superpowers/skills/subagent-driven-development/SKILL.md +206 -67
- package/bundled/upstream/superpowers/skills/subagent-driven-development/implementer-prompt.md +30 -4
- package/bundled/upstream/superpowers/skills/subagent-driven-development/scripts/review-package +44 -0
- package/bundled/upstream/superpowers/skills/subagent-driven-development/scripts/sdd-workspace +22 -0
- package/bundled/upstream/superpowers/skills/subagent-driven-development/scripts/task-brief +40 -0
- package/bundled/upstream/superpowers/skills/subagent-driven-development/task-reviewer-prompt.md +188 -0
- package/bundled/upstream/superpowers/skills/systematic-debugging/SKILL.md +1 -1
- package/bundled/upstream/superpowers/skills/test-driven-development/SKILL.md +1 -1
- package/bundled/upstream/superpowers/skills/using-git-worktrees/SKILL.md +9 -22
- package/bundled/upstream/superpowers/skills/using-superpowers/SKILL.md +19 -15
- package/bundled/upstream/superpowers/skills/using-superpowers/references/antigravity-tools.md +96 -0
- package/bundled/upstream/superpowers/skills/using-superpowers/references/claude-code-tools.md +50 -0
- package/bundled/upstream/superpowers/skills/using-superpowers/references/codex-tools.md +25 -12
- package/bundled/upstream/superpowers/skills/using-superpowers/references/copilot-tools.md +27 -20
- package/bundled/upstream/superpowers/skills/using-superpowers/references/gemini-tools.md +44 -32
- package/bundled/upstream/superpowers/skills/using-superpowers/references/pi-tools.md +28 -0
- package/bundled/upstream/superpowers/skills/writing-plans/SKILL.md +22 -0
- package/bundled/upstream/superpowers/skills/writing-plans/plan-document-reviewer-prompt.md +1 -1
- package/bundled/upstream/superpowers/skills/writing-skills/SKILL.md +52 -18
- package/bundled/upstream/superpowers/skills/writing-skills/anthropic-best-practices.md +88 -88
- package/bundled/upstream/superpowers/skills/writing-skills/persuasion-principles.md +3 -3
- package/package.json +1 -1
- package/bundled/upstream/superpowers/skills/subagent-driven-development/code-quality-reviewer-prompt.md +0 -25
- package/bundled/upstream/superpowers/skills/subagent-driven-development/spec-reviewer-prompt.md +0 -61
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
* init flow.
|
|
6
6
|
*
|
|
7
7
|
* Path resolution (first match wins):
|
|
8
|
-
* 1.
|
|
9
|
-
* 2. .agents/context/ then docs/
|
|
10
|
-
* 3.
|
|
8
|
+
* 1. Active project root, if PRODUCT.md or DESIGN.md is there
|
|
9
|
+
* 2. Active project .agents/context/ then docs/
|
|
10
|
+
* 3. Monorepo root context, using the same order, as a per-file fallback
|
|
11
|
+
* 4. $IMPECCABLE_CONTEXT_DIR (absolute or cwd-relative) — power-user
|
|
11
12
|
* escape hatch, only consulted when defaults are empty
|
|
12
|
-
*
|
|
13
|
+
* 5. Active project root as a "nothing found" default
|
|
13
14
|
*
|
|
14
15
|
* `resolveContextDir()` and `loadContext()` are also exported for the
|
|
15
16
|
* server-side scripts (live.mjs, live-server.mjs) that need the structured
|
|
@@ -19,10 +20,25 @@ import fs from 'node:fs';
|
|
|
19
20
|
import os from 'node:os';
|
|
20
21
|
import path from 'node:path';
|
|
21
22
|
import { fileURLToPath } from 'node:url';
|
|
23
|
+
import { parseTargetOptions } from './lib/target-args.mjs';
|
|
22
24
|
|
|
23
25
|
const PRODUCT_NAMES = ['PRODUCT.md', 'Product.md', 'product.md'];
|
|
24
26
|
const DESIGN_NAMES = ['DESIGN.md', 'Design.md', 'design.md'];
|
|
25
27
|
const FALLBACK_DIRS = ['.agents/context', 'docs'];
|
|
28
|
+
const MONOREPO_MARKER_FILES = ['pnpm-workspace.yaml', 'turbo.json', 'nx.json', 'lerna.json'];
|
|
29
|
+
const MONOREPO_FALLBACK_PROJECT_DIRS = ['apps', 'packages'];
|
|
30
|
+
const WORKSPACE_DISCOVERY_IGNORED_DIRS = new Set([
|
|
31
|
+
'node_modules',
|
|
32
|
+
'.git',
|
|
33
|
+
'dist',
|
|
34
|
+
'build',
|
|
35
|
+
'.next',
|
|
36
|
+
'.nuxt',
|
|
37
|
+
'.svelte-kit',
|
|
38
|
+
'.turbo',
|
|
39
|
+
'.cache',
|
|
40
|
+
'coverage',
|
|
41
|
+
]);
|
|
26
42
|
|
|
27
43
|
// ─── Update check ──────────────────────────────────────────────────────────
|
|
28
44
|
// Piggyback a lightweight skill-version check on the once-per-session boot.
|
|
@@ -38,41 +54,623 @@ const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000; // throttle the network poll to o
|
|
|
38
54
|
const RENOTIFY_INTERVAL_MS = 7 * 24 * 60 * 60 * 1000; // don't re-surface the same version for a week
|
|
39
55
|
const FETCH_TIMEOUT_MS = 1200;
|
|
40
56
|
|
|
41
|
-
export function resolveContextDir(cwd = process.cwd()) {
|
|
42
|
-
|
|
43
|
-
|
|
57
|
+
export function resolveContextDir(cwd = process.cwd(), options = {}) {
|
|
58
|
+
return resolveContext(cwd, options).contextDir;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function loadContext(cwd = process.cwd(), options = {}) {
|
|
62
|
+
const resolved = resolveContext(cwd, options);
|
|
63
|
+
const absCwd = path.resolve(cwd);
|
|
64
|
+
const productPath = resolved.productPath;
|
|
65
|
+
const designPath = resolved.designPath;
|
|
66
|
+
const product = productPath ? safeRead(productPath) : null;
|
|
67
|
+
const design = designPath ? safeRead(designPath) : null;
|
|
68
|
+
return {
|
|
69
|
+
hasProduct: !!product,
|
|
70
|
+
product,
|
|
71
|
+
productPath: productPath ? path.relative(absCwd, productPath) : null,
|
|
72
|
+
hasDesign: !!design,
|
|
73
|
+
design,
|
|
74
|
+
designPath: designPath ? path.relative(absCwd, designPath) : null,
|
|
75
|
+
contextDir: resolved.contextDir,
|
|
76
|
+
productContextDir: productPath ? path.dirname(productPath) : null,
|
|
77
|
+
designContextDir: designPath ? path.dirname(designPath) : null,
|
|
78
|
+
projectRoot: resolved.projectRoot,
|
|
79
|
+
repoRoot: resolved.repoRoot,
|
|
80
|
+
isMonorepo: resolved.isMonorepo,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function resolveContext(cwd = process.cwd(), options = {}) {
|
|
85
|
+
const absCwd = path.resolve(cwd);
|
|
86
|
+
const project = resolveProject(absCwd, options);
|
|
87
|
+
const projectContextDir = resolveLocalContextDir(project.projectRoot);
|
|
88
|
+
const rootContextDir = project.isMonorepo && project.repoRoot !== project.projectRoot
|
|
89
|
+
? resolveLocalContextDir(project.repoRoot)
|
|
90
|
+
: null;
|
|
91
|
+
|
|
92
|
+
let productPath =
|
|
93
|
+
(projectContextDir ? firstExisting(projectContextDir, PRODUCT_NAMES) : null)
|
|
94
|
+
|| (rootContextDir ? firstExisting(rootContextDir, PRODUCT_NAMES) : null);
|
|
95
|
+
let designPath =
|
|
96
|
+
(projectContextDir ? firstExisting(projectContextDir, DESIGN_NAMES) : null)
|
|
97
|
+
|| (rootContextDir ? firstExisting(rootContextDir, DESIGN_NAMES) : null);
|
|
98
|
+
|
|
99
|
+
let envContextDir = null;
|
|
100
|
+
if (!productPath && !designPath) {
|
|
101
|
+
envContextDir = resolveEnvContextDir(absCwd);
|
|
102
|
+
if (envContextDir) {
|
|
103
|
+
productPath = firstExisting(envContextDir, PRODUCT_NAMES);
|
|
104
|
+
designPath = firstExisting(envContextDir, DESIGN_NAMES);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
contextDir: productPath
|
|
110
|
+
? path.dirname(productPath)
|
|
111
|
+
: designPath
|
|
112
|
+
? path.dirname(designPath)
|
|
113
|
+
: envContextDir || project.projectRoot,
|
|
114
|
+
productPath,
|
|
115
|
+
designPath,
|
|
116
|
+
projectRoot: project.projectRoot,
|
|
117
|
+
repoRoot: project.repoRoot,
|
|
118
|
+
isMonorepo: project.isMonorepo,
|
|
119
|
+
targetDir: project.targetDir,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function resolveProjectRoot(cwd = process.cwd(), options = {}) {
|
|
124
|
+
return resolveProject(cwd, options).projectRoot;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function resolveTargetSelection(cwd = process.cwd(), options = {}) {
|
|
128
|
+
if (hasTargetOption(options)) return null;
|
|
129
|
+
const project = resolveProject(cwd);
|
|
130
|
+
if (
|
|
131
|
+
!project.isMonorepo
|
|
132
|
+
|| !project.projectRoot
|
|
133
|
+
|| !project.repoRoot
|
|
134
|
+
|| path.resolve(project.projectRoot) !== path.resolve(project.repoRoot)
|
|
135
|
+
) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
const targetCandidates = discoverTargetCandidates(project.repoRoot);
|
|
139
|
+
// No discoverable child apps (e.g. `workspaces: ["."]`, a root-only workspace,
|
|
140
|
+
// or a marker file with no apps/packages children): there is nothing to choose,
|
|
141
|
+
// so treat the repo root as the active project rather than blocking on an empty
|
|
142
|
+
// selection prompt that the user cannot answer.
|
|
143
|
+
if (targetCandidates.length === 0) return null;
|
|
144
|
+
return {
|
|
145
|
+
targetPath: null,
|
|
146
|
+
projectRoot: project.projectRoot,
|
|
147
|
+
repoRoot: project.repoRoot,
|
|
148
|
+
targetCandidates,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function resolveProject(cwd = process.cwd(), options = {}) {
|
|
153
|
+
const absCwd = path.resolve(cwd);
|
|
154
|
+
const targetDir = resolveTargetDir(absCwd, options);
|
|
155
|
+
let repoRoot = findMonorepoRoot(targetDir);
|
|
156
|
+
if (!repoRoot && targetDir !== absCwd) {
|
|
157
|
+
const cwdRepoRoot = findMonorepoRoot(absCwd);
|
|
158
|
+
if (cwdRepoRoot && isPathInside(targetDir, cwdRepoRoot)) {
|
|
159
|
+
repoRoot = cwdRepoRoot;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (!repoRoot) {
|
|
163
|
+
return {
|
|
164
|
+
targetDir,
|
|
165
|
+
projectRoot: absCwd,
|
|
166
|
+
repoRoot: absCwd,
|
|
167
|
+
isMonorepo: false,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
targetDir,
|
|
172
|
+
projectRoot: resolveWorkspaceProjectRoot(repoRoot, targetDir) || repoRoot,
|
|
173
|
+
repoRoot,
|
|
174
|
+
isMonorepo: true,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function isPathInside(candidate, root) {
|
|
179
|
+
const rel = path.relative(root, candidate);
|
|
180
|
+
return !!rel && !rel.startsWith('..') && !path.isAbsolute(rel);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function resolveLocalContextDir(root) {
|
|
184
|
+
if (firstExisting(root, [...PRODUCT_NAMES, ...DESIGN_NAMES])) {
|
|
185
|
+
return root;
|
|
44
186
|
}
|
|
45
187
|
for (const rel of FALLBACK_DIRS) {
|
|
46
|
-
const candidate = path.resolve(
|
|
188
|
+
const candidate = path.resolve(root, rel);
|
|
47
189
|
if (firstExisting(candidate, [...PRODUCT_NAMES, ...DESIGN_NAMES])) {
|
|
48
190
|
return candidate;
|
|
49
191
|
}
|
|
50
192
|
}
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function resolveEnvContextDir(cwd) {
|
|
51
197
|
const envDir = process.env.IMPECCABLE_CONTEXT_DIR;
|
|
52
|
-
if (envDir
|
|
53
|
-
|
|
54
|
-
|
|
198
|
+
if (!envDir || !envDir.trim()) return null;
|
|
199
|
+
const trimmed = envDir.trim();
|
|
200
|
+
return path.isAbsolute(trimmed) ? trimmed : path.resolve(cwd, trimmed);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function resolveTargetDir(cwd, options = {}) {
|
|
204
|
+
const targetPath = options && typeof options === 'object' ? options.targetPath : null;
|
|
205
|
+
if (!targetPath || !String(targetPath).trim()) return cwd;
|
|
206
|
+
const abs = path.isAbsolute(targetPath) ? targetPath : path.resolve(cwd, targetPath);
|
|
207
|
+
try {
|
|
208
|
+
const stat = fs.statSync(abs);
|
|
209
|
+
return stat.isDirectory() ? abs : path.dirname(abs);
|
|
210
|
+
} catch {
|
|
211
|
+
return path.extname(abs) ? path.dirname(abs) : abs;
|
|
55
212
|
}
|
|
56
|
-
return cwd;
|
|
57
213
|
}
|
|
58
214
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
215
|
+
function findMonorepoRoot(startDir) {
|
|
216
|
+
let dir = path.resolve(startDir);
|
|
217
|
+
const homeDir = path.resolve(os.homedir());
|
|
218
|
+
while (true) {
|
|
219
|
+
if (dir === homeDir) return null;
|
|
220
|
+
// isMonorepoRoot is checked before hasGitBoundary on purpose: a workspace
|
|
221
|
+
// root that also carries its own .git is still recognized. The trade-off is
|
|
222
|
+
// deliberate — a directory with a monorepo *marker* but no workspace patterns
|
|
223
|
+
// and no apps/packages children is not a monorepo root, so its .git stops
|
|
224
|
+
// traversal and a further-up root is not searched. The nested .git is treated
|
|
225
|
+
// as an independent project boundary, which is the intended isolation.
|
|
226
|
+
if (isMonorepoRoot(dir)) return dir;
|
|
227
|
+
if (hasGitBoundary(dir)) return null;
|
|
228
|
+
const parent = path.dirname(dir);
|
|
229
|
+
if (parent === dir) return null;
|
|
230
|
+
dir = parent;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function isMonorepoRoot(dir) {
|
|
235
|
+
if (readWorkspacePatterns(dir).some((pattern) => !normalizeWorkspacePattern(pattern).startsWith('!'))) return true;
|
|
236
|
+
if (!MONOREPO_MARKER_FILES.some((file) => fs.existsSync(path.join(dir, file)))) return false;
|
|
237
|
+
return hasFallbackWorkspaceChildren(dir);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function hasGitBoundary(dir) {
|
|
241
|
+
return fs.existsSync(path.join(dir, '.git'));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function hasFallbackWorkspaceChildren(dir) {
|
|
245
|
+
for (const name of MONOREPO_FALLBACK_PROJECT_DIRS) {
|
|
246
|
+
const base = path.join(dir, name);
|
|
247
|
+
let entries;
|
|
248
|
+
try {
|
|
249
|
+
entries = fs.readdirSync(base, { withFileTypes: true });
|
|
250
|
+
} catch {
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
if (entries.some((entry) => entry.isDirectory() && !isIgnoredWorkspaceDiscoveryDir(entry.name))) return true;
|
|
254
|
+
}
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function discoverTargetCandidates(repoRoot) {
|
|
259
|
+
const roots = new Map();
|
|
260
|
+
const patterns = readWorkspacePatterns(repoRoot);
|
|
261
|
+
for (const pattern of patterns) {
|
|
262
|
+
for (const root of discoverRootsForPattern(repoRoot, pattern)) {
|
|
263
|
+
roots.set(path.relative(repoRoot, root).split(path.sep).join('/'), root);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (MONOREPO_MARKER_FILES.some((file) => fs.existsSync(path.join(repoRoot, file)))) {
|
|
267
|
+
for (const name of MONOREPO_FALLBACK_PROJECT_DIRS) {
|
|
268
|
+
const base = path.join(repoRoot, name);
|
|
269
|
+
let entries;
|
|
270
|
+
try {
|
|
271
|
+
entries = fs.readdirSync(base, { withFileTypes: true });
|
|
272
|
+
} catch {
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
for (const entry of entries) {
|
|
276
|
+
if (!entry.isDirectory() || isIgnoredWorkspaceDiscoveryDir(entry.name)) continue;
|
|
277
|
+
const root = path.join(base, entry.name);
|
|
278
|
+
roots.set(path.relative(repoRoot, root).split(path.sep).join('/'), root);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return [...roots.entries()]
|
|
283
|
+
.filter(([rel]) => rel && !rel.startsWith('..'))
|
|
284
|
+
// Honor negated workspace patterns (e.g. "!packages/internal"). resolveWorkspaceProjectRoot
|
|
285
|
+
// sends an excluded package back to the repo root, so an excluded folder must not appear as a
|
|
286
|
+
// selectable target — choosing it would silently resolve to the root instead.
|
|
287
|
+
.filter(([rel]) => !isExcludedByWorkspacePattern(rel.split('/').filter(Boolean), patterns))
|
|
288
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
289
|
+
.map(([rel, root]) => {
|
|
290
|
+
const targetExample = findTargetExample(repoRoot, root);
|
|
291
|
+
return {
|
|
292
|
+
name: path.basename(root),
|
|
293
|
+
path: rel,
|
|
294
|
+
targetExample,
|
|
295
|
+
...resolveCandidateContextSummary(repoRoot, root, targetExample),
|
|
296
|
+
};
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function resolveCandidateContextSummary(repoRoot, projectRoot, targetPath) {
|
|
301
|
+
const ctx = resolveContext(repoRoot, { targetPath });
|
|
65
302
|
return {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
design,
|
|
71
|
-
designPath: designPath ? path.relative(cwd, designPath) : null,
|
|
72
|
-
contextDir,
|
|
303
|
+
productStatus: contextSourceStatus(ctx.productPath, repoRoot, projectRoot),
|
|
304
|
+
productPath: contextSourcePath(ctx.productPath, repoRoot),
|
|
305
|
+
designStatus: contextSourceStatus(ctx.designPath, repoRoot, projectRoot),
|
|
306
|
+
designPath: contextSourcePath(ctx.designPath, repoRoot),
|
|
73
307
|
};
|
|
74
308
|
}
|
|
75
309
|
|
|
310
|
+
// Selection candidates surface one of four statuses: 'child' (a canonical
|
|
311
|
+
// PRODUCT.md/DESIGN.md directly in the app root), 'inherited' (resolved from the
|
|
312
|
+
// repo root in a monorepo), 'missing' (no file found), and 'fallback'. 'fallback'
|
|
313
|
+
// intentionally covers two non-canonical locations: a file inside the project
|
|
314
|
+
// root but in a subdirectory (FALLBACK_DIRS, e.g. `.agents/context/`), and a file
|
|
315
|
+
// outside both the project and repo roots (IMPECCABLE_CONTEXT_DIR override).
|
|
316
|
+
function contextSourceStatus(filePath, repoRoot, projectRoot) {
|
|
317
|
+
if (!filePath) return 'missing';
|
|
318
|
+
const absPath = path.resolve(filePath);
|
|
319
|
+
const absProjectRoot = path.resolve(projectRoot);
|
|
320
|
+
const absRepoRoot = path.resolve(repoRoot);
|
|
321
|
+
if (isPathInsideOrEqual(absPath, absProjectRoot)) {
|
|
322
|
+
return path.dirname(absPath) === absProjectRoot ? 'child' : 'fallback';
|
|
323
|
+
}
|
|
324
|
+
if (absProjectRoot !== absRepoRoot && isPathInsideOrEqual(absPath, absRepoRoot)) {
|
|
325
|
+
return 'inherited';
|
|
326
|
+
}
|
|
327
|
+
return 'fallback';
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function contextSourcePath(filePath, repoRoot) {
|
|
331
|
+
if (!filePath) return null;
|
|
332
|
+
const rel = path.relative(repoRoot, filePath);
|
|
333
|
+
if (rel && !rel.startsWith('..') && !path.isAbsolute(rel)) {
|
|
334
|
+
return rel.split(path.sep).join('/');
|
|
335
|
+
}
|
|
336
|
+
return filePath;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function discoverRootsForPattern(repoRoot, rawPattern) {
|
|
340
|
+
const pattern = normalizeWorkspacePattern(rawPattern);
|
|
341
|
+
if (!pattern || pattern.startsWith('!')) return [];
|
|
342
|
+
const segments = pattern.split('/').filter(Boolean);
|
|
343
|
+
if (!segments.length) return [];
|
|
344
|
+
const firstGlobIndex = segments.findIndex((segment) => segment.includes('*'));
|
|
345
|
+
const literalPrefix = firstGlobIndex === -1 ? segments : segments.slice(0, firstGlobIndex);
|
|
346
|
+
const base = path.join(repoRoot, ...literalPrefix);
|
|
347
|
+
if (!fs.existsSync(base)) return [];
|
|
348
|
+
if (segments.includes('**')) {
|
|
349
|
+
const packageRoots = [];
|
|
350
|
+
walkDirs(base, (dir) => {
|
|
351
|
+
if (dir !== base && isCandidateProjectRoot(dir)) packageRoots.push(dir);
|
|
352
|
+
});
|
|
353
|
+
if (packageRoots.length) return packageRoots;
|
|
354
|
+
return directChildDirs(base);
|
|
355
|
+
}
|
|
356
|
+
return expandSimplePattern(repoRoot, segments);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function expandSimplePattern(repoRoot, patternSegments, index = 0, current = repoRoot) {
|
|
360
|
+
if (index >= patternSegments.length) return fs.existsSync(current) ? [current] : [];
|
|
361
|
+
const segment = patternSegments[index];
|
|
362
|
+
if (!segment.includes('*')) {
|
|
363
|
+
return expandSimplePattern(repoRoot, patternSegments, index + 1, path.join(current, segment));
|
|
364
|
+
}
|
|
365
|
+
let entries;
|
|
366
|
+
try {
|
|
367
|
+
entries = fs.readdirSync(current, { withFileTypes: true });
|
|
368
|
+
} catch {
|
|
369
|
+
return [];
|
|
370
|
+
}
|
|
371
|
+
const roots = [];
|
|
372
|
+
for (const entry of entries) {
|
|
373
|
+
if (!entry.isDirectory() || isIgnoredWorkspaceDiscoveryDir(entry.name)) continue;
|
|
374
|
+
if (!segmentMatches(segment, entry.name)) continue;
|
|
375
|
+
roots.push(...expandSimplePattern(repoRoot, patternSegments, index + 1, path.join(current, entry.name)));
|
|
376
|
+
}
|
|
377
|
+
return roots;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
function directChildDirs(dir) {
|
|
381
|
+
try {
|
|
382
|
+
return fs.readdirSync(dir, { withFileTypes: true })
|
|
383
|
+
.filter((entry) => entry.isDirectory() && !isIgnoredWorkspaceDiscoveryDir(entry.name))
|
|
384
|
+
.map((entry) => path.join(dir, entry.name));
|
|
385
|
+
} catch {
|
|
386
|
+
return [];
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function walkDirs(root, visit) {
|
|
391
|
+
let entries;
|
|
392
|
+
try {
|
|
393
|
+
entries = fs.readdirSync(root, { withFileTypes: true });
|
|
394
|
+
} catch {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
for (const entry of entries) {
|
|
398
|
+
if (!entry.isDirectory() || isIgnoredWorkspaceDiscoveryDir(entry.name)) continue;
|
|
399
|
+
const dir = path.join(root, entry.name);
|
|
400
|
+
visit(dir);
|
|
401
|
+
walkDirs(dir, visit);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function isCandidateProjectRoot(dir) {
|
|
406
|
+
return !!(
|
|
407
|
+
fs.existsSync(path.join(dir, 'package.json'))
|
|
408
|
+
|| firstExisting(dir, [...PRODUCT_NAMES, ...DESIGN_NAMES])
|
|
409
|
+
|| fs.existsSync(path.join(dir, 'src'))
|
|
410
|
+
|| fs.existsSync(path.join(dir, 'app'))
|
|
411
|
+
|| fs.existsSync(path.join(dir, 'pages'))
|
|
412
|
+
|| fs.existsSync(path.join(dir, 'public'))
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function isIgnoredWorkspaceDiscoveryDir(name) {
|
|
417
|
+
return name.startsWith('.') || WORKSPACE_DISCOVERY_IGNORED_DIRS.has(name);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
function findTargetExample(repoRoot, projectRoot) {
|
|
421
|
+
const examples = [
|
|
422
|
+
'src/App.jsx',
|
|
423
|
+
'src/App.tsx',
|
|
424
|
+
'src/main.jsx',
|
|
425
|
+
'src/main.tsx',
|
|
426
|
+
'src/index.jsx',
|
|
427
|
+
'src/index.ts',
|
|
428
|
+
'app/page.tsx',
|
|
429
|
+
'pages/index.tsx',
|
|
430
|
+
'public/index.html',
|
|
431
|
+
];
|
|
432
|
+
for (const rel of examples) {
|
|
433
|
+
const abs = path.join(projectRoot, rel);
|
|
434
|
+
if (fs.existsSync(abs)) return path.relative(repoRoot, abs).split(path.sep).join('/');
|
|
435
|
+
}
|
|
436
|
+
return path.relative(repoRoot, projectRoot).split(path.sep).join('/');
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function resolveWorkspaceProjectRoot(repoRoot, targetDir) {
|
|
440
|
+
const rel = path.relative(repoRoot, targetDir);
|
|
441
|
+
if (!rel || rel.startsWith('..') || path.isAbsolute(rel)) return repoRoot;
|
|
442
|
+
const relSegments = rel.split(path.sep).filter(Boolean);
|
|
443
|
+
const patterns = readWorkspacePatterns(repoRoot);
|
|
444
|
+
const excluded = isExcludedByWorkspacePattern(relSegments, patterns);
|
|
445
|
+
if (!excluded) {
|
|
446
|
+
for (const pattern of patterns) {
|
|
447
|
+
const projectRoot = projectRootFromWorkspacePattern(repoRoot, relSegments, pattern);
|
|
448
|
+
if (projectRoot) return projectRoot;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
if (excluded) return repoRoot;
|
|
452
|
+
if (
|
|
453
|
+
relSegments.length >= 2
|
|
454
|
+
&& MONOREPO_FALLBACK_PROJECT_DIRS.includes(relSegments[0])
|
|
455
|
+
) {
|
|
456
|
+
return path.join(repoRoot, relSegments[0], relSegments[1]);
|
|
457
|
+
}
|
|
458
|
+
const nearest = nearestProjectLikeRoot(repoRoot, targetDir);
|
|
459
|
+
if (nearest) return nearest;
|
|
460
|
+
return repoRoot;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function isExcludedByWorkspacePattern(relSegments, patterns) {
|
|
464
|
+
return patterns.some((rawPattern) => {
|
|
465
|
+
const pattern = normalizeWorkspacePattern(rawPattern);
|
|
466
|
+
if (!pattern.startsWith('!')) return false;
|
|
467
|
+
return workspacePatternMatchesRel(pattern.slice(1), relSegments);
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
function nearestProjectLikeRoot(repoRoot, targetDir) {
|
|
472
|
+
let dir = path.resolve(targetDir);
|
|
473
|
+
const stop = path.resolve(repoRoot);
|
|
474
|
+
while (dir && dir !== stop) {
|
|
475
|
+
if (
|
|
476
|
+
firstExisting(dir, [...PRODUCT_NAMES, ...DESIGN_NAMES])
|
|
477
|
+
|| fs.existsSync(path.join(dir, 'package.json'))
|
|
478
|
+
) {
|
|
479
|
+
return dir;
|
|
480
|
+
}
|
|
481
|
+
const parent = path.dirname(dir);
|
|
482
|
+
if (parent === dir) break;
|
|
483
|
+
dir = parent;
|
|
484
|
+
}
|
|
485
|
+
return null;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
function nearestPackageRootBetween(repoRoot, targetDir, stopDir) {
|
|
489
|
+
let dir = path.resolve(targetDir);
|
|
490
|
+
const stop = path.resolve(stopDir || repoRoot);
|
|
491
|
+
const root = path.resolve(repoRoot);
|
|
492
|
+
while (dir && dir !== stop && isPathInsideOrEqual(dir, root)) {
|
|
493
|
+
if (fs.existsSync(path.join(dir, 'package.json'))) return dir;
|
|
494
|
+
const parent = path.dirname(dir);
|
|
495
|
+
if (parent === dir) break;
|
|
496
|
+
dir = parent;
|
|
497
|
+
}
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
function isPathInsideOrEqual(candidate, root) {
|
|
502
|
+
return path.resolve(candidate) === path.resolve(root) || isPathInside(candidate, root);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
function workspacePatternMatchesRel(pattern, relSegments) {
|
|
506
|
+
const patternSegments = normalizeWorkspacePattern(pattern).split('/').filter(Boolean);
|
|
507
|
+
if (!patternSegments.length) return false;
|
|
508
|
+
if (patternSegments.includes('**')) {
|
|
509
|
+
const firstGlobIndex = patternSegments.findIndex((segment) => segment.includes('*'));
|
|
510
|
+
const literalPrefix = firstGlobIndex === -1
|
|
511
|
+
? patternSegments
|
|
512
|
+
: patternSegments.slice(0, firstGlobIndex);
|
|
513
|
+
if (relSegments.length < literalPrefix.length + 1) return false;
|
|
514
|
+
for (let i = 0; i < literalPrefix.length; i++) {
|
|
515
|
+
if (!segmentMatches(literalPrefix[i], relSegments[i])) return false;
|
|
516
|
+
}
|
|
517
|
+
return true;
|
|
518
|
+
}
|
|
519
|
+
if (relSegments.length < patternSegments.length) return false;
|
|
520
|
+
for (let i = 0; i < patternSegments.length; i++) {
|
|
521
|
+
if (!segmentMatches(patternSegments[i], relSegments[i])) return false;
|
|
522
|
+
}
|
|
523
|
+
return true;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
function readWorkspacePatterns(repoRoot) {
|
|
527
|
+
return [
|
|
528
|
+
...readPackageWorkspaces(repoRoot),
|
|
529
|
+
...readPnpmWorkspaces(repoRoot),
|
|
530
|
+
...readLernaWorkspaces(repoRoot),
|
|
531
|
+
].filter(Boolean);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
function readPackageWorkspaces(repoRoot) {
|
|
535
|
+
const pkg = readJson(path.join(repoRoot, 'package.json'));
|
|
536
|
+
const workspaces = pkg?.workspaces;
|
|
537
|
+
if (Array.isArray(workspaces)) return workspaces;
|
|
538
|
+
if (Array.isArray(workspaces?.packages)) return workspaces.packages;
|
|
539
|
+
return [];
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
function readLernaWorkspaces(repoRoot) {
|
|
543
|
+
const lerna = readJson(path.join(repoRoot, 'lerna.json'));
|
|
544
|
+
return Array.isArray(lerna?.packages) ? lerna.packages : [];
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
function readPnpmWorkspaces(repoRoot) {
|
|
548
|
+
try {
|
|
549
|
+
const body = fs.readFileSync(path.join(repoRoot, 'pnpm-workspace.yaml'), 'utf-8');
|
|
550
|
+
const patterns = [];
|
|
551
|
+
let inPackages = false;
|
|
552
|
+
for (const line of body.split(/\r?\n/)) {
|
|
553
|
+
const trimmed = stripYamlInlineComment(line).trim();
|
|
554
|
+
if (!trimmed || trimmed.startsWith('#')) continue;
|
|
555
|
+
const flowMatch = trimmed.match(/^packages:\s*\[(.*)\]\s*$/);
|
|
556
|
+
if (flowMatch) {
|
|
557
|
+
patterns.push(...parseYamlFlowList(flowMatch[1]));
|
|
558
|
+
inPackages = false;
|
|
559
|
+
continue;
|
|
560
|
+
}
|
|
561
|
+
if (/^packages:\s*$/.test(trimmed)) {
|
|
562
|
+
inPackages = true;
|
|
563
|
+
continue;
|
|
564
|
+
}
|
|
565
|
+
if (inPackages && /^[A-Za-z0-9_-]+:\s*/.test(trimmed)) break;
|
|
566
|
+
if (inPackages) {
|
|
567
|
+
const match = trimmed.match(/^-\s*(.+)$/);
|
|
568
|
+
if (match) patterns.push(unquoteYamlValue(match[1]));
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
return patterns;
|
|
572
|
+
} catch {
|
|
573
|
+
return [];
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
function stripYamlInlineComment(line) {
|
|
578
|
+
let quote = null;
|
|
579
|
+
for (let i = 0; i < line.length; i++) {
|
|
580
|
+
const ch = line[i];
|
|
581
|
+
if ((ch === '"' || ch === "'") && line[i - 1] !== '\\') {
|
|
582
|
+
quote = quote === ch ? null : quote || ch;
|
|
583
|
+
continue;
|
|
584
|
+
}
|
|
585
|
+
if (ch === '#' && !quote) return line.slice(0, i);
|
|
586
|
+
}
|
|
587
|
+
return line;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
function parseYamlFlowList(body) {
|
|
591
|
+
const items = [];
|
|
592
|
+
let quote = null;
|
|
593
|
+
let current = '';
|
|
594
|
+
for (let i = 0; i < body.length; i++) {
|
|
595
|
+
const ch = body[i];
|
|
596
|
+
if ((ch === '"' || ch === "'") && body[i - 1] !== '\\') {
|
|
597
|
+
quote = quote === ch ? null : quote || ch;
|
|
598
|
+
current += ch;
|
|
599
|
+
continue;
|
|
600
|
+
}
|
|
601
|
+
if (ch === ',' && !quote) {
|
|
602
|
+
const value = unquoteYamlValue(current);
|
|
603
|
+
if (value) items.push(value);
|
|
604
|
+
current = '';
|
|
605
|
+
continue;
|
|
606
|
+
}
|
|
607
|
+
current += ch;
|
|
608
|
+
}
|
|
609
|
+
const value = unquoteYamlValue(current);
|
|
610
|
+
if (value) items.push(value);
|
|
611
|
+
return items;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
function unquoteYamlValue(value) {
|
|
615
|
+
return String(value || '')
|
|
616
|
+
.trim()
|
|
617
|
+
.replace(/^['"]|['"]$/g, '');
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
function readJson(filePath) {
|
|
621
|
+
try {
|
|
622
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
|
623
|
+
} catch {
|
|
624
|
+
return null;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
function projectRootFromWorkspacePattern(repoRoot, relSegments, rawPattern) {
|
|
629
|
+
const pattern = normalizeWorkspacePattern(rawPattern);
|
|
630
|
+
if (!pattern || pattern.startsWith('!')) return null;
|
|
631
|
+
const patternSegments = pattern.split('/').filter(Boolean);
|
|
632
|
+
if (!patternSegments.length) return null;
|
|
633
|
+
if (patternSegments.includes('**')) {
|
|
634
|
+
return projectRootFromDoubleStarPattern(repoRoot, relSegments, patternSegments);
|
|
635
|
+
}
|
|
636
|
+
if (relSegments.length < patternSegments.length) return null;
|
|
637
|
+
for (let i = 0; i < patternSegments.length; i++) {
|
|
638
|
+
if (!segmentMatches(patternSegments[i], relSegments[i])) return null;
|
|
639
|
+
}
|
|
640
|
+
return path.join(repoRoot, ...relSegments.slice(0, patternSegments.length));
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
function projectRootFromDoubleStarPattern(repoRoot, relSegments, patternSegments) {
|
|
644
|
+
const firstGlobIndex = patternSegments.findIndex((segment) => segment.includes('*'));
|
|
645
|
+
const literalPrefix = firstGlobIndex === -1
|
|
646
|
+
? patternSegments
|
|
647
|
+
: patternSegments.slice(0, firstGlobIndex);
|
|
648
|
+
if (relSegments.length < literalPrefix.length + 1) return null;
|
|
649
|
+
for (let i = 0; i < literalPrefix.length; i++) {
|
|
650
|
+
if (!segmentMatches(literalPrefix[i], relSegments[i])) return null;
|
|
651
|
+
}
|
|
652
|
+
const prefixDir = path.join(repoRoot, ...literalPrefix);
|
|
653
|
+
const targetDir = path.join(repoRoot, ...relSegments);
|
|
654
|
+
const packageRoot = nearestPackageRootBetween(repoRoot, targetDir, prefixDir);
|
|
655
|
+
if (packageRoot) return packageRoot;
|
|
656
|
+
return path.join(repoRoot, ...relSegments.slice(0, literalPrefix.length + 1));
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
function normalizeWorkspacePattern(pattern) {
|
|
660
|
+
return String(pattern || '')
|
|
661
|
+
.trim()
|
|
662
|
+
.replace(/^['"]|['"]$/g, '')
|
|
663
|
+
.replace(/^\.\//, '')
|
|
664
|
+
.replace(/\/+$/, '');
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
function segmentMatches(patternSegment, relSegment) {
|
|
668
|
+
if (patternSegment === '*') return true;
|
|
669
|
+
if (!patternSegment.includes('*')) return patternSegment === relSegment;
|
|
670
|
+
const re = new RegExp(`^${escapeRegExp(patternSegment).replace(/\\\*/g, '[^/]*')}$`);
|
|
671
|
+
return re.test(relSegment);
|
|
672
|
+
}
|
|
673
|
+
|
|
76
674
|
function firstExisting(dir, names) {
|
|
77
675
|
for (const name of names) {
|
|
78
676
|
const abs = path.join(dir, name);
|
|
@@ -89,6 +687,10 @@ function safeRead(p) {
|
|
|
89
687
|
}
|
|
90
688
|
}
|
|
91
689
|
|
|
690
|
+
function escapeRegExp(value) {
|
|
691
|
+
return String(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
692
|
+
}
|
|
693
|
+
|
|
92
694
|
/**
|
|
93
695
|
* Pull the register (`brand` or `product`) out of PRODUCT.md by looking
|
|
94
696
|
* for a `## Register` section and reading the first non-empty line that
|
|
@@ -233,7 +835,24 @@ async function computeUpdateDirective(now = Date.now()) {
|
|
|
233
835
|
}
|
|
234
836
|
|
|
235
837
|
async function cli() {
|
|
236
|
-
|
|
838
|
+
let cliOptions;
|
|
839
|
+
try {
|
|
840
|
+
cliOptions = parseCliOptions(process.argv.slice(2));
|
|
841
|
+
} catch (err) {
|
|
842
|
+
if (err?.name === 'TargetArgError') {
|
|
843
|
+
process.stderr.write(`${err.message}\n`);
|
|
844
|
+
process.exit(1);
|
|
845
|
+
}
|
|
846
|
+
throw err;
|
|
847
|
+
}
|
|
848
|
+
const targetProvided = hasTargetOption(cliOptions);
|
|
849
|
+
const targetExists = targetProvided ? pathExistsForTarget(process.cwd(), cliOptions.targetPath) : null;
|
|
850
|
+
const selection = resolveTargetSelection(process.cwd(), cliOptions);
|
|
851
|
+
if (selection) {
|
|
852
|
+
process.stdout.write(buildTargetSelectionDirective(selection) + '\n');
|
|
853
|
+
process.exit(0);
|
|
854
|
+
}
|
|
855
|
+
const ctx = loadContext(process.cwd(), cliOptions);
|
|
237
856
|
const updateDirective = await computeUpdateDirective();
|
|
238
857
|
|
|
239
858
|
if (!ctx.hasProduct) {
|
|
@@ -244,6 +863,10 @@ async function cli() {
|
|
|
244
863
|
'Stop the current task, load reference/init.md, and follow its ' +
|
|
245
864
|
'instructions to write PRODUCT.md before resuming.',
|
|
246
865
|
];
|
|
866
|
+
parts.push(buildResolvedContextDirective(ctx, cliOptions, { targetExists }));
|
|
867
|
+
if (shouldWarnMissingTarget(ctx, targetProvided, targetExists)) {
|
|
868
|
+
parts.push(buildMissingTargetDirective());
|
|
869
|
+
}
|
|
247
870
|
if (updateDirective) parts.push(updateDirective);
|
|
248
871
|
process.stdout.write(parts.join('\n\n---\n\n') + '\n');
|
|
249
872
|
process.exit(0);
|
|
@@ -252,6 +875,10 @@ async function cli() {
|
|
|
252
875
|
if (ctx.hasDesign) {
|
|
253
876
|
parts.push(`# DESIGN.md\n\n${ctx.design.trim()}`);
|
|
254
877
|
}
|
|
878
|
+
parts.push(buildResolvedContextDirective(ctx, cliOptions, { targetExists }));
|
|
879
|
+
if (shouldWarnMissingTarget(ctx, targetProvided, targetExists)) {
|
|
880
|
+
parts.push(buildMissingTargetDirective());
|
|
881
|
+
}
|
|
255
882
|
const register = extractRegister(ctx.product);
|
|
256
883
|
const next = register
|
|
257
884
|
? `NEXT STEP: This project's register is \`${register}\`. You MUST now read \`reference/${register}.md\` before producing any design output.`
|
|
@@ -261,6 +888,60 @@ async function cli() {
|
|
|
261
888
|
process.stdout.write(parts.join('\n\n---\n\n') + '\n');
|
|
262
889
|
}
|
|
263
890
|
|
|
891
|
+
function parseCliOptions(args) {
|
|
892
|
+
return parseTargetOptions(args, { strict: true });
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
function hasTargetOption(options) {
|
|
896
|
+
return !!(options && typeof options.targetPath === 'string' && options.targetPath.trim());
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
function pathExistsForTarget(cwd, targetPath) {
|
|
900
|
+
const abs = path.isAbsolute(targetPath) ? targetPath : path.resolve(cwd, targetPath);
|
|
901
|
+
return fs.existsSync(abs);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
function buildResolvedContextDirective(ctx, options, { targetExists = null } = {}) {
|
|
905
|
+
const targetPath = hasTargetOption(options) ? options.targetPath : null;
|
|
906
|
+
return `RESOLVED_CONTEXT:\n${JSON.stringify({
|
|
907
|
+
targetPath,
|
|
908
|
+
...(targetPath ? { targetExists } : {}),
|
|
909
|
+
projectRoot: ctx.projectRoot,
|
|
910
|
+
repoRoot: ctx.repoRoot,
|
|
911
|
+
productPath: ctx.productPath,
|
|
912
|
+
designPath: ctx.designPath,
|
|
913
|
+
}, null, 2)}`;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
function shouldWarnMissingTarget(ctx, targetProvided, targetExists = null) {
|
|
917
|
+
if (ctx.isMonorepo && targetProvided && targetExists === false) return true;
|
|
918
|
+
return !!(
|
|
919
|
+
ctx.isMonorepo
|
|
920
|
+
&& (!targetProvided || targetExists === false)
|
|
921
|
+
&& ctx.projectRoot
|
|
922
|
+
&& ctx.repoRoot
|
|
923
|
+
&& path.resolve(ctx.projectRoot) === path.resolve(ctx.repoRoot)
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
function buildMissingTargetDirective() {
|
|
928
|
+
const script = process.argv[1] || 'context.mjs';
|
|
929
|
+
return (
|
|
930
|
+
'MONOREPO_TARGET_REQUIRED: This is a monorepo and context.mjs ran without --target. ' +
|
|
931
|
+
'If the user named a file, route, or child app, do not answer from this output. ' +
|
|
932
|
+
`Rerun \`node ${script} --target <path>\` and answer from that run's RESOLVED_CONTEXT fields.`
|
|
933
|
+
);
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
function buildTargetSelectionDirective(selection) {
|
|
937
|
+
return (
|
|
938
|
+
`TARGET_SELECTION_REQUIRED:\n${JSON.stringify(selection, null, 2)}\n\n` +
|
|
939
|
+
'Show each app with its productStatus/productPath and designStatus/designPath so the user can see child overrides, inherited root files, fallback files, or missing files before choosing. ' +
|
|
940
|
+
'Ask the user which app Impeccable should use, then rerun Impeccable helper commands from that child app cwd using this same scripts directory. ' +
|
|
941
|
+
'Use `--target <path>` only as a fallback when changing cwd is not possible, or when the user explicitly named a file/path.'
|
|
942
|
+
);
|
|
943
|
+
}
|
|
944
|
+
|
|
264
945
|
// Run cli() only when this module is the entry point. Compare realpaths
|
|
265
946
|
// rather than endsWith(): a loose suffix match also fires for unrelated
|
|
266
947
|
// scripts like `load-context.mjs`, and realpath tolerates symlinked
|