code-foundry 0.1.3 → 0.2.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 (37) hide show
  1. package/.githooks/pre-commit +20 -5
  2. package/.github/CODEOWNERS +4 -2
  3. package/.github/CONTRIBUTING.md +5 -1
  4. package/.github/actions/cache/action.yml +43 -0
  5. package/.github/actions/codeql/action.yml +29 -0
  6. package/.github/actions/setup/action.yml +756 -0
  7. package/.github/scripts/bootstrap.sh +7 -0
  8. package/.github/scripts/changed-files.sh +96 -0
  9. package/.github/scripts/ci.sh +421 -28
  10. package/.github/scripts/codeql-languages.sh +71 -5
  11. package/.github/scripts/doctor.sh +1 -1
  12. package/.github/scripts/format-fast-path.sh +80 -0
  13. package/.github/scripts/init-repo.sh +39 -11
  14. package/.github/scripts/profile.sh +179 -0
  15. package/.github/scripts/security.sh +180 -20
  16. package/.github/scripts/sync-codeowners.sh +76 -0
  17. package/.github/scripts/sync-protection.sh +15 -2
  18. package/.github/scripts/sync-template.sh +222 -15
  19. package/.github/scripts/turbo-cache-probe.sh +102 -0
  20. package/.github/template.yml +14 -0
  21. package/.github/template.yml.example +10 -0
  22. package/.github/workflows/ci.yml +108 -7
  23. package/.github/workflows/codeql.yml +126 -17
  24. package/.github/workflows/draft-pr.yml +4 -7
  25. package/.github/workflows/release-pr.yml +20 -7
  26. package/.github/workflows/release.yml +99 -7
  27. package/.github/workflows/security.yml +201 -6
  28. package/.github/workflows/test.yml +100 -3
  29. package/.gitignore +4 -0
  30. package/.mise.toml +0 -2
  31. package/AGENTS.md +1 -0
  32. package/CHANGELOG.md +12 -0
  33. package/README.md +92 -10
  34. package/package.json +11 -1
  35. package/release-please-config.json +16 -0
  36. package/src/cli.mjs +20 -8
  37. package/.github/workflows/publish.yml +0 -25
@@ -38,13 +38,28 @@ if printf '%s\n' "$changed" | grep -Eq '\.rs$|(^|/)Cargo\.toml$'; then
38
38
  cargo clippy --all-targets -- -D warnings
39
39
  fi
40
40
 
41
- if printf '%s\n' "$changed" | grep -Eq '\.py$|(^|/)(pyproject\.toml|requirements(-dev)?\.txt)$'; then
41
+ python_files=()
42
+ python_config=false
43
+ while IFS= read -r file; do
44
+ case "$file" in
45
+ *.py)
46
+ [ -f "$file" ] && python_files+=("$file")
47
+ ;;
48
+ pyproject.toml|requirements.txt|requirements-dev.txt)
49
+ python_config=true
50
+ ;;
51
+ esac
52
+ done <<< "$changed"
53
+
54
+ if [ "$python_config" = true ] || [ "${#python_files[@]}" -gt 0 ]; then
55
+ ruff_targets=(.)
56
+ [ "$python_config" = true ] || ruff_targets=("${python_files[@]}")
42
57
  if [ -x .venv/bin/ruff ]; then
43
- .venv/bin/ruff format --check .
44
- .venv/bin/ruff check .
58
+ .venv/bin/ruff format --check "${ruff_targets[@]}"
59
+ .venv/bin/ruff check "${ruff_targets[@]}"
45
60
  elif command -v ruff >/dev/null 2>&1; then
46
- ruff format --check .
47
- ruff check .
61
+ ruff format --check "${ruff_targets[@]}"
62
+ ruff check "${ruff_targets[@]}"
48
63
  else
49
64
  echo "Python files changed but Ruff is not installed; run the template setup first." >&2
50
65
  exit 1
@@ -1,2 +1,4 @@
1
- # Default owner for all repository files.
2
- * @0xPlayerOne
1
+ # Repository owners and administrators are populated by code-foundry
2
+ # initializer. GitHub CODEOWNERS does not interpolate shell variables.
3
+ # Run the initializer in the target repository to replace this default rule.
4
+ * @OWNER
@@ -164,10 +164,14 @@ Keep pull requests focused and reviewable. Include screenshots or recordings for
164
164
  | Push to `staging` | Release PR workflow |
165
165
  | Version tag such as `v1.2.3` | Release workflow |
166
166
 
167
- The workflows use separate concurrency groups. A newer run for the same branch or pull request cancels its older run, while independent CI, test, security, and CodeQL workflows continue in parallel.
167
+ The workflows use separate concurrency groups keyed by the commit under test. A newer run for the same commit cancels a duplicate event-triggered run, while newer commits cancel older runs and independent CI, Test, Security, and CodeQL workflows continue in parallel.
168
168
 
169
169
  Required checks are enforced by branch protection. Do not duplicate their checklists in the pull request description; document validation commands and results instead.
170
170
 
171
+ ### Release conventions
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`.
174
+
171
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.
172
176
 
173
177
  ## Review and merge protocol
@@ -0,0 +1,43 @@
1
+ name: Repository Cache
2
+ description: Restore a cache and optionally enable the post-job save performed by actions/cache.
3
+
4
+ inputs:
5
+ path:
6
+ description: Cache paths.
7
+ required: true
8
+ key:
9
+ description: Primary cache key.
10
+ required: true
11
+ restore-keys:
12
+ description: Optional newline-delimited restore keys.
13
+ required: false
14
+ default: ''
15
+ save:
16
+ description: Enable cache saving after the job completes.
17
+ required: false
18
+ default: 'true'
19
+
20
+ outputs:
21
+ cache-hit:
22
+ description: Whether an exact cache was restored.
23
+ value: ${{ steps.cache.outputs.cache-hit || steps.restore.outputs.cache-hit }}
24
+
25
+ runs:
26
+ using: composite
27
+ steps:
28
+ - name: Restore cache
29
+ id: restore
30
+ if: inputs.save != 'true'
31
+ uses: actions/cache/restore@v5
32
+ with:
33
+ path: ${{ inputs.path }}
34
+ key: ${{ inputs.key }}
35
+ restore-keys: ${{ inputs.restore-keys }}
36
+ - name: Restore and save cache
37
+ id: cache
38
+ if: inputs.save == 'true'
39
+ uses: actions/cache@v5
40
+ with:
41
+ path: ${{ inputs.path }}
42
+ key: ${{ inputs.key }}
43
+ restore-keys: ${{ inputs.restore-keys }}
@@ -0,0 +1,29 @@
1
+ name: CodeQL Analyze
2
+ description: Initialize and analyze one CodeQL language using the repository baseline.
3
+
4
+ inputs:
5
+ language:
6
+ description: CodeQL language identifier.
7
+ required: true
8
+ build-mode:
9
+ description: CodeQL build mode.
10
+ required: false
11
+ default: none
12
+ category:
13
+ description: CodeQL analysis category.
14
+ required: true
15
+
16
+ runs:
17
+ using: composite
18
+ steps:
19
+ - name: Initialize
20
+ uses: github/codeql-action/init@v4
21
+ with:
22
+ languages: ${{ inputs.language }}
23
+ build-mode: ${{ inputs.build-mode }}
24
+ - name: Analyze
25
+ uses: github/codeql-action/analyze@v4
26
+ with:
27
+ category: ${{ inputs.category }}
28
+ upload-database: false
29
+ wait-for-processing: false