@axm.sh/cli 0.0.11 → 0.0.13
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/dist/src/cli-commands/packs/add/command.d.ts +14 -0
- package/dist/src/cli-commands/packs/add/command.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/add/command.js +52 -0
- package/dist/src/cli-commands/packs/add/command.js.map +1 -0
- package/dist/src/cli-commands/packs/add/handler.d.ts +23 -0
- package/dist/src/cli-commands/packs/add/handler.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/add/handler.js +135 -0
- package/dist/src/cli-commands/packs/add/handler.js.map +1 -0
- package/dist/src/cli-commands/packs/command.d.ts +3 -0
- package/dist/src/cli-commands/packs/command.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/command.js +33 -0
- package/dist/src/cli-commands/packs/command.js.map +1 -0
- package/dist/src/cli-commands/packs/index.d.ts +13 -0
- package/dist/src/cli-commands/packs/index.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/index.js +12 -0
- package/dist/src/cli-commands/packs/index.js.map +1 -0
- package/dist/src/cli-commands/packs/install/build-plan.d.ts +19 -0
- package/dist/src/cli-commands/packs/install/build-plan.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/install/build-plan.js +44 -0
- package/dist/src/cli-commands/packs/install/build-plan.js.map +1 -0
- package/dist/src/cli-commands/packs/install/command.d.ts +17 -0
- package/dist/src/cli-commands/packs/install/command.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/install/command.js +66 -0
- package/dist/src/cli-commands/packs/install/command.js.map +1 -0
- package/dist/src/cli-commands/packs/install/handler.d.ts +43 -0
- package/dist/src/cli-commands/packs/install/handler.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/install/handler.js +180 -0
- package/dist/src/cli-commands/packs/install/handler.js.map +1 -0
- package/dist/src/cli-commands/packs/install/install-pack.d.ts +20 -0
- package/dist/src/cli-commands/packs/install/install-pack.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/install/install-pack.js +42 -0
- package/dist/src/cli-commands/packs/install/install-pack.js.map +1 -0
- package/dist/src/cli-commands/packs/new/command.d.ts +14 -0
- package/dist/src/cli-commands/packs/new/command.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/new/command.js +51 -0
- package/dist/src/cli-commands/packs/new/command.js.map +1 -0
- package/dist/src/cli-commands/packs/new/handler.d.ts +23 -0
- package/dist/src/cli-commands/packs/new/handler.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/new/handler.js +96 -0
- package/dist/src/cli-commands/packs/new/handler.js.map +1 -0
- package/dist/src/cli-commands/packs/operations.d.ts +67 -0
- package/dist/src/cli-commands/packs/operations.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/operations.js +10 -0
- package/dist/src/cli-commands/packs/operations.js.map +1 -0
- package/dist/src/cli-commands/packs/pack-paths.d.ts +28 -0
- package/dist/src/cli-commands/packs/pack-paths.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/pack-paths.js +22 -0
- package/dist/src/cli-commands/packs/pack-paths.js.map +1 -0
- package/dist/src/cli-commands/packs/publish/command.d.ts +15 -0
- package/dist/src/cli-commands/packs/publish/command.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/publish/command.js +56 -0
- package/dist/src/cli-commands/packs/publish/command.js.map +1 -0
- package/dist/src/cli-commands/packs/publish/handler.d.ts +34 -0
- package/dist/src/cli-commands/packs/publish/handler.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/publish/handler.js +123 -0
- package/dist/src/cli-commands/packs/publish/handler.js.map +1 -0
- package/dist/src/cli-commands/packs/publish/publish-pack.d.ts +26 -0
- package/dist/src/cli-commands/packs/publish/publish-pack.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/publish/publish-pack.js +142 -0
- package/dist/src/cli-commands/packs/publish/publish-pack.js.map +1 -0
- package/dist/src/cli-commands/packs/remove/command.d.ts +14 -0
- package/dist/src/cli-commands/packs/remove/command.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/remove/command.js +52 -0
- package/dist/src/cli-commands/packs/remove/command.js.map +1 -0
- package/dist/src/cli-commands/packs/remove/handler.d.ts +23 -0
- package/dist/src/cli-commands/packs/remove/handler.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/remove/handler.js +115 -0
- package/dist/src/cli-commands/packs/remove/handler.js.map +1 -0
- package/dist/src/cli-commands/packs/uninstall/build-plan.d.ts +46 -0
- package/dist/src/cli-commands/packs/uninstall/build-plan.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/uninstall/build-plan.js +99 -0
- package/dist/src/cli-commands/packs/uninstall/build-plan.js.map +1 -0
- package/dist/src/cli-commands/packs/uninstall/command.d.ts +14 -0
- package/dist/src/cli-commands/packs/uninstall/command.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/uninstall/command.js +53 -0
- package/dist/src/cli-commands/packs/uninstall/command.js.map +1 -0
- package/dist/src/cli-commands/packs/uninstall/handler.d.ts +31 -0
- package/dist/src/cli-commands/packs/uninstall/handler.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/uninstall/handler.js +57 -0
- package/dist/src/cli-commands/packs/uninstall/handler.js.map +1 -0
- package/dist/src/cli-commands/packs/uninstall/uninstall-pack.d.ts +25 -0
- package/dist/src/cli-commands/packs/uninstall/uninstall-pack.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/uninstall/uninstall-pack.js +87 -0
- package/dist/src/cli-commands/packs/uninstall/uninstall-pack.js.map +1 -0
- package/dist/src/cli-commands/packs/unpack/command.d.ts +14 -0
- package/dist/src/cli-commands/packs/unpack/command.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/unpack/command.js +51 -0
- package/dist/src/cli-commands/packs/unpack/command.js.map +1 -0
- package/dist/src/cli-commands/packs/unpack/handler.d.ts +52 -0
- package/dist/src/cli-commands/packs/unpack/handler.d.ts.map +1 -0
- package/dist/src/cli-commands/packs/unpack/handler.js +116 -0
- package/dist/src/cli-commands/packs/unpack/handler.js.map +1 -0
- package/dist/src/cli-commands/skills/constants.d.ts +1 -0
- package/dist/src/cli-commands/skills/constants.d.ts.map +1 -1
- package/dist/src/cli-commands/skills/constants.js +1 -0
- package/dist/src/cli-commands/skills/constants.js.map +1 -1
- package/dist/src/cli-commands/skills/disable/disable-skill.d.ts +7 -8
- package/dist/src/cli-commands/skills/disable/disable-skill.d.ts.map +1 -1
- package/dist/src/cli-commands/skills/disable/disable-skill.js +9 -35
- package/dist/src/cli-commands/skills/disable/disable-skill.js.map +1 -1
- package/dist/src/cli-commands/skills/disable/handler.d.ts +1 -0
- package/dist/src/cli-commands/skills/disable/handler.d.ts.map +1 -1
- package/dist/src/cli-commands/skills/disable/handler.js +19 -7
- package/dist/src/cli-commands/skills/disable/handler.js.map +1 -1
- package/dist/src/cli-commands/skills/enable/enable-skill.d.ts +6 -7
- package/dist/src/cli-commands/skills/enable/enable-skill.d.ts.map +1 -1
- package/dist/src/cli-commands/skills/enable/enable-skill.js +16 -74
- package/dist/src/cli-commands/skills/enable/enable-skill.js.map +1 -1
- package/dist/src/cli-commands/skills/enable/handler.d.ts +1 -0
- package/dist/src/cli-commands/skills/enable/handler.d.ts.map +1 -1
- package/dist/src/cli-commands/skills/enable/handler.js +9 -0
- package/dist/src/cli-commands/skills/enable/handler.js.map +1 -1
- package/dist/src/cli-commands/skills/install/install-result.d.ts +1 -1
- package/dist/src/cli-commands/skills/install/install-result.d.ts.map +1 -1
- package/dist/src/cli-commands/skills/install/install-skill.d.ts.map +1 -1
- package/dist/src/cli-commands/skills/install/install-skill.js +3 -17
- package/dist/src/cli-commands/skills/install/install-skill.js.map +1 -1
- package/dist/src/cli-commands/skills/rename/rename-skill.d.ts.map +1 -1
- package/dist/src/cli-commands/skills/rename/rename-skill.js +0 -11
- package/dist/src/cli-commands/skills/rename/rename-skill.js.map +1 -1
- package/dist/src/cli-commands/skills/skill-paths.d.ts +1 -1
- package/dist/src/cli-commands/skills/skill-paths.js +2 -2
- package/dist/src/cli-commands/skills/skill-paths.js.map +1 -1
- package/dist/src/cli-commands/skills/uninstall/uninstall-skill.d.ts +1 -1
- package/dist/src/cli-commands/skills/uninstall/uninstall-skill.d.ts.map +1 -1
- package/dist/src/cli-commands/skills/uninstall/uninstall-skill.js +5 -10
- package/dist/src/cli-commands/skills/uninstall/uninstall-skill.js.map +1 -1
- package/dist/src/extensions/packs/manifest-schema.d.ts +6 -6
- package/dist/src/extensions/packs/manifest-schema.d.ts.map +1 -1
- package/dist/src/extensions/packs/manifest-schema.js +28 -7
- package/dist/src/extensions/packs/manifest-schema.js.map +1 -1
- package/dist/src/lockfile/index.d.ts +2 -2
- package/dist/src/lockfile/index.d.ts.map +1 -1
- package/dist/src/lockfile/index.js +1 -1
- package/dist/src/lockfile/index.js.map +1 -1
- package/dist/src/lockfile/lockfile.d.ts +21 -0
- package/dist/src/lockfile/lockfile.d.ts.map +1 -1
- package/dist/src/lockfile/schema.d.ts +77 -1
- package/dist/src/lockfile/schema.d.ts.map +1 -1
- package/dist/src/lockfile/schema.js +58 -1
- package/dist/src/lockfile/schema.js.map +1 -1
- package/dist/src/main.d.ts.map +1 -1
- package/dist/src/main.js +3 -0
- package/dist/src/main.js.map +1 -1
- package/dist/src/registry/schema.d.ts +4 -4
- package/dist/src/registry/schema.d.ts.map +1 -1
- package/dist/src/registry/schema.js +3 -3
- package/dist/src/registry/schema.js.map +1 -1
- package/dist/src/settings/index.d.ts +2 -2
- package/dist/src/settings/index.d.ts.map +1 -1
- package/dist/src/settings/index.js +1 -1
- package/dist/src/settings/index.js.map +1 -1
- package/dist/src/settings/schema.d.ts +46 -1
- package/dist/src/settings/schema.d.ts.map +1 -1
- package/dist/src/settings/schema.js +34 -1
- package/dist/src/settings/schema.js.map +1 -1
- package/dist/src/settings/settings.d.ts +3 -1
- package/dist/src/settings/settings.d.ts.map +1 -1
- package/dist/src/sources/providers/registry.d.ts.map +1 -1
- package/dist/src/sources/providers/registry.js +11 -5
- package/dist/src/sources/providers/registry.js.map +1 -1
- package/dist/src/sources/resolve-source.d.ts.map +1 -1
- package/dist/src/sources/resolve-source.js +2 -2
- package/dist/src/sources/resolve-source.js.map +1 -1
- package/dist/src/workspace/service.d.ts +19 -2
- package/dist/src/workspace/service.d.ts.map +1 -1
- package/dist/src/workspace/service.js +83 -5
- package/dist/src/workspace/service.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/cli-commands/packs/publish/command.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAK3C,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAAC;CACxC;AAGD,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,EAAE,EAAE,sBAAsB,CAoDxE,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Publish command yargs definition -- wires handler to `axm packs publish`.
|
|
3
|
+
*
|
|
4
|
+
* @experimental This API is unstable and may change without notice.
|
|
5
|
+
*/
|
|
6
|
+
import * as Option from "effect/Option";
|
|
7
|
+
import { run } from "../../../runtime/index.js";
|
|
8
|
+
import { handlePublishPack } from "./handler.js";
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- yargs convention
|
|
10
|
+
export const publishPackCommand = {
|
|
11
|
+
command: "publish <pack>",
|
|
12
|
+
describe: "Publish a managed pack to a registry",
|
|
13
|
+
builder: (yargs) => yargs
|
|
14
|
+
.positional("pack", {
|
|
15
|
+
type: "string",
|
|
16
|
+
describe: "Pack name (@scope/name or bare name)",
|
|
17
|
+
demandOption: true,
|
|
18
|
+
})
|
|
19
|
+
.option("registry", {
|
|
20
|
+
type: "string",
|
|
21
|
+
describe: "Named registry source to publish to",
|
|
22
|
+
})
|
|
23
|
+
.option("yes", {
|
|
24
|
+
alias: "y",
|
|
25
|
+
type: "boolean",
|
|
26
|
+
describe: "Skip all confirmation prompts",
|
|
27
|
+
default: false,
|
|
28
|
+
})
|
|
29
|
+
.option("preview", {
|
|
30
|
+
type: "boolean",
|
|
31
|
+
describe: "Display publish plan without applying",
|
|
32
|
+
default: false,
|
|
33
|
+
})
|
|
34
|
+
.option("non-interactive", {
|
|
35
|
+
type: "boolean",
|
|
36
|
+
describe: "Disable all interactive prompts",
|
|
37
|
+
})
|
|
38
|
+
.example("$0 packs publish @acme/frontend-tools", "Publish to the default registry")
|
|
39
|
+
.example("$0 packs publish frontend-tools --registry local", "Publish with scope from settings to the local registry"),
|
|
40
|
+
handler: async (argv) => {
|
|
41
|
+
await run(handlePublishPack({
|
|
42
|
+
pack: argv.pack,
|
|
43
|
+
registry: Option.fromNullable(argv.registry),
|
|
44
|
+
yes: argv.yes,
|
|
45
|
+
}), {
|
|
46
|
+
workspace: {
|
|
47
|
+
global: false,
|
|
48
|
+
yes: argv.yes,
|
|
49
|
+
nonInteractive: Option.fromNullable(argv["non-interactive"]),
|
|
50
|
+
preview: argv.preview,
|
|
51
|
+
agents: Option.none(),
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../../../src/cli-commands/packs/publish/command.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAUjD,uFAAuF;AACvF,MAAM,CAAC,MAAM,kBAAkB,GAA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;aACtB;SACF,CACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Publish command handler -- Effect-based orchestration for `axm packs publish`.
|
|
3
|
+
*
|
|
4
|
+
* Publishes a pack from `.axm/extensions/` to a target registry:
|
|
5
|
+
* 1. Registry guard (ensure registry configured)
|
|
6
|
+
* 2. Resolve extension name (bare name -> scope from settings)
|
|
7
|
+
* 3. Validate managed pack exists with manifest
|
|
8
|
+
* 4. Build plan with a single PublishPackOperation
|
|
9
|
+
* 5. Execute via resolvePlan
|
|
10
|
+
*
|
|
11
|
+
* @experimental This API is unstable and may change without notice.
|
|
12
|
+
*/
|
|
13
|
+
import * as FileSystem from "@effect/platform/FileSystem";
|
|
14
|
+
import * as Path from "@effect/platform/Path";
|
|
15
|
+
import * as Effect from "effect/Effect";
|
|
16
|
+
import * as Option from "effect/Option";
|
|
17
|
+
import { Log, Spinner } from "../../../tui/index.js";
|
|
18
|
+
import { Workspace } from "../../../workspace/index.js";
|
|
19
|
+
/**
|
|
20
|
+
* Arguments for the packs publish command.
|
|
21
|
+
*/
|
|
22
|
+
export interface PublishPackHandlerArgs {
|
|
23
|
+
/** Pack name (@scope/name or bare name). */
|
|
24
|
+
readonly pack: string;
|
|
25
|
+
/** Named registry source to publish to. None = default/first configured. */
|
|
26
|
+
readonly registry: Option.Option<string>;
|
|
27
|
+
/** Skip confirmations. */
|
|
28
|
+
readonly yes: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Handles the `axm packs publish` command.
|
|
32
|
+
*/
|
|
33
|
+
export declare const handlePublishPack: (args: PublishPackHandlerArgs) => Effect.Effect<undefined, import("../../../tui/errors.js").PromptCancelled | import("../../../cli-error/cli-error.js").CliError, import("../../../tui/index.js").Confirm | Log | Spinner | import("../../../tui/index.js").TextInput | FileSystem.FileSystem | Path.Path | Workspace>;
|
|
34
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../../src/cli-commands/packs/publish/handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAE9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAgBxD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACzC,0BAA0B;IAC1B,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;CACvB;AAMD;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,sBAAsB,yRAyHd,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Publish command handler -- Effect-based orchestration for `axm packs publish`.
|
|
3
|
+
*
|
|
4
|
+
* Publishes a pack from `.axm/extensions/` to a target registry:
|
|
5
|
+
* 1. Registry guard (ensure registry configured)
|
|
6
|
+
* 2. Resolve extension name (bare name -> scope from settings)
|
|
7
|
+
* 3. Validate managed pack exists with manifest
|
|
8
|
+
* 4. Build plan with a single PublishPackOperation
|
|
9
|
+
* 5. Execute via resolvePlan
|
|
10
|
+
*
|
|
11
|
+
* @experimental This API is unstable and may change without notice.
|
|
12
|
+
*/
|
|
13
|
+
import * as FileSystem from "@effect/platform/FileSystem";
|
|
14
|
+
import * as Path from "@effect/platform/Path";
|
|
15
|
+
import { registryGuard } from "../../../sources/index.js";
|
|
16
|
+
import * as Effect from "effect/Effect";
|
|
17
|
+
import * as Option from "effect/Option";
|
|
18
|
+
import { makeCliError } from "../../../cli-error/index.js";
|
|
19
|
+
import { Log, Spinner } from "../../../tui/index.js";
|
|
20
|
+
import { Workspace } from "../../../workspace/index.js";
|
|
21
|
+
import { REGISTRY_EXTENSIONS_DIR } from "../../skills/constants.js";
|
|
22
|
+
import { hasScopePrefix, parseScopedName } from "../../skills/naming.js";
|
|
23
|
+
import { publishPack } from "./publish-pack.js";
|
|
24
|
+
// -----------------------------------------------------------------------------
|
|
25
|
+
// Constants
|
|
26
|
+
// -----------------------------------------------------------------------------
|
|
27
|
+
const PACK_MANIFEST_FILENAME = "axm-pack.json";
|
|
28
|
+
// -----------------------------------------------------------------------------
|
|
29
|
+
// Main Handler
|
|
30
|
+
// -----------------------------------------------------------------------------
|
|
31
|
+
/**
|
|
32
|
+
* Handles the `axm packs publish` command.
|
|
33
|
+
*/
|
|
34
|
+
export const handlePublishPack = (args) => Effect.gen(function* () {
|
|
35
|
+
const ws = yield* Workspace;
|
|
36
|
+
const path = yield* Path.Path;
|
|
37
|
+
const fs = yield* FileSystem.FileSystem;
|
|
38
|
+
const log = yield* Log;
|
|
39
|
+
const spinnerSvc = yield* Spinner;
|
|
40
|
+
const base = path.dirname(ws.path);
|
|
41
|
+
yield* log.info("axm packs publish");
|
|
42
|
+
// Step 1: Registry guard
|
|
43
|
+
yield* registryGuard;
|
|
44
|
+
// Step 2: Resolve pack name
|
|
45
|
+
const packName = yield* hasScopePrefix(args.pack)
|
|
46
|
+
? Effect.succeed(args.pack)
|
|
47
|
+
: ws.getConfiguredScope().pipe(Effect.map((scope) => `${scope}/${args.pack}`), Effect.mapError((e) => makeCliError({
|
|
48
|
+
code: "SCOPE_RESOLUTION_FAILED",
|
|
49
|
+
what: `Failed to resolve scope: ${e._tag}`,
|
|
50
|
+
howToFix: "Configure a scope in your settings with `axm init`.",
|
|
51
|
+
cause: e,
|
|
52
|
+
})));
|
|
53
|
+
// Parse scope and pack name from the full name
|
|
54
|
+
const { scope, skillName: shortName } = parseScopedName(packName);
|
|
55
|
+
// Step 3: Validate managed pack exists
|
|
56
|
+
const handle = yield* spinnerSvc.start("Validating pack...");
|
|
57
|
+
const packDir = path.join(base, REGISTRY_EXTENSIONS_DIR, scope, "packs", shortName);
|
|
58
|
+
const packDirExists = yield* fs.exists(packDir).pipe(Effect.orElseSucceed(() => false));
|
|
59
|
+
if (!packDirExists) {
|
|
60
|
+
yield* handle.stop("Failed");
|
|
61
|
+
return yield* Effect.fail(makeCliError({
|
|
62
|
+
code: "EXTENSION_NOT_FOUND",
|
|
63
|
+
what: `Managed pack not found: ${packName}`,
|
|
64
|
+
details: [`Expected at: ${packDir}`],
|
|
65
|
+
howToFix: "Only managed packs (in .axm/extensions/) can be published. Use `axm packs new` first.",
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
// Validate manifest exists
|
|
69
|
+
const manifestPath = path.join(packDir, PACK_MANIFEST_FILENAME);
|
|
70
|
+
const manifestExists = yield* fs.exists(manifestPath).pipe(Effect.orElseSucceed(() => false));
|
|
71
|
+
if (!manifestExists) {
|
|
72
|
+
yield* handle.stop("Failed");
|
|
73
|
+
return yield* Effect.fail(makeCliError({
|
|
74
|
+
code: "MISSING_MANIFEST",
|
|
75
|
+
what: `Missing manifest: ${PACK_MANIFEST_FILENAME}`,
|
|
76
|
+
details: [`Expected at: ${manifestPath}`],
|
|
77
|
+
howToFix: "Ensure the pack has a valid axm-pack.json manifest.",
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
yield* handle.stop(`Validated ${packName}`);
|
|
81
|
+
// Step 4: Determine target registry
|
|
82
|
+
const registrySources = yield* ws.getConfiguredRegistrySources(Option.none()).pipe(Effect.mapError((e) => makeCliError({
|
|
83
|
+
code: "REGISTRY_SOURCES_FAILED",
|
|
84
|
+
what: `Failed to get registry sources: ${e._tag}`,
|
|
85
|
+
cause: e,
|
|
86
|
+
})));
|
|
87
|
+
if (registrySources.length === 0) {
|
|
88
|
+
return yield* Effect.fail(makeCliError({
|
|
89
|
+
code: "NO_REGISTRY_CONFIGURED",
|
|
90
|
+
what: "No registry sources configured",
|
|
91
|
+
howToFix: "Run the registry guard first.",
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
const registryName = Option.match(args.registry, {
|
|
95
|
+
onNone: () => registrySources[0].name,
|
|
96
|
+
onSome: (name) => name,
|
|
97
|
+
});
|
|
98
|
+
// Step 5: Build plan with a single PublishPackOperation
|
|
99
|
+
const steps = [
|
|
100
|
+
{
|
|
101
|
+
_tag: "PlannedJobStep",
|
|
102
|
+
operation: {
|
|
103
|
+
name: "publish-pack",
|
|
104
|
+
args: {
|
|
105
|
+
name: packName,
|
|
106
|
+
registryName,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
expectedResult: { result: "success", message: `Published ${packName}` },
|
|
110
|
+
label: `Publish ${packName}`,
|
|
111
|
+
},
|
|
112
|
+
];
|
|
113
|
+
const plan = {
|
|
114
|
+
name: "Publish pack",
|
|
115
|
+
description: Option.some(`Publish ${packName} to registry "${registryName}"`),
|
|
116
|
+
jobs: [{ steps, concurrency: 1 }],
|
|
117
|
+
};
|
|
118
|
+
yield* ws.resolvePlan(plan, {
|
|
119
|
+
"publish-pack": publishPack,
|
|
120
|
+
});
|
|
121
|
+
yield* log.success("Done");
|
|
122
|
+
}).pipe(Effect.withSpan("PublishPack.handle"));
|
|
123
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../../../src/cli-commands/packs/publish/handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,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
3
|
+
* archive, computes the SHA-256 checksum, and publishes to a target registry.
|
|
4
|
+
*
|
|
5
|
+
* Pipeline: validate manifest -> build archive -> compute checksum ->
|
|
6
|
+
* resolve registry provider -> publish version (idempotent).
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
*/
|
|
10
|
+
import * as FileSystem from "@effect/platform/FileSystem";
|
|
11
|
+
import * as Path from "@effect/platform/Path";
|
|
12
|
+
import type { OperationHandler } from "../../../workspace/apply-plan.js";
|
|
13
|
+
import { Workspace } from "../../../workspace/service.js";
|
|
14
|
+
import type { PublishPackOperation } from "../operations.js";
|
|
15
|
+
export type { PublishPackOperation } from "../operations.js";
|
|
16
|
+
/**
|
|
17
|
+
* Publish-pack operation handler.
|
|
18
|
+
*
|
|
19
|
+
* 1. Read and validate `axm-pack.json` manifest
|
|
20
|
+
* 2. Build zip archive of pack directory
|
|
21
|
+
* 3. Compute SHA-256 checksum
|
|
22
|
+
* 4. Resolve target registry provider by source name
|
|
23
|
+
* 5. Publish version (idempotent: same checksum = no-op, different checksum = error)
|
|
24
|
+
*/
|
|
25
|
+
export declare const publishPack: OperationHandler<PublishPackOperation, FileSystem.FileSystem | Path.Path | Workspace>;
|
|
26
|
+
//# sourceMappingURL=publish-pack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish-pack.d.ts","sourceRoot":"","sources":["../../../../../src/cli-commands/packs/publish/publish-pack.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAY9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAmD7D;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,EAAE,gBAAgB,CACxC,oBAAoB,EACpB,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,GAAG,SAAS,CA0G3C,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Publish pack executor -- reads a managed pack's manifest, builds a zip
|
|
3
|
+
* archive, computes the SHA-256 checksum, and publishes to a target registry.
|
|
4
|
+
*
|
|
5
|
+
* Pipeline: validate manifest -> build archive -> compute checksum ->
|
|
6
|
+
* resolve registry provider -> publish version (idempotent).
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
*/
|
|
10
|
+
import * as FileSystem from "@effect/platform/FileSystem";
|
|
11
|
+
import * as Path from "@effect/platform/Path";
|
|
12
|
+
import * as Effect from "effect/Effect";
|
|
13
|
+
import * as Option from "effect/Option";
|
|
14
|
+
import * as Schema from "effect/Schema";
|
|
15
|
+
import { PackManifestSchema, } from "../../../extensions/packs/manifest-schema.js";
|
|
16
|
+
import { createRegistryProvider } from "../../../sources/providers/registry.js";
|
|
17
|
+
import { computeChecksum } from "../../../utils/checksum.js";
|
|
18
|
+
import { makeCliError } from "../../../cli-error/index.js";
|
|
19
|
+
import { Workspace } from "../../../workspace/service.js";
|
|
20
|
+
import { REGISTRY_EXTENSIONS_DIR } from "../../skills/constants.js";
|
|
21
|
+
import { parseScopedName } from "../../skills/naming.js";
|
|
22
|
+
// -----------------------------------------------------------------------------
|
|
23
|
+
// Constants
|
|
24
|
+
// -----------------------------------------------------------------------------
|
|
25
|
+
const PACK_MANIFEST_FILENAME = "axm-pack.json";
|
|
26
|
+
// -----------------------------------------------------------------------------
|
|
27
|
+
// Helpers
|
|
28
|
+
// -----------------------------------------------------------------------------
|
|
29
|
+
/**
|
|
30
|
+
* Build a zip archive of a directory.
|
|
31
|
+
* Files are stored at the root of the zip (no enclosing directory).
|
|
32
|
+
*/
|
|
33
|
+
const buildZipArchive = (dir) => Effect.tryPromise({
|
|
34
|
+
try: async () => {
|
|
35
|
+
const { execFileSync } = await import("node:child_process");
|
|
36
|
+
const { readFile, mkdtemp, rm } = await import("node:fs/promises");
|
|
37
|
+
const { tmpdir } = await import("node:os");
|
|
38
|
+
const p = await import("node:path");
|
|
39
|
+
const tmpDir = await mkdtemp(p.join(tmpdir(), "axm-publish-"));
|
|
40
|
+
const archivePath = p.join(tmpDir, "archive.zip");
|
|
41
|
+
// Create deterministic zip (strip extra attributes, normalize timestamps)
|
|
42
|
+
execFileSync("find", [dir, "-exec", "touch", "-t", "202001010000.00", "{}", "+"]);
|
|
43
|
+
execFileSync("zip", ["-r", "-q", "-X", "-D", archivePath, "."], {
|
|
44
|
+
cwd: dir,
|
|
45
|
+
stdio: "pipe",
|
|
46
|
+
});
|
|
47
|
+
const bytes = await readFile(archivePath);
|
|
48
|
+
await rm(tmpDir, { recursive: true, force: true });
|
|
49
|
+
return new Uint8Array(bytes);
|
|
50
|
+
},
|
|
51
|
+
catch: (e) => makeCliError({
|
|
52
|
+
code: "PUBLISH_PACK_ARCHIVE_FAILED",
|
|
53
|
+
what: "Failed to build zip archive",
|
|
54
|
+
cause: e,
|
|
55
|
+
}),
|
|
56
|
+
});
|
|
57
|
+
// -----------------------------------------------------------------------------
|
|
58
|
+
// Public API
|
|
59
|
+
// -----------------------------------------------------------------------------
|
|
60
|
+
/**
|
|
61
|
+
* Publish-pack operation handler.
|
|
62
|
+
*
|
|
63
|
+
* 1. Read and validate `axm-pack.json` manifest
|
|
64
|
+
* 2. Build zip archive of pack directory
|
|
65
|
+
* 3. Compute SHA-256 checksum
|
|
66
|
+
* 4. Resolve target registry provider by source name
|
|
67
|
+
* 5. Publish version (idempotent: same checksum = no-op, different checksum = error)
|
|
68
|
+
*/
|
|
69
|
+
export const publishPack = (op) => Effect.gen(function* () {
|
|
70
|
+
const fs = yield* FileSystem.FileSystem;
|
|
71
|
+
const path = yield* Path.Path;
|
|
72
|
+
const ws = yield* Workspace;
|
|
73
|
+
const base = path.dirname(ws.path);
|
|
74
|
+
const { scope, skillName: shortName } = parseScopedName(op.args.name);
|
|
75
|
+
// Locate the managed pack directory
|
|
76
|
+
const packDir = path.join(base, REGISTRY_EXTENSIONS_DIR, scope, "packs", shortName);
|
|
77
|
+
const packDirExists = yield* fs.exists(packDir).pipe(Effect.orElseSucceed(() => false));
|
|
78
|
+
if (!packDirExists) {
|
|
79
|
+
return yield* makeCliError({
|
|
80
|
+
code: "PUBLISH_PACK_NOT_FOUND",
|
|
81
|
+
what: `Managed pack not found: ${packDir}`,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
// Read and validate manifest
|
|
85
|
+
const manifestPath = path.join(packDir, PACK_MANIFEST_FILENAME);
|
|
86
|
+
const manifestContent = yield* fs.readFileString(manifestPath).pipe(Effect.mapError((e) => makeCliError({
|
|
87
|
+
code: "PUBLISH_PACK_MANIFEST_READ_FAILED",
|
|
88
|
+
what: `Failed to read manifest: ${manifestPath}`,
|
|
89
|
+
cause: e,
|
|
90
|
+
})));
|
|
91
|
+
const manifestJson = yield* Effect.try({
|
|
92
|
+
try: () => JSON.parse(manifestContent),
|
|
93
|
+
catch: (e) => makeCliError({
|
|
94
|
+
code: "PUBLISH_PACK_MANIFEST_PARSE_FAILED",
|
|
95
|
+
what: `Invalid JSON in manifest: ${manifestPath}`,
|
|
96
|
+
cause: e,
|
|
97
|
+
}),
|
|
98
|
+
});
|
|
99
|
+
const manifest = yield* Schema.decodeUnknown(PackManifestSchema)(manifestJson).pipe(Effect.mapError((e) => makeCliError({
|
|
100
|
+
code: "PUBLISH_PACK_MANIFEST_SCHEMA_INVALID",
|
|
101
|
+
what: `Invalid manifest schema: ${manifestPath}`,
|
|
102
|
+
cause: e,
|
|
103
|
+
})));
|
|
104
|
+
// Build zip archive from pack directory
|
|
105
|
+
const archive = yield* buildZipArchive(packDir);
|
|
106
|
+
// Compute checksum
|
|
107
|
+
const checksum = yield* computeChecksum(archive);
|
|
108
|
+
// Resolve target registry source
|
|
109
|
+
const registrySource = yield* ws.getConfiguredSourceByName(op.args.registryName).pipe(Effect.mapError((e) => makeCliError({
|
|
110
|
+
code: "PUBLISH_PACK_REGISTRY_LOOKUP_FAILED",
|
|
111
|
+
what: `Failed to lookup registry source "${op.args.registryName}"`,
|
|
112
|
+
cause: e,
|
|
113
|
+
})));
|
|
114
|
+
if (Option.isNone(registrySource) || registrySource.value.type !== "registry") {
|
|
115
|
+
return yield* makeCliError({
|
|
116
|
+
code: "PUBLISH_PACK_REGISTRY_NOT_FOUND",
|
|
117
|
+
what: `Registry source "${op.args.registryName}" not found or not a registry source`,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const provider = createRegistryProvider(registrySource.value.url.href);
|
|
121
|
+
// Build version entry metadata
|
|
122
|
+
const versionEntry = {
|
|
123
|
+
version: manifest.version,
|
|
124
|
+
published: new Date().toISOString(),
|
|
125
|
+
agents: [],
|
|
126
|
+
checksum,
|
|
127
|
+
};
|
|
128
|
+
// Publish to registry (idempotent)
|
|
129
|
+
yield* provider
|
|
130
|
+
.publishVersion(scope, "pack", shortName, manifest.version, archive, versionEntry)
|
|
131
|
+
.pipe(Effect.mapError((e) => makeCliError({
|
|
132
|
+
code: "PUBLISH_PACK_PUBLISH_FAILED",
|
|
133
|
+
what: "Failed to publish to registry",
|
|
134
|
+
details: [e.what],
|
|
135
|
+
cause: e,
|
|
136
|
+
})));
|
|
137
|
+
return {
|
|
138
|
+
result: "success",
|
|
139
|
+
message: `Published ${op.args.name}@${manifest.version}`,
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
//# sourceMappingURL=publish-pack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish-pack.js","sourceRoot":"","sources":["../../../../../src/cli-commands/packs/publish/publish-pack.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAA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C;IAEvE,+BAA+B;IAC/B,MAAM,YAAY,GAAiB;QACjC,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,MAAM,EAAE,EAAE;QACV,QAAQ;KACT,CAAC;IAEF,mCAAmC;IACnC,KAAK,CAAC,CAAC,QAAQ;SACZ,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC;SACjF,IAAI,CACH,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CACpB,YAAY,CAAC;QACX,IAAI,EAAE,6BAA6B;QACnC,IAAI,EAAE,+BAA+B;QACrC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACjB,KAAK,EAAE,CAAC;KACT,CAAC,CACH,CACF,CAAC;IAEJ,OAAO;QACL,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,aAAa,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,QAAQ,CAAC,OAAO,EAAE;KAC/B,CAAC;AAC9B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Packs remove command yargs definition — wires handler to `axm packs remove`.
|
|
3
|
+
*
|
|
4
|
+
* @experimental This API is unstable and may change without notice.
|
|
5
|
+
*/
|
|
6
|
+
import type { CommandModule } from "yargs";
|
|
7
|
+
export interface PacksRemoveCommandArgs {
|
|
8
|
+
pack: string;
|
|
9
|
+
extension: string;
|
|
10
|
+
yes: boolean;
|
|
11
|
+
"non-interactive": boolean | undefined;
|
|
12
|
+
}
|
|
13
|
+
export declare const packsRemoveCommand: CommandModule<{}, PacksRemoveCommandArgs>;
|
|
14
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/cli-commands/packs/remove/command.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAK3C,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,OAAO,CAAC;IACb,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAAC;CACxC;AAGD,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,EAAE,EAAE,sBAAsB,CAmDxE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Packs remove command yargs definition — wires handler to `axm packs remove`.
|
|
3
|
+
*
|
|
4
|
+
* @experimental This API is unstable and may change without notice.
|
|
5
|
+
*/
|
|
6
|
+
import * as Option from "effect/Option";
|
|
7
|
+
import { run } from "../../../runtime/index.js";
|
|
8
|
+
import { handlePacksRemove } from "./handler.js";
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- yargs convention
|
|
10
|
+
export const packsRemoveCommand = {
|
|
11
|
+
command: "remove <pack> <extension>",
|
|
12
|
+
describe: "Remove an extension from a pack manifest",
|
|
13
|
+
builder: (yargs) => yargs
|
|
14
|
+
.positional("pack", {
|
|
15
|
+
type: "string",
|
|
16
|
+
describe: "Name of the pack",
|
|
17
|
+
demandOption: true,
|
|
18
|
+
})
|
|
19
|
+
.positional("extension", {
|
|
20
|
+
type: "string",
|
|
21
|
+
describe: "Extension name or glob pattern",
|
|
22
|
+
demandOption: true,
|
|
23
|
+
})
|
|
24
|
+
.option("yes", {
|
|
25
|
+
alias: "y",
|
|
26
|
+
type: "boolean",
|
|
27
|
+
describe: "Skip all confirmation prompts",
|
|
28
|
+
default: false,
|
|
29
|
+
})
|
|
30
|
+
.option("non-interactive", {
|
|
31
|
+
type: "boolean",
|
|
32
|
+
describe: "Disable all interactive prompts",
|
|
33
|
+
})
|
|
34
|
+
.example("$0 packs remove frontend-tools @acme/code-review", "Remove a specific extension from a pack")
|
|
35
|
+
.example('$0 packs remove my-pack "@acme/effect-*"', "Remove all matching extensions via glob"),
|
|
36
|
+
handler: async (argv) => {
|
|
37
|
+
await run(handlePacksRemove({
|
|
38
|
+
pack: argv.pack,
|
|
39
|
+
extension: argv.extension,
|
|
40
|
+
yes: argv.yes,
|
|
41
|
+
}), {
|
|
42
|
+
workspace: {
|
|
43
|
+
global: false,
|
|
44
|
+
yes: argv.yes,
|
|
45
|
+
nonInteractive: Option.fromNullable(argv["non-interactive"]),
|
|
46
|
+
preview: false,
|
|
47
|
+
agents: Option.none(),
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../../../src/cli-commands/packs/remove/command.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AASjD,uFAAuF;AACvF,MAAM,CAAC,MAAM,kBAAkB,GAA8C;IAC3E,OAAO,EAAE,2BAA2B;IACpC,QAAQ,EAAE,0CAA0C;IACpD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CACjB,KAAK;SACF,UAAU,CAAC,MAAM,EAAE;QAClB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,kBAAkB;QAC5B,YAAY,EAAE,IAAI;KACnB,CAAC;SACD,UAAU,CAAC,WAAW,EAAE;QACvB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,gCAAgC;QAC1C,YAAY,EAAE,IAAI;KACnB,CAAC;SACD,MAAM,CAAC,KAAK,EAAE;QACb,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,+BAA+B;QACzC,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,iBAAiB,EAAE;QACzB,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,iCAAiC;KAC5C,CAAC;SACD,OAAO,CACN,kDAAkD,EAClD,yCAAyC,CAC1C;SACA,OAAO,CACN,0CAA0C,EAC1C,yCAAyC,CAC1C;IACL,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACtB,MAAM,GAAG,CACP,iBAAiB,CAAC;YAChB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAC,EACF;YACE,SAAS,EAAE;gBACT,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,cAAc,EAAE,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;gBAC5D,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;aACtB;SACF,CACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Packs remove handler — removes extensions from a pack manifest.
|
|
3
|
+
*
|
|
4
|
+
* Supports glob expansion against pack manifest entries.
|
|
5
|
+
* This is a manifest edit only — it does not uninstall extensions.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This API is unstable and may change without notice.
|
|
8
|
+
*/
|
|
9
|
+
import * as FileSystem from "@effect/platform/FileSystem";
|
|
10
|
+
import * as Path from "@effect/platform/Path";
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import { Log } from "../../../tui/index.js";
|
|
13
|
+
import { Workspace } from "../../../workspace/index.js";
|
|
14
|
+
export interface PacksRemoveHandlerArgs {
|
|
15
|
+
/** Pack name (without scope). */
|
|
16
|
+
readonly pack: string;
|
|
17
|
+
/** Extension name or glob pattern. */
|
|
18
|
+
readonly extension: string;
|
|
19
|
+
/** Skip confirmations. */
|
|
20
|
+
readonly yes: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const handlePacksRemove: (args: PacksRemoveHandlerArgs) => Effect.Effect<undefined, import("../../../cli-error/cli-error.js").CliError, Log | FileSystem.FileSystem | Path.Path | Workspace>;
|
|
23
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../../src/cli-commands/packs/remove/handler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAcxD,MAAM,WAAW,sBAAsB;IACrC,iCAAiC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,0BAA0B;IAC1B,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;CACvB;AAkBD,eAAO,MAAM,iBAAiB,GAAI,MAAM,sBAAsB,sIAiHd,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Packs remove handler — removes extensions from a pack manifest.
|
|
3
|
+
*
|
|
4
|
+
* Supports glob expansion against pack manifest entries.
|
|
5
|
+
* This is a manifest edit only — it does not uninstall extensions.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This API is unstable and may change without notice.
|
|
8
|
+
*/
|
|
9
|
+
import * as FileSystem from "@effect/platform/FileSystem";
|
|
10
|
+
import * as Path from "@effect/platform/Path";
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import { makeCliError } from "../../../cli-error/index.js";
|
|
13
|
+
import { Log } from "../../../tui/index.js";
|
|
14
|
+
import { Workspace } from "../../../workspace/index.js";
|
|
15
|
+
import { expandGlobs } from "../../../skills/index.js";
|
|
16
|
+
import { computePackPaths } from "../pack-paths.js";
|
|
17
|
+
// -----------------------------------------------------------------------------
|
|
18
|
+
// Constants
|
|
19
|
+
// -----------------------------------------------------------------------------
|
|
20
|
+
const PACK_MANIFEST_FILENAME = "axm-pack.json";
|
|
21
|
+
// -----------------------------------------------------------------------------
|
|
22
|
+
// Main Handler
|
|
23
|
+
// -----------------------------------------------------------------------------
|
|
24
|
+
export const handlePacksRemove = (args) => Effect.gen(function* () {
|
|
25
|
+
const ws = yield* Workspace;
|
|
26
|
+
const fs = yield* FileSystem.FileSystem;
|
|
27
|
+
const path = yield* Path.Path;
|
|
28
|
+
const log = yield* Log;
|
|
29
|
+
yield* log.info("axm packs remove");
|
|
30
|
+
// Step 1: Find the pack
|
|
31
|
+
const configuredPacks = yield* ws.getConfiguredPacks();
|
|
32
|
+
const packEntry = configuredPacks[args.pack];
|
|
33
|
+
if (packEntry === undefined) {
|
|
34
|
+
return yield* makeCliError({
|
|
35
|
+
code: "PACK_NOT_FOUND",
|
|
36
|
+
what: `Pack '${args.pack}' not found`,
|
|
37
|
+
howToFix: "Check available packs or create one with `axm packs new`",
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
// Resolve pack scope
|
|
41
|
+
const packSource = typeof packEntry === "string" ? packEntry : packEntry.source;
|
|
42
|
+
const scopeMatch = packSource.match(/^(@[\w-]+)\//);
|
|
43
|
+
const packScope = scopeMatch ? scopeMatch[1] : yield* ws.getConfiguredScope();
|
|
44
|
+
const base = path.dirname(ws.path);
|
|
45
|
+
// Step 2: Read pack manifest
|
|
46
|
+
const packDir = computePackPaths(path.join, base, packScope, args.pack);
|
|
47
|
+
const manifestPath = path.join(packDir.canonicalPath, PACK_MANIFEST_FILENAME);
|
|
48
|
+
const manifestContent = yield* fs.readFileString(manifestPath).pipe(Effect.mapError((e) => makeCliError({
|
|
49
|
+
code: "PACK_NOT_FOUND",
|
|
50
|
+
what: `Pack manifest not found at ${manifestPath}`,
|
|
51
|
+
howToFix: "Ensure the pack exists on disk",
|
|
52
|
+
cause: e,
|
|
53
|
+
})));
|
|
54
|
+
const manifest = yield* Effect.try({
|
|
55
|
+
try: () => JSON.parse(manifestContent),
|
|
56
|
+
catch: (e) => makeCliError({
|
|
57
|
+
code: "PACK_MANIFEST_PARSE_FAILED",
|
|
58
|
+
what: `Failed to parse pack manifest: ${manifestPath}`,
|
|
59
|
+
cause: e,
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
62
|
+
// Step 3: Collect all extension names from the manifest (across all sections)
|
|
63
|
+
const allEntries = [];
|
|
64
|
+
for (const section of ["skills", "commands", "mcp-servers"]) {
|
|
65
|
+
const entries = manifest[section] ?? {};
|
|
66
|
+
for (const name of Object.keys(entries)) {
|
|
67
|
+
allEntries.push({ section, name });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const allNames = allEntries.map((e) => e.name);
|
|
71
|
+
// Step 4: Match extensions by name or glob
|
|
72
|
+
const isGlob = args.extension.includes("*");
|
|
73
|
+
const matchedNames = isGlob
|
|
74
|
+
? expandGlobs([args.extension], allNames)
|
|
75
|
+
: allNames.includes(args.extension)
|
|
76
|
+
? [args.extension]
|
|
77
|
+
: [];
|
|
78
|
+
if (matchedNames.length === 0) {
|
|
79
|
+
if (isGlob) {
|
|
80
|
+
return yield* makeCliError({
|
|
81
|
+
code: "NO_EXTENSIONS_MATCHED",
|
|
82
|
+
what: `No extensions in pack match '${args.extension}'`,
|
|
83
|
+
details: allNames.length > 0 ? [`Available: ${allNames.join(", ")}`] : [],
|
|
84
|
+
howToFix: "Check pack contents",
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return yield* makeCliError({
|
|
88
|
+
code: "EXTENSION_NOT_IN_PACK",
|
|
89
|
+
what: `Extension '${args.extension}' is not in the pack`,
|
|
90
|
+
details: allNames.length > 0 ? [`Available: ${allNames.join(", ")}`] : [],
|
|
91
|
+
howToFix: "Check the pack manifest for available extensions",
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
// Step 5: Remove matched extensions from the relevant sections
|
|
95
|
+
const matchedSet = new Set(matchedNames);
|
|
96
|
+
for (const section of ["skills", "commands", "mcp-servers"]) {
|
|
97
|
+
const entries = manifest[section];
|
|
98
|
+
if (entries === undefined)
|
|
99
|
+
continue;
|
|
100
|
+
for (const name of Object.keys(entries)) {
|
|
101
|
+
if (matchedSet.has(name)) {
|
|
102
|
+
delete entries[name];
|
|
103
|
+
yield* log.info(`Removed ${name} from ${section}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Step 6: Write updated manifest
|
|
108
|
+
yield* fs.writeFileString(manifestPath, JSON.stringify(manifest, null, 2) + "\n").pipe(Effect.mapError((e) => makeCliError({
|
|
109
|
+
code: "PACK_WRITE_FAILED",
|
|
110
|
+
what: `Failed to write pack manifest: ${manifestPath}`,
|
|
111
|
+
cause: e,
|
|
112
|
+
})));
|
|
113
|
+
yield* log.success("Done");
|
|
114
|
+
}).pipe(Effect.withSpan("PacksRemove.handle"));
|
|
115
|
+
//# sourceMappingURL=handler.js.map
|