|
| 1 | +--- |
| 2 | +name: new-revision |
| 3 | +description: Scaffold a new revision of an existing document by copying the latest version folder to a new version, setting the draft flag, and creating an appropriately-prefixed git branch for the review process. |
| 4 | +--- |
| 5 | + |
| 6 | +# New Revision |
| 7 | + |
| 8 | +Scaffold a new revision of an existing document on the RMC documentation site. Copies the latest version folder to a new version directory, marks the document as draft, and creates a `docs/major/` or `docs/minor/` branch ready for the review workflow. |
| 9 | + |
| 10 | +**Arguments:** `$ARGUMENTS` — optional. If provided, use as hints for the prompts below (e.g., a document path or version number). Still confirm each value with the user before proceeding. |
| 11 | + |
| 12 | +## Step 1: Gather Information via Interactive Prompts |
| 13 | + |
| 14 | +Prompt the user for each value, one at a time. Show sensible defaults where possible. Do NOT proceed until all values are confirmed. |
| 15 | + |
| 16 | +### 1a — Document selection |
| 17 | + |
| 18 | +Ask: "Which existing document are you revising?" |
| 19 | + |
| 20 | +Read [static/versions/latestVersions.json](static/versions/latestVersions.json) and present the keys as a numbered list. The user picks one. The selected key is the `docBasePath` (e.g., `desktop-applications/lifesim/users-guide`). |
| 21 | + |
| 22 | +The corresponding value in the JSON is the `currentVersion` (e.g., `v1.0`). |
| 23 | + |
| 24 | +### 1b — Revision type |
| 25 | + |
| 26 | +Ask: "Is this a major revision or a minor revision?" |
| 27 | + |
| 28 | +- **Major revision** — substantial changes warranting a new major version. Branch prefix: `docs/major/`. Goes through Lane 2 (Peer → Lead Civil review). |
| 29 | +- **Minor revision** — smaller updates warranting a minor version bump. Branch prefix: `docs/minor/`. Goes through Lane 3 (Peer review only). |
| 30 | + |
| 31 | +### 1c — New version number |
| 32 | + |
| 33 | +Compute the default based on revision type: |
| 34 | +- Major: increment the major component, reset minor to 0 (e.g., `v1.0` → `v2.0`, `v1.5` → `v2.0`). |
| 35 | +- Minor: increment the minor component (e.g., `v1.0` → `v1.1`, `v1.5` → `v1.6`). |
| 36 | + |
| 37 | +Ask: "The new version will be `{newVersion}`. Is that correct, or would you like a different version number?" |
| 38 | + |
| 39 | +### 1d — Branch name |
| 40 | + |
| 41 | +Compute the default branch name as `docs/{major|minor}/{slug}-{newVersionWithoutV}` where `{slug}` is the last segment of the docBasePath (e.g., `users-guide`). Example: `docs/major/users-guide-v2.0`. |
| 42 | + |
| 43 | +Ask: "I'll use branch name `{branchName}`. Is that correct, or would you like a different name?" |
| 44 | + |
| 45 | +### 1e — Confirmation |
| 46 | + |
| 47 | +Display a summary: |
| 48 | + |
| 49 | +``` |
| 50 | +Document: {docBasePath} |
| 51 | +Current version: {currentVersion} |
| 52 | +New version: {newVersion} |
| 53 | +Revision type: {major|minor} |
| 54 | +Branch: {branchName} |
| 55 | +Source folder: docs/{docBasePath}/{currentVersion}/ |
| 56 | +Target folder: docs/{docBasePath}/{newVersion}/ |
| 57 | +Figures source: static/figures/{docBasePath}/{currentVersion}/ |
| 58 | +Figures target: static/figures/{docBasePath}/{newVersion}/ |
| 59 | +Bibliography: static/bibliographies/{docBasePath}/{newVersion}/bib.json |
| 60 | +``` |
| 61 | + |
| 62 | +Ask: "Does this look correct? (yes/no)" |
| 63 | + |
| 64 | +If no, ask which value to change and loop back. |
| 65 | + |
| 66 | +## Step 2: Create the git branch |
| 67 | + |
| 68 | +Create and check out the branch from the current `main` (not from the user's current branch — start clean): |
| 69 | + |
| 70 | +```bash |
| 71 | +git fetch origin main |
| 72 | +git checkout -b {branchName} origin/main |
| 73 | +``` |
| 74 | + |
| 75 | +If the branch already exists, abort and report the conflict to the user. |
| 76 | + |
| 77 | +## Step 3: Copy the version folder |
| 78 | + |
| 79 | +Copy the entire current version directory to the new version directory: |
| 80 | + |
| 81 | +```bash |
| 82 | +cp -r docs/{docBasePath}/{currentVersion}/ docs/{docBasePath}/{newVersion}/ |
| 83 | +``` |
| 84 | + |
| 85 | +Then copy the figures folder: |
| 86 | + |
| 87 | +```bash |
| 88 | +cp -r static/figures/{docBasePath}/{currentVersion}/ static/figures/{docBasePath}/{newVersion}/ |
| 89 | +``` |
| 90 | + |
| 91 | +Then copy the bibliography folder: |
| 92 | + |
| 93 | +```bash |
| 94 | +cp -r static/bibliographies/{docBasePath}/{currentVersion}/ static/bibliographies/{docBasePath}/{newVersion}/ |
| 95 | +``` |
| 96 | + |
| 97 | +If any source folder doesn't exist, skip it and note in the final report. |
| 98 | + |
| 99 | +## Step 4: Update the version history file |
| 100 | + |
| 101 | +Read `docs/{docBasePath}/{newVersion}/00-version-history.mdx` and add a new placeholder row at the top of the `TableVersionHistory` props arrays: |
| 102 | + |
| 103 | +- `versions`: prepend the new version number without the `v` prefix (e.g., `'2.0'`) |
| 104 | +- `dates`: prepend the current month and year (e.g., `'April 2026'`) |
| 105 | +- `descriptions`: prepend `'Placeholder — describe the changes in this revision.'` |
| 106 | +- `modifiedBy`: prepend `'Enter author name'` |
| 107 | +- `reviewedBy`: prepend `'-'` |
| 108 | +- `approvedBy`: prepend `'-'` |
| 109 | + |
| 110 | +The author will fill in the actual values during the PR. The site admin will fill in `reviewedBy`/`approvedBy` at merge time. |
| 111 | + |
| 112 | +## Step 5: Set the draft flag |
| 113 | + |
| 114 | +Find the document's entry in the appropriate landing page JS file (search `src/pages/` for the `doc_location` matching `{docBasePath}`). Common locations: |
| 115 | + |
| 116 | +- Desktop apps: `src/pages/desktop-applications/{software}.js` |
| 117 | +- Toolboxes: `src/pages/toolboxes/{suite}.js` |
| 118 | +- Web apps: `src/pages/web-applications/{software}.js` |
| 119 | +- Dev: `src/pages/dev.js` |
| 120 | + |
| 121 | +In the matching entry, change `draft: false` to `draft: true`. |
| 122 | + |
| 123 | +> Note: this flips the draft flag on the *currently published* version too, since the flag is per-document, not per-version. The version-aware watermark logic in [src/theme/DocItem/index.js](src/theme/DocItem/index.js) ensures the watermark only appears on the *latest* version of a flagged document. Until this PR is merged, the latest version on the live site is still the previous version, which will not be watermarked. Once merged, the new version becomes latest and (briefly, until the site admin flips the flag back to `false`) the watermark will appear on it. |
| 124 | +
|
| 125 | +## Step 6: Run generation scripts |
| 126 | + |
| 127 | +Run the build generation scripts to pick up the new version: |
| 128 | + |
| 129 | +```bash |
| 130 | +npm run sidebars && npm run counters && npm run versions |
| 131 | +``` |
| 132 | + |
| 133 | +Verify no errors. If errors occur, diagnose and fix. |
| 134 | + |
| 135 | +## Step 7: Verify and report |
| 136 | + |
| 137 | +1. Glob to confirm the new version folder exists at `docs/{docBasePath}/{newVersion}/` |
| 138 | +2. Confirm the version history file has the new row |
| 139 | +3. Confirm the landing page JS has `draft: true` |
| 140 | +4. Confirm the branch is checked out (`git branch --show-current`) |
| 141 | +5. Report a summary to the user: |
| 142 | + |
| 143 | +``` |
| 144 | +New revision scaffolded successfully! |
| 145 | +
|
| 146 | +Document: {docBasePath} |
| 147 | +Old version: {currentVersion} |
| 148 | +New version: {newVersion} |
| 149 | +Branch: {branchName} |
| 150 | +
|
| 151 | +Created: |
| 152 | + - docs/{docBasePath}/{newVersion}/ (copied from {currentVersion}) |
| 153 | + - static/figures/{docBasePath}/{newVersion}/ (copied) |
| 154 | + - static/bibliographies/{docBasePath}/{newVersion}/ (copied) |
| 155 | +
|
| 156 | +Modified: |
| 157 | + - docs/{docBasePath}/{newVersion}/00-version-history.mdx (new placeholder row) |
| 158 | + - {landing page JS file} (draft: true) |
| 159 | +
|
| 160 | +Next steps: |
| 161 | + 1. Edit the new version's MDX files to make your changes |
| 162 | + 2. Update 00-version-history.mdx with a real description and your name |
| 163 | + 3. Run `npm start` to preview locally |
| 164 | + 4. When ready, commit and open a PR (the workflow will detect the branch prefix and start {Lane 2: Peer → Lead Civil | Lane 3: Peer review} automatically) |
| 165 | +``` |
0 commit comments