@ai-primitives-hub/core 0.0.1-alpha.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/README.md +18 -0
- package/dist/domain/bundle/id.d.ts +60 -0
- package/dist/domain/bundle/id.d.ts.map +1 -0
- package/dist/domain/bundle/id.js +75 -0
- package/dist/domain/bundle/id.js.map +1 -0
- package/dist/domain/bundle/identity-matcher.d.ts +48 -0
- package/dist/domain/bundle/identity-matcher.d.ts.map +1 -0
- package/dist/domain/bundle/identity-matcher.js +57 -0
- package/dist/domain/bundle/identity-matcher.js.map +1 -0
- package/dist/domain/bundle/types.d.ts +138 -0
- package/dist/domain/bundle/types.d.ts.map +1 -0
- package/dist/domain/bundle/types.js +17 -0
- package/dist/domain/bundle/types.js.map +1 -0
- package/dist/domain/bundle/version.d.ts +51 -0
- package/dist/domain/bundle/version.d.ts.map +1 -0
- package/dist/domain/bundle/version.js +176 -0
- package/dist/domain/bundle/version.js.map +1 -0
- package/dist/domain/collection/manifest-validator.d.ts +47 -0
- package/dist/domain/collection/manifest-validator.d.ts.map +1 -0
- package/dist/domain/collection/manifest-validator.js +83 -0
- package/dist/domain/collection/manifest-validator.js.map +1 -0
- package/dist/domain/collection/types.d.ts +201 -0
- package/dist/domain/collection/types.d.ts.map +1 -0
- package/dist/domain/collection/types.js +17 -0
- package/dist/domain/collection/types.js.map +1 -0
- package/dist/domain/collection/validate.d.ts +51 -0
- package/dist/domain/collection/validate.d.ts.map +1 -0
- package/dist/domain/collection/validate.js +263 -0
- package/dist/domain/collection/validate.js.map +1 -0
- package/dist/domain/discovery/types.d.ts +95 -0
- package/dist/domain/discovery/types.d.ts.map +1 -0
- package/dist/domain/discovery/types.js +13 -0
- package/dist/domain/discovery/types.js.map +1 -0
- package/dist/domain/errors.d.ts +23 -0
- package/dist/domain/errors.d.ts.map +1 -0
- package/dist/domain/errors.js +41 -0
- package/dist/domain/errors.js.map +1 -0
- package/dist/domain/hub/types.d.ts +254 -0
- package/dist/domain/hub/types.d.ts.map +1 -0
- package/dist/domain/hub/types.js +11 -0
- package/dist/domain/hub/types.js.map +1 -0
- package/dist/domain/hub/validate.d.ts +40 -0
- package/dist/domain/hub/validate.d.ts.map +1 -0
- package/dist/domain/hub/validate.js +89 -0
- package/dist/domain/hub/validate.js.map +1 -0
- package/dist/domain/index.d.ts +31 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +47 -0
- package/dist/domain/index.js.map +1 -0
- package/dist/domain/install/copilot-file-type.d.ts +84 -0
- package/dist/domain/install/copilot-file-type.d.ts.map +1 -0
- package/dist/domain/install/copilot-file-type.js +190 -0
- package/dist/domain/install/copilot-file-type.js.map +1 -0
- package/dist/domain/install/installable.d.ts +58 -0
- package/dist/domain/install/installable.d.ts.map +1 -0
- package/dist/domain/install/installable.js +36 -0
- package/dist/domain/install/installable.js.map +1 -0
- package/dist/domain/install/layout.d.ts +84 -0
- package/dist/domain/install/layout.d.ts.map +1 -0
- package/dist/domain/install/layout.js +70 -0
- package/dist/domain/install/layout.js.map +1 -0
- package/dist/domain/install/target.d.ts +70 -0
- package/dist/domain/install/target.d.ts.map +1 -0
- package/dist/domain/install/target.js +43 -0
- package/dist/domain/install/target.js.map +1 -0
- package/dist/domain/install/transform.d.ts +47 -0
- package/dist/domain/install/transform.d.ts.map +1 -0
- package/dist/domain/install/transform.js +24 -0
- package/dist/domain/install/transform.js.map +1 -0
- package/dist/domain/install/types.d.ts +51 -0
- package/dist/domain/install/types.d.ts.map +1 -0
- package/dist/domain/install/types.js +3 -0
- package/dist/domain/install/types.js.map +1 -0
- package/dist/domain/primitive/types.d.ts +59 -0
- package/dist/domain/primitive/types.d.ts.map +1 -0
- package/dist/domain/primitive/types.js +22 -0
- package/dist/domain/primitive/types.js.map +1 -0
- package/dist/domain/registry/guards.d.ts +28 -0
- package/dist/domain/registry/guards.d.ts.map +1 -0
- package/dist/domain/registry/guards.js +33 -0
- package/dist/domain/registry/guards.js.map +1 -0
- package/dist/domain/registry/settings.d.ts +49 -0
- package/dist/domain/registry/settings.d.ts.map +1 -0
- package/dist/domain/registry/settings.js +3 -0
- package/dist/domain/registry/settings.js.map +1 -0
- package/dist/domain/registry/types.d.ts +91 -0
- package/dist/domain/registry/types.d.ts.map +1 -0
- package/dist/domain/registry/types.js +3 -0
- package/dist/domain/registry/types.js.map +1 -0
- package/dist/domain/registry-error.d.ts +69 -0
- package/dist/domain/registry-error.d.ts.map +1 -0
- package/dist/domain/registry-error.js +87 -0
- package/dist/domain/registry-error.js.map +1 -0
- package/dist/domain/scaffold/index.d.ts +9 -0
- package/dist/domain/scaffold/index.d.ts.map +1 -0
- package/dist/domain/scaffold/index.js +13 -0
- package/dist/domain/scaffold/index.js.map +1 -0
- package/dist/domain/scaffold/types.d.ts +135 -0
- package/dist/domain/scaffold/types.d.ts.map +1 -0
- package/dist/domain/scaffold/types.js +44 -0
- package/dist/domain/scaffold/types.js.map +1 -0
- package/dist/domain/skill/validate.d.ts +52 -0
- package/dist/domain/skill/validate.d.ts.map +1 -0
- package/dist/domain/skill/validate.js +108 -0
- package/dist/domain/skill/validate.js.map +1 -0
- package/dist/domain/source/types.d.ts +72 -0
- package/dist/domain/source/types.d.ts.map +1 -0
- package/dist/domain/source/types.js +14 -0
- package/dist/domain/source/types.js.map +1 -0
- package/dist/domain/source-id.d.ts +41 -0
- package/dist/domain/source-id.d.ts.map +1 -0
- package/dist/domain/source-id.js +90 -0
- package/dist/domain/source-id.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/ports/app-storage.d.ts +65 -0
- package/dist/ports/app-storage.d.ts.map +1 -0
- package/dist/ports/app-storage.js +22 -0
- package/dist/ports/app-storage.js.map +1 -0
- package/dist/ports/bundle-downloader.d.ts +28 -0
- package/dist/ports/bundle-downloader.d.ts.map +1 -0
- package/dist/ports/bundle-downloader.js +3 -0
- package/dist/ports/bundle-downloader.js.map +1 -0
- package/dist/ports/bundle-extractor.d.ts +21 -0
- package/dist/ports/bundle-extractor.d.ts.map +1 -0
- package/dist/ports/bundle-extractor.js +8 -0
- package/dist/ports/bundle-extractor.js.map +1 -0
- package/dist/ports/clock.d.ts +29 -0
- package/dist/ports/clock.d.ts.map +1 -0
- package/dist/ports/clock.js +13 -0
- package/dist/ports/clock.js.map +1 -0
- package/dist/ports/copilot-sdk.d.ts +80 -0
- package/dist/ports/copilot-sdk.d.ts.map +1 -0
- package/dist/ports/copilot-sdk.js +16 -0
- package/dist/ports/copilot-sdk.js.map +1 -0
- package/dist/ports/filesystem.d.ts +53 -0
- package/dist/ports/filesystem.d.ts.map +1 -0
- package/dist/ports/filesystem.js +14 -0
- package/dist/ports/filesystem.js.map +1 -0
- package/dist/ports/github-api.d.ts +62 -0
- package/dist/ports/github-api.d.ts.map +1 -0
- package/dist/ports/github-api.js +19 -0
- package/dist/ports/github-api.js.map +1 -0
- package/dist/ports/http.d.ts +58 -0
- package/dist/ports/http.d.ts.map +1 -0
- package/dist/ports/http.js +12 -0
- package/dist/ports/http.js.map +1 -0
- package/dist/ports/index.d.ts +23 -0
- package/dist/ports/index.d.ts.map +1 -0
- package/dist/ports/index.js +39 -0
- package/dist/ports/index.js.map +1 -0
- package/dist/ports/layout-config-loader.d.ts +27 -0
- package/dist/ports/layout-config-loader.d.ts.map +1 -0
- package/dist/ports/layout-config-loader.js +3 -0
- package/dist/ports/layout-config-loader.js.map +1 -0
- package/dist/ports/process-runner.d.ts +31 -0
- package/dist/ports/process-runner.d.ts.map +1 -0
- package/dist/ports/process-runner.js +14 -0
- package/dist/ports/process-runner.js.map +1 -0
- package/dist/ports/registry-operations.d.ts +157 -0
- package/dist/ports/registry-operations.d.ts.map +1 -0
- package/dist/ports/registry-operations.js +3 -0
- package/dist/ports/registry-operations.js.map +1 -0
- package/dist/ports/resource-transformer.d.ts +28 -0
- package/dist/ports/resource-transformer.d.ts.map +1 -0
- package/dist/ports/resource-transformer.js +3 -0
- package/dist/ports/resource-transformer.js.map +1 -0
- package/dist/ports/source-adapter.d.ts +43 -0
- package/dist/ports/source-adapter.d.ts.map +1 -0
- package/dist/ports/source-adapter.js +3 -0
- package/dist/ports/source-adapter.js.map +1 -0
- package/dist/ports/source-resolver.d.ts +19 -0
- package/dist/ports/source-resolver.d.ts.map +1 -0
- package/dist/ports/source-resolver.js +3 -0
- package/dist/ports/source-resolver.js.map +1 -0
- package/dist/ports/target-writer.d.ts +37 -0
- package/dist/ports/target-writer.d.ts.map +1 -0
- package/dist/ports/target-writer.js +3 -0
- package/dist/ports/target-writer.js.map +1 -0
- package/dist/ports/telemetry.d.ts +22 -0
- package/dist/ports/telemetry.d.ts.map +1 -0
- package/dist/ports/telemetry.js +11 -0
- package/dist/ports/telemetry.js.map +1 -0
- package/dist/ports/update-notifier.d.ts +22 -0
- package/dist/ports/update-notifier.d.ts.map +1 -0
- package/dist/ports/update-notifier.js +12 -0
- package/dist/ports/update-notifier.js.map +1 -0
- package/dist/ports/update-store.d.ts +25 -0
- package/dist/ports/update-store.d.ts.map +1 -0
- package/dist/ports/update-store.js +12 -0
- package/dist/ports/update-store.js.map +1 -0
- package/dist/public/schemas/apm.schema.json +59 -0
- package/dist/public/schemas/collection.schema.json +345 -0
- package/dist/public/schemas/default-hubs-config.schema.json +68 -0
- package/dist/public/schemas/hub-config.schema.json +389 -0
- package/dist/public/schemas/lockfile.schema.json +243 -0
- package/package.json +50 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.changed = exports.noChange = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Create a TransformResult indicating no change.
|
|
6
|
+
* @param content - The (unchanged) content.
|
|
7
|
+
* @returns TransformResult with modified=false.
|
|
8
|
+
*/
|
|
9
|
+
const noChange = (content) => ({
|
|
10
|
+
content,
|
|
11
|
+
modified: false
|
|
12
|
+
});
|
|
13
|
+
exports.noChange = noChange;
|
|
14
|
+
/**
|
|
15
|
+
* Create a TransformResult indicating a change.
|
|
16
|
+
* @param content - The transformed content.
|
|
17
|
+
* @returns TransformResult with modified=true.
|
|
18
|
+
*/
|
|
19
|
+
const changed = (content) => ({
|
|
20
|
+
content,
|
|
21
|
+
modified: true
|
|
22
|
+
});
|
|
23
|
+
exports.changed = changed;
|
|
24
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/domain/install/transform.ts"],"names":[],"mappings":";;;AAuCA;;;;GAIG;AACI,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAmB,EAAE,CAAC,CAAC;IAC7D,OAAO;IACP,QAAQ,EAAE,KAAK;CAChB,CAAC,CAAC;AAHU,QAAA,QAAQ,YAGlB;AAEH;;;;GAIG;AACI,MAAM,OAAO,GAAG,CAAC,OAAe,EAAmB,EAAE,CAAC,CAAC;IAC5D,OAAO;IACP,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AAHU,QAAA,OAAO,WAGjB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain layer — Install types.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the production shape at `src/types/registry.ts`
|
|
5
|
+
* (`InstallationScope`, `RepositoryCommitMode`, `InstallOptions`,
|
|
6
|
+
* `InstalledBundle`) so the extension's install pipeline can eventually
|
|
7
|
+
* delegate here with zero field-mapping (migration plan §7.5).
|
|
8
|
+
* @module domain/install/types
|
|
9
|
+
*/
|
|
10
|
+
import type { DeploymentManifest } from '../collection/types';
|
|
11
|
+
/**
|
|
12
|
+
* Where a bundle is installed to: the current user's global profile, the
|
|
13
|
+
* open VS Code workspace, or a git-tracked repository (lockfile-backed).
|
|
14
|
+
*/
|
|
15
|
+
export type InstallationScope = 'user' | 'workspace' | 'repository';
|
|
16
|
+
/**
|
|
17
|
+
* Whether a repository-scoped install's files are committed to Git or
|
|
18
|
+
* kept local-only (e.g. gitignored).
|
|
19
|
+
*/
|
|
20
|
+
export type RepositoryCommitMode = 'commit' | 'local-only';
|
|
21
|
+
/**
|
|
22
|
+
* Options accepted by an install use case.
|
|
23
|
+
*/
|
|
24
|
+
export interface InstallOptions {
|
|
25
|
+
version?: string;
|
|
26
|
+
scope: InstallationScope;
|
|
27
|
+
profileId?: string;
|
|
28
|
+
/** Overwrite an existing install at the same path. */
|
|
29
|
+
force?: boolean;
|
|
30
|
+
commitMode?: RepositoryCommitMode;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Record of a bundle already installed at some scope.
|
|
34
|
+
*/
|
|
35
|
+
export interface InstalledBundle {
|
|
36
|
+
bundleId: string;
|
|
37
|
+
version: string;
|
|
38
|
+
installedAt: string;
|
|
39
|
+
scope: InstallationScope;
|
|
40
|
+
profileId?: string;
|
|
41
|
+
installPath: string;
|
|
42
|
+
manifest: DeploymentManifest;
|
|
43
|
+
/** Source identifier, for identity matching across re-syncs. */
|
|
44
|
+
sourceId?: string;
|
|
45
|
+
/** Source type, for identity matching across re-syncs. */
|
|
46
|
+
sourceType?: string;
|
|
47
|
+
commitMode?: RepositoryCommitMode;
|
|
48
|
+
/** Set when a lockfile entry exists but its files are missing on disk (repository scope only). */
|
|
49
|
+
filesMissing?: boolean;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/domain/install/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EACV,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAE7B;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,WAAW,GAAG,YAAY,CAAC;AAEpE;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,iBAAiB,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,oBAAoB,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,iBAAiB,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,kGAAkG;IAClG,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/domain/install/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain layer — Primitive types.
|
|
3
|
+
*
|
|
4
|
+
* New in `ai-primitives-hub-next` (no equivalent exists on `main` today):
|
|
5
|
+
* a `Primitive` is a single harvested, searchable unit inside a bundle —
|
|
6
|
+
* one prompt, one instruction file, one agent, etc. Needed by both
|
|
7
|
+
* `infra/search` (Phase 3) and `app/discovery` (Phase 4) per migration plan
|
|
8
|
+
* §8 decision 4.
|
|
9
|
+
*
|
|
10
|
+
* Nests `bundle: BundleRef` rather than flat `sourceId`/`bundleId`/
|
|
11
|
+
* `bundleVersion` fields — matches the reference branch's shape. Phase 2
|
|
12
|
+
* originally flattened these fields (no prior need for `BundleRef`); now
|
|
13
|
+
* that Phase 3b's harvest subsystem (`infra/harvest/extractor.ts`) is the
|
|
14
|
+
* first real producer, adopted the richer nested shape since it carries
|
|
15
|
+
* `sourceType`/`installed` too and nothing outside this module consumed
|
|
16
|
+
* the flat fields in the interim, so this is a safe, non-breaking change.
|
|
17
|
+
*
|
|
18
|
+
* `tags`, `kind`, and `bundle.sourceId` together are the facets a
|
|
19
|
+
* search/browse UI filters on — there is no separate "facets" bag;
|
|
20
|
+
* faceting is just grouping/filtering by these existing fields.
|
|
21
|
+
* @module domain/primitive/types
|
|
22
|
+
*/
|
|
23
|
+
import type { BundleRef } from '../bundle/types';
|
|
24
|
+
export declare const PRIMITIVE_KINDS: readonly ["prompt", "instruction", "chat-mode", "agent", "skill", "plugin", "hook", "mcp-server"];
|
|
25
|
+
export type PrimitiveKind = typeof PRIMITIVE_KINDS[number];
|
|
26
|
+
/**
|
|
27
|
+
* Type guard for `PrimitiveKind`.
|
|
28
|
+
* @param value - Candidate value.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isPrimitiveKind(value: unknown): value is PrimitiveKind;
|
|
31
|
+
/**
|
|
32
|
+
* A single harvested, searchable primitive.
|
|
33
|
+
*/
|
|
34
|
+
export interface Primitive {
|
|
35
|
+
/** Stable identifier, typically derived from `bundle.bundleId` + `path`. */
|
|
36
|
+
id: string;
|
|
37
|
+
/** The bundle this primitive was harvested from. */
|
|
38
|
+
bundle: BundleRef;
|
|
39
|
+
kind: PrimitiveKind;
|
|
40
|
+
title: string;
|
|
41
|
+
description: string;
|
|
42
|
+
/** Path relative to the bundle root. */
|
|
43
|
+
path: string;
|
|
44
|
+
tags: string[];
|
|
45
|
+
authors?: string[];
|
|
46
|
+
/** Glob the primitive applies to, for instruction-like kinds. */
|
|
47
|
+
applyTo?: string;
|
|
48
|
+
/** Declared tool dependencies, for agent/skill-like kinds. */
|
|
49
|
+
tools?: string[];
|
|
50
|
+
/** Preferred/required model, when declared. */
|
|
51
|
+
model?: string;
|
|
52
|
+
/** Short excerpt of the primitive's body, for search result previews. */
|
|
53
|
+
bodyPreview: string;
|
|
54
|
+
/** Content hash, for change detection between harvests. */
|
|
55
|
+
contentHash: string;
|
|
56
|
+
rating?: number;
|
|
57
|
+
updatedAt?: string;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/domain/primitive/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EACV,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,eAAe,mGASlB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,4EAA4E;IAC5E,EAAE,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,WAAW,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PRIMITIVE_KINDS = void 0;
|
|
4
|
+
exports.isPrimitiveKind = isPrimitiveKind;
|
|
5
|
+
exports.PRIMITIVE_KINDS = [
|
|
6
|
+
'prompt',
|
|
7
|
+
'instruction',
|
|
8
|
+
'chat-mode',
|
|
9
|
+
'agent',
|
|
10
|
+
'skill',
|
|
11
|
+
'plugin',
|
|
12
|
+
'hook',
|
|
13
|
+
'mcp-server'
|
|
14
|
+
];
|
|
15
|
+
/**
|
|
16
|
+
* Type guard for `PrimitiveKind`.
|
|
17
|
+
* @param value - Candidate value.
|
|
18
|
+
*/
|
|
19
|
+
function isPrimitiveKind(value) {
|
|
20
|
+
return typeof value === 'string' && exports.PRIMITIVE_KINDS.includes(value);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/domain/primitive/types.ts"],"names":[],"mappings":";;;AA2CA,0CAEC;AAnBY,QAAA,eAAe,GAAG;IAC7B,QAAQ;IACR,aAAa;IACb,WAAW;IACX,OAAO;IACP,OAAO;IACP,QAAQ;IACR,MAAM;IACN,YAAY;CACJ,CAAC;AAIX;;;GAGG;AACH,SAAgB,eAAe,CAAC,KAAc;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,uBAAqC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC7F,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime type guards for registry data crossing an untyped boundary
|
|
3
|
+
* (a `RegistryManager`-shaped orchestrator's return value, cache
|
|
4
|
+
* deserialization, ...).
|
|
5
|
+
*
|
|
6
|
+
* Ported from the extension's `src/utils/type-guards.ts`
|
|
7
|
+
* (`isBundleUpdateArray`/`isSourceArray`) — pure, no `vscode` dependency
|
|
8
|
+
* in the original either, moved here so `app`'s update use cases can
|
|
9
|
+
* validate `UpdateRegistryReader`'s return values the same way the
|
|
10
|
+
* extension's `UpdateChecker` already does.
|
|
11
|
+
* @module domain/registry/guards
|
|
12
|
+
*/
|
|
13
|
+
import type { BundleUpdate } from '../bundle/types';
|
|
14
|
+
/**
|
|
15
|
+
* Type guard for a `BundleUpdate[]`.
|
|
16
|
+
* @param value - Value to check.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isBundleUpdateArray(value: unknown): value is BundleUpdate[];
|
|
19
|
+
/**
|
|
20
|
+
* Type guard for a minimal source array (id/type/name present).
|
|
21
|
+
* @param value - Value to check.
|
|
22
|
+
*/
|
|
23
|
+
export declare function isSourceArray(value: unknown): value is {
|
|
24
|
+
id: string;
|
|
25
|
+
type: string;
|
|
26
|
+
name: string;
|
|
27
|
+
}[];
|
|
28
|
+
//# sourceMappingURL=guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../../src/domain/registry/guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EACV,YAAY,EACb,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,EAAE,CAW3E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAWnG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isBundleUpdateArray = isBundleUpdateArray;
|
|
4
|
+
exports.isSourceArray = isSourceArray;
|
|
5
|
+
/**
|
|
6
|
+
* Type guard for a `BundleUpdate[]`.
|
|
7
|
+
* @param value - Value to check.
|
|
8
|
+
*/
|
|
9
|
+
function isBundleUpdateArray(value) {
|
|
10
|
+
if (!Array.isArray(value)) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return value.every((item) => typeof item === 'object'
|
|
14
|
+
&& item !== null
|
|
15
|
+
&& typeof item.bundleId === 'string'
|
|
16
|
+
&& typeof item.currentVersion === 'string'
|
|
17
|
+
&& typeof item.latestVersion === 'string');
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Type guard for a minimal source array (id/type/name present).
|
|
21
|
+
* @param value - Value to check.
|
|
22
|
+
*/
|
|
23
|
+
function isSourceArray(value) {
|
|
24
|
+
if (!Array.isArray(value)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return value.every((item) => typeof item === 'object'
|
|
28
|
+
&& item !== null
|
|
29
|
+
&& typeof item.id === 'string'
|
|
30
|
+
&& typeof item.type === 'string'
|
|
31
|
+
&& typeof item.name === 'string');
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../../src/domain/registry/guards.ts"],"names":[],"mappings":";;AAoBA,kDAWC;AAMD,sCAWC;AAhCD;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,KAAc;IAChD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAC1B,OAAO,IAAI,KAAK,QAAQ;WACrB,IAAI,KAAK,IAAI;WACb,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ;WACjC,OAAO,IAAI,CAAC,cAAc,KAAK,QAAQ;WACvC,OAAO,IAAI,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,KAAc;IAC1C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAC1B,OAAO,IAAI,KAAK,QAAQ;WACrB,IAAI,KAAK,IAAI;WACb,OAAO,IAAI,CAAC,EAAE,KAAK,QAAQ;WAC3B,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ;WAC7B,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain layer — registry settings export/import types.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the production shape at `src/types/settings.ts`. Named
|
|
5
|
+
* `ExportedSettingsConfiguration` here (not `RegistryConfiguration`,
|
|
6
|
+
* the extension's own name for this type) to avoid colliding with
|
|
7
|
+
* `domain/hub/types.ts`'s unrelated `RegistryConfiguration` (a hub's
|
|
8
|
+
* own sync/strict-mode config) — both are called `RegistryConfiguration`
|
|
9
|
+
* in the extension source too, but never wildcard-re-exported into the
|
|
10
|
+
* same namespace there, so the collision only surfaces here.
|
|
11
|
+
* @module domain/registry/settings
|
|
12
|
+
*/
|
|
13
|
+
import type { RegistrySource } from '../source/types';
|
|
14
|
+
import type { Profile } from './types';
|
|
15
|
+
/**
|
|
16
|
+
* Extension configuration settings included in an export/import.
|
|
17
|
+
*/
|
|
18
|
+
export interface ExportedSettingsConfiguration {
|
|
19
|
+
/** Automatically check for bundle updates. */
|
|
20
|
+
autoCheckUpdates?: boolean;
|
|
21
|
+
/** Default installation scope (user or workspace). */
|
|
22
|
+
installationScope?: string;
|
|
23
|
+
/** Enable logging for debugging. */
|
|
24
|
+
enableLogging?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Complete registry settings for export/import.
|
|
28
|
+
*/
|
|
29
|
+
export interface ExportedSettings {
|
|
30
|
+
/** Schema version for migration compatibility. */
|
|
31
|
+
version: string;
|
|
32
|
+
/** ISO timestamp when settings were exported. */
|
|
33
|
+
exportedAt: string;
|
|
34
|
+
/** All registry sources. */
|
|
35
|
+
sources: RegistrySource[];
|
|
36
|
+
/** All user profiles. */
|
|
37
|
+
profiles: Profile[];
|
|
38
|
+
/** Extension configuration settings. */
|
|
39
|
+
configuration?: ExportedSettingsConfiguration;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Supported export/import formats.
|
|
43
|
+
*/
|
|
44
|
+
export type ExportFormat = 'json' | 'yaml';
|
|
45
|
+
/**
|
|
46
|
+
* Import strategy for handling existing data.
|
|
47
|
+
*/
|
|
48
|
+
export type ImportStrategy = 'merge' | 'replace';
|
|
49
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/domain/registry/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EACV,cAAc,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,OAAO,EACR,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,8CAA8C;IAC9C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,sDAAsD;IACtD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oCAAoC;IACpC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,yBAAyB;IACzB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,wCAAwC;IACxC,aAAa,CAAC,EAAE,6BAA6B,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../src/domain/registry/settings.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain layer — Registry types.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the production shape at `src/types/registry.ts` (`Profile`,
|
|
5
|
+
* `ProfileBundle`, `RegistryConfig`, `RegistrySettings`, `SearchQuery`).
|
|
6
|
+
* @module domain/registry/types
|
|
7
|
+
*/
|
|
8
|
+
import type { InstallationScope } from '../install/types';
|
|
9
|
+
import type { RegistrySource } from '../source/types';
|
|
10
|
+
/**
|
|
11
|
+
* A bundle reference within a profile.
|
|
12
|
+
*/
|
|
13
|
+
export interface ProfileBundle {
|
|
14
|
+
id: string;
|
|
15
|
+
/** Semantic version, or `'latest'`. */
|
|
16
|
+
version: string;
|
|
17
|
+
/** Disambiguates which source this bundle should come from. */
|
|
18
|
+
sourceId?: string;
|
|
19
|
+
required: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A named collection of bundles a user can activate as a group.
|
|
23
|
+
*/
|
|
24
|
+
export interface Profile {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
icon: string;
|
|
29
|
+
bundles: ProfileBundle[];
|
|
30
|
+
environments?: {
|
|
31
|
+
preferred: string;
|
|
32
|
+
compatible: string[];
|
|
33
|
+
};
|
|
34
|
+
active: boolean;
|
|
35
|
+
createdAt: string;
|
|
36
|
+
updatedAt: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* User-configurable registry behavior.
|
|
40
|
+
*/
|
|
41
|
+
export interface RegistrySettings {
|
|
42
|
+
autoUpdate: boolean;
|
|
43
|
+
/** Hours between automatic update checks. */
|
|
44
|
+
updateCheckInterval: number;
|
|
45
|
+
telemetry: boolean;
|
|
46
|
+
installationScope: InstallationScope;
|
|
47
|
+
preferredEnvironment: string;
|
|
48
|
+
proxySettings?: {
|
|
49
|
+
enabled: boolean;
|
|
50
|
+
url: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Top-level, persisted registry configuration.
|
|
55
|
+
*/
|
|
56
|
+
export interface RegistryConfig {
|
|
57
|
+
version: string;
|
|
58
|
+
sources: RegistrySource[];
|
|
59
|
+
profiles: Profile[];
|
|
60
|
+
settings: RegistrySettings;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Query parameters for searching/browsing bundles.
|
|
64
|
+
*/
|
|
65
|
+
export interface SearchQuery {
|
|
66
|
+
text?: string;
|
|
67
|
+
tags?: string[];
|
|
68
|
+
author?: string;
|
|
69
|
+
environment?: string;
|
|
70
|
+
sourceId?: string;
|
|
71
|
+
sortBy?: 'relevance' | 'downloads' | 'rating' | 'recent';
|
|
72
|
+
limit?: number;
|
|
73
|
+
offset?: number;
|
|
74
|
+
/** If true, only return already-cached bundles without hitting the network. */
|
|
75
|
+
cacheOnly?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A `BundleUpdate` enriched with display/preference metadata, ready for a
|
|
79
|
+
* UI (or CLI) to render or act on. Mirrors the production shape at
|
|
80
|
+
* `src/services/update-cache.ts`.
|
|
81
|
+
*/
|
|
82
|
+
export interface UpdateCheckResult {
|
|
83
|
+
bundleId: string;
|
|
84
|
+
currentVersion: string;
|
|
85
|
+
latestVersion: string;
|
|
86
|
+
releaseNotes?: string;
|
|
87
|
+
releaseDate: string;
|
|
88
|
+
downloadUrl: string;
|
|
89
|
+
autoUpdateEnabled: boolean;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/domain/registry/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EACV,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,cAAc,EACf,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC;IACF,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,6CAA6C;IAC7C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE;QACd,OAAO,EAAE,OAAO,CAAC;QACjB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,OAAO,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/domain/registry/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain error — structured, machine-readable error type used across
|
|
3
|
+
* all layers. Lives here (not in `cli`'s framework) so application and
|
|
4
|
+
* infrastructure code can throw `RegistryError` without depending on
|
|
5
|
+
* the CLI layer.
|
|
6
|
+
*
|
|
7
|
+
* Named `registry-error.ts` rather than `errors.ts` to avoid colliding
|
|
8
|
+
* with this package's pre-existing `domain/errors.ts` (`categorizeError`,
|
|
9
|
+
* a keyword-based classifier for generic `Error` objects, ported from the
|
|
10
|
+
* extension's `ErrorHandler` — an unrelated concern that happens to want
|
|
11
|
+
* the same filename in the reference branch this class is ported from).
|
|
12
|
+
*
|
|
13
|
+
* A `renderError()` helper (which needs a CLI `Context` for stderr) stays
|
|
14
|
+
* in `cli`'s framework and is re-exported from its barrel for callers that
|
|
15
|
+
* need both, matching the reference branch's own split.
|
|
16
|
+
* @module domain/registry-error
|
|
17
|
+
*/
|
|
18
|
+
declare const NAMESPACES: readonly ["BUNDLE", "INDEX", "HUB", "PRIMITIVE", "CONFIG", "NETWORK", "AUTH", "FS", "PLUGIN", "USAGE", "INTERNAL"];
|
|
19
|
+
/**
|
|
20
|
+
* Valid error-code namespace prefixes.
|
|
21
|
+
*/
|
|
22
|
+
export type RegistryErrorNamespace = (typeof NAMESPACES)[number];
|
|
23
|
+
/**
|
|
24
|
+
* Construction options for {@link RegistryError}.
|
|
25
|
+
*/
|
|
26
|
+
export interface RegistryErrorOptions {
|
|
27
|
+
code: string;
|
|
28
|
+
message: string;
|
|
29
|
+
hint?: string;
|
|
30
|
+
docsUrl?: string;
|
|
31
|
+
cause?: unknown;
|
|
32
|
+
context?: Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* JSON-serializable error shape produced by {@link RegistryError.toJSON}.
|
|
36
|
+
*/
|
|
37
|
+
export interface RegistryErrorJson {
|
|
38
|
+
code: string;
|
|
39
|
+
message: string;
|
|
40
|
+
hint?: string;
|
|
41
|
+
docsUrl?: string;
|
|
42
|
+
context?: Record<string, unknown>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Domain-specific error class. All error paths in command and
|
|
46
|
+
* application code should throw `RegistryError` so the renderer can
|
|
47
|
+
* produce consistent output for both text and JSON modes.
|
|
48
|
+
*/
|
|
49
|
+
export declare class RegistryError extends Error {
|
|
50
|
+
readonly code: string;
|
|
51
|
+
readonly hint?: string;
|
|
52
|
+
readonly docsUrl?: string;
|
|
53
|
+
readonly context?: Record<string, unknown>;
|
|
54
|
+
readonly cause?: unknown;
|
|
55
|
+
constructor(opts: RegistryErrorOptions);
|
|
56
|
+
/**
|
|
57
|
+
* Serialize to the JSON shape consumed by the output envelope.
|
|
58
|
+
* @returns Output-friendly representation.
|
|
59
|
+
*/
|
|
60
|
+
toJSON(): RegistryErrorJson;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Type guard for RegistryError.
|
|
64
|
+
* @param value Anything.
|
|
65
|
+
* @returns Whether `value` is a RegistryError.
|
|
66
|
+
*/
|
|
67
|
+
export declare const isRegistryError: (value: unknown) => value is RegistryError;
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=registry-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-error.d.ts","sourceRoot":"","sources":["../../src/domain/registry-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,QAAA,MAAM,UAAU,oHAIN,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAIjE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjC,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClD,SAAgB,KAAK,CAAC,EAAE,OAAO,CAAC;gBAEb,IAAI,EAAE,oBAAoB;IAW7C;;;OAGG;IACI,MAAM,IAAI,iBAAiB;CAgBnC;AAiBD;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,aAC1B,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Domain error — structured, machine-readable error type used across
|
|
4
|
+
* all layers. Lives here (not in `cli`'s framework) so application and
|
|
5
|
+
* infrastructure code can throw `RegistryError` without depending on
|
|
6
|
+
* the CLI layer.
|
|
7
|
+
*
|
|
8
|
+
* Named `registry-error.ts` rather than `errors.ts` to avoid colliding
|
|
9
|
+
* with this package's pre-existing `domain/errors.ts` (`categorizeError`,
|
|
10
|
+
* a keyword-based classifier for generic `Error` objects, ported from the
|
|
11
|
+
* extension's `ErrorHandler` — an unrelated concern that happens to want
|
|
12
|
+
* the same filename in the reference branch this class is ported from).
|
|
13
|
+
*
|
|
14
|
+
* A `renderError()` helper (which needs a CLI `Context` for stderr) stays
|
|
15
|
+
* in `cli`'s framework and is re-exported from its barrel for callers that
|
|
16
|
+
* need both, matching the reference branch's own split.
|
|
17
|
+
* @module domain/registry-error
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.isRegistryError = exports.RegistryError = void 0;
|
|
21
|
+
const NAMESPACES = [
|
|
22
|
+
'BUNDLE', 'INDEX', 'HUB', 'PRIMITIVE',
|
|
23
|
+
'CONFIG', 'NETWORK', 'AUTH', 'FS',
|
|
24
|
+
'PLUGIN', 'USAGE', 'INTERNAL'
|
|
25
|
+
];
|
|
26
|
+
const CODE_PATTERN = /^([A-Z]+)\.[A-Z][A-Z0-9_]*$/;
|
|
27
|
+
/**
|
|
28
|
+
* Domain-specific error class. All error paths in command and
|
|
29
|
+
* application code should throw `RegistryError` so the renderer can
|
|
30
|
+
* produce consistent output for both text and JSON modes.
|
|
31
|
+
*/
|
|
32
|
+
class RegistryError extends Error {
|
|
33
|
+
code;
|
|
34
|
+
hint;
|
|
35
|
+
docsUrl;
|
|
36
|
+
context;
|
|
37
|
+
cause;
|
|
38
|
+
constructor(opts) {
|
|
39
|
+
super(opts.message);
|
|
40
|
+
validateCode(opts.code);
|
|
41
|
+
this.name = 'RegistryError';
|
|
42
|
+
this.code = opts.code;
|
|
43
|
+
this.hint = opts.hint;
|
|
44
|
+
this.docsUrl = opts.docsUrl;
|
|
45
|
+
this.context = opts.context;
|
|
46
|
+
this.cause = opts.cause;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Serialize to the JSON shape consumed by the output envelope.
|
|
50
|
+
* @returns Output-friendly representation.
|
|
51
|
+
*/
|
|
52
|
+
toJSON() {
|
|
53
|
+
const out = {
|
|
54
|
+
code: this.code,
|
|
55
|
+
message: this.message
|
|
56
|
+
};
|
|
57
|
+
if (this.hint !== undefined) {
|
|
58
|
+
out.hint = this.hint;
|
|
59
|
+
}
|
|
60
|
+
if (this.docsUrl !== undefined) {
|
|
61
|
+
out.docsUrl = this.docsUrl;
|
|
62
|
+
}
|
|
63
|
+
if (this.context !== undefined) {
|
|
64
|
+
out.context = this.context;
|
|
65
|
+
}
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.RegistryError = RegistryError;
|
|
70
|
+
const validateCode = (code) => {
|
|
71
|
+
const m = CODE_PATTERN.exec(code);
|
|
72
|
+
if (m === null) {
|
|
73
|
+
throw new TypeError(`Invalid RegistryError code "${code}": expected NAMESPACE.UPPER_SNAKE format`);
|
|
74
|
+
}
|
|
75
|
+
const ns = m[1];
|
|
76
|
+
if (!NAMESPACES.includes(ns)) {
|
|
77
|
+
throw new TypeError(`Invalid RegistryError namespace "${ns}" in code "${code}": expected one of ${NAMESPACES.join(', ')}`);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Type guard for RegistryError.
|
|
82
|
+
* @param value Anything.
|
|
83
|
+
* @returns Whether `value` is a RegistryError.
|
|
84
|
+
*/
|
|
85
|
+
const isRegistryError = (value) => value instanceof RegistryError;
|
|
86
|
+
exports.isRegistryError = isRegistryError;
|
|
87
|
+
//# sourceMappingURL=registry-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-error.js","sourceRoot":"","sources":["../../src/domain/registry-error.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,MAAM,UAAU,GAAG;IACjB,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW;IACrC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI;IACjC,QAAQ,EAAE,OAAO,EAAE,UAAU;CACrB,CAAC;AAOX,MAAM,YAAY,GAAG,6BAA6B,CAAC;AAyBnD;;;;GAIG;AACH,MAAa,aAAc,SAAQ,KAAK;IACtB,IAAI,CAAS;IACb,IAAI,CAAU;IACd,OAAO,CAAU;IACjB,OAAO,CAA2B;IAClC,KAAK,CAAW;IAEhC,YAAmB,IAA0B;QAC3C,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,MAAM;QACX,MAAM,GAAG,GAAsB;YAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;QACF,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC5B,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC/B,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC/B,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAtCD,sCAsCC;AAED,MAAM,YAAY,GAAG,CAAC,IAAY,EAAQ,EAAE;IAC1C,MAAM,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QACf,MAAM,IAAI,SAAS,CACjB,+BAA+B,IAAI,0CAA0C,CAC9E,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAChB,IAAI,CAAE,UAAgC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,SAAS,CACjB,oCAAoC,EAAE,cAAc,IAAI,sBAAsB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACtG,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACI,MAAM,eAAe,GAAG,CAAC,KAAc,EAA0B,EAAE,CACxE,KAAK,YAAY,aAAa,CAAC;AADpB,QAAA,eAAe,mBACK"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain types for scaffolding collections and primitives.
|
|
3
|
+
*
|
|
4
|
+
* Exported for use by infra (TemplateEngine) and CLI (commands).
|
|
5
|
+
* @module domain/scaffold
|
|
6
|
+
*/
|
|
7
|
+
export { generateSanitizedId, ScaffoldType, } from './types';
|
|
8
|
+
export type { ScaffoldOptions, ScaffoldResult, TemplateContext, TemplateInfo, TemplateManifest, } from './types';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/scaffold/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,mBAAmB,EACnB,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,YAAY,EACZ,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Domain types for scaffolding collections and primitives.
|
|
4
|
+
*
|
|
5
|
+
* Exported for use by infra (TemplateEngine) and CLI (commands).
|
|
6
|
+
* @module domain/scaffold
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ScaffoldType = exports.generateSanitizedId = void 0;
|
|
10
|
+
var types_1 = require("./types");
|
|
11
|
+
Object.defineProperty(exports, "generateSanitizedId", { enumerable: true, get: function () { return types_1.generateSanitizedId; } });
|
|
12
|
+
Object.defineProperty(exports, "ScaffoldType", { enumerable: true, get: function () { return types_1.ScaffoldType; } });
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/scaffold/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iCAGiB;AAFf,4GAAA,mBAAmB,OAAA;AACnB,qGAAA,YAAY,OAAA"}
|