@pi-unipi/workflow 0.1.7 → 0.1.9

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,313 @@
1
+ ---
2
+ name: chore-create
3
+ description: "Create reusable chore — save repeatable tasks like deploy, publish, push to docs/chore/."
4
+ ---
5
+
6
+ # Creating Chores
7
+
8
+ Create reusable chore definitions for repeatable tasks. Save to `.unipi/docs/chore/` for future execution.
9
+
10
+ ## Boundaries
11
+
12
+ **This skill MAY:** read codebase, ask questions, write chore to `.unipi/docs/chore/`.
13
+ **This skill MAY NOT:** edit code, execute the chore, run tests, deploy.
14
+
15
+ **This is definition only — not execution.**
16
+
17
+ ## Command Format
18
+
19
+ ```
20
+ /unipi:chore-create <string(greedy)>
21
+ ```
22
+
23
+ - `string(greedy)` — description of the chore to create (e.g., "push to github main", "publish npm package")
24
+ - Write-only sandbox (`.unipi/docs/chore/`)
25
+
26
+ ## Output Path
27
+
28
+ ```
29
+ .unipi/docs/chore/<chore-name>.md
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Process
35
+
36
+ ### Phase 1: Understand the Chore
37
+
38
+ 1. Read the chore description
39
+ 2. Ask clarifying questions (one at a time):
40
+ - "What are the exact steps for this chore?"
41
+ - "Any pre-conditions before running?"
42
+ - "What should happen if a step fails?"
43
+ - "Is this interactive or fully automated?"
44
+
45
+ 3. Determine chore type:
46
+ - **Deploy** — push to production/staging
47
+ - **Publish** — npm, pypi, docker registry
48
+ - **Git** — push, merge, release
49
+ - **Build** — compile, bundle, package
50
+ - **Test** — run specific test suites
51
+ - **Maintenance** — cleanup, backup, sync
52
+ - **Custom** — any repeatable task
53
+
54
+ **Exit:** Chore understood, steps clear.
55
+
56
+ ### Phase 2: Design Chore Structure
57
+
58
+ Plan the chore:
59
+
60
+ 1. **Name** — kebab-case, descriptive (e.g., `push-github-main`, `publish-npm`)
61
+ 2. **Steps** — ordered list of commands/actions
62
+ 3. **Pre-conditions** — what must be true before running
63
+ 4. **Post-conditions** — what should be true after success
64
+ 5. **Failure handling** — what to do if steps fail
65
+ 6. **Interactive points** — where user input may be needed
66
+
67
+ **Exit:** Structure designed.
68
+
69
+ ### Phase 3: Write Chore File
70
+
71
+ Create `.unipi/docs/chore/<chore-name>.md`:
72
+
73
+ ```markdown
74
+ ---
75
+ name: {chore-name}
76
+ type: chore
77
+ description: {One-line description}
78
+ created: YYYY-MM-DD
79
+ ---
80
+
81
+ # {Chore Name}
82
+
83
+ {Description of what this chore does and when to use it}
84
+
85
+ ## Pre-conditions
86
+
87
+ Before running this chore, ensure:
88
+ - [ ] {Pre-condition 1}
89
+ - [ ] {Pre-condition 2}
90
+
91
+ ## Steps
92
+
93
+ ### Step 1: {Step Name}
94
+ {What to do}
95
+
96
+ ```bash
97
+ {command}
98
+ ```
99
+
100
+ Expected: {what should happen}
101
+
102
+ ### Step 2: {Step Name}
103
+ {What to do}
104
+
105
+ ```bash
106
+ {command}
107
+ ```
108
+
109
+ Expected: {what should happen}
110
+
111
+ ### Step N: Verify
112
+ {How to verify success}
113
+
114
+ ```bash
115
+ {verification command}
116
+ ```
117
+
118
+ Expected: {success indicator}
119
+
120
+ ## Failure Handling
121
+
122
+ If any step fails:
123
+ 1. {What to check}
124
+ 2. {How to recover}
125
+ 3. {When to abort}
126
+
127
+ ## Post-conditions
128
+
129
+ After successful completion:
130
+ - [ ] {Post-condition 1}
131
+ - [ ] {Post-condition 2}
132
+
133
+ ## Notes
134
+ {Any additional context, gotchas, or tips}
135
+ ```
136
+
137
+ ### Phase 4: Self-Review
138
+
139
+ Before presenting:
140
+ 1. Are all steps clear and executable?
141
+ 2. Are commands correct and tested?
142
+ 3. Is failure handling comprehensive?
143
+ 4. Would someone else be able to run this?
144
+
145
+ ### Phase 5: Present & Handoff
146
+
147
+ Present to user:
148
+
149
+ > "Chore created at `.unipi/docs/chore/<chore-name>.md`"
150
+ >
151
+ > **Steps:** {count} steps
152
+ > **Type:** {deploy/publish/git/etc.}
153
+
154
+ Then suggest:
155
+
156
+ ```
157
+ /unipi:chore-execute chore:<chore-name>
158
+ ```
159
+
160
+ Or if more chores needed:
161
+ > "Need to create more chores?"
162
+
163
+ ---
164
+
165
+ ## Chore Naming Convention
166
+
167
+ Use kebab-case with action-verb prefix:
168
+
169
+ | Pattern | Example |
170
+ |---------|---------|
171
+ | `push-{target}` | `push-github-main`, `push-github-develop` |
172
+ | `publish-{registry}` | `publish-npm`, `publish-docker` |
173
+ | `deploy-{env}` | `deploy-staging`, `deploy-production` |
174
+ | `run-{suite}` | `run-unit-tests`, `run-e2e-tests` |
175
+ | `sync-{service}` | `sync-translations`, `sync-config` |
176
+ | `backup-{target}` | `backup-database`, `backup-files` |
177
+ | `release-{type}` | `release-patch`, `release-minor` |
178
+
179
+ ---
180
+
181
+ ## Examples
182
+
183
+ ### Push to GitHub Main
184
+
185
+ ```
186
+ /unipi:chore-create push current branch to github main
187
+ ```
188
+
189
+ Creates `.unipi/docs/chore/push-github-main.md`:
190
+ ```markdown
191
+ ---
192
+ name: push-github-main
193
+ type: chore
194
+ description: Push current branch changes to GitHub main
195
+ created: 2026-04-28
196
+ ---
197
+
198
+ # Push to GitHub Main
199
+
200
+ Push committed changes from current branch to GitHub main branch.
201
+
202
+ ## Pre-conditions
203
+ - [ ] All changes committed
204
+ - [ ] On correct branch
205
+ - [ ] Tests passing
206
+
207
+ ## Steps
208
+
209
+ ### Step 1: Verify clean working tree
210
+ ```bash
211
+ git status
212
+ ```
213
+ Expected: "nothing to commit, working tree clean"
214
+
215
+ ### Step 2: Push to remote
216
+ ```bash
217
+ git push origin main
218
+ ```
219
+ Expected: Success with no errors
220
+
221
+ ### Step 3: Verify push
222
+ ```bash
223
+ git log --oneline -1
224
+ ```
225
+ Expected: Latest commit matches remote
226
+
227
+ ## Failure Handling
228
+ If push rejected:
229
+ 1. Pull latest: `git pull origin main`
230
+ 2. Resolve conflicts if any
231
+ 3. Retry push
232
+
233
+ ## Post-conditions
234
+ - [ ] Remote main is up to date
235
+ ```
236
+
237
+ ### Publish to NPM
238
+
239
+ ```
240
+ /unipi:chore-create publish package to npm registry
241
+ ```
242
+
243
+ Creates `.unipi/docs/chore/publish-npm.md`:
244
+ ```markdown
245
+ ---
246
+ name: publish-npm
247
+ type: chore
248
+ description: Publish package to npm registry
249
+ created: 2026-04-28
250
+ ---
251
+
252
+ # Publish to NPM
253
+
254
+ Publish the current package version to npm registry.
255
+
256
+ ## Pre-conditions
257
+ - [ ] Logged in to npm (`npm whoami`)
258
+ - [ ] Version bumped in package.json
259
+ - [ ] All changes committed
260
+ - [ ] Tests passing
261
+
262
+ ## Steps
263
+
264
+ ### Step 1: Verify npm login
265
+ ```bash
266
+ npm whoami
267
+ ```
268
+ Expected: Your npm username
269
+
270
+ ### Step 2: Run tests
271
+ ```bash
272
+ npm test
273
+ ```
274
+ Expected: All tests passing
275
+
276
+ ### Step 3: Build package
277
+ ```bash
278
+ npm run build
279
+ ```
280
+ Expected: Build succeeds
281
+
282
+ ### Step 4: Publish
283
+ ```bash
284
+ npm publish
285
+ ```
286
+ Expected: Package published successfully
287
+
288
+ ### Step 5: Verify publication
289
+ ```bash
290
+ npm view {package-name} version
291
+ ```
292
+ Expected: Matches package.json version
293
+
294
+ ## Failure Handling
295
+ If publish fails:
296
+ 1. Check npm login: `npm whoami`
297
+ 2. Check version: must be higher than current
298
+ 3. Check package name conflicts
299
+
300
+ ## Post-conditions
301
+ - [ ] Package available on npm
302
+ - [ ] Version matches package.json
303
+ ```
304
+
305
+ ---
306
+
307
+ ## Notes
308
+
309
+ - Chores are reusable — create once, execute many times
310
+ - Keep steps clear and executable by anyone
311
+ - Include verification steps for confidence
312
+ - Document failure scenarios for resilience
313
+ - Chores are stored in `.unipi/docs/chore/` for discoverability
@@ -0,0 +1,312 @@
1
+ ---
2
+ name: chore-execute
3
+ description: "Execute a saved chore — run deploy, publish, push, or any repeatable task from docs/chore/."
4
+ ---
5
+
6
+ # Executing Chores
7
+
8
+ Run saved chore definitions. Autocomplete available for chore file selection.
9
+
10
+ ## Boundaries
11
+
12
+ **This skill MAY:** read chore file, run commands, ask user for confirmation, report results.
13
+ **This skill MAY NOT:** create new chores, edit code (unless chore requires it).
14
+
15
+ ## Command Format
16
+
17
+ ```
18
+ /unipi:chore-execute chore:<path>(optional) <string(greedy)>(optional)
19
+ ```
20
+
21
+ - `chore:<path>` — chore file to execute (autocomplete available)
22
+ - `string(greedy)` — optional context or overrides (e.g., "skip tests", "dry run")
23
+ - If no chore provided → agent lists available chores and asks
24
+
25
+ ## Input Path
26
+
27
+ ```
28
+ .unipi/docs/chore/<chore-name>.md
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Process
34
+
35
+ ### Phase 1: Load Chore
36
+
37
+ **If `chore:` arg provided:**
38
+ 1. Read the chore file from `.unipi/docs/chore/`
39
+ 2. Understand: steps, pre-conditions, failure handling
40
+
41
+ **If no chore provided:**
42
+ 1. List available chore files in `.unipi/docs/chore/`
43
+ 2. Present to user for selection (autocomplete-style)
44
+
45
+ ```
46
+ Available chores:
47
+ ┌─────────────────────────────┬─────────────────────────────────────┐
48
+ │ Chore │ Description │
49
+ ├─────────────────────────────┼─────────────────────────────────────┤
50
+ │ push-github-main.md │ Push current branch to GitHub main │
51
+ │ publish-npm.md │ Publish package to npm registry │
52
+ │ deploy-staging.md │ Deploy to staging environment │
53
+ │ run-full-tests.md │ Run complete test suite │
54
+ └─────────────────────────────┴─────────────────────────────────────┘
55
+ ```
56
+
57
+ **Exit:** Chore loaded. Steps understood.
58
+
59
+ ### Phase 2: Pre-condition Check
60
+
61
+ Before executing, verify pre-conditions:
62
+
63
+ 1. Read pre-conditions from chore file
64
+ 2. For each pre-condition:
65
+ - Run verification command if provided
66
+ - Ask user to confirm if manual check
67
+ - Report status
68
+
69
+ ```
70
+ Pre-conditions:
71
+ ✓ All changes committed — verified
72
+ ✓ On correct branch — verified (main)
73
+ ? Tests passing — should I run tests first?
74
+ ```
75
+
76
+ **If pre-conditions fail:**
77
+ > "Pre-condition not met: {description}. Fix this before continuing?"
78
+ - If yes → help fix or wait for user
79
+ - If no → abort chore
80
+
81
+ **If `string(greedy)` contains overrides:**
82
+ - "skip tests" → skip test steps
83
+ - "dry run" → show commands without executing
84
+ - "force" → skip pre-condition checks (with warning)
85
+
86
+ **Exit:** Pre-conditions verified (or overridden).
87
+
88
+ ### Phase 3: Execute Steps
89
+
90
+ For each step in the chore:
91
+
92
+ 1. **Display step:**
93
+ ```
94
+ Step 2/5: Push to remote
95
+ > git push origin main
96
+ ```
97
+
98
+ 2. **Confirm execution** (for destructive commands):
99
+ > "Execute this step?"
100
+
101
+ 3. **Run command:**
102
+ ```bash
103
+ {command}
104
+ ```
105
+
106
+ 4. **Check result:**
107
+ - If success → proceed to next step
108
+ - If failure → go to Phase 4 (Failure Handling)
109
+
110
+ 5. **Report progress:**
111
+ ```
112
+ ✓ Step 1/5: Verify clean working tree
113
+ ✓ Step 2/5: Push to remote
114
+ ○ Step 3/5: Verify push (running...)
115
+ ```
116
+
117
+ **Exit:** All steps completed.
118
+
119
+ ### Phase 4: Failure Handling (if needed)
120
+
121
+ If a step fails:
122
+
123
+ 1. **Report failure:**
124
+ ```
125
+ ✗ Step 2/5: Push to remote — FAILED
126
+ Error: rejected (non-fast-forward)
127
+ ```
128
+
129
+ 2. **Check chore's failure handling section:**
130
+ - Follow recovery steps
131
+ - Run diagnostic commands
132
+ - Ask user for decision
133
+
134
+ 3. **Options:**
135
+ - **Retry** — try the step again
136
+ - **Skip** — skip this step (if non-critical)
137
+ - **Abort** — stop chore execution
138
+ - **Manual** — user handles this step
139
+
140
+ 4. **If recovery succeeds:**
141
+ > "Recovered from failure. Continuing..."
142
+ → Resume execution
143
+
144
+ 5. **If recovery fails:**
145
+ > "Cannot recover. Chore aborted at step {N}."
146
+ → Report what was completed and what remains
147
+
148
+ ### Phase 5: Verify Completion
149
+
150
+ After all steps complete:
151
+
152
+ 1. Run post-condition checks
153
+ 2. Run verification commands from chore
154
+ 3. Report success:
155
+
156
+ ```
157
+ Chore Complete: {chore-name}
158
+
159
+ ✓ Step 1: {name}
160
+ ✓ Step 2: {name}
161
+ ✓ Step 3: {name}
162
+ ✓ Step 4: {name}
163
+ ✓ Step 5: {name}
164
+
165
+ Post-conditions:
166
+ ✓ {Post-condition 1} — verified
167
+ ✓ {Post-condition 2} — verified
168
+ ```
169
+
170
+ ### Phase 6: Report
171
+
172
+ > "Chore `{chore-name}` completed successfully."
173
+
174
+ If there were issues:
175
+ > "Chore completed with notes: {notes}"
176
+
177
+ ---
178
+
179
+ ## Autocomplete Behavior
180
+
181
+ When user types `/unipi:chore-execute chore:`, autocomplete shows:
182
+
183
+ ```
184
+ Available chores:
185
+ ┌─────────────────────────────┬────────────┬─────────────────────────────────────┐
186
+ │ File │ Type │ Description │
187
+ ├─────────────────────────────┼────────────┼─────────────────────────────────────┤
188
+ │ push-github-main.md │ git │ Push current branch to GitHub main │
189
+ │ publish-npm.md │ publish │ Publish package to npm registry │
190
+ │ deploy-staging.md │ deploy │ Deploy to staging environment │
191
+ └─────────────────────────────┴────────────┴─────────────────────────────────────┘
192
+ ```
193
+
194
+ User selects one, or types path manually.
195
+
196
+ ---
197
+
198
+ ## Context Overrides
199
+
200
+ The `string(greedy)` parameter can override chore behavior:
201
+
202
+ | Override | Effect |
203
+ |----------|--------|
204
+ | `skip tests` | Skip test/verification steps |
205
+ | `dry run` | Show commands without executing |
206
+ | `force` | Skip pre-condition checks |
207
+ | `verbose` | Show detailed output |
208
+ | `step 3` | Start from step 3 |
209
+
210
+ Example:
211
+ ```
212
+ /unipi:chore-execute chore:publish-npm skip tests
213
+ ```
214
+
215
+ ---
216
+
217
+ ## Examples
218
+
219
+ ### Execute Push to GitHub
220
+
221
+ ```
222
+ /unipi:chore-execute chore:push-github-main
223
+ ```
224
+
225
+ Output:
226
+ ```
227
+ Loading chore: push-github-main
228
+ Description: Push current branch changes to GitHub main
229
+
230
+ Pre-conditions:
231
+ ✓ All changes committed — verified (3 files committed)
232
+ ✓ On correct branch — verified (main)
233
+
234
+ Executing steps:
235
+
236
+ Step 1/3: Verify clean working tree
237
+ > git status
238
+ ✓ Working tree clean
239
+
240
+ Step 2/3: Push to remote
241
+ > git push origin main
242
+ ✓ Pushed to origin/main
243
+
244
+ Step 3/3: Verify push
245
+ > git log --oneline -1
246
+ ✓ Remote matches local
247
+
248
+ Post-conditions:
249
+ ✓ Remote main is up to date
250
+
251
+ Chore push-github-main completed successfully.
252
+ ```
253
+
254
+ ### Execute Publish to NPM (with override)
255
+
256
+ ```
257
+ /unipi:chore-execute chore:publish-npm dry run
258
+ ```
259
+
260
+ Output:
261
+ ```
262
+ Loading chore: publish-npm
263
+ Description: Publish package to npm registry
264
+ Mode: DRY RUN (commands shown but not executed)
265
+
266
+ Steps that would run:
267
+ 1. npm whoami
268
+ 2. npm test
269
+ 3. npm run build
270
+ 4. npm publish
271
+ 5. npm view @pi-unipi/workflow version
272
+
273
+ Dry run complete. No commands executed.
274
+ ```
275
+
276
+ ---
277
+
278
+ ## Error Recovery
279
+
280
+ When a step fails, the agent should:
281
+
282
+ 1. **Diagnose** — understand why it failed
283
+ 2. **Suggest** — propose recovery steps
284
+ 3. **Execute** — try recovery if user approves
285
+ 4. **Report** — explain what happened
286
+
287
+ Example:
288
+ ```
289
+ Step 2/5: Push to remote
290
+ > git push origin main
291
+ ✗ FAILED: rejected (non-fast-forward)
292
+
293
+ Diagnosis: Remote has commits not in local branch
294
+
295
+ Recovery options:
296
+ 1. Pull and merge: git pull origin main
297
+ 2. Force push: git push --force origin main (dangerous!)
298
+ 3. Abort chore
299
+
300
+ Which option?
301
+ ```
302
+
303
+ ---
304
+
305
+ ## Notes
306
+
307
+ - Chores are reusable — same chore can be run many times
308
+ - Autocomplete makes it easy to find the right chore
309
+ - Pre-condition checks prevent common failures
310
+ - Failure handling provides recovery paths
311
+ - Context overrides allow flexibility without editing chore files
312
+ - Chores stored in `.unipi/docs/chore/` for discoverability