@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,9 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type ResultEnvelope } from "../index.js";
|
|
3
|
+
interface Output {
|
|
4
|
+
emit(result: ResultEnvelope<unknown>, text?: string): void;
|
|
5
|
+
help(command: Command): void;
|
|
6
|
+
}
|
|
7
|
+
/** Register reference composition operations; shared core functions own all IO. */
|
|
8
|
+
export declare function registerCompositionCommands(program: Command, output: Output): void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Command } from "commander";
|
|
2
|
+
import { type ResultEnvelope } from "../index.js";
|
|
3
|
+
interface Output {
|
|
4
|
+
emit(result: ResultEnvelope<unknown>, text?: string): void;
|
|
5
|
+
}
|
|
6
|
+
export declare function registerDiagnosticCommands(program: Command, output: Output): void;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type ResultEnvelope } from "../index.js";
|
|
3
|
+
interface Output {
|
|
4
|
+
emit(result: ResultEnvelope<unknown>, text?: string): void;
|
|
5
|
+
}
|
|
6
|
+
export declare function registerMigrationCommand(program: Command, output: Output): void;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type ResultEnvelope } from "../index.js";
|
|
3
|
+
interface Output {
|
|
4
|
+
emit(result: ResultEnvelope<unknown>, text?: string): void;
|
|
5
|
+
help(command: Command): void;
|
|
6
|
+
}
|
|
7
|
+
export declare function registerProfileCommands(program: Command, output: Output): void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Command } from "commander";
|
|
2
|
+
import { type ResultEnvelope } from "../index.js";
|
|
3
|
+
interface Output {
|
|
4
|
+
emit(result: ResultEnvelope<unknown>, text?: string): void;
|
|
5
|
+
}
|
|
6
|
+
export declare function registerSelectionCommands(program: Command, output: Output): void;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Command } from "commander";
|
|
2
|
+
import { type ResultEnvelope } from "../index.js";
|
|
3
|
+
interface Output {
|
|
4
|
+
emit(result: ResultEnvelope<unknown>, text?: string): void;
|
|
5
|
+
}
|
|
6
|
+
export declare function registerSyncCommand(program: Command, output: Output): void;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type ResultEnvelope } from "../index.js";
|
|
3
|
+
interface Output {
|
|
4
|
+
emit(result: ResultEnvelope<unknown>, text?: string): void;
|
|
5
|
+
help(command: Command): void;
|
|
6
|
+
}
|
|
7
|
+
export declare function registerVendorCommands(program: Command, output: Output): void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BigIntStats } from "node:fs";
|
|
2
|
+
import type { ActivationData, EntryIdentity, OwnedNode } from "./activation-types.js";
|
|
3
|
+
export interface Entry {
|
|
4
|
+
readonly path: string;
|
|
5
|
+
readonly info: BigIntStats;
|
|
6
|
+
readonly raw?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function refuse(path: string, message: string, code?: "E_ACTIVATION_CONFLICT" | "E_OWNERSHIP_CHANGED" | "E_ACTIVATION_RECURSIVE" | "E_ACTIVATION_RECEIPT"): never;
|
|
9
|
+
export declare function within(path: string, root: string): boolean;
|
|
10
|
+
export declare function entry(path: string): Promise<Entry | undefined>;
|
|
11
|
+
export declare function identity(item: Entry): EntryIdentity;
|
|
12
|
+
export declare function matches(item: Entry | undefined, expected: EntryIdentity): boolean;
|
|
13
|
+
export declare function requireIdentity(path: string, expected: EntryIdentity, missingOkay?: boolean): Promise<Entry | undefined>;
|
|
14
|
+
export declare function inspectOwnedNode(path: string, node: OwnedNode, missingOkay?: boolean): Promise<boolean>;
|
|
15
|
+
export declare function validateData(raw: unknown, root: string, aliases: readonly string[], receipt: string): ActivationData;
|
|
16
|
+
export declare function emptyData(): ActivationData;
|
|
17
|
+
export declare function replaceOwnership(data: ActivationData, path: string, node?: OwnedNode): ActivationData;
|
|
18
|
+
export declare function lexicalTarget(path: string, raw: string): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { LockOptions } from "./lock.js";
|
|
2
|
+
export interface ReceiptOptions extends LockOptions {
|
|
3
|
+
readonly forbiddenRoots?: readonly string[];
|
|
4
|
+
}
|
|
5
|
+
export interface ReceiptDocument<T> {
|
|
6
|
+
readonly schema: 2;
|
|
7
|
+
readonly scopeRoot: string;
|
|
8
|
+
readonly activationRoot: string;
|
|
9
|
+
readonly host: string;
|
|
10
|
+
readonly uid: number | null;
|
|
11
|
+
readonly data: T;
|
|
12
|
+
}
|
|
13
|
+
/** An IO snapshot, not an ownership claim over any activation filesystem object. */
|
|
14
|
+
export interface ReceiptSnapshot<T> {
|
|
15
|
+
readonly path: string;
|
|
16
|
+
readonly scopeRoot: string;
|
|
17
|
+
readonly activationRoot: string;
|
|
18
|
+
readonly document?: ReceiptDocument<T>;
|
|
19
|
+
}
|
|
20
|
+
/** Internal target binding; public activation entry points keep their existing namespace and path. */
|
|
21
|
+
export interface ReceiptBinding {
|
|
22
|
+
readonly namespace: "activations" | "profiles" | "migrations";
|
|
23
|
+
readonly targetParts: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
/** Validate state placement without creating anything or inspecting activation receipt contents. */
|
|
26
|
+
export declare function validateActivationStateLocation(scopeRoot: string, options?: ReceiptOptions): Promise<void>;
|
|
27
|
+
/** Read and validate local v2 state without creating directories or adopting legacy receipts. */
|
|
28
|
+
export declare function readActivationReceipt<T = unknown>(scopeRoot: string, options?: ReceiptOptions): Promise<ReceiptSnapshot<T>>;
|
|
29
|
+
/** Internal shared state IO; callers supply a fixed target binding, never user-directed receipt paths. */
|
|
30
|
+
export declare function readBoundReceipt<T = unknown>(scopeRoot: string, binding: ReceiptBinding, options?: ReceiptOptions): Promise<ReceiptSnapshot<T>>;
|
|
31
|
+
/**
|
|
32
|
+
* Persist a complete document while the caller holds the activation ownership lock.
|
|
33
|
+
* The previous snapshot authorizes only its exact bytes/inode (or continued absence).
|
|
34
|
+
*/
|
|
35
|
+
export declare function writeActivationReceipt<T>(previous: ReceiptSnapshot<T>, data: T, options?: ReceiptOptions): Promise<ReceiptSnapshot<T>>;
|
|
36
|
+
/** Writes retain the original binding and exact opaque snapshot evidence. */
|
|
37
|
+
export declare function writeBoundReceipt<T>(previous: ReceiptSnapshot<T>, data: T, options?: ReceiptOptions): Promise<ReceiptSnapshot<T>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface EntryIdentity {
|
|
2
|
+
readonly kind: "directory" | "link";
|
|
3
|
+
readonly dev: string;
|
|
4
|
+
readonly ino: string;
|
|
5
|
+
readonly raw?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface OwnedNode {
|
|
8
|
+
readonly identity: EntryIdentity;
|
|
9
|
+
readonly children?: Readonly<Record<string, EntryIdentity>>;
|
|
10
|
+
}
|
|
11
|
+
export interface SourceRevision {
|
|
12
|
+
readonly kind: "catalog" | "pack";
|
|
13
|
+
readonly path: string;
|
|
14
|
+
readonly commit: string | null;
|
|
15
|
+
readonly reason: string | null;
|
|
16
|
+
}
|
|
17
|
+
export interface ActivationJournal {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly intent: string;
|
|
20
|
+
readonly path: string;
|
|
21
|
+
readonly stage: string;
|
|
22
|
+
readonly parked: string;
|
|
23
|
+
readonly previous?: OwnedNode;
|
|
24
|
+
readonly next?: OwnedNode;
|
|
25
|
+
}
|
|
26
|
+
export interface ActivationData {
|
|
27
|
+
readonly version: 1;
|
|
28
|
+
readonly links: Readonly<Record<string, EntryIdentity>>;
|
|
29
|
+
readonly directories: Readonly<Record<string, EntryIdentity>>;
|
|
30
|
+
readonly sources: readonly SourceRevision[];
|
|
31
|
+
readonly pending?: ActivationJournal;
|
|
32
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ScopeName } from "./selection.js";
|
|
2
|
+
/** Scope aliases shared by reconciliation and diagnostics. */
|
|
3
|
+
export declare const GLOBAL_CLI_ALIASES: readonly [".claude/skills", ".codex/skills", ".gemini/skills", ".copilot/skills", ".kimi-code/skills", ".kimi/skills", ".openclaw/skills", ".config/opencode/skills"];
|
|
4
|
+
export declare const PROJECT_CLI_ALIASES: readonly [".claude/skills", ".codex/skills", ".gemini/skills", ".copilot/skills", ".opencode/skills", ".kimi-code/skills"];
|
|
5
|
+
/** These integrations retain their own installer or profile lifecycle. */
|
|
6
|
+
export declare const NEVER_TOUCH: readonly [".hermes", ".augment", ".cursor", ".crush"];
|
|
7
|
+
export declare function aliasPaths(base: string, scope: ScopeName): readonly string[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type LockOptions } from "./lock.js";
|
|
2
|
+
import type { RegistrySelection } from "./selection.js";
|
|
3
|
+
export interface CatalogLockOptions extends LockOptions {
|
|
4
|
+
readonly signal?: {
|
|
5
|
+
readonly aborted: boolean;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
interface CatalogTransactionOptions extends CatalogLockOptions {
|
|
9
|
+
readonly allowPendingVendor?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Share state-placement rules without reading or writing an activation receipt. */
|
|
12
|
+
export declare function validateCatalogStateLocation(registry: RegistrySelection, options: CatalogLockOptions): Promise<void>;
|
|
13
|
+
/** All Node writers of canonical definition bytes serialize on the catalog itself. */
|
|
14
|
+
export declare function withCatalogLock<T>(registry: RegistrySelection, options: CatalogTransactionOptions, action: () => Promise<T>): Promise<T>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RegistryOptions, RegistrySelection } from "./selection.js";
|
|
2
|
+
export interface SkillReference {
|
|
3
|
+
readonly kind: "set" | "pack";
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly version?: string;
|
|
6
|
+
readonly path: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SkillMetadata {
|
|
9
|
+
readonly description: string | null;
|
|
10
|
+
readonly metadata: Readonly<Record<string, unknown>>;
|
|
11
|
+
readonly provenance: Readonly<Record<string, unknown>> | null;
|
|
12
|
+
}
|
|
13
|
+
export interface SkillDetails extends SkillMetadata {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly path: string;
|
|
16
|
+
readonly references: readonly SkillReference[];
|
|
17
|
+
}
|
|
18
|
+
export interface ListSkillsOptions extends RegistryOptions {
|
|
19
|
+
readonly query?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface SkillListData {
|
|
22
|
+
readonly registry: RegistrySelection;
|
|
23
|
+
readonly skills: readonly SkillDetails[];
|
|
24
|
+
}
|
|
25
|
+
export interface SkillShowData {
|
|
26
|
+
readonly registry: RegistrySelection;
|
|
27
|
+
readonly skill: SkillDetails;
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type CatalogLockOptions } from "./catalog-lock.js";
|
|
2
|
+
import { type ResultEnvelope } from "./result.js";
|
|
3
|
+
import type { RegistryOptions, RegistrySelection } from "./selection.js";
|
|
4
|
+
export interface CatalogChange {
|
|
5
|
+
readonly action: string;
|
|
6
|
+
readonly path: string;
|
|
7
|
+
readonly source?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CatalogWriteResult {
|
|
10
|
+
readonly registry: RegistrySelection;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly dryRun: boolean;
|
|
14
|
+
readonly changes: readonly CatalogChange[];
|
|
15
|
+
}
|
|
16
|
+
export interface CatalogWriteOptions extends RegistryOptions, CatalogLockOptions {
|
|
17
|
+
readonly dryRun?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface CreateSkillOptions extends CatalogWriteOptions {
|
|
20
|
+
readonly description?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Scaffold one canonical skill without touching any activation roots. */
|
|
23
|
+
export declare function createSkill(name: string, options?: CreateSkillOptions): Promise<ResultEnvelope<CatalogWriteResult | null>>;
|
|
24
|
+
/** Import a fully inspected local tree, retaining the source and its provenance evidence. */
|
|
25
|
+
export declare function importSkill(source: string, name: string, options?: CatalogWriteOptions): Promise<ResultEnvelope<CatalogWriteResult | null>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ListSkillsOptions, SkillListData, SkillShowData } from "./catalog-types.js";
|
|
2
|
+
import { type ResultEnvelope } from "./result.js";
|
|
3
|
+
import type { RegistryOptions } from "./selection.js";
|
|
4
|
+
/** Browse valid canonical definitions while keeping incomplete inspection visible. */
|
|
5
|
+
export declare function listSkills(options?: ListSkillsOptions): Promise<ResultEnvelope<SkillListData | null>>;
|
|
6
|
+
/** Inspect one canonical identity; frontmatter names never redirect its lookup. */
|
|
7
|
+
export declare function showSkill(name: string, options?: RegistryOptions): Promise<ResultEnvelope<SkillShowData | null>>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Stats } from "node:fs";
|
|
2
|
+
import type { CompositionChange, CompositionDetails, CompositionMutationData, CompositionOptions } from "./composition-types.js";
|
|
3
|
+
import { SkillexError } from "./error.js";
|
|
4
|
+
import { type ResultEnvelope } from "./result.js";
|
|
5
|
+
import type { RegistrySelection } from "./selection.js";
|
|
6
|
+
interface LinkIdentity {
|
|
7
|
+
readonly info: Stats;
|
|
8
|
+
readonly raw: string;
|
|
9
|
+
readonly target: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CompositionPlan {
|
|
12
|
+
readonly registry: RegistrySelection;
|
|
13
|
+
readonly composition: CompositionDetails;
|
|
14
|
+
readonly dryRun: boolean;
|
|
15
|
+
readonly changes: CompositionChange[];
|
|
16
|
+
readonly directories: Map<string, Stats>;
|
|
17
|
+
readonly links: Map<string, LinkIdentity>;
|
|
18
|
+
manifest?: {
|
|
19
|
+
path: string;
|
|
20
|
+
bytes: Buffer;
|
|
21
|
+
before?: {
|
|
22
|
+
bytes: Buffer;
|
|
23
|
+
info: Stats;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export declare function compositionError<T>(command: string, error: unknown): ResultEnvelope<T | null>;
|
|
28
|
+
export declare function conflict(path: string, message?: string): never;
|
|
29
|
+
export declare function requestedSkills(registry: string, names: readonly string[], path: string): Promise<Map<string, string>>;
|
|
30
|
+
export declare function newPlan(registry: RegistrySelection, composition: CompositionDetails, dryRun: boolean): Promise<CompositionPlan>;
|
|
31
|
+
export declare function planDirectory(plan: CompositionPlan, path: string): Promise<void>;
|
|
32
|
+
export declare function inspectCanonicalLink(plan: CompositionPlan, path: string, target: string): Promise<boolean>;
|
|
33
|
+
export declare function planLink(plan: CompositionPlan, path: string, target: string): Promise<void>;
|
|
34
|
+
export declare function planUnlink(plan: CompositionPlan, path: string, target: string): Promise<void>;
|
|
35
|
+
export declare function mutateComposition(command: string, options: CompositionOptions, prepare: () => Promise<CompositionPlan>): Promise<ResultEnvelope<CompositionMutationData | null>>;
|
|
36
|
+
export declare function listOutcome<T>(command: string, value: T, failures: readonly SkillexError[], count: number): ResultEnvelope<T>;
|
|
37
|
+
export declare function collectedError(error: unknown, path: string): SkillexError;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { RegistryOptions, RegistrySelection } from "./selection.js";
|
|
2
|
+
export interface CompositionOptions extends RegistryOptions {
|
|
3
|
+
readonly dryRun?: boolean;
|
|
4
|
+
readonly description?: string;
|
|
5
|
+
readonly stateHome?: string;
|
|
6
|
+
readonly timeoutMs?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface CompositionDetails {
|
|
9
|
+
readonly kind: "set" | "pack";
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly version?: string;
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly skills: readonly {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly path: string;
|
|
16
|
+
}[];
|
|
17
|
+
readonly description?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface CompositionChange {
|
|
20
|
+
readonly action: "create-directory" | "create-link" | "remove-link" | "write-manifest";
|
|
21
|
+
readonly path: string;
|
|
22
|
+
readonly target?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface CompositionMutationData {
|
|
25
|
+
readonly registry: RegistrySelection;
|
|
26
|
+
readonly composition: CompositionDetails;
|
|
27
|
+
readonly dryRun: boolean;
|
|
28
|
+
readonly changes: readonly CompositionChange[];
|
|
29
|
+
}
|
|
30
|
+
export interface SetListData {
|
|
31
|
+
readonly registry: RegistrySelection;
|
|
32
|
+
readonly sets: readonly CompositionDetails[];
|
|
33
|
+
}
|
|
34
|
+
export interface SetShowData {
|
|
35
|
+
readonly registry: RegistrySelection;
|
|
36
|
+
readonly set: CompositionDetails;
|
|
37
|
+
}
|
|
38
|
+
export interface PackListData {
|
|
39
|
+
readonly registry: RegistrySelection;
|
|
40
|
+
readonly packs: readonly CompositionDetails[];
|
|
41
|
+
}
|
|
42
|
+
export interface PackShowData {
|
|
43
|
+
readonly registry: RegistrySelection;
|
|
44
|
+
readonly pack: CompositionDetails;
|
|
45
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PackSelection, ResolvedPack } from "./selection.js";
|
|
2
|
+
export declare function canonicalSkill(registry: string, name: string): Promise<string>;
|
|
3
|
+
export declare function setMembers(registry: string, name: string): Promise<{
|
|
4
|
+
path: string;
|
|
5
|
+
names: string[];
|
|
6
|
+
}>;
|
|
7
|
+
export declare function setMemberTarget(registry: string, setPath: string, name: string): Promise<string>;
|
|
8
|
+
export interface PackInventory extends ResolvedPack {
|
|
9
|
+
readonly names: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
/** pack.toml owns membership; its generated skills/ links are checked by verify. */
|
|
12
|
+
export declare function packInventory(registry: string, selection: PackSelection): Promise<PackInventory>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type ContentEntry = {
|
|
2
|
+
readonly path: string;
|
|
3
|
+
readonly kind: "directory";
|
|
4
|
+
readonly mode: number;
|
|
5
|
+
} | {
|
|
6
|
+
readonly path: string;
|
|
7
|
+
readonly kind: "file";
|
|
8
|
+
readonly mode: number;
|
|
9
|
+
readonly bytes: Buffer;
|
|
10
|
+
} | {
|
|
11
|
+
readonly path: string;
|
|
12
|
+
readonly kind: "link";
|
|
13
|
+
readonly target: string;
|
|
14
|
+
readonly originalTarget: string;
|
|
15
|
+
readonly targetPath: string;
|
|
16
|
+
};
|
|
17
|
+
export interface CapturedContent {
|
|
18
|
+
readonly entries: readonly ContentEntry[];
|
|
19
|
+
readonly excluded: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
export declare function isWithin(root: string, path: string): boolean;
|
|
22
|
+
/** Capture bytes before mutation and retain every authored support entry. */
|
|
23
|
+
export declare function captureContent(root: string): Promise<CapturedContent>;
|
|
24
|
+
/** Existing Python vendor digest wire format, extended with Git's symlink mode. */
|
|
25
|
+
export declare function digestContent(entries: readonly ContentEntry[]): string;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { SyncChange, SyncOptions } from "./reconciliation-types.js";
|
|
2
|
+
import type { Diagnostic } from "./result.js";
|
|
3
|
+
import type { ExcludedBinding, Resolution, ScopeName, SkillOrigin } from "./selection.js";
|
|
4
|
+
export interface DiagnosticOptions extends Omit<SyncOptions, "dryRun" | "exitCode"> {
|
|
5
|
+
}
|
|
6
|
+
export interface PathObservation {
|
|
7
|
+
readonly path: string;
|
|
8
|
+
readonly kind: "missing" | "directory" | "link" | "file" | "other" | "unreadable";
|
|
9
|
+
readonly rawTarget: string | null;
|
|
10
|
+
readonly target: string | null;
|
|
11
|
+
readonly reachable: boolean;
|
|
12
|
+
readonly ownership: "owned" | "foreign" | "changed" | "pack" | "none";
|
|
13
|
+
}
|
|
14
|
+
export interface SkillObservation extends PathObservation {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
}
|
|
17
|
+
export interface AliasObservation extends PathObservation {
|
|
18
|
+
readonly reachesRoot: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ReceiptObservation {
|
|
21
|
+
readonly path: string | null;
|
|
22
|
+
readonly state: "missing" | "valid" | "pending" | "invalid";
|
|
23
|
+
readonly pending: {
|
|
24
|
+
readonly path: string;
|
|
25
|
+
readonly stage: string;
|
|
26
|
+
readonly parked: string;
|
|
27
|
+
} | null;
|
|
28
|
+
}
|
|
29
|
+
export interface StatusScope {
|
|
30
|
+
readonly scope: ScopeName;
|
|
31
|
+
readonly root: string;
|
|
32
|
+
readonly manifestPath: string;
|
|
33
|
+
readonly mode: "composed" | "pack" | null;
|
|
34
|
+
readonly desired: readonly string[] | null;
|
|
35
|
+
readonly actual: {
|
|
36
|
+
readonly root: PathObservation;
|
|
37
|
+
readonly entries: readonly SkillObservation[];
|
|
38
|
+
};
|
|
39
|
+
readonly counts: {
|
|
40
|
+
readonly desired: number | null;
|
|
41
|
+
readonly actual: number;
|
|
42
|
+
readonly owned: number;
|
|
43
|
+
readonly foreign: number;
|
|
44
|
+
readonly pack: number;
|
|
45
|
+
readonly missing: number | null;
|
|
46
|
+
};
|
|
47
|
+
readonly aliases: readonly AliasObservation[];
|
|
48
|
+
readonly receipt: ReceiptObservation;
|
|
49
|
+
}
|
|
50
|
+
export interface StatusResult {
|
|
51
|
+
readonly resolution: Resolution | null;
|
|
52
|
+
readonly writeScopes: readonly ScopeName[];
|
|
53
|
+
readonly scopes: readonly StatusScope[];
|
|
54
|
+
readonly changes: readonly SyncChange[];
|
|
55
|
+
}
|
|
56
|
+
export interface SkillExplanation {
|
|
57
|
+
readonly scope: ScopeName;
|
|
58
|
+
readonly root: string;
|
|
59
|
+
readonly manifestPath: string;
|
|
60
|
+
readonly state: "effective" | "excluded" | "dormant" | "unselected" | "blocked";
|
|
61
|
+
readonly canonical: string | null;
|
|
62
|
+
readonly origins: readonly SkillOrigin[];
|
|
63
|
+
readonly exclusions: readonly ExcludedBinding[];
|
|
64
|
+
readonly dormant: readonly SkillOrigin[];
|
|
65
|
+
readonly actual: PathObservation;
|
|
66
|
+
readonly aliases: readonly {
|
|
67
|
+
readonly path: string;
|
|
68
|
+
readonly reachable: boolean;
|
|
69
|
+
}[];
|
|
70
|
+
readonly blockers: readonly Diagnostic[];
|
|
71
|
+
}
|
|
72
|
+
export interface ExplainResult {
|
|
73
|
+
readonly name: string;
|
|
74
|
+
readonly canonical: string | null;
|
|
75
|
+
readonly scopes: readonly SkillExplanation[];
|
|
76
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DiagnosticOptions, ExplainResult, StatusResult } from "./diagnostics-types.js";
|
|
2
|
+
import { ExitCode, type ResultEnvelope } from "./result.js";
|
|
3
|
+
/** Internal shared exit precedence for read-only diagnostics. */
|
|
4
|
+
export declare function diagnosticExit(exits: readonly ExitCode[], drift?: boolean): ExitCode;
|
|
5
|
+
export declare function inspectStatus(options?: DiagnosticOptions): Promise<ResultEnvelope<StatusResult | null>>;
|
|
6
|
+
export declare function explainSkill(name: string, options?: DiagnosticOptions): Promise<ResultEnvelope<ExplainResult | null>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DiscoveryOptions, RegistryOptions, RegistrySelection, ScopeDiscovery } from "./selection.js";
|
|
2
|
+
/** Discover read sources separately from the activation scopes selected for writes. */
|
|
3
|
+
export declare function discoverScopes(options?: DiscoveryOptions): Promise<ScopeDiscovery>;
|
|
4
|
+
/** Select one offline checkout. Explicit inputs are exclusive, including invalid ones. */
|
|
5
|
+
export declare function discoverRegistry(options?: RegistryOptions): Promise<RegistrySelection>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DoctorSourceInspection } from "./doctor-types.js";
|
|
2
|
+
import { type Diagnostic, ExitCode } from "./result.js";
|
|
3
|
+
import type { RegistrySelection } from "./selection.js";
|
|
4
|
+
export interface SourceAudit {
|
|
5
|
+
readonly data: DoctorSourceInspection;
|
|
6
|
+
readonly findings: readonly Diagnostic[];
|
|
7
|
+
readonly exits: readonly ExitCode[];
|
|
8
|
+
}
|
|
9
|
+
/** A source audit accumulates independent failures instead of hiding later violations. */
|
|
10
|
+
export declare function inspectDoctorSources(registry: RegistrySelection): Promise<SourceAudit>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { DiagnosticOptions, StatusResult } from "./diagnostics-types.js";
|
|
2
|
+
import type { RegistrySelection } from "./selection.js";
|
|
3
|
+
export interface DoctorOptions extends DiagnosticOptions {
|
|
4
|
+
readonly sourcesOnly?: boolean;
|
|
5
|
+
/** Supply the text of `ps -axo pid=,args=` for an isolated observation. */
|
|
6
|
+
readonly processSnapshot?: () => Promise<string>;
|
|
7
|
+
}
|
|
8
|
+
export interface DoctorSourceInspection {
|
|
9
|
+
readonly registry: RegistrySelection;
|
|
10
|
+
readonly canonicalSkills: number;
|
|
11
|
+
readonly sets: number;
|
|
12
|
+
readonly packs: number;
|
|
13
|
+
readonly provenance: number;
|
|
14
|
+
readonly digestsChecked: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ConfiguredLegacyWriter {
|
|
17
|
+
readonly kind: "mise" | "service";
|
|
18
|
+
readonly path: string;
|
|
19
|
+
readonly line: number;
|
|
20
|
+
readonly command: string;
|
|
21
|
+
}
|
|
22
|
+
export interface RunningLegacyWriter {
|
|
23
|
+
readonly pid: number;
|
|
24
|
+
readonly command: string;
|
|
25
|
+
readonly entrypoint: string;
|
|
26
|
+
}
|
|
27
|
+
export interface DoctorWriterInspection {
|
|
28
|
+
readonly configured: readonly ConfiguredLegacyWriter[];
|
|
29
|
+
readonly running: readonly RunningLegacyWriter[];
|
|
30
|
+
readonly processObservation: "complete" | "unknown";
|
|
31
|
+
}
|
|
32
|
+
export interface DoctorResult {
|
|
33
|
+
readonly sourcesOnly: boolean;
|
|
34
|
+
readonly sources: readonly DoctorSourceInspection[];
|
|
35
|
+
readonly status: StatusResult | null;
|
|
36
|
+
readonly writers: DoctorWriterInspection | null;
|
|
37
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DoctorOptions, DoctorWriterInspection } from "./doctor-types.js";
|
|
2
|
+
import { type Diagnostic, ExitCode } from "./result.js";
|
|
3
|
+
import type { RegistrySelection } from "./selection.js";
|
|
4
|
+
export declare function inspectDoctorWriters(options: DoctorOptions, registries: readonly RegistrySelection[], scopes: readonly {
|
|
5
|
+
readonly scope: string;
|
|
6
|
+
readonly root: string;
|
|
7
|
+
}[]): Promise<{
|
|
8
|
+
data: DoctorWriterInspection;
|
|
9
|
+
findings: Diagnostic[];
|
|
10
|
+
exits: ExitCode[];
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DoctorOptions, DoctorResult } from "./doctor-types.js";
|
|
2
|
+
import { type ResultEnvelope } from "./result.js";
|
|
3
|
+
/** Aggregate source and activation observations without locks, repair, or network access. */
|
|
4
|
+
export declare function doctor(options?: DoctorOptions): Promise<ResultEnvelope<DoctorResult>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Diagnostic, ExitCode } from "./result.js";
|
|
2
|
+
/** Expected configuration and invariant failures, shared by all core consumers. */
|
|
3
|
+
export declare class SkillexError extends Error {
|
|
4
|
+
readonly exit: ExitCode;
|
|
5
|
+
readonly findings: readonly Diagnostic[];
|
|
6
|
+
constructor(exit: ExitCode, findings: readonly Diagnostic[]);
|
|
7
|
+
}
|
|
8
|
+
export declare function fail(code: Diagnostic["code"], message: string, details?: Omit<Diagnostic, "code" | "severity" | "message">, exit?: ExitCode): never;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Diagnostic } from "./result.js";
|
|
2
|
+
export declare function inspectPath(path: string): Promise<import("fs").Stats | undefined>;
|
|
3
|
+
export declare function requireDirectory(path: string, missing: Diagnostic["code"]): Promise<string>;
|
|
4
|
+
/** Inspect real composition content without following its canonical skill links. */
|
|
5
|
+
export declare function assertReferenceOnly(root: string): Promise<void>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface LockOptions {
|
|
2
|
+
readonly home?: string;
|
|
3
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
4
|
+
readonly stateHome?: string;
|
|
5
|
+
readonly timeoutMs?: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Filesystem adaptation of Lamport's bakery algorithm (CACM, August 1974):
|
|
9
|
+
* https://lamport.azurewebsites.net/pubs/bakery.pdf
|
|
10
|
+
*
|
|
11
|
+
* A published unique claim without a ticket is choosing. Its immutable ticket is
|
|
12
|
+
* max(existing tickets)+1; contenders wait for choosing peers and smaller
|
|
13
|
+
* (ticket, claim-name) pairs. A later entrant sees the current ticket before
|
|
14
|
+
* choosing, so newly appearing participants cannot bypass a holder. Local atomic
|
|
15
|
+
* mkdir/link and coherent directory reads are required; this is not a network
|
|
16
|
+
* filesystem lease. Only a proven-dead local PID can erase a failed participant.
|
|
17
|
+
*/
|
|
18
|
+
export declare function withLock<T>(resource: string, action: () => Promise<T>, options?: LockOptions): Promise<T>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SkillsManifest } from "./selection.js";
|
|
2
|
+
export declare function isSkillName(value: unknown): value is string;
|
|
3
|
+
export declare function isVersionComponent(value: unknown): value is string;
|
|
4
|
+
/** Validate without coercion, input mutation, or discarding dormant selections. */
|
|
5
|
+
export declare function parseManifest(raw: unknown, path: string): SkillsManifest;
|
|
6
|
+
/** Read one required declaration. Callers must explicitly handle optional scope absence. */
|
|
7
|
+
export declare function readManifest(path: string): Promise<SkillsManifest>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SkillMetadata } from "./catalog-types.js";
|
|
2
|
+
export declare function parseSkillMetadata(content: string, path: string): Record<string, unknown>;
|
|
3
|
+
/** Parse already-decoded receipt bytes, including blobs read from a local Git tree. */
|
|
4
|
+
export declare function parseProvenanceMetadata(content: string, path: string): Record<string, unknown>;
|
|
5
|
+
/** Read skill-owned metadata without changing names, provenance fields, or source bytes. */
|
|
6
|
+
export declare function readSkillMetadata(skillPath: string): Promise<SkillMetadata>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type ReceiptOptions, type ReceiptSnapshot } from "./activation-state.js";
|
|
2
|
+
export interface MigrationIdentity {
|
|
3
|
+
readonly kind: "directory" | "link" | "file" | "other";
|
|
4
|
+
readonly dev: string;
|
|
5
|
+
readonly ino: string;
|
|
6
|
+
readonly mode: number;
|
|
7
|
+
readonly raw?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface MigrationNode {
|
|
10
|
+
readonly identity: MigrationIdentity;
|
|
11
|
+
readonly hash: string | null;
|
|
12
|
+
readonly children: Readonly<Record<string, MigrationNode>>;
|
|
13
|
+
}
|
|
14
|
+
export interface MigrationPending {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly item: string;
|
|
17
|
+
readonly path: string;
|
|
18
|
+
readonly stage: string;
|
|
19
|
+
readonly parked: string;
|
|
20
|
+
readonly previous?: MigrationNode;
|
|
21
|
+
readonly next: MigrationNode;
|
|
22
|
+
readonly claimRoot: boolean;
|
|
23
|
+
readonly claimNames: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
export interface MigrationActivationData {
|
|
26
|
+
readonly version: 1;
|
|
27
|
+
readonly root: string;
|
|
28
|
+
readonly verified: Readonly<Record<string, {
|
|
29
|
+
readonly path: string;
|
|
30
|
+
readonly digest: string;
|
|
31
|
+
}>>;
|
|
32
|
+
readonly pending?: MigrationPending;
|
|
33
|
+
}
|
|
34
|
+
export interface MigrationActivationState {
|
|
35
|
+
readonly snapshot: ReceiptSnapshot<MigrationActivationData>;
|
|
36
|
+
readonly data: MigrationActivationData;
|
|
37
|
+
}
|
|
38
|
+
export declare function migrationRefusal(path: string, message: string): never;
|
|
39
|
+
/** Inspect without following any child link; regular files are read through bounded no-follow descriptors. */
|
|
40
|
+
export declare function captureMigrationNode(path: string): Promise<MigrationNode | undefined>;
|
|
41
|
+
export declare function migrationDigest(node: MigrationNode): string;
|
|
42
|
+
export declare function assertMigrationNode(path: string, expected: MigrationNode): Promise<void>;
|
|
43
|
+
export declare function assertMigrationRemainder(path: string, expected: MigrationNode): Promise<MigrationNode | undefined>;
|
|
44
|
+
export declare function removeMigrationNode(path: string, expected: MigrationNode): Promise<void>;
|
|
45
|
+
export declare function readMigrationActivationState(base: string, root: string, aliases: readonly string[], profile: boolean, options: ReceiptOptions): Promise<MigrationActivationState>;
|
|
46
|
+
export declare function writeMigrationActivationState(previous: MigrationActivationState, data: MigrationActivationData): Promise<MigrationActivationState>;
|
|
47
|
+
/** Strict bounded UTF-8 JSON input with stable regular-file evidence. */
|
|
48
|
+
export declare function readLegacyJson(path: string): Promise<{
|
|
49
|
+
raw: unknown;
|
|
50
|
+
node: MigrationNode;
|
|
51
|
+
} | undefined>;
|
|
52
|
+
export declare function migrationAbsolute(value: string, home: string, cwd: string): string;
|