@axiomatic-labs/claudeflow 2.13.18 → 2.13.19

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.
Files changed (2) hide show
  1. package/lib/install.js +16 -9
  2. package/package.json +1 -1
package/lib/install.js CHANGED
@@ -1036,22 +1036,29 @@ function ensureDefaultClaudeMdRules(projectRoot) {
1036
1036
  return { action: 'opt-out' };
1037
1037
  }
1038
1038
 
1039
+ // The block always lives at the bottom. Two paths get us there:
1040
+ // - sentinels found at the bottom and content current → unchanged
1041
+ // - sentinels found anywhere else (top, middle, stale content) →
1042
+ // remove the old block and append a fresh one at the tail.
1043
+ // - sentinels absent → append for the first time.
1039
1044
  const beginIdx = existing.indexOf(CLAUDE_MD_INJECT_BEGIN);
1040
1045
  const endIdx = existing.indexOf(CLAUDE_MD_INJECT_END);
1046
+ let userContent;
1041
1047
  if (beginIdx !== -1 && endIdx !== -1 && endIdx > beginIdx) {
1042
1048
  const before = existing.slice(0, beginIdx);
1043
1049
  const after = existing.slice(endIdx + CLAUDE_MD_INJECT_END.length);
1044
- const next = `${before}${block}${after}`;
1045
- if (next === existing) return { action: 'unchanged' };
1046
- fs.writeFileSync(outputPath, next);
1047
- return { action: 'updated' };
1050
+ userContent = `${before.replace(/\s+$/, '')}${after.startsWith('\n') ? '' : '\n'}${after}`.replace(/^\s+/, '').replace(/\s+$/, '');
1051
+ } else {
1052
+ userContent = existing.replace(/\s+$/, '');
1048
1053
  }
1049
1054
 
1050
- // First injection into a pre-existing CLAUDE.md prepend, keep the
1051
- // user's content verbatim below.
1052
- const separator = existing.startsWith('\n') ? '\n' : '\n\n';
1053
- fs.writeFileSync(outputPath, `${block}${separator}${existing}`);
1054
- return { action: 'injected' };
1055
+ const next = userContent.length === 0
1056
+ ? `${block}\n`
1057
+ : `${userContent}\n\n${block}\n`;
1058
+
1059
+ if (next === existing) return { action: 'unchanged' };
1060
+ fs.writeFileSync(outputPath, next);
1061
+ return { action: beginIdx !== -1 ? 'updated' : 'injected' };
1055
1062
  }
1056
1063
 
1057
1064
  function isTemplateManagedAgent(agentName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiomatic-labs/claudeflow",
3
- "version": "2.13.18",
3
+ "version": "2.13.19",
4
4
  "description": "Claudeflow — AI-powered development toolkit for Claude Code. Skills, agents, hooks, and quality gates that ship production apps.",
5
5
  "bin": {
6
6
  "claudeflow": "./bin/cli.js"