codewhale.history 2.0.0 → 2.1.0

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/package.json +1 -1
  2. package/tools-install.js +14 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codewhale.history",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "CodeWhale utility commands: session history, tool listing — global install",
5
5
  "bin": {
6
6
  "codewhale-history": "./_list_sessions.js",
package/tools-install.js CHANGED
@@ -39,7 +39,7 @@ if (fs.existsSync(skillsSource)) {
39
39
  console.log(' WARNING: Skills folder not found.');
40
40
  }
41
41
 
42
- // ── 2. Install instructions ────────────────────────────
42
+ // ── 2. Install instructions (append mode) ──────────────
43
43
  console.log('[2/3] Setting up workspace instructions...');
44
44
  const dotCodeWhale = path.join(workspacePath, '.codewhale');
45
45
  const instructionsDest = path.join(dotCodeWhale, 'instructions.md');
@@ -51,13 +51,21 @@ if (!fs.existsSync(dotCodeWhale)) {
51
51
  }
52
52
 
53
53
  if (fs.existsSync(instructionsSource)) {
54
+ const newContent = fs.readFileSync(instructionsSource, 'utf-8');
54
55
  if (fs.existsSync(instructionsDest)) {
55
- const backup = instructionsDest + '.bak';
56
- fs.cpSync(instructionsDest, backup);
57
- console.log(' Backed up existing instructions.md -> instructions.md.bak');
56
+ const existingContent = fs.readFileSync(instructionsDest, 'utf-8');
57
+ // Only append if it's not already there (idempotent)
58
+ if (!existingContent.includes('## //tools Command') && !existingContent.includes('## //history Command')) {
59
+ const separator = `\n\n---\n\n`;
60
+ fs.writeFileSync(instructionsDest, existingContent + separator + newContent, 'utf-8');
61
+ console.log(' Appended //tools and //history instructions to existing instructions.md');
62
+ } else {
63
+ console.log(' //tools and //history already present in instructions.md — skipped.');
64
+ }
65
+ } else {
66
+ fs.writeFileSync(instructionsDest, newContent, 'utf-8');
67
+ console.log(' Created fresh instructions.md.');
58
68
  }
59
- fs.cpSync(instructionsSource, instructionsDest);
60
- console.log(' instructions.md deployed.');
61
69
  } else {
62
70
  console.log(' WARNING: instructions.md not found.');
63
71
  }