@softure-ai/skills 0.19.0 → 0.21.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/ONBOARD.md +1 -1
- package/README.md +44 -0
- package/WORKFLOW.md +210 -6
- package/package.json +2 -1
- package/rules/AGENTS.md +26 -1
- package/scripts/install.mjs +70 -1
- package/scripts/portfolio.py +328 -0
- package/skills/softure-archive/SKILL.md +15 -6
- package/skills/softure-doctor/SKILL.md +146 -0
- package/skills/softure-doctor/references/state.schema.json +125 -0
- package/skills/softure-doctor/scripts/context_state.py +622 -0
- package/skills/softure-doctor/scripts/doctor.py +573 -0
- package/skills/softure-doctor/scripts/doctor_fix.py +227 -0
- package/skills/softure-doctor/scripts/doctor_sweep.py +386 -0
- package/skills/softure-roadmap/SKILL.md +21 -3
- package/skills/softure-worktree/scripts/wt-roadmap.py +66 -5
- package/skills/softure-worktree-manager/SKILL.md +7 -1
- package/skills/softure-worktree-manager/references/report-routine.md +3 -1
|
@@ -43,6 +43,10 @@ from HEAD plus one edit (hash-object -> update-index), so other sessions' uncomm
|
|
|
43
43
|
the working file never ride along; the same edit is applied to the working file too, so it does
|
|
44
44
|
not look like it reverts the commit.
|
|
45
45
|
|
|
46
|
+
Every commit also carries `context/state.json` (WORKFLOW.md §12), regenerated from the same tree
|
|
47
|
+
plus the new roadmap, so the machine-readable state never lags the markdown. A project without the
|
|
48
|
+
file gets it on the first run.
|
|
49
|
+
|
|
46
50
|
Always works on the main worktree (first entry of `git worktree list`), whichever worktree
|
|
47
51
|
calls it. The main branch name comes from context/workflow.json (`mainBranch`).
|
|
48
52
|
|
|
@@ -76,7 +80,14 @@ sys.dont_write_bytecode = True # no __pycache__ inside the consumer's .claude/s
|
|
|
76
80
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
77
81
|
from wt_config import load_config, main_branch, main_root # noqa: E402
|
|
78
82
|
|
|
83
|
+
try: # the state writer ships in the softure-doctor skill, installed next to this one
|
|
84
|
+
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "softure-doctor", "scripts"))
|
|
85
|
+
import context_state # noqa: E402
|
|
86
|
+
except ImportError: # pragma: no cover - an install without softure-doctor still marks the roadmap
|
|
87
|
+
context_state = None
|
|
88
|
+
|
|
79
89
|
ROADMAP = "context/foundation/roadmap.md"
|
|
90
|
+
STATE = "context/state.json"
|
|
80
91
|
COAUTHOR = "Co-Authored-By: Claude <noreply@anthropic.com>"
|
|
81
92
|
|
|
82
93
|
ROW_RE = re.compile(r"^(?P<head>\|.*\|\s*)(?P<status>[^|]*?)(?P<tail>\s*\|\s*)$")
|
|
@@ -256,6 +267,21 @@ def done_status(handoff: dict, mode: str, arg: str | None, today: str) -> str:
|
|
|
256
267
|
return "done"
|
|
257
268
|
|
|
258
269
|
|
|
270
|
+
def render_state(reader) -> str | None:
|
|
271
|
+
"""`context/state.json` for the tree `reader` sees, or None when softure-doctor is not installed."""
|
|
272
|
+
if context_state is None:
|
|
273
|
+
print("note: softure-doctor is not installed next to softure-worktree; context/state.json not written",
|
|
274
|
+
file=sys.stderr)
|
|
275
|
+
return None
|
|
276
|
+
return context_state.render_state(reader)
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
def print_state_diff(old: str | None, new: str | None, label: str) -> None:
|
|
280
|
+
if new is not None and old != new:
|
|
281
|
+
sys.stdout.writelines(difflib.unified_diff((old or "").splitlines(True), new.splitlines(True),
|
|
282
|
+
f"{label}:{STATE}", f"commit:{STATE}"))
|
|
283
|
+
|
|
284
|
+
|
|
259
285
|
def unchanged(old: str, new: str, target: str) -> bool:
|
|
260
286
|
"""A re-run (e.g. `done` after a retry) whose edit is already in place commits nothing."""
|
|
261
287
|
if re.sub(r"(?m)^updated: .*$", "", old) != re.sub(r"(?m)^updated: .*$", "", new):
|
|
@@ -415,8 +441,11 @@ def run_cloud(mode: str, change_id: str, arg: str | None, branch: str | None, dr
|
|
|
415
441
|
handoff, run_mode, run_arg = load_handoff(repo, base, mode, change_id, arg, verified)
|
|
416
442
|
new = edit(old, run_mode, change_id, run_arg, repo_name, cloud_branch=branch if mode == "open" else None,
|
|
417
443
|
handoff=handoff)
|
|
444
|
+
state = render_state(context_state.GitReader(repo, base, {ROADMAP: new})) if context_state else None
|
|
418
445
|
if dry:
|
|
419
446
|
sys.stdout.writelines(difflib.unified_diff(old.splitlines(True), new.splitlines(True), f"origin/{main}", "commit"))
|
|
447
|
+
print_state_diff(context_state.GitReader(repo, base).read(STATE) if context_state else None, state,
|
|
448
|
+
f"origin/{main}")
|
|
420
449
|
return
|
|
421
450
|
if unchanged(old, new, f"origin/{main}"):
|
|
422
451
|
return
|
|
@@ -432,6 +461,12 @@ def run_cloud(mode: str, change_id: str, arg: str | None, branch: str | None, dr
|
|
|
432
461
|
git(repo, "read-tree", base, env=index_env)
|
|
433
462
|
blob = git(repo, "hash-object", "-w", blob_path, env=index_env).strip()
|
|
434
463
|
git(repo, "update-index", "--cacheinfo", f"100644,{blob},{ROADMAP}", env=index_env)
|
|
464
|
+
if state is not None:
|
|
465
|
+
state_path = os.path.join(tmpdir, "state.json")
|
|
466
|
+
with open(state_path, "w", encoding="utf-8") as fh:
|
|
467
|
+
fh.write(state)
|
|
468
|
+
state_blob = git(repo, "hash-object", "-w", state_path, env=index_env).strip()
|
|
469
|
+
git(repo, "update-index", "--add", "--cacheinfo", f"100644,{state_blob},{STATE}", env=index_env)
|
|
435
470
|
tree = git(repo, "write-tree", env=index_env).strip()
|
|
436
471
|
sha = git(repo, "commit-tree", tree, "-p", base, "-m", msg, env=index_env).strip()
|
|
437
472
|
push = push_roadmap_commit(repo, sha, main, env)
|
|
@@ -462,22 +497,39 @@ def run_cloud_branch(mode: str, change_id: str, arg: str | None, branch: str | N
|
|
|
462
497
|
handoff, mode, arg = load_handoff(repo, "HEAD", mode, change_id, arg, verified)
|
|
463
498
|
new = edit(old, mode, change_id, arg, repo_name, cloud_branch=branch if mode == "open" else None,
|
|
464
499
|
handoff=handoff)
|
|
500
|
+
state = render_state(context_state.FsReader(repo, {ROADMAP: new})) if context_state else None
|
|
465
501
|
if dry:
|
|
466
502
|
sys.stdout.writelines(difflib.unified_diff(old.splitlines(True), new.splitlines(True), current, "commit"))
|
|
503
|
+
print_state_diff(context_state.FsReader(repo).read(STATE) if context_state else None, state, current)
|
|
467
504
|
return
|
|
468
505
|
if unchanged(old, new, current):
|
|
469
506
|
return
|
|
470
507
|
with open(work_path, "w", encoding="utf-8") as fh:
|
|
471
508
|
fh.write(new)
|
|
509
|
+
paths = [ROADMAP]
|
|
510
|
+
if state is not None:
|
|
511
|
+
with open(os.path.join(repo, STATE), "w", encoding="utf-8") as fh:
|
|
512
|
+
fh.write(state)
|
|
513
|
+
git(repo, "add", "--", STATE)
|
|
514
|
+
paths.append(STATE)
|
|
472
515
|
msg = commit_message(old, mode, change_id, arg, f"cloud session, branch {branch}", new)
|
|
473
516
|
session = os.environ.get("CLAUDE_CODE_REMOTE_SESSION_ID", "")
|
|
474
517
|
if session.startswith("cse_"):
|
|
475
518
|
msg += f"\nClaude-Session: https://claude.ai/code/session_{session[4:]}"
|
|
476
|
-
git(repo, "commit", "-q", "-m", msg, "--",
|
|
519
|
+
git(repo, "commit", "-q", "-m", msg, "--", *paths)
|
|
477
520
|
sha = git(repo, "rev-parse", "--short", "HEAD").strip()
|
|
478
521
|
print(f"{sha} {msg.splitlines()[0]} -> {current} (not pushed; the branch carries the state)")
|
|
479
522
|
|
|
480
523
|
|
|
524
|
+
def hash_text(repo: str, text: str) -> str:
|
|
525
|
+
with tempfile.NamedTemporaryFile("w", delete=False, encoding="utf-8") as tmp:
|
|
526
|
+
tmp.write(text)
|
|
527
|
+
try:
|
|
528
|
+
return git(repo, "hash-object", "-w", tmp.name).strip()
|
|
529
|
+
finally:
|
|
530
|
+
os.unlink(tmp.name)
|
|
531
|
+
|
|
532
|
+
|
|
481
533
|
def run_local(mode: str, change_id: str, arg: str | None, dry: bool, verified: str | None = None) -> None:
|
|
482
534
|
main_wt = main_root()
|
|
483
535
|
repo_name = os.path.basename(main_wt)
|
|
@@ -492,6 +544,9 @@ def run_local(mode: str, change_id: str, arg: str | None, dry: bool, verified: s
|
|
|
492
544
|
handoff, mode, arg = load_handoff(main_wt, "HEAD", mode, change_id, arg, verified)
|
|
493
545
|
new_head = edit(head_text, mode, change_id, arg, repo_name, handoff=handoff)
|
|
494
546
|
sys.stdout.writelines(difflib.unified_diff(head_text.splitlines(True), new_head.splitlines(True), "HEAD", "commit"))
|
|
547
|
+
if context_state:
|
|
548
|
+
print_state_diff(context_state.GitReader(main_wt, "HEAD").read(STATE),
|
|
549
|
+
render_state(context_state.GitReader(main_wt, "HEAD", {ROADMAP: new_head})), "HEAD")
|
|
495
550
|
return
|
|
496
551
|
|
|
497
552
|
# Several sessions commit stages on the main branch at once. Every attempt re-reads HEAD,
|
|
@@ -518,25 +573,31 @@ def run_local(mode: str, change_id: str, arg: str | None, dry: bool, verified: s
|
|
|
518
573
|
new_work = new_head if work_text == head_text else edit(work_text, run_mode, change_id, run_arg, repo_name,
|
|
519
574
|
handoff=handoff)
|
|
520
575
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
os.unlink(tmp.name)
|
|
576
|
+
state = render_state(context_state.GitReader(main_wt, head_sha, {ROADMAP: new_head})) if context_state else None
|
|
577
|
+
blob = hash_text(main_wt, new_head)
|
|
578
|
+
state_blob = hash_text(main_wt, state) if state is not None else None
|
|
525
579
|
|
|
526
580
|
try:
|
|
527
581
|
git(main_wt, "update-index", "--cacheinfo", f"100644,{blob},{ROADMAP}")
|
|
582
|
+
if state_blob:
|
|
583
|
+
git(main_wt, "update-index", "--add", "--cacheinfo", f"100644,{state_blob},{STATE}")
|
|
528
584
|
if git(main_wt, "rev-parse", "HEAD").strip() != head_sha:
|
|
529
585
|
raise subprocess.CalledProcessError(1, "rev-parse", stderr="HEAD moved")
|
|
530
586
|
git(main_wt, "commit", "-q", "-m", msg)
|
|
531
587
|
break
|
|
532
588
|
except subprocess.CalledProcessError as exc:
|
|
533
589
|
subprocess.run(["git", "-C", main_wt, "reset", "-q", "--", ROADMAP])
|
|
590
|
+
if state_blob:
|
|
591
|
+
subprocess.run(["git", "-C", main_wt, "reset", "-q", "--", STATE], capture_output=True)
|
|
534
592
|
if attempt < 7:
|
|
535
593
|
time.sleep(2)
|
|
536
594
|
continue
|
|
537
595
|
sys.exit(f"commit failed (index restored): {exc.stderr}")
|
|
538
596
|
with open(work_path, "w", encoding="utf-8") as fh:
|
|
539
597
|
fh.write(new_work)
|
|
598
|
+
if state is not None:
|
|
599
|
+
with open(os.path.join(main_wt, STATE), "w", encoding="utf-8") as fh:
|
|
600
|
+
fh.write(state)
|
|
540
601
|
sha = git(main_wt, "rev-parse", "--short", "HEAD").strip()
|
|
541
602
|
print(f"{sha} {msg.splitlines()[0]}")
|
|
542
603
|
if work_text != head_text:
|
|
@@ -188,7 +188,13 @@ claude agents --json # background + interactive sessio
|
|
|
188
188
|
```
|
|
189
189
|
|
|
190
190
|
Plus `ListAgents` for peer sessions — its header names **this** session;
|
|
191
|
-
remember it, M0.1 compares against it.
|
|
191
|
+
remember it, M0.1 compares against it. List the open `owner-word` issues of
|
|
192
|
+
this repository (`gh issue list --label owner-word --state open`, WORKFLOW §8.6)
|
|
193
|
+
and act on them before anything else: autonomous mode carries each out like an
|
|
194
|
+
order in the conversation, comments what was done and closes it (one it cannot
|
|
195
|
+
act on gets a comment with the question and stays open); manual mode shows them
|
|
196
|
+
to the owner and waits for the word. Repeat this on every status firing (M4).
|
|
197
|
+
Read `context/foundation/roadmap.md`:
|
|
192
198
|
the header note (run-wide orders from the owner such as parallelism or the
|
|
193
199
|
final push), `## At a glance`, `## Order`, each candidate's `### <ID>` block.
|
|
194
200
|
|
|
@@ -34,7 +34,9 @@ Roadmap report for <roadmap name> (SOFTURE workflow, AGENTS.md → Operating mod
|
|
|
34
34
|
If several firings queued up while busy, do one.
|
|
35
35
|
- Running as the coordinator: post the roadmap report in the main chat in the standard shape
|
|
36
36
|
(title, "X of N on <main>", the four-column table of the items not done yet, Decision, times),
|
|
37
|
-
in chatLanguage, times in timezone. Before posting,
|
|
37
|
+
in chatLanguage, times in timezone. Before posting, act on every open `owner-word` issue of
|
|
38
|
+
<owner/repo> (WORKFLOW §8.6: carry it out, comment, close; ask in a comment when unclear), then run
|
|
39
|
+
the heartbeat: recompute the startable set
|
|
38
40
|
from roadmap.md on origin/<main> (softure-worktree/scripts/wt-startable.py; never only the
|
|
39
41
|
successors of the last merge) and start a thread for every item that is not done, has no thread
|
|
40
42
|
and has all prerequisites on <main> or none; give the go to every READY thread; nudge every
|