@softure-ai/skills 0.22.0 → 0.24.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 CHANGED
@@ -29,16 +29,26 @@ What the installer does (idempotent; re-run on every `npm install`):
29
29
  It never overwrites a skill folder it did not install. Flags: `--dry-run`, `--target <dir>`,
30
30
  `--no-gitignore` (commit the skills instead).
31
31
 
32
- **CI line.** Add one step to the project's CI check, documentation-only changes included (in a project
33
- that already has history, once the rollout below brings the doctor to zero):
34
-
35
- ```bash
36
- npx softure-skills doctor
32
+ **CI job.** Run the doctor in a CI job named `context-doctor`, with no paths filter and no condition, so
33
+ documentation-only changes are checked too (in a project that already has history, once the rollout below
34
+ brings the doctor to zero). Keep that name: outside readers (`portfolio --source api`, an aggregator) look for
35
+ the `context-doctor` check run on the main branch's head. In GitHub Actions the doctor writes its failure codes on
36
+ that check run (the annotation `context-doctor failure codes`, then one per failure) and in the job summary, so a
37
+ reader gets the codes through the forge API without a checkout.
38
+
39
+ ```yaml
40
+ context-doctor:
41
+ runs-on: ubuntu-latest
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ - run: npx --yes --package @softure-ai/skills@<version> softure-skills doctor
45
+ env:
46
+ npm_config_ignore_scripts: "true"
37
47
  ```
38
48
 
39
49
  It fails on drift in `context/` (a roadmap left after its archive, archived changes not stamped,
40
50
  `## Summary` placeholders, a stale `context/state.json`, …; WORKFLOW §12). The installer prints the
41
- line until a workflow runs it. `npx softure-skills state` regenerates `context/state.json`, which the
51
+ job until a workflow runs the doctor, and asks to rename a job that runs it under another name. `npx softure-skills state` regenerates `context/state.json`, which the
42
52
  scripts otherwise write themselves.
43
53
 
44
54
  **Rolling out to an existing project** (WORKFLOW §12.4). A project that adopted the package earlier
@@ -49,10 +59,13 @@ usually fails on history. Put it right, in this order, one pass per repository:
49
59
  2. `npx softure-skills doctor --sweep --json`, worked by an agent with the `softure-doctor` skill
50
60
  ("Sweep history to zero"): every entry settled with its evidence (commit, release, file), never
51
61
  without, in one change, until the doctor exits 0. Entries classed `superseded` (later roadmaps,
52
- releases or changes made them obsolete) are closed by the agent as obsolete, never forwarded.
62
+ releases or changes made them obsolete) are closed by the agent as obsolete, never forwarded; post-merge
63
+ steps (a release after the merge, `close #N`) are checked with the forge through `gh`, by the sweep itself
64
+ when it can reach it, else by the agent (class `forge`). A check carried to another roadmap (`→ roadmap-x`)
65
+ is ticked by `--fix`.
53
66
  3. The owner's short list: only real owner items (a decision about future work, a secret, account or
54
67
  connector, a step outside the repository), carried to the live roadmap or an `owner-word` issue.
55
- 4. The CI line above, once the doctor is at zero.
68
+ 4. The `context-doctor` job above, once the doctor is at zero.
56
69
 
57
70
  `npx softure-skills doctor --baseline` exists only as a last resort, for a project that cannot finish
58
71
  the history sweep at once: it accepts today's failures in `context/doctor-baseline.json`, the check
package/WORKFLOW.md CHANGED
@@ -80,6 +80,8 @@ or languages.
80
80
  // at once (default; branches never edit roadmap.md, so merging <main> in never conflicts
81
81
  // on it); "branch" commits them on the session branch only, <main> changes only by the merge
82
82
  },
83
+ "roadmap": { "sizes": false }, // optional: true lets softure-roadmap write a relative size (S / M / L) per item and
84
+ // a `### Slices` block (§5); default: only when the owner asks for sizes
83
85
  "release": { "owner": true }, // releases and deploys are never done by skills when true; false lets an autonomous
84
86
  // project release through its own pipeline (never a production deploy, §8.4)
85
87
  "autonomy": { // optional, read only when mode is "autonomous" (§8.4)
@@ -284,6 +286,14 @@ updated: 2026-10-01
284
286
  ## Order
285
287
  Why this order; which items may run in parallel and which files each one owns.
286
288
 
289
+ **Sizes:** relative to each other, never hours or dates. S: … M: … L: … (optional, see below)
290
+
291
+ ### Slices (optional, see below)
292
+ | Slice | Items | Size |
293
+ | --- | --- | --- |
294
+ | **1. First usable** | FC-1, FC-2 | 1 S, 1 M |
295
+ | 2. … | FC-3 | 1 L |
296
+
287
297
  ## Items
288
298
 
289
299
  ### FC-1: Hero in balance
@@ -291,6 +301,8 @@ Why this order; which items may run in parallel and which files each one owns.
291
301
  - **Status:** ready
292
302
  - **Outcome:** …
293
303
  - **Prerequisites:** …
304
+ - **Touches (estimate):** files and areas, from a quick search
305
+ - **Size:** S (optional, see below)
294
306
  - **Unknowns:** questions research must answer
295
307
  - **Risk:** …
296
308
  - **Baseline:** how we measure before/after
@@ -317,6 +329,16 @@ item block and appends to `## Done` itself. On a change branch (`softure-worktre
317
329
  branch never conflicts on the roadmap. Orchestrators fall back to `wt-roadmap.py done` themselves when a thread did not
318
330
  run it.
319
331
  Each item block may carry `- **Input:** <path>` (e.g. the change folder), which tells research where its brief lives.
332
+
333
+ **Sizes and slices (optional).** An owner who funds a roadmap in slices ("the first usable slice now, the rest after
334
+ it") needs a rough relative size to make that call. `softure-roadmap` writes sizes only when the owner asks for them or
335
+ `workflow.json` sets `roadmap.sizes: true`; otherwise a roadmap has none:
336
+ - `- **Size:** S | M | L` in an item block, after `Touches (estimate)`. Sizes are relative to each other, never hours,
337
+ days, points or dates; their meaning is defined once, in a `**Sizes:**` line under `## Order`.
338
+ - `### Slices` under `## Order`: named groups of items in order, the first usable slice marked (bold), each with its size
339
+ sum as counts (`2 S, 1 M`), so the owner can fund slice by slice. Every sized item sits in exactly one slice.
340
+ - The `## At a glance` table, the row status and the item block's first two fields stay as they are: the parsers
341
+ never read a size.
320
342
  `change.md` is defined **only** in §4. softure-roadmap (step 14, for every item it records) and softure-new write the same
321
343
  format; softure-new takes over a `change.md` the roadmap opened.
322
344
 
@@ -623,8 +645,26 @@ after the last item", "drop SA-12"). It is the owner's word in writing, equal to
623
645
  `change.md` or a standing order) gets a comment with the question and stays open.
624
646
  - **Manual mode.** The coordinator shows open `owner-word` issues to the owner at the start of a session and acts
625
647
  only on the owner's word in the conversation; it then comments and closes them the same way.
648
+ - **Answering a queue entry.** An issue that answers one `owner_queue` entry (§12.1) may carry, next to the prose, one
649
+ machine-readable line that names the entry by its `id` and the answer:
650
+
651
+ ```markdown
652
+ Start the payments roadmap once the provider account is open.
653
+
654
+ <!-- owner-word: {"entry": "oq-bfe20288d8", "answer": "yes"} -->
655
+ ```
656
+
657
+ `answer` is `yes`, `no` or `later`; the prose still says the decision and wins where the two differ (the coordinator
658
+ asks in a comment). The coordinator settles the entry it names in the file `source` points to, citing the issue:
659
+ `yes`: it carries the decision out and ticks the entry `— done: #N` (with the thread, PR or merge SHA when there is
660
+ one); `no`: it ticks the entry `— declined: #N` and records what follows in the roadmap (an item `dropped`, a queued
661
+ roadmap left waiting); `later`: it leaves the entry open and appends `(later: #N)`, so the entry keeps its `id` and
662
+ stays in the queue. An `entry` that is not in the current `state.json` (already settled, or an unknown id) gets a
663
+ comment saying so, and the issue is closed when the entry was settled. An issue without the line is read as prose,
664
+ as before.
626
665
  - **Not in `state.json`.** Open owner-word issues live on the forge; an aggregator reads both (`state.json` for what
627
- waits for the owner, the forge for the words already given).
666
+ waits for the owner, the forge for the words already given). With the line, it tells which entries an open issue
667
+ already answers (its `entry`) and shows them as answered until the entry leaves the queue.
628
668
 
629
669
  ## 9. Commits
630
670
 
@@ -722,11 +762,12 @@ A project without the file gets it from the first of these runs; nothing has to
722
762
 
723
763
  ```jsonc
724
764
  {
725
- "schema_version": 1,
726
- "project": "Example clinic", // workflow.json `project`, else the roadmap's `project`
765
+ "schema_version": 2, // 2 adds owner_queue[].id; read a version 1 file as one without ids
766
+ "project": "Example clinic", // workflow.json `project`, else the roadmap's, else the repository name; never null
727
767
  "mode": "autonomous", "main_branch": "main",
728
768
  "updated_at": "2026-11-20T09:00:00Z", // changes only when the content does
729
- "active_roadmap": { // null when there is no roadmap.md
769
+ "active_roadmap": { // null when there is no roadmap.md, or it is the idle placeholder
770
+ // (front matter `status: idle` or `roadmap: none`)
730
771
  "slug": "search", "title": "…", "status": "ready", "version": "2", "path": "context/foundation/roadmap.md",
731
772
  "done": 2, "total": 5, // done = rows done or done_code (the report's X of N)
732
773
  "items": [ // rows not done yet
@@ -739,8 +780,8 @@ A project without the file gets it from the first of these runs; nothing has to
739
780
  "open_changes": [ { "change_id": "search-titles", "title": "…", "status": "implementing", "roadmap_item": "SR-2",
740
781
  "updated": "2026-11-10", "stage": "implement 2/3" } ],
741
782
  "owner_queue": [ // everything that waits for the owner, oldest first
742
- { "kind": "decision", "source": "context/foundation/roadmap.md#Owner decisions and checks", "item": "SR-5",
743
- "since": "2026-11-10", "text": "**SR-5**: choose the ranking provider …" }
783
+ { "id": "oq-06e40f59e9", "kind": "decision", "source": "context/foundation/roadmap.md#Owner decisions and checks",
784
+ "item": "SR-5", "since": "2026-11-10", "text": "**SR-5**: choose the ranking provider …" }
744
785
  ],
745
786
  "last_release": { "version": "v1.4.0", "date": "2026-10-02", // as a closed roadmap recorded it (§5.2); the
746
787
  "source": "context/foundation/archive/2026-09-30-roadmap.md" } // portfolio asks the forge first
@@ -766,7 +807,11 @@ An unticked entry in any other archived roadmap, and any unticked `## Owner deci
766
807
  roadmap, is history to settle (the doctor's `archived-roadmap-open-checks`), not something that waits for the owner.
767
808
  Entries from open changes are refreshed on every write and never make the file stale, like `open_changes`. `source` is the file, `#`, and the heading; `item` the roadmap ID the entry names;
768
809
  `since` the date in the entry, else the file's `updated`, and once written it is kept for that entry on every
769
- rewrite. Owner-word issues (§8.6) live on the forge, not here.
810
+ rewrite. `id` is a short stable id (`oq-` and a hash of `source`, `item` and the entry's text when it first appeared):
811
+ it is kept, like `since`, on every rewrite, also when only the entry's wording changed or it moved to another heading
812
+ of the same file (the same item and kind, or text that is still close), so a reader follows one entry across scans
813
+ without fingerprinting it and an owner-word issue can name the entry it answers (§8.6). Owner-word issues live on the
814
+ forge, not here.
770
815
 
771
816
  `open_changes` and `updated_at` are refreshed on every write but never make the file stale: a change branch edits
772
817
  its own `change.md` without touching `state.json`, and stays green.
@@ -799,7 +844,11 @@ left after them; `--fix --write` applies them, only under `context/`, and a seco
799
844
  the file's current path when git history shows where it moved (rename detection, followed across moves); a file
800
845
  deleted on purpose (git shows the deletion, no rename) is marked `(removed in <sha>)` with the deleting commit;
801
846
  - an unticked Progress item of an archived plan that is struck through or carries a dropped/cancelled/not-applicable
802
- note is normalised to `- [x] ~~<item>~~ — dropped: <note>`.
847
+ note is normalised to `- [x] ~~<item>~~ — dropped: <note>`;
848
+ - an unticked owner check or pre-release step of an archived roadmap, or an open row, whose text carries a carry
849
+ marker (`→ roadmap-<slug>`, `carried to <roadmap>`) naming a roadmap that exists (queued, archived or the live one)
850
+ is ticked `- [x] <text> — carried to <path>` (a row becomes `carried (to <path>)`); the sweep shows such an entry
851
+ with that roadmap as its evidence. A marker whose roadmap does not exist stays a failure.
803
852
 
804
853
  A row whose move or deletion the history does not show, and a live index, are left alone and named. A shallow clone
805
854
  works on the commits it holds and names what lies past its edge. Everything else is a judgement case.
@@ -814,7 +863,12 @@ and later roadmaps that mention the item. Each entry has a class. `evidence`: th
814
863
  no direct evidence, but later work made it obsolete (for an owner check or open row of an archived roadmap, a later
815
864
  roadmap was closed and a release shipped after it, or the same item ID or file area appears in a later archived change;
816
865
  for a Progress item, a later phase of the same plan is ticked); its evidence names that roadmap, release or change, and
817
- the agent closes it as `obsolete: superseded by <ref>` itself, never forwards it. `owner`: only for what is still
866
+ the agent closes it as `obsolete: superseded by <ref>` itself, never forwards it. Post-merge steps that git history
867
+ cannot prove (a release after the merge, `close #N`, the Dependabot pull requests) are asked of the forge through `gh`
868
+ when it is reachable (a GitHub remote and credentials): a release published on or after the merge date, the state of
869
+ each `#N`, the open Dependabot pull requests; when every check holds the entry is `evidence` with those pointers.
870
+ `forge`: the same steps when the forge cannot be reached from where the sweep runs (or with `--no-forge`); an agent
871
+ checks them with `gh` before anything goes to the owner. `owner`: only for what is still
818
872
  meaningful today, a decision about future work, a secret, account or connector, or a step outside the repository whose
819
873
  effect the agent cannot see; the entry says which (`owner_reason`) and what the sweep looked for (`tried`). The
820
874
  `softure-doctor` skill ("Sweep history to zero") tells an agent how to work it: every entry is settled with its evidence
@@ -829,9 +883,25 @@ fixed entries, never adds one (it names them and exits 1), and removes the file
829
883
  never baselined; `--fix` and `--sweep` ignore it. It is the owner's call, recorded in the commit; the recommended path
830
884
  is the sweep to zero.
831
885
 
832
- A project that has never written `state.json` gets a note, not a failure. **Adopting projects run the doctor in their
833
- CI check**, documentation-only changes included; the installer prints the line (`npx softure-skills doctor`) until a
834
- workflow under `.github/workflows/` runs it. `softure-archive` and `softure-roadmap --close` run it before their commit
886
+ A project that has never written `state.json` gets a note, not a failure. **Adopting projects run the doctor in a CI
887
+ job named `context-doctor`**, with no paths filter and no condition, so documentation-only changes are checked too and
888
+ an outside reader finds the result by that name: the check run `context-doctor` on the main branch's head says whether
889
+ the project's context contract is green (`portfolio --source api` reads it). In GitHub Actions the doctor also leaves
890
+ its failure codes on that check run: the first annotation, titled `context-doctor failure codes`, lists every code with
891
+ its count (`archived-change-progress (3), state-stale (1)`), one annotation per failure follows (as many as GitHub
892
+ keeps), and the job summary holds the same table. Keep the job name, whatever the rest of
893
+ the workflow looks like. The installer prints the job until a workflow under `.github/workflows/` runs the doctor, and
894
+ asks to rename it while the job that runs it has another name:
895
+
896
+ ```yaml
897
+ context-doctor: # keep this name: readers look for the check run "context-doctor"
898
+ runs-on: ubuntu-latest
899
+ steps:
900
+ - uses: actions/checkout@v4
901
+ - run: npx --yes --package @softure-ai/skills@<version> softure-skills doctor
902
+ env:
903
+ npm_config_ignore_scripts: "true" # run the doctor only, no install into the checkout
904
+ ``` `softure-archive` and `softure-roadmap --close` run it before their commit
835
905
  and fix what they own.
836
906
 
837
907
  ### 12.3 Portfolio: many projects at once
@@ -850,7 +920,9 @@ The config file lives outside every project (`--config <file>`, `$SOFTURE_PORTFO
850
920
  where `repo` is `owner/name`, a git URL or a local path. One row per project:
851
921
  `project | active roadmap X/N | queued | open changes | owner queue | last release | doctor`. The doctor runs on the
852
922
  same tree; a project without `state.json` yet gets one built in memory (marked `*`). `--source api` reads only
853
- `state.json` through `gh api` (no doctor). **Last release comes from the forge** when it can: the latest GitHub
923
+ `state.json` through `gh api` and runs no doctor; its doctor column is the `context-doctor` check run on the main
924
+ branch's head (`ok`, `failing` with the doctor's failure codes from that run's annotations, `pending`, or `missing` when
925
+ the project has no job by that name). **Last release comes from the forge** when it can: the latest GitHub
854
926
  release through `gh api` (both modes, for a GitHub repository; a local checkout counts when its `origin` is on GitHub),
855
927
  else the highest `v*` tag (git mode), else `state.json` → `last_release`, which only records what a closed roadmap
856
928
  wrote and is shown labelled: `v1.4.0 (roadmap, 2026-10-02)`. `--json` gives `last_release`, `last_release_date` and
@@ -872,8 +944,8 @@ long ago. The history is put right, not hidden. One pass per repository, in this
872
944
  a step outside the repository that nothing shows done) was carried to the live roadmap's `## Owner decisions and checks` or an `owner-word` issue; the
873
945
  agent's report lists it once, short: `ID | what the owner decides or does | where it lives now`. Nothing else
874
946
  waits, so `portfolio --owner` shows only these and the live roadmaps' entries.
875
- 4. **The CI line at zero.** Once `npx softure-skills doctor` exits 0 on the main branch, add it to the CI check
876
- (documentation-only changes included). From then on every new drift is red where it happens.
947
+ 4. **The CI job at zero.** Once `npx softure-skills doctor` exits 0 on the main branch, add the `context-doctor` job
948
+ (§12.2; no paths filter, no condition), or rename the job that already runs the doctor to `context-doctor`. From then on every new drift is red where it happens.
877
949
 
878
950
  A project that cannot finish step 2 in one change may, on the owner's word, use `doctor --baseline` (§12.2) and add the
879
- CI line with it; the baseline only shrinks, and the sweep continues until the file is gone.
951
+ `context-doctor` job with it; the baseline only shrinks, and the sweep continues until the file is gone.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softure-ai/skills",
3
- "version": "0.22.0",
3
+ "version": "0.24.0",
4
4
  "description": "SOFTURE agent skills: a spec-driven delivery workflow (shape → prd → roadmap → plan → implement → review) plus parallel worktree orchestration",
5
5
  "license": "MIT",
6
6
  "repository": {
package/rules/AGENTS.md CHANGED
@@ -37,7 +37,7 @@ The full contract is in `node_modules/@softure-ai/skills/WORKFLOW.md`.
37
37
 
38
38
  `context/state.json` is the machine-readable state of the project (WORKFLOW §12). Only scripts write
39
39
  it (`wt-roadmap.py`, and `context_state.py write --staged` in `softure-archive` and `softure-roadmap`),
40
- in the same commit as the markdown; never edit it by hand. CI runs `npx softure-skills doctor`, which
40
+ in the same commit as the markdown; never edit it by hand. CI runs `npx softure-skills doctor` in the job `context-doctor` (keep that name), which
41
41
  fails on drift in `context/`: fix the file it names, never the check.
42
42
 
43
43
  **Every change goes through the chain, however small.** A one-line fix reported in chat is a change
@@ -86,7 +86,8 @@ step the owner has to undo.
86
86
  trade-off), ask with a recommendation instead of deciding silently.
87
87
  - **Owner-word issues** (label `owner-word`, WORKFLOW §8.6): at the start of a session, list the open
88
88
  ones in this project's repository and show them to the owner first, with what each would start. Act
89
- on one only after the owner's word in this conversation; then comment what was done and close it.
89
+ on one only after the owner's word in this conversation; then comment what was done and close it. One that names
90
+ an `owner_queue` entry (`<!-- owner-word: {"entry": …} -->`) is settled on that entry, citing the issue (§8.6).
90
91
  - Rules of autonomous projects (standing merge consent, coordinators, report cadences) do not apply
91
92
  here, even when a memory or another session suggests them.
92
93
 
@@ -346,7 +347,11 @@ word in writing, equal to the same sentence in the main chat: one decision, its
346
347
  on it like an order in the chat: a roadmap to start goes to a roadmap thread (`--promote`), a release
347
348
  word is recorded where the release rules look for it (the roadmap header's `Release:` order, quoted with
348
349
  the issue link), a "no" or "later" is recorded in the roadmap (`## Owner decisions and checks` or the
349
- item's status). Then it comments what it did (thread, PR, merge SHA, roadmap line), closes the issue as
350
+ item's status). An issue whose body carries `<!-- owner-word: {"entry": "<id>", "answer": "yes|no|later"} -->`
351
+ answers the `owner_queue` entry with that `id` in `context/state.json`: settle that entry in its `source` file and cite
352
+ the issue (`yes`: carry it out and tick it `— done: #N`; `no`: tick it `— declined: #N` and record what follows;
353
+ `later`: leave it open with `(later: #N)`); an `entry` no longer in the queue gets a comment saying so (WORKFLOW §8.6).
354
+ Then it comments what it did (thread, PR, merge SHA, roadmap line), closes the issue as
350
355
  completed, and names it in the next report. An issue it cannot act on (unclear, contradicts `change.md`
351
356
  or a standing order) gets one comment with the question and stays open; the question also goes to the
352
357
  owner in the main chat. Owner-word issues are not work items: they never get a thread of their own
@@ -49,6 +49,18 @@ const SUBCOMMANDS = {
49
49
  portfolio: [path.join(PACKAGE_ROOT, "scripts", "portfolio.py"), []],
50
50
  };
51
51
  const CI_LINE = "npx softure-skills doctor";
52
+ // The CI job that runs the doctor has this fixed name, so a reader (portfolio --source api, an aggregator)
53
+ // finds its check run on the main branch's head. No paths filter and no condition: it runs on every push.
54
+ const CI_JOB = "context-doctor";
55
+ const CI_JOB_YAML = (version) => [
56
+ ` ${CI_JOB}: # keep this name: readers look for the check run "${CI_JOB}"`,
57
+ " runs-on: ubuntu-latest",
58
+ " steps:",
59
+ " - uses: actions/checkout@v4",
60
+ ` - run: npx --yes --package @softure-ai/skills@${version} softure-skills doctor`,
61
+ " env:",
62
+ " npm_config_ignore_scripts: \"true\" # run the doctor only, no install into the checkout",
63
+ ].join("\n");
52
64
  // Issues with this label carry an owner decision the coordinator acts on (WORKFLOW.md §8.6).
53
65
  const OWNER_WORD_LABEL = {
54
66
  name: "owner-word",
@@ -80,14 +92,25 @@ function runSubcommand(name, args) {
80
92
  return result.status ?? 1;
81
93
  }
82
94
 
83
- // True when one of the project's GitHub workflows already runs the doctor.
84
- function hasDoctorInCi(projectRoot) {
95
+ // How the project's GitHub workflows run the doctor: "named" (in a job whose id or name is CI_JOB),
96
+ // "unnamed" (somewhere else), or "none".
97
+ function doctorInCi(projectRoot) {
85
98
  const dir = path.join(projectRoot, ".github", "workflows");
86
- if (!fs.existsSync(dir)) return false;
87
- return fs
99
+ if (!fs.existsSync(dir)) return "none";
100
+ const texts = fs
88
101
  .readdirSync(dir)
89
102
  .filter((name) => /\.ya?ml$/.test(name))
90
- .some((name) => fs.readFileSync(path.join(dir, name), "utf8").includes("softure-skills doctor"));
103
+ .map((name) => fs.readFileSync(path.join(dir, name), "utf8"))
104
+ .filter((text) => text.includes("softure-skills doctor"));
105
+ if (texts.length === 0) return "none";
106
+ return texts.some((text) => hasCiJob(text)) ? "named" : "unnamed";
107
+ }
108
+
109
+ // True when a workflow has a job whose id or `name:` is CI_JOB (the name its check run carries).
110
+ function hasCiJob(text) {
111
+ const id = new RegExp(`^\\s+${CI_JOB}:\\s*(#.*)?$`, "m");
112
+ const name = new RegExp(`^\\s+name:\\s*["']?${CI_JOB}["']?\\s*(#.*)?$`, "m");
113
+ return id.test(text) || name.test(text);
91
114
  }
92
115
 
93
116
  function parseArgs(argv) {
@@ -283,8 +306,14 @@ function install(options) {
283
306
  const prefix = options.isDryRun ? "[softure-skills] (dry run)" : "[softure-skills]";
284
307
  for (const action of actions) console.log(`${prefix} ${action}`);
285
308
  console.log(`${prefix} ${PACKAGE.name}@${PACKAGE.version} -> ${projectRoot}`);
286
- if (!hasDoctorInCi(projectRoot)) {
287
- console.log(`${prefix} CI: add \`${CI_LINE}\` to the project's CI check, documentation-only changes included, once it exits 0 (rollout: doctor --fix, doctor --sweep; WORKFLOW.md §12.4)`);
309
+ if (fs.existsSync(path.join(projectRoot, WORKFLOW_CONFIG_PATH)) && !workflowConfig.project) {
310
+ console.log(`${prefix} ${WORKFLOW_CONFIG_PATH}: add "project": "<the name the project calls itself>" (context/state.json falls back to the repository name; softure-init asks for it)`);
311
+ }
312
+ const ci = doctorInCi(projectRoot);
313
+ if (ci === "none") {
314
+ console.log(`${prefix} CI: once \`${CI_LINE}\` exits 0 (rollout: doctor --fix, doctor --sweep; WORKFLOW.md §12.4), add this job to a workflow under .github/workflows/ that runs on every push and pull request, documentation-only changes included:\n${CI_JOB_YAML(PACKAGE.version)}`);
315
+ } else if (ci === "unnamed") {
316
+ console.log(`${prefix} CI: run the doctor in a job named \`${CI_JOB}\` (no paths filter, no condition), so its check run can be found by that name (WORKFLOW.md §12.2):\n${CI_JOB_YAML(PACKAGE.version)}`);
288
317
  }
289
318
  }
290
319
 
@@ -302,4 +331,4 @@ try {
302
331
  process.exit(isPostinstall ? 0 : 1);
303
332
  }
304
333
 
305
- export { CI_LINE, OWNER_WORD_LABEL, replaceManagedBlock, selectRuleSections };
334
+ export { CI_JOB, CI_LINE, OWNER_WORD_LABEL, hasCiJob, replaceManagedBlock, selectRuleSections };
@@ -17,8 +17,9 @@ branch is read; a local checkout is read at `origin/<mainBranch>` when that ref
17
17
  `--source git` (default) reads `context/` of the main branch through git (a shallow, sparse, blob-less
18
18
  clone into a temporary folder for a remote), takes `context/state.json`, and runs softure-doctor on the
19
19
  same tree. A project without `state.json` gets one built in memory and is marked `*`.
20
- `--source api` reads only `context/state.json` through the GitHub API (`gh api`); the doctor column
21
- then shows `n/a`.
20
+ `--source api` reads only `context/state.json` through the GitHub API (`gh api`) and runs no doctor: the
21
+ doctor column shows the `context-doctor` check run on the main branch's head instead (`ok`, `failing`,
22
+ `pending`, or `missing` when the project's CI has no job by that name).
22
23
 
23
24
  Default output, one row per project:
24
25
 
@@ -29,8 +30,11 @@ repository, in both modes; a local checkout counts when its `origin` is on GitHu
29
30
  `v*` tag (git mode), else the value a closed roadmap recorded in `state.json`, labelled `(roadmap)`.
30
31
  `SOFTURE_GH` names another `gh` binary.
31
32
 
32
- `--owner` prints only the owner queue across all projects, oldest first. `--json` prints the same data
33
- for another tool (`last_release` is the version; `last_release_source` is `release`, `tag` or `roadmap`). Exit 1 when a project could not be read (its row says why); nothing is ever written
33
+ `--owner` prints only the owner queue across all projects, oldest first, with each entry's `id` (an owner-word issue
34
+ names the entry it answers by that id, WORKFLOW §8.6). `--json` prints the same data
35
+ for another tool (`last_release` is the version; `last_release_source` is `release`, `tag` or `roadmap`;
36
+ with `--source api`, `doctor_check` is the check run's status, `doctor_check_url` its page and `doctor_check_codes`
37
+ the doctor's failure codes from the run's annotations; the table shows them after `failing`). Exit 1 when a project could not be read (its row says why); nothing is ever written
34
38
  outside a temporary folder.
35
39
  """
36
40
  from __future__ import annotations
@@ -53,6 +57,10 @@ import doctor # noqa: E402
53
57
  DEFAULT_CONFIG = os.path.join("~", ".config", "softure", "portfolio.json")
54
58
  GITHUB_RE = re.compile(r"github\.com[:/]([\w.-]+/[\w.-]+?)(?:\.git)?/?$")
55
59
  SEMVER_RE = re.compile(r"^v?(\d+)\.(\d+)\.(\d+)$")
60
+ # The CI job every adopting project runs the doctor in (WORKFLOW.md §12.2); its check run carries this name.
61
+ DOCTOR_CHECK = "context-doctor"
62
+ CODES_TITLE = "context-doctor failure codes" # the doctor's annotation that lists its failure codes
63
+ PASSING = ("success", "neutral", "skipped")
56
64
 
57
65
 
58
66
  def git(*args: str, cwd: str | None = None, check: bool = True) -> subprocess.CompletedProcess:
@@ -128,6 +136,57 @@ def forge_release(slug: str | None) -> dict | None:
128
136
  return {"version": data["tag_name"], "date": (data.get("published_at") or "")[:10] or None, "source": "release"}
129
137
 
130
138
 
139
+ def gh_json(path: str):
140
+ """`gh api <path>` as JSON; None without gh, access or a valid answer."""
141
+ try:
142
+ shown = subprocess.run([gh(), "api", path], capture_output=True, text=True, timeout=30)
143
+ except (OSError, subprocess.TimeoutExpired):
144
+ return None
145
+ if shown.returncode != 0:
146
+ return None
147
+ try:
148
+ return json.loads(shown.stdout)
149
+ except json.JSONDecodeError:
150
+ return None
151
+
152
+
153
+ def doctor_check(slug: str, branch: str | None) -> dict:
154
+ """The newest `context-doctor` check run on the head of `branch` (else the default branch).
155
+
156
+ `status` is `ok`, `failing`, `pending`, `missing` (no check run by that name), or `unknown` (the forge
157
+ could not be asked).
158
+ """
159
+ if not branch:
160
+ branch = (gh_json(f"repos/{slug}") or {}).get("default_branch")
161
+ if not branch:
162
+ return {"status": "unknown", "url": None}
163
+ data = gh_json(f"repos/{slug}/commits/{branch}/check-runs?check_name={DOCTOR_CHECK}&filter=latest")
164
+ if not isinstance(data, dict):
165
+ return {"status": "unknown", "url": None}
166
+ runs = [run for run in data.get("check_runs") or [] if run.get("name") == DOCTOR_CHECK]
167
+ if not runs:
168
+ return {"status": "missing", "url": None}
169
+ run = max(runs, key=lambda run: (run.get("started_at") or "", run.get("id") or 0))
170
+ if run.get("status") != "completed":
171
+ status = "pending"
172
+ else:
173
+ status = "ok" if run.get("conclusion") in PASSING else "failing"
174
+ codes = failure_codes(slug, run) if status == "failing" else []
175
+ return {"status": status, "url": run.get("html_url"), "codes": codes}
176
+
177
+
178
+ def failure_codes(slug: str, run: dict) -> list[str]:
179
+ """The doctor's failure codes of a failing check run, from its `context-doctor failure codes` annotation."""
180
+ if not run.get("id") or not (run.get("output") or {}).get("annotations_count", 1):
181
+ return []
182
+ annotations = gh_json(f"repos/{slug}/check-runs/{run['id']}/annotations")
183
+ for annotation in annotations if isinstance(annotations, list) else []:
184
+ if annotation.get("title") == CODES_TITLE:
185
+ return [part.strip().split(" (")[0] for part in (annotation.get("message") or "").split(",")
186
+ if part.strip()]
187
+ return []
188
+
189
+
131
190
  def pick_release(forge: dict | None, tag: dict | None, state: dict | None) -> dict:
132
191
  """The forge's release, else the highest tag, else the roadmap-recorded value (labelled as such)."""
133
192
  for found in (forge, tag):
@@ -216,8 +275,11 @@ def read_api(project: dict) -> dict:
216
275
  elif "404" not in shown.stderr and "Not Found" not in shown.stderr:
217
276
  raise RuntimeError(f"gh api failed: {shown.stderr.strip()[:200]}")
218
277
  release = pick_release(forge_release(slug), None, state)
278
+ check = doctor_check(slug, project.get("branch"))
219
279
  return {"branch": project.get("branch") or "default", "state": state, "state_source": source,
220
- "doctor": None, **release_fields(release)}
280
+ "doctor": None, "doctor_check": check["status"], "doctor_check_url": check["url"],
281
+ "doctor_check_codes": check.get("codes") or [],
282
+ **release_fields(release)}
221
283
 
222
284
 
223
285
  def release_fields(release: dict) -> dict:
@@ -248,17 +310,27 @@ def collect(projects: list[dict], source: str) -> list[dict]:
248
310
  return rows
249
311
 
250
312
 
313
+ def check_cell(row: dict) -> str:
314
+ """The doctor column of a row read through the API: the `context-doctor` check run, else `n/a`."""
315
+ check = row.get("doctor_check")
316
+ if check == "failing" and row.get("doctor_check_codes"):
317
+ return f"failing: {', '.join(row['doctor_check_codes'])}"
318
+ return check if check and check != "unknown" else "n/a"
319
+
320
+
251
321
  def summary_cells(row: dict) -> list[str]:
252
322
  name = row["name"] + ("*" if row.get("state_source") == "built" else "")
253
323
  if row["error"]:
254
324
  return [name, f"error: {row['error']}", "", "", "", "", ""]
255
325
  state = row["state"]
256
326
  if state is None:
257
- return [name, "no state.json", "—", "—", "—", release_cell(row), "n/a"]
327
+ return [name, "no state.json", "—", "—", "—", release_cell(row), check_cell(row)]
258
328
  active = state.get("active_roadmap")
259
329
  roadmap = f"{active.get('slug') or '?'} {active['done']}/{active['total']}" if active else "—"
260
- doctor_cell = "n/a" if row["doctor"] is None else ("ok" if not row["doctor"] else
261
- f"{len(row['doctor'])} failing")
330
+ if row["doctor"] is not None:
331
+ doctor_cell = "ok" if not row["doctor"] else f"{len(row['doctor'])} failing"
332
+ else:
333
+ doctor_cell = check_cell(row)
262
334
  return [name, roadmap, str(len(state.get("queued", []))), str(len(state.get("open_changes", []))),
263
335
  str(len(state.get("owner_queue", []))), release_cell(row), doctor_cell]
264
336
 
@@ -310,9 +382,10 @@ def main(argv: list[str] | None = None) -> int:
310
382
  print(json.dumps({"generated_at": generated, "projects": rows}, indent=2, ensure_ascii=False))
311
383
  elif flags["--owner"]:
312
384
  entries = owner_entries(rows)
313
- print(table(["since", "project", "kind", "what", "source"],
385
+ print(table(["since", "project", "kind", "what", "source", "id"],
314
386
  [[e.get("since") or "—", e["project"], e["kind"], e["text"],
315
- e["source"].replace("context/", "")] for e in entries]) if entries else "Nothing waits for the owner.")
387
+ e["source"].replace("context/", ""), e.get("id") or "—"] for e in entries])
388
+ if entries else "Nothing waits for the owner.")
316
389
  else:
317
390
  print(table(["project", "active roadmap X/N", "queued", "open changes", "owner queue", "last release", "doctor"],
318
391
  [summary_cells(row) for row in rows]))
@@ -36,9 +36,12 @@ backlog), §5.2 (closing a roadmap), §6 (Progress). Two scripts next to this fi
36
36
 
37
37
  ## When it runs
38
38
 
39
- - **CI of every adopting project**, documentation-only changes included: `npx softure-skills doctor`
40
- (the installer prints this line). A project with history adds it after the rollout (WORKFLOW §12.4):
41
- `--fix --write`, the sweep to zero, the owner's short list, then the CI line. Drift happens in the documents, so a CI that skips doc-only
39
+ - **CI of every adopting project**, documentation-only changes included: `npx softure-skills doctor` in a job
40
+ named `context-doctor`, with no paths filter and no condition (the installer prints the job; WORKFLOW §12.2).
41
+ Keep the name: outside readers look for that check run on the main branch's head; in GitHub Actions the doctor
42
+ writes its failure codes there as annotations (the first, `context-doctor failure codes`, lists them all) and as
43
+ the job summary. A project with history adds it after the rollout (WORKFLOW §12.4):
44
+ `--fix --write`, the sweep to zero, the owner's short list, then the CI job. Drift happens in the documents, so a CI that skips doc-only
42
45
  changes misses it.
43
46
  - **`softure-archive`** (on the main branch) and **`softure-roadmap`** (record, `--queue`, `--promote`,
44
47
  `--close`): `context_state.py write --staged` right before the commit, then `doctor.py`; each fixes
@@ -67,7 +70,7 @@ Each problem is one line `FAIL <code> <path>: <what>`. Fix the file it names, ne
67
70
  ## Mechanical repairs: `--fix`
68
71
 
69
72
  `doctor.py --fix` prints every edit it would make and the failures left after them; `--fix --write`
70
- applies them. It writes only under `context/`, and a second run changes nothing. Three shapes are
73
+ applies them. It writes only under `context/`, and a second run changes nothing. Four shapes are
71
74
  mechanical:
72
75
 
73
76
  - `archived-change-status`: the archived `change.md` gets `status: archived`, and the old value is kept
@@ -76,7 +79,11 @@ mechanical:
76
79
  path when git history shows where it moved (renames followed across several moves); a file deleted on
77
80
  purpose (git shows the deletion, no rename) is marked `(removed in <sha>)` with the deleting commit;
78
81
  - a dropped Progress item of an archived plan (unticked, but struck through or carrying an explicit
79
- dropped/cancelled/not-applicable note) is normalised to `- [x] ~~<item>~~ — dropped: <note>`.
82
+ dropped/cancelled/not-applicable note) is normalised to `- [x] ~~<item>~~ — dropped: <note>`;
83
+ - a carried entry of an archived roadmap: an unticked owner check or pre-release step, or an open row, whose
84
+ text carries a carry marker (`→ roadmap-<slug>`, `carried to <roadmap>`) naming a roadmap that exists
85
+ (queued, archived or the live one) is ticked `- [x] <text> — carried to <path>` (a row becomes
86
+ `carried (to <path>)`). A marker whose roadmap does not exist is left alone and named: it stays a failure.
80
87
 
81
88
  It skips, and names, every row it cannot settle from history (a live index, a target whose move or
82
89
  deletion the history does not show). A shallow clone works on the commits it holds and names what lies
@@ -102,6 +109,8 @@ The evidence it looks for:
102
109
  | `archived-roadmap-summary` | the merge (or squash) commit of the item's change on the main line; the last SHA of its archived plan |
103
110
  | `archived-roadmap-open-items` | the item's archived change folder, its merge commit, the release that contains it, later roadmaps that mention it |
104
111
  | `archived-roadmap-open-checks` | the same for the item the check names, plus the first release after the close (for pre-release steps) |
112
+ | carried entries | a check or row with a carry marker whose roadmap exists: that roadmap (`--fix --write` ticks it) |
113
+ | post-merge steps | a release after the merge, `close #N`, the Dependabot pull requests: asked of the forge through `gh` (the first release published on or after the merge date, the state of `#N`, open Dependabot pull requests); class `forge` when the forge cannot be reached (`--no-forge` skips it) |
105
114
  | anything else | the file to fix (`index-missing-file`: where git history says the file went, or that it never existed) |
106
115
 
107
116
  Work the list in one change per repository (`docs(context): settle history to zero`):
@@ -120,7 +129,11 @@ Work the list in one change per repository (`docs(context): settle history to ze
120
129
  superseded by <release / roadmap / change>` (a row: `dropped (obsolete: superseded by <ref>)`).
121
130
  Never forward it to the owner: a screenshot review of a page rebuilt since, or "after the release,
122
131
  re-run X" for a release long gone, has no answer the owner could give.
123
- 3. **Only true owner items stay open, in one place.** An entry is the owner's when the evidence does
132
+ 3. **`forge` entries are yours, not the owner's.** Check each with `gh` before anything goes to the owner:
133
+ `gh release list` (a release published after the merge), `gh issue view <N>` / `gh pr view <N>`,
134
+ `gh pr list --author app/dependabot`. Tick it with what the forge shows (`— done: v1.5.0`,
135
+ `— done: #12 closed`); only a step the forge shows not done, and only the owner can do, goes on.
136
+ 4. **Only true owner items stay open, in one place.** An entry is the owner's when the evidence does
124
137
  not settle it, nothing later superseded it, and only the owner can: a decision about future work
125
138
  that is still open, a secret, account or connector, or a step outside the repository (a production
126
139
  setting, a real device) whose effect the agent cannot see. Before forwarding an `unsettled` entry,
@@ -128,8 +141,8 @@ Work the list in one change per repository (`docs(context): settle history to ze
128
141
  live roadmap's `## Owner decisions and checks` (or an `owner-word` issue, WORKFLOW §8.6) and tick
129
142
  the archived line `— carried to <path | #N>`. Never carry a check whose work the evidence shows done,
130
143
  and never tick a decision on the owner's behalf.
131
- 4. Regenerate the state (`context_state.py write`) and re-run `doctor.py` until it exits 0. Commit.
132
- 5. Report: failures per code before and after, and **one short list for the owner**: `ID | what the
144
+ 5. Regenerate the state (`context_state.py write`) and re-run `doctor.py` until it exits 0. Commit.
145
+ 6. Report: failures per code before and after, and **one short list for the owner**: `ID | what the
133
146
  owner decides or does | where it lives now`. Nothing else is left open.
134
147
 
135
148
  An entry the agent cannot settle and that is not the owner's (the evidence is ambiguous) is named in
@@ -8,13 +8,14 @@
8
8
  "open_changes", "owner_queue", "last_release"],
9
9
  "additionalProperties": false,
10
10
  "properties": {
11
- "schema_version": { "type": "integer", "enum": [1] },
12
- "project": { "type": ["string", "null"], "description": "workflow.json `project`, else the roadmap's `project`" },
11
+ "schema_version": { "type": "integer", "enum": [1, 2], "description": "2 adds owner_queue[].id; a reader of version 1 files treats id as absent" },
12
+ "project": { "type": "string", "description": "workflow.json `project`, else the active roadmap's `project`, else the repository name (origin's URL, else the folder); never null" },
13
13
  "mode": { "type": "string", "enum": ["manual", "autonomous"] },
14
14
  "main_branch": { "type": ["string", "null"] },
15
15
  "updated_at": { "type": "string", "description": "UTC ISO 8601; changes only when the content does" },
16
16
  "active_roadmap": {
17
17
  "type": ["object", "null"],
18
+ "description": "null when roadmap.md is absent or is the idle placeholder (status: idle or roadmap: none)",
18
19
  "required": ["slug", "title", "status", "version", "path", "done", "total", "items"],
19
20
  "additionalProperties": false,
20
21
  "properties": {
@@ -103,6 +104,7 @@
103
104
  "required": ["kind", "source", "item", "since", "text"],
104
105
  "additionalProperties": false,
105
106
  "properties": {
107
+ "id": { "type": "string", "description": "stable id of the entry (schema_version 2): set when the entry first appears, kept on every rewrite, also when only its wording changed or its heading moved within the file; absent in version 1 files" },
106
108
  "kind": { "type": "string", "enum": ["word", "decision", "step", "secret"] },
107
109
  "source": { "type": "string", "description": "file, then `#` and the heading" },
108
110
  "item": { "type": ["string", "null"], "description": "roadmap item ID, when the entry names one" },