@yeison.restrepo.r/code-conductor 1.31.2 → 1.31.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeison.restrepo.r/code-conductor",
3
- "version": "1.31.2",
3
+ "version": "1.31.3",
4
4
  "description": "A spec-first, token-efficient Claude Code configuration and installer CLI.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -155,6 +155,7 @@ function g3JoinContinuations(input) {
155
155
  // unclosed quote). "glob" reports whether an unquoted glob character appears, and
156
156
  // treats malformed input as a glob, which is the authority's fail-closed choice.
157
157
  function g3Scan(mode, input) {
158
+ const emit = mode === 'strip' || mode === 'mask';
158
159
  let state = 'UNQUOTED';
159
160
  let result = '';
160
161
  let i = 0;
@@ -163,34 +164,35 @@ function g3Scan(mode, input) {
163
164
  const ch = input[i];
164
165
  const two = input.slice(i, i + 2);
165
166
  if (state === 'UNQUOTED') {
166
- if (two === "$'") { if (mode === 'strip') result += two; i += 2; state = 'ANSI_C_QUOTED'; }
167
- else if (two === '$"') { if (mode === 'strip') result += two; i += 2; state = 'LOCALE_QUOTED'; }
168
- else if (ch === '\\') { if (mode === 'strip') result += input.slice(i, i + 2); i += 2; }
169
- else if (ch === "'") { if (mode === 'strip') result += ch; i += 1; state = 'SINGLE_QUOTED'; }
170
- else if (ch === '"') { if (mode === 'strip') result += ch; i += 1; state = 'DOUBLE_QUOTED'; }
167
+ if (two === "$'") { if (emit) result += two; i += 2; state = 'ANSI_C_QUOTED'; }
168
+ else if (two === '$"') { if (emit) result += two; i += 2; state = 'LOCALE_QUOTED'; }
169
+ else if (ch === '\\') { if (emit) result += input.slice(i, i + 2); i += 2; }
170
+ else if (ch === "'") { if (emit) result += ch; i += 1; state = 'SINGLE_QUOTED'; }
171
+ else if (ch === '"') { if (emit) result += ch; i += 1; state = 'DOUBLE_QUOTED'; }
171
172
  else if (ch === '#' && mode === 'strip') { while (i < len && input[i] !== '\n') i += 1; }
172
173
  else {
173
174
  if (mode === 'glob' && (ch === '*' || ch === '?' || ch === '{' || ch === '[')) return { glob: true };
174
- if (mode === 'strip') result += ch;
175
+ if (emit) result += ch;
175
176
  i += 1;
176
177
  }
177
178
  } else if (state === 'SINGLE_QUOTED') {
178
179
  // Backslash is literal here and ANY quote exits: there is no escape mechanism.
179
180
  if (mode === 'strip') result += ch;
181
+ else if (mode === 'mask') result += ch === "'" ? ch : 'x';
180
182
  if (ch === "'") state = 'UNQUOTED';
181
183
  i += 1;
182
184
  } else if (state === 'DOUBLE_QUOTED' || state === 'LOCALE_QUOTED') {
183
- if (ch === '\\') { if (mode === 'strip') result += input.slice(i, i + 2); i += 2; }
184
- else if (ch === '"') { if (mode === 'strip') result += ch; i += 1; state = 'UNQUOTED'; }
185
- else { if (mode === 'strip') result += ch; i += 1; }
185
+ if (ch === '\\') { if (mode === 'strip') result += input.slice(i, i + 2); else if (mode === 'mask') result += 'xx'; i += 2; }
186
+ else if (ch === '"') { if (emit) result += ch; i += 1; state = 'UNQUOTED'; }
187
+ else { if (mode === 'strip') result += ch; else if (mode === 'mask') result += 'x'; i += 1; }
186
188
  } else {
187
- if (ch === '\\') { if (mode === 'strip') result += input.slice(i, i + 2); i += 2; }
188
- else if (ch === "'") { if (mode === 'strip') result += ch; i += 1; state = 'UNQUOTED'; }
189
- else { if (mode === 'strip') result += ch; i += 1; }
189
+ if (ch === '\\') { if (mode === 'strip') result += input.slice(i, i + 2); else if (mode === 'mask') result += 'xx'; i += 2; }
190
+ else if (ch === "'") { if (emit) result += ch; i += 1; state = 'UNQUOTED'; }
191
+ else { if (mode === 'strip') result += ch; else if (mode === 'mask') result += 'x'; i += 1; }
190
192
  }
191
193
  }
192
- if (state !== 'UNQUOTED') return mode === 'strip' ? { result, malformed: true } : { glob: true };
193
- return mode === 'strip' ? { result, malformed: false } : { glob: false };
194
+ if (state !== 'UNQUOTED') return emit ? { result, malformed: true } : { glob: true };
195
+ return emit ? { result, malformed: false } : { glob: false };
194
196
  }
195
197
 
196
198
  // Each check returns true when it FIRES (the authority's shell functions returned 1).
@@ -451,9 +453,18 @@ function guard3BashScan(input) {
451
453
  }
452
454
  // Real newlines become semicolons so a multi-line script reads as a command
453
455
  // sequence to every position-anchored pattern above.
454
- const pre = g3Chomp(scan.result).split('\n').join(';');
456
+ //
457
+ // The mask is built from the STRIPPED string and BEFORE the newline join, so a
458
+ // newline inside a quoted region can never become a command-position anchor.
459
+ // Exactly two checks read quoted content BY DESIGN: P6 reads the grep pattern and
460
+ // P12 reads the alias value. Everything else reads code and gets the mask. The
461
+ // allowlist reads the unmasked string. [BUG-043].
462
+ const chomped = g3Chomp(scan.result);
463
+ const pre = chomped.split('\n').join(';');
464
+ const masked = g3Scan('mask', chomped).result.split('\n').join(';');
465
+ const UNMASKED_CHECKS = new Set(['P6', 'P12']);
455
466
  const ids = [];
456
- for (const { id, check } of G3_CHECKS) if (check(pre)) ids.push(id);
467
+ for (const { id, check } of G3_CHECKS) if (check(UNMASKED_CHECKS.has(id) ? pre : masked)) ids.push(id);
457
468
  if (ids.length === 0) return null;
458
469
  if (g3AllowlistCovers(pre, g3ReadAllowlist())) return null;
459
470
  return g3Blocked(`The command triggered a mass content-dump pattern. Pattern ids: ${ids.join(' ')}.`);