code-foundry 0.21.0 → 0.21.2

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.
@@ -13,8 +13,8 @@ permissions:
13
13
  jobs:
14
14
  ci:
15
15
  name: CI
16
- uses: 0xPlayerOne/code-foundry/.github/workflows/reusable-ci.yml@v0.20.0
16
+ uses: 0xPlayerOne/code-foundry/.github/workflows/reusable-ci.yml@v0.20.2
17
17
  with:
18
18
  runtime-repository: 0xPlayerOne/code-foundry
19
- runtime-ref: v0.20.0
19
+ runtime-ref: v0.20.2
20
20
  secrets: inherit
@@ -18,8 +18,8 @@ permissions:
18
18
  jobs:
19
19
  codeql:
20
20
  name: CodeQL
21
- uses: 0xPlayerOne/code-foundry/.github/workflows/reusable-codeql.yml@v0.20.0
21
+ uses: 0xPlayerOne/code-foundry/.github/workflows/reusable-codeql.yml@v0.20.2
22
22
  with:
23
23
  runtime-repository: 0xPlayerOne/code-foundry
24
- runtime-ref: v0.20.0
24
+ runtime-ref: v0.20.2
25
25
  secrets: inherit
@@ -18,5 +18,5 @@ permissions:
18
18
  jobs:
19
19
  draft-pr:
20
20
  name: Draft PR
21
- uses: 0xPlayerOne/code-foundry/.github/workflows/reusable-draft-pr.yml@v0.20.0
21
+ uses: 0xPlayerOne/code-foundry/.github/workflows/reusable-draft-pr.yml@v0.20.2
22
22
  secrets: inherit
@@ -14,5 +14,5 @@ permissions:
14
14
  jobs:
15
15
  release:
16
16
  name: Release
17
- uses: 0xPlayerOne/code-foundry/.github/workflows/reusable-release.yml@v0.20.0
17
+ uses: 0xPlayerOne/code-foundry/.github/workflows/reusable-release.yml@v0.20.2
18
18
  secrets: inherit
@@ -13,8 +13,8 @@ permissions:
13
13
  jobs:
14
14
  security:
15
15
  name: Security
16
- uses: 0xPlayerOne/code-foundry/.github/workflows/reusable-security.yml@v0.20.0
16
+ uses: 0xPlayerOne/code-foundry/.github/workflows/reusable-security.yml@v0.20.2
17
17
  with:
18
18
  runtime-repository: 0xPlayerOne/code-foundry
19
- runtime-ref: v0.20.0
19
+ runtime-ref: v0.20.2
20
20
  secrets: inherit
@@ -13,8 +13,8 @@ permissions:
13
13
  jobs:
14
14
  test:
15
15
  name: Test
16
- uses: 0xPlayerOne/code-foundry/.github/workflows/reusable-test.yml@v0.20.0
16
+ uses: 0xPlayerOne/code-foundry/.github/workflows/reusable-test.yml@v0.20.2
17
17
  with:
18
18
  runtime-repository: 0xPlayerOne/code-foundry
19
- runtime-ref: v0.20.0
19
+ runtime-ref: v0.20.2
20
20
  secrets: inherit
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.21.2](https://github.com/0xPlayerOne/code-foundry/compare/v0.21.1...v0.21.2) (2026-07-28)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **docs:** clarify package verification ([b2bb12d](https://github.com/0xPlayerOne/code-foundry/commit/b2bb12d1674acefe5e874df280dfd083f9966e19))
9
+
10
+ ## [0.21.1](https://github.com/0xPlayerOne/code-foundry/compare/v0.21.0...v0.21.1) (2026-07-28)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **template:** align reusable runtime pins ([c3195e8](https://github.com/0xPlayerOne/code-foundry/commit/c3195e8a3320821c5f891ef942cf5df59ecd09bb))
16
+
3
17
  ## [0.21.0](https://github.com/0xPlayerOne/code-foundry/compare/v0.20.3...v0.21.0) (2026-07-28)
4
18
 
5
19
 
package/README.md CHANGED
@@ -3,229 +3,128 @@
3
3
  [![npm version](https://img.shields.io/npm/v/code-foundry?logo=npm&logoColor=white)](https://www.npmjs.com/package/code-foundry)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/code-foundry?logo=npm&logoColor=white)](https://www.npmjs.com/package/code-foundry)
5
5
  [![CI](../../actions/workflows/ci.yml/badge.svg?branch=main)](../../actions/workflows/ci.yml)
6
- [![Latest GitHub release](https://img.shields.io/badge/GitHub%20release-latest-181717?logo=github)](../../releases/latest)
6
+ [![Latest release](https://img.shields.io/github/v/release/0xPlayerOne/code-foundry?logo=github)](../../releases/latest)
7
7
 
8
- `code-foundry` is a repository factory for TypeScript, Rust, Python, Solidity,
9
- and mixed-language projects. It installs agent-ready instructions, fast native
10
- testing, security automation, release workflows, hooks, and repository policy
11
- from one versioned package.
8
+ `code-foundry` is a versioned repository baseline for TypeScript, Rust, Python,
9
+ Solidity, and mixed-language projects. It provides language-aware workflows,
10
+ native testing, security automation, releases, hooks, repository policy, and
11
+ agent instructions from one initializer.
12
12
 
13
13
  ## Quick start
14
14
 
15
- ```bash
16
- npx code-foundry init
17
- ```
18
-
19
- Or select the project profile explicitly:
20
-
21
- ```bash
22
- npx code-foundry init \
23
- --languages typescript,python \
24
- --features all \
25
- --package-manager bun
26
- ```
27
-
28
- Use `code-foundry sync` to update an existing repository and
29
- `code-foundry doctor` to validate it. Add `--dry-run` to preview changes.
30
-
31
- Choose the license during initialization without editing generated files:
32
-
33
- ```bash
34
- npx code-foundry init --license mit
35
- npx code-foundry init --license agpl-3.0-or-later
36
- npx code-foundry init --license-file ./legal/LICENSE.txt
37
- ```
38
-
39
- Reusable workflow callers use the source template's runtime automatically. For
40
- example, initializing from `NiftyLeague/template-repo` selects that fork's
41
- runtime without extra flags. Use `--runtime-repository OWNER/REPO` (or
42
- `REPO_FOUNDRY_RUNTIME_REPOSITORY`) only when you want to override it. The
43
- selected repository is saved in `.github/template.yml` and rendered into the
44
- small CI, Test, Security, CodeQL, Draft PR, and Release PR wrappers
45
- automatically. Use `--runtime-ref REF` (or `REPO_FOUNDRY_RUNTIME_REF`) to pin
46
- those callers to a fork's release tag or branch; the selected ref is persisted
47
- alongside the runtime repository.
48
-
49
- Normal synchronization imports only the local hook, agent-facing command,
50
- profile/release, initializer, doctor, ownership, and protection entrypoints.
51
- Workflow-only actions and Security/CodeQL analyzers stay in the versioned
52
- runtime package and are not duplicated in consumer repositories.
53
-
54
- The standard Security wrapper uses the same runtime contract, so dependency
55
- audits and the public-only Dependency Review policy can be upgraded centrally
56
- without copying security scripts into every consumer repository.
57
-
58
- CodeQL is also independently reusable through the same contract. It retains
59
- GitHub's native security-event permissions and language-specific analysis while
60
- keeping CodeQL separate from CI and dependency security checks.
61
-
62
- Release automation follows the same model: the consumer keeps a short
63
- main-branch wrapper while the shared runtime handles Release Please, GitHub
64
- release metadata, optional npm publication, provenance, and token/trusted
65
- publishing fallback.
66
-
67
- The promotion runtimes for Draft PR and Release PR are maintained in the same
68
- versioned repository and are released before their short consumer callers move
69
- to a new tag, avoiding a bootstrap cycle.
70
-
71
- Initialization defaults to AGPL for new repositories. Synchronization defaults
72
- to `--license preserve`, so an existing repository's license is never replaced
73
- unless you explicitly select a license or provide `--license-file`.
74
-
75
- The generated Git hook is intentionally a small launcher. It points at the
76
- package-managed `.github/scripts/pre-commit.sh`, so repositories do not need to
77
- maintain a second copy of the language-aware hook logic.
78
-
79
- ## Setup
80
-
81
- 1. Install [mise](https://mise.jdx.dev/).
82
- 2. Run `bash .github/scripts/bootstrap.sh` to install the pinned toolchain, enable hooks, and validate the repository.
83
- 3. Add the repository's standard scripts (`format:check`, `lint`, `type-check`, `build`, `test:unit`, `test:integration`, `test:e2e`, and `test:smoke`) when available. The shared scripts also recognize legacy aliases and skip checks that do not apply to the repository's languages or package manager.
84
-
85
- ## Applying the baseline to an existing repository
86
-
87
- Run the package entrypoint from the repository root. It updates shared
88
- workflows, GitHub forms, hooks, policy files, and tool configuration while
89
- preserving the repository's README, `.mise.toml` selections, extra workflows,
90
- licenses, and application code.
15
+ Run this from the root of a repository:
91
16
 
92
17
  ```bash
93
18
  npx code-foundry init
94
19
  ```
95
20
 
96
- Use `bash .github/scripts/sync-template.sh --source ... --check` to preview differences. For local template development, pass the template checkout as `--source` and `--ref staging`.
97
-
98
- The initializer is intentionally flag-driven so the same baseline can be used as a small repository package. Language selection controls CodeQL and records the repository profile; feature selection controls which standard workflows are installed. `auto` detects supported languages, while `all` enables every standard workflow. The resolver profiles the repository for language, package manager, project shape, release type, runners, and cache policy.
99
-
100
- Existing authored documentation and issue/PR templates are preserved by
101
- default. Pass `--force` when intentionally refreshing those files from the
102
- baseline; repository-specific workflows and application files remain protected.
21
+ Useful variants:
103
22
 
104
23
  ```bash
105
- # Preview a TypeScript + Python repository without changing files
106
- bash .github/scripts/init-repo.sh \
107
- --languages typescript,python \
108
- --features all \
109
- --dry-run
110
-
111
- # Initialize a Rust repository with only the core automation
112
- bash .github/scripts/init-repo.sh \
113
- --languages rust \
114
- --features ci,codeql,security,test
115
- ```
116
-
117
- Supported profiles are `application`, `monorepo`, and `minimal`; use `auto` to detect one. Supported languages are `typescript`, `rust`, `python`, and `solidity`. Supported feature flags are `ci`, `codeql`, `security`, `test`, `draft-pr`, `release-pr`, `release`, and `dependabot`. Use `--prune` only when you explicitly want disabled standard workflows removed; custom workflows are always preserved. The selected profile is stored in `.github/template.yml`, which makes later syncs repeatable and lets workflows consume repository-specific settings without duplicating the template scripts.
118
-
119
- Profile precedence is consistent everywhere: explicit CLI flags, then `REPO_FOUNDRY_*` GitHub repository variables/environment values, then `.github/template.yml`, then automatic detection and standard defaults. Useful repository variables include `REPO_FOUNDRY_PROFILE`, `REPO_FOUNDRY_LANGUAGES`, `REPO_FOUNDRY_FEATURES`, `REPO_FOUNDRY_PACKAGE_MANAGER`, `REPO_FOUNDRY_RUNTIME_REPOSITORY`, `REPO_FOUNDRY_RUNTIME_REF`, `REPO_FOUNDRY_RUNNER`, `REPO_FOUNDRY_UNIT_RUNNER`, `REPO_FOUNDRY_CACHE_PACKAGES`, `REPO_FOUNDRY_CACHE_BUILD`, `REPO_FOUNDRY_COVERAGE_MINIMUM`, and `REPO_FOUNDRY_TURBO_REMOTE`. Use CLI flags for one-off initialization; use repository variables for local overrides that should not be committed.
120
-
121
- Inspect the resolved profile at any time with `bash .github/scripts/profile.sh detect`; use `profile.sh get KEY` when another script needs one setting.
122
-
123
- ## Releases and publishing
124
-
125
- The standard release workflow uses [Release Please](https://github.com/googleapis/release-please) after changes reach `main`. It opens or updates a versioned release pull request, maintains `CHANGELOG.md`, creates the GitHub release after that PR is merged, and applies semantic version bumps from Conventional Commits. The reusable `release-please-config.json` groups feature, fix, performance, dependency, documentation, test, CI, and maintenance changes in generated notes:
24
+ # Choose languages and the package manager
25
+ npx code-foundry init --languages typescript,python --package-manager bun
126
26
 
127
- - `fix:` patch, such as `1.2.3` → `1.2.4`
128
- - `feat:` minor, such as `1.2.3` → `1.3.0`
129
- - `feat!:`, `fix!:`, or `BREAKING CHANGE:` → major, such as `1.2.3` → `2.0.0`
130
-
131
- Before `1.0.0`, `feat:` intentionally increments the minor version. This keeps pre-1.0 releases useful without treating every feature as a breaking major.
132
-
133
- Use `Release-As: 2.0.0` in a commit or pull request body when a specific version is required. Existing `CHANGELOG.md` files are preserved by sync and remain repository-owned.
134
-
135
- Release behavior is configured in `.github/template.yml`:
27
+ # Choose a license
28
+ npx code-foundry init --license mit
136
29
 
137
- ```yaml
138
- release_type: auto # auto, node, python, rust, simple, or none
139
- npm_publish: false # true only for a package published to npm
30
+ # Preview without changing files
31
+ npx code-foundry init --dry-run
140
32
  ```
141
33
 
142
- `auto` selects the first matching package type (`package.json`, `pyproject.toml`, `Cargo.toml`, or `version.txt`). Use `none` when the repository should not release automatically. Solidity-only repositories use `simple` with a root `version.txt`. For a repository containing multiple independently released packages, add a Release Please manifest/configuration and select the appropriate Release Please strategy rather than treating the repository as one package.
143
-
144
- GitHub Actions needs permission to open release pull requests. Configure a repository or organization secret named `RELEASE_PLEASE_TOKEN` containing a narrowly scoped token or GitHub App token if the default `GITHUB_TOKEN` is not allowed to create pull requests. Keep `contents`, `issues`, and `pull-requests` permissions enabled for the release workflow.
145
-
146
- For npm publication, set `npm_publish: true` and configure npm trusted publishing (recommended) for this repository’s `release.yml` workflow, or provide an `NPM_TOKEN` secret. The workflow detects which method is configured, and publication occurs only after Release Please creates a release tag, so ordinary pushes cannot publish packages. Keep `publishConfig.access` in `package.json` aligned with the package’s intended visibility; the baseline publishes public packages. If npm publication is enabled without either configuration, the publish job fails instead of silently skipping the release.
147
-
148
- The release flow is: promote `staging` into `main`; let Release Please open or update the version/changelog PR; merge that PR to create the GitHub release and tag; then publish to npm only when `npm_publish: true`.
149
-
150
- For a repository that does not yet contain the scripts, the initializer can be invoked directly from the published package or a downloaded copy of `init-repo.sh`; it fetches the matching sync helper automatically. The generated `.github/template.yml` is the stable configuration contract used by the package and later syncs.
151
-
152
- CI formatting and linting use the preloaded `ubuntu-latest` runner by default because dependency setup is usually faster there. Set `REPO_FOUNDRY_FAST_RUNNER=ubuntu-slim` only after measuring a repository where the lean image is faster; use `ubuntu-latest` for dependency-heavy or native-toolchain projects.
153
-
154
- Rust Build and Type-Check jobs keep compiler caches enabled. JavaScript-only Build and Type-Check jobs skip framework cache archives by default because hosted-runner compression can exceed the build time; opt in with `REPO_FOUNDRY_CACHE_BUILD=true` when a repository’s measurements show a repeatable warm-cache win.
155
-
156
- Branch protection is an administrator operation and is opt-in:
157
-
158
- ```bash
159
- bash .github/scripts/init-repo.sh --protection
34
+ For an existing installation, use `npx code-foundry sync`. Run
35
+ `npx code-foundry doctor` to inspect the resulting repository configuration.
36
+
37
+ ## What it installs
38
+
39
+ - Short workflow callers for CI, Test, Security, CodeQL, Draft PR, Release PR,
40
+ and Release.
41
+ - A small `.githooks/pre-commit` launcher with language-aware formatting and
42
+ linting.
43
+ - `.mise.toml`, optional `mise.lock`, repository profile configuration, and
44
+ standard GitHub forms and policy files.
45
+ - AGENTS instructions, CODEOWNERS, license/notice files, and reusable release
46
+ configuration.
47
+
48
+ The workflow implementation lives in the versioned runtime repository. A
49
+ consumer repository keeps only the callers and the small local entrypoints it
50
+ needs. Custom workflows—such as deployment, indexing, Slither, or search—are
51
+ preserved and can coexist with the standard baseline.
52
+
53
+ ## Configuration
54
+
55
+ Initialization is flag-driven. The most important options are:
56
+
57
+ ```text
58
+ --profile auto|application|monorepo|minimal
59
+ --languages auto|typescript,rust,python,solidity
60
+ --features all|ci,codeql,security,test,draft-pr,release-pr,release,dependabot
61
+ --package-manager auto|bun|pnpm|yarn|npm
62
+ --runtime-repository OWNER/REPO
63
+ --runtime-ref TAG_OR_BRANCH
64
+ --release-type auto|node|python|rust|simple|none
65
+ --license agpl-3.0-or-later|mit|preserve|none
66
+ --license-file PATH
160
67
  ```
161
68
 
162
- The protection helper preserves unrelated provider checks, replaces stale template check names, and skips CodeQL analysis checks for private repositories where the workflow is intentionally skipped.
163
-
164
- The repository name, owner, branch names, and release metadata are resolved by GitHub Actions at runtime through `${{ github.* }}` values. Keep organization-specific details out of this baseline.
165
-
166
- `CODEOWNERS` is repository-aware. Initialization queries the target GitHub repository and writes its personal owner or repository administrators into the default rule. For organization repositories, administrator discovery requires an authenticated `gh` session with collaborator visibility; if discovery is unavailable, the file retains an `@OWNER` placeholder that should be replaced before merging protected changes.
167
-
168
- CI and hooks use Prettier and ESLint for JavaScript/TypeScript, default `rustfmt` and Clippy with warnings-as-errors for Rust, and Ruff formatting/linting for Python.
169
-
170
- The initializer generates a minimal `.mise.toml` from the selected language and package-manager profile instead of installing every supported tool on every runner. TypeScript/Solidity profiles always pin Node and add Bun only for Bun projects; npm, pnpm, and Yarn use Node/Corepack. CI and Security also honor an explicit `package_manager` profile before inspecting lockfiles. Existing `.mise.toml` files are preserved. Initialization also generates a committed `mise.lock` when mise is available; CI then installs exact tool URLs and checksums without repeating registry/API resolution. Workflow setup restores lockfile-keyed package caches for Bun/npm/pnpm/Yarn, Cargo, and pip; cache misses remain safe because dependencies are always re-created from their lockfiles or manifests. Set `REPO_FOUNDRY_CACHE_PACKAGES=true` when a large Bun project has a measured warm-cache win; the default `auto` policy skips oversized archives.
69
+ The selected profile is saved in `.github/template.yml`. Explicit flags take
70
+ precedence over `REPO_FOUNDRY_*` environment/repository variables, which take
71
+ precedence over that file and automatic detection. See
72
+ [Initialization and synchronization](docs/INITIALIZATION.md) for the full
73
+ configuration contract.
171
74
 
172
- Rust profiles declare `rustfmt` and `clippy` as mise components, so they are installed once with the cached toolchain instead of being added separately by each formatting or lint job. Rust Build jobs cache only reusable debug dependency/build-script artifacts plus Cargo fingerprints; Test jobs disable build and materialized-environment caches to avoid restoring and saving large incremental trees or Python virtual environments in parallel. Cargo’s advisory database and audit tools remain separate caches whose keys follow the security script, so dependency updates do not redownload the scanner. Cargo fingerprints invalidate stale objects safely, while keeping build caches separate prevents a large Rust build from displacing dependency-download caches or parallel jobs from racing to save one partial cache.
75
+ New repositories default to AGPL-3.0-or-later. Synchronization preserves an
76
+ existing license unless a replacement is explicitly selected. Authored
77
+ documentation, application files, custom workflows, and existing `.mise.toml`
78
+ files are preserved by default; use `--force` or `--prune` only intentionally.
173
79
 
174
- The shared cache action separates restore-only jobs from jobs allowed to save a cache after completion. Standard parallel CI and Test jobs pass `cache-save: false`, so they can reuse warm data without paying for redundant post-job archive uploads; the Unit and Security paths retain saving where it improves later runs. Repository-specific workflows can use the same local action when they need the same restore-only behavior.
80
+ ## Workflow model
175
81
 
176
- When an exact `Cargo.lock` dependency cache is restored, CI enables Cargo offline mode for compilation and tests, eliminating avoidable registry/index checks. Cache misses continue using normal online resolution. npm projects intentionally skip the installed-`node_modules` cache because `npm ci` removes that directory before installation; they still reuse the package-download cache.
82
+ The standard workflow triggers are:
177
83
 
178
- Applicable jobs cache installed JavaScript dependencies only when a lockfile, workspace, or dependency entry exists; dependency-free package manifests skip both the cache lookup and install. Installed JavaScript dependencies use an `auto` policy: compact pnpm/Yarn layouts are reusable, while Bun recreates its potentially large `node_modules` tree from the cached package store. Package-store caching also defaults to `auto`: normal projects retain it, while Bun repositories with more than 512 KiB of tracked lockfiles skip the large archive when a clean registry install is typically faster. Set `cache-packages: true` or `false` to override that heuristic. Set `cache-installed: true` on the setup action when a specific Bun repository benefits from restoring its materialized tree, or `false` to force lockfile installation for any manager. Jobs also cache Corepack package-manager shims, generic fallback ESLint/Prettier state, and Python virtual environments by manifest/dependency configuration hash. Repository-owned format/lint scripts skip those fallback cache paths entirely, avoiding recursive cache scans and post-job archive work when the script does not create the cache. Formatter and linter configuration is isolated to lint-state caches, so changing formatting rules does not invalidate installed dependencies. Mutable installed environments use exact-key restores only, preventing a lockfile change from downloading stale `node_modules` or a stale virtual environment that must then be replaced. Corepack remains warm even when an installed-dependency cache is already a hit; npm and pnpm installs prefer restored package stores and npm skips redundant audit/funding work because Security runs the authoritative dependency audit separately. The generic ESLint and Prettier fallbacks enable content-based built-in caches so restored lint/format state survives fresh Git checkouts; repository-defined scripts remain authoritative. Cache misses always fall back to a clean install; cached environments must never contain credentials or generated secrets.
84
+ - Pushes to `main` and `staging`.
85
+ - Pull requests targeting `staging`.
86
+ - Draft PR automation for supported feature/fix branches.
179
87
 
180
- When a repository uses multiple supported ecosystems, JavaScript, Rust, and Python dependency installation runs concurrently inside each setup job. A failure in any installer still fails the job after all active installers finish, preserving complete diagnostics without making network waits additive. CI disables Turbo and Next.js telemetry so framework jobs do not spend time on nonessential telemetry startup or network work.
88
+ Jobs are language-aware and skip irrelevant setup while remaining visible as
89
+ successful required checks. TypeScript uses ESLint, Prettier, and Bun's native
90
+ test runner. Rust uses `rustfmt`, Clippy with warnings as errors, and native
91
+ Cargo tests. Python uses Ruff, uv/pip-compatible setup, and native Python
92
+ tests. Solidity projects retain their native toolchain and test runner.
181
93
 
182
- Installers also short-circuit cleanly: JavaScript projects without dependency entries do not run a package install, and Python source-only projects reuse the shared Ruff tool without creating a virtual environment. Workspace manifests and project dependency files still take the normal locked-install path.
94
+ CodeQL remains separate from CI and Security. Dependency Review is isolated in
95
+ Security and is skipped where GitHub does not support it, while JavaScript,
96
+ Python, and Rust audits remain available without GitHub Advanced Security.
183
97
 
184
- E2E jobs cache Playwright, Cypress, and Puppeteer browser directories by dependency/configuration hash, avoiding repeated browser downloads while invalidating safely when the browser configuration or lockfiles change. Coverage artifacts are uploaded only when a test actually produces coverage output.
98
+ See [Workflow and CI conventions](docs/WORKFLOWS.md) for triggers, required
99
+ checks, runners, coverage, caching, and custom workflow extensions.
185
100
 
186
- Repositories with Turborepo automatically cache local `.turbo/cache` results per workflow job and dependency/configuration hash when remote caching is unavailable. Fallback restores can reuse valid artifacts produced by another workflow job, while Turbo’s task hashes discard stale results. Vercel Remote Caching remains available through `TURBO_TOKEN` and `TURBO_TEAM`; when both are set, the default path passes Turbo’s `--cache=remote:rw` mode to repository scripts so local archive work is avoided. The lint, type-check, and build jobs first perform a conservative manifest-only remote-cache probe for Bun projects; when every executable task is already a hit, they install only the pinned toolchain and restore results without installing project dependencies. Any miss falls back automatically to the normal locked install. Set `cache-turbo: true` when a repository intentionally wants both local and remote caching.
187
-
188
- New Python profiles include pinned `uv` as an accelerated, pip-compatible installer and pinned Ruff as the shared formatter/linter. Repositories with `pyproject.toml` and `uv.lock` use `uv sync --frozen` to materialize the exact environment without repeat resolution; requirements-file projects continue using the uv/pip-compatible fallback. Existing repositories without `uv` continue using pip automatically, while existing custom tool selections and dependency-file formats remain supported.
189
-
190
- Python Security audits use an isolated cache for `uv tool run` environments containing `pip-audit` when uv is available, so application lockfile changes do not redownload the scanner. They retain the same pip fallback used by CI installation. Independent `requirements.txt` and `requirements-dev.txt` audits run concurrently and aggregate failures. JavaScript, Rust, and Python audit jobs run concurrently when their ecosystems are present. The Python matrix is profile-gated so repositories without applicable Python inputs avoid a no-op runner; JavaScript and Rust retain independent detection so active audits start without waiting for the profile job. Every active ecosystem still reports a failure if its audit fails.
191
-
192
- CI and Test jobs perform a source-only applicability check before setup. Empty integration, E2E, smoke, or language-specific jobs remain visible as successful required checks but skip runner tool installation and dependency setup.
193
-
194
- On pull requests and ordinary pushes, CI, Test, and Security also recognize governance-only changes (README, license, issue/PR templates, CODEOWNERS, Code of Conduct, CONTRIBUTING, and SECURITY) and leave the required jobs successful without installing tools or running unrelated checks. Any source, dependency, workflow, profile, or build configuration change runs the full applicable checks; an unavailable diff always falls back to running them.
195
-
196
- Security dependency audits apply the same fail-open change detection per ecosystem: JavaScript, Rust, and Python audits skip setup for source-only pushes and pull requests that do not change that ecosystem's manifests, lockfiles, audit allowlist, or shared tool configuration. Scheduled scans, manual runs, and uncertain diffs always audit normally.
197
-
198
- The shared setup action accepts `install-javascript`, `install-python`, and `install-rust` switches. They default to `true` for compatibility, while the standard CI jobs disable ecosystems that their task cannot use: formatting skips project Cargo/Python installs, and lint, type-check, and build skip Python dependency installation. Test jobs pass their task profile (`unit`, `integration`, `e2e`, or `smoke`) and disable unrelated ecosystem caches, dependency installs, and mise tools; mixed-language repositories therefore pay only for languages used by that suite. Mise tool installation defaults to `auto`, so each job installs only configured tools for languages actually detected in the repository. Repositories without `.mise.toml` skip mise entirely and use the runner/project environment; callers can use `mise-scope: all` when a task intentionally spans every configured ecosystem.
199
-
200
- It also accepts `mise-scope` (`auto`, `all`, `javascript`, `python`, or `rust`). Security's parallel ecosystem matrix uses this to install only the active language toolchain and restore only its package caches; callers that omit it get automatic profile-based tool selection, while `all` remains available for tasks that intentionally span every configured ecosystem.
201
-
202
- Lightweight orchestration jobs use GitHub's `ubuntu-slim` runner: Draft PR, Release PR, release detection, Release Please, npm publication, dependency review, CodeQL language detection, and dependency audits. Build, format, lint, type-check, integration/E2E/smoke tests, and active CodeQL analysis use full `ubuntu-latest` runners because toolchain initialization, native libraries, browsers, and source analysis may benefit from full runner resources. Unit tests default to `ubuntu-slim` for small projects, but dependency-heavy or native suites should set the repository variable `REPO_FOUNDRY_UNIT_RUNNER=ubuntu-latest`; measurements across the maintained monorepos showed materially faster installs and test execution on the full runner.
203
-
204
- Release and Security metadata jobs also use blobless checkouts where a checkout is needed, reducing source transfer while preserving on-demand manifest access.
205
-
206
- CodeQL keeps every configured language check visible but skips analyzers whose source, dependencies, or configuration were untouched by a push or pull request. Unchanged analyzer jobs use `ubuntu-slim` and skip both checkout and analysis while remaining visible to branch protection; changed analyzers use full `ubuntu-latest` runners. Its detection job uses a blobless, sparse checkout because it only needs Git paths, metadata, and repository manifests; analyzer jobs still use full checkouts. Scheduled and manually dispatched CodeQL runs remain full scans.
207
-
208
- CodeQL uploads SARIF findings for GitHub code scanning but does not archive the intermediate database in the reusable baseline; this keeps coverage and alert processing while avoiding an unnecessary database transfer. The required workflow check gates on successful SARIF upload acknowledgment and does not wait for GitHub’s asynchronous post-upload processing, shortening the CI critical path while retaining the uploaded findings.
209
-
210
- Coverage is enforced at 80% for Python and Bun test suites when those ecosystems expose coverage support. Rust projects must keep their native test suites green; repositories with `cargo-llvm-cov` should enforce the same 80% line target in their Cargo coverage configuration.
211
-
212
- ## Test runner standard
101
+ ## Releases and publishing
213
102
 
214
- For TypeScript and JavaScript tests, use Bun's native test runner by default. Do not add Vitest to projects based on this template. Preserve specialized native runners such as Matchstick for The Graph and Hardhat for smart contracts.
103
+ The standard flow promotes `staging` into `main`, lets Release Please open a
104
+ versioned release PR, and creates a GitHub release after that PR is merged.
105
+ npm publication is opt-in through `npm_publish: true` and supports npm trusted
106
+ publishing or an `NPM_TOKEN` fallback.
215
107
 
216
- ## Optional Turborepo remote caching
108
+ Read [Release management](docs/RELEASES.md) and
109
+ [Publishing packages](docs/PUBLISHING.md) before enabling automated
110
+ publishing. They are intentionally written with placeholders so they can be
111
+ copied into other repositories.
217
112
 
218
- Turborepo repositories can use Vercel Remote Caching without changing the workflows. Add these repository settings:
113
+ ## Documentation and extensions
219
114
 
220
- - Secret: `TURBO_TOKEN`
221
- - Repository variable: `TURBO_TEAM`
115
+ The `docs/` directory contains generalized operational guides. Add
116
+ repository-specific documentation there as well; synchronization does not
117
+ replace files in `docs/`.
222
118
 
223
- CI and Test pass those values to every job. Non-Turborepo repositories and repositories without the settings simply use their normal local cache behavior. This does not require the repository to deploy to Vercel.
119
+ - [Documentation index](docs/README.md)
120
+ - [Initialization and synchronization](docs/INITIALIZATION.md)
121
+ - [Workflow and CI conventions](docs/WORKFLOWS.md)
122
+ - [Release management](docs/RELEASES.md)
123
+ - [Publishing packages](docs/PUBLISHING.md)
124
+ - [Caching and remote caching](docs/CACHING.md)
224
125
 
225
126
  ## License
226
127
 
227
- Unless a repository says otherwise, new material is licensed under the GNU Affero General Public License v3.0-or-later. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
228
-
229
- ## GitHub security behavior
230
-
231
- The CodeQL workflow uses GitHub's official CodeQL actions, detects Actions, TypeScript, Python, and Rust automatically, and runs each language in parallel. It runs automatically for public repositories and skips itself for private repositories unless GitHub Code Security is enabled. Dependency Review is isolated in the Security workflow and runs only for public pull requests. If GitHub's Code Scanning default setup is enabled, disable that generated `dynamic/github-code-scanning/codeql` workflow after installing this checked-in workflow; otherwise GitHub will run two CodeQL analyzers. The default setup can be disabled with `gh api --method PATCH repos/OWNER/REPO/code-scanning/default-setup -f state=not-configured` when Code Security is available.
128
+ Unless a repository says otherwise, new material is licensed under the GNU
129
+ Affero General Public License v3.0-or-later. See [LICENSE](LICENSE) and
130
+ [NOTICE](NOTICE).
@@ -0,0 +1,29 @@
1
+ # Caching and remote caching
2
+
3
+ ## Local workflow caching
4
+
5
+ The standard runtime uses lockfile- and configuration-keyed caches for package
6
+ stores, Cargo, pip/uv, browser binaries, and applicable build artifacts. Cache
7
+ misses always fall back to a clean locked install. Do not cache credentials,
8
+ generated secrets, or mutable environments without an exact dependency key.
9
+
10
+ Repositories should measure before enabling large installed-tree or build
11
+ caches. Set repository variables such as `REPO_FOUNDRY_CACHE_PACKAGES` and
12
+ `REPO_FOUNDRY_CACHE_BUILD` only when a repeatable warm-cache benefit is proven.
13
+
14
+ ## Turborepo and Vercel Remote Caching
15
+
16
+ Turborepo repositories can opt into Vercel Remote Caching with:
17
+
18
+ - Secret: `TURBO_TOKEN`
19
+ - Repository variable: `TURBO_TEAM`
20
+
21
+ Non-Turborepo repositories do not need either setting. Deployment to Vercel is
22
+ not required. Custom workflows can pass these values to Turbo directly when
23
+ the repository's task graph benefits from remote reuse.
24
+
25
+ ## Runner selection
26
+
27
+ Lightweight detection, orchestration, audits, and release metadata jobs can use
28
+ `ubuntu-slim`. Toolchain-heavy builds, native compilation, browsers, and active
29
+ CodeQL analysis should use `ubuntu-latest` unless measurements show otherwise.
@@ -0,0 +1,56 @@
1
+ # Initialization and synchronization
2
+
3
+ ## Commands
4
+
5
+ Run the package from a repository root:
6
+
7
+ ```bash
8
+ npx code-foundry init [options]
9
+ npx code-foundry sync [options]
10
+ npx code-foundry doctor
11
+ ```
12
+
13
+ Use `--dry-run` to preview changes. Use `--no-bootstrap` when the repository is
14
+ being initialized in CI or on a machine without mise. Run
15
+ `bash .github/scripts/bootstrap.sh` later to install tools, enable hooks, and
16
+ run the repository doctor.
17
+
18
+ ## Profiles and features
19
+
20
+ Supported languages are `typescript`, `rust`, `python`, and `solidity`.
21
+ `--languages auto` detects them from manifests and source files. Profiles are
22
+ `auto`, `application`, `monorepo`, and `minimal`.
23
+
24
+ Standard features are `ci`, `codeql`, `security`, `test`, `draft-pr`,
25
+ `release-pr`, `release`, and `dependabot`. `all` enables every standard
26
+ feature. `--prune` removes disabled standard workflows only; it never removes
27
+ custom workflows.
28
+
29
+ ## Runtime selection
30
+
31
+ Reusable workflow callers require a literal repository and ref. By default,
32
+ the initializer derives the runtime repository from the source template. Use
33
+ these options for a fork or a staged runtime:
34
+
35
+ ```bash
36
+ npx code-foundry init \
37
+ --runtime-repository OWNER/REPO \
38
+ --runtime-ref v1.2.3
39
+ ```
40
+
41
+ Both values are persisted in `.github/template.yml` and rendered into the
42
+ standard callers. `REPO_FOUNDRY_RUNTIME_REPOSITORY` and
43
+ `REPO_FOUNDRY_RUNTIME_REF` provide equivalent environment/repository-variable
44
+ overrides.
45
+
46
+ ## Safety rules
47
+
48
+ Synchronization preserves authored README and policy documents, existing
49
+ `.mise.toml` selections, application code, custom workflows, and repository
50
+ documentation. Existing licenses are preserved unless a license or license
51
+ file is explicitly selected. Use `--force` only when intentionally refreshing
52
+ protected standard documents.
53
+
54
+ The initializer generates `.github/template.yml` as the repository-owned
55
+ configuration contract. Keep project-specific settings there rather than
56
+ editing generated workflow callers by hand.
@@ -0,0 +1,49 @@
1
+ # Publishing packages
2
+
3
+ ## npm
4
+
5
+ Set `npm_publish: true` only when the repository owns an npm package. Configure
6
+ npm trusted publishing for the repository's `release.yml` workflow whenever
7
+ possible. An `NPM_TOKEN` secret is the fallback for registries or repositories
8
+ that cannot use trusted publishing.
9
+
10
+ The package should define its intended visibility explicitly:
11
+
12
+ ```json
13
+ {
14
+ "publishConfig": {
15
+ "access": "public"
16
+ }
17
+ }
18
+ ```
19
+
20
+ Publication occurs only from a Release Please tag; ordinary pushes do not
21
+ publish. The release workflow fails clearly when npm publication is enabled but
22
+ neither trusted publishing nor a token is configured.
23
+
24
+ After enabling publication, make one controlled release and verify both the
25
+ registry version and the provenance link before treating the repository as
26
+ fully configured.
27
+
28
+ ## GitHub Releases and GitHub Packages
29
+
30
+ A GitHub Release is release metadata attached to a Git tag. It is independent
31
+ of the npm registry and of GitHub Packages.
32
+
33
+ Publishing to npm does not populate the repository's GitHub Packages section.
34
+ If a repository also needs a GitHub Container Registry or npm-compatible
35
+ GitHub Package, add a repository-owned publishing workflow and credentials;
36
+ that is an optional extension rather than part of the universal baseline.
37
+
38
+ ## Provenance and verification
39
+
40
+ Prefer trusted publishing because it provides short-lived credentials and
41
+ provenance. After a release, verify:
42
+
43
+ ```bash
44
+ npm view PACKAGE_NAME version dist-tags
45
+ gh release view vVERSION
46
+ ```
47
+
48
+ For private or non-npm repositories, leave `npm_publish: false` and retain the
49
+ GitHub Release portion of the standard flow if versioned releases are useful.
package/docs/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # Documentation
2
+
3
+ These guides describe the reusable repository baseline in provider-neutral
4
+ terms. They are suitable for copying into another repository and adapting with
5
+ its own names, environments, and deployment details.
6
+
7
+ ## Guides
8
+
9
+ - [Initialization and synchronization](INITIALIZATION.md)
10
+ - [Workflow and CI conventions](WORKFLOWS.md)
11
+ - [Release management](RELEASES.md)
12
+ - [Publishing packages](PUBLISHING.md)
13
+ - [Caching and remote caching](CACHING.md)
14
+
15
+ ## Repository-specific documentation
16
+
17
+ Add project-specific guides, architecture notes, runbooks, and deployment
18
+ instructions to this directory. The Code Foundry initializer preserves `docs/`
19
+ files during synchronization. Prefer clear, task-oriented filenames and link
20
+ new documents from this index when they become part of the supported workflow.
@@ -0,0 +1,47 @@
1
+ # Release management
2
+
3
+ ## Branch flow
4
+
5
+ The standard environment flow is:
6
+
7
+ ```text
8
+ topic branch -> staging -> main -> versioned release
9
+ ```
10
+
11
+ Keep commits Conventional Commit-shaped (`feat:`, `fix:`, `docs:`, `ci:`,
12
+ `chore:`, and so on). Release Please uses them to select patch/minor/major
13
+ versions and generate grouped changelog notes.
14
+
15
+ The release workflow opens or updates a versioned PR after changes reach
16
+ `main`. Merging that PR updates the changelog, creates the Git tag and GitHub
17
+ Release, and triggers any configured package publication.
18
+
19
+ For an explicit version, put `Release-As: 2.0.0` in a commit or pull request
20
+ body. Existing `CHANGELOG.md` history remains repository-owned.
21
+
22
+ ## Configuration
23
+
24
+ Set these values in `.github/template.yml`:
25
+
26
+ ```yaml
27
+ release_type: auto # auto, node, python, rust, simple, or none
28
+ npm_publish: false # true only for an npm package
29
+ ```
30
+
31
+ `auto` selects a supported manifest. Use `simple` with `version.txt` for a
32
+ repository without a package manifest and `none` for a repository that should
33
+ not release automatically.
34
+
35
+ ## Pull request permissions
36
+
37
+ If the default `GITHUB_TOKEN` cannot create pull requests, configure a narrowly
38
+ scoped `RELEASE_PLEASE_TOKEN` repository or organization secret. The release
39
+ workflow needs `contents`, `issues`, and `pull-requests` permissions.
40
+
41
+ ## Operational checklist
42
+
43
+ 1. Merge tested changes from `staging` into `main`.
44
+ 2. Review the generated Release Please PR and changelog.
45
+ 3. Merge the release PR with the repository's normal linear-history policy.
46
+ 4. Confirm the GitHub Release and any package publication.
47
+ 5. Synchronize `staging` with the new `main` release commit.
@@ -0,0 +1,66 @@
1
+ # Workflow and CI conventions
2
+
3
+ ## Standard triggers
4
+
5
+ The default standard callers use:
6
+
7
+ ```yaml
8
+ push:
9
+ branches: [main, staging]
10
+ pull_request:
11
+ branches: [staging]
12
+ ```
13
+
14
+ Draft PR automation may additionally listen to supported topic branches.
15
+ Custom deployment, indexing, search, Slither, or other workflows are
16
+ repository-owned extensions and should keep their own triggers and permissions.
17
+
18
+ ## Standard workflow responsibilities
19
+
20
+ | Workflow | Responsibility |
21
+ | --- | --- |
22
+ | CI | Format, lint, type-check, and build |
23
+ | Test | Unit, integration, E2E, and smoke tests |
24
+ | Security | Profile, audits, and public-only Dependency Review |
25
+ | CodeQL | GitHub-native code scanning, kept separate from CI |
26
+ | Draft PR | Create/update development pull requests |
27
+ | Release PR | Promote `staging` into `main` |
28
+ | Release | Release Please, GitHub release, and optional npm publication |
29
+
30
+ Use concise job names such as `CI / Format`, `Test / Unit`, and
31
+ `CodeQL / Analyze (Python)`. Required checks should match the jobs actually
32
+ enabled for the repository profile.
33
+
34
+ ## Language defaults
35
+
36
+ - TypeScript/JavaScript: ESLint, Prettier, and Bun's native `bun test`.
37
+ - Rust: default `rustfmt`, Clippy with `-D warnings`, and Cargo tests.
38
+ - Python: Ruff formatting/linting, uv when a compatible lockfile exists, and
39
+ native Python tests.
40
+ - Solidity: preserve the repository's native Hardhat, Foundry, or specialized
41
+ test/security workflows.
42
+
43
+ Jobs detect applicability before installing tools. Empty language or test
44
+ surfaces remain successful and visible, so branch protection does not become
45
+ ambiguous for mixed-language repositories.
46
+
47
+ ## Security behavior
48
+
49
+ CodeQL is a separate workflow using GitHub's official actions. Dependency
50
+ Review is skipped where GitHub does not support it, while JavaScript, Python,
51
+ and Rust audits remain available without Advanced Security. If GitHub default
52
+ setup is enabled, disable its generated CodeQL workflow to avoid duplicate
53
+ analysis.
54
+
55
+ ## Branch protection
56
+
57
+ Use the initializer's protection helper after reviewing the repository's
58
+ enabled features:
59
+
60
+ ```bash
61
+ bash .github/scripts/init-repo.sh --protection
62
+ ```
63
+
64
+ Keep strict status checks, linear history, and conversation resolution enabled.
65
+ For a repository with optional features disabled, do not require checks that
66
+ will never run.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-foundry",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "description": "A fast, language-aware repository factory for agent-ready workflows, testing, security, and release automation.",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-or-later",
@@ -18,6 +18,7 @@
18
18
  },
19
19
  "files": [
20
20
  "src",
21
+ "docs",
21
22
  ".github",
22
23
  ".githooks",
23
24
  ".editorconfig",