@basestream/cli 0.2.1 → 0.2.2

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/dist/cli.mjs +35 -4
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -921,6 +921,12 @@ async function login() {
921
921
  var CLAUDE_DIR = path2.join(os2.homedir(), ".claude");
922
922
  var CLAUDE_SETTINGS_PATH = path2.join(CLAUDE_DIR, "settings.json");
923
923
  var CLAUDE_SKILLS_PATH = path2.join(CLAUDE_DIR, "skills", "bs-summarize.md");
924
+ var CLAUDE_MD_PATH = path2.join(CLAUDE_DIR, "CLAUDE.md");
925
+ var CLAUDE_MD_MARKER = "<!-- basestream -->";
926
+ var CLAUDE_MD_RULE = `${CLAUDE_MD_MARKER}
927
+ - Before starting any non-trivial task, if the reason or context behind the work isn't already clear, ask: "What's the context for this?" Skip this for small tasks, typo fixes, or anything self-explanatory.
928
+ - After completing any meaningful work (fixing a bug, implementing a feature, making a significant change), invoke /bs-summarize to keep the session summary up to date. Include the "why" if it was provided.
929
+ <!-- /basestream -->`;
924
930
  var HOOK_COMMAND = "npx @basestream/cli _hook-stop";
925
931
  var HOOK_MARKER = "_hook-stop";
926
932
  var SKILL_CONTENT = `---
@@ -928,15 +934,39 @@ name: bs-summarize
928
934
  description: Update the Basestream session summary with what's been accomplished so far
929
935
  ---
930
936
 
931
- Write a concise summary of what has been accomplished in this coding session so far. Focus on:
937
+ First, read the existing summary file at \`~/.basestream/sessions/\${CLAUDE_SESSION_ID}-summary.md\` if it exists \u2014 this is the running record of work done so far this session.
938
+
939
+ Then write an updated summary that aggregates the previous summary with everything that has happened since. Focus on:
940
+ - Why the work was done (if context was provided \u2014 skip if not known)
932
941
  - What was built, fixed, or changed (be specific about features/bugs)
933
942
  - Which parts of the codebase were touched
934
943
  - Any key decisions made
935
944
 
936
- Keep it to 2-4 sentences, plain prose, no bullet points.
945
+ Do not just append \u2014 synthesize everything into a single cohesive summary. Merge related work together, avoid repeating the same point twice, and drop anything superseded by later changes. Be concise \u2014 let the scope of the work determine the length. A small fix deserves one sentence; a large multi-part session can be a short paragraph. Plain prose, no bullet points.
946
+
947
+ Write the result to \`~/.basestream/sessions/\${CLAUDE_SESSION_ID}-summary.md\`, overwriting the file.
948
+ `;
949
+ function injectClaudeMdRule() {
950
+ let existing = "";
951
+ if (fs2.existsSync(CLAUDE_MD_PATH)) {
952
+ existing = fs2.readFileSync(CLAUDE_MD_PATH, "utf-8");
953
+ }
954
+ let updated;
955
+ if (existing.includes(CLAUDE_MD_MARKER)) {
956
+ updated = existing.replace(/<!-- basestream -->[\s\S]*?<!-- \/basestream -->/, CLAUDE_MD_RULE);
957
+ fs2.writeFileSync(CLAUDE_MD_PATH, updated);
958
+ check("Updated Basestream rules in ~/.claude/CLAUDE.md");
959
+ } else {
960
+ updated = existing ? `${existing.trimEnd()}
937
961
 
938
- Write the summary to the file \`~/.basestream/sessions/\${CLAUDE_SESSION_ID}-summary.md\` \u2014 overwrite if it exists.
962
+ ${CLAUDE_MD_RULE}
963
+ ` : `${CLAUDE_MD_RULE}
939
964
  `;
965
+ fs2.mkdirSync(CLAUDE_DIR, { recursive: true });
966
+ fs2.writeFileSync(CLAUDE_MD_PATH, updated);
967
+ check("Injected Basestream rules into ~/.claude/CLAUDE.md");
968
+ }
969
+ }
940
970
  function installSkill() {
941
971
  const skillsDir = path2.dirname(CLAUDE_SKILLS_PATH);
942
972
  fs2.mkdirSync(skillsDir, { recursive: true });
@@ -1009,6 +1039,7 @@ async function init() {
1009
1039
  console.log();
1010
1040
  injectClaudeCodeHook();
1011
1041
  installSkill();
1042
+ injectClaudeMdRule();
1012
1043
  ensureDirs();
1013
1044
  check(`Created ~/.basestream/buffer/`);
1014
1045
  console.log();
@@ -4481,7 +4512,7 @@ async function main() {
4481
4512
  process.exit(0);
4482
4513
  }
4483
4514
  if (command === "--version" || command === "-v") {
4484
- console.log(true ? "0.2.1" : "dev");
4515
+ console.log(true ? "0.2.2" : "dev");
4485
4516
  process.exit(0);
4486
4517
  }
4487
4518
  switch (command || "init") {
package/package.json CHANGED
@@ -18,5 +18,5 @@
18
18
  "unlink:cli": "npm unlink -g @basestream/cli"
19
19
  },
20
20
  "type": "module",
21
- "version": "0.2.1"
21
+ "version": "0.2.2"
22
22
  }