code-foundry 0.21.2 → 0.22.0

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.
@@ -170,7 +170,7 @@ Required checks are enforced by branch protection. Do not duplicate their checkl
170
170
 
171
171
  ### Release conventions
172
172
 
173
- Use Conventional Commits so the release automation can determine the next version: `fix:` produces a patch release, `feat:` produces a minor release, and `!` or `BREAKING CHANGE:` produces a major release. Add `Release-As: x.y.z` only when a deliberate version override is needed. The release workflow maintains the changelog and GitHub release after changes land on `main`; npm publication is opt-in through `.github/template.yml`.
173
+ Use Conventional Commits so the release automation can determine the next version: `fix:` produces a patch release, `feat:` produces a minor release, and `!` or `BREAKING CHANGE:` produces a major release. Add `Release-As: x.y.z` only when a deliberate version override is needed. The release workflow maintains the changelog and GitHub release after changes land on `main`; npm publication is opt-in through `.github/code-foundry.yml`.
174
174
 
175
175
  Security checks can be skipped when repository visibility or the GitHub plan does not support a feature. A skipped optional check must not be configured as a required status check.
176
176
 
@@ -205,8 +205,10 @@ runs:
205
205
 
206
206
  javascript_package_manager=none
207
207
  configured_package_manager=""
208
- if [ -f .github/template.yml ]; then
209
- configured_package_manager="$(awk -F': ' '/^package_manager:/ {print $2; exit}' .github/template.yml)"
208
+ config_file=.github/code-foundry.yml
209
+ [ -f "$config_file" ] || config_file=.github/template.yml
210
+ if [ -f "$config_file" ]; then
211
+ configured_package_manager="$(awk -F': ' '/^package_manager:/ {print $2; exit}' "$config_file")"
210
212
  fi
211
213
  case "$configured_package_manager" in
212
214
  bun|pnpm|yarn|npm) javascript_package_manager="$configured_package_manager" ;;
@@ -387,7 +389,7 @@ runs:
387
389
  if [ "$javascript" = true ] && task_language_needed javascript; then
388
390
  add_configured_tool node
389
391
  if { [ -f bun.lock ] || [ -f bun.lockb ] ||
390
- awk -F': ' '/^package_manager:/ {print $2; exit}' .github/template.yml 2>/dev/null | grep -qx bun; }; then
392
+ config_file=.github/code-foundry.yml; [ -f "$config_file" ] || config_file=.github/template.yml; awk -F': ' '/^package_manager:/ {print $2; exit}' "$config_file" 2>/dev/null | grep -qx bun; }; then
391
393
  add_configured_tool bun
392
394
  fi
393
395
  fi
@@ -401,7 +403,7 @@ runs:
401
403
  javascript)
402
404
  configured_tool node && mise_tools+=(node)
403
405
  if { [ -f bun.lock ] || [ -f bun.lockb ] ||
404
- awk -F': ' '/^package_manager:/ {print $2; exit}' .github/template.yml 2>/dev/null | grep -qx bun; } && configured_tool bun; then
406
+ config_file=.github/code-foundry.yml; [ -f "$config_file" ] || config_file=.github/template.yml; awk -F': ' '/^package_manager:/ {print $2; exit}' "$config_file" 2>/dev/null | grep -qx bun; } && configured_tool bun; then
405
407
  mise_tools+=(bun)
406
408
  fi
407
409
  ;;
@@ -449,12 +451,12 @@ runs:
449
451
  (inputs.cache-installed == 'true' ||
450
452
  steps.profile.outputs.javascript_package_manager == 'pnpm' ||
451
453
  steps.profile.outputs.javascript_package_manager == 'yarn') &&
452
- hashFiles('**/package.json', '**/bun.lock', '**/bun.lockb', '**/pnpm-lock.yaml', '**/yarn.lock', '**/package-lock.json', '**/.npmrc', '**/.yarnrc*', '**/.pnpmfile.cjs', '.github/template.yml', '.mise.toml', 'mise.lock') != ''
454
+ hashFiles('**/package.json', '**/bun.lock', '**/bun.lockb', '**/pnpm-lock.yaml', '**/yarn.lock', '**/package-lock.json', '**/.npmrc', '**/.yarnrc*', '**/.pnpmfile.cjs', '.github/code-foundry.yml', '.github/template.yml', '.mise.toml', 'mise.lock') != ''
453
455
  uses: actions/cache/restore@v5
454
456
  with:
455
457
  path: |
456
458
  **/node_modules
457
- key: ${{ runner.os }}-javascript-installed-v3-${{ hashFiles('**/package.json', '**/bun.lock', '**/bun.lockb', '**/pnpm-lock.yaml', '**/yarn.lock', '**/package-lock.json', '**/.npmrc', '**/.yarnrc*', '**/.pnpmfile.cjs', '.github/template.yml', '.mise.toml', 'mise.lock') }}
459
+ key: ${{ runner.os }}-javascript-installed-v3-${{ hashFiles('**/package.json', '**/bun.lock', '**/bun.lockb', '**/pnpm-lock.yaml', '**/yarn.lock', '**/package-lock.json', '**/.npmrc', '**/.yarnrc*', '**/.pnpmfile.cjs', '.github/code-foundry.yml', '.github/template.yml', '.mise.toml', 'mise.lock') }}
458
460
  - name: Restore Bun dependencies
459
461
  id: javascript-bun-cache-restore
460
462
  if: >-
@@ -463,12 +465,12 @@ runs:
463
465
  inputs.cache-installed != 'false' &&
464
466
  steps.profile.outputs.javascript_dependencies == 'true' &&
465
467
  steps.profile.outputs.javascript_package_manager == 'bun' &&
466
- hashFiles('**/package.json', '**/bun.lock', '**/bun.lockb', '**/.npmrc', '.github/template.yml', '.mise.toml', 'mise.lock') != ''
468
+ hashFiles('**/package.json', '**/bun.lock', '**/bun.lockb', '**/.npmrc', '.github/code-foundry.yml', '.github/template.yml', '.mise.toml', 'mise.lock') != ''
467
469
  uses: actions/cache/restore@v5
468
470
  with:
469
471
  path: |
470
472
  **/node_modules
471
- key: ${{ runner.os }}-javascript-installed-v4-bun-${{ hashFiles('**/package.json', '**/bun.lock', '**/bun.lockb', '**/.npmrc', '.github/template.yml', '.mise.toml', 'mise.lock') }}
473
+ key: ${{ runner.os }}-javascript-installed-v4-bun-${{ hashFiles('**/package.json', '**/bun.lock', '**/bun.lockb', '**/.npmrc', '.github/code-foundry.yml', '.github/template.yml', '.mise.toml', 'mise.lock') }}
472
474
  - name: Detect Bun dependencies
473
475
  id: javascript-bun-dependencies
474
476
  if: >-
@@ -735,7 +737,7 @@ runs:
735
737
  with:
736
738
  path: |
737
739
  **/node_modules
738
- key: ${{ runner.os }}-javascript-installed-v4-bun-${{ hashFiles('**/package.json', '**/bun.lock', '**/bun.lockb', '**/.npmrc', '.github/template.yml', '.mise.toml', 'mise.lock') }}
740
+ key: ${{ runner.os }}-javascript-installed-v4-bun-${{ hashFiles('**/package.json', '**/bun.lock', '**/bun.lockb', '**/.npmrc', '.github/code-foundry.yml', '.github/template.yml', '.mise.toml', 'mise.lock') }}
739
741
  - name: Save installed JavaScript dependencies
740
742
  if: >-
741
743
  inputs.cache-save == 'true' &&
@@ -751,7 +753,7 @@ runs:
751
753
  with:
752
754
  path: |
753
755
  **/node_modules
754
- key: ${{ runner.os }}-javascript-installed-v3-${{ hashFiles('**/package.json', '**/bun.lock', '**/bun.lockb', '**/pnpm-lock.yaml', '**/yarn.lock', '**/package-lock.json', '**/.npmrc', '**/.yarnrc*', '**/.pnpmfile.cjs', '.github/template.yml', '.mise.toml', 'mise.lock') }}
756
+ key: ${{ runner.os }}-javascript-installed-v3-${{ hashFiles('**/package.json', '**/bun.lock', '**/bun.lockb', '**/pnpm-lock.yaml', '**/yarn.lock', '**/package-lock.json', '**/.npmrc', '**/.yarnrc*', '**/.pnpmfile.cjs', '.github/code-foundry.yml', '.github/template.yml', '.mise.toml', 'mise.lock') }}
755
757
  - name: Save JavaScript packages
756
758
  if: >-
757
759
  inputs.cache-save == 'true' &&
@@ -0,0 +1,25 @@
1
+ # Canonical Code Foundry repository configuration.
2
+ version: 1
3
+ template: code-foundry@latest
4
+ profile: auto
5
+ languages: typescript
6
+ features: all
7
+ package_manager: bun
8
+ runtime_repository: 0xPlayerOne/code-foundry
9
+ runtime_ref: v0.20.2
10
+ release_type: node
11
+ npm_publish: true
12
+ license: agpl-3.0-or-later
13
+ runner: ubuntu-latest
14
+ unit_runner: ubuntu-slim
15
+ cache_packages: auto
16
+ cache_build: auto
17
+ coverage_minimum: 80
18
+ turbo_remote: auto
19
+ ci_runner: ubuntu-latest
20
+ test_runner: ubuntu-latest
21
+ security_runner: ubuntu-slim
22
+ codeql_runner: ubuntu-latest
23
+ pr_runner: ubuntu-slim
24
+ release_runner: ubuntu-slim
25
+ prune_standard: false
@@ -0,0 +1,41 @@
1
+ # Copy this file to .github/code-foundry.yml, edit the values you need, and run:
2
+ # npx code-foundry init --config .github/code-foundry.yml
3
+ # Omitted keys use automatic detection and the standard defaults. See
4
+ # docs/CONFIGURATION.md for the complete visual reference.
5
+
6
+ version: 1
7
+
8
+ # Repository shape and supported languages.
9
+ profile: auto # auto, application, monorepo, minimal
10
+ languages: auto # auto or typescript,rust,python,solidity
11
+ package_manager: auto # auto, bun, pnpm, yarn, npm
12
+
13
+ # Standard callers to install. Use `all` or a comma-separated selection.
14
+ features: all # ci, codeql, security, test, draft-pr, release-pr, release, dependabot
15
+
16
+ # Runtime source. Leave blank to infer it from the template source.
17
+ runtime_repository: # OWNER/REPO, or leave blank to infer
18
+ runtime_ref: # tag or branch, or leave blank for default
19
+
20
+ # Release and licensing behavior.
21
+ release_type: auto # auto, node, python, rust, simple, none
22
+ npm_publish: false
23
+ license: preserve # agpl-3.0-or-later, mit, preserve, none
24
+ # license_file: ./legal/LICENSE.txt
25
+
26
+ # Runner policy. Each workflow caller receives its selected runner.
27
+ runner: ubuntu-latest
28
+ unit_runner: ubuntu-slim
29
+ ci_runner: ubuntu-latest
30
+ test_runner: ubuntu-latest
31
+ security_runner: ubuntu-slim
32
+ codeql_runner: ubuntu-latest
33
+ pr_runner: ubuntu-slim
34
+ release_runner: ubuntu-slim
35
+ prune_standard: false # remove disabled standard workflows during sync
36
+
37
+ # Cache and quality policy.
38
+ cache_packages: auto # auto, true, false
39
+ cache_build: auto # auto, true, false
40
+ coverage_minimum: 80
41
+ turbo_remote: auto # auto, true, false
@@ -72,7 +72,7 @@ repo_foundry_pr_dependencies_unchanged() {
72
72
  while IFS= read -r file; do
73
73
  case "$file" in
74
74
  .github/workflows/security.yml|.github/scripts/security.sh|.github/scripts/changed-files.sh|\
75
- .github/actions/setup/action.yml|.github/template.yml|.mise.toml|mise.lock|\
75
+ .github/actions/setup/action.yml|.github/code-foundry.yml|.github/template.yml|.mise.toml|mise.lock|\
76
76
  .github/security-audit-allowlist.txt)
77
77
  return 1
78
78
  ;;
@@ -93,8 +93,12 @@ package_manager() {
93
93
  local configured=""
94
94
  if [ -x .github/scripts/profile.sh ]; then
95
95
  configured="$(bash .github/scripts/profile.sh get package_manager 2>/dev/null || true)"
96
- elif [ -f .github/template.yml ]; then
97
- configured="$(awk -F': ' '/^package_manager:/ {print $2; exit}' .github/template.yml)"
96
+ else
97
+ config_file=.github/code-foundry.yml
98
+ [ -f "$config_file" ] || config_file=.github/template.yml
99
+ if [ -f "$config_file" ]; then
100
+ configured="$(awk -F': ' '/^package_manager:/ {print $2; exit}' "$config_file")"
101
+ fi
98
102
  fi
99
103
  case "$configured" in
100
104
  bun|pnpm|yarn|npm) echo "$configured"; return ;;
@@ -25,8 +25,12 @@ if find .github/workflows -type f \( -name '*.yml' -o -name '*.yaml' \) -print -
25
25
  configured=""
26
26
  if [ -x .github/scripts/profile.sh ]; then
27
27
  configured="$(bash .github/scripts/profile.sh get languages 2>/dev/null || true)"
28
- elif [ -f .github/template.yml ]; then
29
- configured="$(awk -F': ' '/^languages:/ {print $2; exit}' .github/template.yml)"
28
+ else
29
+ config_file=.github/code-foundry.yml
30
+ [ -f "$config_file" ] || config_file=.github/template.yml
31
+ if [ -f "$config_file" ]; then
32
+ configured="$(awk -F': ' '/^languages:/ {print $2; exit}' "$config_file")"
33
+ fi
30
34
  fi
31
35
 
32
36
  if [ "$configured" = auto ] || [ "$configured" = all ] || [ -z "$configured" ]; then
@@ -4,8 +4,10 @@ set -euo pipefail
4
4
  errors=0
5
5
 
6
6
  configured_features="all"
7
- if [ -f .github/template.yml ]; then
8
- configured_features="$(awk -F': ' '/^features:/ {print $2; exit}' .github/template.yml)"
7
+ config_file=.github/code-foundry.yml
8
+ [ -f "$config_file" ] || config_file=.github/template.yml
9
+ if [ -f "$config_file" ]; then
10
+ configured_features="$(awk -F': ' '/^features:/ {print $2; exit}' "$config_file")"
9
11
  [ -n "$configured_features" ] || configured_features="all"
10
12
  fi
11
13
 
@@ -3,6 +3,7 @@ set -euo pipefail
3
3
 
4
4
  source="${REPO_FOUNDRY_SOURCE:-https://github.com/${GITHUB_REPOSITORY_OWNER:-OWNER}/code-foundry.git}"
5
5
  ref="main"
6
+ config_file="${REPO_FOUNDRY_CONFIG:-}"
6
7
  profile="${REPO_FOUNDRY_PROFILE:-auto}"
7
8
  protection=false
8
9
  dry_run=false
@@ -16,8 +17,40 @@ runtime_ref="${REPO_FOUNDRY_RUNTIME_REF:-}"
16
17
  bootstrap=true
17
18
  release_type="${REPO_FOUNDRY_RELEASE_TYPE:-auto}"
18
19
  npm_publish="${REPO_FOUNDRY_NPM_PUBLISH:-false}"
20
+ prune_standard="${REPO_FOUNDRY_PRUNE_STANDARD:-false}"
19
21
  license="${REPO_FOUNDRY_LICENSE:-agpl-3.0-or-later}"
20
22
  license_file="${REPO_FOUNDRY_LICENSE_FILE:-}"
23
+ runner="${REPO_FOUNDRY_RUNNER:-ubuntu-latest}"
24
+ unit_runner="${REPO_FOUNDRY_UNIT_RUNNER:-ubuntu-slim}"
25
+ ci_runner="${REPO_FOUNDRY_CI_RUNNER:-ubuntu-latest}"
26
+ test_runner="${REPO_FOUNDRY_TEST_RUNNER:-ubuntu-latest}"
27
+ security_runner="${REPO_FOUNDRY_SECURITY_RUNNER:-ubuntu-slim}"
28
+ codeql_runner="${REPO_FOUNDRY_CODEQL_RUNNER:-ubuntu-latest}"
29
+ pr_runner="${REPO_FOUNDRY_PR_RUNNER:-ubuntu-slim}"
30
+ release_runner="${REPO_FOUNDRY_RELEASE_RUNNER:-ubuntu-slim}"
31
+ cache_packages="${REPO_FOUNDRY_CACHE_PACKAGES:-auto}"
32
+ cache_build="${REPO_FOUNDRY_CACHE_BUILD:-auto}"
33
+ coverage_minimum="${REPO_FOUNDRY_COVERAGE_MINIMUM:-80}"
34
+ turbo_remote="${REPO_FOUNDRY_TURBO_REMOTE:-auto}"
35
+
36
+ profile_set=false
37
+ languages_set=false
38
+ features_set=false
39
+ package_manager_set=false
40
+ runtime_repository_set=false
41
+ runtime_ref_set=false
42
+ release_type_set=false
43
+ npm_publish_set=false
44
+ license_set=false
45
+ [ -n "${REPO_FOUNDRY_PROFILE:-}" ] && profile_set=true
46
+ [ -n "${REPO_FOUNDRY_LANGUAGES:-}" ] && languages_set=true
47
+ [ -n "${REPO_FOUNDRY_FEATURES:-}" ] && features_set=true
48
+ [ -n "${REPO_FOUNDRY_PACKAGE_MANAGER:-}" ] && package_manager_set=true
49
+ [ -n "${REPO_FOUNDRY_RUNTIME_REPOSITORY:-}" ] && runtime_repository_set=true
50
+ [ -n "${REPO_FOUNDRY_RUNTIME_REF:-}" ] && runtime_ref_set=true
51
+ [ -n "${REPO_FOUNDRY_RELEASE_TYPE:-}" ] && release_type_set=true
52
+ [ -n "${REPO_FOUNDRY_NPM_PUBLISH:-}" ] && npm_publish_set=true
53
+ [ -n "${REPO_FOUNDRY_LICENSE:-}" ] && license_set=true
21
54
  tool_dir=""
22
55
 
23
56
  cleanup() {
@@ -34,6 +67,7 @@ Initialize or synchronize a repository from the shared baseline.
34
67
  Options:
35
68
  --source PATH_OR_URL Template source (default: REPO_FOUNDRY_SOURCE or GitHub owner)
36
69
  --ref REF Template branch or tag (default: main)
70
+ --config PATH Use a .github/code-foundry.yml configuration file
37
71
  --profile NAME auto, application, monorepo, or minimal
38
72
  --languages LIST auto or comma-separated: typescript,rust,python,solidity
39
73
  --features LIST all or comma-separated optional features:
@@ -63,14 +97,15 @@ while [ "$#" -gt 0 ]; do
63
97
  case "$1" in
64
98
  --source) source="${2:?missing source path or URL}"; shift 2 ;;
65
99
  --ref) ref="${2:?missing ref}"; shift 2 ;;
66
- --profile) profile="${2:?missing profile}"; shift 2 ;;
67
- --languages) languages="${2:?missing language list}"; shift 2 ;;
68
- --features) features="${2:?missing feature list}"; shift 2 ;;
69
- --package-manager) package_manager="${2:?missing package manager}"; shift 2 ;;
70
- --runtime-repository) runtime_repository="${2:?missing runtime repository}"; shift 2 ;;
71
- --runtime-ref) runtime_ref="${2:?missing runtime ref}"; shift 2 ;;
72
- --release-type) release_type="${2:?missing release type}"; shift 2 ;;
73
- --license) license="${2:?missing license}"; shift 2 ;;
100
+ --config) config_file="${2:?missing config path}"; shift 2 ;;
101
+ --profile) profile="${2:?missing profile}"; profile_set=true; shift 2 ;;
102
+ --languages) languages="${2:?missing language list}"; languages_set=true; shift 2 ;;
103
+ --features) features="${2:?missing feature list}"; features_set=true; shift 2 ;;
104
+ --package-manager) package_manager="${2:?missing package manager}"; package_manager_set=true; shift 2 ;;
105
+ --runtime-repository) runtime_repository="${2:?missing runtime repository}"; runtime_repository_set=true; shift 2 ;;
106
+ --runtime-ref) runtime_ref="${2:?missing runtime ref}"; runtime_ref_set=true; shift 2 ;;
107
+ --release-type) release_type="${2:?missing release type}"; release_type_set=true; shift 2 ;;
108
+ --license) license="${2:?missing license}"; license_set=true; shift 2 ;;
74
109
  --license-file) license_file="${2:?missing license file}"; shift 2 ;;
75
110
  --npm-publish) npm_publish=true; shift ;;
76
111
  --dry-run) dry_run=true; shift ;;
@@ -86,6 +121,59 @@ while [ "$#" -gt 0 ]; do
86
121
  esac
87
122
  done
88
123
 
124
+ if [ -n "$config_file" ]; then
125
+ [ -f "$config_file" ] || { printf 'Configuration file not found: %s\n' "$config_file" >&2; exit 1; }
126
+ mkdir -p .github
127
+ if [ "$(cd -- "$(dirname -- "$config_file")" && pwd)/$(basename -- "$config_file")" != "$(pwd)/.github/code-foundry.yml" ]; then
128
+ cp "$config_file" .github/code-foundry.yml
129
+ fi
130
+ fi
131
+
132
+ config_path=.github/code-foundry.yml
133
+ [ -f "$config_path" ] || config_path=.github/template.yml
134
+ if [ -f "$config_path" ]; then
135
+ config_value() {
136
+ awk -F': ' -v key="$1" '$1 == key { value=$2; sub(/[[:space:]]+#.*/, "", value); gsub(/^[[:space:]]+|[[:space:]]+$/, "", value); print value; exit }' "$config_path"
137
+ }
138
+ if [ "$profile_set" = false ]; then profile="$(config_value profile)"; fi
139
+ if [ "$languages_set" = false ]; then languages="$(config_value languages)"; fi
140
+ if [ "$features_set" = false ]; then features="$(config_value features)"; fi
141
+ if [ "$package_manager_set" = false ]; then package_manager="$(config_value package_manager)"; fi
142
+ if [ "$runtime_repository_set" = false ]; then runtime_repository="$(config_value runtime_repository)"; fi
143
+ if [ "$runtime_ref_set" = false ]; then runtime_ref="$(config_value runtime_ref)"; fi
144
+ if [ "$release_type_set" = false ]; then release_type="$(config_value release_type)"; fi
145
+ if [ "$npm_publish_set" = false ]; then npm_publish="$(config_value npm_publish)"; fi
146
+ if [ "$license_set" = false ]; then license="$(config_value license)"; fi
147
+ [ -n "$license_file" ] || license_file="$(config_value license_file)"
148
+ prune_standard="$(config_value prune_standard)"
149
+ [ -n "${REPO_FOUNDRY_RUNNER:-}" ] || runner="$(config_value runner)"
150
+ [ -n "${REPO_FOUNDRY_UNIT_RUNNER:-}" ] || unit_runner="$(config_value unit_runner)"
151
+ [ -n "${REPO_FOUNDRY_CI_RUNNER:-}" ] || ci_runner="$(config_value ci_runner)"
152
+ [ -n "${REPO_FOUNDRY_TEST_RUNNER:-}" ] || test_runner="$(config_value test_runner)"
153
+ [ -n "${REPO_FOUNDRY_SECURITY_RUNNER:-}" ] || security_runner="$(config_value security_runner)"
154
+ [ -n "${REPO_FOUNDRY_CODEQL_RUNNER:-}" ] || codeql_runner="$(config_value codeql_runner)"
155
+ [ -n "${REPO_FOUNDRY_PR_RUNNER:-}" ] || pr_runner="$(config_value pr_runner)"
156
+ [ -n "${REPO_FOUNDRY_RELEASE_RUNNER:-}" ] || release_runner="$(config_value release_runner)"
157
+ [ -n "${REPO_FOUNDRY_CACHE_PACKAGES:-}" ] || cache_packages="$(config_value cache_packages)"
158
+ [ -n "${REPO_FOUNDRY_CACHE_BUILD:-}" ] || cache_build="$(config_value cache_build)"
159
+ [ -n "${REPO_FOUNDRY_COVERAGE_MINIMUM:-}" ] || coverage_minimum="$(config_value coverage_minimum)"
160
+ [ -n "${REPO_FOUNDRY_TURBO_REMOTE:-}" ] || turbo_remote="$(config_value turbo_remote)"
161
+ [ -n "$runner" ] || runner=ubuntu-latest
162
+ [ -n "$unit_runner" ] || unit_runner=ubuntu-slim
163
+ [ -n "$ci_runner" ] || ci_runner="$runner"
164
+ [ -n "$test_runner" ] || test_runner="$runner"
165
+ [ -n "$security_runner" ] || security_runner=ubuntu-slim
166
+ [ -n "$codeql_runner" ] || codeql_runner="$runner"
167
+ [ -n "$pr_runner" ] || pr_runner=ubuntu-slim
168
+ [ -n "$release_runner" ] || release_runner=ubuntu-slim
169
+ [ -n "$cache_packages" ] || cache_packages=auto
170
+ [ -n "$cache_build" ] || cache_build=auto
171
+ [ -n "$coverage_minimum" ] || coverage_minimum=80
172
+ [ -n "$turbo_remote" ] || turbo_remote=auto
173
+ [ -n "$prune_standard" ] || prune_standard=false
174
+ [ "$prune_standard" = true ] && prune=true
175
+ fi
176
+
89
177
  case "$package_manager" in
90
178
  auto|bun|pnpm|yarn|npm) ;;
91
179
  *) printf 'Unsupported package manager: %s\n' "$package_manager" >&2; exit 2 ;;
@@ -130,16 +218,19 @@ if [ "$dry_run" = true ]; then
130
218
  fi
131
219
 
132
220
  mkdir -p .github
133
- template_ref="$(awk -F': ' '/^template:/ {print $2; exit}' .github/template.yml 2>/dev/null || true)"
134
- profile="$(awk -F': ' '/^profile:/ {print $2; exit}' .github/template.yml 2>/dev/null || true)"
135
- languages="$(awk -F': ' '/^languages:/ {print $2; exit}' .github/template.yml 2>/dev/null || true)"
136
- features="$(awk -F': ' '/^features:/ {print $2; exit}' .github/template.yml 2>/dev/null || true)"
137
- package_manager="$(awk -F': ' '/^package_manager:/ {print $2; exit}' .github/template.yml 2>/dev/null || true)"
138
- runtime_repository="$(awk -F': ' '/^runtime_repository:/ {print $2; exit}' .github/template.yml 2>/dev/null || true)"
139
- runtime_ref="$(awk -F': ' '/^runtime_ref:/ {print $2; exit}' .github/template.yml 2>/dev/null || true)"
140
- release_type="$(awk -F': ' '/^release_type:/ {print $2; exit}' .github/template.yml 2>/dev/null || true)"
141
- npm_publish="$(awk -F': ' '/^npm_publish:/ {print $2; exit}' .github/template.yml 2>/dev/null || true)"
142
- license="$(awk -F': ' '/^license:/ {print $2; exit}' .github/template.yml 2>/dev/null || true)"
221
+ config_value() {
222
+ awk -F': ' -v key="$1" '$1 == key { value=$2; sub(/[[:space:]]+#.*/, "", value); gsub(/^[[:space:]]+|[[:space:]]+$/, "", value); print value; exit }' .github/code-foundry.yml
223
+ }
224
+ template_ref="$(config_value template 2>/dev/null || true)"
225
+ profile="$(config_value profile 2>/dev/null || true)"
226
+ languages="$(config_value languages 2>/dev/null || true)"
227
+ features="$(config_value features 2>/dev/null || true)"
228
+ package_manager="$(config_value package_manager 2>/dev/null || true)"
229
+ runtime_repository="$(config_value runtime_repository 2>/dev/null || true)"
230
+ runtime_ref="$(config_value runtime_ref 2>/dev/null || true)"
231
+ release_type="$(config_value release_type 2>/dev/null || true)"
232
+ npm_publish="$(config_value npm_publish 2>/dev/null || true)"
233
+ license="$(config_value license 2>/dev/null || true)"
143
234
  {
144
235
  printf 'version: 1\n'
145
236
  if [ -n "$template_ref" ]; then
@@ -151,10 +242,26 @@ license="$(awk -F': ' '/^license:/ {print $2; exit}' .github/template.yml 2>/dev
151
242
  printf 'package_manager: %s\n' "$package_manager"
152
243
  printf 'runtime_repository: %s\n' "$runtime_repository"
153
244
  printf 'runtime_ref: %s\n' "$runtime_ref"
245
+ printf 'runner: %s\n' "$runner"
246
+ printf 'unit_runner: %s\n' "$unit_runner"
247
+ printf 'ci_runner: %s\n' "$ci_runner"
248
+ printf 'test_runner: %s\n' "$test_runner"
249
+ printf 'security_runner: %s\n' "$security_runner"
250
+ printf 'codeql_runner: %s\n' "$codeql_runner"
251
+ printf 'pr_runner: %s\n' "$pr_runner"
252
+ printf 'release_runner: %s\n' "$release_runner"
154
253
  printf 'release_type: %s\n' "$release_type"
155
254
  printf 'npm_publish: %s\n' "$npm_publish"
156
255
  printf 'license: %s\n' "$license"
157
- } > .github/template.yml
256
+ if [ -n "$license_file" ]; then
257
+ printf 'license_file: %s\n' "$license_file"
258
+ fi
259
+ printf 'prune_standard: %s\n' "$prune_standard"
260
+ printf 'cache_packages: %s\n' "$cache_packages"
261
+ printf 'cache_build: %s\n' "$cache_build"
262
+ printf 'coverage_minimum: %s\n' "$coverage_minimum"
263
+ printf 'turbo_remote: %s\n' "$turbo_remote"
264
+ } > .github/code-foundry.yml
158
265
 
159
266
  if [ "$bootstrap" = false ]; then
160
267
  printf '%s\n' 'Bootstrap skipped.'
@@ -3,7 +3,8 @@ set -euo pipefail
3
3
 
4
4
  # Resolve repository settings with this precedence:
5
5
  # explicit REPO_FOUNDRY_* values (CLI callers can export them), then
6
- # .github/template.yml, then detected defaults.
6
+ # .github/code-foundry.yml, then detected defaults. A legacy
7
+ # .github/template.yml is accepted during migration.
7
8
 
8
9
  root="${REPO_FOUNDRY_ROOT:-$PWD}"
9
10
  command="detect"
@@ -31,12 +32,13 @@ while [ "$#" -gt 0 ]; do
31
32
  done
32
33
 
33
34
  cd "$root"
34
- template_file=.github/template.yml
35
+ template_file=.github/code-foundry.yml
36
+ [ -f "$template_file" ] || template_file=.github/template.yml
35
37
 
36
38
  config_value() {
37
39
  local key="$1"
38
40
  [ -f "$template_file" ] || return 0
39
- awk -F': *' -v key="$key" '$1 == key { print substr($0, index($0, ":") + 1); exit }' "$template_file" |
41
+ awk -F': *' -v key="$key" '$1 == key { value=substr($0, index($0, ":") + 1); sub(/[[:space:]]+#.*/, "", value); print value; exit }' "$template_file" |
40
42
  sed -e 's/^ *//' -e 's/ *$//' -e 's/^['"'"'"]//' -e 's/['"'"'"]$//'
41
43
  }
42
44
 
@@ -159,10 +161,17 @@ detect() {
159
161
  printf 'npm_publish=%s\n' "$npm_publish"
160
162
  printf 'runner=%s\n' "$runner"
161
163
  printf 'unit_runner=%s\n' "$unit_runner"
164
+ printf 'ci_runner=%s\n' "$(raw_value ci_runner "$runner")"
165
+ printf 'test_runner=%s\n' "$(raw_value test_runner "$runner")"
166
+ printf 'security_runner=%s\n' "$(raw_value security_runner ubuntu-slim)"
167
+ printf 'codeql_runner=%s\n' "$(raw_value codeql_runner "$runner")"
168
+ printf 'pr_runner=%s\n' "$(raw_value pr_runner ubuntu-slim)"
169
+ printf 'release_runner=%s\n' "$(raw_value release_runner ubuntu-slim)"
162
170
  printf 'cache_packages=%s\n' "$(raw_value cache_packages auto)"
163
171
  printf 'cache_build=%s\n' "$(raw_value cache_build auto)"
164
172
  printf 'coverage_minimum=%s\n' "$(raw_value coverage_minimum 80)"
165
173
  printf 'turbo_remote=%s\n' "$(raw_value turbo_remote auto)"
174
+ printf 'prune_standard=%s\n' "$(raw_value prune_standard false)"
166
175
  }
167
176
 
168
177
  case "$command" in
@@ -105,8 +105,12 @@ package_manager() {
105
105
  local configured=""
106
106
  if [ -x .github/scripts/profile.sh ]; then
107
107
  configured="$(bash .github/scripts/profile.sh get package_manager 2>/dev/null || true)"
108
- elif [ -f .github/template.yml ]; then
109
- configured="$(awk -F': ' '/^package_manager:/ {print $2; exit}' .github/template.yml)"
108
+ else
109
+ config_file=.github/code-foundry.yml
110
+ [ -f "$config_file" ] || config_file=.github/template.yml
111
+ if [ -f "$config_file" ]; then
112
+ configured="$(awk -F': ' '/^package_manager:/ {print $2; exit}' "$config_file")"
113
+ fi
110
114
  fi
111
115
  case "$configured" in
112
116
  bun|pnpm|yarn|npm) echo "$configured"; return ;;
@@ -7,9 +7,11 @@ mode="check"
7
7
  configured_features="all"
8
8
  configured_languages="auto"
9
9
 
10
- if [ -f .github/template.yml ]; then
11
- configured_features="$(awk -F': ' '/^features:/ {print $2; exit}' .github/template.yml)"
12
- configured_languages="$(awk -F': ' '/^languages:/ {print $2; exit}' .github/template.yml)"
10
+ config_file=.github/code-foundry.yml
11
+ [ -f "$config_file" ] || config_file=.github/template.yml
12
+ if [ -f "$config_file" ]; then
13
+ configured_features="$(awk -F': ' '/^features:/ {print $2; exit}' "$config_file")"
14
+ configured_languages="$(awk -F': ' '/^languages:/ {print $2; exit}' "$config_file")"
13
15
  [ -n "$configured_features" ] || configured_features="all"
14
16
  [ -n "$configured_languages" ] || configured_languages="auto"
15
17
  fi