code-foundry 0.25.0 → 0.27.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.
Files changed (47) hide show
  1. package/.githooks/pre-commit +3 -4
  2. package/.github/CONTRIBUTING.md +10 -13
  3. package/.github/actions/setup/action.yml +50 -3
  4. package/.github/code-foundry.yml +6 -1
  5. package/.github/licenses/AGPL-3.0-or-later.txt +661 -0
  6. package/.github/licenses/GPL-3.0-or-later.txt +674 -0
  7. package/.github/licenses/MIT.txt +4 -16
  8. package/.github/workflows/ci.yml +20 -23
  9. package/.github/workflows/ci_self-ci.yml +1 -1
  10. package/.github/workflows/codeql.yml +23 -29
  11. package/.github/workflows/codeql_self-ci.yml +1 -1
  12. package/.github/workflows/draft-pr.yml +2 -2
  13. package/.github/workflows/release-pr.yml +4 -4
  14. package/.github/workflows/release.yml +17 -29
  15. package/.github/workflows/security.yml +24 -19
  16. package/.github/workflows/security_self-ci.yml +1 -1
  17. package/.github/workflows/test.yml +20 -20
  18. package/.github/workflows/test_self-ci.yml +1 -1
  19. package/AGENTS.md +13 -10
  20. package/CHANGELOG.md +28 -0
  21. package/README.md +19 -8
  22. package/docs/CONFIGURATION.md +11 -2
  23. package/docs/INITIALIZATION.md +9 -5
  24. package/docs/RELEASES.md +5 -0
  25. package/docs/WORKFLOWS.md +12 -5
  26. package/package.json +7 -3
  27. package/src/cli.mjs +29 -25
  28. package/src/commands/doctor.mjs +70 -0
  29. package/src/commands/sync.mjs +224 -0
  30. package/src/lib/config.mjs +38 -0
  31. package/src/lib/profile.mjs +114 -0
  32. package/src/runtime.mjs +316 -0
  33. package/.github/scripts/bootstrap.sh +0 -21
  34. package/.github/scripts/changed-files.sh +0 -96
  35. package/.github/scripts/ci.sh +0 -641
  36. package/.github/scripts/codeql-languages.sh +0 -91
  37. package/.github/scripts/doctor.sh +0 -98
  38. package/.github/scripts/format-fast-path.sh +0 -80
  39. package/.github/scripts/init-repo.sh +0 -264
  40. package/.github/scripts/pre-commit.sh +0 -67
  41. package/.github/scripts/profile.sh +0 -186
  42. package/.github/scripts/security.sh +0 -214
  43. package/.github/scripts/sitecustomize.py +0 -17
  44. package/.github/scripts/sync-codeowners.sh +0 -76
  45. package/.github/scripts/sync-protection.sh +0 -138
  46. package/.github/scripts/sync-template.sh +0 -744
  47. package/.github/scripts/turbo-cache-probe.sh +0 -102
@@ -1,5 +1,4 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
1
+ #!/usr/bin/env sh
2
+ set -eu
3
3
 
4
- repo_root="$(git rev-parse --show-toplevel)"
5
- exec bash "$repo_root/.github/scripts/pre-commit.sh" "$@"
4
+ git diff --cached --check
@@ -48,14 +48,14 @@ docs/* test/* refactor/* │ │
48
48
  | `staging` | Integration branch | Target normal pull requests here. Required checks must pass before merge. |
49
49
  | `feat/*`, `fix/*`, `chore/*`, `refactor/*`, `docs/*`, `test/*` | Focused work | Branch from `staging`; keep changes small and reviewable. |
50
50
 
51
- Use squash merges unless the repository documents another strategy. Re-align `staging` with `main` after a release when needed.
51
+ The default Git workflow is `staging-release`: topic branches merge into `staging`, then a promotion PR moves validated changes into `main`, followed by the versioned release PR. The default merge strategy is `rebase`, which preserves the linear Conventional Commit history. Configure `merge_strategy` as `squash` or `merge` in `.github/code-foundry.yml` when the repository intentionally uses another policy. Re-align `staging` with `main` after a release when needed.
52
52
 
53
53
  ## Before you start
54
54
 
55
55
  ### Toolchain
56
56
 
57
- 1. Install [mise](https://mise.jdx.dev/).
58
- 2. Run `npx code-foundry init` to install the pinned toolchain, enable hooks, and validate the checkout.
57
+ 1. Run `npx code-foundry init` to detect the repository and enable hooks.
58
+ 2. Follow `toolchain: auto` in `.github/code-foundry.yml`; install mise only if the repository already uses it or explicitly selects it.
59
59
  3. Use `npx code-foundry doctor` when setup, lockfiles, or hooks appear out of sync.
60
60
  4. Use the repository's existing package manager and lockfile. Do not introduce a second package manager.
61
61
  5. Copy `.env.example` to the appropriate local environment file when provided. Never commit the copy.
@@ -74,17 +74,14 @@ If the worktree is dirty, stop and understand the existing changes before switch
74
74
 
75
75
  ## Local validation
76
76
 
77
- The template scripts detect supported tools and skip checks that do not apply:
77
+ The repository runtime detects supported tools and skips checks that do not apply:
78
78
 
79
79
  ```sh
80
- bash .github/scripts/ci.sh format
81
- bash .github/scripts/ci.sh lint
82
- bash .github/scripts/ci.sh type_check
83
- bash .github/scripts/ci.sh build
84
- bash .github/scripts/ci.sh unit
85
- bash .github/scripts/ci.sh integration
86
- bash .github/scripts/ci.sh e2e
87
- bash .github/scripts/ci.sh smoke
80
+ npx code-foundry doctor
81
+ npm run format:check # or the package manager's equivalent
82
+ npm run lint
83
+ npm run type-check
84
+ npm test
88
85
  Security and dependency audits run through the GitHub Security workflow.
89
86
  ```
90
87
 
@@ -110,7 +107,7 @@ For maintainers, trusted contributors, and automation agents:
110
107
 
111
108
  8. Push the branch and open a pull request into `staging`.
112
109
  9. Address review feedback and failed checks on the same branch.
113
- 10. Squash-merge only after required checks pass and the change is ready.
110
+ 10. Merge using the repository's configured `merge_strategy` after required checks pass and the change is ready.
114
111
 
115
112
  ### Internal agent handoff
116
113
 
@@ -1,5 +1,5 @@
1
1
  name: Repository Setup
2
- description: Install the pinned mise toolchain and optionally project dependencies.
2
+ description: Select mise or native language tooling and optionally install project dependencies.
3
3
 
4
4
  inputs:
5
5
  install:
@@ -85,6 +85,16 @@ runs:
85
85
  run: |
86
86
  tracked_files="$(git ls-files)"
87
87
 
88
+ toolchain="auto"
89
+ if [ -f .github/code-foundry.yml ]; then
90
+ configured_toolchain="$(awk -F': ' '/^toolchain:/ {print $2; exit}' .github/code-foundry.yml)"
91
+ [ -n "$configured_toolchain" ] && toolchain="$configured_toolchain"
92
+ fi
93
+ if [ "$toolchain" = auto ] && [ -f .mise.toml ]; then
94
+ toolchain=mise
95
+ fi
96
+ printf 'toolchain_mode=%s\n' "$toolchain" >> "$GITHUB_OUTPUT"
97
+
88
98
  has_tracked_regex() {
89
99
  printf '%s\n' "$tracked_files" | grep -Eq "$1"
90
100
  }
@@ -428,6 +438,43 @@ runs:
428
438
  REPO_FOUNDRY_TASK_RUST: ${{ inputs.task-rust }}
429
439
  REPO_FOUNDRY_CACHE_PACKAGES: ${{ inputs.cache-packages }}
430
440
 
441
+ - name: Setup Node
442
+ if: >-
443
+ steps.profile.outputs.toolchain_mode != 'mise' &&
444
+ steps.profile.outputs.javascript == 'true' &&
445
+ steps.profile.outputs.javascript_package_manager != 'bun'
446
+ uses: actions/setup-node@v5
447
+ with:
448
+ node-version: 24
449
+ cache: ${{ steps.profile.outputs.javascript_package_manager == 'npm' && 'npm' || steps.profile.outputs.javascript_package_manager == 'pnpm' && 'pnpm' || steps.profile.outputs.javascript_package_manager == 'yarn' && 'yarn' || '' }}
450
+
451
+ - name: Setup Bun
452
+ if: >-
453
+ steps.profile.outputs.toolchain_mode != 'mise' &&
454
+ steps.profile.outputs.javascript == 'true' &&
455
+ steps.profile.outputs.javascript_package_manager == 'bun'
456
+ uses: oven-sh/setup-bun@v2
457
+ with:
458
+ bun-version: 1.3.14
459
+
460
+ - name: Enable Corepack
461
+ if: >-
462
+ steps.profile.outputs.toolchain_mode != 'mise' &&
463
+ (steps.profile.outputs.javascript_package_manager == 'pnpm' ||
464
+ steps.profile.outputs.javascript_package_manager == 'yarn')
465
+ shell: bash
466
+ run: corepack enable
467
+
468
+ - name: Setup Python
469
+ if: steps.profile.outputs.toolchain_mode != 'mise' && steps.profile.outputs.python == 'true'
470
+ uses: actions/setup-python@v6
471
+ with:
472
+ python-version: '3.13'
473
+
474
+ - name: Setup Rust
475
+ if: steps.profile.outputs.toolchain_mode != 'mise' && steps.profile.outputs.rust == 'true'
476
+ uses: dtolnay/rust-toolchain@stable
477
+
431
478
  - name: Setup uv
432
479
  if: >-
433
480
  steps.profile.outputs.python == 'true' &&
@@ -658,7 +705,7 @@ runs:
658
705
  path: ~/.cargo/advisory-db
659
706
  # The advisory database is independent of project dependencies. Keep
660
707
  # it warm for Security without invalidating it on every lockfile edit.
661
- key: ${{ runner.os }}-rust-advisory-${{ hashFiles('.github/scripts/security.sh') }}
708
+ key: ${{ runner.os }}-rust-advisory-${{ hashFiles('.code-foundry/src/runtime.mjs') }}
662
709
  restore-keys: |
663
710
  ${{ runner.os }}-rust-advisory-
664
711
  - name: Cache Rust builds
@@ -701,7 +748,7 @@ runs:
701
748
  REPO_FOUNDRY_INSTALL_PYTHON: ${{ inputs.install-python }}
702
749
  REPO_FOUNDRY_INSTALL_RUST: ${{ inputs.install-rust }}
703
750
  REPO_FOUNDRY_TASK: ${{ inputs.task }}
704
- run: bash .github/scripts/ci.sh install
751
+ run: node .code-foundry/src/runtime.mjs ci install
705
752
  - name: Measure Bun dependencies
706
753
  id: javascript-bun-cache
707
754
  if: >-
@@ -3,12 +3,17 @@ version: 1
3
3
  profile: auto
4
4
  languages: typescript
5
5
  features: all
6
+ codeql: auto
7
+ dependency_review: auto
6
8
  package_manager: bun
9
+ toolchain: auto
7
10
  runtime_repository: 0xPlayerOne/code-foundry
8
- runtime_ref: v0.22.2
11
+ runtime_ref: v0.26.0
9
12
  release_type: node
10
13
  npm_publish: true
11
14
  license: agpl-3.0-or-later
15
+ git_workflow: staging-release
16
+ merge_strategy: rebase
12
17
  runner: ubuntu-latest
13
18
  unit_runner: ubuntu-slim
14
19
  cache_packages: auto