mirror of
https://github.com/expo/agent-cli-detector.git
synced 2026-11-15 03:28:05 -10:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f16f2f06fa | ||
|
|
18ecf8024b |
No files matched your search
@@ -35,6 +35,7 @@ Officially supported coding agents:
|
||||
| Name | ID | Session ID |
|
||||
| ----------------------------------------------------------------- | ------------- | ---------- |
|
||||
| [Antigravity](https://antigravity.google/) | `antigravity` | ✅ |
|
||||
| [Bolt](https://bolt.new/) | `bolt` | 🚫 |
|
||||
| [Claude Code](https://claude.com/claude-code) | `claude-code` | ✅ |
|
||||
| [Cline](https://cline.bot/) | `cline` | 🚫 |
|
||||
| [Codex](https://developers.openai.com/codex/) | `codex` | ✅ |
|
||||
@@ -46,6 +47,7 @@ Officially supported coding agents:
|
||||
| [Kiro](https://kiro.dev/) | `kiro` | ✅ |
|
||||
| [OpenCode](https://opencode.ai/) | `opencode` | 🚫 |
|
||||
| [Pi](https://github.com/badlogic/pi-mono) | `pi` | 🚫 |
|
||||
| [Replit](https://replit.com/) | `replit` | ✅ |
|
||||
|
||||
Detection is data-driven: the exact environment variables and process
|
||||
patterns for each agent live in [`src/agents.ts`](src/agents.ts).
|
||||
@@ -92,7 +94,7 @@ A string containing the agent's session identifier, normalized from
|
||||
agent-specific environment variables such as `CODEX_THREAD_ID`,
|
||||
`CURSOR_CONVERSATION_ID`, `CLAUDE_CODE_SESSION_ID`,
|
||||
`ANTIGRAVITY_TRAJECTORY_ID`, `KIRO_SESSION_ID`, `KILO_RUN_ID`, and
|
||||
`COPILOT_AGENT_SESSION_ID`. Omitted when the agent doesn't expose one
|
||||
`COPILOT_AGENT_SESSION_ID`, and `REPLIT_SESSION`. Omitted when the agent doesn't expose one
|
||||
(see the Session ID column in the support table above).
|
||||
|
||||
### `isRunningFromAgent([options])`
|
||||
|
||||
@@ -58,11 +58,26 @@ export const defaultAgents = [
|
||||
process: [{ pattern: /^antigravity$/i }],
|
||||
sessionEnv: ["ANTIGRAVITY_TRAJECTORY_ID"]
|
||||
},
|
||||
{
|
||||
id: "bolt",
|
||||
name: "Bolt",
|
||||
env: [
|
||||
{ name: "BOLT_ENV" },
|
||||
{ name: "BOLT_ORIGIN" },
|
||||
{ name: "BOLT_SERVER_URL" }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "pi",
|
||||
name: "Pi",
|
||||
env: [{ name: "PI_CODING_AGENT", value: "true" }]
|
||||
},
|
||||
{
|
||||
id: "replit",
|
||||
name: "Replit",
|
||||
env: [{ name: "REPLIT_SESSION" }],
|
||||
sessionEnv: ["REPLIT_SESSION"]
|
||||
},
|
||||
{
|
||||
id: "kiro",
|
||||
name: "Kiro",
|
||||
|
||||
+3
-1
@@ -1,5 +1,6 @@
|
||||
export type AgentId =
|
||||
| "antigravity"
|
||||
| "bolt"
|
||||
| "cline"
|
||||
| "codex"
|
||||
| "copilot"
|
||||
@@ -10,7 +11,8 @@ export type AgentId =
|
||||
| "kilocode"
|
||||
| "claude-code"
|
||||
| "opencode"
|
||||
| "pi";
|
||||
| "pi"
|
||||
| "replit";
|
||||
|
||||
export type DetectionStrategyName = "environment" | "process-tree";
|
||||
|
||||
|
||||
@@ -49,6 +49,37 @@ test("detects kiro and normalizes its session id", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("detects replit and normalizes its session id", () => {
|
||||
const result = detectAgent({
|
||||
env: {
|
||||
REPLIT_SESSION: "session-123"
|
||||
}
|
||||
});
|
||||
|
||||
assert.equal(result.detected, true);
|
||||
assert.deepEqual(result.agent, {
|
||||
id: "replit",
|
||||
name: "Replit",
|
||||
sessionId: "session-123"
|
||||
});
|
||||
});
|
||||
|
||||
test("detects bolt from any known environment variable", () => {
|
||||
for (const envName of ["BOLT_ENV", "BOLT_ORIGIN", "BOLT_SERVER_URL"]) {
|
||||
const result = detectAgent({
|
||||
env: {
|
||||
[envName]: "1"
|
||||
}
|
||||
});
|
||||
|
||||
assert.equal(result.detected, true);
|
||||
assert.deepEqual(result.agent, {
|
||||
id: "bolt",
|
||||
name: "Bolt"
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
test("default strategies only use environment variables", () => {
|
||||
assert.deepEqual(
|
||||
createDefaultStrategies().map((strategy) => strategy.name),
|
||||
|
||||
Reference in new issue
Block a user