@corners/cli 0.0.4 → 0.0.6
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/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +656 -105
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/guidance.d.ts.map +1 -1
- package/dist/guidance.js +15 -12
- package/dist/guidance.js.map +1 -1
- package/dist/skills.d.ts +41 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +160 -0
- package/dist/skills.js.map +1 -0
- package/dist/support.d.ts +9 -0
- package/dist/support.d.ts.map +1 -1
- package/dist/support.js +50 -1
- package/dist/support.js.map +1 -1
- package/package.json +3 -2
- package/skills/corners-ask/SKILL.md +223 -0
- package/skills/corners-plan/SKILL.md +253 -0
- package/skills/corners-push/SKILL.md +177 -0
- package/skills/corners-sync/SKILL.md +245 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: corners-plan
|
|
3
|
+
version: 0.1.0
|
|
4
|
+
description: |
|
|
5
|
+
Create a plan collaboratively, write it to docs/plans/, and post
|
|
6
|
+
summary and open questions to the workstream for team alignment.
|
|
7
|
+
allowed-tools:
|
|
8
|
+
- Bash
|
|
9
|
+
- Read
|
|
10
|
+
- Write
|
|
11
|
+
- Edit
|
|
12
|
+
- Glob
|
|
13
|
+
- Grep
|
|
14
|
+
- AskUserQuestion
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# /corners-plan — "How should we approach this?"
|
|
18
|
+
|
|
19
|
+
Collaboratively create a plan, write it to `docs/plans/`, post a summary to the
|
|
20
|
+
workstream, and surface open questions for the team. The plan document lives in
|
|
21
|
+
git; the coordination lives on the workstream.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Step 0: Preamble
|
|
26
|
+
|
|
27
|
+
Run these commands to check auth and resolve context:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
corners auth status --json 2>/dev/null || echo "CORNERS_CLI_MISSING"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
corners workstream current --json 2>/dev/null
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
|
|
39
|
+
echo "BRANCH: $_BRANCH"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Error handling — check in this order:**
|
|
43
|
+
|
|
44
|
+
1. If `CORNERS_CLI_MISSING` or `command not found`: tell user to install (`npm install -g @corners/cli`) and **STOP**.
|
|
45
|
+
2. If `loggedIn=false` OR `remoteValid=false`: tell user to run `corners auth login` and **STOP**.
|
|
46
|
+
3. If `resolvedCorner` is null: tell user to run `corners corner use <id>` and **STOP**.
|
|
47
|
+
4. If `connectedWorkstreamIds` is empty: proceed to Step 1 (workstream creation wizard).
|
|
48
|
+
If connected, skip to Step 2 using the first connected workstream ID.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Step 1: Workstream Creation Wizard (only if no workstream connected)
|
|
53
|
+
|
|
54
|
+
First, check if any workstreams exist:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
corners workstream list --json 2>/dev/null
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**If workstreams exist:** Normalize the current branch name (strip `feat/`, `fix/`, etc.,
|
|
61
|
+
replace hyphens with spaces, title-case). Compare against workstream names.
|
|
62
|
+
|
|
63
|
+
If a match is found, use AskUserQuestion:
|
|
64
|
+
- Question: "Found workstream '{name}'. Connect it for this plan?"
|
|
65
|
+
- Options: "Yes" / "No, create a new one"
|
|
66
|
+
|
|
67
|
+
If no match, or if the user wants a new one, proceed to creation.
|
|
68
|
+
|
|
69
|
+
**If no workstreams exist, or user wants to create one:**
|
|
70
|
+
|
|
71
|
+
Derive a name from the current branch:
|
|
72
|
+
- `feat/auth-refactor` → "Auth Refactor"
|
|
73
|
+
- `fix/login-bug` → "Login Bug"
|
|
74
|
+
- `main` → use the plan topic (ask in Step 2)
|
|
75
|
+
|
|
76
|
+
Use AskUserQuestion:
|
|
77
|
+
- Question: "Create workstream '{derived name}' for this plan?"
|
|
78
|
+
- Options: "Yes, create it" / "Use a different name" / "Skip workstream — just write the plan locally"
|
|
79
|
+
|
|
80
|
+
If creating:
|
|
81
|
+
```bash
|
|
82
|
+
corners workstream create "<name>" --json
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Extract the workstream ID from the response, then connect it:
|
|
86
|
+
```bash
|
|
87
|
+
corners workstream use <id> --json
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
If "Skip workstream": proceed with plan creation but skip Steps 5 and 6 (no workstream posting).
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Step 2: Pull Existing Context
|
|
95
|
+
|
|
96
|
+
If a workstream is connected, pull its context:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
corners workstream pull <workstreamId> --json 2>/dev/null
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Also check for existing plans:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
ls docs/plans/ 2>/dev/null
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Note any existing plans, prior discussions, threads, and questions from the workstream.
|
|
109
|
+
This context informs the planning conversation.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Step 3: Interactive Planning
|
|
114
|
+
|
|
115
|
+
Guide the user through a structured planning conversation. Use AskUserQuestion for
|
|
116
|
+
each step. Adapt based on the user's responses — skip steps that aren't relevant.
|
|
117
|
+
|
|
118
|
+
**3a. Problem definition:**
|
|
119
|
+
- Question: "What problem are we solving? What's the goal?"
|
|
120
|
+
- Options: freeform text
|
|
121
|
+
|
|
122
|
+
**3b. Constraints and context:**
|
|
123
|
+
- Question: "What constraints should we keep in mind? (timeline, tech stack, dependencies, team)"
|
|
124
|
+
- Options: freeform text / "No special constraints"
|
|
125
|
+
|
|
126
|
+
**3c. Options and tradeoffs:**
|
|
127
|
+
- Question: "What approaches have you considered? I can also suggest some based on the codebase."
|
|
128
|
+
- Options: freeform text / "Suggest approaches for me"
|
|
129
|
+
If "Suggest approaches": read relevant code files based on the problem description
|
|
130
|
+
and propose 2-3 approaches with tradeoffs.
|
|
131
|
+
|
|
132
|
+
**3d. Recommended approach:**
|
|
133
|
+
Based on the discussion, propose a recommended approach.
|
|
134
|
+
- Question: "Here's my recommended approach: {description}. Does this look right?"
|
|
135
|
+
- Options: "Yes, use this" / "Modify it" / "Let's discuss more"
|
|
136
|
+
|
|
137
|
+
**3e. Open questions:**
|
|
138
|
+
- Question: "Are there decisions that need team input before we can proceed?"
|
|
139
|
+
- Options: freeform text / "No open questions"
|
|
140
|
+
Capture each open question for Step 6.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Step 4: Write Plan Document
|
|
145
|
+
|
|
146
|
+
Check if `docs/plans/` exists. If not, create it.
|
|
147
|
+
|
|
148
|
+
Derive a slug from the plan topic (lowercase, hyphens, no special chars).
|
|
149
|
+
|
|
150
|
+
Write the plan to `docs/plans/<slug>.md`:
|
|
151
|
+
|
|
152
|
+
```markdown
|
|
153
|
+
# {Plan Title}
|
|
154
|
+
|
|
155
|
+
**Status:** Draft
|
|
156
|
+
**Created:** {date}
|
|
157
|
+
**Workstream:** {name} ({id}) — or "None" if skipped
|
|
158
|
+
|
|
159
|
+
## Problem
|
|
160
|
+
|
|
161
|
+
{From Step 3a}
|
|
162
|
+
|
|
163
|
+
## Constraints
|
|
164
|
+
|
|
165
|
+
{From Step 3b}
|
|
166
|
+
|
|
167
|
+
## Options Considered
|
|
168
|
+
|
|
169
|
+
{From Step 3c — list each option with tradeoffs}
|
|
170
|
+
|
|
171
|
+
## Recommended Approach
|
|
172
|
+
|
|
173
|
+
{From Step 3d}
|
|
174
|
+
|
|
175
|
+
## Open Questions
|
|
176
|
+
|
|
177
|
+
{From Step 3e — numbered list}
|
|
178
|
+
|
|
179
|
+
## Implementation Notes
|
|
180
|
+
|
|
181
|
+
{Any technical details gathered during the conversation}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Tell the user: "Plan written to `docs/plans/{slug}.md`"
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Step 5: Post Summary to Workstream (skip if no workstream)
|
|
189
|
+
|
|
190
|
+
Post a concise summary of the plan:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
corners workstream push <workstreamId> --type status --message "$(cat <<'CORNERS_MSG'
|
|
194
|
+
Plan: {title}. {1-2 sentence summary of the recommended approach}. Plan document at docs/plans/{slug}.md.
|
|
195
|
+
CORNERS_MSG
|
|
196
|
+
)" --json
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Step 6: Post Open Questions (skip if no workstream or no questions)
|
|
202
|
+
|
|
203
|
+
For each open question identified in Step 3e, post it to the workstream:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
corners workstream question ask <workstreamId> \
|
|
207
|
+
--question "$(cat <<'CORNERS_MSG'
|
|
208
|
+
<question text>
|
|
209
|
+
CORNERS_MSG
|
|
210
|
+
)" \
|
|
211
|
+
--rationale "$(cat <<'CORNERS_MSG'
|
|
212
|
+
This question came up during planning for: {plan title}. See docs/plans/{slug}.md for full context.
|
|
213
|
+
CORNERS_MSG
|
|
214
|
+
)" \
|
|
215
|
+
--json
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Step 7: Confirm
|
|
221
|
+
|
|
222
|
+
Display:
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
Plan created:
|
|
226
|
+
File: docs/plans/{slug}.md
|
|
227
|
+
{If workstream: "Workstream: {name} ({id})"}
|
|
228
|
+
{If summary posted: "Summary posted to workstream feed"}
|
|
229
|
+
{If questions posted: "{N} open questions posted to corner chat"}
|
|
230
|
+
{If no workstream: "No workstream connected — plan is local only"}
|
|
231
|
+
|
|
232
|
+
{If questions posted:}
|
|
233
|
+
The team will see the open questions in corner chat.
|
|
234
|
+
When they answer, you can refine the plan.
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Manual Equivalent
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
# Create a workstream
|
|
243
|
+
corners workstream create "My Feature" --json
|
|
244
|
+
|
|
245
|
+
# Connect it
|
|
246
|
+
corners workstream use <wsId>
|
|
247
|
+
|
|
248
|
+
# Post a plan summary
|
|
249
|
+
corners workstream push <wsId> --type status --message "Plan: ..." --json
|
|
250
|
+
|
|
251
|
+
# Post an open question
|
|
252
|
+
corners workstream question ask <wsId> --question "..." --rationale "..." --json
|
|
253
|
+
```
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: corners-push
|
|
3
|
+
version: 0.1.0
|
|
4
|
+
description: |
|
|
5
|
+
Record progress, learnings, blockers, or outcomes to a workstream.
|
|
6
|
+
Auto-drafts from git state and asks for confirmation before posting.
|
|
7
|
+
allowed-tools:
|
|
8
|
+
- Bash
|
|
9
|
+
- Read
|
|
10
|
+
- AskUserQuestion
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# /corners-push — "Here's what I did / learned / hit"
|
|
14
|
+
|
|
15
|
+
Analyze your recent git activity, draft a progress update, and post it to your
|
|
16
|
+
connected workstream. The team sees this in corner chat.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Step 0: Preamble
|
|
21
|
+
|
|
22
|
+
Run these commands to check auth and resolve context:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
corners auth status --json 2>/dev/null || echo "CORNERS_CLI_MISSING"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
corners workstream current --json 2>/dev/null
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
|
|
34
|
+
echo "BRANCH: $_BRANCH"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Error handling — check in this order:**
|
|
38
|
+
|
|
39
|
+
1. If the first command printed `CORNERS_CLI_MISSING` or `command not found`: tell the user
|
|
40
|
+
"Corners CLI is not installed. Run `npm install -g @corners/cli` to install it." and **STOP**.
|
|
41
|
+
|
|
42
|
+
2. Parse the auth status JSON. If `loggedIn` is `false` OR `remoteValid` is `false`:
|
|
43
|
+
tell the user "Your Corners session has expired. Run `corners auth login` to re-authenticate." and **STOP**.
|
|
44
|
+
|
|
45
|
+
3. Parse the workstream current JSON. If `resolvedCorner` is null:
|
|
46
|
+
tell the user "No corner is configured. Run `corners corner use <cornerId>`." and **STOP**.
|
|
47
|
+
|
|
48
|
+
4. Check `connectedWorkstreamIds`. If empty:
|
|
49
|
+
tell the user "No workstream connected. Run `/corners-sync` first to connect one." and **STOP**.
|
|
50
|
+
|
|
51
|
+
Use the first connected workstream ID for all subsequent steps.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Step 1: Analyze Git State
|
|
56
|
+
|
|
57
|
+
Run:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
git log origin/main..HEAD --oneline 2>/dev/null
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git diff --stat 2>/dev/null | tail -5
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Parse the output:
|
|
68
|
+
- Count the number of commits since the base branch
|
|
69
|
+
- Note the files changed and their scope
|
|
70
|
+
|
|
71
|
+
**If no commits exist** (the git log is empty or the branch is main with no divergence):
|
|
72
|
+
Use AskUserQuestion:
|
|
73
|
+
- Question: "No new commits found since origin/main. Want to write a manual update instead?"
|
|
74
|
+
- Options: "Yes, write a manual update" / "Cancel"
|
|
75
|
+
If "Cancel", **STOP**.
|
|
76
|
+
If "Yes", skip to Step 3 with no auto-draft — ask the user to type the update.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Step 2: Classify Update Type
|
|
81
|
+
|
|
82
|
+
Based on the git context, determine the update type. If the type is clear from context
|
|
83
|
+
(e.g., all commits are `fix:` → outcome, a commit says "WIP" → status), set it directly.
|
|
84
|
+
|
|
85
|
+
If ambiguous, use AskUserQuestion:
|
|
86
|
+
- Re-ground: "Workstream update on branch {branch}. You have {N} commits since origin/main."
|
|
87
|
+
- Question: "What kind of update is this?"
|
|
88
|
+
- Options:
|
|
89
|
+
- **A) Status** — "Progress update: here's what I've done and what remains"
|
|
90
|
+
- **B) Learning** — "I discovered something the team should know"
|
|
91
|
+
- **C) Outcome** — "Work is complete, here's the result"
|
|
92
|
+
- **D) Blocker** — "I'm stuck and need help or a decision"
|
|
93
|
+
|
|
94
|
+
Note the selected type for Step 4.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Step 3: Draft the Update
|
|
99
|
+
|
|
100
|
+
Auto-generate a 2-5 sentence summary of the work done. Base it on:
|
|
101
|
+
- The commit messages from `git log`
|
|
102
|
+
- The files changed from `git diff --stat`
|
|
103
|
+
- The update type selected in Step 2
|
|
104
|
+
|
|
105
|
+
Write the draft in plain language as if explaining to a teammate who hasn't seen the code.
|
|
106
|
+
Focus on WHAT was accomplished and WHY, not implementation details.
|
|
107
|
+
|
|
108
|
+
Present the draft via AskUserQuestion:
|
|
109
|
+
- Re-ground: "Workstream update on branch {branch}, type: {type}."
|
|
110
|
+
- Question: "Here's the auto-drafted update. Edit or approve?"
|
|
111
|
+
- Show the draft text
|
|
112
|
+
- Options: "Post as-is" / "Let me edit it"
|
|
113
|
+
|
|
114
|
+
If "Let me edit it": use AskUserQuestion with a freeform text option for the user
|
|
115
|
+
to provide their edited version.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Step 4: Post the Update
|
|
120
|
+
|
|
121
|
+
Post the update using the heredoc pattern for shell safety:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
corners workstream push <workstreamId> --type <type> --message "$(cat <<'CORNERS_MSG'
|
|
125
|
+
<final message text>
|
|
126
|
+
CORNERS_MSG
|
|
127
|
+
)" --json
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Parse the response to confirm success.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Step 5: Detect and Attach Artifacts
|
|
135
|
+
|
|
136
|
+
Check for an open PR:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
gh pr view --json url,title,number 2>/dev/null
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
If a PR exists, use AskUserQuestion:
|
|
143
|
+
- Question: "Found open PR #{number}: '{title}'. Attach it to the workstream?"
|
|
144
|
+
- Options: "Yes, attach" / "No, skip"
|
|
145
|
+
|
|
146
|
+
If "Yes": note the attachment. (The CLI `corners workstream attach` command can
|
|
147
|
+
link PRs if supported, otherwise mention the PR URL in the update.)
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Step 6: Confirm
|
|
152
|
+
|
|
153
|
+
Display a confirmation:
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
Posted to workstream {name} ({id}):
|
|
157
|
+
Type: {type}
|
|
158
|
+
Message: "{first 100 chars of message}..."
|
|
159
|
+
{If PR attached: "Attached PR: #{number}"}
|
|
160
|
+
|
|
161
|
+
The team will see this in corner chat.
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Manual Equivalent
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# See what you've done
|
|
170
|
+
git log origin/main..HEAD --oneline
|
|
171
|
+
|
|
172
|
+
# Post an update
|
|
173
|
+
corners workstream push <wsId> --type status --message "..." --json
|
|
174
|
+
|
|
175
|
+
# Check for open PR
|
|
176
|
+
gh pr view --json url
|
|
177
|
+
```
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: corners-sync
|
|
3
|
+
version: 0.1.0
|
|
4
|
+
description: |
|
|
5
|
+
Pull workstream context and present a structured briefing.
|
|
6
|
+
Shows recent activity, open questions, and suggested next actions.
|
|
7
|
+
Offers to answer open questions inline and writes context to memory.
|
|
8
|
+
allowed-tools:
|
|
9
|
+
- Bash
|
|
10
|
+
- Read
|
|
11
|
+
- Write
|
|
12
|
+
- AskUserQuestion
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# /corners-sync — "Get me up to speed"
|
|
16
|
+
|
|
17
|
+
Pull context from your connected workstream, present a structured briefing,
|
|
18
|
+
answer open questions inline, and write key context to memory for future sessions.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Step 0: Preamble
|
|
23
|
+
|
|
24
|
+
Run these commands to check auth and resolve context:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
corners auth status --json 2>/dev/null || echo "CORNERS_CLI_MISSING"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
corners workstream current --json 2>/dev/null
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
|
|
36
|
+
echo "BRANCH: $_BRANCH"
|
|
37
|
+
git log --oneline -5 2>/dev/null
|
|
38
|
+
git status --short 2>/dev/null | head -10
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Error handling — check in this order:**
|
|
42
|
+
|
|
43
|
+
1. If the first command printed `CORNERS_CLI_MISSING` or `command not found`: tell the user
|
|
44
|
+
"Corners CLI is not installed. Run `npm install -g @corners/cli` to install it." and **STOP**.
|
|
45
|
+
|
|
46
|
+
2. Parse the auth status JSON. If `loggedIn` is `false` OR `remoteValid` is `false`:
|
|
47
|
+
tell the user "Your Corners session has expired. Run `corners auth login` to re-authenticate." and **STOP**.
|
|
48
|
+
|
|
49
|
+
3. Parse the workstream current JSON. If `resolvedCorner` is null or missing:
|
|
50
|
+
tell the user "No corner is configured for this directory. Run `corners corner use <cornerId>` to set one up." and **STOP**.
|
|
51
|
+
|
|
52
|
+
4. Check `connectedWorkstreamIds` in the workstream current JSON.
|
|
53
|
+
If the array is empty, proceed to Step 1 (workstream resolution).
|
|
54
|
+
If it has entries, skip to Step 2 using the first connected workstream ID.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Step 1: Workstream Resolution (only if no workstream connected)
|
|
59
|
+
|
|
60
|
+
Run:
|
|
61
|
+
```bash
|
|
62
|
+
corners workstream list --json 2>/dev/null
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Parse the response. There are three scenarios:
|
|
66
|
+
|
|
67
|
+
**Scenario A — Workstreams exist:**
|
|
68
|
+
Normalize the current git branch name: strip common prefixes (`feat/`, `fix/`, `chore/`, `refactor/`),
|
|
69
|
+
replace hyphens and underscores with spaces, and title-case the result.
|
|
70
|
+
Compare this normalized name against the `name` field of each workstream in the list.
|
|
71
|
+
|
|
72
|
+
If a workstream name is similar to the normalized branch name, use AskUserQuestion:
|
|
73
|
+
- Question: "Found workstream '{name}' which seems related to your branch '{branch}'. Connect it?"
|
|
74
|
+
- Options: "Yes, connect it" / "No, show me all workstreams" / "Create a new one instead"
|
|
75
|
+
|
|
76
|
+
If "Yes": run `corners workstream use <id> --json` and proceed to Step 2.
|
|
77
|
+
If "Show all": present the full list via AskUserQuestion and let the user pick.
|
|
78
|
+
If "Create new": proceed to Scenario C.
|
|
79
|
+
|
|
80
|
+
If no workstream name matches the branch, present the full list via AskUserQuestion
|
|
81
|
+
and let the user pick one, or offer to create a new one.
|
|
82
|
+
|
|
83
|
+
**Scenario B — No workstreams exist anywhere:**
|
|
84
|
+
Use AskUserQuestion:
|
|
85
|
+
- Question: "No workstreams exist yet. Create one to start tracking your work?"
|
|
86
|
+
- Derive a suggested name from the current branch (e.g., `feat/auth-refactor` → "Auth Refactor")
|
|
87
|
+
- Options: "Yes, create '{suggested name}'" / "Yes, with a different name" / "Skip — just show git context"
|
|
88
|
+
|
|
89
|
+
If creating: run `corners workstream create "{name}" --json`, then `corners workstream use <returned id> --json`.
|
|
90
|
+
|
|
91
|
+
**Scenario C — Create new:**
|
|
92
|
+
Derive name from branch, confirm with user, run create + use.
|
|
93
|
+
|
|
94
|
+
After resolution, proceed to Step 2 with the workstream ID.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Step 2: Pull Workstream Context
|
|
99
|
+
|
|
100
|
+
Run these commands to gather full context:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
corners workstream pull <workstreamId> --json 2>/dev/null
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
corners workstream question list <workstreamId> --json 2>/dev/null
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Parse the JSON responses. Extract:
|
|
111
|
+
- From pull: `workstream.id`, `workstream.name`, `workstream.summary`, `workstream.status`,
|
|
112
|
+
`threads[]`, `feedEvents[]`, `attachments[]`
|
|
113
|
+
- From question list: `questions[]` with fields `id`, `questionText`, `rationale`,
|
|
114
|
+
`suggestedAnswers[]`, `askedBy`, `status`, `createdAt`
|
|
115
|
+
|
|
116
|
+
If `feedEvents` or `threads` has more than 10 items, use only the most recent 10
|
|
117
|
+
and note the total count.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Step 3: Present Structured Briefing
|
|
122
|
+
|
|
123
|
+
Display the briefing in this format:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
## Workstream: {name} ({id})
|
|
127
|
+
Status: {status}
|
|
128
|
+
Summary: {summary}
|
|
129
|
+
|
|
130
|
+
### Recent Activity
|
|
131
|
+
{Summarize the last 10 feed events in 1-2 lines each. Include type, timestamp, and key content.}
|
|
132
|
+
|
|
133
|
+
### Open Questions ({count})
|
|
134
|
+
{For each open question:}
|
|
135
|
+
- **{askedBy}** ({timeAgo}): "{questionText}"
|
|
136
|
+
Suggested answers: {list suggestedAnswers}
|
|
137
|
+
|
|
138
|
+
### Threads ({count})
|
|
139
|
+
{For each thread, show topic/subject and message count}
|
|
140
|
+
|
|
141
|
+
### Attachments ({count})
|
|
142
|
+
{List any linked documents, files, or artifacts}
|
|
143
|
+
|
|
144
|
+
### Local Git State
|
|
145
|
+
Branch: {branch}
|
|
146
|
+
Recent commits: {list from git log}
|
|
147
|
+
Working tree: {clean / N files modified}
|
|
148
|
+
|
|
149
|
+
### Suggested Next Actions
|
|
150
|
+
{Based on the context, suggest 2-3 concrete next steps. Examples:}
|
|
151
|
+
- Answer Alice's question about the API schema
|
|
152
|
+
- Review the latest thread about deployment
|
|
153
|
+
- Continue work on the auth-refactor branch
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Step 4: Answer-at-Sync
|
|
159
|
+
|
|
160
|
+
After presenting the briefing, check if any open questions exist.
|
|
161
|
+
|
|
162
|
+
For each open question (up to 3), use AskUserQuestion:
|
|
163
|
+
- Re-ground: "Workstream '{name}' on branch {branch}."
|
|
164
|
+
- Question: "{askedBy} asked: '{questionText}'"
|
|
165
|
+
- If suggested answers exist, include them as options plus "Skip" and "Custom answer"
|
|
166
|
+
- If no suggested answers, options: "Answer now" / "Skip"
|
|
167
|
+
|
|
168
|
+
If the user provides an answer, post it:
|
|
169
|
+
```bash
|
|
170
|
+
corners workstream question answer <questionId> --text "$(cat <<'CORNERS_MSG'
|
|
171
|
+
<user's answer text>
|
|
172
|
+
CORNERS_MSG
|
|
173
|
+
)" --json
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
If the user skips, move to the next question or proceed to Step 5.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Step 5: Memory Write
|
|
181
|
+
|
|
182
|
+
Write workstream context to Claude Code's memory system so it persists across conversations.
|
|
183
|
+
|
|
184
|
+
Determine the memory directory path. It follows the pattern:
|
|
185
|
+
`~/.claude/projects/-{path-with-hyphens}/memory/`
|
|
186
|
+
|
|
187
|
+
For this project, the path is derived from the working directory. Use the memory
|
|
188
|
+
directory that already exists for this project.
|
|
189
|
+
|
|
190
|
+
Write a memory file named `workstream_{normalized_name}.md` (lowercase, hyphens for spaces):
|
|
191
|
+
|
|
192
|
+
```markdown
|
|
193
|
+
---
|
|
194
|
+
name: Workstream context - {name}
|
|
195
|
+
description: Active workstream {name} ({id}) - {summary}
|
|
196
|
+
type: project
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
Connected workstream for this repository.
|
|
200
|
+
|
|
201
|
+
- **ID:** {id}
|
|
202
|
+
- **Name:** {name}
|
|
203
|
+
- **Status:** {status}
|
|
204
|
+
- **Summary:** {summary}
|
|
205
|
+
|
|
206
|
+
**Open questions ({count}):**
|
|
207
|
+
{For each: "- {askedBy}: {questionText}" — keep to 1 line each}
|
|
208
|
+
|
|
209
|
+
**Recent activity:**
|
|
210
|
+
{2-3 sentence summary of what's been happening}
|
|
211
|
+
|
|
212
|
+
**How to apply:** When working in this repo, this workstream provides the coordination context. Check for open questions before starting new work. Use /corners-push to record progress.
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Then read the existing `MEMORY.md` file in the same directory. If a reference to this
|
|
216
|
+
workstream memory file doesn't already exist, add it under the `## Project` section.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Manual Equivalent
|
|
221
|
+
|
|
222
|
+
The raw CLI commands this skill orchestrates:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
# Check auth
|
|
226
|
+
corners auth status --json
|
|
227
|
+
|
|
228
|
+
# Resolve local context
|
|
229
|
+
corners workstream current --json
|
|
230
|
+
|
|
231
|
+
# List available workstreams
|
|
232
|
+
corners workstream list --json
|
|
233
|
+
|
|
234
|
+
# Connect a workstream
|
|
235
|
+
corners workstream use <wsId>
|
|
236
|
+
|
|
237
|
+
# Pull full context
|
|
238
|
+
corners workstream pull <wsId> --json
|
|
239
|
+
|
|
240
|
+
# List open questions
|
|
241
|
+
corners workstream question list <wsId> --json
|
|
242
|
+
|
|
243
|
+
# Answer a question
|
|
244
|
+
corners workstream question answer <questionId> --text "..." --json
|
|
245
|
+
```
|