@skitterbyte/skitterspec-linear 19.10.0 → 19.12.0
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/README.md +3 -0
- package/assets/claude-md-section.md +8 -2
- package/assets/commands/allow-project.md +28 -0
- package/assets/core/env.config.md +29 -3
- package/assets/core/linear.config.md +7 -0
- package/assets/hooks/project-guard.cjs +161 -0
- package/assets/rules/spec-planning.md +44 -1
- package/assets/skills/spec/SKILL.md +30 -0
- package/assets/skills/spec-cancel/SKILL.md +22 -4
- package/assets/skills/spec-complete/SKILL.md +34 -6
- package/assets/skills/spec-idea/SKILL.md +115 -0
- package/assets/skills/spec-init/SKILL.md +3 -1
- package/assets/skills/spec-review/SKILL.md +22 -4
- package/assets/skills/spec-tada/SKILL.md +26 -4
- package/assets/skills/spec-todo/SKILL.md +104 -0
- package/bin/skitterspec-linear.js +8 -0
- package/package.json +1 -1
- package/src/cli.js +266 -21
- package/src/env/config.js +26 -3
- package/src/env/hooks.js +10 -0
- package/src/env/integrate.js +5 -34
- package/src/env/live.js +106 -4
- package/src/env/projectguard.js +389 -0
- package/src/env/triggered.js +50 -0
- package/src/idea.js +190 -0
- package/src/ideacmd.js +242 -0
- package/src/tada/digest.js +41 -2
- package/src/tada/format.js +4 -2
- package/src/tada/page.js +35 -7
- package/src/tada/repo.js +22 -2
- package/src/tada/serve.js +13 -7
- package/src/tada/todo.js +250 -0
- package/src/vendor/linear/api.js +3 -1
- package/src/vendor/linear/cli-sync.js +165 -14
- package/src/vendor/linear/config.js +3 -1
- package/src/vendor/provider-kit/src/apply.js +90 -5
|
@@ -27,7 +27,7 @@ clobber customised content. Finish with a summary of created vs already-present.
|
|
|
27
27
|
> **Leave alone**. Non-interactively it only adds what's missing; `--resync` /
|
|
28
28
|
> `--reset` (reset needs `--yes`) drive the stronger actions.
|
|
29
29
|
|
|
30
|
-
The system is **
|
|
30
|
+
The system is **eighteen skills**: `spec` (feature, chore or issue), `spec-bug` (bug),
|
|
31
31
|
`spec-hotfix` (a bug fixed on a released tag),
|
|
32
32
|
`spec-incident` (a live outage, recorded as it happens),
|
|
33
33
|
`no-spec` (work that genuinely has none — off the base branch all the same),
|
|
@@ -36,6 +36,8 @@ The system is **sixteen skills**: `spec` (feature, chore or issue), `spec-bug` (
|
|
|
36
36
|
`spec-reviewed` (pick up a review you approved on that page),
|
|
37
37
|
`spec-epic-next` (name the epic member that can start now), `spec-to-main`,
|
|
38
38
|
`spec-complete`, `spec-cancel`, `spec-tada` (a ta-da list of what got done),
|
|
39
|
+
`spec-todo` (where you left off, and what is ahead), `spec-idea` (an idea
|
|
40
|
+
parked without a spec),
|
|
39
41
|
and this `spec-init`. The lifecycle is `backlog → in-progress → complete / cancelled`,
|
|
40
42
|
with `.core` holding always-apply project rules.
|
|
41
43
|
|
|
@@ -146,10 +146,20 @@ Linear API key is set (see `apply.transport` in `linear.config.md`).
|
|
|
146
146
|
and **finish the operation anyway**. The spec is complete/cancelled/reviewed in
|
|
147
147
|
the repo regardless; the mirror is disposable and the next push repairs it.
|
|
148
148
|
Do not roll anything back, and do not stop to ask.
|
|
149
|
-
- **In `/spec-complete`'s PR mode
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
- **In `/spec-complete`'s PR mode the Done waits for run 2.** Run 1 readies a
|
|
150
|
+
PR, and a ready PR is not a merged one. Which run pushes depends on the
|
|
151
|
+
`land.specDocs` lane:
|
|
152
|
+
- **`trunk`** — skip it on run 1. Run 2 moves the spec on base, so it pushes
|
|
153
|
+
there in this step's usual place, before its own commit.
|
|
154
|
+
- **`branch`** — run 1 commits the move to ride the PR, so push **here**,
|
|
155
|
+
holding the state: `spec-sync apply <spec> --plan <file> --hold-state`.
|
|
156
|
+
Everything but the Done goes now, and the snapshot is written as if the
|
|
157
|
+
Done had gone too, so it rides the PR. Run 2 sends it once the host has
|
|
158
|
+
merged: `spec-sync apply <spec> --send-held`, which needs no plan and
|
|
159
|
+
leaves the snapshot untouched. Over MCP, apply by hand and end run 1 with
|
|
160
|
+
`spec-sync record <spec> --held`.
|
|
161
|
+
|
|
162
|
+
The tracker's Done lands when the work does.
|
|
153
163
|
- **Say what happened** in the skill's report: mirror updated, skipped as
|
|
154
164
|
unlinked, or failed with the reason.
|
|
155
165
|
- **There is no unassign step, and that is not an omission.** Where the repo owns
|
|
@@ -173,6 +183,14 @@ In `/spec-complete` and `/spec-cancel` this step is deliberately pinned
|
|
|
173
183
|
snapshot under `specs/.core/`. Push after the commit instead and both are left
|
|
174
184
|
uncommitted, which makes `spec-env integrate` refuse to land the branch.
|
|
175
185
|
|
|
186
|
+
**PR mode keeps both halves by splitting the push across the runs.** In the
|
|
187
|
+
`branch` lane the commit happens in run 1, and run 2 only has the base branch,
|
|
188
|
+
where nothing is left to commit a snapshot to. An unsplit push there left a
|
|
189
|
+
modified snapshot on base after every completion. `--hold-state` writes run 2's
|
|
190
|
+
snapshot in run 1, and `--send-held` then moves only the state. If it says
|
|
191
|
+
nothing was held (a run 1 from before this), it sends the whole plan and names
|
|
192
|
+
the snapshot it leaves modified. Relay that line.
|
|
193
|
+
|
|
176
194
|
The snapshot is reached **by name**, not by breadth. It is a declared
|
|
177
195
|
`spec.companionPaths` entry (`specs/.core/linear-base/{identifier}.base.json`),
|
|
178
196
|
so `spec-env stage` returns it among this spec's owned paths and the commit below
|
|
@@ -69,6 +69,15 @@ do not paste it anywhere else, and never publish it.
|
|
|
69
69
|
|
|
70
70
|
## 2. Write the recap
|
|
71
71
|
|
|
72
|
+
**Open with the wins.** The evening question this answers is usually *did I
|
|
73
|
+
get anything done?*, and the answer is nearly always more than it felt like.
|
|
74
|
+
Before the projects, a short **Wins** list from the digest's `★` lines:
|
|
75
|
+
`★ saved bacon` (a bug, hotfix or incident finished — something was broken and
|
|
76
|
+
now is not) first, then `★ win` (a spec completed, a release cut). You may
|
|
77
|
+
promote **one** more from the prompts — a long fight with one problem that
|
|
78
|
+
ended in a fix, say — and only with its evidence in the same line. Never
|
|
79
|
+
invent one, and leave the section out on a day with none.
|
|
80
|
+
|
|
72
81
|
One section per project, then one entry per group. A group headed by a spec
|
|
73
82
|
(`feat-orders [#12]`) is that spec's work wherever it happened — its branch, its
|
|
74
83
|
worktree, or a commit on the base naming it. A group headed `<branch> — no spec`
|
|
@@ -88,6 +97,14 @@ For each group, say what applies and skip what does not:
|
|
|
88
97
|
- **In flight** — the `in flight:` line: where the spec stands and its next
|
|
89
98
|
action, as the engine wrote it.
|
|
90
99
|
|
|
100
|
+
**Only the `(here)` project's next actions are commands.** The project marked
|
|
101
|
+
`(here)` is the one this session was started in, and it is the only one this
|
|
102
|
+
session acts on. For every other project, say where it stands as a suggestion
|
|
103
|
+
in its own section — *"ereqs has chore-perf-alerts ready to complete"* — never
|
|
104
|
+
as a bare `/spec-…` command. A command at the bottom of a report is what gets
|
|
105
|
+
copied and run, and running it from here means working on another repo from a
|
|
106
|
+
session that does not belong to it.
|
|
107
|
+
|
|
91
108
|
Name a spec by its folder and its ticket exactly as the digest gives them. Keep
|
|
92
109
|
each entry to a line or two; a project with only in-flight rows gets one line
|
|
93
110
|
listing them.
|
|
@@ -95,9 +112,13 @@ listing them.
|
|
|
95
112
|
Then the **standup** — three lines, no more:
|
|
96
113
|
|
|
97
114
|
- **Done:** the work that landed or moved, across every project.
|
|
98
|
-
- **Next:** the in-flight next actions that matter most
|
|
99
|
-
|
|
100
|
-
|
|
115
|
+
- **Next:** the `(here)` project's in-flight next actions that matter most —
|
|
116
|
+
or `nothing in flight here`.
|
|
117
|
+
- **Blockers:** the `(here)` project's — a verdict waiting, a gate armed, a
|
|
118
|
+
wait unmet — or `none`. Only what the digest shows; never invent one.
|
|
119
|
+
|
|
120
|
+
**A quiet today points at the morning.** Run with no window flag and nothing
|
|
121
|
+
in it, say once in `Notes` that `/spec-todo` answers *where did I leave off*.
|
|
101
122
|
|
|
102
123
|
## 3. The page — only when asked
|
|
103
124
|
|
|
@@ -147,7 +168,8 @@ what is specific here.
|
|
|
147
168
|
page's tiers (or its `file://` path) when one was rendered. `Notes` carries the digest's own closing
|
|
148
169
|
lines (`cannot tell`, torn-down worktrees counted elsewhere) and, when no page
|
|
149
170
|
was asked for, that `--page` renders one. `Next` is the one
|
|
150
|
-
in-flight action the standup put first
|
|
171
|
+
in-flight action the standup put first — the `(here)` project's, never
|
|
172
|
+
another's — or `nothing in flight here`.
|
|
151
173
|
|
|
152
174
|
**`Follow-ups` is always `none` here.** This skill reports work; anything it
|
|
153
175
|
notices belongs to the spec it is about.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-todo
|
|
3
|
+
description: The morning half of the ta-da list — where each project was left on the last day you worked (Monday reads Friday), what is still open, what is waiting on you, and what to pick up first, ending in a three-line standup. Read-only. Use when the user says "/spec-todo", "where did I leave off", "what's on today", "what was I doing", "morning summary", or starts a day asking what is next.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /spec-todo — where you left off, and what is ahead
|
|
7
|
+
|
|
8
|
+
> Stay silent while this runs — speak only to ask something you cannot answer
|
|
9
|
+
> yourself, or to report a failure at the moment it happens. Read
|
|
10
|
+
> `.claude/rules/spec-reports.md` before reporting; it defines the block this
|
|
11
|
+
> skill ends with.
|
|
12
|
+
|
|
13
|
+
Read-only. It writes nothing, commits nothing and publishes nothing. `/spec-tada`
|
|
14
|
+
answers the evening question — *did I get anything done?* — and this answers the
|
|
15
|
+
morning one: *where was I, and what now?*
|
|
16
|
+
|
|
17
|
+
## 1. Get the to-do
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
skitterspec todo [--here | --all-projects]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- **`--here`** — "this repo", "this project": only the repo the session is
|
|
24
|
+
standing in.
|
|
25
|
+
- **`--all-projects`** — "everything", "work and personal": every project on the
|
|
26
|
+
machine.
|
|
27
|
+
|
|
28
|
+
There is no window to choose. The engine finds the **last day with any activity**
|
|
29
|
+
before today — up to 14 days back, so a Monday reads Friday and a day off is
|
|
30
|
+
skipped — and reads that day, plus today so far. It is scoped by
|
|
31
|
+
`project.category` exactly as `/spec-tada` is, and names the category on its
|
|
32
|
+
first line when there is one.
|
|
33
|
+
|
|
34
|
+
**Read the text form, never `--json`**, and **never read a transcript yourself** —
|
|
35
|
+
the same two rules, for the same reasons, as `/spec-tada`. The output quotes the
|
|
36
|
+
person's own prompts; it stays in this conversation and is never published.
|
|
37
|
+
|
|
38
|
+
What the lines mean:
|
|
39
|
+
|
|
40
|
+
- `(here)` — the project this session was started in. It is listed first, and
|
|
41
|
+
it is listed even on a morning nothing happened there, with its open specs.
|
|
42
|
+
- `left:` — the last move or commit on that spec, the day it was left.
|
|
43
|
+
- `- …` — the last thing typed on it: what was on the person's mind when they
|
|
44
|
+
stopped.
|
|
45
|
+
- `in flight:` — where the spec stands now, and its next action.
|
|
46
|
+
- `finished:` — the specs that day completed or cancelled, by name.
|
|
47
|
+
- `blocked:` — a review verdict waiting, or a gate armed by a phase that ended
|
|
48
|
+
and still owes an answer. Read only for specs in flight.
|
|
49
|
+
- `ideas:` — how many ideas are waiting for the `(here)` project. It is a count,
|
|
50
|
+
never the next action: `/spec-idea` lists them, and the line is absent when
|
|
51
|
+
there are none or the count could not be read.
|
|
52
|
+
- `today:` — commits and moves since midnight, when there are any.
|
|
53
|
+
|
|
54
|
+
## 2. Write the recap
|
|
55
|
+
|
|
56
|
+
One short section per project, `(here)` first. For each open spec, one line:
|
|
57
|
+
where it was left and what is next, in plain words. Then `finished:` as one line
|
|
58
|
+
and `blocked:` lines as they are — a blocker is the thing most worth seeing in
|
|
59
|
+
the morning.
|
|
60
|
+
|
|
61
|
+
**Only the `(here)` project's next actions are commands.** Every other project's
|
|
62
|
+
are suggestions in its own section — *"ereqs has chore-perf-alerts ready to
|
|
63
|
+
complete"* — never a bare `/spec-…`. This session acts on the project it was
|
|
64
|
+
started in; the others are picked up in a session of their own.
|
|
65
|
+
|
|
66
|
+
Then the **standup** — three lines, no more:
|
|
67
|
+
|
|
68
|
+
- **Left off:** where yesterday (or the last working day) ended, across every
|
|
69
|
+
project — a line, not a list.
|
|
70
|
+
- **Today:** the `(here)` project's first one or two actions — or
|
|
71
|
+
`nothing in flight here`.
|
|
72
|
+
- **Blockers:** the `(here)` project's `blocked:` lines — or `none`. Only what
|
|
73
|
+
the output shows; never invent one.
|
|
74
|
+
|
|
75
|
+
A fortnight with nothing in it is still an answer: say so, and name what is in
|
|
76
|
+
flight in the home project if anything is.
|
|
77
|
+
|
|
78
|
+
## 3. The page — only when asked
|
|
79
|
+
|
|
80
|
+
Exactly as `/spec-tada` §3, with `skitterspec todo <the same flags> --page
|
|
81
|
+
--summary <that file>`. It is served beside the ta-da page where the project has
|
|
82
|
+
a review server, and is a `file://` page where it does not. Never publish it.
|
|
83
|
+
|
|
84
|
+
## Report
|
|
85
|
+
|
|
86
|
+
The recap and standup are the body of the message; the block follows them and
|
|
87
|
+
is the last thing in it.
|
|
88
|
+
|
|
89
|
+
**Verdicts**
|
|
90
|
+
|
|
91
|
+
- `✅` — the to-do is written. Nothing in 14 days is still `✅`, said as such.
|
|
92
|
+
- `⚠️` — written, but the output said `cannot tell` somewhere. Name it in
|
|
93
|
+
`Notes`.
|
|
94
|
+
|
|
95
|
+
**Fields:** `Built` · `Notes` · `Follow-ups` · `Next`
|
|
96
|
+
|
|
97
|
+
`Built` is the day it read as "left off" and the counts — projects, open specs,
|
|
98
|
+
blockers — and the page's tiers (or its `file://` path) when one was rendered.
|
|
99
|
+
`Notes` carries the output's own closing lines and, when no page was asked for,
|
|
100
|
+
that `--page` renders one. `Next` is the `(here)` project's first action, or
|
|
101
|
+
`nothing in flight here` — never another project's.
|
|
102
|
+
|
|
103
|
+
**`Follow-ups` is always `none` here.** This skill reports work; anything it
|
|
104
|
+
notices belongs to the spec it is about.
|
|
@@ -45,6 +45,14 @@ require('../src/env/config.js').setProviderEnvDefaults(
|
|
|
45
45
|
require('../src/env/config.js').setProviderConfigFile(
|
|
46
46
|
require('../src/vendor/linear/config.js').CONFIG_FILE,
|
|
47
47
|
)
|
|
48
|
+
// Linear holds ideas: an issue carrying `intake.ideaLabel`, in no project.
|
|
49
|
+
// Registered so `skitterspec idea` hands Linear the command instead of writing
|
|
50
|
+
// specs/ideas.md (see common src/idea.js, selectStore).
|
|
51
|
+
require('../src/idea.js').setProviderIdeaStore({
|
|
52
|
+
supports: true,
|
|
53
|
+
run: (sub, argv, { cwd, out } = {}) =>
|
|
54
|
+
require('../src/vendor/linear/cli-sync.js').specSync(['idea', sub, ...argv], { cwd, out }),
|
|
55
|
+
})
|
|
48
56
|
const {
|
|
49
57
|
PROVIDER_COMMANDS,
|
|
50
58
|
providerHelpSection,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skitterbyte/skitterspec-linear",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.12.0",
|
|
4
4
|
"description": "Spec-driven development for Claude Code, with one-way Linear sync — a superset of @skitterbyte/skitterspec: the base filesystem workflow plus /spec-status · /spec-push and the spec-sync CLI. The repo is canonical; Linear is a generated mirror. Install this OR the base, not both.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
package/src/cli.js
CHANGED
|
@@ -48,6 +48,7 @@ const SPEC_ENV_VERBS = Object.freeze([
|
|
|
48
48
|
'base',
|
|
49
49
|
'nospec',
|
|
50
50
|
'main',
|
|
51
|
+
'project',
|
|
51
52
|
])
|
|
52
53
|
const { forkMatch, planBaseReport } = require('./env/base.js')
|
|
53
54
|
const {
|
|
@@ -104,6 +105,7 @@ const {
|
|
|
104
105
|
liveStateFor,
|
|
105
106
|
liveStateLine,
|
|
106
107
|
planRelease,
|
|
108
|
+
runAfterSwitch,
|
|
107
109
|
planAbort,
|
|
108
110
|
} = require('./env/live.js')
|
|
109
111
|
const { ensureWorktreeDirTrusted } = require('./env/trust.js')
|
|
@@ -215,8 +217,16 @@ const { ROUTE: TADA_ROUTE, tadaQuery, recapKey: tadaRecapKey, recapPath: tadaRec
|
|
|
215
217
|
const { defaultRoot, knownDirs } = require('./tada/transcripts.js')
|
|
216
218
|
const { setProjectKeys } = require('./env/projectedit.js')
|
|
217
219
|
const { buildDigest, gitRepoOf } = require('./tada/digest.js')
|
|
220
|
+
const {
|
|
221
|
+
readAllows: readProjectAllows,
|
|
222
|
+
checkPath: checkProjectPath,
|
|
223
|
+
checkCommand: checkProjectCommand,
|
|
224
|
+
recordLift: recordProjectLift,
|
|
225
|
+
clearLift: clearProjectLift,
|
|
226
|
+
} = require('./env/projectguard.js')
|
|
218
227
|
const { readRepoFacts } = require('./tada/repo.js')
|
|
219
228
|
const { formatTada } = require('./tada/format.js')
|
|
229
|
+
const { LOOKBACK_DAYS, activityTimes, lastActiveDay, readBlockers, buildTodo, formatTodo } = require('./tada/todo.js')
|
|
220
230
|
const { renderTadaPage } = require('./tada/page.js')
|
|
221
231
|
const { startProcess, stopProcess, waitHealthy, readPid, isAlive } = require('./env/supervise.js')
|
|
222
232
|
const {
|
|
@@ -289,6 +299,10 @@ Usage:
|
|
|
289
299
|
main <check|allow|status>
|
|
290
300
|
the main guard — is a write about to land
|
|
291
301
|
on the base branch? (/allow-main lifts it)
|
|
302
|
+
project <check|allow|status>
|
|
303
|
+
the project guard — is a write or a lifecycle
|
|
304
|
+
command aimed at another skitterspec project?
|
|
305
|
+
(/allow-project <name> lifts it)
|
|
292
306
|
down <spec> tear down (guards; --keep-volumes, --force)
|
|
293
307
|
prune reap orphaned test-DB volumes (--older-than <days>)
|
|
294
308
|
dev up <spec> start host dev servers on the spec's ports
|
|
@@ -357,6 +371,19 @@ Usage:
|
|
|
357
371
|
--json, --page [--summary <recap.md>] for an HTML
|
|
358
372
|
page. Reads ~/.claude/projects; exits 0 unless the
|
|
359
373
|
window cannot be read.
|
|
374
|
+
skitterspec todo Where you left off: each project as it stood on
|
|
375
|
+
the last day with activity (up to 14 days back),
|
|
376
|
+
its open specs and next actions, review verdicts
|
|
377
|
+
waiting and gates armed, and today so far. Same
|
|
378
|
+
scope as tada (--here, --all-projects), --json,
|
|
379
|
+
--page [--summary <recap.md>].
|
|
380
|
+
skitterspec idea <cmd> Ideas not specced yet, where the team can see them:
|
|
381
|
+
in the tracker when the provider holds ideas, else
|
|
382
|
+
specs/ideas.md landed on the base branch (never
|
|
383
|
+
pushed — it prints the push). Subcommands:
|
|
384
|
+
add <text> capture one; first line is the title
|
|
385
|
+
list what is waiting (--count, --json)
|
|
386
|
+
drop <id> discard one (--reason <why>)
|
|
360
387
|
skitterspec gating <cmd> Release-gating check (opt-in; needs
|
|
361
388
|
specs/.core/gating.config.json). Subcommands:
|
|
362
389
|
check [spec] report specs with no recorded gating
|
|
@@ -813,12 +840,38 @@ async function tadaCommand(argv) {
|
|
|
813
840
|
// nothing else, because the digest it carries was already read once.
|
|
814
841
|
if (await serveTadaPage({ window, flags, recap })) return
|
|
815
842
|
}
|
|
816
|
-
const digest = await
|
|
843
|
+
const digest = await tadaDigest(window, flags)
|
|
844
|
+
// The reader's own dates, for the text header and the page; the digest's
|
|
845
|
+
// own `since`/`until` stay UTC instants for a script.
|
|
846
|
+
digest.window.label = humanLabel(window)
|
|
847
|
+
if (argv.includes('--page')) {
|
|
848
|
+
// No server to serve it: the page is a file on this machine, as it was.
|
|
849
|
+
const out = path.join(os.tmpdir(), `skitterspec-tada-${windowLabel(window).replace(' → ', '_')}.html`)
|
|
850
|
+
fs.writeFileSync(out, renderTadaPage(digest, { recap, title: `Ta-da · ${digest.window.label}`, category: digest.category || null }))
|
|
851
|
+
process.stdout.write(`page: ${pathToFileURL(out).href}\n`)
|
|
852
|
+
return
|
|
853
|
+
}
|
|
854
|
+
if (json) {
|
|
855
|
+
process.stdout.write(JSON.stringify(digest, null, 2) + '\n')
|
|
856
|
+
return
|
|
857
|
+
}
|
|
858
|
+
process.stdout.write(formatTada(digest))
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* One window's digest, scoped the way `tada` and `todo` both scope it: the
|
|
863
|
+
* running project's category unless `--all-projects`, the repo alone under
|
|
864
|
+
* `--here`, and the run's own cwd as home. `open: false` skips the in-flight
|
|
865
|
+
* rows, for a scan that only asks when something happened.
|
|
866
|
+
*/
|
|
867
|
+
async function tadaDigest(window, flags, { chat = flags.chat, open = true } = {}) {
|
|
868
|
+
return buildDigest({
|
|
817
869
|
root: defaultRoot(),
|
|
818
870
|
window,
|
|
819
871
|
here: flags.here ? process.cwd() : null,
|
|
872
|
+
home: process.cwd(),
|
|
820
873
|
category: flags.all ? null : runningCategory(process.cwd()),
|
|
821
|
-
chat
|
|
874
|
+
chat,
|
|
822
875
|
facts: (repo) => {
|
|
823
876
|
let config = {}
|
|
824
877
|
try {
|
|
@@ -829,31 +882,112 @@ async function tadaCommand(argv) {
|
|
|
829
882
|
}
|
|
830
883
|
return readRepoFacts({ repo, git: gitReader(repo), config, window })
|
|
831
884
|
},
|
|
832
|
-
openFor:
|
|
833
|
-
try {
|
|
834
|
-
return inFlightRows(repo)
|
|
835
|
-
.rows.filter(isInFlight)
|
|
836
|
-
.map((r) => ({ spec: r.spec, detail: detailOf(r), next: r.next ? actionText(r.next) : null }))
|
|
837
|
-
} catch {
|
|
838
|
-
return []
|
|
839
|
-
}
|
|
840
|
-
},
|
|
885
|
+
openFor: open ? openSpecsIn : null,
|
|
841
886
|
})
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
function openSpecsIn(repo) {
|
|
890
|
+
try {
|
|
891
|
+
return inFlightRows(repo)
|
|
892
|
+
.rows.filter(isInFlight)
|
|
893
|
+
.map((r) => ({ spec: r.spec, detail: detailOf(r), next: r.next ? actionText(r.next) : null }))
|
|
894
|
+
} catch {
|
|
895
|
+
return []
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* What stands in one repo's way, read off its review store: passes waiting
|
|
901
|
+
* and gates armed, for the specs in flight there. Read-only, and every
|
|
902
|
+
* cannot-tell — no config, no store, an unreadable sidecar — is nothing at all
|
|
903
|
+
* rather than a blocker (`.claude/rules/negative-checks.md`).
|
|
904
|
+
*/
|
|
905
|
+
function repoBlockers(repo, specs) {
|
|
906
|
+
let config
|
|
907
|
+
try {
|
|
908
|
+
config = loadEnvConfig(repo).config
|
|
909
|
+
} catch {
|
|
910
|
+
return []
|
|
911
|
+
}
|
|
912
|
+
return readBlockers(reviewsDirFor(repo, config), specs, config.review && config.review.required)
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* The home project's waiting ideas, or null when that cannot be told. A
|
|
917
|
+
* provider store asks the network, so the answer is bounded: a slow, failed or
|
|
918
|
+
* refused count is null, and null prints nothing — an idea count is never a
|
|
919
|
+
* reason for the morning report to fail or stall.
|
|
920
|
+
*/
|
|
921
|
+
async function ideaCount(repo) {
|
|
922
|
+
let text = ''
|
|
923
|
+
const sink = { write: (s) => (text += s) }
|
|
924
|
+
try {
|
|
925
|
+
const counted = require('./ideacmd.js').ideaCommand(['list', '--count', '--json'], { cwd: repo, out: sink })
|
|
926
|
+
const timeout = new Promise((resolve) => setTimeout(() => resolve('timeout'), 5000).unref())
|
|
927
|
+
if ((await Promise.race([counted, timeout])) !== 0) return null
|
|
928
|
+
const n = JSON.parse(text).count
|
|
929
|
+
return Number.isInteger(n) ? n : null
|
|
930
|
+
} catch {
|
|
931
|
+
return null
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* `skitterspec todo` — the morning half of the ta-da list: where each project
|
|
937
|
+
* was left on the last day with any activity, what is ahead, and what is in
|
|
938
|
+
* the way. Exits 0 whatever it finds, a fortnight of nothing included.
|
|
939
|
+
*/
|
|
940
|
+
async function todoCommand(argv) {
|
|
941
|
+
const now = new Date()
|
|
942
|
+
const flags = { on: null, since: null, all: argv.includes('--all-projects'), chat: false, here: argv.includes('--here') }
|
|
943
|
+
const today = windowFor({}, now)
|
|
944
|
+
// One scan of the lookback finds the day; only that day is read in full.
|
|
945
|
+
const lookback = { since: new Date(today.since.getFullYear(), today.since.getMonth(), today.since.getDate() - LOOKBACK_DAYS), until: today.since }
|
|
946
|
+
const scan = await tadaDigest(lookback, flags, { chat: true, open: false })
|
|
947
|
+
const day = lastActiveDay(activityTimes(scan), today.since)
|
|
948
|
+
const leftWindow = day ? windowFor({ on: localDay(day) }, now) : null
|
|
949
|
+
const leftOff = leftWindow ? await tadaDigest(leftWindow, flags) : null
|
|
950
|
+
const todaySoFar = await tadaDigest(today, flags)
|
|
951
|
+
|
|
952
|
+
const homeRepo = gitRepoOf(process.cwd()).repo
|
|
953
|
+
let home = null
|
|
954
|
+
if (homeRepo && fs.existsSync(path.join(homeRepo, 'specs', '.core'))) {
|
|
955
|
+
let name = path.basename(homeRepo)
|
|
956
|
+
try {
|
|
957
|
+
name = projectName(loadEnvConfig(homeRepo).config) || name
|
|
958
|
+
} catch {
|
|
959
|
+
// the folder name stands in, as it does everywhere else
|
|
960
|
+
}
|
|
961
|
+
home = { repo: homeRepo, name, groups: openSpecsIn(homeRepo).map((row) => ({ spec: row.spec, inFlight: row })), ideas: await ideaCount(homeRepo) }
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
const todo = buildTodo({ leftOff, leftOffDay: day, today: todaySoFar, home, blockersFor: repoBlockers })
|
|
965
|
+
todo.todayLabel = humanLabel(today)
|
|
966
|
+
if (todo.leftOff) todo.leftOff.label = humanLabel(leftWindow)
|
|
967
|
+
|
|
845
968
|
if (argv.includes('--page')) {
|
|
846
|
-
|
|
847
|
-
const
|
|
848
|
-
|
|
969
|
+
let recap = null
|
|
970
|
+
const from = tadaFlag(argv, '--summary')
|
|
971
|
+
if (from) {
|
|
972
|
+
try {
|
|
973
|
+
recap = fs.readFileSync(path.resolve(from), 'utf8')
|
|
974
|
+
} catch (e) {
|
|
975
|
+
process.stderr.write(`skitterspec todo: --summary ${from}: ${e.code || e.message}\n`)
|
|
976
|
+
process.exitCode = 1
|
|
977
|
+
return
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
if (await serveTadaPage({ window: today, flags: { ...flags, todo: true }, recap })) return
|
|
981
|
+
const out = path.join(os.tmpdir(), `skitterspec-todo-${localDay(today.since)}.html`)
|
|
982
|
+
fs.writeFileSync(out, renderTadaPage(todo, { recap, title: `To-do · ${todo.todayLabel}`, category: todo.category || null }))
|
|
849
983
|
process.stdout.write(`page: ${pathToFileURL(out).href}\n`)
|
|
850
984
|
return
|
|
851
985
|
}
|
|
852
|
-
if (json) {
|
|
853
|
-
process.stdout.write(JSON.stringify(
|
|
986
|
+
if (argv.includes('--json')) {
|
|
987
|
+
process.stdout.write(JSON.stringify(todo, null, 2) + '\n')
|
|
854
988
|
return
|
|
855
989
|
}
|
|
856
|
-
process.stdout.write(
|
|
990
|
+
process.stdout.write(formatTodo(todo, now))
|
|
857
991
|
}
|
|
858
992
|
|
|
859
993
|
/**
|
|
@@ -879,7 +1013,7 @@ async function serveTadaPage({ window, flags, recap }) {
|
|
|
879
1013
|
if (!present || config.review.serve === 'never') return false
|
|
880
1014
|
attachProject(config, anchor)
|
|
881
1015
|
const dir = anchor.dir
|
|
882
|
-
const ask = { on: flags.on, since: flags.since, window, all: flags.all, chat: flags.chat }
|
|
1016
|
+
const ask = { on: flags.on, since: flags.since, window, all: flags.all, chat: flags.chat, todo: Boolean(flags.todo) }
|
|
883
1017
|
if (recap !== null) {
|
|
884
1018
|
const file = tadaRecapPath(path.join(dir, stateDirLabel(config)), tadaRecapKey(ask))
|
|
885
1019
|
fs.mkdirSync(path.dirname(file), { recursive: true })
|
|
@@ -1427,6 +1561,88 @@ function specEnvUpCheckout(dir, config, spec) {
|
|
|
1427
1561
|
* `allow` and `status` are for a person. `allow` is reached only through
|
|
1428
1562
|
* `/allow-main`, which is user-only — a guard the model can lift is decoration.
|
|
1429
1563
|
*/
|
|
1564
|
+
/**
|
|
1565
|
+
* `spec-env project <check|allow|status>` — the project guard's engine
|
|
1566
|
+
* (`env/projectguard.js`). `dir` is home: the project the session belongs to,
|
|
1567
|
+
* anchored on its primary checkout like every subcommand.
|
|
1568
|
+
*
|
|
1569
|
+
* `check` is the hook's question — `--path <file>` for a write, `--command
|
|
1570
|
+
* <line> --cwd <dir>` for a shell command — and prints a refusal on stdout with
|
|
1571
|
+
* exit 1, or nothing with exit 0. `allow <name|path> [off]` is `/allow-project`.
|
|
1572
|
+
*/
|
|
1573
|
+
function specEnvProject(dir, config, positional, flags = {}) {
|
|
1574
|
+
const action = positional[0] || 'status'
|
|
1575
|
+
const sessionId = flags.session || process.env.CLAUDE_CODE_SESSION_ID || null
|
|
1576
|
+
const enabled = !(config.guards && config.guards.projectBoundary === false)
|
|
1577
|
+
|
|
1578
|
+
if (action === 'check') {
|
|
1579
|
+
if (!enabled) return
|
|
1580
|
+
const allows = readProjectAllows(dir, config)
|
|
1581
|
+
const cwd = flags.cwd ? path.resolve(flags.cwd) : dir
|
|
1582
|
+
let verdict = { refuse: false }
|
|
1583
|
+
if (typeof flags.command === 'string') {
|
|
1584
|
+
verdict = checkProjectCommand({ home: dir, cwd, command: flags.command, gitAt: gitReader, allows, sessionId })
|
|
1585
|
+
} else if (flags.path) {
|
|
1586
|
+
verdict = checkProjectPath({ home: dir, target: path.resolve(cwd, flags.path), gitAt: gitReader, allows, sessionId })
|
|
1587
|
+
}
|
|
1588
|
+
if (!verdict.refuse) return
|
|
1589
|
+
process.stdout.write(`spec-env project: ${verdict.reason}\n`)
|
|
1590
|
+
process.exitCode = 1
|
|
1591
|
+
return
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
if (action === 'allow') {
|
|
1595
|
+
const what = positional[1]
|
|
1596
|
+
if (!what) {
|
|
1597
|
+
process.stdout.write('Usage: skitterspec spec-env project allow <name|path> [off]\n')
|
|
1598
|
+
process.exitCode = 1
|
|
1599
|
+
return
|
|
1600
|
+
}
|
|
1601
|
+
if (flags.off || positional[2] === 'off') {
|
|
1602
|
+
const n = clearProjectLift(dir, config, what)
|
|
1603
|
+
process.stdout.write(
|
|
1604
|
+
n ? `spec-env project: ${what} is guarded again.\n` : `spec-env project: nothing to clear — ${what} was already guarded.\n`,
|
|
1605
|
+
)
|
|
1606
|
+
return
|
|
1607
|
+
}
|
|
1608
|
+
const lift = recordProjectLift(dir, config, { what, sessionId, gitAt: gitReader, at: new Date().toISOString() })
|
|
1609
|
+
if (lift.error) {
|
|
1610
|
+
process.stdout.write(`spec-env project: ${lift.error}\n`)
|
|
1611
|
+
process.exitCode = 1
|
|
1612
|
+
return
|
|
1613
|
+
}
|
|
1614
|
+
const scope =
|
|
1615
|
+
lift.scope === 'session'
|
|
1616
|
+
? 'this session only — it lapses when the session ends'
|
|
1617
|
+
: `this repo until cleared — no session id available, so \`/allow-project ${lift.name} off\` is what ends it`
|
|
1618
|
+
process.stdout.write(`spec-env project: this session may work on ${lift.name} (${scope}).\n`)
|
|
1619
|
+
return
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
if (action === 'status') {
|
|
1623
|
+
const lifts = readProjectAllows(dir, config)
|
|
1624
|
+
const st = { state: enabled ? 'guarded' : 'off', lifts }
|
|
1625
|
+
if (flags.json) {
|
|
1626
|
+
process.stdout.write(JSON.stringify(st, null, 2) + '\n')
|
|
1627
|
+
return
|
|
1628
|
+
}
|
|
1629
|
+
if (!enabled) {
|
|
1630
|
+
process.stdout.write('spec-env project: off for this project (guards.projectBoundary is false).\n')
|
|
1631
|
+
return
|
|
1632
|
+
}
|
|
1633
|
+
const mine = lifts.filter((l) => l.scope === 'repo' || (sessionId && l.session === sessionId))
|
|
1634
|
+
process.stdout.write(
|
|
1635
|
+
mine.length
|
|
1636
|
+
? `spec-env project: guarded, with ${mine.map((l) => l.name).join(', ')} lifted for ${mine.some((l) => l.scope === 'repo') ? 'this repo' : 'this session'}.\n`
|
|
1637
|
+
: 'spec-env project: guarded — this session works on this project only.\n',
|
|
1638
|
+
)
|
|
1639
|
+
return
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
process.stdout.write('Usage: skitterspec spec-env project <check|allow|status>\n')
|
|
1643
|
+
process.exitCode = 1
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1430
1646
|
function specEnvMain(dir, config, positional, flags = {}, present = true, invokedFrom = dir) {
|
|
1431
1647
|
const action = positional[0] || 'status'
|
|
1432
1648
|
const sessionId = flags.session || process.env.CLAUDE_CODE_SESSION_ID || null
|
|
@@ -7235,8 +7451,12 @@ async function specEnvLiveTake(dir, config, specArg, flags = {}) {
|
|
|
7235
7451
|
|
|
7236
7452
|
// Diff onto...branch to spot migration / dependency changes (best-effort) —
|
|
7237
7453
|
// against the target the rebase will replay over, so both read the same commits.
|
|
7454
|
+
// `changedFiles` keeps the difference the two checks above can ignore: a
|
|
7455
|
+
// diff git would not answer is null (unknown), which runs `afterSwitch`'s
|
|
7456
|
+
// conditional entries rather than skipping them.
|
|
7238
7457
|
const changed = primaryGit(['diff', '--name-only', `${onto}...${spec.branch}`])
|
|
7239
7458
|
const files = changed ? changed.split('\n').filter(Boolean) : []
|
|
7459
|
+
const changedFiles = changed === null ? null : files
|
|
7240
7460
|
const depsHit = depsChanged(files, config.setupTriggers)
|
|
7241
7461
|
|
|
7242
7462
|
// Verify-only: probe the declared canonical (frontPort) ports of the HOT dev
|
|
@@ -7268,6 +7488,7 @@ async function specEnvLiveTake(dir, config, specArg, flags = {}) {
|
|
|
7268
7488
|
restartApps,
|
|
7269
7489
|
migrationsHit: migrationsHit(files, config.live.migrations),
|
|
7270
7490
|
depsChanged: depsHit,
|
|
7491
|
+
changedFiles,
|
|
7271
7492
|
holder: primaryGit(['config', 'user.name']) || 'unknown',
|
|
7272
7493
|
heldSince: new Date().toISOString(),
|
|
7273
7494
|
})
|
|
@@ -7345,6 +7566,9 @@ async function specEnvLiveTake(dir, config, specArg, flags = {}) {
|
|
|
7345
7566
|
out.push(` primary: now on ${receipt.branch} (was ${base} @ ${receipt.baseMainCommit.slice(0, 7)})`)
|
|
7346
7567
|
out.push(` worktree: ${spec.worktreePath} (detached — branch handed to the primary checkout)`)
|
|
7347
7568
|
if (onto !== base) out.push(` rebased: onto ${onto} (PR landing — the remote base)`)
|
|
7569
|
+
// After the receipt, so a failed command leaves a switch that `release` and
|
|
7570
|
+
// `status` both know about — the switch stands either way.
|
|
7571
|
+
out.push(...runAfterSwitch(plan.afterSwitch).lines)
|
|
7348
7572
|
for (const w of plan.warnings) out.push(` ! ${w}`)
|
|
7349
7573
|
out.push('')
|
|
7350
7574
|
out.push(' Test at your canonical URL; release with: /spec-live main')
|
|
@@ -7376,6 +7600,10 @@ async function specEnvLiveRelease(dir, config, specArg) {
|
|
|
7376
7600
|
const status = primaryGit(['status', '--porcelain'])
|
|
7377
7601
|
const clean = status !== null && status.length === 0
|
|
7378
7602
|
const worktreeExists = fs.existsSync(spec.worktreePath)
|
|
7603
|
+
// The files take brought in, read before the checkout moves HEAD: the switch
|
|
7604
|
+
// back reverts the same set. null when git would not say — unknown, not empty.
|
|
7605
|
+
const changed = primaryGit(['diff', '--name-only', `${base}...${spec.branch}`])
|
|
7606
|
+
const changedFiles = changed === null ? null : changed.split('\n').filter(Boolean)
|
|
7379
7607
|
|
|
7380
7608
|
const plan = planRelease(spec, config, {
|
|
7381
7609
|
primary,
|
|
@@ -7384,6 +7612,7 @@ async function specEnvLiveRelease(dir, config, specArg) {
|
|
|
7384
7612
|
clean,
|
|
7385
7613
|
worktreeExists,
|
|
7386
7614
|
restartApps: config.dev.filter((d) => d.reload === 'restart').map((d) => d.name),
|
|
7615
|
+
changedFiles,
|
|
7387
7616
|
})
|
|
7388
7617
|
|
|
7389
7618
|
if (plan.noop) {
|
|
@@ -7406,6 +7635,7 @@ async function specEnvLiveRelease(dir, config, specArg) {
|
|
|
7406
7635
|
process.stdout.write(
|
|
7407
7636
|
`spec-env live release: ${spec.folder} released — primary back on ${base}, ` +
|
|
7408
7637
|
`${spec.branch} re-isolated to its worktree.\n` +
|
|
7638
|
+
runAfterSwitch(plan.afterSwitch).lines.map((l) => `${l}\n`).join('') +
|
|
7409
7639
|
plan.warnings.map((w) => ` ! ${w}\n`).join(''),
|
|
7410
7640
|
)
|
|
7411
7641
|
}
|
|
@@ -7661,6 +7891,8 @@ async function specEnv(rest) {
|
|
|
7661
7891
|
else if (args[i] === '--from') flags.from = args[++i]
|
|
7662
7892
|
else if (args[i] === '--session') flags.session = args[++i]
|
|
7663
7893
|
else if (args[i] === '--path') flags.path = args[++i]
|
|
7894
|
+
else if (args[i] === '--cwd') flags.cwd = args[++i]
|
|
7895
|
+
else if (args[i] === '--command') flags.command = args[++i] ?? ''
|
|
7664
7896
|
else if (args[i] === '--assert-primary-clean') flags.assertPrimaryClean = true
|
|
7665
7897
|
else positional.push(args[i])
|
|
7666
7898
|
}
|
|
@@ -7746,6 +7978,9 @@ async function specEnv(rest) {
|
|
|
7746
7978
|
case 'main':
|
|
7747
7979
|
specEnvMain(dir, config, positional, flags, present, invokedFrom)
|
|
7748
7980
|
break
|
|
7981
|
+
case 'project':
|
|
7982
|
+
specEnvProject(dir, config, positional, flags)
|
|
7983
|
+
break
|
|
7749
7984
|
case 'down':
|
|
7750
7985
|
specEnvDown(dir, config, positional[0], flags)
|
|
7751
7986
|
break
|
|
@@ -7894,6 +8129,16 @@ async function run(argv) {
|
|
|
7894
8129
|
return
|
|
7895
8130
|
}
|
|
7896
8131
|
|
|
8132
|
+
if (cmd === 'todo') {
|
|
8133
|
+
await todoCommand(rest)
|
|
8134
|
+
return
|
|
8135
|
+
}
|
|
8136
|
+
|
|
8137
|
+
if (cmd === 'idea') {
|
|
8138
|
+
process.exitCode = await require('./ideacmd.js').ideaCommand(rest)
|
|
8139
|
+
return
|
|
8140
|
+
}
|
|
8141
|
+
|
|
7897
8142
|
if (cmd === 'epic') {
|
|
7898
8143
|
const [sub, ...eArgs] = rest
|
|
7899
8144
|
if (sub === 'status') epicStatusCommand(eArgs)
|