@pragma-sh/junie-plugin 1.0.1 → 1.0.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pragma-junie",
3
- "version": "0.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Reports Junie CLI agent status (running / done / attention) to Pragma automatically.",
5
5
  "author": {
6
6
  "name": "Pragma"
package/dist/install.mjs CHANGED
@@ -5,7 +5,7 @@ import { dirname, join, resolve } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
6
  var JUNIE_HOME = process.env.JUNIE_HOME ?? join(homedir(), ".junie");
7
7
  var CONFIG_PATH = join(JUNIE_HOME, "config.json");
8
- var HOOK_SCRIPT_MARKER = join("packages", "junie-plugin", "hooks", "report.sh");
8
+ var HOOK_SCRIPT_PATTERN = /junie-plugin[^/\\"]*[/\\]hooks[/\\]report\.sh/;
9
9
  var root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
10
10
  var template = readFileSync(join(root, "hooks", "hooks.json"), "utf8");
11
11
  var ours = JSON.parse(template.replaceAll("${JUNIE_PLUGIN_ROOT}", root)).hooks;
@@ -53,7 +53,7 @@ function dropOwnEntries(existingHooks, pluginRoot) {
53
53
  function isOwnEntry(entry, pluginRoot) {
54
54
  return (entry.hooks ?? []).some((hook) => {
55
55
  const command = hook.command ?? "";
56
- return command.includes(pluginRoot) || command.includes(HOOK_SCRIPT_MARKER);
56
+ return command.includes(pluginRoot) || HOOK_SCRIPT_PATTERN.test(command);
57
57
  });
58
58
  }
59
59
  function isPlainObject(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pragma-sh/junie-plugin",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "JetBrains Junie CLI plugin that reports agent status to Pragma via native hooks.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -42,12 +42,14 @@ interface JunieConfig {
42
42
  const JUNIE_HOME = process.env.JUNIE_HOME ?? join(homedir(), ".junie");
43
43
  const CONFIG_PATH = join(JUNIE_HOME, "config.json");
44
44
  /**
45
- * Path fragment that identifies this package's hook script in an installed
46
- * command. The absolute plugin root changes per checkout (worktrees), so this
47
- * marker lets a reinstall from a different checkout replace the previous
48
- * install instead of stacking a second set of hooks.
45
+ * Identifies this package's hook script in an installed command. The absolute
46
+ * plugin root changes per checkout (`packages/junie-plugin`, worktrees) and per
47
+ * Pragma-managed npm install (`-pragma-sh-junie-plugin-<version>-<uuid>`), so
48
+ * this matches the script under any directory named for the package: an
49
+ * upgrade replaces the previous install instead of stacking hooks that point
50
+ * at a directory Pragma has since deleted.
49
51
  */
50
- const HOOK_SCRIPT_MARKER = join("packages", "junie-plugin", "hooks", "report.sh");
52
+ const HOOK_SCRIPT_PATTERN = /junie-plugin[^/\\"]*[/\\]hooks[/\\]report\.sh/;
51
53
 
52
54
  const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
53
55
  const template = readFileSync(join(root, "hooks", "hooks.json"), "utf8");
@@ -114,10 +116,10 @@ function dropOwnEntries(
114
116
  function isOwnEntry(entry: JunieHookEntry, pluginRoot: string): boolean {
115
117
  return (entry.hooks ?? []).some((hook) => {
116
118
  const command = hook.command ?? "";
117
- // The absolute root changes per checkout (worktrees), so also match the
118
- // package's hook-script path: reinstalling from a different worktree must
119
- // replace the previous install instead of stacking a second set of hooks.
120
- return command.includes(pluginRoot) || command.includes(HOOK_SCRIPT_MARKER);
119
+ // The absolute root changes per checkout and per npm install, so also
120
+ // match the package's hook-script path: reinstalling from anywhere else
121
+ // must replace the previous install instead of stacking a second set.
122
+ return command.includes(pluginRoot) || HOOK_SCRIPT_PATTERN.test(command);
121
123
  });
122
124
  }
123
125