@useconvoy/cli 0.48.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 +90 -0
- package/README.md +495 -0
- package/dist/bin/convoy.d.ts +2 -0
- package/dist/bin/convoy.js +129 -0
- package/dist/bin/convoy.js.map +1 -0
- package/dist/marketplace/.claude-plugin/marketplace.json +14 -0
- package/dist/marketplace/opensana/.claude-plugin/plugin.json +5 -0
- package/dist/marketplace/opensana/README.md +90 -0
- package/dist/marketplace/opensana/skills/tasks/SKILL.md +133 -0
- package/dist/marketplace/opensana/skills/tasks/references/mcp-setup.md +164 -0
- package/dist/src/agent/app/chunk-flush-buffer.d.ts +35 -0
- package/dist/src/agent/app/chunk-flush-buffer.js +133 -0
- package/dist/src/agent/app/chunk-flush-buffer.js.map +1 -0
- package/dist/src/agent/app/chunk-scrub.d.ts +9 -0
- package/dist/src/agent/app/chunk-scrub.js +120 -0
- package/dist/src/agent/app/chunk-scrub.js.map +1 -0
- package/dist/src/agent/app/interaction-router.d.ts +16 -0
- package/dist/src/agent/app/interaction-router.js +29 -0
- package/dist/src/agent/app/interaction-router.js.map +1 -0
- package/dist/src/agent/app/runner.d.ts +41 -0
- package/dist/src/agent/app/runner.js +353 -0
- package/dist/src/agent/app/runner.js.map +1 -0
- package/dist/src/agent/app/runtime-config.d.ts +3 -0
- package/dist/src/agent/app/runtime-config.js +4 -0
- package/dist/src/agent/app/runtime-config.js.map +1 -0
- package/dist/src/agent/app/thread-attachment-cache.d.ts +17 -0
- package/dist/src/agent/app/thread-attachment-cache.js +124 -0
- package/dist/src/agent/app/thread-attachment-cache.js.map +1 -0
- package/dist/src/agent/app/thread-processor.d.ts +40 -0
- package/dist/src/agent/app/thread-processor.js +792 -0
- package/dist/src/agent/app/thread-processor.js.map +1 -0
- package/dist/src/agent/app/worktree-op-processor.d.ts +27 -0
- package/dist/src/agent/app/worktree-op-processor.js +173 -0
- package/dist/src/agent/app/worktree-op-processor.js.map +1 -0
- package/dist/src/agent/runtimes/agent-instructions.d.ts +16 -0
- package/dist/src/agent/runtimes/agent-instructions.js +33 -0
- package/dist/src/agent/runtimes/agent-instructions.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/continuation.d.ts +1 -0
- package/dist/src/agent/runtimes/claudeCode/continuation.js +30 -0
- package/dist/src/agent/runtimes/claudeCode/continuation.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/detect.d.ts +12 -0
- package/dist/src/agent/runtimes/claudeCode/detect.js +109 -0
- package/dist/src/agent/runtimes/claudeCode/detect.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/interactions.d.ts +13 -0
- package/dist/src/agent/runtimes/claudeCode/interactions.js +167 -0
- package/dist/src/agent/runtimes/claudeCode/interactions.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/models.d.ts +3 -0
- package/dist/src/agent/runtimes/claudeCode/models.js +16 -0
- package/dist/src/agent/runtimes/claudeCode/models.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/prompts.d.ts +1 -0
- package/dist/src/agent/runtimes/claudeCode/prompts.js +5 -0
- package/dist/src/agent/runtimes/claudeCode/prompts.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/runner.d.ts +32 -0
- package/dist/src/agent/runtimes/claudeCode/runner.js +941 -0
- package/dist/src/agent/runtimes/claudeCode/runner.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/runtime.d.ts +2 -0
- package/dist/src/agent/runtimes/claudeCode/runtime.js +126 -0
- package/dist/src/agent/runtimes/claudeCode/runtime.js.map +1 -0
- package/dist/src/agent/runtimes/claudeCode/streaming.d.ts +8 -0
- package/dist/src/agent/runtimes/claudeCode/streaming.js +88 -0
- package/dist/src/agent/runtimes/claudeCode/streaming.js.map +1 -0
- package/dist/src/agent/runtimes/codex/app-server-rpc.d.ts +26 -0
- package/dist/src/agent/runtimes/codex/app-server-rpc.js +109 -0
- package/dist/src/agent/runtimes/codex/app-server-rpc.js.map +1 -0
- package/dist/src/agent/runtimes/codex/app-server-runner.d.ts +59 -0
- package/dist/src/agent/runtimes/codex/app-server-runner.js +688 -0
- package/dist/src/agent/runtimes/codex/app-server-runner.js.map +1 -0
- package/dist/src/agent/runtimes/codex/commands.d.ts +23 -0
- package/dist/src/agent/runtimes/codex/commands.js +25 -0
- package/dist/src/agent/runtimes/codex/commands.js.map +1 -0
- package/dist/src/agent/runtimes/codex/detect.d.ts +5 -0
- package/dist/src/agent/runtimes/codex/detect.js +17 -0
- package/dist/src/agent/runtimes/codex/detect.js.map +1 -0
- package/dist/src/agent/runtimes/codex/models.d.ts +2 -0
- package/dist/src/agent/runtimes/codex/models.js +4 -0
- package/dist/src/agent/runtimes/codex/models.js.map +1 -0
- package/dist/src/agent/runtimes/codex/runner.d.ts +46 -0
- package/dist/src/agent/runtimes/codex/runner.js +298 -0
- package/dist/src/agent/runtimes/codex/runner.js.map +1 -0
- package/dist/src/agent/runtimes/codex/runtime.d.ts +10 -0
- package/dist/src/agent/runtimes/codex/runtime.js +73 -0
- package/dist/src/agent/runtimes/codex/runtime.js.map +1 -0
- package/dist/src/agent/runtimes/contracts.d.ts +215 -0
- package/dist/src/agent/runtimes/contracts.js +33 -0
- package/dist/src/agent/runtimes/contracts.js.map +1 -0
- package/dist/src/agent/runtimes/cursor/commands.d.ts +7 -0
- package/dist/src/agent/runtimes/cursor/commands.js +39 -0
- package/dist/src/agent/runtimes/cursor/commands.js.map +1 -0
- package/dist/src/agent/runtimes/cursor/detect.d.ts +17 -0
- package/dist/src/agent/runtimes/cursor/detect.js +54 -0
- package/dist/src/agent/runtimes/cursor/detect.js.map +1 -0
- package/dist/src/agent/runtimes/cursor/models.d.ts +9 -0
- package/dist/src/agent/runtimes/cursor/models.js +97 -0
- package/dist/src/agent/runtimes/cursor/models.js.map +1 -0
- package/dist/src/agent/runtimes/cursor/runner.d.ts +36 -0
- package/dist/src/agent/runtimes/cursor/runner.js +293 -0
- package/dist/src/agent/runtimes/cursor/runner.js.map +1 -0
- package/dist/src/agent/runtimes/cursor/runtime.d.ts +2 -0
- package/dist/src/agent/runtimes/cursor/runtime.js +48 -0
- package/dist/src/agent/runtimes/cursor/runtime.js.map +1 -0
- package/dist/src/agent/runtimes/cursor/streaming.d.ts +8 -0
- package/dist/src/agent/runtimes/cursor/streaming.js +78 -0
- package/dist/src/agent/runtimes/cursor/streaming.js.map +1 -0
- package/dist/src/agent/runtimes/debug.d.ts +8 -0
- package/dist/src/agent/runtimes/debug.js +19 -0
- package/dist/src/agent/runtimes/debug.js.map +1 -0
- package/dist/src/agent/runtimes/message-format.d.ts +6 -0
- package/dist/src/agent/runtimes/message-format.js +31 -0
- package/dist/src/agent/runtimes/message-format.js.map +1 -0
- package/dist/src/agent/runtimes/opencode/client.d.ts +82 -0
- package/dist/src/agent/runtimes/opencode/client.js +109 -0
- package/dist/src/agent/runtimes/opencode/client.js.map +1 -0
- package/dist/src/agent/runtimes/opencode/detect.d.ts +18 -0
- package/dist/src/agent/runtimes/opencode/detect.js +100 -0
- package/dist/src/agent/runtimes/opencode/detect.js.map +1 -0
- package/dist/src/agent/runtimes/opencode/json.d.ts +4 -0
- package/dist/src/agent/runtimes/opencode/json.js +17 -0
- package/dist/src/agent/runtimes/opencode/json.js.map +1 -0
- package/dist/src/agent/runtimes/opencode/runner.d.ts +50 -0
- package/dist/src/agent/runtimes/opencode/runner.js +598 -0
- package/dist/src/agent/runtimes/opencode/runner.js.map +1 -0
- package/dist/src/agent/runtimes/opencode/runtime.d.ts +9 -0
- package/dist/src/agent/runtimes/opencode/runtime.js +82 -0
- package/dist/src/agent/runtimes/opencode/runtime.js.map +1 -0
- package/dist/src/agent/runtimes/opencode/server.d.ts +36 -0
- package/dist/src/agent/runtimes/opencode/server.js +210 -0
- package/dist/src/agent/runtimes/opencode/server.js.map +1 -0
- package/dist/src/agent/runtimes/opencode/streaming.d.ts +7 -0
- package/dist/src/agent/runtimes/opencode/streaming.js +47 -0
- package/dist/src/agent/runtimes/opencode/streaming.js.map +1 -0
- package/dist/src/agent/runtimes/registry.d.ts +10 -0
- package/dist/src/agent/runtimes/registry.js +48 -0
- package/dist/src/agent/runtimes/registry.js.map +1 -0
- package/dist/src/agent/sdk/adapters/adapter-interface.d.ts +2 -0
- package/dist/src/agent/sdk/adapters/adapter-interface.js +4 -0
- package/dist/src/agent/sdk/adapters/adapter-interface.js.map +1 -0
- package/dist/src/agent/sdk/adapters/claude/claude-adapter.d.ts +9 -0
- package/dist/src/agent/sdk/adapters/claude/claude-adapter.js +95 -0
- package/dist/src/agent/sdk/adapters/claude/claude-adapter.js.map +1 -0
- package/dist/src/agent/sdk/adapters/codex/codex-adapter.d.ts +10 -0
- package/dist/src/agent/sdk/adapters/codex/codex-adapter.js +87 -0
- package/dist/src/agent/sdk/adapters/codex/codex-adapter.js.map +1 -0
- package/dist/src/agent/sdk/adapters/executable-resolution.d.ts +2 -0
- package/dist/src/agent/sdk/adapters/executable-resolution.js +50 -0
- package/dist/src/agent/sdk/adapters/executable-resolution.js.map +1 -0
- package/dist/src/agent/sdk/adapters/generic/generic-subprocess-adapter.d.ts +11 -0
- package/dist/src/agent/sdk/adapters/generic/generic-subprocess-adapter.js +61 -0
- package/dist/src/agent/sdk/adapters/generic/generic-subprocess-adapter.js.map +1 -0
- package/dist/src/agent/sdk/adapters/provider-registry.d.ts +8 -0
- package/dist/src/agent/sdk/adapters/provider-registry.js +32 -0
- package/dist/src/agent/sdk/adapters/provider-registry.js.map +1 -0
- package/dist/src/agent/sdk/constants.d.ts +5 -0
- package/dist/src/agent/sdk/constants.js +29 -0
- package/dist/src/agent/sdk/constants.js.map +1 -0
- package/dist/src/agent/sdk/index.d.ts +2 -0
- package/dist/src/agent/sdk/index.js +2 -0
- package/dist/src/agent/sdk/index.js.map +1 -0
- package/dist/src/agent/sdk/run-handle.d.ts +22 -0
- package/dist/src/agent/sdk/run-handle.js +90 -0
- package/dist/src/agent/sdk/run-handle.js.map +1 -0
- package/dist/src/agent/sdk/runtime/isolation-env.d.ts +9 -0
- package/dist/src/agent/sdk/runtime/isolation-env.js +39 -0
- package/dist/src/agent/sdk/runtime/isolation-env.js.map +1 -0
- package/dist/src/agent/sdk/runtime/line-parser.d.ts +11 -0
- package/dist/src/agent/sdk/runtime/line-parser.js +59 -0
- package/dist/src/agent/sdk/runtime/line-parser.js.map +1 -0
- package/dist/src/agent/sdk/runtime/output-pump.d.ts +20 -0
- package/dist/src/agent/sdk/runtime/output-pump.js +88 -0
- package/dist/src/agent/sdk/runtime/output-pump.js.map +1 -0
- package/dist/src/agent/sdk/runtime/process-group.d.ts +9 -0
- package/dist/src/agent/sdk/runtime/process-group.js +69 -0
- package/dist/src/agent/sdk/runtime/process-group.js.map +1 -0
- package/dist/src/agent/sdk/runtime/provider-supervisor-entrypoint.d.ts +1 -0
- package/dist/src/agent/sdk/runtime/provider-supervisor-entrypoint.js +3 -0
- package/dist/src/agent/sdk/runtime/provider-supervisor-entrypoint.js.map +1 -0
- package/dist/src/agent/sdk/runtime/provider-supervisor.d.ts +1 -0
- package/dist/src/agent/sdk/runtime/provider-supervisor.js +190 -0
- package/dist/src/agent/sdk/runtime/provider-supervisor.js.map +1 -0
- package/dist/src/agent/sdk/runtime/spawn-process.d.ts +7 -0
- package/dist/src/agent/sdk/runtime/spawn-process.js +16 -0
- package/dist/src/agent/sdk/runtime/spawn-process.js.map +1 -0
- package/dist/src/agent/sdk/runtime/spawn-supervised-process.d.ts +17 -0
- package/dist/src/agent/sdk/runtime/spawn-supervised-process.js +203 -0
- package/dist/src/agent/sdk/runtime/spawn-supervised-process.js.map +1 -0
- package/dist/src/agent/sdk/runtime/supervisor-protocol.d.ts +29 -0
- package/dist/src/agent/sdk/runtime/supervisor-protocol.js +90 -0
- package/dist/src/agent/sdk/runtime/supervisor-protocol.js.map +1 -0
- package/dist/src/agent/sdk/runtime/timeouts.d.ts +24 -0
- package/dist/src/agent/sdk/runtime/timeouts.js +65 -0
- package/dist/src/agent/sdk/runtime/timeouts.js.map +1 -0
- package/dist/src/agent/sdk/session-manager.d.ts +38 -0
- package/dist/src/agent/sdk/session-manager.js +557 -0
- package/dist/src/agent/sdk/session-manager.js.map +1 -0
- package/dist/src/agent/sdk/transport/json-stream-decoder.d.ts +6 -0
- package/dist/src/agent/sdk/transport/json-stream-decoder.js +29 -0
- package/dist/src/agent/sdk/transport/json-stream-decoder.js.map +1 -0
- package/dist/src/agent/sdk/transport/line-text-decoder.d.ts +6 -0
- package/dist/src/agent/sdk/transport/line-text-decoder.js +9 -0
- package/dist/src/agent/sdk/transport/line-text-decoder.js.map +1 -0
- package/dist/src/agent/sdk/transport/pty-contract.d.ts +12 -0
- package/dist/src/agent/sdk/transport/pty-contract.js +2 -0
- package/dist/src/agent/sdk/transport/pty-contract.js.map +1 -0
- package/dist/src/agent/sdk/types.d.ts +194 -0
- package/dist/src/agent/sdk/types.js +2 -0
- package/dist/src/agent/sdk/types.js.map +1 -0
- package/dist/src/agent/sdk/versioning/provider-version.d.ts +9 -0
- package/dist/src/agent/sdk/versioning/provider-version.js +41 -0
- package/dist/src/agent/sdk/versioning/provider-version.js.map +1 -0
- package/dist/src/cli.d.ts +7 -0
- package/dist/src/cli.js +56 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/commands/config/command.d.ts +2 -0
- package/dist/src/commands/config/command.js +150 -0
- package/dist/src/commands/config/command.js.map +1 -0
- package/dist/src/commands/connect/command.d.ts +4 -0
- package/dist/src/commands/connect/command.js +19 -0
- package/dist/src/commands/connect/command.js.map +1 -0
- package/dist/src/commands/connect/workflow.d.ts +92 -0
- package/dist/src/commands/connect/workflow.js +381 -0
- package/dist/src/commands/connect/workflow.js.map +1 -0
- package/dist/src/commands/devcontainer/command.d.ts +2 -0
- package/dist/src/commands/devcontainer/command.js +49 -0
- package/dist/src/commands/devcontainer/command.js.map +1 -0
- package/dist/src/commands/devcontainer/install.d.ts +46 -0
- package/dist/src/commands/devcontainer/install.js +107 -0
- package/dist/src/commands/devcontainer/install.js.map +1 -0
- package/dist/src/commands/init/config/claude-mcp.d.ts +27 -0
- package/dist/src/commands/init/config/claude-mcp.js +56 -0
- package/dist/src/commands/init/config/claude-mcp.js.map +1 -0
- package/dist/src/commands/init/config/codex-mcp.d.ts +12 -0
- package/dist/src/commands/init/config/codex-mcp.js +83 -0
- package/dist/src/commands/init/config/codex-mcp.js.map +1 -0
- package/dist/src/commands/init/config/opencode-mcp.d.ts +16 -0
- package/dist/src/commands/init/config/opencode-mcp.js +55 -0
- package/dist/src/commands/init/config/opencode-mcp.js.map +1 -0
- package/dist/src/commands/init/errors.d.ts +3 -0
- package/dist/src/commands/init/errors.js +7 -0
- package/dist/src/commands/init/errors.js.map +1 -0
- package/dist/src/commands/init/index.d.ts +9 -0
- package/dist/src/commands/init/index.js +10 -0
- package/dist/src/commands/init/index.js.map +1 -0
- package/dist/src/commands/init/io/file-copy.d.ts +18 -0
- package/dist/src/commands/init/io/file-copy.js +129 -0
- package/dist/src/commands/init/io/file-copy.js.map +1 -0
- package/dist/src/commands/init/marketplace.d.ts +8 -0
- package/dist/src/commands/init/marketplace.js +25 -0
- package/dist/src/commands/init/marketplace.js.map +1 -0
- package/dist/src/commands/init/mcp-service.d.ts +2 -0
- package/dist/src/commands/init/mcp-service.js +66 -0
- package/dist/src/commands/init/mcp-service.js.map +1 -0
- package/dist/src/commands/init/parsers.d.ts +4 -0
- package/dist/src/commands/init/parsers.js +40 -0
- package/dist/src/commands/init/parsers.js.map +1 -0
- package/dist/src/commands/init/prompts.d.ts +4 -0
- package/dist/src/commands/init/prompts.js +72 -0
- package/dist/src/commands/init/prompts.js.map +1 -0
- package/dist/src/commands/init/skill-service.d.ts +2 -0
- package/dist/src/commands/init/skill-service.js +36 -0
- package/dist/src/commands/init/skill-service.js.map +1 -0
- package/dist/src/commands/init/summary.d.ts +2 -0
- package/dist/src/commands/init/summary.js +22 -0
- package/dist/src/commands/init/summary.js.map +1 -0
- package/dist/src/commands/init/targets/claude.d.ts +4 -0
- package/dist/src/commands/init/targets/claude.js +178 -0
- package/dist/src/commands/init/targets/claude.js.map +1 -0
- package/dist/src/commands/init/targets/codex.d.ts +4 -0
- package/dist/src/commands/init/targets/codex.js +75 -0
- package/dist/src/commands/init/targets/codex.js.map +1 -0
- package/dist/src/commands/init/targets/driver.d.ts +28 -0
- package/dist/src/commands/init/targets/driver.js +2 -0
- package/dist/src/commands/init/targets/driver.js.map +1 -0
- package/dist/src/commands/init/targets/opencode.d.ts +4 -0
- package/dist/src/commands/init/targets/opencode.js +77 -0
- package/dist/src/commands/init/targets/opencode.js.map +1 -0
- package/dist/src/commands/init/targets/registry.d.ts +4 -0
- package/dist/src/commands/init/targets/registry.js +15 -0
- package/dist/src/commands/init/targets/registry.js.map +1 -0
- package/dist/src/commands/init/types.d.ts +30 -0
- package/dist/src/commands/init/types.js +7 -0
- package/dist/src/commands/init/types.js.map +1 -0
- package/dist/src/commands/init.d.ts +3 -0
- package/dist/src/commands/init.js +143 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/keys/command.d.ts +2 -0
- package/dist/src/commands/keys/command.js +154 -0
- package/dist/src/commands/keys/command.js.map +1 -0
- package/dist/src/commands/labels/create.d.ts +2 -0
- package/dist/src/commands/labels/create.js +31 -0
- package/dist/src/commands/labels/create.js.map +1 -0
- package/dist/src/commands/labels/delete.d.ts +2 -0
- package/dist/src/commands/labels/delete.js +51 -0
- package/dist/src/commands/labels/delete.js.map +1 -0
- package/dist/src/commands/labels/formatters.d.ts +4 -0
- package/dist/src/commands/labels/formatters.js +6 -0
- package/dist/src/commands/labels/formatters.js.map +1 -0
- package/dist/src/commands/labels/index.d.ts +2 -0
- package/dist/src/commands/labels/index.js +13 -0
- package/dist/src/commands/labels/index.js.map +1 -0
- package/dist/src/commands/labels/list.d.ts +2 -0
- package/dist/src/commands/labels/list.js +29 -0
- package/dist/src/commands/labels/list.js.map +1 -0
- package/dist/src/commands/labels/resolve.d.ts +9 -0
- package/dist/src/commands/labels/resolve.js +23 -0
- package/dist/src/commands/labels/resolve.js.map +1 -0
- package/dist/src/commands/labels/update.d.ts +2 -0
- package/dist/src/commands/labels/update.js +37 -0
- package/dist/src/commands/labels/update.js.map +1 -0
- package/dist/src/commands/lists/constants.d.ts +7 -0
- package/dist/src/commands/lists/constants.js +14 -0
- package/dist/src/commands/lists/constants.js.map +1 -0
- package/dist/src/commands/lists/create.d.ts +2 -0
- package/dist/src/commands/lists/create.js +45 -0
- package/dist/src/commands/lists/create.js.map +1 -0
- package/dist/src/commands/lists/index.d.ts +2 -0
- package/dist/src/commands/lists/index.js +10 -0
- package/dist/src/commands/lists/index.js.map +1 -0
- package/dist/src/commands/lists/list.d.ts +2 -0
- package/dist/src/commands/lists/list.js +66 -0
- package/dist/src/commands/lists/list.js.map +1 -0
- package/dist/src/commands/lists/resolve.d.ts +11 -0
- package/dist/src/commands/lists/resolve.js +24 -0
- package/dist/src/commands/lists/resolve.js.map +1 -0
- package/dist/src/commands/lists/update.d.ts +2 -0
- package/dist/src/commands/lists/update.js +61 -0
- package/dist/src/commands/lists/update.js.map +1 -0
- package/dist/src/commands/login/command.d.ts +8 -0
- package/dist/src/commands/login/command.js +20 -0
- package/dist/src/commands/login/command.js.map +1 -0
- package/dist/src/commands/orgs/index.d.ts +2 -0
- package/dist/src/commands/orgs/index.js +6 -0
- package/dist/src/commands/orgs/index.js.map +1 -0
- package/dist/src/commands/orgs/list.d.ts +2 -0
- package/dist/src/commands/orgs/list.js +29 -0
- package/dist/src/commands/orgs/list.js.map +1 -0
- package/dist/src/commands/paths/command.d.ts +2 -0
- package/dist/src/commands/paths/command.js +90 -0
- package/dist/src/commands/paths/command.js.map +1 -0
- package/dist/src/commands/profiles/index.d.ts +2 -0
- package/dist/src/commands/profiles/index.js +6 -0
- package/dist/src/commands/profiles/index.js.map +1 -0
- package/dist/src/commands/profiles/list.d.ts +2 -0
- package/dist/src/commands/profiles/list.js +50 -0
- package/dist/src/commands/profiles/list.js.map +1 -0
- package/dist/src/commands/project-agents/create.d.ts +2 -0
- package/dist/src/commands/project-agents/create.js +53 -0
- package/dist/src/commands/project-agents/create.js.map +1 -0
- package/dist/src/commands/project-agents/index.d.ts +2 -0
- package/dist/src/commands/project-agents/index.js +10 -0
- package/dist/src/commands/project-agents/index.js.map +1 -0
- package/dist/src/commands/project-agents/list.d.ts +2 -0
- package/dist/src/commands/project-agents/list.js +30 -0
- package/dist/src/commands/project-agents/list.js.map +1 -0
- package/dist/src/commands/project-agents/parsers.d.ts +16 -0
- package/dist/src/commands/project-agents/parsers.js +80 -0
- package/dist/src/commands/project-agents/parsers.js.map +1 -0
- package/dist/src/commands/project-agents/update.d.ts +2 -0
- package/dist/src/commands/project-agents/update.js +74 -0
- package/dist/src/commands/project-agents/update.js.map +1 -0
- package/dist/src/commands/projects/index.d.ts +2 -0
- package/dist/src/commands/projects/index.js +6 -0
- package/dist/src/commands/projects/index.js.map +1 -0
- package/dist/src/commands/projects/list.d.ts +2 -0
- package/dist/src/commands/projects/list.js +41 -0
- package/dist/src/commands/projects/list.js.map +1 -0
- package/dist/src/commands/prompts/create.d.ts +2 -0
- package/dist/src/commands/prompts/create.js +48 -0
- package/dist/src/commands/prompts/create.js.map +1 -0
- package/dist/src/commands/prompts/formatters.d.ts +4 -0
- package/dist/src/commands/prompts/formatters.js +7 -0
- package/dist/src/commands/prompts/formatters.js.map +1 -0
- package/dist/src/commands/prompts/index.d.ts +2 -0
- package/dist/src/commands/prompts/index.js +11 -0
- package/dist/src/commands/prompts/index.js.map +1 -0
- package/dist/src/commands/prompts/list.d.ts +2 -0
- package/dist/src/commands/prompts/list.js +34 -0
- package/dist/src/commands/prompts/list.js.map +1 -0
- package/dist/src/commands/prompts/parsers.d.ts +9 -0
- package/dist/src/commands/prompts/parsers.js +12 -0
- package/dist/src/commands/prompts/parsers.js.map +1 -0
- package/dist/src/commands/prompts/resolve.d.ts +17 -0
- package/dist/src/commands/prompts/resolve.js +43 -0
- package/dist/src/commands/prompts/resolve.js.map +1 -0
- package/dist/src/commands/prompts/update.d.ts +2 -0
- package/dist/src/commands/prompts/update.js +58 -0
- package/dist/src/commands/prompts/update.js.map +1 -0
- package/dist/src/commands/setup/command.d.ts +2 -0
- package/dist/src/commands/setup/command.js +15 -0
- package/dist/src/commands/setup/command.js.map +1 -0
- package/dist/src/commands/setup/prompts.d.ts +66 -0
- package/dist/src/commands/setup/prompts.js +199 -0
- package/dist/src/commands/setup/prompts.js.map +1 -0
- package/dist/src/commands/setup/workflow.d.ts +17 -0
- package/dist/src/commands/setup/workflow.js +141 -0
- package/dist/src/commands/setup/workflow.js.map +1 -0
- package/dist/src/commands/status/command.d.ts +2 -0
- package/dist/src/commands/status/command.js +83 -0
- package/dist/src/commands/status/command.js.map +1 -0
- package/dist/src/commands/task-types/index.d.ts +2 -0
- package/dist/src/commands/task-types/index.js +6 -0
- package/dist/src/commands/task-types/index.js.map +1 -0
- package/dist/src/commands/task-types/list.d.ts +2 -0
- package/dist/src/commands/task-types/list.js +32 -0
- package/dist/src/commands/task-types/list.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/comments/add.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/comments/add.js +32 -0
- package/dist/src/commands/tasks/artifacts/comments/add.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/comments/formatters.d.ts +7 -0
- package/dist/src/commands/tasks/artifacts/comments/formatters.js +32 -0
- package/dist/src/commands/tasks/artifacts/comments/formatters.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/comments/index.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/comments/index.js +13 -0
- package/dist/src/commands/tasks/artifacts/comments/index.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/comments/list.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/comments/list.js +24 -0
- package/dist/src/commands/tasks/artifacts/comments/list.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/comments/parsers.d.ts +6 -0
- package/dist/src/commands/tasks/artifacts/comments/parsers.js +8 -0
- package/dist/src/commands/tasks/artifacts/comments/parsers.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/comments/reply.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/comments/reply.js +23 -0
- package/dist/src/commands/tasks/artifacts/comments/reply.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/comments/resolve.d.ts +3 -0
- package/dist/src/commands/tasks/artifacts/comments/resolve.js +26 -0
- package/dist/src/commands/tasks/artifacts/comments/resolve.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/create.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/create.js +63 -0
- package/dist/src/commands/tasks/artifacts/create.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/delete.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/delete.js +27 -0
- package/dist/src/commands/tasks/artifacts/delete.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/get.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/get.js +54 -0
- package/dist/src/commands/tasks/artifacts/get.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/index.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/index.js +18 -0
- package/dist/src/commands/tasks/artifacts/index.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/list.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/list.js +31 -0
- package/dist/src/commands/tasks/artifacts/list.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/parsers.d.ts +13 -0
- package/dist/src/commands/tasks/artifacts/parsers.js +24 -0
- package/dist/src/commands/tasks/artifacts/parsers.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/replace.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/replace.js +62 -0
- package/dist/src/commands/tasks/artifacts/replace.js.map +1 -0
- package/dist/src/commands/tasks/artifacts/update.d.ts +2 -0
- package/dist/src/commands/tasks/artifacts/update.js +55 -0
- package/dist/src/commands/tasks/artifacts/update.js.map +1 -0
- package/dist/src/commands/tasks/attach.d.ts +2 -0
- package/dist/src/commands/tasks/attach.js +70 -0
- package/dist/src/commands/tasks/attach.js.map +1 -0
- package/dist/src/commands/tasks/attachments/delete.d.ts +2 -0
- package/dist/src/commands/tasks/attachments/delete.js +61 -0
- package/dist/src/commands/tasks/attachments/delete.js.map +1 -0
- package/dist/src/commands/tasks/attachments/download.d.ts +2 -0
- package/dist/src/commands/tasks/attachments/download.js +42 -0
- package/dist/src/commands/tasks/attachments/download.js.map +1 -0
- package/dist/src/commands/tasks/attachments/formatters.d.ts +5 -0
- package/dist/src/commands/tasks/attachments/formatters.js +18 -0
- package/dist/src/commands/tasks/attachments/formatters.js.map +1 -0
- package/dist/src/commands/tasks/attachments/index.d.ts +2 -0
- package/dist/src/commands/tasks/attachments/index.js +11 -0
- package/dist/src/commands/tasks/attachments/index.js.map +1 -0
- package/dist/src/commands/tasks/attachments/list.d.ts +2 -0
- package/dist/src/commands/tasks/attachments/list.js +36 -0
- package/dist/src/commands/tasks/attachments/list.js.map +1 -0
- package/dist/src/commands/tasks/attachments/resolve.d.ts +6 -0
- package/dist/src/commands/tasks/attachments/resolve.js +15 -0
- package/dist/src/commands/tasks/attachments/resolve.js.map +1 -0
- package/dist/src/commands/tasks/attachments/transfer.d.ts +11 -0
- package/dist/src/commands/tasks/attachments/transfer.js +71 -0
- package/dist/src/commands/tasks/attachments/transfer.js.map +1 -0
- package/dist/src/commands/tasks/comments/add.d.ts +2 -0
- package/dist/src/commands/tasks/comments/add.js +44 -0
- package/dist/src/commands/tasks/comments/add.js.map +1 -0
- package/dist/src/commands/tasks/comments/index.d.ts +2 -0
- package/dist/src/commands/tasks/comments/index.js +6 -0
- package/dist/src/commands/tasks/comments/index.js.map +1 -0
- package/dist/src/commands/tasks/create.d.ts +2 -0
- package/dist/src/commands/tasks/create.js +77 -0
- package/dist/src/commands/tasks/create.js.map +1 -0
- package/dist/src/commands/tasks/delete.d.ts +2 -0
- package/dist/src/commands/tasks/delete.js +31 -0
- package/dist/src/commands/tasks/delete.js.map +1 -0
- package/dist/src/commands/tasks/formatters.d.ts +25 -0
- package/dist/src/commands/tasks/formatters.js +40 -0
- package/dist/src/commands/tasks/formatters.js.map +1 -0
- package/dist/src/commands/tasks/get.d.ts +2 -0
- package/dist/src/commands/tasks/get.js +94 -0
- package/dist/src/commands/tasks/get.js.map +1 -0
- package/dist/src/commands/tasks/hydrate.d.ts +20 -0
- package/dist/src/commands/tasks/hydrate.js +47 -0
- package/dist/src/commands/tasks/hydrate.js.map +1 -0
- package/dist/src/commands/tasks/index.d.ts +2 -0
- package/dist/src/commands/tasks/index.js +33 -0
- package/dist/src/commands/tasks/index.js.map +1 -0
- package/dist/src/commands/tasks/links.d.ts +4 -0
- package/dist/src/commands/tasks/links.js +121 -0
- package/dist/src/commands/tasks/links.js.map +1 -0
- package/dist/src/commands/tasks/list.d.ts +2 -0
- package/dist/src/commands/tasks/list.js +47 -0
- package/dist/src/commands/tasks/list.js.map +1 -0
- package/dist/src/commands/tasks/move-to-list.d.ts +2 -0
- package/dist/src/commands/tasks/move-to-list.js +41 -0
- package/dist/src/commands/tasks/move-to-list.js.map +1 -0
- package/dist/src/commands/tasks/move.d.ts +2 -0
- package/dist/src/commands/tasks/move.js +61 -0
- package/dist/src/commands/tasks/move.js.map +1 -0
- package/dist/src/commands/tasks/parsers.d.ts +22 -0
- package/dist/src/commands/tasks/parsers.js +118 -0
- package/dist/src/commands/tasks/parsers.js.map +1 -0
- package/dist/src/commands/tasks/refs.d.ts +2 -0
- package/dist/src/commands/tasks/refs.js +89 -0
- package/dist/src/commands/tasks/refs.js.map +1 -0
- package/dist/src/commands/tasks/resolve.d.ts +20 -0
- package/dist/src/commands/tasks/resolve.js +57 -0
- package/dist/src/commands/tasks/resolve.js.map +1 -0
- package/dist/src/commands/tasks/search.d.ts +2 -0
- package/dist/src/commands/tasks/search.js +110 -0
- package/dist/src/commands/tasks/search.js.map +1 -0
- package/dist/src/commands/tasks/update.d.ts +2 -0
- package/dist/src/commands/tasks/update.js +101 -0
- package/dist/src/commands/tasks/update.js.map +1 -0
- package/dist/src/commands/test-helpers.d.ts +2 -0
- package/dist/src/commands/test-helpers.js +6 -0
- package/dist/src/commands/test-helpers.js.map +1 -0
- package/dist/src/commands/threads/create.d.ts +2 -0
- package/dist/src/commands/threads/create.js +99 -0
- package/dist/src/commands/threads/create.js.map +1 -0
- package/dist/src/commands/threads/formatters.d.ts +10 -0
- package/dist/src/commands/threads/formatters.js +17 -0
- package/dist/src/commands/threads/formatters.js.map +1 -0
- package/dist/src/commands/threads/get.d.ts +2 -0
- package/dist/src/commands/threads/get.js +53 -0
- package/dist/src/commands/threads/get.js.map +1 -0
- package/dist/src/commands/threads/index.d.ts +2 -0
- package/dist/src/commands/threads/index.js +14 -0
- package/dist/src/commands/threads/index.js.map +1 -0
- package/dist/src/commands/threads/list.d.ts +2 -0
- package/dist/src/commands/threads/list.js +69 -0
- package/dist/src/commands/threads/list.js.map +1 -0
- package/dist/src/commands/threads/messages.d.ts +2 -0
- package/dist/src/commands/threads/messages.js +59 -0
- package/dist/src/commands/threads/messages.js.map +1 -0
- package/dist/src/commands/threads/parsers.d.ts +5 -0
- package/dist/src/commands/threads/parsers.js +19 -0
- package/dist/src/commands/threads/parsers.js.map +1 -0
- package/dist/src/commands/threads/send.d.ts +2 -0
- package/dist/src/commands/threads/send.js +49 -0
- package/dist/src/commands/threads/send.js.map +1 -0
- package/dist/src/commands/threads/spawn-target.d.ts +29 -0
- package/dist/src/commands/threads/spawn-target.js +62 -0
- package/dist/src/commands/threads/spawn-target.js.map +1 -0
- package/dist/src/convex/_generated/ai/ai-files.state.json +6 -0
- package/dist/src/convex/_generated/ai/guidelines.md +371 -0
- package/dist/src/convex/_generated/api.d.ts +598 -0
- package/dist/src/convex/_generated/api.js +23 -0
- package/dist/src/convex/_generated/dataModel.d.ts +60 -0
- package/dist/src/convex/_generated/server.d.ts +143 -0
- package/dist/src/convex/_generated/server.js +93 -0
- package/dist/src/lib/argv.d.ts +1 -0
- package/dist/src/lib/argv.js +7 -0
- package/dist/src/lib/argv.js.map +1 -0
- package/dist/src/lib/browser-login.d.ts +43 -0
- package/dist/src/lib/browser-login.js +216 -0
- package/dist/src/lib/browser-login.js.map +1 -0
- package/dist/src/lib/config/convex-client.d.ts +41 -0
- package/dist/src/lib/config/convex-client.js +53 -0
- package/dist/src/lib/config/convex-client.js.map +1 -0
- package/dist/src/lib/config/index.d.ts +7 -0
- package/dist/src/lib/config/index.js +13 -0
- package/dist/src/lib/config/index.js.map +1 -0
- package/dist/src/lib/config/profile.d.ts +40 -0
- package/dist/src/lib/config/profile.js +155 -0
- package/dist/src/lib/config/profile.js.map +1 -0
- package/dist/src/lib/config/provider-keys.d.ts +47 -0
- package/dist/src/lib/config/provider-keys.js +97 -0
- package/dist/src/lib/config/provider-keys.js.map +1 -0
- package/dist/src/lib/config/toml.d.ts +78 -0
- package/dist/src/lib/config/toml.js +228 -0
- package/dist/src/lib/config/toml.js.map +1 -0
- package/dist/src/lib/config/types.d.ts +98 -0
- package/dist/src/lib/config/types.js +65 -0
- package/dist/src/lib/config/types.js.map +1 -0
- package/dist/src/lib/config/validate.d.ts +30 -0
- package/dist/src/lib/config/validate.js +66 -0
- package/dist/src/lib/config/validate.js.map +1 -0
- package/dist/src/lib/connect-events.d.ts +42 -0
- package/dist/src/lib/connect-events.js +65 -0
- package/dist/src/lib/connect-events.js.map +1 -0
- package/dist/src/lib/constants.d.ts +20 -0
- package/dist/src/lib/constants.js +27 -0
- package/dist/src/lib/constants.js.map +1 -0
- package/dist/src/lib/content-type.d.ts +1 -0
- package/dist/src/lib/content-type.js +27 -0
- package/dist/src/lib/content-type.js.map +1 -0
- package/dist/src/lib/convex-error.d.ts +12 -0
- package/dist/src/lib/convex-error.js +33 -0
- package/dist/src/lib/convex-error.js.map +1 -0
- package/dist/src/lib/git/checkpoint.d.ts +74 -0
- package/dist/src/lib/git/checkpoint.js +210 -0
- package/dist/src/lib/git/checkpoint.js.map +1 -0
- package/dist/src/lib/git/exec.d.ts +23 -0
- package/dist/src/lib/git/exec.js +46 -0
- package/dist/src/lib/git/exec.js.map +1 -0
- package/dist/src/lib/git/file-index.d.ts +8 -0
- package/dist/src/lib/git/file-index.js +125 -0
- package/dist/src/lib/git/file-index.js.map +1 -0
- package/dist/src/lib/git/index.d.ts +5 -0
- package/dist/src/lib/git/index.js +6 -0
- package/dist/src/lib/git/index.js.map +1 -0
- package/dist/src/lib/git/repo.d.ts +32 -0
- package/dist/src/lib/git/repo.js +95 -0
- package/dist/src/lib/git/repo.js.map +1 -0
- package/dist/src/lib/git/worktrees.d.ts +49 -0
- package/dist/src/lib/git/worktrees.js +97 -0
- package/dist/src/lib/git/worktrees.js.map +1 -0
- package/dist/src/lib/global-options.d.ts +3 -0
- package/dist/src/lib/global-options.js +8 -0
- package/dist/src/lib/global-options.js.map +1 -0
- package/dist/src/lib/id.d.ts +3 -0
- package/dist/src/lib/id.js +14 -0
- package/dist/src/lib/id.js.map +1 -0
- package/dist/src/lib/one-shot-command.d.ts +7 -0
- package/dist/src/lib/one-shot-command.js +30 -0
- package/dist/src/lib/one-shot-command.js.map +1 -0
- package/dist/src/lib/one-shot-config.d.ts +3 -0
- package/dist/src/lib/one-shot-config.js +7 -0
- package/dist/src/lib/one-shot-config.js.map +1 -0
- package/dist/src/lib/output.d.ts +10 -0
- package/dist/src/lib/output.js +27 -0
- package/dist/src/lib/output.js.map +1 -0
- package/dist/src/lib/pagination.d.ts +16 -0
- package/dist/src/lib/pagination.js +45 -0
- package/dist/src/lib/pagination.js.map +1 -0
- package/dist/src/lib/parsers.d.ts +2 -0
- package/dist/src/lib/parsers.js +21 -0
- package/dist/src/lib/parsers.js.map +1 -0
- package/dist/src/lib/project-resolution.d.ts +41 -0
- package/dist/src/lib/project-resolution.js +84 -0
- package/dist/src/lib/project-resolution.js.map +1 -0
- package/dist/src/lib/pull-requests.d.ts +47 -0
- package/dist/src/lib/pull-requests.js +305 -0
- package/dist/src/lib/pull-requests.js.map +1 -0
- package/dist/src/lib/skill-install-guidance.d.ts +5 -0
- package/dist/src/lib/skill-install-guidance.js +41 -0
- package/dist/src/lib/skill-install-guidance.js.map +1 -0
- package/dist/src/lib/text-input.d.ts +18 -0
- package/dist/src/lib/text-input.js +36 -0
- package/dist/src/lib/text-input.js.map +1 -0
- package/dist/src/lib/thread-attachments.d.ts +21 -0
- package/dist/src/lib/thread-attachments.js +104 -0
- package/dist/src/lib/thread-attachments.js.map +1 -0
- package/dist/src/lib/url.d.ts +13 -0
- package/dist/src/lib/url.js +25 -0
- package/dist/src/lib/url.js.map +1 -0
- package/dist/src/lib/version.d.ts +2 -0
- package/dist/src/lib/version.js +33 -0
- package/dist/src/lib/version.js.map +1 -0
- package/dist/templates/devcontainer/Dockerfile +95 -0
- package/dist/templates/devcontainer/README.md +129 -0
- package/dist/templates/devcontainer/devcontainer.json +92 -0
- package/dist/templates/devcontainer/init-firewall.sh +271 -0
- package/package.json +79 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { api } from "../convex/_generated/api.js";
|
|
2
|
+
import { getGlobalProjectOption } from "./global-options.js";
|
|
3
|
+
import { parseId } from "./id.js";
|
|
4
|
+
export function filterProjectsByOrgRef(projects, orgRef) {
|
|
5
|
+
const normalized = orgRef.trim().toLowerCase();
|
|
6
|
+
return projects.filter((project) => project.organizationId === orgRef ||
|
|
7
|
+
project.organizationSlug.toLowerCase() === normalized);
|
|
8
|
+
}
|
|
9
|
+
function selectProjectCandidates(projects, projectRef) {
|
|
10
|
+
const idMatches = projects.filter((project) => project._id === projectRef);
|
|
11
|
+
if (idMatches.length > 0) {
|
|
12
|
+
return idMatches;
|
|
13
|
+
}
|
|
14
|
+
const normalizedAlias = projectRef.trim().toUpperCase();
|
|
15
|
+
return projects.filter((project) => project.alias.toUpperCase() === normalizedAlias);
|
|
16
|
+
}
|
|
17
|
+
export function resolveProjectId(args) {
|
|
18
|
+
const { projects, defaultProjectId, projectRef, orgRef } = args;
|
|
19
|
+
if (orgRef && !projectRef) {
|
|
20
|
+
throw new Error("--org requires --project");
|
|
21
|
+
}
|
|
22
|
+
if (!projectRef) {
|
|
23
|
+
if (defaultProjectId) {
|
|
24
|
+
return defaultProjectId;
|
|
25
|
+
}
|
|
26
|
+
throw new Error("No project configured. Pass --project or run 'convoy setup' with a project.");
|
|
27
|
+
}
|
|
28
|
+
let matches = selectProjectCandidates(projects, projectRef);
|
|
29
|
+
if (orgRef) {
|
|
30
|
+
matches = filterProjectsByOrgRef(matches, orgRef);
|
|
31
|
+
}
|
|
32
|
+
if (matches.length === 0) {
|
|
33
|
+
if (orgRef) {
|
|
34
|
+
throw new Error(`Project "${projectRef}" was not found for organization "${orgRef}".`);
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`Project "${projectRef}" was not found or not accessible.`);
|
|
37
|
+
}
|
|
38
|
+
if (matches.length > 1) {
|
|
39
|
+
const organizations = matches
|
|
40
|
+
.map((project) => `${project.organizationSlug}/${project.alias}`)
|
|
41
|
+
.join(", ");
|
|
42
|
+
throw new Error(`Project "${projectRef}" is ambiguous across organizations (${organizations}). Pass --org <orgId|orgSlug>.`);
|
|
43
|
+
}
|
|
44
|
+
return matches[0]._id;
|
|
45
|
+
}
|
|
46
|
+
/** Resolves `--project`/`--org` against an already-fetched project list. */
|
|
47
|
+
export function resolveProjectIdFromCommand(projects, config, cmd, orgRef) {
|
|
48
|
+
return parseId(resolveProjectId({
|
|
49
|
+
projects,
|
|
50
|
+
defaultProjectId: config.projectId,
|
|
51
|
+
projectRef: getGlobalProjectOption(cmd),
|
|
52
|
+
orgRef,
|
|
53
|
+
}), "projectId");
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The one-shot project preamble: list accessible projects, resolve the ref, brand
|
|
57
|
+
* the ID. `projects` comes back for callers that also resolve task refs.
|
|
58
|
+
*/
|
|
59
|
+
export async function resolveProjectFromCommand(client, config, cmd, orgRef) {
|
|
60
|
+
const projects = await client.query(api.projects.core.listAccessible, {});
|
|
61
|
+
return {
|
|
62
|
+
projects,
|
|
63
|
+
projectId: resolveProjectIdFromCommand(projects, config, cmd, orgRef),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Memberships are the source of truth for which organizations exist; projects
|
|
68
|
+
* only supply the counts. Deriving the list from projects instead would hide
|
|
69
|
+
* an organization the caller belongs to but whose projects it cannot reach.
|
|
70
|
+
*/
|
|
71
|
+
export function summarizeOrganizations(organizations, projects) {
|
|
72
|
+
const projectCounts = new Map();
|
|
73
|
+
for (const project of projects) {
|
|
74
|
+
projectCounts.set(project.organizationId, (projectCounts.get(project.organizationId) ?? 0) + 1);
|
|
75
|
+
}
|
|
76
|
+
const rows = organizations.map((org) => ({
|
|
77
|
+
organizationId: org._id,
|
|
78
|
+
organizationSlug: org.slug,
|
|
79
|
+
organizationName: org.name,
|
|
80
|
+
projectCount: projectCounts.get(org._id) ?? 0,
|
|
81
|
+
}));
|
|
82
|
+
return rows.sort((a, b) => a.organizationName.localeCompare(b.organizationName));
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=project-resolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-resolution.js","sourceRoot":"","sources":["../../../src/lib/project-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAKlD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAsBlC,MAAM,UAAU,sBAAsB,CACpC,QAA4B,EAC5B,MAAc;IAEd,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC/C,OAAO,QAAQ,CAAC,MAAM,CACpB,CAAC,OAA0B,EAAE,EAAE,CAC7B,OAAO,CAAC,cAAc,KAAK,MAAM;QACjC,OAAO,CAAC,gBAAgB,CAAC,WAAW,EAAE,KAAK,UAAU,CACxD,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAC9B,Q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B,aAAa,CAAC,GAAG,CACf,OAAO,CAAC,cAAc,EACtB,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CACrD,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAA0B,aAAa,CAAC,GAAG,CAAC,CAAC,GAA2B,EAAE,EAAE,CAAC,CAAC;QACtF,cAAc,EAAE,GAAG,CAAC,GAAG;QACvB,gBAAgB,EAAE,GAAG,CAAC,IAAI;QAC1B,gBAAgB,EAAE,GAAG,CAAC,IAAI;QAC1B,YAAY,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC;KAC9C,CAAC,CAAC,CAAC;IAEJ,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Last-known PR lookup for a thread's branch (OS-1370). Detects the forge from the origin
|
|
3
|
+
* remote host and lists change requests whose head branch equals the checked-out branch
|
|
4
|
+
* via the user's own forge CLI (`gh`/`glab`/`az`), so auth piggybacks on their logged-in
|
|
5
|
+
* tooling and this module stores no credentials. Bitbucket has no official CLI, so it is
|
|
6
|
+
* detect-only. See docs/specs/cli-thread-pr-badge.md.
|
|
7
|
+
*/
|
|
8
|
+
export type PullRequestProvider = "github" | "gitlab" | "azure-devops";
|
|
9
|
+
export type PullRequestState = "open" | "draft" | "merged" | "closed";
|
|
10
|
+
export interface PullRequestSnapshot {
|
|
11
|
+
provider: PullRequestProvider;
|
|
12
|
+
number: number;
|
|
13
|
+
title: string;
|
|
14
|
+
url: string;
|
|
15
|
+
state: PullRequestState;
|
|
16
|
+
headBranch: string;
|
|
17
|
+
baseBranch: string;
|
|
18
|
+
capturedAt: number;
|
|
19
|
+
}
|
|
20
|
+
/** A normalized change-request row plus the recency used for tie-breaking. */
|
|
21
|
+
export interface PullRequestCandidate extends Omit<PullRequestSnapshot, "capturedAt"> {
|
|
22
|
+
updatedAt: number;
|
|
23
|
+
}
|
|
24
|
+
/** Provider whose CLI we can query, or null for unrecognized hosts and Bitbucket. */
|
|
25
|
+
export declare function detectPullRequestProvider(remoteUrl: string): PullRequestProvider | null;
|
|
26
|
+
export declare function normalizeGitHubPullRequest(raw: unknown): PullRequestCandidate | null;
|
|
27
|
+
export declare function normalizeGitLabMergeRequest(raw: unknown): PullRequestCandidate | null;
|
|
28
|
+
export declare function normalizeAzureDevOpsPullRequest(raw: unknown): PullRequestCandidate | null;
|
|
29
|
+
/**
|
|
30
|
+
* Rows whose head branch equals the branch exactly; prefer an open/draft PR,
|
|
31
|
+
* otherwise the most recently updated. On the repo's default branch only an
|
|
32
|
+
* open PR is attributed — merged/closed matches there are reverse-merge noise.
|
|
33
|
+
*/
|
|
34
|
+
export declare function selectPullRequestCandidate(candidates: PullRequestCandidate[], branch: string, isDefaultBranch: boolean): PullRequestCandidate | null;
|
|
35
|
+
export declare function parsePullRequestList(raw: string, normalize: (row: unknown) => PullRequestCandidate | null): PullRequestCandidate[];
|
|
36
|
+
export interface PullRequestLookupSuccess {
|
|
37
|
+
/** null = successful lookup that found no PR (caller should clear the snapshot). */
|
|
38
|
+
pullRequest: PullRequestSnapshot | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolve the PR attributed to the branch checked out in `cwd`.
|
|
42
|
+
*
|
|
43
|
+
* Null when the lookup could not run or failed (non-git directory, detached HEAD,
|
|
44
|
+
* unrecognized provider, forge CLI missing/unauthenticated/errored) — the caller must
|
|
45
|
+
* then report nothing so the last-known snapshot survives.
|
|
46
|
+
*/
|
|
47
|
+
export declare function lookupThreadPullRequest(cwd: string): Promise<PullRequestLookupSuccess | null>;
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { getCurrentBranch, getDefaultBranch, getGitRemoteUrl } from "./git/index.js";
|
|
3
|
+
const LOOKUP_TIMEOUT_MS = 30_000;
|
|
4
|
+
const LOOKUP_LIMIT = 20;
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// Provider detection (host matching mirrors t3code's sourceControl.ts)
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
function parseRemoteHostname(remoteUrl) {
|
|
9
|
+
const trimmed = remoteUrl.trim();
|
|
10
|
+
if (!trimmed) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
// scp-like SSH syntax: git@host:owner/repo.git
|
|
14
|
+
const scpMatch = /^(?:[^@\s]+@)?([^:/\s]+):[^/]/.exec(trimmed);
|
|
15
|
+
if (scpMatch?.[1] && !trimmed.includes("://")) {
|
|
16
|
+
return scpMatch[1].toLowerCase();
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
return new URL(trimmed).hostname.toLowerCase();
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Provider whose CLI we can query, or null for unrecognized hosts and Bitbucket. */
|
|
26
|
+
export function detectPullRequestProvider(remoteUrl) {
|
|
27
|
+
const hostname = parseRemoteHostname(remoteUrl);
|
|
28
|
+
if (!hostname) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
if (hostname === "dev.azure.com" || hostname.endsWith(".visualstudio.com")) {
|
|
32
|
+
return "azure-devops";
|
|
33
|
+
}
|
|
34
|
+
if (hostname.includes("github")) {
|
|
35
|
+
return "github";
|
|
36
|
+
}
|
|
37
|
+
if (hostname.includes("gitlab")) {
|
|
38
|
+
return "gitlab";
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
// Untrusted-JSON narrowing helpers
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
function isRecord(value) {
|
|
46
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
47
|
+
}
|
|
48
|
+
function asString(value) {
|
|
49
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
50
|
+
}
|
|
51
|
+
function asNumber(value) {
|
|
52
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
53
|
+
}
|
|
54
|
+
function asTimestamp(value) {
|
|
55
|
+
const raw = asString(value);
|
|
56
|
+
if (!raw) {
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
const parsed = Date.parse(raw);
|
|
60
|
+
return Number.isNaN(parsed) ? 0 : parsed;
|
|
61
|
+
}
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// Per-provider normalization (raw CLI JSON row -> PullRequestCandidate)
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
export function normalizeGitHubPullRequest(raw) {
|
|
66
|
+
if (!isRecord(raw)) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
const number = asNumber(raw.number);
|
|
70
|
+
const title = asString(raw.title);
|
|
71
|
+
const url = asString(raw.url);
|
|
72
|
+
const headBranch = asString(raw.headRefName);
|
|
73
|
+
const baseBranch = asString(raw.baseRefName);
|
|
74
|
+
if (number === null || !title || !url || !headBranch || !baseBranch) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
const rawState = asString(raw.state)?.toUpperCase();
|
|
78
|
+
const merged = rawState === "MERGED" || asString(raw.mergedAt) !== null;
|
|
79
|
+
const state = merged
|
|
80
|
+
? "merged"
|
|
81
|
+
: rawState === "CLOSED"
|
|
82
|
+
? "closed"
|
|
83
|
+
: raw.isDraft === true
|
|
84
|
+
? "draft"
|
|
85
|
+
: "open";
|
|
86
|
+
return {
|
|
87
|
+
provider: "github",
|
|
88
|
+
number,
|
|
89
|
+
title,
|
|
90
|
+
url,
|
|
91
|
+
state,
|
|
92
|
+
headBranch,
|
|
93
|
+
baseBranch,
|
|
94
|
+
updatedAt: asTimestamp(raw.updatedAt),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export function normalizeGitLabMergeRequest(raw) {
|
|
98
|
+
if (!isRecord(raw)) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
const number = asNumber(raw.iid);
|
|
102
|
+
const title = asString(raw.title);
|
|
103
|
+
const url = asString(raw.web_url);
|
|
104
|
+
const headBranch = asString(raw.source_branch);
|
|
105
|
+
const baseBranch = asString(raw.target_branch);
|
|
106
|
+
if (number === null || !title || !url || !headBranch || !baseBranch) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
const rawState = asString(raw.state)?.toLowerCase();
|
|
110
|
+
const state = rawState === "merged"
|
|
111
|
+
? "merged"
|
|
112
|
+
: rawState === "closed"
|
|
113
|
+
? "closed"
|
|
114
|
+
: raw.draft === true
|
|
115
|
+
? "draft"
|
|
116
|
+
: "open";
|
|
117
|
+
return {
|
|
118
|
+
provider: "gitlab",
|
|
119
|
+
number,
|
|
120
|
+
title,
|
|
121
|
+
url,
|
|
122
|
+
state,
|
|
123
|
+
headBranch,
|
|
124
|
+
baseBranch,
|
|
125
|
+
updatedAt: asTimestamp(raw.updated_at),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function stripRefsHeads(refName) {
|
|
129
|
+
return refName.startsWith("refs/heads/") ? refName.slice("refs/heads/".length) : refName;
|
|
130
|
+
}
|
|
131
|
+
export function normalizeAzureDevOpsPullRequest(raw) {
|
|
132
|
+
if (!isRecord(raw)) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
const number = asNumber(raw.pullRequestId);
|
|
136
|
+
const title = asString(raw.title);
|
|
137
|
+
const sourceRefName = asString(raw.sourceRefName);
|
|
138
|
+
const targetRefName = asString(raw.targetRefName);
|
|
139
|
+
const repositoryWebUrl = isRecord(raw.repository) ? asString(raw.repository.webUrl) : null;
|
|
140
|
+
if (number === null || !title || !sourceRefName || !targetRefName || !repositoryWebUrl) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
const rawStatus = asString(raw.status)?.toLowerCase();
|
|
144
|
+
const state = rawStatus === "completed"
|
|
145
|
+
? "merged"
|
|
146
|
+
: rawStatus === "abandoned"
|
|
147
|
+
? "closed"
|
|
148
|
+
: raw.isDraft === true
|
|
149
|
+
? "draft"
|
|
150
|
+
: "open";
|
|
151
|
+
return {
|
|
152
|
+
provider: "azure-devops",
|
|
153
|
+
number,
|
|
154
|
+
title,
|
|
155
|
+
url: `${repositoryWebUrl.replace(/\/+$/, "")}/pullrequest/${number}`,
|
|
156
|
+
state,
|
|
157
|
+
headBranch: stripRefsHeads(sourceRefName),
|
|
158
|
+
baseBranch: stripRefsHeads(targetRefName),
|
|
159
|
+
updatedAt: asTimestamp(raw.closedDate) || asTimestamp(raw.creationDate),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
// Candidate selection
|
|
164
|
+
// ---------------------------------------------------------------------------
|
|
165
|
+
function isOpenState(state) {
|
|
166
|
+
return state === "open" || state === "draft";
|
|
167
|
+
}
|
|
168
|
+
function mostRecent(candidates) {
|
|
169
|
+
let best = null;
|
|
170
|
+
for (const candidate of candidates) {
|
|
171
|
+
if (!best || candidate.updatedAt > best.updatedAt) {
|
|
172
|
+
best = candidate;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return best;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Rows whose head branch equals the branch exactly; prefer an open/draft PR,
|
|
179
|
+
* otherwise the most recently updated. On the repo's default branch only an
|
|
180
|
+
* open PR is attributed — merged/closed matches there are reverse-merge noise.
|
|
181
|
+
*/
|
|
182
|
+
export function selectPullRequestCandidate(candidates, branch, isDefaultBranch) {
|
|
183
|
+
const matches = candidates.filter((candidate) => candidate.headBranch === branch);
|
|
184
|
+
const open = mostRecent(matches.filter((candidate) => isOpenState(candidate.state)));
|
|
185
|
+
if (open) {
|
|
186
|
+
return open;
|
|
187
|
+
}
|
|
188
|
+
if (isDefaultBranch) {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
return mostRecent(matches);
|
|
192
|
+
}
|
|
193
|
+
// ---------------------------------------------------------------------------
|
|
194
|
+
// Forge CLI invocation
|
|
195
|
+
// ---------------------------------------------------------------------------
|
|
196
|
+
const PROVIDER_LOOKUPS = {
|
|
197
|
+
github: {
|
|
198
|
+
command: "gh",
|
|
199
|
+
args: (branch) => [
|
|
200
|
+
"pr",
|
|
201
|
+
"list",
|
|
202
|
+
"--head",
|
|
203
|
+
branch,
|
|
204
|
+
"--state",
|
|
205
|
+
"all",
|
|
206
|
+
"--limit",
|
|
207
|
+
String(LOOKUP_LIMIT),
|
|
208
|
+
"--json",
|
|
209
|
+
"number,title,url,state,isDraft,mergedAt,headRefName,baseRefName,updatedAt",
|
|
210
|
+
],
|
|
211
|
+
normalize: normalizeGitHubPullRequest,
|
|
212
|
+
},
|
|
213
|
+
gitlab: {
|
|
214
|
+
command: "glab",
|
|
215
|
+
args: (branch) => [
|
|
216
|
+
"mr",
|
|
217
|
+
"list",
|
|
218
|
+
"--source-branch",
|
|
219
|
+
branch,
|
|
220
|
+
"--all",
|
|
221
|
+
"--per-page",
|
|
222
|
+
String(LOOKUP_LIMIT),
|
|
223
|
+
"--output",
|
|
224
|
+
"json",
|
|
225
|
+
],
|
|
226
|
+
normalize: normalizeGitLabMergeRequest,
|
|
227
|
+
},
|
|
228
|
+
"azure-devops": {
|
|
229
|
+
command: "az",
|
|
230
|
+
args: (branch) => [
|
|
231
|
+
"repos",
|
|
232
|
+
"pr",
|
|
233
|
+
"list",
|
|
234
|
+
"--detect",
|
|
235
|
+
"true",
|
|
236
|
+
"--source-branch",
|
|
237
|
+
branch,
|
|
238
|
+
"--status",
|
|
239
|
+
"all",
|
|
240
|
+
"--top",
|
|
241
|
+
String(LOOKUP_LIMIT),
|
|
242
|
+
"--only-show-errors",
|
|
243
|
+
"--output",
|
|
244
|
+
"json",
|
|
245
|
+
],
|
|
246
|
+
normalize: normalizeAzureDevOpsPullRequest,
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
function runForgeCli(command, args, cwd) {
|
|
250
|
+
return new Promise((resolve, reject) => {
|
|
251
|
+
execFile(command, args, { cwd, timeout: LOOKUP_TIMEOUT_MS, maxBuffer: 10 * 1024 * 1024, encoding: "utf8" }, (error, stdout) => {
|
|
252
|
+
if (error) {
|
|
253
|
+
reject(error);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
resolve(stdout);
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
export function parsePullRequestList(raw, normalize) {
|
|
261
|
+
const trimmed = raw.trim();
|
|
262
|
+
if (!trimmed) {
|
|
263
|
+
return [];
|
|
264
|
+
}
|
|
265
|
+
const parsed = JSON.parse(trimmed);
|
|
266
|
+
if (!Array.isArray(parsed)) {
|
|
267
|
+
return [];
|
|
268
|
+
}
|
|
269
|
+
// Per-row fail-soft: a malformed row is skipped, never fails the lookup.
|
|
270
|
+
return parsed.map(normalize).filter((candidate) => candidate !== null);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Resolve the PR attributed to the branch checked out in `cwd`.
|
|
274
|
+
*
|
|
275
|
+
* Null when the lookup could not run or failed (non-git directory, detached HEAD,
|
|
276
|
+
* unrecognized provider, forge CLI missing/unauthenticated/errored) — the caller must
|
|
277
|
+
* then report nothing so the last-known snapshot survives.
|
|
278
|
+
*/
|
|
279
|
+
export async function lookupThreadPullRequest(cwd) {
|
|
280
|
+
const [branch, remoteUrl] = await Promise.all([getCurrentBranch(cwd), getGitRemoteUrl(cwd)]);
|
|
281
|
+
if (!branch || !remoteUrl) {
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
const provider = detectPullRequestProvider(remoteUrl);
|
|
285
|
+
if (!provider) {
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
const lookup = PROVIDER_LOOKUPS[provider];
|
|
289
|
+
let candidates;
|
|
290
|
+
try {
|
|
291
|
+
const stdout = await runForgeCli(lookup.command, lookup.args(branch), cwd);
|
|
292
|
+
candidates = parsePullRequestList(stdout, lookup.normalize);
|
|
293
|
+
}
|
|
294
|
+
catch {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
const defaultBranch = await getDefaultBranch(cwd);
|
|
298
|
+
const candidate = selectPullRequestCandidate(candidates, branch, defaultBranch === branch);
|
|
299
|
+
if (!candidate) {
|
|
300
|
+
return { pullRequest: null };
|
|
301
|
+
}
|
|
302
|
+
const { updatedAt: _updatedAt, ...snapshotFields } = candidate;
|
|
303
|
+
return { pullRequest: { ...snapshotFields, capturedAt: Date.now() } };
|
|
304
|
+
}
|
|
305
|
+
//# sourceMappingURL=pull-requests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull-requests.js","sourceRoot":"","sources":["../../../src/lib/pull-requests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AA6BrF,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACjC,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,8EAA8E;AAC9E,uEAAuE;AACvE,8EAA8E;AAE9E,SAAS,mBAAmB,CAAC,SAAiB;IAC5C,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;IACjC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IACD,+CAA+C;IAC/C,MAAM,QAAQ,GAAG,+BAA+B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/D,IAAI,QAAQ,EAAE,CAAC,CA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C"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const OPENSANA_SKILLS_SH_INSTALL_COMMAND = "npx skills add https://github.com/gecko0/opensana/tree/main/plugins/opensana/skills --skill opensana-tasks";
|
|
2
|
+
export declare function getProjectSkillDirectories(baseDir: string): string[];
|
|
3
|
+
export declare function hasProjectOpensanaSkill(baseDir: string): boolean;
|
|
4
|
+
export declare function logSkillsShAlternative(): void;
|
|
5
|
+
export declare function maybeLogMissingProjectSkillHint(paths: string[]): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
const SKILL_NAME = "opensana-tasks";
|
|
5
|
+
export const OPENSANA_SKILLS_SH_INSTALL_COMMAND = "npx skills add https://github.com/gecko0/opensana/tree/main/plugins/opensana/skills --skill opensana-tasks";
|
|
6
|
+
const warnedProjectSkillPaths = new Set();
|
|
7
|
+
function hasSkillFile(skillDir) {
|
|
8
|
+
return fs.existsSync(path.join(skillDir, "SKILL.md"));
|
|
9
|
+
}
|
|
10
|
+
export function getProjectSkillDirectories(baseDir) {
|
|
11
|
+
const resolvedBaseDir = path.resolve(baseDir);
|
|
12
|
+
return [
|
|
13
|
+
path.join(resolvedBaseDir, ".agents", "skills", SKILL_NAME),
|
|
14
|
+
path.join(resolvedBaseDir, ".claude", "skills", SKILL_NAME),
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
export function hasProjectOpensanaSkill(baseDir) {
|
|
18
|
+
return getProjectSkillDirectories(baseDir).some((skillDir) => hasSkillFile(skillDir));
|
|
19
|
+
}
|
|
20
|
+
export function logSkillsShAlternative() {
|
|
21
|
+
console.log(chalk.dim("\nAlternative installer with skills.sh:"));
|
|
22
|
+
console.log(chalk.dim(` ${OPENSANA_SKILLS_SH_INSTALL_COMMAND}`));
|
|
23
|
+
}
|
|
24
|
+
export function maybeLogMissingProjectSkillHint(paths) {
|
|
25
|
+
const projectPath = paths[0] ?? process.cwd();
|
|
26
|
+
const resolvedProjectPath = path.resolve(projectPath);
|
|
27
|
+
if (warnedProjectSkillPaths.has(resolvedProjectPath)) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (hasProjectOpensanaSkill(resolvedProjectPath)) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
warnedProjectSkillPaths.add(resolvedProjectPath);
|
|
34
|
+
console.log(chalk.yellow("Optional: OpenSana task skill was not found for this project."));
|
|
35
|
+
console.log(chalk.dim("Install it with:"));
|
|
36
|
+
console.log(chalk.dim(" convoy init skill --scope project"));
|
|
37
|
+
console.log(chalk.dim("Or with skills.sh:"));
|
|
38
|
+
console.log(chalk.dim(` ${OPENSANA_SKILLS_SH_INSTALL_COMMAND}`));
|
|
39
|
+
console.log("");
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=skill-install-guidance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-install-guidance.js","sourceRoot":"","sources":["../../../src/lib/skill-install-guidance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAEpC,MAAM,CAAC,MAAM,kCAAkC,GAC7C,4GAA4G,CAAC;AAE/G,MAAM,uBAAuB,GAAG,IAAI,GAAG,EAAU,CAAC;AAElD,SAAS,YAAY,CAAC,QAAgB;IACpC,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,OAAe;IACxD,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9C,OAAO;QACL,IAAI,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G,CAAC,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,kCAAkC,EAAE,CAAC,CAAC,CAAC;IAClE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare function readTextFile(path: string, label: string): string;
|
|
2
|
+
interface StringInputArgs {
|
|
3
|
+
inlineValue?: string;
|
|
4
|
+
filePath?: string;
|
|
5
|
+
inlineLabel: string;
|
|
6
|
+
fileLabel: string;
|
|
7
|
+
displayName: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Text from either source, or `""` when neither was given — for callers where an
|
|
11
|
+
* attachment can stand in for the text (`threads create|send`). The caller owns
|
|
12
|
+
* the "text or attachment" error, since only it knows the other half.
|
|
13
|
+
*
|
|
14
|
+
* Not trimmed: `tasks artifacts replace` matches exact strings.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveOptionalStringInput({ inlineValue, filePath, inlineLabel, fileLabel, displayName, }: StringInputArgs): string;
|
|
17
|
+
export declare function resolveRequiredStringInput(args: StringInputArgs): string;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
export function readTextFile(path, label) {
|
|
3
|
+
try {
|
|
4
|
+
return readFileSync(path, "utf-8");
|
|
5
|
+
}
|
|
6
|
+
catch (error) {
|
|
7
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
8
|
+
throw new Error(`Could not read ${label} file "${path}": ${message}`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Text from either source, or `""` when neither was given — for callers where an
|
|
13
|
+
* attachment can stand in for the text (`threads create|send`). The caller owns
|
|
14
|
+
* the "text or attachment" error, since only it knows the other half.
|
|
15
|
+
*
|
|
16
|
+
* Not trimmed: `tasks artifacts replace` matches exact strings.
|
|
17
|
+
*/
|
|
18
|
+
export function resolveOptionalStringInput({ inlineValue, filePath, inlineLabel, fileLabel, displayName, }) {
|
|
19
|
+
if (inlineValue !== undefined && filePath !== undefined) {
|
|
20
|
+
throw new Error(`Cannot use ${inlineLabel} and ${fileLabel} together`);
|
|
21
|
+
}
|
|
22
|
+
if (inlineValue !== undefined) {
|
|
23
|
+
return inlineValue;
|
|
24
|
+
}
|
|
25
|
+
if (filePath !== undefined) {
|
|
26
|
+
return readTextFile(filePath, displayName);
|
|
27
|
+
}
|
|
28
|
+
return "";
|
|
29
|
+
}
|
|
30
|
+
export function resolveRequiredStringInput(args) {
|
|
31
|
+
if (args.inlineValue === undefined && args.filePath === undefined) {
|
|
32
|
+
throw new Error(`Pass ${args.inlineLabel} or ${args.fileLabel}.`);
|
|
33
|
+
}
|
|
34
|
+
return resolveOptionalStringInput(args);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=text-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-input.js","sourceRoot":"","sources":["../../../src/lib/text-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,KAAa;IACtD,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,UAAU,IAAI,MAAM,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;AACH,CAAC;AAUD;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CAAC,EACzC,WAAW,EACX,QAAQ,EACR,WAAW,EACX,SAAS,EACT,WAAW,GACK;IAChB,IAAI,WAAW,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,cAAc,WAAW,QAAQ,SAAS,WAAW,CAAC,CAAC;IACzE,CAAC;IAED,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,YAAY,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,IAAqB;IAC9D,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,CAAC,WAAW,OAAO,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,0BAA0B,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Id } from "../convex/_generated/dataModel.js";
|
|
2
|
+
import type { OpenSanaClient } from "./config/index.js";
|
|
3
|
+
/** What `cli.messages.send` / `cli.threads.create` take inline. */
|
|
4
|
+
export interface ThreadAttachmentInput {
|
|
5
|
+
storageId: Id<"_storage">;
|
|
6
|
+
fileName: string;
|
|
7
|
+
fileSize: number;
|
|
8
|
+
contentType: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Upload `files`, hand the metadata to `send`, and always discard the pending
|
|
12
|
+
* uploads — a failed send would otherwise leak the blobs. Discarding after a
|
|
13
|
+
* *successful* send is a no-op on storage: the mutation deletes bytes only when
|
|
14
|
+
* no message references them (`createAttachmentRefs` already dropped the rows).
|
|
15
|
+
*
|
|
16
|
+
* Cleanup never changes the outcome: every blob is attempted even if one fails,
|
|
17
|
+
* and a cleanup failure is warned about rather than thrown. Rethrowing would turn
|
|
18
|
+
* a committed send into a reported failure — losing the message id and inviting a
|
|
19
|
+
* retry that queues a duplicate.
|
|
20
|
+
*/
|
|
21
|
+
export declare function withThreadAttachments<T>(client: OpenSanaClient, projectId: Id<"projects">, files: string[], send: (attachments: ThreadAttachmentInput[]) => Promise<T>): Promise<T>;
|