@delorenj/pjangler 1.2.14 → 1.2.16

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/dist/index.js CHANGED
@@ -2524,6 +2524,9 @@ function extractTomlStrings(text3) {
2524
2524
  }
2525
2525
  return values;
2526
2526
  }
2527
+ function stripTomlStringsAndComments(line) {
2528
+ return line.replace(/"(?:\\.|[^"\\])*"/g, '""').replace(/'[^']*'/g, "''").replace(/#.*$/, "");
2529
+ }
2527
2530
  function isManagedHookEntry(value) {
2528
2531
  const trimmed = value.trim();
2529
2532
  return trimmed === "op inject -i .env.op > .env" || /(^|\/)link-agentfiles\.sh$/.test(trimmed);
@@ -2551,12 +2554,17 @@ function upsertLinkAgentfilesHooks(text3) {
2551
2554
  for (let i = hooksStart + 1; i < hooksEnd; i++) {
2552
2555
  if (!/^\s*enter\s*=/.test(lines[i])) continue;
2553
2556
  enterStart = i;
2554
- enterEnd = i + 1;
2555
- const afterEquals = lines[i].slice(lines[i].indexOf("=") + 1);
2556
- if (afterEquals.includes("[") && !afterEquals.includes("]")) {
2557
- while (enterEnd < hooksEnd && !lines[enterEnd].includes("]")) enterEnd++;
2558
- if (enterEnd < hooksEnd) enterEnd++;
2557
+ let depth = 0;
2558
+ let j = i;
2559
+ for (; j < hooksEnd; j++) {
2560
+ for (const ch of stripTomlStringsAndComments(lines[j])) {
2561
+ if (ch === "[") depth++;
2562
+ else if (ch === "]") depth--;
2563
+ }
2564
+ if (depth <= 0) break;
2559
2565
  }
2566
+ enterEnd = Math.min(j, hooksEnd - 1) + 1;
2567
+ while (enterEnd < hooksEnd && /^\s*\]\s*$/.test(lines[enterEnd])) enterEnd++;
2560
2568
  break;
2561
2569
  }
2562
2570
  const existingBlock = enterStart >= 0 ? lines.slice(enterStart, enterEnd).join("\n") : "";
@@ -2451,6 +2451,9 @@ function extractTomlStrings(text2) {
2451
2451
  }
2452
2452
  return values;
2453
2453
  }
2454
+ function stripTomlStringsAndComments(line) {
2455
+ return line.replace(/"(?:\\.|[^"\\])*"/g, '""').replace(/'[^']*'/g, "''").replace(/#.*$/, "");
2456
+ }
2454
2457
  function isManagedHookEntry(value) {
2455
2458
  const trimmed = value.trim();
2456
2459
  return trimmed === "op inject -i .env.op > .env" || /(^|\/)link-agentfiles\.sh$/.test(trimmed);
@@ -2478,12 +2481,17 @@ function upsertLinkAgentfilesHooks(text2) {
2478
2481
  for (let i = hooksStart + 1; i < hooksEnd; i++) {
2479
2482
  if (!/^\s*enter\s*=/.test(lines[i])) continue;
2480
2483
  enterStart = i;
2481
- enterEnd = i + 1;
2482
- const afterEquals = lines[i].slice(lines[i].indexOf("=") + 1);
2483
- if (afterEquals.includes("[") && !afterEquals.includes("]")) {
2484
- while (enterEnd < hooksEnd && !lines[enterEnd].includes("]")) enterEnd++;
2485
- if (enterEnd < hooksEnd) enterEnd++;
2484
+ let depth = 0;
2485
+ let j = i;
2486
+ for (; j < hooksEnd; j++) {
2487
+ for (const ch of stripTomlStringsAndComments(lines[j])) {
2488
+ if (ch === "[") depth++;
2489
+ else if (ch === "]") depth--;
2490
+ }
2491
+ if (depth <= 0) break;
2486
2492
  }
2493
+ enterEnd = Math.min(j, hooksEnd - 1) + 1;
2494
+ while (enterEnd < hooksEnd && /^\s*\]\s*$/.test(lines[enterEnd])) enterEnd++;
2487
2495
  break;
2488
2496
  }
2489
2497
  const existingBlock = enterStart >= 0 ? lines.slice(enterStart, enterEnd).join("\n") : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delorenj/pjangler",
3
- "version": "1.2.14",
3
+ "version": "1.2.16",
4
4
  "description": "Project subsystem bootstrapper CLI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",