feat: init --workspace auto-detects monorepo markers and configures prefix#253
Merged
feat: init --workspace auto-detects monorepo markers and configures prefix#253
Conversation
…prefix
Add DetectMonorepo() supporting go.work, pnpm-workspace.yaml, package.json
workspaces, and Cargo.toml [workspace]. When detected, init --workspace sets
tag prefix to {module_path}/v, workspace.versioning to independent, and
creates .version files in discovered module directories.
Also adds workspace.versioning config field (independent|coordinated) with
validation, shared with the discover mismatch warnings feature.
Add 8 TestDetectMonorepo_* tests covering go.work (block/single-line/external), pnpm-workspace.yaml, package.json workspaces, Cargo.toml [workspace], no markers, and priority ordering. Add TestCreateMonorepoVersionFiles verifying .version creation and skip-if-exists behavior.
…ions) Fix unchecked os.MkdirAll in tests, add filepath.Clean for gosec path traversal warnings, use 0o600 for .version file permissions.
Extract chdirTest, buildTestModules, assertError, and assertCreatedTags helpers. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
sley init --workspacenow detects monorepo workspace markers and automatically configures tag prefix and versioning mode. Detection supports four ecosystems (checked in order, first match wins):go.work- parsesusedirectives for module pathspnpm-workspace.yaml- parsespackagesfield, expands globspackage.jsonwithworkspaces- parses JSON array, expands globsCargo.tomlwith[workspace]- scans for section, parsesmembersWhen detected:
workspace.versioning: independentin generated configplugins.tag-manager.prefix: "{module_path}/v".versionfiles (initialized to0.0.0) in each discovered module directory (skips existing files)Also includes the
workspace.versioningconfig field addition (shared with the discover mismatch warnings feature).Related Issue
Notes for Reviewers
go.workpaths (e.g.,use ../shared) are excluded - only subdirectories are included