safeword 0.30.1 → 0.30.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.
@@ -6,7 +6,7 @@ import {
6
6
  createProjectContext,
7
7
  getMissingPacks,
8
8
  reconcile
9
- } from "./chunk-P4RX4IUV.js";
9
+ } from "./chunk-A52DHYLS.js";
10
10
  import "./chunk-YVZL7WO5.js";
11
11
  import {
12
12
  VERSION
@@ -189,4 +189,4 @@ async function check(options) {
189
189
  export {
190
190
  check
191
191
  };
192
- //# sourceMappingURL=check-YKI5457M.js.map
192
+ //# sourceMappingURL=check-VBN3JZIG.js.map
@@ -507,14 +507,11 @@ function planMissingDirectories(directories, cwd, isGitRepo2) {
507
507
  }
508
508
  return { actions, created };
509
509
  }
510
- function planTextPatches(patches, cwd, isGitRepo2) {
510
+ function planTextPatches(patches, isGitRepo2) {
511
511
  const actions = [];
512
512
  for (const [filePath, definition] of Object.entries(patches)) {
513
513
  if (shouldSkipForNonGit(filePath, isGitRepo2)) continue;
514
- const content = readFileSafe(nodePath7.join(cwd, filePath)) ?? "";
515
- if (!content.includes(definition.marker)) {
516
- actions.push({ type: "text-patch", path: filePath, definition });
517
- }
514
+ actions.push({ type: "text-patch", path: filePath, definition });
518
515
  }
519
516
  return actions;
520
517
  }
@@ -537,11 +534,10 @@ function planManagedFileWrites(files, ctx) {
537
534
  return planFileWrites(files, ctx, (filePath, c) => exists(nodePath7.join(c.cwd, filePath)));
538
535
  }
539
536
  function planTextPatchesWithCreation(patches, ctx) {
540
- const actions = [];
537
+ const actions = planTextPatches(patches, ctx.isGitRepo);
541
538
  const created = [];
542
539
  for (const [filePath, definition] of Object.entries(patches)) {
543
540
  if (shouldSkipForNonGit(filePath, ctx.isGitRepo)) continue;
544
- actions.push({ type: "text-patch", path: filePath, definition });
545
541
  if (definition.createIfMissing && !exists(nodePath7.join(ctx.cwd, filePath))) {
546
542
  created.push(filePath);
547
543
  }
@@ -717,7 +713,7 @@ function computeUpgradePlan(schema, ctx) {
717
713
  for (const [filePath, definition] of Object.entries(schema.jsonMerges)) {
718
714
  actions.push({ type: "json-merge", path: filePath, definition });
719
715
  }
720
- actions.push(...planTextPatches(schema.textPatches, ctx.cwd, ctx.isGitRepo));
716
+ actions.push(...planTextPatches(schema.textPatches, ctx.isGitRepo));
721
717
  const packagesToInstall = computePackagesToInstall(
722
718
  schema,
723
719
  ctx.projectType,
@@ -915,7 +911,13 @@ function executeJsonUnmerge(cwd, path2, definition, ctx) {
915
911
  function executeTextPatch(cwd, path2, definition) {
916
912
  const fullPath = nodePath7.join(cwd, path2);
917
913
  let content = readFileSafe(fullPath) ?? "";
918
- if (content.includes(definition.marker)) return;
914
+ if (content.includes(definition.marker)) {
915
+ if (content.includes("\n\n---#")) {
916
+ const healed = content.replaceAll("\n\n---#", "\n\n---\n\n#");
917
+ writeFile(fullPath, healed);
918
+ }
919
+ return;
920
+ }
919
921
  content = definition.operation === "prepend" ? definition.content + content : content + definition.content;
920
922
  writeFile(fullPath, content);
921
923
  }
@@ -2272,10 +2274,14 @@ var AGENTS_MD_LINK = `**\u26A0\uFE0F ALWAYS READ FIRST:** \`.safeword/SAFEWORD.m
2272
2274
  The SAFEWORD.md file contains core development patterns, workflows, and conventions.
2273
2275
  Read it BEFORE working on any task in this project.
2274
2276
 
2275
- ---`;
2277
+ ---
2278
+
2279
+ `;
2276
2280
  var CLAUDE_MD_IMPORT_BLOCK = `@./.safeword/SAFEWORD.md
2277
2281
 
2278
- ---`;
2282
+ ---
2283
+
2284
+ `;
2279
2285
 
2280
2286
  // src/utils/hooks.ts
2281
2287
  function isHookEntry(h) {
@@ -3012,4 +3018,4 @@ export {
3012
3018
  detectLanguages2,
3013
3019
  createProjectContext
3014
3020
  };
3015
- //# sourceMappingURL=chunk-P4RX4IUV.js.map
3021
+ //# sourceMappingURL=chunk-A52DHYLS.js.map