@monoes/monomindcli 2.15.7 → 2.16.0
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/.claude/helpers/build-skill-registry.cjs +23 -2
- package/.claude/helpers/handlers/route-handler.cjs +89 -3
- package/.claude/helpers/handlers/session-restore-handler.cjs +1 -1
- package/.claude/helpers/jev-picker.cjs +499 -0
- package/.claude/helpers/redact-secrets.cjs +69 -0
- package/.claude/skills/mastermind-agent-select/SKILL.md +28 -0
- package/dist/src/catalog/blueprints.d.ts +39 -0
- package/dist/src/catalog/blueprints.d.ts.map +1 -0
- package/dist/src/catalog/blueprints.js +78 -0
- package/dist/src/catalog/blueprints.js.map +1 -0
- package/dist/src/catalog/digest.d.ts +16 -0
- package/dist/src/catalog/digest.d.ts.map +1 -0
- package/dist/src/catalog/digest.js +62 -0
- package/dist/src/catalog/digest.js.map +1 -0
- package/dist/src/catalog/frontmatter.d.ts +23 -0
- package/dist/src/catalog/frontmatter.d.ts.map +1 -0
- package/dist/src/catalog/frontmatter.js +80 -0
- package/dist/src/catalog/frontmatter.js.map +1 -0
- package/dist/src/catalog/lifecycle.d.ts +31 -0
- package/dist/src/catalog/lifecycle.d.ts.map +1 -0
- package/dist/src/catalog/lifecycle.js +78 -0
- package/dist/src/catalog/lifecycle.js.map +1 -0
- package/dist/src/catalog/projection.d.ts +57 -0
- package/dist/src/catalog/projection.d.ts.map +1 -0
- package/dist/src/catalog/projection.js +272 -0
- package/dist/src/catalog/projection.js.map +1 -0
- package/dist/src/catalog/scan.d.ts +37 -0
- package/dist/src/catalog/scan.d.ts.map +1 -0
- package/dist/src/catalog/scan.js +214 -0
- package/dist/src/catalog/scan.js.map +1 -0
- package/dist/src/catalog/snapshot.d.ts +62 -0
- package/dist/src/catalog/snapshot.d.ts.map +1 -0
- package/dist/src/catalog/snapshot.js +183 -0
- package/dist/src/catalog/snapshot.js.map +1 -0
- package/dist/src/catalog/stage.d.ts +26 -0
- package/dist/src/catalog/stage.d.ts.map +1 -0
- package/dist/src/catalog/stage.js +316 -0
- package/dist/src/catalog/stage.js.map +1 -0
- package/dist/src/catalog/state.d.ts +23 -0
- package/dist/src/catalog/state.d.ts.map +1 -0
- package/dist/src/catalog/state.js +102 -0
- package/dist/src/catalog/state.js.map +1 -0
- package/dist/src/catalog/types.d.ts +289 -0
- package/dist/src/catalog/types.d.ts.map +1 -0
- package/dist/src/catalog/types.js +118 -0
- package/dist/src/catalog/types.js.map +1 -0
- package/dist/src/commands/catalog.d.ts +14 -0
- package/dist/src/commands/catalog.d.ts.map +1 -0
- package/dist/src/commands/catalog.js +392 -0
- package/dist/src/commands/catalog.js.map +1 -0
- package/dist/src/commands/doctor-catalog-checks.d.ts +3 -0
- package/dist/src/commands/doctor-catalog-checks.d.ts.map +1 -0
- package/dist/src/commands/doctor-catalog-checks.js +69 -0
- package/dist/src/commands/doctor-catalog-checks.js.map +1 -0
- package/dist/src/commands/doctor-decision-checks.d.ts +10 -0
- package/dist/src/commands/doctor-decision-checks.d.ts.map +1 -0
- package/dist/src/commands/doctor-decision-checks.js +82 -0
- package/dist/src/commands/doctor-decision-checks.js.map +1 -0
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +9 -1
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/index.d.ts +2 -2
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +4 -1
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/org-observe.d.ts.map +1 -1
- package/dist/src/commands/org-observe.js +7 -1
- package/dist/src/commands/org-observe.js.map +1 -1
- package/dist/src/commands/org-skills.d.ts.map +1 -1
- package/dist/src/commands/org-skills.js +14 -4
- package/dist/src/commands/org-skills.js.map +1 -1
- package/dist/src/commands/org.d.ts.map +1 -1
- package/dist/src/commands/org.js +8 -1
- package/dist/src/commands/org.js.map +1 -1
- package/dist/src/commands/pick.d.ts +4 -0
- package/dist/src/commands/pick.d.ts.map +1 -0
- package/dist/src/commands/pick.js +77 -0
- package/dist/src/commands/pick.js.map +1 -0
- package/dist/src/commands/route.js +1 -1
- package/dist/src/commands/route.js.map +1 -1
- package/dist/src/decision/catalogs.d.ts +20 -0
- package/dist/src/decision/catalogs.d.ts.map +1 -0
- package/dist/src/decision/catalogs.js +64 -0
- package/dist/src/decision/catalogs.js.map +1 -0
- package/dist/src/decision/jev.d.ts +85 -0
- package/dist/src/decision/jev.d.ts.map +1 -0
- package/dist/src/decision/jev.js +72 -0
- package/dist/src/decision/jev.js.map +1 -0
- package/dist/src/decision/picks.d.ts +50 -0
- package/dist/src/decision/picks.d.ts.map +1 -0
- package/dist/src/decision/picks.js +100 -0
- package/dist/src/decision/picks.js.map +1 -0
- package/dist/src/init/helpers-generator.d.ts.map +1 -1
- package/dist/src/init/helpers-generator.js +7 -0
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/orgrt/checkpoint-ops.d.ts.map +1 -1
- package/dist/src/orgrt/checkpoint-ops.js +6 -1
- package/dist/src/orgrt/checkpoint-ops.js.map +1 -1
- package/dist/src/orgrt/daemon.d.ts +14 -1
- package/dist/src/orgrt/daemon.d.ts.map +1 -1
- package/dist/src/orgrt/daemon.js +32 -3
- package/dist/src/orgrt/daemon.js.map +1 -1
- package/dist/src/orgrt/decisions.d.ts +7 -0
- package/dist/src/orgrt/decisions.d.ts.map +1 -1
- package/dist/src/orgrt/decisions.js +60 -14
- package/dist/src/orgrt/decisions.js.map +1 -1
- package/dist/src/orgrt/session.d.ts +6 -0
- package/dist/src/orgrt/session.d.ts.map +1 -1
- package/dist/src/orgrt/session.js +18 -1
- package/dist/src/orgrt/session.js.map +1 -1
- package/dist/src/orgrt/skill-library.d.ts +10 -1
- package/dist/src/orgrt/skill-library.d.ts.map +1 -1
- package/dist/src/orgrt/skill-library.js +53 -4
- package/dist/src/orgrt/skill-library.js.map +1 -1
- package/dist/src/orgrt/types.d.ts +2 -0
- package/dist/src/orgrt/types.d.ts.map +1 -1
- package/dist/src/orgrt/types.js +4 -0
- package/dist/src/orgrt/types.js.map +1 -1
- package/dist/src/platform-adapters/mutation.d.ts +34 -0
- package/dist/src/platform-adapters/mutation.d.ts.map +1 -0
- package/dist/src/platform-adapters/mutation.js +188 -0
- package/dist/src/platform-adapters/mutation.js.map +1 -0
- package/dist/src/platform-adapters/operations.d.ts +7 -1
- package/dist/src/platform-adapters/operations.d.ts.map +1 -1
- package/dist/src/platform-adapters/operations.js +18 -76
- package/dist/src/platform-adapters/operations.js.map +1 -1
- package/dist/src/routing/jev-step.d.ts +17 -0
- package/dist/src/routing/jev-step.d.ts.map +1 -0
- package/dist/src/routing/jev-step.js +27 -0
- package/dist/src/routing/jev-step.js.map +1 -0
- package/dist/src/routing/route-layer-factory.d.ts.map +1 -1
- package/dist/src/routing/route-layer-factory.js +16 -1
- package/dist/src/routing/route-layer-factory.js.map +1 -1
- package/dist/src/utils/redaction.d.ts.map +1 -1
- package/dist/src/utils/redaction.js +19 -4
- package/dist/src/utils/redaction.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type CatalogState, type CatalogStatus } from './types.js';
|
|
2
|
+
export declare class CatalogStateError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
export declare const statePath: (root: string) => string;
|
|
6
|
+
export declare const lockPath: (root: string) => string;
|
|
7
|
+
/** Lifecycle moves the catalog commands may make. Restaging changed content is `stage`'s own path. */
|
|
8
|
+
export declare const TRANSITIONS: Record<CatalogStatus, readonly CatalogStatus[]>;
|
|
9
|
+
export declare const HISTORY_CAP = 20;
|
|
10
|
+
/** The state on disk, or the empty state when absent. Never creates directories. */
|
|
11
|
+
export declare function loadCatalogState(root: string): CatalogState;
|
|
12
|
+
/** load → fn → validate → atomic write, under the catalog lock. A throw writes nothing. */
|
|
13
|
+
export declare function mutateCatalogState(root: string, fn: (state: CatalogState) => CatalogState): CatalogState;
|
|
14
|
+
export interface TransitionContext {
|
|
15
|
+
actor: string;
|
|
16
|
+
/** ISO timestamp recorded in history. */
|
|
17
|
+
now: string;
|
|
18
|
+
reason?: string;
|
|
19
|
+
root: string;
|
|
20
|
+
}
|
|
21
|
+
/** One lifecycle move, enforced against `TRANSITIONS`. Returns a new state. */
|
|
22
|
+
export declare function transition(state: CatalogState, id: string, to: CatalogStatus, ctx: TransitionContext): CatalogState;
|
|
23
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/catalog/state.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAEpB,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,eAAO,MAAM,SAAS,SAAU,MAAM,KAAG,MAA8C,CAAC;AACxF,eAAO,MAAM,QAAQ,SAAU,MAAM,KAAG,MAA0D,CAAC;AAEnG,sGAAsG;AACtG,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,aAAa,EAAE,SAAS,aAAa,EAAE,CAOvE,CAAC;AAEF,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B,oFAAoF;AACpF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAa3D;AAED,2FAA2F;AAC3F,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,YAAY,GACxC,YAAY,CAmBd;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,+EAA+E;AAC/E,wBAAgB,UAAU,CACxB,KAAK,EAAE,YAAY,EACnB,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,aAAa,EACjB,GAAG,EAAE,iBAAiB,GACrB,YAAY,CA4Bd"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catalog lifecycle state: `.monomind/catalog/state.json`.
|
|
3
|
+
*
|
|
4
|
+
* Reading never creates anything; every write goes through
|
|
5
|
+
* `mutateCatalogState`, which holds `.monomind/locks/catalog.lock` (exclusive
|
|
6
|
+
* create, fails safe on a stale lock) and validates the whole state before an
|
|
7
|
+
* atomic write. `transition` is pure: it returns a new state.
|
|
8
|
+
*/
|
|
9
|
+
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, unlinkSync } from 'node:fs';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
import { writeJsonFileAtomic } from '../utils/json-file.js';
|
|
12
|
+
import { catalogDir, verifyEntry } from './digest.js';
|
|
13
|
+
import { CATALOG_SCHEMA_VERSION, CatalogStateSchema, } from './types.js';
|
|
14
|
+
export class CatalogStateError extends Error {
|
|
15
|
+
constructor(message) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = 'CatalogStateError';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export const statePath = (root) => join(catalogDir(root), 'state.json');
|
|
21
|
+
export const lockPath = (root) => join(root, '.monomind', 'locks', 'catalog.lock');
|
|
22
|
+
/** Lifecycle moves the catalog commands may make. Restaging changed content is `stage`'s own path. */
|
|
23
|
+
export const TRANSITIONS = {
|
|
24
|
+
staged: ['approved', 'quarantined', 'revoked'],
|
|
25
|
+
quarantined: ['staged', 'revoked'],
|
|
26
|
+
approved: ['active', 'disabled', 'revoked'],
|
|
27
|
+
active: ['disabled', 'quarantined', 'revoked'],
|
|
28
|
+
disabled: ['active', 'quarantined', 'revoked'],
|
|
29
|
+
revoked: [],
|
|
30
|
+
};
|
|
31
|
+
export const HISTORY_CAP = 20;
|
|
32
|
+
/** The state on disk, or the empty state when absent. Never creates directories. */
|
|
33
|
+
export function loadCatalogState(root) {
|
|
34
|
+
const file = statePath(root);
|
|
35
|
+
if (!existsSync(file))
|
|
36
|
+
return { schemaVersion: CATALOG_SCHEMA_VERSION, entries: [] };
|
|
37
|
+
let raw;
|
|
38
|
+
try {
|
|
39
|
+
raw = JSON.parse(readFileSync(file, 'utf8'));
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
throw new CatalogStateError(`catalog state is not valid JSON: ${e.message}`);
|
|
43
|
+
}
|
|
44
|
+
const parsed = CatalogStateSchema.safeParse(raw);
|
|
45
|
+
if (!parsed.success)
|
|
46
|
+
throw new CatalogStateError(`catalog state is invalid: ${parsed.error.message}`);
|
|
47
|
+
return parsed.data;
|
|
48
|
+
}
|
|
49
|
+
/** load → fn → validate → atomic write, under the catalog lock. A throw writes nothing. */
|
|
50
|
+
export function mutateCatalogState(root, fn) {
|
|
51
|
+
const lock = lockPath(root);
|
|
52
|
+
mkdirSync(join(root, '.monomind', 'locks'), { recursive: true });
|
|
53
|
+
let fd;
|
|
54
|
+
try {
|
|
55
|
+
fd = openSync(lock, 'wx');
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
if (e.code === 'EEXIST')
|
|
59
|
+
throw new CatalogStateError(`catalog is locked by another command: ${lock}`);
|
|
60
|
+
throw e;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
closeSync(fd);
|
|
64
|
+
const next = CatalogStateSchema.parse(fn(loadCatalogState(root)));
|
|
65
|
+
writeJsonFileAtomic(statePath(root), next);
|
|
66
|
+
return next;
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
unlinkSync(lock);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** One lifecycle move, enforced against `TRANSITIONS`. Returns a new state. */
|
|
73
|
+
export function transition(state, id, to, ctx) {
|
|
74
|
+
const current = state.entries.find((e) => e.id === id);
|
|
75
|
+
if (!current)
|
|
76
|
+
throw new CatalogStateError(`no catalog entry ${id}`);
|
|
77
|
+
const from = current.status;
|
|
78
|
+
const allowed = TRANSITIONS[from];
|
|
79
|
+
if (!allowed.includes(to))
|
|
80
|
+
throw new CatalogStateError(`${id} is ${from}; cannot move to ${to} (allowed: ${allowed.join(', ') || 'none'})`);
|
|
81
|
+
const isRelease = from === 'quarantined' && to === 'staged';
|
|
82
|
+
if ((to === 'quarantined' || to === 'revoked' || isRelease) && !ctx.reason?.trim())
|
|
83
|
+
throw new CatalogStateError(`${from} → ${to} needs a reason`);
|
|
84
|
+
if (to === 'active') {
|
|
85
|
+
const check = verifyEntry(ctx.root, current);
|
|
86
|
+
if (!check.ok)
|
|
87
|
+
throw new CatalogStateError(`cannot activate ${id}: ${check.reason}`);
|
|
88
|
+
}
|
|
89
|
+
const history = [
|
|
90
|
+
...current.history,
|
|
91
|
+
{ from, to, actor: ctx.actor, at: ctx.now, ...(ctx.reason ? { reason: ctx.reason } : {}) },
|
|
92
|
+
].slice(-HISTORY_CAP);
|
|
93
|
+
const inspection = isRelease
|
|
94
|
+
? {
|
|
95
|
+
...current.inspection,
|
|
96
|
+
override: { actor: ctx.actor, reason: ctx.reason, at: ctx.now },
|
|
97
|
+
}
|
|
98
|
+
: current.inspection;
|
|
99
|
+
const next = { ...current, status: to, inspection, history, updatedAt: ctx.now };
|
|
100
|
+
return { ...state, entries: state.entries.map((e) => (e.id === id ? next : e)) };
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/catalog/state.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,E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BAAmB,EAAE,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACvF,CAAC;IACD,MAAM,OAAO,GAAG;QACd,GAAG,OAAO,CAAC,OAAO;QAClB,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;KAC3F,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC;IACtB,MAAM,UAAU,GAAG,SAAS;QAC1B,CAAC,CAAC;YACE,GAAG,OAAO,CAAC,UAAU;YACrB,QAAQ,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAgB,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE;SAC1E;QACH,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IACvB,MAAM,IAAI,GAAG,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;IACjF,OAAO,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const CATALOG_SCHEMA_VERSION: 1;
|
|
3
|
+
/** Same shape as skill-library's SKILL_NAME_RE, so a catalog skill is a valid library name. */
|
|
4
|
+
export declare const CATALOG_NAME_RE: RegExp;
|
|
5
|
+
export declare const CatalogKindSchema: z.ZodEnum<{
|
|
6
|
+
archetype: "archetype";
|
|
7
|
+
blueprint: "blueprint";
|
|
8
|
+
skill: "skill";
|
|
9
|
+
}>;
|
|
10
|
+
export declare const CatalogIdSchema: z.ZodString;
|
|
11
|
+
export declare const CatalogStatusSchema: z.ZodEnum<{
|
|
12
|
+
active: "active";
|
|
13
|
+
approved: "approved";
|
|
14
|
+
disabled: "disabled";
|
|
15
|
+
quarantined: "quarantined";
|
|
16
|
+
revoked: "revoked";
|
|
17
|
+
staged: "staged";
|
|
18
|
+
}>;
|
|
19
|
+
export declare const CatalogTargetSchema: z.ZodEnum<{
|
|
20
|
+
jev: "jev";
|
|
21
|
+
org: "org";
|
|
22
|
+
"platform:agents": "platform:agents";
|
|
23
|
+
"platform:claude": "platform:claude";
|
|
24
|
+
}>;
|
|
25
|
+
/** MCP tools a catalog skill may be granted: graph READS only. Excluded on purpose:
|
|
26
|
+
* monograph_suggest (its health-aware mode triggers a background rebuild) and
|
|
27
|
+
* monodesign_detect (reads any path `resolve(cwd, target)` reaches, no containment). */
|
|
28
|
+
export declare const CATALOG_GRANTABLE_TOOLS: readonly ['monograph_query', 'monograph_context', 'monograph_impact', 'monograph_neighbors'];
|
|
29
|
+
export declare const CatalogSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
30
|
+
kind: z.ZodLiteral<"git">;
|
|
31
|
+
url: z.ZodString;
|
|
32
|
+
commit: z.ZodString;
|
|
33
|
+
path: z.ZodString;
|
|
34
|
+
license: z.ZodEnum<{
|
|
35
|
+
"Apache-2.0": "Apache-2.0";
|
|
36
|
+
MIT: "MIT";
|
|
37
|
+
}>;
|
|
38
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
39
|
+
kind: z.ZodLiteral<"local">;
|
|
40
|
+
path: z.ZodString;
|
|
41
|
+
commit: z.ZodOptional<z.ZodString>;
|
|
42
|
+
path_in_source: z.ZodString;
|
|
43
|
+
license: z.ZodEnum<{
|
|
44
|
+
"Apache-2.0": "Apache-2.0";
|
|
45
|
+
MIT: "MIT";
|
|
46
|
+
}>;
|
|
47
|
+
}, z.core.$strict>], "kind">;
|
|
48
|
+
export declare const InspectionSchema: z.ZodObject<{
|
|
49
|
+
verdict: z.ZodEnum<{
|
|
50
|
+
clean: "clean";
|
|
51
|
+
quarantine: "quarantine";
|
|
52
|
+
}>;
|
|
53
|
+
accepted: z.ZodArray<z.ZodString>;
|
|
54
|
+
rejected: z.ZodArray<z.ZodObject<{
|
|
55
|
+
path: z.ZodString;
|
|
56
|
+
reason: z.ZodString;
|
|
57
|
+
}, z.core.$strict>>;
|
|
58
|
+
requestedTools: z.ZodArray<z.ZodString>;
|
|
59
|
+
scanner: z.ZodObject<{
|
|
60
|
+
ok: z.ZodBoolean;
|
|
61
|
+
blocked: z.ZodBoolean;
|
|
62
|
+
summary: z.ZodString;
|
|
63
|
+
}, z.core.$strict>;
|
|
64
|
+
at: z.ZodString;
|
|
65
|
+
override: z.ZodOptional<z.ZodObject<{
|
|
66
|
+
actor: z.ZodString;
|
|
67
|
+
reason: z.ZodString;
|
|
68
|
+
at: z.ZodString;
|
|
69
|
+
}, z.core.$strict>>;
|
|
70
|
+
}, z.core.$strict>;
|
|
71
|
+
export declare const HistorySchema: z.ZodObject<{
|
|
72
|
+
from: z.ZodNullable<z.ZodEnum<{
|
|
73
|
+
active: "active";
|
|
74
|
+
approved: "approved";
|
|
75
|
+
disabled: "disabled";
|
|
76
|
+
quarantined: "quarantined";
|
|
77
|
+
revoked: "revoked";
|
|
78
|
+
staged: "staged";
|
|
79
|
+
}>>;
|
|
80
|
+
to: z.ZodEnum<{
|
|
81
|
+
active: "active";
|
|
82
|
+
approved: "approved";
|
|
83
|
+
disabled: "disabled";
|
|
84
|
+
quarantined: "quarantined";
|
|
85
|
+
revoked: "revoked";
|
|
86
|
+
staged: "staged";
|
|
87
|
+
}>;
|
|
88
|
+
actor: z.ZodString;
|
|
89
|
+
at: z.ZodString;
|
|
90
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, z.core.$strict>;
|
|
92
|
+
export declare const CatalogEntrySchema: z.ZodObject<{
|
|
93
|
+
id: z.ZodString;
|
|
94
|
+
kind: z.ZodEnum<{
|
|
95
|
+
archetype: "archetype";
|
|
96
|
+
blueprint: "blueprint";
|
|
97
|
+
skill: "skill";
|
|
98
|
+
}>;
|
|
99
|
+
status: z.ZodEnum<{
|
|
100
|
+
active: "active";
|
|
101
|
+
approved: "approved";
|
|
102
|
+
disabled: "disabled";
|
|
103
|
+
quarantined: "quarantined";
|
|
104
|
+
revoked: "revoked";
|
|
105
|
+
staged: "staged";
|
|
106
|
+
}>;
|
|
107
|
+
sha256: z.ZodString;
|
|
108
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
109
|
+
kind: z.ZodLiteral<"git">;
|
|
110
|
+
url: z.ZodString;
|
|
111
|
+
commit: z.ZodString;
|
|
112
|
+
path: z.ZodString;
|
|
113
|
+
license: z.ZodEnum<{
|
|
114
|
+
"Apache-2.0": "Apache-2.0";
|
|
115
|
+
MIT: "MIT";
|
|
116
|
+
}>;
|
|
117
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
118
|
+
kind: z.ZodLiteral<"local">;
|
|
119
|
+
path: z.ZodString;
|
|
120
|
+
commit: z.ZodOptional<z.ZodString>;
|
|
121
|
+
path_in_source: z.ZodString;
|
|
122
|
+
license: z.ZodEnum<{
|
|
123
|
+
"Apache-2.0": "Apache-2.0";
|
|
124
|
+
MIT: "MIT";
|
|
125
|
+
}>;
|
|
126
|
+
}, z.core.$strict>], "kind">;
|
|
127
|
+
inspection: z.ZodObject<{
|
|
128
|
+
verdict: z.ZodEnum<{
|
|
129
|
+
clean: "clean";
|
|
130
|
+
quarantine: "quarantine";
|
|
131
|
+
}>;
|
|
132
|
+
accepted: z.ZodArray<z.ZodString>;
|
|
133
|
+
rejected: z.ZodArray<z.ZodObject<{
|
|
134
|
+
path: z.ZodString;
|
|
135
|
+
reason: z.ZodString;
|
|
136
|
+
}, z.core.$strict>>;
|
|
137
|
+
requestedTools: z.ZodArray<z.ZodString>;
|
|
138
|
+
scanner: z.ZodObject<{
|
|
139
|
+
ok: z.ZodBoolean;
|
|
140
|
+
blocked: z.ZodBoolean;
|
|
141
|
+
summary: z.ZodString;
|
|
142
|
+
}, z.core.$strict>;
|
|
143
|
+
at: z.ZodString;
|
|
144
|
+
override: z.ZodOptional<z.ZodObject<{
|
|
145
|
+
actor: z.ZodString;
|
|
146
|
+
reason: z.ZodString;
|
|
147
|
+
at: z.ZodString;
|
|
148
|
+
}, z.core.$strict>>;
|
|
149
|
+
}, z.core.$strict>;
|
|
150
|
+
targets: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
151
|
+
jev: "jev";
|
|
152
|
+
org: "org";
|
|
153
|
+
"platform:agents": "platform:agents";
|
|
154
|
+
"platform:claude": "platform:claude";
|
|
155
|
+
}>>>;
|
|
156
|
+
grantedTools: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
157
|
+
monograph_context: "monograph_context";
|
|
158
|
+
monograph_impact: "monograph_impact";
|
|
159
|
+
monograph_neighbors: "monograph_neighbors";
|
|
160
|
+
monograph_query: "monograph_query";
|
|
161
|
+
}>>>;
|
|
162
|
+
replacesLegacy: z.ZodDefault<z.ZodBoolean>;
|
|
163
|
+
createdAt: z.ZodString;
|
|
164
|
+
updatedAt: z.ZodString;
|
|
165
|
+
history: z.ZodArray<z.ZodObject<{
|
|
166
|
+
from: z.ZodNullable<z.ZodEnum<{
|
|
167
|
+
active: "active";
|
|
168
|
+
approved: "approved";
|
|
169
|
+
disabled: "disabled";
|
|
170
|
+
quarantined: "quarantined";
|
|
171
|
+
revoked: "revoked";
|
|
172
|
+
staged: "staged";
|
|
173
|
+
}>>;
|
|
174
|
+
to: z.ZodEnum<{
|
|
175
|
+
active: "active";
|
|
176
|
+
approved: "approved";
|
|
177
|
+
disabled: "disabled";
|
|
178
|
+
quarantined: "quarantined";
|
|
179
|
+
revoked: "revoked";
|
|
180
|
+
staged: "staged";
|
|
181
|
+
}>;
|
|
182
|
+
actor: z.ZodString;
|
|
183
|
+
at: z.ZodString;
|
|
184
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
185
|
+
}, z.core.$strict>>;
|
|
186
|
+
}, z.core.$strict>;
|
|
187
|
+
export declare const CatalogStateSchema: z.ZodObject<{
|
|
188
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
189
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
190
|
+
id: z.ZodString;
|
|
191
|
+
kind: z.ZodEnum<{
|
|
192
|
+
archetype: "archetype";
|
|
193
|
+
blueprint: "blueprint";
|
|
194
|
+
skill: "skill";
|
|
195
|
+
}>;
|
|
196
|
+
status: z.ZodEnum<{
|
|
197
|
+
active: "active";
|
|
198
|
+
approved: "approved";
|
|
199
|
+
disabled: "disabled";
|
|
200
|
+
quarantined: "quarantined";
|
|
201
|
+
revoked: "revoked";
|
|
202
|
+
staged: "staged";
|
|
203
|
+
}>;
|
|
204
|
+
sha256: z.ZodString;
|
|
205
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
206
|
+
kind: z.ZodLiteral<"git">;
|
|
207
|
+
url: z.ZodString;
|
|
208
|
+
commit: z.ZodString;
|
|
209
|
+
path: z.ZodString;
|
|
210
|
+
license: z.ZodEnum<{
|
|
211
|
+
"Apache-2.0": "Apache-2.0";
|
|
212
|
+
MIT: "MIT";
|
|
213
|
+
}>;
|
|
214
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
215
|
+
kind: z.ZodLiteral<"local">;
|
|
216
|
+
path: z.ZodString;
|
|
217
|
+
commit: z.ZodOptional<z.ZodString>;
|
|
218
|
+
path_in_source: z.ZodString;
|
|
219
|
+
license: z.ZodEnum<{
|
|
220
|
+
"Apache-2.0": "Apache-2.0";
|
|
221
|
+
MIT: "MIT";
|
|
222
|
+
}>;
|
|
223
|
+
}, z.core.$strict>], "kind">;
|
|
224
|
+
inspection: z.ZodObject<{
|
|
225
|
+
verdict: z.ZodEnum<{
|
|
226
|
+
clean: "clean";
|
|
227
|
+
quarantine: "quarantine";
|
|
228
|
+
}>;
|
|
229
|
+
accepted: z.ZodArray<z.ZodString>;
|
|
230
|
+
rejected: z.ZodArray<z.ZodObject<{
|
|
231
|
+
path: z.ZodString;
|
|
232
|
+
reason: z.ZodString;
|
|
233
|
+
}, z.core.$strict>>;
|
|
234
|
+
requestedTools: z.ZodArray<z.ZodString>;
|
|
235
|
+
scanner: z.ZodObject<{
|
|
236
|
+
ok: z.ZodBoolean;
|
|
237
|
+
blocked: z.ZodBoolean;
|
|
238
|
+
summary: z.ZodString;
|
|
239
|
+
}, z.core.$strict>;
|
|
240
|
+
at: z.ZodString;
|
|
241
|
+
override: z.ZodOptional<z.ZodObject<{
|
|
242
|
+
actor: z.ZodString;
|
|
243
|
+
reason: z.ZodString;
|
|
244
|
+
at: z.ZodString;
|
|
245
|
+
}, z.core.$strict>>;
|
|
246
|
+
}, z.core.$strict>;
|
|
247
|
+
targets: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
248
|
+
jev: "jev";
|
|
249
|
+
org: "org";
|
|
250
|
+
"platform:agents": "platform:agents";
|
|
251
|
+
"platform:claude": "platform:claude";
|
|
252
|
+
}>>>;
|
|
253
|
+
grantedTools: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
254
|
+
monograph_context: "monograph_context";
|
|
255
|
+
monograph_impact: "monograph_impact";
|
|
256
|
+
monograph_neighbors: "monograph_neighbors";
|
|
257
|
+
monograph_query: "monograph_query";
|
|
258
|
+
}>>>;
|
|
259
|
+
replacesLegacy: z.ZodDefault<z.ZodBoolean>;
|
|
260
|
+
createdAt: z.ZodString;
|
|
261
|
+
updatedAt: z.ZodString;
|
|
262
|
+
history: z.ZodArray<z.ZodObject<{
|
|
263
|
+
from: z.ZodNullable<z.ZodEnum<{
|
|
264
|
+
active: "active";
|
|
265
|
+
approved: "approved";
|
|
266
|
+
disabled: "disabled";
|
|
267
|
+
quarantined: "quarantined";
|
|
268
|
+
revoked: "revoked";
|
|
269
|
+
staged: "staged";
|
|
270
|
+
}>>;
|
|
271
|
+
to: z.ZodEnum<{
|
|
272
|
+
active: "active";
|
|
273
|
+
approved: "approved";
|
|
274
|
+
disabled: "disabled";
|
|
275
|
+
quarantined: "quarantined";
|
|
276
|
+
revoked: "revoked";
|
|
277
|
+
staged: "staged";
|
|
278
|
+
}>;
|
|
279
|
+
actor: z.ZodString;
|
|
280
|
+
at: z.ZodString;
|
|
281
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
282
|
+
}, z.core.$strict>>;
|
|
283
|
+
}, z.core.$strict>>;
|
|
284
|
+
}, z.core.$strict>;
|
|
285
|
+
export type CatalogEntry = z.infer<typeof CatalogEntrySchema>;
|
|
286
|
+
export type CatalogState = z.infer<typeof CatalogStateSchema>;
|
|
287
|
+
export type CatalogStatus = z.infer<typeof CatalogStatusSchema>;
|
|
288
|
+
export type CatalogTarget = z.infer<typeof CatalogTargetSchema>;
|
|
289
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/catalog/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB,EAAG,CAAU,CAAC;AACjD,+FAA+F;AAC/F,eAAO,MAAM,eAAe,QAA8B,CAAC;AAC3D,eAAO,MAAM,iBAAiB;;;;EAA8C,CAAC;AAC7E,eAAO,MAAM,eAAe,aAEqC,CAAC;AAClE,eAAO,MAAM,mBAAmB;;;;;;;EAO9B,CAAC;AACH,eAAO,MAAM,mBAAmB;;;;;EAA+D,CAAC;AAChG;;yFAEyF;AACzF,eAAO,MAAM,uBAAuB,YAClC,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,CACb,CAAC;AAKX,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;4BAuB9B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;kBAgBlB,CAAC;AAEZ,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;kBAQf,CAAC;AAEZ,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA2B3B,CAAC;AAEL,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAS3B,CAAC;AAEL,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const CATALOG_SCHEMA_VERSION = 1;
|
|
3
|
+
/** Same shape as skill-library's SKILL_NAME_RE, so a catalog skill is a valid library name. */
|
|
4
|
+
export const CATALOG_NAME_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
5
|
+
export const CatalogKindSchema = z.enum(['skill', 'archetype', 'blueprint']);
|
|
6
|
+
export const CatalogIdSchema = z
|
|
7
|
+
.string()
|
|
8
|
+
.regex(/^(skill|archetype|blueprint):[a-z0-9][a-z0-9-]{0,63}$/);
|
|
9
|
+
export const CatalogStatusSchema = z.enum([
|
|
10
|
+
'staged',
|
|
11
|
+
'quarantined',
|
|
12
|
+
'approved',
|
|
13
|
+
'active',
|
|
14
|
+
'disabled',
|
|
15
|
+
'revoked',
|
|
16
|
+
]);
|
|
17
|
+
export const CatalogTargetSchema = z.enum(['org', 'jev', 'platform:claude', 'platform:agents']);
|
|
18
|
+
/** MCP tools a catalog skill may be granted: graph READS only. Excluded on purpose:
|
|
19
|
+
* monograph_suggest (its health-aware mode triggers a background rebuild) and
|
|
20
|
+
* monodesign_detect (reads any path `resolve(cwd, target)` reaches, no containment). */
|
|
21
|
+
export const CATALOG_GRANTABLE_TOOLS = [
|
|
22
|
+
'monograph_query',
|
|
23
|
+
'monograph_context',
|
|
24
|
+
'monograph_impact',
|
|
25
|
+
'monograph_neighbors',
|
|
26
|
+
];
|
|
27
|
+
const Sha256 = z.string().regex(/^[0-9a-f]{64}$/);
|
|
28
|
+
const Iso = z.string().datetime();
|
|
29
|
+
export const CatalogSourceSchema = z.discriminatedUnion('kind', [
|
|
30
|
+
z
|
|
31
|
+
.object({
|
|
32
|
+
kind: z.literal('git'),
|
|
33
|
+
// No userinfo on https: a `user:token@` URL would persist the credential.
|
|
34
|
+
url: z.string().regex(/^(?:https:\/\/[^\s/@]+(?:\/\S*)?|git@[\w.-]+:[^\s]+)$/),
|
|
35
|
+
commit: z.string().regex(/^[0-9a-f]{40}$/),
|
|
36
|
+
path: z.string(),
|
|
37
|
+
license: z.enum(['MIT', 'Apache-2.0']),
|
|
38
|
+
})
|
|
39
|
+
.strict(),
|
|
40
|
+
z
|
|
41
|
+
.object({
|
|
42
|
+
kind: z.literal('local'),
|
|
43
|
+
path: z.string().startsWith('/'),
|
|
44
|
+
commit: z
|
|
45
|
+
.string()
|
|
46
|
+
.regex(/^[0-9a-f]{40}$/)
|
|
47
|
+
.optional(),
|
|
48
|
+
path_in_source: z.string(),
|
|
49
|
+
license: z.enum(['MIT', 'Apache-2.0']),
|
|
50
|
+
})
|
|
51
|
+
.strict(),
|
|
52
|
+
]);
|
|
53
|
+
export const InspectionSchema = z
|
|
54
|
+
.object({
|
|
55
|
+
verdict: z.enum(['clean', 'quarantine']),
|
|
56
|
+
accepted: z.array(z.string()),
|
|
57
|
+
rejected: z.array(z.object({ path: z.string(), reason: z.string() }).strict()),
|
|
58
|
+
requestedTools: z.array(z.string()),
|
|
59
|
+
scanner: z
|
|
60
|
+
.object({ ok: z.boolean(), blocked: z.boolean(), summary: z.string().max(500) })
|
|
61
|
+
.strict(),
|
|
62
|
+
at: Iso,
|
|
63
|
+
/** Set only by `release`: a human accepted THIS revision despite the verdict. Cleared on restage. */
|
|
64
|
+
override: z
|
|
65
|
+
.object({ actor: z.string().min(1).max(64), reason: z.string().min(1).max(500), at: Iso })
|
|
66
|
+
.strict()
|
|
67
|
+
.optional(),
|
|
68
|
+
})
|
|
69
|
+
.strict();
|
|
70
|
+
export const HistorySchema = z
|
|
71
|
+
.object({
|
|
72
|
+
from: CatalogStatusSchema.nullable(),
|
|
73
|
+
to: CatalogStatusSchema,
|
|
74
|
+
actor: z.string().min(1).max(64),
|
|
75
|
+
at: Iso,
|
|
76
|
+
reason: z.string().max(500).optional(),
|
|
77
|
+
})
|
|
78
|
+
.strict();
|
|
79
|
+
export const CatalogEntrySchema = z
|
|
80
|
+
.object({
|
|
81
|
+
id: CatalogIdSchema,
|
|
82
|
+
kind: CatalogKindSchema,
|
|
83
|
+
status: CatalogStatusSchema,
|
|
84
|
+
sha256: Sha256,
|
|
85
|
+
source: CatalogSourceSchema,
|
|
86
|
+
inspection: InspectionSchema,
|
|
87
|
+
targets: z.array(CatalogTargetSchema).default([]),
|
|
88
|
+
grantedTools: z.array(z.enum(CATALOG_GRANTABLE_TOOLS)).default([]),
|
|
89
|
+
replacesLegacy: z.boolean().default(false),
|
|
90
|
+
createdAt: Iso,
|
|
91
|
+
updatedAt: Iso,
|
|
92
|
+
history: z.array(HistorySchema).max(20),
|
|
93
|
+
})
|
|
94
|
+
.strict()
|
|
95
|
+
.superRefine((e, ctx) => {
|
|
96
|
+
if (e.id.split(':')[0] !== e.kind)
|
|
97
|
+
ctx.addIssue({ code: 'custom', message: 'id prefix must equal kind' });
|
|
98
|
+
if (new Set(e.targets).size !== e.targets.length)
|
|
99
|
+
ctx.addIssue({ code: 'custom', message: 'duplicate target' });
|
|
100
|
+
if (e.targets.includes('jev') && !e.targets.includes('org'))
|
|
101
|
+
ctx.addIssue({ code: 'custom', message: 'jev requires org' });
|
|
102
|
+
if ((e.status === 'approved' || e.status === 'active') && e.targets.length === 0)
|
|
103
|
+
ctx.addIssue({ code: 'custom', message: `${e.status} entry needs a target` });
|
|
104
|
+
if (e.kind !== 'skill' && e.grantedTools.length > 0)
|
|
105
|
+
ctx.addIssue({ code: 'custom', message: 'only skills take tool grants' });
|
|
106
|
+
});
|
|
107
|
+
export const CatalogStateSchema = z
|
|
108
|
+
.object({
|
|
109
|
+
schemaVersion: z.literal(CATALOG_SCHEMA_VERSION),
|
|
110
|
+
entries: z.array(CatalogEntrySchema),
|
|
111
|
+
})
|
|
112
|
+
.strict()
|
|
113
|
+
.superRefine((s, ctx) => {
|
|
114
|
+
const ids = s.entries.map((e) => e.id);
|
|
115
|
+
if (new Set(ids).size !== ids.length)
|
|
116
|
+
ctx.addIssue({ code: 'custom', message: 'duplicate id' });
|
|
117
|
+
});
|
|
118
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/catalog/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAU,CAAC;AACjD,+FAA+F;AAC/F,MAAM,CAAC,MAAM,eAAe,GAAG,2BAA2B,CAAC;AAC3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,C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a,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAChD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;CACrC,CAAC;KACD,MAAM,EAAE;KACR,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;IACtB,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACvC,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,MAAM;QAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;AAClG,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Command, CommandContext, CommandResult, ParsedFlags } from '../types.js';
|
|
2
|
+
export interface VerbContext {
|
|
3
|
+
root: string;
|
|
4
|
+
/** Positional arguments after the verb. */
|
|
5
|
+
rest: string[];
|
|
6
|
+
flags: ParsedFlags;
|
|
7
|
+
json: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function print(payload: Record<string, unknown>, success?: boolean): CommandResult;
|
|
10
|
+
/** The CLI prints `message` for a failed result, so nothing is printed here. */
|
|
11
|
+
export declare function fail(message: string): CommandResult;
|
|
12
|
+
export declare function catalogAction(ctx: CommandContext): Promise<CommandResult>;
|
|
13
|
+
export declare const catalogCommand: Command;
|
|
14
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/commands/catalog.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEvF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,WAAW,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;CACf;AAOD,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,UAAO,GAAG,aAAa,CAGrF;AAED,gFAAgF;AAChF,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAEnD;AA4TD,wBAAsB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAc/E;AAED,eAAO,MAAM,cAAc,EAAE,OAiE5B,CAAC"}
|