Skip to content

fix(scripts): generate-scenario-docs.sh reads its Markdown groups from the project file - #194

Merged
clabonte merged 1 commit into
mainfrom
fix/scenario-docs-groups-from-project-file
Oct 29, 2026
Merged

clabonte merged 1 commit into
mainfrom
fix/scenario-docs-groups-from-project-file

Conversation

@clabonte

Copy link
Copy Markdown
Collaborator

Closes #191

Problem. generate-scenario-docs.sh ran two hardcoded group names (Documentation - Scenarios, Documentation - Technical References) and cleaned and counted a hardcoded docs/generated. A project whose Markdown groups have other names or destinations, including the handbook's own single Documentation group example, got a generator error or a summary of the wrong folder.

Changes

  • The script runs every group with "language": "markdown" (same aliases as generate.sh --lang) from <name>-project.json, one generator call per group.
  • --clean removes each Markdown group's destination, with one exception: it never removes a destination that is outside the repo, is the repo root, or holds api/docs/flows/ or api/specs/. Without that guard, a scenarios group writing to ./api/docs would have wiped the hand-written docs and the flow specs. Scenario pages are still deleted file by file, as before.
  • The summary lists and counts each destination. It skips a destination that contains api/docs/flows/, because the scenario count already covers it.
  • With no Markdown group, the script prints a clear message and exits 1, before calling the generator.
  • The summary no longer kills the run when api/docs/flows/ doesn't exist. Before this change, set -o pipefail plus a failing find exited non-zero after a successful generation.
  • One reader. The project-file parsing moves out of generate.sh into a sourced scripts/specfuse/project-file.sh (find_project_file, groups_tsv, config_value, canon_lang), and both scripts use it. api/docs/flows stays fixed until Project-configurable paths: honour layout.yml paths: keys in skills, templates and scripts #184.
  • The generate skill (step 6) and the scripts README now describe what the script actually does. The handbook example (Documentation → ./docs/generated) needed no change, because it now works as written.

A note on the issue's first acceptance criterion. The project-init project file declares "groups": [], so it never had the two groups the issue and the old skill text describe. Before this change, running the script on a fresh scaffold failed inside the generator. Now it stops early with "No Markdown group". To show that projects which did define the two old groups behave the same, CI uses a fixture with exactly those groups.

Tests. A new CI step runs on a copy of the scaffold, with bundling stubbed and a fake SPECFUSE_AUTHORING that records each generator call:

  • no Markdown group: exits non-zero, says so, and calls no generator;
  • the two old groups plus a C# group: exactly 2 calls, the C# group skipped; --clean removes docs/generated and keeps api/docs; scenario summary present;
  • the handbook-style single group writing to ./docs/reference: exactly one call, that folder listed, counted and cleaned.

Run locally against a scaffold built from source, by extracting the step's script from the YAML: passes. The generate.sh behaviour #170's step checks (--list, empty selection, unknown group, --lang md --dry-run) is unchanged. shellcheck -x is clean on the new and changed lines, and check-shipped-docs.py is OK.

No compatibility.md row; that's added at release time.

🤖 Generated with Claude Code

…m the project file

The script ran two hardcoded group names and cleaned and counted a hardcoded
docs/generated, so a project whose Markdown groups had other names or
destinations got a generator error or a summary of the wrong folder. It now:

- runs every group with "language": "markdown" in <name>-project.json;
- cleans and counts each group's destination, but never removes one outside
  the repo, the repo root, or a folder holding api/docs/flows or api/specs;
- exits non-zero with a clear message when there is no Markdown group;
- no longer dies on its summary when api/docs/flows does not exist.

The project-file reader moves out of generate.sh into project-file.sh, which
both scripts source, so there is one reader. api/docs/flows stays fixed until
the layout work in #184.

Closes #191

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clabonte
clabonte force-pushed the fix/scenario-docs-groups-from-project-file branch from ca03770 to 8b664f3 Compare October 29, 2026 14:46
@clabonte
clabonte merged commit ed0b605 into main Oct 29, 2026
9 checks passed
@clabonte
clabonte deleted the fix/scenario-docs-groups-from-project-file branch October 29, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

generate-scenario-docs.sh hardcodes generator groups and output folders instead of reading the project file

1 participant