You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The behavior, log messages, and tests as specified in the TypeScript code MUST BE MATCHED in the Go/Rust code.
29
+
30
+
- Do not change behavior or logs or remove tests, unless it's exclusively related to features which you've been asked not to implement yet.
31
+
- If a different pattern would be more idiomatic in the target language, or it's not possible to implement the exact same behavior in the target language, ask the user before changing anything.
32
+
- Don't make assumptions about the implementation of functions from `workspace-tools`. Check the JS implementation in `node_modules` and exactly follow that.
33
+
34
+
When porting tests, add a comment by each Rust/Go test with the name of the corresponding TS test. If any TS tests have been omitted or combined, add a comment indicating which tests and why.
35
+
36
+
Use syntax and helpers from the newest version of the language where it makes sense. If a particular scenario is most commonly handled in this language by some external library, and the library would meaningfully simplify the code, ask the user about adding the library as a dependency.
37
+
38
+
After making changes, run the commands to build, test, lint, and format.
39
+
40
+
### Key Implementation Details
41
+
42
+
**Git commands**: Both shell out to `git` (matching the TS approach via workspace-tools). The git flags used should exactly match the workspace-tools code. Three-dot range (`branch...`) is used for diffs.
43
+
44
+
**Config loading**: Searches `.beachballrc.json` then `package.json``"beachball"` field, walking up from cwd but stopping at git root.
45
+
46
+
**Glob matching**: Two modes matching the TS behavior — `matchBase` (patterns without `/` match basename) for `ignorePatterns`, full path matching for `scope`/`groups`.
47
+
48
+
### Known Gotchas
49
+
50
+
-**macOS `/tmp` symlink**: `/tmp` is a symlink to `/private/tmp`. `git rev-parse --show-toplevel` resolves symlinks but `tempfile`/`os.MkdirTemp` does not. Both implementations canonicalize paths (`std::fs::canonicalize` in Rust, `filepath.EvalSymlinks` in Go) when comparing git-returned paths with filesystem paths.
51
+
-**Default branch name**: Modern git defaults to `main`. Test fixtures use `--initial-branch=master` for bare repo init to match the `origin/master` refs used in tests.
Copy file name to clipboardExpand all lines: CLAUDE.md
+4-71Lines changed: 4 additions & 71 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,15 +87,13 @@ Multi-pass algorithm that calculates version bumps. See comments in file.
87
87
88
88
- Change files stored in `change/` directory track intended version changes
89
89
- See `src/types/ChangeInfo.ts``ChangeFileInfo` for the info stored in each change file. For grouped change files (config has `groupChanges: true`), the type will be `ChangeInfoMultiple`.
90
-
-`readChangeFiles()` - Loads and validates from disk
91
-
-`writeChangeFiles()` - Persists new change files
92
-
-`unlinkChangeFiles()` - Deletes after consumption during bump
90
+
- Folder contains helper to read, write, and unlink change files
- Pre/post hooks available (see `HooksOptions` in `src/types/BeachballOptions.ts`)
99
97
100
98
**Context Passing:**
101
99
`CommandContext` aggregates reusable data (packages, version groups, change files, and more) to avoid repeated calculations. See source in `src/types/CommandContext.ts`.
@@ -143,7 +141,7 @@ Multi-pass algorithm that calculates version bumps. See comments in file.
143
141
144
142
**Testing Structure:**
145
143
146
-
- Fixtures: `__fixtures__` directory
144
+
- Fixtures and helpers: `__fixtures__/` directory
147
145
- Unit tests: `__tests__/` directory
148
146
- Functional tests: `__functional__/` directory
149
147
- E2E tests: `__e2e__/` directory
@@ -164,69 +162,4 @@ Multi-pass algorithm that calculates version bumps. See comments in file.
164
162
165
163
## Experimental: Rust and Go Implementations
166
164
167
-
The `rust/` and `go/` directories contain parallel re-implementations of beachball's `check` and `change` commands and the corresponding tests.
168
-
169
-
### Building and Testing
170
-
171
-
```bash
172
-
# Rust (from rust/ directory)
173
-
cargo build
174
-
cargo test
175
-
176
-
# Go (from go/ directory)
177
-
go build ./...
178
-
go test ./...
179
-
```
180
-
181
-
### Scope
182
-
183
-
Both implement:
184
-
185
-
- CLI args (as relevant for supported commands)
186
-
- JSON config loading (`.beachballrc.json` and `package.json``"beachball"` field)
The behavior, log messages, and tests as specified in the TypeScript code MUST BE MATCHED in the Go/Rust code.
203
-
204
-
- Do not change behavior or logs or remove tests, unless it's exclusively related to features which you've been asked not to implement yet.
205
-
- If a different pattern would be more idiomatic in the target language, or it's not possible to implement the exact same behavior in the target language, ask the user before changing anything.
206
-
- Don't make assumptions about the implementation of functions from `workspace-tools`. Check the JS implementation in `node_modules` and exactly follow that.
207
-
208
-
When porting tests, add a comment by each Rust/Go test with the name of the corresponding TS test. If any TS tests have been omitted or combined, add a comment indicating which tests and why.
209
-
210
-
Use syntax and helpers from the newest version of the language where it makes sense. If a particular scenario is most commonly handled in this language by some external library, and the library would meaningfully simplify the code, ask the user about adding the library as a dependency.
211
-
212
-
Where possible, use the LSP instead of grep to understand the code. Also use the LSP to check for errors after making changes.
213
-
214
-
After making changes, run the commands to build, test, lint, and format.
215
-
216
-
### Structure
217
-
218
-
-**Rust**: `src/` with nested modules, integration tests in `tests/` with shared helpers in `tests/common/`
219
-
-**Go**: `cmd/beachball/` CLI entry, `internal/` packages, test helpers in `internal/testutil/`, tests alongside source (`_test.go`)
220
-
221
-
### Key Implementation Details
222
-
223
-
**Git commands**: Both shell out to `git` (matching the TS approach via workspace-tools). The git flags used should exactly match the workspace-tools code. Three-dot range (`branch...`) is used for diffs.
224
-
225
-
**Config loading**: Searches `.beachballrc.json` then `package.json``"beachball"` field, walking up from cwd but stopping at git root.
226
-
227
-
**Glob matching**: Two modes matching the TS behavior — `matchBase` (patterns without `/` match basename) for `ignorePatterns`, full path matching for `scope`/`groups`.
228
-
229
-
### Known Gotchas
230
-
231
-
-**macOS `/tmp` symlink**: `/tmp` is a symlink to `/private/tmp`. `git rev-parse --show-toplevel` resolves symlinks but `tempfile`/`os.MkdirTemp` does not. Both implementations canonicalize paths (`std::fs::canonicalize` in Rust, `filepath.EvalSymlinks` in Go) when comparing git-returned paths with filesystem paths.
232
-
-**Default branch name**: Modern git defaults to `main`. Test fixtures use `--initial-branch=master` for bare repo init to match the `origin/master` refs used in tests.
165
+
The `rust/` and `go/` directories contain experimental parallel re-implementations. See the `go-impl` and `rust-impl` custom skills as relevant.
0 commit comments