@blxzer/cursor-trellis 0.1.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/CHANGELOG.md +45 -0
- package/LICENSE +235 -0
- package/README.md +9 -0
- package/bin/smart-search.js +79 -0
- package/bin/trellis.js +3 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +258 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/channel/adapters/claude.d.ts +29 -0
- package/dist/commands/channel/adapters/claude.d.ts.map +1 -0
- package/dist/commands/channel/adapters/claude.js +203 -0
- package/dist/commands/channel/adapters/claude.js.map +1 -0
- package/dist/commands/channel/adapters/codex.d.ts +85 -0
- package/dist/commands/channel/adapters/codex.d.ts.map +1 -0
- package/dist/commands/channel/adapters/codex.js +505 -0
- package/dist/commands/channel/adapters/codex.js.map +1 -0
- package/dist/commands/channel/adapters/index.d.ts +84 -0
- package/dist/commands/channel/adapters/index.d.ts.map +1 -0
- package/dist/commands/channel/adapters/index.js +115 -0
- package/dist/commands/channel/adapters/index.js.map +1 -0
- package/dist/commands/channel/adapters/types.d.ts +33 -0
- package/dist/commands/channel/adapters/types.d.ts.map +1 -0
- package/dist/commands/channel/adapters/types.js +2 -0
- package/dist/commands/channel/adapters/types.js.map +1 -0
- package/dist/commands/channel/agent-loader.d.ts +32 -0
- package/dist/commands/channel/agent-loader.d.ts.map +1 -0
- package/dist/commands/channel/agent-loader.js +154 -0
- package/dist/commands/channel/agent-loader.js.map +1 -0
- package/dist/commands/channel/context-loader.d.ts +26 -0
- package/dist/commands/channel/context-loader.d.ts.map +1 -0
- package/dist/commands/channel/context-loader.js +290 -0
- package/dist/commands/channel/context-loader.js.map +1 -0
- package/dist/commands/channel/context.d.ts +16 -0
- package/dist/commands/channel/context.d.ts.map +1 -0
- package/dist/commands/channel/context.js +83 -0
- package/dist/commands/channel/context.js.map +1 -0
- package/dist/commands/channel/create.d.ts +27 -0
- package/dist/commands/channel/create.d.ts.map +1 -0
- package/dist/commands/channel/create.js +39 -0
- package/dist/commands/channel/create.js.map +1 -0
- package/dist/commands/channel/dev-parse-trace.d.ts +14 -0
- package/dist/commands/channel/dev-parse-trace.d.ts.map +1 -0
- package/dist/commands/channel/dev-parse-trace.js +70 -0
- package/dist/commands/channel/dev-parse-trace.js.map +1 -0
- package/dist/commands/channel/guard.d.ts +150 -0
- package/dist/commands/channel/guard.d.ts.map +1 -0
- package/dist/commands/channel/guard.js +474 -0
- package/dist/commands/channel/guard.js.map +1 -0
- package/dist/commands/channel/index.d.ts +3 -0
- package/dist/commands/channel/index.d.ts.map +1 -0
- package/dist/commands/channel/index.js +531 -0
- package/dist/commands/channel/index.js.map +1 -0
- package/dist/commands/channel/interrupt.d.ts +10 -0
- package/dist/commands/channel/interrupt.d.ts.map +1 -0
- package/dist/commands/channel/interrupt.js +22 -0
- package/dist/commands/channel/interrupt.js.map +1 -0
- package/dist/commands/channel/kill.d.ts +7 -0
- package/dist/commands/channel/kill.d.ts.map +1 -0
- package/dist/commands/channel/kill.js +121 -0
- package/dist/commands/channel/kill.js.map +1 -0
- package/dist/commands/channel/list.d.ts +17 -0
- package/dist/commands/channel/list.d.ts.map +1 -0
- package/dist/commands/channel/list.js +233 -0
- package/dist/commands/channel/list.js.map +1 -0
- package/dist/commands/channel/messages.d.ts +15 -0
- package/dist/commands/channel/messages.d.ts.map +1 -0
- package/dist/commands/channel/messages.js +245 -0
- package/dist/commands/channel/messages.js.map +1 -0
- package/dist/commands/channel/rm.d.ts +27 -0
- package/dist/commands/channel/rm.d.ts.map +1 -0
- package/dist/commands/channel/rm.js +216 -0
- package/dist/commands/channel/rm.js.map +1 -0
- package/dist/commands/channel/run.d.ts +30 -0
- package/dist/commands/channel/run.d.ts.map +1 -0
- package/dist/commands/channel/run.js +130 -0
- package/dist/commands/channel/run.js.map +1 -0
- package/dist/commands/channel/send.d.ts +11 -0
- package/dist/commands/channel/send.d.ts.map +1 -0
- package/dist/commands/channel/send.js +24 -0
- package/dist/commands/channel/send.js.map +1 -0
- package/dist/commands/channel/spawn.d.ts +40 -0
- package/dist/commands/channel/spawn.d.ts.map +1 -0
- package/dist/commands/channel/spawn.js +244 -0
- package/dist/commands/channel/spawn.js.map +1 -0
- package/dist/commands/channel/store/events.d.ts +39 -0
- package/dist/commands/channel/store/events.d.ts.map +1 -0
- package/dist/commands/channel/store/events.js +87 -0
- package/dist/commands/channel/store/events.js.map +1 -0
- package/dist/commands/channel/store/filter.d.ts +3 -0
- package/dist/commands/channel/store/filter.d.ts.map +1 -0
- package/dist/commands/channel/store/filter.js +2 -0
- package/dist/commands/channel/store/filter.js.map +1 -0
- package/dist/commands/channel/store/lock.d.ts +23 -0
- package/dist/commands/channel/store/lock.d.ts.map +1 -0
- package/dist/commands/channel/store/lock.js +99 -0
- package/dist/commands/channel/store/lock.js.map +1 -0
- package/dist/commands/channel/store/paths.d.ts +63 -0
- package/dist/commands/channel/store/paths.d.ts.map +1 -0
- package/dist/commands/channel/store/paths.js +246 -0
- package/dist/commands/channel/store/paths.js.map +1 -0
- package/dist/commands/channel/store/schema.d.ts +27 -0
- package/dist/commands/channel/store/schema.d.ts.map +1 -0
- package/dist/commands/channel/store/schema.js +34 -0
- package/dist/commands/channel/store/schema.js.map +1 -0
- package/dist/commands/channel/store/thread-state.d.ts +5 -0
- package/dist/commands/channel/store/thread-state.d.ts.map +1 -0
- package/dist/commands/channel/store/thread-state.js +16 -0
- package/dist/commands/channel/store/thread-state.js.map +1 -0
- package/dist/commands/channel/store/watch.d.ts +19 -0
- package/dist/commands/channel/store/watch.d.ts.map +1 -0
- package/dist/commands/channel/store/watch.js +146 -0
- package/dist/commands/channel/store/watch.js.map +1 -0
- package/dist/commands/channel/supervisor/idle.d.ts +46 -0
- package/dist/commands/channel/supervisor/idle.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/idle.js +72 -0
- package/dist/commands/channel/supervisor/idle.js.map +1 -0
- package/dist/commands/channel/supervisor/inbox.d.ts +30 -0
- package/dist/commands/channel/supervisor/inbox.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/inbox.js +160 -0
- package/dist/commands/channel/supervisor/inbox.js.map +1 -0
- package/dist/commands/channel/supervisor/shutdown.d.ts +68 -0
- package/dist/commands/channel/supervisor/shutdown.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/shutdown.js +146 -0
- package/dist/commands/channel/supervisor/shutdown.js.map +1 -0
- package/dist/commands/channel/supervisor/stdout.d.ts +51 -0
- package/dist/commands/channel/supervisor/stdout.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/stdout.js +121 -0
- package/dist/commands/channel/supervisor/stdout.js.map +1 -0
- package/dist/commands/channel/supervisor/turns.d.ts +31 -0
- package/dist/commands/channel/supervisor/turns.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/turns.js +45 -0
- package/dist/commands/channel/supervisor/turns.js.map +1 -0
- package/dist/commands/channel/supervisor/warning.d.ts +48 -0
- package/dist/commands/channel/supervisor/warning.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/warning.js +77 -0
- package/dist/commands/channel/supervisor/warning.js.map +1 -0
- package/dist/commands/channel/supervisor.d.ts +59 -0
- package/dist/commands/channel/supervisor.d.ts.map +1 -0
- package/dist/commands/channel/supervisor.js +344 -0
- package/dist/commands/channel/supervisor.js.map +1 -0
- package/dist/commands/channel/text-body.d.ts +13 -0
- package/dist/commands/channel/text-body.d.ts.map +1 -0
- package/dist/commands/channel/text-body.js +47 -0
- package/dist/commands/channel/text-body.js.map +1 -0
- package/dist/commands/channel/threads.d.ts +39 -0
- package/dist/commands/channel/threads.d.ts.map +1 -0
- package/dist/commands/channel/threads.js +106 -0
- package/dist/commands/channel/threads.js.map +1 -0
- package/dist/commands/channel/title.d.ts +12 -0
- package/dist/commands/channel/title.d.ts.map +1 -0
- package/dist/commands/channel/title.js +24 -0
- package/dist/commands/channel/title.js.map +1 -0
- package/dist/commands/channel/wait.d.ts +17 -0
- package/dist/commands/channel/wait.d.ts.map +1 -0
- package/dist/commands/channel/wait.js +75 -0
- package/dist/commands/channel/wait.js.map +1 -0
- package/dist/commands/init.d.ts +62 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +1656 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mem.d.ts +30 -0
- package/dist/commands/mem.d.ts.map +1 -0
- package/dist/commands/mem.js +424 -0
- package/dist/commands/mem.js.map +1 -0
- package/dist/commands/rollout.d.ts +34 -0
- package/dist/commands/rollout.d.ts.map +1 -0
- package/dist/commands/rollout.js +102 -0
- package/dist/commands/rollout.js.map +1 -0
- package/dist/commands/uninstall.d.ts +27 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +339 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.d.ts +80 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +2185 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/upgrade.d.ts +28 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +84 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/commands/workflow.d.ts +35 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +219 -0
- package/dist/commands/workflow.js.map +1 -0
- package/dist/configurators/antigravity.d.ts +7 -0
- package/dist/configurators/antigravity.d.ts.map +1 -0
- package/dist/configurators/antigravity.js +19 -0
- package/dist/configurators/antigravity.js.map +1 -0
- package/dist/configurators/claude.d.ts +9 -0
- package/dist/configurators/claude.d.ts.map +1 -0
- package/dist/configurators/claude.js +72 -0
- package/dist/configurators/claude.js.map +1 -0
- package/dist/configurators/codebuddy.d.ts +10 -0
- package/dist/configurators/codebuddy.d.ts.map +1 -0
- package/dist/configurators/codebuddy.js +30 -0
- package/dist/configurators/codebuddy.js.map +1 -0
- package/dist/configurators/codex.d.ts +8 -0
- package/dist/configurators/codex.d.ts.map +1 -0
- package/dist/configurators/codex.js +87 -0
- package/dist/configurators/codex.js.map +1 -0
- package/dist/configurators/copilot.d.ts +10 -0
- package/dist/configurators/copilot.d.ts.map +1 -0
- package/dist/configurators/copilot.js +51 -0
- package/dist/configurators/copilot.js.map +1 -0
- package/dist/configurators/cursor.d.ts +20 -0
- package/dist/configurators/cursor.d.ts.map +1 -0
- package/dist/configurators/cursor.js +49 -0
- package/dist/configurators/cursor.js.map +1 -0
- package/dist/configurators/cursor2plus-local.d.ts +6 -0
- package/dist/configurators/cursor2plus-local.d.ts.map +1 -0
- package/dist/configurators/cursor2plus-local.js +20 -0
- package/dist/configurators/cursor2plus-local.js.map +1 -0
- package/dist/configurators/droid.d.ts +10 -0
- package/dist/configurators/droid.d.ts.map +1 -0
- package/dist/configurators/droid.js +30 -0
- package/dist/configurators/droid.js.map +1 -0
- package/dist/configurators/gemini.d.ts +16 -0
- package/dist/configurators/gemini.d.ts.map +1 -0
- package/dist/configurators/gemini.js +38 -0
- package/dist/configurators/gemini.js.map +1 -0
- package/dist/configurators/index.d.ts +69 -0
- package/dist/configurators/index.d.ts.map +1 -0
- package/dist/configurators/index.js +395 -0
- package/dist/configurators/index.js.map +1 -0
- package/dist/configurators/kilo.d.ts +7 -0
- package/dist/configurators/kilo.d.ts.map +1 -0
- package/dist/configurators/kilo.js +19 -0
- package/dist/configurators/kilo.js.map +1 -0
- package/dist/configurators/kiro.d.ts +8 -0
- package/dist/configurators/kiro.d.ts.map +1 -0
- package/dist/configurators/kiro.js +24 -0
- package/dist/configurators/kiro.js.map +1 -0
- package/dist/configurators/opencode.d.ts +14 -0
- package/dist/configurators/opencode.d.ts.map +1 -0
- package/dist/configurators/opencode.js +96 -0
- package/dist/configurators/opencode.js.map +1 -0
- package/dist/configurators/pi.d.ts +3 -0
- package/dist/configurators/pi.d.ts.map +1 -0
- package/dist/configurators/pi.js +45 -0
- package/dist/configurators/pi.js.map +1 -0
- package/dist/configurators/qoder.d.ts +11 -0
- package/dist/configurators/qoder.d.ts.map +1 -0
- package/dist/configurators/qoder.js +31 -0
- package/dist/configurators/qoder.js.map +1 -0
- package/dist/configurators/shared.d.ts +183 -0
- package/dist/configurators/shared.d.ts.map +1 -0
- package/dist/configurators/shared.js +557 -0
- package/dist/configurators/shared.js.map +1 -0
- package/dist/configurators/windsurf.d.ts +7 -0
- package/dist/configurators/windsurf.d.ts.map +1 -0
- package/dist/configurators/windsurf.js +19 -0
- package/dist/configurators/windsurf.js.map +1 -0
- package/dist/configurators/workflow.d.ts +46 -0
- package/dist/configurators/workflow.d.ts.map +1 -0
- package/dist/configurators/workflow.js +180 -0
- package/dist/configurators/workflow.js.map +1 -0
- package/dist/constants/paths.d.ts +70 -0
- package/dist/constants/paths.d.ts.map +1 -0
- package/dist/constants/paths.js +79 -0
- package/dist/constants/paths.js.map +1 -0
- package/dist/constants/version.d.ts +9 -0
- package/dist/constants/version.d.ts.map +1 -0
- package/dist/constants/version.js +15 -0
- package/dist/constants/version.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations/index.d.ts +62 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +187 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/manifests/0.1.0.json +9 -0
- package/dist/templates/claude/agents/trellis-check.md +124 -0
- package/dist/templates/claude/agents/trellis-implement.md +110 -0
- package/dist/templates/claude/agents/trellis-research.md +137 -0
- package/dist/templates/claude/index.d.ts +22 -0
- package/dist/templates/claude/index.d.ts.map +1 -0
- package/dist/templates/claude/index.js +46 -0
- package/dist/templates/claude/index.js.map +1 -0
- package/dist/templates/claude/settings.json +84 -0
- package/dist/templates/codebuddy/agents/trellis-check.md +115 -0
- package/dist/templates/codebuddy/agents/trellis-implement.md +110 -0
- package/dist/templates/codebuddy/agents/trellis-research.md +137 -0
- package/dist/templates/codebuddy/index.d.ts +15 -0
- package/dist/templates/codebuddy/index.d.ts.map +1 -0
- package/dist/templates/codebuddy/index.js +15 -0
- package/dist/templates/codebuddy/index.js.map +1 -0
- package/dist/templates/codebuddy/settings.json +70 -0
- package/dist/templates/codex/agents/trellis-check.toml +67 -0
- package/dist/templates/codex/agents/trellis-implement.toml +40 -0
- package/dist/templates/codex/agents/trellis-research.toml +73 -0
- package/dist/templates/codex/config.toml +28 -0
- package/dist/templates/codex/hooks/session-start.py +575 -0
- package/dist/templates/codex/hooks.json +15 -0
- package/dist/templates/codex/index.d.ts +39 -0
- package/dist/templates/codex/index.d.ts.map +1 -0
- package/dist/templates/codex/index.js +85 -0
- package/dist/templates/codex/index.js.map +1 -0
- package/dist/templates/codex/skills/before-dev/SKILL.md +40 -0
- package/dist/templates/codex/skills/brainstorm/SKILL.md +112 -0
- package/dist/templates/codex/skills/break-loop/SKILL.md +130 -0
- package/dist/templates/codex/skills/check/SKILL.md +98 -0
- package/dist/templates/codex/skills/check-cross-layer/SKILL.md +158 -0
- package/dist/templates/codex/skills/create-command/SKILL.md +101 -0
- package/dist/templates/codex/skills/finish-work/SKILL.md +90 -0
- package/dist/templates/codex/skills/improve-ut/SKILL.md +69 -0
- package/dist/templates/codex/skills/integrate-skill/SKILL.md +221 -0
- package/dist/templates/codex/skills/onboard/SKILL.md +363 -0
- package/dist/templates/codex/skills/record-session/SKILL.md +67 -0
- package/dist/templates/codex/skills/start/SKILL.md +66 -0
- package/dist/templates/codex/skills/update-spec/SKILL.md +335 -0
- package/dist/templates/common/bundled-skills/smart-search-cli/SKILL.md +388 -0
- package/dist/templates/common/bundled-skills/smart-search-cli/agents/openai.yaml +3 -0
- package/dist/templates/common/bundled-skills/smart-search-cli/examples/batch-search.md +98 -0
- package/dist/templates/common/bundled-skills/smart-search-cli/examples/evidence-gathering.md +89 -0
- package/dist/templates/common/bundled-skills/smart-search-cli/references/cli-contract.md +337 -0
- package/dist/templates/common/bundled-skills/trellis-cursor2plus-setup/SKILL.md +62 -0
- package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +73 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/add-project-local-conventions.md +83 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-agents.md +54 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-context-loading.md +84 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-hooks.md +57 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-skills-or-commands.md +80 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-spec-structure.md +83 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-task-lifecycle.md +88 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-workflow.md +65 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/overview.md +55 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/context-injection.md +68 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/generated-files.md +80 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/overview.md +51 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/spec-system.md +102 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +133 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workflow.md +75 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workspace-memory.md +71 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +80 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +69 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/overview.md +61 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md +76 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/skills-and-commands.md +128 -0
- package/dist/templates/common/bundled-skills/trellis-micro-grill/SKILL.md +47 -0
- package/dist/templates/common/bundled-skills/trellis-skill-creator/SKILL.md +44 -0
- package/dist/templates/common/bundled-skills/trellis-skill-creator/references/authoring-rules.md +97 -0
- package/dist/templates/common/bundled-skills/trellis-skill-creator/references/review-checklist.md +47 -0
- package/dist/templates/common/bundled-skills/trellis-skill-creator/references/trellis-skill-locations.md +52 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/SKILL.md +41 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/mcp-setup.md +90 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/repository-analysis.md +59 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/spec-task-planning.md +61 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/spec-writing.md +70 -0
- package/dist/templates/common/commands/continue.md +63 -0
- package/dist/templates/common/commands/finish-work.md +68 -0
- package/dist/templates/common/commands/start.md +69 -0
- package/dist/templates/common/index.d.ts +48 -0
- package/dist/templates/common/index.d.ts.map +1 -0
- package/dist/templates/common/index.js +104 -0
- package/dist/templates/common/index.js.map +1 -0
- package/dist/templates/common/skills/before-dev.md +35 -0
- package/dist/templates/common/skills/brainstorm.md +164 -0
- package/dist/templates/common/skills/break-loop.md +125 -0
- package/dist/templates/common/skills/check.md +106 -0
- package/dist/templates/common/skills/update-spec.md +364 -0
- package/dist/templates/copilot/hooks/session-start.py +557 -0
- package/dist/templates/copilot/hooks.json +19 -0
- package/dist/templates/copilot/index.d.ts +23 -0
- package/dist/templates/copilot/index.d.ts.map +1 -0
- package/dist/templates/copilot/index.js +54 -0
- package/dist/templates/copilot/index.js.map +1 -0
- package/dist/templates/copilot/prompts/before-dev.prompt.md +39 -0
- package/dist/templates/copilot/prompts/brainstorm.prompt.md +111 -0
- package/dist/templates/copilot/prompts/break-loop.prompt.md +129 -0
- package/dist/templates/copilot/prompts/check-cross-layer.prompt.md +157 -0
- package/dist/templates/copilot/prompts/check.prompt.md +97 -0
- package/dist/templates/copilot/prompts/create-command.prompt.md +116 -0
- package/dist/templates/copilot/prompts/finish-work.prompt.md +99 -0
- package/dist/templates/copilot/prompts/integrate-skill.prompt.md +223 -0
- package/dist/templates/copilot/prompts/onboard.prompt.md +362 -0
- package/dist/templates/copilot/prompts/parallel.prompt.md +204 -0
- package/dist/templates/copilot/prompts/record-session.prompt.md +66 -0
- package/dist/templates/copilot/prompts/start.prompt.md +63 -0
- package/dist/templates/copilot/prompts/update-spec.prompt.md +358 -0
- package/dist/templates/cursor/agents/trellis-check.md +139 -0
- package/dist/templates/cursor/agents/trellis-implement.md +119 -0
- package/dist/templates/cursor/agents/trellis-research.md +147 -0
- package/dist/templates/cursor/commands/cursor2plus-setup.md +82 -0
- package/dist/templates/cursor/hooks.json +30 -0
- package/dist/templates/cursor/index.d.ts +19 -0
- package/dist/templates/cursor/index.d.ts.map +1 -0
- package/dist/templates/cursor/index.js +19 -0
- package/dist/templates/cursor/index.js.map +1 -0
- package/dist/templates/cursor/rules/trellis-triage.mdc +38 -0
- package/dist/templates/cursor/worktrees.json +11 -0
- package/dist/templates/droid/droids/trellis-check.md +107 -0
- package/dist/templates/droid/droids/trellis-implement.md +102 -0
- package/dist/templates/droid/droids/trellis-research.md +137 -0
- package/dist/templates/droid/index.d.ts +15 -0
- package/dist/templates/droid/index.d.ts.map +1 -0
- package/dist/templates/droid/index.js +15 -0
- package/dist/templates/droid/index.js.map +1 -0
- package/dist/templates/droid/settings.json +70 -0
- package/dist/templates/extract.d.ts +40 -0
- package/dist/templates/extract.d.ts.map +1 -0
- package/dist/templates/extract.js +106 -0
- package/dist/templates/extract.js.map +1 -0
- package/dist/templates/gemini/agents/trellis-check.md +107 -0
- package/dist/templates/gemini/agents/trellis-implement.md +102 -0
- package/dist/templates/gemini/agents/trellis-research.md +136 -0
- package/dist/templates/gemini/index.d.ts +13 -0
- package/dist/templates/gemini/index.d.ts.map +1 -0
- package/dist/templates/gemini/index.js +13 -0
- package/dist/templates/gemini/index.js.map +1 -0
- package/dist/templates/gemini/settings.json +28 -0
- package/dist/templates/kiro/agents/trellis-check.json +26 -0
- package/dist/templates/kiro/agents/trellis-implement.json +26 -0
- package/dist/templates/kiro/agents/trellis-research.json +30 -0
- package/dist/templates/kiro/index.d.ts +18 -0
- package/dist/templates/kiro/index.d.ts.map +1 -0
- package/dist/templates/kiro/index.js +18 -0
- package/dist/templates/kiro/index.js.map +1 -0
- package/dist/templates/markdown/agents.md +32 -0
- package/dist/templates/markdown/gitignore.txt +15 -0
- package/dist/templates/markdown/index.d.ts +30 -0
- package/dist/templates/markdown/index.d.ts.map +1 -0
- package/dist/templates/markdown/index.js +55 -0
- package/dist/templates/markdown/index.js.map +1 -0
- package/dist/templates/markdown/spec/backend/database-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/backend/directory-structure.md.txt +54 -0
- package/dist/templates/markdown/spec/backend/error-handling.md.txt +51 -0
- package/dist/templates/markdown/spec/backend/index.md.txt +38 -0
- package/dist/templates/markdown/spec/backend/logging-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/backend/quality-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/component-guidelines.md.txt +59 -0
- package/dist/templates/markdown/spec/frontend/directory-structure.md.txt +54 -0
- package/dist/templates/markdown/spec/frontend/hook-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/index.md.txt +39 -0
- package/dist/templates/markdown/spec/frontend/quality-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/state-management.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/type-safety.md.txt +51 -0
- package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +223 -0
- package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +259 -0
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +633 -0
- package/dist/templates/markdown/spec/guides/cursor-context-injection-guide.md.txt +65 -0
- package/dist/templates/markdown/spec/guides/cursor-subagent-policy.md.txt +382 -0
- package/dist/templates/markdown/spec/guides/durable-learning-decision-guide.md.txt +76 -0
- package/dist/templates/markdown/spec/guides/index.md.txt +101 -0
- package/dist/templates/markdown/spec/guides/retrieval-daily-guide.md.txt +92 -0
- package/dist/templates/markdown/workspace-index.md +125 -0
- package/dist/templates/markdown/worktree.yaml.txt +58 -0
- package/dist/templates/opencode/agents/trellis-check.md +122 -0
- package/dist/templates/opencode/agents/trellis-implement.md +118 -0
- package/dist/templates/opencode/agents/trellis-research.md +145 -0
- package/dist/templates/opencode/lib/session-utils.js +667 -0
- package/dist/templates/opencode/lib/trellis-context.js +336 -0
- package/dist/templates/opencode/package.json +5 -0
- package/dist/templates/opencode/plugins/inject-subagent-context.js +495 -0
- package/dist/templates/opencode/plugins/inject-workflow-state.js +159 -0
- package/dist/templates/opencode/plugins/session-start.js +101 -0
- package/dist/templates/pi/agents/trellis-check.md +37 -0
- package/dist/templates/pi/agents/trellis-implement.md +42 -0
- package/dist/templates/pi/agents/trellis-research.md +25 -0
- package/dist/templates/pi/extensions/trellis/index.ts.txt +1600 -0
- package/dist/templates/pi/index.d.ts +5 -0
- package/dist/templates/pi/index.d.ts.map +1 -0
- package/dist/templates/pi/index.js +12 -0
- package/dist/templates/pi/index.js.map +1 -0
- package/dist/templates/pi/settings.json +12 -0
- package/dist/templates/qoder/agents/trellis-check.md +108 -0
- package/dist/templates/qoder/agents/trellis-implement.md +103 -0
- package/dist/templates/qoder/agents/trellis-research.md +137 -0
- package/dist/templates/qoder/index.d.ts +15 -0
- package/dist/templates/qoder/index.d.ts.map +1 -0
- package/dist/templates/qoder/index.js +15 -0
- package/dist/templates/qoder/index.js.map +1 -0
- package/dist/templates/qoder/settings.json +47 -0
- package/dist/templates/shared-hooks/index.d.ts +50 -0
- package/dist/templates/shared-hooks/index.d.ts.map +1 -0
- package/dist/templates/shared-hooks/index.js +92 -0
- package/dist/templates/shared-hooks/index.js.map +1 -0
- package/dist/templates/shared-hooks/inject-shell-session-context.py +183 -0
- package/dist/templates/shared-hooks/inject-subagent-context.py +774 -0
- package/dist/templates/shared-hooks/inject-workflow-state.py +366 -0
- package/dist/templates/shared-hooks/research-end-retrieval-pack.py +220 -0
- package/dist/templates/shared-hooks/session-start.py +873 -0
- package/dist/templates/template-utils.d.ts +28 -0
- package/dist/templates/template-utils.d.ts.map +1 -0
- package/dist/templates/template-utils.js +83 -0
- package/dist/templates/template-utils.js.map +1 -0
- package/dist/templates/trellis/config.yaml +132 -0
- package/dist/templates/trellis/gitignore.txt +39 -0
- package/dist/templates/trellis/index.d.ts +80 -0
- package/dist/templates/trellis/index.d.ts.map +1 -0
- package/dist/templates/trellis/index.js +171 -0
- package/dist/templates/trellis/index.js.map +1 -0
- package/dist/templates/trellis/local/README.md +59 -0
- package/dist/templates/trellis/local/config.local.json.example +6 -0
- package/dist/templates/trellis/local/index.d.ts +7 -0
- package/dist/templates/trellis/local/index.d.ts.map +1 -0
- package/dist/templates/trellis/local/index.js +14 -0
- package/dist/templates/trellis/local/index.js.map +1 -0
- package/dist/templates/trellis/local/patch_wpelc8.py +297 -0
- package/dist/templates/trellis/local/subagent-models.json.example +4 -0
- package/dist/templates/trellis/local/trellis-task-models.json.example +10 -0
- package/dist/templates/trellis/local/trellis-task-models.json5.example +45 -0
- package/dist/templates/trellis/local/trellis_task_models_config.py +200 -0
- package/dist/templates/trellis/scripts/__init__.py +5 -0
- package/dist/templates/trellis/scripts/add_session.py +547 -0
- package/dist/templates/trellis/scripts/build_context_pack.py +12 -0
- package/dist/templates/trellis/scripts/build_retrieval_pack.py +12 -0
- package/dist/templates/trellis/scripts/common/__init__.py +103 -0
- package/dist/templates/trellis/scripts/common/active_task.py +607 -0
- package/dist/templates/trellis/scripts/common/artifact_search.py +587 -0
- package/dist/templates/trellis/scripts/common/cli_adapter.py +811 -0
- package/dist/templates/trellis/scripts/common/cli_environment.py +155 -0
- package/dist/templates/trellis/scripts/common/codebase_retrieval_router.py +902 -0
- package/dist/templates/trellis/scripts/common/config.py +458 -0
- package/dist/templates/trellis/scripts/common/context_pack.py +371 -0
- package/dist/templates/trellis/scripts/common/developer.py +190 -0
- package/dist/templates/trellis/scripts/common/git.py +31 -0
- package/dist/templates/trellis/scripts/common/git_context.py +149 -0
- package/dist/templates/trellis/scripts/common/io.py +37 -0
- package/dist/templates/trellis/scripts/common/log.py +45 -0
- package/dist/templates/trellis/scripts/common/packages_context.py +239 -0
- package/dist/templates/trellis/scripts/common/parent_orchestration.py +691 -0
- package/dist/templates/trellis/scripts/common/paths.py +457 -0
- package/dist/templates/trellis/scripts/common/retrieval_adapter_metadata.py +889 -0
- package/dist/templates/trellis/scripts/common/retrieval_evidence.py +917 -0
- package/dist/templates/trellis/scripts/common/retrieval_pack.py +425 -0
- package/dist/templates/trellis/scripts/common/retrieval_pack_context.py +126 -0
- package/dist/templates/trellis/scripts/common/safe_commit.py +285 -0
- package/dist/templates/trellis/scripts/common/session_context.py +1159 -0
- package/dist/templates/trellis/scripts/common/session_memory.py +360 -0
- package/dist/templates/trellis/scripts/common/smart_search_evidence.py +479 -0
- package/dist/templates/trellis/scripts/common/smart_search_resolve.py +125 -0
- package/dist/templates/trellis/scripts/common/task_context.py +223 -0
- package/dist/templates/trellis/scripts/common/task_dashboard.py +140 -0
- package/dist/templates/trellis/scripts/common/task_gates.py +1735 -0
- package/dist/templates/trellis/scripts/common/task_map.py +586 -0
- package/dist/templates/trellis/scripts/common/task_queue.py +188 -0
- package/dist/templates/trellis/scripts/common/task_store.py +1533 -0
- package/dist/templates/trellis/scripts/common/task_utils.py +274 -0
- package/dist/templates/trellis/scripts/common/tasks.py +231 -0
- package/dist/templates/trellis/scripts/common/test_retrieval_arbitration.py +333 -0
- package/dist/templates/trellis/scripts/common/trellis_config.py +131 -0
- package/dist/templates/trellis/scripts/common/types.py +110 -0
- package/dist/templates/trellis/scripts/common/workflow_phase.py +212 -0
- package/dist/templates/trellis/scripts/get_context.py +17 -0
- package/dist/templates/trellis/scripts/get_developer.py +26 -0
- package/dist/templates/trellis/scripts/hooks/linear_sync.py +243 -0
- package/dist/templates/trellis/scripts/init_developer.py +51 -0
- package/dist/templates/trellis/scripts/route_codebase_retrieval.py +77 -0
- package/dist/templates/trellis/scripts/run_smart_search.py +12 -0
- package/dist/templates/trellis/scripts/search_artifacts.py +13 -0
- package/dist/templates/trellis/scripts/search_memory.py +12 -0
- package/dist/templates/trellis/scripts/task.py +851 -0
- package/dist/templates/trellis/tasks/.gitkeep +0 -0
- package/dist/templates/trellis/tasks/templates/release-execution/design.md +61 -0
- package/dist/templates/trellis/tasks/templates/release-execution/handoff-template.md +29 -0
- package/dist/templates/trellis/tasks/templates/release-execution/implement.md +29 -0
- package/dist/templates/trellis/tasks/templates/release-execution/prd.md +31 -0
- package/dist/templates/trellis/tasks/templates/release-readiness/design.md +50 -0
- package/dist/templates/trellis/tasks/templates/release-readiness/handoff-template.md +39 -0
- package/dist/templates/trellis/tasks/templates/release-readiness/implement.md +29 -0
- package/dist/templates/trellis/tasks/templates/release-readiness/prd.md +31 -0
- package/dist/templates/trellis/workflow.md +960 -0
- package/dist/types/ai-tools.d.ts +106 -0
- package/dist/types/ai-tools.d.ts.map +1 -0
- package/dist/types/ai-tools.js +294 -0
- package/dist/types/ai-tools.js.map +1 -0
- package/dist/types/migration.d.ts +125 -0
- package/dist/types/migration.d.ts.map +1 -0
- package/dist/types/migration.js +8 -0
- package/dist/types/migration.js.map +1 -0
- package/dist/utils/codebase-retrieval-router.d.ts +77 -0
- package/dist/utils/codebase-retrieval-router.d.ts.map +1 -0
- package/dist/utils/codebase-retrieval-router.js +767 -0
- package/dist/utils/codebase-retrieval-router.js.map +1 -0
- package/dist/utils/compare-versions.d.ts +12 -0
- package/dist/utils/compare-versions.d.ts.map +1 -0
- package/dist/utils/compare-versions.js +86 -0
- package/dist/utils/compare-versions.js.map +1 -0
- package/dist/utils/cwd-guard.d.ts +38 -0
- package/dist/utils/cwd-guard.d.ts.map +1 -0
- package/dist/utils/cwd-guard.js +62 -0
- package/dist/utils/cwd-guard.js.map +1 -0
- package/dist/utils/file-writer.d.ts +36 -0
- package/dist/utils/file-writer.d.ts.map +1 -0
- package/dist/utils/file-writer.js +203 -0
- package/dist/utils/file-writer.js.map +1 -0
- package/dist/utils/manifest-prune.d.ts +61 -0
- package/dist/utils/manifest-prune.d.ts.map +1 -0
- package/dist/utils/manifest-prune.js +136 -0
- package/dist/utils/manifest-prune.js.map +1 -0
- package/dist/utils/posix.d.ts +13 -0
- package/dist/utils/posix.d.ts.map +1 -0
- package/dist/utils/posix.js +15 -0
- package/dist/utils/posix.js.map +1 -0
- package/dist/utils/post-update-smoke.d.ts +7 -0
- package/dist/utils/post-update-smoke.d.ts.map +1 -0
- package/dist/utils/post-update-smoke.js +40 -0
- package/dist/utils/post-update-smoke.js.map +1 -0
- package/dist/utils/project-capabilities.d.ts +54 -0
- package/dist/utils/project-capabilities.d.ts.map +1 -0
- package/dist/utils/project-capabilities.js +515 -0
- package/dist/utils/project-capabilities.js.map +1 -0
- package/dist/utils/project-detector.d.ts +46 -0
- package/dist/utils/project-detector.d.ts.map +1 -0
- package/dist/utils/project-detector.js +666 -0
- package/dist/utils/project-detector.js.map +1 -0
- package/dist/utils/proxy.d.ts +25 -0
- package/dist/utils/proxy.d.ts.map +1 -0
- package/dist/utils/proxy.js +60 -0
- package/dist/utils/proxy.js.map +1 -0
- package/dist/utils/readiness.d.ts +20 -0
- package/dist/utils/readiness.d.ts.map +1 -0
- package/dist/utils/readiness.js +430 -0
- package/dist/utils/readiness.js.map +1 -0
- package/dist/utils/retrieval-execution-telemetry.d.ts +162 -0
- package/dist/utils/retrieval-execution-telemetry.d.ts.map +1 -0
- package/dist/utils/retrieval-execution-telemetry.js +288 -0
- package/dist/utils/retrieval-execution-telemetry.js.map +1 -0
- package/dist/utils/retrieval-result-ranking.d.ts +40 -0
- package/dist/utils/retrieval-result-ranking.d.ts.map +1 -0
- package/dist/utils/retrieval-result-ranking.js +162 -0
- package/dist/utils/retrieval-result-ranking.js.map +1 -0
- package/dist/utils/task-json.d.ts +13 -0
- package/dist/utils/task-json.d.ts.map +1 -0
- package/dist/utils/task-json.js +12 -0
- package/dist/utils/task-json.js.map +1 -0
- package/dist/utils/template-fetcher.d.ts +150 -0
- package/dist/utils/template-fetcher.d.ts.map +1 -0
- package/dist/utils/template-fetcher.js +907 -0
- package/dist/utils/template-fetcher.js.map +1 -0
- package/dist/utils/template-hash.d.ts +123 -0
- package/dist/utils/template-hash.d.ts.map +1 -0
- package/dist/utils/template-hash.js +334 -0
- package/dist/utils/template-hash.js.map +1 -0
- package/dist/utils/uninstall-scrubbers.d.ts +66 -0
- package/dist/utils/uninstall-scrubbers.d.ts.map +1 -0
- package/dist/utils/uninstall-scrubbers.js +342 -0
- package/dist/utils/uninstall-scrubbers.js.map +1 -0
- package/dist/utils/update-rollout-report.d.ts +137 -0
- package/dist/utils/update-rollout-report.d.ts.map +1 -0
- package/dist/utils/update-rollout-report.js +108 -0
- package/dist/utils/update-rollout-report.js.map +1 -0
- package/dist/utils/workflow-resolver.d.ts +86 -0
- package/dist/utils/workflow-resolver.d.ts.map +1 -0
- package/dist/utils/workflow-resolver.js +265 -0
- package/dist/utils/workflow-resolver.js.map +1 -0
- package/package.json +137 -0
- package/scripts/postinstall.js +45 -0
- package/vendor/smart-search/LICENSE +21 -0
- package/vendor/smart-search/README.md +412 -0
- package/vendor/smart-search/README.zh-CN.md +430 -0
- package/vendor/smart-search/npm/bin/smart-search.js +63 -0
- package/vendor/smart-search/npm/scripts/postinstall.js +87 -0
- package/vendor/smart-search/npm/scripts/resolve-prerelease-version.js +108 -0
- package/vendor/smart-search/npm/scripts/set-package-version.js +35 -0
- package/vendor/smart-search/npm/scripts/sync-python-version.js +22 -0
- package/vendor/smart-search/npm/scripts/test-wrapper-repair.js +99 -0
- package/vendor/smart-search/npm/scripts/test.js +85 -0
- package/vendor/smart-search/package.json +42 -0
- package/vendor/smart-search/pyproject.toml +37 -0
- package/vendor/smart-search/skills/smart-search-cli/SKILL.md +387 -0
- package/vendor/smart-search/skills/smart-search-cli/agents/openai.yaml +3 -0
- package/vendor/smart-search/skills/smart-search-cli/examples/batch-search.md +98 -0
- package/vendor/smart-search/skills/smart-search-cli/examples/evidence-gathering.md +89 -0
- package/vendor/smart-search/skills/smart-search-cli/references/cli-contract.md +337 -0
- package/vendor/smart-search/src/smart_search/__init__.py +1 -0
- package/vendor/smart-search/src/smart_search/assets/skills/smart-search-cli/SKILL.md +387 -0
- package/vendor/smart-search/src/smart_search/assets/skills/smart-search-cli/agents/openai.yaml +3 -0
- package/vendor/smart-search/src/smart_search/assets/skills/smart-search-cli/examples/batch-search.md +98 -0
- package/vendor/smart-search/src/smart_search/assets/skills/smart-search-cli/examples/evidence-gathering.md +89 -0
- package/vendor/smart-search/src/smart_search/assets/skills/smart-search-cli/references/cli-contract.md +337 -0
- package/vendor/smart-search/src/smart_search/cli.py +2003 -0
- package/vendor/smart-search/src/smart_search/config.py +580 -0
- package/vendor/smart-search/src/smart_search/logger.py +43 -0
- package/vendor/smart-search/src/smart_search/providers/__init__.py +16 -0
- package/vendor/smart-search/src/smart_search/providers/base.py +41 -0
- package/vendor/smart-search/src/smart_search/providers/context7.py +141 -0
- package/vendor/smart-search/src/smart_search/providers/exa.py +206 -0
- package/vendor/smart-search/src/smart_search/providers/jina.py +136 -0
- package/vendor/smart-search/src/smart_search/providers/openai_compatible.py +370 -0
- package/vendor/smart-search/src/smart_search/providers/zhipu.py +143 -0
- package/vendor/smart-search/src/smart_search/service.py +2865 -0
- package/vendor/smart-search/src/smart_search/sources.py +429 -0
- package/vendor/smart-search/src/smart_search/utils.py +220 -0
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Capture Smart Search evidence into Trellis task artifacts.
|
|
4
|
+
|
|
5
|
+
This module shells out to the local `smart-search` CLI and writes a compact
|
|
6
|
+
manifest that downstream Trellis context/ranking code can consume. It stays
|
|
7
|
+
dependency-free because it is generated into user projects.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import argparse
|
|
13
|
+
import json
|
|
14
|
+
import os
|
|
15
|
+
import re
|
|
16
|
+
import subprocess
|
|
17
|
+
import sys
|
|
18
|
+
from datetime import datetime, timezone
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
from typing import Any
|
|
21
|
+
|
|
22
|
+
from .paths import get_repo_root, get_selected_task_abs, resolve_task_ref
|
|
23
|
+
from .smart_search_resolve import default_smart_search_argv, resolve_smart_search_argv
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
INTENT_CHOICES = ("deep-research", "broad-search", "docs", "official-source", "fetch")
|
|
27
|
+
STATUS_OK = "ok"
|
|
28
|
+
STATUS_DEGRADED = "degraded"
|
|
29
|
+
STATUS_FAILED = "failed"
|
|
30
|
+
STATUS_NOT_CONFIGURED = "not_configured"
|
|
31
|
+
MANIFEST_VERSION = 1
|
|
32
|
+
MAX_SUMMARY_CHARS = 500
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
|
|
36
|
+
parser = argparse.ArgumentParser(
|
|
37
|
+
description="Run smart-search and save a Trellis evidence manifest.",
|
|
38
|
+
)
|
|
39
|
+
parser.add_argument("query", help="Search query, research question, or URL for --intent fetch.")
|
|
40
|
+
parser.add_argument(
|
|
41
|
+
"--intent",
|
|
42
|
+
choices=INTENT_CHOICES,
|
|
43
|
+
default="deep-research",
|
|
44
|
+
help="Smart Search route to use.",
|
|
45
|
+
)
|
|
46
|
+
parser.add_argument(
|
|
47
|
+
"--task",
|
|
48
|
+
help="Task directory/ref. Defaults to the selected Trellis task when available.",
|
|
49
|
+
)
|
|
50
|
+
parser.add_argument(
|
|
51
|
+
"--run-id",
|
|
52
|
+
help="Stable run id for output paths. Defaults to timestamp plus query slug.",
|
|
53
|
+
)
|
|
54
|
+
parser.add_argument("--root", help="Repository root. Defaults to nearest parent with .trellis/.")
|
|
55
|
+
parser.add_argument(
|
|
56
|
+
"--smart-search-command",
|
|
57
|
+
default=None,
|
|
58
|
+
help="Override CLI executable (single path/name). Default: env, config, PATH, repo wrappers.",
|
|
59
|
+
)
|
|
60
|
+
parser.add_argument(
|
|
61
|
+
"--skip-doctor",
|
|
62
|
+
action="store_true",
|
|
63
|
+
help="Skip smart-search doctor preflight and run the selected command directly.",
|
|
64
|
+
)
|
|
65
|
+
parser.add_argument("--budget", choices=("quick", "standard", "deep"), default="standard")
|
|
66
|
+
parser.add_argument("--fallback", choices=("auto", "off"), default="auto")
|
|
67
|
+
parser.add_argument("--validation", choices=("fast", "balanced", "strict"), default="balanced")
|
|
68
|
+
parser.add_argument("--extra-sources", type=int, default=1)
|
|
69
|
+
parser.add_argument("--timeout", type=int, default=90)
|
|
70
|
+
parser.add_argument("--num-results", type=int, default=5)
|
|
71
|
+
parser.add_argument(
|
|
72
|
+
"--include-domain",
|
|
73
|
+
action="append",
|
|
74
|
+
default=[],
|
|
75
|
+
help="Domain filter for --intent official-source. May be repeated.",
|
|
76
|
+
)
|
|
77
|
+
parser.add_argument("--json", action="store_true", help="Emit manifest JSON.")
|
|
78
|
+
return parser.parse_args(argv)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def main(argv: list[str] | None = None) -> int:
|
|
82
|
+
args = parse_args(argv)
|
|
83
|
+
if args.extra_sources < 0:
|
|
84
|
+
print("Error: --extra-sources must be >= 0", file=sys.stderr)
|
|
85
|
+
return 2
|
|
86
|
+
if args.timeout <= 0:
|
|
87
|
+
print("Error: --timeout must be > 0", file=sys.stderr)
|
|
88
|
+
return 2
|
|
89
|
+
if args.num_results <= 0:
|
|
90
|
+
print("Error: --num-results must be > 0", file=sys.stderr)
|
|
91
|
+
return 2
|
|
92
|
+
|
|
93
|
+
repo_root = Path(args.root).resolve() if args.root else get_repo_root()
|
|
94
|
+
if args.smart_search_command:
|
|
95
|
+
args.smart_search_argv = [args.smart_search_command]
|
|
96
|
+
else:
|
|
97
|
+
args.smart_search_argv = resolve_smart_search_argv(repo_root) or default_smart_search_argv(
|
|
98
|
+
repo_root
|
|
99
|
+
)
|
|
100
|
+
run_id = args.run_id or default_run_id(args.intent, args.query)
|
|
101
|
+
evidence_dir = resolve_evidence_dir(repo_root, args.task, run_id)
|
|
102
|
+
evidence_dir.mkdir(parents=True, exist_ok=True)
|
|
103
|
+
|
|
104
|
+
command = build_smart_search_command(args, evidence_dir)
|
|
105
|
+
doctor_result = None
|
|
106
|
+
if not args.skip_doctor:
|
|
107
|
+
doctor_result = run_command(
|
|
108
|
+
[*args.smart_search_argv, "doctor", "--format", "json"],
|
|
109
|
+
repo_root,
|
|
110
|
+
)
|
|
111
|
+
if doctor_result.not_found:
|
|
112
|
+
manifest = build_manifest(
|
|
113
|
+
repo_root=repo_root,
|
|
114
|
+
query=args.query,
|
|
115
|
+
intent=args.intent,
|
|
116
|
+
command=command,
|
|
117
|
+
evidence_dir=evidence_dir,
|
|
118
|
+
output_path=command_output_path(args.intent, evidence_dir),
|
|
119
|
+
status=STATUS_NOT_CONFIGURED,
|
|
120
|
+
result_data={},
|
|
121
|
+
doctor_data={},
|
|
122
|
+
error="smart-search CLI could not be resolved (PATH, config, or repo wrapper).",
|
|
123
|
+
)
|
|
124
|
+
write_manifest(manifest, evidence_dir)
|
|
125
|
+
print_manifest(manifest, args.json)
|
|
126
|
+
return 4
|
|
127
|
+
doctor_data = parse_json_output(doctor_result.stdout)
|
|
128
|
+
if doctor_result.returncode != 0 or doctor_data.get("ok") is False:
|
|
129
|
+
manifest = build_manifest(
|
|
130
|
+
repo_root=repo_root,
|
|
131
|
+
query=args.query,
|
|
132
|
+
intent=args.intent,
|
|
133
|
+
command=command,
|
|
134
|
+
evidence_dir=evidence_dir,
|
|
135
|
+
output_path=command_output_path(args.intent, evidence_dir),
|
|
136
|
+
status=STATUS_NOT_CONFIGURED,
|
|
137
|
+
result_data={},
|
|
138
|
+
doctor_data=doctor_data,
|
|
139
|
+
error=doctor_data.get("error") or doctor_result.stderr.strip() or "smart-search doctor failed.",
|
|
140
|
+
)
|
|
141
|
+
write_manifest(manifest, evidence_dir)
|
|
142
|
+
print_manifest(manifest, args.json)
|
|
143
|
+
return doctor_result.returncode or 3
|
|
144
|
+
|
|
145
|
+
result = run_command(command, repo_root)
|
|
146
|
+
output_path = command_output_path(args.intent, evidence_dir)
|
|
147
|
+
result_data = read_result_data(output_path, result.stdout)
|
|
148
|
+
doctor_data = parse_json_output(doctor_result.stdout) if doctor_result else {}
|
|
149
|
+
status = status_from_result(result.returncode, result_data)
|
|
150
|
+
error = ""
|
|
151
|
+
if result.not_found:
|
|
152
|
+
status = STATUS_NOT_CONFIGURED
|
|
153
|
+
error = "smart-search CLI could not be resolved (PATH, config, or repo wrapper)."
|
|
154
|
+
elif status == STATUS_FAILED:
|
|
155
|
+
error = (
|
|
156
|
+
string_value(result_data.get("error"))
|
|
157
|
+
or result.stderr.strip()
|
|
158
|
+
or f"smart-search exited with code {result.returncode}."
|
|
159
|
+
)
|
|
160
|
+
if "timed out" in error.lower() or "timeout" in error.lower():
|
|
161
|
+
error = (
|
|
162
|
+
f"{error} Retry with --timeout 120 or --intent docs; "
|
|
163
|
+
"or use Cursor WebSearch/WebFetch and persist source: cursor-web-fallback."
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
manifest = build_manifest(
|
|
167
|
+
repo_root=repo_root,
|
|
168
|
+
query=args.query,
|
|
169
|
+
intent=args.intent,
|
|
170
|
+
command=command,
|
|
171
|
+
evidence_dir=evidence_dir,
|
|
172
|
+
output_path=output_path,
|
|
173
|
+
status=status,
|
|
174
|
+
result_data=result_data,
|
|
175
|
+
doctor_data=doctor_data,
|
|
176
|
+
error=error,
|
|
177
|
+
)
|
|
178
|
+
write_manifest(manifest, evidence_dir)
|
|
179
|
+
print_manifest(manifest, args.json)
|
|
180
|
+
return 0 if status in {STATUS_OK, STATUS_DEGRADED} else (result.returncode or 4)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
class CommandResult:
|
|
184
|
+
def __init__(self, returncode: int, stdout: str = "", stderr: str = "", not_found: bool = False):
|
|
185
|
+
self.returncode = returncode
|
|
186
|
+
self.stdout = stdout
|
|
187
|
+
self.stderr = stderr
|
|
188
|
+
self.not_found = not_found
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def run_command(command: list[str], cwd: Path) -> CommandResult:
|
|
192
|
+
try:
|
|
193
|
+
completed = subprocess.run(
|
|
194
|
+
command,
|
|
195
|
+
cwd=str(cwd),
|
|
196
|
+
text=True,
|
|
197
|
+
encoding="utf-8",
|
|
198
|
+
errors="replace",
|
|
199
|
+
capture_output=True,
|
|
200
|
+
check=False,
|
|
201
|
+
)
|
|
202
|
+
return CommandResult(completed.returncode, completed.stdout or "", completed.stderr or "")
|
|
203
|
+
except FileNotFoundError as error:
|
|
204
|
+
return CommandResult(127, "", str(error), not_found=True)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def build_smart_search_command(args: argparse.Namespace, evidence_dir: Path) -> list[str]:
|
|
208
|
+
output_path = command_output_path(args.intent, evidence_dir)
|
|
209
|
+
command = list(args.smart_search_argv)
|
|
210
|
+
if args.intent == "deep-research":
|
|
211
|
+
return [
|
|
212
|
+
*command,
|
|
213
|
+
"research",
|
|
214
|
+
args.query,
|
|
215
|
+
"--budget",
|
|
216
|
+
args.budget,
|
|
217
|
+
"--fallback",
|
|
218
|
+
args.fallback,
|
|
219
|
+
"--format",
|
|
220
|
+
"json",
|
|
221
|
+
"--output",
|
|
222
|
+
str(output_path),
|
|
223
|
+
]
|
|
224
|
+
if args.intent == "broad-search":
|
|
225
|
+
return [
|
|
226
|
+
*command,
|
|
227
|
+
"search",
|
|
228
|
+
args.query,
|
|
229
|
+
"--validation",
|
|
230
|
+
args.validation,
|
|
231
|
+
"--extra-sources",
|
|
232
|
+
str(args.extra_sources),
|
|
233
|
+
"--timeout",
|
|
234
|
+
str(args.timeout),
|
|
235
|
+
"--format",
|
|
236
|
+
"json",
|
|
237
|
+
"--output",
|
|
238
|
+
str(output_path),
|
|
239
|
+
]
|
|
240
|
+
if args.intent == "docs":
|
|
241
|
+
return [
|
|
242
|
+
*command,
|
|
243
|
+
"context7-library",
|
|
244
|
+
args.query,
|
|
245
|
+
"--format",
|
|
246
|
+
"json",
|
|
247
|
+
"--output",
|
|
248
|
+
str(output_path),
|
|
249
|
+
]
|
|
250
|
+
if args.intent == "official-source":
|
|
251
|
+
built = [
|
|
252
|
+
*command,
|
|
253
|
+
"exa-search",
|
|
254
|
+
args.query,
|
|
255
|
+
"--num-results",
|
|
256
|
+
str(args.num_results),
|
|
257
|
+
"--include-text",
|
|
258
|
+
"--include-highlights",
|
|
259
|
+
"--format",
|
|
260
|
+
"json",
|
|
261
|
+
"--output",
|
|
262
|
+
str(output_path),
|
|
263
|
+
]
|
|
264
|
+
for domain in args.include_domain:
|
|
265
|
+
built.extend(["--include-domains", domain])
|
|
266
|
+
return built
|
|
267
|
+
if args.intent == "fetch":
|
|
268
|
+
return [
|
|
269
|
+
*command,
|
|
270
|
+
"fetch",
|
|
271
|
+
args.query,
|
|
272
|
+
"--format",
|
|
273
|
+
"markdown",
|
|
274
|
+
"--output",
|
|
275
|
+
str(output_path),
|
|
276
|
+
]
|
|
277
|
+
raise ValueError(f"Unsupported Smart Search intent: {args.intent}")
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def command_output_path(intent: str, evidence_dir: Path) -> Path:
|
|
281
|
+
suffix = "md" if intent == "fetch" else "json"
|
|
282
|
+
name = intent.replace("-", "_")
|
|
283
|
+
return evidence_dir / f"{name}.{suffix}"
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
def resolve_evidence_dir(repo_root: Path, task_ref: str | None, run_id: str) -> Path:
|
|
287
|
+
task_dir: Path | None = None
|
|
288
|
+
if task_ref:
|
|
289
|
+
task_dir = resolve_task_ref(task_ref, repo_root)
|
|
290
|
+
else:
|
|
291
|
+
task_dir = get_selected_task_abs(repo_root)
|
|
292
|
+
|
|
293
|
+
if task_dir and task_dir.exists():
|
|
294
|
+
return task_dir / "research" / "smart-search" / safe_filename(run_id)
|
|
295
|
+
return repo_root / ".trellis" / "workspace" / "smart-search" / safe_filename(run_id)
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
def default_run_id(intent: str, query: str) -> str:
|
|
299
|
+
stamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
|
|
300
|
+
slug = safe_filename(query)[:48] or "query"
|
|
301
|
+
return f"{stamp}-{intent}-{slug}"
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def safe_filename(value: str) -> str:
|
|
305
|
+
cleaned = re.sub(r"[^A-Za-z0-9._-]+", "-", value.strip().lower())
|
|
306
|
+
cleaned = cleaned.strip(".-_")
|
|
307
|
+
return cleaned or "run"
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
def parse_json_output(content: str) -> dict[str, Any]:
|
|
311
|
+
if not content.strip():
|
|
312
|
+
return {}
|
|
313
|
+
try:
|
|
314
|
+
parsed = json.loads(content)
|
|
315
|
+
except json.JSONDecodeError:
|
|
316
|
+
return {}
|
|
317
|
+
return parsed if isinstance(parsed, dict) else {}
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
def read_result_data(output_path: Path, stdout: str) -> dict[str, Any]:
|
|
321
|
+
if output_path.is_file() and output_path.suffix.lower() == ".json":
|
|
322
|
+
return parse_json_output(output_path.read_text(encoding="utf-8"))
|
|
323
|
+
if output_path.is_file() and output_path.suffix.lower() != ".json":
|
|
324
|
+
return {"ok": True, "content": output_path.read_text(encoding="utf-8")}
|
|
325
|
+
return parse_json_output(stdout)
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
def status_from_result(returncode: int, result_data: dict[str, Any]) -> str:
|
|
329
|
+
if returncode != 0:
|
|
330
|
+
return STATUS_FAILED
|
|
331
|
+
if result_data.get("ok") is False:
|
|
332
|
+
return STATUS_FAILED
|
|
333
|
+
if result_data.get("degraded") is True:
|
|
334
|
+
return STATUS_DEGRADED
|
|
335
|
+
return STATUS_OK
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
def build_manifest(
|
|
339
|
+
repo_root: Path,
|
|
340
|
+
query: str,
|
|
341
|
+
intent: str,
|
|
342
|
+
command: list[str],
|
|
343
|
+
evidence_dir: Path,
|
|
344
|
+
output_path: Path,
|
|
345
|
+
status: str,
|
|
346
|
+
result_data: dict[str, Any],
|
|
347
|
+
doctor_data: dict[str, Any],
|
|
348
|
+
error: str = "",
|
|
349
|
+
) -> dict[str, Any]:
|
|
350
|
+
provider_attempts = list_value(result_data.get("provider_attempts"))
|
|
351
|
+
citations = normalize_citations(result_data)
|
|
352
|
+
manifest: dict[str, Any] = {
|
|
353
|
+
"version": MANIFEST_VERSION,
|
|
354
|
+
"source": "smart-search",
|
|
355
|
+
"query": query,
|
|
356
|
+
"intent": intent,
|
|
357
|
+
"command": render_command(command),
|
|
358
|
+
"outputPath": to_repo_path(output_path, repo_root),
|
|
359
|
+
"evidenceDir": to_repo_path(evidence_dir, repo_root),
|
|
360
|
+
"manifestPath": to_repo_path(evidence_dir / "manifest.json", repo_root),
|
|
361
|
+
"status": status,
|
|
362
|
+
"createdAt": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"),
|
|
363
|
+
"summary": summarize_result(result_data, error),
|
|
364
|
+
"citations": citations,
|
|
365
|
+
"gapCheck": dict_value(result_data.get("gap_check")),
|
|
366
|
+
"providerAttempts": provider_attempts,
|
|
367
|
+
"degraded": bool(result_data.get("degraded", status == STATUS_DEGRADED)),
|
|
368
|
+
"routePolicyVersion": string_value(result_data.get("route_policy_version")),
|
|
369
|
+
"doctor": normalize_doctor(doctor_data),
|
|
370
|
+
}
|
|
371
|
+
if error:
|
|
372
|
+
manifest["error"] = error
|
|
373
|
+
return manifest
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
def write_manifest(manifest: dict[str, Any], evidence_dir: Path) -> None:
|
|
377
|
+
path = evidence_dir / "manifest.json"
|
|
378
|
+
path.write_text(json.dumps(manifest, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
def print_manifest(manifest: dict[str, Any], as_json: bool) -> None:
|
|
382
|
+
if as_json:
|
|
383
|
+
print(json.dumps(manifest, ensure_ascii=False, indent=2))
|
|
384
|
+
return
|
|
385
|
+
print(f"Smart Search evidence: {manifest['status']}")
|
|
386
|
+
print(f"Manifest: {manifest['manifestPath']}")
|
|
387
|
+
print(f"Output: {manifest['outputPath']}")
|
|
388
|
+
if manifest.get("summary"):
|
|
389
|
+
print(f"Summary: {manifest['summary']}")
|
|
390
|
+
if manifest.get("error"):
|
|
391
|
+
print(f"Error: {manifest['error']}")
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
def normalize_citations(result_data: dict[str, Any]) -> list[dict[str, Any]]:
|
|
395
|
+
raw_items = list_value(result_data.get("citations"))
|
|
396
|
+
if not raw_items:
|
|
397
|
+
raw_items = list_value(result_data.get("evidence_items"))
|
|
398
|
+
if not raw_items:
|
|
399
|
+
raw_items = list_value(result_data.get("primary_sources")) or list_value(result_data.get("sources"))
|
|
400
|
+
|
|
401
|
+
citations: list[dict[str, Any]] = []
|
|
402
|
+
for item in raw_items:
|
|
403
|
+
if not isinstance(item, dict):
|
|
404
|
+
continue
|
|
405
|
+
url = string_value(item.get("url"))
|
|
406
|
+
title = string_value(item.get("title"))
|
|
407
|
+
if not url and not title:
|
|
408
|
+
continue
|
|
409
|
+
citation: dict[str, Any] = {}
|
|
410
|
+
if title:
|
|
411
|
+
citation["title"] = title
|
|
412
|
+
if url:
|
|
413
|
+
citation["url"] = url
|
|
414
|
+
provider = string_value(item.get("provider"))
|
|
415
|
+
if provider:
|
|
416
|
+
citation["provider"] = provider
|
|
417
|
+
citations.append(citation)
|
|
418
|
+
return citations
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
def summarize_result(result_data: dict[str, Any], error: str = "") -> str:
|
|
422
|
+
if error:
|
|
423
|
+
return error[:MAX_SUMMARY_CHARS]
|
|
424
|
+
content = (
|
|
425
|
+
string_value(result_data.get("final_answer"))
|
|
426
|
+
or string_value(result_data.get("content"))
|
|
427
|
+
or string_value(result_data.get("summary"))
|
|
428
|
+
)
|
|
429
|
+
if not content:
|
|
430
|
+
total = result_data.get("total") or result_data.get("sources_count")
|
|
431
|
+
if isinstance(total, int):
|
|
432
|
+
return f"Smart Search returned {total} result(s)."
|
|
433
|
+
return ""
|
|
434
|
+
normalized = re.sub(r"\s+", " ", content).strip()
|
|
435
|
+
return normalized[:MAX_SUMMARY_CHARS]
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
def normalize_doctor(doctor_data: dict[str, Any]) -> dict[str, Any]:
|
|
439
|
+
allowed_keys = (
|
|
440
|
+
"ok",
|
|
441
|
+
"config_status",
|
|
442
|
+
"minimum_profile_ok",
|
|
443
|
+
"capability_status",
|
|
444
|
+
"resolved_evidence_dir",
|
|
445
|
+
"config_dir_source",
|
|
446
|
+
)
|
|
447
|
+
return {key: doctor_data[key] for key in allowed_keys if key in doctor_data}
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
def dict_value(value: Any) -> dict[str, Any]:
|
|
451
|
+
return value if isinstance(value, dict) else {}
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
def list_value(value: Any) -> list[Any]:
|
|
455
|
+
return value if isinstance(value, list) else []
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
def string_value(value: Any) -> str | None:
|
|
459
|
+
if isinstance(value, str):
|
|
460
|
+
stripped = value.strip()
|
|
461
|
+
return stripped or None
|
|
462
|
+
return None
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
def to_repo_path(path: Path, repo_root: Path) -> str:
|
|
466
|
+
try:
|
|
467
|
+
return path.resolve().relative_to(repo_root.resolve()).as_posix()
|
|
468
|
+
except ValueError:
|
|
469
|
+
return str(path)
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
def render_command(parts: list[str]) -> str:
|
|
473
|
+
return " ".join(quote_arg(part) for part in parts)
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
def quote_arg(value: str) -> str:
|
|
477
|
+
if re.fullmatch(r"[A-Za-z0-9_./:=@+-]+", value):
|
|
478
|
+
return value
|
|
479
|
+
return json.dumps(value, ensure_ascii=False)
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Resolve how to invoke the smart-search CLI (argv prefix for subprocess).
|
|
4
|
+
|
|
5
|
+
No writes under .trellis/.runtime/. Optional per-machine override:
|
|
6
|
+
TRELLIS_SMART_SEARCH_COMMAND or smart_search.command in config.yaml.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
import shutil
|
|
13
|
+
import sys
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
from .config import get_smart_search_command_config
|
|
17
|
+
from .paths import get_repo_root
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _windows_candidates(stem: str) -> list[str]:
|
|
21
|
+
if not sys.platform.startswith("win"):
|
|
22
|
+
return [stem]
|
|
23
|
+
return [f"{stem}.cmd", f"{stem}.bat", stem]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _which_executable(name: str) -> str | None:
|
|
27
|
+
for candidate in _windows_candidates(name):
|
|
28
|
+
found = shutil.which(candidate)
|
|
29
|
+
if found:
|
|
30
|
+
return found
|
|
31
|
+
return None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _resolve_config_or_env(repo_root: Path) -> list[str] | None:
|
|
35
|
+
env_cmd = os.environ.get("TRELLIS_SMART_SEARCH_COMMAND", "").strip()
|
|
36
|
+
if env_cmd:
|
|
37
|
+
if Path(env_cmd).is_file():
|
|
38
|
+
return [env_cmd]
|
|
39
|
+
found = _which_executable(env_cmd)
|
|
40
|
+
if found:
|
|
41
|
+
return [found]
|
|
42
|
+
|
|
43
|
+
config_cmd = get_smart_search_command_config(repo_root)
|
|
44
|
+
if config_cmd:
|
|
45
|
+
if Path(config_cmd).is_file():
|
|
46
|
+
return [config_cmd]
|
|
47
|
+
found = _which_executable(config_cmd)
|
|
48
|
+
if found:
|
|
49
|
+
return [found]
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _node_script_argv(script: Path) -> list[str] | None:
|
|
54
|
+
if not script.is_file():
|
|
55
|
+
return None
|
|
56
|
+
node = shutil.which("node") or shutil.which("node.exe")
|
|
57
|
+
if not node:
|
|
58
|
+
return None
|
|
59
|
+
return [node, str(script.resolve())]
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _npm_local_wrappers(repo_root: Path) -> list[list[str]]:
|
|
63
|
+
"""Project-local npm installs (no global PATH)."""
|
|
64
|
+
candidates: list[Path] = [
|
|
65
|
+
repo_root / "node_modules" / ".bin" / "smart-search.js",
|
|
66
|
+
repo_root
|
|
67
|
+
/ "node_modules"
|
|
68
|
+
/ "@konbakuyomu"
|
|
69
|
+
/ "smart-search"
|
|
70
|
+
/ "npm"
|
|
71
|
+
/ "bin"
|
|
72
|
+
/ "smart-search.js",
|
|
73
|
+
]
|
|
74
|
+
out: list[list[str]] = []
|
|
75
|
+
for script in candidates:
|
|
76
|
+
argv = _node_script_argv(script)
|
|
77
|
+
if argv:
|
|
78
|
+
out.append(argv)
|
|
79
|
+
for stem in _windows_candidates("smart-search"):
|
|
80
|
+
bin_path = repo_root / "node_modules" / ".bin" / stem
|
|
81
|
+
if bin_path.is_file():
|
|
82
|
+
out.append([str(bin_path.resolve())])
|
|
83
|
+
return out
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _harness_wrappers(repo_root: Path) -> list[list[str]]:
|
|
87
|
+
"""Optional polyrepo harness layouts (e.g. MyHarness)."""
|
|
88
|
+
candidates: list[Path] = [
|
|
89
|
+
repo_root / "Trellis" / "packages" / "cli" / "bin" / "smart-search.js",
|
|
90
|
+
repo_root / "smartsearch-private" / "npm" / "bin" / "smart-search.js",
|
|
91
|
+
]
|
|
92
|
+
out: list[list[str]] = []
|
|
93
|
+
for script in candidates:
|
|
94
|
+
argv = _node_script_argv(script)
|
|
95
|
+
if argv:
|
|
96
|
+
out.append(argv)
|
|
97
|
+
return out
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def resolve_smart_search_argv(repo_root: Path | None = None) -> list[str] | None:
|
|
101
|
+
"""
|
|
102
|
+
argv prefix to run smart-search, e.g. ``['smart-search.cmd']`` or
|
|
103
|
+
``['node', '.../smart-search.js']``. None if nothing resolvable.
|
|
104
|
+
"""
|
|
105
|
+
root = repo_root or get_repo_root()
|
|
106
|
+
|
|
107
|
+
from_env = _resolve_config_or_env(root)
|
|
108
|
+
if from_env:
|
|
109
|
+
return from_env
|
|
110
|
+
|
|
111
|
+
found = _which_executable("smart-search")
|
|
112
|
+
if found:
|
|
113
|
+
return [found]
|
|
114
|
+
|
|
115
|
+
for argv in _npm_local_wrappers(root):
|
|
116
|
+
return argv
|
|
117
|
+
|
|
118
|
+
for argv in _harness_wrappers(root):
|
|
119
|
+
return argv
|
|
120
|
+
|
|
121
|
+
return None
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def default_smart_search_argv(repo_root: Path | None = None) -> list[str]:
|
|
125
|
+
return resolve_smart_search_argv(repo_root) or ["smart-search"]
|