@g3nomaly/mods 0.0.0-stage → 0.1.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.
- package/LICENSE +95 -0
- package/README.md +95 -2
- package/dist/cli/commands/add.d.ts +15 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/add.js +25 -0
- package/dist/cli/commands/add.js.map +1 -0
- package/dist/cli/commands/init.d.ts +13 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +24 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/ls.d.ts +12 -0
- package/dist/cli/commands/ls.d.ts.map +1 -0
- package/dist/cli/commands/ls.js +20 -0
- package/dist/cli/commands/ls.js.map +1 -0
- package/dist/cli/commands/remove.d.ts +12 -0
- package/dist/cli/commands/remove.d.ts.map +1 -0
- package/dist/cli/commands/remove.js +28 -0
- package/dist/cli/commands/remove.js.map +1 -0
- package/dist/cli/commands/source.d.ts +29 -0
- package/dist/cli/commands/source.d.ts.map +1 -0
- package/dist/cli/commands/source.js +30 -0
- package/dist/cli/commands/source.js.map +1 -0
- package/dist/cli/commands/update.d.ts +12 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +13 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +95 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/project.d.ts +49 -0
- package/dist/cli/project.d.ts.map +1 -0
- package/dist/cli/project.js +58 -0
- package/dist/cli/project.js.map +1 -0
- package/dist/cli/viewer.d.ts +11 -0
- package/dist/cli/viewer.d.ts.map +1 -0
- package/dist/cli/viewer.js +32 -0
- package/dist/cli/viewer.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/registry/index.d.ts +7 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +7 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/locate.d.ts +16 -0
- package/dist/registry/locate.d.ts.map +1 -0
- package/dist/registry/locate.js +41 -0
- package/dist/registry/locate.js.map +1 -0
- package/dist/registry/manifest.d.ts +8 -0
- package/dist/registry/manifest.d.ts.map +1 -0
- package/dist/registry/manifest.js +13 -0
- package/dist/registry/manifest.js.map +1 -0
- package/dist/registry/readModDir.d.ts +20 -0
- package/dist/registry/readModDir.d.ts.map +1 -0
- package/dist/registry/readModDir.js +79 -0
- package/dist/registry/readModDir.js.map +1 -0
- package/dist/registry/readSource.d.ts +9 -0
- package/dist/registry/readSource.d.ts.map +1 -0
- package/dist/registry/readSource.js +27 -0
- package/dist/registry/readSource.js.map +1 -0
- package/dist/registry/types.d.ts +54 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +20 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/sources/builtins.d.ts +4 -0
- package/dist/sources/builtins.d.ts.map +1 -0
- package/dist/sources/builtins.js +5 -0
- package/dist/sources/builtins.js.map +1 -0
- package/dist/sources/index.d.ts +2 -0
- package/dist/sources/index.d.ts.map +1 -0
- package/dist/sources/index.js +3 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/viewer/extension.d.ts +18 -0
- package/dist/viewer/extension.d.ts.map +1 -0
- package/dist/viewer/extension.js +43 -0
- package/dist/viewer/extension.js.map +1 -0
- package/dist/viewer/index.d.ts +5 -0
- package/dist/viewer/index.d.ts.map +1 -0
- package/dist/viewer/index.js +4 -0
- package/dist/viewer/index.js.map +1 -0
- package/dist/viewer/settings.d.ts +31 -0
- package/dist/viewer/settings.d.ts.map +1 -0
- package/dist/viewer/settings.js +44 -0
- package/dist/viewer/settings.js.map +1 -0
- package/package.json +37 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
Copyright (c) 2026 G3NTs - G3nomaly
|
|
2
|
+
|
|
3
|
+
Elastic License 2.0
|
|
4
|
+
|
|
5
|
+
URL: https://www.elastic.co/licensing/elastic-license
|
|
6
|
+
|
|
7
|
+
## Acceptance
|
|
8
|
+
|
|
9
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
10
|
+
|
|
11
|
+
## Copyright License
|
|
12
|
+
|
|
13
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
14
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
15
|
+
available, and prepare derivative works of the software, in each case subject to
|
|
16
|
+
the limitations and conditions below.
|
|
17
|
+
|
|
18
|
+
## Limitations
|
|
19
|
+
|
|
20
|
+
You may not provide the software to third parties as a hosted or managed
|
|
21
|
+
service, where the service provides users with access to any substantial set of
|
|
22
|
+
the features or functionality of the software.
|
|
23
|
+
|
|
24
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
25
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
26
|
+
software that is protected by the license key.
|
|
27
|
+
|
|
28
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices
|
|
29
|
+
of the licensor in the software. Any use of the licensor’s trademarks is subject
|
|
30
|
+
to applicable law.
|
|
31
|
+
|
|
32
|
+
## Patents
|
|
33
|
+
|
|
34
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
35
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
36
|
+
sale, import and have imported the software, in each case subject to the
|
|
37
|
+
limitations and conditions in this license. This license does not cover any
|
|
38
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
39
|
+
the software. If you or your company make any written claim that the software
|
|
40
|
+
infringes or contributes to infringement of any patent, your patent license for
|
|
41
|
+
the software granted under these terms ends immediately. If your company makes
|
|
42
|
+
such a claim, your patent license ends immediately for work on behalf of your
|
|
43
|
+
company.
|
|
44
|
+
|
|
45
|
+
## Notices
|
|
46
|
+
|
|
47
|
+
You must ensure that anyone who gets a copy of any part of the software from you
|
|
48
|
+
also gets a copy of these terms.
|
|
49
|
+
|
|
50
|
+
If you modify the software, you must include in any modified copies of the
|
|
51
|
+
software prominent notices stating that you have modified the software.
|
|
52
|
+
|
|
53
|
+
## No Other Rights
|
|
54
|
+
|
|
55
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
56
|
+
these terms.
|
|
57
|
+
|
|
58
|
+
## Termination
|
|
59
|
+
|
|
60
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
61
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
62
|
+
with a notice of your violation, and you cease all violation of this license no
|
|
63
|
+
later than 30 days after you receive that notice, your licenses will be
|
|
64
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
65
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
66
|
+
to terminate automatically and permanently.
|
|
67
|
+
|
|
68
|
+
## No Liability
|
|
69
|
+
|
|
70
|
+
*As far as the law allows, the software comes as is, without any warranty or
|
|
71
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
72
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
73
|
+
legal claim.*
|
|
74
|
+
|
|
75
|
+
## Definitions
|
|
76
|
+
|
|
77
|
+
The **licensor** is the entity offering these terms, and the **software** is the
|
|
78
|
+
software the licensor makes available under these terms, including any portion
|
|
79
|
+
of it.
|
|
80
|
+
|
|
81
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
82
|
+
|
|
83
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
84
|
+
organization that you work for, plus all organizations that have control over,
|
|
85
|
+
are under the control of, or are under common control with that
|
|
86
|
+
organization. **control** means ownership of substantially all the assets of an
|
|
87
|
+
entity, or the power to direct its management and policies by vote, contract, or
|
|
88
|
+
otherwise. Control can be direct or indirect.
|
|
89
|
+
|
|
90
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
91
|
+
these terms.
|
|
92
|
+
|
|
93
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
94
|
+
|
|
95
|
+
**trademark** means trademarks, service marks, and similar rights.
|
package/README.md
CHANGED
|
@@ -1,3 +1,96 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @g3nomaly/mods
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`g3n-mods` installs Claude Code mods into a project. A mod adds a pane, a status line, a slash command or a hook to Claude Code. The g3n mods from [`@g3nomaly/g3n-mods`](../g3n-mods) are available by default, and you can register other sources: a git repository, an npm package or a local folder.
|
|
4
|
+
|
|
5
|
+
Mods are drawn by the Claude Code extension for VS Code. They also load in the terminal, but they are built for the extension.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- [Bun](https://bun.sh)
|
|
10
|
+
- Claude Code for VS Code (`anthropic.claude-code`) 2.1.296 or newer
|
|
11
|
+
- A git repository to install into, unless you install with `--user`
|
|
12
|
+
|
|
13
|
+
## Install the mods
|
|
14
|
+
|
|
15
|
+
Run these from the root of your project:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
bunx @g3nomaly/mods init # creates .claude/mods.json and sets up VS Code
|
|
19
|
+
bunx @g3nomaly/mods ls # lists the mods you can install
|
|
20
|
+
bunx @g3nomaly/mods add context-bar # installs one mod
|
|
21
|
+
bunx @g3nomaly/mods add g3n-mods # or every mod from the g3n-mods source
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then open the project in VS Code and trust the workspace when asked. Claude Code does not load mods from an untrusted workspace. New sessions load the mods. In a session that is already open, run `/reload-plugins`.
|
|
25
|
+
|
|
26
|
+
Mods are copied to `.claude/skills/<mod>/`, where Claude Code finds them, and recorded in `.claude/mods.json`. Commit both if your team should get the same mods.
|
|
27
|
+
|
|
28
|
+
To install for every project instead of one, add `--user` to any command. Mods then go to `~/.claude/`.
|
|
29
|
+
|
|
30
|
+
## The g3n mods
|
|
31
|
+
|
|
32
|
+
| Mod | What it does | Command |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| `context-bar` | One bar of context-window use split by source, with the total and where compaction starts | `/context-bar` |
|
|
35
|
+
| `tool-timeline` | Each tool call with its duration. A denied call is struck through, next to the call that replaced it | `/tool-timeline` |
|
|
36
|
+
| `delete-guard` | Denies `rm -rf` and other permanent deletes and points Claude to the trash | `/delete-guard on \| off` |
|
|
37
|
+
| `agents-panel` | The agents in `.claude/agents` with their model and a run button | `/agents-panel` |
|
|
38
|
+
| `focus-mode` | A timed focus block with a countdown and an end button | `/focus-mode [minutes] \| end` |
|
|
39
|
+
| `hide-personal-data` | Masks names, emails and other personal data in replies. Hover to show them | `/hide-personal-data on \| off` |
|
|
40
|
+
| `mini-game` | Minesweeper, to play while Claude works | `/mini-game` |
|
|
41
|
+
| `custom-crab-agents` | Each subagent as a crab with a hat: effort, model, steps, tokens, cost and time | `/crabs` |
|
|
42
|
+
| `handoff` | Writes a handoff, clears the session, and gives the handoff to your next prompt | `/handoff-new [what the next session is for]` |
|
|
43
|
+
| `you-should-know` | A card under long replies with their key point. It makes one small Haiku call per long reply | none |
|
|
44
|
+
|
|
45
|
+
Each pane opens with its command. For `context-bar`, `tool-timeline`, `agents-panel` and `custom-crab-agents`, running the command again closes the pane.
|
|
46
|
+
|
|
47
|
+
## Showing mods in VS Code
|
|
48
|
+
|
|
49
|
+
`init` writes two settings to `.vscode/settings.json`:
|
|
50
|
+
|
|
51
|
+
- `claudeCode.preferredLocation`: `panel` opens Claude in an editor tab, where panes have room. Pass `--location sidebar` to keep it in the side bar.
|
|
52
|
+
- `claudeCode.useTerminal`: `false`, because mods are drawn in the extension's own UI, not in the terminal.
|
|
53
|
+
|
|
54
|
+
The other settings in the file are kept. If the file has comments, `init` leaves it alone and prints the two settings to add by hand.
|
|
55
|
+
|
|
56
|
+
To give Claude a window of its own, run **Claude Code: Open in New Window** from the command palette.
|
|
57
|
+
|
|
58
|
+
## Keep mods up to date
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
bunx @g3nomaly/mods update # every installed mod
|
|
62
|
+
bunx @g3nomaly/mods update focus-mode # one mod
|
|
63
|
+
bunx @g3nomaly/mods update --dry-run # shows what would change
|
|
64
|
+
bunx @g3nomaly/mods remove mini-game
|
|
65
|
+
bunx @g3nomaly/mods ls --installed
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
When you have changed an installed file, `update` asks whether to keep your change or overwrite it. Pass `-f` to overwrite without asking, for example in a script.
|
|
69
|
+
|
|
70
|
+
## Other sources
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
bunx @g3nomaly/mods source add owner/repo # a GitHub repository
|
|
74
|
+
bunx @g3nomaly/mods source add https://git.example.com/mods.git --ref v1
|
|
75
|
+
bunx @g3nomaly/mods source add npm:some-mods # an npm package
|
|
76
|
+
bunx @g3nomaly/mods source add ./my-mods --name mine # a local folder
|
|
77
|
+
bunx @g3nomaly/mods source ls
|
|
78
|
+
bunx @g3nomaly/mods add some-mod@mine # a mod from one source
|
|
79
|
+
bunx @g3nomaly/mods source remove mine
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`g3n-mods` is built in and cannot be removed.
|
|
83
|
+
|
|
84
|
+
A source lists its mods in `.claude-plugin/marketplace.json`. Without one, the source is read as one mod, or as a folder of mods under `mods/`. A mod is a plugin folder with `.claude-plugin/plugin.json` and `hooks/hooks.json`, and the folder name must match the plugin name. Mods are TypeScript only: a mod with any `.js`, `.mjs`, `.cjs` or `.jsx` file is refused.
|
|
85
|
+
|
|
86
|
+
## Development
|
|
87
|
+
|
|
88
|
+
Run `bun install` at the repository root first, then every command from this directory.
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
bun run mods -- ls # the CLI from source
|
|
92
|
+
bun run typecheck
|
|
93
|
+
bun run build
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The reasons behind the design are in [`documentation/spec/mods/decisions.md`](../../documentation/spec/mods/decisions.md).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { InstallOptions } from "@g3nomaly/core/cli";
|
|
2
|
+
import type { ProjectDeps, Scope } from "../project";
|
|
3
|
+
export interface AddOptions extends InstallOptions {
|
|
4
|
+
scope?: Scope;
|
|
5
|
+
/** Read only this registered source */
|
|
6
|
+
source?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Installs mods, or every mod of a source, from the registered sources into
|
|
10
|
+
* the scope's `.claude/skills/`, records them in `mods.json` and sets up the
|
|
11
|
+
* viewer. A name more than one source offers is picked as `<name>@<source>`;
|
|
12
|
+
* with no names the user picks from what the sources provide.
|
|
13
|
+
*/
|
|
14
|
+
export declare function addCommand(names: string[], options?: AddOptions, deps?: ProjectDeps): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGrD,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,KAAK,CAAC,EAAG,KAAK,CAAC;IACf,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAAe,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAajH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// packages/mods/src/cli/commands/add.ts
|
|
2
|
+
import { addFromSources, c, lineInfo } from "@g3nomaly/core/cli";
|
|
3
|
+
import { MOD_CONTEXT, installedMods, openModProject, openModRegistry } from "../project";
|
|
4
|
+
import { setUpViewer } from "../viewer";
|
|
5
|
+
/**
|
|
6
|
+
* Installs mods, or every mod of a source, from the registered sources into
|
|
7
|
+
* the scope's `.claude/skills/`, records them in `mods.json` and sets up the
|
|
8
|
+
* viewer. A name more than one source offers is picked as `<name>@<source>`;
|
|
9
|
+
* with no names the user picks from what the sources provide.
|
|
10
|
+
*/
|
|
11
|
+
export async function addCommand(names, options = {}, deps = {}) {
|
|
12
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
13
|
+
const registry = await openModRegistry(project, options.source);
|
|
14
|
+
try {
|
|
15
|
+
await addFromSources([project.target], names, registry, options, MOD_CONTEXT);
|
|
16
|
+
}
|
|
17
|
+
finally {
|
|
18
|
+
registry.dispose();
|
|
19
|
+
}
|
|
20
|
+
if (Object.keys(installedMods(project)).length > 0) {
|
|
21
|
+
setUpViewer(project);
|
|
22
|
+
console.log(lineInfo(`New sessions load the mods; in a running one, run ${c.cmd("/reload-plugins")}.`));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,cAAc,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEzF,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAQxC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAe,EAAE,OAAO,GAAe,EAAE,EAAE,IAAI,GAAgB,EAAE;IAChG,MAAM,OAAO,GAAI,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,SAAS,EAAE,IAAI,CAAC,CAAC;IAClE,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAChE,IAAI,CAAC;QACH,MAAM,cAAc,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IAChF,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnD,WAAW,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,qDAAqD,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1G,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ViewerLocation } from "../../viewer";
|
|
2
|
+
import type { ProjectDeps, Scope } from "../project";
|
|
3
|
+
export interface InitOptions {
|
|
4
|
+
scope?: Scope;
|
|
5
|
+
/** Where Claude opens in VS Code; a location already set is kept when absent */
|
|
6
|
+
location?: ViewerLocation;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Creates the scope's `mods.json` when missing, sets up the viewer, and lists
|
|
10
|
+
* the sources mods can be installed from.
|
|
11
|
+
*/
|
|
12
|
+
export declare function initCommand(options?: InitOptions, deps?: ProjectDeps): void;
|
|
13
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAIrD,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAK,KAAK,CAAC;IACjB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,WAAgB,EAAE,IAAI,GAAE,WAAgB,GAAG,IAAI,CAYnF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// packages/mods/src/cli/commands/init.ts
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { c, lineSuccess } from "@g3nomaly/core/cli";
|
|
4
|
+
import { saveInstallManifest } from "@g3nomaly/core/installer";
|
|
5
|
+
import { ModMetaSchema } from "../../registry/types";
|
|
6
|
+
import { openModProject } from "../project";
|
|
7
|
+
import { setUpViewer } from "../viewer";
|
|
8
|
+
import { sourceLsCommand } from "./source";
|
|
9
|
+
/**
|
|
10
|
+
* Creates the scope's `mods.json` when missing, sets up the viewer, and lists
|
|
11
|
+
* the sources mods can be installed from.
|
|
12
|
+
*/
|
|
13
|
+
export function initCommand(options = {}, deps = {}) {
|
|
14
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
15
|
+
if (!fs.existsSync(project.target.manifest.filePath)) {
|
|
16
|
+
saveInstallManifest(project.target.manifest, ModMetaSchema);
|
|
17
|
+
console.log(lineSuccess(`Created ${c.file(project.target.manifest.filePath)}`));
|
|
18
|
+
}
|
|
19
|
+
setUpViewer(project, options.location);
|
|
20
|
+
console.log(c.header("\nSources"));
|
|
21
|
+
sourceLsCommand({ scope: project.scope }, deps);
|
|
22
|
+
console.log(`\nRun ${c.cmd("g3n-mods ls")} to see the mods, ${c.cmd("g3n-mods add <mod>")} to install one.`);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE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
|
5
|
+
/** List what `mods.json` records instead of what the sources provide */
|
|
6
|
+
installed?: boolean;
|
|
7
|
+
/** Only the mods of this registered source */
|
|
8
|
+
source?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Lists the mods the scope's sources provide, `●` marking installed ones, or with `installed` only what is installed. */
|
|
11
|
+
export declare function lsCommand(options?: LsOptions, deps?: ProjectDeps): Promise<void>;
|
|
12
|
+
//# sourceMappingURL=ls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/ls.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C,KAAK,CAAC,EAAM,KAAK,CAAC;IAClB,wEAAwE;IACxE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8CAA8C;IAC9C,MAAM,CAAC,EAAK,MAAM,CAAC;CACpB;AAED,0HAA0H;AAC1H,wBAAsB,SAAS,CAAC,OAAO,GAAE,SAAc,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAe9F"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// packages/mods/src/cli/commands/ls.ts
|
|
2
|
+
import { lsEntries, lsSourceRegistry } from "@g3nomaly/core/cli";
|
|
3
|
+
import { installedMods, openModProject, openModRegistry, modSources } from "../project";
|
|
4
|
+
/** Lists the mods the scope's sources provide, `●` marking installed ones, or with `installed` only what is installed. */
|
|
5
|
+
export async function lsCommand(options = {}, deps = {}) {
|
|
6
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
7
|
+
const installed = installedMods(project);
|
|
8
|
+
if (options.installed === true) {
|
|
9
|
+
lsEntries(installed, options);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const registry = await openModRegistry(project, options.source);
|
|
13
|
+
try {
|
|
14
|
+
lsSourceRegistry(registry, modSources(project), installed, options);
|
|
15
|
+
}
|
|
16
|
+
finally {
|
|
17
|
+
registry.dispose();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ls.js","sourceRoot":"","sources":["../../../src/cli/commands/ls.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAWxF,0HAA0H;AAC1H,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAO,GAAc,EAAE,EAAE,IAAI,GAAgB,EAAE;IAC7E,MAAM,OAAO,GAAK,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,SAAS,EAAE,IAAI,CAAC,CAAC;IACnE,MAAM,SAAS,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAEzC,IAAI,OAAO,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;QAC/B,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC9B,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAChE,IAAI,CAAC;QACH,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { InstallOptions } from "@g3nomaly/core/cli";
|
|
2
|
+
import type { ProjectDeps, Scope } from "../project";
|
|
3
|
+
export interface RemoveOptions extends InstallOptions {
|
|
4
|
+
scope?: Scope;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Removes installed mods, or every mod of a source, with the type
|
|
8
|
+
* declarations Claude Code wrote beside them, and drops them from
|
|
9
|
+
* `mods.json`. With no names the user picks from what is installed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function removeCommand(names: string[], options?: RemoveOptions, deps?: ProjectDeps): Promise<void>;
|
|
12
|
+
//# sourceMappingURL=remove.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/remove.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,oBAAoB,CAAC;AAGzE,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAeD;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,aAAkB,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvH"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// packages/mods/src/cli/commands/remove.ts
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { removeFromTargets } from "@g3nomaly/core/cli";
|
|
5
|
+
import { createInstallerIO, pruneEmptyDirs } from "@g3nomaly/core/installer";
|
|
6
|
+
import { MOD_CONTEXT, openModProject } from "../project";
|
|
7
|
+
/** Folder Claude Code writes the mod API's declarations into when it loads a mod; never recorded in `mods.json`. */
|
|
8
|
+
const ENGINE_TYPES_DIR = path.join(".claude-plugin", "types");
|
|
9
|
+
/** Deletes the declarations Claude Code wrote into removed mods, then their emptied folders. */
|
|
10
|
+
function removeEngineTypes(target, removed) {
|
|
11
|
+
const io = createInstallerIO();
|
|
12
|
+
for (const key of removed) {
|
|
13
|
+
const typesDir = path.join(target.installDir, key, ENGINE_TYPES_DIR);
|
|
14
|
+
if (fs.existsSync(typesDir))
|
|
15
|
+
fs.rmSync(typesDir, { recursive: true });
|
|
16
|
+
pruneEmptyDirs(path.dirname(typesDir), target.installDir, io);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Removes installed mods, or every mod of a source, with the type
|
|
21
|
+
* declarations Claude Code wrote beside them, and drops them from
|
|
22
|
+
* `mods.json`. With no names the user picks from what is installed.
|
|
23
|
+
*/
|
|
24
|
+
export async function removeCommand(names, options = {}, deps = {}) {
|
|
25
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
26
|
+
await removeFromTargets([project.target], names, options, MOD_CONTEXT, removeEngineTypes);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../src/cli/commands/remove.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAOzD,oHAAoH;AACpH,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;AAE9D,gGAAgG;AAChG,SAAS,iBAAiB,CAAC,MAAsB,EAAE,OAAiB;IAClE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAC/B,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC;QACrE,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtE,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAe,EAAE,OAAO,GAAkB,EAAE,EAAE,IAAI,GAAgB,EAAE;IACtG,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,SAAS,EAAE,IAAI,CAAC,CAAC;IACjE,MAAM,iBAAiB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC;AAC5F,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ProjectDeps, Scope } from "../project";
|
|
2
|
+
export interface SourceAddOptions {
|
|
3
|
+
scope?: Scope;
|
|
4
|
+
/** Name to register under; derived from the spec when absent */
|
|
5
|
+
name?: string;
|
|
6
|
+
/** Branch or tag of a git source */
|
|
7
|
+
ref?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SourceLsOptions {
|
|
10
|
+
scope?: Scope;
|
|
11
|
+
json?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface SourceRemoveOptions {
|
|
14
|
+
scope?: Scope;
|
|
15
|
+
/** Unregister even while installed mods come from the source */
|
|
16
|
+
force?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Registers a git repository, npm package or local folder as a mod source in
|
|
20
|
+
* the scope's `mods.json`, after checking it provides at least one mod. A
|
|
21
|
+
* local path is stored relative to the project root, and absolute for the
|
|
22
|
+
* user scope, which every project shares.
|
|
23
|
+
*/
|
|
24
|
+
export declare function sourceAddCommand(input: string, options?: SourceAddOptions, deps?: ProjectDeps): Promise<void>;
|
|
25
|
+
/** Lists the built-in and registered sources of the scope, with how many installed mods came from each. */
|
|
26
|
+
export declare function sourceLsCommand(options?: SourceLsOptions, deps?: ProjectDeps): void;
|
|
27
|
+
/** Unregisters a source; refused for built-in sources and, unless forced, while installed mods came from it. */
|
|
28
|
+
export declare function sourceRemoveCommand(name: string, options?: SourceRemoveOptions, deps?: ProjectDeps): void;
|
|
29
|
+
//# sourceMappingURL=source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/source.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAc,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gEAAgE;IAChE,IAAI,CAAC,EAAG,MAAM,CAAC;IACf,oCAAoC;IACpC,GAAG,CAAC,EAAI,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAG,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gEAAgE;IAChE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAOD;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAG3H;AAED,2GAA2G;AAC3G,wBAAgB,eAAe,CAAC,OAAO,GAAE,eAAoB,EAAE,IAAI,GAAE,WAAgB,GAAG,IAAI,CAG3F;AAED,gHAAgH;AAChH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,EAAE,IAAI,GAAE,WAAgB,GAAG,IAAI,CAGjH"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// packages/mods/src/cli/commands/source.ts
|
|
2
|
+
import { addSourceEntries, lsSources, removeSourceEntries } from "@g3nomaly/core/cli";
|
|
3
|
+
import { readModSource } from "../../registry/readSource";
|
|
4
|
+
import { BUILTIN_SOURCES } from "../../sources/builtins";
|
|
5
|
+
import { MOD_CONTEXT, openModProject } from "../project";
|
|
6
|
+
/** What the core source commands need to know about mods in one scope. */
|
|
7
|
+
function sourceContext(project) {
|
|
8
|
+
return { ...MOD_CONTEXT, builtins: BUILTIN_SOURCES, readSource: readModSource, projectRoot: project.projectRoot };
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Registers a git repository, npm package or local folder as a mod source in
|
|
12
|
+
* the scope's `mods.json`, after checking it provides at least one mod. A
|
|
13
|
+
* local path is stored relative to the project root, and absolute for the
|
|
14
|
+
* user scope, which every project shares.
|
|
15
|
+
*/
|
|
16
|
+
export async function sourceAddCommand(input, options = {}, deps = {}) {
|
|
17
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
18
|
+
await addSourceEntries([project.target], input, { name: options.name, ref: options.ref, absolutePaths: project.scope === "user" }, sourceContext(project));
|
|
19
|
+
}
|
|
20
|
+
/** Lists the built-in and registered sources of the scope, with how many installed mods came from each. */
|
|
21
|
+
export function sourceLsCommand(options = {}, deps = {}) {
|
|
22
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
23
|
+
lsSources([project.target], options, sourceContext(project));
|
|
24
|
+
}
|
|
25
|
+
/** Unregisters a source; refused for built-in sources and, unless forced, while installed mods came from it. */
|
|
26
|
+
export function sourceRemoveCommand(name, options = {}, deps = {}) {
|
|
27
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
28
|
+
removeSourceEntries([project.target], name, options, sourceContext(project));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../../src/cli/commands/source.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEtF,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAsBzD,0EAA0E;AAC1E,SAAS,aAAa,CAAC,OAAmB;IACxC,OAAO,EAAE,GAAG,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;AACpH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAAa,EAAE,OAAO,GAAqB,EAAE,EAAE,IAAI,GAAgB,EAAE;IAC1G,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,SAAS,EAAE,IAAI,CAAC,CAAC;IACjE,MAAM,gBAAgB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,CAAC,KAAK,KAAK,MAAM,EAAE,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;AAC7J,CAAC;AAED,2GAA2G;AAC3G,MAAM,UAAU,eAAe,CAAC,OAAO,GAAoB,EAAE,EAAE,IAAI,GAAgB,EAAE;IACnF,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,SAAS,EAAE,IAAI,CAAC,CAAC;IACjE,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,gHAAgH;AAChH,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,OAAO,GAAwB,EAAE,EAAE,IAAI,GAAgB,EAAE;IACzG,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,SAAS,EAAE,IAAI,CAAC,CAAC;IACjE,mBAAmB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { InstallOptions } from "@g3nomaly/core/cli";
|
|
2
|
+
import type { ProjectDeps, Scope } from "../project";
|
|
3
|
+
export interface UpdateOptions extends InstallOptions {
|
|
4
|
+
scope?: Scope;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Re-installs installed mods from the source each one was installed from,
|
|
8
|
+
* at that source's current revision; with no names, everything installed.
|
|
9
|
+
* Files the user changed since install are kept unless overwritten.
|
|
10
|
+
*/
|
|
11
|
+
export declare function updateCommand(names: string[], options?: UpdateOptions, deps?: ProjectDeps): Promise<void>;
|
|
12
|
+
//# sourceMappingURL=update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/update.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,aAAkB,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvH"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// packages/mods/src/cli/commands/update.ts
|
|
2
|
+
import { updateFromSources } from "@g3nomaly/core/cli";
|
|
3
|
+
import { MOD_CONTEXT, openModProject, openModRegistry } from "../project";
|
|
4
|
+
/**
|
|
5
|
+
* Re-installs installed mods from the source each one was installed from,
|
|
6
|
+
* at that source's current revision; with no names, everything installed.
|
|
7
|
+
* Files the user changed since install are kept unless overwritten.
|
|
8
|
+
*/
|
|
9
|
+
export async function updateCommand(names, options = {}, deps = {}) {
|
|
10
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
11
|
+
await updateFromSources([project.target], names, () => openModRegistry(project), options, MOD_CONTEXT);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/cli/commands/update.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAO1E;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAe,EAAE,OAAO,GAAkB,EAAE,EAAE,IAAI,GAAgB,EAAE;IACtG,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,SAAS,EAAE,IAAI,CAAC,CAAC;IACjE,MAAM,iBAAiB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AACzG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// packages/mods/src/cli/index.ts
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { readPackageMeta, warnIfOutdated } from "@g3nomaly/core/utils";
|
|
5
|
+
import { ViewerLocationSchema } from "../viewer";
|
|
6
|
+
import { addCommand } from "./commands/add";
|
|
7
|
+
import { initCommand } from "./commands/init";
|
|
8
|
+
import { lsCommand } from "./commands/ls";
|
|
9
|
+
import { removeCommand } from "./commands/remove";
|
|
10
|
+
import { sourceAddCommand, sourceLsCommand, sourceRemoveCommand } from "./commands/source";
|
|
11
|
+
import { updateCommand } from "./commands/update";
|
|
12
|
+
/** Every command takes `--user` to work on `~/.claude/` instead of the project. */
|
|
13
|
+
function scopeOf(opts) {
|
|
14
|
+
return opts.user === true ? "user" : "project";
|
|
15
|
+
}
|
|
16
|
+
const program = new Command()
|
|
17
|
+
.name("g3n-mods")
|
|
18
|
+
.description("Install Claude Code mods from registered sources");
|
|
19
|
+
program
|
|
20
|
+
.command("init")
|
|
21
|
+
.description("Create mods.json and set up VS Code to show mods")
|
|
22
|
+
.option("-u, --user", "Work on ~/.claude/ for every project")
|
|
23
|
+
.option("--location <where>", "Where Claude opens in VS Code: panel (an editor tab) or sidebar")
|
|
24
|
+
.action((opts) => {
|
|
25
|
+
const location = opts.location === undefined ? undefined : ViewerLocationSchema.parse(opts.location);
|
|
26
|
+
initCommand({ scope: scopeOf(opts), location });
|
|
27
|
+
});
|
|
28
|
+
program
|
|
29
|
+
.command("ls")
|
|
30
|
+
.description("List the mods the registered sources provide")
|
|
31
|
+
.option("-u, --user", "Work on ~/.claude/ for every project")
|
|
32
|
+
.option("-i, --installed", "List installed mods instead")
|
|
33
|
+
.option("-s, --source <name>", "Only this source")
|
|
34
|
+
.option("--json", "Output as JSON")
|
|
35
|
+
.action(async (opts) => {
|
|
36
|
+
await lsCommand({ scope: scopeOf(opts), installed: opts.installed, source: opts.source, json: opts.json });
|
|
37
|
+
});
|
|
38
|
+
program
|
|
39
|
+
.command("add [mods...]")
|
|
40
|
+
.description("Install mods, or every mod of a source")
|
|
41
|
+
.option("-u, --user", "Work on ~/.claude/ for every project")
|
|
42
|
+
.option("-s, --source <name>", "Only read this source")
|
|
43
|
+
.option("-f, --force", "Overwrite locally modified files")
|
|
44
|
+
.action(async (mods, opts) => {
|
|
45
|
+
await addCommand(mods, { scope: scopeOf(opts), source: opts.source, force: opts.force });
|
|
46
|
+
});
|
|
47
|
+
program
|
|
48
|
+
.command("update [mods...]")
|
|
49
|
+
.description("Re-install installed mods from their sources")
|
|
50
|
+
.option("-u, --user", "Work on ~/.claude/ for every project")
|
|
51
|
+
.option("-f, --force", "Overwrite locally modified files without prompting")
|
|
52
|
+
.option("--dry-run", "Report what would change without writing")
|
|
53
|
+
.action(async (mods, opts) => {
|
|
54
|
+
await updateCommand(mods, { scope: scopeOf(opts), force: opts.force, dryRun: opts.dryRun });
|
|
55
|
+
});
|
|
56
|
+
program
|
|
57
|
+
.command("remove [mods...]")
|
|
58
|
+
.description("Remove installed mods")
|
|
59
|
+
.option("-u, --user", "Work on ~/.claude/ for every project")
|
|
60
|
+
.option("-f, --force", "Remove even if files have been modified")
|
|
61
|
+
.action(async (mods, opts) => {
|
|
62
|
+
await removeCommand(mods, { scope: scopeOf(opts), force: opts.force });
|
|
63
|
+
});
|
|
64
|
+
const source = program
|
|
65
|
+
.command("source")
|
|
66
|
+
.description("Register, list and unregister mod sources");
|
|
67
|
+
source
|
|
68
|
+
.command("add <source>")
|
|
69
|
+
.description("Register a git URL, owner/repo, npm package (npm:<pkg>, @scope/pkg) or local folder")
|
|
70
|
+
.option("-u, --user", "Work on ~/.claude/ for every project")
|
|
71
|
+
.option("-n, --name <name>", "Name to register it under")
|
|
72
|
+
.option("-r, --ref <ref>", "Branch or tag of a git source")
|
|
73
|
+
.action(async (input, opts) => {
|
|
74
|
+
await sourceAddCommand(input, { scope: scopeOf(opts), name: opts.name, ref: opts.ref });
|
|
75
|
+
});
|
|
76
|
+
source
|
|
77
|
+
.command("ls")
|
|
78
|
+
.description("List built-in and registered sources")
|
|
79
|
+
.option("-u, --user", "Work on ~/.claude/ for every project")
|
|
80
|
+
.option("--json", "Output as JSON")
|
|
81
|
+
.action((opts) => {
|
|
82
|
+
sourceLsCommand({ scope: scopeOf(opts), json: opts.json });
|
|
83
|
+
});
|
|
84
|
+
source
|
|
85
|
+
.command("remove <name>")
|
|
86
|
+
.description("Unregister a source")
|
|
87
|
+
.option("-u, --user", "Work on ~/.claude/ for every project")
|
|
88
|
+
.option("-f, --force", "Unregister even while installed mods come from it")
|
|
89
|
+
.action((name, opts) => {
|
|
90
|
+
sourceRemoveCommand(name, { scope: scopeOf(opts), force: opts.force });
|
|
91
|
+
});
|
|
92
|
+
const self = readPackageMeta(import.meta.url);
|
|
93
|
+
await warnIfOutdated(self.name, self.version, import.meta.url);
|
|
94
|
+
await program.parseAsync();
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,iCAAiC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,eAA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