This document describes the automated agents, CI/CD workflows, test runners, and helper scripts used by the SmarkForm project. It explains what runs automatically, where configuration lives, how to run things locally, and how to add or change automation safely.
- Playwright test runner: end-to-end and co-located docs example tests.
- Collector: script that extracts docs examples into a manifest used by tests.
- Build & bundle agents: rollup-based bundling and scripts to produce dist/.
- Documentation build and deploy: Jekyll site, built locally or via GitHub Pages workflow.
- Local live-serve helpers: scripts to run dev servers and watchers.
- GitHub Pages workflow: deploy docs site from stable branch.
- Dependabot: monitors npm (devDependencies) and GitHub Actions to propose updates.
-
Default to opening a PR for all changes unless the user explicitly says otherwise. Always use
report_progressto commit and push changes to a PR branch. -
Make step commits: When several steps are specified in the task, make at least one commit per each step. In case of bug fixes, a commit with failing tests should come first, then a commit with the fix, and finally a commit with documentation updates, etc... if needed. These are minimums: There can be more intermediate commits if it makes sense to break down the work into smaller steps or there is something that needs to be fix in an already committed change, but there should not be fewer than one commit per step.
To ensure coding agents (and contributors alike) make the best decisions while solving current tasks, we maintain a detailed PROMPTS.md file. This file serves as:
- A detailed TODO list for future work and improvements.
- A brainstorming space where ideas can be drafted, refined, and polished into implementable tasks.
- A prompt storage space for developing AI-assisted tasks and identifying interdependencies between them before starting code implementation.
Contributors and agents are encouraged to review the PROMPTS.md file when tackling significant changes or planning enhancements. This ensures all work aligns with upcoming goals and avoids duplication or divergent strategies.
Find the file at: PROMPTS.md
When you change or add any of the following, please update this file to reflect the change:
- package.json scripts (build, test, pretest, dev)
- playwright.config.js or files under test/
- scripts/* (collector, build scripts, live-serve helpers)
- rollup.config.js or rollup-plugins/
- docs/ content, co-located examples, or test collection logic
- .github/workflows/* (CI / Pages deployment)
For convenience, include this exact sentence in the PR description when you want the assistant to update AGENTS.md automatically:
"Please update AGENTS.md to reflect the changes in this PR."
What it does: Runs end-to-end tests against the built distribution files and validates documentation examples.
Configuration: playwright.config.js
Test location: test/ directory
How to run locally:
npm test # all browsers + chromium-mobile (full matrix, default)
npm run test:quick # one randomly-chosen browser (fast, non-deterministic)Key details:
- Test files match pattern:
**/*.tests.js npm testruns the full matrix: chromium, firefox, webkit, and chromium-mobile (Pixel 5 emulation)npm run test:quickpicks one project at random (seescripts/test_quick.sh) — useful for a fast sanity check without committing to a specific browser- Generates HTML reports
- Screenshots and traces captured on failure
forbidOnlyenabled in CI to prevent.onlycommits- Mobile project (
chromium-mobile) uses Playwright's Pixel 5 device emulation to catch Android/Brave-specific bugs
Troubleshooting:
- If tests fail, check
playwright-report/index.htmlfor detailed reports - Use
npm run test:pickto run specific test files (auto-discovers all projects including mobile) - Ensure
npm run buildcompletes successfully before testing
What it does: Extracts documentation examples into a manifest file that Playwright tests use to validate examples.
Location: scripts/collect-docs-examples.js
How to run locally:
node scripts/collect-docs-examples.jsKey details:
- Runs automatically as part of
npm run pretest - Scans docs/ for co-located examples
- Creates a manifest used by test suite
Troubleshooting:
- If tests can't find examples, re-run the collector
- Check that example files exist in docs/ structure
What they do: Bundle the source code using Rollup to produce ESM and UMD distributions in dist/.
Configuration: rollup.config.js, rollup-plugins/
How to run locally:
# Production build
npm run build
# or
scripts/build_production_smarkform.sh
# Build everything (library + examples)
npm run bundle
# or
scripts/build_all.sh
# Watch mode for development
npm run watch
# or
scripts/livebuild_dev_smarkform.shKey details:
- Outputs:
dist/SmarkForm.esm.js(ES module),dist/SmarkForm.umd.js(UMD) - Uses Babel for transpilation with decorators support
- Minification via Terser
- Cleanup plugin for code formatting
- Custom Pug and Sass plugins for examples
- Generates computed metadata (bundle size, last updated)
Troubleshooting:
- If build fails, check Node.js version compatibility
- Ensure all devDependencies are installed:
npm install - Check rollup.config.js for plugin configuration issues
- Review rollup-plugins/ for custom plugin errors
What it does: Builds the Jekyll documentation site from the docs/ directory.
Configuration:
- Jekyll config:
docs/_config.yml - Workflow:
.github/workflows/pages.yml
How to run locally:
# Build docs site
npm run doc
# or
scripts/build_documentation_site.sh
# Serve docs with live reload
npm run servedoc
# or
scripts/liveserve_documentation_site.sh
# Run both library and docs in watch mode
npm run dev
# or
scripts/liveserve_all.shKey details:
- Jekyll site in
docs/directory - Built package and examples copied into docs for deployment
package.jsoncopied todocs/_data/for Jekyll data files- Built examples copied to
docs/_resources/
Troubleshooting:
- If Jekyll fails, ensure Ruby and bundler are installed
- Run
bundle installin docs/ directory - Check Jekyll version compatibility
- Review
docs/Gemfilefor dependencies
What it does: Provides automatic color scheme switching for the documentation site based on user's system preferences.
Configuration:
- CSS:
docs/assets/css/auto-color-scheme.css - JavaScript:
docs/assets/js/auto-logo-switcher.js - Include:
docs/_includes/head_custom.html - Documentation:
docs/CUSTOMIZATION.md
How it works:
- CSS media queries detect
prefers-color-schemeand apply appropriate styles - JavaScript dynamically switches between light (
smarkform.svg) and dark (smarkform_dark.svg) logos - Automatically updates when user changes system color scheme preference
- No user configuration needed - works automatically
Key details:
- Implemented because JustTheDocs 0.10.1 doesn't support
color_scheme: auto - Dark mode colors match JustTheDocs dark theme for consistency
- Supports modern browsers (Chrome 76+, Firefox 67+, Safari 12.1+)
- Falls back to light mode in older browsers
- Includes styles for all common elements (code blocks, tables, links, buttons, etc.)
Customization files:
docs/assets/css/auto-color-scheme.css- Color scheme stylesdocs/assets/js/auto-logo-switcher.js- Logo switching logicdocs/_includes/head_custom.html- Loads custom CSS and JSdocs/CUSTOMIZATION.md- Full documentation
Testing:
- Build and serve the Jekyll site:
npm run servedoc - Open site in browser
- Change system color scheme preference
- Site should automatically update to match
Troubleshooting:
- If colors don't change, check browser console for JavaScript errors
- Verify CSS and JS files are loading in browser DevTools Network tab
- Ensure
head_custom.htmlis being included by Jekyll - Check browser supports
prefers-color-schememedia queries
What they do: Run development servers with live reload for rapid iteration.
Available scripts:
npm run watch/scripts/livebuild_dev_smarkform.sh- Watch library sourcenpm run servedoc/scripts/liveserve_documentation_site.sh- Serve docs with Jekyllnpm run dev/scripts/liveserve_all.sh- Run both library watcher and docs server
How to run locally:
# Development mode (both library and docs)
npm run devKey details:
- Uses
concurrentlyto run multiple processes - Library changes trigger automatic rebuilds
- Documentation server provides live reload
- Automatically stops any previously running instance on startup — running
npm run devin a different branch or worktree always cleanly terminates the previous server first, so you never accidentally test against the wrong build - Stop with Ctrl+C in the terminal where it was started
Troubleshooting:
- If changes don't appear, check that watchers are running
- Ensure ports are not already in use
- Check console output for build errors
What it does: Automatically builds and deploys the documentation site to GitHub Pages when changes are pushed to the stable branch.
Configuration: .github/workflows/pages.yml
Trigger conditions:
- Push to
stablebranch (not main) - Changes to
docs/**paths - Manual workflow dispatch
Key steps:
- Checkout code
- Setup Ruby and install Jekyll dependencies
- Install npm dependencies (from docs directory with working-directory: docs)
- Build package with
npm run build(executed from docs directory) - Copy built files from parent directory to docs structure
- Build Jekyll site
- Upload and deploy to GitHub Pages
Note: The workflow sets working-directory: docs as the default, so npm commands execute from the docs directory.
Troubleshooting:
- Check Actions tab in GitHub for workflow run details
- Review workflow logs for build failures
- Ensure
stablebranch is up to date - Verify GitHub Pages settings in repository configuration
What it does: Automatically creates pull requests to update npm dependencies (devDependencies) and GitHub Actions versions.
Configuration: .github/dependabot.yml
Monitored ecosystems:
npm- devDependencies in package.jsongithub-actions- Actions used in workflow files
Key details:
- Checks daily for npm updates
- Checks weekly for GitHub Actions updates
- No runtime dependencies (only devDependencies)
- Helps keep tooling and CI/CD up to date
How to manage:
- Review PRs created by Dependabot
- Test updates locally before merging
- Check for breaking changes in changelogs
- Merge updates regularly to avoid large batches
Troubleshooting:
- If Dependabot PRs fail CI, review breaking changes
- Check compatibility with Node.js version
- Review package changelogs for migration guides
- Test locally:
npm install <package>@<version>
| Component | Configuration File(s) |
|---|---|
| Playwright | playwright.config.js |
| Rollup | rollup.config.js, rollup-plugins/* |
| Jekyll | docs/_config.yml, docs/Gemfile |
| GitHub Actions | .github/workflows/pages.yml |
| Dependabot | .github/dependabot.yml |
| npm scripts | package.json (scripts section) |
| Example collector | scripts/collect-docs-examples.js |
| Auto color scheme | docs/assets/css/auto-color-scheme.css, docs/assets/js/auto-logo-switcher.js, docs/_includes/head_custom.html |
# Testing
npm test # Run full matrix: chromium + firefox + webkit + chromium-mobile
npm run test:quick # Run on one randomly-chosen browser (fast sanity check)
npm run test:pick # Run specific test file(s) interactively
npm run pretest # Build and collect examples (runs before test / test:quick)
# Building
npm run build # Build production library
npm run bundle # Build library and examples
npm run watch # Watch mode for library
# Documentation
npm run doc # Build documentation site
npm run servedoc # Serve docs with live reload
npm run dev # Watch library + serve docs
# Utility
node scripts/collect-docs-examples.js # Collect docs examplesThe AGENTS/ directory at the repository root contains specialised knowledge files for coding agents. These files capture patterns, gotchas, and implementation details that are not obvious from reading the source code.
| File | Contents |
|---|---|
AGENTS/SmarkForm-Usage.md |
Pointer to docs/_resources/AGENTS/SmarkForm-Usage.md — component types, list template roles, button context patterns, CSS grid layout, exportEmpties behaviour. Full content kept here for agents that need it without following a link. |
AGENTS/SmarkForm-Forms.md |
Pointer to docs/_resources/AGENTS/SmarkForm-Forms.md — practical form implementation guide, CDN/npm/downloaded-copy consumption snippets, prompt templates, and an agent checklist |
AGENTS/Documentation-Examples.md |
How the playground template works — demoValue, DOCS_ONLY_PARAMS, co-located test patterns, tips for harvesting realistic demo data |
Agents should read the relevant AGENTS/ files before making changes to documentation examples, showcase forms, or anything involving SmarkForm component authoring.
When you discover a new pattern, fix a bug caused by an undocumented constraint, or find that an existing entry in AGENTS/ is incorrect or incomplete:
- Update or create the relevant file in
AGENTS/as part of the same commit. - Add new entries for anything you had to learn the hard way — gotchas, non-obvious constraints, error messages and their root causes.
- Correct inaccurate entries whenever you verify that something documented is wrong.
- You do not need a special PR description sentence to update
AGENTS/files — just do it as part of your normal work.
- Contributing: See
CONTRIBUTING.md - Documentation: https://smarkform.bitifet.net
This document should be kept up to date as automation changes. When you make changes to CI/CD, tests, build scripts, or other automation:
- Update the relevant section(s) in this file
- Test your changes locally
- Commit the AGENTS.md update with your changes
For automated updates: Include the sentence "Please update AGENTS.md to reflect the changes in this PR." in your PR description, and the GitHub Copilot Chat Assistant will update this file for you.