@cmodjs/core 4.3.0 → 4.3.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.
- package/docs/commands.md +12 -13
- package/package.json +1 -1
- package/records.d.ts +5 -1
- package/records.d.ts.map +1 -1
- package/records.js +11 -1
- package/runtime/lifecycle.d.ts.map +1 -1
- package/runtime/lifecycle.js +5 -11
- package/src/records.ts +9 -1
- package/src/runtime/lifecycle.ts +8 -9
package/docs/commands.md
CHANGED
|
@@ -65,13 +65,12 @@ Runs every check this machine can run on the mod at `path` (default: the current
|
|
|
65
65
|
8. Writes the `cmod` dependency in `.claude-plugin/plugin.json` as `>=` the version of the `@cmodjs/core` the mod installed, such as `>=4.0.0`, so every newer cmod runs the mod. A mod still on `@cmodjs/core` 3 keeps its own range ([dependencies.md](dependencies.md#call-the-methods-mod-dependencies)).
|
|
66
66
|
9. Checks its imports.
|
|
67
67
|
10. Looks for prebuilt binaries outside `cli/`.
|
|
68
|
-
11.
|
|
69
|
-
12.
|
|
70
|
-
13.
|
|
71
|
-
14.
|
|
72
|
-
15. Runs, with `
|
|
73
|
-
16.
|
|
74
|
-
17. Checks its name against other plugins. Only a project plugin, in `.claude/skills/<name>/` of a repository, runs this check: it fails when an installed or linked plugin has the same name and hides the project plugin. Any other mod passes it at once.
|
|
68
|
+
11. Builds the release in a temporary folder as `cmod publish` builds it, with its `"files"` list and its bundled hooks module, and validates the release with Claude Code, `claude plugin validate --strict`. So it fails on a path `plugin.json` names that `"files"` leaves out, a `"files"` path that matches no file in the mod, and each reason a bundle fails, and prints every line the validator writes. Then it deletes the folder.
|
|
69
|
+
12. Compiles it against Claude Code's API with `tsc`, with `tsconfig.json`, and then with `tests/tsconfig.json` when it exists. `cmod new` writes both: the root config leaves Bun out of `src/`, which runs inside Claude Code, and the tests config adds `bun-types`, so a test can run a real program with `Bun.spawn` or read files with `node:fs`. When `.claude-plugin/types/` is missing, as in a fresh clone or in CI, Claude Code writes it first: cmod loads the mod in one `claude -p` run with a config folder of its own and no model to reach, so the run sends nothing.
|
|
70
|
+
13. Lints it with `oxlint`.
|
|
71
|
+
14. Runs, with `bun test`, every test file that does not import `claude-code/testing`. When `bunfig.toml` names a `[test]` `root`, it runs only the test files under that folder, as `bun test` does.
|
|
72
|
+
15. Runs, with `claude plugin test`, the test files that import `claude-code/testing`. It skips this when none does.
|
|
73
|
+
16. Checks its name against other plugins. Only a project plugin, in `.claude/skills/<name>/` of a repository, runs this check: it fails when an installed or linked plugin has the same name and hides the project plugin. Any other mod passes it at once.
|
|
75
74
|
|
|
76
75
|
`cmod check` fetches `tsc` 7.0.2 and `oxlint` 1.86.0 into the cmod store the first time. It ends with a count of passed, failed, and skipped checks, and exits 1 when one failed.
|
|
77
76
|
|
|
@@ -105,9 +104,9 @@ cmod publish [path] [--dry-run]
|
|
|
105
104
|
|
|
106
105
|
Releases the mod at `path` (default: the current folder) at the version in its `plugin.json`. It refuses a `plugin.json` whose `userConfig` differs from the options `defineMod` declares, and says to run `cmod check` and commit `.claude-plugin/plugin.json`.
|
|
107
106
|
|
|
108
|
-
1. Builds the release from the
|
|
107
|
+
1. Builds the release from the files git does not ignore, leaving out `cli/`, `.github/`, and `.claude/`. A `"files"` list in `package.json` limits the release to the paths it lists, plus the folders of the install and uninstall steps, `.claude-plugin/`, `package.json`, `tsconfig.json`, the README, the license, and `CHANGELOG.md`, the way `npm publish` reads it. `tsconfig.json` holds the JSX settings the bundle in step 2 needs. List every folder the hooks module imports from, such as `"files": ["hooks", "src", "skills"]`, because the bundle in step 2 is built from the release.
|
|
109
108
|
2. Bundles the hooks module that `hooks/hooks.json` names, with the mod's source and packages, into one readable `.js` file, writes each control character in it as a `\u` escape, and points `hooks/hooks.json` at it. Anthropic's plugin directory reads a repository without installing its packages, so it can follow a mod only when all its code is in one file. Without `"approve": true` in `package.json` `"cmod".permissions`, the bundle leaves out the code that allows and asks on Claude Code's permission check ([permissions.md](permissions.md)).
|
|
110
|
-
3. Checks the release with `claude plugin validate --strict`, and stops with the validator
|
|
109
|
+
3. Checks the release's `.claude-plugin/plugin.json`, and its `.claude-plugin/marketplace.json` when it has one, with `claude plugin validate --strict`, and stops with every line the validator writes when it fails. `cmod check` builds and validates the release the same way, so it fails first.
|
|
111
110
|
4. Commits the release as the `release` branch, and builds the release archive from that commit.
|
|
112
111
|
5. Builds the program `cli/` declares, and writes `SHA256SUMS` for every file of the release.
|
|
113
112
|
6. Writes `.claude-plugin/marketplace.json`, listing the archive and the cmod plugin. The cmod entry points at the `release` branch of `heyJordanParker/cmod`, so the mod's `"cmod"` dependency resolves in this marketplace and follows each cmod release with no new publish of the mod.
|
|
@@ -118,19 +117,19 @@ The release keeps `package.json`, so Claude Code still installs the mod's packag
|
|
|
118
117
|
|
|
119
118
|
It needs, and refuses to start without:
|
|
120
119
|
|
|
121
|
-
- the mod's folder as the root of a git repository with at least one commit, because
|
|
120
|
+
- the mod's folder as the root of a git repository with at least one commit, because the release is committed as the `release` branch
|
|
122
121
|
- a `## [<version>]` section with notes in the committed `CHANGELOG.md`
|
|
123
122
|
- `node_modules` in the mod's folder, from `bun install`, when the hooks module imports a package
|
|
124
123
|
- a `register` declared as a function in the hooks module, as `cmod new` writes it, because the validator refuses a bundled `register` that is not one
|
|
125
124
|
- the `claude` command, which validates the release
|
|
126
125
|
- an `origin` remote on GitHub
|
|
127
126
|
- a `package.json` with no dependency on a `file:` or `link:` path, which no user has
|
|
128
|
-
- a `"files"` list, when `package.json` has one, whose every path matches a
|
|
127
|
+
- a `"files"` list, when `package.json` has one, whose every path matches a file in the mod
|
|
129
128
|
- a `"program"` in the `cmod` key of `package.json` that names the program `cli/` declares, when `cli/` declares one
|
|
130
129
|
- a `cmod` dependency in `.claude-plugin/plugin.json` of `>=` the `@cmodjs/core` the mod bundles, which `cmod check` writes
|
|
131
130
|
- for a real publish, a working tree with no uncommitted changes, no `v<version>` or `<name>--v<version>` tag yet, a `git push` to `origin` that succeeds, and the `gh` command, which creates the GitHub release
|
|
132
131
|
|
|
133
|
-
`--dry-run` builds everything into a temporary folder, and pushes nothing. It writes `marketplace.json` there too, so the working tree stays as it was. It allows uncommitted changes and an existing tag, and builds from the
|
|
132
|
+
`--dry-run` builds everything into a temporary folder, and pushes nothing. It writes `marketplace.json` there too, so the working tree stays as it was. It allows uncommitted changes and an existing tag, and builds from the working tree, uncommitted changes included. It prints the folder that holds the release, so you can read what the directory will read.
|
|
134
133
|
|
|
135
134
|
## Install mods
|
|
136
135
|
|
|
@@ -233,7 +232,7 @@ Reads every conversation Claude Code saved, as the sessions, contexts, turns, ta
|
|
|
233
232
|
cmod watch
|
|
234
233
|
```
|
|
235
234
|
|
|
236
|
-
Tells every running session once a checkout `cmod link` linked builds after a change. It watches each linked folder, outside `node_modules` and `.git`, and skips a change to a file git ignores, such as the `.claude-plugin/types/` Claude Code writes each time it loads the mod. Once a folder has had no change for 2 seconds, it bundles the mod's hooks module as `cmod publish` does. A bundle that builds marks `plugins-changed`, so every session reloads its plugins, and shows no toast, because the version stays the same. A bundle that still fails 10 seconds after the last change shows `<mod> does not build` with the error as one toast in every session, and the toast goes once the mod builds. So an agent's half-written file reloads nothing and shows nothing. The cmod plugin starts one only in a session that an app shows, once a mod is linked, at the session's start or later, so a machine with no linked mod runs none. The first holds `watch.lock` in the cmod store, watches, and touches its file there every 5 seconds. Another one exits at once while it runs, and the cmod plugin of each such session starts one again once that file is 15 seconds old, so a machine runs one watcher however many sessions it has open.
|
|
235
|
+
Tells every running session once a checkout `cmod link` linked builds after a change. It watches each linked folder, outside `node_modules` and `.git`, and skips a change to a file git ignores, such as the `.claude-plugin/types/` Claude Code writes each time it loads the mod. Once a folder has had no change for 2 seconds, it bundles the mod's hooks module as `cmod publish` does. A bundle that builds marks `plugins-changed`, so every session reloads its plugins, and shows no toast, because the version stays the same. A bundle that still fails 10 seconds after the last change shows `<mod> does not build` with the error as one toast in every session, and the toast goes once the mod builds. So an agent's half-written file reloads nothing and shows nothing. At its start it bundles again each mod whose failure it finds in `build-failures.json`, so a failure an older cmod wrote goes once the mod builds. The cmod plugin starts one only in a session that an app shows, once a mod is linked, at the session's start or later, so a machine with no linked mod runs none. The first holds `watch.lock` in the cmod store, watches, and touches its file there every 5 seconds. Another one exits at once while it runs, and the cmod plugin of each such session starts one again once that file is gone or 15 seconds old, so a machine runs one watcher however many sessions it has open. Before each touch it reads the newest cmod in the cmod store, the newest version folder of `bin/cmod` that the launcher runs. A `cmod watch` older than that exits and lets go of `watch.lock`, so after a cmod update the new cmod's watcher judges the linked mods by its own rules within 15 seconds.
|
|
237
236
|
|
|
238
237
|
A cmod before 4.1.0 linked a checkout by writing it into `CLAUDE_CODE_PLUGIN_DIRS` in the `env` block of Claude Code's `settings.json`. `cmod watch` at its start, and `cmod setup`, link each folder still in that list as `cmod link` does now and take it out of the list. A folder that fails to link stays in the list, and its error prints on stderr.
|
|
239
238
|
|
package/package.json
CHANGED
package/records.d.ts
CHANGED
|
@@ -58,6 +58,10 @@ export declare function storeFolder(env: Record<string, string | undefined>): st
|
|
|
58
58
|
export declare function recordPath(store: string, name: string): string;
|
|
59
59
|
export declare function programPath(store: string, program: string, version: string): string;
|
|
60
60
|
export declare function isProgramNewer(record: InstallRecord, programModifiedMs: number | undefined): boolean;
|
|
61
|
+
export declare function readCmodVersion(files: {
|
|
62
|
+
list: (folder: string) => Promise<readonly string[]>;
|
|
63
|
+
exists: (path: string) => Promise<boolean>;
|
|
64
|
+
}, store: string): Promise<string | undefined>;
|
|
61
65
|
export declare function dataFolder(store: string, name: string): string;
|
|
62
66
|
export declare function configFolder(env: Record<string, string | undefined>, name: string): string;
|
|
63
67
|
export declare function configFolders(env: Record<string, string | undefined>, name: string, root: string): {
|
|
@@ -99,7 +103,7 @@ export type Preferences = {
|
|
|
99
103
|
};
|
|
100
104
|
export declare function parsePreferences(value: unknown, path: string): Preferences;
|
|
101
105
|
export declare function parseConsent(value: unknown, path: string): Record<string, string[]>;
|
|
102
|
-
export declare const coreVersion = "4.3.
|
|
106
|
+
export declare const coreVersion = "4.3.2";
|
|
103
107
|
export declare function hotkeyCommand(mod: string, hotkey: string): string;
|
|
104
108
|
export declare function hotkeyBindings(mod: string, hotkeys: Hotkeys | undefined): Record<string, string>;
|
|
105
109
|
export declare function boundCombos(keybindings: unknown): Map<string, string>;
|
package/records.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["src/records.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,OAAO,EAAE,MAAM,cAAc,CAAA;AAG1E,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACtC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAA;IACrC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAA;CACnC,CAAA;AAED,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,eAAe,YAAI,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAA;AAC7E,eAAO,MAAM,eAAe,YAAI,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAU,CAAA;A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ermissions, ...flagPermissions];
|
|
6
6
|
const hostName = /^[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?)*$/;
|
|
7
7
|
const programName = /^[A-Za-z0-9][A-Za-z0-9._+-]*$/;
|
|
8
|
+
const releaseVersion = /^\d+\.\d+\.\d+$/;
|
|
8
9
|
const settingPath = /^[A-Za-z][A-Za-z0-9]*(\.[A-Za-z0-9_@-]+)*$/;
|
|
9
10
|
const listItemHint = {
|
|
10
11
|
network: 'a host alone, such as "api.github.com", or a socket path, such as "/var/run/docker.sock"',
|
|
@@ -31,6 +32,15 @@ export function programPath(store, program, version) {
|
|
|
31
32
|
export function isProgramNewer(record, programModifiedMs) {
|
|
32
33
|
return record.program !== null && (programModifiedMs === undefined || programModifiedMs > Date.parse(record.installedAt));
|
|
33
34
|
}
|
|
35
|
+
export async function readCmodVersion(files, store) {
|
|
36
|
+
if (!(await files.exists(`${store}/programs/cmod`)))
|
|
37
|
+
return undefined;
|
|
38
|
+
const newestFirst = (await files.list(`${store}/bin/cmod`)).filter((name) => releaseVersion.test(name)).toSorted((one, other) => (isAtLeast(one, other) ? -1 : 1));
|
|
39
|
+
for (const version of newestFirst)
|
|
40
|
+
if (await files.exists(programPath(store, 'cmod', version)))
|
|
41
|
+
return version;
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
34
44
|
export function dataFolder(store, name) {
|
|
35
45
|
return `${store}/data/${checkedName(name)}`;
|
|
36
46
|
}
|
|
@@ -284,7 +294,7 @@ function readHotkeys(hotkeys) {
|
|
|
284
294
|
throw new Error(`package.json "cmod.hotkeys" is not a map of hotkeys to their title and optional default combo. ${fix}`);
|
|
285
295
|
return { hotkeys: checkHotkeys('package.json "cmod"', hotkeys) };
|
|
286
296
|
}
|
|
287
|
-
export const coreVersion = '4.3.
|
|
297
|
+
export const coreVersion = '4.3.2';
|
|
288
298
|
export function hotkeyCommand(mod, hotkey) {
|
|
289
299
|
return `${mod}--${hotkey}`;
|
|
290
300
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../src/runtime/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAqB,WAAW,EAAE,MAAM,EAAc,aAAa,EAAwB,MAAM,aAAa,CAAA;AAGxI,OAAO,KAAK,EAAoB,GAAG,EAAE,aAAa,EAA8G,MAAM,WAAW,CAAA;AACjL,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,eAAe,CAAA;AAC1D,OAAO,
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../src/runtime/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAqB,WAAW,EAAE,MAAM,EAAc,aAAa,EAAwB,MAAM,aAAa,CAAA;AAGxI,OAAO,KAAK,EAAoB,GAAG,EAAE,aAAa,EAA8G,MAAM,WAAW,CAAA;AACjL,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,eAAe,CAAA;AAC1D,OAAO,EAA6T,KAAK,KAAK,EAAE,MAAM,eAAe,CAAA;AAGrW,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAOzC,OAAO,EAA6F,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AACxI,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAO7D,OAAO,EAA6B,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AAMxE,OAAO,EAA+B,KAAK,UAAU,EAAgB,MAAM,cAAc,CAAA;AAWzF,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC,QA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KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACpF,CAAA;AAuDD,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA2BhE;AAmCD,wBAAgB,eAAe,CAAC,KAAK,SAAS,MAAM,EAAE,QAAQ,SAAS,OAAO,GAAG,OAAO,EACtF,UAAU,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAClD,gBAAgB,GAAE,MAAM,gBAAgB,GAAG,SAA2B,EACtE,OAAO,GAAE,aAAkB,EAC3B,UAAU,UAAO,GAChB,SAAS,CAAC,KAAK,CAAC,CAqkBlB"}
|
package/runtime/lifecycle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { consentPath, dataFolder, finishStepsMethod, grantFix, coreVersion, isAtLeast, isProgramNewer, marketplaceOf, parseConsent, pendingStepsMethod, parseEvent, permissionWords, programPath, readRecord, readSteps, recordPath, scriptsSha256, storeFolder, updatesToTurnOn } from '../records.js';
|
|
1
|
+
import { consentPath, dataFolder, finishStepsMethod, grantFix, coreVersion, isAtLeast, isProgramNewer, marketplaceOf, parseConsent, pendingStepsMethod, parseEvent, permissionWords, programPath, readCmodVersion, readRecord, readSteps, recordPath, scriptsSha256, storeFolder, updatesToTurnOn } from '../records.js';
|
|
2
2
|
import { homePrefix, ifMissing, relativePath } from '../utils/paths.js';
|
|
3
3
|
import { firstLine, formatExit, messageOf } from '../utils/text.js';
|
|
4
4
|
import { beforeDeadline } from './deadline.js';
|
|
@@ -97,17 +97,11 @@ async function readJson(read, path) {
|
|
|
97
97
|
}
|
|
98
98
|
async function cmodVersion(claude) {
|
|
99
99
|
const store = storeFolder({ HOME: await claude.env.home(), XDG_DATA_HOME: await claude.env.dataHome() });
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const newestFirst = versions.toSorted((one, other) => (isAtLeast(one, other) ? -1 : 1));
|
|
105
|
-
for (const version of newestFirst)
|
|
106
|
-
if (await exists(`${store}/bin/cmod/${version}/cmod`))
|
|
107
|
-
return version;
|
|
108
|
-
return undefined;
|
|
100
|
+
return readCmodVersion({
|
|
101
|
+
list: async (folder) => (await claude.fs.list(folder).catch(ifMissing([]))).map((entry) => entry.name),
|
|
102
|
+
exists: async (path) => (await claude.fs.stat(path).catch(ifMissing(undefined))) !== undefined,
|
|
103
|
+
}, store);
|
|
109
104
|
}
|
|
110
|
-
const releaseVersion = /^\d+\.\d+\.\d+$/;
|
|
111
105
|
export function createLifecycle(definition, permissionRoutes = () => undefined, options = {}, asksPerson = true) {
|
|
112
106
|
let router = createRouter();
|
|
113
107
|
let phase = 'starting';
|
package/src/records.ts
CHANGED
|
@@ -29,6 +29,7 @@ export type FlagPermission = (typeof flagPermissions)[number]
|
|
|
29
29
|
const permissionNames: readonly string[] = [...listPermissions, ...flagPermissions]
|
|
30
30
|
const hostName = /^[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?)*$/
|
|
31
31
|
const programName = /^[A-Za-z0-9][A-Za-z0-9._+-]*$/
|
|
32
|
+
const releaseVersion = /^\d+\.\d+\.\d+$/
|
|
32
33
|
const settingPath = /^[A-Za-z][A-Za-z0-9]*(\.[A-Za-z0-9_@-]+)*$/
|
|
33
34
|
const listItemHint: Readonly<Record<ListPermission, string>> = {
|
|
34
35
|
network: 'a host alone, such as "api.github.com", or a socket path, such as "/var/run/docker.sock"',
|
|
@@ -70,6 +71,13 @@ export function isProgramNewer(record: InstallRecord, programModifiedMs: number
|
|
|
70
71
|
return record.program !== null && (programModifiedMs === undefined || programModifiedMs > Date.parse(record.installedAt))
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
export async function readCmodVersion(files: { list: (folder: string) => Promise<readonly string[]>; exists: (path: string) => Promise<boolean> }, store: string): Promise<string | undefined> {
|
|
75
|
+
if (!(await files.exists(`${store}/programs/cmod`))) return undefined
|
|
76
|
+
const newestFirst = (await files.list(`${store}/bin/cmod`)).filter((name) => releaseVersion.test(name)).toSorted((one, other) => (isAtLeast(one, other) ? -1 : 1))
|
|
77
|
+
for (const version of newestFirst) if (await files.exists(programPath(store, 'cmod', version))) return version
|
|
78
|
+
return undefined
|
|
79
|
+
}
|
|
80
|
+
|
|
73
81
|
export function dataFolder(store: string, name: string): string {
|
|
74
82
|
return `${store}/data/${checkedName(name)}`
|
|
75
83
|
}
|
|
@@ -331,7 +339,7 @@ function readHotkeys(hotkeys: unknown): Steps {
|
|
|
331
339
|
return { hotkeys: checkHotkeys('package.json "cmod"', hotkeys as Record<string, HotkeyInit>) }
|
|
332
340
|
}
|
|
333
341
|
|
|
334
|
-
export const coreVersion = '4.3.
|
|
342
|
+
export const coreVersion = '4.3.2'
|
|
335
343
|
|
|
336
344
|
export function hotkeyCommand(mod: string, hotkey: string): string {
|
|
337
345
|
return `${mod}--${hotkey}`
|
package/src/runtime/lifecycle.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Step } from '../installer.js'
|
|
|
3
3
|
|
|
4
4
|
import type { Allowed, Imports, Mod, ModDefinition, Reservation, SettingsFile, SettingsFileChange, SettingsFileChangeListener, Subscription, Timer as ModTimer } from '../mod.js'
|
|
5
5
|
import type { Options, OptionValues } from '../options.js'
|
|
6
|
-
import { consentPath, dataFolder, finishStepsMethod, grantFix, coreVersion, isAtLeast, isProgramNewer, marketplaceOf, parseConsent, pendingStepsMethod, parseEvent, permissionWords, programPath, readRecord, readSteps, recordPath, scriptsSha256, storeFolder, updatesToTurnOn, type ReadFile, type RunnerEvent, type Steps } from '../records.js'
|
|
6
|
+
import { consentPath, dataFolder, finishStepsMethod, grantFix, coreVersion, isAtLeast, isProgramNewer, marketplaceOf, parseConsent, pendingStepsMethod, parseEvent, permissionWords, programPath, readCmodVersion, readRecord, readSteps, recordPath, scriptsSha256, storeFolder, updatesToTurnOn, type ReadFile, type RunnerEvent, type Steps } from '../records.js'
|
|
7
7
|
import { homePrefix, ifMissing, relativePath } from '../utils/paths.js'
|
|
8
8
|
import { firstLine, formatExit, messageOf } from '../utils/text.js'
|
|
9
9
|
import type { Claude } from './claude.js'
|
|
@@ -168,16 +168,15 @@ async function readJson(read: ReadFile, path: string): Promise<unknown> {
|
|
|
168
168
|
|
|
169
169
|
async function cmodVersion(claude: Claude): Promise<string | undefined> {
|
|
170
170
|
const store = storeFolder({ HOME: await claude.env.home(), XDG_DATA_HOME: await claude.env.dataHome() })
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
return readCmodVersion(
|
|
172
|
+
{
|
|
173
|
+
list: async (folder) => (await claude.fs.list(folder).catch(ifMissing([]))).map((entry) => entry.name),
|
|
174
|
+
exists: async (path) => (await claude.fs.stat(path).catch(ifMissing(undefined))) !== undefined,
|
|
175
|
+
},
|
|
176
|
+
store,
|
|
177
|
+
)
|
|
177
178
|
}
|
|
178
179
|
|
|
179
|
-
const releaseVersion = /^\d+\.\d+\.\d+$/
|
|
180
|
-
|
|
181
180
|
export function createLifecycle<State extends object, Declared extends Options = Options>(
|
|
182
181
|
definition: ModDefinition<State, string, Declared>,
|
|
183
182
|
permissionRoutes: () => PermissionRoutes | undefined = () => undefined,
|