feat(cli): retrofit commands to agent-first JSON envelopes#4
Merged
wcole1-godaddy merged 30 commits intomainfrom Feb 24, 2026
Merged
feat(cli): retrofit commands to agent-first JSON envelopes#4wcole1-godaddy merged 30 commits intomainfrom
wcole1-godaddy merged 30 commits intomainfrom
Conversation
Added standard -v and --verbose flags for enabling verbose output, while keeping --debug as an alias. This follows common CLI conventions where -v is the standard flag for verbose logging. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit adds comprehensive verbose output support with two levels of verbosity, along with fixes for ES module compatibility issues. - **Level 1 (-v, --info)**: Basic output showing HTTP method, URL, status, and duration - **Level 2 (-vv, --debug)**: Full output including headers, request/response bodies with sensitive field redaction - Introduced `loggedFetch()` wrapper that automatically logs HTTP requests - Extracts logging details from actual requests/responses, eliminating hardcoded duplication - Automatic timing and status code capture - Smart JSON response parsing for level 2 verbosity - Automatic redaction of `access_token` and `accessToken` fields in logs - Recursive redaction for nested objects - Follows existing redaction patterns for Authorization headers - Added `__dirname` and `__filename` shims in require-shim.js for dependencies expecting CommonJS globals - Marked pino-pretty as external dependency to avoid bundling worker thread code that breaks at runtime - Changed from pino transport API to direct stream usage to eliminate worker thread dependency - Added visual indicator when verbose output is enabled - Clear messaging distinguishing between basic and full verbosity levels - `-v, --verbose`: Incrementing flag (use multiple times for higher levels) - `--info`: Alias for level 1 verbosity - `--debug`: Alias for level 2 verbosity - DRY principle: Single `loggedFetch()` wrapper handles all HTTP logging - No hardcoded method/status values in logging calls - Automatic body parsing based on content-type - Level-aware logging prevents unnecessary work at lower verbosity Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add verbose output with tiered logging levels (-v and -vv)
Add a new command that allows direct, authenticated requests to any GoDaddy API endpoint, similar to `gh api` and `vercel api`. Features: - Support for all HTTP methods (GET, POST, PUT, PATCH, DELETE) - Field arguments (-f key=value) and JSON file body (-F path) - Custom headers (-H "Key: Value") - JSON path queries for filtering output (-q .path.to.value) - Response header display (-i, --include) - Debug mode shows request/response details (--debug) - Proactive token expiry checking with helpful messages - Specific handling for 401/403 responses Also includes: - Comprehensive documentation in README - Unit tests for API module and command - Improved test reliability for CI environments Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
feat: add `godaddy api` command for direct API access
Replace Promise-based wrappers with Effect-first patterns across all core modules, services, and CLI commands. Introduces tagged error types (Data.TaggedError), service layers (FileSystem, Keychain, HttpClient, Browser, Clock), and NodeLiveLayer for dependency injection. Key changes: - Add src/effect/ infrastructure (errors, services, layers, runtime) - Convert all effectful functions to *Effect suffix returning Effect<T,E,R> - Delete deprecated compatibility wrappers (services/auth, services/credentials, shared/utils, core/actions) - Migrate test files to use runEffect helper with NodeLiveLayer - Some test files still need further migration (tracked for follow-up) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Source fixes: - HttpClientLive: use Layer.sync with closure over globalThis.fetch so test mocks (vi.stubGlobal, global.fetch) are picked up at call time - token-store: change Effect.promise to Effect.tryPromise for keychain reads so rejections become typed ConfigurationError (not defects) - cli-entry: env override, truncation FS init, and related plumbing Test infrastructure: - Add runEffectExit() and extractFailure() helpers to extract tagged errors from Effect Exit values without FiberFailure wrapping Test migrations: - Rename old function imports to *Effect convention throughout tests - Switch error assertions from try/catch to runEffectExit/extractFailure - Update result access patterns (result.data.x -> result.x) - Wrap Effect calls with runEffect/runEffectExit in all test files All 654 tests pass across 55 test files. Typecheck and build clean.
Pass 1: Rewrite CLI layer to @effect/cli native commands
- Replace custom Command class with Command.make + Command.withSubcommands
- Centralize error handling at boundary (cli-entry.ts)
- Colocate next_actions with each command (delete 582-line switch statement)
- Derive registry from command tree (delete 429-line registry.ts)
- Extract action schemas to JSON files (actions.ts 1921 -> 173 lines)
- Add EnvelopeWriter service with write-once semantics via Ref
- Add CliConfig service for global flags (--pretty, --verbose, --env)
- Delete command-model.ts, registry.ts, next-actions.ts, respond.ts
Pass 2: Migrate custom Effect services to @effect/platform
- Replace custom FileSystem (sync) with @effect/platform FileSystem (effectful)
- Replace custom HttpClient with FetchHttpClient.Fetch tag
- Delete custom Clock service (unused)
- Delete effect/services/filesystem.ts, http.ts, clock.ts
- Add @effect/platform as direct dependency
- NodeLiveLayer now provides only Fetch, Keychain, Browser
- Platform services (FileSystem, Path, Terminal) from NodeContext.layer
Cleanup pass: Effect best practices + dead code removal
- Environment override reads from CliConfig via Effect.serviceOption
- Eliminate apiBaseUrl mutable cache (pure function)
- Route deploy progress through EnvelopeWriter (not bare stdout)
- Stream events respect --pretty serialization
- Delete dead code: types.ts, legacy stream functions, mapLeftoverTokens
- Replace require('node:fs') with static import
- Rename index.tsx to index.ts
- Extract COMMAND_TREE constant from handler body
55 test files, 654 tests passing. Zero TypeScript errors.
- Wire Fetch tag into graphql-request via GraphQLClient constructor All GraphQL HTTP traffic now goes through the injectable Fetch service. makeGraphQLClientEffect() creates a GraphQLClient with injected fetch. - Replace unsafe 'as Effect.Effect' casts with Effect.map narrowing Nine wrapper functions in core/applications.ts now use narrowResult() helper. Error and service channels are preserved by the type system. - Extract fileExists() helper (effect/fs-utils.ts) Eliminates 11 repeated fs.exists().pipe(orElseSucceed(() => false)) patterns across config.ts, api.ts, environment.ts, bundler.ts. - Use Effect.sleep instead of setTimeout wrapper upload.ts sleep() now uses Effect scheduler instead of raw Promise. - Guard JSON.parse with Effect.try in bundler.ts Wraps parse failure in ConfigurationError instead of unhandled throw. - Consolidate test utility layer cast into provideTestLayer() Single documented cast point with explanation of why it's necessary. 55 test files, 654 tests passing. Zero TypeScript errors.
- Replace 'any' with 'unknown' in workspace test runEffect helper - Apply biome import sorting and formatting across all source files - Zero biome errors, zero TypeScript errors, 654 tests passing
… add auto-reauth on 403 - Replace keytar native addon with cross-platform keychain using OS CLIs (macOS security, Linux secret-tool, Windows PasswordVault) - Fix isCliValidation guard matching all tagged errors by checking against explicit set of @effect/cli ValidationError tags - Strip --pretty and --env global flags before passing args to @effect/cli - Fix ApplicationsListQuery to use Relay connection syntax (edges/node) - Add --scope option to 'auth login' for requesting additional OAuth scopes - Add --scope option to 'api' command with automatic 403 retry: decodes JWT, detects missing scopes, triggers auth flow, and retries the request - Remove keytar from dependencies and build externals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.