@ginkoai/cli 1.0.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/LICENSE +21 -0
- package/README.md +230 -0
- package/dist/adapters/ai-adapter.d.ts +25 -0
- package/dist/adapters/ai-adapter.d.ts.map +1 -0
- package/dist/adapters/ai-adapter.js +21 -0
- package/dist/adapters/ai-adapter.js.map +1 -0
- package/dist/adapters/ai-completion.d.ts +35 -0
- package/dist/adapters/ai-completion.d.ts.map +1 -0
- package/dist/adapters/ai-completion.js +118 -0
- package/dist/adapters/ai-completion.js.map +1 -0
- package/dist/adapters/base.d.ts +64 -0
- package/dist/adapters/base.d.ts.map +1 -0
- package/dist/adapters/base.js +48 -0
- package/dist/adapters/base.js.map +1 -0
- package/dist/adapters/claude-adapter.d.ts +18 -0
- package/dist/adapters/claude-adapter.d.ts.map +1 -0
- package/dist/adapters/claude-adapter.js +73 -0
- package/dist/adapters/claude-adapter.js.map +1 -0
- package/dist/adapters/claude.d.ts +20 -0
- package/dist/adapters/claude.d.ts.map +1 -0
- package/dist/adapters/claude.js +91 -0
- package/dist/adapters/claude.js.map +1 -0
- package/dist/adapters/copilot-adapter.d.ts +16 -0
- package/dist/adapters/copilot-adapter.d.ts.map +1 -0
- package/dist/adapters/copilot-adapter.js +288 -0
- package/dist/adapters/copilot-adapter.js.map +1 -0
- package/dist/adapters/cursor-adapter.d.ts +22 -0
- package/dist/adapters/cursor-adapter.d.ts.map +1 -0
- package/dist/adapters/cursor-adapter.js +108 -0
- package/dist/adapters/cursor-adapter.js.map +1 -0
- package/dist/adapters/detector.d.ts +29 -0
- package/dist/adapters/detector.d.ts.map +1 -0
- package/dist/adapters/detector.js +132 -0
- package/dist/adapters/detector.js.map +1 -0
- package/dist/adapters/generic-adapter.d.ts +18 -0
- package/dist/adapters/generic-adapter.d.ts.map +1 -0
- package/dist/adapters/generic-adapter.js +37 -0
- package/dist/adapters/generic-adapter.js.map +1 -0
- package/dist/adapters/gpt4.d.ts +20 -0
- package/dist/adapters/gpt4.d.ts.map +1 -0
- package/dist/adapters/gpt4.js +114 -0
- package/dist/adapters/gpt4.js.map +1 -0
- package/dist/adapters/grok-adapter.d.ts +18 -0
- package/dist/adapters/grok-adapter.d.ts.map +1 -0
- package/dist/adapters/grok-adapter.js +94 -0
- package/dist/adapters/grok-adapter.js.map +1 -0
- package/dist/adapters/index.d.ts +18 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +71 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/openai-adapter.d.ts +18 -0
- package/dist/adapters/openai-adapter.d.ts.map +1 -0
- package/dist/adapters/openai-adapter.js +97 -0
- package/dist/adapters/openai-adapter.js.map +1 -0
- package/dist/adapters/universal.d.ts +20 -0
- package/dist/adapters/universal.d.ts.map +1 -0
- package/dist/adapters/universal.js +80 -0
- package/dist/adapters/universal.js.map +1 -0
- package/dist/analysis/deep-analyzer.d.ts +61 -0
- package/dist/analysis/deep-analyzer.d.ts.map +1 -0
- package/dist/analysis/deep-analyzer.js +349 -0
- package/dist/analysis/deep-analyzer.js.map +1 -0
- package/dist/analysis/project-analyzer.d.ts +25 -0
- package/dist/analysis/project-analyzer.d.ts.map +1 -0
- package/dist/analysis/project-analyzer.js +244 -0
- package/dist/analysis/project-analyzer.js.map +1 -0
- package/dist/commands/architecture/architecture-pipeline-enhanced.d.ts +82 -0
- package/dist/commands/architecture/architecture-pipeline-enhanced.d.ts.map +1 -0
- package/dist/commands/architecture/architecture-pipeline-enhanced.js +649 -0
- package/dist/commands/architecture/architecture-pipeline-enhanced.js.map +1 -0
- package/dist/commands/architecture/architecture-pipeline.d.ts +105 -0
- package/dist/commands/architecture/architecture-pipeline.d.ts.map +1 -0
- package/dist/commands/architecture/architecture-pipeline.js +510 -0
- package/dist/commands/architecture/architecture-pipeline.js.map +1 -0
- package/dist/commands/architecture/architecture-reflection.d.ts +67 -0
- package/dist/commands/architecture/architecture-reflection.d.ts.map +1 -0
- package/dist/commands/architecture/architecture-reflection.js +508 -0
- package/dist/commands/architecture/architecture-reflection.js.map +1 -0
- package/dist/commands/architecture/index.d.ts +21 -0
- package/dist/commands/architecture/index.d.ts.map +1 -0
- package/dist/commands/architecture/index.js +41 -0
- package/dist/commands/architecture/index.js.map +1 -0
- package/dist/commands/architecture.d.ts +20 -0
- package/dist/commands/architecture.d.ts.map +1 -0
- package/dist/commands/architecture.js +223 -0
- package/dist/commands/architecture.js.map +1 -0
- package/dist/commands/backlog/ai-enhanced.d.ts +83 -0
- package/dist/commands/backlog/ai-enhanced.d.ts.map +1 -0
- package/dist/commands/backlog/ai-enhanced.js +462 -0
- package/dist/commands/backlog/ai-enhanced.js.map +1 -0
- package/dist/commands/backlog/ai-prompt.d.ts +21 -0
- package/dist/commands/backlog/ai-prompt.d.ts.map +1 -0
- package/dist/commands/backlog/ai-prompt.js +373 -0
- package/dist/commands/backlog/ai-prompt.js.map +1 -0
- package/dist/commands/backlog/ai-template.d.ts +21 -0
- package/dist/commands/backlog/ai-template.d.ts.map +1 -0
- package/dist/commands/backlog/ai-template.js +374 -0
- package/dist/commands/backlog/ai-template.js.map +1 -0
- package/dist/commands/backlog/ai.d.ts +21 -0
- package/dist/commands/backlog/ai.d.ts.map +1 -0
- package/dist/commands/backlog/ai.js +76 -0
- package/dist/commands/backlog/ai.js.map +1 -0
- package/dist/commands/backlog/backlog-pipeline.d.ts +103 -0
- package/dist/commands/backlog/backlog-pipeline.d.ts.map +1 -0
- package/dist/commands/backlog/backlog-pipeline.js +538 -0
- package/dist/commands/backlog/backlog-pipeline.js.map +1 -0
- package/dist/commands/backlog/backlog-reflection.d.ts +48 -0
- package/dist/commands/backlog/backlog-reflection.d.ts.map +1 -0
- package/dist/commands/backlog/backlog-reflection.js +231 -0
- package/dist/commands/backlog/backlog-reflection.js.map +1 -0
- package/dist/commands/backlog/base.d.ts +95 -0
- package/dist/commands/backlog/base.d.ts.map +1 -0
- package/dist/commands/backlog/base.js +291 -0
- package/dist/commands/backlog/base.js.map +1 -0
- package/dist/commands/backlog/complete.d.ts +20 -0
- package/dist/commands/backlog/complete.d.ts.map +1 -0
- package/dist/commands/backlog/complete.js +83 -0
- package/dist/commands/backlog/complete.js.map +1 -0
- package/dist/commands/backlog/context-gatherer.d.ts +76 -0
- package/dist/commands/backlog/context-gatherer.d.ts.map +1 -0
- package/dist/commands/backlog/context-gatherer.js +216 -0
- package/dist/commands/backlog/context-gatherer.js.map +1 -0
- package/dist/commands/backlog/create.d.ts +25 -0
- package/dist/commands/backlog/create.d.ts.map +1 -0
- package/dist/commands/backlog/create.js +131 -0
- package/dist/commands/backlog/create.js.map +1 -0
- package/dist/commands/backlog/index.d.ts +17 -0
- package/dist/commands/backlog/index.d.ts.map +1 -0
- package/dist/commands/backlog/index.js +177 -0
- package/dist/commands/backlog/index.js.map +1 -0
- package/dist/commands/backlog/list.d.ts +25 -0
- package/dist/commands/backlog/list.d.ts.map +1 -0
- package/dist/commands/backlog/list.js +136 -0
- package/dist/commands/backlog/list.js.map +1 -0
- package/dist/commands/backlog/quick-query.d.ts +16 -0
- package/dist/commands/backlog/quick-query.d.ts.map +1 -0
- package/dist/commands/backlog/quick-query.js +126 -0
- package/dist/commands/backlog/quick-query.js.map +1 -0
- package/dist/commands/backlog/show.d.ts +20 -0
- package/dist/commands/backlog/show.d.ts.map +1 -0
- package/dist/commands/backlog/show.js +95 -0
- package/dist/commands/backlog/show.js.map +1 -0
- package/dist/commands/backlog/update.d.ts +25 -0
- package/dist/commands/backlog/update.d.ts.map +1 -0
- package/dist/commands/backlog/update.js +113 -0
- package/dist/commands/backlog/update.js.map +1 -0
- package/dist/commands/bug/bug-context-gatherer.d.ts +58 -0
- package/dist/commands/bug/bug-context-gatherer.d.ts.map +1 -0
- package/dist/commands/bug/bug-context-gatherer.js +228 -0
- package/dist/commands/bug/bug-context-gatherer.js.map +1 -0
- package/dist/commands/bug/bug-reflection.d.ts +70 -0
- package/dist/commands/bug/bug-reflection.d.ts.map +1 -0
- package/dist/commands/bug/bug-reflection.js +343 -0
- package/dist/commands/bug/bug-reflection.js.map +1 -0
- package/dist/commands/capture/capture-reflection.d.ts +139 -0
- package/dist/commands/capture/capture-reflection.d.ts.map +1 -0
- package/dist/commands/capture/capture-reflection.js +583 -0
- package/dist/commands/capture/capture-reflection.js.map +1 -0
- package/dist/commands/capture.d.ts +22 -0
- package/dist/commands/capture.d.ts.map +1 -0
- package/dist/commands/capture.js +301 -0
- package/dist/commands/capture.js.map +1 -0
- package/dist/commands/changelog/changelog-reflection.d.ts +65 -0
- package/dist/commands/changelog/changelog-reflection.d.ts.map +1 -0
- package/dist/commands/changelog/changelog-reflection.js +252 -0
- package/dist/commands/changelog/changelog-reflection.js.map +1 -0
- package/dist/commands/compact.d.ts +15 -0
- package/dist/commands/compact.d.ts.map +1 -0
- package/dist/commands/compact.js +113 -0
- package/dist/commands/compact.js.map +1 -0
- package/dist/commands/config.d.ts +10 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +85 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/context-new.d.ts +18 -0
- package/dist/commands/context-new.d.ts.map +1 -0
- package/dist/commands/context-new.js +265 -0
- package/dist/commands/context-new.js.map +1 -0
- package/dist/commands/context.d.ts +16 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +82 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/documentation/documentation-pipeline.d.ts +130 -0
- package/dist/commands/documentation/documentation-pipeline.d.ts.map +1 -0
- package/dist/commands/documentation/documentation-pipeline.js +716 -0
- package/dist/commands/documentation/documentation-pipeline.js.map +1 -0
- package/dist/commands/documentation/documentation-reflection.d.ts +54 -0
- package/dist/commands/documentation/documentation-reflection.d.ts.map +1 -0
- package/dist/commands/documentation/documentation-reflection.js +338 -0
- package/dist/commands/documentation/documentation-reflection.js.map +1 -0
- package/dist/commands/explore/explore-reflection-pipeline.d.ts +117 -0
- package/dist/commands/explore/explore-reflection-pipeline.d.ts.map +1 -0
- package/dist/commands/explore/explore-reflection-pipeline.js +503 -0
- package/dist/commands/explore/explore-reflection-pipeline.js.map +1 -0
- package/dist/commands/explore/index.d.ts +29 -0
- package/dist/commands/explore/index.d.ts.map +1 -0
- package/dist/commands/explore/index.js +30 -0
- package/dist/commands/explore/index.js.map +1 -0
- package/dist/commands/explore.d.ts +20 -0
- package/dist/commands/explore.d.ts.map +1 -0
- package/dist/commands/explore.js +224 -0
- package/dist/commands/explore.js.map +1 -0
- package/dist/commands/git/git-context-gatherer.d.ts +101 -0
- package/dist/commands/git/git-context-gatherer.d.ts.map +1 -0
- package/dist/commands/git/git-context-gatherer.js +284 -0
- package/dist/commands/git/git-context-gatherer.js.map +1 -0
- package/dist/commands/git/git-pipeline.d.ts +75 -0
- package/dist/commands/git/git-pipeline.d.ts.map +1 -0
- package/dist/commands/git/git-pipeline.js +530 -0
- package/dist/commands/git/git-pipeline.js.map +1 -0
- package/dist/commands/git/git-reflection.d.ts +50 -0
- package/dist/commands/git/git-reflection.d.ts.map +1 -0
- package/dist/commands/git/git-reflection.js +193 -0
- package/dist/commands/git/git-reflection.js.map +1 -0
- package/dist/commands/handoff/handoff-reflection-pipeline.d.ts +106 -0
- package/dist/commands/handoff/handoff-reflection-pipeline.d.ts.map +1 -0
- package/dist/commands/handoff/handoff-reflection-pipeline.js +534 -0
- package/dist/commands/handoff/handoff-reflection-pipeline.js.map +1 -0
- package/dist/commands/handoff/handoff-save.d.ts +16 -0
- package/dist/commands/handoff/handoff-save.d.ts.map +1 -0
- package/dist/commands/handoff/handoff-save.js +72 -0
- package/dist/commands/handoff/handoff-save.js.map +1 -0
- package/dist/commands/handoff/index.d.ts +19 -0
- package/dist/commands/handoff/index.d.ts.map +1 -0
- package/dist/commands/handoff/index.js +55 -0
- package/dist/commands/handoff/index.js.map +1 -0
- package/dist/commands/handoff-ai-orig.d.ts +27 -0
- package/dist/commands/handoff-ai-orig.d.ts.map +1 -0
- package/dist/commands/handoff-ai-orig.js +405 -0
- package/dist/commands/handoff-ai-orig.js.map +1 -0
- package/dist/commands/handoff-ai.d.ts +27 -0
- package/dist/commands/handoff-ai.d.ts.map +1 -0
- package/dist/commands/handoff-ai.js +405 -0
- package/dist/commands/handoff-ai.js.map +1 -0
- package/dist/commands/handoff-enhanced-orig.d.ts +25 -0
- package/dist/commands/handoff-enhanced-orig.d.ts.map +1 -0
- package/dist/commands/handoff-enhanced-orig.js +349 -0
- package/dist/commands/handoff-enhanced-orig.js.map +1 -0
- package/dist/commands/handoff-enhanced.d.ts +25 -0
- package/dist/commands/handoff-enhanced.d.ts.map +1 -0
- package/dist/commands/handoff-enhanced.js +349 -0
- package/dist/commands/handoff-enhanced.js.map +1 -0
- package/dist/commands/handoff-orig.d.ts +10 -0
- package/dist/commands/handoff-orig.d.ts.map +1 -0
- package/dist/commands/handoff-orig.js +167 -0
- package/dist/commands/handoff-orig.js.map +1 -0
- package/dist/commands/handoff.d.ts +10 -0
- package/dist/commands/handoff.d.ts.map +1 -0
- package/dist/commands/handoff.js +167 -0
- package/dist/commands/handoff.js.map +1 -0
- package/dist/commands/init-copilot.d.ts +6 -0
- package/dist/commands/init-copilot.d.ts.map +1 -0
- package/dist/commands/init-copilot.js +151 -0
- package/dist/commands/init-copilot.js.map +1 -0
- package/dist/commands/init-cursor.d.ts +5 -0
- package/dist/commands/init-cursor.d.ts.map +1 -0
- package/dist/commands/init-cursor.js +95 -0
- package/dist/commands/init-cursor.js.map +1 -0
- package/dist/commands/init-enhanced.d.ts +20 -0
- package/dist/commands/init-enhanced.d.ts.map +1 -0
- package/dist/commands/init-enhanced.js +430 -0
- package/dist/commands/init-enhanced.js.map +1 -0
- package/dist/commands/init.d.ts +16 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +213 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/magic-prompt.d.ts +20 -0
- package/dist/commands/magic-prompt.d.ts.map +1 -0
- package/dist/commands/magic-prompt.js +166 -0
- package/dist/commands/magic-prompt.js.map +1 -0
- package/dist/commands/magic-simple.d.ts +20 -0
- package/dist/commands/magic-simple.d.ts.map +1 -0
- package/dist/commands/magic-simple.js +32 -0
- package/dist/commands/magic-simple.js.map +1 -0
- package/dist/commands/magic.d.ts +20 -0
- package/dist/commands/magic.d.ts.map +1 -0
- package/dist/commands/magic.js +144 -0
- package/dist/commands/magic.js.map +1 -0
- package/dist/commands/plan/plan-reflection-pipeline.d.ts +126 -0
- package/dist/commands/plan/plan-reflection-pipeline.d.ts.map +1 -0
- package/dist/commands/plan/plan-reflection-pipeline.js +554 -0
- package/dist/commands/plan/plan-reflection-pipeline.js.map +1 -0
- package/dist/commands/plan.d.ts +20 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +253 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/prd/index.d.ts +21 -0
- package/dist/commands/prd/index.d.ts.map +1 -0
- package/dist/commands/prd/index.js +41 -0
- package/dist/commands/prd/index.js.map +1 -0
- package/dist/commands/prd/prd-pipeline-enhanced.d.ts +82 -0
- package/dist/commands/prd/prd-pipeline-enhanced.d.ts.map +1 -0
- package/dist/commands/prd/prd-pipeline-enhanced.js +565 -0
- package/dist/commands/prd/prd-pipeline-enhanced.js.map +1 -0
- package/dist/commands/prd/prd-pipeline.d.ts +106 -0
- package/dist/commands/prd/prd-pipeline.d.ts.map +1 -0
- package/dist/commands/prd/prd-pipeline.js +491 -0
- package/dist/commands/prd/prd-pipeline.js.map +1 -0
- package/dist/commands/prd/prd-reflection-enhanced.d.ts +63 -0
- package/dist/commands/prd/prd-reflection-enhanced.d.ts.map +1 -0
- package/dist/commands/prd/prd-reflection-enhanced.js +310 -0
- package/dist/commands/prd/prd-reflection-enhanced.js.map +1 -0
- package/dist/commands/prd/prd-reflection.d.ts +59 -0
- package/dist/commands/prd/prd-reflection.d.ts.map +1 -0
- package/dist/commands/prd/prd-reflection.js +548 -0
- package/dist/commands/prd/prd-reflection.js.map +1 -0
- package/dist/commands/reflect.d.ts +24 -0
- package/dist/commands/reflect.d.ts.map +1 -0
- package/dist/commands/reflect.js +135 -0
- package/dist/commands/reflect.js.map +1 -0
- package/dist/commands/ship/ship-reflection.d.ts +164 -0
- package/dist/commands/ship/ship-reflection.d.ts.map +1 -0
- package/dist/commands/ship/ship-reflection.js +732 -0
- package/dist/commands/ship/ship-reflection.js.map +1 -0
- package/dist/commands/ship-ai.d.ts +28 -0
- package/dist/commands/ship-ai.d.ts.map +1 -0
- package/dist/commands/ship-ai.js +318 -0
- package/dist/commands/ship-ai.js.map +1 -0
- package/dist/commands/ship.d.ts +17 -0
- package/dist/commands/ship.d.ts.map +1 -0
- package/dist/commands/ship.js +175 -0
- package/dist/commands/ship.js.map +1 -0
- package/dist/commands/sprint/index.d.ts +21 -0
- package/dist/commands/sprint/index.d.ts.map +1 -0
- package/dist/commands/sprint/index.js +39 -0
- package/dist/commands/sprint/index.js.map +1 -0
- package/dist/commands/sprint/sprint-pipeline-enhanced.d.ts +142 -0
- package/dist/commands/sprint/sprint-pipeline-enhanced.d.ts.map +1 -0
- package/dist/commands/sprint/sprint-pipeline-enhanced.js +822 -0
- package/dist/commands/sprint/sprint-pipeline-enhanced.js.map +1 -0
- package/dist/commands/sprint/sprint-pipeline.d.ts +72 -0
- package/dist/commands/sprint/sprint-pipeline.d.ts.map +1 -0
- package/dist/commands/sprint/sprint-pipeline.js +363 -0
- package/dist/commands/sprint/sprint-pipeline.js.map +1 -0
- package/dist/commands/start/index.d.ts +19 -0
- package/dist/commands/start/index.d.ts.map +1 -0
- package/dist/commands/start/index.js +41 -0
- package/dist/commands/start/index.js.map +1 -0
- package/dist/commands/start/start-reflection-pipeline.d.ts +99 -0
- package/dist/commands/start/start-reflection-pipeline.d.ts.map +1 -0
- package/dist/commands/start/start-reflection-pipeline.js +458 -0
- package/dist/commands/start/start-reflection-pipeline.js.map +1 -0
- package/dist/commands/start/start-reflection.d.ts +89 -0
- package/dist/commands/start/start-reflection.d.ts.map +1 -0
- package/dist/commands/start/start-reflection.js +572 -0
- package/dist/commands/start/start-reflection.js.map +1 -0
- package/dist/commands/start/start-with-synthesis.d.ts +20 -0
- package/dist/commands/start/start-with-synthesis.d.ts.map +1 -0
- package/dist/commands/start/start-with-synthesis.js +134 -0
- package/dist/commands/start/start-with-synthesis.js.map +1 -0
- package/dist/commands/start-enhanced-orig.d.ts +19 -0
- package/dist/commands/start-enhanced-orig.d.ts.map +1 -0
- package/dist/commands/start-enhanced-orig.js +434 -0
- package/dist/commands/start-enhanced-orig.js.map +1 -0
- package/dist/commands/start-enhanced.d.ts +19 -0
- package/dist/commands/start-enhanced.d.ts.map +1 -0
- package/dist/commands/start-enhanced.js +434 -0
- package/dist/commands/start-enhanced.js.map +1 -0
- package/dist/commands/start-orig.d.ts +10 -0
- package/dist/commands/start-orig.d.ts.map +1 -0
- package/dist/commands/start-orig.js +119 -0
- package/dist/commands/start-orig.js.map +1 -0
- package/dist/commands/start.d.ts +10 -0
- package/dist/commands/start.d.ts.map +1 -0
- package/dist/commands/start.js +119 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/status.d.ts +11 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +119 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/testing/index.d.ts +21 -0
- package/dist/commands/testing/index.d.ts.map +1 -0
- package/dist/commands/testing/index.js +41 -0
- package/dist/commands/testing/index.js.map +1 -0
- package/dist/commands/testing/testing-pipeline-enhanced.d.ts +94 -0
- package/dist/commands/testing/testing-pipeline-enhanced.d.ts.map +1 -0
- package/dist/commands/testing/testing-pipeline-enhanced.js +760 -0
- package/dist/commands/testing/testing-pipeline-enhanced.js.map +1 -0
- package/dist/commands/testing/testing-pipeline.d.ts +77 -0
- package/dist/commands/testing/testing-pipeline.d.ts.map +1 -0
- package/dist/commands/testing/testing-pipeline.js +479 -0
- package/dist/commands/testing/testing-pipeline.js.map +1 -0
- package/dist/commands/uninstall-copilot.d.ts +5 -0
- package/dist/commands/uninstall-copilot.d.ts.map +1 -0
- package/dist/commands/uninstall-copilot.js +143 -0
- package/dist/commands/uninstall-copilot.js.map +1 -0
- package/dist/commands/uninstall-cursor.d.ts +6 -0
- package/dist/commands/uninstall-cursor.d.ts.map +1 -0
- package/dist/commands/uninstall-cursor.js +124 -0
- package/dist/commands/uninstall-cursor.js.map +1 -0
- package/dist/commands/vibecheck-ai.d.ts +25 -0
- package/dist/commands/vibecheck-ai.d.ts.map +1 -0
- package/dist/commands/vibecheck-ai.js +260 -0
- package/dist/commands/vibecheck-ai.js.map +1 -0
- package/dist/commands/vibecheck-aware.d.ts +19 -0
- package/dist/commands/vibecheck-aware.d.ts.map +1 -0
- package/dist/commands/vibecheck-aware.js +350 -0
- package/dist/commands/vibecheck-aware.js.map +1 -0
- package/dist/commands/vibecheck-final.d.ts +22 -0
- package/dist/commands/vibecheck-final.d.ts.map +1 -0
- package/dist/commands/vibecheck-final.js +132 -0
- package/dist/commands/vibecheck-final.js.map +1 -0
- package/dist/commands/vibecheck-natural.d.ts +18 -0
- package/dist/commands/vibecheck-natural.d.ts.map +1 -0
- package/dist/commands/vibecheck-natural.js +105 -0
- package/dist/commands/vibecheck-natural.js.map +1 -0
- package/dist/commands/vibecheck-simple.d.ts +20 -0
- package/dist/commands/vibecheck-simple.d.ts.map +1 -0
- package/dist/commands/vibecheck-simple.js +136 -0
- package/dist/commands/vibecheck-simple.js.map +1 -0
- package/dist/commands/vibecheck.d.ts +10 -0
- package/dist/commands/vibecheck.d.ts.map +1 -0
- package/dist/commands/vibecheck.js +95 -0
- package/dist/commands/vibecheck.js.map +1 -0
- package/dist/core/adapters/path-adapter.d.ts +144 -0
- package/dist/core/adapters/path-adapter.d.ts.map +1 -0
- package/dist/core/adapters/path-adapter.js +245 -0
- package/dist/core/adapters/path-adapter.js.map +1 -0
- package/dist/core/command-shortcuts.d.ts +62 -0
- package/dist/core/command-shortcuts.d.ts.map +1 -0
- package/dist/core/command-shortcuts.js +124 -0
- package/dist/core/command-shortcuts.js.map +1 -0
- package/dist/core/config/config-aware-reflection.d.ts +37 -0
- package/dist/core/config/config-aware-reflection.d.ts.map +1 -0
- package/dist/core/config/config-aware-reflection.js +97 -0
- package/dist/core/config/config-aware-reflection.js.map +1 -0
- package/dist/core/config/config-loader.d.ts +154 -0
- package/dist/core/config/config-loader.d.ts.map +1 -0
- package/dist/core/config/config-loader.js +424 -0
- package/dist/core/config/config-loader.js.map +1 -0
- package/dist/core/config/config-migrator.d.ts +150 -0
- package/dist/core/config/config-migrator.d.ts.map +1 -0
- package/dist/core/config/config-migrator.js +423 -0
- package/dist/core/config/config-migrator.js.map +1 -0
- package/dist/core/config/config-schema.d.ts +276 -0
- package/dist/core/config/config-schema.d.ts.map +1 -0
- package/dist/core/config/config-schema.js +277 -0
- package/dist/core/config/config-schema.js.map +1 -0
- package/dist/core/config/index.d.ts +260 -0
- package/dist/core/config/index.d.ts.map +1 -0
- package/dist/core/config/index.js +283 -0
- package/dist/core/config/index.js.map +1 -0
- package/dist/core/config/interactive-config.d.ts +76 -0
- package/dist/core/config/interactive-config.d.ts.map +1 -0
- package/dist/core/config/interactive-config.js +315 -0
- package/dist/core/config/interactive-config.js.map +1 -0
- package/dist/core/config/path-config.d.ts +121 -0
- package/dist/core/config/path-config.d.ts.map +1 -0
- package/dist/core/config/path-config.js +210 -0
- package/dist/core/config/path-config.js.map +1 -0
- package/dist/core/config/path-resolver.d.ts +151 -0
- package/dist/core/config/path-resolver.d.ts.map +1 -0
- package/dist/core/config/path-resolver.js +343 -0
- package/dist/core/config/path-resolver.js.map +1 -0
- package/dist/core/config/project-detector.d.ts +58 -0
- package/dist/core/config/project-detector.d.ts.map +1 -0
- package/dist/core/config/project-detector.js +310 -0
- package/dist/core/config/project-detector.js.map +1 -0
- package/dist/core/config-backup/config-aware-reflection.d.ts +37 -0
- package/dist/core/config-backup/config-aware-reflection.d.ts.map +1 -0
- package/dist/core/config-backup/config-aware-reflection.js +97 -0
- package/dist/core/config-backup/config-aware-reflection.js.map +1 -0
- package/dist/core/config-backup/config-loader.d.ts +71 -0
- package/dist/core/config-backup/config-loader.d.ts.map +1 -0
- package/dist/core/config-backup/config-loader.js +288 -0
- package/dist/core/config-backup/config-loader.js.map +1 -0
- package/dist/core/config-backup/interactive-config.d.ts +76 -0
- package/dist/core/config-backup/interactive-config.d.ts.map +1 -0
- package/dist/core/config-backup/interactive-config.js +315 -0
- package/dist/core/config-backup/interactive-config.js.map +1 -0
- package/dist/core/config-backup/path-config.d.ts +121 -0
- package/dist/core/config-backup/path-config.d.ts.map +1 -0
- package/dist/core/config-backup/path-config.js +210 -0
- package/dist/core/config-backup/path-config.js.map +1 -0
- package/dist/core/config-backup/project-detector.d.ts +58 -0
- package/dist/core/config-backup/project-detector.d.ts.map +1 -0
- package/dist/core/config-backup/project-detector.js +310 -0
- package/dist/core/config-backup/project-detector.js.map +1 -0
- package/dist/core/documents/document-manager.d.ts +97 -0
- package/dist/core/documents/document-manager.d.ts.map +1 -0
- package/dist/core/documents/document-manager.js +441 -0
- package/dist/core/documents/document-manager.js.map +1 -0
- package/dist/core/documents/document-migrator.d.ts +138 -0
- package/dist/core/documents/document-migrator.d.ts.map +1 -0
- package/dist/core/documents/document-migrator.js +349 -0
- package/dist/core/documents/document-migrator.js.map +1 -0
- package/dist/core/documents/document-namer.d.ts +111 -0
- package/dist/core/documents/document-namer.d.ts.map +1 -0
- package/dist/core/documents/document-namer.js +225 -0
- package/dist/core/documents/document-namer.js.map +1 -0
- package/dist/core/documents/examples.d.ts +74 -0
- package/dist/core/documents/examples.d.ts.map +1 -0
- package/dist/core/documents/examples.js +273 -0
- package/dist/core/documents/examples.js.map +1 -0
- package/dist/core/documents/file-system.d.ts +93 -0
- package/dist/core/documents/file-system.d.ts.map +1 -0
- package/dist/core/documents/file-system.js +432 -0
- package/dist/core/documents/file-system.js.map +1 -0
- package/dist/core/documents/index.d.ts +97 -0
- package/dist/core/documents/index.d.ts.map +1 -0
- package/dist/core/documents/index.js +119 -0
- package/dist/core/documents/index.js.map +1 -0
- package/dist/core/documents/markdown-processor.d.ts +84 -0
- package/dist/core/documents/markdown-processor.d.ts.map +1 -0
- package/dist/core/documents/markdown-processor.js +302 -0
- package/dist/core/documents/markdown-processor.js.map +1 -0
- package/dist/core/documents/sequence-manager.d.ts +107 -0
- package/dist/core/documents/sequence-manager.d.ts.map +1 -0
- package/dist/core/documents/sequence-manager.js +246 -0
- package/dist/core/documents/sequence-manager.js.map +1 -0
- package/dist/core/documents/template-engine.d.ts +101 -0
- package/dist/core/documents/template-engine.d.ts.map +1 -0
- package/dist/core/documents/template-engine.js +440 -0
- package/dist/core/documents/template-engine.js.map +1 -0
- package/dist/core/handoff-quality.d.ts +164 -0
- package/dist/core/handoff-quality.d.ts.map +1 -0
- package/dist/core/handoff-quality.js +590 -0
- package/dist/core/handoff-quality.js.map +1 -0
- package/dist/core/platform/hook-adapter.d.ts +109 -0
- package/dist/core/platform/hook-adapter.d.ts.map +1 -0
- package/dist/core/platform/hook-adapter.js +527 -0
- package/dist/core/platform/hook-adapter.js.map +1 -0
- package/dist/core/platform/hook-migration.d.ts +73 -0
- package/dist/core/platform/hook-migration.d.ts.map +1 -0
- package/dist/core/platform/hook-migration.js +339 -0
- package/dist/core/platform/hook-migration.js.map +1 -0
- package/dist/core/platform/hook-migrator.d.ts +49 -0
- package/dist/core/platform/hook-migrator.d.ts.map +1 -0
- package/dist/core/platform/hook-migrator.js +305 -0
- package/dist/core/platform/hook-migrator.js.map +1 -0
- package/dist/core/platform/hook-templates.d.ts +60 -0
- package/dist/core/platform/hook-templates.d.ts.map +1 -0
- package/dist/core/platform/hook-templates.js +352 -0
- package/dist/core/platform/hook-templates.js.map +1 -0
- package/dist/core/platform/index.d.ts +82 -0
- package/dist/core/platform/index.d.ts.map +1 -0
- package/dist/core/platform/index.js +173 -0
- package/dist/core/platform/index.js.map +1 -0
- package/dist/core/platform/path-normalizer.d.ts +117 -0
- package/dist/core/platform/path-normalizer.d.ts.map +1 -0
- package/dist/core/platform/path-normalizer.js +333 -0
- package/dist/core/platform/path-normalizer.js.map +1 -0
- package/dist/core/platform/path-resolver.d.ts +120 -0
- package/dist/core/platform/path-resolver.d.ts.map +1 -0
- package/dist/core/platform/path-resolver.js +339 -0
- package/dist/core/platform/path-resolver.js.map +1 -0
- package/dist/core/platform/platform-adapter.d.ts +101 -0
- package/dist/core/platform/platform-adapter.d.ts.map +1 -0
- package/dist/core/platform/platform-adapter.js +243 -0
- package/dist/core/platform/platform-adapter.js.map +1 -0
- package/dist/core/platform/platform-detector.d.ts +122 -0
- package/dist/core/platform/platform-detector.d.ts.map +1 -0
- package/dist/core/platform/platform-detector.js +318 -0
- package/dist/core/platform/platform-detector.js.map +1 -0
- package/dist/core/platform/platform-templates.d.ts +62 -0
- package/dist/core/platform/platform-templates.d.ts.map +1 -0
- package/dist/core/platform/platform-templates.js +364 -0
- package/dist/core/platform/platform-templates.js.map +1 -0
- package/dist/core/platform/types.d.ts +54 -0
- package/dist/core/platform/types.d.ts.map +1 -0
- package/dist/core/platform/types.js +12 -0
- package/dist/core/platform/types.js.map +1 -0
- package/dist/core/polyglot-example.d.ts +115 -0
- package/dist/core/polyglot-example.d.ts.map +1 -0
- package/dist/core/polyglot-example.js +341 -0
- package/dist/core/polyglot-example.js.map +1 -0
- package/dist/core/pressure-monitor.d.ts +76 -0
- package/dist/core/pressure-monitor.d.ts.map +1 -0
- package/dist/core/pressure-monitor.js +156 -0
- package/dist/core/pressure-monitor.js.map +1 -0
- package/dist/core/reflection-pattern.d.ts +99 -0
- package/dist/core/reflection-pattern.d.ts.map +1 -0
- package/dist/core/reflection-pattern.js +294 -0
- package/dist/core/reflection-pattern.js.map +1 -0
- package/dist/core/session-log-manager.d.ts +83 -0
- package/dist/core/session-log-manager.d.ts.map +1 -0
- package/dist/core/session-log-manager.js +288 -0
- package/dist/core/session-log-manager.js.map +1 -0
- package/dist/core/simple-pipeline-base.d.ts +130 -0
- package/dist/core/simple-pipeline-base.d.ts.map +1 -0
- package/dist/core/simple-pipeline-base.js +240 -0
- package/dist/core/simple-pipeline-base.js.map +1 -0
- package/dist/core/simple-pipeline.d.ts +70 -0
- package/dist/core/simple-pipeline.d.ts.map +1 -0
- package/dist/core/simple-pipeline.js +241 -0
- package/dist/core/simple-pipeline.js.map +1 -0
- package/dist/core/utils/paths.d.ts +50 -0
- package/dist/core/utils/paths.d.ts.map +1 -0
- package/dist/core/utils/paths.js +75 -0
- package/dist/core/utils/paths.js.map +1 -0
- package/dist/core/validators/command-argument-validator.d.ts +102 -0
- package/dist/core/validators/command-argument-validator.d.ts.map +1 -0
- package/dist/core/validators/command-argument-validator.js +377 -0
- package/dist/core/validators/command-argument-validator.js.map +1 -0
- package/dist/core/validators/config-validator.d.ts +111 -0
- package/dist/core/validators/config-validator.d.ts.map +1 -0
- package/dist/core/validators/config-validator.js +433 -0
- package/dist/core/validators/config-validator.js.map +1 -0
- package/dist/core/validators/environment-validator.d.ts +138 -0
- package/dist/core/validators/environment-validator.d.ts.map +1 -0
- package/dist/core/validators/environment-validator.js +516 -0
- package/dist/core/validators/environment-validator.js.map +1 -0
- package/dist/core/validators/git-validator.d.ts +100 -0
- package/dist/core/validators/git-validator.d.ts.map +1 -0
- package/dist/core/validators/git-validator.js +288 -0
- package/dist/core/validators/git-validator.js.map +1 -0
- package/dist/core/validators/git-validator.test.d.ts +12 -0
- package/dist/core/validators/git-validator.test.d.ts.map +1 -0
- package/dist/core/validators/git-validator.test.js +40 -0
- package/dist/core/validators/git-validator.test.js.map +1 -0
- package/dist/core/validators/index.d.ts +90 -0
- package/dist/core/validators/index.d.ts.map +1 -0
- package/dist/core/validators/index.js +166 -0
- package/dist/core/validators/index.js.map +1 -0
- package/dist/core/validators/input-validator.d.ts +117 -0
- package/dist/core/validators/input-validator.d.ts.map +1 -0
- package/dist/core/validators/input-validator.js +368 -0
- package/dist/core/validators/input-validator.js.map +1 -0
- package/dist/core/validators/temp_index.d.ts +56 -0
- package/dist/core/validators/temp_index.d.ts.map +1 -0
- package/dist/core/validators/temp_index.js +94 -0
- package/dist/core/validators/temp_index.js.map +1 -0
- package/dist/core/validators/validation-error-handler.d.ts +107 -0
- package/dist/core/validators/validation-error-handler.d.ts.map +1 -0
- package/dist/core/validators/validation-error-handler.js +379 -0
- package/dist/core/validators/validation-error-handler.js.map +1 -0
- package/dist/core/validators/validation-orchestrator.d.ts +128 -0
- package/dist/core/validators/validation-orchestrator.d.ts.map +1 -0
- package/dist/core/validators/validation-orchestrator.js +301 -0
- package/dist/core/validators/validation-orchestrator.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +316 -0
- package/dist/index.js.map +1 -0
- package/dist/services/active-context-manager.d.ts +118 -0
- package/dist/services/active-context-manager.d.ts.map +1 -0
- package/dist/services/active-context-manager.js +435 -0
- package/dist/services/active-context-manager.js.map +1 -0
- package/dist/services/ai-service.d.ts +71 -0
- package/dist/services/ai-service.d.ts.map +1 -0
- package/dist/services/ai-service.js +329 -0
- package/dist/services/ai-service.js.map +1 -0
- package/dist/services/context-search.d.ts +98 -0
- package/dist/services/context-search.d.ts.map +1 -0
- package/dist/services/context-search.js +289 -0
- package/dist/services/context-search.js.map +1 -0
- package/dist/services/insight-extractor.d.ts +69 -0
- package/dist/services/insight-extractor.d.ts.map +1 -0
- package/dist/services/insight-extractor.js +343 -0
- package/dist/services/insight-extractor.js.map +1 -0
- package/dist/services/insight-quality-controller.d.ts +167 -0
- package/dist/services/insight-quality-controller.d.ts.map +1 -0
- package/dist/services/insight-quality-controller.js +543 -0
- package/dist/services/insight-quality-controller.js.map +1 -0
- package/dist/services/module-generator.d.ts +108 -0
- package/dist/services/module-generator.d.ts.map +1 -0
- package/dist/services/module-generator.js +561 -0
- package/dist/services/module-generator.js.map +1 -0
- package/dist/services/statusline-tracker.d.ts +139 -0
- package/dist/services/statusline-tracker.d.ts.map +1 -0
- package/dist/services/statusline-tracker.js +360 -0
- package/dist/services/statusline-tracker.js.map +1 -0
- package/dist/templates/ai-instructions-template.d.ts +39 -0
- package/dist/templates/ai-instructions-template.d.ts.map +1 -0
- package/dist/templates/ai-instructions-template.js +222 -0
- package/dist/templates/ai-instructions-template.js.map +1 -0
- package/dist/types/config.d.ts +128 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +49 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/documents.d.ts +87 -0
- package/dist/types/documents.d.ts.map +1 -0
- package/dist/types/documents.js +12 -0
- package/dist/types/documents.js.map +1 -0
- package/dist/types/session-log.d.ts +83 -0
- package/dist/types/session-log.d.ts.map +1 -0
- package/dist/types/session-log.js +12 -0
- package/dist/types/session-log.js.map +1 -0
- package/dist/types/session.d.ts +257 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/session.js +12 -0
- package/dist/types/session.js.map +1 -0
- package/dist/utils/ai-templates.d.ts +98 -0
- package/dist/utils/ai-templates.d.ts.map +1 -0
- package/dist/utils/ai-templates.js +179 -0
- package/dist/utils/ai-templates.js.map +1 -0
- package/dist/utils/ginko-root.d.ts +51 -0
- package/dist/utils/ginko-root.d.ts.map +1 -0
- package/dist/utils/ginko-root.js +96 -0
- package/dist/utils/ginko-root.js.map +1 -0
- package/dist/utils/helpers.d.ts +19 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/helpers.js +107 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/progressive-learning.d.ts +42 -0
- package/dist/utils/progressive-learning.d.ts.map +1 -0
- package/dist/utils/progressive-learning.js +248 -0
- package/dist/utils/progressive-learning.js.map +1 -0
- package/dist/utils/session-collector.d.ts +81 -0
- package/dist/utils/session-collector.d.ts.map +1 -0
- package/dist/utils/session-collector.js +387 -0
- package/dist/utils/session-collector.js.map +1 -0
- package/dist/utils/session-logger.d.ts +125 -0
- package/dist/utils/session-logger.d.ts.map +1 -0
- package/dist/utils/session-logger.js +359 -0
- package/dist/utils/session-logger.js.map +1 -0
- package/dist/utils/session-synthesizer.d.ts +36 -0
- package/dist/utils/session-synthesizer.d.ts.map +1 -0
- package/dist/utils/session-synthesizer.js +239 -0
- package/dist/utils/session-synthesizer.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileType: utility
|
|
3
|
+
* @status: current
|
|
4
|
+
* @updated: 2025-09-20
|
|
5
|
+
* @tags: [platform, cross-platform, hooks, compatibility, adapter]
|
|
6
|
+
* @related: [config-loader.ts, git-validator.ts]
|
|
7
|
+
* @priority: high
|
|
8
|
+
* @complexity: medium
|
|
9
|
+
* @dependencies: [os, path, fs]
|
|
10
|
+
*/
|
|
11
|
+
import * as os from 'os';
|
|
12
|
+
import * as path from 'path';
|
|
13
|
+
import * as fs from 'fs';
|
|
14
|
+
/**
|
|
15
|
+
* PlatformAdapter handles cross-platform compatibility for ginko CLI
|
|
16
|
+
* Provides platform detection, path resolution, and hook management
|
|
17
|
+
*/
|
|
18
|
+
export class PlatformAdapter {
|
|
19
|
+
_platform = null;
|
|
20
|
+
_config = null;
|
|
21
|
+
/**
|
|
22
|
+
* Detect current operating system platform
|
|
23
|
+
*/
|
|
24
|
+
detectPlatform() {
|
|
25
|
+
if (this._platform) {
|
|
26
|
+
return this._platform;
|
|
27
|
+
}
|
|
28
|
+
const platform = process.platform;
|
|
29
|
+
if (platform === 'win32') {
|
|
30
|
+
this._platform = 'windows';
|
|
31
|
+
}
|
|
32
|
+
else if (platform === 'darwin') {
|
|
33
|
+
this._platform = 'macos';
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this._platform = 'linux';
|
|
37
|
+
}
|
|
38
|
+
return this._platform;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get platform-specific configuration
|
|
42
|
+
*/
|
|
43
|
+
getPlatformConfig() {
|
|
44
|
+
if (this._config) {
|
|
45
|
+
return this._config;
|
|
46
|
+
}
|
|
47
|
+
const platform = this.detectPlatform();
|
|
48
|
+
const homeDir = os.homedir();
|
|
49
|
+
this._config = {
|
|
50
|
+
platform,
|
|
51
|
+
hookExtension: this.getHookExtension(platform),
|
|
52
|
+
shellExtension: this.getShellExtension(platform),
|
|
53
|
+
pathSeparator: platform === 'windows' ? '\\' : '/',
|
|
54
|
+
homeDirectory: homeDir,
|
|
55
|
+
claudeConfigPath: this.getClaudeConfigPath(platform, homeDir),
|
|
56
|
+
hookDirectory: this.getHookDirectory(platform, homeDir)
|
|
57
|
+
};
|
|
58
|
+
return this._config;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get appropriate hook file extension for platform
|
|
62
|
+
*/
|
|
63
|
+
getHookExtension(platform) {
|
|
64
|
+
const currentPlatform = platform || this.detectPlatform();
|
|
65
|
+
switch (currentPlatform) {
|
|
66
|
+
case 'windows':
|
|
67
|
+
return '.bat';
|
|
68
|
+
case 'macos':
|
|
69
|
+
case 'linux':
|
|
70
|
+
return '.sh';
|
|
71
|
+
default:
|
|
72
|
+
return '.sh';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get appropriate shell script extension for platform
|
|
77
|
+
*/
|
|
78
|
+
getShellExtension(platform) {
|
|
79
|
+
const currentPlatform = platform || this.detectPlatform();
|
|
80
|
+
switch (currentPlatform) {
|
|
81
|
+
case 'windows':
|
|
82
|
+
return '.bat';
|
|
83
|
+
case 'macos':
|
|
84
|
+
case 'linux':
|
|
85
|
+
return '.sh';
|
|
86
|
+
default:
|
|
87
|
+
return '.sh';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Get Claude configuration directory path for platform
|
|
92
|
+
*/
|
|
93
|
+
getClaudeConfigPath(platform, homeDir) {
|
|
94
|
+
const currentPlatform = platform || this.detectPlatform();
|
|
95
|
+
const home = homeDir || os.homedir();
|
|
96
|
+
switch (currentPlatform) {
|
|
97
|
+
case 'windows':
|
|
98
|
+
return path.join(home, 'AppData', 'Roaming', 'Claude');
|
|
99
|
+
case 'macos':
|
|
100
|
+
return path.join(home, 'Library', 'Application Support', 'Claude');
|
|
101
|
+
case 'linux':
|
|
102
|
+
return path.join(home, '.config', 'claude');
|
|
103
|
+
default:
|
|
104
|
+
return path.join(home, '.claude');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get hook directory path for platform
|
|
109
|
+
*/
|
|
110
|
+
getHookDirectory(platform, homeDir) {
|
|
111
|
+
const claudeConfigPath = this.getClaudeConfigPath(platform, homeDir);
|
|
112
|
+
return path.join(claudeConfigPath, 'hooks');
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Adapt hook path for current platform
|
|
116
|
+
*/
|
|
117
|
+
adaptHookPath(hookName, platform) {
|
|
118
|
+
const config = this.getPlatformConfig();
|
|
119
|
+
const currentPlatform = platform || config.platform;
|
|
120
|
+
const ext = this.getHookExtension(currentPlatform);
|
|
121
|
+
// Remove any existing extension from hookName
|
|
122
|
+
const baseName = hookName.replace(/\.(sh|bat|ps1)$/, '');
|
|
123
|
+
return path.join(this.getHookDirectory(currentPlatform), `${baseName}${ext}`);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Find all existing hooks in the system
|
|
127
|
+
*/
|
|
128
|
+
async findExistingHooks() {
|
|
129
|
+
const hooks = [];
|
|
130
|
+
const config = this.getPlatformConfig();
|
|
131
|
+
try {
|
|
132
|
+
if (!fs.existsSync(config.hookDirectory)) {
|
|
133
|
+
return hooks;
|
|
134
|
+
}
|
|
135
|
+
const files = await fs.promises.readdir(config.hookDirectory);
|
|
136
|
+
for (const file of files) {
|
|
137
|
+
const filePath = path.join(config.hookDirectory, file);
|
|
138
|
+
const stat = await fs.promises.stat(filePath);
|
|
139
|
+
if (stat.isFile()) {
|
|
140
|
+
const ext = path.extname(file);
|
|
141
|
+
const baseName = path.basename(file, ext);
|
|
142
|
+
let platform;
|
|
143
|
+
if (ext === '.bat') {
|
|
144
|
+
platform = 'windows';
|
|
145
|
+
}
|
|
146
|
+
else if (ext === '.sh') {
|
|
147
|
+
// Could be macOS or Linux, use current platform as default
|
|
148
|
+
platform = config.platform === 'windows' ? 'linux' : config.platform;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
continue; // Skip non-hook files
|
|
152
|
+
}
|
|
153
|
+
hooks.push({
|
|
154
|
+
name: baseName,
|
|
155
|
+
platform,
|
|
156
|
+
path: filePath,
|
|
157
|
+
extension: ext
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
console.warn(`Warning: Could not read hook directory: ${error}`);
|
|
164
|
+
}
|
|
165
|
+
return hooks;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Check if hooks directory exists and create it if needed
|
|
169
|
+
*/
|
|
170
|
+
async ensureHookDirectory() {
|
|
171
|
+
const config = this.getPlatformConfig();
|
|
172
|
+
try {
|
|
173
|
+
await fs.promises.mkdir(config.hookDirectory, { recursive: true });
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
throw new Error(`Failed to create hook directory: ${error}`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Check if current platform is Windows
|
|
181
|
+
*/
|
|
182
|
+
isWindows() {
|
|
183
|
+
return this.detectPlatform() === 'windows';
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Check if current platform is macOS
|
|
187
|
+
*/
|
|
188
|
+
isMacOS() {
|
|
189
|
+
return this.detectPlatform() === 'macos';
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Check if current platform is Linux
|
|
193
|
+
*/
|
|
194
|
+
isLinux() {
|
|
195
|
+
return this.detectPlatform() === 'linux';
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Check if current platform is Unix-like (macOS or Linux)
|
|
199
|
+
*/
|
|
200
|
+
isUnix() {
|
|
201
|
+
const platform = this.detectPlatform();
|
|
202
|
+
return platform === 'macos' || platform === 'linux';
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Get platform-appropriate path separator
|
|
206
|
+
*/
|
|
207
|
+
getPathSeparator() {
|
|
208
|
+
return this.getPlatformConfig().pathSeparator;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Normalize path for current platform
|
|
212
|
+
*/
|
|
213
|
+
normalizePath(inputPath) {
|
|
214
|
+
const config = this.getPlatformConfig();
|
|
215
|
+
if (config.platform === 'windows') {
|
|
216
|
+
// Convert forward slashes to backslashes on Windows
|
|
217
|
+
return inputPath.replace(/\//g, '\\');
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
// Convert backslashes to forward slashes on Unix-like systems
|
|
221
|
+
return inputPath.replace(/\\/g, '/');
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Get platform display name for user messages
|
|
226
|
+
*/
|
|
227
|
+
getPlatformDisplayName(platform) {
|
|
228
|
+
const currentPlatform = platform || this.detectPlatform();
|
|
229
|
+
switch (currentPlatform) {
|
|
230
|
+
case 'windows':
|
|
231
|
+
return 'Windows';
|
|
232
|
+
case 'macos':
|
|
233
|
+
return 'macOS';
|
|
234
|
+
case 'linux':
|
|
235
|
+
return 'Linux';
|
|
236
|
+
default:
|
|
237
|
+
return 'Unknown';
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
// Export singleton instance
|
|
242
|
+
export const platformAdapter = new PlatformAdapter();
|
|
243
|
+
//# sourceMappingURL=platform-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-adapter.js","sourceRoot":"","sources":["../../../src/core/platform/platform-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,C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OAAO;gBACV,OAAO,OAAO,CAAC;YACjB;gBACE,OAAO,SAAS,CAAC;QACrB,CAAC;IACH,CAAC;CACF;AAED,4BAA4B;AAC5B,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileType: utility
|
|
3
|
+
* @status: current
|
|
4
|
+
* @updated: 2025-09-19
|
|
5
|
+
* @tags: [platform, detection, os, environment, cross-platform]
|
|
6
|
+
* @related: [hook-adapter.ts, path-normalizer.ts, index.ts]
|
|
7
|
+
* @priority: high
|
|
8
|
+
* @complexity: medium
|
|
9
|
+
* @dependencies: [fs-extra, os, child_process]
|
|
10
|
+
*/
|
|
11
|
+
export type Platform = 'windows' | 'macos' | 'linux';
|
|
12
|
+
export type Shell = 'bash' | 'zsh' | 'powershell' | 'cmd' | 'fish' | 'unknown';
|
|
13
|
+
export type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'unknown';
|
|
14
|
+
export interface PlatformInfo {
|
|
15
|
+
platform: Platform;
|
|
16
|
+
shell: Shell;
|
|
17
|
+
packageManager: PackageManager;
|
|
18
|
+
homeDirectory: string;
|
|
19
|
+
pathSeparator: string;
|
|
20
|
+
scriptExtension: string;
|
|
21
|
+
executableExtension: string;
|
|
22
|
+
nodeVersion?: string;
|
|
23
|
+
gitVersion?: string;
|
|
24
|
+
architecture: string;
|
|
25
|
+
environmentVars: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
export interface EnvironmentCapabilities {
|
|
28
|
+
hasGit: boolean;
|
|
29
|
+
hasNode: boolean;
|
|
30
|
+
hasNpm: boolean;
|
|
31
|
+
hasYarn: boolean;
|
|
32
|
+
hasPnpm: boolean;
|
|
33
|
+
canExecuteShell: boolean;
|
|
34
|
+
canExecuteBatch: boolean;
|
|
35
|
+
canExecutePowerShell: boolean;
|
|
36
|
+
supportedScriptTypes: string[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Detects platform, environment, and development tools
|
|
40
|
+
* Provides comprehensive information for cross-platform compatibility
|
|
41
|
+
*/
|
|
42
|
+
export declare class PlatformDetector {
|
|
43
|
+
private cachedInfo;
|
|
44
|
+
private cachedCapabilities;
|
|
45
|
+
/**
|
|
46
|
+
* Get comprehensive platform information
|
|
47
|
+
*/
|
|
48
|
+
detect(): Promise<PlatformInfo>;
|
|
49
|
+
/**
|
|
50
|
+
* Get environment capabilities
|
|
51
|
+
*/
|
|
52
|
+
getCapabilities(): Promise<EnvironmentCapabilities>;
|
|
53
|
+
/**
|
|
54
|
+
* Detect the current platform
|
|
55
|
+
*/
|
|
56
|
+
private detectPlatform;
|
|
57
|
+
/**
|
|
58
|
+
* Detect the current shell
|
|
59
|
+
*/
|
|
60
|
+
private detectShell;
|
|
61
|
+
/**
|
|
62
|
+
* Detect the preferred package manager
|
|
63
|
+
*/
|
|
64
|
+
private detectPackageManager;
|
|
65
|
+
/**
|
|
66
|
+
* Get the appropriate script extension for the platform and shell
|
|
67
|
+
*/
|
|
68
|
+
private getScriptExtension;
|
|
69
|
+
/**
|
|
70
|
+
* Get Node.js version
|
|
71
|
+
*/
|
|
72
|
+
private getNodeVersion;
|
|
73
|
+
/**
|
|
74
|
+
* Get Git version
|
|
75
|
+
*/
|
|
76
|
+
private getGitVersion;
|
|
77
|
+
/**
|
|
78
|
+
* Get relevant environment variables
|
|
79
|
+
*/
|
|
80
|
+
private getRelevantEnvVars;
|
|
81
|
+
/**
|
|
82
|
+
* Check if a command is available
|
|
83
|
+
*/
|
|
84
|
+
private checkCommand;
|
|
85
|
+
/**
|
|
86
|
+
* Check if we can execute a specific script type
|
|
87
|
+
*/
|
|
88
|
+
private canExecuteType;
|
|
89
|
+
/**
|
|
90
|
+
* Get all supported script types for this environment
|
|
91
|
+
*/
|
|
92
|
+
private getSupportedScriptTypes;
|
|
93
|
+
/**
|
|
94
|
+
* Check if current platform is Windows
|
|
95
|
+
*/
|
|
96
|
+
isWindows(): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Check if current platform is macOS
|
|
99
|
+
*/
|
|
100
|
+
isMacOS(): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Check if current platform is Linux
|
|
103
|
+
*/
|
|
104
|
+
isLinux(): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Check if current platform is Unix-like (macOS or Linux)
|
|
107
|
+
*/
|
|
108
|
+
isUnixLike(): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Get the appropriate Claude hooks directory for this platform
|
|
111
|
+
*/
|
|
112
|
+
getClaudeHooksDirectory(): string;
|
|
113
|
+
/**
|
|
114
|
+
* Get the appropriate ginko directory for this platform
|
|
115
|
+
*/
|
|
116
|
+
getGinkoDirectory(): string;
|
|
117
|
+
/**
|
|
118
|
+
* Clear cached information (useful for testing)
|
|
119
|
+
*/
|
|
120
|
+
clearCache(): void;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=platform-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-detector.d.ts","sourceRoot":"","sources":["../../../src/core/platform/platform-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AACrD,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;AAC/E,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAEjE,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,EAAE,cAAc,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CA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M;IAK3B;;OAEG;IACH,UAAU,IAAI,IAAI;CAInB"}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileType: utility
|
|
3
|
+
* @status: current
|
|
4
|
+
* @updated: 2025-09-19
|
|
5
|
+
* @tags: [platform, detection, os, environment, cross-platform]
|
|
6
|
+
* @related: [hook-adapter.ts, path-normalizer.ts, index.ts]
|
|
7
|
+
* @priority: high
|
|
8
|
+
* @complexity: medium
|
|
9
|
+
* @dependencies: [fs-extra, os, child_process]
|
|
10
|
+
*/
|
|
11
|
+
import * as os from 'os';
|
|
12
|
+
import * as fs from 'fs-extra';
|
|
13
|
+
import { execSync } from 'child_process';
|
|
14
|
+
import * as path from 'path';
|
|
15
|
+
/**
|
|
16
|
+
* Detects platform, environment, and development tools
|
|
17
|
+
* Provides comprehensive information for cross-platform compatibility
|
|
18
|
+
*/
|
|
19
|
+
export class PlatformDetector {
|
|
20
|
+
cachedInfo = null;
|
|
21
|
+
cachedCapabilities = null;
|
|
22
|
+
/**
|
|
23
|
+
* Get comprehensive platform information
|
|
24
|
+
*/
|
|
25
|
+
async detect() {
|
|
26
|
+
if (this.cachedInfo) {
|
|
27
|
+
return this.cachedInfo;
|
|
28
|
+
}
|
|
29
|
+
const platform = this.detectPlatform();
|
|
30
|
+
const shell = await this.detectShell();
|
|
31
|
+
const packageManager = await this.detectPackageManager();
|
|
32
|
+
const homeDirectory = os.homedir();
|
|
33
|
+
const architecture = os.arch();
|
|
34
|
+
const info = {
|
|
35
|
+
platform,
|
|
36
|
+
shell,
|
|
37
|
+
packageManager,
|
|
38
|
+
homeDirectory,
|
|
39
|
+
pathSeparator: platform === 'windows' ? '\\' : '/',
|
|
40
|
+
scriptExtension: this.getScriptExtension(platform, shell),
|
|
41
|
+
executableExtension: platform === 'windows' ? '.exe' : '',
|
|
42
|
+
nodeVersion: await this.getNodeVersion(),
|
|
43
|
+
gitVersion: await this.getGitVersion(),
|
|
44
|
+
architecture,
|
|
45
|
+
environmentVars: this.getRelevantEnvVars()
|
|
46
|
+
};
|
|
47
|
+
this.cachedInfo = info;
|
|
48
|
+
return info;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get environment capabilities
|
|
52
|
+
*/
|
|
53
|
+
async getCapabilities() {
|
|
54
|
+
if (this.cachedCapabilities) {
|
|
55
|
+
return this.cachedCapabilities;
|
|
56
|
+
}
|
|
57
|
+
const capabilities = {
|
|
58
|
+
hasGit: await this.checkCommand('git'),
|
|
59
|
+
hasNode: await this.checkCommand('node'),
|
|
60
|
+
hasNpm: await this.checkCommand('npm'),
|
|
61
|
+
hasYarn: await this.checkCommand('yarn'),
|
|
62
|
+
hasPnpm: await this.checkCommand('pnpm'),
|
|
63
|
+
canExecuteShell: await this.canExecuteType('shell'),
|
|
64
|
+
canExecuteBatch: await this.canExecuteType('batch'),
|
|
65
|
+
canExecutePowerShell: await this.canExecuteType('powershell'),
|
|
66
|
+
supportedScriptTypes: await this.getSupportedScriptTypes()
|
|
67
|
+
};
|
|
68
|
+
this.cachedCapabilities = capabilities;
|
|
69
|
+
return capabilities;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Detect the current platform
|
|
73
|
+
*/
|
|
74
|
+
detectPlatform() {
|
|
75
|
+
const platform = os.platform();
|
|
76
|
+
switch (platform) {
|
|
77
|
+
case 'win32':
|
|
78
|
+
return 'windows';
|
|
79
|
+
case 'darwin':
|
|
80
|
+
return 'macos';
|
|
81
|
+
case 'linux':
|
|
82
|
+
return 'linux';
|
|
83
|
+
default:
|
|
84
|
+
// Default to linux for other Unix-like systems
|
|
85
|
+
return 'linux';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Detect the current shell
|
|
90
|
+
*/
|
|
91
|
+
async detectShell() {
|
|
92
|
+
try {
|
|
93
|
+
// Check environment variables first
|
|
94
|
+
const shell = process.env.SHELL || process.env.ComSpec || '';
|
|
95
|
+
if (shell.includes('bash'))
|
|
96
|
+
return 'bash';
|
|
97
|
+
if (shell.includes('zsh'))
|
|
98
|
+
return 'zsh';
|
|
99
|
+
if (shell.includes('powershell') || shell.includes('pwsh'))
|
|
100
|
+
return 'powershell';
|
|
101
|
+
if (shell.includes('cmd'))
|
|
102
|
+
return 'cmd';
|
|
103
|
+
if (shell.includes('fish'))
|
|
104
|
+
return 'fish';
|
|
105
|
+
// Try to detect by checking what's available
|
|
106
|
+
const platform = this.detectPlatform();
|
|
107
|
+
if (platform === 'windows') {
|
|
108
|
+
// Check for PowerShell first, then cmd
|
|
109
|
+
if (await this.checkCommand('powershell'))
|
|
110
|
+
return 'powershell';
|
|
111
|
+
if (await this.checkCommand('pwsh'))
|
|
112
|
+
return 'powershell';
|
|
113
|
+
return 'cmd';
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
// Unix-like systems
|
|
117
|
+
if (await this.checkCommand('zsh'))
|
|
118
|
+
return 'zsh';
|
|
119
|
+
if (await this.checkCommand('bash'))
|
|
120
|
+
return 'bash';
|
|
121
|
+
if (await this.checkCommand('fish'))
|
|
122
|
+
return 'fish';
|
|
123
|
+
return 'bash'; // Default fallback
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
return 'unknown';
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Detect the preferred package manager
|
|
132
|
+
*/
|
|
133
|
+
async detectPackageManager() {
|
|
134
|
+
try {
|
|
135
|
+
// Check for lock files first (most reliable)
|
|
136
|
+
const cwd = process.cwd();
|
|
137
|
+
if (await fs.pathExists(path.join(cwd, 'pnpm-lock.yaml'))) {
|
|
138
|
+
return 'pnpm';
|
|
139
|
+
}
|
|
140
|
+
if (await fs.pathExists(path.join(cwd, 'yarn.lock'))) {
|
|
141
|
+
return 'yarn';
|
|
142
|
+
}
|
|
143
|
+
if (await fs.pathExists(path.join(cwd, 'package-lock.json'))) {
|
|
144
|
+
return 'npm';
|
|
145
|
+
}
|
|
146
|
+
// Check for globally available package managers
|
|
147
|
+
if (await this.checkCommand('pnpm'))
|
|
148
|
+
return 'pnpm';
|
|
149
|
+
if (await this.checkCommand('yarn'))
|
|
150
|
+
return 'yarn';
|
|
151
|
+
if (await this.checkCommand('npm'))
|
|
152
|
+
return 'npm';
|
|
153
|
+
return 'unknown';
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
return 'unknown';
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get the appropriate script extension for the platform and shell
|
|
161
|
+
*/
|
|
162
|
+
getScriptExtension(platform, shell) {
|
|
163
|
+
if (platform === 'windows') {
|
|
164
|
+
return shell === 'powershell' ? '.ps1' : '.bat';
|
|
165
|
+
}
|
|
166
|
+
return '.sh';
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get Node.js version
|
|
170
|
+
*/
|
|
171
|
+
async getNodeVersion() {
|
|
172
|
+
try {
|
|
173
|
+
const version = execSync('node --version', {
|
|
174
|
+
encoding: 'utf8',
|
|
175
|
+
stdio: 'pipe',
|
|
176
|
+
timeout: 5000
|
|
177
|
+
}).trim();
|
|
178
|
+
return version;
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get Git version
|
|
186
|
+
*/
|
|
187
|
+
async getGitVersion() {
|
|
188
|
+
try {
|
|
189
|
+
const version = execSync('git --version', {
|
|
190
|
+
encoding: 'utf8',
|
|
191
|
+
stdio: 'pipe',
|
|
192
|
+
timeout: 5000
|
|
193
|
+
}).trim();
|
|
194
|
+
return version;
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Get relevant environment variables
|
|
202
|
+
*/
|
|
203
|
+
getRelevantEnvVars() {
|
|
204
|
+
const relevantVars = [
|
|
205
|
+
'PATH', 'HOME', 'USER', 'USERNAME', 'USERPROFILE',
|
|
206
|
+
'SHELL', 'ComSpec', 'NODE_ENV', 'npm_config_prefix',
|
|
207
|
+
'CLAUDE_CONFIG_PATH', 'CLAUDE_HOOKS_PATH'
|
|
208
|
+
];
|
|
209
|
+
const envVars = {};
|
|
210
|
+
for (const varName of relevantVars) {
|
|
211
|
+
const value = process.env[varName];
|
|
212
|
+
if (value) {
|
|
213
|
+
envVars[varName] = value;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return envVars;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Check if a command is available
|
|
220
|
+
*/
|
|
221
|
+
async checkCommand(command) {
|
|
222
|
+
try {
|
|
223
|
+
const platform = this.detectPlatform();
|
|
224
|
+
const checkCmd = platform === 'windows'
|
|
225
|
+
? `where ${command}`
|
|
226
|
+
: `which ${command}`;
|
|
227
|
+
execSync(checkCmd, {
|
|
228
|
+
stdio: 'pipe',
|
|
229
|
+
timeout: 3000
|
|
230
|
+
});
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Check if we can execute a specific script type
|
|
239
|
+
*/
|
|
240
|
+
async canExecuteType(type) {
|
|
241
|
+
try {
|
|
242
|
+
switch (type) {
|
|
243
|
+
case 'shell':
|
|
244
|
+
return await this.checkCommand('sh') || await this.checkCommand('bash');
|
|
245
|
+
case 'batch':
|
|
246
|
+
return this.detectPlatform() === 'windows';
|
|
247
|
+
case 'powershell':
|
|
248
|
+
return await this.checkCommand('powershell') || await this.checkCommand('pwsh');
|
|
249
|
+
default:
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Get all supported script types for this environment
|
|
259
|
+
*/
|
|
260
|
+
async getSupportedScriptTypes() {
|
|
261
|
+
const types = [];
|
|
262
|
+
const capabilities = await this.getCapabilities();
|
|
263
|
+
if (capabilities.canExecuteShell)
|
|
264
|
+
types.push('.sh');
|
|
265
|
+
if (capabilities.canExecuteBatch)
|
|
266
|
+
types.push('.bat');
|
|
267
|
+
if (capabilities.canExecutePowerShell)
|
|
268
|
+
types.push('.ps1');
|
|
269
|
+
return types;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Check if current platform is Windows
|
|
273
|
+
*/
|
|
274
|
+
isWindows() {
|
|
275
|
+
return this.detectPlatform() === 'windows';
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Check if current platform is macOS
|
|
279
|
+
*/
|
|
280
|
+
isMacOS() {
|
|
281
|
+
return this.detectPlatform() === 'macos';
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Check if current platform is Linux
|
|
285
|
+
*/
|
|
286
|
+
isLinux() {
|
|
287
|
+
return this.detectPlatform() === 'linux';
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Check if current platform is Unix-like (macOS or Linux)
|
|
291
|
+
*/
|
|
292
|
+
isUnixLike() {
|
|
293
|
+
const platform = this.detectPlatform();
|
|
294
|
+
return platform === 'macos' || platform === 'linux';
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Get the appropriate Claude hooks directory for this platform
|
|
298
|
+
*/
|
|
299
|
+
getClaudeHooksDirectory() {
|
|
300
|
+
const homeDir = os.homedir();
|
|
301
|
+
return path.join(homeDir, '.claude', 'hooks');
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Get the appropriate ginko directory for this platform
|
|
305
|
+
*/
|
|
306
|
+
getGinkoDirectory() {
|
|
307
|
+
const homeDir = os.homedir();
|
|
308
|
+
return path.join(homeDir, '.ginko');
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Clear cached information (useful for testing)
|
|
312
|
+
*/
|
|
313
|
+
clearCache() {
|
|
314
|
+
this.cachedInfo = null;
|
|
315
|
+
this.cachedCapabilities = null;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
//# sourceMappingURL=platform-detector.js.map
|