@kaitranntt/ccs 7.79.1-dev.23 → 7.79.1-dev.24
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.
|
@@ -34,6 +34,13 @@
|
|
|
34
34
|
* the rest of the line belongs to that subcommand.
|
|
35
35
|
*/
|
|
36
36
|
export declare function isClaudeSubcommandInvocation(args: readonly string[]): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the Claude subcommand name when `args` look like a subcommand
|
|
39
|
+
* invocation, otherwise null. Uses the same scan as
|
|
40
|
+
* `isClaudeSubcommandInvocation` so callers can branch on the specific
|
|
41
|
+
* subcommand (e.g. `agents` allows flags that other subcommands reject).
|
|
42
|
+
*/
|
|
43
|
+
export declare function getClaudeSubcommandName(args: readonly string[]): string | null;
|
|
37
44
|
export declare function stripClaudeSubcommandSessionArgs(args: readonly string[]): string[];
|
|
38
45
|
export declare function stripClaudeCodeFeatureBlockingEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
39
46
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-subcommand-detector.d.ts","sourceRoot":"","sources":["../../src/utils/claude-subcommand-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;
|
|
1
|
+
{"version":3,"file":"claude-subcommand-detector.d.ts","sourceRoot":"","sources":["../../src/utils/claude-subcommand-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAgGH;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAE7E;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAqB9E;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CA2ClF;AAQD,wBAAgB,iCAAiC,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAa3F;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAEpF"}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* Claude subcommand.
|
|
21
21
|
*/
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.stripSubcommandBlockingEnv = exports.stripClaudeCodeFeatureBlockingEnv = exports.stripClaudeSubcommandSessionArgs = exports.isClaudeSubcommandInvocation = void 0;
|
|
23
|
+
exports.stripSubcommandBlockingEnv = exports.stripClaudeCodeFeatureBlockingEnv = exports.stripClaudeSubcommandSessionArgs = exports.getClaudeSubcommandName = exports.isClaudeSubcommandInvocation = void 0;
|
|
24
24
|
/**
|
|
25
25
|
* Known Claude CLI subcommands. Sourced from `claude --help` (v2.1.139).
|
|
26
26
|
* Keep in sync with upstream — additions are safe (over-skipping injection
|
|
@@ -92,6 +92,24 @@ const SUBCOMMAND_SESSION_ONLY_VALUE_FLAGS = new Set([
|
|
|
92
92
|
'--permission-mode',
|
|
93
93
|
'--teammate-mode',
|
|
94
94
|
]);
|
|
95
|
+
/**
|
|
96
|
+
* Flags that look session-only but are actually accepted by specific Claude
|
|
97
|
+
* subcommands. Keep these intact instead of stripping. Sourced from
|
|
98
|
+
* `claude <sub> --help` (v2.1.139); add new entries when upstream extends a
|
|
99
|
+
* subcommand parser.
|
|
100
|
+
*
|
|
101
|
+
* - `agents` accepts `--permission-mode`, `--dangerously-skip-permissions`,
|
|
102
|
+
* and `--allow-dangerously-skip-permissions` as defaults for dispatched
|
|
103
|
+
* sessions (see `claude agents --help`). Stripping these breaks
|
|
104
|
+
* `ccs <profile> agents --permission-mode bypassPermissions`.
|
|
105
|
+
*/
|
|
106
|
+
const SUBCOMMAND_ALLOWED_SESSION_FLAGS = {
|
|
107
|
+
agents: new Set([
|
|
108
|
+
'--allow-dangerously-skip-permissions',
|
|
109
|
+
'--dangerously-skip-permissions',
|
|
110
|
+
'--permission-mode',
|
|
111
|
+
]),
|
|
112
|
+
};
|
|
95
113
|
/**
|
|
96
114
|
* Returns true when `args` look like a Claude subcommand invocation.
|
|
97
115
|
*
|
|
@@ -106,10 +124,20 @@ const SUBCOMMAND_SESSION_ONLY_VALUE_FLAGS = new Set([
|
|
|
106
124
|
* the rest of the line belongs to that subcommand.
|
|
107
125
|
*/
|
|
108
126
|
function isClaudeSubcommandInvocation(args) {
|
|
127
|
+
return getClaudeSubcommandName(args) !== null;
|
|
128
|
+
}
|
|
129
|
+
exports.isClaudeSubcommandInvocation = isClaudeSubcommandInvocation;
|
|
130
|
+
/**
|
|
131
|
+
* Returns the Claude subcommand name when `args` look like a subcommand
|
|
132
|
+
* invocation, otherwise null. Uses the same scan as
|
|
133
|
+
* `isClaudeSubcommandInvocation` so callers can branch on the specific
|
|
134
|
+
* subcommand (e.g. `agents` allows flags that other subcommands reject).
|
|
135
|
+
*/
|
|
136
|
+
function getClaudeSubcommandName(args) {
|
|
109
137
|
for (let i = 0; i < args.length; i += 1) {
|
|
110
138
|
const arg = args[i];
|
|
111
139
|
if (arg === '--')
|
|
112
|
-
return
|
|
140
|
+
return null;
|
|
113
141
|
if (arg.startsWith('-')) {
|
|
114
142
|
if (VALUE_TAKING_FLAGS.has(arg)) {
|
|
115
143
|
// Skip the next token as the flag's value (when present and not another flag).
|
|
@@ -121,25 +149,39 @@ function isClaudeSubcommandInvocation(args) {
|
|
|
121
149
|
// `--flag=value`, bare boolean flags, and unknown short/long flags fall through.
|
|
122
150
|
continue;
|
|
123
151
|
}
|
|
124
|
-
return CLAUDE_SUBCOMMANDS.has(arg);
|
|
152
|
+
return CLAUDE_SUBCOMMANDS.has(arg) ? arg : null;
|
|
125
153
|
}
|
|
126
|
-
return
|
|
154
|
+
return null;
|
|
127
155
|
}
|
|
128
|
-
exports.
|
|
156
|
+
exports.getClaudeSubcommandName = getClaudeSubcommandName;
|
|
129
157
|
function stripClaudeSubcommandSessionArgs(args) {
|
|
130
|
-
|
|
158
|
+
const subcommand = getClaudeSubcommandName(args);
|
|
159
|
+
if (subcommand === null) {
|
|
131
160
|
return [...args];
|
|
132
161
|
}
|
|
162
|
+
const allowed = SUBCOMMAND_ALLOWED_SESSION_FLAGS[subcommand];
|
|
163
|
+
const isAllowed = (flag) => allowed?.has(flag) === true;
|
|
133
164
|
const out = [];
|
|
134
165
|
for (let i = 0; i < args.length; i += 1) {
|
|
135
166
|
const arg = args[i];
|
|
136
|
-
if (SUBCOMMAND_SESSION_ONLY_FLAGS.has(arg)) {
|
|
167
|
+
if (SUBCOMMAND_SESSION_ONLY_FLAGS.has(arg) && !isAllowed(arg)) {
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (arg.startsWith('--permission-mode=')) {
|
|
171
|
+
if (isAllowed('--permission-mode')) {
|
|
172
|
+
out.push(arg);
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
137
175
|
continue;
|
|
138
176
|
}
|
|
139
|
-
if (arg.startsWith('--
|
|
177
|
+
if (arg.startsWith('--teammate-mode=')) {
|
|
178
|
+
if (isAllowed('--teammate-mode')) {
|
|
179
|
+
out.push(arg);
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
140
182
|
continue;
|
|
141
183
|
}
|
|
142
|
-
if (SUBCOMMAND_SESSION_ONLY_VALUE_FLAGS.has(arg)) {
|
|
184
|
+
if (SUBCOMMAND_SESSION_ONLY_VALUE_FLAGS.has(arg) && !isAllowed(arg)) {
|
|
143
185
|
const next = args[i + 1];
|
|
144
186
|
if (next !== undefined && !next.startsWith('-')) {
|
|
145
187
|
i += 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-subcommand-detector.js","sourceRoot":"","sources":["../../src/utils/claude-subcommand-detector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;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