npq 3.25.0 → 3.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/lib/helpers/codingAgentEnvironment.js +26 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -233,7 +233,9 @@ npq install express --json
|
|
|
233
233
|
When npq detects a supported coding-agent environment, it automatically uses
|
|
234
234
|
the same audit-only JSON mode. This applies to `npq` and to install commands
|
|
235
235
|
intercepted by `npq-hero`; non-install `npq-hero` commands still pass through to
|
|
236
|
-
the configured package manager. See [
|
|
236
|
+
the configured package manager. See the [full coding-agent detection signal
|
|
237
|
+
table](docs/feature/json-output.md#coding-agent-detection) for the supported
|
|
238
|
+
signals and contextual matchers.
|
|
237
239
|
|
|
238
240
|
JSON mode never invokes the package manager. It exits `0` for a clean audit,
|
|
239
241
|
`1` for findings, and `2` when the audit cannot complete. See
|
|
@@ -11,13 +11,34 @@ const CODING_AGENT_ENVIRONMENT_VARIABLES = Object.freeze([
|
|
|
11
11
|
'WINDSURF_AGENT',
|
|
12
12
|
'CODEIUM_AGENT',
|
|
13
13
|
'AGENT',
|
|
14
|
-
'AI_AGENT'
|
|
14
|
+
'AI_AGENT',
|
|
15
|
+
'CLAUDE_CODE',
|
|
16
|
+
'REPL_ID',
|
|
17
|
+
'OPENCODE',
|
|
18
|
+
'AUGMENT_AGENT',
|
|
19
|
+
'GOOSE_PROVIDER',
|
|
20
|
+
'JUNIE_DATA',
|
|
21
|
+
'JUNIE_SHIM_PATH'
|
|
15
22
|
])
|
|
16
23
|
|
|
17
|
-
function
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
function hasNonEmptyValue(env, name) {
|
|
25
|
+
return typeof env[name] === 'string' && env[name].length > 0
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function isCodingAgentEnvironment(env = process.env, { stdoutIsTTY = process.stdout?.isTTY } = {}) {
|
|
29
|
+
if (CODING_AGENT_ENVIRONMENT_VARIABLES.some((name) => hasNonEmptyValue(env, name))) {
|
|
30
|
+
return true
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (typeof env.PATH === 'string' && /\.pi[\\/]agent/.test(env.PATH)) {
|
|
34
|
+
return true
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (typeof env.EDITOR === 'string' && /devin/i.test(env.EDITOR)) {
|
|
38
|
+
return true
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return !stdoutIsTTY && typeof env.TERM_PROGRAM === 'string' && /kiro/i.test(env.TERM_PROGRAM)
|
|
21
42
|
}
|
|
22
43
|
|
|
23
44
|
module.exports = { CODING_AGENT_ENVIRONMENT_VARIABLES, isCodingAgentEnvironment }
|