@snappedly-tools/shipyard 0.7.0 → 0.9.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.
Files changed (63) hide show
  1. package/README.md +46 -43
  2. package/dist/{MountConfig-bZoCs4Dd.d.ts → MountConfig-K5ILnfht.d.ts} +1 -1
  3. package/dist/SandboxProvider-oUAwYlWm.d.ts +120 -0
  4. package/dist/{chunk-FDYOTN55.js → chunk-57EEKW3R.js} +361 -984
  5. package/dist/chunk-57EEKW3R.js.map +1 -0
  6. package/dist/{chunk-56TDSWFU.js → chunk-HXSZM52J.js} +3 -3
  7. package/dist/{chunk-56TDSWFU.js.map → chunk-HXSZM52J.js.map} +1 -1
  8. package/dist/{chunk-WAXEMZUV.js → chunk-JZUBT4WG.js} +241 -33
  9. package/dist/chunk-JZUBT4WG.js.map +1 -0
  10. package/dist/chunk-NQRFVKCU.js +1840 -0
  11. package/dist/chunk-NQRFVKCU.js.map +1 -0
  12. package/dist/chunk-Z5C4LHVP.js +137 -0
  13. package/dist/chunk-Z5C4LHVP.js.map +1 -0
  14. package/dist/createSandbox-DmbnWAZv.d.ts +739 -0
  15. package/dist/index.d.ts +99 -2606
  16. package/dist/index.js +412 -7487
  17. package/dist/index.js.map +1 -1
  18. package/dist/integrations/github.d.ts +52 -0
  19. package/dist/integrations/github.js +1049 -0
  20. package/dist/integrations/github.js.map +1 -0
  21. package/dist/integrations/releases.d.ts +136 -0
  22. package/dist/integrations/releases.js +500 -0
  23. package/dist/integrations/releases.js.map +1 -0
  24. package/dist/main.js +826 -472
  25. package/dist/main.js.map +1 -1
  26. package/dist/publication-BPoy_M9M.d.ts +1200 -0
  27. package/dist/sandboxes/docker.d.ts +2 -3
  28. package/dist/sandboxes/docker.js +2 -4
  29. package/dist/templates/parallel-planner/main.mts +78 -16
  30. package/dist/templates/parallel-planner/planner-branch.mts +151 -0
  31. package/dist/templates/parallel-planner/setup.sh +1 -0
  32. package/dist/templates/parallel-planner-with-review/main.mts +81 -19
  33. package/dist/templates/parallel-planner-with-review/planner-branch.mts +151 -0
  34. package/dist/templates/parallel-planner-with-review/setup.sh +1 -0
  35. package/dist/templates/sequential-reviewer/main.mts +59 -6
  36. package/dist/templates/sequential-reviewer/setup.sh +1 -0
  37. package/dist/templates/shared/setup.sh +1 -0
  38. package/dist/templates/simple-loop/main.mts +58 -5
  39. package/dist/templates/simple-loop/setup.sh +1 -0
  40. package/dist/workflow/coordinator/migrations/002_workflow_phase_records.sql +11 -0
  41. package/dist/workflow/coordinator/migrations/003_phase_record_schema_version.sql +6 -0
  42. package/dist/workflow.d.ts +472 -0
  43. package/dist/workflow.js +4345 -0
  44. package/dist/workflow.js.map +1 -0
  45. package/package.json +11 -15
  46. package/dist/SandboxProvider-XJQqEdSf.d.ts +0 -261
  47. package/dist/chunk-ACD46ZM4.js +0 -136
  48. package/dist/chunk-ACD46ZM4.js.map +0 -1
  49. package/dist/chunk-FDYOTN55.js.map +0 -1
  50. package/dist/chunk-KMGNFXKN.js +0 -38
  51. package/dist/chunk-KMGNFXKN.js.map +0 -1
  52. package/dist/chunk-SOJTAJTF.js +0 -78
  53. package/dist/chunk-SOJTAJTF.js.map +0 -1
  54. package/dist/chunk-WAXEMZUV.js.map +0 -1
  55. package/dist/sandboxes/no-sandbox.d.ts +0 -37
  56. package/dist/sandboxes/no-sandbox.js +0 -4
  57. package/dist/sandboxes/no-sandbox.js.map +0 -1
  58. package/dist/sandboxes/vercel.d.ts +0 -104
  59. package/dist/sandboxes/vercel.js +0 -166
  60. package/dist/sandboxes/vercel.js.map +0 -1
  61. package/dist/templates/blank/main.mts +0 -13
  62. package/dist/templates/blank/prompt.md +0 -12
  63. package/dist/templates/blank/template.json +0 -4
package/README.md CHANGED
@@ -23,86 +23,89 @@ a commit or pull request you can inspect.
23
23
 
24
24
  ## Try it on one task
25
25
 
26
- You need **Node.js 20.18.1+**, **Git**, **Docker running**, and **Codex or Claude
27
- Code** with a login or API key. Start with a clean Git repository you want
28
- Shipyard to change. If it is on GitHub, sign in with the
29
- [GitHub CLI](https://cli.github.com/) (`gh auth login`) before `init`; Shipyard
30
- creates its issue labels there.
26
+ You need **Node.js 20.18.1+**, **Git**, **Docker running**, and **Codex or Claude Code**
27
+ with a subscription login or API key.
31
28
 
32
29
  Run:
33
30
 
34
31
  ```sh
35
- git switch -c try-shipyard
36
32
  npx skills add snappedly/skills
33
+ ```
34
+
35
+ Ask your coding agent to run `setup-snappedly-skills` in that repository.
36
+
37
+ ```sh
37
38
  npm install --save-dev @snappedly-tools/shipyard
38
39
  npx shipyard init
39
40
  ```
40
41
 
41
- Ask your coding agent to run `setup-snappedly-skills` in that repository. During
42
- `shipyard init`, choose your agent, **Docker**, and the **blank** template. Follow
43
- the authentication prompts. You can skip the optional repository runner for
44
- this first task.
42
+ During `shipyard init`, choose your agent and template, then follow the
43
+ authentication prompts. GitHub Issues is the built-in tracker. Init builds the
44
+ Docker image and automatically installs the
45
+ [repository runner](docs/content/docs/repository-runner.mdx).
46
+
47
+ On a local Mac, the repository runner automatically wakes Shipyard when you label an issue.
48
+ It runs as long as its terminal stays open.
45
49
 
46
- Open `.shipyard/prompt.md` and describe a small change. For example:
50
+ See the [getting started guide](docs/content/docs/index.mdx) for authentication and
51
+ branch options.
47
52
 
48
- ```md
49
- # Task
53
+ Fill in any credentials required in `.shipyard/.env`.
54
+ `GH_TOKEN` in `.shipyard/.env` to a GH token with Contents, Issues, and Pull
55
+ Requests read/write access and Metadata read access.
50
56
 
51
- Document how to run this project locally using commands already in the repo.
52
- Run the relevant checks and commit the change.
57
+ Set `SHIPYARD_ROUTINE_MODEL` and `SHIPYARD_STRONG_MODEL` in `.shipyard/.env`
58
+ for the roles your template uses.
53
59
 
54
- # Done
60
+ `simple-loop` uses routine for triage and
61
+ implementation. `sequential-reviewer` also uses strong for issue reviews.
62
+ Parallel planner templates use routine for ticket work and strong for planning,
63
+ conflict resolution, and integration. The review-enabled planner also uses
64
+ strong for ticket and final specification reviews. See
65
+ [agent setup](docs/content/docs/agents.mdx).
55
66
 
56
- Output <promise>COMPLETE</promise> when finished.
67
+ ```sh
68
+ npx shipyard runner start
57
69
  ```
58
70
 
59
- Fill in any credentials requested in `.shipyard/.env`. Commit the setup and
60
- prompt so the sandbox can read them. The generated Git ignore file keeps
61
- `.shipyard/.env` out of the commit.
71
+ To start Shipyard for a single run without the active runner, use:
62
72
 
63
73
  ```sh
64
- git add .
65
- git commit -m "Set up Shipyard"
66
74
  npx shipyard run
67
- git show --stat HEAD
68
75
  ```
69
76
 
70
- Shipyard builds the Docker image, runs the agent, and returns its commit to your
71
- current branch. `git show` lets you inspect what changed. See the
72
- [getting started guide](docs/content/docs/index.mdx) for authentication and
73
- branch options.
77
+ To remove Shipyard from the repository:
78
+
79
+ ```sh
80
+ npx shipyard uninstall
81
+ ```
74
82
 
75
83
  ## Turn GitHub issues into pull requests
76
84
 
77
- For a repository you want to automate from GitHub Issues, choose
78
- **sequential-reviewer** instead of **blank** during `shipyard init`. Set
79
- `GH_TOKEN` in `.shipyard/.env` to a token with Contents, Issues, and Pull
80
- requests read/write access and Metadata read access. Then:
85
+ Then:
81
86
 
82
87
  1. Write an issue with a clear goal and add the `shipyard` and
83
88
  `ready-for-agent` labels.
84
- 2. Run `npx shipyard run`. Shipyard checks the issue, implements it in Docker,
85
- reviews the work, and opens a pull request.
89
+ 2. Run Shipyard to check for the issue, implement it in Docker,
90
+ review the work, and open a pull request.
86
91
  3. Inspect the pull request and merge it when you are happy with the result.
87
92
 
88
- On an Apple Silicon Mac, the optional [repository runner](docs/content/docs/repository-runner.mdx)
89
- can wake Shipyard when you label an issue. It runs while its terminal stays open.
90
- The guide covers installation, retries, and issue status labels.
91
-
92
93
  ## Choose a workflow
93
94
 
94
95
  | Template | What it does |
95
96
  | ------------------------------ | -------------------------------------------------- |
96
- | `blank` | Runs your own task and prompt. |
97
- | `simple-loop` | Works through labelled issues one at a time. |
97
+ | `simple-loop` | Works through labeled issues one at a time. |
98
98
  | `sequential-reviewer` | Implements and reviews issues before PR handoff. |
99
99
  | `parallel-planner` | Plans and works on independent issues in parallel. |
100
100
  | `parallel-planner-with-review` | Adds review to the parallel workflow. |
101
101
 
102
- Shipyard also exports TypeScript APIs for custom workflows. Configure prompts,
103
- branches, limits, and hooks in the generated `.shipyard/main.ts` or
104
- `.shipyard/main.mts`. See [configuration](docs/content/docs/configuration.mdx)
105
- and [agent setup](docs/content/docs/agents.mdx).
102
+ The package root exports the core run, interactive, and sandbox APIs. Import
103
+ hosted workflow coordination and GitHub integration APIs from
104
+ `@snappedly-tools/shipyard/workflow` and
105
+ `@snappedly-tools/shipyard/integrations/github`. Configure prompts, branches,
106
+ limits, and hooks in the generated `.shipyard/main.ts` or `.shipyard/main.mts`.
107
+ See [configuration](docs/content/docs/configuration.mdx) and
108
+ [agent setup](docs/content/docs/agents.mdx).
106
109
 
107
110
  ## Safety and license
108
111
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * User-facing mount configuration for bind-mount sandbox providers.
2
+ * User-facing mount configuration for Docker.
3
3
  *
4
4
  * Each entry describes a host directory to mount into the sandbox container.
5
5
  */
@@ -0,0 +1,120 @@
1
+ /** Result of executing a command inside a sandbox. */
2
+ interface ExecResult {
3
+ /** Collected standard output. */
4
+ readonly stdout: string;
5
+ /** Collected standard error. */
6
+ readonly stderr: string;
7
+ /** Process exit status. */
8
+ readonly exitCode: number;
9
+ }
10
+ /** Streams supplied when launching an interactive agent process. */
11
+ interface InteractiveExecOptions {
12
+ /** Input stream forwarded to the agent process. */
13
+ readonly stdin: NodeJS.ReadableStream;
14
+ /** Output stream receiving agent standard output. */
15
+ readonly stdout: NodeJS.WritableStream;
16
+ /** Output stream receiving agent standard error. */
17
+ readonly stderr: NodeJS.WritableStream;
18
+ /** Working directory inside Docker. */
19
+ readonly cwd?: string;
20
+ /** Abort signal that terminates the interactive process. */
21
+ readonly signal?: AbortSignal;
22
+ }
23
+ /** Handle to a running isolated sandbox. Docker implements this contract. */
24
+ interface IsolatedSandboxHandle {
25
+ /** Absolute Git workspace path inside Docker. */
26
+ readonly worktreePath: string;
27
+ /**
28
+ * Execute a command in Docker. Deliver `onLine` as output arrives so idle
29
+ * timeouts and live feedback work; buffered delivery does not satisfy this
30
+ * contract. Pipe `stdin` to the child rather than passing it as an argument.
31
+ */
32
+ exec(command: string, options?: {
33
+ /** Live output callback. */
34
+ onLine?: (line: string) => void;
35
+ /** Working directory inside Docker. */
36
+ cwd?: string;
37
+ /** Execute as root when supported. */
38
+ sudo?: boolean;
39
+ /** Input piped to the child process. */
40
+ stdin?: string;
41
+ /** Abort signal that terminates the command. */
42
+ signal?: AbortSignal;
43
+ /** Maximum combined output bytes before termination. */
44
+ maxOutputBytes?: number;
45
+ }): Promise<ExecResult>;
46
+ /** Launch an interactive process and terminate it when `signal` aborts. */
47
+ interactiveExec?(args: string[], options: InteractiveExecOptions): Promise<{
48
+ exitCode: number;
49
+ }>;
50
+ /** Copy a file or directory from the host into Docker. */
51
+ copyIn(hostPath: string, sandboxPath: string): Promise<void>;
52
+ /** Copy a file from Docker to the host. */
53
+ copyFileOut(sandboxPath: string, hostPath: string): Promise<void>;
54
+ /** Tear down the container. */
55
+ close(): Promise<void>;
56
+ }
57
+ /** File transfer shape used by agent session storage. */
58
+ interface SessionTransferHandle {
59
+ /** Absolute Git workspace path inside Docker. */
60
+ readonly worktreePath: string;
61
+ /** Run a command in the sandbox. */
62
+ exec: IsolatedSandboxHandle["exec"];
63
+ /** Launch an interactive command when available. */
64
+ interactiveExec?: IsolatedSandboxHandle["interactiveExec"];
65
+ /** Copy one host file into the sandbox. */
66
+ copyFileIn(hostPath: string, sandboxPath: string): Promise<void>;
67
+ /** Copy one sandbox file to the host. */
68
+ copyFileOut(sandboxPath: string, hostPath: string): Promise<void>;
69
+ /** Tear down the sandbox. */
70
+ close(): Promise<void>;
71
+ }
72
+ /** Inputs to Docker sandbox creation. */
73
+ interface IsolatedCreateOptions {
74
+ /** Original repository path used to derive the image name; never mounted. */
75
+ readonly hostRepoPath?: string;
76
+ /** Environment injected into the Docker container. */
77
+ readonly env: Record<string, string>;
78
+ }
79
+ /** Configuration for the isolated Docker provider contract. */
80
+ interface IsolatedSandboxProviderConfig {
81
+ /** Human-readable provider name. */
82
+ readonly name: string;
83
+ /** Provider environment merged into sandbox startup. */
84
+ readonly env?: Record<string, string>;
85
+ /** Start a sandbox and return its command and file-transfer handle. */
86
+ readonly create: (options: IsolatedCreateOptions) => Promise<IsolatedSandboxHandle>;
87
+ }
88
+ /** Docker's isolated filesystem provider contract. */
89
+ interface IsolatedSandboxProvider {
90
+ /** Isolated filesystem discriminator. */
91
+ readonly tag: "isolated";
92
+ /** Human-readable provider name. */
93
+ readonly name: string;
94
+ /** Environment variables injected into Docker. */
95
+ readonly env: Record<string, string>;
96
+ /** Start a sandbox. */
97
+ readonly create: (options: IsolatedCreateOptions) => Promise<IsolatedSandboxHandle>;
98
+ }
99
+ /** Provider accepted by Shipyard's Docker execution path. */
100
+ type SandboxProvider = IsolatedSandboxProvider;
101
+ /** Create a temporary branch and merge its commits back to host HEAD. */
102
+ interface MergeToHeadBranchStrategy {
103
+ /** Branch strategy discriminator. */
104
+ readonly type: "merge-to-head";
105
+ }
106
+ /** Run on a caller-named branch. */
107
+ interface NamedBranchStrategy {
108
+ /** Branch strategy discriminator. */
109
+ readonly type: "branch";
110
+ /** Branch to create or reuse. */
111
+ readonly branch: string;
112
+ /** Starting ref for a new branch. */
113
+ readonly baseBranch?: string;
114
+ }
115
+ /** Supported Docker branch strategies. */
116
+ type BranchStrategy = MergeToHeadBranchStrategy | NamedBranchStrategy;
117
+ /** Construct the isolated provider contract used by Docker. */
118
+ declare const createIsolatedSandboxProvider: (config: IsolatedSandboxProviderConfig) => IsolatedSandboxProvider;
119
+
120
+ export { type BranchStrategy as B, type ExecResult as E, type IsolatedSandboxProvider as I, type MergeToHeadBranchStrategy as M, type NamedBranchStrategy as N, type SandboxProvider as S, type InteractiveExecOptions as a, type IsolatedCreateOptions as b, type IsolatedSandboxHandle as c, type IsolatedSandboxProviderConfig as d, createIsolatedSandboxProvider as e, type SessionTransferHandle as f };