@workit-dev/codex 2.22.1 → 2.22.3
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.
- package/.codex-plugin/plugin.json +1 -1
- package/bin/workit-paths.mjs +33 -1
- package/dist/launch-mcp.js +936 -631
- package/dist/{workit-hook-z09frbdk.js → workit-hook-0qpa9aa6.js} +5 -1
- package/dist/{workit-hook-52cm7mqd.js → workit-hook-2j7nwxvz.js} +3 -3
- package/dist/{workit-hook-teys17gm.js → workit-hook-84bzj3hf.js} +931 -637
- package/dist/{workit-hook-sdmcdyrk.js → workit-hook-a7qmf2t8.js} +3 -3
- package/dist/{workit-hook-azjr1ew1.js → workit-hook-agyvx03a.js} +1 -1
- package/dist/{workit-hook-ta5skes6.js → workit-hook-c490e5mm.js} +2 -2
- package/dist/{workit-hook-vmvv43m0.js → workit-hook-dv9s0sjq.js} +2 -2
- package/dist/{workit-hook-btkg30rw.js → workit-hook-mer435q8.js} +1 -1
- package/dist/{workit-hook-xdv92sjp.js → workit-hook-p972vv1e.js} +1 -1
- package/dist/{workit-hook-7jv519ep.js → workit-hook-sxyjantk.js} +14 -2
- package/dist/{workit-hook-x482fqpj.js → workit-hook-v0nvtq6s.js} +1 -1
- package/dist/{workit-hook-7dwf87hc.js → workit-hook-v7vytjn0.js} +4 -3
- package/dist/{workit-hook-dzfxvq92.js → workit-hook-yqe1kfrp.js} +2 -2
- package/dist/workit-hook.js +9 -9
- package/package.json +3 -3
package/bin/workit-paths.mjs
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
// POSIX shell launchers embed the *_SH functions below verbatim, and a test
|
|
11
11
|
// runs them against the JavaScript for the same environment.
|
|
12
12
|
// Side-effect free on import; only migrateLegacyDirs touches the disk.
|
|
13
|
-
import {
|
|
13
|
+
import { createHash } from "node:crypto";
|
|
14
|
+
import { existsSync, lstatSync, mkdirSync, realpathSync, renameSync, writeFileSync } from "node:fs";
|
|
14
15
|
import os from "node:os";
|
|
15
16
|
import path from "node:path";
|
|
16
17
|
|
|
@@ -100,6 +101,37 @@ export const runtimeDir = (env, platform) => workitDir("runtime", env, platform)
|
|
|
100
101
|
*/
|
|
101
102
|
export const worktreesDir = (env, platform) => path.join(stateDir(env, platform), "worktrees");
|
|
102
103
|
|
|
104
|
+
/**
|
|
105
|
+
* A filesystem-safe name for one directory, from its canonical path, so every
|
|
106
|
+
* spelling of it (symlinks, Windows short names, drive-letter case) maps to one
|
|
107
|
+
* name: `<basename>-<12 hex of its sha256>`. The task store keys checkouts by it.
|
|
108
|
+
* @param {string} dir @param {string} [platform]
|
|
109
|
+
*/
|
|
110
|
+
export const folderSlug = (dir, platform = process.platform) => {
|
|
111
|
+
let canonical = dir;
|
|
112
|
+
try {
|
|
113
|
+
canonical = realpathSync.native(dir);
|
|
114
|
+
} catch {
|
|
115
|
+
// A missing path keys by its spelling.
|
|
116
|
+
}
|
|
117
|
+
if (platform === "win32") canonical = canonical.toLowerCase();
|
|
118
|
+
const base =
|
|
119
|
+
path
|
|
120
|
+
.basename(canonical)
|
|
121
|
+
.replace(/[^A-Za-z0-9._-]/g, "_")
|
|
122
|
+
.slice(0, 40) || "root";
|
|
123
|
+
return `${base}-${createHash("sha256").update(canonical).digest("hex").slice(0, 12)}`;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Where a folder outside every git repository keeps its Workit store (ledger,
|
|
128
|
+
* tasks, plans, retros, handoffs, notes): `<state>/folders/<folderSlug(dir)>`,
|
|
129
|
+
* never inside the folder itself.
|
|
130
|
+
* @param {string} dir @param {NodeJS.ProcessEnv} [env] @param {string} [platform]
|
|
131
|
+
*/
|
|
132
|
+
export const folderStoreDir = (dir, env, platform) =>
|
|
133
|
+
path.join(stateDir(env, platform), "folders", folderSlug(dir, platform));
|
|
134
|
+
|
|
103
135
|
/**
|
|
104
136
|
* The managed worktree root before it moved to worktreesDir:
|
|
105
137
|
* `$XDG_CACHE_HOME/workit-wt`, else `~/.cache/workit-wt` (on every platform).
|