@g3nomaly/skills 0.3.0 → 1.0.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.
Files changed (87) hide show
  1. package/LICENSE +95 -0
  2. package/dist/cli/adapter.d.ts +33 -0
  3. package/dist/cli/adapter.d.ts.map +1 -0
  4. package/dist/cli/adapter.js +62 -0
  5. package/dist/cli/adapter.js.map +1 -0
  6. package/dist/cli/commands/add.d.ts +14 -0
  7. package/dist/cli/commands/add.d.ts.map +1 -0
  8. package/dist/cli/commands/add.js +22 -0
  9. package/dist/cli/commands/add.js.map +1 -0
  10. package/dist/cli/commands/init.d.ts +22 -0
  11. package/dist/cli/commands/init.d.ts.map +1 -0
  12. package/dist/cli/commands/init.js +119 -0
  13. package/dist/cli/commands/init.js.map +1 -0
  14. package/dist/cli/commands/ls.d.ts +11 -0
  15. package/dist/cli/commands/ls.d.ts.map +1 -0
  16. package/dist/cli/commands/ls.js +24 -0
  17. package/dist/cli/commands/ls.js.map +1 -0
  18. package/dist/cli/commands/remove.d.ts +12 -0
  19. package/dist/cli/commands/remove.d.ts.map +1 -0
  20. package/dist/cli/commands/remove.js +15 -0
  21. package/dist/cli/commands/remove.js.map +1 -0
  22. package/dist/cli/commands/source.d.ts +29 -0
  23. package/dist/cli/commands/source.d.ts.map +1 -0
  24. package/dist/cli/commands/source.js +31 -0
  25. package/dist/cli/commands/source.js.map +1 -0
  26. package/dist/cli/commands/update.d.ts +13 -0
  27. package/dist/cli/commands/update.d.ts.map +1 -0
  28. package/dist/cli/commands/update.js +15 -0
  29. package/dist/cli/commands/update.js.map +1 -0
  30. package/dist/cli/index.d.ts +3 -0
  31. package/dist/cli/index.d.ts.map +1 -0
  32. package/dist/cli/index.js +93 -0
  33. package/dist/cli/index.js.map +1 -0
  34. package/dist/index.d.ts +4 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +5 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/packages/index.d.ts +3 -0
  39. package/dist/packages/index.d.ts.map +1 -0
  40. package/dist/packages/index.js +3 -0
  41. package/dist/packages/index.js.map +1 -0
  42. package/dist/packages/install.d.ts +24 -0
  43. package/dist/packages/install.d.ts.map +1 -0
  44. package/dist/packages/install.js +47 -0
  45. package/dist/packages/install.js.map +1 -0
  46. package/dist/registry/index.d.ts +7 -0
  47. package/dist/registry/index.d.ts.map +1 -0
  48. package/dist/registry/index.js +7 -0
  49. package/dist/registry/index.js.map +1 -0
  50. package/dist/registry/locate.d.ts +22 -0
  51. package/dist/registry/locate.d.ts.map +1 -0
  52. package/dist/registry/locate.js +81 -0
  53. package/dist/registry/locate.js.map +1 -0
  54. package/dist/registry/manifest.d.ts +9 -0
  55. package/dist/registry/manifest.d.ts.map +1 -0
  56. package/dist/registry/manifest.js +14 -0
  57. package/dist/registry/manifest.js.map +1 -0
  58. package/dist/registry/readSkillDir.d.ts +14 -0
  59. package/dist/registry/readSkillDir.d.ts.map +1 -0
  60. package/dist/registry/readSkillDir.js +54 -0
  61. package/dist/registry/readSkillDir.js.map +1 -0
  62. package/dist/registry/readSource.d.ts +9 -0
  63. package/dist/registry/readSource.d.ts.map +1 -0
  64. package/dist/registry/readSource.js +30 -0
  65. package/dist/registry/readSource.js.map +1 -0
  66. package/dist/registry/types.d.ts +53 -0
  67. package/dist/registry/types.d.ts.map +1 -0
  68. package/dist/registry/types.js +25 -0
  69. package/dist/registry/types.js.map +1 -0
  70. package/dist/sources/builtins.d.ts +4 -0
  71. package/dist/sources/builtins.d.ts.map +1 -0
  72. package/dist/sources/builtins.js +5 -0
  73. package/dist/sources/builtins.js.map +1 -0
  74. package/dist/sources/index.d.ts +2 -0
  75. package/dist/sources/index.d.ts.map +1 -0
  76. package/dist/sources/index.js +3 -0
  77. package/dist/sources/index.js.map +1 -0
  78. package/dist/utils/frontmatter.d.ts +7 -0
  79. package/dist/utils/frontmatter.d.ts.map +1 -0
  80. package/dist/utils/frontmatter.js +20 -0
  81. package/dist/utils/frontmatter.js.map +1 -0
  82. package/dist/utils/index.d.ts +2 -0
  83. package/dist/utils/index.d.ts.map +1 -0
  84. package/dist/utils/index.js +3 -0
  85. package/dist/utils/index.js.map +1 -0
  86. package/package.json +38 -3
  87. package/README.md +0 -3
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.
@@ -0,0 +1,33 @@
1
+ import { resolveProjectRoot } from "@g3nomaly/core/config";
2
+ import type { G3nConfig } from "@g3nomaly/core/config";
3
+ import type { InstallCommandContext, ManifestTarget } from "@g3nomaly/core/cli";
4
+ import type { SourceRegistry } from "@g3nomaly/core/installer";
5
+ import type { RegisteredSource } from "@g3nomaly/core/sources";
6
+ import type { SkillMeta, SkillRegistry } from "../registry/types";
7
+ /** Injection point for tests; the real project root comes from git discovery. */
8
+ export interface ProjectDeps {
9
+ resolveProjectRoot?: typeof resolveProjectRoot;
10
+ }
11
+ /** Anchors the command to the git project and loads its config; exits when outside a repo. */
12
+ export declare function openSkillProject(deps?: ProjectDeps): Promise<{
13
+ projectRoot: string;
14
+ config: G3nConfig;
15
+ }>;
16
+ /** One target per configured harness, narrowed to `only` when given; exits on an unreadable `skills.json`. */
17
+ export declare function skillTargets(config: G3nConfig, projectRoot: string, only?: string[]): ManifestTarget[];
18
+ /** Built-in sources plus those registered in any of the targets' `skills.json`. */
19
+ export declare function skillSources(targets: readonly ManifestTarget[]): RegisteredSource[];
20
+ /** Installed skills of one target. */
21
+ export declare function installedSkills(target: ManifestTarget): SkillRegistry;
22
+ /** What the core install and source commands print and check for skills. */
23
+ export declare const SKILL_CONTEXT: InstallCommandContext<SkillMeta>;
24
+ /**
25
+ * Reads the skills of the targets' sources, or only those of `only`, and
26
+ * prints what could not be read; the caller disposes the result.
27
+ *
28
+ * @param only - Source name to read alone; exits when no such source is registered
29
+ */
30
+ export declare function openSkillRegistry(targets: readonly ManifestTarget[], projectRoot: string, only?: string): Promise<SourceRegistry<SkillMeta>>;
31
+ /** Installs the packages of the given skills in one target and prints each failure; sets exit code 1 on any. */
32
+ export declare function installPackagesReporting(target: ManifestTarget, keys: readonly string[]): Promise<void>;
33
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/cli/adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiC,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEhF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI/D,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIlE,iFAAiF;AACjF,MAAM,WAAW,WAAW;IAC1B,kBAAkB,CAAC,EAAE,OAAO,kBAAkB,CAAC;CAChD;AAED,8FAA8F;AAC9F,wBAAsB,gBAAgB,CAAC,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC,CAOlH;AAED,8GAA8G;AAC9G,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,CAWtG;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,GAAG,gBAAgB,EAAE,CAEnF;AAED,sCAAsC;AACtC,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,aAAa,CAErE;AAED,4EAA4E;AAC5E,eAAO,MAAM,aAAa,EAAE,qBAAqB,CAAC,SAAS,CAAsE,CAAC;AAElI;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAIlJ;AAED,gHAAgH;AAChH,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAM7G"}
@@ -0,0 +1,62 @@
1
+ // packages/skills/src/cli/adapter.ts
2
+ import path from "node:path";
3
+ import { SkillTargetSchema, loadConfig, resolveProjectRoot } from "@g3nomaly/core/config";
4
+ import { c, lineError, narrowSources, orExit, reportSourceRegistry } from "@g3nomaly/core/cli";
5
+ import { installedEntries, loadInstallManifest, loadSourceRegistry, manifestSources } from "@g3nomaly/core/installer";
6
+ import { skillsManifestPath } from "../registry/manifest";
7
+ import { readSkillSource } from "../registry/readSource";
8
+ import { SkillMetaSchema } from "../registry/types";
9
+ import { installSkillPackages } from "../packages/install";
10
+ import { BUILTIN_SOURCES } from "../sources/builtins";
11
+ /** Anchors the command to the git project and loads its config; exits when outside a repo. */
12
+ export async function openSkillProject(deps = {}) {
13
+ const projectRoot = (deps.resolveProjectRoot ?? resolveProjectRoot)();
14
+ if (projectRoot === null) {
15
+ console.error(lineError("No g3n project found: run `g3n-skills init` inside a git repository."));
16
+ process.exit(1);
17
+ }
18
+ return { projectRoot, config: await loadConfig(projectRoot) };
19
+ }
20
+ /** One target per configured harness, narrowed to `only` when given; exits on an unreadable `skills.json`. */
21
+ export function skillTargets(config, projectRoot, only) {
22
+ const settings = config.skills.settings;
23
+ const wanted = only === undefined || only.length === 0
24
+ ? settings.targets
25
+ : only.map((t) => SkillTargetSchema.parse(t));
26
+ return wanted.map((target) => {
27
+ const installDir = settings.installDirs[target];
28
+ const manifest = orExit(() => loadInstallManifest(skillsManifestPath(projectRoot, installDir), SkillMetaSchema));
29
+ return { label: target, installDir: path.join(projectRoot, installDir), store: manifest.store, manifest };
30
+ });
31
+ }
32
+ /** Built-in sources plus those registered in any of the targets' `skills.json`. */
33
+ export function skillSources(targets) {
34
+ return manifestSources(targets.map((t) => t.manifest), BUILTIN_SOURCES);
35
+ }
36
+ /** Installed skills of one target. */
37
+ export function installedSkills(target) {
38
+ return installedEntries(target.manifest, SkillMetaSchema);
39
+ }
40
+ /** What the core install and source commands print and check for skills. */
41
+ export const SKILL_CONTEXT = { bin: "g3n-skills", noun: "skill", entrySchema: SkillMetaSchema };
42
+ /**
43
+ * Reads the skills of the targets' sources, or only those of `only`, and
44
+ * prints what could not be read; the caller disposes the result.
45
+ *
46
+ * @param only - Source name to read alone; exits when no such source is registered
47
+ */
48
+ export async function openSkillRegistry(targets, projectRoot, only) {
49
+ const registry = await loadSourceRegistry(narrowSources(skillSources(targets), only, "g3n-skills"), projectRoot, readSkillSource);
50
+ reportSourceRegistry(registry);
51
+ return registry;
52
+ }
53
+ /** Installs the packages of the given skills in one target and prints each failure; sets exit code 1 on any. */
54
+ export async function installPackagesReporting(target, keys) {
55
+ for (const result of await installSkillPackages(target.installDir, keys)) {
56
+ if (result.error === undefined)
57
+ continue;
58
+ console.error(lineError(`${c.key(result.key)} (${c.target(target.label)}): its packages could not be installed, so its hooks will not run: ${result.error}`));
59
+ process.exitCode = 1;
60
+ }
61
+ }
62
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/cli/adapter.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE1F,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/F,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGtH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAOtD,8FAA8F;AAC9F,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAI,GAAgB,EAAE;IAC3D,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,kBAAkB,IAAI,kBAAkB,CAAC,EAAE,CAAC;IACtE,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,sEAAsE,CAAC,CAAC,CAAC;QACjG,OAAO,CAAC,IAAI,CAAC,CA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,CAAC,MAAM,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;AAC5D,CAAC;AAED,4EAA4E;AAC5E,MAAM,CAAC,MAAM,aAAa,GAAqC,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC;AAElI;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAkC,EAAE,WAAmB,EAAE,IAAa;IAC5G,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC;IAClI,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC/B,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,gHAAgH;AAChH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,MAAsB,EAAE,IAAuB;IAC5F,KAAK,MAAM,MAAM,IAAI,MAAM,oBAAoB,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC;QACzE,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS;YAAE,SAAS;QACzC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,sEAAsE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC9J,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { InstallOptions } from "@g3nomaly/core/cli";
2
+ import type { ProjectDeps } from "../adapter";
3
+ export interface AddOptions extends InstallOptions {
4
+ targets?: string[];
5
+ }
6
+ /**
7
+ * Installs skills or whole groups from the registered sources into every
8
+ * configured target, each with the skills it depends on from any source, and
9
+ * installs the packages of the skills that ship a `package.json`. A name more
10
+ * than one source offers is picked as `<name>@<source>`; with no names the
11
+ * user picks from what the sources offer.
12
+ */
13
+ export declare function addCommand(names: string[], options?: AddOptions, deps?: ProjectDeps): Promise<void>;
14
+ //# 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,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAAe,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CASjH"}
@@ -0,0 +1,22 @@
1
+ // packages/skills/src/cli/commands/add.ts
2
+ import { addFromSources } from "@g3nomaly/core/cli";
3
+ import { SKILL_CONTEXT, installPackagesReporting, openSkillProject, openSkillRegistry, skillTargets } from "../adapter";
4
+ /**
5
+ * Installs skills or whole groups from the registered sources into every
6
+ * configured target, each with the skills it depends on from any source, and
7
+ * installs the packages of the skills that ship a `package.json`. A name more
8
+ * than one source offers is picked as `<name>@<source>`; with no names the
9
+ * user picks from what the sources offer.
10
+ */
11
+ export async function addCommand(names, options = {}, deps = {}) {
12
+ const { projectRoot, config } = await openSkillProject(deps);
13
+ const targets = skillTargets(config, projectRoot, options.targets);
14
+ const registry = await openSkillRegistry(targets, projectRoot);
15
+ try {
16
+ await addFromSources(targets, names, registry, options, SKILL_CONTEXT, installPackagesReporting);
17
+ }
18
+ finally {
19
+ registry.dispose();
20
+ }
21
+ }
22
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAOxH;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAe,EAAE,OAAO,GAAe,EAAE,EAAE,IAAI,GAAgB,EAAE;IAChG,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC7D,MAAM,OAAO,GAAI,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACpE,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC/D,IAAI,CAAC;QACH,MAAM,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,wBAAwB,CAAC,CAAC;IACnG,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { SkillTarget, SkillsSettings } from "@g3nomaly/core/config";
2
+ import type { Dialogue, DialogueAnswers } from "@g3nomaly/core/cli";
3
+ import type { ProjectDeps } from "../adapter";
4
+ export interface InitOptions {
5
+ force?: boolean;
6
+ targets?: string[];
7
+ /** Preset dialogue answers by step id; skips the terminal prompt. */
8
+ answers?: DialogueAnswers;
9
+ }
10
+ export interface SkillsInitAnswers {
11
+ targets: SkillTarget[];
12
+ claudeDir: string;
13
+ codexDir: string;
14
+ }
15
+ interface SkillsInitInput extends Record<string, unknown> {
16
+ settings: SkillsSettings;
17
+ }
18
+ export declare const initDialogue: Dialogue<SkillsInitInput>;
19
+ /** Configures which harnesses skills are installed for. */
20
+ export declare function initCommand(options?: InitOptions, deps?: ProjectDeps): Promise<void>;
21
+ export {};
22
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAa,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEpF,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAI,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,qEAAqE;IACrE,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAI,WAAW,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAG,MAAM,CAAC;CACnB;AAKD,UAAU,eAAgB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvD,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAYD,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,eAAe,CA6BlD,CAAC;AA6BF,2DAA2D;AAC3D,wBAAsB,WAAW,CAAC,OAAO,GAAE,WAAgB,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+ClG"}
@@ -0,0 +1,119 @@
1
+ // packages/skills/src/cli/commands/init.ts
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import chalk from "chalk";
5
+ import * as p from "@clack/prompts";
6
+ import { z } from "zod";
7
+ import { SkillTargetSchema, configExists, loadConfig, resolveProjectRoot, saveConfig } from "@g3nomaly/core/config";
8
+ import { StepKind, c, runDialogue, runDialogueValue } from "@g3nomaly/core/cli";
9
+ const TargetsSchema = z.array(SkillTargetSchema);
10
+ const notEmpty = (v) => (v?.trim() ? undefined : "Directory cannot be empty");
11
+ const reconfigureDialogue = {
12
+ steps: {
13
+ reconfigure: {
14
+ kind: StepKind.Confirm,
15
+ message: "Config already exists. Reconfigure?",
16
+ initial: false,
17
+ },
18
+ },
19
+ };
20
+ export const initDialogue = {
21
+ steps: {
22
+ targets: {
23
+ kind: StepKind.MultiSelect,
24
+ message: "Install skills for which harnesses?",
25
+ choices: [
26
+ { value: "claude", label: "Claude Code" },
27
+ { value: "codex", label: "Codex" },
28
+ ],
29
+ initial: ({ settings }) => settings.targets,
30
+ required: true,
31
+ next: "claudeDir",
32
+ },
33
+ claudeDir: {
34
+ kind: StepKind.Text,
35
+ message: "Claude skills directory?",
36
+ initial: ({ settings }) => settings.installDirs.claude,
37
+ validate: notEmpty,
38
+ when: (_input, answers) => TargetsSchema.parse(answers.targets).includes("claude"),
39
+ next: "codexDir",
40
+ },
41
+ codexDir: {
42
+ kind: StepKind.Text,
43
+ message: "Codex skills directory?",
44
+ initial: ({ settings }) => settings.installDirs.codex,
45
+ validate: notEmpty,
46
+ when: (_input, answers) => TargetsSchema.parse(answers.targets).includes("codex"),
47
+ },
48
+ },
49
+ };
50
+ function settingsLines(targets, claudeDir, codexDir) {
51
+ return [
52
+ ` targets: ${targets.map((t) => c.target(t)).join(", ")}`,
53
+ ` claude dir: ${c.dir(claudeDir)}`,
54
+ ` codex dir: ${c.dir(codexDir)}`,
55
+ ];
56
+ }
57
+ function fromOptions(options, config) {
58
+ if (options.targets === undefined)
59
+ return null;
60
+ const s = config.skills.settings;
61
+ return {
62
+ targets: options.targets.map((t) => SkillTargetSchema.parse(t)),
63
+ claudeDir: s.installDirs.claude,
64
+ codexDir: s.installDirs.codex,
65
+ };
66
+ }
67
+ function parseAnswers(record, config) {
68
+ const s = config.skills.settings;
69
+ return {
70
+ targets: TargetsSchema.parse(record.targets),
71
+ claudeDir: typeof record.claudeDir === "string" ? record.claudeDir : s.installDirs.claude,
72
+ codexDir: typeof record.codexDir === "string" ? record.codexDir : s.installDirs.codex,
73
+ };
74
+ }
75
+ /** Configures which harnesses skills are installed for. */
76
+ export async function initCommand(options = {}, deps = {}) {
77
+ p.intro(chalk.bold.cyan("g3n-skills init"));
78
+ const projectRoot = (deps.resolveProjectRoot ?? resolveProjectRoot)();
79
+ if (projectRoot === null) {
80
+ console.error(chalk.red("Not inside a git repository — g3n projects are anchored to a repo. Run `git init` first."));
81
+ process.exitCode = 1;
82
+ return;
83
+ }
84
+ const exists = await configExists(projectRoot);
85
+ const config = await loadConfig(projectRoot);
86
+ const preset = fromOptions(options, config);
87
+ if (exists && !options.force && preset === null) {
88
+ const s = config.skills.settings;
89
+ console.log(chalk.bold("Current skills config:"));
90
+ for (const line of settingsLines(s.targets, s.installDirs.claude, s.installDirs.codex))
91
+ console.log(line);
92
+ console.log();
93
+ const reconfigure = await runDialogueValue(reconfigureDialogue, {}, options.answers);
94
+ if (reconfigure !== true) {
95
+ p.outro(chalk.dim("No changes made."));
96
+ return;
97
+ }
98
+ }
99
+ let answers;
100
+ if (preset !== null) {
101
+ answers = preset;
102
+ }
103
+ else {
104
+ const record = await runDialogue(initDialogue, { settings: config.skills.settings }, options.answers);
105
+ if (typeof record === "symbol") {
106
+ p.outro(chalk.dim("Init cancelled."));
107
+ return;
108
+ }
109
+ answers = parseAnswers(record, config);
110
+ }
111
+ await saveConfig(projectRoot, {
112
+ skills: { settings: { targets: answers.targets, installDirs: { claude: answers.claudeDir, codex: answers.codexDir } } },
113
+ });
114
+ for (const target of answers.targets) {
115
+ fs.mkdirSync(path.join(projectRoot, target === "claude" ? answers.claudeDir : answers.codexDir), { recursive: true });
116
+ }
117
+ p.outro([`Config written to ${c.file(".g3n.config.json")}`, ...settingsLines(answers.targets, answers.claudeDir, answers.codexDir)].join("\n"));
118
+ }
119
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","s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,KAAK,QAAQ,EAAE,CAAC;YAC/B,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;YACtC,OAAO;QACT,CAAC;QACD,OAAO,GAAG,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,UAAU,CAAC,WAAW,EAAE;QAC5B,MAAM,EAAE,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,EAAE;KACxH,CAAC,CAAC;IACH,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACrC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACxH,CAAC;IAED,CAAC,CAAC,KAAK,CAAC,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAClJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { LSOptions } from "@g3nomaly/core/cli";
2
+ import type { ProjectDeps } from "../adapter";
3
+ export interface LsOptions extends LSOptions {
4
+ /** List what `skills.json` records instead of what the sources offer */
5
+ installed?: boolean;
6
+ /** Only the skills of this registered source */
7
+ source?: string;
8
+ }
9
+ /** Lists the skills the registered sources offer, `●` marking installed ones, or with `installed` only what is installed. */
10
+ export declare function lsCommand(options?: LsOptions, deps?: ProjectDeps): Promise<void>;
11
+ //# 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;AAGpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C,wEAAwE;IACxE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gDAAgD;IAChD,MAAM,CAAC,EAAK,MAAM,CAAC;CACpB;AAED,6HAA6H;AAC7H,wBAAsB,SAAS,CAAC,OAAO,GAAE,SAAc,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB9F"}
@@ -0,0 +1,24 @@
1
+ // packages/skills/src/cli/commands/ls.ts
2
+ import { lsEntries, lsSourceRegistry } from "@g3nomaly/core/cli";
3
+ import { installedSkills, openSkillProject, openSkillRegistry, skillSources, skillTargets } from "../adapter";
4
+ /** Lists the skills the registered sources offer, `●` marking installed ones, or with `installed` only what is installed. */
5
+ export async function lsCommand(options = {}, deps = {}) {
6
+ const { projectRoot, config } = await openSkillProject(deps);
7
+ const targets = skillTargets(config, projectRoot);
8
+ const installed = {};
9
+ for (const target of targets)
10
+ for (const [key, entry] of Object.entries(installedSkills(target)))
11
+ installed[key] ??= entry;
12
+ if (options.installed === true) {
13
+ lsEntries(installed, options);
14
+ return;
15
+ }
16
+ const registry = await openSkillRegistry(targets, projectRoot, options.source);
17
+ try {
18
+ lsSourceRegistry(registry, skillSources(targets), installed, options);
19
+ }
20
+ finally {
21
+ registry.dispose();
22
+ }
23
+ }
24
+ //# sourceMappingURL=ls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ls.js","sourceRoot":"","sources":["../../../src/cli/commands/ls.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGjE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAU9G,6HAA6H;AAC7H,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAO,GAAc,EAAE,EAAE,IAAI,GAAgB,EAAE;IAC7E,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC7D,MAAM,OAAO,GAAK,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACpD,MAAM,SAAS,GAAkB,EAAE,CAAC;IACpC,KAAK,MAAM,MAAM,IAAI,OAAO;QAAE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAAE,SAAS,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC;IAE3H,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,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/E,IAAI,CAAC;QACH,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACxE,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 } from "../adapter";
3
+ export interface RemoveOptions extends InstallOptions {
4
+ targets?: string[];
5
+ }
6
+ /**
7
+ * Removes installed skills, hooks included, with the packages installed into
8
+ * them, and drops them from each target's `skills.json`. Works from the
9
+ * manifests alone; installed dependents are offered for removal too.
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":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,aAAkB,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAIvH"}
@@ -0,0 +1,15 @@
1
+ // packages/skills/src/cli/commands/remove.ts
2
+ import { removeFromTargets } from "@g3nomaly/core/cli";
3
+ import { removeSkillPackages } from "../../packages/install";
4
+ import { SKILL_CONTEXT, openSkillProject, skillTargets } from "../adapter";
5
+ /**
6
+ * Removes installed skills, hooks included, with the packages installed into
7
+ * them, and drops them from each target's `skills.json`. Works from the
8
+ * manifests alone; installed dependents are offered for removal too.
9
+ */
10
+ export async function removeCommand(names, options = {}, deps = {}) {
11
+ const { projectRoot, config } = await openSkillProject(deps);
12
+ const targets = skillTargets(config, projectRoot, options.targets);
13
+ await removeFromTargets(targets, names, options, SKILL_CONTEXT, (target, removed) => removeSkillPackages(target.installDir, removed));
14
+ }
15
+ //# sourceMappingURL=remove.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../src/cli/commands/remove.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAO3E;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAe,EAAE,OAAO,GAAkB,EAAE,EAAE,IAAI,GAAgB,EAAE;IACtG,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC7D,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,MAAM,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;AACxI,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { ProjectDeps } from "../adapter";
2
+ export interface SourceAddOptions {
3
+ /** Name to register under; derived from the source when absent */
4
+ name?: string;
5
+ /** Branch or tag a git source is pinned to */
6
+ ref?: string;
7
+ targets?: string[];
8
+ }
9
+ export interface SourceLsOptions {
10
+ json?: boolean;
11
+ targets?: string[];
12
+ }
13
+ export interface SourceRemoveOptions {
14
+ /** Unregister even when installed skills came from the source */
15
+ force?: boolean;
16
+ targets?: string[];
17
+ }
18
+ /**
19
+ * Registers a git repository, npm package or local folder as a skill source
20
+ * in every target's `skills.json`, after checking it offers at least one skill.
21
+ *
22
+ * @param input - The source as typed, e.g. `owner/repo`, `npm:@scope/skills` or `./my-skills`
23
+ */
24
+ export declare function sourceAddCommand(input: string, options?: SourceAddOptions, deps?: ProjectDeps): Promise<void>;
25
+ /** Lists each target's sources, built-in ones first, with how many installed skills came from each. */
26
+ export declare function sourceLsCommand(options?: SourceLsOptions, deps?: ProjectDeps): Promise<void>;
27
+ /** Unregisters a source from every target; refused for built-in sources and, unless forced, while skills came from it. */
28
+ export declare function sourceRemoveCommand(name: string, options?: SourceRemoveOptions, deps?: ProjectDeps): Promise<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,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B,kEAAkE;IAClE,IAAI,CAAC,EAAK,MAAM,CAAC;IACjB,8CAA8C;IAC9C,GAAG,CAAC,EAAM,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAK,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,iEAAiE;IACjE,KAAK,CAAC,EAAI,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAOD;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAI3H;AAED,uGAAuG;AACvG,wBAAsB,eAAe,CAAC,OAAO,GAAE,eAAoB,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAG1G;AAED,0HAA0H;AAC1H,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhI"}
@@ -0,0 +1,31 @@
1
+ // packages/skills/src/cli/commands/source.ts
2
+ import { addSourceEntries, lsSources, removeSourceEntries } from "@g3nomaly/core/cli";
3
+ import { readSkillSource } from "../../registry/readSource";
4
+ import { BUILTIN_SOURCES } from "../../sources/builtins";
5
+ import { SKILL_CONTEXT, openSkillProject, skillTargets } from "../adapter";
6
+ /** What the core source commands need to know about skills. */
7
+ function sourceContext(projectRoot) {
8
+ return { ...SKILL_CONTEXT, builtins: BUILTIN_SOURCES, readSource: readSkillSource, projectRoot };
9
+ }
10
+ /**
11
+ * Registers a git repository, npm package or local folder as a skill source
12
+ * in every target's `skills.json`, after checking it offers at least one skill.
13
+ *
14
+ * @param input - The source as typed, e.g. `owner/repo`, `npm:@scope/skills` or `./my-skills`
15
+ */
16
+ export async function sourceAddCommand(input, options = {}, deps = {}) {
17
+ const { projectRoot, config } = await openSkillProject(deps);
18
+ const targets = skillTargets(config, projectRoot, options.targets);
19
+ await addSourceEntries(targets, input, { name: options.name, ref: options.ref }, sourceContext(projectRoot));
20
+ }
21
+ /** Lists each target's sources, built-in ones first, with how many installed skills came from each. */
22
+ export async function sourceLsCommand(options = {}, deps = {}) {
23
+ const { projectRoot, config } = await openSkillProject(deps);
24
+ lsSources(skillTargets(config, projectRoot, options.targets), options, sourceContext(projectRoot));
25
+ }
26
+ /** Unregisters a source from every target; refused for built-in sources and, unless forced, while skills came from it. */
27
+ export async function sourceRemoveCommand(name, options = {}, deps = {}) {
28
+ const { projectRoot, config } = await openSkillProject(deps);
29
+ removeSourceEntries(skillTargets(config, projectRoot, options.targets), name, options, sourceContext(projectRoot));
30
+ }
31
+ //# sourceMappingURL=source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.js","sourceRoot":"","sources":["../../../src/cli/commands/source.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,eAAe,E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E,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC7D,mBAAmB,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC;AACrH,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { InstallOptions } from "@g3nomaly/core/cli";
2
+ import type { ProjectDeps } from "../adapter";
3
+ export interface UpdateOptions extends InstallOptions {
4
+ targets?: string[];
5
+ }
6
+ /**
7
+ * Re-installs installed skills from the source each one was installed from,
8
+ * at that source's current revision, then their packages; with no names,
9
+ * everything installed. Files the user changed since install are kept unless
10
+ * overwritten.
11
+ */
12
+ export declare function updateCommand(names: string[], options?: UpdateOptions, deps?: ProjectDeps): Promise<void>;
13
+ //# 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,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,aAAkB,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAIvH"}
@@ -0,0 +1,15 @@
1
+ // packages/skills/src/cli/commands/update.ts
2
+ import { updateFromSources } from "@g3nomaly/core/cli";
3
+ import { SKILL_CONTEXT, installPackagesReporting, openSkillProject, openSkillRegistry, skillTargets } from "../adapter";
4
+ /**
5
+ * Re-installs installed skills from the source each one was installed from,
6
+ * at that source's current revision, then their packages; with no names,
7
+ * everything installed. Files the user changed since install are kept unless
8
+ * overwritten.
9
+ */
10
+ export async function updateCommand(names, options = {}, deps = {}) {
11
+ const { projectRoot, config } = await openSkillProject(deps);
12
+ const targets = skillTargets(config, projectRoot, options.targets);
13
+ await updateFromSources(targets, names, () => openSkillRegistry(targets, projectRoot), options, SKILL_CONTEXT, installPackagesReporting);
14
+ }
15
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/cli/commands/update.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAOxH;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAe,EAAE,OAAO,GAAkB,EAAE,EAAE,IAAI,GAAgB,EAAE;IACtG,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC7D,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,MAAM,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,wBAAwB,CAAC,CAAC;AAC3I,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bun
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}