Skip to content

feat(cli): add non-interactive commands for agentic onboarding - #413

Open
adkah wants to merge 7 commits into
mainfrom
ak-new-commands
Open

adkah wants to merge 7 commits into
mainfrom
ak-new-commands

Conversation

@adkah

@adkah adkah commented Sep 24, 2026 •

Copy link
Copy Markdown

Description 📣

Lets an AI agent (or a script) set up Infisical in a project without interactive prompts that fail when there's no terminal. This is part of the implementation of AI-agent quickstart flow from:

The agent runs these commands, and the user logs in or signs up in the browser.

New commands

  • infisical projects list / projects create --name <name> list and create projects in the current org. --json returns id, name, and orgId (plus slug and environments on create).

Updated commands

  • infisical login no longer fails when run without a terminal. It skips saving the terminal state and the "paste your token" fallback, and waits for the browser as usual.
  • infisical init gets --project-id <id>, which links a directory without the org and project pickers, and --force, which overwrites an existing .infisical.json. Without a terminal, init exits with a message pointing at --force instead of prompting.
  • infisical org list gets --json, including which org is current.

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

Tested against a local Infisical instance, including a full agent run: sign up in the browser, create and link a project, import .env, then infisical run.

go test -race -count=1 ./packages/api/
go test -vet=off -count=1 ./packages/cmd/   # vet=off: run.go's Msgf calls fail vet on main too

# without a terminal, as an agent would run them
infisical login --domain http://localhost:8080 </dev/null
infisical org list --json
infisical projects create --name my-app --json
infisical init --project-id <id>            # links the directory
infisical init --project-id <id>            # exits: already linked, pass --force
infisical init --project-id <id> --force    # overwrites
infisical import --yes --add-gitignore --json

adkah and others added 2 commits September 24, 2026 18:09
browserCliLogin called term.GetState(os.Stdin.Fd()) unconditionally,
which returns ENOTSUP ("operation not supported by device") when stdin
is a pipe rather than a TTY. The CLI treated that as fatal, printed
"Login via browser failed", and fell back to the interactive email
prompt, which also failed because there was no stdin. Net effect: an
AI agent spawning `infisical login` as a subprocess could not complete
browser login at all.

Guard both term.GetState/restoreTerminal and the askToPasteJwtToken
paste-fallback goroutine behind an isatty check. Neither is useful in
non-TTY contexts, and the browser callback flow itself requires no
terminal. Interactive terminal behavior is unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds the five CLI verbs an AI-agent quickstart prompt needs to drive
end to end without dashboard clicks, backed by the existing REST API:

- `infisical init --yes --project-id <id>`: non-interactive .infisical.json
  write; skips the org/project pickers so an agent can link a directory
  once it already has a project id.
- `infisical projects list [--json]` and
  `infisical projects create --name [--description] [--slug] [--json]`:
  wraps GET /v1/workspace and POST /v2/workspace with machine-readable
  output. Create returns id + name + slug + orgId + environments and
  defaults shouldCreateDefaultEnvs to true.
- `infisical org list [--json]`: enumerates the user's org memberships
  so an agent can pick one before creating a project.
- `infisical import [--path] [--env] [--yes] [--json] [--add-gitignore]`:
  discovers .env, .env.local, .env.development, .env.staging, and
  .env.production under --path; previews key names (never values);
  uploads via util.SetRawSecrets; checks .gitignore, and optionally
  appends missing entries; never deletes the source. The CLI owns the
  file parsing so the agent never has to open a .env itself.

Adds packages/api/model.go request/response types for project creation
and packages/api/api.go CallCreateProject.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Comment thread packages/cmd/projects.go Outdated
@veria-ai

veria-ai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

@greptile-apps

greptile-apps Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Adds non-interactive project and organization commands to the CLI.

The PR is not safe to merge while its advertised non-interactive import command is absent.

Summary

The PR adds non-interactive project creation and linking, JSON organization and project listings, and browser login support without a terminal. The latest change also deletes the import command:

  • Project listing now filters to the selected organization.
  • The advertised .env import step is no longer available.

Reviews (6) · Last reviewed commit: "remove unnecessary import command"

Comment thread packages/cmd/projects.go Outdated
Comment thread packages/cmd/import.go Outdated
Comment thread packages/cmd/import.go Outdated
Comment thread packages/cmd/import.go Outdated
Comment thread packages/cmd/import.go Outdated
Comment thread packages/cmd/import.go Outdated
Comment thread packages/cmd/import.go Outdated
Comment thread packages/cmd/init.go
Comment thread packages/cmd/init.go Outdated
Comment thread packages/cmd/import.go Outdated
Comment thread packages/cmd/import.go Outdated
Comment thread packages/cmd/import.go Outdated
Comment thread packages/cmd/import.go Outdated
Comment thread packages/cmd/import.go Outdated
Comment thread packages/cmd/import.go Outdated
Comment thread packages/cmd/import.go Outdated
@adkah
adkah requested a review from varonix0 September 25, 2026 20:17
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.

2 participants