code-foundry 0.21.1 → 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.
- package/.github/CONTRIBUTING.md +1 -1
- package/.github/actions/setup/action.yml +12 -10
- package/.github/code-foundry.yml +25 -0
- package/.github/code-foundry.yml.example +41 -0
- package/.github/scripts/changed-files.sh +1 -1
- package/.github/scripts/ci.sh +6 -2
- package/.github/scripts/codeql-languages.sh +6 -2
- package/.github/scripts/doctor.sh +4 -2
- package/.github/scripts/init-repo.sh +126 -19
- package/.github/scripts/profile.sh +12 -3
- package/.github/scripts/security.sh +6 -2
- package/.github/scripts/sync-protection.sh +5 -3
- package/.github/scripts/sync-template.sh +135 -20
- package/.github/template.yml +3 -16
- package/.github/workflows/reusable-ci.yml +10 -5
- package/.github/workflows/reusable-codeql.yml +11 -6
- package/.github/workflows/reusable-draft-pr.yml +7 -1
- package/.github/workflows/reusable-release-pr.yml +7 -1
- package/.github/workflows/reusable-release.yml +12 -4
- package/.github/workflows/reusable-security.yml +12 -7
- package/.github/workflows/reusable-test.yml +15 -5
- package/CHANGELOG.md +20 -0
- package/README.md +97 -193
- package/docs/CACHING.md +29 -0
- package/docs/CONFIGURATION.md +87 -0
- package/docs/INITIALIZATION.md +67 -0
- package/docs/PUBLISHING.md +49 -0
- package/docs/README.md +21 -0
- package/docs/RELEASES.md +47 -0
- package/docs/WORKFLOWS.md +66 -0
- package/package.json +2 -1
- package/src/cli.mjs +38 -15
- package/.github/template.yml.example +0 -18
package/docs/RELEASES.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Release management
|
|
2
|
+
|
|
3
|
+
## Branch flow
|
|
4
|
+
|
|
5
|
+
The standard environment flow is:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
topic branch -> staging -> main -> versioned release
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Keep commits Conventional Commit-shaped (`feat:`, `fix:`, `docs:`, `ci:`,
|
|
12
|
+
`chore:`, and so on). Release Please uses them to select patch/minor/major
|
|
13
|
+
versions and generate grouped changelog notes.
|
|
14
|
+
|
|
15
|
+
The release workflow opens or updates a versioned PR after changes reach
|
|
16
|
+
`main`. Merging that PR updates the changelog, creates the Git tag and GitHub
|
|
17
|
+
Release, and triggers any configured package publication.
|
|
18
|
+
|
|
19
|
+
For an explicit version, put `Release-As: 2.0.0` in a commit or pull request
|
|
20
|
+
body. Existing `CHANGELOG.md` history remains repository-owned.
|
|
21
|
+
|
|
22
|
+
## Configuration
|
|
23
|
+
|
|
24
|
+
Set these values in `.github/code-foundry.yml`:
|
|
25
|
+
|
|
26
|
+
```yaml
|
|
27
|
+
release_type: auto # auto, node, python, rust, simple, or none
|
|
28
|
+
npm_publish: false # true only for an npm package
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`auto` selects a supported manifest. Use `simple` with `version.txt` for a
|
|
32
|
+
repository without a package manifest and `none` for a repository that should
|
|
33
|
+
not release automatically.
|
|
34
|
+
|
|
35
|
+
## Pull request permissions
|
|
36
|
+
|
|
37
|
+
If the default `GITHUB_TOKEN` cannot create pull requests, configure a narrowly
|
|
38
|
+
scoped `RELEASE_PLEASE_TOKEN` repository or organization secret. The release
|
|
39
|
+
workflow needs `contents`, `issues`, and `pull-requests` permissions.
|
|
40
|
+
|
|
41
|
+
## Operational checklist
|
|
42
|
+
|
|
43
|
+
1. Merge tested changes from `staging` into `main`.
|
|
44
|
+
2. Review the generated Release Please PR and changelog.
|
|
45
|
+
3. Merge the release PR with the repository's normal linear-history policy.
|
|
46
|
+
4. Confirm the GitHub Release and any package publication.
|
|
47
|
+
5. Synchronize `staging` with the new `main` release commit.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Workflow and CI conventions
|
|
2
|
+
|
|
3
|
+
## Standard triggers
|
|
4
|
+
|
|
5
|
+
The default standard callers use:
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
push:
|
|
9
|
+
branches: [main, staging]
|
|
10
|
+
pull_request:
|
|
11
|
+
branches: [staging]
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Draft PR automation may additionally listen to supported topic branches.
|
|
15
|
+
Custom deployment, indexing, search, Slither, or other workflows are
|
|
16
|
+
repository-owned extensions and should keep their own triggers and permissions.
|
|
17
|
+
|
|
18
|
+
## Standard workflow responsibilities
|
|
19
|
+
|
|
20
|
+
| Workflow | Responsibility |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| CI | Format, lint, type-check, and build |
|
|
23
|
+
| Test | Unit, integration, E2E, and smoke tests |
|
|
24
|
+
| Security | Profile, audits, and public-only Dependency Review |
|
|
25
|
+
| CodeQL | GitHub-native code scanning, kept separate from CI |
|
|
26
|
+
| Draft PR | Create/update development pull requests |
|
|
27
|
+
| Release PR | Promote `staging` into `main` |
|
|
28
|
+
| Release | Release Please, GitHub release, and optional npm publication |
|
|
29
|
+
|
|
30
|
+
Use concise job names such as `CI / Format`, `Test / Unit`, and
|
|
31
|
+
`CodeQL / Analyze (Python)`. Required checks should match the jobs actually
|
|
32
|
+
enabled for the repository profile.
|
|
33
|
+
|
|
34
|
+
## Language defaults
|
|
35
|
+
|
|
36
|
+
- TypeScript/JavaScript: ESLint, Prettier, and Bun's native `bun test`.
|
|
37
|
+
- Rust: default `rustfmt`, Clippy with `-D warnings`, and Cargo tests.
|
|
38
|
+
- Python: Ruff formatting/linting, uv when a compatible lockfile exists, and
|
|
39
|
+
native Python tests.
|
|
40
|
+
- Solidity: preserve the repository's native Hardhat, Foundry, or specialized
|
|
41
|
+
test/security workflows.
|
|
42
|
+
|
|
43
|
+
Jobs detect applicability before installing tools. Empty language or test
|
|
44
|
+
surfaces remain successful and visible, so branch protection does not become
|
|
45
|
+
ambiguous for mixed-language repositories.
|
|
46
|
+
|
|
47
|
+
## Security behavior
|
|
48
|
+
|
|
49
|
+
CodeQL is a separate workflow using GitHub's official actions. Dependency
|
|
50
|
+
Review is skipped where GitHub does not support it, while JavaScript, Python,
|
|
51
|
+
and Rust audits remain available without Advanced Security. If GitHub default
|
|
52
|
+
setup is enabled, disable its generated CodeQL workflow to avoid duplicate
|
|
53
|
+
analysis.
|
|
54
|
+
|
|
55
|
+
## Branch protection
|
|
56
|
+
|
|
57
|
+
Use the initializer's protection helper after reviewing the repository's
|
|
58
|
+
enabled features:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
bash .github/scripts/init-repo.sh --protection
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Keep strict status checks, linear history, and conversation resolution enabled.
|
|
65
|
+
For a repository with optional features disabled, do not require checks that
|
|
66
|
+
will never run.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "code-foundry",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
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",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"src",
|
|
21
|
+
"docs",
|
|
21
22
|
".github",
|
|
22
23
|
".githooks",
|
|
23
24
|
".editorconfig",
|
package/src/cli.mjs
CHANGED
|
@@ -18,6 +18,7 @@ Init/sync options:
|
|
|
18
18
|
--target PATH Repository directory (default: current directory)
|
|
19
19
|
--source PATH_OR_URL Template source override
|
|
20
20
|
--ref REF Template branch or tag (default: main)
|
|
21
|
+
--config PATH Use a .github/code-foundry.yml configuration file
|
|
21
22
|
--profile NAME auto, application, monorepo, or minimal
|
|
22
23
|
--languages LIST auto or typescript,rust,python,solidity
|
|
23
24
|
--features LIST all or ci,codeql,security,test,draft-pr,release-pr,release,dependabot
|
|
@@ -47,6 +48,7 @@ function parseArgs(argv) {
|
|
|
47
48
|
target: process.cwd(),
|
|
48
49
|
source: packageRoot,
|
|
49
50
|
ref: 'main',
|
|
51
|
+
config: process.env.REPO_FOUNDRY_CONFIG || '',
|
|
50
52
|
profile: process.env.REPO_FOUNDRY_PROFILE || 'auto',
|
|
51
53
|
languages: process.env.REPO_FOUNDRY_LANGUAGES || 'auto',
|
|
52
54
|
features: process.env.REPO_FOUNDRY_FEATURES || 'all',
|
|
@@ -62,6 +64,14 @@ function parseArgs(argv) {
|
|
|
62
64
|
npmPublish: process.env.REPO_FOUNDRY_NPM_PUBLISH === 'true',
|
|
63
65
|
languagesSet: false,
|
|
64
66
|
featuresSet: false,
|
|
67
|
+
profileSet: Boolean(process.env.REPO_FOUNDRY_PROFILE),
|
|
68
|
+
packageManagerSet: Boolean(process.env.REPO_FOUNDRY_PACKAGE_MANAGER),
|
|
69
|
+
runtimeRepositorySet: Boolean(process.env.REPO_FOUNDRY_RUNTIME_REPOSITORY),
|
|
70
|
+
runtimeRefSet: Boolean(process.env.REPO_FOUNDRY_RUNTIME_REF),
|
|
71
|
+
releaseTypeSet: Boolean(process.env.REPO_FOUNDRY_RELEASE_TYPE),
|
|
72
|
+
licenseSet: Boolean(process.env.REPO_FOUNDRY_LICENSE),
|
|
73
|
+
licenseFileSet: Boolean(process.env.REPO_FOUNDRY_LICENSE_FILE),
|
|
74
|
+
npmPublishSet: Boolean(process.env.REPO_FOUNDRY_NPM_PUBLISH),
|
|
65
75
|
dryRun: false,
|
|
66
76
|
prune: false,
|
|
67
77
|
force: false,
|
|
@@ -72,6 +82,7 @@ function parseArgs(argv) {
|
|
|
72
82
|
['--target', 'target'],
|
|
73
83
|
['--source', 'source'],
|
|
74
84
|
['--ref', 'ref'],
|
|
85
|
+
['--config', 'config'],
|
|
75
86
|
['--profile', 'profile'],
|
|
76
87
|
['--languages', 'languages'],
|
|
77
88
|
['--features', 'features'],
|
|
@@ -95,6 +106,13 @@ function parseArgs(argv) {
|
|
|
95
106
|
options[values.get(arg)] = value
|
|
96
107
|
if (arg === '--languages') options.languagesSet = true
|
|
97
108
|
if (arg === '--features') options.featuresSet = true
|
|
109
|
+
if (arg === '--profile') options.profileSet = true
|
|
110
|
+
if (arg === '--package-manager') options.packageManagerSet = true
|
|
111
|
+
if (arg === '--runtime-repository') options.runtimeRepositorySet = true
|
|
112
|
+
if (arg === '--runtime-ref') options.runtimeRefSet = true
|
|
113
|
+
if (arg === '--release-type') options.releaseTypeSet = true
|
|
114
|
+
if (arg === '--license') options.licenseSet = true
|
|
115
|
+
if (arg === '--license-file') options.licenseFileSet = true
|
|
98
116
|
continue
|
|
99
117
|
}
|
|
100
118
|
if (arg === '--dry-run') options.dryRun = true
|
|
@@ -102,7 +120,7 @@ function parseArgs(argv) {
|
|
|
102
120
|
else if (arg === '--prune') options.prune = true
|
|
103
121
|
else if (arg === '--protection') options.protection = true
|
|
104
122
|
else if (arg === '--no-bootstrap') options.bootstrap = false
|
|
105
|
-
else if (arg === '--npm-publish') options.npmPublish = true
|
|
123
|
+
else if (arg === '--npm-publish') { options.npmPublish = true; options.npmPublishSet = true }
|
|
106
124
|
else fail(`unknown option: ${arg}`)
|
|
107
125
|
}
|
|
108
126
|
|
|
@@ -125,12 +143,16 @@ function main() {
|
|
|
125
143
|
const { command, options } = parseArgs(process.argv.slice(2))
|
|
126
144
|
const target = resolve(options.target)
|
|
127
145
|
const common = ['--source', options.source, '--ref', options.ref]
|
|
128
|
-
common.push('--
|
|
129
|
-
if (options.
|
|
146
|
+
if (options.config) common.push('--config', options.config)
|
|
147
|
+
if (options.profileSet) common.push('--profile', options.profile)
|
|
130
148
|
if (options.languagesSet) common.push('--languages', options.languages)
|
|
131
149
|
if (options.featuresSet) common.push('--features', options.features)
|
|
132
|
-
if (options.
|
|
133
|
-
if (options.
|
|
150
|
+
if (options.packageManagerSet) common.push('--package-manager', options.packageManager)
|
|
151
|
+
if (options.runtimeRepositorySet) common.push('--runtime-repository', options.runtimeRepository)
|
|
152
|
+
if (options.runtimeRefSet) common.push('--runtime-ref', options.runtimeRef)
|
|
153
|
+
if (options.releaseTypeSet) common.push('--release-type', options.releaseType)
|
|
154
|
+
if (options.licenseSet) common.push('--license', options.license)
|
|
155
|
+
if (options.licenseFileSet && options.licenseFile) common.push('--license-file', options.licenseFile)
|
|
134
156
|
if (options.prune) common.push('--prune')
|
|
135
157
|
if (options.force) common.push('--force')
|
|
136
158
|
if (options.dryRun) common.push('--check')
|
|
@@ -140,21 +162,22 @@ function main() {
|
|
|
140
162
|
const initArgs = [
|
|
141
163
|
'--source', options.source,
|
|
142
164
|
'--ref', options.ref,
|
|
143
|
-
'--profile', options.profile,
|
|
144
|
-
'--languages', options.languages,
|
|
145
|
-
'--features', options.features,
|
|
146
|
-
'--package-manager', options.packageManager,
|
|
147
|
-
'--release-type', options.releaseType,
|
|
148
|
-
'--license', options.license,
|
|
149
165
|
]
|
|
150
|
-
if (options.
|
|
151
|
-
if (options.
|
|
152
|
-
if (options.
|
|
166
|
+
if (options.profileSet) initArgs.push('--profile', options.profile)
|
|
167
|
+
if (options.languagesSet) initArgs.push('--languages', options.languages)
|
|
168
|
+
if (options.featuresSet) initArgs.push('--features', options.features)
|
|
169
|
+
if (options.packageManagerSet) initArgs.push('--package-manager', options.packageManager)
|
|
170
|
+
if (options.releaseTypeSet) initArgs.push('--release-type', options.releaseType)
|
|
171
|
+
if (options.licenseSet) initArgs.push('--license', options.license)
|
|
172
|
+
if (options.config) initArgs.push('--config', options.config)
|
|
173
|
+
if (options.runtimeRepositorySet) initArgs.push('--runtime-repository', options.runtimeRepository)
|
|
174
|
+
if (options.runtimeRefSet) initArgs.push('--runtime-ref', options.runtimeRef)
|
|
175
|
+
if (options.licenseFileSet && options.licenseFile) initArgs.push('--license-file', options.licenseFile)
|
|
153
176
|
if (options.protection) initArgs.push('--protection')
|
|
154
177
|
if (options.dryRun) initArgs.push('--dry-run')
|
|
155
178
|
if (options.prune) initArgs.push('--prune')
|
|
156
179
|
if (options.force) initArgs.push('--force')
|
|
157
|
-
if (options.npmPublish) initArgs.push('--npm-publish')
|
|
180
|
+
if (options.npmPublishSet && options.npmPublish) initArgs.push('--npm-publish')
|
|
158
181
|
if (!options.bootstrap) initArgs.push('--no-bootstrap')
|
|
159
182
|
run('init-repo.sh', initArgs, target)
|
|
160
183
|
} else if (command === 'sync') {
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# Repository-specific settings for the shared initializer and sync scripts.
|
|
2
|
-
version: 1
|
|
3
|
-
template: code-foundry@latest
|
|
4
|
-
profile: auto
|
|
5
|
-
languages: auto
|
|
6
|
-
features: all
|
|
7
|
-
package_manager: auto
|
|
8
|
-
runtime_repository: 0xPlayerOne/code-foundry
|
|
9
|
-
runtime_ref: v0.20.2
|
|
10
|
-
release_type: auto
|
|
11
|
-
npm_publish: false
|
|
12
|
-
license: preserve
|
|
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
|