@corners/cli 0.0.5 → 0.0.7

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.
@@ -0,0 +1,223 @@
1
+ ---
2
+ name: corners-ask
3
+ version: 0.1.0
4
+ description: |
5
+ Post a durable question to a workstream for team input.
6
+ Offers structured templates and auto-generates rationale from code context.
7
+ allowed-tools:
8
+ - Bash
9
+ - Read
10
+ - AskUserQuestion
11
+ ---
12
+
13
+ # /corners-ask — "I need the team's input"
14
+
15
+ Post a well-structured question to your workstream. The question is visible to the
16
+ whole team in corner chat. When they answer, skill continuation can auto-resume
17
+ your work if configured.
18
+
19
+ ---
20
+
21
+ ## Step 0: Preamble
22
+
23
+ Run these commands to check auth and resolve context:
24
+
25
+ ```bash
26
+ corners auth status --json 2>/dev/null || echo "CORNERS_CLI_MISSING"
27
+ ```
28
+
29
+ ```bash
30
+ corners workstream current --json 2>/dev/null
31
+ ```
32
+
33
+ ```bash
34
+ _BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
35
+ echo "BRANCH: $_BRANCH"
36
+ ```
37
+
38
+ **Error handling — check in this order:**
39
+
40
+ 1. If `CORNERS_CLI_MISSING` or `command not found`: tell user to install (`npm install -g @corners/cli`) and **STOP**.
41
+ 2. If `loggedIn=false` OR `remoteValid=false`: tell user to run `corners auth login` and **STOP**.
42
+ 3. If `resolvedCorner` is null: tell user to run `corners corner use <id>` and **STOP**.
43
+ 4. If `connectedWorkstreamIds` is empty: tell user to run `/corners-sync` first and **STOP**.
44
+
45
+ Use the first connected workstream ID for all subsequent steps.
46
+
47
+ ---
48
+
49
+ ## Step 1: Gather Code Context
50
+
51
+ Run:
52
+
53
+ ```bash
54
+ git diff --stat 2>/dev/null | head -10
55
+ ```
56
+
57
+ ```bash
58
+ git log --oneline -5 2>/dev/null
59
+ ```
60
+
61
+ Note the current branch, recently modified files, and recent commit messages.
62
+ This context will be used to auto-generate the question's rationale.
63
+
64
+ ---
65
+
66
+ ## Step 2: Choose Question Template
67
+
68
+ Use AskUserQuestion:
69
+ - Re-ground: "Workstream question on branch {branch}."
70
+ - Question: "What kind of question do you need to ask the team?"
71
+ - Options:
72
+ - **A) Architecture decision** — "We need to choose between technical approaches. I'll help you frame the options and tradeoffs."
73
+ - **B) Scope clarification** — "Something might be in or out of scope. I'll help you ask clearly."
74
+ - **C) Blocker escalation** — "You're blocked and need someone to unblock you. I'll help frame the urgency."
75
+ - **D) Freeform** — "Custom question — I'll help you sharpen it."
76
+
77
+ Note the selected template for Step 3.
78
+
79
+ ---
80
+
81
+ ## Step 3: Formulate the Question
82
+
83
+ Based on the selected template, guide the user through formulation.
84
+
85
+ ### Template A: Architecture Decision
86
+
87
+ Use AskUserQuestion:
88
+ - Question: "What's the technical decision you're facing? Describe the options you see."
89
+ - Options: freeform text
90
+
91
+ Then draft the question in this structure:
92
+ ```
93
+ We need to decide: {user's decision}
94
+
95
+ Options:
96
+ A) {option 1} — {tradeoff}
97
+ B) {option 2} — {tradeoff}
98
+ C) {option 3 if applicable}
99
+
100
+ Context: Currently working on branch {branch}. Recent changes: {summary from git context}.
101
+ ```
102
+
103
+ ### Template B: Scope Clarification
104
+
105
+ Use AskUserQuestion:
106
+ - Question: "What's the scope question? What might be in or out?"
107
+ - Options: freeform text
108
+
109
+ Draft:
110
+ ```
111
+ Scope question: {user's question}
112
+
113
+ Current context: Working on {branch}. This came up while {brief context from git}.
114
+ If in scope: {implication}
115
+ If out of scope: {implication}
116
+ ```
117
+
118
+ ### Template C: Blocker Escalation
119
+
120
+ Use AskUserQuestion:
121
+ - Question: "What are you blocked on? Who or what can unblock you?"
122
+ - Options: freeform text
123
+
124
+ Draft:
125
+ ```
126
+ Blocked: {user's blocker description}
127
+
128
+ Impact: {what can't proceed until this is resolved}
129
+ Needed from: {person or team if known}
130
+ Branch: {branch}
131
+ ```
132
+
133
+ ### Template D: Freeform
134
+
135
+ Use AskUserQuestion:
136
+ - Question: "What do you want to ask the team?"
137
+ - Options: freeform text
138
+
139
+ Use the user's text directly.
140
+
141
+ ---
142
+
143
+ ## Step 4: Refine and Confirm
144
+
145
+ Present the drafted question to the user via AskUserQuestion:
146
+ - Show the full question text
147
+ - Show the auto-generated rationale (derived from git context: "This question arose while
148
+ working on branch {branch}, which modifies {files}. Recent commits: {summary}.")
149
+ - Show 2-3 suggested answers (derived from the template — for architecture decisions,
150
+ the options become suggested answers; for scope, "In scope" / "Out of scope" / "Defer";
151
+ for blockers, "I can help" / "Escalate to {person}" / "Deprioritize")
152
+ - Options: "Post as-is" / "Edit question" / "Edit rationale" / "Cancel"
153
+
154
+ If the user wants to edit, use AskUserQuestion for the specific field and re-present.
155
+
156
+ ---
157
+
158
+ ## Step 5: Post the Question
159
+
160
+ Post via heredoc for shell safety:
161
+
162
+ ```bash
163
+ corners workstream question ask <workstreamId> \
164
+ --question "$(cat <<'CORNERS_MSG'
165
+ <final question text>
166
+ CORNERS_MSG
167
+ )" \
168
+ --rationale "$(cat <<'CORNERS_MSG'
169
+ <final rationale text>
170
+ CORNERS_MSG
171
+ )" \
172
+ --suggested-answer "<answer 1>" \
173
+ --suggested-answer "<answer 2>" \
174
+ --json
175
+ ```
176
+
177
+ Parse the response to confirm success and extract the question ID.
178
+
179
+ ---
180
+
181
+ ## Step 6: Blocker Follow-up (Template C only)
182
+
183
+ If the user selected "Blocker escalation" in Step 2, also push a blocker update:
184
+
185
+ ```bash
186
+ corners workstream push <workstreamId> --type blocker --message "$(cat <<'CORNERS_MSG'
187
+ <brief blocker description from the question>
188
+ CORNERS_MSG
189
+ )" --json
190
+ ```
191
+
192
+ ---
193
+
194
+ ## Step 7: Confirm
195
+
196
+ Display:
197
+
198
+ ```
199
+ Posted question to workstream {name} ({id}):
200
+ "{first 80 chars of question}..."
201
+ Suggested answers: {list}
202
+ {If blocker also posted: "Also posted blocker update."}
203
+
204
+ The team will see this in corner chat.
205
+ When they answer, skill continuation will auto-resume if configured.
206
+ ```
207
+
208
+ ---
209
+
210
+ ## Manual Equivalent
211
+
212
+ ```bash
213
+ # Post a question
214
+ corners workstream question ask <wsId> \
215
+ --question "What should we do about X?" \
216
+ --rationale "This came up while working on Y" \
217
+ --suggested-answer "Option A" \
218
+ --suggested-answer "Option B" \
219
+ --json
220
+
221
+ # Also post a blocker (if applicable)
222
+ corners workstream push <wsId> --type blocker --message "Blocked on X" --json
223
+ ```
@@ -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
+ ```