|
| 1 | +--- |
| 2 | +classification: quick-spec |
| 3 | +risk_level: medium |
| 4 | +target_workflow: specify-light |
| 5 | +required_artifacts: intent, action-plan |
| 6 | +recommended_next_step: plan |
| 7 | +required_gates: checklist |
| 8 | +--- |
| 9 | + |
| 10 | +# Quick Specification: Build Artifact Separation |
| 11 | + |
| 12 | +**Feature Branch**: `001-build-artifact-separation` |
| 13 | +**Created**: 2026-04-13 |
| 14 | +**Status**: Complete <!-- Valid: Draft | In Progress | Complete --> |
| 15 | +**Input**: User description: "Refactor files and build process to separate source files from build artifacts. Prevent every build from creating git noise that distracts from meaningful changes. Clean separation between source and built output so .gitignore can exclude build artifacts." |
| 16 | + |
| 17 | +## Intent |
| 18 | + |
| 19 | +Every `npm run build` produces a `docs/` directory with hash-based filenames (e.g., `About-DUW_-ayh.js`). Because `docs/` is tracked in git, **each build generates ~40+ changed files** in git status — all deletions of old hashed files and additions of new ones. This noise obscures actual meaningful code changes, pollutes pull request diffs, and makes commit history harder to review. |
| 20 | + |
| 21 | +The `docs/` directory is the Vite build output consumed by Azure Static Web Apps. The CI/CD pipeline (GitHub Actions) already runs `npm run build` and deploys from `docs/` — meaning the committed `docs/` folder is redundant. The `coverage/` directory (test coverage reports) is also partially tracked and creates similar noise. |
| 22 | + |
| 23 | +This change will establish a clean boundary: **source files are committed, build artifacts are not**. |
| 24 | + |
| 25 | +## Scope |
| 26 | + |
| 27 | +- **In scope:** |
| 28 | + - Add `docs/` to `.gitignore` so Vite build output is never committed |
| 29 | + - Add `coverage/` to `.gitignore` (test coverage reports are build artifacts) |
| 30 | + - Remove `docs/` and `coverage/` from git tracking (untrack without deleting local files) |
| 31 | + - Verify the Azure Static Web Apps CI/CD workflow builds from source and does not depend on a pre-committed `docs/` folder |
| 32 | + - Update `swa-cli.config.json` if needed to ensure local SWA CLI still works with the build-on-demand model |
| 33 | + - Update any documentation that references the `docs/` folder as a deployment target requiring commits |
| 34 | + |
| 35 | +- **Out of scope:** |
| 36 | + - Changing the Vite `outDir` configuration (keeping `docs/` as the build output directory is fine) |
| 37 | + - Changing the CI/CD workflow structure or deployment provider |
| 38 | + - Modifying the build process itself (scripts, plugins, optimizations) |
| 39 | + - Changing the `public/` or `src/` source file structure |
| 40 | + |
| 41 | +## Constraints |
| 42 | + |
| 43 | +- **Azure Static Web Apps deployment must not break.** The GitHub Actions workflow uses `output_location: "docs"` and `app_build_command: "npm run build"` — it builds from source in CI. Removing committed `docs/` must not affect this. |
| 44 | +- **Local development workflow must remain functional.** `npm run dev`, `npm run build`, and `npm run preview` must continue to work. The SWA CLI (`swa start`) must still find build output. |
| 45 | +- **Constitution compliance:** No new test coverage gaps. Build/config changes must be validated. |
| 46 | +- **Backward compatibility:** Contributors who `git pull` after this change will no longer have a pre-built `docs/` folder. The README should note that `npm run build` is required before `npm run preview`. |
| 47 | + |
| 48 | +## Action Plan |
| 49 | + |
| 50 | +1. **Update `.gitignore`** — Add `docs/` and ensure `coverage/` entries cover all coverage output |
| 51 | +2. **Untrack `docs/` from git** — Run `git rm -r --cached docs/` to stop tracking without deleting local files |
| 52 | +3. **Untrack `coverage/` from git** — Run `git rm -r --cached coverage/` to stop tracking without deleting local files |
| 53 | +4. **Verify CI/CD pipeline** — Confirm the Azure Static Web Apps workflow builds from source (`skip_app_build: false`, `app_build_command: "npm run build"`) and does not expect pre-committed build output |
| 54 | +5. **Verify local SWA CLI** — Confirm `swa-cli.config.json` uses `appBuildCommand` so it builds before serving, not relying on pre-existing `docs/` |
| 55 | +6. **Update README** — Add a note that `docs/` is a build artifact (not committed) and `npm run build` must be run before previewing locally |
| 56 | +7. **Commit and validate** — Commit the `.gitignore` and untrack changes, then verify a clean `git status` after running `npm run build` |
| 57 | + |
| 58 | +## Validation Notes |
| 59 | + |
| 60 | +- After the change, running `npm run build` should produce **zero git-tracked file changes** in `docs/` |
| 61 | +- `git status` after a build should show only source file modifications (if any) |
| 62 | +- The Azure Static Web Apps CI/CD pipeline must successfully build and deploy on push to `main` |
| 63 | +- `npm run dev`, `npm run build`, `npm run preview`, and `swa start` must all function correctly |
| 64 | +- A fresh clone followed by `npm install && npm run build` must produce a working site |
| 65 | +- How does system handle [error scenario]? |
| 66 | + |
| 67 | +## Requirements *(mandatory)* |
| 68 | + |
| 69 | +<!-- |
| 70 | + ACTION REQUIRED: The content in this section represents placeholders. |
| 71 | + Fill them out with the right functional requirements. |
| 72 | +--> |
| 73 | + |
| 74 | +### Functional Requirements |
| 75 | + |
| 76 | +- **FR-001**: System MUST [specific capability, e.g., "allow users to create accounts"] |
| 77 | +- **FR-002**: System MUST [specific capability, e.g., "validate email addresses"] |
| 78 | +- **FR-003**: Users MUST be able to [key interaction, e.g., "reset their password"] |
| 79 | +- **FR-004**: System MUST [data requirement, e.g., "persist user preferences"] |
| 80 | +- **FR-005**: System MUST [behavior, e.g., "log all security events"] |
| 81 | + |
| 82 | +*Example of marking unclear requirements:* |
| 83 | + |
| 84 | +- **FR-006**: System MUST authenticate users via [NEEDS CLARIFICATION: auth method not specified - email/password, SSO, OAuth?] |
| 85 | +- **FR-007**: System MUST retain user data for [NEEDS CLARIFICATION: retention period not specified] |
| 86 | + |
| 87 | +### Key Entities *(include if feature involves data)* |
| 88 | + |
| 89 | +- **[Entity 1]**: [What it represents, key attributes without implementation] |
| 90 | +- **[Entity 2]**: [What it represents, relationships to other entities] |
| 91 | + |
| 92 | +## Success Criteria *(mandatory)* |
| 93 | + |
| 94 | +<!-- |
| 95 | + ACTION REQUIRED: Define measurable success criteria. |
| 96 | + These must be technology-agnostic and measurable. |
| 97 | +--> |
| 98 | + |
| 99 | +### Measurable Outcomes |
| 100 | + |
| 101 | +- **SC-001**: [Measurable metric, e.g., "Users can complete account creation in under 2 minutes"] |
| 102 | +- **SC-002**: [Measurable metric, e.g., "System handles 1000 concurrent users without degradation"] |
| 103 | +- **SC-003**: [User satisfaction metric, e.g., "90% of users successfully complete primary task on first attempt"] |
| 104 | +- **SC-004**: [Business metric, e.g., "Reduce support tickets related to [X] by 50%"] |
0 commit comments