diff --git a/plugins/product-development/skills/product-development/SKILL.md b/plugins/product-development/skills/product-development/SKILL.md index fba6012..b7cac19 100644 --- a/plugins/product-development/skills/product-development/SKILL.md +++ b/plugins/product-development/skills/product-development/SKILL.md @@ -17,7 +17,7 @@ The skill's glossary is [CONTEXT.md](CONTEXT.md). Use its terms exactly, in conv Foundation workflow ├─ Product Constitution approval ├─ Product Vision workflow (Vision Grill) - ├─ additional product-anchor workflows (planned extension point) + ├─ further foundation document types (planned extension point) └─ Foundation Gate: approved, versioned constitution + approved, versioned vision before first PRD ↓ Discovery and Design ← idea discovery first; design saved in shaping/ @@ -73,7 +73,7 @@ Each feature has a feature bundle, `docs/product/features/{feature}/`, inside th A change's state comes from its path plus two recorded signals: Idea, Shaping, In review (promotion PR open), Ratified (in `changes/{change}/`), Shipped (still in `changes/{change}/`, with a Shipped entry in the feature log), Canonized (in `changes/archive/`) or Dropped (deleted, with a lineage-log entry). -Consult `references/feature-bundles.md` for the bundle layout, spec units, the OKF `status` mapping and both logs, and `references/changes-and-deltas.md` for the change and delta contract, the overlap and base checks, and worked examples. Consult `references/okf-profile.md` for the front matter every product document carries, the closed `type` list, the generated indexes and the profile checks; regenerate the indexes from the project root with `python3 "/scripts/okf-profile.py" index docs/product` whenever a document is added, moved or retitled, where `` is this skill's installed directory. +Consult `references/feature-bundles.md` for the bundle layout, spec units, the OKF `status` mapping and both logs, and `references/changes-and-deltas.md` for the change and delta contract, the overlap and base checks, and worked examples. Consult `references/okf-profile.md` for the front matter every product document carries, the closed `type` list, the generated indexes and the profile checks; regenerate the indexes from the project root with `python3 "/scripts/okf-profile.py" index docs/product` whenever a document is added, moved or retitled, where `` is this skill's installed directory. While feature folders written with 0.1.0 await modernization, every index and check command runs with one `--pending` for each of them (`references/open-questions.md#while-modernization-is-in-progress`). When the project tracks changes on a board, such as GitHub Projects, consult `references/board-mapping.md`: one item per change, a "Spec state" field, moves on repository events, and the repository wins over the board. Every board write needs the maintainer's approval. @@ -81,32 +81,33 @@ When the project tracks changes on a board, such as GitHub Projects, consult `re ### Project Setup -**Trigger:** The project does not yet have a `docs/product/` directory or is missing one of the scaffold files listed under Output, or the user asks to "initialize product docs" or "set up product documentation." +**Trigger:** The project does not yet have a `docs/product/` directory or is missing one of the scaffold files or the bundle root, `docs/product/index.md`, listed under Output, or the user asks to "initialize product docs" or "set up product documentation." -**Process:** Run the initialization script (`scripts/init.sh`) to scaffold the documentation structure, including the three stage directories. The script uses templates with placeholders, auto-detects project context (name, surfaces), and prompts the user for domain-specific values. Consult `references/initialization.md` for the full workflow. +**Process:** Run the initialization script (`"/scripts/init.sh" `) to scaffold the documentation structure, including the three stage directories. The script uses templates with placeholders, auto-detects project context (name, surfaces), and prompts the user for domain-specific values. Then generate the OKF indexes from the project root, `python3 "/scripts/okf-profile.py" index docs/product`, which writes the bundle root, `docs/product/index.md`; the script prints this step, since it needs PyYAML. Consult `references/initialization.md` for the full workflow. **Output:** - `docs/product/README.md` — documentation hierarchy and boundary rules - `docs/product/AGENTS.md` — agent guidance for organizing product docs - `docs/product/ideas/AGENTS.md`, `docs/product/shaping/AGENTS.md`, `docs/product/features/AGENTS.md` — the three stage directories, each with its agent guidance - `docs/product/open-questions.md` — the register of product-wide open questions and the generated open-questions index +- `docs/product/index.md` — the OKF bundle root, with an `index.md` in every directory, generated by `okf-profile.py` -**This workflow runs once per project.** Skip only when every scaffold file exists: `docs/product/README.md`, `docs/product/AGENTS.md`, `docs/product/ideas/AGENTS.md`, `docs/product/shaping/AGENTS.md`, `docs/product/features/AGENTS.md` and `docs/product/open-questions.md`. If any is missing, for example after an interrupted run, re-run `scripts/init.sh`. It never overwrites, so it fills only the gaps. +**This workflow runs once per project.** Skip only when every scaffold file exists, `docs/product/README.md`, `docs/product/AGENTS.md`, `docs/product/ideas/AGENTS.md`, `docs/product/shaping/AGENTS.md`, `docs/product/features/AGENTS.md` and `docs/product/open-questions.md`, and so does the bundle root, `docs/product/index.md`. If a scaffold file is missing, for example after an interrupted run, re-run `"/scripts/init.sh" .` from the project root. It never overwrites, so it fills only the gaps. If only `docs/product/index.md` is missing, Setup stopped before index generation, for example because `python3` lacks PyYAML and `okf-profile.py` exited 2: resume there with a `python3` that has PyYAML (`references/initialization.md#post-initialization`). ### Foundation workflow **Trigger:** Either of two entry points: -- The user asks to create, update or approve product-anchor docs, such as the constitution or the vision. +- The user asks to create, update or approve foundation documents: the constitution or the vision. - The agent is about to draft a PRD and the Foundation Gate has not passed: `docs/product/constitution.md` or `docs/product/vision.md` is missing, unapproved or unversioned. A missing foundation document does not trigger this workflow during ideas, discovery, design or other shaping work. Raise it when PRD drafting is next. -**Process:** Establish product-anchor docs in this hierarchy: +**Process:** Establish the foundation documents in this order: 1. Product Constitution workflow: create, ratify, or amend approved, versioned `docs/product/constitution.md`. Consult `references/product-constitution.md` for `grill-with-docs` dependency behavior, Constitution Grill workflow, versioning, amendment behavior, and constitution alignment checks. 2. Product Vision workflow: run the Vision Grill after Constitution approval. The vision is a six-part core; material that changes more often goes in companion documents linked from it, the delivery plan (`roadmap.md`), research notes (`research/`) and the open-questions register. Consult `references/product-vision.md` for `grill-with-docs` dependency behavior, the core and its companions, the Decided label, splitting an existing vision, context/ADR coordination, and vision versioning. -3. Additional product-anchor workflows: planned extension point for product-anchor documents when approved. +3. Further foundation document types: a planned extension point. The foundation documents are the constitution and the vision; another document type joins them only when the maintainer approves it, with its own workflow. 4. Foundation Gate: complete only when approved, versioned `docs/product/constitution.md` and approved, versioned `docs/product/vision.md` exist. **Output:** Approved, versioned `docs/product/constitution.md`; approved, versioned `docs/product/vision.md`; optional `CONTEXT-MAP.md`, `docs/product/CONTEXT.md`, and ADRs when approved and used. @@ -180,7 +181,7 @@ An early idea that nobody is shaping yet goes to `docs/product/ideas/` instead, The promotion PR also lists each app-local scenario file under `apps/{surface}/docs/features/{feature}/scenarios/` that it adds or changes, so the maintainer ratifies surface-specific scenarios with the rest of the change. -Check for collisions before moving anything: if `features/{feature}/changes/{change}/` already exists, the change name is already used in the change archive, or a new feature's bundle already exists, stop and ask the maintainer. Never overwrite a ratified document during promotion. +Check for collisions before moving anything: if the change is named `archive` (reserved for the change archive), `features/{feature}/changes/{change}/` already exists, the change name is already used in the change archive, or a new feature's bundle already exists, stop and ask the maintainer. Never overwrite a ratified document during promotion. **Output:** The ratified change in `docs/product/features/{feature}/changes/{change}/`. @@ -190,7 +191,7 @@ Check for collisions before moving anything: if `features/{feature}/changes/{cha **Trigger:** The change's promotion PR has merged. -**Process:** Draft the handoff from the promotion PR's merge commit: the ratified change (its PRD, TRD and every delta, feature-qualified ones included), its stories and scenarios, every document a delta targets, the foundation documents, the project's ship signal and any open release-level questions. For a feature's first change, the change's deltas describe the spec to be. The ratified documents stay pinned to the merge commit; answers the maintainer approves later are linked at the commits that recorded them, and the release-level questions are listed as of the commit the handoff is sent from. Send it once no implementation-level question remains open: `scripts/open-questions.py blocking docs/product {feature}/{change} --level implementation` exits 0. If it lists questions, triage them with the maintainer (`references/open-question-triage.md`) and run it again. Filing the handoff as the implementation issue waits for the maintainer's approval. Consult `references/implementation-handoff.md` for its contents, the send condition and an example. The skill drafts the handoff and stops there; the implementation workflow, such as the `delivery-engineering` plugin, takes it from there. +**Process:** Draft the handoff from the promotion PR's merge commit: the ratified change (its PRD, TRD and every delta, feature-qualified ones included), its stories and scenarios, every document a delta targets, the foundation documents, the project's ship signal and any open release-level questions. For a feature's first change, the change's deltas describe the spec to be. The ratified documents stay pinned to the merge commit; answers the maintainer approves later are linked at the commits that recorded them, and the release-level questions are listed as of the commit the handoff is sent from. Send it once no implementation-level question remains open: `python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level implementation` exits 0, run with `--pending` while feature folders written with 0.1.0 await modernization. If it lists questions, triage them with the maintainer (`references/open-question-triage.md`) and run it again. Filing the handoff as the implementation issue waits for the maintainer's approval. Consult `references/implementation-handoff.md` for its contents, the send condition and an example. The skill drafts the handoff and stops there; the implementation workflow, such as the `delivery-engineering` plugin, takes it from there. **Output:** The handoff, sent to the implementation workflow. @@ -212,9 +213,9 @@ If implementation would violate `MUST NOT` language, weaken a constitutional pri **Trigger:** Someone is about to fire the ship signal for a ratified change (merge the implementation PR, cut the release, or widen the feature flag to everyone, whichever the project names), or to execute a step in the delivery plan. -**Process:** Whoever will fire the ship signal runs the release-level open-questions check (`references/open-questions.md`), `scripts/open-questions.py blocking docs/product {feature}/{change} --level release`: no open `design`, `implementation`, `release` or `none yet` question may name the change unless its deferral is approved. When merging the implementation PR is the ship signal, the implementation workflow runs this check before that merge. While feature folders written with 0.1.0 await modernization, the check runs with `--pending` and the maintainer triages their questions too (`references/open-questions.md#while-modernization-is-in-progress`). +**Process:** Whoever will fire the ship signal runs the release-level open-questions check (`references/open-questions.md`), `python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level release`: no open `design`, `implementation`, `release` or `none yet` question may name the change unless its deferral is approved. When merging the implementation PR is the ship signal, the implementation workflow runs this check before that merge. While feature folders written with 0.1.0 await modernization, the check runs with `--pending` and the maintainer triages their questions too (`references/open-questions.md#while-modernization-is-in-progress`). -Release questions can also name a delivery-plan step, by path and anchor. Before executing a delivery-plan step, run the same check on the step: `scripts/open-questions.py blocking docs/product roadmap.md#broader-rollout --level release`. When that step fires a change's ship signal, run both checks, the change's and the step's. +Release questions can also name a delivery-plan step, by path and anchor. Before executing a delivery-plan step, run the same check, with the same `--pending`, on the step: `python3 "/scripts/open-questions.py" blocking docs/product roadmap.md#broader-rollout --level release`. The step's check also lists the questions that block the whole delivery plan, scoped to `this document` in `roadmap.md`. When that step fires a change's ship signal, run both checks, the change's and the step's. **Gate:** Do not fire the ship signal until its checks pass, and do not execute a delivery-plan step until its check passes. @@ -282,7 +283,7 @@ These workflows run inside the lifecycle when their trigger arises. None of them - **Downstream comments** (`references/downstream-comments.md`): a decision affects work someone else owns later. The skill drafts the comments; posting waits for the maintainer's approval. - **Tech decisions** (`references/tech-decisions.md`): a TRD needs a technology choice. The decision lands in the change's TRD, with an ADR when it is consequential. - **Compliance research** (`references/compliance-research.md`): a requirement or decision depends on a law, regulation, standard or platform policy. Claims that land in a spec, TRD or ADR cite primary sources there. -- **Feature tags** (`references/feature-tags.md`): code is written or reviewed for a ratified change, a feature is renamed, split, merged or dropped, or a project sets up the check. Code names its feature in an `@feature ` tag or by a `features//` path; `scripts/feature-tags.py check` fails on any tag or path that names a missing feature. +- **Feature tags** (`references/feature-tags.md`): code is written or reviewed for a ratified change, a feature is renamed, split, merged or dropped, or a project sets up the check. Code names its feature in an `@feature ` tag or by a `features//` path; `python3 "/scripts/feature-tags.py" check` fails on any tag or path that names a missing feature. ## GitHub Writes @@ -376,17 +377,20 @@ All product documentation follows a three-tier hierarchy. See `docs/product/READ ## Workflow Selection -Not every feature starts at the beginning. Match the entry point to the current state: +Not every feature starts at the beginning. Match the entry point to the current state. Route by the gates already passed: a workflow starts only when its inputs are approved, and an unfinished artifact goes back to the workflow that produces it. | Starting point | Enter at | |---------------|----------| -| No `docs/product/` directory, or any scaffold file missing (`README.md`, `AGENTS.md`, a stage `AGENTS.md`, or `open-questions.md`) | Project Setup | +| No `docs/product/` directory, any scaffold file missing (`README.md`, `AGENTS.md`, a stage `AGENTS.md`, or `open-questions.md`), or no bundle root (`docs/product/index.md`) | Project Setup; with only the bundle root missing, resume at index generation | | Missing, unapproved, or unversioned constitution or vision before first PRD | Foundation workflow | | Early idea nobody is shaping yet | Record it in `ideas/` | | Vague idea, no clarity on approach | Discovery and Design | | Clear requirements, needs documentation | Requirements after Foundation Gate | -| PRD exists, needs decomposition | User Stories | -| Stories exist, needs testable criteria | BDD Scenarios | +| PRD or TRD drafted, not yet approved | Requirements: finish its review and approval | +| PRD and TRD approved, no stories yet | User Stories | +| Stories drafted, not yet approved, or without acceptance criteria | User Stories: finish them | +| Stories approved, with acceptance criteria defined | BDD Scenarios | +| Scenarios drafted, not yet approved | BDD Scenarios: finish their review and approval | | Discovery suggests the work may evolve an existing feature | Discovery and Design: classify the work first | | Approved change in `shaping/`, not yet ratified | Promotion | | Ratified change in `features/{feature}/changes/`, handoff not sent | Handoff | @@ -448,6 +452,7 @@ Detailed guidance for each workflow lives in reference files to keep context tar - **`references/promotion-review.md`** — The promotion-review checklist the `spec-reviewer` agent uses - **`references/open-question-triage.md`** — Working through open questions one at a time by blocking level, with recorded deferrals - **`references/implementation-handoff.md`** — The handoff: its contents, when it is drafted and sent, and an example for a feature's first change +- **`references/feature-tags.md`** — Feature tags: `@feature` comments in code, the feature path convention for files that can't carry comments, the check and its CI setup - **`references/canonization.md`** — Recording the ship signal, the five canonization steps, the canonization PR, and a worked example with a change in meaning, a deferral and a rebased delta - **`references/modernization.md`** — Converting a feature folder written with 0.1.0 into a feature bundle: the seven steps, archived originals, mismatch rulings, retirements, and a worked example - **`references/retrofit.md`** — Taking a codebase without specs to features in the right stages: the maintainer braindump, the eight feature lenses with their prompt templates, the feature inventory, routing, the `wayfinder` rule for large codebases, and a worked example @@ -462,8 +467,11 @@ Load `references/source/product-constitution-guide.md` only through `references/ ## Scripts +The scripts ship with the installed skill; `scripts/init.sh` does not copy them into the project. Run each one from the project root by its installed path, such as `python3 "/scripts/open-questions.py" check docs/product`, where `` is the directory that holds this skill's `SKILL.md`, wherever the plugin is installed. Bundle paths such as `docs/product` resolve from the project root. + - **`scripts/init.sh`** — Project initialization script. Scaffolds `docs/product/` from templates with placeholder substitution. Supports interactive prompts, CLI arguments, and `--dry-run`. -- **`scripts/open-questions.py`** — Generates the open-questions index in `docs/product/open-questions.md`, checks it in CI, and lists the open questions that hold a change at a check point. `--pending` skips each feature folder still in the 0.1.0 layout while it awaits modernization, as the profile check does. See `references/open-questions.md`. +- **`scripts/open-questions.py`** — Generates the open-questions index in `docs/product/open-questions.md`, checks it in CI, and lists the open questions that hold a change at a check point. `--pending` names each feature folder still in the 0.1.0 layout while it awaits modernization, as the profile check does: the rows of tables still in the 0.1.0 format are skipped, and valid rows there still count. See `references/open-questions.md`. +- **`scripts/feature-tags.py`** — Checks that every `@feature` tag and feature path segment in code names a feature in `docs/product/features/`. See `references/feature-tags.md`. - **`scripts/okf-profile.py`** — OKF profile tooling. `index` regenerates every `index.md` in `docs/product/`, keeping the root front matter; `index --check` reports stale indexes; `check` runs the profile checks, skipping the originals that modernization archives without front matter; `--pending` makes `index` and `check` skip each feature folder still in the 0.1.0 layout while it awaits modernization, and check everything else. Needs PyYAML. ## Templates diff --git a/plugins/product-development/skills/product-development/references/board-mapping-github-projects.md b/plugins/product-development/skills/product-development/references/board-mapping-github-projects.md index b66cb44..fb21355 100644 --- a/plugins/product-development/skills/product-development/references/board-mapping-github-projects.md +++ b/plugins/product-development/skills/product-development/references/board-mapping-github-projects.md @@ -348,7 +348,7 @@ set_spec_state shared-calendars/invite-expiry "In review" ### Promotion PR closed without merging -The maintainer closes #214 without merging: the expiry window needs more work. The change is still in `shaping/`, so the agent proposes Shaping, and on approval runs: +The maintainer closes the promotion PR, #214, without merging: the expiry window needs more work. The change is still in `shaping/`, so the agent proposes Shaping, and on approval runs: ```sh set_spec_state shared-calendars/invite-expiry "Shaping" @@ -367,7 +367,7 @@ The next commit to the default branch that touches `docs/product/` adds to `feat ### In review again -The maintainer reworks the change on #214's branch, adding a per-calendar expiry window, and reopens the original promotion PR: +The maintainer reworks the change on the promotion PR's branch, adding a per-calendar expiry window, and reopens the original promotion PR: ```sh gh pr reopen 214 diff --git a/plugins/product-development/skills/product-development/references/canonization.md b/plugins/product-development/skills/product-development/references/canonization.md index 7b7996a..7d0f613 100644 --- a/plugins/product-development/skills/product-development/references/canonization.md +++ b/plugins/product-development/skills/product-development/references/canonization.md @@ -50,19 +50,19 @@ Base the accounting on the evidence the Shipped entry links and on what the impl - **Changed:** it went live with a different meaning. A change in meaning needs the maintainer's approval of the text that shipped. An edit that keeps the meaning, such as clearer wording, is not a change. - **Deferred:** it did not go live. Each deferred item becomes a shaping item: a shaping document in `shaping/{feature}--{change}/`, with `x-amends: {feature}`, that starts from copies of the deferred text and files and links the archived change. Name the new change for what it delivers. It is shaped, ratified and canonized like any other change; nothing in it is ratified yet. A deferred spec unit keeps its ID in the archive as provenance, and IDs are never reused ([feature-bundles.md](feature-bundles.md#spec-units)): when the follow-up change's delta is drafted, it assigns the next free ID to a deferred addition. A deferred modification or removal keeps targeting the existing unit's ID: a deferred revision to `FR-02` still modifies `FR-02`. -Then write the reconciled deltas, the deltas to be applied: deferred units are left out, and changed units carry the approved text. A partly shipped story or scenario file, an app-local file or a `DOCUMENT` entry is reconciled as [changes-and-deltas.md](changes-and-deltas.md#deferred-stories-and-scenarios) describes. The ratified deltas stay as they were, for the archive. The reconciled deltas are working copies: the canonization PR shows their effect on the feature spec, its body holds the accounting, and the Canonized log entry records the outcome. +Then write the reconciled deltas, the deltas to be applied: deferred units are left out, and changed units carry the approved text. A story or scenario file that is partly shipped, or a whole-file unit that changed in meaning or was rebased, carries its reconciled text in its entry, so canonization writes that text at the feature root instead of moving the ratified file; it, an app-local file and a `DOCUMENT` entry are reconciled as [changes-and-deltas.md](changes-and-deltas.md#deferred-stories-and-scenarios) describes. The ratified deltas stay as they were, for the archive. The reconciled deltas are working copies: the canonization PR shows their effect on the feature spec, its body holds the accounting, and the Canonized log entry records the outcome. ### 2. Base check Run the base check ([changes-and-deltas.md](changes-and-deltas.md#base-check)) on the reconciled deltas against the current feature spec. Each modified or removed spec unit must still match the base text the delta recorded. -If the feature spec has drifted, usually because another change was canonized after this one was ratified, the delta is rebased first, and the maintainer confirms any change in meaning. Write the rebase into the reconciled deltas only: the rebased entry records the unit as it now stands as its base text, and the change's edit on top of it as its new text. An `ADDED` ID that is now taken is renumbered. +If the feature spec has drifted, usually because another change was canonized after this one was ratified, the delta is rebased first, and the maintainer confirms any change in meaning. Write the rebase into the reconciled deltas only: the rebased entry records the unit as it now stands as its base text, and the change's edit on top of it as its new text. A rebased story or scenario file does the same, with the whole file as both. An `ADDED` ID that is now taken is renumbered. Run it again against the latest feature spec on the default branch just before the canonization PR merges. If a change was canonized in the meantime, rebase again. ### 3. Apply the reconciled deltas -Apply the reconciled deltas to the feature spec, and move the story and scenario files the reconciled deltas list to the feature root. A split file's reconciled text is written at the feature root; a deferred file stays with the change. App-local scenario files are restored or rewritten as the contract says; they don't move. +Apply the reconciled deltas to the feature spec, and move the story and scenario files the reconciled deltas list to the feature root. A whole-file unit whose reconciled entry carries text, because it was split, changed or rebased, is written from that text at the feature root, and the change's own file stays with the change; a deferred file stays with the change. App-local scenario files are restored or rewritten as the contract says; they don't move. Check the result before going on: @@ -75,9 +75,27 @@ A lineage change may empty another feature's bundle; [feature-bundles.md](featur ### 4. Archive the change -Move what is left of the change to `changes/archive/YYYY-MM-DD-{change}/`, dated the day of canonization, with the ratified deltas intact. Set every document's OKF `status` in the archived change from `stable` to `deprecated`; change nothing else. Deferred story and scenario files stay in the archive, where the shaping item's copies came from. +Move what is left of the change to `changes/archive/YYYY-MM-DD-{change}/`, dated the day of canonization. The ratified deltas keep their payloads: every `Text:`, `New text:` and base text stays as ratified, never the reconciled or rebased text, so the archive shows what the maintainer approved. Deferred story and scenario files stay in the archive, where the shaping item's copies came from. In the archived documents, set OKF `status` from `stable` to `deprecated`, and change no wording. -The change is now Canonized. Regenerate the indexes from the project root, `python3 "/scripts/okf-profile.py" index docs/product`, and run the profile checks. +The move breaks relative links in both directions, so the same PR updates them; a rebased link changes its path, never its label or the text around it: + +- **Links into the change** from the rest of the bundle, including the back-links in the target rows of approved deferrals, whose `Deferred from` link points at a question row in the change. +- **Links out of the archived change**, which gain one directory level, including the **Deferred to** links of its deferred rows, which must still reach their open target rows ([open-questions.md](open-questions.md#deferral)). + +The open-questions worked example walks both links through this move ([open-questions.md](open-questions.md#worked-example), step 3). + +The change is now Canonized. From the project root, regenerate the indexes, then check them, so a link the move broke or a stale index fails here instead of on the default branch: + +```bash +python3 "/scripts/open-questions.py" index --pending {unconverted} docs/product +python3 "/scripts/okf-profile.py" index --pending {unconverted} docs/product +python3 "/scripts/open-questions.py" check --pending {unconverted} docs/product +python3 "/scripts/okf-profile.py" check --pending {unconverted} docs/product +``` + +`--pending {unconverted}` stands for one `--pending` for each feature folder written with 0.1.0 that awaits modernization, so no command fails on such a folder or writes an index into it ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)). With no such folder, drop it. + +The open-questions index drops the archived change's rows, since the change archive is history, and keeps their open target rows. The generator refuses to run while any question link does not resolve. ### 5. Write the feature-log entry @@ -93,7 +111,7 @@ Write "Nothing deferred." in the outcome when nothing was, and leave out a field ## The canonization PR -One PR canonizes one change. It holds the applied deltas, the moved files, the archived change, the shaping items for deferrals, the Canonized log entry and the regenerated indexes. Its body holds the coverage table, the base-check result with any rebased unit, and the list of shaping items. +One PR canonizes one change. It holds the applied deltas, the moved files, the archived change with its rebased links, the links into it, the shaping items for deferrals, the Canonized log entry and the regenerated OKF and open-questions indexes. Its body holds the coverage table, the base-check result with any rebased unit, and the list of shaping items. Opening it waits for the maintainer's approval, like every write to GitHub (`SKILL.md`, GitHub Writes). The maintainer confirms any change in meaning, any deferred item and any rebased delta before it merges, and the base check runs again just before the merge. When the project tracks changes on a board, the merge moves the change's item to Canonized ([board-mapping.md](board-mapping.md)). diff --git a/plugins/product-development/skills/product-development/references/changes-and-deltas.md b/plugins/product-development/skills/product-development/references/changes-and-deltas.md index 0bba037..44cf4c5 100644 --- a/plugins/product-development/skills/product-development/references/changes-and-deltas.md +++ b/plugins/product-development/skills/product-development/references/changes-and-deltas.md @@ -63,6 +63,7 @@ A Shipped change cannot be dropped. Its behavior is live, so withdrawing it is a ## Naming - `{change}` is lowercase kebab-case and names what the change does: `invite-expiry`, `decline-with-note`. A feature's first version is a change like any other; name it for what it delivers. +- `archive` is reserved: `features/{feature}/changes/archive/` holds the change archive, so a change named `archive` would be promoted into it. No change takes that name; promotion refuses it ([ratification.md](ratification.md#1-prepare-the-promotion-pr)). - A change name is unique within its feature, including the change archive. Two features may each have a change of the same name, so a change is identified by its feature and name, written `{feature}/{change}`, such as `calendar-links/link-expiry`. Checks, reports and logs that span more than one feature name changes this way. - While shaped, a change lives in `shaping/{feature}--{change}/`, one directory per change. `{feature}` is the feature it creates or amends. A shaping directory never holds more than one change. - A change to an existing feature names it in its shaping document's front matter, `x-amends: {feature}`. A change that creates a feature has no `x-amends`. @@ -111,8 +112,8 @@ Fences follow CommonMark. The outer fence is a run of three or more tildes (or b | Section | Entry holds | |---------|-------------| -| `ADDED` | `Section:` the heading, or heading path, of the feature spec section the unit joins, then `Text:` and the unit. A whole-file unit holds nothing more: its content is the file in the change's `stories/` or `scenarios/`. A reconciled entry for a split file carries `Text:` with the shipped part (see [Deferred stories and scenarios](#deferred-stories-and-scenarios)). | -| `MODIFIED` | `Base text:` and the unit as it stood when the delta was written, then `New text:` and the unit as the change leaves it. A whole-file unit holds only the base text; the new version is the file in the change. A reconciled entry for a split file adds `New text:` with the shipped part. | +| `ADDED` | `Section:` the heading, or heading path, of the feature spec section the unit joins, then `Text:` and the unit. A whole-file unit holds nothing more: its content is the file in the change's `stories/` or `scenarios/`. A reconciled entry for a changed or split file carries `Text:` with the file as canonization writes it at the feature root (see [Deferred stories and scenarios](#deferred-stories-and-scenarios)). | +| `MODIFIED` | `Base text:` and the unit as it stood when the delta was written, then `New text:` and the unit as the change leaves it. A whole-file unit holds only the base text; the new version is the file in the change. A reconciled entry for a changed, rebased or split file adds `New text:` with the file as canonization writes it at the feature root, and a rebased one also records the feature-root file as it now stands as its `Base text:`. | | `REMOVED` | `Base text:` and the unit as it stood when the delta was written. | | `App-local scenario files` | One entry per app-local scenario file, headed by its path from the repository root: `Base text:` with the file before the change for a revised file, nothing for an added one (see [App-local scenario files](#app-local-scenario-files)). | | `DOCUMENT` | No `###` entry. `Text:` and the front matter, title and summary of a document the delta writes; or `Base text:` and `New text:` with the whole document, before and after, for a rewrite. A rewrite holds no other entries. | @@ -195,6 +196,8 @@ Canonization accounts for each app-local file as it does for the change's other Before it restores or rewrites a file, canonization compares it with the file at the promotion PR's merge commit; if another change has edited it since, canonization refuses and the maintainer reconciles the file. Likewise, canonization refuses a deferral whose recorded base text differs from the file at the merge commit's first parent, or that deletes a file present there: putting back a stale base would undo another change's revision. The shaping item a deferral creates starts from the file at the promotion PR's merge commit. +Dropping a Ratified change undoes its app-local edits in the drop PR, since the promotion PR made them on the default branch. For each app-local scenario file the ratified deltas list, the drop PR restores each revised file from its recorded base text and deletes each file the change added, under the same guards as a deferral: the file must still read as the promotion PR's merge commit left it, and the recorded base text must equal the file at the merge commit's first parent. If another change has edited the file since, restoring the base would undo that edit, so the drop PR refuses that file and the maintainer reconciles it, removing only the dropped change's edits and keeping the later ones. A change dropped before its promotion PR merged made no app-local edits on the default branch. + ## A change's stories and scenarios A change carries its own stories and scenarios until it is canonized. The feature root keeps only stories and scenarios of shipped behavior, so an expectation that has not shipped never sits beside shipped ones, and anyone reading `scenarios/` at the feature root reads only what the product does. @@ -219,9 +222,11 @@ features/shared-calendars/ Canonization's accounting decides each story and scenario file, as it decides each requirement: -- **Shipped or changed:** the reconciled delta keeps the file's entry, and canonization moves the file to the feature root. +- **Shipped:** the reconciled delta keeps the file's entry as listed, and canonization moves the change's file to the feature root. +- **Changed:** the reconciled entry carries the approved file as its text, `Text:` for an added file or `New text:` for a revised one, and canonization writes that text at the feature root. The change's own file, with the ratified expectation, stays in the archived change. Moving it would publish the expectation that did not ship. +- **Rebased:** a revised file whose feature-root version drifted since the delta was written, usually because another change canonized an edit to it, fails the base check. Its reconciled entry is rebased like a spec unit, with the maintainer confirming any change in meaning: `Base text:` holds the file as it now stands at the feature root, and `New text:` holds the change's revision applied on top of it, which canonization writes at the feature root. The change's own file stays in the archived change. - **Deferred:** the reconciled delta drops the file's entry. The file stays in the archived change, and the shaping item the deferral creates starts from a copy of it. A deferred file never reaches the feature root. -- **Partly shipped:** a file that holds both shipped and deferred scenarios is split. The reconciled entry carries the shipped scenarios as its text, `Text:` for an added file or `New text:` for a revised one, and canonization writes that text at the feature root. The change's own file, with the deferred scenarios, stays in the archived change for the shaping item. A story whose acceptance criteria shipped only in part is split the same way. +- **Partly shipped:** a file that holds both shipped and deferred scenarios is split. The reconciled entry carries the shipped scenarios as its text, `Text:` for an added file or `New text:` for a revised one, and canonization writes that text at the feature root. The change's own file, with the deferred scenarios, stays in the archived change for the shaping item. A story whose acceptance criteria shipped only in part is split the same way. A split file that also changed or was rebased carries a single text with all of it. - **App-local scenario files:** the promotion PR edited them in place, so a deferral restores the file from its recorded base text (see [App-local scenario files](#app-local-scenario-files)). - **`DOCUMENT` entries:** their text is reconciled like a changed unit, with the maintainer's approval. A description, summary or Facets row that describes deferred behavior is rewritten to describe only what shipped, and links to deferred facet specs, stories or scenarios are removed. A facet spec whose units are all deferred is not written: its delta is left out of the reconciled deltas and stays in the archived change. Canonization resolves every relative link in `DOCUMENT` text, including `./` forms, against the bundle as it will be after canonization, and refuses a link that does not resolve. The rule covers reference-style links: each link reference definition's target resolves the same way. A link to an existing document the change leaves alone resolves; a link to a deferred facet spec, story or scenario, to a file the change removes, or to an app-local scenario file the deferral deletes, does not. The first-version fixture, `tests/fixtures/first-version/`, defers a whole facet this way. diff --git a/plugins/product-development/skills/product-development/references/feature-bundles.md b/plugins/product-development/skills/product-development/references/feature-bundles.md index e2b4fa0..e6bd8ef 100644 --- a/plugins/product-development/skills/product-development/references/feature-bundles.md +++ b/plugins/product-development/skills/product-development/references/feature-bundles.md @@ -126,7 +126,7 @@ Change events go in the log, never in the feature spec. - **Feature split**: one feature becomes two or more. - **Feature merge**: two or more features become one. - **Feature drop**: a feature is withdrawn. -- **Dropped change**: a change is withdrawn before it ships, from `shaping/` or from `changes/`. A Shipped change cannot be dropped: withdrawing shipped behavior is a new change that removes it, shaped, ratified and canonized like any other. +- **Dropped change**: a change is withdrawn before it ships, from `shaping/` or from `changes/`. A Shipped change cannot be dropped: withdrawing shipped behavior is a new change that removes it, shaped, ratified and canonized like any other. When the change was Ratified, the drop PR also restores the app-local scenario files its promotion PR revised and deletes the ones it added, with the guards in [changes-and-deltas.md](changes-and-deltas.md#app-local-scenario-files), and the entry lists each under Restored or Removed. - **Promotion PR closed without merging**: the change returns to `shaping/` or is dropped; say which. A closed PR can't carry its own entry, so add it in the next commit to the default branch that touches `docs/product/`. @@ -166,7 +166,7 @@ No `calendar-links` directory remains. Its history is in this entry, in the arch ### Worked example: a dropped change -The change `recurring-invitations` was ratified, then the maintainer withdrew it before it shipped. The PR that drops it deletes `features/shared-calendars/changes/recurring-invitations/` and adds: +The change `recurring-invitations` was ratified, then the maintainer withdrew it before it shipped. Its promotion PR had revised the app-local scenario file `apps/web/docs/features/shared-calendars/scenarios/invitation-list.feature`, and no change has edited it since. The PR that drops it deletes `features/shared-calendars/changes/recurring-invitations/`, restores that file from the base text its delta recorded, and adds: ```markdown ## 2027-02-03 @@ -175,4 +175,5 @@ The change `recurring-invitations` was ratified, then the maintainer withdrew it - Reason: Usage showed organizers re-invite per event; the series model added cost without demand. - State when dropped: Ratified - Removed: `features/shared-calendars/changes/recurring-invitations/`, last present in commit 9b07e3d + - Restored: `apps/web/docs/features/shared-calendars/scenarios/invitation-list.feature`, to its text before the promotion PR ``` diff --git a/plugins/product-development/skills/product-development/references/implementation-handoff.md b/plugins/product-development/skills/product-development/references/implementation-handoff.md index 6155d39..cac1b17 100644 --- a/plugins/product-development/skills/product-development/references/implementation-handoff.md +++ b/plugins/product-development/skills/product-development/references/implementation-handoff.md @@ -34,22 +34,24 @@ Draft the handoff when the promotion PR merges, from the merge commit. The draft Send the handoff once no implementation-level question remains open. Run the implementation-level check just before sending, since questions can be added after the draft was written: ```bash -scripts/open-questions.py blocking docs/product {feature}/{change} --level implementation +python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level implementation ``` +Run it from the project root. `` is the directory that holds this skill's `SKILL.md`, wherever the plugin is installed. The handoff's own commands use the same form, so whoever fires the ship signal runs the script from the installed skill. + Exit 0 means it can be sent. The check fails on any open `design`, `implementation` or `none yet` question that names the change without an approved deferral ([open-questions.md](open-questions.md#blocking-level)). On exit 1, work through the listed questions with the maintainer ([open-question-triage.md](open-question-triage.md)), then run the check again. While feature folders written with 0.1.0 await modernization, the check runs with `--pending` and the maintainer triages their questions too ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)). Before sending, add the answers approved since the draft. Then list the open release-level questions in the handoff, from the check run on the commit the handoff is sent from, and record that commit. They don't hold the handoff; they hold the ship decision: ```bash -scripts/open-questions.py blocking docs/product {feature}/{change} --level release +python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level release ``` Sending means giving the handoff to the implementation workflow, for example by filing it as the implementation issue. Filing the implementation issue, posting downstream comments and moving board cards each need the maintainer's approval, whichever workflow does them (`SKILL.md`, GitHub Writes). ## The ship signal and the release check -The handoff names the project's ship signal: the event that makes the change live, such as the implementation PR merging, a release, or a feature flag reaching everyone. Whoever fires the ship signal runs the release check first: `scripts/open-questions.py blocking docs/product {feature}/{change} --level release` must exit 0 (`SKILL.md`, Release Check). If merging the implementation PR is itself the ship signal, the implementation workflow runs it before that merge. While feature folders written with 0.1.0 await modernization, it runs with `--pending` and the maintainer triages their questions too ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)). +The handoff names the project's ship signal: the event that makes the change live, such as the implementation PR merging, a release, or a feature flag reaching everyone. Whoever fires the ship signal runs the release check first: `python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level release` must exit 0 (`SKILL.md`, Release Check). If merging the implementation PR is itself the ship signal, the implementation workflow runs it before that merge. While feature folders written with 0.1.0 await modernization, it runs with `--pending` and the maintainer triages their questions too ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)). When the signal fires, a Shipped entry in the feature log records it with its evidence, and canonization follows ([canonization.md](canonization.md)). @@ -114,7 +116,7 @@ New code for this change carries `@feature {feature}`, or sits under `features/{ ## Ship signal - Before firing it, run `scripts/open-questions.py blocking docs/product {feature}/{change} --level release`; it must exit 0. If merging the implementation PR is the ship signal, run it before that merge. + Before firing it, run `python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level release`<, with one `--pending` for each feature folder written with 0.1.0 still awaiting modernization, if any>; it must exit 0. If merging the implementation PR is the ship signal, run it before that merge. Open release-level questions, as of ``, the commit this handoff was sent from: @@ -174,7 +176,7 @@ New code for this change carries `@feature shared-calendars`, or sits under `fea ## Ship signal -Release 3.0 reaching all users. Before widening the release to everyone, run `scripts/open-questions.py blocking docs/product shared-calendars/event-invitations --level release`; it must exit 0. +Release 3.0 reaching all users. Before widening the release to everyone, run `python3 "/scripts/open-questions.py" blocking docs/product shared-calendars/event-invitations --level release`; it must exit 0. Open release-level questions, as of `9b1e07d`, the commit this handoff was sent from: diff --git a/plugins/product-development/skills/product-development/references/initialization.md b/plugins/product-development/skills/product-development/references/initialization.md index c004c97..8f50a30 100644 --- a/plugins/product-development/skills/product-development/references/initialization.md +++ b/plugins/product-development/skills/product-development/references/initialization.md @@ -19,7 +19,7 @@ Each stage directory gets its own `AGENTS.md` that says when agents read the sta ## Running the script -The initialization script lives at `scripts/init.sh` relative to this skill's root directory. +The initialization script lives at `/scripts/init.sh`, where `` is the directory that holds this skill's `SKILL.md`, wherever the plugin is installed. It takes the project root as its argument. It copies no scripts into the project: the other scripts also run from the installed skill, with the project root as the working directory. ### Via agent orchestration @@ -29,7 +29,7 @@ The initialization script lives at `scripts/init.sh` relative to this skill's ro 4. Run the script with the collected values: ```bash -scripts/init.sh /path/to/project \ +"/scripts/init.sh" /path/to/project \ --project-name "MyProject" \ --surfaces "mobile,web" \ --platform-scenario-example "Every invitee sees the event's current time." \ @@ -39,7 +39,7 @@ scripts/init.sh /path/to/project \ ### Via standalone execution ```bash -./scripts/init.sh /path/to/project +"/scripts/init.sh" /path/to/project ``` The script prompts interactively for any values not provided as arguments. @@ -47,7 +47,7 @@ The script prompts interactively for any values not provided as arguments. ### Non-interactive mode ```bash -./scripts/init.sh /path/to/project --non-interactive +"/scripts/init.sh" /path/to/project --non-interactive ``` Uses auto-detected and default values without prompting. @@ -77,12 +77,21 @@ If the user doesn't have examples yet, the defaults are reasonable placeholders After running the script: -1. Review the generated files and adjust wording if needed -2. Run the Product Constitution workflow before the Product Vision workflow -3. Create and approve versioned `docs/product/constitution.md` through the Constitution Grill (use the immutable + supersede evolution strategy) -4. Run the Product Vision workflow before the first PRD -5. Create approved, versioned `docs/product/vision.md` through the Vision Grill (use the immutable + supersede evolution strategy) -6. Draft the first PRD, in `docs/product/shaping/`, only after the Foundation Gate passes +1. Generate the OKF indexes from the project root, both after agent orchestration and after standalone execution. They include the bundle root, `docs/product/index.md`, which declares `okf_version: "0.3"`; without it the profile check fails ([okf-profile.md](okf-profile.md#indexes)). The script prints this step instead of running it, because `okf-profile.py` needs PyYAML and, on a rerun over feature folders written with 0.1.0, must name them with `--pending` ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)): + + ```bash + python3 "/scripts/okf-profile.py" index docs/product + python3 "/scripts/okf-profile.py" check docs/product + ``` + + Run them with a `python3` that has PyYAML: the project's dev shell if it provides one, a virtual environment with PyYAML installed, or `nix-shell -p 'python3.withPackages (ps: [ ps.pyyaml ])'`. Without PyYAML, `okf-profile.py` exits 2 and writes nothing. Setup is unfinished until `docs/product/index.md` exists, even with every scaffold file in place; Workflow Selection resumes it at this step. + +2. Review the generated files and adjust wording if needed +3. Run the Product Constitution workflow before the Product Vision workflow +4. Create and approve versioned `docs/product/constitution.md` through the Constitution Grill (use the immutable + supersede evolution strategy) +5. Run the Product Vision workflow before the first PRD +6. Create approved, versioned `docs/product/vision.md` through the Vision Grill (use the immutable + supersede evolution strategy) +7. Draft the first PRD, in `docs/product/shaping/`, only after the Foundation Gate passes When running the Constitution Grill or Vision Grill, prefer `grill-with-docs` if it is installed. If it is missing, notify the user up front, recommend installing it for doc-aware interrogation, and continue with the built-in fallback only if the user declines installation or asks to proceed. diff --git a/plugins/product-development/skills/product-development/references/modernization.md b/plugins/product-development/skills/product-development/references/modernization.md index e83a9f3..8e26648 100644 --- a/plugins/product-development/skills/product-development/references/modernization.md +++ b/plugins/product-development/skills/product-development/references/modernization.md @@ -12,7 +12,7 @@ Until the last folder is converted, the folders still in the 0.1.0 layout fail t Before step 1: -- **Set up the bundle.** If `docs/product/` lacks the 0.2.0 scaffold, run `scripts/init.sh`; it never overwrites. The constitution and vision gain front matter as [okf-profile.md](okf-profile.md#front-matter) describes; a 0.1.0 vision is split as [product-vision.md](product-vision.md#splitting-an-existing-vision) describes, in its own PR. +- **Set up the bundle.** If `docs/product/` lacks the 0.2.0 scaffold, run `"/scripts/init.sh" .` from the project root; it never overwrites. The constitution and vision gain front matter as [okf-profile.md](okf-profile.md#front-matter) describes; a 0.1.0 vision is split as [product-vision.md](product-vision.md#splitting-an-existing-vision) describes, in its own PR. - **Reconcile `docs/product/AGENTS.md` and `docs/product/README.md`.** 0.1.0 installed both, so `scripts/init.sh` skips them, and it never overwrites them: their 0.1.0 instructions still send a new PRD to the feature folder and say to edit PRDs and TRDs in place with a changelog. Rewrite each from the current template, `templates/AGENTS.md.tmpl` and `templates/README.md.tmpl`, keeping the project's own guidance, such as conventions or notes added after setup. Do this in the first modernization PR, or in a PR of its own before it. - **Gather the folder's material:** its `PRD.md`, `TRD.md`, `stories/` and `scenarios/`; surface-specific scenarios under `apps/{surface}/docs/features/{feature}/scenarios/`; plans and design documents under `docs/plans/` that concern the feature; decision ledgers from spikes; engineering notes; and the code, its tests and release history, which show what shipped. - **Account for each requirement** in the original documents, with evidence from the code, tests or releases: shipped as written, shipped but different from the documents (a mismatch, step 3), or never shipped (step 4). Ask the maintainer where the evidence is thin. The accounting goes in the modernization PR's body. @@ -66,7 +66,7 @@ Live open questions in the original documents move to the shaping document they python3 "/scripts/open-questions.py" index --pending {unconverted} docs/product ``` -Never name the folder being converted, or one converted earlier, with `--pending`: both scripts refuse a folder that is not in the 0.1.0 layout. The script doesn't validate the question tables of the pending folders, since they hold 0.1.0 tables, but it still indexes a valid table there. Every other table is validated, so an error in a feature converted earlier still fails the command. It checks question links everywhere except between pending folders: links into them, and their links out to the rest of the bundle. +Never name the folder being converted, or one converted earlier, with `--pending`: both scripts refuse a folder that is not in the 0.1.0 layout. The script doesn't validate the question tables of the pending folders, since they hold 0.1.0 tables, but a valid row there counts, indexed and seen by `blocking`. Rows in tables still in the 0.1.0 format are skipped, so the maintainer reads those tables directly before accepting a gate pass ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)). Every other table is validated, so an error in a feature converted earlier still fails the command. It checks question links everywhere except between pending folders: links into them, and their links out to the rest of the bundle. `open-questions.py` doesn't follow the question links inside the archived originals, the PRD and TRD that the profile checks skip, identified the same way. They are history, and history never blocks a live check: a link in them that breaks once they are archived, such as a relative link to a question in another folder, never fails a check, and you don't edit them to fix it. A live document's link into the archive is checked like any other. diff --git a/plugins/product-development/skills/product-development/references/okf-profile.md b/plugins/product-development/skills/product-development/references/okf-profile.md index 6bda6c4..6409b44 100644 --- a/plugins/product-development/skills/product-development/references/okf-profile.md +++ b/plugins/product-development/skills/product-development/references/okf-profile.md @@ -110,7 +110,7 @@ Every directory in the bundle has a generated `index.md`; an empty directory's i python3 "/scripts/okf-profile.py" index docs/product ``` -`` is the directory that holds this skill's `SKILL.md`, wherever the plugin is installed. The script path resolves from there; the bundle path, `docs/product`, resolves from the project root. +`` is the directory that holds this skill's `SKILL.md`, wherever the plugin is installed. The script path resolves from there; the bundle path, `docs/product`, resolves from the project root. While feature folders written with 0.1.0 await modernization, add one `--pending` for each, so the generator writes no index into them ([Checks](#checks), [While modernization is in progress](open-questions.md#while-modernization-is-in-progress)). Run it in every pull request that adds, moves, renames or removes a document, or changes a title or description, and commit the result. Don't edit an index by hand; the freshness check fails on any difference. diff --git a/plugins/product-development/skills/product-development/references/open-question-triage.md b/plugins/product-development/skills/product-development/references/open-question-triage.md index 12f0efb..dcdcb36 100644 --- a/plugins/product-development/skills/product-development/references/open-question-triage.md +++ b/plugins/product-development/skills/product-development/references/open-question-triage.md @@ -10,11 +10,13 @@ The loop takes one question at a time. Never batch decisions: each question gets ### 1. Enumerate -List the questions to triage: +List the questions to triage. While feature folders written with 0.1.0 await modernization, every command here runs with one `--pending` for each of them, as the check that started the loop did ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)): -- For a check point, the questions that hold the change there: `scripts/open-questions.py blocking docs/product {feature}/{change} --level `. +- For a check point, the questions that hold the change there: `python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level `. - For a wider pass, the generated index in `docs/product/open-questions.md`. +Run the script from the project root. `` is the directory that holds this skill's `SKILL.md`, wherever the plugin is installed. + Order them `none yet` first, since each must be classified before the change's next check, then `design`, `implementation` and `release`. ### 2. Explain @@ -56,4 +58,4 @@ When the ruling affects work that someone else owns later, such as another featu ### 7. Regenerate and continue -Regenerate the index in the same PR, `scripts/open-questions.py index docs/product`, then take the next question. When the list is done, run the check that started the loop again. +Regenerate the index in the same PR, `python3 "/scripts/open-questions.py" index docs/product`, with the same `--pending` as the check, then take the next question. When the list is done, run the check that started the loop again. diff --git a/plugins/product-development/skills/product-development/references/open-questions.md b/plugins/product-development/skills/product-development/references/open-questions.md index 2d4196e..64e5080 100644 --- a/plugins/product-development/skills/product-development/references/open-questions.md +++ b/plugins/product-development/skills/product-development/references/open-questions.md @@ -40,6 +40,8 @@ Each question names what it blocks, in its Blocks cell: - `this document`, for a document's own questions, such as a question in the delivery plan or a vision companion. Research notes and foundation snapshots are never edited, so they hold no live questions: a question about a research note's evidence goes in the register, or in the change it concerns. The vision has no Open Questions section; questions about the product's direction go in the register. A question scoped to one of a change's documents, by `this document` or by the document's path, also holds that change's checks. - A change by name, `{feature}/{change}`, or a step in the delivery plan by path and anchor, such as `roadmap.md#invitation-extension`. Separate several targets with commas. +A question that blocks a whole document, by `this document` or by the document's path without an anchor, blocks every step in it: the check on `roadmap.md#broader-rollout` lists the delivery plan's own `this document` questions as well as the questions that name that step. + A product-wide release question blocks only the targets it names. A question about regional sender rules for expiry notices that names `shared-calendars/invite-expiry` holds that change's ship decision and no other. ## Identity @@ -92,15 +94,17 @@ While a project is being modernized, every command takes `--pending` for the fea ```bash # Rewrite the index in docs/product/open-questions.md. -scripts/open-questions.py index docs/product +python3 "/scripts/open-questions.py" index docs/product # Exit 1 if the index is stale or a table or question link is invalid. Writes nothing; for CI. -scripts/open-questions.py check docs/product +python3 "/scripts/open-questions.py" check docs/product # List the open questions that hold a target at a check point. Exit 1 if any do. -scripts/open-questions.py blocking docs/product shared-calendars/invite-expiry --level design +python3 "/scripts/open-questions.py" blocking docs/product shared-calendars/invite-expiry --level design ``` +Run the commands from the project root. `` is the directory that holds this skill's `SKILL.md`, wherever the plugin is installed; the script stays there, since `scripts/init.sh` copies no scripts into the project ([okf-profile.md](okf-profile.md#indexes)). + Every command first validates the tables and refuses to continue on any of these: a table with other columns, an ID without its matching anchor, a duplicate ID in one document, an unknown blocking level or resolution method, a deferral whose target is not a link to an open question row that links back, a chain of deferrals that loops, an approval without a real date and a link or issue or PR number for where it was given, `this change` outside a change directory, a question answered by measurement after shipping that blocks ratification or the handoff, or that is release-level and names anything but a delivery-plan step, and a link to a question anchor that does not resolve, in any document. Links may be inline, with or without a title (`[OQ-2](PRD.md#oq-2 "Expiry decision")`), or reference-style (`[label][ref]` with a `[ref]: path#oq-N` definition). The index sits between two marker comments in `docs/product/open-questions.md`. Regeneration replaces everything between them, so running it twice changes nothing. The index copies each question's text, with its relative links rewritten to resolve from the register; the generator refuses to run if a link in the index would not resolve, to its file or to the heading or HTML anchor it names. A register without the markers gains an `## Index` section at its end. Regenerate the index in the same PR that adds, defers, answers or moves a question. @@ -110,12 +114,12 @@ The index sits between two marker comments in `docs/product/open-questions.md`. Until the last feature folder written with 0.1.0 is converted ([modernization.md](modernization.md)), the folders still in that layout hold 0.1.0 question tables, which fail every command. Every command, the gates' `blocking` checks included, then runs with one `--pending` for every feature folder still in the 0.1.0 layout: ```bash -scripts/open-questions.py blocking --pending {unconverted} docs/product {feature}/{change} --level design +python3 "/scripts/open-questions.py" blocking --pending {unconverted} docs/product {feature}/{change} --level design ``` -Every converted folder is still validated: its tables, its question links and its place in the index, so an error there fails the command as it would without `--pending`. In a pending folder, the tables are not validated, and a valid one is still indexed; a question link from it to a document outside the pending folders is checked, and so is a link into it from anywhere else. The commands refuse, with exit status 2, a `--pending` that names a folder not in the 0.1.0 layout: one with a feature spec overview, `{feature}-spec.md`, or a `changes/` directory, one with no `PRD.md`, or one whose `PRD.md` or `TRD.md` has front matter. `scripts/okf-profile.py` takes the same `--pending` ([okf-profile.md](okf-profile.md#checks)). +Every converted folder is still validated: its tables, its question links and its place in the index, so an error there fails the command as it would without `--pending`. In a pending folder, the tables are not validated. A valid row in a pending folder counts: it is indexed, and `blocking` sees it, like a row anywhere else. Rows in a table still in the 0.1.0 format are skipped: no command reads them. A question link from a pending folder to a document outside the pending folders is checked, and so is a link into it from anywhere else. The commands refuse, with exit status 2, a `--pending` that names a folder not in the 0.1.0 layout: one with a feature spec overview, `{feature}-spec.md`, or a `changes/` directory, one with no `PRD.md`, or one whose `PRD.md` or `TRD.md` has front matter. `scripts/okf-profile.py` takes the same `--pending` ([okf-profile.md](okf-profile.md#checks)). -A pending folder's 0.1.0 questions are invisible to `blocking` and missing from the generated index, so a pass doesn't cover them, and the triage workflow's listing steps won't show them. Before accepting a pass at ratification, the handoff or the release check, the maintainer reads the original question tables in each pending folder's `PRD.md` and `TRD.md` directly and triages any question that might hold the target ([open-question-triage.md](open-question-triage.md)); the gate passes only when the check exits 0 and that reading finds none that holds it. After the last conversion, the commands run without `--pending`. +The skipped 0.1.0 rows are absent from `blocking`'s output and missing from the generated index, so a pass doesn't cover them, and the triage workflow's listing steps won't show them. Before accepting a pass at ratification, the handoff or the release check, the maintainer reads the original question tables in each pending folder's `PRD.md` and `TRD.md` that are still in the 0.1.0 format directly and triages any question that might hold the target ([open-question-triage.md](open-question-triage.md)); the gate passes only when the check exits 0 and that reading finds none that holds it. After the last conversion, the commands run without `--pending`. ## Worked example @@ -127,7 +131,7 @@ One question on the change `invite-expiry` to the `shared-calendars` feature, fr | OQ-2 | Can an organizer extend an invitation that has expired? | design | this change | maintainer decision | — | — | ``` -`scripts/open-questions.py index docs/product` adds it to the index as `shaping/shared-calendars--invite-expiry/PRD.md#oq-2`, blocking `shared-calendars/invite-expiry`. +`python3 "/scripts/open-questions.py" index docs/product` adds it to the index as `shaping/shared-calendars--invite-expiry/PRD.md#oq-2`, blocking `shared-calendars/invite-expiry`. **2. Deferred.** When the promotion PR is prepared, the design-level check lists OQ-2. The maintainer rules that extension is a change of its own and approves the deferral in a review comment on 2026-11-18. The PR creates the shaping document `shaping/shared-calendars--extend-invitations/shaping.md` with the target row: diff --git a/plugins/product-development/skills/product-development/references/product-vision.md b/plugins/product-development/skills/product-development/references/product-vision.md index a62dfb4..4826644 100644 --- a/plugins/product-development/skills/product-development/references/product-vision.md +++ b/plugins/product-development/skills/product-development/references/product-vision.md @@ -206,7 +206,7 @@ A vision written to the earlier eleven-part anatomy, or one that has grown into "What the product is not" is new. Draft it from the old vision's exclusions and non-goals, and ask the maintainer for anything missing. Add the Decided label to each statement the maintainer confirms as settled. -If the old vision has an Open Questions table, move each live question to the register, `docs/product/open-questions.md`, as a new row with the register's next never-issued ID, or to the document it now concerns. Keep each row's Blocks targets, except `this document`: in the vision it meant the vision, and in the new home it would name that document instead. Replace it with what the question holds, such as `vision.md`, a change as `{feature}/{change}` or a delivery-plan step, and ask the maintainer when that is unclear. Rebase the row's outgoing relative links so they resolve from its new document, and point a bare `#oq-N` link, which meant a row in the vision, at that question's new row. Update every link that pointed at `vision.md#oq-N`, such as a `Deferred from` back-link, to the new row, and run `scripts/open-questions.py index docs/product` in the same PR. The archived copy keeps its table as history: the script leaves snapshot tables out of the index and the checks, so a question there no longer blocks anything. +If the old vision has an Open Questions table, move each live question to the register, `docs/product/open-questions.md`, as a new row with the register's next never-issued ID, or to the document it now concerns. Keep each row's Blocks targets, except `this document`: in the vision it meant the vision, and in the new home it would name that document instead. Replace it with what the question holds, such as `vision.md`, a change as `{feature}/{change}` or a delivery-plan step, and ask the maintainer when that is unclear. Rebase the row's outgoing relative links so they resolve from its new document, and point a bare `#oq-N` link, which meant a row in the vision, at that question's new row. Update every link that pointed at `vision.md#oq-N`, such as a `Deferred from` back-link, to the new row, and run `python3 "/scripts/open-questions.py" index docs/product` from the project root in the same PR, where `` is the directory that holds this skill's `SKILL.md`, with one `--pending` for each feature folder written with 0.1.0 that awaits modernization ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)). The archived copy keeps its table as history: the script leaves snapshot tables out of the index and the checks, so a question there no longer blocks anything. Present the slimmed vision together with its companions, research notes, delivery plan and register entries, and show where each part of the old vision went, so nothing is dropped without the maintainer seeing it. The maintainer approves the slimmed vision as a new version, and the old one stays archived under `docs/product/visions/`, following the version rules below: a split that keeps the strategic meaning is a minor version, and one in which the maintainer changes direction is a major version. Moving a constraint into the constitution is a constitution amendment, approved separately through the Product Constitution workflow. diff --git a/plugins/product-development/skills/product-development/references/promotion-review.md b/plugins/product-development/skills/product-development/references/promotion-review.md index a413d1a..d2d91e8 100644 --- a/plugins/product-development/skills/product-development/references/promotion-review.md +++ b/plugins/product-development/skills/product-development/references/promotion-review.md @@ -23,7 +23,7 @@ Say "No findings" for a section with none. Do not edit the PR. - [ ] Shaping content is not treated as binding. No ratified document cites a shaping document, an idea or a spike as the authority for a requirement. Links into `shaping/` are deferral targets or provenance, never requirements. ADRs and contracts the shaping document linked keep their own authority. - [ ] The shaping document moves with the change or is absorbed into the PRD, and the PRD keeps the provenance record ([changes-and-deltas.md](changes-and-deltas.md#provenance)). - [ ] No document says code, a spike or a prototype admits the spec. Behavior that exists only in code still enters through this PR. -- [ ] Outside `changes/{change}/`, the PR deletes the change's shaping directory and touches only: the Ratified entry in the feature log, the open-questions index, links into moved documents, the target rows of deferrals the maintainer approved, the app-local scenario files it lists and, for a new feature, the metadata-only feature overview, `log.md` and `changes/`. +- [ ] Outside `changes/{change}/`, the PR deletes the change's shaping directory and touches only: the Ratified entry in the feature log, the open-questions index, the generated OKF indexes (`index.md`) of the directories it changes, links into moved documents, the target rows of deferrals the maintainer approved, the app-local scenario files it lists and, for a new feature, the metadata-only feature overview, `log.md` and `changes/`. When a split creates a feature, it also adds the Feature split entry in the lineage log, `features/log.md` ([feature-bundles.md](feature-bundles.md#no-stub-bundles)). Both indexes are regenerated before this review, so the diff under review is the one that merges ([ratification.md](ratification.md#1-prepare-the-promotion-pr)). - [ ] Every moved document has OKF `status: stable`. No document carries a status field or changelog of its own ([feature-bundles.md](feature-bundles.md)). ### Deltas diff --git a/plugins/product-development/skills/product-development/references/ratification.md b/plugins/product-development/skills/product-development/references/ratification.md index b6ed610..6d58c1d 100644 --- a/plugins/product-development/skills/product-development/references/ratification.md +++ b/plugins/product-development/skills/product-development/references/ratification.md @@ -6,26 +6,34 @@ Ratification is the maintainer's approval of a change, recorded by merging its p ## 1. Prepare the promotion PR -Run these before the PR is opened, and put each result in its body. +Run these before the PR is opened, and put each result in its body. Run the scripts from the project root; `` is the directory that holds this skill's `SKILL.md`, wherever the plugin is installed ([okf-profile.md](okf-profile.md#indexes)). -1. **Collision check.** If `features/{feature}/changes/{change}/` already exists, the change name is used in the change archive, or a new feature's bundle already exists, stop and ask the maintainer. +1. **Collision check.** If the change is named `archive` (reserved for the change archive), `features/{feature}/changes/{change}/` already exists, the change name is used in the change archive, or a new feature's bundle already exists, stop and ask the maintainer. 2. **Overlap check.** Compare the change's deltas with every other change in flight that touches the same features ([changes-and-deltas.md](changes-and-deltas.md#overlap-check)). Put its report table in the PR body, or one line saying no overlap was found. 3. **Design-level check.** No open `design` or `none yet` question may name the change unless its deferral is approved ([open-questions.md](open-questions.md)): ```bash - scripts/open-questions.py blocking docs/product {feature}/{change} --level design + python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level design ``` Exit 0 passes. On exit 1, work through the listed questions with the maintainer in [open-question-triage.md](open-question-triage.md) before the PR is opened. While feature folders written with 0.1.0 await modernization, the check runs with `--pending` and the maintainer triages their questions too ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)). 4. **Everything else still open.** Preparation also reports anything else that is still open, so the maintainer ratifies knowing what remains. List the change's open implementation-level and release-level questions in the PR body: ```bash - scripts/open-questions.py blocking docs/product {feature}/{change} --level release + python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level release ``` - Here the exit code doesn't gate anything; the design-level check already passed. The list says what will hold the handoff (implementation) and the ship decision (release). -5. **Promotion review.** Review the PR against the checklist in [promotion-review.md](promotion-review.md), with the `spec-reviewer` agent where the harness has one, and include its findings. -6. **Index.** The PR moves documents that hold questions, so regenerate the open-questions index in it: `scripts/open-questions.py index docs/product`. + Run it with the same `--pending` as the design-level check. Here the exit code doesn't gate anything; the design-level check already passed. The list says what will hold the handoff (implementation) and the ship decision (release). +5. **Indexes.** The PR moves documents, some of which hold questions, so regenerate both indexes in it from the project root before the review, and commit the result: + + ```bash + python3 "/scripts/open-questions.py" index --pending {unconverted} docs/product + python3 "/scripts/okf-profile.py" index --pending {unconverted} docs/product + ``` + + `--pending {unconverted}` stands for one `--pending` for each feature folder written with 0.1.0 that awaits modernization, so neither command fails on such a folder's question tables or writes an index into it ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)). With no such folder, drop it. + +6. **Promotion review.** Review the PR against the checklist in [promotion-review.md](promotion-review.md), with the `spec-reviewer` agent where the harness has one, and include its findings. If the review leads to changes, regenerate the indexes again with step 5's commands, the same `--pending` included. Before you open the PR, show the maintainer the PR body and wait for their approval. Opening it is a write to GitHub and waits for the maintainer's approval (`SKILL.md`, GitHub Writes). diff --git a/plugins/product-development/skills/product-development/references/retrofit.md b/plugins/product-development/skills/product-development/references/retrofit.md index 54d90f4..a5e89fe 100644 --- a/plugins/product-development/skills/product-development/references/retrofit.md +++ b/plugins/product-development/skills/product-development/references/retrofit.md @@ -13,7 +13,7 @@ Two rules hold throughout: - Specs in other formats count as evidence for shaping. Code alone never admits a spec to `features/` (`SKILL.md`, Stages): behavior that exists only in code enters through `shaping/` or `ideas/`, and a change whose code has already shipped still goes through promotion. - Market and positioning details found along the way, such as segments, competitors, pricing comparisons and survey results, go to research notes in `docs/product/research/`, as [product-vision.md](product-vision.md#market-context-research-note) describes. Name each note for when its evidence was gathered and record where each detail came from. -Before step 1, if `docs/product/` lacks the 0.2.0 scaffold, run `scripts/init.sh`; it never overwrites. The Foundation Gate blocks drafting a PRD, not ideas or shaping, so a retrofit can run before the constitution and vision exist. +Before step 1, if `docs/product/` lacks the 0.2.0 scaffold, run `"/scripts/init.sh" .` from the project root; it never overwrites. The Foundation Gate blocks drafting a PRD, not ideas or shaping, so a retrofit can run before the constitution and vision exist. A project can mix 0.1.0 feature folders with undocumented features. Version 0.1.0 also installed `docs/product/AGENTS.md` and `docs/product/README.md`, which `scripts/init.sh` keeps, and their instructions still tell agents to edit PRDs in place under `features/`. When they are present, reconcile them before seeding, as modernization's setup describes ([modernization.md](modernization.md#how-it-runs)), in the retrofit PR or a PR of its own before it. diff --git a/plugins/product-development/skills/product-development/scripts/init.sh b/plugins/product-development/skills/product-development/scripts/init.sh index 7e014a9..7620d00 100755 --- a/plugins/product-development/skills/product-development/scripts/init.sh +++ b/plugins/product-development/skills/product-development/scripts/init.sh @@ -265,7 +265,12 @@ done echo "" echo "Done. Next steps:" -echo " 1. Review docs/product/README.md and docs/product/AGENTS.md" -echo " 2. Run the Product Constitution workflow to create approved, versioned docs/product/constitution.md" -echo " 3. Run the Product Vision workflow to create approved, versioned docs/product/vision.md" -echo " 4. Draft the first PRD in docs/product/shaping/ only after the Foundation Gate passes" +echo " 1. Generate the OKF indexes, including the bundle root docs/product/index.md, from the project root:" +echo " python3 \"$SCRIPT_DIR/okf-profile.py\" index docs/product" +echo " The step needs a python3 with PyYAML; the skill's references/initialization.md says where to get one." +echo " Project Setup is unfinished until docs/product/index.md exists." +echo " While feature folders written with skill 0.1.0 await modernization, add one --pending for each." +echo " 2. Review docs/product/README.md and docs/product/AGENTS.md" +echo " 3. Run the Product Constitution workflow to create approved, versioned docs/product/constitution.md" +echo " 4. Run the Product Vision workflow to create approved, versioned docs/product/vision.md" +echo " 5. Draft the first PRD in docs/product/shaping/ only after the Foundation Gate passes" diff --git a/plugins/product-development/skills/product-development/scripts/open-questions.py b/plugins/product-development/skills/product-development/scripts/open-questions.py index c550913..5b27cf7 100755 --- a/plugins/product-development/skills/product-development/scripts/open-questions.py +++ b/plugins/product-development/skills/product-development/scripts/open-questions.py @@ -14,7 +14,9 @@ blocking Lists the open questions that hold at a check point: those that name it at the checked level or an earlier one, or as `none yet`. A change also carries the questions scoped to its - own documents. Approved deferrals don't hold it. Exits 1 if any do. + own documents, and a document step such as a delivery-plan step + carries the questions that block its whole document. Approved + deferrals don't hold it. Exits 1 if any do. is a change as `{feature}/{change}`, or a document path relative to , with an optional `#anchor`, such as the delivery-plan step `roadmap.md#broader-rollout`. @@ -46,7 +48,8 @@ --pending: each feature folder still in the 0.1.0 layout. Repeat it for each one. Everything else is validated in full, the features converted earlier included. Tables in a pending folder are not validated, since it holds 0.1.0 -tables; a valid one there is still indexed. Question links are checked +tables: a valid row there still counts, indexed and seen by blocking, and a +row in a table still in the 0.1.0 format is skipped. Question links are checked everywhere except between pending folders: a link from a pending folder to a document outside them is checked. A command refuses, with exit status 2, a --pending that names a folder not in the 0.1.0 layout: one with a feature @@ -354,8 +357,17 @@ def index_errors(bundle, questions): def holds(question, target): """Whether a question names `target`. A change also carries the questions - scoped to its own documents (`this document`, or a document path).""" - return any(t == target or own_change(t.partition("#")[0]) == target for t in question.targets) + scoped to its own documents (`this document`, or a document path). A + document step, such as `roadmap.md#broader-rollout`, also carries the + questions that block its whole document (`this document`, or the path + without an anchor).""" + document, _, step = target.partition("#") + return any( + t == target + or own_change(t.partition("#")[0]) == target + or (step and t == document) + for t in question.targets + ) def documents(bundle): @@ -651,7 +663,11 @@ def main(argv=None): action="append", default=[], metavar="FEATURE", - help="skip features/FEATURE/, a feature folder still in the 0.1.0 layout that awaits modernization; repeatable", + help=( + "features/FEATURE/ is still in the 0.1.0 layout and awaits modernization: " + "its tables are not validated and the rows of tables still in the 0.1.0 format are skipped; " + "valid rows there still count; repeatable" + ), ) command.add_argument("bundle", type=Path) commands[2].add_argument("target") @@ -696,7 +712,7 @@ def main(argv=None): return fail([str(error)]) if args.command == "check": if updated != current: - return fail([f"{register}: index is stale; run scripts/open-questions.py index {bundle}"]) + return fail([f"{register}: index is stale; run open-questions.py index {bundle} from the installed skill"]) return 0 if updated != current: register.write_text(updated, encoding="utf-8") diff --git a/plugins/product-development/skills/product-development/templates/README.md.tmpl b/plugins/product-development/skills/product-development/templates/README.md.tmpl index 8eacd2f..6d1434f 100644 --- a/plugins/product-development/skills/product-development/templates/README.md.tmpl +++ b/plugins/product-development/skills/product-development/templates/README.md.tmpl @@ -48,7 +48,7 @@ Feature content moves through three stage directories. A document's stage, and s - The maintainer moves an idea to `shaping/` when they start shaping it. - A PRD is drafted in `shaping/`. Merging the change's promotion PR ratifies the change and moves it into `features/{feature}/changes/{change}/`. -- Implementation starts once the change's handoff has been sent: after ratification, once `open-questions.py blocking --level implementation` exits 0 for the change. That check also fails on an open design-level or `none yet` question that names the change. +- Implementation starts once the change's handoff has been sent: after ratification, once the implementation-level open-questions check exits 0 for the change: `python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level implementation`, run from the project root, where `` is the installed product-development skill's directory. That check also fails on an open design-level or `none yet` question that names the change. - When the change ships, canonization reconciles its deltas with what shipped, applies the reconciled deltas to the feature spec and archives the change. The product-development skill's canonization workflow (`references/canonization.md` in the installed skill) has the steps. - Code alone never admits a spec to `features/`. - Each stage directory has an `AGENTS.md` that says when agents read it and when they stay out. @@ -78,7 +78,7 @@ Surface Scenarios (extend with interaction-specific behaviors, written before pr ↓ Promotion PR (opened with the maintainer's approval; merge ratifies the change, moves it into features/{feature}/changes/{change}/ and lists its app-local scenarios) ↓ -Handoff (drafted at ratification, sent once `open-questions.py blocking --level implementation` exits 0; implementation starts here) +Handoff (drafted at ratification, sent once the implementation-level open-questions check exits 0; implementation starts here) ↓ Step Definitions (automate scenarios as executable tests) ↓ diff --git a/plugins/product-development/skills/product-development/templates/documents/lineage-log.md.tmpl b/plugins/product-development/skills/product-development/templates/documents/lineage-log.md.tmpl index b2bad02..b211943 100644 --- a/plugins/product-development/skills/product-development/templates/documents/lineage-log.md.tmpl +++ b/plugins/product-development/skills/product-development/templates/documents/lineage-log.md.tmpl @@ -26,6 +26,8 @@ Product-wide record of feature splits, merges and drops, dropped changes, and pr - Removed: ``, last present in commit - Removed: `features//`, the receiving bundle the change's promotion PR created, last present in commit + - Restored: ``, to its text before the promotion PR + ## diff --git a/plugins/product-development/skills/product-development/templates/open-questions.md.tmpl b/plugins/product-development/skills/product-development/templates/open-questions.md.tmpl index a055059..a41712f 100644 --- a/plugins/product-development/skills/product-development/templates/open-questions.md.tmpl +++ b/plugins/product-development/skills/product-development/templates/open-questions.md.tmpl @@ -18,7 +18,7 @@ When a question is answered, remove its row and put the answer in the spec, an A ## Index -Every open or deferred question in `docs/product/`, generated by the product-development skill's `scripts/open-questions.py index docs/product`. Do not edit between the markers. +Every open or deferred question in `docs/product/`, generated from the project root with `python3 "/scripts/open-questions.py" index docs/product`, where `` is the installed product-development skill's directory, the one that holds its `SKILL.md`. Do not edit between the markers. No open or deferred questions. diff --git a/plugins/product-development/skills/product-development/tests/board-mapping.bats b/plugins/product-development/skills/product-development/tests/board-mapping.bats index a548487..8580513 100644 --- a/plugins/product-development/skills/product-development/tests/board-mapping.bats +++ b/plugins/product-development/skills/product-development/tests/board-mapping.bats @@ -122,6 +122,11 @@ load_helpers() { # --- The neutral model --- +@test "the walkthrough names the action beside the promotion PR number it closes" { + grep -qF 'The maintainer closes the promotion PR, #214, without merging' "$GITHUB" + refute_grep -qF 'The maintainer closes #214 without merging' "$GITHUB" +} + @test "SKILL.md links the board-mapping model and the GitHub Projects reference" { local skill="$SCRIPT_DIR/SKILL.md" grep -q '`references/board-mapping.md`' "$skill" diff --git a/plugins/product-development/skills/product-development/tests/canonization.bats b/plugins/product-development/skills/product-development/tests/canonization.bats index ef40cad..33714e2 100644 --- a/plugins/product-development/skills/product-development/tests/canonization.bats +++ b/plugins/product-development/skills/product-development/tests/canonization.bats @@ -80,9 +80,9 @@ stage_fixture() { text=$(joined "$REF") grep -q "move the story and scenario files the reconciled deltas list to the feature root" <<< "$text" grep -qF 'changes/archive/YYYY-MM-DD-{change}/' <<< "$text" - grep -q "with the ratified deltas intact" <<< "$text" + grep -q "The ratified deltas keep their payloads" <<< "$text" grep -q "The change is now Canonized" <<< "$text" - grep -qF 'okf-profile.py" index docs/product' <<< "$text" + grep -qF 'okf-profile.py" index --pending {unconverted} docs/product' <<< "$text" } @test "the ship signal is recorded as a Shipped feature-log entry with its evidence" { @@ -158,6 +158,21 @@ stage_fixture() { done } +@test "archiving keeps the ratified payloads, rebases question links both ways and checks the open-questions index" { + local archive + archive=$(sed -n '/^### 4\. Archive the change/,/^### 5\./p' "$REF" | tr -s '\n ' ' ') + grep -q "The ratified deltas keep their payloads" <<< "$archive" + grep -q "Links into the change" <<< "$archive" + grep -q "back-links in the target rows of approved deferrals" <<< "$archive" + grep -q "Links out of the archived change" <<< "$archive" + grep -qF 'python3 "/scripts/open-questions.py" index --pending {unconverted} docs/product' <<< "$archive" + grep -qF 'python3 "/scripts/open-questions.py" check --pending {unconverted} docs/product' <<< "$archive" + grep -qF 'python3 "/scripts/okf-profile.py" check --pending {unconverted} docs/product' <<< "$archive" + refute_grep -q "change nothing else" <<< "$archive" + # The canonization PR carries the regenerated open-questions index too. + grep -q "the regenerated OKF and open-questions indexes" "$REF" +} + @test "the canonization PR waits for approval and records the accounting" { local text text=$(joined "$REF") @@ -242,6 +257,44 @@ stage_fixture() { grep -q "Working hours follow a time-zone change" "$ARCHIVE/scenarios/working-hours.feature" } +@test "a fully shipped whole-file unit changed in meaning or rebased carries its reconciled text, written at the feature root" { + local text + text=$(joined "$SCRIPT_DIR/references/changes-and-deltas.md") + grep -q "\*\*Changed:\*\* the reconciled entry carries the approved file as its text" <<< "$text" + grep -q "\*\*Rebased:\*\* a revised file whose feature-root version drifted" <<< "$text" + grep -q "A reconciled entry for a changed, rebased or split file" <<< "$text" + grep -q "whole-file unit that changed in meaning or was rebased" <<< "$(joined "$REF")" +} + +@test "fixture: a fully shipped story changed in meaning reaches the feature root as approved, and the archive keeps it as ratified" { + stage_fixture + local reconciled="$WORK/reconciled" + mkdir -p "$reconciled" + python3 - "$RECONCILED/free-busy.delta.md" "$reconciled/free-busy.delta.md" <<'PY' +import sys +text = open(sys.argv[1]).read() +entry = "### stories/US-002-set-working-hours.md\n" +approved = ( + "Text:\n\n~~~markdown\n---\ntype: story\ntitle: \"US-002: Set working hours\"\n" + "description: A member sets working hours so others see the time outside them apart from busy blocks.\n" + "status: stable\n---\n\n# US-002: Set working hours\n\n**PRD Requirement:** FR-03, FR-02\n\n" + "## Story\n\nAs a member,\nI want to set the hours of my working day,\n" + "so that others see when I am outside working hours.\n\n## Acceptance Criteria\n\n" + "- [ ] I can set the start and end of my working day\n" + "- [ ] Others see the time outside my working day apart from my busy blocks\n~~~\n" +) +assert entry in text +open(sys.argv[2], "w").write(text.replace(entry, entry + "\n" + approved, 1)) +PY + run python3 "$DELTAS" canonize "$FEATURE" working-hours --date 2027-03-08 --deltas "$reconciled" + echo "$output" + [ "$status" -eq 0 ] + grep -q "apart from my busy blocks" "$FEATURE/stories/US-002-set-working-hours.md" + refute_grep -q "don't invite me to meetings" "$FEATURE/stories/US-002-set-working-hours.md" + grep -q "don't invite me to meetings" "$FEATURE/changes/archive/2027-03-08-working-hours/stories/US-002-set-working-hours.md" + rm -rf "$WORK" +} + @test "fixture: the reconciled deltas leave out deferred units and carry the approved text" { local reconciled="$RECONCILED/free-busy.delta.md" refute_grep -q "FR-04\|US-003\|time.zone" "$reconciled" diff --git a/plugins/product-development/skills/product-development/tests/feature-evolution.bats b/plugins/product-development/skills/product-development/tests/feature-evolution.bats index 8ea3be5..b0fd3fb 100644 --- a/plugins/product-development/skills/product-development/tests/feature-evolution.bats +++ b/plugins/product-development/skills/product-development/tests/feature-evolution.bats @@ -672,6 +672,28 @@ SPLIT="$SCRIPT_DIR/tests/fixtures/feature-split" grep -qx -- " - Removed: \`features//\`, the receiving bundle the change's promotion PR created, last present in commit " "$tmpl" } +@test "archive is a reserved change name, refused at promotion" { + local naming + naming=$(sed -n '/^## Naming/,/^## Change directory/p' "$SCRIPT_DIR/references/changes-and-deltas.md" | tr -s '\n ' ' ') + grep -q "\`archive\` is reserved" <<< "$naming" + grep -qF 'features/{feature}/changes/archive/' <<< "$naming" + grep -q "the change is named \`archive\`" "$SCRIPT_DIR/references/ratification.md" + sed -n '/^### Promotion/,/^### Handoff/p' "$SCRIPT_DIR/SKILL.md" | grep -q "the change is named \`archive\`" +} + +@test "dropping a ratified change restores the app-local scenario files its promotion PR revised, guarded like a deferral" { + local deltas bundles tmpl="$SCRIPT_DIR/templates/documents/lineage-log.md.tmpl" + deltas=$(joined "$SCRIPT_DIR/references/changes-and-deltas.md") + bundles=$(joined "$SCRIPT_DIR/references/feature-bundles.md") + grep -q "Dropping a Ratified change undoes its app-local edits in the drop PR" <<< "$deltas" + grep -q "restores each revised file from its recorded base text and deletes each file the change added" <<< "$deltas" + grep -q "the drop PR refuses that file and the maintainer reconciles it" <<< "$deltas" + grep -q "removing only the dropped change's edits" <<< "$deltas" + grep -q "the drop PR also restores the app-local scenario files" <<< "$bundles" + sed -n '/^### Worked example: a dropped change/,$p' "$SCRIPT_DIR/references/feature-bundles.md" | grep -q " - Restored: \`apps/web/docs/features/shared-calendars/scenarios/" + grep -q " - Restored: \`\`" "$tmpl" +} + @test "a split's promotion PR initializes the receiving bundle and both logs record the split" { local text text=$(joined "$SCRIPT_DIR/references/feature-bundles.md") diff --git a/plugins/product-development/skills/product-development/tests/feature-tags.bats b/plugins/product-development/skills/product-development/tests/feature-tags.bats index 21ad9d7..9c80749 100644 --- a/plugins/product-development/skills/product-development/tests/feature-tags.bats +++ b/plugins/product-development/skills/product-development/tests/feature-tags.bats @@ -43,6 +43,11 @@ refute_grep() { # --- Comment forms ----------------------------------------------------------- +@test "SKILL.md lists the feature-tags reference and script in its inventories" { + grep -qF -- '- **`references/feature-tags.md`** —' "$SKILL_DIR/SKILL.md" + grep -qF -- '- **`scripts/feature-tags.py`** —' "$SKILL_DIR/SKILL.md" +} + @test "a /** */ block comment tag naming an existing feature passes" { put src/reminders.ts <<'EOF' /** diff --git a/plugins/product-development/skills/product-development/tests/fixtures/handoff/bundle/open-questions.md b/plugins/product-development/skills/product-development/tests/fixtures/handoff/bundle/open-questions.md index 5f8ecd7..f9427bb 100644 --- a/plugins/product-development/skills/product-development/tests/fixtures/handoff/bundle/open-questions.md +++ b/plugins/product-development/skills/product-development/tests/fixtures/handoff/bundle/open-questions.md @@ -7,7 +7,7 @@ status: stable # Open questions -Questions about the whole product go in the table below. A question about one document stays in that document's own Open Questions table. The index lists every open or deferred question in `docs/product/`; regenerate it with the product-development skill's `scripts/open-questions.py index`. +Questions about the whole product go in the table below. A question about one document stays in that document's own Open Questions table. The index lists every open or deferred question in `docs/product/`; regenerate it from the project root with `python3 "/scripts/open-questions.py" index docs/product`, where `` is the installed product-development skill's directory. ## Product-wide questions diff --git a/plugins/product-development/skills/product-development/tests/fixtures/modernization/expected/docs/product/README.md b/plugins/product-development/skills/product-development/tests/fixtures/modernization/expected/docs/product/README.md index 6030444..b67addc 100644 --- a/plugins/product-development/skills/product-development/tests/fixtures/modernization/expected/docs/product/README.md +++ b/plugins/product-development/skills/product-development/tests/fixtures/modernization/expected/docs/product/README.md @@ -48,7 +48,7 @@ Feature content moves through three stage directories. A document's stage, and s - The maintainer moves an idea to `shaping/` when they start shaping it. - A PRD is drafted in `shaping/`. Merging the change's promotion PR ratifies the change and moves it into `features/{feature}/changes/{change}/`. -- Implementation starts once the change's handoff has been sent: after ratification, once `open-questions.py blocking --level implementation` exits 0 for the change. That check also fails on an open design-level or `none yet` question that names the change. +- Implementation starts once the change's handoff has been sent: after ratification, once the implementation-level open-questions check exits 0 for the change: `python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level implementation`, run from the project root, where `` is the installed product-development skill's directory. That check also fails on an open design-level or `none yet` question that names the change. - When the change ships, canonization reconciles its deltas with what shipped, applies the reconciled deltas to the feature spec and archives the change. The product-development skill's canonization workflow (`references/canonization.md` in the installed skill) has the steps. - Code alone never admits a spec to `features/`. - Each stage directory has an `AGENTS.md` that says when agents read it and when they stay out. @@ -78,7 +78,7 @@ Surface Scenarios (extend with interaction-specific behaviors, written before pr ↓ Promotion PR (opened with the maintainer's approval; merge ratifies the change, moves it into features/{feature}/changes/{change}/ and lists its app-local scenarios) ↓ -Handoff (drafted at ratification, sent once `open-questions.py blocking --level implementation` exits 0; implementation starts here) +Handoff (drafted at ratification, sent once the implementation-level open-questions check exits 0; implementation starts here) ↓ Step Definitions (automate scenarios as executable tests) ↓ diff --git a/plugins/product-development/skills/product-development/tests/fixtures/modernization/expected/docs/product/open-questions.md b/plugins/product-development/skills/product-development/tests/fixtures/modernization/expected/docs/product/open-questions.md index bbb555d..a24754d 100644 --- a/plugins/product-development/skills/product-development/tests/fixtures/modernization/expected/docs/product/open-questions.md +++ b/plugins/product-development/skills/product-development/tests/fixtures/modernization/expected/docs/product/open-questions.md @@ -18,7 +18,7 @@ When a question is answered, remove its row and put the answer in the spec, an A ## Index -Every open or deferred question in `docs/product/`, generated by the product-development skill's `scripts/open-questions.py index docs/product`. Do not edit between the markers. +Every open or deferred question in `docs/product/`, generated from the project root with `python3 "/scripts/open-questions.py" index docs/product`, where `` is the installed product-development skill's directory, the one that holds its `SKILL.md`. Do not edit between the markers. | Question | Blocking level | Blocks | Deferred to | Text | diff --git a/plugins/product-development/skills/product-development/tests/fixtures/modernization/start/docs/product/README.md b/plugins/product-development/skills/product-development/tests/fixtures/modernization/start/docs/product/README.md index ab5de8c..20ca751 100644 --- a/plugins/product-development/skills/product-development/tests/fixtures/modernization/start/docs/product/README.md +++ b/plugins/product-development/skills/product-development/tests/fixtures/modernization/start/docs/product/README.md @@ -19,7 +19,7 @@ Product governance and cross-surface specifications. Artifacts here describe wha Surface-specific specifications. Artifacts here describe behaviors and interactions that are bound to a specific surface's interaction model. -- `features/{feature}/scenarios/` — surface-specific `.feature` files (e.g., Swiping down during a breathing round triggers haptic feedback) +- `features/{feature}/scenarios/` — surface-specific `.feature` files (e.g., Swiping left on the day view shows the next day) Step definitions (automation code that implements both platform and surface scenarios) live in each app's test directory, not in `docs/`. @@ -59,11 +59,11 @@ When `grill-with-docs` is used, product-domain context may live in `docs/product A specification belongs at **platform level** if it holds true regardless of whether the user is on a phone. -> "Error reports for non-consented users contain no persistent identifier." +> "An accepted invitation adds the event to the invitee's calendar." A specification belongs at **app level** if its language references a surface-specific interaction model. -> "Swiping down during a breathing round triggers haptic feedback." +> "Swiping left on the day view shows the next day." When in doubt, start at platform level. Move to app level only when the Given/When/Then language cannot be written without referencing a specific interaction model. diff --git a/plugins/product-development/skills/product-development/tests/fixtures/open-questions/bundle/open-questions.md b/plugins/product-development/skills/product-development/tests/fixtures/open-questions/bundle/open-questions.md index 7b26927..c5740cf 100644 --- a/plugins/product-development/skills/product-development/tests/fixtures/open-questions/bundle/open-questions.md +++ b/plugins/product-development/skills/product-development/tests/fixtures/open-questions/bundle/open-questions.md @@ -7,7 +7,7 @@ status: stable # Open questions -Questions about the whole product go in the table below. A question about one document stays in that document's own Open Questions table. The index lists every open or deferred question in `docs/product/`; regenerate it with the product-development skill's `scripts/open-questions.py index`. +Questions about the whole product go in the table below. A question about one document stays in that document's own Open Questions table. The index lists every open or deferred question in `docs/product/`; regenerate it from the project root with `python3 "/scripts/open-questions.py" index docs/product`, where `` is the installed product-development skill's directory. ## Product-wide questions diff --git a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/open-questions.md b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/open-questions.md index 8eb05db..fa13502 100644 --- a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/open-questions.md +++ b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/open-questions.md @@ -18,7 +18,7 @@ When a question is answered, remove its row and put the answer in the spec, an A ## Index -Every open or deferred question in `docs/product/`, generated by the product-development skill's `scripts/open-questions.py index docs/product`. Do not edit between the markers. +Every open or deferred question in `docs/product/`, generated from the project root with `python3 "/scripts/open-questions.py" index docs/product`, where `` is the installed product-development skill's directory, the one that holds its `SKILL.md`. Do not edit between the markers. | Question | Blocking level | Blocks | Deferred to | Text | diff --git a/plugins/product-development/skills/product-development/tests/helpers/deltas.py b/plugins/product-development/skills/product-development/tests/helpers/deltas.py index d4b8786..f156eac 100755 --- a/plugins/product-development/skills/product-development/tests/helpers/deltas.py +++ b/plugins/product-development/skills/product-development/tests/helpers/deltas.py @@ -241,7 +241,7 @@ def change_name(change_dir): def file_units(deltas): """Map each whole-file unit, as (qualifier, path), to (section, text), where text is the Text or New text a reconciled entry carries for a - split file, or None.""" + changed, rebased or split file, or None.""" units = {} for delta, q in deltas: for e in parse_delta(delta): @@ -833,8 +833,9 @@ def apply_canonization(feature, change, date, deltas, reconciled, writes, emptie if text is None: shutil.move(str(change_dir / prefix(q) / rel), str(dest)) else: - # A split file: the reconciled entry carries the shipped part, and - # the change's file, with the deferred part, is archived. + # A changed, rebased or split file: the reconciled entry carries + # the text that shipped, and the change's file, as ratified, is + # archived. dest.write_text(text.rstrip("\n") + "\n") for d in sorted(change_dir.rglob("*"), reverse=True): if d.is_dir() and not any(d.iterdir()): diff --git a/plugins/product-development/skills/product-development/tests/init.bats b/plugins/product-development/skills/product-development/tests/init.bats index 6e8f6f6..716609f 100644 --- a/plugins/product-development/skills/product-development/tests/init.bats +++ b/plugins/product-development/skills/product-development/tests/init.bats @@ -412,7 +412,7 @@ EOF run "$INIT_SCRIPT" "$TEST_PROJECT" --non-interactive --project-name "X" [ "$status" -eq 0 ] grep -q "Foundation Gate" <<< "$output" - [[ "$output" == *"2. Run the Product Constitution workflow to create approved, versioned docs/product/constitution.md"*"3. Run the Product Vision workflow to create approved, versioned docs/product/vision.md"* ]] + [[ "$output" == *"3. Run the Product Constitution workflow to create approved, versioned docs/product/constitution.md"*"4. Run the Product Vision workflow to create approved, versioned docs/product/vision.md"* ]] refute_grep -q "Start your first feature with: docs/product/features/{feature}/PRD.md" <<< "$output" } @@ -618,14 +618,16 @@ EOF @test "a missing foundation document triggers the Foundation workflow only at PRD drafting" { grep -q "A missing foundation document does not trigger this workflow during ideas, discovery, design or other shaping work" "$SCRIPT_DIR/SKILL.md" - grep -q "The user asks to create, update or approve product-anchor docs" "$SCRIPT_DIR/SKILL.md" + grep -q "The user asks to create, update or approve foundation documents: the constitution or the vision" "$SCRIPT_DIR/SKILL.md" + refute_grep -qi "product-anchor\|anchor doc" "$SCRIPT_DIR/SKILL.md" + grep -q "Further foundation document types" "$SCRIPT_DIR/SKILL.md" } @test "promotion moves each change into its own directory and stops on a collision" { local promotion promotion=$(sed -n '/^### Promotion/,/^### Handoff$/p' "$SCRIPT_DIR/SKILL.md") grep -q 'moves the change.s approved documents from `docs/product/shaping/{feature}--{change}/` into `docs/product/features/{feature}/changes/{change}/`' <<< "$promotion" - grep -q 'if `features/{feature}/changes/{change}/` already exists' <<< "$promotion" + grep -qF 'if the change is named `archive` (reserved for the change archive), `features/{feature}/changes/{change}/` already exists' <<< "$promotion" grep -q "stop and ask the maintainer. Never overwrite a ratified document during promotion" <<< "$promotion" refute_grep -q "provisional" <<< "$promotion" } @@ -663,18 +665,76 @@ EOF done } +@test "init prints the OKF index step, and following it leaves a bundle that passes the profile check" { + run "$INIT_SCRIPT" "$TEST_PROJECT" --non-interactive --project-name "X" + [ "$status" -eq 0 ] + local step="python3 \"$SCRIPT_DIR/scripts/okf-profile.py\" index docs/product" + grep -qF "$step" <<< "$output" + # Scaffolding alone leaves no bundle root, so the profile check fails. + run bash -c 'cd "$1" && python3 "$2/scripts/okf-profile.py" check docs/product' _ "$TEST_PROJECT" "$SCRIPT_DIR" + [ "$status" -eq 1 ] + grep -qF 'there is no index.md' <<< "$output" + # The printed step, run from the project root, completes the bundle. + run bash -c 'cd "$1" && eval "$2"' _ "$TEST_PROJECT" "$step" + [ "$status" -eq 0 ] || { echo "$output" >&2; return 1; } + grep -qx 'okf_version: "0.3"' "$TEST_PROJECT/docs/product/index.md" + run bash -c 'cd "$1" && python3 "$2/scripts/okf-profile.py" check docs/product' _ "$TEST_PROJECT" "$SCRIPT_DIR" + [ "$status" -eq 0 ] || { echo "$output" >&2; return 1; } + run bash -c 'cd "$1" && python3 "$2/scripts/open-questions.py" check docs/product' _ "$TEST_PROJECT" "$SCRIPT_DIR" + [ "$status" -eq 0 ] || { echo "$output" >&2; return 1; } +} + +@test "agent and standalone setup both generate the OKF indexes before Project Setup is done" { + local setup post + setup=$(sed -n '/^### Project Setup/,/^### Foundation workflow/p' "$SCRIPT_DIR/SKILL.md") + grep -qF 'python3 "/scripts/okf-profile.py" index docs/product' <<< "$setup" + grep -qF '`docs/product/index.md` — the OKF bundle root' <<< "$setup" + post=$(sed -n '/^## Post-initialization/,/^When running the Constitution Grill/p' "$SCRIPT_DIR/references/initialization.md") + grep -qF 'python3 "/scripts/okf-profile.py" index docs/product' <<< "$post" + grep -q "both after agent orchestration and after standalone execution" <<< "$post" +} + @test "Project Setup skips only when every scaffold file exists" { local setup setup=$(sed -n '/^### Project Setup/,/^### Foundation workflow/p' "$SCRIPT_DIR/SKILL.md") grep -q "Skip only when every scaffold file exists" <<< "$setup" - grep -q 're-run `scripts/init.sh`' <<< "$setup" + grep -qF 're-run `"/scripts/init.sh" .` from the project root' <<< "$setup" refute_grep -q 'Skip if `docs/product/README.md` already exists' <<< "$setup" - grep -qE '^\| No `docs/product/` directory, or any scaffold file missing .*\| Project Setup \|$' "$SCRIPT_DIR/SKILL.md" + grep -qE '^\| No `docs/product/` directory, any scaffold file missing .*\| Project Setup' "$SCRIPT_DIR/SKILL.md" for file in README.md AGENTS.md ideas/AGENTS.md shaping/AGENTS.md features/AGENTS.md; do grep -qF "docs/product/$file" <<< "$setup" done } +@test "a missing bundle root leaves Project Setup unfinished, resumed at index generation" { + local setup post + # Scaffolding writes all six scaffold files before the index step, and + # without PyYAML the index step exits 2 and writes no bundle root. + run "$INIT_SCRIPT" "$TEST_PROJECT" --non-interactive --project-name "X" + [ "$status" -eq 0 ] + grep -qF "Project Setup is unfinished until docs/product/index.md exists" <<< "$output" + grep -qF "needs a python3 with PyYAML" <<< "$output" + mkdir -p "$TEST_PROJECT/no-yaml" + echo 'raise ImportError("no PyYAML here")' > "$TEST_PROJECT/no-yaml/yaml.py" + run bash -c 'cd "$1" && PYTHONPATH="$1/no-yaml" python3 "$2/scripts/okf-profile.py" index docs/product' _ "$TEST_PROJECT" "$SCRIPT_DIR" + [ "$status" -eq 2 ] + [ ! -e "$TEST_PROJECT/docs/product/index.md" ] + for file in README.md AGENTS.md ideas/AGENTS.md shaping/AGENTS.md features/AGENTS.md open-questions.md; do + [ -f "$TEST_PROJECT/docs/product/$file" ] + done + # So the skip condition and Workflow Selection count the bundle root too. + setup=$(sed -n '/^### Project Setup/,/^### Foundation workflow/p' "$SCRIPT_DIR/SKILL.md" | tr -s '\n ' ' ') + grep -qF 'and so does the bundle root, `docs/product/index.md`' <<< "$setup" + grep -qF 'If only `docs/product/index.md` is missing, Setup stopped before index generation' <<< "$setup" + grep -qF 'resume there with a `python3` that has PyYAML (`references/initialization.md#post-initialization`)' <<< "$setup" + grep -qE '^\| No `docs/product/` directory, any scaffold file missing \(.*\), or no bundle root \(`docs/product/index.md`\) \| Project Setup; with only the bundle root missing, resume at index generation \|$' "$SCRIPT_DIR/SKILL.md" + # The setup reference says how to get a Python with PyYAML, never Homebrew. + post=$(sed -n '/^## Post-initialization/,/^When running the Constitution Grill/p' "$SCRIPT_DIR/references/initialization.md" | tr -s '\n ' ' ') + grep -qF "nix-shell -p 'python3.withPackages (ps: [ ps.pyyaml ])'" <<< "$post" + grep -qF 'Setup is unfinished until `docs/product/index.md` exists' <<< "$post" + refute_grep -qi 'brew' "$SCRIPT_DIR/references/initialization.md" "$SCRIPT_DIR/SKILL.md" "$INIT_SCRIPT" +} + @test "changes to ratified specs go through shaping and promotion, not in-place edits" { run "$INIT_SCRIPT" "$TEST_PROJECT" --non-interactive --project-name "X" [ "$status" -eq 0 ] diff --git a/plugins/product-development/skills/product-development/tests/lifecycle-review-handoff.bats b/plugins/product-development/skills/product-development/tests/lifecycle-review-handoff.bats index 31b6c89..223e25a 100644 --- a/plugins/product-development/skills/product-development/tests/lifecycle-review-handoff.bats +++ b/plugins/product-development/skills/product-development/tests/lifecycle-review-handoff.bats @@ -125,9 +125,9 @@ drop_row() { local text text=$(joined "$REFS/ratification.md") grep -q "overlap check" <<< "$text" - grep -qF "scripts/open-questions.py blocking docs/product {feature}/{change} --level design" <<< "$text" + grep -qF 'python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level design' <<< "$text" grep -q "reports anything else that is still open" <<< "$text" - grep -qF "scripts/open-questions.py blocking docs/product {feature}/{change} --level release" <<< "$text" + grep -qF 'python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level release' <<< "$text" grep -q "references/changes-and-deltas.md\|changes-and-deltas.md" <<< "$text" grep -q "open-questions.md" <<< "$text" } @@ -171,6 +171,19 @@ drop_row() { grep -q "overlap report" <<< "$text" } +@test "the promotion-review checklist permits regenerated OKF indexes and a split's lineage entry" { + local text prep + text=$(joined "$REFS/promotion-review.md") + grep -qF "the generated OKF indexes (\`index.md\`)" <<< "$text" + grep -qF "the Feature split entry in the lineage log, \`features/log.md\`" <<< "$text" + grep -q "regenerated before this review" <<< "$text" + # Ratification regenerates both indexes before the promotion review runs. + prep=$(sed -n '/^## 1. Prepare the promotion PR/,/^Before you open the PR/p' "$REFS/ratification.md") + grep -q '^5\. \*\*Indexes\.\*\*' <<< "$prep" + grep -q '^6\. \*\*Promotion review\.\*\*' <<< "$prep" + grep -qF 'okf-profile.py" index --pending {unconverted} docs/product' <<< "$prep" +} + @test "the promotion-review checklist checks terminology against the skill's glossary" { local text text=$(joined "$REFS/promotion-review.md") @@ -225,7 +238,7 @@ drop_row() { grep -qi "a deferral is recorded, needs maintainer approval, and names where the question went" <<< "$text" grep -q "Deferred to" <<< "$text" grep -q "Approval" <<< "$text" - grep -qF "scripts/open-questions.py index docs/product" <<< "$text" + grep -qF 'python3 "/scripts/open-questions.py" index docs/product' <<< "$text" } @test "triage leaves the register and the levels to the open-questions reference" { @@ -250,7 +263,7 @@ drop_row() { text=$(joined "$REFS/implementation-handoff.md") grep -q "drafted at ratification" <<< "$text" grep -q "sent once no implementation-level question remains open" <<< "$text" - grep -qF "scripts/open-questions.py blocking docs/product {feature}/{change} --level implementation" <<< "$text" + grep -qF 'python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level implementation' <<< "$text" } @test "the handoff carries the release check to whoever fires the ship signal" { @@ -295,6 +308,20 @@ drop_row() { grep -q '^\*\*Gate:\*\* Do not start implementation until the handoff has been sent' <<< "$text" } +@test "workflow selection routes by approved inputs and sends unfinished artifacts back to their own workflow" { + local skill="$SCRIPT_DIR/SKILL.md" + grep -qxF '| PRD or TRD drafted, not yet approved | Requirements: finish its review and approval |' "$skill" + grep -qxF '| PRD and TRD approved, no stories yet | User Stories |' "$skill" + grep -qxF '| Stories drafted, not yet approved, or without acceptance criteria | User Stories: finish them |' "$skill" + grep -qxF '| Stories approved, with acceptance criteria defined | BDD Scenarios |' "$skill" + grep -qxF '| Scenarios drafted, not yet approved | BDD Scenarios: finish their review and approval |' "$skill" + refute_grep -qF '| PRD exists, needs decomposition |' "$skill" + refute_grep -qF '| Stories exist, needs testable criteria |' "$skill" + # The rows agree with the workflows' own triggers. + grep -qx '\*\*Trigger:\*\* PRD and TRD are reviewed and stable.' "$skill" + grep -qx '\*\*Trigger:\*\* User stories have acceptance criteria defined.' "$skill" +} + @test "the lifecycle map and workflow selection place the handoff before implementation" { local skill="$SCRIPT_DIR/SKILL.md" map map=$(sed -n '/^## Lifecycle Map/,/^## Stages/p' "$skill") @@ -442,14 +469,14 @@ drop_row() { [ -n "$steps" ] [ "$handoff" -eq $((promotion + 2)) ] [ "$steps" -eq $((handoff + 2)) ] - grep -qF '`open-questions.py blocking --level implementation` exits 0' <<< "$(sed -n "${handoff}p" "$tmpl")" + grep -qF 'the implementation-level open-questions check exits 0' <<< "$(sed -n "${handoff}p" "$tmpl")" grep -q "maintainer's approval" <<< "$(sed -n "${promotion}p" "$tmpl")" } @test "the generated README states the send condition as the implementation-level check exiting 0" { local tmpl="$SCRIPT_DIR/templates/README.md.tmpl" refute_grep -q "no implementation-level" "$tmpl" - [ "$(grep -cF '`open-questions.py blocking --level implementation` exits 0' "$tmpl")" -eq 2 ] + [ "$(grep -cF 'the implementation-level open-questions check exits 0' "$tmpl")" -eq 2 ] } # --- Findings from review: pinning, delta targets, cleanup, gates --- diff --git a/plugins/product-development/skills/product-development/tests/modernization.bats b/plugins/product-development/skills/product-development/tests/modernization.bats index 398a9b2..a2cfb04 100644 --- a/plugins/product-development/skills/product-development/tests/modernization.bats +++ b/plugins/product-development/skills/product-development/tests/modernization.bats @@ -491,17 +491,17 @@ EOF grep -qF "]($link)" "$REF" # Ratification: the design-level check, step 3. section=$(awk '/^[0-9]+\. / { on = /^3\. / } on' "$refs/ratification.md") - grep -qF 'open-questions.py blocking' <<< "$section" + grep -qF 'open-questions.py" blocking' <<< "$section" grep -qF "]($link)" <<< "$section" # The handoff: when it is sent, and the release check. for heading in "## When it is sent" "## The ship signal and the release check"; do section=$(awk -v h="$heading" '/^## / { on = ($0 == h) } on' "$refs/implementation-handoff.md") - grep -qF 'open-questions.py blocking' <<< "$section" || { echo "$heading: no check" >&2; return 1; } + grep -qF 'open-questions.py" blocking' <<< "$section" || { echo "$heading: no check" >&2; return 1; } grep -qF "]($link)" <<< "$section" || { echo "$heading: no link" >&2; return 1; } done # SKILL.md's release check. section=$(awk '/^##/ { on = ($0 == "### Release Check") } on' "$SCRIPT_DIR/SKILL.md") - grep -qF 'open-questions.py blocking' <<< "$section" + grep -qF 'open-questions.py" blocking' <<< "$section" grep -qF "\`references/$link\`" <<< "$section" } @@ -706,6 +706,41 @@ EOF diff -r "$OTHER_OLD" "$BUNDLE/features/calendar-sharing" } +@test "open-questions: a valid row in a pending folder counts: it is indexed and holds the converted change it names" { + indexed_bundle + local prd="$BUNDLE/features/calendar-sharing/PRD.md" + cat >> "$prd" <<'EOF' + +## Questions for the conversion + +| ID | Question | Blocking level | Blocks | Resolution | Deferred to | Approval | +|----|----------|----------------|--------|------------|-------------|----------| +| OQ-2 | Do SMS reminders reach the members a calendar is shared with? | design | event-reminders/sms-reminders | maintainer decision | — | — | +EOF + run python3 "$OPEN_QUESTIONS" blocking --pending calendar-sharing "$BUNDLE" event-reminders/sms-reminders --level design + echo "$output" + [ "$status" -eq 1 ] + grep -qF "features/calendar-sharing/PRD.md#oq-2 design" <<< "$output" + # The row still in the 0.1.0 format is skipped: no command sees it. + refute_grep -qF "features/calendar-sharing/PRD.md#oq-1" <<< "$output" + run python3 "$OPEN_QUESTIONS" index --pending calendar-sharing "$BUNDLE" + [ "$status" -eq 0 ] + grep -qF "[features/calendar-sharing/PRD.md#oq-2]" "$BUNDLE/open-questions.md" + refute_grep -qF "[features/calendar-sharing/PRD.md#oq-1]" "$BUNDLE/open-questions.md" +} + +@test "the pending contract says valid rows count and 0.1.0 rows are read by hand, in one voice" { + local note mod skill + note=$(awk '/^## / { on = ($0 == "## While modernization is in progress") } on' "$SCRIPT_DIR/references/open-questions.md" | tr -s '\n ' ' ') + mod=$(joined "$SCRIPT_DIR/references/modernization.md") + skill=$(joined "$SCRIPT_DIR/SKILL.md") + grep -q "A valid row in a pending folder counts: it is indexed, and \`blocking\` sees it" <<< "$note" + grep -q "Rows in a table still in the 0.1.0 format are skipped" <<< "$note" + refute_grep -q "invisible to \`blocking\`" <<< "$note" + grep -q "a valid row there counts, indexed and seen by \`blocking\`" <<< "$mod" + grep -q "the rows of tables still in the 0.1.0 format" <<< "$skill" +} + @test "open-questions: a feature converted earlier stays validated and indexed while another is pending" { indexed_bundle convert_other @@ -1264,3 +1299,42 @@ EOF [ "$status" -eq 0 ] [[ "$output" == *"0 errors"* ]] } + +# --- Other workflows while modernization is in progress --- + +# Prints the open-questions and profile index and check commands in the +# fenced blocks of FILE between the lines matching START and END. +reference_commands() { + sed -n "/$2/,/$3/p" "$1" | + awk '/^ *```/ { fence = !fence; next } fence { sub(/^ +/, ""); print }' | + grep -E '^python3 "/scripts/(open-questions|okf-profile)\.py" (index|check) ' +} + +@test "fixture: the promotion and canonization index and check commands, as written, pass with a folder pending" { + local commands command before after + commands=$(reference_commands "$SCRIPT_DIR/references/ratification.md" '^5\. \*\*Indexes' '^6\. \*\*Promotion review') + commands+=$'\n'$(reference_commands "$SCRIPT_DIR/references/canonization.md" '^### 4\. Archive the change' '^### 5\. ') + [ "$(grep -c . <<< "$commands")" -eq 6 ] || { echo "$commands" >&2; return 1; } + mkdir -p "$WORK/docs" + cp -R "$BUNDLE_EXPECTED" "$WORK/docs/product" + before=$(cd "$WORK/docs/product/features/calendar-sharing" && find . -type f -exec shasum {} + | sort) + while IFS= read -r command; do + command=${command//""/$SCRIPT_DIR} + command=${command//"{unconverted}"/calendar-sharing} + run bash -c 'cd "$1" && eval "$2"' _ "$WORK" "$command" + [ "$status" -eq 0 ] || { echo "$command: $output" >&2; return 1; } + done <<< "$commands" + # Nothing was written into the folder not yet converted. + after=$(cd "$WORK/docs/product/features/calendar-sharing" && find . -type f -exec shasum {} + | sort) + [ "$before" = "$after" ] + [ -f "$WORK/docs/product/features/event-reminders/index.md" ] +} + +@test "every workflow that runs an open-questions or profile command links the shared note on pending folders" { + local file + for file in SKILL.md references/ratification.md references/canonization.md references/open-question-triage.md \ + references/product-vision.md references/implementation-handoff.md references/okf-profile.md references/initialization.md; do + grep -qF 'open-questions.md#while-modernization-is-in-progress' "$SCRIPT_DIR/$file" \ + || { echo "$file: no link to the shared note" >&2; return 1; } + done +} diff --git a/plugins/product-development/skills/product-development/tests/okf-profile.bats b/plugins/product-development/skills/product-development/tests/okf-profile.bats index 47c6b1e..6b41a69 100644 --- a/plugins/product-development/skills/product-development/tests/okf-profile.bats +++ b/plugins/product-development/skills/product-development/tests/okf-profile.bats @@ -65,6 +65,31 @@ drop_key() { # --- Reference --- +@test "every script invocation in SKILL.md, the references, the templates and init.sh's output uses the installed skill's path" { + local bare out + local -a docs + # A command line names the script, then a subcommand, path or flag. The + # scripts stay in the installed skill; init.sh copies none of them. The + # templates are scaffolded into projects, so they follow the same rule. + docs=("$SCRIPT_DIR/SKILL.md" "$SCRIPT_DIR"/references/*.md) + while IFS= read -r file; do docs+=("$file"); done < <(find "$SCRIPT_DIR/templates" -type f -name '*.tmpl') + bare=$(grep -nE '(^|[^>/[:alnum:]_-])(\./)?scripts/(open-questions|okf-profile|feature-tags)\.py"? [a-z./-]|(^|[^>/[:alnum:]_-])(\./)?scripts/init\.sh"? [a-z./-]' \ + "${docs[@]}" || true) + [ -z "$bare" ] || { echo "$bare" >&2; return 1; } + # A script named with no path at all, then a subcommand, is bare too. + bare=$(grep -nE '(^|[^/[:alnum:]_-])(open-questions|okf-profile|feature-tags)\.py"? (index|check|blocking)' \ + "${docs[@]}" || true) + [ -z "$bare" ] || { echo "$bare" >&2; return 1; } + # init.sh prints its next steps with the scripts' installed path. + mkdir -p "$WORK/project" + out=$("$SCRIPT_DIR/scripts/init.sh" "$WORK/project" --non-interactive --project-name "X") + bare=$(grep -E '(open-questions|okf-profile|feature-tags)\.py' <<< "$out" | grep -vF "\"$SCRIPT_DIR/scripts/" || true) + [ -z "$bare" ] || { echo "$bare" >&2; return 1; } + grep -qF 'python3 "/scripts/open-questions.py" index docs/product' "$SCRIPT_DIR/templates/open-questions.md.tmpl" + grep -qF 'python3 "/scripts/open-questions.py" check docs/product' "$SCRIPT_DIR/SKILL.md" + grep -qF '`scripts/init.sh` does not copy them into the project' "$SCRIPT_DIR/SKILL.md" +} + @test "profile reference names the closed type list and links the status tables it reuses" { [ -f "$REF" ] local type diff --git a/plugins/product-development/skills/product-development/tests/open-questions.bats b/plugins/product-development/skills/product-development/tests/open-questions.bats index c26deee..6a33b11 100644 --- a/plugins/product-development/skills/product-development/tests/open-questions.bats +++ b/plugins/product-development/skills/product-development/tests/open-questions.bats @@ -181,7 +181,7 @@ assert_index_links_resolve() { ship=$(sed -n '/^### Ship Signal and Canonization/,/^## /p' "$skill") grep -q '^\*\*Trigger:\*\* .*about to fire the ship signal' <<< "$release" grep -q "release-level" <<< "$release" - grep -q "open-questions.py blocking" <<< "$release" + grep -qF 'open-questions.py" blocking' <<< "$release" grep -q '^\*\*Gate:\*\* Do not fire the ship signal until' <<< "$release" grep -q "^\*\*Trigger:\*\* The project's ship signal fires" <<< "$ship" refute_grep -qi "before the ship signal fires" <<< "$ship" @@ -193,8 +193,10 @@ assert_index_links_resolve() { local skill="$SCRIPT_DIR/SKILL.md" release release=$(sed -n '/^### Release Check/,/^### Ship Signal and Canonization/p' "$skill") grep -q "delivery-plan step" <<< "$release" - grep -qF 'scripts/open-questions.py blocking docs/product roadmap.md#broader-rollout --level release' <<< "$release" + grep -qF 'python3 "/scripts/open-questions.py" blocking docs/product roadmap.md#broader-rollout --level release' <<< "$release" grep -q "run both checks" <<< "$release" + grep -q "questions that block the whole delivery plan" <<< "$release" + grep -q "blocks every step in it" <<< "$(joined "$REF")" grep -qE '^\| About to execute a step in the delivery plan \| Release Check \|$' "$skill" grep -q "A step in the delivery plan is checked before the step is executed" <<< "$(joined "$REF")" } @@ -425,6 +427,31 @@ assert_index_links_resolve() { [[ "$output" == *"No open question holds roadmap.md#broader-rollout"* ]] } +@test "a release check on a delivery-plan step also lists the plan's questions that block the whole plan" { + cat > "$B/roadmap.md" <<'MD' +# Delivery plan + +## Broader rollout + +Every calendar, once invite expiry is live. + +## Open Questions + +| ID | Question | Blocking level | Blocks | Resolution | Deferred to | Approval | +|----|----------|----------------|--------|------------|-------------|----------| +| OQ-1 | Does every region allow the expiry notice wording? | release | this document | research | — | — | +| OQ-2 | Which regions go first? | release | [Rollout plan](roadmap.md) | maintainer decision | — | — | +MD + run "$OQ" blocking "$B" roadmap.md#broader-rollout --level release + [ "$status" -eq 1 ] + [[ "$output" == *"roadmap.md#oq-1 release"* ]] + [[ "$output" == *"roadmap.md#oq-2 release"* ]] + + # A whole-document question holds only steps of its own document. + run "$OQ" blocking "$B" shared-calendars/invite-expiry --level release + [[ "$output" != *"roadmap.md#oq-"* ]] +} + @test "a question table with or without outer pipes holds its change" { local form for form in 's/^//' 's/^|//; s/|$//' 's/^|//'; do @@ -860,3 +887,15 @@ expect_refused() { run "$OQ" index "$B" [ "$status" -eq 0 ] } + +@test "--help says valid rows in a pending folder still count and only 0.1.0 tables are skipped" { + local command text + for command in index check blocking; do + run python3 "$OQ" "$command" --help + [ "$status" -eq 0 ] + text=$(tr -s '\n ' ' ' <<< "$output") + grep -qF "valid rows there still count" <<< "$text" || { echo "$command: $output" >&2; return 1; } + grep -qF "rows of tables still in the 0.1.0 format are skipped" <<< "$text" + refute_grep -qF "skip features/FEATURE/" <<< "$text" + done +} diff --git a/plugins/product-development/skills/product-development/tests/vision-anatomy.bats b/plugins/product-development/skills/product-development/tests/vision-anatomy.bats index fc4bd8a..a1a9d60 100644 --- a/plugins/product-development/skills/product-development/tests/vision-anatomy.bats +++ b/plugins/product-development/skills/product-development/tests/vision-anatomy.bats @@ -195,7 +195,7 @@ PYCHECK @test "splitting a vision redirects live question links to the register and regenerates the index" { split="$(section "Splitting an existing vision")" grep -qF 'vision.md#oq-' <<< "$split" - grep -qF 'scripts/open-questions.py index' <<< "$split" + grep -qF 'python3 "/scripts/open-questions.py" index' <<< "$split" } @test "splitting a vision keeps or reclassifies each moved row's Blocks target and rebases its links" {