agim-cli 1.2.144 → 1.2.148
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/CHANGELOG.md +159 -0
- package/dist/cli-ui/setup-llm.d.ts.map +1 -1
- package/dist/cli-ui/setup-llm.js +3 -1
- package/dist/cli-ui/setup-llm.js.map +1 -1
- package/dist/core/circuit-breaker.d.ts +28 -0
- package/dist/core/circuit-breaker.d.ts.map +1 -1
- package/dist/core/circuit-breaker.js +45 -0
- package/dist/core/circuit-breaker.js.map +1 -1
- package/dist/core/intent.d.ts.map +1 -1
- package/dist/core/intent.js +3 -1
- package/dist/core/intent.js.map +1 -1
- package/dist/core/llm/agent-loop.d.ts +9 -1
- package/dist/core/llm/agent-loop.d.ts.map +1 -1
- package/dist/core/llm/agent-loop.js +80 -1
- package/dist/core/llm/agent-loop.js.map +1 -1
- package/dist/core/llm/anthropic-provider.d.ts.map +1 -1
- package/dist/core/llm/anthropic-provider.js +18 -4
- package/dist/core/llm/anthropic-provider.js.map +1 -1
- package/dist/core/llm/hallucination-detector.d.ts +33 -0
- package/dist/core/llm/hallucination-detector.d.ts.map +1 -0
- package/dist/core/llm/hallucination-detector.js +103 -0
- package/dist/core/llm/hallucination-detector.js.map +1 -0
- package/dist/core/llm/imhub-dispatcher.d.ts.map +1 -1
- package/dist/core/llm/imhub-dispatcher.js +7 -0
- package/dist/core/llm/imhub-dispatcher.js.map +1 -1
- package/dist/core/llm/provider-base.d.ts +9 -0
- package/dist/core/llm/provider-base.d.ts.map +1 -1
- package/dist/core/llm/provider-base.js.map +1 -1
- package/dist/core/memory-distill.d.ts.map +1 -1
- package/dist/core/memory-distill.js +18 -3
- package/dist/core/memory-distill.js.map +1 -1
- package/dist/core/memory.d.ts +14 -0
- package/dist/core/memory.d.ts.map +1 -1
- package/dist/core/memory.js +39 -0
- package/dist/core/memory.js.map +1 -1
- package/dist/core/message-sink.d.ts +6 -0
- package/dist/core/message-sink.d.ts.map +1 -1
- package/dist/core/message-sink.js +18 -3
- package/dist/core/message-sink.js.map +1 -1
- package/dist/core/outbox.d.ts +30 -2
- package/dist/core/outbox.d.ts.map +1 -1
- package/dist/core/outbox.js +102 -10
- package/dist/core/outbox.js.map +1 -1
- package/dist/core/reminders.d.ts.map +1 -1
- package/dist/core/reminders.js +11 -1
- package/dist/core/reminders.js.map +1 -1
- package/dist/core/router.d.ts.map +1 -1
- package/dist/core/router.js +16 -4
- package/dist/core/router.js.map +1 -1
- package/dist/core/schedule.d.ts +18 -0
- package/dist/core/schedule.d.ts.map +1 -1
- package/dist/core/schedule.js +80 -17
- package/dist/core/schedule.js.map +1 -1
- package/dist/core/sensitive-paths.d.ts.map +1 -1
- package/dist/core/sensitive-paths.js +53 -9
- package/dist/core/sensitive-paths.js.map +1 -1
- package/dist/core/skills/builtin/ECC_LICENSE +21 -0
- package/dist/core/skills/builtin/ECC_NOTICE.md +22 -0
- package/dist/core/skills/builtin/accessibility/SKILL.md +146 -0
- package/dist/core/skills/builtin/agent-eval/SKILL.md +145 -0
- package/dist/core/skills/builtin/agent-harness-construction/SKILL.md +73 -0
- package/dist/core/skills/builtin/agent-introspection-debugging/SKILL.md +153 -0
- package/dist/core/skills/builtin/agentic-engineering/SKILL.md +63 -0
- package/dist/core/skills/builtin/ai-first-engineering/SKILL.md +51 -0
- package/dist/core/skills/builtin/ai-regression-testing/SKILL.md +385 -0
- package/dist/core/skills/builtin/android-clean-architecture/SKILL.md +339 -0
- package/dist/core/skills/builtin/angular-developer/SKILL.md +154 -0
- package/dist/core/skills/builtin/angular-developer/references/angular-animations.md +160 -0
- package/dist/core/skills/builtin/angular-developer/references/angular-aria.md +410 -0
- package/dist/core/skills/builtin/angular-developer/references/cli.md +86 -0
- package/dist/core/skills/builtin/angular-developer/references/component-harnesses.md +59 -0
- package/dist/core/skills/builtin/angular-developer/references/component-styling.md +91 -0
- package/dist/core/skills/builtin/angular-developer/references/components.md +117 -0
- package/dist/core/skills/builtin/angular-developer/references/creating-services.md +97 -0
- package/dist/core/skills/builtin/angular-developer/references/data-resolvers.md +69 -0
- package/dist/core/skills/builtin/angular-developer/references/define-routes.md +67 -0
- package/dist/core/skills/builtin/angular-developer/references/defining-providers.md +72 -0
- package/dist/core/skills/builtin/angular-developer/references/di-fundamentals.md +120 -0
- package/dist/core/skills/builtin/angular-developer/references/e2e-testing.md +56 -0
- package/dist/core/skills/builtin/angular-developer/references/effects.md +83 -0
- package/dist/core/skills/builtin/angular-developer/references/hierarchical-injectors.md +43 -0
- package/dist/core/skills/builtin/angular-developer/references/host-elements.md +80 -0
- package/dist/core/skills/builtin/angular-developer/references/injection-context.md +63 -0
- package/dist/core/skills/builtin/angular-developer/references/inputs.md +101 -0
- package/dist/core/skills/builtin/angular-developer/references/linked-signal.md +59 -0
- package/dist/core/skills/builtin/angular-developer/references/loading-strategies.md +61 -0
- package/dist/core/skills/builtin/angular-developer/references/mcp.md +108 -0
- package/dist/core/skills/builtin/angular-developer/references/navigate-to-routes.md +69 -0
- package/dist/core/skills/builtin/angular-developer/references/outputs.md +86 -0
- package/dist/core/skills/builtin/angular-developer/references/reactive-forms.md +122 -0
- package/dist/core/skills/builtin/angular-developer/references/rendering-strategies.md +44 -0
- package/dist/core/skills/builtin/angular-developer/references/resource.md +77 -0
- package/dist/core/skills/builtin/angular-developer/references/route-animations.md +56 -0
- package/dist/core/skills/builtin/angular-developer/references/route-guards.md +52 -0
- package/dist/core/skills/builtin/angular-developer/references/router-lifecycle.md +45 -0
- package/dist/core/skills/builtin/angular-developer/references/router-testing.md +87 -0
- package/dist/core/skills/builtin/angular-developer/references/show-routes-with-outlets.md +68 -0
- package/dist/core/skills/builtin/angular-developer/references/signal-forms.md +795 -0
- package/dist/core/skills/builtin/angular-developer/references/signals-overview.md +94 -0
- package/dist/core/skills/builtin/angular-developer/references/tailwind-css.md +69 -0
- package/dist/core/skills/builtin/angular-developer/references/template-driven-forms.md +114 -0
- package/dist/core/skills/builtin/angular-developer/references/testing-fundamentals.md +65 -0
- package/dist/core/skills/builtin/api-connector-builder/SKILL.md +120 -0
- package/dist/core/skills/builtin/api-design/SKILL.md +523 -0
- package/dist/core/skills/builtin/architecture-decision-records/SKILL.md +179 -0
- package/dist/core/skills/builtin/article-writing/SKILL.md +79 -0
- package/dist/core/skills/builtin/automation-audit-ops/SKILL.md +142 -0
- package/dist/core/skills/builtin/autonomous-agent-harness/SKILL.md +273 -0
- package/dist/core/skills/builtin/autonomous-loops/SKILL.md +610 -0
- package/dist/core/skills/builtin/backend-patterns/SKILL.md +561 -0
- package/dist/core/skills/builtin/benchmark/SKILL.md +93 -0
- package/dist/core/skills/builtin/benchmark-optimization-loop/SKILL.md +69 -0
- package/dist/core/skills/builtin/blueprint/SKILL.md +105 -0
- package/dist/core/skills/builtin/browser-qa/SKILL.md +87 -0
- package/dist/core/skills/builtin/bun-runtime/SKILL.md +84 -0
- package/dist/core/skills/builtin/cisco-ios-patterns/SKILL.md +163 -0
- package/dist/core/skills/builtin/claude-devfleet/SKILL.md +111 -0
- package/dist/core/skills/builtin/click-path-audit/SKILL.md +244 -0
- package/dist/core/skills/builtin/clickhouse-io/SKILL.md +439 -0
- package/dist/core/skills/builtin/code-tour/SKILL.md +236 -0
- package/dist/core/skills/builtin/codebase-onboarding/SKILL.md +233 -0
- package/dist/core/skills/builtin/codehealth-mcp/SKILL.md +166 -0
- package/dist/core/skills/builtin/coding-standards/SKILL.md +550 -0
- package/dist/core/skills/builtin/compose-multiplatform-patterns/SKILL.md +299 -0
- package/dist/core/skills/builtin/config-gc/SKILL.md +119 -0
- package/dist/core/skills/builtin/content-hash-cache-pattern/SKILL.md +161 -0
- package/dist/core/skills/builtin/context-budget/SKILL.md +135 -0
- package/dist/core/skills/builtin/continuous-agent-loop/SKILL.md +45 -0
- package/dist/core/skills/builtin/continuous-learning/SKILL.md +131 -0
- package/dist/core/skills/builtin/continuous-learning/config.json +18 -0
- package/dist/core/skills/builtin/continuous-learning/evaluate-session.sh +69 -0
- package/dist/core/skills/builtin/continuous-learning-v2/SKILL.md +360 -0
- package/dist/core/skills/builtin/continuous-learning-v2/agents/observer-loop.sh +335 -0
- package/dist/core/skills/builtin/continuous-learning-v2/agents/observer.md +198 -0
- package/dist/core/skills/builtin/continuous-learning-v2/agents/session-guardian.sh +150 -0
- package/dist/core/skills/builtin/continuous-learning-v2/agents/start-observer.sh +248 -0
- package/dist/core/skills/builtin/continuous-learning-v2/config.json +8 -0
- package/dist/core/skills/builtin/continuous-learning-v2/hooks/observe.sh +498 -0
- package/dist/core/skills/builtin/continuous-learning-v2/scripts/detect-project.sh +322 -0
- package/dist/core/skills/builtin/continuous-learning-v2/scripts/instinct-cli.py +1914 -0
- package/dist/core/skills/builtin/continuous-learning-v2/scripts/lib/homunculus-dir.sh +31 -0
- package/dist/core/skills/builtin/continuous-learning-v2/scripts/migrate-homunculus.sh +62 -0
- package/dist/core/skills/builtin/continuous-learning-v2/scripts/test_parse_instinct.py +1045 -0
- package/dist/core/skills/builtin/cost-aware-llm-pipeline/SKILL.md +183 -0
- package/dist/core/skills/builtin/cost-tracking/SKILL.md +147 -0
- package/dist/core/skills/builtin/council/SKILL.md +203 -0
- package/dist/core/skills/builtin/cpp-coding-standards/SKILL.md +723 -0
- package/dist/core/skills/builtin/cpp-testing/SKILL.md +324 -0
- package/dist/core/skills/builtin/crosspost/SKILL.md +111 -0
- package/dist/core/skills/builtin/csharp-testing/SKILL.md +321 -0
- package/dist/core/skills/builtin/customs-trade-compliance/SKILL.md +263 -0
- package/dist/core/skills/builtin/dart-flutter-patterns/SKILL.md +563 -0
- package/dist/core/skills/builtin/dashboard-builder/SKILL.md +108 -0
- package/dist/core/skills/builtin/data-scraper-agent/SKILL.md +764 -0
- package/dist/core/skills/builtin/data-throughput-accelerator/SKILL.md +72 -0
- package/dist/core/skills/builtin/database-migrations/SKILL.md +429 -0
- package/dist/core/skills/builtin/deep-research/SKILL.md +159 -0
- package/dist/core/skills/builtin/defi-amm-security/SKILL.md +166 -0
- package/dist/core/skills/builtin/deployment-patterns/SKILL.md +427 -0
- package/dist/core/skills/builtin/design-system/SKILL.md +82 -0
- package/dist/core/skills/builtin/django-celery/SKILL.md +457 -0
- package/dist/core/skills/builtin/django-patterns/SKILL.md +734 -0
- package/dist/core/skills/builtin/django-security/SKILL.md +593 -0
- package/dist/core/skills/builtin/django-tdd/SKILL.md +729 -0
- package/dist/core/skills/builtin/django-verification/SKILL.md +469 -0
- package/dist/core/skills/builtin/dmux-workflows/SKILL.md +191 -0
- package/dist/core/skills/builtin/docker-patterns/SKILL.md +364 -0
- package/dist/core/skills/builtin/documentation-lookup/SKILL.md +90 -0
- package/dist/core/skills/builtin/dotnet-patterns/SKILL.md +321 -0
- package/dist/core/skills/builtin/dynamic-workflow-mode/SKILL.md +123 -0
- package/dist/core/skills/builtin/e2e-testing/SKILL.md +326 -0
- package/dist/core/skills/builtin/email-ops/SKILL.md +121 -0
- package/dist/core/skills/builtin/energy-procurement/SKILL.md +228 -0
- package/dist/core/skills/builtin/enterprise-agent-ops/SKILL.md +50 -0
- package/dist/core/skills/builtin/error-handling/SKILL.md +376 -0
- package/dist/core/skills/builtin/eval-harness/SKILL.md +270 -0
- package/dist/core/skills/builtin/evm-token-decimals/SKILL.md +130 -0
- package/dist/core/skills/builtin/exa-search/SKILL.md +107 -0
- package/dist/core/skills/builtin/fal-ai-media/SKILL.md +288 -0
- package/dist/core/skills/builtin/fastapi-patterns/SKILL.md +513 -0
- package/dist/core/skills/builtin/finance-billing-ops/SKILL.md +127 -0
- package/dist/core/skills/builtin/flox-environments/SKILL.md +496 -0
- package/dist/core/skills/builtin/flutter-dart-code-review/SKILL.md +435 -0
- package/dist/core/skills/builtin/foundation-models-on-device/SKILL.md +243 -0
- package/dist/core/skills/builtin/frontend-a11y/SKILL.md +445 -0
- package/dist/core/skills/builtin/frontend-design-direction/SKILL.md +92 -0
- package/dist/core/skills/builtin/frontend-patterns/SKILL.md +656 -0
- package/dist/core/skills/builtin/frontend-slides/SKILL.md +184 -0
- package/dist/core/skills/builtin/frontend-slides/STYLE_PRESETS.md +330 -0
- package/dist/core/skills/builtin/frontend-slides/animation-patterns.md +122 -0
- package/dist/core/skills/builtin/frontend-slides/html-template.md +419 -0
- package/dist/core/skills/builtin/frontend-slides/scripts/export-pdf.sh +418 -0
- package/dist/core/skills/builtin/frontend-slides/scripts/extract-pptx.py +96 -0
- package/dist/core/skills/builtin/frontend-slides/viewport-base.css +153 -0
- package/dist/core/skills/builtin/fsharp-testing/SKILL.md +280 -0
- package/dist/core/skills/builtin/gan-style-harness/SKILL.md +278 -0
- package/dist/core/skills/builtin/gateguard/SKILL.md +132 -0
- package/dist/core/skills/builtin/git-workflow/SKILL.md +715 -0
- package/dist/core/skills/builtin/github-ops/SKILL.md +144 -0
- package/dist/core/skills/builtin/golang-patterns/SKILL.md +674 -0
- package/dist/core/skills/builtin/golang-testing/SKILL.md +720 -0
- package/dist/core/skills/builtin/healthcare-cdss-patterns/SKILL.md +245 -0
- package/dist/core/skills/builtin/healthcare-emr-patterns/SKILL.md +159 -0
- package/dist/core/skills/builtin/healthcare-eval-harness/SKILL.md +207 -0
- package/dist/core/skills/builtin/healthcare-phi-compliance/SKILL.md +145 -0
- package/dist/core/skills/builtin/hermes-imports/SKILL.md +88 -0
- package/dist/core/skills/builtin/hexagonal-architecture/SKILL.md +276 -0
- package/dist/core/skills/builtin/hipaa-compliance/SKILL.md +78 -0
- package/dist/core/skills/builtin/hookify-rules/SKILL.md +128 -0
- package/dist/core/skills/builtin/inherit-legacy-style/SKILL.md +156 -0
- package/dist/core/skills/builtin/intent-driven-development/SKILL.md +360 -0
- package/dist/core/skills/builtin/inventory-demand-planning/SKILL.md +247 -0
- package/dist/core/skills/builtin/ios-icon-gen/SKILL.md +157 -0
- package/dist/core/skills/builtin/ios-icon-gen/scripts/generate_icons.swift +258 -0
- package/dist/core/skills/builtin/ios-icon-gen/scripts/iconify_gen.sh +235 -0
- package/dist/core/skills/builtin/iterative-retrieval/SKILL.md +211 -0
- package/dist/core/skills/builtin/java-coding-standards/SKILL.md +383 -0
- package/dist/core/skills/builtin/jira-integration/SKILL.md +302 -0
- package/dist/core/skills/builtin/jpa-patterns/SKILL.md +151 -0
- package/dist/core/skills/builtin/knowledge-ops/SKILL.md +154 -0
- package/dist/core/skills/builtin/kotlin-coroutines-flows/SKILL.md +284 -0
- package/dist/core/skills/builtin/kotlin-exposed-patterns/SKILL.md +719 -0
- package/dist/core/skills/builtin/kotlin-ktor-patterns/SKILL.md +689 -0
- package/dist/core/skills/builtin/kotlin-patterns/SKILL.md +711 -0
- package/dist/core/skills/builtin/kotlin-testing/SKILL.md +824 -0
- package/dist/core/skills/builtin/kubernetes-patterns/SKILL.md +755 -0
- package/dist/core/skills/builtin/laravel-patterns/SKILL.md +415 -0
- package/dist/core/skills/builtin/laravel-plugin-discovery/SKILL.md +229 -0
- package/dist/core/skills/builtin/laravel-security/SKILL.md +947 -0
- package/dist/core/skills/builtin/laravel-tdd/SKILL.md +674 -0
- package/dist/core/skills/builtin/laravel-verification/SKILL.md +179 -0
- package/dist/core/skills/builtin/latency-critical-systems/SKILL.md +73 -0
- package/dist/core/skills/builtin/lead-intelligence/SKILL.md +321 -0
- package/dist/core/skills/builtin/lead-intelligence/agents/enrichment-agent.md +85 -0
- package/dist/core/skills/builtin/lead-intelligence/agents/mutual-mapper.md +75 -0
- package/dist/core/skills/builtin/lead-intelligence/agents/outreach-drafter.md +98 -0
- package/dist/core/skills/builtin/lead-intelligence/agents/signal-scorer.md +60 -0
- package/dist/core/skills/builtin/liquid-glass-design/SKILL.md +279 -0
- package/dist/core/skills/builtin/llm-trading-agent-security/SKILL.md +146 -0
- package/dist/core/skills/builtin/logistics-exception-management/SKILL.md +222 -0
- package/dist/core/skills/builtin/make-interfaces-feel-better/SKILL.md +151 -0
- package/dist/core/skills/builtin/market-research/SKILL.md +75 -0
- package/dist/core/skills/builtin/marketing-campaign/SKILL.md +113 -0
- package/dist/core/skills/builtin/mcp-server-patterns/SKILL.md +69 -0
- package/dist/core/skills/builtin/messages-ops/SKILL.md +104 -0
- package/dist/core/skills/builtin/mle-workflow/SKILL.md +346 -0
- package/dist/core/skills/builtin/motion-advanced/SKILL.md +596 -0
- package/dist/core/skills/builtin/motion-foundations/SKILL.md +299 -0
- package/dist/core/skills/builtin/motion-patterns/SKILL.md +434 -0
- package/dist/core/skills/builtin/motion-ui/SKILL.md +575 -0
- package/dist/core/skills/builtin/mysql-patterns/SKILL.md +412 -0
- package/dist/core/skills/builtin/nanoclaw-repl/SKILL.md +33 -0
- package/dist/core/skills/builtin/nestjs-patterns/SKILL.md +230 -0
- package/dist/core/skills/builtin/netmiko-ssh-automation/SKILL.md +173 -0
- package/dist/core/skills/builtin/network-bgp-diagnostics/SKILL.md +167 -0
- package/dist/core/skills/builtin/network-config-validation/SKILL.md +210 -0
- package/dist/core/skills/builtin/network-interface-health/SKILL.md +152 -0
- package/dist/core/skills/builtin/nextjs-turbopack/SKILL.md +57 -0
- package/dist/core/skills/builtin/nodejs-keccak256/SKILL.md +102 -0
- package/dist/core/skills/builtin/nutrient-document-processing/SKILL.md +167 -0
- package/dist/core/skills/builtin/nuxt4-patterns/SKILL.md +100 -0
- package/dist/core/skills/builtin/openclaw-persona-forge/SKILL.md +288 -0
- package/dist/core/skills/builtin/openclaw-persona-forge/gacha.py +224 -0
- package/dist/core/skills/builtin/openclaw-persona-forge/gacha.sh +5 -0
- package/dist/core/skills/builtin/openclaw-persona-forge/references/avatar-style.md +124 -0
- package/dist/core/skills/builtin/openclaw-persona-forge/references/boundary-rules.md +53 -0
- package/dist/core/skills/builtin/openclaw-persona-forge/references/error-handling.md +53 -0
- package/dist/core/skills/builtin/openclaw-persona-forge/references/identity-tension.md +48 -0
- package/dist/core/skills/builtin/openclaw-persona-forge/references/naming-system.md +39 -0
- package/dist/core/skills/builtin/openclaw-persona-forge/references/output-template.md +166 -0
- package/dist/core/skills/builtin/opensource-pipeline/SKILL.md +255 -0
- package/dist/core/skills/builtin/orch-add-feature/SKILL.md +44 -0
- package/dist/core/skills/builtin/orch-build-mvp/SKILL.md +48 -0
- package/dist/core/skills/builtin/orch-change-feature/SKILL.md +42 -0
- package/dist/core/skills/builtin/orch-fix-defect/SKILL.md +42 -0
- package/dist/core/skills/builtin/orch-pipeline/SKILL.md +120 -0
- package/dist/core/skills/builtin/orch-refine-code/SKILL.md +43 -0
- package/dist/core/skills/builtin/parallel-execution-optimizer/SKILL.md +72 -0
- package/dist/core/skills/builtin/perl-patterns/SKILL.md +504 -0
- package/dist/core/skills/builtin/perl-security/SKILL.md +503 -0
- package/dist/core/skills/builtin/perl-testing/SKILL.md +475 -0
- package/dist/core/skills/builtin/plan-orchestrate/SKILL.md +262 -0
- package/dist/core/skills/builtin/plankton-code-quality/SKILL.md +236 -0
- package/dist/core/skills/builtin/postgres-patterns/SKILL.md +147 -0
- package/dist/core/skills/builtin/prediction-market-oracle-research/SKILL.md +63 -0
- package/dist/core/skills/builtin/prediction-market-risk-review/SKILL.md +60 -0
- package/dist/core/skills/builtin/prisma-patterns/SKILL.md +371 -0
- package/dist/core/skills/builtin/product-capability/SKILL.md +141 -0
- package/dist/core/skills/builtin/product-lens/SKILL.md +92 -0
- package/dist/core/skills/builtin/production-audit/SKILL.md +206 -0
- package/dist/core/skills/builtin/production-scheduling/SKILL.md +238 -0
- package/dist/core/skills/builtin/prompt-optimizer/SKILL.md +398 -0
- package/dist/core/skills/builtin/python-patterns/SKILL.md +750 -0
- package/dist/core/skills/builtin/python-testing/SKILL.md +816 -0
- package/dist/core/skills/builtin/pytorch-patterns/SKILL.md +396 -0
- package/dist/core/skills/builtin/quality-nonconformance/SKILL.md +260 -0
- package/dist/core/skills/builtin/quarkus-patterns/SKILL.md +722 -0
- package/dist/core/skills/builtin/quarkus-security/SKILL.md +467 -0
- package/dist/core/skills/builtin/quarkus-tdd/SKILL.md +811 -0
- package/dist/core/skills/builtin/quarkus-verification/SKILL.md +479 -0
- package/dist/core/skills/builtin/ralphinho-rfc-pipeline/SKILL.md +67 -0
- package/dist/core/skills/builtin/react-patterns/SKILL.md +341 -0
- package/dist/core/skills/builtin/react-performance/SKILL.md +574 -0
- package/dist/core/skills/builtin/react-testing/SKILL.md +423 -0
- package/dist/core/skills/builtin/recsys-pipeline-architect/SKILL.md +114 -0
- package/dist/core/skills/builtin/recursive-decision-ledger/SKILL.md +79 -0
- package/dist/core/skills/builtin/redis-patterns/SKILL.md +403 -0
- package/dist/core/skills/builtin/regex-vs-llm-structured-text/SKILL.md +220 -0
- package/dist/core/skills/builtin/repo-scan/SKILL.md +78 -0
- package/dist/core/skills/builtin/research-ops/SKILL.md +112 -0
- package/dist/core/skills/builtin/returns-reverse-logistics/SKILL.md +240 -0
- package/dist/core/skills/builtin/rules-distill/SKILL.md +264 -0
- package/dist/core/skills/builtin/rules-distill/scripts/scan-rules.sh +58 -0
- package/dist/core/skills/builtin/rules-distill/scripts/scan-skills.sh +129 -0
- package/dist/core/skills/builtin/rust-patterns/SKILL.md +499 -0
- package/dist/core/skills/builtin/rust-testing/SKILL.md +500 -0
- package/dist/core/skills/builtin/safety-guard/SKILL.md +75 -0
- package/dist/core/skills/builtin/santa-method/SKILL.md +306 -0
- package/dist/core/skills/builtin/scientific-db-pubmed-database/SKILL.md +175 -0
- package/dist/core/skills/builtin/scientific-db-uspto-database/SKILL.md +177 -0
- package/dist/core/skills/builtin/scientific-pkg-gget/SKILL.md +166 -0
- package/dist/core/skills/builtin/scientific-thinking-literature-review/SKILL.md +192 -0
- package/dist/core/skills/builtin/scientific-thinking-scholar-evaluation/SKILL.md +160 -0
- package/dist/core/skills/builtin/search-first/SKILL.md +182 -0
- package/dist/core/skills/builtin/security-bounty-hunter/SKILL.md +99 -0
- package/dist/core/skills/builtin/security-review/SKILL.md +503 -0
- package/dist/core/skills/builtin/security-review/cloud-infrastructure-security.md +361 -0
- package/dist/core/skills/builtin/security-scan/SKILL.md +165 -0
- package/dist/core/skills/builtin/seo/SKILL.md +154 -0
- package/dist/core/skills/builtin/skill-comply/SKILL.md +58 -0
- package/dist/core/skills/builtin/skill-comply/fixtures/compliant_trace.jsonl +5 -0
- package/dist/core/skills/builtin/skill-comply/fixtures/noncompliant_trace.jsonl +3 -0
- package/dist/core/skills/builtin/skill-comply/fixtures/tdd_spec.yaml +44 -0
- package/dist/core/skills/builtin/skill-comply/prompts/classifier.md +24 -0
- package/dist/core/skills/builtin/skill-comply/prompts/scenario_generator.md +62 -0
- package/dist/core/skills/builtin/skill-comply/prompts/spec_generator.md +42 -0
- package/dist/core/skills/builtin/skill-comply/pyproject.toml +15 -0
- package/dist/core/skills/builtin/skill-comply/scripts/__init__.py +0 -0
- package/dist/core/skills/builtin/skill-comply/scripts/classifier.py +85 -0
- package/dist/core/skills/builtin/skill-comply/scripts/grader.py +124 -0
- package/dist/core/skills/builtin/skill-comply/scripts/parser.py +107 -0
- package/dist/core/skills/builtin/skill-comply/scripts/report.py +170 -0
- package/dist/core/skills/builtin/skill-comply/scripts/run.py +127 -0
- package/dist/core/skills/builtin/skill-comply/scripts/runner.py +186 -0
- package/dist/core/skills/builtin/skill-comply/scripts/scenario_generator.py +70 -0
- package/dist/core/skills/builtin/skill-comply/scripts/spec_generator.py +72 -0
- package/dist/core/skills/builtin/skill-comply/scripts/utils.py +13 -0
- package/dist/core/skills/builtin/skill-comply/tests/test_grader.py +197 -0
- package/dist/core/skills/builtin/skill-comply/tests/test_parser.py +90 -0
- package/dist/core/skills/builtin/skill-comply/tests/test_runner.py +172 -0
- package/dist/core/skills/builtin/skill-scout/SKILL.md +140 -0
- package/dist/core/skills/builtin/skill-stocktake/SKILL.md +194 -0
- package/dist/core/skills/builtin/skill-stocktake/scripts/quick-diff.sh +87 -0
- package/dist/core/skills/builtin/skill-stocktake/scripts/save-results.sh +56 -0
- package/dist/core/skills/builtin/skill-stocktake/scripts/scan.sh +170 -0
- package/dist/core/skills/builtin/springboot-patterns/SKILL.md +314 -0
- package/dist/core/skills/builtin/springboot-security/SKILL.md +272 -0
- package/dist/core/skills/builtin/springboot-tdd/SKILL.md +158 -0
- package/dist/core/skills/builtin/springboot-verification/SKILL.md +231 -0
- package/dist/core/skills/builtin/strategic-compact/SKILL.md +135 -0
- package/dist/core/skills/builtin/swift-actor-persistence/SKILL.md +143 -0
- package/dist/core/skills/builtin/swift-concurrency-6-2/SKILL.md +216 -0
- package/dist/core/skills/builtin/swift-protocol-di-testing/SKILL.md +190 -0
- package/dist/core/skills/builtin/swiftui-patterns/SKILL.md +259 -0
- package/dist/core/skills/builtin/tdd-workflow/SKILL.md +463 -0
- package/dist/core/skills/builtin/team-agent-orchestration/SKILL.md +110 -0
- package/dist/core/skills/builtin/team-builder/SKILL.md +168 -0
- package/dist/core/skills/builtin/terminal-ops/SKILL.md +109 -0
- package/dist/core/skills/builtin/tinystruct-patterns/SKILL.md +203 -0
- package/dist/core/skills/builtin/tinystruct-patterns/references/architecture.md +90 -0
- package/dist/core/skills/builtin/tinystruct-patterns/references/data-handling.md +60 -0
- package/dist/core/skills/builtin/tinystruct-patterns/references/database.md +99 -0
- package/dist/core/skills/builtin/tinystruct-patterns/references/routing.md +64 -0
- package/dist/core/skills/builtin/tinystruct-patterns/references/system-usage.md +97 -0
- package/dist/core/skills/builtin/tinystruct-patterns/references/testing.md +72 -0
- package/dist/core/skills/builtin/token-budget-advisor/SKILL.md +133 -0
- package/dist/core/skills/builtin/ui-demo/SKILL.md +465 -0
- package/dist/core/skills/builtin/ui-to-vue/SKILL.md +134 -0
- package/dist/core/skills/builtin/uncloud/SKILL.md +343 -0
- package/dist/core/skills/builtin/unified-notifications-ops/SKILL.md +187 -0
- package/dist/core/skills/builtin/verification-loop/SKILL.md +126 -0
- package/dist/core/skills/builtin/video-editing/SKILL.md +310 -0
- package/dist/core/skills/builtin/videodb/SKILL.md +374 -0
- package/dist/core/skills/builtin/videodb/reference/api-reference.md +550 -0
- package/dist/core/skills/builtin/videodb/reference/capture-reference.md +407 -0
- package/dist/core/skills/builtin/videodb/reference/capture.md +101 -0
- package/dist/core/skills/builtin/videodb/reference/editor.md +443 -0
- package/dist/core/skills/builtin/videodb/reference/generative.md +331 -0
- package/dist/core/skills/builtin/videodb/reference/rtstream-reference.md +564 -0
- package/dist/core/skills/builtin/videodb/reference/rtstream.md +65 -0
- package/dist/core/skills/builtin/videodb/reference/search.md +230 -0
- package/dist/core/skills/builtin/videodb/reference/streaming.md +406 -0
- package/dist/core/skills/builtin/videodb/reference/use-cases.md +118 -0
- package/dist/core/skills/builtin/videodb/scripts/ws_listener.py +282 -0
- package/dist/core/skills/builtin/visa-doc-translate/README.md +86 -0
- package/dist/core/skills/builtin/visa-doc-translate/SKILL.md +117 -0
- package/dist/core/skills/builtin/vite-patterns/SKILL.md +449 -0
- package/dist/core/skills/builtin/windows-desktop-e2e/SKILL.md +887 -0
- package/dist/core/skills/builtin/x-api/SKILL.md +234 -0
- package/dist/core/skills/loader.js +11 -0
- package/dist/core/skills/loader.js.map +1 -1
- package/dist/core/types.d.ts +6 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/plugins/agents/native/index.d.ts +47 -8
- package/dist/plugins/agents/native/index.d.ts.map +1 -1
- package/dist/plugins/agents/native/index.js +253 -102
- package/dist/plugins/agents/native/index.js.map +1 -1
- package/dist/plugins/agents/native/tool-registry.d.ts +33 -0
- package/dist/plugins/agents/native/tool-registry.d.ts.map +1 -0
- package/dist/plugins/agents/native/tool-registry.js +82 -0
- package/dist/plugins/agents/native/tool-registry.js.map +1 -0
- package/dist/plugins/messengers/dingtalk/dingtalk-client.d.ts.map +1 -1
- package/dist/plugins/messengers/dingtalk/dingtalk-client.js +11 -11
- package/dist/plugins/messengers/dingtalk/dingtalk-client.js.map +1 -1
- package/dist/plugins/messengers/feishu/feishu-adapter.d.ts.map +1 -1
- package/dist/plugins/messengers/feishu/feishu-adapter.js +9 -5
- package/dist/plugins/messengers/feishu/feishu-adapter.js.map +1 -1
- package/dist/plugins/messengers/wechat/ilink-adapter.d.ts.map +1 -1
- package/dist/plugins/messengers/wechat/ilink-adapter.js +11 -1
- package/dist/plugins/messengers/wechat/ilink-adapter.js.map +1 -1
- package/dist/web/public/assets/{a2a-DczMMkbl.js → a2a-Cll3P4QN.js} +2 -2
- package/dist/web/public/assets/{a2a-DczMMkbl.js.map → a2a-Cll3P4QN.js.map} +1 -1
- package/dist/web/public/assets/{activity-cbLHkzca.js → activity-B7T7YFlD.js} +2 -2
- package/dist/web/public/assets/{activity-cbLHkzca.js.map → activity-B7T7YFlD.js.map} +1 -1
- package/dist/web/public/assets/{admins-C-YsGMj7.js → admins-CN7P018S.js} +2 -2
- package/dist/web/public/assets/{admins-C-YsGMj7.js.map → admins-CN7P018S.js.map} +1 -1
- package/dist/web/public/assets/{agents-BWfov_1-.js → agents-Bqgq7GBF.js} +2 -2
- package/dist/web/public/assets/{agents-BWfov_1-.js.map → agents-Bqgq7GBF.js.map} +1 -1
- package/dist/web/public/assets/{approvals-HSssmXKS.js → approvals-C8IUJQ_A.js} +2 -2
- package/dist/web/public/assets/{approvals-HSssmXKS.js.map → approvals-C8IUJQ_A.js.map} +1 -1
- package/dist/web/public/assets/{arrow-down-BXvC8Al2.js → arrow-down-SLWKqtDc.js} +2 -2
- package/dist/web/public/assets/{arrow-down-BXvC8Al2.js.map → arrow-down-SLWKqtDc.js.map} +1 -1
- package/dist/web/public/assets/{arrow-up-63xELY5Q.js → arrow-up-BOADc9ce.js} +2 -2
- package/dist/web/public/assets/{arrow-up-63xELY5Q.js.map → arrow-up-BOADc9ce.js.map} +1 -1
- package/dist/web/public/assets/{asks-COLEFOvK.js → asks-C-j-DypC.js} +2 -2
- package/dist/web/public/assets/{asks-COLEFOvK.js.map → asks-C-j-DypC.js.map} +1 -1
- package/dist/web/public/assets/{audit-D4ZEiZub.js → audit-DQb-RuXh.js} +2 -2
- package/dist/web/public/assets/{audit-D4ZEiZub.js.map → audit-DQb-RuXh.js.map} +1 -1
- package/dist/web/public/assets/{bell-Cg2Bvv06.js → bell-CV88-ul6.js} +2 -2
- package/dist/web/public/assets/{bell-Cg2Bvv06.js.map → bell-CV88-ul6.js.map} +1 -1
- package/dist/web/public/assets/{bgjobs-CEjCzwtd.js → bgjobs-CDrK0d-W.js} +2 -2
- package/dist/web/public/assets/{bgjobs-CEjCzwtd.js.map → bgjobs-CDrK0d-W.js.map} +1 -1
- package/dist/web/public/assets/{brain-euvl6F6C.js → brain-B7HtSOQU.js} +2 -2
- package/dist/web/public/assets/{brain-euvl6F6C.js.map → brain-B7HtSOQU.js.map} +1 -1
- package/dist/web/public/assets/{briefcase-DPWLbCnA.js → briefcase-mdzuIa__.js} +2 -2
- package/dist/web/public/assets/{briefcase-DPWLbCnA.js.map → briefcase-mdzuIa__.js.map} +1 -1
- package/dist/web/public/assets/{browser-ponyfill-BUutOaRz.js → browser-ponyfill-DBWdeCTC.js} +2 -2
- package/dist/web/public/assets/{browser-ponyfill-BUutOaRz.js.map → browser-ponyfill-DBWdeCTC.js.map} +1 -1
- package/dist/web/public/assets/{chat-Dz9kfaxH.js → chat-CSjtY2rN.js} +3 -3
- package/dist/web/public/assets/{chat-Dz9kfaxH.js.map → chat-CSjtY2rN.js.map} +1 -1
- package/dist/web/public/assets/{chevron-left-BeIh5thq.js → chevron-left-uSfPn636.js} +2 -2
- package/dist/web/public/assets/{chevron-left-BeIh5thq.js.map → chevron-left-uSfPn636.js.map} +1 -1
- package/dist/web/public/assets/{chevron-right-uP_l9MMb.js → chevron-right-CtelqacW.js} +2 -2
- package/dist/web/public/assets/{chevron-right-uP_l9MMb.js.map → chevron-right-CtelqacW.js.map} +1 -1
- package/dist/web/public/assets/{circle-check-CewnjFgv.js → circle-check-8dbL-u7O.js} +2 -2
- package/dist/web/public/assets/{circle-check-CewnjFgv.js.map → circle-check-8dbL-u7O.js.map} +1 -1
- package/dist/web/public/assets/{circle-check-big-C2RTc48c.js → circle-check-big-D8-svk9a.js} +2 -2
- package/dist/web/public/assets/{circle-check-big-C2RTc48c.js.map → circle-check-big-D8-svk9a.js.map} +1 -1
- package/dist/web/public/assets/{circle-x-Ccg1HyV-.js → circle-x-rUxzIz5P.js} +2 -2
- package/dist/web/public/assets/{circle-x-Ccg1HyV-.js.map → circle-x-rUxzIz5P.js.map} +1 -1
- package/dist/web/public/assets/{clock-qxbYSynv.js → clock-CG5dlBGB.js} +2 -2
- package/dist/web/public/assets/{clock-qxbYSynv.js.map → clock-CG5dlBGB.js.map} +1 -1
- package/dist/web/public/assets/{confirm-dialog-DmJq4Td9.js → confirm-dialog-DlUsSur3.js} +2 -2
- package/dist/web/public/assets/{confirm-dialog-DmJq4Td9.js.map → confirm-dialog-DlUsSur3.js.map} +1 -1
- package/dist/web/public/assets/{copy-DxSHRdbc.js → copy-DnC76wFT.js} +2 -2
- package/dist/web/public/assets/{copy-DxSHRdbc.js.map → copy-DnC76wFT.js.map} +1 -1
- package/dist/web/public/assets/{data-table-S7rIjwdO.js → data-table-DswkWUfG.js} +2 -2
- package/dist/web/public/assets/{data-table-S7rIjwdO.js.map → data-table-DswkWUfG.js.map} +1 -1
- package/dist/web/public/assets/dialog-Ceo4YuXy.js +6 -0
- package/dist/web/public/assets/dialog-Ceo4YuXy.js.map +1 -0
- package/dist/web/public/assets/{download-OhsGtnO-.js → download-DF-46tS4.js} +2 -2
- package/dist/web/public/assets/{download-OhsGtnO-.js.map → download-DF-46tS4.js.map} +1 -1
- package/dist/web/public/assets/{email-C1-HxWLF.js → email-CZee26-_.js} +3 -3
- package/dist/web/public/assets/{email-C1-HxWLF.js.map → email-CZee26-_.js.map} +1 -1
- package/dist/web/public/assets/{empty-state-C-qjOHyu.js → empty-state-D9Hi0Atm.js} +2 -2
- package/dist/web/public/assets/{empty-state-C-qjOHyu.js.map → empty-state-D9Hi0Atm.js.map} +1 -1
- package/dist/web/public/assets/{external-link-DRVp9-lb.js → external-link-D64iZa9P.js} +2 -2
- package/dist/web/public/assets/{external-link-DRVp9-lb.js.map → external-link-D64iZa9P.js.map} +1 -1
- package/dist/web/public/assets/{eye-CFhg5BTa.js → eye-sY6WZb7D.js} +2 -2
- package/dist/web/public/assets/{eye-CFhg5BTa.js.map → eye-sY6WZb7D.js.map} +1 -1
- package/dist/web/public/assets/{facts-CGaLWhzi.js → facts-B7bGGwvi.js} +2 -2
- package/dist/web/public/assets/{facts-CGaLWhzi.js.map → facts-B7bGGwvi.js.map} +1 -1
- package/dist/web/public/assets/{goals-C-dJANmn.js → goals-BfQbsvZv.js} +2 -2
- package/dist/web/public/assets/{goals-C-dJANmn.js.map → goals-BfQbsvZv.js.map} +1 -1
- package/dist/web/public/assets/{health-CWcti5h3.js → health-Ba_mY0Ts.js} +2 -2
- package/dist/web/public/assets/{health-CWcti5h3.js.map → health-Ba_mY0Ts.js.map} +1 -1
- package/dist/web/public/assets/{heart-pulse-DmGhKR2W.js → heart-pulse-BjikOVwU.js} +2 -2
- package/dist/web/public/assets/{heart-pulse-DmGhKR2W.js.map → heart-pulse-BjikOVwU.js.map} +1 -1
- package/dist/web/public/assets/{heartbeat-kLoGBNCo.js → heartbeat-BM8LlPes.js} +2 -2
- package/dist/web/public/assets/{heartbeat-kLoGBNCo.js.map → heartbeat-BM8LlPes.js.map} +1 -1
- package/dist/web/public/assets/{hot-BITDoax1.js → hot-BtuLL6n8.js} +2 -2
- package/dist/web/public/assets/{hot-BITDoax1.js.map → hot-BtuLL6n8.js.map} +1 -1
- package/dist/web/public/assets/index-DEWFfW_Z.js +199 -0
- package/dist/web/public/assets/index-DEWFfW_Z.js.map +1 -0
- package/dist/web/public/assets/{installed-Co9WrtQ7.js → installed-Xr8p31ij.js} +2 -2
- package/dist/web/public/assets/{installed-Co9WrtQ7.js.map → installed-Xr8p31ij.js.map} +1 -1
- package/dist/web/public/assets/{jobs-hdHhBEvi.js → jobs-Ddy81Udm.js} +2 -2
- package/dist/web/public/assets/{jobs-hdHhBEvi.js.map → jobs-Ddy81Udm.js.map} +1 -1
- package/dist/web/public/assets/{layout-CQtbOBag.js → layout-BL74fT-L.js} +2 -2
- package/dist/web/public/assets/{layout-CQtbOBag.js.map → layout-BL74fT-L.js.map} +1 -1
- package/dist/web/public/assets/{layout-bDMXIKIR.js → layout-Bn2qUxcK.js} +2 -2
- package/dist/web/public/assets/{layout-bDMXIKIR.js.map → layout-Bn2qUxcK.js.map} +1 -1
- package/dist/web/public/assets/{layout-BMXC1Uh1.js → layout-Bp4SAA8_.js} +2 -2
- package/dist/web/public/assets/{layout-BMXC1Uh1.js.map → layout-Bp4SAA8_.js.map} +1 -1
- package/dist/web/public/assets/{layout-CysVsySh.js → layout-CZ9pGnW8.js} +2 -2
- package/dist/web/public/assets/{layout-CysVsySh.js.map → layout-CZ9pGnW8.js.map} +1 -1
- package/dist/web/public/assets/{layout-CyBGneZ9.js → layout-pasFRkKV.js} +2 -2
- package/dist/web/public/assets/{layout-CyBGneZ9.js.map → layout-pasFRkKV.js.map} +1 -1
- package/dist/web/public/assets/llm-yp7b5xxL.js +7 -0
- package/dist/web/public/assets/llm-yp7b5xxL.js.map +1 -0
- package/dist/web/public/assets/{loader-circle-9VUMGitw.js → loader-circle-Bbw4pEyE.js} +2 -2
- package/dist/web/public/assets/{loader-circle-9VUMGitw.js.map → loader-circle-Bbw4pEyE.js.map} +1 -1
- package/dist/web/public/assets/{map-pin-BXYvvHry.js → map-pin-DIXHUQgM.js} +2 -2
- package/dist/web/public/assets/{map-pin-BXYvvHry.js.map → map-pin-DIXHUQgM.js.map} +1 -1
- package/dist/web/public/assets/{mcp-BgLdlwSn.js → mcp-DyaljIM_.js} +2 -2
- package/dist/web/public/assets/{mcp-BgLdlwSn.js.map → mcp-DyaljIM_.js.map} +1 -1
- package/dist/web/public/assets/memos-Dkoc157i.js +12 -0
- package/dist/web/public/assets/memos-Dkoc157i.js.map +1 -0
- package/dist/web/public/assets/{messengers-7Phqea62.js → messengers-CcyGDeUI.js} +2 -2
- package/dist/web/public/assets/{messengers-7Phqea62.js.map → messengers-CcyGDeUI.js.map} +1 -1
- package/dist/web/public/assets/{mobile-CV5b6D2W.js → mobile-DqzIv4Xb.js} +2 -2
- package/dist/web/public/assets/{mobile-CV5b6D2W.js.map → mobile-DqzIv4Xb.js.map} +1 -1
- package/dist/web/public/assets/{native-agent-QvIa6LjE.js → native-agent-BQ7WaRGK.js} +2 -2
- package/dist/web/public/assets/{native-agent-QvIa6LjE.js.map → native-agent-BQ7WaRGK.js.map} +1 -1
- package/dist/web/public/assets/{network-BXhEjGhE.js → network-B_yUFAqC.js} +2 -2
- package/dist/web/public/assets/{network-BXhEjGhE.js.map → network-B_yUFAqC.js.map} +1 -1
- package/dist/web/public/assets/{outbox-DHQL7TQb.js → outbox-l8aVOZqO.js} +2 -2
- package/dist/web/public/assets/{outbox-DHQL7TQb.js.map → outbox-l8aVOZqO.js.map} +1 -1
- package/dist/web/public/assets/{pagination-VKuPb1Ot.js → pagination-BAKRGKa9.js} +2 -2
- package/dist/web/public/assets/{pagination-VKuPb1Ot.js.map → pagination-BAKRGKa9.js.map} +1 -1
- package/dist/web/public/assets/{persona-CWug2GLR.js → persona-D3VL9Rg1.js} +2 -2
- package/dist/web/public/assets/{persona-CWug2GLR.js.map → persona-D3VL9Rg1.js.map} +1 -1
- package/dist/web/public/assets/{plans-CZoEs5SY.js → plans-BBB5e9my.js} +2 -2
- package/dist/web/public/assets/{plans-CZoEs5SY.js.map → plans-BBB5e9my.js.map} +1 -1
- package/dist/web/public/assets/{play-CfSn5Vdl.js → play-7-Wd369f.js} +2 -2
- package/dist/web/public/assets/{play-CfSn5Vdl.js.map → play-7-Wd369f.js.map} +1 -1
- package/dist/web/public/assets/{plus-Z8l4CiqJ.js → plus-B0sfZy-j.js} +2 -2
- package/dist/web/public/assets/{plus-Z8l4CiqJ.js.map → plus-B0sfZy-j.js.map} +1 -1
- package/dist/web/public/assets/{policy-CutDSEPW.js → policy-BM1WRXH0.js} +2 -2
- package/dist/web/public/assets/{policy-CutDSEPW.js.map → policy-BM1WRXH0.js.map} +1 -1
- package/dist/web/public/assets/{qr-code-DgU5aiM6.js → qr-code-DcKs5fi3.js} +2 -2
- package/dist/web/public/assets/{qr-code-DgU5aiM6.js.map → qr-code-DcKs5fi3.js.map} +1 -1
- package/dist/web/public/assets/{react-Cb2sDjhD.js → react-DlP5eolq.js} +2 -2
- package/dist/web/public/assets/{react-Cb2sDjhD.js.map → react-DlP5eolq.js.map} +1 -1
- package/dist/web/public/assets/{refresh-ccw-D2CWiyU_.js → refresh-ccw-uNKeBeRl.js} +2 -2
- package/dist/web/public/assets/{refresh-ccw-D2CWiyU_.js.map → refresh-ccw-uNKeBeRl.js.map} +1 -1
- package/dist/web/public/assets/{reminders-Cb6Izedg.js → reminders-DHM8K0_O.js} +2 -2
- package/dist/web/public/assets/{reminders-Cb6Izedg.js.map → reminders-DHM8K0_O.js.map} +1 -1
- package/dist/web/public/assets/{save-DB0BDYTs.js → save-qwJa5_SA.js} +2 -2
- package/dist/web/public/assets/{save-DB0BDYTs.js.map → save-qwJa5_SA.js.map} +1 -1
- package/dist/web/public/assets/{schedules-8mSjE14D.js → schedules-Bcd0wbT4.js} +2 -2
- package/dist/web/public/assets/{schedules-8mSjE14D.js.map → schedules-Bcd0wbT4.js.map} +1 -1
- package/dist/web/public/assets/{search-Con69NhG.js → search-BUlzNWrj.js} +2 -2
- package/dist/web/public/assets/{search-Con69NhG.js.map → search-BUlzNWrj.js.map} +1 -1
- package/dist/web/public/assets/{search-B4fHilZ0.js → search-i1tP2maJ.js} +2 -2
- package/dist/web/public/assets/{search-B4fHilZ0.js.map → search-i1tP2maJ.js.map} +1 -1
- package/dist/web/public/assets/{security-BTe3zUg8.js → security-DgJyTT4g.js} +2 -2
- package/dist/web/public/assets/{security-BTe3zUg8.js.map → security-DgJyTT4g.js.map} +1 -1
- package/dist/web/public/assets/{service-C7SqcwfL.js → service-A0Hzear0.js} +2 -2
- package/dist/web/public/assets/{service-C7SqcwfL.js.map → service-A0Hzear0.js.map} +1 -1
- package/dist/web/public/assets/{shield-alert-CKFVsGgI.js → shield-alert-DrnN6fz_.js} +2 -2
- package/dist/web/public/assets/{shield-alert-CKFVsGgI.js.map → shield-alert-DrnN6fz_.js.map} +1 -1
- package/dist/web/public/assets/{status-badge-BSkpyN4D.js → status-badge-Ryzf96Pl.js} +2 -2
- package/dist/web/public/assets/{status-badge-BSkpyN4D.js.map → status-badge-Ryzf96Pl.js.map} +1 -1
- package/dist/web/public/assets/{subtasks-Bel-I1Sk.js → subtasks-Bzh3o3EF.js} +2 -2
- package/dist/web/public/assets/{subtasks-Bel-I1Sk.js.map → subtasks-Bzh3o3EF.js.map} +1 -1
- package/dist/web/public/assets/{table-CPn1MRcy.js → table-BbAOSyc8.js} +2 -2
- package/dist/web/public/assets/{table-CPn1MRcy.js.map → table-BbAOSyc8.js.map} +1 -1
- package/dist/web/public/assets/{topn-Ba3RjcK1.js → topn-DkhYw-Gp.js} +2 -2
- package/dist/web/public/assets/{topn-Ba3RjcK1.js.map → topn-DkhYw-Gp.js.map} +1 -1
- package/dist/web/public/assets/{trash-2-Dfov8aHD.js → trash-2-CA0cLpnU.js} +2 -2
- package/dist/web/public/assets/{trash-2-Dfov8aHD.js.map → trash-2-CA0cLpnU.js.map} +1 -1
- package/dist/web/public/assets/{use-background-tasks-BQrEeUwY.js → use-background-tasks-B64YjlA8.js} +2 -2
- package/dist/web/public/assets/{use-background-tasks-BQrEeUwY.js.map → use-background-tasks-B64YjlA8.js.map} +1 -1
- package/dist/web/public/assets/{use-event-stream-DgGpGKop.js → use-event-stream-I1lMFEfh.js} +2 -2
- package/dist/web/public/assets/{use-event-stream-DgGpGKop.js.map → use-event-stream-I1lMFEfh.js.map} +1 -1
- package/dist/web/public/assets/{use-llm-admin-DYekqogG.js → use-llm-admin-DY2axI4D.js} +2 -2
- package/dist/web/public/assets/{use-llm-admin-DYekqogG.js.map → use-llm-admin-DY2axI4D.js.map} +1 -1
- package/dist/web/public/assets/{use-memory-DbJ4pP2Z.js → use-memory-BYEjVWbU.js} +2 -2
- package/dist/web/public/assets/{use-memory-DbJ4pP2Z.js.map → use-memory-BYEjVWbU.js.map} +1 -1
- package/dist/web/public/assets/{use-observability-C2M6WZ9W.js → use-observability-Coj02yDo.js} +2 -2
- package/dist/web/public/assets/{use-observability-C2M6WZ9W.js.map → use-observability-Coj02yDo.js.map} +1 -1
- package/dist/web/public/assets/{use-settings-DMdaoWsB.js → use-settings-i1MhlkyC.js} +2 -2
- package/dist/web/public/assets/{use-settings-DMdaoWsB.js.map → use-settings-i1MhlkyC.js.map} +1 -1
- package/dist/web/public/assets/{use-workspace-BHG7h3jQ.js → use-workspace-DgEM35PY.js} +2 -2
- package/dist/web/public/assets/{use-workspace-BHG7h3jQ.js.map → use-workspace-DgEM35PY.js.map} +1 -1
- package/dist/web/public/assets/{useQuery-PdiC7-sY.js → useQuery-CY2iazjN.js} +2 -2
- package/dist/web/public/assets/{useQuery-PdiC7-sY.js.map → useQuery-CY2iazjN.js.map} +1 -1
- package/dist/web/public/assets/{vector-DnZM3OXU.js → vector-Ic76u2hY.js} +2 -2
- package/dist/web/public/assets/{vector-DnZM3OXU.js.map → vector-Ic76u2hY.js.map} +1 -1
- package/dist/web/public/assets/{viewer-Dz6k0YKp.js → viewer-BXbUN1Rl.js} +2 -2
- package/dist/web/public/assets/{viewer-Dz6k0YKp.js.map → viewer-BXbUN1Rl.js.map} +1 -1
- package/dist/web/public/assets/{workspace-BnXrWS3j.js → workspace-CUg0JPn6.js} +3 -3
- package/dist/web/public/assets/{workspace-BnXrWS3j.js.map → workspace-CUg0JPn6.js.map} +1 -1
- package/dist/web/public/assets/{workspaces-CSS_UBEi.js → workspaces-C-wb5FQj.js} +2 -2
- package/dist/web/public/assets/{workspaces-CSS_UBEi.js.map → workspaces-C-wb5FQj.js.map} +1 -1
- package/dist/web/public/assets/{x-DG-JKVw_.js → x-D1iSuoqg.js} +2 -2
- package/dist/web/public/assets/{x-DG-JKVw_.js.map → x-D1iSuoqg.js.map} +1 -1
- package/dist/web/public/index.html +2 -2
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +6 -0
- package/dist/web/server.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/public/assets/dialog-bAIDaO-6.js +0 -6
- package/dist/web/public/assets/dialog-bAIDaO-6.js.map +0 -1
- package/dist/web/public/assets/index-O0BQoyzo.js +0 -199
- package/dist/web/public/assets/index-O0BQoyzo.js.map +0 -1
- package/dist/web/public/assets/llm-CPIRNQU2.js +0 -7
- package/dist/web/public/assets/llm-CPIRNQU2.js.map +0 -1
- package/dist/web/public/assets/memos-CfneX9DH.js +0 -12
- package/dist/web/public/assets/memos-CfneX9DH.js.map +0 -1
|
@@ -0,0 +1,1045 @@
|
|
|
1
|
+
"""Tests for continuous-learning-v2 instinct-cli.py
|
|
2
|
+
|
|
3
|
+
Covers:
|
|
4
|
+
- parse_instinct_file() — content preservation, edge cases
|
|
5
|
+
- _validate_file_path() — path traversal blocking
|
|
6
|
+
- detect_project() — project detection with mocked git/env
|
|
7
|
+
- load_all_instincts() — loading from project + global dirs, dedup
|
|
8
|
+
- _load_instincts_from_dir() — directory scanning
|
|
9
|
+
- cmd_projects() — listing projects from registry
|
|
10
|
+
- cmd_status() — status display
|
|
11
|
+
- _promote_specific() — single instinct promotion
|
|
12
|
+
- _promote_auto() — auto-promotion across projects
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import importlib.util
|
|
16
|
+
import io
|
|
17
|
+
import json
|
|
18
|
+
import os
|
|
19
|
+
import sys
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
from types import SimpleNamespace
|
|
22
|
+
from unittest import mock
|
|
23
|
+
|
|
24
|
+
import pytest
|
|
25
|
+
|
|
26
|
+
# Load instinct-cli.py (hyphenated filename requires importlib)
|
|
27
|
+
_spec = importlib.util.spec_from_file_location(
|
|
28
|
+
"instinct_cli",
|
|
29
|
+
os.path.join(os.path.dirname(__file__), "instinct-cli.py"),
|
|
30
|
+
)
|
|
31
|
+
_mod = importlib.util.module_from_spec(_spec)
|
|
32
|
+
_spec.loader.exec_module(_mod)
|
|
33
|
+
|
|
34
|
+
parse_instinct_file = _mod.parse_instinct_file
|
|
35
|
+
_validate_file_path = _mod._validate_file_path
|
|
36
|
+
detect_project = _mod.detect_project
|
|
37
|
+
load_all_instincts = _mod.load_all_instincts
|
|
38
|
+
load_project_only_instincts = _mod.load_project_only_instincts
|
|
39
|
+
_load_instincts_from_dir = _mod._load_instincts_from_dir
|
|
40
|
+
cmd_status = _mod.cmd_status
|
|
41
|
+
cmd_projects = _mod.cmd_projects
|
|
42
|
+
_promote_specific = _mod._promote_specific
|
|
43
|
+
_promote_auto = _mod._promote_auto
|
|
44
|
+
_find_cross_project_instincts = _mod._find_cross_project_instincts
|
|
45
|
+
load_registry = _mod.load_registry
|
|
46
|
+
_validate_instinct_id = _mod._validate_instinct_id
|
|
47
|
+
_validate_import_url = _mod._validate_import_url
|
|
48
|
+
_update_registry = _mod._update_registry
|
|
49
|
+
_confidence_bar = _mod._confidence_bar
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# ─────────────────────────────────────────────
|
|
53
|
+
# Fixtures
|
|
54
|
+
# ─────────────────────────────────────────────
|
|
55
|
+
|
|
56
|
+
SAMPLE_INSTINCT_YAML = """\
|
|
57
|
+
---
|
|
58
|
+
id: test-instinct
|
|
59
|
+
trigger: "when writing tests"
|
|
60
|
+
confidence: 0.8
|
|
61
|
+
domain: testing
|
|
62
|
+
scope: project
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Action
|
|
66
|
+
Always write tests first.
|
|
67
|
+
|
|
68
|
+
## Evidence
|
|
69
|
+
TDD leads to better design.
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
SAMPLE_GLOBAL_INSTINCT_YAML = """\
|
|
73
|
+
---
|
|
74
|
+
id: global-instinct
|
|
75
|
+
trigger: "always"
|
|
76
|
+
confidence: 0.9
|
|
77
|
+
domain: security
|
|
78
|
+
scope: global
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Action
|
|
82
|
+
Validate all user input.
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@pytest.fixture
|
|
87
|
+
def project_tree(tmp_path):
|
|
88
|
+
"""Create a realistic project directory tree for testing."""
|
|
89
|
+
homunculus = tmp_path / ".claude" / "homunculus"
|
|
90
|
+
projects_dir = homunculus / "projects"
|
|
91
|
+
global_personal = homunculus / "instincts" / "personal"
|
|
92
|
+
global_inherited = homunculus / "instincts" / "inherited"
|
|
93
|
+
global_evolved = homunculus / "evolved"
|
|
94
|
+
|
|
95
|
+
for d in [
|
|
96
|
+
global_personal, global_inherited,
|
|
97
|
+
global_evolved / "skills", global_evolved / "commands", global_evolved / "agents",
|
|
98
|
+
projects_dir,
|
|
99
|
+
]:
|
|
100
|
+
d.mkdir(parents=True, exist_ok=True)
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
"root": tmp_path,
|
|
104
|
+
"homunculus": homunculus,
|
|
105
|
+
"projects_dir": projects_dir,
|
|
106
|
+
"global_personal": global_personal,
|
|
107
|
+
"global_inherited": global_inherited,
|
|
108
|
+
"global_evolved": global_evolved,
|
|
109
|
+
"registry_file": homunculus / "projects.json",
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@pytest.fixture
|
|
114
|
+
def patch_globals(project_tree, monkeypatch):
|
|
115
|
+
"""Patch module-level globals to use tmp_path-based directories."""
|
|
116
|
+
monkeypatch.setattr(_mod, "HOMUNCULUS_DIR", project_tree["homunculus"])
|
|
117
|
+
monkeypatch.setattr(_mod, "PROJECTS_DIR", project_tree["projects_dir"])
|
|
118
|
+
monkeypatch.setattr(_mod, "REGISTRY_FILE", project_tree["registry_file"])
|
|
119
|
+
monkeypatch.setattr(_mod, "GLOBAL_PERSONAL_DIR", project_tree["global_personal"])
|
|
120
|
+
monkeypatch.setattr(_mod, "GLOBAL_INHERITED_DIR", project_tree["global_inherited"])
|
|
121
|
+
monkeypatch.setattr(_mod, "GLOBAL_EVOLVED_DIR", project_tree["global_evolved"])
|
|
122
|
+
monkeypatch.setattr(_mod, "GLOBAL_OBSERVATIONS_FILE", project_tree["homunculus"] / "observations.jsonl")
|
|
123
|
+
return project_tree
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _make_project(tree, pid="abc123", pname="test-project"):
|
|
127
|
+
"""Create project directory structure and return a project dict."""
|
|
128
|
+
project_dir = tree["projects_dir"] / pid
|
|
129
|
+
personal_dir = project_dir / "instincts" / "personal"
|
|
130
|
+
inherited_dir = project_dir / "instincts" / "inherited"
|
|
131
|
+
for d in [personal_dir, inherited_dir,
|
|
132
|
+
project_dir / "evolved" / "skills",
|
|
133
|
+
project_dir / "evolved" / "commands",
|
|
134
|
+
project_dir / "evolved" / "agents",
|
|
135
|
+
project_dir / "observations.archive"]:
|
|
136
|
+
d.mkdir(parents=True, exist_ok=True)
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
"id": pid,
|
|
140
|
+
"name": pname,
|
|
141
|
+
"root": str(tree["root"] / "fake-repo"),
|
|
142
|
+
"remote": "https://github.com/test/test-project.git",
|
|
143
|
+
"project_dir": project_dir,
|
|
144
|
+
"instincts_personal": personal_dir,
|
|
145
|
+
"instincts_inherited": inherited_dir,
|
|
146
|
+
"evolved_dir": project_dir / "evolved",
|
|
147
|
+
"observations_file": project_dir / "observations.jsonl",
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
# ─────────────────────────────────────────────
|
|
152
|
+
# parse_instinct_file tests
|
|
153
|
+
# ─────────────────────────────────────────────
|
|
154
|
+
|
|
155
|
+
MULTI_SECTION = """\
|
|
156
|
+
---
|
|
157
|
+
id: instinct-a
|
|
158
|
+
trigger: "when coding"
|
|
159
|
+
confidence: 0.9
|
|
160
|
+
domain: general
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Action
|
|
164
|
+
Do thing A.
|
|
165
|
+
|
|
166
|
+
## Examples
|
|
167
|
+
- Example A1
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
id: instinct-b
|
|
171
|
+
trigger: "when testing"
|
|
172
|
+
confidence: 0.7
|
|
173
|
+
domain: testing
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Action
|
|
177
|
+
Do thing B.
|
|
178
|
+
"""
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def test_multiple_instincts_preserve_content():
|
|
182
|
+
result = parse_instinct_file(MULTI_SECTION)
|
|
183
|
+
assert len(result) == 2
|
|
184
|
+
assert "Do thing A." in result[0]["content"]
|
|
185
|
+
assert "Example A1" in result[0]["content"]
|
|
186
|
+
assert "Do thing B." in result[1]["content"]
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def test_single_instinct_preserves_content():
|
|
190
|
+
content = """\
|
|
191
|
+
---
|
|
192
|
+
id: solo
|
|
193
|
+
trigger: "when reviewing"
|
|
194
|
+
confidence: 0.8
|
|
195
|
+
domain: review
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Action
|
|
199
|
+
Check for security issues.
|
|
200
|
+
|
|
201
|
+
## Evidence
|
|
202
|
+
Prevents vulnerabilities.
|
|
203
|
+
"""
|
|
204
|
+
result = parse_instinct_file(content)
|
|
205
|
+
assert len(result) == 1
|
|
206
|
+
assert "Check for security issues." in result[0]["content"]
|
|
207
|
+
assert "Prevents vulnerabilities." in result[0]["content"]
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def test_empty_content_no_error():
|
|
211
|
+
content = """\
|
|
212
|
+
---
|
|
213
|
+
id: empty
|
|
214
|
+
trigger: "placeholder"
|
|
215
|
+
confidence: 0.5
|
|
216
|
+
domain: general
|
|
217
|
+
---
|
|
218
|
+
"""
|
|
219
|
+
result = parse_instinct_file(content)
|
|
220
|
+
assert len(result) == 1
|
|
221
|
+
assert result[0]["content"] == ""
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def test_parse_no_id_skipped():
|
|
225
|
+
"""Instincts without an 'id' field should be silently dropped."""
|
|
226
|
+
content = """\
|
|
227
|
+
---
|
|
228
|
+
trigger: "when doing nothing"
|
|
229
|
+
confidence: 0.5
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
No id here.
|
|
233
|
+
"""
|
|
234
|
+
result = parse_instinct_file(content)
|
|
235
|
+
assert len(result) == 0
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def test_parse_confidence_is_float():
|
|
239
|
+
content = """\
|
|
240
|
+
---
|
|
241
|
+
id: float-check
|
|
242
|
+
trigger: "when parsing"
|
|
243
|
+
confidence: 0.42
|
|
244
|
+
domain: general
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
Body.
|
|
248
|
+
"""
|
|
249
|
+
result = parse_instinct_file(content)
|
|
250
|
+
assert isinstance(result[0]["confidence"], float)
|
|
251
|
+
assert result[0]["confidence"] == pytest.approx(0.42)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def test_parse_trigger_strips_quotes():
|
|
255
|
+
content = """\
|
|
256
|
+
---
|
|
257
|
+
id: quote-check
|
|
258
|
+
trigger: "when quoting"
|
|
259
|
+
confidence: 0.5
|
|
260
|
+
domain: general
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
Body.
|
|
264
|
+
"""
|
|
265
|
+
result = parse_instinct_file(content)
|
|
266
|
+
assert result[0]["trigger"] == "when quoting"
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def test_parse_empty_string():
|
|
270
|
+
result = parse_instinct_file("")
|
|
271
|
+
assert result == []
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
def test_parse_garbage_input():
|
|
275
|
+
result = parse_instinct_file("this is not yaml at all\nno frontmatter here")
|
|
276
|
+
assert result == []
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
# ─────────────────────────────────────────────
|
|
280
|
+
# _validate_file_path tests
|
|
281
|
+
# ─────────────────────────────────────────────
|
|
282
|
+
|
|
283
|
+
def test_validate_normal_path(tmp_path):
|
|
284
|
+
test_file = tmp_path / "test.yaml"
|
|
285
|
+
test_file.write_text("hello")
|
|
286
|
+
result = _validate_file_path(str(test_file), must_exist=True)
|
|
287
|
+
assert result == test_file.resolve()
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def test_validate_rejects_etc():
|
|
291
|
+
with pytest.raises(ValueError, match="system directory"):
|
|
292
|
+
_validate_file_path("/etc/passwd")
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def test_validate_rejects_var_log():
|
|
296
|
+
with pytest.raises(ValueError, match="system directory"):
|
|
297
|
+
_validate_file_path("/var/log/syslog")
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
def test_validate_rejects_usr():
|
|
301
|
+
with pytest.raises(ValueError, match="system directory"):
|
|
302
|
+
_validate_file_path("/usr/local/bin/foo")
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def test_validate_rejects_proc():
|
|
306
|
+
with pytest.raises(ValueError, match="system directory"):
|
|
307
|
+
_validate_file_path("/proc/self/status")
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
def test_validate_must_exist_fails(tmp_path):
|
|
311
|
+
with pytest.raises(ValueError, match="does not exist"):
|
|
312
|
+
_validate_file_path(str(tmp_path / "nonexistent.yaml"), must_exist=True)
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
def test_validate_home_expansion(tmp_path):
|
|
316
|
+
"""Tilde expansion should work."""
|
|
317
|
+
result = _validate_file_path("~/test.yaml")
|
|
318
|
+
assert str(result).startswith(str(Path.home()))
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def test_validate_relative_path(tmp_path, monkeypatch):
|
|
322
|
+
"""Relative paths should be resolved."""
|
|
323
|
+
monkeypatch.chdir(tmp_path)
|
|
324
|
+
test_file = tmp_path / "rel.yaml"
|
|
325
|
+
test_file.write_text("content")
|
|
326
|
+
result = _validate_file_path("rel.yaml", must_exist=True)
|
|
327
|
+
assert result == test_file.resolve()
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
def test_validate_import_url_rejects_http():
|
|
331
|
+
"""Remote imports should not downgrade to plaintext HTTP."""
|
|
332
|
+
with pytest.raises(ValueError, match="require https"):
|
|
333
|
+
_validate_import_url("http://example.com/instincts.yaml")
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
def test_validate_import_url_rejects_private_hosts(monkeypatch):
|
|
337
|
+
"""Remote imports should not resolve to private or loopback addresses."""
|
|
338
|
+
monkeypatch.setattr(
|
|
339
|
+
_mod.socket,
|
|
340
|
+
"getaddrinfo",
|
|
341
|
+
lambda *args, **kwargs: [(None, None, None, None, ("127.0.0.1", 443))],
|
|
342
|
+
)
|
|
343
|
+
with pytest.raises(ValueError, match="non-public address"):
|
|
344
|
+
_validate_import_url("https://example.com/instincts.yaml")
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
def test_validate_import_url_allows_public_https(monkeypatch):
|
|
348
|
+
monkeypatch.setattr(
|
|
349
|
+
_mod.socket,
|
|
350
|
+
"getaddrinfo",
|
|
351
|
+
lambda *args, **kwargs: [(None, None, None, None, ("93.184.216.34", 443))],
|
|
352
|
+
)
|
|
353
|
+
assert _validate_import_url("https://example.com/instincts.yaml") == "https://example.com/instincts.yaml"
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
# ─────────────────────────────────────────────
|
|
357
|
+
# detect_project tests
|
|
358
|
+
# ─────────────────────────────────────────────
|
|
359
|
+
|
|
360
|
+
def test_detect_project_global_fallback(patch_globals, monkeypatch):
|
|
361
|
+
"""When no git and no env var, should return global project."""
|
|
362
|
+
monkeypatch.delenv("CLAUDE_PROJECT_DIR", raising=False)
|
|
363
|
+
|
|
364
|
+
# Mock subprocess.run to simulate git not available
|
|
365
|
+
def mock_run(*args, **kwargs):
|
|
366
|
+
raise FileNotFoundError("git not found")
|
|
367
|
+
|
|
368
|
+
monkeypatch.setattr("subprocess.run", mock_run)
|
|
369
|
+
|
|
370
|
+
project = detect_project()
|
|
371
|
+
assert project["id"] == "global"
|
|
372
|
+
assert project["name"] == "global"
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
def test_detect_project_from_env(patch_globals, monkeypatch, tmp_path):
|
|
376
|
+
"""CLAUDE_PROJECT_DIR env var should be used as project root."""
|
|
377
|
+
fake_repo = tmp_path / "my-repo"
|
|
378
|
+
fake_repo.mkdir()
|
|
379
|
+
monkeypatch.setenv("CLAUDE_PROJECT_DIR", str(fake_repo))
|
|
380
|
+
|
|
381
|
+
# Mock git remote to return a URL
|
|
382
|
+
def mock_run(cmd, **kwargs):
|
|
383
|
+
if "rev-parse" in cmd:
|
|
384
|
+
return SimpleNamespace(returncode=0, stdout=str(fake_repo) + "\n", stderr="")
|
|
385
|
+
if "get-url" in cmd:
|
|
386
|
+
return SimpleNamespace(returncode=0, stdout="https://github.com/test/my-repo.git\n", stderr="")
|
|
387
|
+
return SimpleNamespace(returncode=1, stdout="", stderr="")
|
|
388
|
+
|
|
389
|
+
monkeypatch.setattr("subprocess.run", mock_run)
|
|
390
|
+
|
|
391
|
+
project = detect_project()
|
|
392
|
+
assert project["id"] != "global"
|
|
393
|
+
assert project["name"] == "my-repo"
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
def test_detect_project_git_timeout(patch_globals, monkeypatch):
|
|
397
|
+
"""Git timeout should fall through to global."""
|
|
398
|
+
monkeypatch.delenv("CLAUDE_PROJECT_DIR", raising=False)
|
|
399
|
+
import subprocess as sp
|
|
400
|
+
|
|
401
|
+
def mock_run(cmd, **kwargs):
|
|
402
|
+
raise sp.TimeoutExpired(cmd, 5)
|
|
403
|
+
|
|
404
|
+
monkeypatch.setattr("subprocess.run", mock_run)
|
|
405
|
+
|
|
406
|
+
project = detect_project()
|
|
407
|
+
assert project["id"] == "global"
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
def test_detect_project_creates_directories(patch_globals, monkeypatch, tmp_path):
|
|
411
|
+
"""detect_project should create the project dir structure."""
|
|
412
|
+
fake_repo = tmp_path / "structured-repo"
|
|
413
|
+
fake_repo.mkdir()
|
|
414
|
+
monkeypatch.setenv("CLAUDE_PROJECT_DIR", str(fake_repo))
|
|
415
|
+
|
|
416
|
+
def mock_run(cmd, **kwargs):
|
|
417
|
+
if "rev-parse" in cmd:
|
|
418
|
+
return SimpleNamespace(returncode=0, stdout=str(fake_repo) + "\n", stderr="")
|
|
419
|
+
if "get-url" in cmd:
|
|
420
|
+
return SimpleNamespace(returncode=1, stdout="", stderr="no remote")
|
|
421
|
+
return SimpleNamespace(returncode=1, stdout="", stderr="")
|
|
422
|
+
|
|
423
|
+
monkeypatch.setattr("subprocess.run", mock_run)
|
|
424
|
+
|
|
425
|
+
project = detect_project()
|
|
426
|
+
assert project["instincts_personal"].exists()
|
|
427
|
+
assert project["instincts_inherited"].exists()
|
|
428
|
+
assert (project["evolved_dir"] / "skills").exists()
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
# ─────────────────────────────────────────────
|
|
432
|
+
# _load_instincts_from_dir tests
|
|
433
|
+
# ─────────────────────────────────────────────
|
|
434
|
+
|
|
435
|
+
def test_load_from_empty_dir(tmp_path):
|
|
436
|
+
result = _load_instincts_from_dir(tmp_path, "personal", "project")
|
|
437
|
+
assert result == []
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
def test_load_from_nonexistent_dir(tmp_path):
|
|
441
|
+
result = _load_instincts_from_dir(tmp_path / "does-not-exist", "personal", "project")
|
|
442
|
+
assert result == []
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
def test_load_annotates_metadata(tmp_path):
|
|
446
|
+
"""Loaded instincts should have _source_file, _source_type, _scope_label."""
|
|
447
|
+
yaml_file = tmp_path / "test.yaml"
|
|
448
|
+
yaml_file.write_text(SAMPLE_INSTINCT_YAML)
|
|
449
|
+
|
|
450
|
+
result = _load_instincts_from_dir(tmp_path, "personal", "project")
|
|
451
|
+
assert len(result) == 1
|
|
452
|
+
assert result[0]["_source_file"] == str(yaml_file)
|
|
453
|
+
assert result[0]["_source_type"] == "personal"
|
|
454
|
+
assert result[0]["_scope_label"] == "project"
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
def test_load_defaults_scope_from_label(tmp_path):
|
|
458
|
+
"""If an instinct has no 'scope' in frontmatter, it should default to scope_label."""
|
|
459
|
+
no_scope_yaml = """\
|
|
460
|
+
---
|
|
461
|
+
id: no-scope
|
|
462
|
+
trigger: "test"
|
|
463
|
+
confidence: 0.5
|
|
464
|
+
domain: general
|
|
465
|
+
---
|
|
466
|
+
|
|
467
|
+
Body.
|
|
468
|
+
"""
|
|
469
|
+
(tmp_path / "no-scope.yaml").write_text(no_scope_yaml)
|
|
470
|
+
result = _load_instincts_from_dir(tmp_path, "inherited", "global")
|
|
471
|
+
assert result[0]["scope"] == "global"
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
def test_load_preserves_explicit_scope(tmp_path):
|
|
475
|
+
"""If frontmatter has explicit scope, it should be preserved."""
|
|
476
|
+
yaml_file = tmp_path / "test.yaml"
|
|
477
|
+
yaml_file.write_text(SAMPLE_INSTINCT_YAML)
|
|
478
|
+
|
|
479
|
+
result = _load_instincts_from_dir(tmp_path, "personal", "global")
|
|
480
|
+
# Frontmatter says scope: project, scope_label is global
|
|
481
|
+
# The explicit scope should be preserved (not overwritten)
|
|
482
|
+
assert result[0]["scope"] == "project"
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
def test_load_handles_corrupt_file(tmp_path, capsys):
|
|
486
|
+
"""Corrupt YAML files should be warned about but not crash."""
|
|
487
|
+
# A file that will cause parse_instinct_file to return empty
|
|
488
|
+
(tmp_path / "good.yaml").write_text(SAMPLE_INSTINCT_YAML)
|
|
489
|
+
(tmp_path / "bad.yaml").write_text("not yaml\nno frontmatter")
|
|
490
|
+
|
|
491
|
+
result = _load_instincts_from_dir(tmp_path, "personal", "project")
|
|
492
|
+
# bad.yaml has no valid instincts (no id), so only good.yaml contributes
|
|
493
|
+
assert len(result) == 1
|
|
494
|
+
assert result[0]["id"] == "test-instinct"
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
def test_load_supports_yml_extension(tmp_path):
|
|
498
|
+
yml_file = tmp_path / "test.yml"
|
|
499
|
+
yml_file.write_text(SAMPLE_INSTINCT_YAML)
|
|
500
|
+
|
|
501
|
+
result = _load_instincts_from_dir(tmp_path, "personal", "project")
|
|
502
|
+
ids = {i["id"] for i in result}
|
|
503
|
+
assert "test-instinct" in ids
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
def test_load_supports_md_extension(tmp_path):
|
|
507
|
+
md_file = tmp_path / "legacy-instinct.md"
|
|
508
|
+
md_file.write_text(SAMPLE_INSTINCT_YAML)
|
|
509
|
+
|
|
510
|
+
result = _load_instincts_from_dir(tmp_path, "personal", "project")
|
|
511
|
+
ids = {i["id"] for i in result}
|
|
512
|
+
assert "test-instinct" in ids
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
def test_load_instincts_from_dir_uses_utf8_encoding(tmp_path, monkeypatch):
|
|
516
|
+
yaml_file = tmp_path / "test.yaml"
|
|
517
|
+
yaml_file.write_text("placeholder")
|
|
518
|
+
calls = []
|
|
519
|
+
|
|
520
|
+
def fake_read_text(self, *args, **kwargs):
|
|
521
|
+
calls.append(kwargs.get("encoding"))
|
|
522
|
+
return SAMPLE_INSTINCT_YAML
|
|
523
|
+
|
|
524
|
+
monkeypatch.setattr(Path, "read_text", fake_read_text)
|
|
525
|
+
result = _load_instincts_from_dir(tmp_path, "personal", "project")
|
|
526
|
+
assert result[0]["id"] == "test-instinct"
|
|
527
|
+
assert calls == ["utf-8"]
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
# ─────────────────────────────────────────────
|
|
531
|
+
# load_all_instincts tests
|
|
532
|
+
# ─────────────────────────────────────────────
|
|
533
|
+
|
|
534
|
+
def test_load_all_project_and_global(patch_globals):
|
|
535
|
+
"""Should load from both project and global directories."""
|
|
536
|
+
tree = patch_globals
|
|
537
|
+
project = _make_project(tree)
|
|
538
|
+
|
|
539
|
+
# Write a project instinct
|
|
540
|
+
(project["instincts_personal"] / "proj.yaml").write_text(SAMPLE_INSTINCT_YAML)
|
|
541
|
+
# Write a global instinct
|
|
542
|
+
(tree["global_personal"] / "glob.yaml").write_text(SAMPLE_GLOBAL_INSTINCT_YAML)
|
|
543
|
+
|
|
544
|
+
result = load_all_instincts(project)
|
|
545
|
+
ids = {i["id"] for i in result}
|
|
546
|
+
assert "test-instinct" in ids
|
|
547
|
+
assert "global-instinct" in ids
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
def test_load_all_project_overrides_global(patch_globals):
|
|
551
|
+
"""When project and global have same ID, project wins."""
|
|
552
|
+
tree = patch_globals
|
|
553
|
+
project = _make_project(tree)
|
|
554
|
+
|
|
555
|
+
# Same ID but different confidence
|
|
556
|
+
proj_yaml = SAMPLE_INSTINCT_YAML.replace("id: test-instinct", "id: shared-id")
|
|
557
|
+
proj_yaml = proj_yaml.replace("confidence: 0.8", "confidence: 0.9")
|
|
558
|
+
glob_yaml = SAMPLE_GLOBAL_INSTINCT_YAML.replace("id: global-instinct", "id: shared-id")
|
|
559
|
+
glob_yaml = glob_yaml.replace("confidence: 0.9", "confidence: 0.3")
|
|
560
|
+
|
|
561
|
+
(project["instincts_personal"] / "shared.yaml").write_text(proj_yaml)
|
|
562
|
+
(tree["global_personal"] / "shared.yaml").write_text(glob_yaml)
|
|
563
|
+
|
|
564
|
+
result = load_all_instincts(project)
|
|
565
|
+
shared = [i for i in result if i["id"] == "shared-id"]
|
|
566
|
+
assert len(shared) == 1
|
|
567
|
+
assert shared[0]["_scope_label"] == "project"
|
|
568
|
+
assert shared[0]["confidence"] == 0.9
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
def test_load_all_global_only(patch_globals):
|
|
572
|
+
"""Global project should only load global instincts."""
|
|
573
|
+
tree = patch_globals
|
|
574
|
+
(tree["global_personal"] / "glob.yaml").write_text(SAMPLE_GLOBAL_INSTINCT_YAML)
|
|
575
|
+
|
|
576
|
+
global_project = {
|
|
577
|
+
"id": "global",
|
|
578
|
+
"name": "global",
|
|
579
|
+
"root": "",
|
|
580
|
+
"project_dir": tree["homunculus"],
|
|
581
|
+
"instincts_personal": tree["global_personal"],
|
|
582
|
+
"instincts_inherited": tree["global_inherited"],
|
|
583
|
+
"evolved_dir": tree["global_evolved"],
|
|
584
|
+
"observations_file": tree["homunculus"] / "observations.jsonl",
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
result = load_all_instincts(global_project)
|
|
588
|
+
assert len(result) == 1
|
|
589
|
+
assert result[0]["id"] == "global-instinct"
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
def test_load_project_only_excludes_global(patch_globals):
|
|
593
|
+
"""load_project_only_instincts should NOT include global instincts."""
|
|
594
|
+
tree = patch_globals
|
|
595
|
+
project = _make_project(tree)
|
|
596
|
+
|
|
597
|
+
(project["instincts_personal"] / "proj.yaml").write_text(SAMPLE_INSTINCT_YAML)
|
|
598
|
+
(tree["global_personal"] / "glob.yaml").write_text(SAMPLE_GLOBAL_INSTINCT_YAML)
|
|
599
|
+
|
|
600
|
+
result = load_project_only_instincts(project)
|
|
601
|
+
ids = {i["id"] for i in result}
|
|
602
|
+
assert "test-instinct" in ids
|
|
603
|
+
assert "global-instinct" not in ids
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
def test_load_project_only_global_fallback_loads_global(patch_globals):
|
|
607
|
+
"""Global fallback should return global instincts for project-only queries."""
|
|
608
|
+
tree = patch_globals
|
|
609
|
+
(tree["global_personal"] / "glob.yaml").write_text(SAMPLE_GLOBAL_INSTINCT_YAML)
|
|
610
|
+
|
|
611
|
+
global_project = {
|
|
612
|
+
"id": "global",
|
|
613
|
+
"name": "global",
|
|
614
|
+
"root": "",
|
|
615
|
+
"project_dir": tree["homunculus"],
|
|
616
|
+
"instincts_personal": tree["global_personal"],
|
|
617
|
+
"instincts_inherited": tree["global_inherited"],
|
|
618
|
+
"evolved_dir": tree["global_evolved"],
|
|
619
|
+
"observations_file": tree["homunculus"] / "observations.jsonl",
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
result = load_project_only_instincts(global_project)
|
|
623
|
+
assert len(result) == 1
|
|
624
|
+
assert result[0]["id"] == "global-instinct"
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
def test_load_all_empty(patch_globals):
|
|
628
|
+
"""No instincts at all should return empty list."""
|
|
629
|
+
tree = patch_globals
|
|
630
|
+
project = _make_project(tree)
|
|
631
|
+
|
|
632
|
+
result = load_all_instincts(project)
|
|
633
|
+
assert result == []
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
# ─────────────────────────────────────────────
|
|
637
|
+
# cmd_status tests
|
|
638
|
+
# ─────────────────────────────────────────────
|
|
639
|
+
|
|
640
|
+
def test_cmd_status_no_instincts(patch_globals, monkeypatch, capsys):
|
|
641
|
+
"""Status with no instincts should print fallback message."""
|
|
642
|
+
tree = patch_globals
|
|
643
|
+
project = _make_project(tree)
|
|
644
|
+
monkeypatch.setattr(_mod, "detect_project", lambda: project)
|
|
645
|
+
|
|
646
|
+
args = SimpleNamespace()
|
|
647
|
+
ret = cmd_status(args)
|
|
648
|
+
assert ret == 0
|
|
649
|
+
out = capsys.readouterr().out
|
|
650
|
+
assert "No instincts found." in out
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
def test_cmd_status_with_instincts(patch_globals, monkeypatch, capsys):
|
|
654
|
+
"""Status should show project and global instinct counts."""
|
|
655
|
+
tree = patch_globals
|
|
656
|
+
project = _make_project(tree)
|
|
657
|
+
monkeypatch.setattr(_mod, "detect_project", lambda: project)
|
|
658
|
+
|
|
659
|
+
(project["instincts_personal"] / "proj.yaml").write_text(SAMPLE_INSTINCT_YAML)
|
|
660
|
+
(tree["global_personal"] / "glob.yaml").write_text(SAMPLE_GLOBAL_INSTINCT_YAML)
|
|
661
|
+
|
|
662
|
+
args = SimpleNamespace()
|
|
663
|
+
ret = cmd_status(args)
|
|
664
|
+
assert ret == 0
|
|
665
|
+
out = capsys.readouterr().out
|
|
666
|
+
assert "INSTINCT STATUS" in out
|
|
667
|
+
assert "Project instincts: 1" in out
|
|
668
|
+
assert "Global instincts: 1" in out
|
|
669
|
+
assert "PROJECT-SCOPED" in out
|
|
670
|
+
assert "GLOBAL" in out
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
def test_confidence_bar_uses_unicode_when_supported():
|
|
674
|
+
"""Confidence bars should retain block glyphs on UTF-8 streams."""
|
|
675
|
+
stream = SimpleNamespace(encoding="utf-8")
|
|
676
|
+
assert _confidence_bar(0.8, stream=stream) == "\u2588" * 8 + "\u2591" * 2
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
def test_confidence_bar_uses_ascii_when_stream_rejects_block_glyphs():
|
|
680
|
+
"""Windows cp1252 streams cannot encode block glyphs."""
|
|
681
|
+
stream = SimpleNamespace(encoding="cp1252")
|
|
682
|
+
assert _confidence_bar(0.8, stream=stream) == "########.."
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
def test_print_instincts_by_domain_is_cp1252_safe(monkeypatch):
|
|
686
|
+
"""Status rendering should not crash on Windows cp1252 stdout."""
|
|
687
|
+
raw = io.BytesIO()
|
|
688
|
+
stream = io.TextIOWrapper(raw, encoding="cp1252")
|
|
689
|
+
monkeypatch.setattr(_mod.sys, "stdout", stream)
|
|
690
|
+
|
|
691
|
+
_mod._print_instincts_by_domain([{
|
|
692
|
+
"id": "windows-safe",
|
|
693
|
+
"trigger": "when stdout uses cp1252",
|
|
694
|
+
"confidence": 0.8,
|
|
695
|
+
"domain": "platform",
|
|
696
|
+
"scope": "project",
|
|
697
|
+
}])
|
|
698
|
+
|
|
699
|
+
stream.flush()
|
|
700
|
+
out = raw.getvalue().decode("cp1252")
|
|
701
|
+
assert "########.." in out
|
|
702
|
+
assert "\u2588" not in out
|
|
703
|
+
assert "\u2591" not in out
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
def test_cmd_status_returns_int(patch_globals, monkeypatch):
|
|
707
|
+
"""cmd_status should always return an int."""
|
|
708
|
+
tree = patch_globals
|
|
709
|
+
project = _make_project(tree)
|
|
710
|
+
monkeypatch.setattr(_mod, "detect_project", lambda: project)
|
|
711
|
+
|
|
712
|
+
args = SimpleNamespace()
|
|
713
|
+
ret = cmd_status(args)
|
|
714
|
+
assert isinstance(ret, int)
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
# ─────────────────────────────────────────────
|
|
718
|
+
# cmd_projects tests
|
|
719
|
+
# ─────────────────────────────────────────────
|
|
720
|
+
|
|
721
|
+
def test_cmd_projects_empty_registry(patch_globals, capsys):
|
|
722
|
+
"""No projects should print helpful message."""
|
|
723
|
+
args = SimpleNamespace()
|
|
724
|
+
ret = cmd_projects(args)
|
|
725
|
+
assert ret == 0
|
|
726
|
+
out = capsys.readouterr().out
|
|
727
|
+
assert "No projects registered yet." in out
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
def test_cmd_projects_with_registry(patch_globals, capsys):
|
|
731
|
+
"""Should list projects from registry."""
|
|
732
|
+
tree = patch_globals
|
|
733
|
+
|
|
734
|
+
# Create a project dir with instincts
|
|
735
|
+
pid = "test123abc"
|
|
736
|
+
project = _make_project(tree, pid=pid, pname="my-app")
|
|
737
|
+
(project["instincts_personal"] / "inst.yaml").write_text(SAMPLE_INSTINCT_YAML)
|
|
738
|
+
|
|
739
|
+
# Write registry
|
|
740
|
+
registry = {
|
|
741
|
+
pid: {
|
|
742
|
+
"name": "my-app",
|
|
743
|
+
"root": "/home/user/my-app",
|
|
744
|
+
"remote": "https://github.com/user/my-app.git",
|
|
745
|
+
"last_seen": "2025-01-15T12:00:00Z",
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
tree["registry_file"].write_text(json.dumps(registry))
|
|
749
|
+
|
|
750
|
+
args = SimpleNamespace()
|
|
751
|
+
ret = cmd_projects(args)
|
|
752
|
+
assert ret == 0
|
|
753
|
+
out = capsys.readouterr().out
|
|
754
|
+
assert "my-app" in out
|
|
755
|
+
assert pid in out
|
|
756
|
+
assert "1 personal" in out
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
# ─────────────────────────────────────────────
|
|
760
|
+
# _promote_specific tests
|
|
761
|
+
# ─────────────────────────────────────────────
|
|
762
|
+
|
|
763
|
+
def test_promote_specific_not_found(patch_globals, capsys):
|
|
764
|
+
"""Promoting nonexistent instinct should fail."""
|
|
765
|
+
tree = patch_globals
|
|
766
|
+
project = _make_project(tree)
|
|
767
|
+
|
|
768
|
+
ret = _promote_specific(project, "nonexistent", force=True)
|
|
769
|
+
assert ret == 1
|
|
770
|
+
out = capsys.readouterr().out
|
|
771
|
+
assert "not found" in out
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
def test_promote_specific_rejects_invalid_id(patch_globals, capsys):
|
|
775
|
+
"""Path-like instinct IDs should be rejected before file writes."""
|
|
776
|
+
tree = patch_globals
|
|
777
|
+
project = _make_project(tree)
|
|
778
|
+
|
|
779
|
+
ret = _promote_specific(project, "../escape", force=True)
|
|
780
|
+
assert ret == 1
|
|
781
|
+
err = capsys.readouterr().err
|
|
782
|
+
assert "Invalid instinct ID" in err
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
def test_promote_specific_already_global(patch_globals, capsys):
|
|
786
|
+
"""Promoting an instinct that already exists globally should fail."""
|
|
787
|
+
tree = patch_globals
|
|
788
|
+
project = _make_project(tree)
|
|
789
|
+
|
|
790
|
+
# Write same-id instinct in both project and global
|
|
791
|
+
(project["instincts_personal"] / "shared.yaml").write_text(SAMPLE_INSTINCT_YAML)
|
|
792
|
+
global_yaml = SAMPLE_INSTINCT_YAML # same id: test-instinct
|
|
793
|
+
(tree["global_personal"] / "shared.yaml").write_text(global_yaml)
|
|
794
|
+
|
|
795
|
+
ret = _promote_specific(project, "test-instinct", force=True)
|
|
796
|
+
assert ret == 1
|
|
797
|
+
out = capsys.readouterr().out
|
|
798
|
+
assert "already exists in global" in out
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
def test_promote_specific_success(patch_globals, capsys):
|
|
802
|
+
"""Promote a project instinct to global with --force."""
|
|
803
|
+
tree = patch_globals
|
|
804
|
+
project = _make_project(tree)
|
|
805
|
+
|
|
806
|
+
(project["instincts_personal"] / "inst.yaml").write_text(SAMPLE_INSTINCT_YAML)
|
|
807
|
+
|
|
808
|
+
ret = _promote_specific(project, "test-instinct", force=True)
|
|
809
|
+
assert ret == 0
|
|
810
|
+
out = capsys.readouterr().out
|
|
811
|
+
assert "Promoted" in out
|
|
812
|
+
|
|
813
|
+
# Verify file was created in global dir
|
|
814
|
+
promoted_file = tree["global_personal"] / "test-instinct.yaml"
|
|
815
|
+
assert promoted_file.exists()
|
|
816
|
+
content = promoted_file.read_text()
|
|
817
|
+
assert "scope: global" in content
|
|
818
|
+
assert "promoted_from: abc123" in content
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
# ─────────────────────────────────────────────
|
|
822
|
+
# _promote_auto tests
|
|
823
|
+
# ─────────────────────────────────────────────
|
|
824
|
+
|
|
825
|
+
def test_promote_auto_no_candidates(patch_globals, capsys):
|
|
826
|
+
"""Auto-promote with no cross-project instincts should say so."""
|
|
827
|
+
tree = patch_globals
|
|
828
|
+
project = _make_project(tree)
|
|
829
|
+
|
|
830
|
+
# Empty registry
|
|
831
|
+
tree["registry_file"].write_text("{}")
|
|
832
|
+
|
|
833
|
+
ret = _promote_auto(project, force=True, dry_run=False)
|
|
834
|
+
assert ret == 0
|
|
835
|
+
out = capsys.readouterr().out
|
|
836
|
+
assert "No instincts qualify" in out
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
def test_promote_auto_dry_run(patch_globals, capsys):
|
|
840
|
+
"""Dry run should list candidates but not write files."""
|
|
841
|
+
tree = patch_globals
|
|
842
|
+
|
|
843
|
+
# Create two projects with the same high-confidence instinct
|
|
844
|
+
p1 = _make_project(tree, pid="proj1", pname="project-one")
|
|
845
|
+
p2 = _make_project(tree, pid="proj2", pname="project-two")
|
|
846
|
+
|
|
847
|
+
high_conf_yaml = """\
|
|
848
|
+
---
|
|
849
|
+
id: cross-project-instinct
|
|
850
|
+
trigger: "when reviewing"
|
|
851
|
+
confidence: 0.95
|
|
852
|
+
domain: security
|
|
853
|
+
scope: project
|
|
854
|
+
---
|
|
855
|
+
|
|
856
|
+
## Action
|
|
857
|
+
Always review for injection.
|
|
858
|
+
"""
|
|
859
|
+
(p1["instincts_personal"] / "cross.yaml").write_text(high_conf_yaml)
|
|
860
|
+
(p2["instincts_personal"] / "cross.yaml").write_text(high_conf_yaml)
|
|
861
|
+
|
|
862
|
+
# Write registry
|
|
863
|
+
registry = {
|
|
864
|
+
"proj1": {"name": "project-one", "root": "/a", "remote": "", "last_seen": "2025-01-01T00:00:00Z"},
|
|
865
|
+
"proj2": {"name": "project-two", "root": "/b", "remote": "", "last_seen": "2025-01-01T00:00:00Z"},
|
|
866
|
+
}
|
|
867
|
+
tree["registry_file"].write_text(json.dumps(registry))
|
|
868
|
+
|
|
869
|
+
project = p1
|
|
870
|
+
ret = _promote_auto(project, force=True, dry_run=True)
|
|
871
|
+
assert ret == 0
|
|
872
|
+
out = capsys.readouterr().out
|
|
873
|
+
assert "DRY RUN" in out
|
|
874
|
+
assert "cross-project-instinct" in out
|
|
875
|
+
|
|
876
|
+
# Verify no file was created
|
|
877
|
+
assert not (tree["global_personal"] / "cross-project-instinct.yaml").exists()
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
def test_promote_auto_writes_file(patch_globals, capsys):
|
|
881
|
+
"""Auto-promote with force should write global instinct file."""
|
|
882
|
+
tree = patch_globals
|
|
883
|
+
|
|
884
|
+
p1 = _make_project(tree, pid="proj1", pname="project-one")
|
|
885
|
+
p2 = _make_project(tree, pid="proj2", pname="project-two")
|
|
886
|
+
|
|
887
|
+
high_conf_yaml = """\
|
|
888
|
+
---
|
|
889
|
+
id: universal-pattern
|
|
890
|
+
trigger: "when coding"
|
|
891
|
+
confidence: 0.85
|
|
892
|
+
domain: general
|
|
893
|
+
scope: project
|
|
894
|
+
---
|
|
895
|
+
|
|
896
|
+
## Action
|
|
897
|
+
Use descriptive variable names.
|
|
898
|
+
"""
|
|
899
|
+
(p1["instincts_personal"] / "uni.yaml").write_text(high_conf_yaml)
|
|
900
|
+
(p2["instincts_personal"] / "uni.yaml").write_text(high_conf_yaml)
|
|
901
|
+
|
|
902
|
+
registry = {
|
|
903
|
+
"proj1": {"name": "project-one", "root": "/a", "remote": "", "last_seen": "2025-01-01T00:00:00Z"},
|
|
904
|
+
"proj2": {"name": "project-two", "root": "/b", "remote": "", "last_seen": "2025-01-01T00:00:00Z"},
|
|
905
|
+
}
|
|
906
|
+
tree["registry_file"].write_text(json.dumps(registry))
|
|
907
|
+
|
|
908
|
+
ret = _promote_auto(p1, force=True, dry_run=False)
|
|
909
|
+
assert ret == 0
|
|
910
|
+
|
|
911
|
+
promoted = tree["global_personal"] / "universal-pattern.yaml"
|
|
912
|
+
assert promoted.exists()
|
|
913
|
+
content = promoted.read_text()
|
|
914
|
+
assert "scope: global" in content
|
|
915
|
+
assert "auto-promoted" in content
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
def test_promote_auto_skips_invalid_id(patch_globals, capsys):
|
|
919
|
+
tree = patch_globals
|
|
920
|
+
|
|
921
|
+
p1 = _make_project(tree, pid="proj1", pname="project-one")
|
|
922
|
+
p2 = _make_project(tree, pid="proj2", pname="project-two")
|
|
923
|
+
|
|
924
|
+
bad_id_yaml = """\
|
|
925
|
+
---
|
|
926
|
+
id: ../escape
|
|
927
|
+
trigger: "when coding"
|
|
928
|
+
confidence: 0.9
|
|
929
|
+
domain: general
|
|
930
|
+
scope: project
|
|
931
|
+
---
|
|
932
|
+
|
|
933
|
+
## Action
|
|
934
|
+
Invalid id should be skipped.
|
|
935
|
+
"""
|
|
936
|
+
(p1["instincts_personal"] / "bad.yaml").write_text(bad_id_yaml)
|
|
937
|
+
(p2["instincts_personal"] / "bad.yaml").write_text(bad_id_yaml)
|
|
938
|
+
|
|
939
|
+
registry = {
|
|
940
|
+
"proj1": {"name": "project-one", "root": "/a", "remote": "", "last_seen": "2025-01-01T00:00:00Z"},
|
|
941
|
+
"proj2": {"name": "project-two", "root": "/b", "remote": "", "last_seen": "2025-01-01T00:00:00Z"},
|
|
942
|
+
}
|
|
943
|
+
tree["registry_file"].write_text(json.dumps(registry))
|
|
944
|
+
|
|
945
|
+
ret = _promote_auto(p1, force=True, dry_run=False)
|
|
946
|
+
assert ret == 0
|
|
947
|
+
err = capsys.readouterr().err
|
|
948
|
+
assert "Skipping invalid instinct ID" in err
|
|
949
|
+
assert not (tree["global_personal"] / "../escape.yaml").exists()
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
# ─────────────────────────────────────────────
|
|
953
|
+
# _find_cross_project_instincts tests
|
|
954
|
+
# ─────────────────────────────────────────────
|
|
955
|
+
|
|
956
|
+
def test_find_cross_project_empty_registry(patch_globals):
|
|
957
|
+
tree = patch_globals
|
|
958
|
+
tree["registry_file"].write_text("{}")
|
|
959
|
+
result = _find_cross_project_instincts()
|
|
960
|
+
assert result == {}
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+
def test_find_cross_project_single_project(patch_globals):
|
|
964
|
+
"""Single project should return nothing (need 2+)."""
|
|
965
|
+
tree = patch_globals
|
|
966
|
+
p1 = _make_project(tree, pid="proj1", pname="project-one")
|
|
967
|
+
(p1["instincts_personal"] / "inst.yaml").write_text(SAMPLE_INSTINCT_YAML)
|
|
968
|
+
|
|
969
|
+
registry = {"proj1": {"name": "project-one", "root": "/a", "remote": "", "last_seen": "2025-01-01T00:00:00Z"}}
|
|
970
|
+
tree["registry_file"].write_text(json.dumps(registry))
|
|
971
|
+
|
|
972
|
+
result = _find_cross_project_instincts()
|
|
973
|
+
assert result == {}
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
def test_find_cross_project_shared_instinct(patch_globals):
|
|
977
|
+
"""Same instinct ID in 2 projects should be found."""
|
|
978
|
+
tree = patch_globals
|
|
979
|
+
p1 = _make_project(tree, pid="proj1", pname="project-one")
|
|
980
|
+
p2 = _make_project(tree, pid="proj2", pname="project-two")
|
|
981
|
+
|
|
982
|
+
(p1["instincts_personal"] / "shared.yaml").write_text(SAMPLE_INSTINCT_YAML)
|
|
983
|
+
(p2["instincts_personal"] / "shared.yaml").write_text(SAMPLE_INSTINCT_YAML)
|
|
984
|
+
|
|
985
|
+
registry = {
|
|
986
|
+
"proj1": {"name": "project-one", "root": "/a", "remote": "", "last_seen": "2025-01-01T00:00:00Z"},
|
|
987
|
+
"proj2": {"name": "project-two", "root": "/b", "remote": "", "last_seen": "2025-01-01T00:00:00Z"},
|
|
988
|
+
}
|
|
989
|
+
tree["registry_file"].write_text(json.dumps(registry))
|
|
990
|
+
|
|
991
|
+
result = _find_cross_project_instincts()
|
|
992
|
+
assert "test-instinct" in result
|
|
993
|
+
assert len(result["test-instinct"]) == 2
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
# ─────────────────────────────────────────────
|
|
997
|
+
# load_registry tests
|
|
998
|
+
# ─────────────────────────────────────────────
|
|
999
|
+
|
|
1000
|
+
def test_load_registry_missing_file(patch_globals):
|
|
1001
|
+
result = load_registry()
|
|
1002
|
+
assert result == {}
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
def test_load_registry_corrupt_json(patch_globals):
|
|
1006
|
+
tree = patch_globals
|
|
1007
|
+
tree["registry_file"].write_text("not json at all {{{")
|
|
1008
|
+
result = load_registry()
|
|
1009
|
+
assert result == {}
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
def test_load_registry_valid(patch_globals):
|
|
1013
|
+
tree = patch_globals
|
|
1014
|
+
data = {"abc": {"name": "test", "root": "/test"}}
|
|
1015
|
+
tree["registry_file"].write_text(json.dumps(data))
|
|
1016
|
+
result = load_registry()
|
|
1017
|
+
assert result == data
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
def test_load_registry_uses_utf8_encoding(monkeypatch):
|
|
1021
|
+
calls = []
|
|
1022
|
+
|
|
1023
|
+
def fake_open(path, mode="r", *args, **kwargs):
|
|
1024
|
+
calls.append(kwargs.get("encoding"))
|
|
1025
|
+
return io.StringIO("{}")
|
|
1026
|
+
|
|
1027
|
+
monkeypatch.setattr(_mod, "open", fake_open, raising=False)
|
|
1028
|
+
assert load_registry() == {}
|
|
1029
|
+
assert calls == ["utf-8"]
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
def test_validate_instinct_id():
|
|
1033
|
+
assert _validate_instinct_id("good-id_1.0")
|
|
1034
|
+
assert not _validate_instinct_id("../bad")
|
|
1035
|
+
assert not _validate_instinct_id("bad/name")
|
|
1036
|
+
assert not _validate_instinct_id(".hidden")
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
def test_update_registry_atomic_replaces_file(patch_globals):
|
|
1040
|
+
tree = patch_globals
|
|
1041
|
+
_update_registry("abc123", "demo", "/repo", "https://example.com/repo.git")
|
|
1042
|
+
data = json.loads(tree["registry_file"].read_text())
|
|
1043
|
+
assert "abc123" in data
|
|
1044
|
+
leftovers = list(tree["registry_file"].parent.glob(".projects.json.tmp.*"))
|
|
1045
|
+
assert leftovers == []
|