@softure-ai/skills 0.22.0 → 0.23.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 +15 -7
- package/WORKFLOW.md +24 -9
- package/package.json +1 -1
- package/rules/AGENTS.md +1 -1
- package/scripts/install.mjs +37 -8
- package/scripts/portfolio.py +60 -7
- package/skills/softure-doctor/SKILL.md +4 -3
- package/skills/softure-doctor/references/state.schema.json +2 -1
- package/skills/softure-doctor/scripts/context_state.py +23 -2
- package/skills/softure-doctor/scripts/doctor.py +1 -1
- package/skills/softure-init/SKILL.md +5 -0
- package/skills/softure-init/references/example.md +3 -1
package/README.md
CHANGED
|
@@ -29,16 +29,24 @@ 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
|
|
33
|
-
that already has history, once the rollout below
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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.
|
|
36
|
+
|
|
37
|
+
```yaml
|
|
38
|
+
context-doctor:
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
- run: npx --yes --package @softure-ai/skills@<version> softure-skills doctor
|
|
43
|
+
env:
|
|
44
|
+
npm_config_ignore_scripts: "true"
|
|
37
45
|
```
|
|
38
46
|
|
|
39
47
|
It fails on drift in `context/` (a roadmap left after its archive, archived changes not stamped,
|
|
40
48
|
`## Summary` placeholders, a stale `context/state.json`, …; WORKFLOW §12). The installer prints the
|
|
41
|
-
|
|
49
|
+
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
50
|
scripts otherwise write themselves.
|
|
43
51
|
|
|
44
52
|
**Rolling out to an existing project** (WORKFLOW §12.4). A project that adopted the package earlier
|
|
@@ -52,7 +60,7 @@ usually fails on history. Put it right, in this order, one pass per repository:
|
|
|
52
60
|
releases or changes made them obsolete) are closed by the agent as obsolete, never forwarded.
|
|
53
61
|
3. The owner's short list: only real owner items (a decision about future work, a secret, account or
|
|
54
62
|
connector, a step outside the repository), carried to the live roadmap or an `owner-word` issue.
|
|
55
|
-
4. The
|
|
63
|
+
4. The `context-doctor` job above, once the doctor is at zero.
|
|
56
64
|
|
|
57
65
|
`npx softure-skills doctor --baseline` exists only as a last resort, for a project that cannot finish
|
|
58
66
|
the history sweep at once: it accepts today's failures in `context/doctor-baseline.json`, the check
|
package/WORKFLOW.md
CHANGED
|
@@ -723,10 +723,11 @@ A project without the file gets it from the first of these runs; nothing has to
|
|
|
723
723
|
```jsonc
|
|
724
724
|
{
|
|
725
725
|
"schema_version": 1,
|
|
726
|
-
"project": "Example clinic", // workflow.json `project`, else the roadmap's
|
|
726
|
+
"project": "Example clinic", // workflow.json `project`, else the roadmap's, else the repository name; never null
|
|
727
727
|
"mode": "autonomous", "main_branch": "main",
|
|
728
728
|
"updated_at": "2026-11-20T09:00:00Z", // changes only when the content does
|
|
729
|
-
"active_roadmap": { // null when there is no roadmap.md
|
|
729
|
+
"active_roadmap": { // null when there is no roadmap.md, or it is the idle placeholder
|
|
730
|
+
// (front matter `status: idle` or `roadmap: none`)
|
|
730
731
|
"slug": "search", "title": "…", "status": "ready", "version": "2", "path": "context/foundation/roadmap.md",
|
|
731
732
|
"done": 2, "total": 5, // done = rows done or done_code (the report's X of N)
|
|
732
733
|
"items": [ // rows not done yet
|
|
@@ -829,9 +830,22 @@ fixed entries, never adds one (it names them and exits 1), and removes the file
|
|
|
829
830
|
never baselined; `--fix` and `--sweep` ignore it. It is the owner's call, recorded in the commit; the recommended path
|
|
830
831
|
is the sweep to zero.
|
|
831
832
|
|
|
832
|
-
A project that has never written `state.json` gets a note, not a failure. **Adopting projects run the doctor in
|
|
833
|
-
|
|
834
|
-
|
|
833
|
+
A project that has never written `state.json` gets a note, not a failure. **Adopting projects run the doctor in a CI
|
|
834
|
+
job named `context-doctor`**, with no paths filter and no condition, so documentation-only changes are checked too and
|
|
835
|
+
an outside reader finds the result by that name: the check run `context-doctor` on the main branch's head says whether
|
|
836
|
+
the project's context contract is green (`portfolio --source api` reads it). Keep the job name, whatever the rest of
|
|
837
|
+
the workflow looks like. The installer prints the job until a workflow under `.github/workflows/` runs the doctor, and
|
|
838
|
+
asks to rename it while the job that runs it has another name:
|
|
839
|
+
|
|
840
|
+
```yaml
|
|
841
|
+
context-doctor: # keep this name: readers look for the check run "context-doctor"
|
|
842
|
+
runs-on: ubuntu-latest
|
|
843
|
+
steps:
|
|
844
|
+
- uses: actions/checkout@v4
|
|
845
|
+
- run: npx --yes --package @softure-ai/skills@<version> softure-skills doctor
|
|
846
|
+
env:
|
|
847
|
+
npm_config_ignore_scripts: "true" # run the doctor only, no install into the checkout
|
|
848
|
+
``` `softure-archive` and `softure-roadmap --close` run it before their commit
|
|
835
849
|
and fix what they own.
|
|
836
850
|
|
|
837
851
|
### 12.3 Portfolio: many projects at once
|
|
@@ -850,7 +864,8 @@ The config file lives outside every project (`--config <file>`, `$SOFTURE_PORTFO
|
|
|
850
864
|
where `repo` is `owner/name`, a git URL or a local path. One row per project:
|
|
851
865
|
`project | active roadmap X/N | queued | open changes | owner queue | last release | doctor`. The doctor runs on the
|
|
852
866
|
same tree; a project without `state.json` yet gets one built in memory (marked `*`). `--source api` reads only
|
|
853
|
-
`state.json` through `gh api`
|
|
867
|
+
`state.json` through `gh api` and runs no doctor; its doctor column is the `context-doctor` check run on the main
|
|
868
|
+
branch's head (`ok`, `failing`, `pending`, or `missing` when the project has no job by that name). **Last release comes from the forge** when it can: the latest GitHub
|
|
854
869
|
release through `gh api` (both modes, for a GitHub repository; a local checkout counts when its `origin` is on GitHub),
|
|
855
870
|
else the highest `v*` tag (git mode), else `state.json` → `last_release`, which only records what a closed roadmap
|
|
856
871
|
wrote and is shown labelled: `v1.4.0 (roadmap, 2026-10-02)`. `--json` gives `last_release`, `last_release_date` and
|
|
@@ -872,8 +887,8 @@ long ago. The history is put right, not hidden. One pass per repository, in this
|
|
|
872
887
|
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
888
|
agent's report lists it once, short: `ID | what the owner decides or does | where it lives now`. Nothing else
|
|
874
889
|
waits, so `portfolio --owner` shows only these and the live roadmaps' entries.
|
|
875
|
-
4. **The CI
|
|
876
|
-
(
|
|
890
|
+
4. **The CI job at zero.** Once `npx softure-skills doctor` exits 0 on the main branch, add the `context-doctor` job
|
|
891
|
+
(§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
892
|
|
|
878
893
|
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
|
-
|
|
894
|
+
`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.
|
|
3
|
+
"version": "0.23.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
|
|
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
|
package/scripts/install.mjs
CHANGED
|
@@ -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
|
-
//
|
|
84
|
-
|
|
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
|
|
87
|
-
|
|
99
|
+
if (!fs.existsSync(dir)) return "none";
|
|
100
|
+
const texts = fs
|
|
88
101
|
.readdirSync(dir)
|
|
89
102
|
.filter((name) => /\.ya?ml$/.test(name))
|
|
90
|
-
.
|
|
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 (
|
|
287
|
-
console.log(`${prefix}
|
|
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 };
|
package/scripts/portfolio.py
CHANGED
|
@@ -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`)
|
|
21
|
-
|
|
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
|
|
|
@@ -30,7 +31,8 @@ repository, in both modes; a local checkout counts when its `origin` is on GitHu
|
|
|
30
31
|
`SOFTURE_GH` names another `gh` binary.
|
|
31
32
|
|
|
32
33
|
`--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
|
|
34
|
+
for another tool (`last_release` is the version; `last_release_source` is `release`, `tag` or `roadmap`;
|
|
35
|
+
with `--source api`, `doctor_check` is the check run's status and `doctor_check_url` its page). Exit 1 when a project could not be read (its row says why); nothing is ever written
|
|
34
36
|
outside a temporary folder.
|
|
35
37
|
"""
|
|
36
38
|
from __future__ import annotations
|
|
@@ -53,6 +55,9 @@ import doctor # noqa: E402
|
|
|
53
55
|
DEFAULT_CONFIG = os.path.join("~", ".config", "softure", "portfolio.json")
|
|
54
56
|
GITHUB_RE = re.compile(r"github\.com[:/]([\w.-]+/[\w.-]+?)(?:\.git)?/?$")
|
|
55
57
|
SEMVER_RE = re.compile(r"^v?(\d+)\.(\d+)\.(\d+)$")
|
|
58
|
+
# The CI job every adopting project runs the doctor in (WORKFLOW.md §12.2); its check run carries this name.
|
|
59
|
+
DOCTOR_CHECK = "context-doctor"
|
|
60
|
+
PASSING = ("success", "neutral", "skipped")
|
|
56
61
|
|
|
57
62
|
|
|
58
63
|
def git(*args: str, cwd: str | None = None, check: bool = True) -> subprocess.CompletedProcess:
|
|
@@ -128,6 +133,44 @@ def forge_release(slug: str | None) -> dict | None:
|
|
|
128
133
|
return {"version": data["tag_name"], "date": (data.get("published_at") or "")[:10] or None, "source": "release"}
|
|
129
134
|
|
|
130
135
|
|
|
136
|
+
def gh_json(path: str):
|
|
137
|
+
"""`gh api <path>` as JSON; None without gh, access or a valid answer."""
|
|
138
|
+
try:
|
|
139
|
+
shown = subprocess.run([gh(), "api", path], capture_output=True, text=True, timeout=30)
|
|
140
|
+
except (OSError, subprocess.TimeoutExpired):
|
|
141
|
+
return None
|
|
142
|
+
if shown.returncode != 0:
|
|
143
|
+
return None
|
|
144
|
+
try:
|
|
145
|
+
return json.loads(shown.stdout)
|
|
146
|
+
except json.JSONDecodeError:
|
|
147
|
+
return None
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def doctor_check(slug: str, branch: str | None) -> dict:
|
|
151
|
+
"""The newest `context-doctor` check run on the head of `branch` (else the default branch).
|
|
152
|
+
|
|
153
|
+
`status` is `ok`, `failing`, `pending`, `missing` (no check run by that name), or `unknown` (the forge
|
|
154
|
+
could not be asked).
|
|
155
|
+
"""
|
|
156
|
+
if not branch:
|
|
157
|
+
branch = (gh_json(f"repos/{slug}") or {}).get("default_branch")
|
|
158
|
+
if not branch:
|
|
159
|
+
return {"status": "unknown", "url": None}
|
|
160
|
+
data = gh_json(f"repos/{slug}/commits/{branch}/check-runs?check_name={DOCTOR_CHECK}&filter=latest")
|
|
161
|
+
if not isinstance(data, dict):
|
|
162
|
+
return {"status": "unknown", "url": None}
|
|
163
|
+
runs = [run for run in data.get("check_runs") or [] if run.get("name") == DOCTOR_CHECK]
|
|
164
|
+
if not runs:
|
|
165
|
+
return {"status": "missing", "url": None}
|
|
166
|
+
run = max(runs, key=lambda run: (run.get("started_at") or "", run.get("id") or 0))
|
|
167
|
+
if run.get("status") != "completed":
|
|
168
|
+
status = "pending"
|
|
169
|
+
else:
|
|
170
|
+
status = "ok" if run.get("conclusion") in PASSING else "failing"
|
|
171
|
+
return {"status": status, "url": run.get("html_url")}
|
|
172
|
+
|
|
173
|
+
|
|
131
174
|
def pick_release(forge: dict | None, tag: dict | None, state: dict | None) -> dict:
|
|
132
175
|
"""The forge's release, else the highest tag, else the roadmap-recorded value (labelled as such)."""
|
|
133
176
|
for found in (forge, tag):
|
|
@@ -216,8 +259,10 @@ def read_api(project: dict) -> dict:
|
|
|
216
259
|
elif "404" not in shown.stderr and "Not Found" not in shown.stderr:
|
|
217
260
|
raise RuntimeError(f"gh api failed: {shown.stderr.strip()[:200]}")
|
|
218
261
|
release = pick_release(forge_release(slug), None, state)
|
|
262
|
+
check = doctor_check(slug, project.get("branch"))
|
|
219
263
|
return {"branch": project.get("branch") or "default", "state": state, "state_source": source,
|
|
220
|
-
"doctor": None,
|
|
264
|
+
"doctor": None, "doctor_check": check["status"], "doctor_check_url": check["url"],
|
|
265
|
+
**release_fields(release)}
|
|
221
266
|
|
|
222
267
|
|
|
223
268
|
def release_fields(release: dict) -> dict:
|
|
@@ -248,17 +293,25 @@ def collect(projects: list[dict], source: str) -> list[dict]:
|
|
|
248
293
|
return rows
|
|
249
294
|
|
|
250
295
|
|
|
296
|
+
def check_cell(row: dict) -> str:
|
|
297
|
+
"""The doctor column of a row read through the API: the `context-doctor` check run, else `n/a`."""
|
|
298
|
+
check = row.get("doctor_check")
|
|
299
|
+
return check if check and check != "unknown" else "n/a"
|
|
300
|
+
|
|
301
|
+
|
|
251
302
|
def summary_cells(row: dict) -> list[str]:
|
|
252
303
|
name = row["name"] + ("*" if row.get("state_source") == "built" else "")
|
|
253
304
|
if row["error"]:
|
|
254
305
|
return [name, f"error: {row['error']}", "", "", "", "", ""]
|
|
255
306
|
state = row["state"]
|
|
256
307
|
if state is None:
|
|
257
|
-
return [name, "no state.json", "—", "—", "—", release_cell(row),
|
|
308
|
+
return [name, "no state.json", "—", "—", "—", release_cell(row), check_cell(row)]
|
|
258
309
|
active = state.get("active_roadmap")
|
|
259
310
|
roadmap = f"{active.get('slug') or '?'} {active['done']}/{active['total']}" if active else "—"
|
|
260
|
-
|
|
261
|
-
|
|
311
|
+
if row["doctor"] is not None:
|
|
312
|
+
doctor_cell = "ok" if not row["doctor"] else f"{len(row['doctor'])} failing"
|
|
313
|
+
else:
|
|
314
|
+
doctor_cell = check_cell(row)
|
|
262
315
|
return [name, roadmap, str(len(state.get("queued", []))), str(len(state.get("open_changes", []))),
|
|
263
316
|
str(len(state.get("owner_queue", []))), release_cell(row), doctor_cell]
|
|
264
317
|
|
|
@@ -36,9 +36,10 @@ 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
|
-
|
|
41
|
-
|
|
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. A project with history adds it after the rollout (WORKFLOW §12.4):
|
|
42
|
+
`--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
43
|
changes misses it.
|
|
43
44
|
- **`softure-archive`** (on the main branch) and **`softure-roadmap`** (record, `--queue`, `--promote`,
|
|
44
45
|
`--close`): `context_state.py write --staged` right before the commit, then `doctor.py`; each fixes
|
|
@@ -9,12 +9,13 @@
|
|
|
9
9
|
"additionalProperties": false,
|
|
10
10
|
"properties": {
|
|
11
11
|
"schema_version": { "type": "integer", "enum": [1] },
|
|
12
|
-
"project": { "type":
|
|
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": {
|
|
@@ -417,7 +417,7 @@ def build_state(reader, prior: dict | None = None, now: str | None = None) -> di
|
|
|
417
417
|
active = None
|
|
418
418
|
roadmap_text = reader.read(ROADMAP_PATH)
|
|
419
419
|
rows_by_change: dict[str, dict] = {}
|
|
420
|
-
if roadmap_text is not None:
|
|
420
|
+
if roadmap_text is not None and not is_idle_placeholder(roadmap_text):
|
|
421
421
|
meta = frontmatter(roadmap_text)
|
|
422
422
|
rows = roadmap_rows(roadmap_text)
|
|
423
423
|
done, total = _summary(rows)
|
|
@@ -494,7 +494,8 @@ def build_state(reader, prior: dict | None = None, now: str | None = None) -> di
|
|
|
494
494
|
|
|
495
495
|
state = {
|
|
496
496
|
"schema_version": SCHEMA_VERSION,
|
|
497
|
-
"project": workflow.get("project") or (frontmatter(roadmap_text).get("project") if roadmap_text else None)
|
|
497
|
+
"project": (workflow.get("project") or (frontmatter(roadmap_text).get("project") if roadmap_text else None)
|
|
498
|
+
or repository_name(reader)),
|
|
498
499
|
"mode": workflow.get("mode") or "manual",
|
|
499
500
|
"main_branch": workflow.get("mainBranch"),
|
|
500
501
|
"updated_at": now or dt.datetime.now(dt.timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z"),
|
|
@@ -507,6 +508,26 @@ def build_state(reader, prior: dict | None = None, now: str | None = None) -> di
|
|
|
507
508
|
return state
|
|
508
509
|
|
|
509
510
|
|
|
511
|
+
def is_idle_placeholder(text: str) -> bool:
|
|
512
|
+
"""A `roadmap.md` that only says there is no active roadmap (`status: idle` or `roadmap: none`)."""
|
|
513
|
+
meta = frontmatter(text)
|
|
514
|
+
return (meta.get("status") or "").lower() == "idle" or (meta.get("roadmap") or "").lower() == "none"
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
def repository_name(reader) -> str:
|
|
518
|
+
"""The repository's name: the last segment of `origin`'s URL, else the checkout's folder name.
|
|
519
|
+
|
|
520
|
+
The last fallback for `project`, so a project between roadmaps without `project` in workflow.json still
|
|
521
|
+
has a name. The URL comes first because a checkout's folder can be named anything (a worktree, a clone
|
|
522
|
+
into a temporary folder).
|
|
523
|
+
"""
|
|
524
|
+
folder = getattr(reader, "root", None) or getattr(reader, "repo", None) or os.getcwd()
|
|
525
|
+
url = subprocess.run(["git", "-C", folder, "remote", "get-url", "origin"], capture_output=True,
|
|
526
|
+
text=True).stdout.strip()
|
|
527
|
+
name = re.split(r"[/:]", url.rstrip("/"))[-1] if url else os.path.basename(os.path.abspath(folder))
|
|
528
|
+
return re.sub(r"\.git$", "", name) or "unnamed"
|
|
529
|
+
|
|
530
|
+
|
|
510
531
|
def _start_order(text: str) -> str | None:
|
|
511
532
|
"""A run-wide order about starting the roadmap (`> - Start: …`), when the header has one."""
|
|
512
533
|
for line in (text or "").splitlines():
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
doctor.py --baseline last resort: accept today's failures in context/doctor-baseline.json
|
|
8
8
|
npx softure-skills doctor [...] (the same, from the installed package)
|
|
9
9
|
|
|
10
|
-
Adopting projects run it in
|
|
10
|
+
Adopting projects run it in a CI job named `context-doctor`, documentation-only changes included (that is where the
|
|
11
11
|
drift happens). `softure-archive` and `softure-roadmap --close` run it before their commit and fix
|
|
12
12
|
what they own. Each problem is one line `FAIL <code> <path>: <what>`; the codes:
|
|
13
13
|
|
|
@@ -53,6 +53,10 @@ start any work: no change, PRD or roadmap is created here.
|
|
|
53
53
|
- Non-JS stacks: `*.sln`/`*.csproj` -> `dotnet build` / `dotnet test`; `pyproject.toml` ->
|
|
54
54
|
`ruff check` / `pytest`; `go.mod` -> `go vet ./...` / `go test ./...`. Use them only if the
|
|
55
55
|
tool's config is actually present.
|
|
56
|
+
- Project name (`project`): the name the project calls itself, from the README's first heading, else
|
|
57
|
+
`package.json` -> `name` (without the scope), else the repository name. It names the project in
|
|
58
|
+
`context/state.json` and every report, between roadmaps too. Interactive: ask once, with the
|
|
59
|
+
detected name as the recommended answer. An existing `project` is never changed here.
|
|
56
60
|
- Main branch: `git symbolic-ref refs/remotes/origin/HEAD`, falling back to whichever of
|
|
57
61
|
`main`/`master` exists locally.
|
|
58
62
|
- Migrations: look for `drizzle/`, `migrations/`, `prisma/migrations/`, `db/migrate/` and
|
|
@@ -120,6 +124,7 @@ Required keys and the ones init writes by default:
|
|
|
120
124
|
|
|
121
125
|
```json
|
|
122
126
|
{
|
|
127
|
+
"project": "Example clinic",
|
|
123
128
|
"mode": "manual",
|
|
124
129
|
"language": "en",
|
|
125
130
|
"chatLanguage": "pl",
|
|
@@ -8,6 +8,7 @@ A fictional repo, first run, interactive. Use it for the shape of the plan and t
|
|
|
8
8
|
- `package.json` scripts: `typecheck: "tsc --noEmit"`, `lint: "eslint ."`, `test: "vitest run"`,
|
|
9
9
|
`test:e2e: "playwright test"`, `stack:test: "docker compose -f docker/test.yml up -d && playwright test; docker compose -f docker/test.yml down"`,
|
|
10
10
|
`db:generate: "drizzle-kit generate"`.
|
|
11
|
+
- README's first heading `# Booking` -> project `Booking`.
|
|
11
12
|
- `origin/HEAD` -> `origin/main`.
|
|
12
13
|
- `drizzle/` with `0000_init.sql` ... `0014_slots_index.sql`.
|
|
13
14
|
- `.env` present.
|
|
@@ -28,6 +29,7 @@ context/
|
|
|
28
29
|
|
|
29
30
|
```json
|
|
30
31
|
{
|
|
32
|
+
"project": "Booking",
|
|
31
33
|
"language": "en",
|
|
32
34
|
"mainBranch": "main",
|
|
33
35
|
"gates": {
|
|
@@ -51,7 +53,7 @@ context/
|
|
|
51
53
|
```
|
|
52
54
|
|
|
53
55
|
```text
|
|
54
|
-
read: gates.*, migrations.dir, mainBranch (origin/HEAD)
|
|
56
|
+
read: project (README heading), gates.*, migrations.dir, mainBranch (origin/HEAD)
|
|
55
57
|
inferred: integration.local -> stack:test (brings up its own stack; test:e2e expects a running app)
|
|
56
58
|
migrations.pattern -> from 15 existing file names
|
|
57
59
|
Optional keys you may want: timezone, integration.cadence, worktree.cloudState, install.
|