Skip to content

feat: detect goose, junie, pi, and kiro agents - #5

Merged
quuu merged 1 commit into
mainfrom
tomknickman/add-std-env-agents
Jul 9, 2026
Merged

quuu merged 1 commit into
mainfrom
tomknickman/add-std-env-agents

Conversation

@tknickman

Copy link
Copy Markdown
Member

Summary

Adds four agents from the unjs/std-env list that we were missing, and broadens opencode detection.

Agent Detection
goose (Block) GOOSE_PROVIDER set
junie (JetBrains) JUNIE_DATA or JUNIE_SHIM_PATH set
pi PATH matches \.pi[\\/]agent
kiro (AWS) TERM_PROGRAM matches kiro and stdout is not a TTY

opencode now matches OPENCODE in addition to our existing OPENCODE_CLIENT (std-env checks OPENCODE).

New spec capabilities

goose and junie fit the existing schema. pi and kiro needed two new leaf condition types, added to agents.schema.json, src/types.ts, and the evaluator:

  • env_matches — regex match against an env var ({ type, name, pattern }). pattern is a regex source string, substring semantics, case-sensitive; unset var or invalid pattern → no match (never throws).
  • no_tty — matches when the process is non-interactive (!process.stdout.isTTY). This is the first leaf that reads runtime process state rather than env/filesystem; it exists so terminal-based IDE agents can be disambiguated from a human at the same terminal. kiro pairs env_matches on TERM_PROGRAM with no_tty — this is exactly the case std-env's issue #185 addressed. Documented as a deliberate exception in the schema.

Notes

  • agents.json reformats from minified to pretty-printed (oxfmt, the project formatter, enforces this) — hence the larger-than-expected diff on that file.
  • No changeset included: the Changesets setup (ci: set up automated releases with Changesets #3) isn't merged to main yet, so there's no .changeset/ infra here. Once ci: set up automated releases with Changesets #3 lands, this should get a minor changeset (new features, additive/backward-compatible), or be versioned accordingly at release.

Verification

  • pnpm type-check, pnpm lint, pnpm format:check all pass.
  • pnpm test — 86 tests pass (was 68). New unit tests for env_matches/no_tty, detection tests for all four agents (including kiro TTY vs no-TTY) and opencode via OPENCODE.
  • pnpm build, then smoke-tested the built dist/ with real env vars: goose/junie/pi/opencode detected; kiro detected when piped (no TTY) and not detected under an emulated TTY.

🤖 Generated with Claude Code

Adds four agents from the unjs/std-env list. goose (GOOSE_PROVIDER) and junie (JUNIE_DATA/JUNIE_SHIM_PATH) use existing env checks. pi and kiro need two new spec condition types: env_matches (regex match on an env var) and no_tty (process is non-interactive). kiro pairs both so a human at Kiro's integrated terminal isn't misdetected.

Also broadens opencode detection to match OPENCODE in addition to OPENCODE_CLIENT.

agents.json is reformatted by oxfmt from minified to pretty-printed.
@quuu
quuu merged commit 46dd5cf into main Jul 9, 2026
6 checks passed
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