@brainervirus/workit-cursor 8.33.0 → 8.35.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.
@@ -2,7 +2,7 @@
2
2
  "name": "workit",
3
3
  "displayName": "Workit",
4
4
  "description": "Adaptive Workit workflow with shared MCP tools and native Cursor hooks",
5
- "version": "8.33.0",
5
+ "version": "8.35.0",
6
6
  "author": {
7
7
  "name": "Cristhofer Pincetti"
8
8
  },
@@ -23824,6 +23824,39 @@ var init_cursor = __esm(() => {
23824
23824
  };
23825
23825
  });
23826
23826
 
23827
+ // packages/workit-core/src/hooks/hook-runs.ts
23828
+ import { mkdirSync as mkdirSync4, readdirSync as readdirSync4, readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "node:fs";
23829
+ import path34 from "node:path";
23830
+ var HOOK_RUNS_DIR = "hook-runs", safe = (part) => part.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 64), runFile = (dir, host, event) => path34.join(dir, HOOK_RUNS_DIR, `${safe(host)}__${safe(event)}.json`), recordHookRun = (host, event, env = process.env, now = Date.now) => {
23831
+ if (!event)
23832
+ return;
23833
+ try {
23834
+ const dir = stateDir2(env);
23835
+ const file = runFile(dir, host, event);
23836
+ let count = 0;
23837
+ try {
23838
+ const previous = JSON.parse(readFileSync6(file, "utf8"));
23839
+ if (typeof previous.count === "number" && Number.isFinite(previous.count))
23840
+ count = previous.count;
23841
+ } catch {}
23842
+ const row = {
23843
+ host,
23844
+ event,
23845
+ at: new Date(now()).toISOString(),
23846
+ count: count + 1
23847
+ };
23848
+ try {
23849
+ writeFileSync3(file, JSON.stringify(row));
23850
+ } catch {
23851
+ mkdirSync4(path34.dirname(file), { recursive: true });
23852
+ writeFileSync3(file, JSON.stringify(row));
23853
+ }
23854
+ } catch {}
23855
+ };
23856
+ var init_hook_runs = __esm(() => {
23857
+ init_heavy_words();
23858
+ });
23859
+
23827
23860
  // packages/workit-core/src/hooks/run.ts
23828
23861
  async function runHookProcess(host, stdin, stdout, stderr = process.stderr, env = process.env, deadline = {}) {
23829
23862
  const adapter = typeof host === "string" ? HOOK_ADAPTERS[host] : host;
@@ -23835,6 +23868,8 @@ async function runHookProcess(host, stdin, stdout, stderr = process.stderr, env
23835
23868
  } catch {
23836
23869
  raw = undefined;
23837
23870
  }
23871
+ const native = raw?.hook_event_name;
23872
+ recordHookRun(typeof host === "string" ? host : adapter.descriptor.host, typeof native === "string" ? native : null, env);
23838
23873
  const result = text === null ? skippedHook(adapter, undefined, env, budget, "input") : await dispatchWithin(adapter, raw, env, budget, deadline.dispatch);
23839
23874
  if (result.skipped)
23840
23875
  stderr.write(`[workit] ${result.error}
@@ -23852,6 +23887,7 @@ var init_run = __esm(async () => {
23852
23887
  init_claude_code();
23853
23888
  init_codex();
23854
23889
  init_cursor();
23890
+ init_hook_runs();
23855
23891
  HOOK_ADAPTERS = {
23856
23892
  claude_code: claudeCodeAdapter,
23857
23893
  codex_cli: codexAdapter,
@@ -24051,6 +24051,39 @@ var cursorAdapter = {
24051
24051
  addendum: (input) => input.session.id ? `<workit-session>Cursor puts no session id in the shell: start workit commands that record authorship with the global flag \`--session ${input.session.id}\` (e.g. \`workit --session ${input.session.id} git commit -m …\`; a leading env assignment can miss the \`Shell(workit)\` allowlist). A verifier uses its own id, never this one.</workit-session>` : null
24052
24052
  };
24053
24053
 
24054
+ // packages/workit-core/src/hooks/hook-runs.ts
24055
+ import { mkdirSync as mkdirSync4, readdirSync as readdirSync4, readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "node:fs";
24056
+ import path34 from "node:path";
24057
+ var HOOK_RUNS_DIR = "hook-runs";
24058
+ var safe = (part) => part.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 64);
24059
+ var runFile = (dir, host, event) => path34.join(dir, HOOK_RUNS_DIR, `${safe(host)}__${safe(event)}.json`);
24060
+ var recordHookRun = (host, event, env = process.env, now = Date.now) => {
24061
+ if (!event)
24062
+ return;
24063
+ try {
24064
+ const dir = stateDir2(env);
24065
+ const file = runFile(dir, host, event);
24066
+ let count = 0;
24067
+ try {
24068
+ const previous = JSON.parse(readFileSync6(file, "utf8"));
24069
+ if (typeof previous.count === "number" && Number.isFinite(previous.count))
24070
+ count = previous.count;
24071
+ } catch {}
24072
+ const row = {
24073
+ host,
24074
+ event,
24075
+ at: new Date(now()).toISOString(),
24076
+ count: count + 1
24077
+ };
24078
+ try {
24079
+ writeFileSync3(file, JSON.stringify(row));
24080
+ } catch {
24081
+ mkdirSync4(path34.dirname(file), { recursive: true });
24082
+ writeFileSync3(file, JSON.stringify(row));
24083
+ }
24084
+ } catch {}
24085
+ };
24086
+
24054
24087
  // packages/workit-core/src/hooks/run.ts
24055
24088
  var HOOK_ADAPTERS = {
24056
24089
  claude_code: claudeCodeAdapter,
@@ -24068,6 +24101,8 @@ async function runHookProcess(host, stdin, stdout, stderr = process.stderr, env
24068
24101
  } catch {
24069
24102
  raw = undefined;
24070
24103
  }
24104
+ const native = raw?.hook_event_name;
24105
+ recordHookRun(typeof host === "string" ? host : adapter.descriptor.host, typeof native === "string" ? native : null, env);
24071
24106
  const result = text === null ? skippedHook(adapter, undefined, env, budget, "input") : await dispatchWithin(adapter, raw, env, budget, deadline.dispatch);
24072
24107
  if (result.skipped)
24073
24108
  stderr.write(`[workit] ${result.error}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-cursor",
3
- "version": "8.33.0",
3
+ "version": "8.35.0",
4
4
  "private": false,
5
5
  "description": "Workit Cursor plugin — shared MCP transport, native hooks, and sixteen method skills",
6
6
  "keywords": [
@@ -46,8 +46,8 @@
46
46
  "build": "bun scripts/build.ts"
47
47
  },
48
48
  "devDependencies": {
49
- "@brainervirus/workit-core": "^8.33.0",
50
- "@brainervirus/workit-mcp": "^8.33.0"
49
+ "@brainervirus/workit-core": "^8.35.0",
50
+ "@brainervirus/workit-mcp": "^8.35.0"
51
51
  },
52
52
  "engines": {
53
53
  "node": ">=24"