its-magic 0.1.2-32 → 0.1.2-33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -280,7 +280,7 @@ Generated test scaffolding + auto-run behavior (US-0066):
280
280
  - Static baseline test pass does not bypass runtime autopilot; runtime verdict
281
281
  remains mandatory for QA PASS.
282
282
 
283
- ## Workflow
283
+ ## Commands and workflow
284
284
 
285
285
  ### Core commands
286
286
 
@@ -1014,25 +1014,32 @@ the safety cap (`AUTO_LOOP_MAX_CYCLES`) is reached.
1014
1014
 
1015
1015
  #### Layer 2: Local validate-and-push
1016
1016
 
1017
- Run before pushing to catch anything the AI loop missed:
1017
+ Run before pushing to catch anything the AI loop missed. **Merged scratchpad** (see
1018
+ `docs/engineering/runbook.md`, **Executable validate-and-push wiring (DEC-0058)**) gates
1019
+ **`git push`**: default **`SYNC_POLICY_MODE=manual`** and **`ALLOW_AUTO_PUSH=0`** exit early
1020
+ with a **reason code** (no push). Opt-in push requires an eligible mode, **`ALLOW_AUTO_PUSH=1`**,
1021
+ a non-empty **branch allowlist** match, passing **runbook** checks, and bounded **QA** rules.
1018
1022
 
1019
1023
  ```bash
1020
- # Bash (Linux / macOS)
1021
- sh scripts/validate-and-push.sh
1024
+ # Bash (Linux / macOS; bash required for this script)
1025
+ bash scripts/validate-and-push.sh
1022
1026
 
1023
1027
  # PowerShell (Windows)
1024
1028
  powershell scripts/validate-and-push.ps1
1025
1029
  powershell scripts/validate-and-push.ps1 -MaxAttempts 3
1030
+ powershell scripts/validate-and-push.ps1 -DryRun
1026
1031
  ```
1027
1032
 
1028
1033
  The script:
1029
- 1. Runs `FORMAT_COMMAND` and `LINT_FIX_COMMAND` to auto-fix what it can
1030
- 2. Runs `LINT_COMMAND` and `TEST_COMMAND` to verify
1031
- 3. If checks fail, pauses and waits for you to fix
1032
- 4. Re-runs (up to 5 attempts, configurable)
1033
- 5. When green, commits and pushes automatically
1034
+ 1. Evaluates merged scratchpad policy via **`python scripts/sync_push_gates.py`** (Python 3 on PATH)
1035
+ 2. Runs `FORMAT_COMMAND` and `LINT_FIX_COMMAND` to auto-fix what it can
1036
+ 3. Runs `LINT_COMMAND`, optional `TYPECHECK_COMMAND`, and `TEST_COMMAND` to verify (with `TEST_TIMEOUT_SECONDS` when `timeout`/`gtimeout` is available on Unix)
1037
+ 4. If checks fail, pauses and waits for you to fix
1038
+ 5. Re-runs (up to 5 attempts, configurable)
1039
+ 6. When green, re-checks allowlist + QA scan, then commits and pushes automatically (unless dry-run / no-commit)
1034
1040
 
1035
- Use `-NoCommit` (PowerShell) or `false` as third arg (Bash) to skip auto-push.
1041
+ Use `-NoCommit` (PowerShell), **`--dry-run`** first arg (Bash), or `false` as third arg (Bash) to skip **push**.
1042
+ **Policy-only** interpretation of scratchpad sync flags is **deprecated** for these scripts; see **`decisions/DEC-0058.md`** (policy semantics remain **`DEC-0018`** / **`US-0038`**).
1036
1043
 
1037
1044
  #### Layer 3: CI auto-fix (GitHub Actions)
1038
1045
 
@@ -1062,7 +1069,7 @@ push / PR ──> checks ──> PASS ──> done
1062
1069
  Auto-fix commits appear as `ci: auto-fix attempt N/3`. After 3 retries the
1063
1070
  workflow stops and points you to `scripts/validate-and-push` for local fixing.
1064
1071
 
1065
- ## Examples
1072
+ ## Walkthrough examples
1066
1073
 
1067
1074
  ### Example 1: New feature from idea
1068
1075
 
@@ -1354,3 +1361,44 @@ flowchart TD
1354
1361
  - `sprints/Sxxxx/*`: sprint scope, tasks, progress, QA findings, summary.
1355
1362
  - `decisions/*`: decision records.
1356
1363
  - `handoffs/*`: role-to-role transfer notes.
1364
+
1365
+ ## Purpose
1366
+
1367
+ This repository publishes the **its-magic** workflow kit: commands, rules, skills, and
1368
+ documentation templates that teams install into their own repositories. The goal is a
1369
+ repeatable, file-backed lifecycle from intake through release.
1370
+
1371
+ ## Quickstart
1372
+
1373
+ Use [Setup](#setup) for install commands. First-time install:
1374
+
1375
+ ```bash
1376
+ npx its-magic --target . --mode missing --create
1377
+ ```
1378
+
1379
+ ## Examples
1380
+
1381
+ - Upgrade an existing repo: `its-magic --target . --mode upgrade`
1382
+ - Run check-in tests: use `TEST_COMMAND` from `docs/engineering/runbook.md` (often `sh tests/run-tests.sh`).
1383
+
1384
+ ## Related documentation
1385
+
1386
+ - Operator commands and gates: `docs/engineering/runbook.md`
1387
+ - Architecture and story contracts: `docs/engineering/architecture.md`
1388
+ - Product backlog and acceptance: `docs/product/backlog.md`, `docs/product/acceptance.md`
1389
+ - Optional spec-pack mode (`SPEC_PACK_MODE=1`): engineering design artifacts under `docs/engineering/` when your team enables it
1390
+ - Optional user guides (`USER_GUIDE_MODE=1`): `docs/user-guides/` when enabled
1391
+
1392
+ ## Limitations
1393
+
1394
+ - its-magic is a **process and documentation** framework; it does not replace your
1395
+ application runtime, hosting, or product-specific compliance work.
1396
+ - Mixed files such as `README.md` are preserved on upgrade; review notices may appear when
1397
+ the template adds new sections.
1398
+ - Documentation profile validation (`scripts/validate_doc_profile.py`) enforces audience and
1399
+ depth choices from the merged scratchpad (`DOC_AUDIENCE_PROFILE`, `DOC_DETAIL_LEVEL`).
1400
+
1401
+ ## Contributing
1402
+
1403
+ Contributor-focused workflow and guardrails live in
1404
+ [`docs/developer/README.md`](docs/developer/README.md).
package/installer.ps1 CHANGED
@@ -122,6 +122,7 @@ function Classify-File($RelPath) {
122
122
  '.cursor/hooks/',
123
123
  '.github/workflows/',
124
124
  'scripts/validate-and-push',
125
+ 'scripts/sync_push_gates',
125
126
  'docs/engineering/context/',
126
127
  'its_magic/'
127
128
  )
package/installer.py CHANGED
@@ -280,6 +280,18 @@ def materialize_scratchpad_baseline(target_root, source_root, mode, print_ok=Tru
280
280
  return True
281
281
 
282
282
 
283
+ def _doc_profile_sync(target_root, merged, print_ok=True):
284
+ """Append missing normative README/developer doc sections from merged profile (non-destructive)."""
285
+ scripts_dir = os.path.join(normalize(os.path.dirname(__file__)), "scripts")
286
+ if scripts_dir not in sys.path:
287
+ sys.path.insert(0, scripts_dir)
288
+ import doc_profile_lib
289
+
290
+ notes = doc_profile_lib.ensure_doc_surfaces_merged(merged, target_root, print_ok=print_ok)
291
+ bad = [ln for ln in notes if ln.startswith("[DOC_PROFILE_INVALID]")]
292
+ return (not bad), notes
293
+
294
+
283
295
  def run_scratchpad_postinstall(target_root, source_root, mode, print_ok=True):
284
296
  if not materialize_scratchpad_example(target_root, source_root, print_ok=print_ok):
285
297
  return False
@@ -288,6 +300,13 @@ def run_scratchpad_postinstall(target_root, source_root, mode, print_ok=True):
288
300
  ok, diagnostics = validate_merged_scratchpad(target_root)
289
301
  for line in diagnostics:
290
302
  print(line)
303
+ if ok:
304
+ merged, _paths = merge_scratchpad_layers(target_root)
305
+ dp_ok, dp_notes = _doc_profile_sync(target_root, merged, print_ok=print_ok)
306
+ for line in dp_notes:
307
+ print(line)
308
+ if not dp_ok:
309
+ ok = False
291
310
  if ok and print_ok:
292
311
  loc = os.path.join(target_root, SCRATCHPAD_LOCAL_REL)
293
312
  if os.path.isfile(loc):
package/installer.sh CHANGED
@@ -157,7 +157,7 @@ classify_file() {
157
157
  README.md) echo "mixed" ;;
158
158
  .cursor/commands/*|.cursor/rules/*|.cursor/agents/*|.cursor/skills/*) echo "framework" ;;
159
159
  .cursor/hooks/*|.cursor/hooks.json|.cursor/scratchpad.local.example.md) echo "framework" ;;
160
- .github/workflows/*|scripts/validate-and-push*|docs/engineering/context/*|its_magic/*) echo "framework" ;;
160
+ .github/workflows/*|scripts/validate-and-push*|scripts/sync_push_gates.py|docs/engineering/context/*|its_magic/*) echo "framework" ;;
161
161
  .its-magic-version|its_magic/.its-magic-version|its_magic/README.md) echo "framework" ;;
162
162
  docs/product/*|docs/engineering/*|docs/user-guides/*) echo "user-data" ;;
163
163
  sprints/*|handoffs/*|decisions/*) echo "user-data" ;;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "its-magic",
3
- "version": "0.1.2-32",
3
+ "version": "0.1.2-33",
4
4
  "description": "its-magic - AI dev team workflow for Cursor.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -193,7 +193,14 @@ Release gate semantics (US-0039): mandatory gates (check-in test, QA, UAT) and n
193
193
  scan roots in `scripts/check-user-visible-metadata.py` **and** this runbook
194
194
  section together or fail closed with `METADATA_SANITIZATION_SCOPE_AMBIGUOUS`
195
195
  semantics at QA/release.
196
- 21. Triad hot-surface enforcement (DEC-0054):
196
+ 21. Documentation profile validation (US-0077 / DEC-0059):
197
+ - When you change `README.md`, `docs/developer/README.md`, scratchpad profile keys
198
+ (`DOC_AUDIENCE_PROFILE`, `DOC_DETAIL_LEVEL`), or `scripts/doc_profile_lib.py` /
199
+ `scripts/validate_doc_profile.py`, run `python scripts/validate_doc_profile.py --repo <root>`.
200
+ - Fail closed on `DOC_PROFILE_INVALID`, `DOC_PROFILE_MERGE_ERROR`,
201
+ `DOC_SECTION_MISSING:*`, `DOC_SECTION_BUDGET_EXCEEDED`, or `DOC_TEMPLATE_PARITY_FAIL`
202
+ (see `docs/engineering/runbook.md`).
203
+ 22. Triad hot-surface enforcement (DEC-0054):
197
204
  - Before completing `/execute`, run
198
205
  `python scripts/enforce-triad-hot-surface.py --check` from repository root
199
206
  (or `--repo <root>`).
@@ -24,7 +24,7 @@ globs: ["**/*"]
24
24
  (local pre-push) → CI auto-fix (GitHub Actions). Each layer catches issues
25
25
  the previous layer missed.
26
26
  - Before pushing, recommend running `scripts/validate-and-push.ps1` (Windows)
27
- or `scripts/validate-and-push.sh` (Linux/Mac) to catch failures locally.
27
+ or `bash scripts/validate-and-push.sh` (Linux/Mac) to catch failures locally.
28
28
  - `LINT_FIX_COMMAND` and `FORMAT_COMMAND` in the runbook enable automatic
29
29
  formatting/lint fixes both locally and in CI.
30
30
  - Remote config validation errors (when `REMOTE_EXECUTION=1`) must be fail-fast
@@ -196,3 +196,9 @@ SPEC_PACK_MODE=0
196
196
  # - USER_GUIDE_MODE: 0|1 (enable per-feature user guides at docs/user-guides/US-xxxx.md; default 0)
197
197
  # When 0, intake/architecture/sprint-plan/execute/qa/release add no required user-guide steps or blocking checks.
198
198
  USER_GUIDE_MODE=0
199
+
200
+ # Documentation audience profile (DEC-0059)
201
+ # - DOC_AUDIENCE_PROFILE: user|developer|both (empty -> both during transition)
202
+ # - DOC_DETAIL_LEVEL: concise|balanced|technical-deep (empty -> balanced during transition)
203
+ DOC_AUDIENCE_PROFILE=both
204
+ DOC_DETAIL_LEVEL=balanced
@@ -197,3 +197,9 @@ SPEC_PACK_MODE=0
197
197
  # When 0, intake/architecture/sprint-plan/execute/qa/release add no required user-guide steps or blocking checks.
198
198
  USER_GUIDE_MODE=0
199
199
 
200
+ # Documentation audience profile (DEC-0059)
201
+ # - DOC_AUDIENCE_PROFILE: user|developer|both (empty -> both during transition)
202
+ # - DOC_DETAIL_LEVEL: concise|balanced|technical-deep (empty -> balanced during transition)
203
+ DOC_AUDIENCE_PROFILE=both
204
+ DOC_DETAIL_LEVEL=balanced
205
+
@@ -186,7 +186,7 @@ jobs:
186
186
  echo ""
187
187
  echo "What to do next:"
188
188
  echo " 1. Pull the latest changes"
189
- echo " 2. Run: sh scripts/validate-and-push.sh"
189
+ echo " 2. Run: bash scripts/validate-and-push.sh"
190
190
  echo " (or: powershell scripts/validate-and-push.ps1)"
191
191
  echo " 3. Fix failures, the script loops until green, then pushes."
192
192
 
@@ -280,7 +280,7 @@ Generated test scaffolding + auto-run behavior (US-0066):
280
280
  - Static baseline test pass does not bypass runtime autopilot; runtime verdict
281
281
  remains mandatory for QA PASS.
282
282
 
283
- ## Workflow
283
+ ## Commands and workflow
284
284
 
285
285
  ### Core commands
286
286
 
@@ -1014,25 +1014,32 @@ the safety cap (`AUTO_LOOP_MAX_CYCLES`) is reached.
1014
1014
 
1015
1015
  #### Layer 2: Local validate-and-push
1016
1016
 
1017
- Run before pushing to catch anything the AI loop missed:
1017
+ Run before pushing to catch anything the AI loop missed. **Merged scratchpad** (see
1018
+ `docs/engineering/runbook.md`, **Executable validate-and-push wiring (DEC-0058)**) gates
1019
+ **`git push`**: default **`SYNC_POLICY_MODE=manual`** and **`ALLOW_AUTO_PUSH=0`** exit early
1020
+ with a **reason code** (no push). Opt-in push requires an eligible mode, **`ALLOW_AUTO_PUSH=1`**,
1021
+ a non-empty **branch allowlist** match, passing **runbook** checks, and bounded **QA** rules.
1018
1022
 
1019
1023
  ```bash
1020
- # Bash (Linux / macOS)
1021
- sh scripts/validate-and-push.sh
1024
+ # Bash (Linux / macOS; bash required for this script)
1025
+ bash scripts/validate-and-push.sh
1022
1026
 
1023
1027
  # PowerShell (Windows)
1024
1028
  powershell scripts/validate-and-push.ps1
1025
1029
  powershell scripts/validate-and-push.ps1 -MaxAttempts 3
1030
+ powershell scripts/validate-and-push.ps1 -DryRun
1026
1031
  ```
1027
1032
 
1028
1033
  The script:
1029
- 1. Runs `FORMAT_COMMAND` and `LINT_FIX_COMMAND` to auto-fix what it can
1030
- 2. Runs `LINT_COMMAND` and `TEST_COMMAND` to verify
1031
- 3. If checks fail, pauses and waits for you to fix
1032
- 4. Re-runs (up to 5 attempts, configurable)
1033
- 5. When green, commits and pushes automatically
1034
+ 1. Evaluates merged scratchpad policy via **`python scripts/sync_push_gates.py`** (Python 3 on PATH)
1035
+ 2. Runs `FORMAT_COMMAND` and `LINT_FIX_COMMAND` to auto-fix what it can
1036
+ 3. Runs `LINT_COMMAND`, optional `TYPECHECK_COMMAND`, and `TEST_COMMAND` to verify (with `TEST_TIMEOUT_SECONDS` when `timeout`/`gtimeout` is available on Unix)
1037
+ 4. If checks fail, pauses and waits for you to fix
1038
+ 5. Re-runs (up to 5 attempts, configurable)
1039
+ 6. When green, re-checks allowlist + QA scan, then commits and pushes automatically (unless dry-run / no-commit)
1034
1040
 
1035
- Use `-NoCommit` (PowerShell) or `false` as third arg (Bash) to skip auto-push.
1041
+ Use `-NoCommit` (PowerShell), **`--dry-run`** first arg (Bash), or `false` as third arg (Bash) to skip **push**.
1042
+ **Policy-only** interpretation of scratchpad sync flags is **deprecated** for these scripts; see **`decisions/DEC-0058.md`** (policy semantics remain **`DEC-0018`** / **`US-0038`**).
1036
1043
 
1037
1044
  #### Layer 3: CI auto-fix (GitHub Actions)
1038
1045
 
@@ -1062,7 +1069,7 @@ push / PR ──> checks ──> PASS ──> done
1062
1069
  Auto-fix commits appear as `ci: auto-fix attempt N/3`. After 3 retries the
1063
1070
  workflow stops and points you to `scripts/validate-and-push` for local fixing.
1064
1071
 
1065
- ## Examples
1072
+ ## Walkthrough examples
1066
1073
 
1067
1074
  ### Example 1: New feature from idea
1068
1075
 
@@ -1354,3 +1361,44 @@ flowchart TD
1354
1361
  - `sprints/Sxxxx/*`: sprint scope, tasks, progress, QA findings, summary.
1355
1362
  - `decisions/*`: decision records.
1356
1363
  - `handoffs/*`: role-to-role transfer notes.
1364
+
1365
+ ## Purpose
1366
+
1367
+ This repository publishes the **its-magic** workflow kit: commands, rules, skills, and
1368
+ documentation templates that teams install into their own repositories. The goal is a
1369
+ repeatable, file-backed lifecycle from intake through release.
1370
+
1371
+ ## Quickstart
1372
+
1373
+ Use [Setup](#setup) for install commands. First-time install:
1374
+
1375
+ ```bash
1376
+ npx its-magic --target . --mode missing --create
1377
+ ```
1378
+
1379
+ ## Examples
1380
+
1381
+ - Upgrade an existing repo: `its-magic --target . --mode upgrade`
1382
+ - Run check-in tests: use `TEST_COMMAND` from `docs/engineering/runbook.md` (often `sh tests/run-tests.sh`).
1383
+
1384
+ ## Related documentation
1385
+
1386
+ - Operator commands and gates: `docs/engineering/runbook.md`
1387
+ - Architecture and story contracts: `docs/engineering/architecture.md`
1388
+ - Product backlog and acceptance: `docs/product/backlog.md`, `docs/product/acceptance.md`
1389
+ - Optional spec-pack mode (`SPEC_PACK_MODE=1`): engineering design artifacts under `docs/engineering/` when your team enables it
1390
+ - Optional user guides (`USER_GUIDE_MODE=1`): `docs/user-guides/` when enabled
1391
+
1392
+ ## Limitations
1393
+
1394
+ - its-magic is a **process and documentation** framework; it does not replace your
1395
+ application runtime, hosting, or product-specific compliance work.
1396
+ - Mixed files such as `README.md` are preserved on upgrade; review notices may appear when
1397
+ the template adds new sections.
1398
+ - Documentation profile validation (`scripts/validate_doc_profile.py`) enforces audience and
1399
+ depth choices from the merged scratchpad (`DOC_AUDIENCE_PROFILE`, `DOC_DETAIL_LEVEL`).
1400
+
1401
+ ## Contributing
1402
+
1403
+ Contributor-focused workflow and guardrails live in
1404
+ [`docs/developer/README.md`](docs/developer/README.md).
@@ -0,0 +1,44 @@
1
+ # Developer documentation
2
+
3
+ This shard holds contributor-facing material for the **its-magic** framework. End-user
4
+ setup stays in the root `README.md` (user channel).
5
+
6
+ ## Prerequisites
7
+
8
+ - **Cursor** (or compatible editor) with the workflow files installed.
9
+ - **Python 3** on PATH for scratchpad merge validation and several repo scripts.
10
+ - **Node.js** if you use npm-packaged `its-magic` or npm-driven `TEST_COMMAND` defaults.
11
+
12
+ ## Workflow
13
+
14
+ - Follow phased commands under `.cursor/commands/` (`intake`, `discovery`, `architecture`,
15
+ `sprint-plan`, `execute`, `qa`, `release`, etc.).
16
+ - Keep handoffs and `docs/engineering/state.md` updated at phase boundaries.
17
+ - Use `.cursor/scratchpad.local.md` for personal overrides; never commit secrets.
18
+
19
+ ## Quality gates
20
+
21
+ - Run `TEST_COMMAND` from `docs/engineering/runbook.md` before push; CI should mirror the same.
22
+ - Run `python scripts/validate_doc_profile.py` when changing documentation profile flags or
23
+ README surfaces.
24
+ - Observe `US-0071` hygiene for user-visible script output (see runbook).
25
+
26
+ ## Architecture notes
27
+
28
+ - High-level contracts live in `docs/engineering/architecture.md` (search for story ids).
29
+ - Installer ownership is driven by `docs/engineering/context/installer-owned-paths.manifest`.
30
+ - Template parity: changes in repo root often require the same edit under `template/`.
31
+
32
+ ## Contracts and interfaces
33
+
34
+ - Scratchpad merge precedence: local → materialized `.cursor/scratchpad.md` →
35
+ `.cursor/scratchpad.local.example.md` (Model B / **DEC-0055**).
36
+ - Documentation profile keys: `DOC_AUDIENCE_PROFILE`, `DOC_DETAIL_LEVEL` (**DEC-0059**).
37
+ - Optional modes: `SPEC_PACK_MODE`, `USER_GUIDE_MODE` remain orthogonal; when `0`, validators
38
+ must not require those artifacts.
39
+
40
+ ## Engineering decisions
41
+
42
+ - Decision records: `decisions/DEC-xxxx.md` and the compact index in
43
+ `docs/engineering/decisions.md`.
44
+ - Profile semantics for this shard: **DEC-0059** and `# US-0077` in `architecture.md`.
@@ -20,6 +20,9 @@ handoffs
20
20
  decisions
21
21
  scripts/validate-and-push.ps1
22
22
  scripts/validate-and-push.sh
23
+ scripts/sync_push_gates.py
24
+ scripts/doc_profile_lib.py
25
+ scripts/validate_doc_profile.py
23
26
  .github/workflows
24
27
  README.md
25
28
  its_magic
@@ -28,12 +31,16 @@ its_magic
28
31
  .cursor
29
32
  docs/product
30
33
  docs/engineering
34
+ docs/developer
31
35
  docs/user-guides
32
36
  sprints
33
37
  handoffs
34
38
  decisions
35
39
  scripts/validate-and-push.ps1
36
40
  scripts/validate-and-push.sh
41
+ scripts/sync_push_gates.py
42
+ scripts/doc_profile_lib.py
43
+ scripts/validate_doc_profile.py
37
44
  .github/workflows/ci.yml
38
45
  .github/workflows/deploy.yml
39
46
  its_magic
@@ -60,6 +60,36 @@ Remediation:
60
60
  - define `TEST_COMMAND` explicitly in `docs/engineering/runbook.md`, or
61
61
  - add detectable stack markers/scripts then rerun installer upgrade.
62
62
 
63
+ ## Documentation profile validation (US-0077 / DEC-0059)
64
+
65
+ **Goal:** keep root `README.md` (user channel) and `docs/developer/README.md`
66
+ (developer shard) aligned with merged scratchpad keys `DOC_AUDIENCE_PROFILE` and
67
+ `DOC_DETAIL_LEVEL`, with deterministic reason codes and active/`template/` parity.
68
+
69
+ ### Scratchpad keys
70
+
71
+ - `DOC_AUDIENCE_PROFILE`: `user` \| `developer` \| `both` (empty defaults to `both` during transition).
72
+ - `DOC_DETAIL_LEVEL`: `concise` \| `balanced` \| `technical-deep` (empty defaults to `balanced`).
73
+ - Invalid values → `DOC_PROFILE_INVALID`. Merge/read failures → `DOC_PROFILE_MERGE_ERROR`.
74
+ - Optional modes `SPEC_PACK_MODE` / `USER_GUIDE_MODE` stay additive only: when `0`, this
75
+ validator does not require spec-pack or user-guide files.
76
+
77
+ ### Command
78
+
79
+ ```bash
80
+ python scripts/validate_doc_profile.py --repo .
81
+ python scripts/validate_doc_profile.py --repo . --no-template-parity # fixture trees without template/
82
+ ```
83
+
84
+ ### Installer hook
85
+
86
+ `installer.py` scratchpad post-install refreshes missing normative `##` sections
87
+ (non-destructive append) from the resolved profile, then operators should keep
88
+ content accurate. Re-run `python installer.py --scratchpad-postinstall --target <repo> --mode missing`
89
+ after template upgrades if needed.
90
+
91
+ Normative H2 titles and matrix: `docs/engineering/architecture.md` (`# US-0077`).
92
+
63
93
  ## User-visible internal metadata guard (US-0071 / DEC-0053)
64
94
 
65
95
  **Goal:** keep planning-shaped identifiers out of **operator-visible software
@@ -1095,6 +1125,39 @@ Deterministic reason-code baseline:
1095
1125
  - `OPTIONAL_CHECK_FAILED`
1096
1126
  - `SYNC_PUSHED`
1097
1127
 
1128
+ ## Executable validate-and-push wiring (DEC-0058)
1129
+
1130
+ Scratchpad **`SYNC_*` / `ALLOW_AUTO_PUSH` / `AUTO_PUSH_BRANCH_ALLOWLIST`** are read from the
1131
+ **merged** scratchpad only (installer merge: local → materialized baseline → example; same
1132
+ precedence as installer post-install validation). **`scripts/validate-and-push.ps1`** and
1133
+ **`scripts/validate-and-push.sh`** call **`python scripts/sync_push_gates.py`** for policy;
1134
+ **`docs/engineering/runbook.md`** remains the sole source for **`TEST_COMMAND`** and optional
1135
+ lint/typecheck commands.
1136
+
1137
+ **Operator rule:** changing scratchpad alone does **not** run **`git push`**. Run
1138
+ **`validate-and-push`** (or CI) after an eligible boundary. For **`by_phase`**, **`by_milestone`**,
1139
+ and **`custom_phase_list`**, scheduling is **operator or CI** responsibility.
1140
+
1141
+ **`SYNC_PHASE_BOUNDARY`:** optional environment variable (canonical phase id, case-insensitive).
1142
+ When **`SYNC_POLICY_MODE=custom_phase_list`**, the variable must be set and must appear in
1143
+ **`SYNC_CUSTOM_PHASES`** (comma-separated) or the script exits **`SYNC_TRIGGER_NOT_ELIGIBLE`**.
1144
+
1145
+ **Dry-run:** **`powershell .../validate-and-push.ps1 -DryRun`** or
1146
+ **`bash scripts/validate-and-push.sh --dry-run ...`** — runs merge/policy and the runbook check
1147
+ chain, then prints **`SYNC_PUSHED`** without **`git push`**.
1148
+
1149
+ **Branch allowlist matching (`AUTO_PUSH_BRANCH_ALLOWLIST`):** comma-separated entries; each entry
1150
+ is either an exact branch name or a **`fnmatch`** pattern (for example `release/*`). An empty
1151
+ allowlist denies every branch (**`BRANCH_NOT_ALLOWLISTED`**).
1152
+
1153
+ **QA scan (bounded):** files under **`sprints/S####/qa-findings.md`** (four digits). Blocking
1154
+ rules match **`DEC-0058`** §6. **`PRE_QA_AUTOPUSH_FORBIDDEN`** applies on branches other than
1155
+ **`main`** / **`master`** when **no** such **`qa-findings.md`** file exists yet (feature-line
1156
+ signal; see architecture **US-0076**).
1157
+
1158
+ **Python:** merged policy evaluation requires **Python 3** on **`PATH`** (**`PYTHON_NOT_ON_PATH`**
1159
+ if missing).
1160
+
1098
1161
  Required sync evidence fields:
1099
1162
  - `phase_boundary`
1100
1163
  - `policy_mode`