code-foundry 0.39.4 → 0.40.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.
@@ -33,6 +33,12 @@ jobs:
33
33
  outputs:
34
34
  mode: ${{ steps.classify.outputs.mode }}
35
35
  steps:
36
+ # The runtime classifies policy from the consumer repository's config.
37
+ # Keep this checkout before the isolated runtime checkout below.
38
+ - name: Checkout consumer repository
39
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
40
+ with:
41
+ persist-credentials: false
36
42
  - name: Checkout runtime
37
43
  uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
38
44
  with:
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.40.1](https://github.com/0xPlayerOne/code-foundry/compare/v0.40.0...v0.40.1) (2026-08-31)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **validation:** load consumer audit policy ([8d13173](https://github.com/0xPlayerOne/code-foundry/commit/8d13173a36849528335f87a550072e08137f4473))
9
+
10
+ ## [0.40.0](https://github.com/0xPlayerOne/code-foundry/compare/v0.39.4...v0.40.0) (2026-08-31)
11
+
12
+
13
+ ### Features
14
+
15
+ * **validation:** allow audit mode on staging PRs ([0d95123](https://github.com/0xPlayerOne/code-foundry/commit/0d951230b9095d3b875db44ae8287335152eee60))
16
+
3
17
  ## [0.39.4](https://github.com/0xPlayerOne/code-foundry/compare/v0.39.3...v0.39.4) (2026-08-29)
4
18
 
5
19
 
@@ -35,6 +35,7 @@ repository manifests and source
35
35
  | `languages` | detected list | TypeScript, Rust, Python, Solidity |
36
36
  | `package_manager` | `bun`, `pnpm`, `yarn`, `npm`, `none` | JavaScript setup |
37
37
  | `toolchain` | `auto`, `native`, `mise` | Environment setup policy; defaults to `auto` |
38
+ | `staging_validation_mode` | `fast`, `audit` | Validation tier for pull requests targeting `staging`; defaults to `fast` |
38
39
  | `features` | `all` or a list | Standard workflow callers |
39
40
  | `codeql` | `auto`, `true`, `false` | CodeQL policy; public repositories default to enabled, non-public repositories default to disabled |
40
41
  | `codeql_rust_shards` | JSON array of paths | Rust scan scopes; `["all"]` keeps the safe single full scan |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-foundry",
3
- "version": "0.39.4",
3
+ "version": "0.40.1",
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",
@@ -100,6 +100,12 @@ export function syncRepository(options) {
100
100
  if (!['direct', 'staging-release'].includes(workflow)) {
101
101
  throw new Error(`Unsupported git_workflow: ${workflow}; use direct or staging-release.`)
102
102
  }
103
+ const stagingValidationMode = configured(config.staging_validation_mode, 'fast')
104
+ if (!['fast', 'audit'].includes(stagingValidationMode)) {
105
+ throw new Error(
106
+ `Unsupported staging_validation_mode: ${stagingValidationMode}; use fast or audit.`
107
+ )
108
+ }
103
109
  const mergeStrategy = configured(config.merge_strategy, 'rebase')
104
110
  if (workflow === 'staging-release' && mergeStrategy !== 'rebase') {
105
111
  throw new Error(`Unsupported merge_strategy: ${mergeStrategy}; the staging-release topology requires rebase for staging to main promotions.`)
@@ -429,7 +435,13 @@ function renderDependabot(content, config, languages) {
429
435
  * @returns {string}
430
436
  */
431
437
  export function renderContributionDocs(content, file, config) {
432
- if (isStagingRelease(config.git_workflow)) return content
438
+ if (isStagingRelease(config.git_workflow)) {
439
+ if (configured(config.staging_validation_mode, 'fast') !== 'audit') return content
440
+ return content.replace(
441
+ 'Fast validation: CI plus unit tests, ending in `Validation / Gate`',
442
+ 'Audit validation: CI, full tests, Security, and CodeQL, ending in `Validation / Gate`'
443
+ )
444
+ }
433
445
  const replacements = DIRECT_DOC_REPLACEMENTS[file]
434
446
  if (!replacements) return content
435
447
  let rendered = content
@@ -645,7 +657,7 @@ function createDefaultConfig(root, source) {
645
657
  codeql_rust_shards: '["all"]', codeql_rust_threads: '1', codeql_rust_max_parallel: '1',
646
658
  runtime_repository: '0xPlayerOne/code-foundry', runtime_ref: `v${readPackageVersion(source)}`,
647
659
  ...runners,
648
- toolchain: 'auto',
660
+ toolchain: 'auto', staging_validation_mode: 'fast',
649
661
  prune_standard: 'false', cache_packages: 'auto', cache_build: 'auto', coverage_minimum: '80', turbo_remote: 'auto',
650
662
  release_type: detectPackageManager(root) === 'none' ? 'auto' : 'node', npm_publish: 'false',
651
663
  post_release: 'false', post_release_workflow: '', post_release_mode: 'auto',
@@ -40,18 +40,18 @@ export function isReleasePleaseHead(headRef) {
40
40
 
41
41
  /**
42
42
  * Classify an event into exactly one validation mode, failing closed:
43
- * - fast: pull_request targeting staging
43
+ * - fast or audit: pull_request targeting staging, according to the repository policy
44
44
  * - release: pull_request targeting main whose head is the exact approved
45
45
  * Release Please prefix
46
46
  * - audit: every other pull_request targeting main, plus schedule and
47
47
  * workflow_dispatch
48
48
  * Unsupported events (for example push) and unsupported base branches are
49
49
  * rejected so canonical validation can never silently run or silently skip.
50
- * @param {{ eventName: string, baseRef?: string, headRef?: string }} input
50
+ * @param {{ eventName: string, baseRef?: string, headRef?: string, stagingMode?: string }} input
51
51
  * @returns {'fast'|'audit'|'release'}
52
52
  */
53
53
  export function classifyValidationMode(input) {
54
- const { eventName, baseRef, headRef } = input
54
+ const { eventName, baseRef, headRef, stagingMode = 'fast' } = input
55
55
  if (typeof eventName !== 'string' || !VALIDATION_EVENTS.includes(eventName)) {
56
56
  throw new Error(
57
57
  `Unsupported validation event: ${eventName ?? '(missing)'}; canonical validation must not run on this event.`
@@ -64,7 +64,14 @@ export function classifyValidationMode(input) {
64
64
  if (typeof headRef !== 'string' || headRef.length === 0) {
65
65
  throw new Error('pull_request classification requires head_ref.')
66
66
  }
67
- if (baseRef === 'staging') return 'fast'
67
+ if (baseRef === 'staging') {
68
+ if (stagingMode !== 'fast' && stagingMode !== 'audit') {
69
+ throw new Error(
70
+ `Unsupported staging validation mode: ${stagingMode || '(missing)'}; expected fast or audit.`
71
+ )
72
+ }
73
+ return stagingMode
74
+ }
68
75
  if (baseRef === 'main') return isReleasePleaseHead(headRef) ? 'release' : 'audit'
69
76
  throw new Error(`Unsupported pull_request base branch: ${baseRef}; expected staging or main.`)
70
77
  }
package/src/runtime.mjs CHANGED
@@ -53,6 +53,7 @@ function validation(task) {
53
53
  eventName: process.env.FOUNDRY_EVENT_NAME ?? '',
54
54
  baseRef: process.env.FOUNDRY_BASE_REF ?? '',
55
55
  headRef: process.env.FOUNDRY_HEAD_REF ?? '',
56
+ stagingMode: config.staging_validation_mode,
56
57
  }))
57
58
  return
58
59
  }