Skip to content

feat(create): add pub workspace support#1634

Open
Crdzbird wants to merge 3 commits into
VeryGoodOpenSource:mainfrom
Crdzbird:feat/pub-workspace
Open

feat(create): add pub workspace support#1634
Crdzbird wants to merge 3 commits into
VeryGoodOpenSource:mainfrom
Crdzbird:feat/pub-workspace

Conversation

@Crdzbird

@Crdzbird Crdzbird commented Jun 30, 2026

Copy link
Copy Markdown

Status

READY

Description

Adds first-class support for pub workspaces.

  • New command very_good create workspace <name> scaffolds a multi-package
    workspace: a root pubspec.yaml with a workspace: list plus apps/ and
    packages/ directories for members.
  • New opt-in --workspace flag on every create subcommand. When run inside
    a workspace it (a) registers the generated package in the root workspace:
    list and (b) writes resolution: workspace into the member, so the workspace
    resolves without a manual edit. It defaults to off and is a no-op outside a
    workspace, so existing behavior is unchanged.
  • Shared infrastructure in lib/src/workspace/ (WorkspaceContext,
    WorkspaceDetector, WorkspaceIntegrator) that later workspace-aware commands
    build on. Adds the yaml_edit dependency.
  • The create MCP tool gains workspace as a subcommand option.
  • Docs: README (a "🆕 Multi-package workspaces" callout plus a dedicated
    Workspaces subsection under create), site/docs/commands/create.md,
    overview.md, and doc/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.

Note: per VGV convention the brick source lives in very_good_templates;
this PR commits only the generated bundle. If preferred, the brick can be
published there first and the bundle regenerated against it.

New commands

very_good create workspace <name> — scaffold a pub workspace (a create subcommand):

# Create the workspace
very_good create workspace my_workspace

# Add members from inside it (registers them + sets resolution: workspace)
cd my_workspace
very_good create dart_package my_package -o packages --workspace
very_good create flutter_app  my_app     -o apps     --workspace

The --workspace / --no-workspace flag is available on every create
subcommand and defaults to off.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

Video/Screenshot

Screen.Recording.2026-06-30.at.09.44.15.mov
image

Crdzbird added 2 commits June 29, 2026 23:54
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.
@Crdzbird Crdzbird requested a review from a team as a code owner June 30, 2026 07:52
@marcossevilla

Copy link
Copy Markdown
Member

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 🙏

@Crdzbird

Copy link
Copy Markdown
Author

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 monorepos/workspace.

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... 🥹

@Crdzbird

Copy link
Copy Markdown
Author

ok, I created the issue: #1635

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants