feat(create): add pub workspace support#1634
Conversation
Introduce lib/src/workspace/ with the building blocks shared by every workspace-aware command: - WorkspaceContext: the resolved root + member list of a pub workspace. - WorkspaceDetector: walks up from a directory to the nearest pubspec.yaml declaring a `workspace:` key. - WorkspaceIntegrator: format-preserving (yaml_edit) helpers to append a member to the root `workspace:` list, ensure `resolution: workspace` on a member, and add a path dependency between members. All operations are idempotent. Add the yaml_edit dependency.
- Add `very_good create workspace <name>` which scaffolds a multi-package pub workspace (root pubspec with `workspace: []`, plus apps/ and packages/ directories) from the new very_good_workspace bundle. - Add an opt-in `--workspace` flag (default off) to every create subcommand that can be a workspace member. When set inside a workspace it registers the new package in the root `workspace:` list and gives it `resolution: workspace`, so the workspace resolves without a manual edit. - Expose `workspace` in the `create` MCP tool's subcommand enum. - Register the bundle in tool/generate_bundles.sh and update docs.
|
hey @Crdzbird! thanks for opening a PR I think regarding a feature like this, it would be better to define the approach and scope of this in an issue and then we can open a PR when we have a clear picture of what we want to build in the CLI and if we need to create a new template for it. please create an issue specifying the purpose of this feature and what you'd like the CLI to achieve through this 🙏 |
|
Hey @marcossevilla ! Well, there isn't any open issue about this specific PR, it was more to provide a quick setup to the new guidelines on Since the CLI already covers all the scaffolding, i thought it could be nice to also provide a quick setup and automatic support to this new structure, mostly because it's a pain when starting a new project to setup everything following the workspace requirements... 🥹 |
|
ok, I created the issue: #1635 |
Status
READY
Description
Adds first-class support for pub workspaces.
very_good create workspace <name>scaffolds a multi-packageworkspace: a root
pubspec.yamlwith aworkspace:list plusapps/andpackages/directories for members.--workspaceflag on everycreatesubcommand. When run insidea workspace it (a) registers the generated package in the root
workspace:list and (b) writes
resolution: workspaceinto the member, so the workspaceresolves without a manual edit. It defaults to off and is a no-op outside a
workspace, so existing behavior is unchanged.
lib/src/workspace/(WorkspaceContext,WorkspaceDetector,WorkspaceIntegrator) that later workspace-aware commandsbuild on. Adds the
yaml_editdependency.createMCP tool gainsworkspaceas a subcommand option.Workspaces subsection under
create),site/docs/commands/create.md,overview.md, anddoc/mcp.md.Fully additive and behind an opt-in flag. The full test suite is green, the
analyzer/formatter are clean, and 100% coverage is maintained.
New commands
very_good create workspace <name>— scaffold a pub workspace (acreatesubcommand):The
--workspace/--no-workspaceflag is available on everycreatesubcommand and defaults to off.
Type of Change
Video/Screenshot
Screen.Recording.2026-06-30.at.09.44.15.mov