@delorenj/skillex 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +15851 -0
- package/dist/commands/compositions.d.ts +9 -0
- package/dist/commands/diagnostics.d.ts +7 -0
- package/dist/commands/migrate.d.ts +7 -0
- package/dist/commands/profiles.d.ts +8 -0
- package/dist/commands/selections.d.ts +7 -0
- package/dist/commands/sync.d.ts +7 -0
- package/dist/commands/vendor.d.ts +8 -0
- package/dist/core/activation-ownership.d.ts +18 -0
- package/dist/core/activation-state.d.ts +37 -0
- package/dist/core/activation-types.d.ts +32 -0
- package/dist/core/aliases.d.ts +7 -0
- package/dist/core/catalog-lock.d.ts +15 -0
- package/dist/core/catalog-types.d.ts +28 -0
- package/dist/core/catalog-write.d.ts +25 -0
- package/dist/core/catalog.d.ts +7 -0
- package/dist/core/composition-mutation.d.ts +38 -0
- package/dist/core/composition-types.d.ts +45 -0
- package/dist/core/composition.d.ts +12 -0
- package/dist/core/content.d.ts +25 -0
- package/dist/core/diagnostics-types.d.ts +76 -0
- package/dist/core/diagnostics.d.ts +6 -0
- package/dist/core/discovery.d.ts +5 -0
- package/dist/core/doctor-sources.d.ts +10 -0
- package/dist/core/doctor-types.d.ts +37 -0
- package/dist/core/doctor-writers.d.ts +11 -0
- package/dist/core/doctor.d.ts +4 -0
- package/dist/core/error.d.ts +8 -0
- package/dist/core/filesystem.d.ts +5 -0
- package/dist/core/lock.d.ts +18 -0
- package/dist/core/manifest.d.ts +7 -0
- package/dist/core/metadata.d.ts +6 -0
- package/dist/core/migration-activation-state.d.ts +52 -0
- package/dist/core/migration-activation.d.ts +6 -0
- package/dist/core/migration-common.d.ts +8 -0
- package/dist/core/migration-manifest.d.ts +4 -0
- package/dist/core/migration-registry-state.d.ts +72 -0
- package/dist/core/migration-registry.d.ts +7 -0
- package/dist/core/migration-sources.d.ts +4 -0
- package/dist/core/migration-types.d.ts +56 -0
- package/dist/core/migration.d.ts +4 -0
- package/dist/core/packs.d.ts +8 -0
- package/dist/core/profile-discovery.d.ts +15 -0
- package/dist/core/profile-state.d.ts +27 -0
- package/dist/core/profile-sync.d.ts +40 -0
- package/dist/core/profile-types.d.ts +88 -0
- package/dist/core/profiles.d.ts +6 -0
- package/dist/core/reconciliation-types.d.ts +36 -0
- package/dist/core/reconciliation.d.ts +47 -0
- package/dist/core/resolution.d.ts +6 -0
- package/dist/core/result.d.ts +37 -0
- package/dist/core/selection-command-types.d.ts +23 -0
- package/dist/core/selection-commands.d.ts +6 -0
- package/dist/core/selection-manifest.d.ts +18 -0
- package/dist/core/selection.d.ts +98 -0
- package/dist/core/sets.d.ts +7 -0
- package/dist/core/vendor-git.d.ts +26 -0
- package/dist/core/vendor-inspect.d.ts +5 -0
- package/dist/core/vendor-provenance.d.ts +9 -0
- package/dist/core/vendor-sources.d.ts +14 -0
- package/dist/core/vendor-state.d.ts +54 -0
- package/dist/core/vendor-sync.d.ts +4 -0
- package/dist/core/vendor-types.d.ts +132 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +15028 -0
- package/dist/version.d.ts +1 -0
- package/package.json +62 -0
- package/schemas/result.schema.json +47 -0
- package/skills.schema.json +144 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MigrationOptions, MigrationSectionResult } from "./migration-types.js";
|
|
2
|
+
import { type ResultEnvelope } from "./result.js";
|
|
3
|
+
/** Recover recorded objects before current source or manifest validation; never plan new intent. */
|
|
4
|
+
export declare function recoverActivationMigration(options?: MigrationOptions): Promise<ResultEnvelope<MigrationSectionResult | null>>;
|
|
5
|
+
/** A migration section never selects an ambient scope and never invokes ordinary sync. */
|
|
6
|
+
export declare function migrateActivation(options?: MigrationOptions): Promise<ResultEnvelope<MigrationSectionResult | null>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MigrationMapping, MigrationOptions, MigrationSectionResult } from "./migration-types.js";
|
|
2
|
+
import { type ResultEnvelope } from "./result.js";
|
|
3
|
+
export declare function checkMigrationSignal(options: Pick<MigrationOptions, "signal">): void;
|
|
4
|
+
/** Validate authored choices and capture a private, immutable copy before asynchronous work. */
|
|
5
|
+
export declare function parseMigrationMapping(input: unknown): MigrationMapping;
|
|
6
|
+
export declare function normalizeMigrationOptions(options?: MigrationOptions): MigrationOptions;
|
|
7
|
+
export declare function migrationFailure<T>(command: string, error: unknown, data: T): ResultEnvelope<T>;
|
|
8
|
+
export declare function emptyMigrationSection(): MigrationSectionResult;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MigrationOptions, MigrationSectionResult } from "./migration-types.js";
|
|
2
|
+
import { type ResultEnvelope } from "./result.js";
|
|
3
|
+
/** Translate only an explicitly selected declaration; no activation paths are managed here. */
|
|
4
|
+
export declare function migrateManifest(options: MigrationOptions, nameMap?: Readonly<Record<string, string>>): Promise<ResultEnvelope<MigrationSectionResult | null>>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type BigIntStats } from "node:fs";
|
|
2
|
+
import { type ReceiptSnapshot } from "./activation-state.js";
|
|
3
|
+
import type { MigrationItem, MigrationOptions } from "./migration-types.js";
|
|
4
|
+
export interface MigrationIdentity {
|
|
5
|
+
readonly dev: string;
|
|
6
|
+
readonly ino: string;
|
|
7
|
+
readonly uid: string;
|
|
8
|
+
readonly mode: number;
|
|
9
|
+
readonly kind: "directory" | "file" | "link";
|
|
10
|
+
}
|
|
11
|
+
export interface MigrationEntry {
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly kind: MigrationIdentity["kind"];
|
|
14
|
+
readonly mode: number;
|
|
15
|
+
readonly bytes?: Buffer;
|
|
16
|
+
readonly target?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface MigrationTreeEvidence {
|
|
19
|
+
readonly root: MigrationIdentity;
|
|
20
|
+
readonly entries: readonly {
|
|
21
|
+
readonly path: string;
|
|
22
|
+
readonly identity: MigrationIdentity;
|
|
23
|
+
readonly hash: string | null;
|
|
24
|
+
readonly target: string | null;
|
|
25
|
+
}[];
|
|
26
|
+
readonly digest: string;
|
|
27
|
+
}
|
|
28
|
+
export interface MigrationTree {
|
|
29
|
+
readonly evidence: MigrationTreeEvidence;
|
|
30
|
+
readonly entries: readonly MigrationEntry[];
|
|
31
|
+
}
|
|
32
|
+
export interface MigrationOperation {
|
|
33
|
+
readonly item: MigrationItem;
|
|
34
|
+
readonly path: string;
|
|
35
|
+
readonly stage: string | null;
|
|
36
|
+
readonly parked: string | null;
|
|
37
|
+
readonly parent: MigrationIdentity;
|
|
38
|
+
readonly ancestors: readonly {
|
|
39
|
+
readonly path: string;
|
|
40
|
+
readonly identity: MigrationIdentity;
|
|
41
|
+
}[];
|
|
42
|
+
readonly before: MigrationTreeEvidence | null;
|
|
43
|
+
readonly after: MigrationTreeEvidence | null;
|
|
44
|
+
}
|
|
45
|
+
export interface RegistryMigrationReceipt {
|
|
46
|
+
readonly version: 1;
|
|
47
|
+
readonly registry: string;
|
|
48
|
+
readonly phase: "preparing" | "ready" | "complete";
|
|
49
|
+
readonly operations: readonly MigrationOperation[];
|
|
50
|
+
readonly verified: readonly MigrationItem[];
|
|
51
|
+
readonly nameMap: Readonly<Record<string, string>>;
|
|
52
|
+
readonly provenance: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
|
|
53
|
+
readonly externalRoots?: readonly string[];
|
|
54
|
+
}
|
|
55
|
+
export declare function migrationFailure(path: string, message: string, code?: `E_${string}`): never;
|
|
56
|
+
export declare function migrationLstat(path: string): Promise<BigIntStats | null>;
|
|
57
|
+
export declare function migrationTreeDigest(entries: readonly MigrationEntry[]): string;
|
|
58
|
+
/** Capture every entry, including hidden support assets and provenance, without following links. */
|
|
59
|
+
export declare function captureMigrationTree(root: string): Promise<MigrationTree | null>;
|
|
60
|
+
export declare function assertMigrationIdentity(path: string, expected: MigrationIdentity): Promise<void>;
|
|
61
|
+
export declare function assertMigrationTree(path: string, expected: MigrationTreeEvidence | null): Promise<void>;
|
|
62
|
+
export declare function migrationParent(path: string): Promise<MigrationIdentity>;
|
|
63
|
+
export declare function migrationAncestors(registry: string, path: string): Promise<MigrationOperation["ancestors"]>;
|
|
64
|
+
export declare function assertMigrationAncestors(ancestors: MigrationOperation["ancestors"]): Promise<void>;
|
|
65
|
+
export declare function migrationStage(path: string, suffix: "new" | "old"): string;
|
|
66
|
+
/** The unique staged root is complete and fsynced before any visible source entry is replaced. */
|
|
67
|
+
export declare function stageMigrationTree(path: string, entries: readonly MigrationEntry[], parent: MigrationIdentity, ancestors?: MigrationOperation["ancestors"]): Promise<MigrationTreeEvidence>;
|
|
68
|
+
export declare function removeMigrationTree(path: string, expected: MigrationTreeEvidence): Promise<void>;
|
|
69
|
+
export declare function readRegistryMigrationReceipt(registry: string, options: MigrationOptions, externalRoots?: readonly string[]): Promise<ReceiptSnapshot<RegistryMigrationReceipt>>;
|
|
70
|
+
export declare function writeRegistryMigrationReceipt(previous: ReceiptSnapshot<RegistryMigrationReceipt>, value: RegistryMigrationReceipt, options: MigrationOptions): Promise<ReceiptSnapshot<RegistryMigrationReceipt>>;
|
|
71
|
+
/** Recover only the exact prepared objects, never a tree inferred from target containment. */
|
|
72
|
+
export declare function publishMigrationOperation(operation: MigrationOperation): Promise<void>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MigrationOptions, MigrationSectionResult } from "./migration-types.js";
|
|
2
|
+
import { type ResultEnvelope } from "./result.js";
|
|
3
|
+
export interface RegistryMigrationSection extends MigrationSectionResult {
|
|
4
|
+
readonly nameMap: Readonly<Record<string, string>>;
|
|
5
|
+
}
|
|
6
|
+
/** Explicit registry migration; previews never create state, staging, catalog, or composition entries. */
|
|
7
|
+
export declare function migrateRegistry(options?: MigrationOptions): Promise<ResultEnvelope<RegistryMigrationSection | null>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MigrationOptions, MigrationSectionResult } from "./migration-types.js";
|
|
2
|
+
import { type ResultEnvelope } from "./result.js";
|
|
3
|
+
/** Explicit declaration onboarding preserves all recorded skill bytes and upstream pins. */
|
|
4
|
+
export declare function migrateSources(input: MigrationOptions): Promise<ResultEnvelope<MigrationSectionResult | null>>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { LockOptions } from "./lock.js";
|
|
2
|
+
import type { RegistryOptions, RegistrySelection } from "./selection.js";
|
|
3
|
+
/** Explicit choices for inputs whose names or selections cannot be inferred from content. */
|
|
4
|
+
export interface MigrationMapping {
|
|
5
|
+
readonly version: 1;
|
|
6
|
+
readonly names?: Readonly<Record<string, string>>;
|
|
7
|
+
/** Null explicitly retires a composition reference, never a real skill tree or activation entry. */
|
|
8
|
+
readonly references?: Readonly<Record<string, string | null>>;
|
|
9
|
+
readonly digests?: Readonly<Record<string, string>>;
|
|
10
|
+
readonly packs?: Readonly<Record<string, {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly version: string;
|
|
13
|
+
}>>;
|
|
14
|
+
readonly wrappers?: Readonly<Record<string, {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly ownedPaths: readonly string[];
|
|
17
|
+
}>>;
|
|
18
|
+
readonly manifests?: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
|
|
19
|
+
}
|
|
20
|
+
export interface MigrationOptions extends RegistryOptions, LockOptions {
|
|
21
|
+
/** Preview is the default. Only true authorizes publication. */
|
|
22
|
+
readonly apply?: boolean;
|
|
23
|
+
/** No scope is selected from the current working directory. */
|
|
24
|
+
readonly scope?: "global" | "project";
|
|
25
|
+
readonly project?: string;
|
|
26
|
+
readonly profile?: string;
|
|
27
|
+
readonly hermesRoot?: string;
|
|
28
|
+
readonly mapping?: MigrationMapping;
|
|
29
|
+
readonly sourcesFile?: string;
|
|
30
|
+
readonly signal?: {
|
|
31
|
+
readonly aborted: boolean;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface MigrationItem {
|
|
35
|
+
readonly id: string;
|
|
36
|
+
readonly area: "catalog" | "composition" | "manifest" | "activation" | "profile" | "sources";
|
|
37
|
+
readonly action: string;
|
|
38
|
+
readonly path: string;
|
|
39
|
+
readonly target?: string;
|
|
40
|
+
readonly state: "ready" | "blocked" | "verified" | "preserved";
|
|
41
|
+
readonly beforeDigest?: string;
|
|
42
|
+
readonly afterDigest?: string;
|
|
43
|
+
readonly details: readonly string[];
|
|
44
|
+
readonly dependsOn: readonly string[];
|
|
45
|
+
}
|
|
46
|
+
/** Shared internal section result; the public result also identifies the selected registry. */
|
|
47
|
+
export interface MigrationSectionResult {
|
|
48
|
+
readonly items: readonly MigrationItem[];
|
|
49
|
+
readonly applied: readonly string[];
|
|
50
|
+
readonly receipts: readonly string[];
|
|
51
|
+
}
|
|
52
|
+
export interface MigrationResult extends MigrationSectionResult {
|
|
53
|
+
readonly registry: RegistrySelection | null;
|
|
54
|
+
readonly apply: boolean;
|
|
55
|
+
readonly targets: readonly string[];
|
|
56
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MigrationOptions, MigrationResult } from "./migration-types.js";
|
|
2
|
+
import { type ResultEnvelope } from "./result.js";
|
|
3
|
+
/** Explicit, resumable conversion. No target scope is inferred from the caller's directory. */
|
|
4
|
+
export declare function migrate(input?: MigrationOptions): Promise<ResultEnvelope<MigrationResult | null>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CompositionMutationData, CompositionOptions, PackListData, PackShowData } from "./composition-types.js";
|
|
2
|
+
import { type ResultEnvelope } from "./result.js";
|
|
3
|
+
export declare function listPacks(options?: CompositionOptions): Promise<ResultEnvelope<PackListData | null>>;
|
|
4
|
+
export declare function showPack(ref: string, options?: CompositionOptions): Promise<ResultEnvelope<PackShowData | null>>;
|
|
5
|
+
export declare function verifyPack(ref: string, options?: CompositionOptions): Promise<ResultEnvelope<PackShowData | null>>;
|
|
6
|
+
export declare function createPack(name: string, version: string, options?: CompositionOptions): Promise<ResultEnvelope<CompositionMutationData | null>>;
|
|
7
|
+
export declare function addPackSkills(ref: string, names: readonly string[], options?: CompositionOptions): Promise<ResultEnvelope<CompositionMutationData | null>>;
|
|
8
|
+
export declare function removePackSkills(ref: string, names: readonly string[], options?: CompositionOptions): Promise<ResultEnvelope<CompositionMutationData | null>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HermesRootSelection, ProfileDiscovery, ProfileLocation, ProfileOptions } from "./profile-types.js";
|
|
2
|
+
export declare function validateProfileName(name: string): void;
|
|
3
|
+
export declare function checkProfileSignal(options: Pick<ProfileOptions, "signal">): void;
|
|
4
|
+
/** Keep discovery, selection and receipt context on the same expanded home/cwd. */
|
|
5
|
+
export declare function normalizeProfileOptions(options?: ProfileOptions): ProfileOptions & {
|
|
6
|
+
readonly home: string;
|
|
7
|
+
readonly cwd: string;
|
|
8
|
+
};
|
|
9
|
+
/** Hermes treats HERMES_HOME beneath profiles/NAME as a profile, before resolving its symlink. */
|
|
10
|
+
export declare function discoverProfileRoot(options?: ProfileOptions): Promise<HermesRootSelection>;
|
|
11
|
+
export declare function discoverProfile(name: string, options?: ProfileOptions): Promise<ProfileLocation>;
|
|
12
|
+
/** Discovery reads no profile configuration, skill content, sticky selection or project manifest. */
|
|
13
|
+
export declare function discoverProfiles(options?: ProfileOptions): Promise<ProfileDiscovery>;
|
|
14
|
+
/** Guard root identity across planning and mutation; child changes are guarded by the applicator. */
|
|
15
|
+
export declare function assertProfileIdentity(profile: ProfileLocation): Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ReceiptOptions, type ReceiptSnapshot } from "./activation-state.js";
|
|
2
|
+
import type { EntryIdentity, SourceRevision } from "./activation-types.js";
|
|
3
|
+
import type { ProfileLocation } from "./profile-types.js";
|
|
4
|
+
export interface ProfileJournal {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly stage: string;
|
|
8
|
+
readonly parked: string;
|
|
9
|
+
readonly previous?: EntryIdentity;
|
|
10
|
+
readonly next?: EntryIdentity;
|
|
11
|
+
}
|
|
12
|
+
export interface ProfileData {
|
|
13
|
+
readonly version: 1;
|
|
14
|
+
readonly root: EntryIdentity | null;
|
|
15
|
+
readonly project: string | null;
|
|
16
|
+
readonly sources: readonly SourceRevision[];
|
|
17
|
+
readonly links: Readonly<Record<string, EntryIdentity>>;
|
|
18
|
+
readonly pending?: ProfileJournal;
|
|
19
|
+
}
|
|
20
|
+
export interface ProfileState {
|
|
21
|
+
readonly snapshot: ReceiptSnapshot<ProfileData>;
|
|
22
|
+
readonly data: ProfileData;
|
|
23
|
+
}
|
|
24
|
+
export declare function emptyProfileData(): ProfileData;
|
|
25
|
+
/** Profiles share atomic state IO, while their namespace, payload, and ownership rules remain separate. */
|
|
26
|
+
export declare function readProfileState(profile: ProfileLocation, options?: ReceiptOptions): Promise<ProfileState>;
|
|
27
|
+
export declare function writeProfileState(previous: ProfileState, data: ProfileData): Promise<ProfileState>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Entry } from "./activation-ownership.js";
|
|
2
|
+
import type { SourceRevision } from "./activation-types.js";
|
|
3
|
+
import { type ProfileData, type ProfileState } from "./profile-state.js";
|
|
4
|
+
import type { ProfileLocation, ProfileOptions, ProfileShowResult, ProfileSyncOptions, ProfileSyncResult } from "./profile-types.js";
|
|
5
|
+
import { type Diagnostic, ExitCode, type ResultEnvelope } from "./result.js";
|
|
6
|
+
import type { ResolvedScope, SkillOrigin } from "./selection.js";
|
|
7
|
+
interface Desired {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly target: string;
|
|
10
|
+
readonly registry: string;
|
|
11
|
+
readonly origins: readonly SkillOrigin[];
|
|
12
|
+
readonly winner: "global" | "project";
|
|
13
|
+
}
|
|
14
|
+
interface Projection {
|
|
15
|
+
readonly project: string;
|
|
16
|
+
readonly desired: readonly Desired[];
|
|
17
|
+
readonly scopes: readonly ResolvedScope[];
|
|
18
|
+
readonly sources: readonly SourceRevision[];
|
|
19
|
+
readonly findings: readonly Diagnostic[];
|
|
20
|
+
}
|
|
21
|
+
interface ProfileWork {
|
|
22
|
+
readonly profile: ProfileLocation;
|
|
23
|
+
readonly state: ProfileState;
|
|
24
|
+
readonly root: Entry | undefined;
|
|
25
|
+
readonly projection: Projection;
|
|
26
|
+
readonly next: ProfileData;
|
|
27
|
+
readonly result: ProfileShowResult;
|
|
28
|
+
readonly options: ProfileOptions;
|
|
29
|
+
}
|
|
30
|
+
export interface ProfileInspection {
|
|
31
|
+
readonly result: ProfileShowResult;
|
|
32
|
+
readonly findings: readonly Diagnostic[];
|
|
33
|
+
readonly exit: ExitCode;
|
|
34
|
+
readonly state: ProfileState | null;
|
|
35
|
+
readonly work: ProfileWork | null;
|
|
36
|
+
}
|
|
37
|
+
/** Inspect existing profile content even when its source declarations cannot be resolved. */
|
|
38
|
+
export declare function inspectProfile(profile: ProfileLocation, options?: ProfileOptions): Promise<ProfileInspection>;
|
|
39
|
+
export declare function runProfileSync(name: string, options: ProfileSyncOptions): Promise<ResultEnvelope<ProfileSyncResult | null>>;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { LockOptions } from "./lock.js";
|
|
2
|
+
import type { Diagnostic } from "./result.js";
|
|
3
|
+
import type { RegistryOptions, SkillOrigin } from "./selection.js";
|
|
4
|
+
export interface ProfileOptions extends RegistryOptions, LockOptions {
|
|
5
|
+
readonly hermesRoot?: string;
|
|
6
|
+
readonly project?: string;
|
|
7
|
+
readonly signal?: {
|
|
8
|
+
readonly aborted: boolean;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface ProfileSyncOptions extends ProfileOptions {
|
|
12
|
+
readonly project: string;
|
|
13
|
+
readonly dryRun?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface HermesRootSelection {
|
|
16
|
+
/** Expanded absolute spelling selected before following any profile symlink. */
|
|
17
|
+
readonly path: string;
|
|
18
|
+
readonly root: string | null;
|
|
19
|
+
readonly source: "argument" | "environment" | "default";
|
|
20
|
+
}
|
|
21
|
+
export interface ProfileLocation {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
/** Hermes-visible profile path; root is its canonical directory target. */
|
|
24
|
+
readonly path: string;
|
|
25
|
+
readonly root: string;
|
|
26
|
+
readonly skillsRoot: string;
|
|
27
|
+
readonly rootSymlink: boolean;
|
|
28
|
+
readonly skills: {
|
|
29
|
+
readonly kind: "missing" | "directory" | "symlink" | "file" | "other";
|
|
30
|
+
readonly rawTarget: string | null;
|
|
31
|
+
readonly target: string | null;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface ProfileDiscovery {
|
|
35
|
+
readonly hermesRoot: HermesRootSelection;
|
|
36
|
+
readonly profiles: readonly ProfileLocation[];
|
|
37
|
+
readonly findings: readonly Diagnostic[];
|
|
38
|
+
}
|
|
39
|
+
export interface ProfileCandidate {
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly path: string;
|
|
42
|
+
readonly target: string;
|
|
43
|
+
readonly origins: readonly SkillOrigin[];
|
|
44
|
+
readonly state: "create" | "update" | "unchanged" | "shadowed";
|
|
45
|
+
readonly winner: "global" | "project" | "profile";
|
|
46
|
+
}
|
|
47
|
+
export interface ProfileLocalEntry {
|
|
48
|
+
readonly name: string;
|
|
49
|
+
readonly path: string;
|
|
50
|
+
readonly kind: "directory" | "file" | "symlink" | "other";
|
|
51
|
+
readonly rawTarget: string | null;
|
|
52
|
+
readonly target: string | null;
|
|
53
|
+
readonly shadows: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface ProfileChange {
|
|
56
|
+
readonly action: "mkdir" | "create" | "update" | "prune" | "release" | "write-receipt" | "recover";
|
|
57
|
+
readonly name?: string;
|
|
58
|
+
readonly path: string;
|
|
59
|
+
readonly target?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface ProfileSummary {
|
|
62
|
+
readonly profile: ProfileLocation;
|
|
63
|
+
readonly project: string | null;
|
|
64
|
+
readonly receiptPath: string | null;
|
|
65
|
+
readonly projection: "unmanaged" | "managed" | "pending" | "invalid";
|
|
66
|
+
readonly counts: {
|
|
67
|
+
readonly managed: number | null;
|
|
68
|
+
readonly local: number;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export interface ProfileListResult {
|
|
72
|
+
readonly hermesRoot: HermesRootSelection;
|
|
73
|
+
readonly profiles: readonly ProfileSummary[];
|
|
74
|
+
}
|
|
75
|
+
export interface ProfileShowResult {
|
|
76
|
+
readonly profile: ProfileLocation;
|
|
77
|
+
readonly project: string | null;
|
|
78
|
+
readonly receiptPath: string | null;
|
|
79
|
+
readonly managed: readonly ProfileCandidate[] | null;
|
|
80
|
+
readonly preserved: readonly ProfileLocalEntry[];
|
|
81
|
+
readonly changes: readonly ProfileChange[];
|
|
82
|
+
readonly pending: boolean;
|
|
83
|
+
}
|
|
84
|
+
export interface ProfileSyncResult extends ProfileShowResult {
|
|
85
|
+
readonly project: string;
|
|
86
|
+
readonly dryRun: boolean;
|
|
87
|
+
readonly applied: readonly ProfileChange[];
|
|
88
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ProfileListResult, ProfileOptions, ProfileShowResult, ProfileSyncOptions, ProfileSyncResult } from "./profile-types.js";
|
|
2
|
+
import { type ResultEnvelope } from "./result.js";
|
|
3
|
+
/** List configured profiles and read-only projection observations without choosing an ambient project. */
|
|
4
|
+
export declare function listProfiles(options?: ProfileOptions): Promise<ResultEnvelope<ProfileListResult | null>>;
|
|
5
|
+
export declare function showProfile(name: string, options?: ProfileOptions): Promise<ResultEnvelope<ProfileShowResult | null>>;
|
|
6
|
+
export declare function syncProfile(name: string, options: ProfileSyncOptions): Promise<ResultEnvelope<ProfileSyncResult | null>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { LockOptions } from "./lock.js";
|
|
2
|
+
import type { ResolveOptions, ScopeName } from "./selection.js";
|
|
3
|
+
export interface SyncOptions extends ResolveOptions, LockOptions {
|
|
4
|
+
readonly dryRun?: boolean;
|
|
5
|
+
readonly exitCode?: boolean;
|
|
6
|
+
readonly signal?: {
|
|
7
|
+
readonly aborted: boolean;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface SyncChange {
|
|
11
|
+
readonly scope: ScopeName;
|
|
12
|
+
readonly action: "create-directory" | "create-link" | "replace-link" | "remove-link" | "replace-root" | "write-receipt" | "recover";
|
|
13
|
+
readonly path: string;
|
|
14
|
+
readonly target?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SyncScopePlan {
|
|
17
|
+
readonly scope: ScopeName;
|
|
18
|
+
readonly root: string;
|
|
19
|
+
readonly activationRoot: string;
|
|
20
|
+
readonly mode: "composed" | "pack";
|
|
21
|
+
readonly skills: readonly {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly path: string;
|
|
24
|
+
}[];
|
|
25
|
+
readonly receiptPath: string;
|
|
26
|
+
readonly changes: readonly SyncChange[];
|
|
27
|
+
}
|
|
28
|
+
export interface SyncPlan {
|
|
29
|
+
readonly writeScopes: readonly ScopeName[];
|
|
30
|
+
readonly scopes: readonly SyncScopePlan[];
|
|
31
|
+
readonly changes: readonly SyncChange[];
|
|
32
|
+
}
|
|
33
|
+
export interface SyncResult extends SyncPlan {
|
|
34
|
+
readonly dryRun: boolean;
|
|
35
|
+
readonly applied: readonly SyncChange[];
|
|
36
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type ReceiptOptions, type ReceiptSnapshot } from "./activation-state.js";
|
|
2
|
+
import type { ActivationData, ActivationJournal, EntryIdentity, OwnedNode, SourceRevision } from "./activation-types.js";
|
|
3
|
+
import type { SyncChange, SyncOptions, SyncPlan, SyncResult, SyncScopePlan } from "./reconciliation-types.js";
|
|
4
|
+
import { type Diagnostic, type ResultEnvelope } from "./result.js";
|
|
5
|
+
import type { Resolution, ResolvedScope } from "./selection.js";
|
|
6
|
+
interface Operation {
|
|
7
|
+
readonly path: string;
|
|
8
|
+
readonly previous?: OwnedNode;
|
|
9
|
+
readonly target?: string;
|
|
10
|
+
readonly children?: ReadonlyMap<string, string>;
|
|
11
|
+
readonly changes: readonly SyncChange[];
|
|
12
|
+
}
|
|
13
|
+
interface Recovery {
|
|
14
|
+
readonly journal: ActivationJournal;
|
|
15
|
+
readonly published: boolean;
|
|
16
|
+
readonly restore: boolean;
|
|
17
|
+
readonly data: ActivationData;
|
|
18
|
+
}
|
|
19
|
+
interface ScopeWork {
|
|
20
|
+
readonly options: SyncOptions;
|
|
21
|
+
readonly scope: ResolvedScope;
|
|
22
|
+
readonly snapshot: ReceiptSnapshot<ActivationData>;
|
|
23
|
+
readonly receiptOptions: ReceiptOptions;
|
|
24
|
+
readonly data: ActivationData;
|
|
25
|
+
readonly sources: readonly SourceRevision[];
|
|
26
|
+
readonly recovery?: Recovery;
|
|
27
|
+
readonly directories: ReadonlyMap<string, EntryIdentity>;
|
|
28
|
+
readonly missingDirectories: readonly string[];
|
|
29
|
+
readonly operations: readonly Operation[];
|
|
30
|
+
readonly plan: SyncScopePlan;
|
|
31
|
+
}
|
|
32
|
+
/** Internal only: create and consume inside the activation ownership lock. */
|
|
33
|
+
export interface PreparedSync {
|
|
34
|
+
readonly plan: SyncPlan;
|
|
35
|
+
readonly scopes: readonly ScopeWork[];
|
|
36
|
+
readonly findings: readonly Diagnostic[];
|
|
37
|
+
readonly resolution: Resolution;
|
|
38
|
+
}
|
|
39
|
+
/** Internal shared revision evidence for scope and profile receipts. */
|
|
40
|
+
export declare function sourceRevision(kind: SourceRevision["kind"], path: string): Promise<SourceRevision>;
|
|
41
|
+
/** Read-only internal preparation; callers must not retain it across lock acquisitions. */
|
|
42
|
+
export declare function prepareSyncUnlocked(options?: SyncOptions, proposed?: ReadonlyMap<string, unknown>, expected?: ReadonlyMap<string, unknown>): Promise<PreparedSync>;
|
|
43
|
+
/** Internal C06 boundary: caller holds the activation lock; this function re-resolves intent itself. */
|
|
44
|
+
export declare function reconcileUnlocked(options?: SyncOptions, expected?: ReadonlyMap<string, unknown>): Promise<ResultEnvelope<SyncResult | null>>;
|
|
45
|
+
export declare function planSync(options?: SyncOptions): Promise<ResultEnvelope<SyncPlan | null>>;
|
|
46
|
+
export declare function sync(options?: SyncOptions): Promise<ResultEnvelope<SyncResult | null>>;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ResultEnvelope } from "./result.js";
|
|
2
|
+
import type { Resolution, ResolveOptions } from "./selection.js";
|
|
3
|
+
/** Resolve intent offline. No manifests, catalog definitions, or activation paths are written. */
|
|
4
|
+
export declare function resolveSelection(options?: ResolveOptions): Promise<ResultEnvelope<Resolution | null>>;
|
|
5
|
+
/** Internal read-only preview: substitute only named manifests in discovered scopes. */
|
|
6
|
+
export declare function resolveSelectionWithManifests(options?: ResolveOptions, proposed?: ReadonlyMap<string, unknown>, expected?: ReadonlyMap<string, unknown>): Promise<ResultEnvelope<Resolution | null>>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Process exits shared by the CLI and importing consumers. */
|
|
2
|
+
export declare const ExitCode: {
|
|
3
|
+
readonly SUCCESS: 0;
|
|
4
|
+
readonly FAILURE: 1;
|
|
5
|
+
readonly CONFIG: 2;
|
|
6
|
+
readonly REFUSED: 3;
|
|
7
|
+
readonly PARTIAL: 4;
|
|
8
|
+
readonly LOCK_BUSY: 5;
|
|
9
|
+
readonly DRIFT: 6;
|
|
10
|
+
readonly INTERRUPTED: 130;
|
|
11
|
+
};
|
|
12
|
+
export type ExitCode = (typeof ExitCode)[keyof typeof ExitCode];
|
|
13
|
+
export declare const JSON_SCHEMA_VERSION: 2;
|
|
14
|
+
export interface Diagnostic {
|
|
15
|
+
readonly code: `E_${string}` | `W_${string}` | `I_${string}`;
|
|
16
|
+
readonly severity: "error" | "warning" | "info";
|
|
17
|
+
readonly message: string;
|
|
18
|
+
readonly path?: string;
|
|
19
|
+
readonly fix?: string;
|
|
20
|
+
readonly scope?: string;
|
|
21
|
+
readonly name?: string;
|
|
22
|
+
readonly detail?: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
export interface ResultEnvelope<T> {
|
|
25
|
+
readonly schema: typeof JSON_SCHEMA_VERSION;
|
|
26
|
+
readonly command: string;
|
|
27
|
+
readonly ok: boolean;
|
|
28
|
+
readonly exit: ExitCode;
|
|
29
|
+
readonly data: T;
|
|
30
|
+
readonly findings: readonly Diagnostic[];
|
|
31
|
+
}
|
|
32
|
+
export interface ResultOptions {
|
|
33
|
+
readonly exit?: ExitCode;
|
|
34
|
+
readonly findings?: readonly Diagnostic[];
|
|
35
|
+
}
|
|
36
|
+
/** Construct the wire result without formatting output or exiting the process. */
|
|
37
|
+
export declare function makeResult<T>(command: string, data: T, { exit, findings }?: ResultOptions): ResultEnvelope<T>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SyncChange, SyncOptions } from "./reconciliation-types.js";
|
|
2
|
+
import type { ScopeName } from "./selection.js";
|
|
3
|
+
export type SelectionKind = "skill" | "set" | "pack";
|
|
4
|
+
export interface SelectionOptions extends Omit<SyncOptions, "scope" | "exitCode"> {
|
|
5
|
+
readonly scope?: ScopeName;
|
|
6
|
+
}
|
|
7
|
+
export interface SelectionChange {
|
|
8
|
+
readonly scope: ScopeName;
|
|
9
|
+
readonly action: "write-manifest" | SyncChange["action"];
|
|
10
|
+
readonly path: string;
|
|
11
|
+
readonly target?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SelectionResult {
|
|
14
|
+
readonly scope: ScopeName;
|
|
15
|
+
readonly root: string;
|
|
16
|
+
readonly manifestPath: string;
|
|
17
|
+
readonly manifest: Readonly<Record<string, unknown>>;
|
|
18
|
+
readonly dryRun: boolean;
|
|
19
|
+
readonly changed: boolean;
|
|
20
|
+
readonly saved: boolean;
|
|
21
|
+
readonly changes: readonly SelectionChange[];
|
|
22
|
+
readonly applied: readonly SelectionChange[];
|
|
23
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ResultEnvelope } from "./result.js";
|
|
2
|
+
import type { SelectionKind, SelectionOptions, SelectionResult } from "./selection-command-types.js";
|
|
3
|
+
export declare function initScope(options?: SelectionOptions): Promise<ResultEnvelope<SelectionResult | null>>;
|
|
4
|
+
export declare function enableSelection(kind: SelectionKind, reference: string, options?: SelectionOptions): Promise<ResultEnvelope<SelectionResult | null>>;
|
|
5
|
+
export declare function disableSelection(kind: SelectionKind, reference: string, options?: SelectionOptions): Promise<ResultEnvelope<SelectionResult | null>>;
|
|
6
|
+
export declare function setInheritance(enabled: boolean, options?: SelectionOptions): Promise<ResultEnvelope<SelectionResult | null>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SkillexError } from "./error.js";
|
|
2
|
+
import type { SkillsManifest } from "./selection.js";
|
|
3
|
+
export interface SelectionManifestSnapshot {
|
|
4
|
+
readonly root: string;
|
|
5
|
+
readonly path: string;
|
|
6
|
+
readonly exists: boolean;
|
|
7
|
+
readonly raw: Readonly<Record<string, unknown>> | null;
|
|
8
|
+
readonly manifest: SkillsManifest | null;
|
|
9
|
+
}
|
|
10
|
+
/** The declaration may already be saved even when later durability checks fail. */
|
|
11
|
+
export declare class SelectionManifestWriteError extends SkillexError {
|
|
12
|
+
readonly published: boolean;
|
|
13
|
+
constructor(error: SkillexError, published: boolean);
|
|
14
|
+
}
|
|
15
|
+
/** Inspect one source declaration. Missing .agents/skills.json never creates anything. */
|
|
16
|
+
export declare function readSelectionManifest(root: string): Promise<SelectionManifestSnapshot>;
|
|
17
|
+
/** Validate and atomically publish while the caller holds the shared activation lock. */
|
|
18
|
+
export declare function writeSelectionManifest(previous: SelectionManifestSnapshot, raw: Readonly<Record<string, unknown>>): Promise<SelectionManifestSnapshot>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export type ScopeName = "global" | "project";
|
|
2
|
+
export type WriteScope = "auto" | ScopeName | "both";
|
|
3
|
+
export interface SkillSelection {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SetSelection {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly include?: readonly string[];
|
|
9
|
+
readonly exclude: readonly string[];
|
|
10
|
+
readonly optional: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface PackSelection {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly version?: string;
|
|
15
|
+
readonly optional: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface SkillsManifest {
|
|
18
|
+
readonly path: string;
|
|
19
|
+
readonly scope?: ScopeName;
|
|
20
|
+
readonly inheritGlobal: boolean;
|
|
21
|
+
readonly registry?: string;
|
|
22
|
+
readonly skills: readonly SkillSelection[];
|
|
23
|
+
readonly sets: readonly SetSelection[];
|
|
24
|
+
readonly packs: readonly PackSelection[];
|
|
25
|
+
readonly exclude: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
export interface ScopeLocation {
|
|
28
|
+
readonly scope: ScopeName;
|
|
29
|
+
readonly root: string;
|
|
30
|
+
readonly path: string;
|
|
31
|
+
readonly exists: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface ScopeDiscovery {
|
|
34
|
+
readonly global: ScopeLocation;
|
|
35
|
+
readonly project?: ScopeLocation;
|
|
36
|
+
readonly writeScopes: readonly ScopeName[];
|
|
37
|
+
}
|
|
38
|
+
export interface DiscoveryOptions {
|
|
39
|
+
readonly cwd?: string;
|
|
40
|
+
readonly home?: string;
|
|
41
|
+
readonly project?: string;
|
|
42
|
+
readonly scope?: WriteScope;
|
|
43
|
+
}
|
|
44
|
+
export interface RegistryOptions {
|
|
45
|
+
readonly registryRoot?: string;
|
|
46
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
47
|
+
readonly home?: string;
|
|
48
|
+
readonly cwd?: string;
|
|
49
|
+
readonly registry?: string;
|
|
50
|
+
readonly installedRoot?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface RegistrySelection {
|
|
53
|
+
readonly root: string;
|
|
54
|
+
readonly source: "argument" | "environment" | "cache" | "checkout" | "installed" | "fallback";
|
|
55
|
+
readonly searched: readonly string[];
|
|
56
|
+
}
|
|
57
|
+
export interface ResolveOptions extends DiscoveryOptions {
|
|
58
|
+
readonly registryRoot?: string;
|
|
59
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
60
|
+
readonly installedRoot?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface SkillOrigin {
|
|
63
|
+
readonly scope: ScopeName;
|
|
64
|
+
readonly manifest: string;
|
|
65
|
+
readonly kind: "skill" | "set" | "pack" | "inherit";
|
|
66
|
+
readonly reference: string;
|
|
67
|
+
}
|
|
68
|
+
export interface ResolvedBinding {
|
|
69
|
+
readonly name: string;
|
|
70
|
+
readonly path: string;
|
|
71
|
+
readonly origins: readonly SkillOrigin[];
|
|
72
|
+
}
|
|
73
|
+
export interface ExcludedBinding {
|
|
74
|
+
readonly name: string;
|
|
75
|
+
readonly origins: readonly SkillOrigin[];
|
|
76
|
+
readonly by: "scope" | "set";
|
|
77
|
+
readonly reference: string;
|
|
78
|
+
}
|
|
79
|
+
export interface ResolvedPack {
|
|
80
|
+
readonly name: string;
|
|
81
|
+
readonly version: string;
|
|
82
|
+
readonly path: string;
|
|
83
|
+
readonly skillsRoot: string;
|
|
84
|
+
}
|
|
85
|
+
export interface ResolvedScope {
|
|
86
|
+
readonly scope: ScopeName;
|
|
87
|
+
readonly root: string;
|
|
88
|
+
readonly manifest: SkillsManifest;
|
|
89
|
+
readonly registry: RegistrySelection;
|
|
90
|
+
readonly mode: "composed" | "pack";
|
|
91
|
+
readonly pack?: ResolvedPack;
|
|
92
|
+
readonly bindings: readonly ResolvedBinding[];
|
|
93
|
+
readonly excluded: readonly ExcludedBinding[];
|
|
94
|
+
}
|
|
95
|
+
export interface Resolution {
|
|
96
|
+
readonly scopes: readonly ResolvedScope[];
|
|
97
|
+
readonly writeScopes: readonly ScopeName[];
|
|
98
|
+
}
|