@softure-ai/skills 0.23.0 → 0.25.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.
@@ -15,6 +15,9 @@ evidence found in the repository, and how to settle it:
15
15
  contains it, and later roadmaps that mention the item
16
16
  archived-roadmap-open-checks the same for the item the check names, plus the first release after
17
17
  the roadmap was closed
18
+ carried entries an open check or row whose text carries a carry marker (`→ roadmap-<slug>`,
19
+ `carried to <roadmap>`) naming a roadmap that exists: that roadmap is the
20
+ evidence, and `--fix` ticks it (a marker whose roadmap is gone stays as it was)
18
21
  anything else the file to fix (and `--fix` for the mechanical shapes)
19
22
 
20
23
  Every entry has a `class`:
@@ -25,6 +28,12 @@ Every entry has a `class`:
25
28
  item ID or file area appears in a later archived change; for a Progress item, a later
26
29
  phase of the same plan is ticked (or a later archived change has the item's area). The
27
30
  agent closes it as `obsolete: superseded by <ref>` itself, never forwards it
31
+ forge a post-merge step the history cannot prove (a release after the merge, `close #N`, the
32
+ Dependabot pull requests) while the forge cannot be reached from here: an agent with `gh`
33
+ checks it before anything goes to the owner. With the forge reachable (`gh` and a GitHub
34
+ remote), the sweep asks it itself: a release published on or after the merge date, the
35
+ state of each `#N`, open Dependabot pull requests; when every check holds the entry is
36
+ `evidence` with those pointers (`--no-forge` skips the forge)
28
37
  owner only the owner can settle it: a decision about future work, a secret, account or connector,
29
38
  or a step outside the repository whose effect the agent cannot see (`owner_reason` says
30
39
  which; `unsettled` when nothing at all was found), with `tried`: what the sweep looked for
@@ -215,6 +224,19 @@ def _item_evidence(reader, git: Git, path: str, item: str | None, change_id: str
215
224
  return evidence
216
225
 
217
226
 
227
+ CARRIED_SETTLE = "mechanical: `doctor --fix --write` ticks it `— carried to <path>` (the row: `carried (to <path>)`)"
228
+
229
+
230
+ def _carried(reader, text: str) -> list[dict]:
231
+ """Evidence when `text` carries a carry marker whose roadmap exists; [] otherwise (a missing target stays open)."""
232
+ import doctor
233
+
234
+ target = doctor.carry_target(text)
235
+ found = doctor.resolve_carry(reader, target)
236
+ return [_evidence("file", found, f"the carry marker `{target}` names this roadmap, which took the entry over")] \
237
+ if found else []
238
+
239
+
218
240
  def owner_kind(text: str) -> str | None:
219
241
  """`decision`, `secret` or `outside` when the line is something only the owner can settle; None otherwise."""
220
242
  for kind, pattern in OWNER_KINDS:
@@ -242,6 +264,9 @@ def _entry(code: str, path: str, line: int | None, text: str, subject: str, evid
242
264
  evidence = superseded
243
265
  else:
244
266
  klass, reason, settle = "owner", "unsettled", SETTLE.get(code, "fix the file it names")
267
+ override = extra.pop("settle_override", None)
268
+ if override and klass == "evidence":
269
+ settle = override
245
270
  return {"code": code, "path": path, "line": line, "text": text, "subject": subject, "evidence": evidence,
246
271
  "class": klass, "owner": klass == "owner", "owner_reason": reason,
247
272
  "tried": [] if klass == "evidence" else (tried or []), "settle": settle, **extra}
@@ -390,7 +415,9 @@ def _progress_entries(reader, git: Git, path: str) -> list[dict]:
390
415
  if git.shallow:
391
416
  tried.append("the history is a shallow clone; `git fetch --deepen <n>` may find more")
392
417
  entries.append(_entry("archived-change-progress", path, number, line, subject, evidence,
393
- superseded=superseded, tried=tried, owner_text=subject))
418
+ superseded=superseded, tried=tried, owner_text=subject,
419
+ merged_on=merges[0]["date"] if merges else (change.get("archived_at") or change.get("updated")
420
+ or since)))
394
421
  return entries
395
422
 
396
423
 
@@ -432,12 +459,14 @@ def _open_item_entries(reader, git: Git, path: str) -> list[dict]:
432
459
  continue
433
460
  row = rows.pop(match.group(1))
434
461
  status = [cell.strip() for cell in line.strip().strip("|").split("|")][-1]
435
- evidence = _item_evidence(reader, git, path, row["id"], row["change_id"])
462
+ carried = _carried(reader, status)
463
+ evidence = carried or _item_evidence(reader, git, path, row["id"], row["change_id"])
436
464
  superseded, tried = ([], []) if evidence else _superseded_roadmap_entry(
437
465
  reader, git, path, line, [row["id"], row["change_id"]])
438
466
  entries.append(_entry("archived-roadmap-open-items", path, number, line, f"{row['id']} ({row['status']})",
439
467
  evidence, superseded=superseded, tried=tried, item=row["id"],
440
- change_id=row["change_id"], status=status))
468
+ change_id=row["change_id"], status=status, settle_override=CARRIED_SETTLE
469
+ if carried else None))
441
470
  return entries
442
471
 
443
472
 
@@ -460,14 +489,17 @@ def _open_check_entries(reader, git: Git, path: str) -> list[dict]:
460
489
  ref = ITEM_REF_RE.search(line)
461
490
  item = ref.group("id") if ref else None
462
491
  change_id = (rows.get(item) or {}).get("change_id") if item else None
463
- evidence = _item_evidence(reader, git, path, item, change_id) if item else []
492
+ carried = _carried(reader, line)
493
+ evidence = carried or (_item_evidence(reader, git, path, item, change_id) if item else [])
464
494
  if release and section == RELEASE_SECTION:
465
495
  evidence.append(_evidence("release", release["tag"], f"released {release['date']}, after the close"))
466
496
  superseded, tried = ([], []) if evidence else _superseded_roadmap_entry(
467
497
  reader, git, path, line, [item, change_id] if item else [])
468
498
  entries.append(_entry("archived-roadmap-open-checks", path, number, line, box.group("text").strip(),
469
- evidence, superseded=superseded, tried=tried, owner_text=box.group("text"),
470
- item=item, change_id=change_id, section=section))
499
+ evidence, superseded=superseded, tried=tried,
500
+ owner_text=None if carried else box.group("text"), item=item, change_id=change_id,
501
+ section=section, settle_override=CARRIED_SETTLE if carried else None,
502
+ merged_on=closed_on))
471
503
  return entries
472
504
 
473
505
 
@@ -503,11 +535,15 @@ def _file_entry(failure, reader) -> dict:
503
535
  return _entry(failure.code, failure.path, None, "", failure.message, evidence)
504
536
 
505
537
 
506
- def sweep(reader, root: str | None) -> list[dict]:
507
- """Every failure the doctor reports on `reader`, as worklist entries with evidence."""
538
+ def sweep(reader, root: str | None, forge: "Forge | None" = None) -> list[dict]:
539
+ """Every failure the doctor reports on `reader`, as worklist entries with evidence.
540
+
541
+ `forge` (default: `Forge(root)`, through `gh`) is asked about post-merge steps that the history cannot prove.
542
+ """
508
543
  import doctor
509
544
 
510
545
  git = Git(root)
546
+ forge = forge if forge is not None else Forge(root)
511
547
  entries: list[dict] = []
512
548
  indexes_done = False
513
549
  for failure in doctor.run_checks(reader, root, baseline=False):
@@ -527,4 +563,134 @@ def sweep(reader, root: str | None) -> list[dict]:
527
563
  entries += _open_check_entries(reader, git, failure.path)
528
564
  else:
529
565
  entries.append(_file_entry(failure, reader))
566
+ for entry in entries:
567
+ _forge_step(entry, forge)
530
568
  return entries
569
+
570
+
571
+ # ---------------------------------------------------------------- forge
572
+
573
+
574
+ class Forge:
575
+ """Read-only questions to the repository's forge through `gh` (`$SOFTURE_GH` names another binary).
576
+
577
+ `{owner}/{repo}` is resolved by `gh` from the checkout's remote. `reachable` is False without `gh`, without a
578
+ GitHub remote, without credentials, or when `enabled` is False (`--no-forge`); every answer is then None.
579
+ """
580
+
581
+ def __init__(self, root: str | None, enabled: bool = True) -> None:
582
+ self.root = root
583
+ self.enabled = enabled and bool(root)
584
+ self._reachable: bool | None = None
585
+ self._releases: list[dict] | None = None
586
+
587
+ def _api(self, path: str):
588
+ import json
589
+
590
+ try:
591
+ out = subprocess.run([os.environ.get("SOFTURE_GH", "gh"), "api", path], cwd=self.root,
592
+ capture_output=True, text=True, timeout=60)
593
+ except (OSError, subprocess.TimeoutExpired):
594
+ return None
595
+ if out.returncode != 0:
596
+ return None
597
+ try:
598
+ return json.loads(out.stdout)
599
+ except ValueError:
600
+ return None
601
+
602
+ @property
603
+ def reachable(self) -> bool:
604
+ if self._reachable is None:
605
+ self._reachable = self.enabled and isinstance(self._api("repos/{owner}/{repo}"), dict)
606
+ return self._reachable
607
+
608
+ def releases(self) -> list[dict]:
609
+ if self._releases is None:
610
+ data = self._api("repos/{owner}/{repo}/releases?per_page=100") if self.reachable else None
611
+ self._releases = sorted((release for release in data or [] if isinstance(release, dict)
612
+ and not release.get("draft") and release.get("published_at")),
613
+ key=lambda release: release["published_at"])
614
+ return self._releases
615
+
616
+ def release_after(self, day: str | None) -> dict | None:
617
+ """The first published release on or after `day`."""
618
+ return next((release for release in self.releases() if release["published_at"][:10] >= (day or "")), None)
619
+
620
+ def issue(self, number: str) -> dict | None:
621
+ data = self._api(f"repos/{{owner}}/{{repo}}/issues/{number}") if self.reachable else None
622
+ return data if isinstance(data, dict) else None
623
+
624
+ def open_dependabot_before(self, day: str | None) -> list[dict] | None:
625
+ data = self._api("repos/{owner}/{repo}/pulls?state=open&per_page=100") if self.reachable else None
626
+ if not isinstance(data, list):
627
+ return None
628
+ return [pull for pull in data if "dependabot" in ((pull.get("user") or {}).get("login") or "")
629
+ and (pull.get("created_at") or "")[:10] <= (day or "9999")]
630
+
631
+
632
+ RELEASE_STEP_RE = re.compile(r"\b(?:release|released|publish|published)\b", re.IGNORECASE)
633
+ ISSUE_REF_RE = re.compile(r"(?<![\w/&])#(\d+)\b")
634
+ DEPENDABOT_RE = re.compile(r"\bdependabot\b", re.IGNORECASE)
635
+ FORGE_SETTLE = ("check it with the forge before anything goes to the owner (`gh release list`, `gh issue view <N>`, "
636
+ "`gh pr list --author app/dependabot`), then tick it with what the forge shows")
637
+
638
+
639
+ def forge_checks(text: str) -> list[tuple[str, str | None]]:
640
+ """What the forge can prove for a post-merge step: ("release", None), ("issue", "<N>"), ("dependabot", None)."""
641
+ checks: list[tuple[str, str | None]] = []
642
+ if RELEASE_STEP_RE.search(text or ""):
643
+ checks.append(("release", None))
644
+ checks += [("issue", number) for number in dict.fromkeys(ISSUE_REF_RE.findall(text or ""))]
645
+ if DEPENDABOT_RE.search(text or ""):
646
+ checks.append(("dependabot", None))
647
+ return checks
648
+
649
+
650
+ def _forge_step(entry: dict, forge: Forge) -> None:
651
+ """Settle a post-merge step the history cannot prove with the forge: `evidence`, else `forge` when unreachable.
652
+
653
+ Only entries the sweep would hand to the owner as `unsettled` or `outside` are asked about; a decision or a
654
+ secret stays the owner's. Every check the line names must hold for `evidence`.
655
+ """
656
+ if entry["class"] != "owner" or entry.get("owner_reason") not in ("unsettled", "outside"):
657
+ return
658
+ checks = forge_checks(entry.get("subject") or entry.get("text") or "")
659
+ if not checks:
660
+ return
661
+ day = entry.get("merged_on")
662
+ if not forge.reachable:
663
+ entry.update({"class": "forge", "owner": False, "owner_reason": None, "settle": FORGE_SETTLE,
664
+ "tried": entry.get("tried", []) + ["the forge: not reachable here (no `gh`, no GitHub remote or "
665
+ "no credentials); an agent with `gh` checks it"]})
666
+ return
667
+ found: list[dict] = []
668
+ missing: list[str] = []
669
+ for kind, value in checks:
670
+ if kind == "release":
671
+ release = forge.release_after(day)
672
+ if release:
673
+ found.append(_evidence("release", release.get("tag_name") or "?",
674
+ f"published {release['published_at'][:10]}, on or after the merge ({day})"))
675
+ else:
676
+ missing.append(f"a release published on or after {day}: none")
677
+ elif kind == "issue":
678
+ issue = forge.issue(value)
679
+ pull = (issue or {}).get("pull_request") or {}
680
+ if issue and issue.get("state") == "closed":
681
+ what = "pull request merged" if pull.get("merged_at") else ("pull request closed" if pull else "closed")
682
+ found.append(_evidence("issue", f"#{value}", f"{what} {(issue.get('closed_at') or '')[:10]}".strip()))
683
+ else:
684
+ missing.append(f"#{value}: {issue.get('state') if issue else 'not found'}")
685
+ else:
686
+ pulls = forge.open_dependabot_before(day)
687
+ if pulls == []:
688
+ found.append(_evidence("forge", "dependabot", f"no open Dependabot pull request opened by {day}"))
689
+ else:
690
+ missing.append(f"open Dependabot pull requests opened by {day}: "
691
+ + (", ".join(f"#{pull.get('number')}" for pull in pulls) if pulls else "unknown"))
692
+ if not missing:
693
+ entry.update({"class": "evidence", "owner": False, "owner_reason": None, "evidence": found, "tried": [],
694
+ "settle": SETTLE.get(entry["code"], "fix the file it names")})
695
+ else:
696
+ entry["tried"] = entry.get("tried", []) + [f"the forge: {note}" for note in missing]
@@ -204,6 +204,11 @@ Overwriting a roadmap without archiving it is never an option. In `--auto`: revi
204
204
  free slot", never a noun like "booking system"), `Unlocks` (foundations only), Prerequisites,
205
205
  Touches (estimate), Unknowns, Risk (one line: why it sits here and what could go wrong),
206
206
  Baseline (how it is measured before and after) and PRD refs (literal IDs, not paraphrases).
207
+ **Size (optional):** only when the owner asks for sizes or `workflow.json` sets
208
+ `roadmap.sizes: true`, add `- **Size:** S | M | L` after `Touches (estimate)` (WORKFLOW §5,
209
+ "Sizes and slices"). Sizes are relative to each other and read from the slicing signals (phases,
210
+ migrations, surfaces, unknowns; [references/slicing.md](references/slicing.md)), never hours,
211
+ days, points or dates. Without that word or key, write no size.
207
212
 
208
213
  11. **Header and `## Order`.**
209
214
  - frontmatter: `prd_version` = the PRD `version`;
@@ -215,6 +220,11 @@ Overwriting a roadmap without archiving it is never an option. In `--auto`: revi
215
220
  - `## Order` opens with the framing (optimising for, first proof, main risk, depth), then the
216
221
  reasoning for the order, `### Starting point` (the confirmed baseline, one line per layer
217
222
  with a file), `### Lanes`, and one line pointing to deferred ideas in the backlog.
223
+ - With sizes (step 10): one `**Sizes:**` line under `## Order` that defines S, M and L for this
224
+ roadmap, relative to each other, and a `### Slices` block after `### Lanes`:
225
+ `| Slice | Items | Size |`, slices in order, the first usable slice in bold, each size as counts
226
+ (`2 S, 1 M`). Every sized item sits in exactly one slice. Slices are what the owner funds;
227
+ lanes stay what runs in parallel.
218
228
  - Define any strategy term (north star, riskiest assumption, …) in one plain sentence on first
219
229
  use, or replace it with plain words. A teammate must be able to read the roadmap cold.
220
230
 
@@ -277,8 +287,8 @@ Exactly the structure of WORKFLOW §5. Parser-critical rules:
277
287
  and `blocked`. `ready` means the item itself has no open decision; whether its prerequisites
278
288
  are merged is checked by the orchestrator.
279
289
  - Every item block has `- **Change ID:** \`<id>\`` followed directly by `- **Status:** <same as row>`.
280
- Extra fields (`Unlocks`, `Touches (estimate)`, `Input`) come after those two.
281
- - The framing, baseline, lanes and deferred ideas live under `## Order`; owner questions under
290
+ Extra fields (`Unlocks`, `Touches (estimate)`, the optional `Size`, `Input`) come after those two.
291
+ - The framing, baseline, lanes, the optional sizes and slices, and deferred ideas live under `## Order`; owner questions under
282
292
  `## Owner decisions and checks`. Do not add other top-level sections.
283
293
  - `## Done` starts empty; `softure-archive` is its only writer.
284
294
 
@@ -312,7 +322,10 @@ Record each choice under `## Decisions (auto)` at the end of the file:
312
322
  item sits in exactly one lane.
313
323
  - [ ] The table and item blocks agree on IDs, change-ids and statuses; change-ids are unique
314
324
  kebab-case outcomes, not IDs, dates or activities.
315
- - [ ] No estimates, sizes or dates for delivery; no implementation steps.
325
+ - [ ] No estimates in time (hours, days, points) and no dates for delivery; no implementation steps.
326
+ - [ ] Sizes only when asked (the owner's word or `roadmap.sizes: true`): then every item has `S`, `M`
327
+ or `L`, the `**Sizes:**` line defines them, and every item sits in exactly one slice whose size
328
+ sum matches its items. Without that, no item has a size.
316
329
  - [ ] Strategy terms are defined on first use.
317
330
  - [ ] The first item can start today with no open owner decision.
318
331
 
@@ -321,7 +334,8 @@ Record each choice under `## Decisions (auto)` at the end of the file:
321
334
  - Do not plan implementation steps. That is `softure-plan`, per change.
322
335
  - Do not change the status of an item that is in progress. That belongs to the orchestrators
323
336
  and `softure-archive`.
324
- - Do not estimate in hours, days, points or sizes. Order and slice size are the planning tools here.
337
+ - Do not estimate in hours, days, points or dates. Order and slice size are the planning tools here;
338
+ a relative size (S / M / L) is written only when the owner asks for it or `roadmap.sizes` is true.
325
339
  - Do not chain into the next skill on your own; the handoff is a recommendation.
326
340
  - Do not implement roadmap items in the session that wrote the roadmap. In a coordinated run
327
341
  (autonomous mode, a hosted project), the roadmap thread commits and merges `roadmap.md` together
@@ -150,6 +150,36 @@ What makes it good:
150
150
  - mail is adopted from a module rather than built;
151
151
  - no estimates, no dates other than the framing date, no implementation steps.
152
152
 
153
+ ## The same roadmap with sizes (optional)
154
+
155
+ Only when the owner asks for sizes (here: "the first usable slice now, the rest after it") or
156
+ `workflow.json` sets `roadmap.sizes: true`. The table, the statuses and the first two fields of each
157
+ item stay as they are; three things are added.
158
+
159
+ Under `## Order`, after `### Lanes`:
160
+
161
+ ```markdown
162
+ **Sizes:** relative to each other, never hours or dates. S: one or two phases, no migration, one
163
+ surface. M: up to four phases or one migration. L: four phases with a migration and open unknowns.
164
+
165
+ ### Slices
166
+ | Slice | Items | Size |
167
+ | --- | --- | --- |
168
+ | **1. First usable: a visitor books online** | BK-1, BK-2 | 1 M, 1 L |
169
+ | 2. Clients and staff manage bookings | BK-3, BK-4, BK-5 | 2 S, 1 M |
170
+ | 3. Deposits and sharing | BK-6, BK-7 | 1 S, 1 M |
171
+ ```
172
+
173
+ In each item block, after `Touches (estimate)`:
174
+
175
+ ```markdown
176
+ - **Touches (estimate):** `lib/availability/**`, `drizzle/` (one migration), owner settings form.
177
+ - **Size:** M
178
+ ```
179
+
180
+ Every item has a size and sits in exactly one slice, each slice's sum counts its items' sizes, and
181
+ nothing is in hours, days or dates.
182
+
153
183
  ## A bad version of the same roadmap
154
184
 
155
185
  ```markdown
@@ -18,8 +18,17 @@ An item is the right size when:
18
18
  - it has at most three unknowns; more means research would be a project of its own;
19
19
  - it can merge without a feature flag, or the flag is part of the item.
20
20
 
21
- Size is expressed by these signals, never in hours, days, points or t-shirt sizes. Agent execution
22
- is not linear in calendar time, and an estimate in the roadmap gets read as a promise.
21
+ Size is expressed by these signals, never in hours, days or points. Agent execution is not linear
22
+ in calendar time, and an estimate in the roadmap gets read as a promise.
23
+
24
+ **Relative sizes, on request.** When the owner funds the roadmap in slices and asks for sizes (or
25
+ `workflow.json` sets `roadmap.sizes: true`), give each item `S`, `M` or `L` from the same signals,
26
+ relative to the other items of this roadmap, and define them once under `## Order`. A starting
27
+ point: `S` = one or two phases, no migration, one surface; `M` = up to four phases or one migration;
28
+ `L` = at the limits above (four phases, a migration, three unknowns); anything bigger is split, not
29
+ sized `XL`. Then group the items into `### Slices` (WORKFLOW §5): the first usable slice is the
30
+ smallest set that someone can use on its own, each later slice adds one more usable step, and each
31
+ slice shows its size sum as counts (`2 S, 1 M`).
23
32
 
24
33
  ## When an item is too big: split patterns
25
34
 
@@ -115,4 +124,4 @@ risk is `capacity`, look harder for parallel lanes: they are the owner's best le
115
124
  | "Change the button colour on the invoice page" | too small, no outcome | fold into the item whose screen it is |
116
125
  | "Set up the API layer" | generic foundation, no `Unlocks` | "(foundation) invoice numbering is gap-free per year; unlocks IN-2, IN-4" |
117
126
  | "Add analytics dashboard" (not in PRD) | invented scope | owner question or backlog entry |
118
- | "Wiki search (2 days, M)" | estimate and size label | drop the estimate; split by data subset if it is big |
127
+ | "Wiki search (2 days, M)" | a time estimate, and a size in the title | drop the estimate; a size goes only in the optional `Size` field, on request; split by data subset if it is big |