@su-record/vibe 3.0.0 → 3.2.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/CLAUDE.md +2 -2
- package/README.en.md +6 -4
- package/README.md +5 -3
- package/dist/__tests__/wiring-integrity.test.d.ts +2 -0
- package/dist/__tests__/wiring-integrity.test.d.ts.map +1 -0
- package/dist/__tests__/wiring-integrity.test.js +160 -0
- package/dist/__tests__/wiring-integrity.test.js.map +1 -0
- package/dist/cli/commands/info.d.ts.map +1 -1
- package/dist/cli/commands/info.js +2 -1
- package/dist/cli/commands/info.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +4 -2
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/index.js +102 -128
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/postinstall/claude-agents.d.ts.map +1 -1
- package/dist/cli/postinstall/claude-agents.js +0 -5
- package/dist/cli/postinstall/claude-agents.js.map +1 -1
- package/dist/cli/postinstall/constants.d.ts +6 -0
- package/dist/cli/postinstall/constants.d.ts.map +1 -1
- package/dist/cli/postinstall/constants.js +42 -60
- package/dist/cli/postinstall/constants.js.map +1 -1
- package/dist/cli/postinstall/inline-skills.js +2 -2
- package/dist/cli/postinstall/inline-skills.js.map +1 -1
- package/dist/cli/postinstall/main.d.ts.map +1 -1
- package/dist/cli/postinstall/main.js +2 -0
- package/dist/cli/postinstall/main.js.map +1 -1
- package/dist/cli/postinstall.d.ts +6 -1
- package/dist/cli/postinstall.d.ts.map +1 -1
- package/dist/cli/postinstall.js +6 -1
- package/dist/cli/postinstall.js.map +1 -1
- package/dist/cli/setup/GlobalInstaller.d.ts +1 -15
- package/dist/cli/setup/GlobalInstaller.d.ts.map +1 -1
- package/dist/cli/setup/GlobalInstaller.js +16 -115
- package/dist/cli/setup/GlobalInstaller.js.map +1 -1
- package/dist/cli/setup/GlobalInstaller.test.d.ts +2 -0
- package/dist/cli/setup/GlobalInstaller.test.d.ts.map +1 -0
- package/dist/cli/setup/GlobalInstaller.test.js +16 -0
- package/dist/cli/setup/GlobalInstaller.test.js.map +1 -0
- package/dist/cli/setup/ProjectSetup.js +2 -2
- package/dist/cli/setup/ProjectSetup.js.map +1 -1
- package/dist/cli/setup.d.ts +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +1 -1
- package/dist/cli/setup.js.map +1 -1
- package/dist/infra/lib/SkillRepository.js +1 -1
- package/dist/infra/lib/evolution/__tests__/integration.test.js +0 -42
- package/dist/infra/lib/evolution/__tests__/integration.test.js.map +1 -1
- package/hooks/scripts/__tests__/.vibe/command-log.txt +3 -78
- package/hooks/scripts/__tests__/clone-behaviors.test.js +97 -1
- package/hooks/scripts/__tests__/clone-merge-responsive.test.js +106 -0
- package/hooks/scripts/__tests__/code-check-memory-write.test.js +81 -0
- package/hooks/scripts/__tests__/step-counter.test.js +21 -0
- package/hooks/scripts/auto-format.js +2 -11
- package/hooks/scripts/auto-test.js +2 -11
- package/hooks/scripts/clone-extract.js +388 -38
- package/hooks/scripts/clone-merge-responsive.js +184 -0
- package/hooks/scripts/clone-spec.js +33 -8
- package/hooks/scripts/clone-validate.js +15 -9
- package/hooks/scripts/code-check.js +27 -55
- package/hooks/scripts/lib/glob.js +32 -0
- package/hooks/scripts/lib/hook-context.js +19 -2
- package/hooks/scripts/post-edit.js +2 -3
- package/hooks/scripts/prompt-dispatcher.js +1 -1
- package/hooks/scripts/scope-guard.js +3 -42
- package/hooks/scripts/sentinel-guard.js +5 -20
- package/hooks/scripts/session-start.js +2 -2
- package/hooks/scripts/step-counter.js +35 -57
- package/package.json +6 -4
- package/skills/clone/SKILL.md +74 -203
- package/skills/clone/references/capture-rules.md +48 -0
- package/skills/clone/references/legal-and-error-recovery.md +40 -0
- package/skills/clone/references/refine-rules.md +61 -0
- package/skills/clone/references/scaffold-phases.md +59 -0
- package/skills/clone/references/setup-and-layout.md +30 -0
- package/skills/docs/SKILL.md +39 -4
- package/skills/docs/references/api-docs-changelog.md +34 -0
- package/skills/docs/references/codemaps-output.md +23 -0
- package/{agents/diagrammer.md → skills/docs/references/diagram-spec.md} +2 -15
- package/skills/exec-plan/SKILL.md +1 -1
- package/skills/exec-plan/templates/plan.md +1 -1
- package/skills/handoff/SKILL.md +3 -3
- package/skills/handoff/templates/handoff.md +1 -1
- package/skills/vibe/SKILL.md +3 -2
- package/skills/vibe.analyze/SKILL.md +12 -249
- package/skills/vibe.analyze/references/output-templates.md +188 -0
- package/skills/vibe.analyze/references/quality-gate.md +93 -0
- package/skills/vibe.clone/SKILL.md +52 -19
- package/skills/vibe.continue/SKILL.md +32 -0
- package/skills/vibe.design/SKILL.md +23 -1
- package/skills/vibe.design/references/ui-preview.md +20 -0
- package/skills/vibe.docs/SKILL.md +4 -2
- package/skills/vibe.figma/SKILL.md +33 -260
- package/skills/vibe.figma/references/branch-phases.md +113 -0
- package/skills/vibe.figma/references/state-schema.md +42 -0
- package/skills/vibe.figma/references/step-algorithms.md +204 -0
- package/skills/vibe.image/SKILL.md +62 -0
- package/skills/vibe.image/references/image-generation-examples.md +39 -0
- package/skills/vibe.reason/SKILL.md +3 -183
- package/skills/vibe.reason/references/output-format-template.md +57 -0
- package/skills/vibe.reason/references/quality-rubrics.md +94 -0
- package/skills/vibe.reason/references/worked-example.md +45 -0
- package/skills/vibe.review/SKILL.md +13 -348
- package/skills/vibe.review/references/boundary-check.md +25 -0
- package/skills/vibe.review/references/output-template.md +74 -0
- package/skills/vibe.review/references/quality-gate.md +84 -0
- package/skills/vibe.review/references/race-mode.md +117 -0
- package/skills/vibe.review/references/worked-examples.md +94 -0
- package/vibe/templates/claudemd-template.md +1 -1
- package/agents/acceptance-tester.md +0 -56
- package/agents/documenter.md +0 -43
- package/agents/figma/figma-engineer.md +0 -76
- package/dist/cli/llm/gemini-commands.d.ts +0 -25
- package/dist/cli/llm/gemini-commands.d.ts.map +0 -1
- package/dist/cli/llm/gemini-commands.js +0 -143
- package/dist/cli/llm/gemini-commands.js.map +0 -1
- package/dist/cli/postinstall/codex-agents.d.ts +0 -24
- package/dist/cli/postinstall/codex-agents.d.ts.map +0 -1
- package/dist/cli/postinstall/codex-agents.js +0 -114
- package/dist/cli/postinstall/codex-agents.js.map +0 -1
- package/dist/cli/postinstall/codex-instruction.d.ts +0 -10
- package/dist/cli/postinstall/codex-instruction.d.ts.map +0 -1
- package/dist/cli/postinstall/codex-instruction.js +0 -56
- package/dist/cli/postinstall/codex-instruction.js.map +0 -1
- package/dist/cli/postinstall/gemini-agents.d.ts +0 -12
- package/dist/cli/postinstall/gemini-agents.d.ts.map +0 -1
- package/dist/cli/postinstall/gemini-agents.js +0 -80
- package/dist/cli/postinstall/gemini-agents.js.map +0 -1
- package/dist/cli/postinstall/gemini-instruction.d.ts +0 -10
- package/dist/cli/postinstall/gemini-instruction.d.ts.map +0 -1
- package/dist/cli/postinstall/gemini-instruction.js +0 -59
- package/dist/cli/postinstall/gemini-instruction.js.map +0 -1
- package/dist/cli/postinstall/index.d.ts +0 -23
- package/dist/cli/postinstall/index.d.ts.map +0 -1
- package/dist/cli/postinstall/index.js +0 -23
- package/dist/cli/postinstall/index.js.map +0 -1
- package/dist/cli/setup/index.d.ts +0 -9
- package/dist/cli/setup/index.d.ts.map +0 -1
- package/dist/cli/setup/index.js +0 -12
- package/dist/cli/setup/index.js.map +0 -1
- package/dist/infra/lib/ContextCompressor.d.ts +0 -104
- package/dist/infra/lib/ContextCompressor.d.ts.map +0 -1
- package/dist/infra/lib/ContextCompressor.js +0 -297
- package/dist/infra/lib/ContextCompressor.js.map +0 -1
- package/dist/infra/lib/ContextCompressor.test.d.ts +0 -2
- package/dist/infra/lib/ContextCompressor.test.d.ts.map +0 -1
- package/dist/infra/lib/ContextCompressor.test.js +0 -25
- package/dist/infra/lib/ContextCompressor.test.js.map +0 -1
- package/dist/infra/lib/ProgressTracker.d.ts +0 -73
- package/dist/infra/lib/ProgressTracker.d.ts.map +0 -1
- package/dist/infra/lib/ProgressTracker.js +0 -267
- package/dist/infra/lib/ProgressTracker.js.map +0 -1
- package/dist/infra/lib/TokenBudgetTracker.d.ts +0 -68
- package/dist/infra/lib/TokenBudgetTracker.d.ts.map +0 -1
- package/dist/infra/lib/TokenBudgetTracker.js +0 -191
- package/dist/infra/lib/TokenBudgetTracker.js.map +0 -1
- package/dist/infra/lib/autonomy/AuditStore.d.ts +0 -63
- package/dist/infra/lib/autonomy/AuditStore.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/AuditStore.js +0 -185
- package/dist/infra/lib/autonomy/AuditStore.js.map +0 -1
- package/dist/infra/lib/autonomy/AutonomyConfig.d.ts +0 -84
- package/dist/infra/lib/autonomy/AutonomyConfig.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/AutonomyConfig.js +0 -49
- package/dist/infra/lib/autonomy/AutonomyConfig.js.map +0 -1
- package/dist/infra/lib/autonomy/AutonomyOrchestrator.d.ts +0 -78
- package/dist/infra/lib/autonomy/AutonomyOrchestrator.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/AutonomyOrchestrator.js +0 -246
- package/dist/infra/lib/autonomy/AutonomyOrchestrator.js.map +0 -1
- package/dist/infra/lib/autonomy/BackgroundMonitor.d.ts +0 -36
- package/dist/infra/lib/autonomy/BackgroundMonitor.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/BackgroundMonitor.js +0 -138
- package/dist/infra/lib/autonomy/BackgroundMonitor.js.map +0 -1
- package/dist/infra/lib/autonomy/CollaborationProtocol.d.ts +0 -56
- package/dist/infra/lib/autonomy/CollaborationProtocol.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/CollaborationProtocol.js +0 -122
- package/dist/infra/lib/autonomy/CollaborationProtocol.js.map +0 -1
- package/dist/infra/lib/autonomy/ConfirmationManager.d.ts +0 -42
- package/dist/infra/lib/autonomy/ConfirmationManager.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/ConfirmationManager.js +0 -200
- package/dist/infra/lib/autonomy/ConfirmationManager.js.map +0 -1
- package/dist/infra/lib/autonomy/ConfirmationStore.d.ts +0 -55
- package/dist/infra/lib/autonomy/ConfirmationStore.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/ConfirmationStore.js +0 -130
- package/dist/infra/lib/autonomy/ConfirmationStore.js.map +0 -1
- package/dist/infra/lib/autonomy/EventBus.d.ts +0 -20
- package/dist/infra/lib/autonomy/EventBus.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/EventBus.js +0 -119
- package/dist/infra/lib/autonomy/EventBus.js.map +0 -1
- package/dist/infra/lib/autonomy/EventOutbox.d.ts +0 -32
- package/dist/infra/lib/autonomy/EventOutbox.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/EventOutbox.js +0 -152
- package/dist/infra/lib/autonomy/EventOutbox.js.map +0 -1
- package/dist/infra/lib/autonomy/NotificationDispatcher.d.ts +0 -24
- package/dist/infra/lib/autonomy/NotificationDispatcher.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/NotificationDispatcher.js +0 -112
- package/dist/infra/lib/autonomy/NotificationDispatcher.js.map +0 -1
- package/dist/infra/lib/autonomy/PolicyEngine.d.ts +0 -76
- package/dist/infra/lib/autonomy/PolicyEngine.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/PolicyEngine.js +0 -208
- package/dist/infra/lib/autonomy/PolicyEngine.js.map +0 -1
- package/dist/infra/lib/autonomy/ProactiveAnalyzer.d.ts +0 -61
- package/dist/infra/lib/autonomy/ProactiveAnalyzer.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/ProactiveAnalyzer.js +0 -236
- package/dist/infra/lib/autonomy/ProactiveAnalyzer.js.map +0 -1
- package/dist/infra/lib/autonomy/RiskClassifier.d.ts +0 -35
- package/dist/infra/lib/autonomy/RiskClassifier.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/RiskClassifier.js +0 -147
- package/dist/infra/lib/autonomy/RiskClassifier.js.map +0 -1
- package/dist/infra/lib/autonomy/SecuritySentinel.d.ts +0 -51
- package/dist/infra/lib/autonomy/SecuritySentinel.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/SecuritySentinel.js +0 -162
- package/dist/infra/lib/autonomy/SecuritySentinel.js.map +0 -1
- package/dist/infra/lib/autonomy/SuggestionStore.d.ts +0 -54
- package/dist/infra/lib/autonomy/SuggestionStore.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/SuggestionStore.js +0 -144
- package/dist/infra/lib/autonomy/SuggestionStore.js.map +0 -1
- package/dist/infra/lib/autonomy/TaskDecomposer.d.ts +0 -38
- package/dist/infra/lib/autonomy/TaskDecomposer.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/TaskDecomposer.js +0 -175
- package/dist/infra/lib/autonomy/TaskDecomposer.js.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/audit-store.test.d.ts +0 -2
- package/dist/infra/lib/autonomy/__tests__/audit-store.test.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/audit-store.test.js +0 -198
- package/dist/infra/lib/autonomy/__tests__/audit-store.test.js.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/event-bus.test.d.ts +0 -2
- package/dist/infra/lib/autonomy/__tests__/event-bus.test.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/event-bus.test.js +0 -225
- package/dist/infra/lib/autonomy/__tests__/event-bus.test.js.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/event-core.test.d.ts +0 -2
- package/dist/infra/lib/autonomy/__tests__/event-core.test.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/event-core.test.js +0 -194
- package/dist/infra/lib/autonomy/__tests__/event-core.test.js.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/governance.test.d.ts +0 -2
- package/dist/infra/lib/autonomy/__tests__/governance.test.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/governance.test.js +0 -540
- package/dist/infra/lib/autonomy/__tests__/governance.test.js.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/integration.test.d.ts +0 -2
- package/dist/infra/lib/autonomy/__tests__/integration.test.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/integration.test.js +0 -480
- package/dist/infra/lib/autonomy/__tests__/integration.test.js.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/proactive.test.d.ts +0 -2
- package/dist/infra/lib/autonomy/__tests__/proactive.test.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/proactive.test.js +0 -410
- package/dist/infra/lib/autonomy/__tests__/proactive.test.js.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/sentinel.test.d.ts +0 -2
- package/dist/infra/lib/autonomy/__tests__/sentinel.test.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/sentinel.test.js +0 -486
- package/dist/infra/lib/autonomy/__tests__/sentinel.test.js.map +0 -1
- package/dist/infra/lib/autonomy/index.d.ts +0 -18
- package/dist/infra/lib/autonomy/index.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/index.js +0 -22
- package/dist/infra/lib/autonomy/index.js.map +0 -1
- package/dist/infra/lib/autonomy/schemas.d.ts +0 -317
- package/dist/infra/lib/autonomy/schemas.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/schemas.js +0 -90
- package/dist/infra/lib/autonomy/schemas.js.map +0 -1
- package/dist/infra/lib/claude/index.d.ts +0 -5
- package/dist/infra/lib/claude/index.d.ts.map +0 -1
- package/dist/infra/lib/claude/index.js +0 -5
- package/dist/infra/lib/claude/index.js.map +0 -1
- package/dist/infra/lib/claude/storage.d.ts +0 -12
- package/dist/infra/lib/claude/storage.d.ts.map +0 -1
- package/dist/infra/lib/claude/storage.js +0 -54
- package/dist/infra/lib/claude/storage.js.map +0 -1
- package/dist/infra/lib/gemini/auth.d.ts +0 -18
- package/dist/infra/lib/gemini/auth.d.ts.map +0 -1
- package/dist/infra/lib/gemini/auth.js +0 -32
- package/dist/infra/lib/gemini/auth.js.map +0 -1
- package/dist/infra/lib/gemini/capabilities.d.ts +0 -28
- package/dist/infra/lib/gemini/capabilities.d.ts.map +0 -1
- package/dist/infra/lib/gemini/capabilities.js +0 -178
- package/dist/infra/lib/gemini/capabilities.js.map +0 -1
- package/dist/infra/lib/gemini/chat.d.ts +0 -35
- package/dist/infra/lib/gemini/chat.d.ts.map +0 -1
- package/dist/infra/lib/gemini/chat.js +0 -161
- package/dist/infra/lib/gemini/chat.js.map +0 -1
- package/dist/infra/lib/gemini/completion.d.ts +0 -12
- package/dist/infra/lib/gemini/completion.d.ts.map +0 -1
- package/dist/infra/lib/gemini/completion.js +0 -13
- package/dist/infra/lib/gemini/completion.js.map +0 -1
- package/dist/infra/lib/gemini/constants.d.ts +0 -8
- package/dist/infra/lib/gemini/constants.d.ts.map +0 -1
- package/dist/infra/lib/gemini/constants.js +0 -11
- package/dist/infra/lib/gemini/constants.js.map +0 -1
- package/dist/infra/lib/gemini/index.d.ts +0 -13
- package/dist/infra/lib/gemini/index.d.ts.map +0 -1
- package/dist/infra/lib/gemini/index.js +0 -12
- package/dist/infra/lib/gemini/index.js.map +0 -1
- package/dist/infra/lib/gemini/models.d.ts +0 -11
- package/dist/infra/lib/gemini/models.d.ts.map +0 -1
- package/dist/infra/lib/gemini/models.js +0 -38
- package/dist/infra/lib/gemini/models.js.map +0 -1
- package/dist/infra/lib/gemini/orchestration.d.ts +0 -33
- package/dist/infra/lib/gemini/orchestration.d.ts.map +0 -1
- package/dist/infra/lib/gemini/orchestration.js +0 -62
- package/dist/infra/lib/gemini/orchestration.js.map +0 -1
- package/dist/infra/lib/gemini/types.d.ts +0 -115
- package/dist/infra/lib/gemini/types.d.ts.map +0 -1
- package/dist/infra/lib/gemini/types.js +0 -5
- package/dist/infra/lib/gemini/types.js.map +0 -1
- package/dist/infra/orchestrator/AgentAnnouncer.d.ts +0 -64
- package/dist/infra/orchestrator/AgentAnnouncer.d.ts.map +0 -1
- package/dist/infra/orchestrator/AgentAnnouncer.js +0 -127
- package/dist/infra/orchestrator/AgentAnnouncer.js.map +0 -1
- package/dist/infra/orchestrator/AgentAnnouncer.test.d.ts +0 -5
- package/dist/infra/orchestrator/AgentAnnouncer.test.d.ts.map +0 -1
- package/dist/infra/orchestrator/AgentAnnouncer.test.js +0 -119
- package/dist/infra/orchestrator/AgentAnnouncer.test.js.map +0 -1
- package/dist/infra/orchestrator/AgentExecutor.d.ts +0 -22
- package/dist/infra/orchestrator/AgentExecutor.d.ts.map +0 -1
- package/dist/infra/orchestrator/AgentExecutor.js +0 -272
- package/dist/infra/orchestrator/AgentExecutor.js.map +0 -1
- package/dist/infra/orchestrator/AgentManager.d.ts +0 -72
- package/dist/infra/orchestrator/AgentManager.d.ts.map +0 -1
- package/dist/infra/orchestrator/AgentManager.js +0 -183
- package/dist/infra/orchestrator/AgentManager.js.map +0 -1
- package/dist/infra/orchestrator/AgentManifestCache.d.ts +0 -54
- package/dist/infra/orchestrator/AgentManifestCache.d.ts.map +0 -1
- package/dist/infra/orchestrator/AgentManifestCache.js +0 -191
- package/dist/infra/orchestrator/AgentManifestCache.js.map +0 -1
- package/dist/infra/orchestrator/AgentRegistry.d.ts +0 -76
- package/dist/infra/orchestrator/AgentRegistry.d.ts.map +0 -1
- package/dist/infra/orchestrator/AgentRegistry.js +0 -217
- package/dist/infra/orchestrator/AgentRegistry.js.map +0 -1
- package/dist/infra/orchestrator/AgentRegistry.test.d.ts +0 -5
- package/dist/infra/orchestrator/AgentRegistry.test.d.ts.map +0 -1
- package/dist/infra/orchestrator/AgentRegistry.test.js +0 -122
- package/dist/infra/orchestrator/AgentRegistry.test.js.map +0 -1
- package/dist/infra/orchestrator/BackgroundManager.d.ts +0 -128
- package/dist/infra/orchestrator/BackgroundManager.d.ts.map +0 -1
- package/dist/infra/orchestrator/BackgroundManager.js +0 -620
- package/dist/infra/orchestrator/BackgroundManager.js.map +0 -1
- package/dist/infra/orchestrator/BackgroundManager.test.d.ts +0 -6
- package/dist/infra/orchestrator/BackgroundManager.test.d.ts.map +0 -1
- package/dist/infra/orchestrator/BackgroundManager.test.js +0 -162
- package/dist/infra/orchestrator/BackgroundManager.test.js.map +0 -1
- package/dist/infra/orchestrator/CheckpointManager.d.ts +0 -54
- package/dist/infra/orchestrator/CheckpointManager.d.ts.map +0 -1
- package/dist/infra/orchestrator/CheckpointManager.js +0 -121
- package/dist/infra/orchestrator/CheckpointManager.js.map +0 -1
- package/dist/infra/orchestrator/CodexAgentRuntime.d.ts +0 -12
- package/dist/infra/orchestrator/CodexAgentRuntime.d.ts.map +0 -1
- package/dist/infra/orchestrator/CodexAgentRuntime.js +0 -94
- package/dist/infra/orchestrator/CodexAgentRuntime.js.map +0 -1
- package/dist/infra/orchestrator/CodexAgentRuntime.test.d.ts +0 -2
- package/dist/infra/orchestrator/CodexAgentRuntime.test.d.ts.map +0 -1
- package/dist/infra/orchestrator/CodexAgentRuntime.test.js +0 -37
- package/dist/infra/orchestrator/CodexAgentRuntime.test.js.map +0 -1
- package/dist/infra/orchestrator/LLMCluster.d.ts +0 -82
- package/dist/infra/orchestrator/LLMCluster.d.ts.map +0 -1
- package/dist/infra/orchestrator/LLMCluster.js +0 -146
- package/dist/infra/orchestrator/LLMCluster.js.map +0 -1
- package/dist/infra/orchestrator/MultiLlmResearch.d.ts +0 -31
- package/dist/infra/orchestrator/MultiLlmResearch.d.ts.map +0 -1
- package/dist/infra/orchestrator/MultiLlmResearch.js +0 -160
- package/dist/infra/orchestrator/MultiLlmResearch.js.map +0 -1
- package/dist/infra/orchestrator/PhasePipeline.d.ts +0 -122
- package/dist/infra/orchestrator/PhasePipeline.d.ts.map +0 -1
- package/dist/infra/orchestrator/PhasePipeline.js +0 -385
- package/dist/infra/orchestrator/PhasePipeline.js.map +0 -1
- package/dist/infra/orchestrator/PhaseResultStore.d.ts +0 -39
- package/dist/infra/orchestrator/PhaseResultStore.d.ts.map +0 -1
- package/dist/infra/orchestrator/PhaseResultStore.js +0 -151
- package/dist/infra/orchestrator/PhaseResultStore.js.map +0 -1
- package/dist/infra/orchestrator/SessionStore.d.ts +0 -40
- package/dist/infra/orchestrator/SessionStore.d.ts.map +0 -1
- package/dist/infra/orchestrator/SessionStore.js +0 -116
- package/dist/infra/orchestrator/SessionStore.js.map +0 -1
- package/dist/infra/orchestrator/SmartRouter.d.ts +0 -90
- package/dist/infra/orchestrator/SmartRouter.d.ts.map +0 -1
- package/dist/infra/orchestrator/SmartRouter.js +0 -277
- package/dist/infra/orchestrator/SmartRouter.js.map +0 -1
- package/dist/infra/orchestrator/SmartRouter.test.d.ts +0 -5
- package/dist/infra/orchestrator/SmartRouter.test.d.ts.map +0 -1
- package/dist/infra/orchestrator/SmartRouter.test.js +0 -484
- package/dist/infra/orchestrator/SmartRouter.test.js.map +0 -1
- package/dist/infra/orchestrator/SwarmOrchestrator.d.ts +0 -143
- package/dist/infra/orchestrator/SwarmOrchestrator.d.ts.map +0 -1
- package/dist/infra/orchestrator/SwarmOrchestrator.js +0 -378
- package/dist/infra/orchestrator/SwarmOrchestrator.js.map +0 -1
- package/dist/infra/orchestrator/SwarmOrchestrator.test.d.ts +0 -5
- package/dist/infra/orchestrator/SwarmOrchestrator.test.d.ts.map +0 -1
- package/dist/infra/orchestrator/SwarmOrchestrator.test.js +0 -95
- package/dist/infra/orchestrator/SwarmOrchestrator.test.js.map +0 -1
- package/dist/infra/orchestrator/agentDiscovery.d.ts +0 -26
- package/dist/infra/orchestrator/agentDiscovery.d.ts.map +0 -1
- package/dist/infra/orchestrator/agentDiscovery.js +0 -175
- package/dist/infra/orchestrator/agentDiscovery.js.map +0 -1
- package/dist/infra/orchestrator/backgroundAgent.d.ts +0 -9
- package/dist/infra/orchestrator/backgroundAgent.d.ts.map +0 -1
- package/dist/infra/orchestrator/backgroundAgent.js +0 -10
- package/dist/infra/orchestrator/backgroundAgent.js.map +0 -1
- package/dist/infra/orchestrator/index.d.ts +0 -207
- package/dist/infra/orchestrator/index.d.ts.map +0 -1
- package/dist/infra/orchestrator/index.js +0 -362
- package/dist/infra/orchestrator/index.js.map +0 -1
- package/dist/infra/orchestrator/orchestrator.d.ts +0 -60
- package/dist/infra/orchestrator/orchestrator.d.ts.map +0 -1
- package/dist/infra/orchestrator/orchestrator.js +0 -214
- package/dist/infra/orchestrator/orchestrator.js.map +0 -1
- package/dist/infra/orchestrator/parallelResearch.d.ts +0 -27
- package/dist/infra/orchestrator/parallelResearch.d.ts.map +0 -1
- package/dist/infra/orchestrator/parallelResearch.js +0 -285
- package/dist/infra/orchestrator/parallelResearch.js.map +0 -1
- package/dist/infra/orchestrator/types.d.ts +0 -205
- package/dist/infra/orchestrator/types.d.ts.map +0 -1
- package/dist/infra/orchestrator/types.js +0 -87
- package/dist/infra/orchestrator/types.js.map +0 -1
- package/dist/infra/orchestrator/types.test.d.ts +0 -2
- package/dist/infra/orchestrator/types.test.d.ts.map +0 -1
- package/dist/infra/orchestrator/types.test.js +0 -57
- package/dist/infra/orchestrator/types.test.js.map +0 -1
- package/dist/tools/semantic/analyzeDependencyGraph.d.ts +0 -12
- package/dist/tools/semantic/analyzeDependencyGraph.d.ts.map +0 -1
- package/dist/tools/semantic/analyzeDependencyGraph.js +0 -359
- package/dist/tools/semantic/analyzeDependencyGraph.js.map +0 -1
- package/dist/tools/semantic/astGrep.d.ts +0 -25
- package/dist/tools/semantic/astGrep.d.ts.map +0 -1
- package/dist/tools/semantic/astGrep.js +0 -324
- package/dist/tools/semantic/astGrep.js.map +0 -1
- package/dist/tools/semantic/astGrep.test.d.ts +0 -2
- package/dist/tools/semantic/astGrep.test.d.ts.map +0 -1
- package/dist/tools/semantic/astGrep.test.js +0 -74
- package/dist/tools/semantic/astGrep.test.js.map +0 -1
- package/dist/tools/semantic/findReferences.d.ts +0 -9
- package/dist/tools/semantic/findReferences.d.ts.map +0 -1
- package/dist/tools/semantic/findReferences.js +0 -200
- package/dist/tools/semantic/findReferences.js.map +0 -1
- package/dist/tools/semantic/findSymbol.d.ts +0 -8
- package/dist/tools/semantic/findSymbol.d.ts.map +0 -1
- package/dist/tools/semantic/findSymbol.js +0 -204
- package/dist/tools/semantic/findSymbol.js.map +0 -1
- package/dist/tools/semantic/index.d.ts +0 -9
- package/dist/tools/semantic/index.d.ts.map +0 -1
- package/dist/tools/semantic/index.js +0 -11
- package/dist/tools/semantic/index.js.map +0 -1
- package/dist/tools/semantic/lsp.d.ts +0 -68
- package/dist/tools/semantic/lsp.d.ts.map +0 -1
- package/dist/tools/semantic/lsp.js +0 -561
- package/dist/tools/semantic/lsp.js.map +0 -1
- package/dist/tools/spec/e2eTestGenerator.d.ts +0 -61
- package/dist/tools/spec/e2eTestGenerator.d.ts.map +0 -1
- package/dist/tools/spec/e2eTestGenerator.js +0 -255
- package/dist/tools/spec/e2eTestGenerator.js.map +0 -1
- package/dist/tools/spec/specVersioning.d.ts +0 -76
- package/dist/tools/spec/specVersioning.d.ts.map +0 -1
- package/dist/tools/spec/specVersioning.js +0 -236
- package/dist/tools/spec/specVersioning.js.map +0 -1
- package/hooks/scripts/__tests__/.vibe/memories/memories.db +0 -0
- package/hooks/scripts/__tests__/.vibe/memories/memories.db-shm +0 -0
- package/hooks/scripts/__tests__/.vibe/memories/memories.db-wal +0 -0
- package/hooks/scripts/evolution-engine.js +0 -91
- package/hooks/scripts/hud-status.js +0 -321
- package/hooks/scripts/skill-injector.js +0 -83
- package/skills/vibe.utils/SKILL.md +0 -415
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ast-grep Tools - 패턴 기반 코드 검색/변환
|
|
3
|
-
*
|
|
4
|
-
* 지원 언어: JavaScript, TypeScript, TSX, JSX, HTML, CSS
|
|
5
|
-
* (Python, Go, Rust 등은 ast-grep-napi에서 별도 동적 등록 필요)
|
|
6
|
-
*
|
|
7
|
-
* @ast-grep/napi는 네이티브 바이너리 optional dependency → 동적 import
|
|
8
|
-
*/
|
|
9
|
-
import { createRequire } from 'module';
|
|
10
|
-
import { readFile, readdir, stat, writeFile } from 'fs/promises';
|
|
11
|
-
import * as path from 'path';
|
|
12
|
-
// ast-grep 동적 로딩 (createRequire — 네이티브 바이너리에 안정적)
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
-
let sgModule = null;
|
|
15
|
-
let sgLoadFailed = false;
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
-
function loadAstGrep() {
|
|
18
|
-
if (sgModule)
|
|
19
|
-
return sgModule;
|
|
20
|
-
if (sgLoadFailed) {
|
|
21
|
-
throw new Error('@ast-grep/napi is not installed. Run: npm install @ast-grep/napi');
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
const require = createRequire(import.meta.url);
|
|
25
|
-
sgModule = require('@ast-grep/napi');
|
|
26
|
-
return sgModule;
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
29
|
-
sgLoadFailed = true;
|
|
30
|
-
throw new Error('@ast-grep/napi is not installed. Run: npm install @ast-grep/napi');
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
-
function getLangParsers(sg) {
|
|
35
|
-
return {
|
|
36
|
-
'.js': sg.js, '.mjs': sg.js, '.cjs': sg.js,
|
|
37
|
-
'.jsx': sg.jsx,
|
|
38
|
-
'.ts': sg.ts, '.mts': sg.ts, '.cts': sg.ts,
|
|
39
|
-
'.tsx': sg.tsx,
|
|
40
|
-
'.html': sg.html, '.htm': sg.html,
|
|
41
|
-
'.css': sg.css, '.scss': sg.css,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
-
function getLangNameMap(sg) {
|
|
46
|
-
return {
|
|
47
|
-
javascript: sg.js, typescript: sg.ts,
|
|
48
|
-
tsx: sg.tsx, jsx: sg.jsx,
|
|
49
|
-
html: sg.html, css: sg.css,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
// Tool Definitions
|
|
53
|
-
export const astGrepSearchDefinition = {
|
|
54
|
-
name: 'ast_grep_search',
|
|
55
|
-
description: 'AST pattern search - Find code patterns using meta-variables ($VAR). Supports JS, TS, TSX, JSX, HTML, CSS.',
|
|
56
|
-
inputSchema: {
|
|
57
|
-
type: 'object',
|
|
58
|
-
properties: {
|
|
59
|
-
pattern: {
|
|
60
|
-
type: 'string',
|
|
61
|
-
description: 'AST pattern with meta-variables (e.g., "console.log($MSG)", "function $NAME($$$) { $$$ }")'
|
|
62
|
-
},
|
|
63
|
-
path: {
|
|
64
|
-
type: 'string',
|
|
65
|
-
description: 'Directory or file path to search'
|
|
66
|
-
},
|
|
67
|
-
lang: {
|
|
68
|
-
type: 'string',
|
|
69
|
-
enum: ['javascript', 'typescript', 'tsx', 'jsx', 'html', 'css'],
|
|
70
|
-
description: 'Language to parse (auto-detected from file extension if not specified)'
|
|
71
|
-
},
|
|
72
|
-
maxResults: {
|
|
73
|
-
type: 'number',
|
|
74
|
-
description: 'Maximum number of results to return (default: 50)'
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
required: ['pattern', 'path']
|
|
78
|
-
},
|
|
79
|
-
annotations: {
|
|
80
|
-
title: 'AST Grep Search',
|
|
81
|
-
audience: ['user', 'assistant'],
|
|
82
|
-
readOnlyHint: true,
|
|
83
|
-
destructiveHint: false,
|
|
84
|
-
idempotentHint: true,
|
|
85
|
-
openWorldHint: false
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
export const astGrepReplaceDefinition = {
|
|
89
|
-
name: 'ast_grep_replace',
|
|
90
|
-
description: 'AST pattern replace - Transform code using pattern matching. Supports JS, TS, TSX, JSX, HTML, CSS.',
|
|
91
|
-
inputSchema: {
|
|
92
|
-
type: 'object',
|
|
93
|
-
properties: {
|
|
94
|
-
pattern: {
|
|
95
|
-
type: 'string',
|
|
96
|
-
description: 'AST pattern to match (e.g., "console.log($MSG)")'
|
|
97
|
-
},
|
|
98
|
-
replacement: {
|
|
99
|
-
type: 'string',
|
|
100
|
-
description: 'Replacement pattern using captured meta-variables (e.g., "logger.info($MSG)")'
|
|
101
|
-
},
|
|
102
|
-
path: {
|
|
103
|
-
type: 'string',
|
|
104
|
-
description: 'Directory or file path'
|
|
105
|
-
},
|
|
106
|
-
lang: {
|
|
107
|
-
type: 'string',
|
|
108
|
-
enum: ['javascript', 'typescript', 'tsx', 'jsx', 'html', 'css'],
|
|
109
|
-
description: 'Language to parse'
|
|
110
|
-
},
|
|
111
|
-
dryRun: {
|
|
112
|
-
type: 'boolean',
|
|
113
|
-
description: 'Preview changes without applying (default: true)'
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
required: ['pattern', 'replacement', 'path']
|
|
117
|
-
},
|
|
118
|
-
annotations: {
|
|
119
|
-
title: 'AST Grep Replace',
|
|
120
|
-
audience: ['user', 'assistant'],
|
|
121
|
-
readOnlyHint: false,
|
|
122
|
-
destructiveHint: true,
|
|
123
|
-
idempotentHint: false,
|
|
124
|
-
openWorldHint: false
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
function getParserFromExtension(parsers, filePath) {
|
|
128
|
-
const ext = path.extname(filePath).toLowerCase();
|
|
129
|
-
return parsers[ext] || null;
|
|
130
|
-
}
|
|
131
|
-
function getParserFromString(nameMap, langStr) {
|
|
132
|
-
return nameMap[langStr.toLowerCase()] || null;
|
|
133
|
-
}
|
|
134
|
-
async function getFilesRecursive(dir, parsers, targetParser) {
|
|
135
|
-
const files = [];
|
|
136
|
-
const ignoreDirs = ['node_modules', '.git', 'dist', 'build', '__pycache__', 'venv', '.venv'];
|
|
137
|
-
async function walk(currentDir) {
|
|
138
|
-
const entries = await readdir(currentDir, { withFileTypes: true });
|
|
139
|
-
for (const entry of entries) {
|
|
140
|
-
const fullPath = path.join(currentDir, entry.name);
|
|
141
|
-
if (entry.isDirectory()) {
|
|
142
|
-
if (!ignoreDirs.includes(entry.name) && !entry.name.startsWith('.')) {
|
|
143
|
-
await walk(fullPath);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
else if (entry.isFile()) {
|
|
147
|
-
const fileParser = getParserFromExtension(parsers, fullPath);
|
|
148
|
-
if (fileParser !== null && (targetParser === undefined || fileParser === targetParser)) {
|
|
149
|
-
files.push(fullPath);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
const stats = await stat(dir);
|
|
155
|
-
if (stats.isFile()) {
|
|
156
|
-
return [dir];
|
|
157
|
-
}
|
|
158
|
-
await walk(dir);
|
|
159
|
-
return files;
|
|
160
|
-
}
|
|
161
|
-
function getContextLines(content, line, contextSize = 1) {
|
|
162
|
-
const lines = content.split('\n');
|
|
163
|
-
const start = Math.max(0, line - 1 - contextSize);
|
|
164
|
-
const end = Math.min(lines.length, line + contextSize);
|
|
165
|
-
return lines.slice(start, end).join('\n');
|
|
166
|
-
}
|
|
167
|
-
export async function astGrepSearch(args) {
|
|
168
|
-
const { pattern, path: searchPath, lang, maxResults = 50 } = args;
|
|
169
|
-
try {
|
|
170
|
-
const sg = loadAstGrep();
|
|
171
|
-
const parsers = getLangParsers(sg);
|
|
172
|
-
const nameMap = getLangNameMap(sg);
|
|
173
|
-
const targetParser = lang ? getParserFromString(nameMap, lang) : undefined;
|
|
174
|
-
const files = await getFilesRecursive(searchPath, parsers, targetParser ?? undefined);
|
|
175
|
-
const matches = [];
|
|
176
|
-
for (const file of files) {
|
|
177
|
-
if (matches.length >= maxResults)
|
|
178
|
-
break;
|
|
179
|
-
const fileParser = getParserFromExtension(parsers, file);
|
|
180
|
-
if (!fileParser)
|
|
181
|
-
continue;
|
|
182
|
-
try {
|
|
183
|
-
const content = await readFile(file, 'utf-8');
|
|
184
|
-
const root = fileParser.parse(content).root();
|
|
185
|
-
const nodes = root.findAll(pattern);
|
|
186
|
-
for (const node of nodes) {
|
|
187
|
-
if (matches.length >= maxResults)
|
|
188
|
-
break;
|
|
189
|
-
const range = node.range();
|
|
190
|
-
matches.push({
|
|
191
|
-
file,
|
|
192
|
-
line: range.start.line + 1,
|
|
193
|
-
column: range.start.column + 1,
|
|
194
|
-
matchedText: node.text(),
|
|
195
|
-
context: getContextLines(content, range.start.line + 1),
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
catch {
|
|
200
|
-
// Skip files that can't be parsed
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
if (matches.length === 0) {
|
|
204
|
-
return {
|
|
205
|
-
content: [{
|
|
206
|
-
type: 'text',
|
|
207
|
-
text: `No matches found for pattern: ${pattern}`
|
|
208
|
-
}]
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
const output = matches.map((m, i) => `${i + 1}. ${m.file}:${m.line}:${m.column}\n Match: ${m.matchedText.substring(0, 100)}${m.matchedText.length > 100 ? '...' : ''}`).join('\n\n');
|
|
212
|
-
return {
|
|
213
|
-
content: [{
|
|
214
|
-
type: 'text',
|
|
215
|
-
text: `Found ${matches.length} matches for pattern: ${pattern}\n\n${output}`
|
|
216
|
-
}]
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
catch (error) {
|
|
220
|
-
return {
|
|
221
|
-
content: [{
|
|
222
|
-
type: 'text',
|
|
223
|
-
text: `Error searching: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
224
|
-
}]
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
export async function astGrepReplace(args) {
|
|
229
|
-
const { pattern, replacement, path: searchPath, lang, dryRun = true } = args;
|
|
230
|
-
try {
|
|
231
|
-
const sg = loadAstGrep();
|
|
232
|
-
const parsers = getLangParsers(sg);
|
|
233
|
-
const nameMap = getLangNameMap(sg);
|
|
234
|
-
const targetParser = lang ? getParserFromString(nameMap, lang) : undefined;
|
|
235
|
-
const files = await getFilesRecursive(searchPath, parsers, targetParser ?? undefined);
|
|
236
|
-
const previews = [];
|
|
237
|
-
const fileChanges = new Map();
|
|
238
|
-
for (const file of files) {
|
|
239
|
-
const fileParser = getParserFromExtension(parsers, file);
|
|
240
|
-
if (!fileParser)
|
|
241
|
-
continue;
|
|
242
|
-
try {
|
|
243
|
-
const content = await readFile(file, 'utf-8');
|
|
244
|
-
const root = fileParser.parse(content).root();
|
|
245
|
-
const nodes = root.findAll(pattern);
|
|
246
|
-
if (nodes.length === 0)
|
|
247
|
-
continue;
|
|
248
|
-
const edits = [];
|
|
249
|
-
for (const node of nodes) {
|
|
250
|
-
const range = node.range();
|
|
251
|
-
// Build replacement with captured meta-variables
|
|
252
|
-
let replaced = replacement;
|
|
253
|
-
// Get captured variables using getMatch
|
|
254
|
-
const metaVarPattern = /\$([A-Z_][A-Z0-9_]*|\$\$)/g;
|
|
255
|
-
let match;
|
|
256
|
-
while ((match = metaVarPattern.exec(replacement)) !== null) {
|
|
257
|
-
const varName = match[1];
|
|
258
|
-
const captured = node.getMatch(varName);
|
|
259
|
-
if (captured) {
|
|
260
|
-
replaced = replaced.replace(new RegExp(`\\$${varName}`, 'g'), captured.text());
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
previews.push({
|
|
264
|
-
file,
|
|
265
|
-
line: range.start.line + 1,
|
|
266
|
-
original: node.text(),
|
|
267
|
-
replacement: replaced,
|
|
268
|
-
});
|
|
269
|
-
edits.push({
|
|
270
|
-
start: range.start.index,
|
|
271
|
-
end: range.end.index,
|
|
272
|
-
text: replaced,
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
if (edits.length > 0) {
|
|
276
|
-
fileChanges.set(file, { content, edits });
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
catch {
|
|
280
|
-
// Skip files that can't be parsed
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
if (previews.length === 0) {
|
|
284
|
-
return {
|
|
285
|
-
content: [{
|
|
286
|
-
type: 'text',
|
|
287
|
-
text: `No matches found for pattern: ${pattern}`
|
|
288
|
-
}]
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
// Apply changes if not dry run
|
|
292
|
-
if (!dryRun) {
|
|
293
|
-
for (const [file, { content, edits }] of fileChanges) {
|
|
294
|
-
// Sort edits by position (descending) to apply from end to start
|
|
295
|
-
edits.sort((a, b) => b.start - a.start);
|
|
296
|
-
let newContent = content;
|
|
297
|
-
for (const edit of edits) {
|
|
298
|
-
newContent = newContent.substring(0, edit.start) + edit.text + newContent.substring(edit.end);
|
|
299
|
-
}
|
|
300
|
-
await writeFile(file, newContent, 'utf-8');
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
const output = previews.slice(0, 20).map((p, i) => `${i + 1}. ${p.file}:${p.line}\n - ${p.original.substring(0, 80)}${p.original.length > 80 ? '...' : ''}\n + ${p.replacement.substring(0, 80)}${p.replacement.length > 80 ? '...' : ''}`).join('\n\n');
|
|
304
|
-
const modeText = dryRun ? '[DRY RUN] ' : '';
|
|
305
|
-
const actionText = dryRun
|
|
306
|
-
? 'Use dryRun: false to apply changes.'
|
|
307
|
-
: `Applied ${previews.length} replacements across ${fileChanges.size} files.`;
|
|
308
|
-
return {
|
|
309
|
-
content: [{
|
|
310
|
-
type: 'text',
|
|
311
|
-
text: `${modeText}Found ${previews.length} replacements for: ${pattern} → ${replacement}\n\n${output}\n\n${actionText}`
|
|
312
|
-
}]
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
catch (error) {
|
|
316
|
-
return {
|
|
317
|
-
content: [{
|
|
318
|
-
type: 'text',
|
|
319
|
-
text: `Error replacing: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
320
|
-
}]
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
//# sourceMappingURL=astGrep.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"astGrep.js","sourceRoot":"","sources":["../../../src/tools/semantic/astGrep.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,aAAa,C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,EAAE;iBACrF,CAAC;SACH,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"astGrep.test.d.ts","sourceRoot":"","sources":["../../../src/tools/semantic/astGrep.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
2
|
-
import { astGrepSearch, astGrepReplace } from './astGrep.js';
|
|
3
|
-
import { writeFile, mkdir, rm } from 'fs/promises';
|
|
4
|
-
import * as path from 'path';
|
|
5
|
-
import * as os from 'os';
|
|
6
|
-
// @ast-grep/napi는 optional dependency — 미설치 시 테스트 스킵
|
|
7
|
-
import { createRequire } from 'module';
|
|
8
|
-
let astGrepAvailable = false;
|
|
9
|
-
try {
|
|
10
|
-
createRequire(import.meta.url).resolve('@ast-grep/napi');
|
|
11
|
-
astGrepAvailable = true;
|
|
12
|
-
}
|
|
13
|
-
catch { /* not installed */ }
|
|
14
|
-
describe.skipIf(!astGrepAvailable)('ast-grep tools', () => {
|
|
15
|
-
const testDir = path.join(os.tmpdir(), 'ast-grep-test-' + Date.now());
|
|
16
|
-
beforeAll(async () => {
|
|
17
|
-
await mkdir(testDir, { recursive: true });
|
|
18
|
-
await writeFile(path.join(testDir, 'test.ts'), `
|
|
19
|
-
console.log("hello");
|
|
20
|
-
console.log("world");
|
|
21
|
-
function greet(name: string) {
|
|
22
|
-
console.log(\`Hello, \${name}\`);
|
|
23
|
-
}
|
|
24
|
-
`);
|
|
25
|
-
});
|
|
26
|
-
afterAll(async () => {
|
|
27
|
-
await rm(testDir, { recursive: true, force: true });
|
|
28
|
-
});
|
|
29
|
-
describe('astGrepSearch', () => {
|
|
30
|
-
it('should find console.log patterns', async () => {
|
|
31
|
-
const result = await astGrepSearch({
|
|
32
|
-
pattern: 'console.log($MSG)',
|
|
33
|
-
path: testDir,
|
|
34
|
-
});
|
|
35
|
-
expect(result.content[0].type).toBe('text');
|
|
36
|
-
const text = result.content[0].text;
|
|
37
|
-
expect(text).toContain('Found');
|
|
38
|
-
expect(text).toContain('matches');
|
|
39
|
-
});
|
|
40
|
-
it('should find function patterns', async () => {
|
|
41
|
-
const result = await astGrepSearch({
|
|
42
|
-
pattern: 'function $NAME($$$) { $$$ }',
|
|
43
|
-
path: testDir,
|
|
44
|
-
});
|
|
45
|
-
expect(result.content[0].type).toBe('text');
|
|
46
|
-
const text = result.content[0].text;
|
|
47
|
-
expect(text).toContain('Found');
|
|
48
|
-
});
|
|
49
|
-
it('should return no matches for non-existent pattern', async () => {
|
|
50
|
-
const result = await astGrepSearch({
|
|
51
|
-
pattern: 'nonExistentFunction()',
|
|
52
|
-
path: testDir,
|
|
53
|
-
});
|
|
54
|
-
const text = result.content[0].text;
|
|
55
|
-
expect(text).toContain('No matches');
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
describe('astGrepReplace', () => {
|
|
59
|
-
it('should preview replacements in dry run mode', async () => {
|
|
60
|
-
const result = await astGrepReplace({
|
|
61
|
-
pattern: 'console.log($MSG)',
|
|
62
|
-
replacement: 'logger.info($MSG)',
|
|
63
|
-
path: testDir,
|
|
64
|
-
dryRun: true,
|
|
65
|
-
});
|
|
66
|
-
const text = result.content[0].text;
|
|
67
|
-
expect(text).toContain('[DRY RUN]');
|
|
68
|
-
expect(text).toContain('replacements');
|
|
69
|
-
expect(text).toContain('console.log');
|
|
70
|
-
expect(text).toContain('logger.info');
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
//# sourceMappingURL=astGrep.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"astGrep.test.js","sourceRoot":"","sources":["../../../src/tools/semantic/astGrep.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,aAAa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C,CAAC;IAEH,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC9B,EAAE,CAAC,6CAA6C,EAAE,KAAK,IAAI,EAAE;YAC3D,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC;gBAClC,OAAO,EAAE,mBAAmB;gBAC5B,WAAW,EAAE,mBAAmB;gBAChC,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,IAAI;aACb,CAAC,CAAC;YAEH,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAc,CAAC;YAC9C,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;YACpC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;YACvC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;YACtC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ToolResult, ToolDefinition } from '../../infra/types/tool.js';
|
|
2
|
-
export declare const findReferencesDefinition: ToolDefinition;
|
|
3
|
-
export declare function findReferences(args: {
|
|
4
|
-
symbolName: string;
|
|
5
|
-
filePath?: string;
|
|
6
|
-
line?: number;
|
|
7
|
-
projectPath: string;
|
|
8
|
-
}): Promise<ToolResult>;
|
|
9
|
-
//# sourceMappingURL=findReferences.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findReferences.d.ts","sourceRoot":"","sources":["../../../src/tools/semantic/findReferences.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAWvE,eAAO,MAAM,wBAAwB,EAAE,cAqBtC,CAAC;AAEF,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,UAAU,CAAC,CA4HtB"}
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
// Semantic code analysis tool - Find References
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import { ProjectCache } from '../../infra/lib/ProjectCache.js';
|
|
4
|
-
import { readFile } from 'fs/promises';
|
|
5
|
-
import { errorLog } from '../../infra/lib/utils.js';
|
|
6
|
-
export const findReferencesDefinition = {
|
|
7
|
-
name: 'find_references',
|
|
8
|
-
description: 'find usage|references|where used - Find symbol references',
|
|
9
|
-
inputSchema: {
|
|
10
|
-
type: 'object',
|
|
11
|
-
properties: {
|
|
12
|
-
symbolName: { type: 'string', description: 'Name of the symbol to find references for' },
|
|
13
|
-
filePath: { type: 'string', description: 'File path where the symbol is defined' },
|
|
14
|
-
line: { type: 'number', description: 'Line number of the symbol definition' },
|
|
15
|
-
projectPath: { type: 'string', description: 'Project directory path' }
|
|
16
|
-
},
|
|
17
|
-
required: ['symbolName', 'projectPath']
|
|
18
|
-
},
|
|
19
|
-
annotations: {
|
|
20
|
-
title: 'Find References',
|
|
21
|
-
audience: ['user', 'assistant'],
|
|
22
|
-
readOnlyHint: true,
|
|
23
|
-
destructiveHint: false,
|
|
24
|
-
idempotentHint: true,
|
|
25
|
-
openWorldHint: false
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
export async function findReferences(args) {
|
|
29
|
-
const { symbolName, filePath, line, projectPath } = args;
|
|
30
|
-
try {
|
|
31
|
-
// Use cached project for performance
|
|
32
|
-
const { Node: TsNode } = await import('ts-morph');
|
|
33
|
-
const projectCache = ProjectCache.getInstance();
|
|
34
|
-
const project = await projectCache.getOrCreate(projectPath);
|
|
35
|
-
const allReferences = [];
|
|
36
|
-
// Check for Python files
|
|
37
|
-
const glob = await import('glob');
|
|
38
|
-
const pythonFiles = glob.globSync(path.join(projectPath, '**/*.py'), {
|
|
39
|
-
ignore: ['**/node_modules/**', '**/.git/**', '**/venv/**', '**/__pycache__/**']
|
|
40
|
-
});
|
|
41
|
-
// Parse Python files for references
|
|
42
|
-
for (const pyFile of pythonFiles) {
|
|
43
|
-
try {
|
|
44
|
-
const content = await readFile(pyFile, 'utf-8');
|
|
45
|
-
const lines = content.split('\n');
|
|
46
|
-
lines.forEach((line, index) => {
|
|
47
|
-
if (line.includes(symbolName)) {
|
|
48
|
-
const column = line.indexOf(symbolName);
|
|
49
|
-
allReferences.push({
|
|
50
|
-
filePath: pyFile,
|
|
51
|
-
line: index + 1,
|
|
52
|
-
column: column,
|
|
53
|
-
text: line.trim().substring(0, 100),
|
|
54
|
-
isDefinition: /^(def|class)\s/.test(line.trim())
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
errorLog(`Error parsing Python file ${pyFile}:`, error);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
// If specific file and line provided, use precise reference finding
|
|
64
|
-
if (filePath && line) {
|
|
65
|
-
const sourceFile = project.getSourceFile(filePath);
|
|
66
|
-
if (sourceFile) {
|
|
67
|
-
const position = sourceFile.compilerNode.getPositionOfLineAndCharacter(line - 1, 0);
|
|
68
|
-
const node = sourceFile.getDescendantAtPos(position);
|
|
69
|
-
if (node) {
|
|
70
|
-
const symbol = node.getSymbol();
|
|
71
|
-
if (symbol) {
|
|
72
|
-
const references = project.getLanguageService().findReferencesAtPosition(sourceFile, position);
|
|
73
|
-
if (references) {
|
|
74
|
-
for (const ref of references) {
|
|
75
|
-
for (const reference of ref.getReferences()) {
|
|
76
|
-
const refSourceFile = reference.getSourceFile();
|
|
77
|
-
const refNode = reference.getNode();
|
|
78
|
-
const start = refNode.getStartLinePos();
|
|
79
|
-
const pos = refSourceFile.getLineAndColumnAtPos(start);
|
|
80
|
-
allReferences.push({
|
|
81
|
-
filePath: refSourceFile.getFilePath(),
|
|
82
|
-
line: pos.line,
|
|
83
|
-
column: pos.column,
|
|
84
|
-
text: refNode.getParent()?.getText().substring(0, 100) || refNode.getText(),
|
|
85
|
-
isDefinition: reference.isDefinition() || false
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
// Fallback: search by name across all files
|
|
96
|
-
for (const sourceFile of project.getSourceFiles()) {
|
|
97
|
-
const filePath = sourceFile.getFilePath();
|
|
98
|
-
// Skip node_modules and other irrelevant paths
|
|
99
|
-
if (filePath.includes('node_modules') || filePath.includes('.git')) {
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
// Find all identifiers matching the symbol name
|
|
103
|
-
sourceFile.forEachDescendant((node) => {
|
|
104
|
-
if (TsNode.isIdentifier(node) && node.getText() === symbolName) {
|
|
105
|
-
const start = node.getStartLinePos();
|
|
106
|
-
const pos = sourceFile.getLineAndColumnAtPos(start);
|
|
107
|
-
const parent = node.getParent();
|
|
108
|
-
// Determine if this is a definition
|
|
109
|
-
const isDefinition = isSymbolDefinition(TsNode, node);
|
|
110
|
-
allReferences.push({
|
|
111
|
-
filePath: filePath,
|
|
112
|
-
line: pos.line,
|
|
113
|
-
column: pos.column,
|
|
114
|
-
text: parent?.getText().substring(0, 100) || node.getText(),
|
|
115
|
-
isDefinition
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
const definitions = allReferences.filter(r => r.isDefinition);
|
|
122
|
-
const usages = allReferences.filter(r => !r.isDefinition);
|
|
123
|
-
return {
|
|
124
|
-
content: [{
|
|
125
|
-
type: 'text',
|
|
126
|
-
text: `Found ${allReferences.length} references (${definitions.length} defs, ${usages.length} uses):\n${allReferences.slice(0, 20).map(r => `${r.isDefinition ? 'DEF' : 'USE'}: ${r.filePath}:${r.line}`).join('\n')}`
|
|
127
|
-
}]
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
catch (error) {
|
|
131
|
-
return {
|
|
132
|
-
content: [{
|
|
133
|
-
type: 'text',
|
|
134
|
-
text: `Error finding references: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
135
|
-
}]
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function isSymbolDefinition(NodeClass, node) {
|
|
140
|
-
const parent = node.getParent();
|
|
141
|
-
if (!parent)
|
|
142
|
-
return false;
|
|
143
|
-
// Check if this is a declaration
|
|
144
|
-
return NodeClass.isFunctionDeclaration(parent) ||
|
|
145
|
-
NodeClass.isClassDeclaration(parent) ||
|
|
146
|
-
NodeClass.isInterfaceDeclaration(parent) ||
|
|
147
|
-
NodeClass.isTypeAliasDeclaration(parent) ||
|
|
148
|
-
NodeClass.isVariableDeclaration(parent) ||
|
|
149
|
-
NodeClass.isMethodDeclaration(parent) ||
|
|
150
|
-
NodeClass.isPropertyDeclaration(parent) ||
|
|
151
|
-
NodeClass.isParameterDeclaration(parent);
|
|
152
|
-
}
|
|
153
|
-
function groupReferencesByFile(references) {
|
|
154
|
-
const grouped = {};
|
|
155
|
-
for (const ref of references) {
|
|
156
|
-
if (!grouped[ref.filePath]) {
|
|
157
|
-
grouped[ref.filePath] = [];
|
|
158
|
-
}
|
|
159
|
-
grouped[ref.filePath].push(ref);
|
|
160
|
-
}
|
|
161
|
-
// Sort references within each file by line number
|
|
162
|
-
for (const filePath in grouped) {
|
|
163
|
-
grouped[filePath].sort((a, b) => a.line - b.line);
|
|
164
|
-
}
|
|
165
|
-
return grouped;
|
|
166
|
-
}
|
|
167
|
-
function formatReferenceResults(result) {
|
|
168
|
-
let output = `# Reference Search Results\n\n`;
|
|
169
|
-
output += `**Symbol:** ${result.symbol}\n`;
|
|
170
|
-
output += `**Total References:** ${result.totalReferences}\n`;
|
|
171
|
-
output += `**Files:** ${result.filesCount}\n`;
|
|
172
|
-
output += `**Definitions:** ${result.definitions.length}\n`;
|
|
173
|
-
output += `**Usages:** ${result.usages.length}\n\n`;
|
|
174
|
-
if (result.totalReferences === 0) {
|
|
175
|
-
output += `No references found for "${result.symbol}".\n`;
|
|
176
|
-
return output;
|
|
177
|
-
}
|
|
178
|
-
// Show definitions first
|
|
179
|
-
if (result.definitions.length > 0) {
|
|
180
|
-
output += `## Definitions\n\n`;
|
|
181
|
-
result.definitions.forEach((def, index) => {
|
|
182
|
-
output += `${index + 1}. **${def.filePath}:${def.line}:${def.column}**\n`;
|
|
183
|
-
output += ` \`\`\`typescript\n ${def.text}\n \`\`\`\n\n`;
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
// Show usages grouped by file
|
|
187
|
-
output += `## Usages by File\n\n`;
|
|
188
|
-
for (const [filePath, refs] of Object.entries(result.references)) {
|
|
189
|
-
const usages = refs.filter(r => !r.isDefinition);
|
|
190
|
-
if (usages.length === 0)
|
|
191
|
-
continue;
|
|
192
|
-
output += `### ${filePath} (${usages.length} usages)\n\n`;
|
|
193
|
-
usages.forEach((ref) => {
|
|
194
|
-
output += `- **Line ${ref.line}:** \`${ref.text.substring(0, 60)}...\`\n`;
|
|
195
|
-
});
|
|
196
|
-
output += `\n`;
|
|
197
|
-
}
|
|
198
|
-
return output;
|
|
199
|
-
}
|
|
200
|
-
//# sourceMappingURL=findReferences.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findReferences.js","sourceRoot":"","sources":["../../../src/tools/semantic/findReferences.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAGhD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,QAA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