@g3nomaly/mods 0.0.0-stage → 0.1.1
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 +24 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/add.js +29 -0
- package/dist/cli/commands/add.js.map +1 -0
- package/dist/cli/commands/init.d.ts +21 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +27 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/ls.d.ts +22 -0
- package/dist/cli/commands/ls.d.ts.map +1 -0
- package/dist/cli/commands/ls.js +25 -0
- package/dist/cli/commands/ls.js.map +1 -0
- package/dist/cli/commands/remove.d.ts +21 -0
- package/dist/cli/commands/remove.d.ts.map +1 -0
- package/dist/cli/commands/remove.js +37 -0
- package/dist/cli/commands/remove.js.map +1 -0
- package/dist/cli/commands/source.d.ts +60 -0
- package/dist/cli/commands/source.d.ts.map +1 -0
- package/dist/cli/commands/source.js +49 -0
- package/dist/cli/commands/source.js.map +1 -0
- package/dist/cli/commands/update.d.ts +21 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +17 -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 +100 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/project.d.ts +72 -0
- package/dist/cli/project.d.ts.map +1 -0
- package/dist/cli/project.js +72 -0
- package/dist/cli/project.js.map +1 -0
- package/dist/cli/viewer.d.ts +12 -0
- package/dist/cli/viewer.d.ts.map +1 -0
- package/dist/cli/viewer.js +33 -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 +21 -0
- package/dist/registry/locate.d.ts.map +1 -0
- package/dist/registry/locate.js +42 -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 +84 -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 +69 -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 +28 -0
- package/dist/viewer/extension.d.ts.map +1 -0
- package/dist/viewer/extension.js +49 -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 +37 -0
- package/dist/viewer/settings.d.ts.map +1 -0
- package/dist/viewer/settings.js +51 -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 restore the source version, fork the mod under a new name that updates leave alone, or skip it and ask again next time. Pass `-f` to restore 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,24 @@
|
|
|
1
|
+
import type { InstallOptions } from "@g3nomaly/core/cli";
|
|
2
|
+
import type { ProjectDeps, Scope } from "../project";
|
|
3
|
+
/**
|
|
4
|
+
* Options of `addCommand`, on top of the core install options.
|
|
5
|
+
*
|
|
6
|
+
* @property scope - Scope to install into; `project` when absent.
|
|
7
|
+
* @property source - Read only this registered source.
|
|
8
|
+
*/
|
|
9
|
+
export interface AddOptions extends InstallOptions {
|
|
10
|
+
scope?: Scope;
|
|
11
|
+
source?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @brief Installs mods, or every mod of a source, from the registered sources into
|
|
15
|
+
* the scope's `.claude/skills/`, records them in `mods.json` and sets up the
|
|
16
|
+
* viewer. A name more than one source offers is picked as `<name>@<source>`;
|
|
17
|
+
* with no names the user picks from what the sources provide.
|
|
18
|
+
*
|
|
19
|
+
* @param names - Mods to install, e.g. `auth-guard` or `auth-guard@my-source`; empty to pick interactively.
|
|
20
|
+
* @param options - Scope, source filter and install options.
|
|
21
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
22
|
+
*/
|
|
23
|
+
export declare function addCommand(names: string[], options?: AddOptions, deps?: ProjectDeps): Promise<void>;
|
|
24
|
+
//# 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;;;;;GAKG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,KAAK,CAAC,EAAG,KAAK,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;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,29 @@
|
|
|
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
|
+
* @brief 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
|
+
* @param names - Mods to install, e.g. `auth-guard` or `auth-guard@my-source`; empty to pick interactively.
|
|
12
|
+
* @param options - Scope, source filter and install options.
|
|
13
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
14
|
+
*/
|
|
15
|
+
export async function addCommand(names, options = {}, deps = {}) {
|
|
16
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
17
|
+
const registry = await openModRegistry(project, options.source);
|
|
18
|
+
try {
|
|
19
|
+
await addFromSources([project.target], names, registry, options, MOD_CONTEXT);
|
|
20
|
+
}
|
|
21
|
+
finally {
|
|
22
|
+
registry.dispose();
|
|
23
|
+
}
|
|
24
|
+
if (Object.keys(installedMods(project)).length > 0) {
|
|
25
|
+
setUpViewer(project);
|
|
26
|
+
console.log(lineInfo(`New sessions load the mods; in a running one, run ${c.cmd("/reload-plugins")}.`));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# 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;AAaxC;;;;;;;;;GASG;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,21 @@
|
|
|
1
|
+
import type { ViewerLocation } from "../../viewer";
|
|
2
|
+
import type { ProjectDeps, Scope } from "../project";
|
|
3
|
+
/**
|
|
4
|
+
* Options of `initCommand`.
|
|
5
|
+
*
|
|
6
|
+
* @property scope - Scope to create `mods.json` in; `project` when absent.
|
|
7
|
+
* @property location - Where Claude opens in VS Code; a location already set is kept when absent.
|
|
8
|
+
*/
|
|
9
|
+
export interface InitOptions {
|
|
10
|
+
scope?: Scope;
|
|
11
|
+
location?: ViewerLocation;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @brief Creates the scope's `mods.json` when missing, sets up the viewer, and lists
|
|
15
|
+
* the sources mods can be installed from.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Scope and viewer location.
|
|
18
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
19
|
+
*/
|
|
20
|
+
export declare function initCommand(options?: InitOptions, deps?: ProjectDeps): void;
|
|
21
|
+
//# 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;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAK,KAAK,CAAC;IACjB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,WAAgB,EAAE,IAAI,GAAE,WAAgB,GAAG,IAAI,CAYnF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
* @brief Creates the scope's `mods.json` when missing, sets up the viewer, and lists
|
|
11
|
+
* the sources mods can be installed from.
|
|
12
|
+
*
|
|
13
|
+
* @param options - Scope and viewer location.
|
|
14
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
15
|
+
*/
|
|
16
|
+
export function initCommand(options = {}, deps = {}) {
|
|
17
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
18
|
+
if (!fs.existsSync(project.target.manifest.filePath)) {
|
|
19
|
+
saveInstallManifest(project.target.manifest, ModMetaSchema);
|
|
20
|
+
console.log(lineSuccess(`Created ${c.file(project.target.manifest.filePath)}`));
|
|
21
|
+
}
|
|
22
|
+
setUpViewer(project, options.location);
|
|
23
|
+
console.log(c.header("\nSources"));
|
|
24
|
+
sourceLsCommand({ scope: project.scope }, deps);
|
|
25
|
+
console.log(`\nRun ${c.cmd("g3n-mods ls")} to see the mods, ${c.cmd("g3n-mods add <mod>")} to install one.`);
|
|
26
|
+
}
|
|
27
|
+
//# 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,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAa3C;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,OAAO,GAAgB,EAAE,EAAE,IAAI,GAAgB,EAAE;IAC3E,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,SAAS,EAAE,IAAI,CAAC,CAAC;IAEjE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrD,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IAClF,CAAC;IACD,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEvC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;IACnC,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC;IAChD,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC,GAAG,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;AAC/G,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { LSOptions } from "@g3nomaly/core/cli";
|
|
2
|
+
import type { ProjectDeps, Scope } from "../project";
|
|
3
|
+
/**
|
|
4
|
+
* Options of `lsCommand`, on top of the core listing options.
|
|
5
|
+
*
|
|
6
|
+
* @property scope - Scope to list; `project` when absent.
|
|
7
|
+
* @property installed - List what `mods.json` records instead of what the sources provide.
|
|
8
|
+
* @property source - Only the mods of this registered source.
|
|
9
|
+
*/
|
|
10
|
+
export interface LsOptions extends LSOptions {
|
|
11
|
+
scope?: Scope;
|
|
12
|
+
installed?: boolean;
|
|
13
|
+
source?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @brief Lists the mods the scope's sources provide, `●` marking installed ones, or with `installed` only what is installed.
|
|
17
|
+
*
|
|
18
|
+
* @param options - Scope, source filter and listing options.
|
|
19
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
20
|
+
*/
|
|
21
|
+
export declare function lsCommand(options?: LsOptions, deps?: ProjectDeps): Promise<void>;
|
|
22
|
+
//# 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;;;;;;GAMG;AACH,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C,KAAK,CAAC,EAAM,KAAK,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAK,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,OAAO,GAAE,SAAc,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAe9F"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
/**
|
|
5
|
+
* @brief Lists the mods the scope's sources provide, `●` marking installed ones, or with `installed` only what is installed.
|
|
6
|
+
*
|
|
7
|
+
* @param options - Scope, source filter and listing options.
|
|
8
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
9
|
+
*/
|
|
10
|
+
export async function lsCommand(options = {}, deps = {}) {
|
|
11
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
12
|
+
const installed = installedMods(project);
|
|
13
|
+
if (options.installed === true) {
|
|
14
|
+
lsEntries(installed, options);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const registry = await openModRegistry(project, options.source);
|
|
18
|
+
try {
|
|
19
|
+
lsSourceRegistry(registry, modSources(project), installed, options);
|
|
20
|
+
}
|
|
21
|
+
finally {
|
|
22
|
+
registry.dispose();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# 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;AAgBxF;;;;;GAKG;AACH,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,21 @@
|
|
|
1
|
+
import type { InstallOptions } from "@g3nomaly/core/cli";
|
|
2
|
+
import type { ProjectDeps, Scope } from "../project";
|
|
3
|
+
/**
|
|
4
|
+
* Options of `removeCommand`, on top of the core install options.
|
|
5
|
+
*
|
|
6
|
+
* @property scope - Scope to remove from; `project` when absent.
|
|
7
|
+
*/
|
|
8
|
+
export interface RemoveOptions extends InstallOptions {
|
|
9
|
+
scope?: Scope;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @brief Removes installed mods, or every mod of a source, with the type
|
|
13
|
+
* declarations Claude Code wrote beside them, and drops them from
|
|
14
|
+
* `mods.json`. With no names the user picks from what is installed.
|
|
15
|
+
*
|
|
16
|
+
* @param names - Mods to remove; empty to pick from what is installed.
|
|
17
|
+
* @param options - Scope and install options.
|
|
18
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
19
|
+
*/
|
|
20
|
+
export declare function removeCommand(names: string[], options?: RemoveOptions, deps?: ProjectDeps): Promise<void>;
|
|
21
|
+
//# 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;;;;GAIG;AACH,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAoBD;;;;;;;;GAQG;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,37 @@
|
|
|
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
|
+
/**
|
|
10
|
+
* Deletes the declarations Claude Code wrote into removed mods, then their emptied folders.
|
|
11
|
+
*
|
|
12
|
+
* @param target - Install destination the mods were removed from.
|
|
13
|
+
* @param removed - Folder names of the removed mods.
|
|
14
|
+
*/
|
|
15
|
+
function removeEngineTypes(target, removed) {
|
|
16
|
+
const io = createInstallerIO();
|
|
17
|
+
for (const key of removed) {
|
|
18
|
+
const typesDir = path.join(target.installDir, key, ENGINE_TYPES_DIR);
|
|
19
|
+
if (fs.existsSync(typesDir))
|
|
20
|
+
fs.rmSync(typesDir, { recursive: true });
|
|
21
|
+
pruneEmptyDirs(path.dirname(typesDir), target.installDir, io);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @brief Removes installed mods, or every mod of a source, with the type
|
|
26
|
+
* declarations Claude Code wrote beside them, and drops them from
|
|
27
|
+
* `mods.json`. With no names the user picks from what is installed.
|
|
28
|
+
*
|
|
29
|
+
* @param names - Mods to remove; empty to pick from what is installed.
|
|
30
|
+
* @param options - Scope and install options.
|
|
31
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
32
|
+
*/
|
|
33
|
+
export async function removeCommand(names, options = {}, deps = {}) {
|
|
34
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
35
|
+
await removeFromTargets([project.target], names, options, MOD_CONTEXT, removeEngineTypes);
|
|
36
|
+
}
|
|
37
|
+
//# 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;AAYzD,oHAAoH;AACpH,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,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;;;;;;;;GAQG;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,60 @@
|
|
|
1
|
+
import type { ProjectDeps, Scope } from "../project";
|
|
2
|
+
/**
|
|
3
|
+
* Options of `sourceAddCommand`.
|
|
4
|
+
*
|
|
5
|
+
* @property scope - Scope to register in; `project` when absent.
|
|
6
|
+
* @property name - Name to register under; derived from the spec when absent.
|
|
7
|
+
* @property ref - Branch or tag of a git source.
|
|
8
|
+
*/
|
|
9
|
+
export interface SourceAddOptions {
|
|
10
|
+
scope?: Scope;
|
|
11
|
+
name?: string;
|
|
12
|
+
ref?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Options of `sourceLsCommand`.
|
|
16
|
+
*
|
|
17
|
+
* @property scope - Scope to list; `project` when absent.
|
|
18
|
+
* @property json - Output as JSON.
|
|
19
|
+
*/
|
|
20
|
+
export interface SourceLsOptions {
|
|
21
|
+
scope?: Scope;
|
|
22
|
+
json?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Options of `sourceRemoveCommand`.
|
|
26
|
+
*
|
|
27
|
+
* @property scope - Scope to unregister from; `project` when absent.
|
|
28
|
+
* @property force - Unregister even while installed mods come from the source.
|
|
29
|
+
*/
|
|
30
|
+
export interface SourceRemoveOptions {
|
|
31
|
+
scope?: Scope;
|
|
32
|
+
force?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @brief Registers a git repository, npm package or local folder as a mod source in
|
|
36
|
+
* the scope's `mods.json`, after checking it provides at least one mod. A
|
|
37
|
+
* local path is stored relative to the project root, and absolute for the
|
|
38
|
+
* user scope, which every project shares.
|
|
39
|
+
*
|
|
40
|
+
* @param input - Git URL, `owner/repo`, npm spec or local folder path.
|
|
41
|
+
* @param options - Scope, name and ref.
|
|
42
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
43
|
+
*/
|
|
44
|
+
export declare function sourceAddCommand(input: string, options?: SourceAddOptions, deps?: ProjectDeps): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* @brief Lists the built-in and registered sources of the scope, with how many installed mods came from each.
|
|
47
|
+
*
|
|
48
|
+
* @param options - Scope and output format.
|
|
49
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
50
|
+
*/
|
|
51
|
+
export declare function sourceLsCommand(options?: SourceLsOptions, deps?: ProjectDeps): void;
|
|
52
|
+
/**
|
|
53
|
+
* @brief Unregisters a source; refused for built-in sources and, unless forced, while installed mods came from it.
|
|
54
|
+
*
|
|
55
|
+
* @param name - Name of the source to unregister.
|
|
56
|
+
* @param options - Scope and force flag.
|
|
57
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
58
|
+
*/
|
|
59
|
+
export declare function sourceRemoveCommand(name: string, options?: SourceRemoveOptions, deps?: ProjectDeps): void;
|
|
60
|
+
//# 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;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAG,MAAM,CAAC;IACf,GAAG,CAAC,EAAI,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAG,OAAO,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAWD;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAG3H;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,eAAoB,EAAE,IAAI,GAAE,WAAgB,GAAG,IAAI,CAG3F;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,EAAE,IAAI,GAAE,WAAgB,GAAG,IAAI,CAGjH"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
/**
|
|
7
|
+
* @brief Builds the context the core source commands use for mods in one scope.
|
|
8
|
+
*
|
|
9
|
+
* @param project - Scope the commands work on.
|
|
10
|
+
*/
|
|
11
|
+
function sourceContext(project) {
|
|
12
|
+
return { ...MOD_CONTEXT, builtins: BUILTIN_SOURCES, readSource: readModSource, projectRoot: project.projectRoot };
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @brief Registers a git repository, npm package or local folder as a mod source in
|
|
16
|
+
* the scope's `mods.json`, after checking it provides at least one mod. A
|
|
17
|
+
* local path is stored relative to the project root, and absolute for the
|
|
18
|
+
* user scope, which every project shares.
|
|
19
|
+
*
|
|
20
|
+
* @param input - Git URL, `owner/repo`, npm spec or local folder path.
|
|
21
|
+
* @param options - Scope, name and ref.
|
|
22
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
23
|
+
*/
|
|
24
|
+
export async function sourceAddCommand(input, options = {}, deps = {}) {
|
|
25
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
26
|
+
await addSourceEntries([project.target], input, { name: options.name, ref: options.ref, absolutePaths: project.scope === "user" }, sourceContext(project));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @brief Lists the built-in and registered sources of the scope, with how many installed mods came from each.
|
|
30
|
+
*
|
|
31
|
+
* @param options - Scope and output format.
|
|
32
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
33
|
+
*/
|
|
34
|
+
export function sourceLsCommand(options = {}, deps = {}) {
|
|
35
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
36
|
+
lsSources([project.target], options, sourceContext(project));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @brief Unregisters a source; refused for built-in sources and, unless forced, while installed mods came from it.
|
|
40
|
+
*
|
|
41
|
+
* @param name - Name of the source to unregister.
|
|
42
|
+
* @param options - Scope and force flag.
|
|
43
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
44
|
+
*/
|
|
45
|
+
export function sourceRemoveCommand(name, options = {}, deps = {}) {
|
|
46
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
47
|
+
removeSourceEntries([project.target], name, options, sourceContext(project));
|
|
48
|
+
}
|
|
49
|
+
//# 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;AAsCzD;;;;GAIG;AACH,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;;;;;;;;;GASG;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;;;;;GAKG;AACH,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;;;;;;GAMG;AACH,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,21 @@
|
|
|
1
|
+
import type { InstallOptions } from "@g3nomaly/core/cli";
|
|
2
|
+
import type { ProjectDeps, Scope } from "../project";
|
|
3
|
+
/**
|
|
4
|
+
* Options of `updateCommand`, on top of the core install options.
|
|
5
|
+
*
|
|
6
|
+
* @property scope - Scope to update; `project` when absent.
|
|
7
|
+
*/
|
|
8
|
+
export interface UpdateOptions extends InstallOptions {
|
|
9
|
+
scope?: Scope;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @brief Re-installs installed mods from the source each one was installed from,
|
|
13
|
+
* at that source's current revision; with no names, everything installed.
|
|
14
|
+
* Files the user changed since install are kept unless overwritten.
|
|
15
|
+
*
|
|
16
|
+
* @param names - Mods to update; empty for everything installed.
|
|
17
|
+
* @param options - Scope and install options.
|
|
18
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
19
|
+
*/
|
|
20
|
+
export declare function updateCommand(names: string[], options?: UpdateOptions, deps?: ProjectDeps): Promise<void>;
|
|
21
|
+
//# 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;;;;GAIG;AACH,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;;;;;;GAQG;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,17 @@
|
|
|
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
|
+
* @brief 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
|
+
* @param names - Mods to update; empty for everything installed.
|
|
10
|
+
* @param options - Scope and install options.
|
|
11
|
+
* @param deps - Overrides for the project lookup, used by tests.
|
|
12
|
+
*/
|
|
13
|
+
export async function updateCommand(names, options = {}, deps = {}) {
|
|
14
|
+
const project = openModProject(options.scope ?? "project", deps);
|
|
15
|
+
await updateFromSources([project.target], names, () => openModRegistry(project), options, MOD_CONTEXT);
|
|
16
|
+
}
|
|
17
|
+
//# 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;AAY1E;;;;;;;;GAQG;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":""}
|