Skip to content

[workspace] Workspaces: dagger mod commands - #13226

Merged
kpenfound merged 5 commits into
dagger:workspacefrom
kpenfound:dagger_mod
May 28, 2026
Merged

kpenfound merged 5 commits into
dagger:workspacefrom
kpenfound:dagger_mod

Conversation

@kpenfound

Copy link
Copy Markdown
Contributor

Adds a dagger mod command group for working with modules in your workspace, plus a top-level dagger uninstall.

Commands

  • dagger mod install — install a module (alias for dagger install)
  • dagger mod uninstall / dagger uninstall — remove a module from the workspace
  • dagger mod list — list installed modules (name, source, entrypoint)
  • dagger mod search [query] — search a curated registry by name/description

Uninstall adds a new Workspace.uninstall resolver (mirrors Workspace.install). Search is backed by an embedded cmd/dagger/modules.json (name/description/repo) behind a loader seam, so it can fetch remotely later.

@kpenfound
kpenfound requested review from a team as code owners May 27, 2026 00:48
@kpenfound

Copy link
Copy Markdown
Contributor Author

Some local testing

➜  demo-react-app git:(main) ✗
> dagger-dev mod list

NAME      SOURCE                           ENTRYPOINT
eslint    github.com/dagger/eslint@main    false
jest      github.com/dagger/jest@main      false
prettier  github.com/dagger/prettier@main  false
➜  demo-react-app git:(main) ✗
> dagger-dev mod search eslint
NAME    DESCRIPTION                                 REPO
eslint  Lint JavaScript and TypeScript with ESLint  github.com/dagger/eslint

Run 'dagger install <repo>' to install a module.
➜  demo-react-app git:(main) ✗
> dagger-dev mod search javascript
NAME     DESCRIPTION                                           REPO
biomejs  Format and lint JavaScript and TypeScript with Biome  github.com/dagger/biomejs
eslint   Lint JavaScript and TypeScript with ESLint            github.com/dagger/eslint
jest     Run JavaScript and TypeScript tests with Jest         github.com/dagger/jest
vitest   Run JavaScript and TypeScript tests with Vitest       github.com/dagger/vitest

Run 'dagger install <repo>' to install a module.
➜  demo-react-app git:(main) ✗
> dagger-dev mod uninstall jest

Uninstalled module "jest" from /Users/kylepenfound/github.com/kpenfound/demo-react-app/.dagger/config.toml
➜  demo-react-app git:(main) ✗
> dagger-dev mod list

NAME      SOURCE                           ENTRYPOINT
eslint    github.com/dagger/eslint@main    false
prettier  github.com/dagger/prettier@main  false

@shykes shykes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Dropped a suggestion for fetching the index using go generate. Other than that - ship it 🚀

Comment thread cmd/dagger/mod.go
Repo string `json:"repo"`
}

//go:embed modules.json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a go generate to fetch the latest index? Users would still need to update the CLI to get an updated index, but it would give give us training wheels for index distribution infra. Then we can switch to live updates in a future PR.

Suggested change
//go:embed modules.json
//go:embed modules.json
//go:generate curl -LO https://dagger.io/stdlib/modules.json

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to query it tho but it didn't worked, it that expected for now?

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have noted in the description, but I just had it embedded to try it out, but I think it should fetch from a remote url at runtime, not at build time. That way the index isn't tied in any way to the build version.

Now that its pushed I can have it fetch the raw github url and once its in dagger/dagger@main we can change that and maybe put our own cdn in front of the file too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went for a hybrid approach to avoid potential issues fetching from github. So it'll try to pull the json file from github, and if there's any errors we still embed the file and it uses that so that the user doesn't see an error. Happy to discuss alternative solutions here too

@TomChv TomChv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

kpenfound and others added 2 commits May 27, 2026 22:29
Workspace modules (.dagger/config.toml):
- dagger mod install / uninstall / list, dagger mod search (registry fetched
  at runtime from GitHub with an embedded fallback), plus a top-level
  dagger uninstall and the Workspace.uninstall resolver.

Module development (dagger.json):
- dagger mod deps add / rm / list (ModuleSource dependency APIs)
- dagger mod engine required / require / require-current (ModuleSource engine version)

Generated SDK clients and docs are produced by a follow-up regenerate.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: kpenfound <[email protected]>
Signed-off-by: kpenfound <[email protected]>
@kpenfound

Copy link
Copy Markdown
Contributor Author

Added dagger mod deps and dagger mod engine

dagger mod deps — manage the current module's dependencies

Edit the dependencies field of the module's own dagger.json (the module is found by walking up from the cwd; if there's no dagger.json to find, the command errors).

  • dagger mod deps add <ref…> — add one or more dependencies (resolves and pins each ref).
  • dagger mod deps rm <name…> — remove dependencies by name.
  • dagger mod deps list — list installed dependencies (name · source · pin).

add/rm write dagger.json only and do not trigger codegen — bindings are refreshed by running dagger generate (via the SDK's generator installed in the workspace). The success message hints at this. This
makes the commands near-instant and lets you edit a module's dependencies even when the module isn't currently in a loadable state (e.g. it declares an engineVersion your local engine doesn't yet meet).

dagger mod engine — manage the module's required engine version

Edit the engineVersion field of the module's own dagger.json.

  • dagger mod engine required — print the module's required engine version.
  • dagger mod engine require <version> — set it to a specific version.
  • dagger mod engine require-current — set it to the version of the engine currently running.
  • dagger mod engine require-latest — set it to the latest released Dagger version (looked up via the existing release-check mechanism).

Writes are config-only (no codegen, no max-version validation at write time), so you can declare a requirement newer than your running engine — for example to pin a module to an upcoming release. The compatibility
check still fires when something later tries to actually load/serve the module (moduleSource.asModule), so this can't be used to run a module on an engine that doesn't meet its requirement.

Core supporting changes

  • New ModuleSource.updatedConfigDirectory field — writes dagger.json from in-memory edits without running codegen or validating engine compatibility (the codegen-bearing generatedContextDirectory stays available
    for callers that want both).
  • loadModuleSourceConfig split into a pure buildModuleConfig + a thin validating wrapper.
  • ParseModuleConfig made permissive (max-version check moved to the new exported ParseAndValidateModuleConfig wrapper); the actual load gate at moduleSource.asModule is unchanged, so anything that tries to use a
    too-new module still errors at the correct place.

@kpenfound

Copy link
Copy Markdown
Contributor Author

Rolled back the changes with mod deps and mod engine
Also now mod search will just use the embedded modules list and not try to search any remote index

@kpenfound
kpenfound merged commit c16cd99 into dagger:workspace May 28, 2026
70 of 77 checks passed
vito pushed a commit that referenced this pull request May 28, 2026
* dagger mod subcommands for workspace and module development

Workspace modules (.dagger/config.toml):
- dagger mod install / uninstall / list, dagger mod search (registry fetched
  at runtime from GitHub with an embedded fallback), plus a top-level
  dagger uninstall and the Workspace.uninstall resolver.

Module development (dagger.json):
- dagger mod deps add / rm / list (ModuleSource dependency APIs)
- dagger mod engine required / require / require-current (ModuleSource engine version)

Generated SDK clients and docs are produced by a follow-up regenerate.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: kpenfound <[email protected]>

* generate

Signed-off-by: kpenfound <[email protected]>

* use new updatedConfigDirectory api to update dagger.json without module loading

Signed-off-by: kpenfound <[email protected]>

* move deps add/rm to updatedConfigDirectory api

Signed-off-by: kpenfound <[email protected]>

* roll back deps and engine. Only use embedded modules.json

Signed-off-by: kpenfound <[email protected]>

---------

Signed-off-by: kpenfound <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@dagger-codex dagger-codex Bot changed the title Workspaces: dagger mod commands [workspace] Workspaces: dagger mod commands May 28, 2026
vito pushed a commit that referenced this pull request May 29, 2026
* dagger mod subcommands for workspace and module development

Workspace modules (.dagger/config.toml):
- dagger mod install / uninstall / list, dagger mod search (registry fetched
  at runtime from GitHub with an embedded fallback), plus a top-level
  dagger uninstall and the Workspace.uninstall resolver.

Module development (dagger.json):
- dagger mod deps add / rm / list (ModuleSource dependency APIs)
- dagger mod engine required / require / require-current (ModuleSource engine version)

Generated SDK clients and docs are produced by a follow-up regenerate.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: kpenfound <[email protected]>

* generate

Signed-off-by: kpenfound <[email protected]>

* use new updatedConfigDirectory api to update dagger.json without module loading

Signed-off-by: kpenfound <[email protected]>

* move deps add/rm to updatedConfigDirectory api

Signed-off-by: kpenfound <[email protected]>

* roll back deps and engine. Only use embedded modules.json

Signed-off-by: kpenfound <[email protected]>

---------

Signed-off-by: kpenfound <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
tiborvass pushed a commit that referenced this pull request May 29, 2026
* dagger mod subcommands for workspace and module development

Workspace modules (.dagger/config.toml):
- dagger mod install / uninstall / list, dagger mod search (registry fetched
  at runtime from GitHub with an embedded fallback), plus a top-level
  dagger uninstall and the Workspace.uninstall resolver.

Module development (dagger.json):
- dagger mod deps add / rm / list (ModuleSource dependency APIs)
- dagger mod engine required / require / require-current (ModuleSource engine version)

Generated SDK clients and docs are produced by a follow-up regenerate.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: kpenfound <[email protected]>

* generate

Signed-off-by: kpenfound <[email protected]>

* use new updatedConfigDirectory api to update dagger.json without module loading

Signed-off-by: kpenfound <[email protected]>

* move deps add/rm to updatedConfigDirectory api

Signed-off-by: kpenfound <[email protected]>

* roll back deps and engine. Only use embedded modules.json

Signed-off-by: kpenfound <[email protected]>

---------

Signed-off-by: kpenfound <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
tiborvass pushed a commit that referenced this pull request May 30, 2026
* dagger mod subcommands for workspace and module development

Workspace modules (.dagger/config.toml):
- dagger mod install / uninstall / list, dagger mod search (registry fetched
  at runtime from GitHub with an embedded fallback), plus a top-level
  dagger uninstall and the Workspace.uninstall resolver.

Module development (dagger.json):
- dagger mod deps add / rm / list (ModuleSource dependency APIs)
- dagger mod engine required / require / require-current (ModuleSource engine version)

Generated SDK clients and docs are produced by a follow-up regenerate.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: kpenfound <[email protected]>

* generate

Signed-off-by: kpenfound <[email protected]>

* use new updatedConfigDirectory api to update dagger.json without module loading

Signed-off-by: kpenfound <[email protected]>

* move deps add/rm to updatedConfigDirectory api

Signed-off-by: kpenfound <[email protected]>

* roll back deps and engine. Only use embedded modules.json

Signed-off-by: kpenfound <[email protected]>

---------

Signed-off-by: kpenfound <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
eunomie pushed a commit to eunomie/dagger that referenced this pull request May 30, 2026
* dagger mod subcommands for workspace and module development

Workspace modules (.dagger/config.toml):
- dagger mod install / uninstall / list, dagger mod search (registry fetched
  at runtime from GitHub with an embedded fallback), plus a top-level
  dagger uninstall and the Workspace.uninstall resolver.

Module development (dagger.json):
- dagger mod deps add / rm / list (ModuleSource dependency APIs)
- dagger mod engine required / require / require-current (ModuleSource engine version)

Generated SDK clients and docs are produced by a follow-up regenerate.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: kpenfound <[email protected]>

* generate

Signed-off-by: kpenfound <[email protected]>

* use new updatedConfigDirectory api to update dagger.json without module loading

Signed-off-by: kpenfound <[email protected]>

* move deps add/rm to updatedConfigDirectory api

Signed-off-by: kpenfound <[email protected]>

* roll back deps and engine. Only use embedded modules.json

Signed-off-by: kpenfound <[email protected]>

---------

Signed-off-by: kpenfound <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: Yves Brissaud <[email protected]>
eunomie pushed a commit that referenced this pull request May 30, 2026
* dagger mod subcommands for workspace and module development

Workspace modules (.dagger/config.toml):
- dagger mod install / uninstall / list, dagger mod search (registry fetched
  at runtime from GitHub with an embedded fallback), plus a top-level
  dagger uninstall and the Workspace.uninstall resolver.

Module development (dagger.json):
- dagger mod deps add / rm / list (ModuleSource dependency APIs)
- dagger mod engine required / require / require-current (ModuleSource engine version)

Generated SDK clients and docs are produced by a follow-up regenerate.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: kpenfound <[email protected]>

* generate

Signed-off-by: kpenfound <[email protected]>

* use new updatedConfigDirectory api to update dagger.json without module loading

Signed-off-by: kpenfound <[email protected]>

* move deps add/rm to updatedConfigDirectory api

Signed-off-by: kpenfound <[email protected]>

* roll back deps and engine. Only use embedded modules.json

Signed-off-by: kpenfound <[email protected]>

---------

Signed-off-by: kpenfound <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: Yves Brissaud <[email protected]>
tiborvass pushed a commit that referenced this pull request Jun 1, 2026
* dagger mod subcommands for workspace and module development

Workspace modules (.dagger/config.toml):
- dagger mod install / uninstall / list, dagger mod search (registry fetched
  at runtime from GitHub with an embedded fallback), plus a top-level
  dagger uninstall and the Workspace.uninstall resolver.

Module development (dagger.json):
- dagger mod deps add / rm / list (ModuleSource dependency APIs)
- dagger mod engine required / require / require-current (ModuleSource engine version)

Generated SDK clients and docs are produced by a follow-up regenerate.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: kpenfound <[email protected]>

* generate

Signed-off-by: kpenfound <[email protected]>

* use new updatedConfigDirectory api to update dagger.json without module loading

Signed-off-by: kpenfound <[email protected]>

* move deps add/rm to updatedConfigDirectory api

Signed-off-by: kpenfound <[email protected]>

* roll back deps and engine. Only use embedded modules.json

Signed-off-by: kpenfound <[email protected]>

---------

Signed-off-by: kpenfound <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: Yves Brissaud <[email protected]>
shykes pushed a commit that referenced this pull request Jun 1, 2026
* dagger mod subcommands for workspace and module development

Workspace modules (.dagger/config.toml):
- dagger mod install / uninstall / list, dagger mod search (registry fetched
  at runtime from GitHub with an embedded fallback), plus a top-level
  dagger uninstall and the Workspace.uninstall resolver.

Module development (dagger.json):
- dagger mod deps add / rm / list (ModuleSource dependency APIs)
- dagger mod engine required / require / require-current (ModuleSource engine version)

Generated SDK clients and docs are produced by a follow-up regenerate.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: kpenfound <[email protected]>

* generate

Signed-off-by: kpenfound <[email protected]>

* use new updatedConfigDirectory api to update dagger.json without module loading

Signed-off-by: kpenfound <[email protected]>

* move deps add/rm to updatedConfigDirectory api

Signed-off-by: kpenfound <[email protected]>

* roll back deps and engine. Only use embedded modules.json

Signed-off-by: kpenfound <[email protected]>

---------

Signed-off-by: kpenfound <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: Yves Brissaud <[email protected]>
Signed-off-by: Kyle Penfound <[email protected]>
tiborvass pushed a commit that referenced this pull request Jun 1, 2026
* dagger mod subcommands for workspace and module development

Workspace modules (.dagger/config.toml):
- dagger mod install / uninstall / list, dagger mod search (registry fetched
  at runtime from GitHub with an embedded fallback), plus a top-level
  dagger uninstall and the Workspace.uninstall resolver.

Module development (dagger.json):
- dagger mod deps add / rm / list (ModuleSource dependency APIs)
- dagger mod engine required / require / require-current (ModuleSource engine version)

Generated SDK clients and docs are produced by a follow-up regenerate.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: kpenfound <[email protected]>

* generate

Signed-off-by: kpenfound <[email protected]>

* use new updatedConfigDirectory api to update dagger.json without module loading

Signed-off-by: kpenfound <[email protected]>

* move deps add/rm to updatedConfigDirectory api

Signed-off-by: kpenfound <[email protected]>

* roll back deps and engine. Only use embedded modules.json

Signed-off-by: kpenfound <[email protected]>

---------

Signed-off-by: kpenfound <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: Yves Brissaud <[email protected]>
Signed-off-by: Kyle Penfound <[email protected]>
shykes added a commit that referenced this pull request Jun 10, 2026
The old --mod flag carried two unrelated meanings: "load a module for
this invocation" (consumer) and "select a module to operate on" (author).
This conflation is what caused PR #13226's deps/engine commands to be
rolled back before merge.

--load-module names the flag's actual job. Short form -m is preserved
for muscle memory. The mutually-exclusive --no-mod/-M is also renamed
to --no-load-module/-M.

Authoring commands will be added under a separate dagger module group
in a follow-up phase; they take no module-targeting flag (operate on
the dagger.json in cwd).

Part of the CLI 1.0 redesign — see future/cli-1.0.md (#13392).

Changes:
- cmd/dagger/module.go: rename in moduleAddFlags funnel + error message
- cmd/dagger/shell.go: update comment referencing --no-mod
- cmd/dagger/cloud_test.go: --mod -> --load-module in test args
- cmd/dagger/workspace_test.go: Lookup("mod") -> Lookup("load-module")
- core/integration/workspace_modules_test.go: update flag + error text
- core/integration/module_call_test.go: update flag-conflict subtest
  to reflect that the global flag no longer collides with function
  args named "mod"
- docs/current_docs/reference/cli/index.mdx: update help-text snippets
shykes added a commit that referenced this pull request Jun 10, 2026
Moves dagger function call -> dagger api call (rename of var to apiCallCmd).
Moves dagger function list -> dagger api functions (rename to plural noun,
and var renamed to apiFunctionsCmd).
Kills the dagger function/fn group entirely.
Drops the hidden dagger functions top-level alias (funcListCmd).
Keeps dagger call as a hidden top-level alias for dagger api call (via the
preexisting callModCmd).

Also adds the api group Long description with the teaching beat from the
design doc:

  "Every Dagger command — check, up, generate, even install — ultimately
   runs against a GraphQL API served by the Dagger engine, combining
   Dagger's core types with schema extensions loaded from modules..."

So dagger api --help now explains what the group is for, while the
top-level mockup keeps the bare "(advanced)" tag for signal-and-skip.

The singular dagger module authoring group (with deps/engine subcommands)
was originally planned for this phase but is deferred. Restoring the
deps/engine commands from PR #13226 requires re-porting the schema-side
work (ModuleSource.updatedConfigDirectory and friends in
core/schema/modulesource.go) which doesn't exist on main. That schema work
will land alongside the deps/engine CLI commands in a later phase.

Tests:
- TestCosmeticCommandAliases rewritten to look up the call/functions
  commands under api instead of under function
- TestHelpAliasesRespectHiddenAliases drops the function-group assertion
- Validate-workspace-flag-policy assertion updated to use apiCallCmd
shykes added a commit that referenced this pull request Jun 10, 2026
Adds the singular `dagger module` group at top-level, with `deps` and
`engine` subcommands restored from PR #13226's pre-rollback state.
The original work was rolled back because there was no clean home
for it under the old `dagger mod` — adding it created the consumer/
author conflation. Phase 1 cleared the old `dagger mod`; this phase
introduces the singular module group as the dedicated authoring lane.

CLI surface:

  dagger module deps   { add, rm, list }
  dagger module engine { require, require-current, require-latest, required }

Both groups operate on the dagger-module.toml reachable from the
current directory. Authoring commands take no module-targeting flag
(--load-module from a higher scope is still honored via the existing
helper, but the design's intended pattern is cd-first).

Schema port (core/schema/modulesource.go):

- ModuleSource.updatedConfigDirectory: writes dagger.json with any
  in-memory edits applied, returned as a diff. Does NOT run codegen
  and does NOT validate the engine version against the running
  engine, so a module can declare a requirement newer than the
  engine it's currently being edited on. Loading or serving such a
  module still fails at moduleSource.asModule — the gate only moves,
  it doesn't disappear.

- loadModuleSourceConfig split into:
  - buildModuleConfig (does the build without validation)
  - loadModuleSourceConfig (wrapper that validates engine version)
  This lets updatedConfigDirectory persist a config without
  triggering the version gate, while existing load/serve paths still
  enforce it.

SDK port:

- sdk/go/dagger.gen.go gains the UpdatedConfigDirectory method on
  ModuleSource. Other SDKs (Python, TypeScript, etc.) are not
  regenerated here — they'll be picked up by the next full codegen
  pass. The CLI doesn't use them.

Module init is still deferred — it depends on the SDK module interface
work (sdks.json alias registry, --sdk auto-install, template
convention) tracked in future/cli-1.0.md.
@shykes shykes mentioned this pull request Jun 10, 2026
5 of 18 tasks
shykes added a commit that referenced this pull request Jun 10, 2026
Implements the doctor verb. Three sequential steps, each independently
prompted with a yes/no question the user can skip:

  Step 1: Cloud login
    - If already logged in (cloudauth.GetCloudAuth succeeds), no-op.
    - Otherwise: prompt; if accepted, invoke the same flow as
      `dagger cloud login` (cloudauth.Login with auth gate).

  Step 2: Workspace migration
    - Build the migration via dag.CurrentWorkspace().Migrate().
    - If the resulting changeset is empty, no-op.
    - Otherwise: prompt; if accepted, apply via handleChangesetResponseAt
      against the workspace export path (same routing the deleted
      `dagger workspace migrate` used).

  Step 3: Recommended modules
    - Reactivates the recommend scan from PR #13226's pre-rollback state.
    - Restored: Recommend []string field on registryModule, modules.json
      already carried the patterns through Phase 1, plus the helpers
      (runRecommend, recommendation, recommendExcludeDirs,
      installedModuleNames) now in a new recommend.go.
    - Skips modules already installed.
    - Prompts with the table of matches; if accepted, installs each
      recommended module via installWorkspaceModule.

Confirm prompt:
- --auto-apply (-y) accepts every step without prompting.
- Non-interactive (no TTY on stdin): default is to skip — the safer
  default; users in CI explicitly pass --auto-apply if they want
  setup to mutate state.
- Interactive: [Y/n] prompt; empty / y / yes accepts.

Bonus: brings back the small workspace export-path helpers
(currentWorkspaceExportPath, localWorkspaceAddressPath,
workspaceRootFromCwd) that were deleted with migrate.go in phase 3.
Now they live in setup.go since setup is their only caller.

Design doc updated:
- setup decision context entry expanded with the concrete shape.
- Discrete changes setup item marked done.
eunomie pushed a commit to eunomie/dagger that referenced this pull request Jun 16, 2026
The old --mod flag carried two unrelated meanings: "load a module for
this invocation" (consumer) and "select a module to operate on" (author).
This conflation is what caused PR dagger#13226's deps/engine commands to be
rolled back before merge.

--load-module names the flag's actual job. Short form -m is preserved
for muscle memory. The mutually-exclusive --no-mod/-M is also renamed
to --no-load-module/-M.

Authoring commands will be added under a separate dagger module group
in a follow-up phase; they take no module-targeting flag (operate on
the dagger.json in cwd).

Part of the CLI 1.0 redesign — see future/cli-1.0.md (dagger#13392).

Changes:
- cmd/dagger/module.go: rename in moduleAddFlags funnel + error message
- cmd/dagger/shell.go: update comment referencing --no-mod
- cmd/dagger/cloud_test.go: --mod -> --load-module in test args
- cmd/dagger/workspace_test.go: Lookup("mod") -> Lookup("load-module")
- core/integration/workspace_modules_test.go: update flag + error text
- core/integration/module_call_test.go: update flag-conflict subtest
  to reflect that the global flag no longer collides with function
  args named "mod"
- docs/current_docs/reference/cli/index.mdx: update help-text snippets

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit to eunomie/dagger that referenced this pull request Jun 16, 2026
Moves dagger function call -> dagger api call (rename of var to apiCallCmd).
Moves dagger function list -> dagger api functions (rename to plural noun,
and var renamed to apiFunctionsCmd).
Kills the dagger function/fn group entirely.
Drops the hidden dagger functions top-level alias (funcListCmd).
Keeps dagger call as a hidden top-level alias for dagger api call (via the
preexisting callModCmd).

Also adds the api group Long description with the teaching beat from the
design doc:

  "Every Dagger command — check, up, generate, even install — ultimately
   runs against a GraphQL API served by the Dagger engine, combining
   Dagger's core types with schema extensions loaded from modules..."

So dagger api --help now explains what the group is for, while the
top-level mockup keeps the bare "(advanced)" tag for signal-and-skip.

The singular dagger module authoring group (with deps/engine subcommands)
was originally planned for this phase but is deferred. Restoring the
deps/engine commands from PR dagger#13226 requires re-porting the schema-side
work (ModuleSource.updatedConfigDirectory and friends in
core/schema/modulesource.go) which doesn't exist on main. That schema work
will land alongside the deps/engine CLI commands in a later phase.

Tests:
- TestCosmeticCommandAliases rewritten to look up the call/functions
  commands under api instead of under function
- TestHelpAliasesRespectHiddenAliases drops the function-group assertion
- Validate-workspace-flag-policy assertion updated to use apiCallCmd

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit to eunomie/dagger that referenced this pull request Jun 16, 2026
Adds the singular `dagger module` group at top-level, with `deps` and
`engine` subcommands restored from PR dagger#13226's pre-rollback state.
The original work was rolled back because there was no clean home
for it under the old `dagger mod` — adding it created the consumer/
author conflation. Phase 1 cleared the old `dagger mod`; this phase
introduces the singular module group as the dedicated authoring lane.

CLI surface:

  dagger module deps   { add, rm, list }
  dagger module engine { require, require-current, require-latest, required }

Both groups operate on the dagger-module.toml reachable from the
current directory. Authoring commands take no module-targeting flag
(--load-module from a higher scope is still honored via the existing
helper, but the design's intended pattern is cd-first).

Schema port (core/schema/modulesource.go):

- ModuleSource.updatedConfigDirectory: writes dagger.json with any
  in-memory edits applied, returned as a diff. Does NOT run codegen
  and does NOT validate the engine version against the running
  engine, so a module can declare a requirement newer than the
  engine it's currently being edited on. Loading or serving such a
  module still fails at moduleSource.asModule — the gate only moves,
  it doesn't disappear.

- loadModuleSourceConfig split into:
  - buildModuleConfig (does the build without validation)
  - loadModuleSourceConfig (wrapper that validates engine version)
  This lets updatedConfigDirectory persist a config without
  triggering the version gate, while existing load/serve paths still
  enforce it.

SDK port:

- sdk/go/dagger.gen.go gains the UpdatedConfigDirectory method on
  ModuleSource. Other SDKs (Python, TypeScript, etc.) are not
  regenerated here — they'll be picked up by the next full codegen
  pass. The CLI doesn't use them.

Module init is still deferred — it depends on the SDK module interface
work (sdks.json alias registry, --sdk auto-install, template
convention) tracked in future/cli-1.0.md.

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit to eunomie/dagger that referenced this pull request Jun 16, 2026
Implements the doctor verb. Three sequential steps, each independently
prompted with a yes/no question the user can skip:

  Step 1: Cloud login
    - If already logged in (cloudauth.GetCloudAuth succeeds), no-op.
    - Otherwise: prompt; if accepted, invoke the same flow as
      `dagger cloud login` (cloudauth.Login with auth gate).

  Step 2: Workspace migration
    - Build the migration via dag.CurrentWorkspace().Migrate().
    - If the resulting changeset is empty, no-op.
    - Otherwise: prompt; if accepted, apply via handleChangesetResponseAt
      against the workspace export path (same routing the deleted
      `dagger workspace migrate` used).

  Step 3: Recommended modules
    - Reactivates the recommend scan from PR dagger#13226's pre-rollback state.
    - Restored: Recommend []string field on registryModule, modules.json
      already carried the patterns through Phase 1, plus the helpers
      (runRecommend, recommendation, recommendExcludeDirs,
      installedModuleNames) now in a new recommend.go.
    - Skips modules already installed.
    - Prompts with the table of matches; if accepted, installs each
      recommended module via installWorkspaceModule.

Confirm prompt:
- --auto-apply (-y) accepts every step without prompting.
- Non-interactive (no TTY on stdin): default is to skip — the safer
  default; users in CI explicitly pass --auto-apply if they want
  setup to mutate state.
- Interactive: [Y/n] prompt; empty / y / yes accepts.

Bonus: brings back the small workspace export-path helpers
(currentWorkspaceExportPath, localWorkspaceAddressPath,
workspaceRootFromCwd) that were deleted with migrate.go in phase 3.
Now they live in setup.go since setup is their only caller.

Design doc updated:
- setup decision context entry expanded with the concrete shape.
- Discrete changes setup item marked done.

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit to eunomie/dagger that referenced this pull request Jun 16, 2026
The old --mod flag carried two unrelated meanings: "load a module for
this invocation" (consumer) and "select a module to operate on" (author).
This conflation is what caused PR dagger#13226's deps/engine commands to be
rolled back before merge.

--load-module names the flag's actual job. Short form -m is preserved
for muscle memory. The mutually-exclusive --no-mod/-M is also renamed
to --no-load-module/-M.

Authoring commands will be added under a separate dagger module group
in a follow-up phase; they take no module-targeting flag (operate on
the dagger.json in cwd).

Part of the CLI 1.0 redesign — see future/cli-1.0.md (dagger#13392).

Changes:
- cmd/dagger/module.go: rename in moduleAddFlags funnel + error message
- cmd/dagger/shell.go: update comment referencing --no-mod
- cmd/dagger/cloud_test.go: --mod -> --load-module in test args
- cmd/dagger/workspace_test.go: Lookup("mod") -> Lookup("load-module")
- core/integration/workspace_modules_test.go: update flag + error text
- core/integration/module_call_test.go: update flag-conflict subtest
  to reflect that the global flag no longer collides with function
  args named "mod"
- docs/current_docs/reference/cli/index.mdx: update help-text snippets

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit to eunomie/dagger that referenced this pull request Jun 16, 2026
Moves dagger function call -> dagger api call (rename of var to apiCallCmd).
Moves dagger function list -> dagger api functions (rename to plural noun,
and var renamed to apiFunctionsCmd).
Kills the dagger function/fn group entirely.
Drops the hidden dagger functions top-level alias (funcListCmd).
Keeps dagger call as a hidden top-level alias for dagger api call (via the
preexisting callModCmd).

Also adds the api group Long description with the teaching beat from the
design doc:

  "Every Dagger command — check, up, generate, even install — ultimately
   runs against a GraphQL API served by the Dagger engine, combining
   Dagger's core types with schema extensions loaded from modules..."

So dagger api --help now explains what the group is for, while the
top-level mockup keeps the bare "(advanced)" tag for signal-and-skip.

The singular dagger module authoring group (with deps/engine subcommands)
was originally planned for this phase but is deferred. Restoring the
deps/engine commands from PR dagger#13226 requires re-porting the schema-side
work (ModuleSource.updatedConfigDirectory and friends in
core/schema/modulesource.go) which doesn't exist on main. That schema work
will land alongside the deps/engine CLI commands in a later phase.

Tests:
- TestCosmeticCommandAliases rewritten to look up the call/functions
  commands under api instead of under function
- TestHelpAliasesRespectHiddenAliases drops the function-group assertion
- Validate-workspace-flag-policy assertion updated to use apiCallCmd

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit to eunomie/dagger that referenced this pull request Jun 16, 2026
Adds the singular `dagger module` group at top-level, with `deps` and
`engine` subcommands restored from PR dagger#13226's pre-rollback state.
The original work was rolled back because there was no clean home
for it under the old `dagger mod` — adding it created the consumer/
author conflation. Phase 1 cleared the old `dagger mod`; this phase
introduces the singular module group as the dedicated authoring lane.

CLI surface:

  dagger module deps   { add, rm, list }
  dagger module engine { require, require-current, require-latest, required }

Both groups operate on the dagger-module.toml reachable from the
current directory. Authoring commands take no module-targeting flag
(--load-module from a higher scope is still honored via the existing
helper, but the design's intended pattern is cd-first).

Schema port (core/schema/modulesource.go):

- ModuleSource.updatedConfigDirectory: writes dagger.json with any
  in-memory edits applied, returned as a diff. Does NOT run codegen
  and does NOT validate the engine version against the running
  engine, so a module can declare a requirement newer than the
  engine it's currently being edited on. Loading or serving such a
  module still fails at moduleSource.asModule — the gate only moves,
  it doesn't disappear.

- loadModuleSourceConfig split into:
  - buildModuleConfig (does the build without validation)
  - loadModuleSourceConfig (wrapper that validates engine version)
  This lets updatedConfigDirectory persist a config without
  triggering the version gate, while existing load/serve paths still
  enforce it.

SDK port:

- sdk/go/dagger.gen.go gains the UpdatedConfigDirectory method on
  ModuleSource. Other SDKs (Python, TypeScript, etc.) are not
  regenerated here — they'll be picked up by the next full codegen
  pass. The CLI doesn't use them.

Module init is still deferred — it depends on the SDK module interface
work (sdks.json alias registry, --sdk auto-install, template
convention) tracked in future/cli-1.0.md.

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit to eunomie/dagger that referenced this pull request Jun 16, 2026
Implements the doctor verb. Three sequential steps, each independently
prompted with a yes/no question the user can skip:

  Step 1: Cloud login
    - If already logged in (cloudauth.GetCloudAuth succeeds), no-op.
    - Otherwise: prompt; if accepted, invoke the same flow as
      `dagger cloud login` (cloudauth.Login with auth gate).

  Step 2: Workspace migration
    - Build the migration via dag.CurrentWorkspace().Migrate().
    - If the resulting changeset is empty, no-op.
    - Otherwise: prompt; if accepted, apply via handleChangesetResponseAt
      against the workspace export path (same routing the deleted
      `dagger workspace migrate` used).

  Step 3: Recommended modules
    - Reactivates the recommend scan from PR dagger#13226's pre-rollback state.
    - Restored: Recommend []string field on registryModule, modules.json
      already carried the patterns through Phase 1, plus the helpers
      (runRecommend, recommendation, recommendExcludeDirs,
      installedModuleNames) now in a new recommend.go.
    - Skips modules already installed.
    - Prompts with the table of matches; if accepted, installs each
      recommended module via installWorkspaceModule.

Confirm prompt:
- --auto-apply (-y) accepts every step without prompting.
- Non-interactive (no TTY on stdin): default is to skip — the safer
  default; users in CI explicitly pass --auto-apply if they want
  setup to mutate state.
- Interactive: [Y/n] prompt; empty / y / yes accepts.

Bonus: brings back the small workspace export-path helpers
(currentWorkspaceExportPath, localWorkspaceAddressPath,
workspaceRootFromCwd) that were deleted with migrate.go in phase 3.
Now they live in setup.go since setup is their only caller.

Design doc updated:
- setup decision context entry expanded with the concrete shape.
- Discrete changes setup item marked done.

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit that referenced this pull request Jun 17, 2026
The old --mod flag carried two unrelated meanings: "load a module for
this invocation" (consumer) and "select a module to operate on" (author).
This conflation is what caused PR #13226's deps/engine commands to be
rolled back before merge.

--load-module names the flag's actual job. Short form -m is preserved
for muscle memory. The mutually-exclusive --no-mod/-M is also renamed
to --no-load-module/-M.

Authoring commands will be added under a separate dagger module group
in a follow-up phase; they take no module-targeting flag (operate on
the dagger.json in cwd).

Part of the CLI 1.0 redesign — see future/cli-1.0.md (#13392).

Changes:
- cmd/dagger/module.go: rename in moduleAddFlags funnel + error message
- cmd/dagger/shell.go: update comment referencing --no-mod
- cmd/dagger/cloud_test.go: --mod -> --load-module in test args
- cmd/dagger/workspace_test.go: Lookup("mod") -> Lookup("load-module")
- core/integration/workspace_modules_test.go: update flag + error text
- core/integration/module_call_test.go: update flag-conflict subtest
  to reflect that the global flag no longer collides with function
  args named "mod"
- docs/current_docs/reference/cli/index.mdx: update help-text snippets

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit that referenced this pull request Jun 17, 2026
Moves dagger function call -> dagger api call (rename of var to apiCallCmd).
Moves dagger function list -> dagger api functions (rename to plural noun,
and var renamed to apiFunctionsCmd).
Kills the dagger function/fn group entirely.
Drops the hidden dagger functions top-level alias (funcListCmd).
Keeps dagger call as a hidden top-level alias for dagger api call (via the
preexisting callModCmd).

Also adds the api group Long description with the teaching beat from the
design doc:

  "Every Dagger command — check, up, generate, even install — ultimately
   runs against a GraphQL API served by the Dagger engine, combining
   Dagger's core types with schema extensions loaded from modules..."

So dagger api --help now explains what the group is for, while the
top-level mockup keeps the bare "(advanced)" tag for signal-and-skip.

The singular dagger module authoring group (with deps/engine subcommands)
was originally planned for this phase but is deferred. Restoring the
deps/engine commands from PR #13226 requires re-porting the schema-side
work (ModuleSource.updatedConfigDirectory and friends in
core/schema/modulesource.go) which doesn't exist on main. That schema work
will land alongside the deps/engine CLI commands in a later phase.

Tests:
- TestCosmeticCommandAliases rewritten to look up the call/functions
  commands under api instead of under function
- TestHelpAliasesRespectHiddenAliases drops the function-group assertion
- Validate-workspace-flag-policy assertion updated to use apiCallCmd

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit that referenced this pull request Jun 17, 2026
Adds the singular `dagger module` group at top-level, with `deps` and
`engine` subcommands restored from PR #13226's pre-rollback state.
The original work was rolled back because there was no clean home
for it under the old `dagger mod` — adding it created the consumer/
author conflation. Phase 1 cleared the old `dagger mod`; this phase
introduces the singular module group as the dedicated authoring lane.

CLI surface:

  dagger module deps   { add, rm, list }
  dagger module engine { require, require-current, require-latest, required }

Both groups operate on the dagger-module.toml reachable from the
current directory. Authoring commands take no module-targeting flag
(--load-module from a higher scope is still honored via the existing
helper, but the design's intended pattern is cd-first).

Schema port (core/schema/modulesource.go):

- ModuleSource.updatedConfigDirectory: writes dagger.json with any
  in-memory edits applied, returned as a diff. Does NOT run codegen
  and does NOT validate the engine version against the running
  engine, so a module can declare a requirement newer than the
  engine it's currently being edited on. Loading or serving such a
  module still fails at moduleSource.asModule — the gate only moves,
  it doesn't disappear.

- loadModuleSourceConfig split into:
  - buildModuleConfig (does the build without validation)
  - loadModuleSourceConfig (wrapper that validates engine version)
  This lets updatedConfigDirectory persist a config without
  triggering the version gate, while existing load/serve paths still
  enforce it.

SDK port:

- sdk/go/dagger.gen.go gains the UpdatedConfigDirectory method on
  ModuleSource. Other SDKs (Python, TypeScript, etc.) are not
  regenerated here — they'll be picked up by the next full codegen
  pass. The CLI doesn't use them.

Module init is still deferred — it depends on the SDK module interface
work (sdks.json alias registry, --sdk auto-install, template
convention) tracked in future/cli-1.0.md.

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit that referenced this pull request Jun 17, 2026
Implements the doctor verb. Three sequential steps, each independently
prompted with a yes/no question the user can skip:

  Step 1: Cloud login
    - If already logged in (cloudauth.GetCloudAuth succeeds), no-op.
    - Otherwise: prompt; if accepted, invoke the same flow as
      `dagger cloud login` (cloudauth.Login with auth gate).

  Step 2: Workspace migration
    - Build the migration via dag.CurrentWorkspace().Migrate().
    - If the resulting changeset is empty, no-op.
    - Otherwise: prompt; if accepted, apply via handleChangesetResponseAt
      against the workspace export path (same routing the deleted
      `dagger workspace migrate` used).

  Step 3: Recommended modules
    - Reactivates the recommend scan from PR #13226's pre-rollback state.
    - Restored: Recommend []string field on registryModule, modules.json
      already carried the patterns through Phase 1, plus the helpers
      (runRecommend, recommendation, recommendExcludeDirs,
      installedModuleNames) now in a new recommend.go.
    - Skips modules already installed.
    - Prompts with the table of matches; if accepted, installs each
      recommended module via installWorkspaceModule.

Confirm prompt:
- --auto-apply (-y) accepts every step without prompting.
- Non-interactive (no TTY on stdin): default is to skip — the safer
  default; users in CI explicitly pass --auto-apply if they want
  setup to mutate state.
- Interactive: [Y/n] prompt; empty / y / yes accepts.

Bonus: brings back the small workspace export-path helpers
(currentWorkspaceExportPath, localWorkspaceAddressPath,
workspaceRootFromCwd) that were deleted with migrate.go in phase 3.
Now they live in setup.go since setup is their only caller.

Design doc updated:
- setup decision context entry expanded with the concrete shape.
- Discrete changes setup item marked done.

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit that referenced this pull request Jun 18, 2026
The old --mod flag carried two unrelated meanings: "load a module for
this invocation" (consumer) and "select a module to operate on" (author).
This conflation is what caused PR #13226's deps/engine commands to be
rolled back before merge.

--load-module names the flag's actual job. Short form -m is preserved
for muscle memory. The mutually-exclusive --no-mod/-M is also renamed
to --no-load-module/-M.

Authoring commands will be added under a separate dagger module group
in a follow-up phase; they take no module-targeting flag (operate on
the dagger.json in cwd).

Part of the CLI 1.0 redesign — see future/cli-1.0.md (#13392).

Changes:
- cmd/dagger/module.go: rename in moduleAddFlags funnel + error message
- cmd/dagger/shell.go: update comment referencing --no-mod
- cmd/dagger/cloud_test.go: --mod -> --load-module in test args
- cmd/dagger/workspace_test.go: Lookup("mod") -> Lookup("load-module")
- core/integration/workspace_modules_test.go: update flag + error text
- core/integration/module_call_test.go: update flag-conflict subtest
  to reflect that the global flag no longer collides with function
  args named "mod"
- docs/current_docs/reference/cli/index.mdx: update help-text snippets

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit that referenced this pull request Jun 18, 2026
Moves dagger function call -> dagger api call (rename of var to apiCallCmd).
Moves dagger function list -> dagger api functions (rename to plural noun,
and var renamed to apiFunctionsCmd).
Kills the dagger function/fn group entirely.
Drops the hidden dagger functions top-level alias (funcListCmd).
Keeps dagger call as a hidden top-level alias for dagger api call (via the
preexisting callModCmd).

Also adds the api group Long description with the teaching beat from the
design doc:

  "Every Dagger command — check, up, generate, even install — ultimately
   runs against a GraphQL API served by the Dagger engine, combining
   Dagger's core types with schema extensions loaded from modules..."

So dagger api --help now explains what the group is for, while the
top-level mockup keeps the bare "(advanced)" tag for signal-and-skip.

The singular dagger module authoring group (with deps/engine subcommands)
was originally planned for this phase but is deferred. Restoring the
deps/engine commands from PR #13226 requires re-porting the schema-side
work (ModuleSource.updatedConfigDirectory and friends in
core/schema/modulesource.go) which doesn't exist on main. That schema work
will land alongside the deps/engine CLI commands in a later phase.

Tests:
- TestCosmeticCommandAliases rewritten to look up the call/functions
  commands under api instead of under function
- TestHelpAliasesRespectHiddenAliases drops the function-group assertion
- Validate-workspace-flag-policy assertion updated to use apiCallCmd

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit that referenced this pull request Jun 18, 2026
Adds the singular `dagger module` group at top-level, with `deps` and
`engine` subcommands restored from PR #13226's pre-rollback state.
The original work was rolled back because there was no clean home
for it under the old `dagger mod` — adding it created the consumer/
author conflation. Phase 1 cleared the old `dagger mod`; this phase
introduces the singular module group as the dedicated authoring lane.

CLI surface:

  dagger module deps   { add, rm, list }
  dagger module engine { require, require-current, require-latest, required }

Both groups operate on the dagger-module.toml reachable from the
current directory. Authoring commands take no module-targeting flag
(--load-module from a higher scope is still honored via the existing
helper, but the design's intended pattern is cd-first).

Schema port (core/schema/modulesource.go):

- ModuleSource.updatedConfigDirectory: writes dagger.json with any
  in-memory edits applied, returned as a diff. Does NOT run codegen
  and does NOT validate the engine version against the running
  engine, so a module can declare a requirement newer than the
  engine it's currently being edited on. Loading or serving such a
  module still fails at moduleSource.asModule — the gate only moves,
  it doesn't disappear.

- loadModuleSourceConfig split into:
  - buildModuleConfig (does the build without validation)
  - loadModuleSourceConfig (wrapper that validates engine version)
  This lets updatedConfigDirectory persist a config without
  triggering the version gate, while existing load/serve paths still
  enforce it.

SDK port:

- sdk/go/dagger.gen.go gains the UpdatedConfigDirectory method on
  ModuleSource. Other SDKs (Python, TypeScript, etc.) are not
  regenerated here — they'll be picked up by the next full codegen
  pass. The CLI doesn't use them.

Module init is still deferred — it depends on the SDK module interface
work (sdks.json alias registry, --sdk auto-install, template
convention) tracked in future/cli-1.0.md.

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit that referenced this pull request Jun 18, 2026
Implements the doctor verb. Three sequential steps, each independently
prompted with a yes/no question the user can skip:

  Step 1: Cloud login
    - If already logged in (cloudauth.GetCloudAuth succeeds), no-op.
    - Otherwise: prompt; if accepted, invoke the same flow as
      `dagger cloud login` (cloudauth.Login with auth gate).

  Step 2: Workspace migration
    - Build the migration via dag.CurrentWorkspace().Migrate().
    - If the resulting changeset is empty, no-op.
    - Otherwise: prompt; if accepted, apply via handleChangesetResponseAt
      against the workspace export path (same routing the deleted
      `dagger workspace migrate` used).

  Step 3: Recommended modules
    - Reactivates the recommend scan from PR #13226's pre-rollback state.
    - Restored: Recommend []string field on registryModule, modules.json
      already carried the patterns through Phase 1, plus the helpers
      (runRecommend, recommendation, recommendExcludeDirs,
      installedModuleNames) now in a new recommend.go.
    - Skips modules already installed.
    - Prompts with the table of matches; if accepted, installs each
      recommended module via installWorkspaceModule.

Confirm prompt:
- --auto-apply (-y) accepts every step without prompting.
- Non-interactive (no TTY on stdin): default is to skip — the safer
  default; users in CI explicitly pass --auto-apply if they want
  setup to mutate state.
- Interactive: [Y/n] prompt; empty / y / yes accepts.

Bonus: brings back the small workspace export-path helpers
(currentWorkspaceExportPath, localWorkspaceAddressPath,
workspaceRootFromCwd) that were deleted with migrate.go in phase 3.
Now they live in setup.go since setup is their only caller.

Design doc updated:
- setup decision context entry expanded with the concrete shape.
- Discrete changes setup item marked done.

Signed-off-by: Solomon Hykes <[email protected]>
tiborvass pushed a commit that referenced this pull request Jun 19, 2026
The old --mod flag carried two unrelated meanings: "load a module for
this invocation" (consumer) and "select a module to operate on" (author).
This conflation is what caused PR #13226's deps/engine commands to be
rolled back before merge.

--load-module names the flag's actual job. Short form -m is preserved
for muscle memory. The mutually-exclusive --no-mod/-M is also renamed
to --no-load-module/-M.

Authoring commands will be added under a separate dagger module group
in a follow-up phase; they take no module-targeting flag (operate on
the dagger.json in cwd).

Part of the CLI 1.0 redesign — see future/cli-1.0.md (#13392).

Changes:
- cmd/dagger/module.go: rename in moduleAddFlags funnel + error message
- cmd/dagger/shell.go: update comment referencing --no-mod
- cmd/dagger/cloud_test.go: --mod -> --load-module in test args
- cmd/dagger/workspace_test.go: Lookup("mod") -> Lookup("load-module")
- core/integration/workspace_modules_test.go: update flag + error text
- core/integration/module_call_test.go: update flag-conflict subtest
  to reflect that the global flag no longer collides with function
  args named "mod"
- docs/current_docs/reference/cli/index.mdx: update help-text snippets

Signed-off-by: Solomon Hykes <[email protected]>
tiborvass pushed a commit that referenced this pull request Jun 19, 2026
Moves dagger function call -> dagger api call (rename of var to apiCallCmd).
Moves dagger function list -> dagger api functions (rename to plural noun,
and var renamed to apiFunctionsCmd).
Kills the dagger function/fn group entirely.
Drops the hidden dagger functions top-level alias (funcListCmd).
Keeps dagger call as a hidden top-level alias for dagger api call (via the
preexisting callModCmd).

Also adds the api group Long description with the teaching beat from the
design doc:

  "Every Dagger command — check, up, generate, even install — ultimately
   runs against a GraphQL API served by the Dagger engine, combining
   Dagger's core types with schema extensions loaded from modules..."

So dagger api --help now explains what the group is for, while the
top-level mockup keeps the bare "(advanced)" tag for signal-and-skip.

The singular dagger module authoring group (with deps/engine subcommands)
was originally planned for this phase but is deferred. Restoring the
deps/engine commands from PR #13226 requires re-porting the schema-side
work (ModuleSource.updatedConfigDirectory and friends in
core/schema/modulesource.go) which doesn't exist on main. That schema work
will land alongside the deps/engine CLI commands in a later phase.

Tests:
- TestCosmeticCommandAliases rewritten to look up the call/functions
  commands under api instead of under function
- TestHelpAliasesRespectHiddenAliases drops the function-group assertion
- Validate-workspace-flag-policy assertion updated to use apiCallCmd

Signed-off-by: Solomon Hykes <[email protected]>
tiborvass pushed a commit that referenced this pull request Jun 19, 2026
Adds the singular `dagger module` group at top-level, with `deps` and
`engine` subcommands restored from PR #13226's pre-rollback state.
The original work was rolled back because there was no clean home
for it under the old `dagger mod` — adding it created the consumer/
author conflation. Phase 1 cleared the old `dagger mod`; this phase
introduces the singular module group as the dedicated authoring lane.

CLI surface:

  dagger module deps   { add, rm, list }
  dagger module engine { require, require-current, require-latest, required }

Both groups operate on the dagger-module.toml reachable from the
current directory. Authoring commands take no module-targeting flag
(--load-module from a higher scope is still honored via the existing
helper, but the design's intended pattern is cd-first).

Schema port (core/schema/modulesource.go):

- ModuleSource.updatedConfigDirectory: writes dagger.json with any
  in-memory edits applied, returned as a diff. Does NOT run codegen
  and does NOT validate the engine version against the running
  engine, so a module can declare a requirement newer than the
  engine it's currently being edited on. Loading or serving such a
  module still fails at moduleSource.asModule — the gate only moves,
  it doesn't disappear.

- loadModuleSourceConfig split into:
  - buildModuleConfig (does the build without validation)
  - loadModuleSourceConfig (wrapper that validates engine version)
  This lets updatedConfigDirectory persist a config without
  triggering the version gate, while existing load/serve paths still
  enforce it.

SDK port:

- sdk/go/dagger.gen.go gains the UpdatedConfigDirectory method on
  ModuleSource. Other SDKs (Python, TypeScript, etc.) are not
  regenerated here — they'll be picked up by the next full codegen
  pass. The CLI doesn't use them.

Module init is still deferred — it depends on the SDK module interface
work (sdks.json alias registry, --sdk auto-install, template
convention) tracked in future/cli-1.0.md.

Signed-off-by: Solomon Hykes <[email protected]>
tiborvass pushed a commit that referenced this pull request Jun 19, 2026
Implements the doctor verb. Three sequential steps, each independently
prompted with a yes/no question the user can skip:

  Step 1: Cloud login
    - If already logged in (cloudauth.GetCloudAuth succeeds), no-op.
    - Otherwise: prompt; if accepted, invoke the same flow as
      `dagger cloud login` (cloudauth.Login with auth gate).

  Step 2: Workspace migration
    - Build the migration via dag.CurrentWorkspace().Migrate().
    - If the resulting changeset is empty, no-op.
    - Otherwise: prompt; if accepted, apply via handleChangesetResponseAt
      against the workspace export path (same routing the deleted
      `dagger workspace migrate` used).

  Step 3: Recommended modules
    - Reactivates the recommend scan from PR #13226's pre-rollback state.
    - Restored: Recommend []string field on registryModule, modules.json
      already carried the patterns through Phase 1, plus the helpers
      (runRecommend, recommendation, recommendExcludeDirs,
      installedModuleNames) now in a new recommend.go.
    - Skips modules already installed.
    - Prompts with the table of matches; if accepted, installs each
      recommended module via installWorkspaceModule.

Confirm prompt:
- --auto-apply (-y) accepts every step without prompting.
- Non-interactive (no TTY on stdin): default is to skip — the safer
  default; users in CI explicitly pass --auto-apply if they want
  setup to mutate state.
- Interactive: [Y/n] prompt; empty / y / yes accepts.

Bonus: brings back the small workspace export-path helpers
(currentWorkspaceExportPath, localWorkspaceAddressPath,
workspaceRootFromCwd) that were deleted with migrate.go in phase 3.
Now they live in setup.go since setup is their only caller.

Design doc updated:
- setup decision context entry expanded with the concrete shape.
- Discrete changes setup item marked done.

Signed-off-by: Solomon Hykes <[email protected]>
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.

3 participants