Repository navigation
feat: add apify agent status and agent uninstall commands (P1) - #1475
Open
kuntal1461 wants to merge 3 commits into
Open
kuntal1461 wants to merge 3 commits into
kuntal1461 wants to merge 3 commits into
Conversation
Fixes apify#1451 (prompt hang in pseudo-TTY environments) and apify#1354 (phantom --confirm flags). P0 — global --non-interactive flag: - New `src/lib/nonInteractiveMode.ts`: single source of truth with `isNonInteractive()`, `setNonInteractiveFlag()`, and `resetNonInteractiveFlag()` - Registered `--non-interactive` in `_buildParseArgsOption()` alongside `--help` and `--user-agent`; env var `APIFY_CLI_NON_INTERACTIVE=1` is equivalent - Activated early in `runCLI()` before version-check middleware; reset+re-applied at the start of every `_run()` for test isolation - All three divergent interactivity decision points now converge on `isNonInteractive()`: `_stdinCheckWrapper`, `create.ts`, and `detectIsInteractive()` in telemetry - Skipped prompt with no programmatic answer exits non-zero with an actionable message naming the exact flag to pass (fixes phantom `--confirm/--no-confirm` bug apify#1354) - Added GLOBAL OPTIONS section to main `--help` output - Added actionable `errorMessageForStdin` to previously unguarded prompts in `useActorConfig.ts` and `auth/login.ts` P1 — agent env var auto-detection and skill update: - `AGENT_ENV_VARS` (9 known agent runtimes) moved to `nonInteractiveMode.ts` and exported; `isNonInteractive()` returns true when any agent env var is set - `detectEnvironment.ts` refactored to import `AGENT_ENV_VARS` from the single source (no duplication, no circular import) - `skills/apify/SKILL.md`: added required "always pass --non-interactive" line - `test/setup.ts` + `vitest.config.ts`: global Vitest setup clears agent env vars before each test file so host environment (e.g. CLAUDECODE) does not leak into tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds apify agent setup -- auto-detects installed AI coding agents (Claude Code, Cursor, VS Code, Kiro, Codex, Antigravity) by env var and home-path heuristics, then configures them via MCP. Includes tier ladder, idempotency via state file, --client override, --json output, and 89 tests covering unit, integration, security, and edge cases.
Implements the two remaining agent commands: - apify agent status: reads agent-state.json, shows configured clients with tier and install date; supports --client filter and --json output - apify agent uninstall: removes MCP config per client, updates state file; supports --client, --yes, --json; confirms before removing New infrastructure: - removeServerEntry() in file-config.ts: JSONC-safe atomic removal of a key from any mcp.json (symmetric to mergeServerEntry) - Uninstall handlers for all 7 clients (file-based and CLI-based) - isSupportedClient guard on state-sourced targets - writeAgentState wrapped in try/catch for disk-full/permission errors - Partial-failure contract: failed clients kept in state, RunFailed exit 45 tests across status (18) and uninstall (27), including security proofs, partial-failure multi-client coverage, and empty-state edge cases. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This branch has not been deployed
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.
Summary
apify agent status— reads agent-state.json and shows each configured client with its tier and install date; supports--clientfilter and--jsonoutputapify agent uninstall— removes Apify MCP config from one or all configured clients, updates state file; supports--client,--yes,--json, and confirmation promptremoveServerEntry()tofile-config.ts— JSONC-safe atomic removal counterpart tomergeServerEntry()Key design decisions
RunFailedis set; successful clients are removed from statewriteAgentStateis wrapped in try/catch — disk-full or permission errors produce a clear recovery message instead of silent data lossTest plan
status, 27 foruninstall--clientfilter,--jsonshape, confirmation prompt behaviour, partial failure, config file absent, security (no token leakage)Related issues
Related to #1445
🤖 Generated with Claude Code