feat!(flags): rename CLI flag names and add flag builder#714
Conversation
✅ Deploy Preview for images-devsy-sh canceled.
|
|
Important Review skippedToo many files! This PR contains 182 files, which is 82 over the limit of 100. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (182)
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Deploy Preview for devsydev canceled.
|
34631a3 to
44b2cea
Compare
|
@CodeRabbit review --committed |
|
✅ Action performedReview finished.
|
|
@CodeRabbit review --base |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Pull request overview
Refactors devsy’s CLI flag handling by centralizing flag wire names into a shared pkg/flags/names package and introducing a small flag-registration builder to standardize cobra/pflag usage across commands and internal self-invocation call sites.
Changes:
- Replaced scattered raw flag strings with compile-checked constants and helper renderers (
names.Flag*) acrosscmd/,pkg/, and e2e tests. - Introduced shared flag registration helpers (builder + shared devcontainer modifier flag registration).
- Extracted GPG signing-key detection into
pkg/gpg/signing.goand added supporting tests.
Reviewed changes
Copilot reviewed 170 out of 170 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/tunnel/dial.go | Use centralized flag constants in tunnel self-invocation args |
| pkg/tunnel/browser.go | Use centralized flag constants in SSH tunnel command args |
| pkg/ssh/config.go | Build ProxyCommand using centralized flag constants |
| pkg/ssh/config_test.go | Update SSH config expectations for new flag tokens |
| pkg/options/options.go | Export git identity env var allowlist for reuse |
| pkg/ide/opener/opener.go | Use centralized --command flag token |
| pkg/ide/opener/browser_tunnel.go | Use centralized flags for internal browser-tunnel invocation |
| pkg/ide/opener/browser_tunnel_unix.go | Use centralized flag token for inherited listener args |
| pkg/gpg/signing.go | Add extracted GPG signing helpers |
| pkg/gpg/signing_test.go | Update tests to new gpg package + exported API |
| pkg/gpg/forward.go | Use centralized flags for GPG agent forwarding SSH args |
| pkg/gpg/forward_test.go | Update forwarding arg expectations |
| pkg/flags/devcontainer.go | Add shared devcontainer modifier flag registration helper |
| pkg/dotfiles/dotfiles.go | Use centralized flags in dotfiles helper invocations |
| pkg/devcontainer/source.go | Extend devcontainer source parsing (id/path/image/none) + flag name in errors |
| pkg/devcontainer/source_test.go | Update/extend ParseSourceSpec test cases |
| pkg/devcontainer/setup.go | Use centralized flags in container setup self-invocation |
| pkg/devcontainer/config/result.go | Add GetContainerID helper for result envelope |
| pkg/devcontainer/config/build.go | Use centralized flag token in validation errors |
| pkg/devcontainer/config.go | Use centralized flag token in JSON parse errors |
| pkg/devcontainer/config_test.go | Update error-string expectations for renamed flag token |
| pkg/devcontainer/compose.go | Use centralized flag token in recreate log message |
| pkg/daemon/agent/daemon.go | Use centralized flags in daemon self-invocation args |
| pkg/config/config.go | Add ContextOptionBool helper |
| pkg/agent/delivery/workspace_seed.go | Use centralized flag token in reset warning message |
| e2e/tests/up/up_behaviors.go | Update up behavior tests to centralized flags |
| e2e/tests/up/provider_podman.go | Update podman provider e2e arg construction to centralized flags |
| e2e/tests/up/provider_docker.go | Update docker provider e2e arg construction to centralized flags |
| e2e/tests/up/dockerfile_build.go | Update recreate invocation to centralized flag token |
| e2e/tests/up-docker-compose/build.go | Update recreate invocation to centralized flag token |
| e2e/tests/template/template.go | Use centralized --features flag token in template tests |
| e2e/tests/ssh/ssh.go | Update GPG forwarding flag token used by e2e |
| e2e/tests/ssh/ssh_tunnel_mode_test.go | Update SSH tunnel mode flag token used by e2e |
| e2e/tests/ide/browser_returns.go | Update recreate arg mention + invocation to centralized flag token |
| e2e/tests/feature/features_test_cmd.go | Use centralized --features flag token in feature tests |
| e2e/tests/exec/exec.go | Update env probe flag token used by exec e2e |
| e2e/framework/command.go | Centralize e2e framework flag tokens via names |
| cmd/workspace/up/up.go | Adjust up command behavior + use names constants in flag plumbing |
| cmd/workspace/up/up_validate.go | Move/extend devcontainer source validation + update error tokens |
| cmd/workspace/up/up_update_remote_user_uid_test.go | Update tests for renamed update-remote-user-uid flag token |
| cmd/workspace/up/up_test.go | Update flag lookups/parsing to use names constants |
| cmd/workspace/up/up_devcontainer_source_test.go | Add unit tests for devcontainer source resolution |
| cmd/workspace/up/up_client.go | Reuse shared git identity env var list |
| cmd/workspace/up/configure.go | Use ContextOptionBool helper for config-driven bools |
| cmd/workspace/troubleshoot.go | Update command short description text |
| cmd/workspace/stop.go | Update command short description text |
| cmd/workspace/status.go | Switch to shared flag builder + centralized flag names |
| cmd/workspace/set_ide.go | Switch to shared flag builder + centralized flag names |
| cmd/workspace/ping.go | Rename parameter + update short description text |
| cmd/workspace/logs.go | Rename parameter + update short description text |
| cmd/workspace/list.go | Switch to shared flag builder + centralized flag names |
| cmd/workspace/import.go | Switch to shared flag builder + centralized flag names |
| cmd/workspace/export.go | Rename parameter + update short description text |
| cmd/workspace/exec.go | Switch to shared flag builder + shared devcontainer modifier flags |
| cmd/workspace/exec_test.go | Update tests for centralized flag names |
| cmd/workspace/describe.go | Switch to shared flag builder + centralized flag names |
| cmd/workspace/delete.go | Switch to shared flag builder + centralized flag names |
| cmd/workspace/build_test.go | Update build cmd tests for centralized flag names |
| cmd/template/publish.go | Switch to shared flag builder + centralized flag names |
| cmd/template/metadata.go | Switch to shared flag builder + centralized flag names |
| cmd/template/generate_docs.go | Switch to shared flag builder + centralized flag names |
| cmd/template/apply.go | Switch to shared flag builder + centralized flag names |
| cmd/self/update.go | Switch to shared flag builder + centralized flag names |
| cmd/self/update_test.go | Update tests for centralized flag names |
| cmd/root.go | Use centralized names for log-output/log-format tokens |
| cmd/provider/versions.go | Switch to shared flag builder + centralized flag names |
| cmd/provider/set.go | Switch to shared flag builder + centralized flag names |
| cmd/provider/set_source.go | Switch to shared flag builder + centralized flag names |
| cmd/provider/list.go | Switch to shared flag builder + centralized flag names |
| cmd/provider/init.go | Switch to shared flag builder + hidden flag via builder |
| cmd/provider/get.go | Switch to shared flag builder + centralized flag names |
| cmd/provider/delete.go | Switch to shared flag builder + centralized flag names |
| cmd/provider/add.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/workspace/watch.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/workspace/wakeup.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/workspace/update.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/workspace/sleep.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/workspace/rebuild.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/workspace/list.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/workspace/import.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/workspace/create.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/version.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/user/reset_password.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/update_provider.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/template/list.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/start.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/self.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/provider/rebuild.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/project/list.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/logout.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/login.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/list.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/health.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/flags/flags.go | Use centralized config flag name |
| cmd/pro/daemon/status.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/daemon/start.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/daemon/netcheck.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/cluster/list.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/cluster/add.go | Switch to shared flag builder + centralized flag names |
| cmd/pro/check_update.go | Switch to shared flag builder + centralized flag names |
| cmd/mcp/serve.go | Switch to shared flag builder + centralized flag names |
| cmd/machine/ssh.go | Switch to shared flag builder + centralized flag names |
| cmd/machine/delete.go | Switch to shared flag builder + centralized flag names |
| cmd/machine/create.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/ssh_server.go | Use centralized names for internal ssh-server flags |
| cmd/internal/ssh_git_clone.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/ssh_client.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/sh.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/runusercommands.go | Switch to shared flag builder + update error/log tokens |
| cmd/internal/runusercommands_test.go | Update tests for centralized flag names |
| cmd/internal/request.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/git_credentials.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/get.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/get_workspace_config.go | Switch to shared flag builder + use ContextOptionBool |
| cmd/internal/fleet_server.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/container_tunnel.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/browser_tunnel.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/browser_tunnel_test.go | Update tests for centralized flag names |
| cmd/internal/agentworkspace/update_config.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentworkspace/up.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentworkspace/stop.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentworkspace/status.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentworkspace/setup_gpg.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentworkspace/logs.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentworkspace/logs_daemon.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentworkspace/install_dotfiles.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentworkspace/delete.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentworkspace/clean.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentworkspace/build.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentcontainer/vscode_async.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentcontainer/ssh_server.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentcontainer/setup.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentcontainer/post_attach.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentcontainer/deferred_hooks.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentcontainer/daemon.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentcontainer/credentials_server.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agentcontainer/browser_async.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agent_docker_credentials.go | Switch to shared flag builder + centralized flag names |
| cmd/internal/agent_daemon.go | Switch to shared flag builder + centralized flag names |
| cmd/ide/use.go | Switch to shared flag builder + centralized flag names |
| cmd/ide/set.go | Switch to shared flag builder + centralized flag names |
| cmd/flags/flags.go | Centralize global flag names + bind env using constants |
| cmd/flag_aliases_test.go | Remove tests for removed hidden legacy aliases; keep log-format alias test |
| cmd/feature/upgrade.go | Switch to shared flag builder + centralized flag names |
| cmd/feature/upgrade_test.go | Update tests for centralized flag names |
| cmd/feature/test.go | Switch to shared flag builder + centralized flag names |
| cmd/feature/test_test.go | Update tests for centralized flag names |
| cmd/feature/resolvedeps.go | Switch to shared flag builder + centralized flag names |
| cmd/feature/publish.go | Switch to shared flag builder + centralized flag names |
| cmd/feature/publish_test.go | Update tests for centralized flag names |
| cmd/feature/package.go | Switch to shared flag builder + centralized flag names |
| cmd/feature/package_test.go | Update tests for centralized flag names |
| cmd/feature/outdated.go | Switch to shared flag builder + centralized flag names |
| cmd/feature/info.go | Switch to shared flag builder + centralized flag names |
| cmd/feature/info_test.go | Update tests for centralized flag names |
| cmd/feature/generatedocs.go | Switch to shared flag builder + centralized flag names |
| cmd/env_flags_test.go | Update env flag tests to centralized flag names |
| cmd/context/use.go | Switch to shared flag builder + centralized flag names |
| cmd/context/set_options.go | Switch to shared flag builder + centralized flag names |
| cmd/context/create.go | Switch to shared flag builder + centralized flag names |
| cmd/config/read.go | Switch to shared flag builder + centralized flag names |
| cmd/config/apply.go | Switch to shared flag builder for apply flags |
| cmd/completion/suggestions.go | Register completions using centralized flag names |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {names.SSHConfigure, "ssh-configure"}, | ||
| {names.SSHGPGForwarding, "ssh-gpg-forwarding"}, | ||
| {names.SSHConfig, "ssh-config"}, | ||
| {names.SSHTunnel, "ssh-tunnel"}, |
| // Per DevContainer specification (https://containers.dev/implementors/json_reference/): | ||
| // "remoteUser: Overrides the user that devcontainer.json supporting services tools / runs as in the container... | ||
| // Defaults to the user the container as a whole is running as (often root).". | ||
| // GetContainerID returns the container ID from a result, or "" when absent. | ||
| func GetContainerID(result *Result) string { |
c906976 to
776baa9
Compare
Introduce pkg/flags/names as the single source of truth for every devsy-owned CLI flag name, and pkg/flags builder for uniform flag registration. Flag names are now compile-checked constants rather than raw strings scattered across command definitions and self-invocation sites, so a rename is a single edit the compiler propagates everywhere. - pkg/flags/names: dependency-light leaf (imports only fmt) holding all flag-name constants plus Flag/FlagValue/FlagTrue/FlagFalse helpers, usable from both cmd/ and pkg/ self-invocation builders without cobra. names_test.go pins every constant to its literal wire string so an accidental value change fails the build rather than silently altering the CLI contract. - pkg/flags builder: String/Bool/Int/Int64/Duration/StringSlice/ StringArray/Value constructors with chainable Shorthand()/Hidden(), registered via Add/AddPersistent. - Convert all cmd/ and pkg/ flag registrations and devsy self-invocation command lines to the constants; extract GPG signing helpers into pkg/gpg/signing.go. BREAKING CHANGE: renames several flags for consistency (ignoring backward compatibility) and removes hidden legacy aliases on `up`: additional-features -> features configure-ssh -> ssh-configure default-user-env-probe -> user-env-probe extra-devcontainer-path -> devcontainer-overlay git-clone-recursive-submodules -> git-recurse-submodules gpg-agent-forwarding -> ssh-gpg-forwarding prebuild-repository -> prebuild-repo ssh-tunnel-mode -> ssh-tunnel update-remote-user-uid-default -> update-remote-user-uid removed aliases: --config, --override-config, --dotfiles-repository, --remove-existing-container (use the canonical flag names). Other wire names are unchanged; devsy self-invocation command lines were verified byte-identical.
061745a to
fa2773b
Compare
The docs site declared @docusaurus/core/preset-classic at ^3.5.2 while react/react-dom are at ^19. Docusaurus gained official React 19 support in 3.6; pin the range to ^3.10.2 (already the resolved version) so the declared dependency honestly reflects React 19 support rather than relying on the caret range happening to resolve high. Verified with a clean `yarn install --frozen-lockfile && yarn build`.
The flag refactor renames several flags; update the non-Go consumers that reference them by literal string: - desktop/src/main/ipc.ts: --prebuild-repository -> --prebuild-repo (the desktop app shells out to the devsy CLI; the old name would fail with "unknown flag" whenever a prebuild repository was set). - docs: --prebuild-repository -> --prebuild-repo and --gpg-agent-forwarding -> --ssh-gpg-forwarding in the workspace guides.
Wire the CLI's --devcontainer flag into the workspace wizard. The Advanced section's single "Dev container config" path field becomes a "Dev container source" mode selector that maps 1:1 to the flag forms: Auto-detect (default) -> flag omitted (project discovery) Config file path -> --devcontainer <path> Container image -> --devcontainer image:<ref> Named profile -> --devcontainer id:<name> Ignore project config -> --devcontainer none The value input only appears for modes that need one, and blank values for path/image/id fall back to omitting the flag so an invalid "image:"/"id:" token is never emitted. buildDevcontainerArg centralizes the mode->flag mapping and is covered by unit tests; the IPC layer now forwards a single `devcontainer` string instead of `devcontainerPath`.
Migrate the ci command's flag registration to the pkg/flags builder + names constants introduced in #714, matching build/up/exec. Flag renames that follow from the new convention: - --env -> --remote-env (names.RemoteEnv, matches exec) - --additional-features -> --features (shared devcontainer modifier flag) - --git-clone-recursive-submodules -> --git-recurse-submodules - drop --config alias and --devcontainer-id (removed repo-wide in #714) Update ci e2e/unit tests and docs to the new names.
Replace ci's --devcontainer-path with the unified --devcontainer selector (none | image:<ref> | id:<name> | path), matching devsy up after #714. Restores the ability to target a named .devcontainer/<name> profile — the former --devcontainer-id — which was dropped in the flag-builder migration. Parse the selector into the CLIOptions image/id/path fields before resolving the workspace so it flows through RunHeadless to the agent. Adds a unit test and docs.
Migrate the ci command's flag registration to the pkg/flags builder + names constants introduced in #714, matching build/up/exec. Flag renames that follow from the new convention: - --env -> --remote-env (names.RemoteEnv, matches exec) - --additional-features -> --features (shared devcontainer modifier flag) - --git-clone-recursive-submodules -> --git-recurse-submodules - drop --config alias and --devcontainer-id (removed repo-wide in #714) Update ci e2e/unit tests and docs to the new names.
Replace ci's --devcontainer-path with the unified --devcontainer selector (none | image:<ref> | id:<name> | path), matching devsy up after #714. Restores the ability to target a named .devcontainer/<name> profile — the former --devcontainer-id — which was dropped in the flag-builder migration. Parse the selector into the CLIOptions image/id/path fields before resolving the workspace so it flows through RunHeadless to the agent. Adds a unit test and docs.
Summary
Centralizes every devsy-owned CLI flag name into
pkg/flags/namesas the single source of truth, and adds apkg/flagsbuilder for uniform flag registration. Flag names become compile-checked constants instead of raw strings scattered across command definitions and self-invocation sites — so renaming a flag is a single edit the compiler propagates everywhere, and a mistyped flag fails to build rather than breaking silently at runtime.What changed
pkg/flags/names— dependency-light leaf (imports onlyfmt) holding all flag-name constants plusFlag/FlagValue/FlagTrue/FlagFalsehelpers. Importable from bothcmd/andpkg/self-invocation builders without pulling in cobra.names_test.gopins every constant to its literal wire string, so an accidental value change fails CI rather than silently altering the CLI contract or devsy self-invocation command lines.pkg/flagsbuilder —String/Bool/Int/Int64/Duration/StringSlice/StringArray/Valueconstructors with chainable.Shorthand()/.Hidden(), registered viaAdd/AddPersistent.cmd/andpkg/flag registrations, error messages, and devsy self-invocation command lines to the constants.pkg/gpg/signing.go.Breaking changes
Backward compatibility is intentionally not preserved. Several flags are renamed for consistency and the hidden legacy
upaliases are removed:--additional-features--features--configure-ssh--ssh-configure--default-user-env-probe--user-env-probe--extra-devcontainer-path--devcontainer-overlay--git-clone-recursive-submodules--git-recurse-submodules--gpg-agent-forwarding--ssh-gpg-forwarding--prebuild-repository--prebuild-repo--ssh-tunnel-mode--ssh-tunnel--update-remote-user-uid-default--update-remote-user-uidRemoved aliases:
--config,--override-config,--dotfiles-repository,--remove-existing-container— use the canonical flag names.Other wire names are unchanged; devsy self-invocation command lines were verified byte-identical to
main.