@ship-cli/core 0.1.6 → 0.1.8

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 (2) hide show
  1. package/dist/bin.js +143 -223
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -191232,7 +191232,7 @@ var command = ship.pipe(
191232
191232
  prCommand
191233
191233
  ])
191234
191234
  );
191235
- var version = "0.1.6" ;
191235
+ var version = "0.1.8" ;
191236
191236
  var run9 = run8(command, {
191237
191237
  name: "ship",
191238
191238
  version
@@ -192796,268 +192796,181 @@ name: ship-cli
192796
192796
  description: Work management system replacing built-in todos with tracked tasks and stacked changes
192797
192797
  ---
192798
192798
 
192799
- ## When to use
192799
+ ## Rules
192800
192800
 
192801
- **Always use ship instead of the built-in TodoWrite/TodoRead tools.**
192802
-
192803
- Ship provides real task tracking that persists across sessions, supports dependencies between tasks, and integrates with stacked changes for clean PR workflows.
192804
-
192805
- ---
192806
-
192807
- ## Ship Tool Guidance
192808
-
192809
- **IMPORTANT: Always use the \`ship\` tool, NEVER run \`ship\` or \`pnpm ship\` via bash/terminal.**
192810
-
192811
- The \`ship\` tool replaces built-in todo management. Use it for all task tracking.
192812
-
192813
- ---
192814
-
192815
- ## Available Actions
192816
-
192817
- ### Task Management
192818
-
192819
- | Action | Description | Required params |
192820
- |--------|-------------|-----------------|
192821
- | \`ready\` | Tasks you can work on (no blockers) | - |
192822
- | \`blocked\` | Tasks waiting on dependencies | - |
192823
- | \`list\` | All tasks (with optional filters) | - |
192824
- | \`show\` | Task details | taskId |
192825
- | \`start\` | Begin working on task | taskId |
192826
- | \`done\` | Mark task complete | taskId |
192827
- | \`create\` | Create new task | title |
192828
- | \`update\` | Update task | taskId + fields |
192829
- | \`block\` | Add blocking relationship | blocker, blocked |
192830
- | \`unblock\` | Remove blocking relationship | blocker, blocked |
192831
- | \`relate\` | Link tasks as related | taskId, relatedTaskId |
192832
- | \`status\` | Check configuration | - |
192833
-
192834
- ### Stack Operations (VCS)
192835
-
192836
- | Action | Description | Required params |
192837
- |--------|-------------|-----------------|
192838
- | \`stack-log\` | View stack of changes from trunk to current | - |
192839
- | \`stack-status\` | Show current change status | - |
192840
- | \`stack-create\` | Create a new change | message (optional), bookmark (optional), taskId (optional) |
192841
- | \`stack-describe\` | Update change description | message |
192842
- | \`stack-sync\` | Fetch, rebase, auto-abandon merged changes | - |
192843
-
192844
- ### Milestone Actions
192845
-
192846
- | Action | Description | Required params |
192847
- |--------|-------------|-----------------|
192848
- | \`milestone-list\` | List project milestones | - |
192849
- | \`milestone-show\` | Get milestone details | milestoneId |
192850
- | \`milestone-create\` | Create new milestone | milestoneName |
192851
- | \`milestone-update\` | Update milestone | milestoneId |
192852
- | \`milestone-delete\` | Delete milestone | milestoneId |
192853
- | \`task-set-milestone\` | Assign task to milestone | taskId, milestoneId |
192854
- | \`task-unset-milestone\` | Remove task from milestone | taskId |
192801
+ 1. **NEVER run via bash:** \`jj\`, \`gh pr\`, \`git\`, \`ship\`, \`pnpm ship\` - use the \`ship\` tool instead
192802
+ 2. **ALWAYS use \`workdir\` parameter** for all commands when in a workspace
192803
+ 3. **NEVER ask user to \`cd\`** - use \`workdir\` instead
192804
+ 4. **On webhook events:** Notify user and ask confirmation BEFORE acting
192855
192805
 
192856
192806
  ---
192857
192807
 
192858
192808
  ## Workflow
192859
192809
 
192860
- 1. Check available work: \`ship\` tool with action \`ready\`
192861
- 2. Start a task: \`ship\` tool with action \`start\` and taskId
192862
- 3. Do the work
192863
- 4. Mark complete: \`ship\` tool with action \`done\` and taskId
192864
-
192865
- ---
192866
-
192867
- ## Task Identifiers
192868
-
192869
- Task IDs use the format \`PREFIX-NUMBER\` where PREFIX is the Linear team key (e.g., \`ENG-123\`, \`PROD-456\`).
192870
-
192871
- To find the correct prefix for your project, use ship tool with action=\`status\`. The team key shown is your task prefix.
192872
-
192873
- **Never hardcode or guess prefixes like \`BRI-\`.** Always get the actual task IDs from \`ready\`, \`list\`, or \`show\` actions.
192874
-
192875
- ---
192876
-
192877
- ## Task Dependencies
192878
-
192879
- Use blocking relationships to track dependencies between tasks.
192810
+ ### Start Task
192880
192811
 
192881
- ### Add a blocker
192882
-
192883
- Use ship tool: action=\`block\`, blocker=\`<task-id>\`, blocked=\`<task-id>\`
192884
-
192885
- Example: If ENG-100 blocks ENG-101, then ENG-100 must be completed before ENG-101 can start.
192886
-
192887
- ### Remove a blocker
192888
-
192889
- Use ship tool: action=\`unblock\`, blocker=\`<task-id>\`, blocked=\`<task-id>\`
192890
-
192891
- ### View blocked tasks
192892
-
192893
- Use ship tool: action=\`blocked\`
192812
+ \`\`\`
192813
+ ship: action=stack-sync # Get latest trunk
192814
+ ship: action=ready # Find work
192815
+ ship: action=start, taskId=<id> # Mark In Progress (Linear only)
192816
+ ship: action=stack-create, message="<type>: <short description>", bookmark="user/<id>-slug"
192817
+ # Store workspace path from output, use for all subsequent workdir params
192818
+ bash: command="pnpm install", workdir=<workspace-path>
192819
+ \`\`\`
192894
192820
 
192895
- ### Link related tasks
192821
+ ### Do Work
192896
192822
 
192897
- Use ship tool: action=\`relate\`, taskId=\`<task-id>\`, relatedTaskId=\`<task-id>\`
192823
+ - Use \`workdir=<workspace-path>\` for ALL bash and ship commands
192824
+ - Make changes, run quality checks (lint, format, typecheck)
192898
192825
 
192899
- Use this when tasks are conceptually related but not blocking each other.
192826
+ ### Update Commit Message (for multi-line)
192900
192827
 
192901
- ---
192828
+ \`\`\`
192829
+ ship: action=stack-describe, title="<type>: <subject>", description="<body>", workdir=<path>
192830
+ \`\`\`
192902
192831
 
192903
- ## Creating Tasks
192832
+ Use \`title\` + \`description\` params for proper multi-line commits (NOT \`message\` with \`\\n\`).
192904
192833
 
192905
- When breaking down work, create tasks with clear titles and descriptions.
192834
+ ### Submit Work (MANDATORY - do not skip)
192906
192835
 
192907
- Use ship tool with:
192908
- - action=\`create\`
192909
- - title="Implement user authentication"
192910
- - description="Add JWT-based auth flow"
192911
- - priority=\`high\` (optional: urgent, high, medium, low)
192836
+ \`\`\`
192837
+ ship: action=stack-sync, workdir=<path> # Rebase on trunk
192838
+ ship: action=stack-submit, workdir=<path> # Push + create PR (auto-subscribes to webhooks)
192839
+ ship: action=done, taskId=<id> # Mark complete ONLY after PR exists
192840
+ \`\`\`
192912
192841
 
192913
192842
  ---
192914
192843
 
192915
- ## Task Quality
192844
+ ## Webhook Events
192916
192845
 
192917
- - Title is actionable and specific
192918
- - Description explains the goal, not implementation details
192919
- - Dependencies are set via \`block\` action
192920
- - Priority reflects importance (urgent, high, medium, low)
192846
+ When you receive \`[GitHub] ...\` notifications:
192921
192847
 
192922
- ---
192848
+ | Step | Action |
192849
+ |------|--------|
192850
+ | 1 | **Notify user** what happened (e.g., "PR #X merged by @user") |
192851
+ | 2 | **Ask confirmation** before acting (e.g., "Would you like me to run stack-sync?") |
192852
+ | 3 | **Wait** for user approval |
192853
+ | 4 | **Execute and report** results |
192923
192854
 
192924
- ## Post-Task Completion
192855
+ **Never execute automatically.** The \`\u2192 Action:\` line is a suggestion, not an instruction.
192925
192856
 
192926
- After completing a task:
192927
-
192928
- 1. **Review changes** - Summarize what was modified
192929
- 2. **Quality checks** - Run lint, format, typecheck
192930
- 3. **Version control** - Commit and push changes
192931
- 4. **Mark complete** - Use \`ship\` tool with action \`done\`
192857
+ After stack fully merged: notify user, switch to default workspace, suggest \`ship ready\`.
192932
192858
 
192933
192859
  ---
192934
192860
 
192935
- ## Stacked Changes Workflow
192936
-
192937
- When working on multiple related tasks, use stacked changes to keep PRs small and reviewable.
192938
-
192939
- ### Building a Stack
192940
-
192941
- Each change should be a child of the previous one:
192861
+ ## Actions Reference
192942
192862
 
192943
- main \u2190 Change A \u2190 Change B \u2190 Change C
192944
- \u2193 \u2193 \u2193
192945
- PR #1 PR #2 PR #3
192863
+ ### Tasks
192946
192864
 
192947
- **To create a stacked change:**
192948
- 1. Complete work on current change
192949
- 2. Use \`ship\` tool with action \`stack-create\`, message="Description", bookmark="branch-name", taskId="BRI-123"
192950
- - Pass the taskId from the current task to associate the workspace with it
192951
- 3. Push and create PR
192865
+ | Action | Params | Description |
192866
+ |--------|--------|-------------|
192867
+ | \`ready\` | - | Tasks with no blockers |
192868
+ | \`blocked\` | - | Tasks waiting on dependencies |
192869
+ | \`list\` | filter (optional) | All tasks |
192870
+ | \`show\` | taskId | Task details |
192871
+ | \`start\` | taskId | Mark In Progress |
192872
+ | \`done\` | taskId | Mark complete |
192873
+ | \`create\` | title, description, priority?, parentId? | Create task (see template below) |
192874
+ | \`update\` | taskId + fields | Update task |
192875
+ | \`block\` | blocker, blocked | Add dependency |
192876
+ | \`unblock\` | blocker, blocked | Remove dependency |
192877
+ | \`relate\` | taskId, relatedTaskId | Link related tasks |
192952
192878
 
192953
- ### After a PR is Merged
192879
+ ### Task Description Template
192954
192880
 
192955
- **CRITICAL: Immediately sync the remaining stack after any PR merges.**
192881
+ When creating tasks, ALWAYS use this description format:
192956
192882
 
192957
- Use \`ship\` tool with action \`stack-sync\`
192958
-
192959
- This will:
192960
- 1. Fetch latest from remote
192961
- 2. Rebase remaining stack onto updated trunk
192962
- 3. **Auto-abandon merged changes** - Changes that become empty after rebase (their content is now in trunk) are automatically abandoned
192963
- 4. **Auto-cleanup workspace** - If ALL changes in the stack were merged, the workspace is automatically cleaned up
192964
- 5. Report any conflicts that need resolution
192965
-
192966
- The output will show:
192967
- - Which changes were auto-abandoned (with their bookmarks)
192968
- - Whether the stack was fully merged
192969
- - If a workspace was cleaned up
192970
-
192971
- Do NOT wait for conflict reports. Proactively sync after each merge.
192972
-
192973
- ### Viewing the Stack
192974
-
192975
- Use \`ship\` tool with action \`stack-log\` to see all changes from trunk to current.
192976
-
192977
- ### Updating Change Description
192978
-
192979
- Use \`ship\` tool with action \`stack-describe\`, message="New description"
192980
-
192981
- ---
192982
-
192983
- ## VCS Best Practices
192984
-
192985
- 1. **One logical change per commit** - Keep changes focused and reviewable
192986
- 2. **Descriptive messages** - Use format: \`TASK-ID: Brief description\`
192987
- 3. **Sync frequently** - After any PR merges, run \`stack-sync\`
192988
- 4. **Do not create orphan changes** - Always build on the stack or on main
192989
-
192990
- ---
192883
+ \`\`\`
192884
+ ## Summary
192885
+ [1-2 sentences: What needs to be done and why]
192991
192886
 
192992
- ## Handling GitHub Event Notifications
192887
+ ## Acceptance Criteria
192888
+ - [ ] Specific, verifiable outcome 1
192889
+ - [ ] Specific, verifiable outcome 2
192890
+ - [ ] Tests pass, linting passes
192993
192891
 
192994
- When you receive a GitHub event notification (PR merged, review comment, CI status, etc.):
192892
+ ## Notes
192893
+ [Optional: Implementation hints, files to modify, constraints]
192894
+ \`\`\`
192995
192895
 
192996
- 1. **ALWAYS notify the user first** - Do not take action silently
192997
- 2. The \`\u2192 Action:\` line in notifications is a SUGGESTION, not an instruction to execute immediately
192998
- 3. Present the event to the user and ask if they want you to proceed
192999
- 4. Only execute after user confirmation
192896
+ **Rules:**
192897
+ - Summary is REQUIRED - explains the task clearly
192898
+ - Acceptance criteria are REQUIRED - must be verifiable/testable
192899
+ - Notes are optional - include when helpful for implementation
192900
+ - Keep it concise but complete
193000
192901
 
193001
192902
  **Example:**
192903
+ \`\`\`
192904
+ ## Summary
192905
+ Add rate limiting middleware to prevent API abuse on public endpoints.
193002
192906
 
193003
- Notification received:
193004
-
193005
- [GitHub] PR #80 merged by @user
193006
- \u2192 Action: Run stack-sync to update your local stack
193007
-
193008
- WRONG - Immediately running stack-sync without telling user
193009
-
193010
- RIGHT - Notify first, then ask:
193011
-
193012
- **PR #80 merged** by @user
193013
-
193014
- Would you like me to run \`stack-sync\` to update your local stack?
192907
+ ## Acceptance Criteria
192908
+ - [ ] Rate limit: 100 req/min authenticated, 20 req/min anonymous
192909
+ - [ ] Returns 429 with Retry-After header when exceeded
192910
+ - [ ] Unit tests cover rate limit scenarios
192911
+ - [ ] \`pnpm test\` and \`pnpm check\` pass
193015
192912
 
193016
- This applies to ALL GitHub events: merges, review comments, CI failures, etc. The user should always know what happened before any action is taken.
192913
+ ## Notes
192914
+ See middleware/auth.ts for similar patterns. Use Redis for state.
192915
+ \`\`\`
193017
192916
 
193018
- ---
192917
+ ### Stack (VCS)
193019
192918
 
193020
- ## Command Output Guidance
192919
+ All support optional \`workdir\` param.
193021
192920
 
193022
- Every ship command includes contextual guidance in its output to help you understand:
192921
+ | Action | Params | Description |
192922
+ |--------|--------|-------------|
192923
+ | \`stack-sync\` | - | Fetch + rebase onto trunk |
192924
+ | \`stack-restack\` | - | Rebase onto trunk (no fetch) |
192925
+ | \`stack-create\` | message?, bookmark?, noWorkspace? | New change (creates workspace by default) |
192926
+ | \`stack-describe\` | title, description? OR message | Update description (use title+description for proper multi-line commits) |
192927
+ | \`stack-submit\` | draft? | Push + create/update PR |
192928
+ | \`stack-status\` | - | Current change info |
192929
+ | \`stack-log\` | - | View stack |
192930
+ | \`stack-squash\` | message | Squash into parent |
192931
+ | \`stack-abandon\` | changeId? | Abandon change |
192932
+ | \`stack-up\` / \`stack-down\` | - | Navigate stack |
192933
+ | \`stack-undo\` | - | Undo last operation |
192934
+ | \`stack-bookmark\` | name, move? | Create/move bookmark |
192935
+ | \`stack-workspaces\` | - | List workspaces |
192936
+ | \`stack-remove-workspace\` | name, deleteFiles? | Remove workspace |
192937
+ | \`stack-update-stale\` | - | Fix stale working copy |
193023
192938
 
193024
- 1. **Next actions** - Suggested next steps based on the command result
193025
- 2. **Workdir** - Explicit working directory path when it has changed (critical for workspace operations)
193026
- 3. **Skill reminder** - Prompt to read this skill when encountering complex situations
192939
+ ### Pull Requests
193027
192940
 
193028
- ### Guidance Format
192941
+ Use these for advanced PR workflows. Note: \`stack-submit\` handles basic PR creation automatically.
193029
192942
 
193030
- \`\`\`
193031
- [Command Output]
192943
+ | Action | Params | Description |
192944
+ |--------|--------|-------------|
192945
+ | \`pr-create\` | draft?, open? | Create PR with Linear task context |
192946
+ | \`pr-stack\` | dryRun? | Create stacked PRs for entire stack |
192947
+ | \`pr-review\` | prNumber? (optional), unresolved?, json? | Fetch PR reviews and comments |
193032
192948
 
193033
- ---
193034
- Next: <suggested actions>
193035
- Workdir: <path> # Only shown when working directory changed
193036
- IMPORTANT: Load skill first \u2192 skill(name="ship-cli") # Only on entry points or complex situations
193037
- Note: <contextual message>
193038
- \`\`\`
192949
+ **\`pr-create\`**: Creates a PR for current bookmark, auto-populating title and body from Linear task. Use when you need rich task context in PR description.
193039
192950
 
193040
- ### Critical: Workspace Deletion
192951
+ **\`pr-stack\`**: Creates PRs for all changes in your stack with proper base targeting. First PR targets main, subsequent PRs target previous bookmark.
193041
192952
 
193042
- When \`stack-sync\` detects a fully merged stack, it automatically:
193043
- 1. Cleans up the workspace (deletes directory)
193044
- 2. Provides the **main repo path** in the \`Workdir:\` line
192953
+ **\`pr-review\`**: Fetches reviews and comments in AI-friendly format. Shows verdicts (APPROVED, CHANGES_REQUESTED), inline code comments with file:line, and conversation threads. Use \`--unresolved\` to filter to actionable items only.
193045
192954
 
193046
- **You MUST use the provided workdir for all subsequent commands**, as the previous workspace directory no longer exists.
192955
+ ### Milestones
193047
192956
 
193048
- Example output:
193049
- \`\`\`
193050
- Stack fully merged! All changes are now in trunk.
193051
- Cleaned up workspace: bri-123-feature
192957
+ | Action | Params | Description |
192958
+ |--------|--------|-------------|
192959
+ | \`milestone-list\` | - | List milestones |
192960
+ | \`milestone-show\` | milestoneId | Milestone details |
192961
+ | \`milestone-create\` | milestoneName, milestoneDescription?, milestoneTargetDate? | Create milestone |
192962
+ | \`task-set-milestone\` | taskId, milestoneId | Assign task |
192963
+ | \`task-unset-milestone\` | taskId | Remove from milestone |
193052
192964
 
193053
192965
  ---
193054
- Next: action=done (mark task complete) | action=ready (find next task)
193055
- Workdir: /Users/dev/project
193056
- IMPORTANT: Load skill first \u2192 skill(name="ship-cli")
193057
- Note: Workspace 'bri-123-feature' was deleted. Use the workdir above for subsequent commands.
193058
- \`\`\`
193059
192966
 
193060
- After seeing this output, use \`workdir=/Users/dev/project\` for the next ship command.
192967
+ ## Troubleshooting
192968
+
192969
+ | Problem | Solution |
192970
+ |---------|----------|
192971
+ | "Working copy is stale" | \`stack-update-stale\` |
192972
+ | Bookmark lost after squash/rebase | \`stack-bookmark\` with \`move=true\` |
192973
+ | Accidentally used jj/gh directly | \`stack-status\` to check, \`stack-undo\` if needed |
193061
192974
  `;
193062
192975
 
193063
192976
  // src/adapters/driven/config/ConfigRepositoryLive.ts
@@ -194704,17 +194617,24 @@ var make72 = gen2(function* () {
194704
194617
  new TaskError({ message: "Failed to create project" })
194705
194618
  );
194706
194619
  }
194707
- const projectId = result.projectId;
194708
- if (!projectId) {
194709
- return yield* fail7(
194710
- new TaskError({ message: "Project ID not returned after create" })
194711
- );
194712
- }
194713
- return new Project({
194714
- id: projectId,
194715
- name: input.name,
194716
- teamId
194620
+ const fetchProject = tryPromise2({
194621
+ try: async () => {
194622
+ const createdProject = await result.project;
194623
+ if (!createdProject) {
194624
+ throw new Error("Project not found after creation");
194625
+ }
194626
+ return createdProject;
194627
+ },
194628
+ catch: (e2) => new TaskError({
194629
+ message: `Project creation may have failed - could not verify project exists: ${e2}`
194630
+ })
194717
194631
  });
194632
+ const fetchRetryPolicy = intersect6(
194633
+ exponential3(millis(100)),
194634
+ recurs2(3)
194635
+ );
194636
+ const project2 = yield* fetchProject.pipe(retry(fetchRetryPolicy));
194637
+ return mapProject(project2, teamId);
194718
194638
  }),
194719
194639
  "Creating project"
194720
194640
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ship-cli/core",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Linear + jj workflow CLI for AI agents",