@softure-ai/skills 0.20.0 → 0.22.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 +22 -2
- package/WORKFLOW.md +87 -11
- package/package.json +1 -1
- package/scripts/install.mjs +4 -1
- package/scripts/portfolio.py +85 -16
- package/skills/softure-doctor/SKILL.md +105 -11
- package/skills/softure-doctor/scripts/context_state.py +74 -15
- package/skills/softure-doctor/scripts/doctor.py +378 -40
- package/skills/softure-doctor/scripts/doctor_fix.py +271 -0
- package/skills/softure-doctor/scripts/doctor_sweep.py +530 -0
- package/skills/softure-roadmap/SKILL.md +9 -2
|
@@ -12,7 +12,10 @@ the working tree, so someone else's uncommitted edits never leak into the file,
|
|
|
12
12
|
|
|
13
13
|
Everything in the file is derived from the markdown under `context/` (and `context/workflow.json`):
|
|
14
14
|
the active roadmap, the queued roadmaps, the change folders, and one `owner_queue` that lists every
|
|
15
|
-
entry that waits for the owner. The
|
|
15
|
+
entry that waits for the owner. The queue is built only from what is live: the active roadmap, the
|
|
16
|
+
queued roadmaps, the open changes, and the pre-release steps of the newest closed roadmap until its
|
|
17
|
+
release is recorded. An unticked entry left in any other archived roadmap is history to settle
|
|
18
|
+
(the doctor's `archived-roadmap-open-checks`), never an owner-queue item. The schema ships next to this script
|
|
16
19
|
(`../references/state.schema.json`). A reader needs this one file per repository instead of parsing
|
|
17
20
|
the markdown.
|
|
18
21
|
|
|
@@ -41,6 +44,10 @@ ARCHIVE_ROADMAPS_DIR = "context/foundation/archive"
|
|
|
41
44
|
CHANGES_DIR = "context/changes"
|
|
42
45
|
# Fields a script rewrites without the markdown changing: never a reason to call the file stale.
|
|
43
46
|
VOLATILE_FIELDS = ("updated_at", "open_changes")
|
|
47
|
+
# Owner-queue entries from these sources are refreshed like open_changes: a change branch edits them.
|
|
48
|
+
VOLATILE_SOURCES = ("context/changes/",)
|
|
49
|
+
HANDOFF_SECTION = "Roadmap handoff"
|
|
50
|
+
HANDOFF_OWNER_RE = re.compile(r"^- \*\*Owner (?P<what>step|check):\*\*\s*(?P<text>.+)$")
|
|
44
51
|
|
|
45
52
|
ROW_RE = re.compile(r"^\|\s*\*\*(?P<id>[A-Z]+-\d+)\*\*\s*\|")
|
|
46
53
|
ID_RE = re.compile(r"\b[A-Z]+-\d+\b")
|
|
@@ -290,15 +297,15 @@ def _today() -> str:
|
|
|
290
297
|
|
|
291
298
|
def _owner_entries(path: str, text: str, rows: list[dict], fallback_since: str,
|
|
292
299
|
archived: bool = False) -> list[dict]:
|
|
293
|
-
"""Every open entry of one roadmap file that waits for the owner.
|
|
300
|
+
"""Every open entry of one live roadmap file that waits for the owner.
|
|
294
301
|
|
|
295
|
-
|
|
296
|
-
|
|
302
|
+
With `archived` (only the newest closed roadmap whose `## Summary` records no release yet), just its
|
|
303
|
+
open `## Before the next release` steps count: the close comes before the release (WORKFLOW §5.2).
|
|
297
304
|
"""
|
|
298
305
|
entries: list[dict] = []
|
|
299
306
|
parts = sections(text)
|
|
300
307
|
ids_with_entry: set[str] = set()
|
|
301
|
-
for line in open_checkboxes(parts.get(OWNER_SECTION, [])):
|
|
308
|
+
for line in ([] if archived else open_checkboxes(parts.get(OWNER_SECTION, []))):
|
|
302
309
|
ref = ITEM_REF_RE.search(line)
|
|
303
310
|
item = ref.group("id") if ref else None
|
|
304
311
|
lowered = line.lower()
|
|
@@ -312,8 +319,7 @@ def _owner_entries(path: str, text: str, rows: list[dict], fallback_since: str,
|
|
|
312
319
|
ids_with_entry.add(item)
|
|
313
320
|
entries.append({"kind": kind, "source": f"{path}#{OWNER_SECTION}", "item": item,
|
|
314
321
|
"since": _date_in(line) or fallback_since, "text": line})
|
|
315
|
-
|
|
316
|
-
for line in ([] if released else open_checkboxes(parts.get(RELEASE_SECTION, []))):
|
|
322
|
+
for line in open_checkboxes(parts.get(RELEASE_SECTION, [])):
|
|
317
323
|
ref = ITEM_REF_RE.search(line)
|
|
318
324
|
entries.append({"kind": "secret" if SECRET_RE.search(line) else "step",
|
|
319
325
|
"source": f"{path}#{RELEASE_SECTION}", "item": ref.group("id") if ref else None,
|
|
@@ -339,6 +345,38 @@ def _owner_entries(path: str, text: str, rows: list[dict], fallback_since: str,
|
|
|
339
345
|
return entries
|
|
340
346
|
|
|
341
347
|
|
|
348
|
+
def released(text: str) -> bool:
|
|
349
|
+
"""Whether an archived roadmap's `## Summary` records the release that shipped it."""
|
|
350
|
+
return any(RELEASE_LINE_RE.match(line.strip()) for line in sections(text).get("Summary", []))
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
def archived_roadmap_files(reader) -> list[str]:
|
|
354
|
+
"""Archived roadmaps (`<date>-roadmap*.md` in foundation/archive/), oldest first."""
|
|
355
|
+
return _roadmap_files(reader, ARCHIVE_ROADMAPS_DIR, r"^\d{4}-\d{2}-\d{2}-roadmap.*\.md$")
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def pending_release_roadmap(reader) -> str | None:
|
|
359
|
+
"""The newest archived roadmap when its release is not recorded yet: its pre-release steps are live."""
|
|
360
|
+
paths = [path for path in archived_roadmap_files(reader) if roadmap_rows(reader.read(path) or "")]
|
|
361
|
+
if not paths:
|
|
362
|
+
return None
|
|
363
|
+
newest = paths[-1]
|
|
364
|
+
return None if released(reader.read(newest) or "") else newest
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
def _handoff_entries(path: str, text: str, item: str | None, since: str) -> list[dict]:
|
|
368
|
+
"""Owner steps and checks an open change records in its `## Roadmap handoff` (WORKFLOW §4)."""
|
|
369
|
+
entries = []
|
|
370
|
+
for line in sections(text).get(HANDOFF_SECTION, []):
|
|
371
|
+
match = HANDOFF_OWNER_RE.match(line.strip())
|
|
372
|
+
if match:
|
|
373
|
+
body = match.group("text").strip()
|
|
374
|
+
entries.append({"kind": "secret" if SECRET_RE.search(body) else "step",
|
|
375
|
+
"source": f"{path}#{HANDOFF_SECTION}", "item": item,
|
|
376
|
+
"since": _date_in(body) or since, "text": f"owner {match.group('what')}: {body}"})
|
|
377
|
+
return entries
|
|
378
|
+
|
|
379
|
+
|
|
342
380
|
def _date_in(text: str) -> str | None:
|
|
343
381
|
match = DATE_RE.search(text)
|
|
344
382
|
return match.group(1) if match else None
|
|
@@ -354,7 +392,7 @@ def _roadmap_files(reader, directory: str, pattern: str) -> list[str]:
|
|
|
354
392
|
|
|
355
393
|
|
|
356
394
|
def _last_release(reader) -> dict | None:
|
|
357
|
-
for path in reversed(
|
|
395
|
+
for path in reversed(archived_roadmap_files(reader)):
|
|
358
396
|
text = reader.read(path) or ""
|
|
359
397
|
for line in reversed(sections(text).get("Summary", [])):
|
|
360
398
|
match = RELEASE_LINE_RE.match(line.strip())
|
|
@@ -421,11 +459,12 @@ def build_state(reader, prior: dict | None = None, now: str | None = None) -> di
|
|
|
421
459
|
"text": f"start queued roadmap {slug}" + (f": {condition}" if condition else "")})
|
|
422
460
|
owner_queue += _owner_entries(path, text, rows, meta.get("updated") or today)
|
|
423
461
|
|
|
424
|
-
|
|
425
|
-
|
|
462
|
+
pending = pending_release_roadmap(reader)
|
|
463
|
+
if pending:
|
|
464
|
+
text = reader.read(pending) or ""
|
|
426
465
|
meta = frontmatter(text)
|
|
427
|
-
owner_queue += _owner_entries(
|
|
428
|
-
archived=True)
|
|
466
|
+
owner_queue += _owner_entries(pending, text, roadmap_rows(text),
|
|
467
|
+
meta.get("updated") or pending.split("/")[-1][:10], archived=True)
|
|
429
468
|
|
|
430
469
|
open_changes = []
|
|
431
470
|
for name, is_dir in reader.listdir(CHANGES_DIR):
|
|
@@ -445,6 +484,8 @@ def build_state(reader, prior: dict | None = None, now: str | None = None) -> di
|
|
|
445
484
|
"updated": meta.get("updated"),
|
|
446
485
|
"stage": (row["stage"] or row["status"]) if row else None,
|
|
447
486
|
})
|
|
487
|
+
owner_queue += _handoff_entries(f"{CHANGES_DIR}/{name}/change.md", text, meta.get("roadmap_item"),
|
|
488
|
+
meta.get("updated") or today)
|
|
448
489
|
|
|
449
490
|
previous = {_entry_key(entry): entry.get("since") for entry in (prior or {}).get("owner_queue", [])}
|
|
450
491
|
for entry in owner_queue:
|
|
@@ -480,10 +521,13 @@ def _entry_key(entry: dict) -> tuple:
|
|
|
480
521
|
|
|
481
522
|
|
|
482
523
|
def comparable(state: dict | None) -> dict | None:
|
|
483
|
-
"""The state without
|
|
524
|
+
"""The state without what a rewrite may change on its own (VOLATILE_FIELDS, VOLATILE_SOURCES)."""
|
|
484
525
|
if state is None:
|
|
485
526
|
return None
|
|
486
|
-
|
|
527
|
+
kept = {key: value for key, value in state.items() if key not in VOLATILE_FIELDS}
|
|
528
|
+
kept["owner_queue"] = [entry for entry in kept.get("owner_queue") or []
|
|
529
|
+
if not str(entry.get("source", "")).startswith(VOLATILE_SOURCES)]
|
|
530
|
+
return kept
|
|
487
531
|
|
|
488
532
|
|
|
489
533
|
def serialize(state: dict) -> str:
|
|
@@ -537,6 +581,21 @@ def repo_root(start: str) -> str:
|
|
|
537
581
|
return out.stdout.strip() if out.returncode == 0 else os.path.abspath(start)
|
|
538
582
|
|
|
539
583
|
|
|
584
|
+
def quiet_broken_pipe(run) -> int:
|
|
585
|
+
"""Run a CLI entry point; when stdout is closed early (`doctor --sweep | head`), stop quietly with 141.
|
|
586
|
+
|
|
587
|
+
141 is what a shell reports for a process ended by SIGPIPE; no traceback, no "Exception ignored".
|
|
588
|
+
"""
|
|
589
|
+
try:
|
|
590
|
+
code = run()
|
|
591
|
+
sys.stdout.flush()
|
|
592
|
+
return code
|
|
593
|
+
except BrokenPipeError:
|
|
594
|
+
devnull = os.open(os.devnull, os.O_WRONLY)
|
|
595
|
+
os.dup2(devnull, sys.stdout.fileno()) # the interpreter's final flush must not fail again
|
|
596
|
+
return 141
|
|
597
|
+
|
|
598
|
+
|
|
540
599
|
def main(argv: list[str] | None = None) -> int:
|
|
541
600
|
args = list(sys.argv[1:] if argv is None else argv)
|
|
542
601
|
root = None
|
|
@@ -575,4 +634,4 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
575
634
|
|
|
576
635
|
|
|
577
636
|
if __name__ == "__main__":
|
|
578
|
-
sys.exit(main
|
|
637
|
+
sys.exit(quiet_broken_pipe(main))
|