code-foundry 0.1.4

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 (50) hide show
  1. package/.editorconfig +18 -0
  2. package/.env.example +3 -0
  3. package/.gitattributes +9 -0
  4. package/.githooks/pre-commit +67 -0
  5. package/.github/CODEOWNERS +4 -0
  6. package/.github/CODE_OF_CONDUCT.md +41 -0
  7. package/.github/CONTRIBUTING.md +198 -0
  8. package/.github/ISSUE_TEMPLATE/bug_report.yml +56 -0
  9. package/.github/ISSUE_TEMPLATE/config.yml +5 -0
  10. package/.github/ISSUE_TEMPLATE/feature_request.yml +38 -0
  11. package/.github/PULL_REQUEST_TEMPLATE.md +29 -0
  12. package/.github/SECURITY.md +23 -0
  13. package/.github/actions/cache/action.yml +43 -0
  14. package/.github/actions/codeql/action.yml +29 -0
  15. package/.github/actions/setup/action.yml +776 -0
  16. package/.github/dependabot.yml +42 -0
  17. package/.github/scripts/bootstrap.sh +20 -0
  18. package/.github/scripts/changed-files.sh +96 -0
  19. package/.github/scripts/ci.sh +636 -0
  20. package/.github/scripts/codeql-languages.sh +86 -0
  21. package/.github/scripts/doctor.sh +103 -0
  22. package/.github/scripts/format-fast-path.sh +80 -0
  23. package/.github/scripts/init-repo.sh +134 -0
  24. package/.github/scripts/security.sh +209 -0
  25. package/.github/scripts/sitecustomize.py +17 -0
  26. package/.github/scripts/sync-codeowners.sh +76 -0
  27. package/.github/scripts/sync-protection.sh +137 -0
  28. package/.github/scripts/sync-template.sh +432 -0
  29. package/.github/scripts/turbo-cache-probe.sh +102 -0
  30. package/.github/template.yml +7 -0
  31. package/.github/template.yml.example +8 -0
  32. package/.github/workflows/ci.yml +166 -0
  33. package/.github/workflows/codeql.yml +160 -0
  34. package/.github/workflows/draft-pr.yml +59 -0
  35. package/.github/workflows/release-pr.yml +66 -0
  36. package/.github/workflows/release.yml +103 -0
  37. package/.github/workflows/security.yml +228 -0
  38. package/.github/workflows/test.yml +175 -0
  39. package/.gitignore +77 -0
  40. package/.mise.toml +6 -0
  41. package/.prettierrc +6 -0
  42. package/AGENTS.md +155 -0
  43. package/CHANGELOG.md +3 -0
  44. package/LICENSE +616 -0
  45. package/NOTICE +7 -0
  46. package/README.md +172 -0
  47. package/package.json +44 -0
  48. package/release-please-config.json +16 -0
  49. package/ruff.toml +6 -0
  50. package/src/cli.mjs +137 -0
@@ -0,0 +1,42 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ target-branch: staging
6
+ schedule:
7
+ interval: weekly
8
+ day: sunday
9
+ open-pull-requests-limit: 99
10
+ groups:
11
+ github-actions:
12
+ patterns: ['*']
13
+ - package-ecosystem: npm
14
+ directory: /
15
+ target-branch: staging
16
+ schedule:
17
+ interval: weekly
18
+ day: sunday
19
+ open-pull-requests-limit: 99
20
+ groups:
21
+ npm-dependencies:
22
+ patterns: ['*']
23
+ - package-ecosystem: cargo
24
+ directory: /
25
+ target-branch: staging
26
+ schedule:
27
+ interval: weekly
28
+ day: sunday
29
+ open-pull-requests-limit: 99
30
+ groups:
31
+ cargo-dependencies:
32
+ patterns: ['*']
33
+ - package-ecosystem: pip
34
+ directory: /
35
+ target-branch: staging
36
+ schedule:
37
+ interval: weekly
38
+ day: sunday
39
+ open-pull-requests-limit: 99
40
+ groups:
41
+ python-dependencies:
42
+ patterns: ['*']
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ git config core.hooksPath .githooks
5
+
6
+ if command -v mise >/dev/null 2>&1; then
7
+ if [ -f .mise.toml ] && [ ! -f mise.lock ]; then
8
+ if MISE_TRUSTED_CONFIG_PATHS="$PWD" mise lock >/dev/null 2>&1; then
9
+ printf '%s\n' 'Initialized mise.lock for deterministic CI tool installs.'
10
+ else
11
+ printf '%s\n' 'Warning: mise.lock could not be generated; continuing with pinned tool resolution.' >&2
12
+ fi
13
+ fi
14
+ mise install
15
+ else
16
+ printf '%s\n' "mise is not installed; install it from https://mise.jdx.dev/ and rerun this script." >&2
17
+ exit 1
18
+ fi
19
+
20
+ bash .github/scripts/doctor.sh
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Shared pull-request change detection. A failed or incomplete diff must be
4
+ # treated as relevant so checks never become silently optional.
5
+ repo_foundry_changed_files() {
6
+ if [ "${REPO_FOUNDRY_CHANGED_FILES_READY:-false}" = true ]; then
7
+ return 0
8
+ fi
9
+
10
+ local base_sha="${REPO_FOUNDRY_BASE_SHA:-}"
11
+ local head_sha="${GITHUB_SHA:-HEAD}"
12
+ local changed_files=""
13
+
14
+ if [ -n "$base_sha" ] && [ "$base_sha" != "0000000000000000000000000000000000000000" ]; then
15
+ if ! git cat-file -e "$base_sha^{commit}" 2>/dev/null; then
16
+ git fetch --no-tags --filter=blob:none --depth=1 origin "$base_sha" >/dev/null 2>&1 || return 1
17
+ fi
18
+ changed_files="$(git diff --name-only "$base_sha" "$head_sha" 2>/dev/null || true)"
19
+ else
20
+ changed_files="$(git diff --name-only HEAD^ HEAD 2>/dev/null || true)"
21
+ fi
22
+
23
+ [ -n "$changed_files" ] || return 1
24
+ REPO_FOUNDRY_CHANGED_FILES="$changed_files"
25
+ REPO_FOUNDRY_CHANGED_FILES_READY=true
26
+ }
27
+
28
+ repo_foundry_governance_only() {
29
+ case "${GITHUB_EVENT_NAME:-}" in
30
+ pull_request|push) ;;
31
+ *) return 1 ;;
32
+ esac
33
+
34
+ local changed_files=""
35
+
36
+ repo_foundry_changed_files || return 1
37
+ changed_files="$REPO_FOUNDRY_CHANGED_FILES"
38
+
39
+ # An unavailable or empty diff is not evidence that a PR is documentation
40
+ # only. Continue with the full check in that case.
41
+ while IFS= read -r file; do
42
+ case "$file" in
43
+ README|README.*|LICENSE|NOTICE|.github/CODEOWNERS|.github/CODE_OF_CONDUCT.md|\
44
+ .github/CONTRIBUTING.md|.github/PULL_REQUEST_TEMPLATE.md|.github/SECURITY.md|\
45
+ .github/ISSUE_TEMPLATE/*)
46
+ ;;
47
+ *) return 1 ;;
48
+ esac
49
+ done <<< "$changed_files"
50
+
51
+ return 0
52
+ }
53
+
54
+ repo_foundry_pr_docs_only() {
55
+ repo_foundry_governance_only
56
+ }
57
+
58
+ # Return success when an ordinary push or pull request changed no dependency or
59
+ # audit inputs for the requested ecosystem. Scheduled and manual runs, plus
60
+ # unknown or unavailable diffs, fail open to a full security check.
61
+ repo_foundry_pr_dependencies_unchanged() {
62
+ local ecosystem="${1:-all}"
63
+ case "${GITHUB_EVENT_NAME:-}" in
64
+ pull_request|push) ;;
65
+ *) return 1 ;;
66
+ esac
67
+
68
+ local changed_files=""
69
+ repo_foundry_changed_files || return 1
70
+ changed_files="$REPO_FOUNDRY_CHANGED_FILES"
71
+
72
+ while IFS= read -r file; do
73
+ case "$file" in
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|\
76
+ .github/security-audit-allowlist.txt)
77
+ return 1
78
+ ;;
79
+ package.json|*/package.json|bun.lock|bun.lockb|*/bun.lock|*/bun.lockb|\
80
+ pnpm-lock.yaml|*/pnpm-lock.yaml|yarn.lock|*/yarn.lock|package-lock.json|*/package-lock.json|\
81
+ .npmrc|*/.npmrc|.yarnrc*|*/.yarnrc*|.pnpmfile.cjs|*/.pnpmfile.cjs)
82
+ case "$ecosystem" in javascript|all) return 1 ;; esac
83
+ ;;
84
+ Cargo.toml|*/Cargo.toml|Cargo.lock|*/Cargo.lock|.cargo/*|*/.cargo/*)
85
+ case "$ecosystem" in rust|all) return 1 ;; esac
86
+ ;;
87
+ pyproject.toml|*/pyproject.toml|requirements*.txt|*/requirements*.txt|\
88
+ setup.py|*/setup.py|setup.cfg|*/setup.cfg|Pipfile|*/Pipfile|Pipfile.lock|*/Pipfile.lock|\
89
+ poetry.lock|*/poetry.lock|uv.lock|*/uv.lock)
90
+ case "$ecosystem" in python|all) return 1 ;; esac
91
+ ;;
92
+ esac
93
+ done <<< "$changed_files"
94
+
95
+ return 0
96
+ }