@codeharbor/agent-playbook 0.2.0 → 0.2.1

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/src/cli.js +8 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeharbor/agent-playbook",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Local skill manager and installer for agent-playbook across Claude Code, Codex, and Gemini.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
package/src/cli.js CHANGED
@@ -1755,6 +1755,9 @@ function updateClaudeSettings(settings, cliPath, options) {
1755
1755
  const data = existing || {};
1756
1756
 
1757
1757
  data.hooks = data.hooks || {};
1758
+ const marker = `--hook-source ${HOOK_SOURCE_VALUE}`;
1759
+ data.hooks = removeHookCommand(data.hooks, "SessionEnd", marker);
1760
+ data.hooks = removeHookCommand(data.hooks, "PostToolUse", marker);
1758
1761
 
1759
1762
  let sessionCommand = buildHookCommand(cliPath, "session-log");
1760
1763
  sessionCommand = `${sessionCommand} --hook-source ${HOOK_SOURCE_VALUE}`;
@@ -1891,8 +1894,11 @@ function upsertCodexBlock(content, values) {
1891
1894
  }
1892
1895
 
1893
1896
  function removeCodexBlock(content) {
1894
- const pattern = /^\[agent_playbook\][\s\S]*?(?=^\[|\s*$)/m;
1895
- return content.replace(pattern, "").trimEnd();
1897
+ const pattern = /^\[agent_playbook\][\s\S]*?(?=^\[|\s*$)/gm;
1898
+ const cleaned = content.replace(pattern, "");
1899
+ const legacyPattern =
1900
+ /(?:\n\s*version\s*=\s*\"[^\"]*\"\s*\n\s*installed_at\s*=\s*\"[^\"]*\"\s*)+$/;
1901
+ return cleaned.replace(legacyPattern, "\n").trimEnd();
1896
1902
  }
1897
1903
 
1898
1904
  function buildHookCommand(cliPath, subcommand) {