@rm-industries/create-forge 0.3.0-alpha.0 → 0.4.0-beta.1

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.
Files changed (33) hide show
  1. package/dist/index.mjs +31 -3
  2. package/dist/index.mjs.map +1 -1
  3. package/dist/template/.github/actions/setup-project/action.yml +24 -0
  4. package/dist/template/.github/dependabot.yml +45 -0
  5. package/dist/template/.github/workflows/automation.yml +59 -0
  6. package/dist/template/.github/workflows/project.yml +235 -0
  7. package/dist/template/.github/workflows/security.yml +70 -0
  8. package/dist/template/.gitignore.template +261 -0
  9. package/dist/template/.lighthouserc.json +28 -0
  10. package/dist/template/README.md +121 -22
  11. package/dist/template/audit-ci.jsonc +20 -0
  12. package/dist/template/cspell.config.ts +19 -2
  13. package/dist/template/docs/accessibility-checklist.md +50 -0
  14. package/dist/template/docs/performance-budget.md +68 -0
  15. package/dist/template/package-lock.json +5663 -390
  16. package/dist/template/package.json +19 -6
  17. package/dist/template/playwright.config.ts +9 -3
  18. package/dist/template/scripts/validate-build.test.ts +58 -0
  19. package/dist/template/scripts/validate-build.ts +64 -0
  20. package/dist/template/src/config/content-models/registry.test.ts +14 -0
  21. package/dist/template/src/config/site.test.ts +13 -0
  22. package/dist/template/src/content.config.test.ts +8 -0
  23. package/dist/template/src/integrations/sveltia/previews.test.ts +23 -0
  24. package/dist/template/src/lib/articles.test.ts +43 -0
  25. package/dist/template/src/lib/articles.ts +1 -1
  26. package/dist/template/src/lib/navigation.test.ts +2 -0
  27. package/dist/template/src/styles/global.css +7 -1
  28. package/dist/template/stylelint.config.ts +2 -0
  29. package/dist/template/tests/accessibility.spec.ts +56 -10
  30. package/dist/template/tests/navigation.spec.ts +43 -0
  31. package/dist/template/tests/routes.spec.ts +19 -12
  32. package/dist/template/vitest.config.ts +18 -1
  33. package/package.json +1 -1
@@ -11,30 +11,129 @@ The template's `.editorconfig` shares UTF-8, LF, final-newline, two-space, and
11
11
  120-column settings with supported editors and Oxfmt. `oxfmt.config.ts` contains
12
12
  only formatter-specific behavior such as quote and import ordering.
13
13
 
14
- | Command | Purpose |
15
- | ----------------------- | --------------------------------------------------------------------------- |
16
- | `npm run dev` | Start Astro's local development server. |
17
- | `npm run build` | Create the production site in `dist/`. |
18
- | `npm run preview` | Serve the production build locally. Run `build` first. |
19
- | `npm run typecheck` | Generate Astro types and run TypeScript without emitting files. |
20
- | `npm run astro:check` | Validate Astro components, content, and diagnostics. |
21
- | `npm run format` | Check formatting with Oxfmt. |
22
- | `npm run format:fix` | Apply Oxfmt formatting. |
23
- | `npm run lint` | Run code, CSS, Markdown, and spelling checks. |
24
- | `npm run lint:code` | Check JavaScript and TypeScript with Oxlint. |
25
- | `npm run lint:css` | Check CSS with Stylelint. |
26
- | `npm run lint:markdown` | Check Markdown with Markdownlint. |
27
- | `npm run spellcheck` | Check repository text with cspell. |
28
- | `npm test` | Run TypeScript unit tests with Vitest. |
29
- | `npm run test:e2e` | Run browser and accessibility tests with Playwright. |
30
- | `npm run audit` | Report high-severity dependency vulnerabilities with npm. |
31
- | `npm run quality` | Run the deterministic formatting, linting, type, unit-test, and build gate. |
14
+ | Command | Purpose |
15
+ | ------------------------ | ---------------------------------------------------------------- |
16
+ | `npm run dev` | Start Astro's local development server. |
17
+ | `npm run build` | Create the production site in `dist/`. |
18
+ | `npm run validate:build` | Validate required output and scan generated text. |
19
+ | `npm run preview` | Serve the production build locally. Run `build` first. |
20
+ | `npm run typecheck` | Generate Astro types and run TypeScript without emitting files. |
21
+ | `npm run astro:check` | Validate Astro components, content, and diagnostics. |
22
+ | `npm run format` | Check formatting with Oxfmt. |
23
+ | `npm run format:fix` | Apply Oxfmt formatting. |
24
+ | `npm run lint` | Run code, CSS, Markdown, and spelling checks. |
25
+ | `npm run lint:code` | Check JavaScript and TypeScript with Oxlint. |
26
+ | `npm run lint:css` | Check CSS with Stylelint. |
27
+ | `npm run lint:markdown` | Check Markdown with Markdownlint. |
28
+ | `npm run spellcheck` | Check repository text with cspell. |
29
+ | `npm run audit:unused` | Detect unused files, exports, and dependencies with Knip. |
30
+ | `npm run lighthouse:ci` | Build and enforce Lighthouse scores and transfer budgets. |
31
+ | `npm test` | Run the `test:unit` command. |
32
+ | `npm run test:unit` | Run deterministic TypeScript unit tests with Vitest. |
33
+ | `npm run test:a11y` | Run focused Playwright and axe accessibility checks. |
34
+ | `npm run test:coverage` | Run unit tests and enforce V8 coverage thresholds. |
35
+ | `npm run test:e2e` | Run browser and accessibility tests with Playwright. |
36
+ | `npm run audit` | Reject unapproved high-severity dependency vulnerabilities. |
37
+ | `npm run quality:static` | Run every static-quality and dependency audit. |
38
+ | `npm run quality:core` | Run static checks, coverage tests, build, and output validation. |
39
+ | `npm run quality` | Run the complete generated-project quality pipeline. |
32
40
 
33
41
  During development, run `npm run dev`. Before committing, run
34
- `npm run quality` and `npm run test:e2e`. Run `npm run audit` separately because
35
- it queries the npm registry and its result can change without a source change.
36
- The quality command remains deterministic and suitable for offline work after
37
- dependencies are installed.
42
+ `npm run quality`. It runs static validation and dependency auditing, unit tests
43
+ with coverage thresholds, a production build and generated-output validation,
44
+ the complete Playwright and axe suite, and Lighthouse budgets in that order.
45
+ Each stage is joined with `&&`, so the command stops immediately and returns a
46
+ non-zero status when any stage fails. Browser tests and Lighthouse start from
47
+ their own production build so they remain independently runnable and cannot
48
+ accidentally inspect stale output.
49
+
50
+ The complete command is intentionally high cost. Use `npm run quality:static`
51
+ for the quickest source-only feedback or `npm run quality:core` for every check
52
+ that does not launch a browser. Both commands include `npm run audit`, so they
53
+ query the npm registry and can change when new advisories are published. Run
54
+ the individual scripts when working offline. CI may execute independent stages
55
+ in parallel, but a project generated by the packed Forge initializer must pass
56
+ the documented `npm run quality` command as a single ordered pipeline.
57
+
58
+ ## Continuous integration
59
+
60
+ The generated `.github/workflows/project.yml` runs on pull requests targeting
61
+ `main` and on pushes to `main`. It separates static quality, coverage-enforced
62
+ unit tests, the validated production build, browser and accessibility tests,
63
+ and Lighthouse budgets so failures identify the affected gate directly. The
64
+ required `Project` result succeeds only after every release-blocking job passes.
65
+
66
+ The workflow installs dependencies with `npm ci`, caches npm downloads using
67
+ the lockfile, cancels superseded runs on the same Git reference, and grants only
68
+ read access to repository contents. Pull requests receive no secrets or write
69
+ permissions. Coverage, production builds, Lighthouse reports, and browser
70
+ failure evidence are retained for seven days. All third-party actions use
71
+ immutable commit pins.
72
+
73
+ Security automation is included alongside project CI. CodeQL analyzes the
74
+ project's TypeScript and GitHub Actions on pull requests, pushes to `main`, and
75
+ a weekly schedule. Dependency review rejects pull requests that introduce
76
+ known high- or critical-severity vulnerabilities. A separate scheduled
77
+ automation workflow validates workflow syntax and scans GitHub Actions with
78
+ Zizmor. Zizmor uploads its findings to GitHub code scanning for review in the
79
+ Security tab without failing the workflow solely because it found an issue.
80
+ The job receives `security-events: write` only for that upload; all other access
81
+ remains read-only. Repositories can make selected code-scanning severities
82
+ merge-blocking later through their ruleset without changing the workflow.
83
+
84
+ Dependabot checks npm and GitHub Actions weekly. Minor and patch npm updates are
85
+ grouped by production or development scope, while major updates remain separate
86
+ for deliberate review. Updates use cooldown periods to avoid adopting newly
87
+ released versions immediately. Because pre-1.0 Sveltia minor releases may be
88
+ breaking, `@sveltia/cms` updates are kept separate from generic production
89
+ dependency groups. Its pull requests must satisfy the compatibility line
90
+ declared by `@rm-industries/content-model`; moving to a later minor requires a
91
+ tested content-model release first. No version is ignored, security updates
92
+ remain enabled, and every update must pass the complete project and security
93
+ workflows before merging.
94
+
95
+ GitHub chooses the Dependabot run times, distributing update checks across its
96
+ available schedule. Forge derives distinct weekly CodeQL and workflow-validation
97
+ minutes from the generated package name. This keeps generation reproducible
98
+ while preventing every Forge project from starting scheduled work simultaneously.
99
+
100
+ Playwright builds the site and runs Chromium against Astro's production preview,
101
+ not the development server. Its browser coverage exercises desktop and mobile
102
+ navigation, article listing/detail flows, article pagination, light and dark
103
+ themes, keyboard use, missing-page recovery, metadata, supporting site files,
104
+ and content-manager startup. Each test receives a fresh browser context, and
105
+ tests use accessible roles and names where the rendered interface provides
106
+ them. On failure, Playwright retains screenshots and traces in `test-results/`;
107
+ the HTML report is written to `playwright-report/`. CI retains both directories
108
+ for seven days, including failed runs.
109
+
110
+ Accessibility verification combines automation with the dated manual review in
111
+ `docs/accessibility-checklist.md`. Repeat that checklist after changing content,
112
+ navigation, themes, components, or interactive behavior; automated axe checks
113
+ cannot judge every aspect of reading order, language, focus order, contrast, or
114
+ alternative-text quality.
115
+
116
+ Lighthouse CI runs three times each against the production home, article
117
+ listing, and article detail pages, then enforces median category scores and
118
+ transfer budgets. The measured baseline, headroom, exclusions, and update rules
119
+ are documented in `docs/performance-budget.md`. Reports are written to the
120
+ generated `.lighthouseci/` directory; CI retains them for seven days even when
121
+ an assertion fails.
122
+
123
+ The configured exclusions cover only generated output, dependency directories,
124
+ and tool artifacts. Stylelint's exceptions recognize Tailwind and DaisyUI
125
+ directives used by `src/styles/global.css`; they do not suppress ordinary CSS
126
+ rules. Knip uses its Astro integration without an ignore list, and Oxlint uses
127
+ its recommended defaults without project-specific rule suppression.
128
+
129
+ Vitest coverage includes configuration, shared content-model registration,
130
+ Astro and Sveltia integration code, content utilities, URL helpers, theme
131
+ configuration, and preview registration. Statements, branches, functions, and
132
+ lines must remain at 100%. Add direct positive and negative tests when this
133
+ source grows; do not lower thresholds or exclude source merely to make a change
134
+ pass. HTML details are written to `coverage/`, which is generated and ignored.
135
+ CI enforces the same thresholds and retains the HTML report for seven days,
136
+ including when the coverage job fails.
38
137
 
39
138
  Edit `src/config/site.ts` to change the site name, description, author,
40
139
  canonical URL, repository, language, navigation, social links, and derived CMS branding. The Astro
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://github.com/IBM/audit-ci/raw/main/docs/schema.json",
3
+ "high": true,
4
+ "allowlist": [
5
+ {
6
+ "GHSA-jmr9-qjv8-65gv": {
7
+ "active": true,
8
+ "expiry": "2026-11-30",
9
+ "notes": "Lighthouse CI development-only browser download path; Forge uses the installed CI browser and does not extract attacker-provided archives.",
10
+ },
11
+ },
12
+ {
13
+ "GHSA-ph9p-34f9-6g65": {
14
+ "active": true,
15
+ "expiry": "2026-11-30",
16
+ "notes": "Lighthouse CI development-only temporary files use tool-controlled names and paths, not attacker-provided prefixes or postfixes.",
17
+ },
18
+ },
19
+ ],
20
+ }
@@ -1,6 +1,23 @@
1
1
  import { defineConfig } from 'cspell';
2
2
 
3
3
  export default defineConfig({
4
- ignorePaths: ['node_modules', 'dist', 'coverage', 'playwright-report', 'test-results'],
5
- words: ['Catppuccin', 'contentinfo', 'daisyui', 'Fira', 'fontsource', 'Macchiato', 'prefersdark', 'Sveltia'],
4
+ // Ignore only installed dependencies and generated tool output.
5
+ ignorePaths: ['node_modules', 'dist', 'coverage', 'playwright-report', 'test-results', '.lighthouseci'],
6
+ words: [
7
+ 'autorun',
8
+ 'Catppuccin',
9
+ 'contentinfo',
10
+ 'daisyui',
11
+ 'Fira',
12
+ 'fontsource',
13
+ 'GHSA',
14
+ 'lhci',
15
+ 'lighthouseci',
16
+ 'Macchiato',
17
+ 'prefersdark',
18
+ 'Sveltia',
19
+ 'unreviewed',
20
+ 'WCAG',
21
+ 'Zizmor',
22
+ ],
6
23
  });
@@ -0,0 +1,50 @@
1
+ # Accessibility review checklist
2
+
3
+ This checklist records the manual accessibility review of the unmodified Forge
4
+ template. Generated-project maintainers must repeat it after changing content,
5
+ navigation, themes, components, or interactive behavior; replace the review
6
+ record below with their own date, environment, results, and linked issues.
7
+
8
+ ## Baseline review
9
+
10
+ - **Date:** 2026-08-30
11
+ - **Environment:** Chromium via Playwright 1.62.1 against the production preview
12
+ - **Viewport coverage:** desktop and 320 × 640 mobile
13
+ - **Input:** keyboard and pointer
14
+ - **Result:** passed without a release-blocking accessibility issue
15
+
16
+ ## Manual checks
17
+
18
+ - [x] Keyboard order starts with the skip link and then follows the visible
19
+ page order without trapping focus.
20
+ - [x] Every interactive element displays a visible focus indicator in light
21
+ and dark modes.
22
+ - [x] Activating **Skip to content** moves focus to the single main landmark.
23
+ - [x] Text, controls, focus indicators, and linked text remain distinguishable
24
+ in the default Latte and Mocha themes.
25
+ - [x] Reduced-motion preference removes smooth scrolling and shortens CSS
26
+ animations and transitions.
27
+ - [x] Representative pages contain one descriptive level-one heading and do
28
+ not skip heading levels.
29
+ - [x] Public pages expose a banner, named primary navigation, one main landmark,
30
+ and a content information landmark.
31
+ - [x] Desktop and mobile navigation remain operable using only the keyboard.
32
+ - [x] The custom 404 page identifies the error and provides a clear route home.
33
+
34
+ The content manager startup and no-index policy are tested separately. Its
35
+ editor interface is supplied by the pinned Sveltia dependency and is outside
36
+ this public-site audit; evaluate that third-party UI against the needs of the
37
+ project's editors before deployment.
38
+
39
+ ## Automated companion checks
40
+
41
+ Run `npm run test:a11y` after each manual review. The suite applies axe-core's
42
+ WCAG 2.0, 2.1, and 2.2 A/AA rules to representative public routes in both
43
+ default color schemes. It also asserts landmarks, level-one headings, skip-link
44
+ behavior, responsive overflow, current-page navigation, and reduced motion.
45
+ Serious or critical axe violations block the browser-test job.
46
+
47
+ Automated checks do not replace judgment about reading order, wording, focus
48
+ order, contrast in newly introduced states, or whether alternative text conveys
49
+ the intended meaning. Record any failure as a linked release-blocking issue
50
+ rather than checking off an unverified item.
@@ -0,0 +1,68 @@
1
+ # Lighthouse performance budget
2
+
3
+ Lighthouse CI protects the generated site's public-page baseline. Run
4
+ `npm run lighthouse:ci` after changes that can affect rendering, assets,
5
+ metadata, or client behavior. The command builds the production site, collects
6
+ three reports per route, and evaluates the median result.
7
+
8
+ ## Enforced routes
9
+
10
+ - `/` represents the landing-page layout and card content.
11
+ - `/articles/` represents a content collection and repeated cards.
12
+ - `/articles/designing-a-calm-starting-point/` represents rendered Markdown,
13
+ typography, tags, and article pagination.
14
+
15
+ The about and custom 404 pages reuse the same public layout with smaller or
16
+ equivalent resource profiles and remain covered by browser and accessibility
17
+ tests. The `/admin/` route is intentionally excluded: it loads the pinned
18
+ third-party Sveltia editor application and is not representative of public
19
+ visitor performance. Reassess that editor separately before deploying it for a
20
+ specific team.
21
+
22
+ ## Category thresholds
23
+
24
+ | Category | Minimum |
25
+ | -------------- | ------: |
26
+ | Performance | 90 |
27
+ | Accessibility | 100 |
28
+ | Best practices | 95 |
29
+ | SEO | 95 |
30
+
31
+ Accessibility remains at 100 because FGE-063 separately enforces serious and
32
+ critical axe findings. The other thresholds allow ordinary Lighthouse runtime
33
+ variance while still failing a meaningful regression.
34
+
35
+ ## Transfer budgets
36
+
37
+ | Resource | Maximum bytes | Rationale |
38
+ | -------- | ------------: | ------------------------------------------------------------------- |
39
+ | Script | 0 | The public template ships no client JavaScript. |
40
+ | Total | 125,000 | Approximately 24% headroom above the measured 100,675-byte maximum. |
41
+
42
+ The 2026-08-30 baseline used Lighthouse 12.6.1 and three local Chromium runs per
43
+ route. Every run scored 99 performance and 100 for accessibility, best
44
+ practices, and SEO. Script transfer was zero bytes. Total transfer was stable at
45
+ 100,675 bytes for home, 100,447 bytes for the listing, and 100,498 bytes for the
46
+ article detail.
47
+
48
+ The total budget leaves room for minor generated-content and toolchain variance
49
+ without allowing an unreviewed asset or client bundle. Do not raise a threshold
50
+ or exclude a route merely to make CI pass. If a product requirement deliberately
51
+ changes the budget, record the new three-run measurements, explain the user
52
+ benefit and cost, and review the change in its pull request.
53
+
54
+ ## Dependency note
55
+
56
+ `@lhci/cli` 0.15.1 pins Lighthouse 12.6.1. Forge keeps that upstream-tested
57
+ dependency graph instead of overriding Lighthouse or its transitive
58
+ dependencies independently. Upgrade the top-level Lighthouse CI package when a
59
+ release supports a newer Lighthouse runtime, then repeat the three-run
60
+ collection and assertion compatibility checks.
61
+
62
+ The pinned graph currently includes high-severity `extract-zip` and `tmp`
63
+ advisories. Both are confined to development-only Lighthouse tooling:
64
+ Lighthouse uses the installed browser rather than extracting an
65
+ attacker-provided browser archive, and its temporary paths are tool-controlled.
66
+ `audit-ci.jsonc` records narrow, expiring exceptions for those two advisory IDs.
67
+ All other high or critical advisories still fail `npm run audit`. Review or
68
+ remove the exceptions by 2026-11-30 rather than extending them automatically.