From b00623d10b888eb0ced02f29d341856519836581 Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 9 Jul 2026 11:50:54 +0200 Subject: [PATCH 1/2] feat(runtime): detect universal AGENT env var --- src/runtime/mode.ts | 1 + test/mode.test.ts | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/runtime/mode.ts b/src/runtime/mode.ts index 0c55e39..be64809 100644 --- a/src/runtime/mode.ts +++ b/src/runtime/mode.ts @@ -9,6 +9,7 @@ export interface OutputModeInput { } const AGENT_ENV_VARS = [ + "AGENT", "CODEX_SANDBOX", "CODEX_CLI", "OPENAI_CODEX", diff --git a/test/mode.test.ts b/test/mode.test.ts index 0315e90..95d0050 100644 --- a/test/mode.test.ts +++ b/test/mode.test.ts @@ -11,6 +11,14 @@ describe("detectOutputMode", () => { expect(detectOutputMode({ argv: [], env: { CODEX_SANDBOX: "1" }, stdoutIsTTY: true })).toBe("agent"); }); + test("detects universal agent environment flag", () => { + expect(detectOutputMode({ argv: [], env: { AGENT: "true" }, stdoutIsTTY: true })).toBe("agent"); + }); + + test("detects universal agent environment name", () => { + expect(detectOutputMode({ argv: [], env: { AGENT: "codex" }, stdoutIsTTY: true })).toBe("agent"); + }); + test("detects CI and non-tty automation", () => { expect(detectOutputMode({ argv: [], env: { CI: "true" }, stdoutIsTTY: true })).toBe("agent"); expect(detectOutputMode({ argv: [], env: {}, stdoutIsTTY: false })).toBe("agent"); From 3cedfbb0c7784cf8276d9d8de7b2001f8aaa616d Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 9 Jul 2026 11:56:01 +0200 Subject: [PATCH 2/2] no-mistakes(document): Document AGENT mode detection --- README.md | 4 ++-- docs/architecture.md | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6124375..a222e0a 100644 --- a/README.md +++ b/README.md @@ -70,8 +70,8 @@ override URLs. Default output is adaptive: -- coding-agent, CI, non-TTY, and automation signals use compact structured - agent output; +- `AGENT` names/flags, coding-agent, CI, non-TTY, and automation signals use + compact structured agent output; - interactive TTY sessions use human output; - `--json`, `--quiet`, `-q`, `--output `, `-o `, and `AKUA_OUTPUT` override detection. diff --git a/docs/architecture.md b/docs/architecture.md index 2a6ef32..98d71d4 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -119,7 +119,8 @@ stored with user-only file permissions. The default output mode is adaptive: - `human`: interactive TTY without automation or coding-agent signals; -- `agent`: known coding-agent env vars, CI env vars, or non-TTY stdout; +- `agent`: `AGENT` names/flags, known coding-agent env vars, CI env vars, or + non-TTY stdout; - `json`: explicit `--json`, `--output json`, `-o json`, or `AKUA_OUTPUT=json`; - `quiet`: explicit `--quiet`, `-q`, `--output quiet`, `-o quiet`, or