@backendkit-labs/agent-core 0.14.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/dist/agent-discovery/AgentPackageLoader.d.ts +14 -0
- package/dist/agent-discovery/AgentPackageLoader.d.ts.map +1 -0
- package/dist/agent-discovery/AgentPackageLoader.js +78 -0
- package/dist/agent-discovery/AgentPackageLoader.js.map +1 -0
- package/dist/agent-discovery/RemoteAgentRegistry.d.ts +31 -0
- package/dist/agent-discovery/RemoteAgentRegistry.d.ts.map +1 -0
- package/dist/agent-discovery/RemoteAgentRegistry.js +103 -0
- package/dist/agent-discovery/RemoteAgentRegistry.js.map +1 -0
- package/dist/agent-discovery/discoverAgents.d.ts +18 -0
- package/dist/agent-discovery/discoverAgents.d.ts.map +1 -0
- package/dist/agent-discovery/discoverAgents.js +59 -0
- package/dist/agent-discovery/discoverAgents.js.map +1 -0
- package/dist/agent-discovery/index.d.ts +5 -0
- package/dist/agent-discovery/index.d.ts.map +1 -0
- package/dist/agent-discovery/index.js +12 -0
- package/dist/agent-discovery/index.js.map +1 -0
- package/dist/agent-discovery/types.d.ts +42 -0
- package/dist/agent-discovery/types.d.ts.map +1 -0
- package/dist/agent-discovery/types.js +3 -0
- package/dist/agent-discovery/types.js.map +1 -0
- package/dist/agent-memory/EpisodicMemory.d.ts +26 -0
- package/dist/agent-memory/EpisodicMemory.d.ts.map +1 -0
- package/dist/agent-memory/EpisodicMemory.js +83 -0
- package/dist/agent-memory/EpisodicMemory.js.map +1 -0
- package/dist/agent-memory/MemorySystem.d.ts +40 -0
- package/dist/agent-memory/MemorySystem.d.ts.map +1 -0
- package/dist/agent-memory/MemorySystem.js +75 -0
- package/dist/agent-memory/MemorySystem.js.map +1 -0
- package/dist/agent-memory/ProceduralMemory.d.ts +26 -0
- package/dist/agent-memory/ProceduralMemory.d.ts.map +1 -0
- package/dist/agent-memory/ProceduralMemory.js +104 -0
- package/dist/agent-memory/ProceduralMemory.js.map +1 -0
- package/dist/agent-memory/SemanticMemory.d.ts +21 -0
- package/dist/agent-memory/SemanticMemory.d.ts.map +1 -0
- package/dist/agent-memory/SemanticMemory.js +68 -0
- package/dist/agent-memory/SemanticMemory.js.map +1 -0
- package/dist/agent-memory/index.d.ts +9 -0
- package/dist/agent-memory/index.d.ts.map +1 -0
- package/dist/agent-memory/index.js +19 -0
- package/dist/agent-memory/index.js.map +1 -0
- package/dist/agent-memory/scoring.d.ts +10 -0
- package/dist/agent-memory/scoring.d.ts.map +1 -0
- package/dist/agent-memory/scoring.js +32 -0
- package/dist/agent-memory/scoring.js.map +1 -0
- package/dist/agent-memory/stores/InMemoryStore.d.ts +10 -0
- package/dist/agent-memory/stores/InMemoryStore.d.ts.map +1 -0
- package/dist/agent-memory/stores/InMemoryStore.js +25 -0
- package/dist/agent-memory/stores/InMemoryStore.js.map +1 -0
- package/dist/agent-memory/stores/JsonFileStore.d.ts +18 -0
- package/dist/agent-memory/stores/JsonFileStore.d.ts.map +1 -0
- package/dist/agent-memory/stores/JsonFileStore.js +61 -0
- package/dist/agent-memory/stores/JsonFileStore.js.map +1 -0
- package/dist/agent-memory/tools.d.ts +6 -0
- package/dist/agent-memory/tools.d.ts.map +1 -0
- package/dist/agent-memory/tools.js +74 -0
- package/dist/agent-memory/tools.js.map +1 -0
- package/dist/agent-memory/types.d.ts +75 -0
- package/dist/agent-memory/types.d.ts.map +1 -0
- package/dist/agent-memory/types.js +4 -0
- package/dist/agent-memory/types.js.map +1 -0
- package/dist/bootstrap/GlobalSeed.d.ts +46 -0
- package/dist/bootstrap/GlobalSeed.d.ts.map +1 -0
- package/dist/bootstrap/GlobalSeed.js +285 -0
- package/dist/bootstrap/GlobalSeed.js.map +1 -0
- package/dist/bootstrap/config.d.ts +24 -0
- package/dist/bootstrap/config.d.ts.map +1 -0
- package/dist/bootstrap/config.js +71 -0
- package/dist/bootstrap/config.js.map +1 -0
- package/dist/checkpoint/index.d.ts +17 -0
- package/dist/checkpoint/index.d.ts.map +1 -0
- package/dist/checkpoint/index.js +207 -0
- package/dist/checkpoint/index.js.map +1 -0
- package/dist/commands/SlashCommandRegistry.d.ts +98 -0
- package/dist/commands/SlashCommandRegistry.d.ts.map +1 -0
- package/dist/commands/SlashCommandRegistry.js +41 -0
- package/dist/commands/SlashCommandRegistry.js.map +1 -0
- package/dist/commands/builtin.d.ts +7 -0
- package/dist/commands/builtin.d.ts.map +1 -0
- package/dist/commands/builtin.js +694 -0
- package/dist/commands/builtin.js.map +1 -0
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +8 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/context/index.d.ts +8 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +8 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/pipeline.d.ts +46 -0
- package/dist/context/pipeline.d.ts.map +1 -0
- package/dist/context/pipeline.js +111 -0
- package/dist/context/pipeline.js.map +1 -0
- package/dist/context/stages/stage-instructions.d.ts +12 -0
- package/dist/context/stages/stage-instructions.d.ts.map +1 -0
- package/dist/context/stages/stage-instructions.js +76 -0
- package/dist/context/stages/stage-instructions.js.map +1 -0
- package/dist/context/stages/stage-lessons.d.ts +13 -0
- package/dist/context/stages/stage-lessons.d.ts.map +1 -0
- package/dist/context/stages/stage-lessons.js +83 -0
- package/dist/context/stages/stage-lessons.js.map +1 -0
- package/dist/context/stages/stage-manifest.d.ts +11 -0
- package/dist/context/stages/stage-manifest.d.ts.map +1 -0
- package/dist/context/stages/stage-manifest.js +62 -0
- package/dist/context/stages/stage-manifest.js.map +1 -0
- package/dist/context/stages/stage-project.d.ts +10 -0
- package/dist/context/stages/stage-project.d.ts.map +1 -0
- package/dist/context/stages/stage-project.js +55 -0
- package/dist/context/stages/stage-project.js.map +1 -0
- package/dist/context/stages/stage-session.d.ts +12 -0
- package/dist/context/stages/stage-session.d.ts.map +1 -0
- package/dist/context/stages/stage-session.js +69 -0
- package/dist/context/stages/stage-session.js.map +1 -0
- package/dist/delegation/DelegationBus.d.ts +40 -0
- package/dist/delegation/DelegationBus.d.ts.map +1 -0
- package/dist/delegation/DelegationBus.js +68 -0
- package/dist/delegation/DelegationBus.js.map +1 -0
- package/dist/engine/AgentEngine.d.ts +212 -0
- package/dist/engine/AgentEngine.d.ts.map +1 -0
- package/dist/engine/AgentEngine.js +1037 -0
- package/dist/engine/AgentEngine.js.map +1 -0
- package/dist/engine/AgentRegistry.d.ts +13 -0
- package/dist/engine/AgentRegistry.d.ts.map +1 -0
- package/dist/engine/AgentRegistry.js +37 -0
- package/dist/engine/AgentRegistry.js.map +1 -0
- package/dist/engine/IterationManager.d.ts +79 -0
- package/dist/engine/IterationManager.d.ts.map +1 -0
- package/dist/engine/IterationManager.js +103 -0
- package/dist/engine/IterationManager.js.map +1 -0
- package/dist/engine/ProviderRegistry.d.ts +10 -0
- package/dist/engine/ProviderRegistry.d.ts.map +1 -0
- package/dist/engine/ProviderRegistry.js +28 -0
- package/dist/engine/ProviderRegistry.js.map +1 -0
- package/dist/engine/ToolRegistry.d.ts +54 -0
- package/dist/engine/ToolRegistry.d.ts.map +1 -0
- package/dist/engine/ToolRegistry.js +75 -0
- package/dist/engine/ToolRegistry.js.map +1 -0
- package/dist/engine/createBaseEngine.d.ts +169 -0
- package/dist/engine/createBaseEngine.d.ts.map +1 -0
- package/dist/engine/createBaseEngine.js +91 -0
- package/dist/engine/createBaseEngine.js.map +1 -0
- package/dist/engine/qa-orchestrator.d.ts +56 -0
- package/dist/engine/qa-orchestrator.d.ts.map +1 -0
- package/dist/engine/qa-orchestrator.js +163 -0
- package/dist/engine/qa-orchestrator.js.map +1 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +163 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/MCPClientManager.d.ts +65 -0
- package/dist/mcp/MCPClientManager.d.ts.map +1 -0
- package/dist/mcp/MCPClientManager.js +211 -0
- package/dist/mcp/MCPClientManager.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +6 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/types.d.ts +121 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +3 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/memory/SessionMemory.d.ts +9 -0
- package/dist/memory/SessionMemory.d.ts.map +1 -0
- package/dist/memory/SessionMemory.js +20 -0
- package/dist/memory/SessionMemory.js.map +1 -0
- package/dist/observability/CostTracker.d.ts +19 -0
- package/dist/observability/CostTracker.d.ts.map +1 -0
- package/dist/observability/CostTracker.js +64 -0
- package/dist/observability/CostTracker.js.map +1 -0
- package/dist/observability/MetricsCollector.d.ts +17 -0
- package/dist/observability/MetricsCollector.d.ts.map +1 -0
- package/dist/observability/MetricsCollector.js +70 -0
- package/dist/observability/MetricsCollector.js.map +1 -0
- package/dist/observability/ObservabilityManager.d.ts +33 -0
- package/dist/observability/ObservabilityManager.d.ts.map +1 -0
- package/dist/observability/ObservabilityManager.js +107 -0
- package/dist/observability/ObservabilityManager.js.map +1 -0
- package/dist/observability/Tracer.d.ts +23 -0
- package/dist/observability/Tracer.d.ts.map +1 -0
- package/dist/observability/Tracer.js +65 -0
- package/dist/observability/Tracer.js.map +1 -0
- package/dist/observability/index.d.ts +7 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +14 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/types.d.ts +77 -0
- package/dist/observability/types.d.ts.map +1 -0
- package/dist/observability/types.js +15 -0
- package/dist/observability/types.js.map +1 -0
- package/dist/orchestration/audit/audit-ci-blocker.d.ts +31 -0
- package/dist/orchestration/audit/audit-ci-blocker.d.ts.map +1 -0
- package/dist/orchestration/audit/audit-ci-blocker.js +120 -0
- package/dist/orchestration/audit/audit-ci-blocker.js.map +1 -0
- package/dist/orchestration/audit/audit-finding-tracer.d.ts +33 -0
- package/dist/orchestration/audit/audit-finding-tracer.d.ts.map +1 -0
- package/dist/orchestration/audit/audit-finding-tracer.js +126 -0
- package/dist/orchestration/audit/audit-finding-tracer.js.map +1 -0
- package/dist/orchestration/audit/audit-lessons-learned.d.ts +27 -0
- package/dist/orchestration/audit/audit-lessons-learned.d.ts.map +1 -0
- package/dist/orchestration/audit/audit-lessons-learned.js +155 -0
- package/dist/orchestration/audit/audit-lessons-learned.js.map +1 -0
- package/dist/orchestration/audit/audit-pending-issues.d.ts +21 -0
- package/dist/orchestration/audit/audit-pending-issues.d.ts.map +1 -0
- package/dist/orchestration/audit/audit-pending-issues.js +110 -0
- package/dist/orchestration/audit/audit-pending-issues.js.map +1 -0
- package/dist/orchestration/audit/audit-reflection-bridge.d.ts +39 -0
- package/dist/orchestration/audit/audit-reflection-bridge.d.ts.map +1 -0
- package/dist/orchestration/audit/audit-reflection-bridge.js +65 -0
- package/dist/orchestration/audit/audit-reflection-bridge.js.map +1 -0
- package/dist/orchestration/audit/audit-report-renderer.d.ts +30 -0
- package/dist/orchestration/audit/audit-report-renderer.d.ts.map +1 -0
- package/dist/orchestration/audit/audit-report-renderer.js +249 -0
- package/dist/orchestration/audit/audit-report-renderer.js.map +1 -0
- package/dist/orchestration/audit/audit-report-version-manager.d.ts +52 -0
- package/dist/orchestration/audit/audit-report-version-manager.d.ts.map +1 -0
- package/dist/orchestration/audit/audit-report-version-manager.js +144 -0
- package/dist/orchestration/audit/audit-report-version-manager.js.map +1 -0
- package/dist/orchestration/audit/audit-silent-gates-buffer.d.ts +37 -0
- package/dist/orchestration/audit/audit-silent-gates-buffer.d.ts.map +1 -0
- package/dist/orchestration/audit/audit-silent-gates-buffer.js +129 -0
- package/dist/orchestration/audit/audit-silent-gates-buffer.js.map +1 -0
- package/dist/orchestration/audit/index.d.ts +17 -0
- package/dist/orchestration/audit/index.d.ts.map +1 -0
- package/dist/orchestration/audit/index.js +26 -0
- package/dist/orchestration/audit/index.js.map +1 -0
- package/dist/orchestration/audit/types.d.ts +79 -0
- package/dist/orchestration/audit/types.d.ts.map +1 -0
- package/dist/orchestration/audit/types.js +10 -0
- package/dist/orchestration/audit/types.js.map +1 -0
- package/dist/orchestration/audit-reporter.d.ts +133 -0
- package/dist/orchestration/audit-reporter.d.ts.map +1 -0
- package/dist/orchestration/audit-reporter.js +322 -0
- package/dist/orchestration/audit-reporter.js.map +1 -0
- package/dist/orchestration/config-loader.d.ts +51 -0
- package/dist/orchestration/config-loader.d.ts.map +1 -0
- package/dist/orchestration/config-loader.js +215 -0
- package/dist/orchestration/config-loader.js.map +1 -0
- package/dist/orchestration/domain-detector.d.ts +36 -0
- package/dist/orchestration/domain-detector.d.ts.map +1 -0
- package/dist/orchestration/domain-detector.js +157 -0
- package/dist/orchestration/domain-detector.js.map +1 -0
- package/dist/orchestration/fsm.d.ts +86 -0
- package/dist/orchestration/fsm.d.ts.map +1 -0
- package/dist/orchestration/fsm.js +223 -0
- package/dist/orchestration/fsm.js.map +1 -0
- package/dist/orchestration/gate-resolver.d.ts +42 -0
- package/dist/orchestration/gate-resolver.d.ts.map +1 -0
- package/dist/orchestration/gate-resolver.js +94 -0
- package/dist/orchestration/gate-resolver.js.map +1 -0
- package/dist/orchestration/index.d.ts +15 -0
- package/dist/orchestration/index.d.ts.map +1 -0
- package/dist/orchestration/index.js +32 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/orchestration/intent-detector.d.ts +43 -0
- package/dist/orchestration/intent-detector.d.ts.map +1 -0
- package/dist/orchestration/intent-detector.js +249 -0
- package/dist/orchestration/intent-detector.js.map +1 -0
- package/dist/orchestration/keyword-match.d.ts +17 -0
- package/dist/orchestration/keyword-match.d.ts.map +1 -0
- package/dist/orchestration/keyword-match.js +26 -0
- package/dist/orchestration/keyword-match.js.map +1 -0
- package/dist/orchestration/llm-client-adapter.d.ts +11 -0
- package/dist/orchestration/llm-client-adapter.d.ts.map +1 -0
- package/dist/orchestration/llm-client-adapter.js +30 -0
- package/dist/orchestration/llm-client-adapter.js.map +1 -0
- package/dist/orchestration/orchestrator.d.ts +153 -0
- package/dist/orchestration/orchestrator.d.ts.map +1 -0
- package/dist/orchestration/orchestrator.js +471 -0
- package/dist/orchestration/orchestrator.js.map +1 -0
- package/dist/orchestration/policy-engine.d.ts +47 -0
- package/dist/orchestration/policy-engine.d.ts.map +1 -0
- package/dist/orchestration/policy-engine.js +262 -0
- package/dist/orchestration/policy-engine.js.map +1 -0
- package/dist/orchestration/risk-scorer.d.ts +38 -0
- package/dist/orchestration/risk-scorer.d.ts.map +1 -0
- package/dist/orchestration/risk-scorer.js +145 -0
- package/dist/orchestration/risk-scorer.js.map +1 -0
- package/dist/orchestration/task-context.d.ts +195 -0
- package/dist/orchestration/task-context.d.ts.map +1 -0
- package/dist/orchestration/task-context.js +160 -0
- package/dist/orchestration/task-context.js.map +1 -0
- package/dist/orchestration/types.d.ts +111 -0
- package/dist/orchestration/types.d.ts.map +1 -0
- package/dist/orchestration/types.js +37 -0
- package/dist/orchestration/types.js.map +1 -0
- package/dist/qa/index.d.ts +3 -0
- package/dist/qa/index.d.ts.map +1 -0
- package/dist/qa/index.js +6 -0
- package/dist/qa/index.js.map +1 -0
- package/dist/qa/qa-service.d.ts +30 -0
- package/dist/qa/qa-service.d.ts.map +1 -0
- package/dist/qa/qa-service.js +200 -0
- package/dist/qa/qa-service.js.map +1 -0
- package/dist/reflection/commands/domain-commands.d.ts +78 -0
- package/dist/reflection/commands/domain-commands.d.ts.map +1 -0
- package/dist/reflection/commands/domain-commands.js +203 -0
- package/dist/reflection/commands/domain-commands.js.map +1 -0
- package/dist/reflection/domain-registry.d.ts +104 -0
- package/dist/reflection/domain-registry.d.ts.map +1 -0
- package/dist/reflection/domain-registry.js +279 -0
- package/dist/reflection/domain-registry.js.map +1 -0
- package/dist/reflection/domains/agent-domain.d.ts +40 -0
- package/dist/reflection/domains/agent-domain.d.ts.map +1 -0
- package/dist/reflection/domains/agent-domain.js +161 -0
- package/dist/reflection/domains/agent-domain.js.map +1 -0
- package/dist/reflection/domains/audit-domain.d.ts +46 -0
- package/dist/reflection/domains/audit-domain.d.ts.map +1 -0
- package/dist/reflection/domains/audit-domain.js +241 -0
- package/dist/reflection/domains/audit-domain.js.map +1 -0
- package/dist/reflection/domains/bootstrap-domain.d.ts +40 -0
- package/dist/reflection/domains/bootstrap-domain.d.ts.map +1 -0
- package/dist/reflection/domains/bootstrap-domain.js +156 -0
- package/dist/reflection/domains/bootstrap-domain.js.map +1 -0
- package/dist/reflection/domains/commit-domain.d.ts +40 -0
- package/dist/reflection/domains/commit-domain.d.ts.map +1 -0
- package/dist/reflection/domains/commit-domain.js +174 -0
- package/dist/reflection/domains/commit-domain.js.map +1 -0
- package/dist/reflection/domains/test-domain.d.ts +40 -0
- package/dist/reflection/domains/test-domain.d.ts.map +1 -0
- package/dist/reflection/domains/test-domain.js +194 -0
- package/dist/reflection/domains/test-domain.js.map +1 -0
- package/dist/reflection/failure-catalog.d.ts +100 -0
- package/dist/reflection/failure-catalog.d.ts.map +1 -0
- package/dist/reflection/failure-catalog.js +269 -0
- package/dist/reflection/failure-catalog.js.map +1 -0
- package/dist/reflection/historical-loader.d.ts +105 -0
- package/dist/reflection/historical-loader.d.ts.map +1 -0
- package/dist/reflection/historical-loader.js +462 -0
- package/dist/reflection/historical-loader.js.map +1 -0
- package/dist/reflection/hooks/agent-hook.d.ts +72 -0
- package/dist/reflection/hooks/agent-hook.d.ts.map +1 -0
- package/dist/reflection/hooks/agent-hook.js +98 -0
- package/dist/reflection/hooks/agent-hook.js.map +1 -0
- package/dist/reflection/hooks/audit-hook.d.ts +72 -0
- package/dist/reflection/hooks/audit-hook.d.ts.map +1 -0
- package/dist/reflection/hooks/audit-hook.js +112 -0
- package/dist/reflection/hooks/audit-hook.js.map +1 -0
- package/dist/reflection/hooks/bootstrap-hook.d.ts +71 -0
- package/dist/reflection/hooks/bootstrap-hook.d.ts.map +1 -0
- package/dist/reflection/hooks/bootstrap-hook.js +97 -0
- package/dist/reflection/hooks/bootstrap-hook.js.map +1 -0
- package/dist/reflection/hooks/commit-hook.d.ts +63 -0
- package/dist/reflection/hooks/commit-hook.d.ts.map +1 -0
- package/dist/reflection/hooks/commit-hook.js +90 -0
- package/dist/reflection/hooks/commit-hook.js.map +1 -0
- package/dist/reflection/hooks/test-hook.d.ts +65 -0
- package/dist/reflection/hooks/test-hook.d.ts.map +1 -0
- package/dist/reflection/hooks/test-hook.js +99 -0
- package/dist/reflection/hooks/test-hook.js.map +1 -0
- package/dist/reflection/index.d.ts +19 -0
- package/dist/reflection/index.d.ts.map +1 -0
- package/dist/reflection/index.js +40 -0
- package/dist/reflection/index.js.map +1 -0
- package/dist/reflection/lessons-memo-generator.d.ts +60 -0
- package/dist/reflection/lessons-memo-generator.d.ts.map +1 -0
- package/dist/reflection/lessons-memo-generator.js +286 -0
- package/dist/reflection/lessons-memo-generator.js.map +1 -0
- package/dist/reflection/pattern-detector.d.ts +55 -0
- package/dist/reflection/pattern-detector.d.ts.map +1 -0
- package/dist/reflection/pattern-detector.js +137 -0
- package/dist/reflection/pattern-detector.js.map +1 -0
- package/dist/reflection/policy-promoter.d.ts +86 -0
- package/dist/reflection/policy-promoter.d.ts.map +1 -0
- package/dist/reflection/policy-promoter.js +382 -0
- package/dist/reflection/policy-promoter.js.map +1 -0
- package/dist/reflection/reflection-engine.d.ts +160 -0
- package/dist/reflection/reflection-engine.d.ts.map +1 -0
- package/dist/reflection/reflection-engine.js +352 -0
- package/dist/reflection/reflection-engine.js.map +1 -0
- package/dist/reflection/types.d.ts +106 -0
- package/dist/reflection/types.d.ts.map +1 -0
- package/dist/reflection/types.js +64 -0
- package/dist/reflection/types.js.map +1 -0
- package/dist/shared/llm/resilient-client.d.ts +40 -0
- package/dist/shared/llm/resilient-client.d.ts.map +1 -0
- package/dist/shared/llm/resilient-client.js +60 -0
- package/dist/shared/llm/resilient-client.js.map +1 -0
- package/dist/shared/utils/atomic-write.d.ts +7 -0
- package/dist/shared/utils/atomic-write.d.ts.map +1 -0
- package/dist/shared/utils/atomic-write.js +52 -0
- package/dist/shared/utils/atomic-write.js.map +1 -0
- package/dist/shared/utils/git.d.ts +2 -0
- package/dist/shared/utils/git.d.ts.map +1 -0
- package/dist/shared/utils/git.js +17 -0
- package/dist/shared/utils/git.js.map +1 -0
- package/dist/shared/utils/project-key.d.ts +4 -0
- package/dist/shared/utils/project-key.d.ts.map +1 -0
- package/dist/shared/utils/project-key.js +54 -0
- package/dist/shared/utils/project-key.js.map +1 -0
- package/dist/shared/utils/string-utils.d.ts +17 -0
- package/dist/shared/utils/string-utils.d.ts.map +1 -0
- package/dist/shared/utils/string-utils.js +37 -0
- package/dist/shared/utils/string-utils.js.map +1 -0
- package/dist/skills/activator.d.ts +27 -0
- package/dist/skills/activator.d.ts.map +1 -0
- package/dist/skills/activator.js +127 -0
- package/dist/skills/activator.js.map +1 -0
- package/dist/skills/builtins/global.d.ts +7 -0
- package/dist/skills/builtins/global.d.ts.map +1 -0
- package/dist/skills/builtins/global.js +208 -0
- package/dist/skills/builtins/global.js.map +1 -0
- package/dist/skills/builtins/go-pack.d.ts +7 -0
- package/dist/skills/builtins/go-pack.d.ts.map +1 -0
- package/dist/skills/builtins/go-pack.js +263 -0
- package/dist/skills/builtins/go-pack.js.map +1 -0
- package/dist/skills/builtins/java-pack.d.ts +7 -0
- package/dist/skills/builtins/java-pack.d.ts.map +1 -0
- package/dist/skills/builtins/java-pack.js +272 -0
- package/dist/skills/builtins/java-pack.js.map +1 -0
- package/dist/skills/builtins/kotlin-pack.d.ts +9 -0
- package/dist/skills/builtins/kotlin-pack.d.ts.map +1 -0
- package/dist/skills/builtins/kotlin-pack.js +292 -0
- package/dist/skills/builtins/kotlin-pack.js.map +1 -0
- package/dist/skills/builtins/node-pack.d.ts +7 -0
- package/dist/skills/builtins/node-pack.d.ts.map +1 -0
- package/dist/skills/builtins/node-pack.js +750 -0
- package/dist/skills/builtins/node-pack.js.map +1 -0
- package/dist/skills/builtins/python-pack.d.ts +7 -0
- package/dist/skills/builtins/python-pack.d.ts.map +1 -0
- package/dist/skills/builtins/python-pack.js +303 -0
- package/dist/skills/builtins/python-pack.js.map +1 -0
- package/dist/skills/index.d.ts +11 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +24 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/loader.d.ts +39 -0
- package/dist/skills/loader.d.ts.map +1 -0
- package/dist/skills/loader.js +152 -0
- package/dist/skills/loader.js.map +1 -0
- package/dist/skills/manager.d.ts +97 -0
- package/dist/skills/manager.d.ts.map +1 -0
- package/dist/skills/manager.js +296 -0
- package/dist/skills/manager.js.map +1 -0
- package/dist/skills/parse-md-skill.d.ts +14 -0
- package/dist/skills/parse-md-skill.d.ts.map +1 -0
- package/dist/skills/parse-md-skill.js +86 -0
- package/dist/skills/parse-md-skill.js.map +1 -0
- package/dist/skills/providers/github.d.ts +21 -0
- package/dist/skills/providers/github.d.ts.map +1 -0
- package/dist/skills/providers/github.js +146 -0
- package/dist/skills/providers/github.js.map +1 -0
- package/dist/skills/providers/index.d.ts +6 -0
- package/dist/skills/providers/index.d.ts.map +1 -0
- package/dist/skills/providers/index.js +12 -0
- package/dist/skills/providers/index.js.map +1 -0
- package/dist/skills/providers/local.d.ts +16 -0
- package/dist/skills/providers/local.d.ts.map +1 -0
- package/dist/skills/providers/local.js +91 -0
- package/dist/skills/providers/local.js.map +1 -0
- package/dist/skills/providers/obsidian.d.ts +31 -0
- package/dist/skills/providers/obsidian.d.ts.map +1 -0
- package/dist/skills/providers/obsidian.js +141 -0
- package/dist/skills/providers/obsidian.js.map +1 -0
- package/dist/skills/providers/skills-sh.d.ts +32 -0
- package/dist/skills/providers/skills-sh.d.ts.map +1 -0
- package/dist/skills/providers/skills-sh.js +53 -0
- package/dist/skills/providers/skills-sh.js.map +1 -0
- package/dist/skills/providers/types.d.ts +25 -0
- package/dist/skills/providers/types.d.ts.map +1 -0
- package/dist/skills/providers/types.js +3 -0
- package/dist/skills/providers/types.js.map +1 -0
- package/dist/skills/registry.d.ts +18 -0
- package/dist/skills/registry.d.ts.map +1 -0
- package/dist/skills/registry.js +45 -0
- package/dist/skills/registry.js.map +1 -0
- package/dist/skills/types.d.ts +66 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +3 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/tools/defineTool.d.ts +34 -0
- package/dist/tools/defineTool.d.ts.map +1 -0
- package/dist/tools/defineTool.js +63 -0
- package/dist/tools/defineTool.js.map +1 -0
- package/dist/transport/CallbackTransport.d.ts +12 -0
- package/dist/transport/CallbackTransport.d.ts.map +1 -0
- package/dist/transport/CallbackTransport.js +28 -0
- package/dist/transport/CallbackTransport.js.map +1 -0
- package/dist/transport/StdoutTransport.d.ts +9 -0
- package/dist/transport/StdoutTransport.d.ts.map +1 -0
- package/dist/transport/StdoutTransport.js +63 -0
- package/dist/transport/StdoutTransport.js.map +1 -0
- package/dist/transport/Transport.d.ts +8 -0
- package/dist/transport/Transport.d.ts.map +1 -0
- package/dist/transport/Transport.js +3 -0
- package/dist/transport/Transport.js.map +1 -0
- package/dist/triggers/EventBus.d.ts +14 -0
- package/dist/triggers/EventBus.d.ts.map +1 -0
- package/dist/triggers/EventBus.js +18 -0
- package/dist/triggers/EventBus.js.map +1 -0
- package/dist/triggers/TriggerManager.d.ts +28 -0
- package/dist/triggers/TriggerManager.d.ts.map +1 -0
- package/dist/triggers/TriggerManager.js +158 -0
- package/dist/triggers/TriggerManager.js.map +1 -0
- package/dist/triggers/WebhookServer.d.ts +23 -0
- package/dist/triggers/WebhookServer.d.ts.map +1 -0
- package/dist/triggers/WebhookServer.js +127 -0
- package/dist/triggers/WebhookServer.js.map +1 -0
- package/dist/triggers/createAutonomousAgent.d.ts +49 -0
- package/dist/triggers/createAutonomousAgent.d.ts.map +1 -0
- package/dist/triggers/createAutonomousAgent.js +42 -0
- package/dist/triggers/createAutonomousAgent.js.map +1 -0
- package/dist/triggers/index.d.ts +8 -0
- package/dist/triggers/index.d.ts.map +1 -0
- package/dist/triggers/index.js +12 -0
- package/dist/triggers/index.js.map +1 -0
- package/dist/triggers/types.d.ts +35 -0
- package/dist/triggers/types.d.ts.map +1 -0
- package/dist/triggers/types.js +3 -0
- package/dist/triggers/types.js.map +1 -0
- package/dist/types/index.d.ts +256 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/workflow/WorkflowBuilder.d.ts +22 -0
- package/dist/workflow/WorkflowBuilder.d.ts.map +1 -0
- package/dist/workflow/WorkflowBuilder.js +67 -0
- package/dist/workflow/WorkflowBuilder.js.map +1 -0
- package/dist/workflow/WorkflowRunner.d.ts +22 -0
- package/dist/workflow/WorkflowRunner.d.ts.map +1 -0
- package/dist/workflow/WorkflowRunner.js +97 -0
- package/dist/workflow/WorkflowRunner.js.map +1 -0
- package/dist/workflow/index.d.ts +5 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +10 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow/types.d.ts +35 -0
- package/dist/workflow/types.d.ts.map +1 -0
- package/dist/workflow/types.js +3 -0
- package/dist/workflow/types.js.map +1 -0
- package/dist/workspace/index.d.ts +55 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +189 -0
- package/dist/workspace/index.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-pack.js","sourceRoot":"","sources":["../../../src/skills/builtins/node-pack.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACU,QAAA,gBAAgB,GAAY;IACrC;QACI,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,oFAAoF;QACjG,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC;QAChC,QAAQ,EA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uFAmFyD;KAClF;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-pack.d.ts","sourceRoot":"","sources":["../../../src/skills/builtins/python-pack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,EAsSrC,CAAC"}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PYTHON_PACK_SKILLS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Python / FastAPI skill pack (@bk-python).
|
|
6
|
+
* Activated for projects with requirements.txt or pyproject.toml.
|
|
7
|
+
*/
|
|
8
|
+
exports.PYTHON_PACK_SKILLS = [
|
|
9
|
+
{
|
|
10
|
+
name: 'fastapi-patterns',
|
|
11
|
+
version: '1.0.0',
|
|
12
|
+
description: 'FastAPI patterns: routers, Depends, Pydantic models, async handlers',
|
|
13
|
+
scope: 'pack',
|
|
14
|
+
pack: '@bk-python',
|
|
15
|
+
language: ['python'],
|
|
16
|
+
triggers: [
|
|
17
|
+
'fastapi', 'api', 'router', 'endpoint', 'depends', 'dependency',
|
|
18
|
+
'pydantic', 'schema', 'request', 'response', 'handler', 'route',
|
|
19
|
+
'api rest', 'backend', 'servidor', 'server',
|
|
20
|
+
],
|
|
21
|
+
systemPromptAddition: `## FastAPI Patterns
|
|
22
|
+
|
|
23
|
+
### Router modular
|
|
24
|
+
\`\`\`python
|
|
25
|
+
# routers/users.py
|
|
26
|
+
from fastapi import APIRouter, Depends, HTTPException, status
|
|
27
|
+
from app.schemas.user import UserCreate, UserResponse
|
|
28
|
+
from app.services.user import UserService
|
|
29
|
+
from app.dependencies import get_user_service
|
|
30
|
+
|
|
31
|
+
router = APIRouter(prefix="/users", tags=["users"])
|
|
32
|
+
|
|
33
|
+
@router.get("/{user_id}", response_model=UserResponse)
|
|
34
|
+
async def get_user(user_id: UUID, service: UserService = Depends(get_user_service)):
|
|
35
|
+
user = await service.find_by_id(user_id)
|
|
36
|
+
if not user:
|
|
37
|
+
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="User not found")
|
|
38
|
+
return user
|
|
39
|
+
|
|
40
|
+
@router.post("", response_model=UserResponse, status_code=status.HTTP_201_CREATED)
|
|
41
|
+
async def create_user(data: UserCreate, service: UserService = Depends(get_user_service)):
|
|
42
|
+
return await service.create(data)
|
|
43
|
+
\`\`\`
|
|
44
|
+
|
|
45
|
+
### Pydantic schemas (separados de las entidades ORM)
|
|
46
|
+
\`\`\`python
|
|
47
|
+
from pydantic import BaseModel, EmailStr
|
|
48
|
+
from uuid import UUID
|
|
49
|
+
|
|
50
|
+
class UserCreate(BaseModel):
|
|
51
|
+
email: EmailStr
|
|
52
|
+
name: str
|
|
53
|
+
|
|
54
|
+
class UserResponse(BaseModel):
|
|
55
|
+
id: UUID
|
|
56
|
+
email: str
|
|
57
|
+
name: str
|
|
58
|
+
|
|
59
|
+
model_config = {"from_attributes": True} # para mapear desde ORM
|
|
60
|
+
\`\`\`
|
|
61
|
+
|
|
62
|
+
### Dependencias con Depends
|
|
63
|
+
\`\`\`python
|
|
64
|
+
# dependencies.py
|
|
65
|
+
async def get_db() -> AsyncGenerator[AsyncSession, None]:
|
|
66
|
+
async with AsyncSessionLocal() as session:
|
|
67
|
+
yield session
|
|
68
|
+
|
|
69
|
+
async def get_user_service(db: AsyncSession = Depends(get_db)) -> UserService:
|
|
70
|
+
return UserService(UserRepository(db))
|
|
71
|
+
\`\`\`
|
|
72
|
+
|
|
73
|
+
### Reglas
|
|
74
|
+
- Usa \`APIRouter\` por dominio — no pongas todo en \`main.py\`
|
|
75
|
+
- Los schemas de entrada (Create/Update) y salida (Response) son clases separadas
|
|
76
|
+
- Nunca devuelvas modelos ORM directamente — mapea a schemas Pydantic
|
|
77
|
+
- Usa \`status.HTTP_xxx\` en lugar de números crudos`,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'python-error-handling',
|
|
81
|
+
version: '1.0.0',
|
|
82
|
+
description: 'FastAPI exception handling: custom exceptions, global handlers, HTTP errors',
|
|
83
|
+
scope: 'pack',
|
|
84
|
+
pack: '@bk-python',
|
|
85
|
+
language: ['python'],
|
|
86
|
+
triggers: [
|
|
87
|
+
'exception', 'error', 'manejo de errores', 'error handling',
|
|
88
|
+
'httpexception', 'exceptionhandler', '404', '400', '422', '500',
|
|
89
|
+
'try', 'except', 'raise',
|
|
90
|
+
],
|
|
91
|
+
systemPromptAddition: `## Python / FastAPI Error Handling
|
|
92
|
+
|
|
93
|
+
### Excepciones de dominio
|
|
94
|
+
\`\`\`python
|
|
95
|
+
class AppError(Exception):
|
|
96
|
+
"""Base para todos los errores de la aplicación."""
|
|
97
|
+
pass
|
|
98
|
+
|
|
99
|
+
class NotFoundError(AppError):
|
|
100
|
+
def __init__(self, resource: str, id: Any):
|
|
101
|
+
self.resource = resource
|
|
102
|
+
self.id = id
|
|
103
|
+
super().__init__(f"{resource} not found: {id}")
|
|
104
|
+
|
|
105
|
+
class ValidationError(AppError):
|
|
106
|
+
def __init__(self, message: str):
|
|
107
|
+
super().__init__(message)
|
|
108
|
+
|
|
109
|
+
class ConflictError(AppError):
|
|
110
|
+
def __init__(self, message: str):
|
|
111
|
+
super().__init__(message)
|
|
112
|
+
\`\`\`
|
|
113
|
+
|
|
114
|
+
### Handler global en FastAPI
|
|
115
|
+
\`\`\`python
|
|
116
|
+
# main.py
|
|
117
|
+
from fastapi import FastAPI, Request
|
|
118
|
+
from fastapi.responses import JSONResponse
|
|
119
|
+
|
|
120
|
+
app = FastAPI()
|
|
121
|
+
|
|
122
|
+
@app.exception_handler(NotFoundError)
|
|
123
|
+
async def not_found_handler(request: Request, exc: NotFoundError):
|
|
124
|
+
return JSONResponse(status_code=404, content={"detail": str(exc)})
|
|
125
|
+
|
|
126
|
+
@app.exception_handler(ConflictError)
|
|
127
|
+
async def conflict_handler(request: Request, exc: ConflictError):
|
|
128
|
+
return JSONResponse(status_code=409, content={"detail": str(exc)})
|
|
129
|
+
|
|
130
|
+
@app.exception_handler(ValidationError)
|
|
131
|
+
async def validation_handler(request: Request, exc: ValidationError):
|
|
132
|
+
return JSONResponse(status_code=422, content={"detail": str(exc)})
|
|
133
|
+
\`\`\`
|
|
134
|
+
|
|
135
|
+
### En los servicios — lanza excepciones de dominio
|
|
136
|
+
\`\`\`python
|
|
137
|
+
async def find_by_id(self, user_id: UUID) -> User:
|
|
138
|
+
user = await self.repo.find_by_id(user_id)
|
|
139
|
+
if not user:
|
|
140
|
+
raise NotFoundError("User", user_id)
|
|
141
|
+
return user
|
|
142
|
+
\`\`\`
|
|
143
|
+
|
|
144
|
+
### Reglas
|
|
145
|
+
- Los servicios lanzan excepciones de dominio (NotFoundError, etc.) — no HTTPException
|
|
146
|
+
- Los handlers globales convierten excepciones de dominio a respuestas HTTP
|
|
147
|
+
- Nunca devuelvas stack traces al cliente en producción
|
|
148
|
+
- Usa logging estructurado: \`logger.exception("msg", exc_info=True)\``,
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: 'sqlalchemy-patterns',
|
|
152
|
+
version: '1.0.0',
|
|
153
|
+
description: 'Async SQLAlchemy, repository pattern, Alembic migrations',
|
|
154
|
+
scope: 'pack',
|
|
155
|
+
pack: '@bk-python',
|
|
156
|
+
language: ['python'],
|
|
157
|
+
triggers: [
|
|
158
|
+
'sqlalchemy', 'database', 'base de datos', 'orm', 'model', 'modelo',
|
|
159
|
+
'migration', 'migracion', 'alembic', 'session', 'query', 'repository',
|
|
160
|
+
'repositorio', 'postgresql', 'postgres', 'mysql', 'sqlite',
|
|
161
|
+
],
|
|
162
|
+
systemPromptAddition: `## SQLAlchemy (Async) + Repository Pattern
|
|
163
|
+
|
|
164
|
+
### Modelo ORM
|
|
165
|
+
\`\`\`python
|
|
166
|
+
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
|
167
|
+
from sqlalchemy import String
|
|
168
|
+
import uuid
|
|
169
|
+
|
|
170
|
+
class Base(DeclarativeBase):
|
|
171
|
+
pass
|
|
172
|
+
|
|
173
|
+
class UserModel(Base):
|
|
174
|
+
__tablename__ = "users"
|
|
175
|
+
|
|
176
|
+
id: Mapped[uuid.UUID] = mapped_column(primary_key=True, default=uuid.uuid4)
|
|
177
|
+
email: Mapped[str] = mapped_column(String(255), unique=True, nullable=False)
|
|
178
|
+
name: Mapped[str] = mapped_column(String(100), nullable=False)
|
|
179
|
+
created_at: Mapped[datetime] = mapped_column(default=func.now())
|
|
180
|
+
\`\`\`
|
|
181
|
+
|
|
182
|
+
### Repository
|
|
183
|
+
\`\`\`python
|
|
184
|
+
from sqlalchemy.ext.asyncio import AsyncSession
|
|
185
|
+
from sqlalchemy import select
|
|
186
|
+
|
|
187
|
+
class UserRepository:
|
|
188
|
+
def __init__(self, session: AsyncSession):
|
|
189
|
+
self.session = session
|
|
190
|
+
|
|
191
|
+
async def find_by_id(self, user_id: UUID) -> UserModel | None:
|
|
192
|
+
result = await self.session.execute(
|
|
193
|
+
select(UserModel).where(UserModel.id == user_id)
|
|
194
|
+
)
|
|
195
|
+
return result.scalar_one_or_none()
|
|
196
|
+
|
|
197
|
+
async def save(self, user: UserModel) -> UserModel:
|
|
198
|
+
self.session.add(user)
|
|
199
|
+
await self.session.flush() # persiste en la transacción actual
|
|
200
|
+
await self.session.refresh(user)
|
|
201
|
+
return user
|
|
202
|
+
\`\`\`
|
|
203
|
+
|
|
204
|
+
### Sesión async con context manager
|
|
205
|
+
\`\`\`python
|
|
206
|
+
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession, async_sessionmaker
|
|
207
|
+
|
|
208
|
+
engine = create_async_engine(settings.DATABASE_URL)
|
|
209
|
+
AsyncSessionLocal = async_sessionmaker(engine, expire_on_commit=False)
|
|
210
|
+
|
|
211
|
+
# En dependencies.py
|
|
212
|
+
async def get_db() -> AsyncGenerator[AsyncSession, None]:
|
|
213
|
+
async with AsyncSessionLocal() as session:
|
|
214
|
+
async with session.begin(): # commit/rollback automático
|
|
215
|
+
yield session
|
|
216
|
+
\`\`\`
|
|
217
|
+
|
|
218
|
+
### Reglas
|
|
219
|
+
- Usa \`async_sessionmaker\` con \`session.begin()\` para transacciones automáticas
|
|
220
|
+
- Nunca expongas modelos ORM fuera del repositorio — mapea a schemas Pydantic
|
|
221
|
+
- Usa Alembic para migraciones — nunca \`Base.metadata.create_all()\` en producción
|
|
222
|
+
- \`expire_on_commit=False\` evita lazy-loading después del commit`,
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: 'python-testing',
|
|
226
|
+
version: '1.0.0',
|
|
227
|
+
description: 'pytest, fixtures, httpx AsyncClient for FastAPI integration tests',
|
|
228
|
+
scope: 'pack',
|
|
229
|
+
pack: '@bk-python',
|
|
230
|
+
language: ['python'],
|
|
231
|
+
triggers: [
|
|
232
|
+
'test', 'tests', 'testing', 'pytest', 'fixture', 'mock', 'prueba',
|
|
233
|
+
'async test', 'httpx', 'asyncclient', 'coverage', 'cobertura',
|
|
234
|
+
'parametrize', 'conftest',
|
|
235
|
+
],
|
|
236
|
+
systemPromptAddition: `## Python Testing (pytest + httpx)
|
|
237
|
+
|
|
238
|
+
### Test unitario de servicio
|
|
239
|
+
\`\`\`python
|
|
240
|
+
import pytest
|
|
241
|
+
from unittest.mock import AsyncMock, MagicMock
|
|
242
|
+
from app.services.user import UserService
|
|
243
|
+
from app.errors import NotFoundError
|
|
244
|
+
|
|
245
|
+
@pytest.fixture
|
|
246
|
+
def mock_repo():
|
|
247
|
+
return MagicMock()
|
|
248
|
+
|
|
249
|
+
@pytest.fixture
|
|
250
|
+
def user_service(mock_repo):
|
|
251
|
+
return UserService(mock_repo)
|
|
252
|
+
|
|
253
|
+
@pytest.mark.asyncio
|
|
254
|
+
async def test_find_by_id_returns_user(user_service, mock_repo):
|
|
255
|
+
user = User(id=uuid4(), email="ana@example.com", name="Ana")
|
|
256
|
+
mock_repo.find_by_id = AsyncMock(return_value=user)
|
|
257
|
+
|
|
258
|
+
result = await user_service.find_by_id(user.id)
|
|
259
|
+
|
|
260
|
+
assert result.email == "ana@example.com"
|
|
261
|
+
mock_repo.find_by_id.assert_awaited_once_with(user.id)
|
|
262
|
+
|
|
263
|
+
@pytest.mark.asyncio
|
|
264
|
+
async def test_find_by_id_raises_not_found(user_service, mock_repo):
|
|
265
|
+
mock_repo.find_by_id = AsyncMock(return_value=None)
|
|
266
|
+
|
|
267
|
+
with pytest.raises(NotFoundError):
|
|
268
|
+
await user_service.find_by_id(uuid4())
|
|
269
|
+
\`\`\`
|
|
270
|
+
|
|
271
|
+
### Test de API con httpx AsyncClient
|
|
272
|
+
\`\`\`python
|
|
273
|
+
# conftest.py
|
|
274
|
+
import pytest
|
|
275
|
+
from httpx import AsyncClient, ASGITransport
|
|
276
|
+
from app.main import app
|
|
277
|
+
|
|
278
|
+
@pytest.fixture
|
|
279
|
+
async def client():
|
|
280
|
+
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as c:
|
|
281
|
+
yield c
|
|
282
|
+
|
|
283
|
+
# test_users.py
|
|
284
|
+
@pytest.mark.asyncio
|
|
285
|
+
async def test_get_user_returns_200(client):
|
|
286
|
+
response = await client.get(f"/users/{user_id}")
|
|
287
|
+
assert response.status_code == 200
|
|
288
|
+
assert response.json()["email"] == "ana@example.com"
|
|
289
|
+
|
|
290
|
+
@pytest.mark.asyncio
|
|
291
|
+
async def test_get_user_returns_404(client):
|
|
292
|
+
response = await client.get(f"/users/{uuid4()}")
|
|
293
|
+
assert response.status_code == 404
|
|
294
|
+
\`\`\`
|
|
295
|
+
|
|
296
|
+
### Reglas
|
|
297
|
+
- Usa \`pytest-asyncio\` con \`asyncio_mode = "auto"\` en \`pyproject.toml\`
|
|
298
|
+
- Fixtures en \`conftest.py\` — no en cada archivo de test
|
|
299
|
+
- Usa \`AsyncMock\` para mockear funciones async
|
|
300
|
+
- Usa \`pytest.mark.parametrize\` para casos múltiples del mismo test`,
|
|
301
|
+
},
|
|
302
|
+
];
|
|
303
|
+
//# sourceMappingURL=python-pack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-pack.js","sourceRoot":"","sources":["../../../src/skills/builtins/python-pack.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACU,QAAA,kBAAkB,GAAY;IACvC;QACI,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,qEAAqE;QAClF,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,CAAC,QAAQ,CAAC;QACpB,QAAQ,EAAE;YACN,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY;YAC/D,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO;YAC/D,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ;SAC9C;QACD,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qDAwDuB;KAChD;IACD;QACI,IAAI,EAAE,uBAAuB;QAC7B,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,6EAA6E;QAC1F,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,CAAC,QAAQ,CAAC;QACpB,QAAQ,EAAE;YACN,WAAW,EAAE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB;YAC3D,eAAe,EAAE,kBAAkB,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;YAC/D,KAAK,EAAE,QAAQ,EAAE,OAAO;SAC3B;QACD,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uEAyDyC;KAClE;IACD;QACI,IAAI,EAAE,qBAAqB;QAC3B,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,0DAA0D;QACvE,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,CAAC,QAAQ,CAAC;QACpB,QAAQ,EAAE;YACN,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ;YACnE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY;YACrE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ;SAC7D;QACD,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mEA4DqC;KAC9D;IACD;QACI,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,mEAAmE;QAChF,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,CAAC,QAAQ,CAAC;QACpB,QAAQ,EAAE;YACN,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ;YACjE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW;YAC7D,aAAa,EAAE,UAAU;SAC5B;QACD,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sEAgEwC;KACjE;CACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { SkillLoader } from './loader';
|
|
2
|
+
export { SkillManager, createSkillManager } from './manager';
|
|
3
|
+
export type { InstallOptions, InstalledPack } from './manager';
|
|
4
|
+
export { SkillRegistry } from './registry';
|
|
5
|
+
export { SkillActivator } from './activator';
|
|
6
|
+
export { parseMdSkill, skillToMd } from './parse-md-skill';
|
|
7
|
+
export { GitHubProvider, LocalProvider, SkillsShProvider, ObsidianProvider } from './providers';
|
|
8
|
+
export type { SkillSourceProvider, FetchOptions } from './providers';
|
|
9
|
+
export type { Skill, SkillScope, SkillHandler, SkillExecuteResult, SkillToolDefinition, SkillPackSource, TrustConfig, } from './types';
|
|
10
|
+
export type { LoadedSkills } from './loader';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAChG,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACrE,YAAY,EACR,KAAK,EACL,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,WAAW,GACd,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObsidianProvider = exports.SkillsShProvider = exports.LocalProvider = exports.GitHubProvider = exports.skillToMd = exports.parseMdSkill = exports.SkillActivator = exports.SkillRegistry = exports.createSkillManager = exports.SkillManager = exports.SkillLoader = void 0;
|
|
4
|
+
// ── Skill infrastructure (generic, domain-agnostic) ──────────────────────────
|
|
5
|
+
// Builtin skill content (GLOBAL_BUILTIN_SKILLS, NODE_PACK_SKILLS, etc.) has moved
|
|
6
|
+
// to @backendkit-labs/agent-coding — it belongs to the coding agent domain, not the generic core.
|
|
7
|
+
var loader_1 = require("./loader");
|
|
8
|
+
Object.defineProperty(exports, "SkillLoader", { enumerable: true, get: function () { return loader_1.SkillLoader; } });
|
|
9
|
+
var manager_1 = require("./manager");
|
|
10
|
+
Object.defineProperty(exports, "SkillManager", { enumerable: true, get: function () { return manager_1.SkillManager; } });
|
|
11
|
+
Object.defineProperty(exports, "createSkillManager", { enumerable: true, get: function () { return manager_1.createSkillManager; } });
|
|
12
|
+
var registry_1 = require("./registry");
|
|
13
|
+
Object.defineProperty(exports, "SkillRegistry", { enumerable: true, get: function () { return registry_1.SkillRegistry; } });
|
|
14
|
+
var activator_1 = require("./activator");
|
|
15
|
+
Object.defineProperty(exports, "SkillActivator", { enumerable: true, get: function () { return activator_1.SkillActivator; } });
|
|
16
|
+
var parse_md_skill_1 = require("./parse-md-skill");
|
|
17
|
+
Object.defineProperty(exports, "parseMdSkill", { enumerable: true, get: function () { return parse_md_skill_1.parseMdSkill; } });
|
|
18
|
+
Object.defineProperty(exports, "skillToMd", { enumerable: true, get: function () { return parse_md_skill_1.skillToMd; } });
|
|
19
|
+
var providers_1 = require("./providers");
|
|
20
|
+
Object.defineProperty(exports, "GitHubProvider", { enumerable: true, get: function () { return providers_1.GitHubProvider; } });
|
|
21
|
+
Object.defineProperty(exports, "LocalProvider", { enumerable: true, get: function () { return providers_1.LocalProvider; } });
|
|
22
|
+
Object.defineProperty(exports, "SkillsShProvider", { enumerable: true, get: function () { return providers_1.SkillsShProvider; } });
|
|
23
|
+
Object.defineProperty(exports, "ObsidianProvider", { enumerable: true, get: function () { return providers_1.ObsidianProvider; } });
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,kFAAkF;AAClF,kGAAkG;AAClG,mCAAuC;AAA9B,qGAAA,WAAW,OAAA;AACpB,qCAA6D;AAApD,uGAAA,YAAY,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAEzC,uCAA2C;AAAlC,yGAAA,aAAa,OAAA;AACtB,yCAA6C;AAApC,2GAAA,cAAc,OAAA;AACvB,mDAA2D;AAAlD,8GAAA,YAAY,OAAA;AAAE,2GAAA,SAAS,OAAA;AAChC,yCAAgG;AAAvF,2GAAA,cAAc,OAAA;AAAE,0GAAA,aAAa,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAAE,6GAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Skill } from './types';
|
|
2
|
+
export interface LoadedSkills {
|
|
3
|
+
global: Skill[];
|
|
4
|
+
packs: Skill[];
|
|
5
|
+
projectConfig: Skill[];
|
|
6
|
+
project: Skill[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Loads skills from the 4-layer hierarchy.
|
|
10
|
+
* Supports both .yaml/.yml (legacy) and .md (with frontmatter) skill files.
|
|
11
|
+
*
|
|
12
|
+
* Layer structure (appName = 'bk-agent'):
|
|
13
|
+
* ~/.bk-agent/skills/global/ ← language-agnostic, loaded for every project
|
|
14
|
+
* ~/.bk-agent/skills/packs/{pack}/ ← installed language packs
|
|
15
|
+
* ~/.bk-agent/projects/{key}/skills/← auto-generated skills (not git-tracked)
|
|
16
|
+
* {cwd}/.bk-agent/skills/ ← project-specific, git-tracked
|
|
17
|
+
*
|
|
18
|
+
* On a name collision, precedence is project > projectConfig > pack > global > builtin.
|
|
19
|
+
* When both .yaml and .md exist for the same skill name, .md wins.
|
|
20
|
+
*/
|
|
21
|
+
export declare class SkillLoader {
|
|
22
|
+
private readonly appName;
|
|
23
|
+
constructor(appName: string);
|
|
24
|
+
loadGlobal(): Promise<Skill[]>;
|
|
25
|
+
loadPacks(): Promise<Skill[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Loads project-specific skills from inside the project directory.
|
|
28
|
+
* Path: {cwd}/.{appName}/skills/*.{yaml,yml,md}
|
|
29
|
+
*/
|
|
30
|
+
loadProject(cwd: string): Promise<Skill[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Loads auto-generated skills from ~/.{appName}/projects/{key}/skills/.
|
|
33
|
+
* These are generated by LearningRouter — not git-tracked.
|
|
34
|
+
*/
|
|
35
|
+
loadProjectConfig(projectDir: string): Promise<Skill[]>;
|
|
36
|
+
loadAll(cwd?: string, projectDir?: string): Promise<LoadedSkills>;
|
|
37
|
+
private loadFromDir;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/skills/loader.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAc,MAAM,SAAS,CAAC;AAEjD,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,aAAa,EAAE,KAAK,EAAE,CAAC;IACvB,OAAO,EAAE,KAAK,EAAE,CAAC;CACpB;AAID;;;;;;;;;;;;GAYG;AACH,qBAAa,WAAW;IACR,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,MAAM;IAEtC,UAAU,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAK9B,SAAS,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAkBnC;;;OAGG;IACG,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAKhD;;;OAGG;IACG,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAKvD,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;YAUzD,WAAW;CAsC5B"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.SkillLoader = void 0;
|
|
37
|
+
const fs = __importStar(require("fs/promises"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const yaml = __importStar(require("yaml"));
|
|
40
|
+
const result_1 = require("@backendkit-labs/result");
|
|
41
|
+
const project_key_1 = require("../shared/utils/project-key");
|
|
42
|
+
const parse_md_skill_1 = require("./parse-md-skill");
|
|
43
|
+
const SKILL_FILE_RE = /\.(ya?ml|md)$/i;
|
|
44
|
+
/**
|
|
45
|
+
* Loads skills from the 4-layer hierarchy.
|
|
46
|
+
* Supports both .yaml/.yml (legacy) and .md (with frontmatter) skill files.
|
|
47
|
+
*
|
|
48
|
+
* Layer structure (appName = 'bk-agent'):
|
|
49
|
+
* ~/.bk-agent/skills/global/ ← language-agnostic, loaded for every project
|
|
50
|
+
* ~/.bk-agent/skills/packs/{pack}/ ← installed language packs
|
|
51
|
+
* ~/.bk-agent/projects/{key}/skills/← auto-generated skills (not git-tracked)
|
|
52
|
+
* {cwd}/.bk-agent/skills/ ← project-specific, git-tracked
|
|
53
|
+
*
|
|
54
|
+
* On a name collision, precedence is project > projectConfig > pack > global > builtin.
|
|
55
|
+
* When both .yaml and .md exist for the same skill name, .md wins.
|
|
56
|
+
*/
|
|
57
|
+
class SkillLoader {
|
|
58
|
+
appName;
|
|
59
|
+
constructor(appName) {
|
|
60
|
+
this.appName = appName;
|
|
61
|
+
}
|
|
62
|
+
async loadGlobal() {
|
|
63
|
+
const dir = path.join((0, project_key_1.getFrameworkDir)(this.appName), 'skills', 'global');
|
|
64
|
+
return this.loadFromDir(dir, 'global');
|
|
65
|
+
}
|
|
66
|
+
async loadPacks() {
|
|
67
|
+
const packsDir = path.join((0, project_key_1.getFrameworkDir)(this.appName), 'skills', 'packs');
|
|
68
|
+
const accessResult = await (0, result_1.run)(() => fs.access(packsDir));
|
|
69
|
+
if (!(0, result_1.isOk)(accessResult))
|
|
70
|
+
return [];
|
|
71
|
+
const entries = await (0, result_1.run)(() => fs.readdir(packsDir, { withFileTypes: true }));
|
|
72
|
+
if (!(0, result_1.isOk)(entries))
|
|
73
|
+
return [];
|
|
74
|
+
const skills = [];
|
|
75
|
+
for (const entry of entries.value) {
|
|
76
|
+
if (!entry.isDirectory())
|
|
77
|
+
continue;
|
|
78
|
+
const packDir = path.join(packsDir, entry.name);
|
|
79
|
+
const packSkills = await this.loadFromDir(packDir, 'pack', entry.name);
|
|
80
|
+
skills.push(...packSkills);
|
|
81
|
+
}
|
|
82
|
+
return skills;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Loads project-specific skills from inside the project directory.
|
|
86
|
+
* Path: {cwd}/.{appName}/skills/*.{yaml,yml,md}
|
|
87
|
+
*/
|
|
88
|
+
async loadProject(cwd) {
|
|
89
|
+
const dir = path.join(cwd, `.${this.appName}`, 'skills');
|
|
90
|
+
return this.loadFromDir(dir, 'project');
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Loads auto-generated skills from ~/.{appName}/projects/{key}/skills/.
|
|
94
|
+
* These are generated by LearningRouter — not git-tracked.
|
|
95
|
+
*/
|
|
96
|
+
async loadProjectConfig(projectDir) {
|
|
97
|
+
const dir = path.join(projectDir, 'skills');
|
|
98
|
+
return this.loadFromDir(dir, 'project');
|
|
99
|
+
}
|
|
100
|
+
async loadAll(cwd, projectDir) {
|
|
101
|
+
const [global, packs, projectConfig, project] = await Promise.all([
|
|
102
|
+
this.loadGlobal(),
|
|
103
|
+
this.loadPacks(),
|
|
104
|
+
projectDir ? this.loadProjectConfig(projectDir) : Promise.resolve([]),
|
|
105
|
+
cwd ? this.loadProject(cwd) : Promise.resolve([]),
|
|
106
|
+
]);
|
|
107
|
+
return { global, packs, projectConfig, project };
|
|
108
|
+
}
|
|
109
|
+
async loadFromDir(dir, scope, pack) {
|
|
110
|
+
const accessResult = await (0, result_1.run)(() => fs.access(dir));
|
|
111
|
+
if (!(0, result_1.isOk)(accessResult))
|
|
112
|
+
return [];
|
|
113
|
+
const filesResult = await (0, result_1.run)(() => fs.readdir(dir));
|
|
114
|
+
if (!(0, result_1.isOk)(filesResult))
|
|
115
|
+
return [];
|
|
116
|
+
// Sort so .yaml/.yml are processed before .md — .md overwrites on name collision
|
|
117
|
+
const files = filesResult.value
|
|
118
|
+
.filter(f => SKILL_FILE_RE.test(f))
|
|
119
|
+
.sort((a, b) => {
|
|
120
|
+
const aIsMd = /\.md$/i.test(a);
|
|
121
|
+
const bIsMd = /\.md$/i.test(b);
|
|
122
|
+
if (aIsMd === bIsMd)
|
|
123
|
+
return 0;
|
|
124
|
+
return aIsMd ? 1 : -1; // .md last → wins on Map.set
|
|
125
|
+
});
|
|
126
|
+
const byName = new Map();
|
|
127
|
+
for (const file of files) {
|
|
128
|
+
const filePath = path.join(dir, file);
|
|
129
|
+
const contentResult = await (0, result_1.run)(() => fs.readFile(filePath, 'utf-8'));
|
|
130
|
+
if (!(0, result_1.isOk)(contentResult))
|
|
131
|
+
continue;
|
|
132
|
+
const skill = /\.md$/i.test(file)
|
|
133
|
+
? (0, parse_md_skill_1.parseMdSkill)(contentResult.value)
|
|
134
|
+
: parseYamlSkill(contentResult.value);
|
|
135
|
+
if (!skill?.name)
|
|
136
|
+
continue;
|
|
137
|
+
byName.set(skill.name, { ...skill, scope, ...(pack ? { pack } : {}) });
|
|
138
|
+
}
|
|
139
|
+
return Array.from(byName.values());
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.SkillLoader = SkillLoader;
|
|
143
|
+
function parseYamlSkill(content) {
|
|
144
|
+
const parsed = (0, result_1.fromThrowable)(() => yaml.parse(content));
|
|
145
|
+
if (!parsed.ok || !parsed.value?.name)
|
|
146
|
+
return null;
|
|
147
|
+
const skill = parsed.value;
|
|
148
|
+
if (!Array.isArray(skill.triggers))
|
|
149
|
+
skill.triggers = [];
|
|
150
|
+
return skill;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/skills/loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,2CAA6B;AAC7B,2CAA6B;AAC7B,oDAAmE;AACnE,6DAA8D;AAC9D,qDAAgD;AAUhD,MAAM,aAAa,GAAG,gBAAgB,CAAC;AAEvC;;;;;;;;;;;;GAYG;AACH,MAAa,WAAW;IACS;IAA7B,YAA6B,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAAG,CAAC;IAEhD,KAAK,CAAC,UAAU;QACZ,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,IAAA,6BAAe,EAAC,IAAI,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACzE,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,SAAS;QACX,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAA,6BAAe,EAAC,IAAI,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC7E,MAAM,YAAY,GAAG,MAAM,IAAA,YAAG,EAAC,GAAG,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAA,aAAI,EAAC,YAAY,CAAC;YAAE,OAAO,EAAE,CAAC;QAEnC,MAAM,OAAO,GAAG,MAAM,IAAA,YAAG,EAAC,GAAG,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,IAA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