AGX CLI nits: functions:update-function hint, functions:set-secret shortcut#61
Conversation
…ortcut Two ergonomic gaps surfaced by the AGX CLI walkthrough. First, an agent reading `functions:update-function --help` had no way to discover `functions:redeploy --file <bundle>`. Add an OPERATION_HINTS map keyed by manifest sdkName so generated commands that shadow a hand-rolled shortcut surface the shortcut directly in their --help description. Entries for createFunction, updateFunction, createFunctionSecret, and setFunctionSecret point at functions:deploy, functions:redeploy, and functions:set-secret respectively. Second, writing a function secret only landed the value at rest; making it visible to the running handler still required a manual redeploy. Add functions:set-secret with a --redeploy flag that, after the secret upsert succeeds, fetches the current bundle via getFunction and re-runs the deploy in the same call. Stage-tagged errors so the caller can tell whether the secret landed before a failed redeploy. Tests cover both no-redeploy and --redeploy paths against a fake API surface, plus the description-rendering branch of createOperationCommand for both the with-hint and no-hint cases. Update the functions topic description in package.json to call out all three shortcuts.
Greptile SummaryThis PR adds two CLI ergonomic improvements to the
Confidence Score: 5/5Safe to merge — the changes are additive, well-tested, and the new All changed code paths are covered by unit tests. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "Document source-map drop on functions:se..." | Re-trigger Greptile |
P2 from Greptile. The --redeploy shortcut pulls the function's current code via getFunction (which does not return the source map, since source maps are stored only on the runtime side) and re-uploads with no sourceMap field. The runtime treats a deploy without sourceMap as 'drop the existing one', so a user who originally deployed with --source-map-file silently loses symbolication after --redeploy. Document the limitation in both the file's header docstring and the flag description, with a pointer to functions:redeploy --file --source-map-file for callers who need symbolication preserved.
Summary
Two CLI ergonomic findings from the email-summarizer AGX run, both in one PR.
1. functions:redeploy discoverability
The AGX agent reached for the auto-generated functions:update-function command for redeploys, missed functions:redeploy --file entirely, and ended up hand-rolling a JSON wrapper with the bundle as a string. Added an OPERATION_HINTS map keyed by sdkName in api-command.ts, appended to operation descriptions in createOperationCommand. Hints point users from functions:update-function, functions:create-function, functions:set-function-secret, and functions:create-function-secret to the file-input / convenience wrappers.
2. functions:set-secret with optional --redeploy
New hand-rolled command at sdk-node/src/oclif/commands/functions-set-secret.ts. Flags: --id, --key, --value, --redeploy. With --redeploy, after the secret upsert succeeds, the command calls getFunction then updateFunction with the same code to roll the binding into the running handler in one shell invocation. Pure runSetSecret(api, params) is exported for testing. Stage-tagged discriminated-union result lets the CLI frame errors as 'secret landed, deploy did not' when only the redeploy fails. Registered as functions:set-secret in src/oclif/index.ts. Topic description in package.json updated to mention it.
Test plan
Paired