@pikku/skills 0.12.42 → 0.12.43

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/skills",
3
- "version": "0.12.42",
3
+ "version": "0.12.43",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/pikkujs/pikku.git",
@@ -1,172 +1,124 @@
1
1
  ---
2
2
  name: pikku-changes
3
- description: 'Work a project''s changes queue — the todo list someone filed by walking a deployed stage. Covers `pikku fabric changes list|claim|show|ask|shot|done`, when to ask a question instead of guessing, and how to offer options as images. TRIGGER when: the user says "work the changes", "pick up the changes queue", names a change by its #number, or you are otherwise idle in a repo that has a pikkufabric.config.json. DO NOT TRIGGER for git changes, diffs or changelogs, and not for deploying or debugging a stage — use pikku-fabric for those.'
3
+ description: 'Work a Fabric project''s changes queue — the todo list someone filed by circling things on a deployed stage. Covers `pikku fabric changes next|claim|show|ask|shot|done`: waiting for work without polling, asking instead of guessing, offering options as images, one commit per item. TRIGGER when: the user says "run the pikkufabric changes", "run the changes against <stage>", "work the changes (queue)", "watch the changes", "pick up the changes", names a change by its #number, or you are otherwise idle in a repo that has a pikkufabric.config.json. DO NOT TRIGGER for git changes, diffs or changelogs, and not for deploying or debugging a stage — use pikku-fabric for those.'
4
4
  installGroups: [fabric]
5
5
  ---
6
6
 
7
7
  # Working a changes queue
8
8
 
9
- Someone walked the deployed app and circled twenty things. Each one is a row with their
10
- words, a picture of what they were looking at, and the elements the circle enclosed. You
11
- have the repo and the app running locally. Your job is to empty the queue without making
12
- them regret filing.
9
+ Someone walked the deployed app and circled things. Each item is their words, a
10
+ screenshot of what they saw, and the elements the circle enclosed. You have the repo.
11
+ Empty the queue without making them regret filing.
13
12
 
14
- ## The loop
15
-
16
- Every argument is a flag; nothing is positional. `--json` works on any of them. The
17
- project comes from the local `pikkufabric.config.json`, so `--project-id` is only needed
18
- when you are not in the checkout.
13
+ Run every command from the checkout: the project comes from `pikkufabric.config.json`.
14
+ `--json` works on all of them. Items are addressed as `2`, `#2` or their uuid.
19
15
 
20
- ```bash
21
- pikku fabric changes list --pickup-only --json
22
- pikku fabric changes claim --change-ids <id>,<id> --title "Checkout pass" --claimed-by claude-code
23
- pikku fabric changes show --change-id <id>
24
- pikku fabric changes ask --change-id <id> --question "…" --option "…" --option "…" --author-name claude-code
25
- pikku fabric changes shot --change-id <id> --label "Bigger" --kind option --image a.png
26
- pikku fabric changes done --change-id <id> --note "What you did"
27
- ```
16
+ ## Which stage
28
17
 
29
- `list --pickup-only` is the one a harness wants: it skips items still inside the grace
30
- window, so a batch someone is mid-way through typing is picked up together rather than item
31
- by item as it lands.
18
+ The queue is per project. "Against develop" or a pasted stage URL narrows it:
19
+ `--stage` takes a branch, the stage URL (as filed, path optional) or a stage id. With
20
+ no stage named, work the whole project. An unknown name prints the stages there are.
32
21
 
33
- Deciding what belongs together is yours: `claim` with `--change-ids` and no `--group-id`
34
- forms the group. Claim an existing one with `--group-id`.
22
+ ## The loop
35
23
 
36
- Claim before working. The lease expires (30 minutes by default, `--lease-minutes` to
37
- change it), so an abandoned claim returns to the queue rather than parking the work
38
- forever — but a second harness picking up something you are halfway through is the failure
39
- this prevents.
24
+ **Never poll.** No `sleep` loops, no repeated `list`, no re-running `show` to see if
25
+ something changed. `next` does the waiting and exits only when there is work.
40
26
 
41
- ## Reading an item
27
+ 1. Start `next` as a **background** command, and stop there until it exits:
42
28
 
43
- `show` gives you four things, in descending order of trustworthiness:
29
+ ```bash
30
+ pikku fabric changes next --stage develop --claim --claimed-by claude-code
31
+ ```
44
32
 
45
- 1. **Their words.** The title and body are the requirement. Everything else is evidence.
46
- 2. **The screenshot.** What they actually saw, at their width, with their data. When the
47
- other addresses disagree with the picture, the picture is right.
48
- 3. **The circled elements** — a testid, a source anchor, a CSS path. The testid greps
49
- straight to a component because it is the i18n message key.
50
- 4. **The source anchor**, printed as `src/routes/app.orders.tsx:42 as of a91c4e2`. That line
51
- number is where the JSX was **at that commit**. Read it as a starting point and find
52
- today's equivalent; never edit line 42 of today's file because the anchor said 42.
33
+ It waits out the grace window (a just-filed item is held about a minute so a batch
34
+ being typed arrives together), claims what is ready as one group, prints it, and
35
+ exits. It also wakes when someone answers a question you asked under that
36
+ `--claimed-by`.
53
37
 
54
- Resolution is a guess and the panel says so. If the circle and the anchor point at
55
- different things, believe the circle.
38
+ 2. When it exits, read the exit code:
56
39
 
57
- ## When to ask
40
+ | code | meaning | do |
41
+ | --- | --- | --- |
42
+ | 0 | work printed (claimed, and/or `Answered`) | work it, then step 3 |
43
+ | 2 | `--timeout`/`--once` found nothing | stop, or restart `next` |
44
+ | 3 | session refused | tell the user to run `pikku fabric login`; stop |
45
+ | 1 | anything else (bad `--stage`, fabric down for minutes) | report the message; stop |
58
46
 
59
- Ask when the item admits more than one reasonable implementation and you would be **picking
60
- for them**. Do not ask to confirm something the item already says.
47
+ 3. For each item: `show` → fix → commit → `done`, or `ask` and move on. Then start
48
+ `next` again, in the background.
61
49
 
62
- Ask:
63
- - "Make the total stand out" — bigger, bolder, coloured, or moved above the fold?
64
- - "This should be faster" — is it the spinner, the request, or the number of steps?
65
- - Anything that changes what data is stored, what an existing user sees, or what something costs.
50
+ Without `--claim` it only reports what is claimable; claim it yourself:
66
51
 
67
- Do not ask:
68
- - "Should I use flexbox or grid?" — that is yours.
69
- - "Do you want me to fix the typo?" — they filed it; fix it.
70
- - "Can you confirm you want the button blue?" — they said blue.
52
+ ```bash
53
+ pikku fabric changes claim --change-ids 3,4 --title "Checkout pass" --claimed-by claude-code
54
+ ```
71
55
 
72
- A question costs them a context switch, not typing. That is the budget you are spending.
56
+ A `claim` refused with a 409 says per item why (held, claimed by someone else, done).
57
+ For held items, run `next --claim` rather than retrying. The lease is 30 minutes
58
+ (`--lease-minutes`); an abandoned claim returns to the queue by itself.
73
59
 
74
- ## What a good question looks like
60
+ ## Reading an item
75
61
 
76
- One decision. Their vocabulary, not the codebase's. And the choices in `--option`, not in
77
- the sentence.
62
+ `pikku fabric changes show 3` gives, most trustworthy first:
78
63
 
79
- > **Bad:** "How would you like me to handle the ambiguity in the checkout total component's
80
- > emphasis requirement?"
81
- >
82
- > **Good:** `--question "Make the total stand out — which way?"`
83
- > `--option "Bigger" --option "Move it above the delivery line"`
64
+ 1. **Their words.** The title and body are the requirement. Everything else is evidence.
65
+ 2. **The screenshot.** What they saw, at their width, with their data. When the other
66
+ addresses disagree with the picture, the picture is right.
67
+ 3. **The circled elements**: a testid (greps straight to a component, it is the i18n
68
+ key), a source anchor, a CSS path.
69
+ 4. **The source anchor**, `src/routes/app.orders.tsx:42 as of a91c4e2`, is where the JSX
70
+ was at *that* commit. Find today's equivalent; never edit line 42 because it said 42.
84
71
 
85
- **A choice written into the prose is not a choice.** Every `--option` becomes a button in
86
- the panel and the console, and clicking one records the answer; a question that says
87
- "(a) build it, (b) leave existing bookings, (c) hold" makes them re-type in free text what
88
- they should have been able to click, and leaves you parsing prose to find out which one
89
- they meant. If you can enumerate them in the sentence, you can pass them as flags.
72
+ ## When to ask
90
73
 
91
- Pass them even when there are only two, and even when one is "hold until I check" — that
92
- last one is a real option and it is the one most often left off. The filer can always
93
- choose "say something else", so the list constrains nothing.
74
+ Ask when the item admits more than one reasonable implementation and you would be
75
+ picking for them — "make the total stand out" (bigger? bolder? moved?), anything that
76
+ changes stored data, what an existing user sees, or what something costs. Do not ask
77
+ what the item already says, or implementation choices that are yours.
94
78
 
95
- Batch per group. Three questions about one checkout flow go out together; three separate
96
- asks about the same screen is three interruptions for one context switch.
79
+ One decision, in their vocabulary, with the choices as `--option` flags — each becomes
80
+ a button. Include "hold until I check" when it is real. Batch questions per group.
97
81
 
98
- Then **park it**. `ask` flips the item to `needs_answer` and you move to the next item. Do
99
- not sit waiting — pick answers up on your next `show`, and bound your polling so an
100
- unanswered item does not spin forever.
82
+ ```bash
83
+ pikku fabric changes ask --change-id 3 --question "Make the total stand out — which way?" \
84
+ --option "Bigger" --option "Move it above the delivery line" --author-name claude-code
85
+ ```
101
86
 
102
- ## When to show instead of ask
87
+ Then **park it** and move on. The answer wakes `next` (same `--claimed-by`); it prints
88
+ under `Answered`, and `show` has the reply.
103
89
 
104
- If the answer is visual and you can build it, build all of them and attach images:
90
+ If the answer is visual and you can build it, build each variant, screenshot all of
91
+ them in one pass at one width (baseline included), and attach them — the panel turns
92
+ `--kind option` shots into a pick-one:
105
93
 
106
94
  ```bash
107
- pikku fabric changes shot --change-id <id> --label "Bigger" --kind option --image a.png
108
- pikku fabric changes shot --change-id <id> --label "Above the line" --kind option --image b.png
95
+ pikku fabric changes shot --change-id 3 --label "Bigger" --kind option --image a.png
109
96
  ```
110
97
 
111
- The panel turns a set of `option` attachments into a pick-one they open full-screen, and
112
- picking one writes the choice into the thread. Capture every variant in **one pass at one
113
- width**, including the baseline — variants shot at different sizes are not comparable, and
114
- comparing is the whole point.
115
-
116
- `--kind evidence` is the other use: a picture that proves something, rendered inline rather
117
- than as a choice.
98
+ `--kind evidence` is a picture that proves something, shown inline.
118
99
 
119
100
  ## Committing
120
101
 
121
- One item, one commit. `done` records a single `head_commit`, and that sha is what a human
122
- reverts when they change their mind — so an item folded in with three others cannot be
123
- undone without taking the other three with it. Land unrelated work separately.
124
-
125
- The subject carries the short id the way a GitHub issue number does, and the uuid goes in a
126
- trailer so `git log --grep` has an exact handle:
102
+ One item, one commit — `done` records one sha, and that is what a human reverts. The
103
+ subject carries the short id; the uuid goes in a trailer:
127
104
 
128
105
  ```
129
- feat(login): #4 make the sign-in heading brown
106
+ fix(booking): #7 stop the date picker closing on the first click
130
107
 
131
108
  Change-Id: 0f3c8a12-9b44-4d2e-8f01-27c6a1d9e5b3
132
109
  ```
133
110
 
134
- Both ids come from `show`. The type and scope are the usual conventional-commit ones —
135
- `feat`, `fix`, `style`, `refactor` — with the scope naming the screen or area they were
136
- looking at, not the file you edited.
137
-
138
- More:
139
-
140
- ```
141
- fix(booking): #7 stop the date picker closing on the first click
142
- style(nav): #12 tighten the spacing around the logo
143
- ```
144
-
145
- Reverting one later is then:
146
-
147
- ```bash
148
- git revert $(git log --grep="Change-Id: <uuid>" --format=%H -1)
149
- ```
111
+ Scope names the screen they were looking at, not the file you edited.
150
112
 
151
113
  ## Finishing
152
114
 
153
- `done` records the branch and commit that closed it, which is what strikes the item through
154
- on the page it was filed on and tells them where the fix landed. Both default to the
155
- checkout you are standing in, so run it from there and let it read git:
156
-
157
115
  ```bash
158
- pikku fabric changes done --change-id <id> \
159
- --note "What you did, for whoever reads the thread later"
116
+ pikku fabric changes done --change-id 7 --note "What you did, for whoever reads the thread"
160
117
  ```
161
118
 
162
- `--branch` and `--head-commit` override them, for the case where the fix landed somewhere
163
- other than where you are. Never type a sha by hand — one that does not exist points the
164
- filer at nothing.
165
-
166
- An item you decided not to do is not `done`. Say why in the thread and leave it for a human
167
- to dismiss.
168
-
169
- ## Scope
119
+ Branch and commit default to the checkout you are in — run it there, never type a sha.
120
+ An item you decided not to do is not `done`: say why in the thread and leave it for a
121
+ human to dismiss.
170
122
 
171
- Writes need the `changes:project:write` scope on your bearer. `list` and `show` are reads.
172
- The project comes from the local `pikkufabric.config.json`, so run these from the checkout.
123
+ Writes need the `changes:project:write` scope; `list`, `show` and `next` without
124
+ `--claim` are reads.
@@ -105,6 +105,9 @@ subscribe to its events as `<source>:<event>`:
105
105
  ```
106
106
 
107
107
  - The route is `POST /webhooks/<name>` unless `method`/`route` say otherwise.
108
+ `method` may be a list, e.g. `['get', 'post']` for a provider that verifies
109
+ the URL with a GET and delivers events with a POST, or `['head', 'post']`
110
+ for one that checks the URL with a HEAD.
108
111
  It needs no session.
109
112
  - `events` maps each event name to a schema. An event that fails its schema is
110
113
  logged and dropped; so is one no `wireTrigger` listens for. Both still get a
@@ -126,9 +129,12 @@ id?, data }] }`, or `{ respond: { status, body } }` for a handshake. Throwing
126
129
  even on queues that ignore job ids, and records each attempt and its last
127
130
  error. Its `webhookReceipt` table comes from `pikku db generate`; `pikku dev`
128
131
  and `pikku serve` use it when a Kysely database is configured.
129
- - `receive` sees singleton services without `secrets`: read the signing secret
130
- in a service method, and declare it with `defineSecret`. Name it in `secret`
131
- so deploy knows where `setup` should store it.
132
+ - `receive` sees singleton services without `secrets`. Declare the signing
133
+ secret with `defineCredential({ type: 'singleton', ... })` and hold it as
134
+ `WebhookSigningSecret.fromCredential(provider, credentialService, name)`
135
+ from `@pikku/core/hmac`; `receive` calls `await signingSecret.load()` and
136
+ checks against what it returns. A handshake that hands over the secret
137
+ (Asana) stores it with `credentialService.set`.
132
138
 
133
139
  `check`, `setup` and `teardown` register the route with the provider. Each gets
134
140
  `{ url, label, events, previous? }`, where `events` are only the ones some
@@ -142,10 +148,9 @@ pikku webhooks teardown --url https://api.example.com --labelPrefix shop:prod --
142
148
 
143
149
  Each prints one JSON line per source (`ok`, `missing`, `drifted`, `created`,
144
150
  `updated`, `unchanged`, `manual`, `deleted`, `absent`, `skipped`, `failed`). `setup` only
145
- runs where `check` does not report `ok`, and a `setup` that returns a new signing
146
- secret prints it with the `secret` name to store it under. In CI pass
147
- `--secretsOut <file>`: secrets are written there (mode 600) as
148
- `{ secretName: secret }` and left out of stdout. Any step can be
151
+ runs where `check` does not report `ok`. A `setup` that gets a signing secret
152
+ from the provider stores it with `credentialService.set`, and `teardown`
153
+ deletes it, so a new secret needs no deploy and never reaches stdout. Any step can be
149
154
  `ref('<addon>:<fn>')` to use an addon's implementation.
150
155
 
151
156
  ## Usage Patterns