@design-intelligence/ghost 0.20.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/LICENSE +201 -0
- package/README.md +75 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +19 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +29 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/checks-command.d.ts +9 -0
- package/dist/commands/checks-command.d.ts.map +1 -0
- package/dist/commands/checks-command.js +45 -0
- package/dist/commands/checks-command.js.map +1 -0
- package/dist/commands/command-discovery.d.ts +57 -0
- package/dist/commands/command-discovery.d.ts.map +1 -0
- package/dist/commands/command-discovery.js +220 -0
- package/dist/commands/command-discovery.js.map +1 -0
- package/dist/commands/errors.d.ts +7 -0
- package/dist/commands/errors.d.ts.map +1 -0
- package/dist/commands/errors.js +19 -0
- package/dist/commands/errors.js.map +1 -0
- package/dist/commands/export-command.d.ts +3 -0
- package/dist/commands/export-command.d.ts.map +1 -0
- package/dist/commands/export-command.js +157 -0
- package/dist/commands/export-command.js.map +1 -0
- package/dist/commands/fingerprint-commands.d.ts +10 -0
- package/dist/commands/fingerprint-commands.d.ts.map +1 -0
- package/dist/commands/fingerprint-commands.js +74 -0
- package/dist/commands/fingerprint-commands.js.map +1 -0
- package/dist/commands/gather-command.d.ts +3 -0
- package/dist/commands/gather-command.d.ts.map +1 -0
- package/dist/commands/gather-command.js +152 -0
- package/dist/commands/gather-command.js.map +1 -0
- package/dist/commands/init-command.d.ts +3 -0
- package/dist/commands/init-command.d.ts.map +1 -0
- package/dist/commands/init-command.js +79 -0
- package/dist/commands/init-command.js.map +1 -0
- package/dist/commands/manifest-command.d.ts +9 -0
- package/dist/commands/manifest-command.d.ts.map +1 -0
- package/dist/commands/manifest-command.js +33 -0
- package/dist/commands/manifest-command.js.map +1 -0
- package/dist/commands/pull-command.d.ts +3 -0
- package/dist/commands/pull-command.d.ts.map +1 -0
- package/dist/commands/pull-command.js +224 -0
- package/dist/commands/pull-command.js.map +1 -0
- package/dist/commands/pulse-command.d.ts +3 -0
- package/dist/commands/pulse-command.d.ts.map +1 -0
- package/dist/commands/pulse-command.js +257 -0
- package/dist/commands/pulse-command.js.map +1 -0
- package/dist/commands/review-command.d.ts +3 -0
- package/dist/commands/review-command.d.ts.map +1 -0
- package/dist/commands/review-command.js +77 -0
- package/dist/commands/review-command.js.map +1 -0
- package/dist/commands/skill-command.d.ts +3 -0
- package/dist/commands/skill-command.d.ts.map +1 -0
- package/dist/commands/skill-command.js +96 -0
- package/dist/commands/skill-command.js.map +1 -0
- package/dist/fingerprint.d.ts +5 -0
- package/dist/fingerprint.d.ts.map +1 -0
- package/dist/fingerprint.js +3 -0
- package/dist/fingerprint.js.map +1 -0
- package/dist/ghost-core/catalog/assemble.d.ts +30 -0
- package/dist/ghost-core/catalog/assemble.d.ts.map +1 -0
- package/dist/ghost-core/catalog/assemble.js +38 -0
- package/dist/ghost-core/catalog/assemble.js.map +1 -0
- package/dist/ghost-core/catalog/closest.d.ts +16 -0
- package/dist/ghost-core/catalog/closest.d.ts.map +1 -0
- package/dist/ghost-core/catalog/closest.js +63 -0
- package/dist/ghost-core/catalog/closest.js.map +1 -0
- package/dist/ghost-core/catalog/index.d.ts +10 -0
- package/dist/ghost-core/catalog/index.d.ts.map +1 -0
- package/dist/ghost-core/catalog/index.js +9 -0
- package/dist/ghost-core/catalog/index.js.map +1 -0
- package/dist/ghost-core/catalog/menu.d.ts +36 -0
- package/dist/ghost-core/catalog/menu.d.ts.map +1 -0
- package/dist/ghost-core/catalog/menu.js +27 -0
- package/dist/ghost-core/catalog/menu.js.map +1 -0
- package/dist/ghost-core/catalog/types.d.ts +37 -0
- package/dist/ghost-core/catalog/types.d.ts.map +1 -0
- package/dist/ghost-core/catalog/types.js +2 -0
- package/dist/ghost-core/catalog/types.js.map +1 -0
- package/dist/ghost-core/check/index.d.ts +12 -0
- package/dist/ghost-core/check/index.d.ts.map +1 -0
- package/dist/ghost-core/check/index.js +12 -0
- package/dist/ghost-core/check/index.js.map +1 -0
- package/dist/ghost-core/check/lint.d.ts +9 -0
- package/dist/ghost-core/check/lint.d.ts.map +1 -0
- package/dist/ghost-core/check/lint.js +119 -0
- package/dist/ghost-core/check/lint.js.map +1 -0
- package/dist/ghost-core/check/load.d.ts +7 -0
- package/dist/ghost-core/check/load.d.ts.map +1 -0
- package/dist/ghost-core/check/load.js +44 -0
- package/dist/ghost-core/check/load.js.map +1 -0
- package/dist/ghost-core/check/parse.d.ts +12 -0
- package/dist/ghost-core/check/parse.d.ts.map +1 -0
- package/dist/ghost-core/check/parse.js +13 -0
- package/dist/ghost-core/check/parse.js.map +1 -0
- package/dist/ghost-core/check/source-ref.d.ts +27 -0
- package/dist/ghost-core/check/source-ref.d.ts.map +1 -0
- package/dist/ghost-core/check/source-ref.js +58 -0
- package/dist/ghost-core/check/source-ref.js.map +1 -0
- package/dist/ghost-core/check/types.d.ts +48 -0
- package/dist/ghost-core/check/types.d.ts.map +1 -0
- package/dist/ghost-core/check/types.js +4 -0
- package/dist/ghost-core/check/types.js.map +1 -0
- package/dist/ghost-core/errors.d.ts +30 -0
- package/dist/ghost-core/errors.d.ts.map +1 -0
- package/dist/ghost-core/errors.js +33 -0
- package/dist/ghost-core/errors.js.map +1 -0
- package/dist/ghost-core/glob.d.ts +5 -0
- package/dist/ghost-core/glob.d.ts.map +1 -0
- package/dist/ghost-core/glob.js +68 -0
- package/dist/ghost-core/glob.js.map +1 -0
- package/dist/ghost-core/glossary.d.ts +38 -0
- package/dist/ghost-core/glossary.d.ts.map +1 -0
- package/dist/ghost-core/glossary.js +76 -0
- package/dist/ghost-core/glossary.js.map +1 -0
- package/dist/ghost-core/index.d.ts +13 -0
- package/dist/ghost-core/index.d.ts.map +1 -0
- package/dist/ghost-core/index.js +19 -0
- package/dist/ghost-core/index.js.map +1 -0
- package/dist/ghost-core/markdown.d.ts +15 -0
- package/dist/ghost-core/markdown.d.ts.map +1 -0
- package/dist/ghost-core/markdown.js +30 -0
- package/dist/ghost-core/markdown.js.map +1 -0
- package/dist/ghost-core/material-transport.d.ts +43 -0
- package/dist/ghost-core/material-transport.d.ts.map +1 -0
- package/dist/ghost-core/material-transport.js +231 -0
- package/dist/ghost-core/material-transport.js.map +1 -0
- package/dist/ghost-core/materials.d.ts +14 -0
- package/dist/ghost-core/materials.d.ts.map +1 -0
- package/dist/ghost-core/materials.js +52 -0
- package/dist/ghost-core/materials.js.map +1 -0
- package/dist/ghost-core/node/index.d.ts +11 -0
- package/dist/ghost-core/node/index.d.ts.map +1 -0
- package/dist/ghost-core/node/index.js +11 -0
- package/dist/ghost-core/node/index.js.map +1 -0
- package/dist/ghost-core/node/parse.d.ts +16 -0
- package/dist/ghost-core/node/parse.d.ts.map +1 -0
- package/dist/ghost-core/node/parse.js +55 -0
- package/dist/ghost-core/node/parse.js.map +1 -0
- package/dist/ghost-core/node/schema.d.ts +17 -0
- package/dist/ghost-core/node/schema.d.ts.map +1 -0
- package/dist/ghost-core/node/schema.js +49 -0
- package/dist/ghost-core/node/schema.js.map +1 -0
- package/dist/ghost-core/node/serialize.d.ts +11 -0
- package/dist/ghost-core/node/serialize.d.ts.map +1 -0
- package/dist/ghost-core/node/serialize.js +21 -0
- package/dist/ghost-core/node/serialize.js.map +1 -0
- package/dist/ghost-core/node/steering.d.ts +18 -0
- package/dist/ghost-core/node/steering.d.ts.map +1 -0
- package/dist/ghost-core/node/steering.js +65 -0
- package/dist/ghost-core/node/steering.js.map +1 -0
- package/dist/ghost-core/node/types.d.ts +42 -0
- package/dist/ghost-core/node/types.d.ts.map +1 -0
- package/dist/ghost-core/node/types.js +2 -0
- package/dist/ghost-core/node/types.js.map +1 -0
- package/dist/ghost-core/package-manifest.d.ts +12 -0
- package/dist/ghost-core/package-manifest.d.ts.map +1 -0
- package/dist/ghost-core/package-manifest.js +14 -0
- package/dist/ghost-core/package-manifest.js.map +1 -0
- package/dist/ghost-core/skill-bundle-loader.d.ts +28 -0
- package/dist/ghost-core/skill-bundle-loader.d.ts.map +1 -0
- package/dist/ghost-core/skill-bundle-loader.js +51 -0
- package/dist/ghost-core/skill-bundle-loader.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/fs.d.ts +4 -0
- package/dist/internal/fs.d.ts.map +1 -0
- package/dist/internal/fs.js +24 -0
- package/dist/internal/fs.js.map +1 -0
- package/dist/observability-events.d.ts +27 -0
- package/dist/observability-events.d.ts.map +1 -0
- package/dist/observability-events.js +56 -0
- package/dist/observability-events.js.map +1 -0
- package/dist/package-version.d.ts +3 -0
- package/dist/package-version.d.ts.map +1 -0
- package/dist/package-version.js +10 -0
- package/dist/package-version.js.map +1 -0
- package/dist/review/baseline.d.ts +11 -0
- package/dist/review/baseline.d.ts.map +1 -0
- package/dist/review/baseline.js +35 -0
- package/dist/review/baseline.js.map +1 -0
- package/dist/review/diff.d.ts +7 -0
- package/dist/review/diff.d.ts.map +1 -0
- package/dist/review/diff.js +41 -0
- package/dist/review/diff.js.map +1 -0
- package/dist/review/glob.d.ts +2 -0
- package/dist/review/glob.d.ts.map +1 -0
- package/dist/review/glob.js +2 -0
- package/dist/review/glob.js.map +1 -0
- package/dist/review/probes.d.ts +13 -0
- package/dist/review/probes.d.ts.map +1 -0
- package/dist/review/probes.js +45 -0
- package/dist/review/probes.js.map +1 -0
- package/dist/review/resolve.d.ts +29 -0
- package/dist/review/resolve.d.ts.map +1 -0
- package/dist/review/resolve.js +87 -0
- package/dist/review/resolve.js.map +1 -0
- package/dist/review/review-packet.d.ts +40 -0
- package/dist/review/review-packet.d.ts.map +1 -0
- package/dist/review/review-packet.js +139 -0
- package/dist/review/review-packet.js.map +1 -0
- package/dist/scan/check-files.d.ts +23 -0
- package/dist/scan/check-files.d.ts.map +1 -0
- package/dist/scan/check-files.js +90 -0
- package/dist/scan/check-files.js.map +1 -0
- package/dist/scan/check-scaffold.d.ts +7 -0
- package/dist/scan/check-scaffold.d.ts.map +1 -0
- package/dist/scan/check-scaffold.js +37 -0
- package/dist/scan/check-scaffold.js.map +1 -0
- package/dist/scan/constants.d.ts +21 -0
- package/dist/scan/constants.d.ts.map +1 -0
- package/dist/scan/constants.js +21 -0
- package/dist/scan/constants.js.map +1 -0
- package/dist/scan/file-kind.d.ts +12 -0
- package/dist/scan/file-kind.d.ts.map +1 -0
- package/dist/scan/file-kind.js +114 -0
- package/dist/scan/file-kind.js.map +1 -0
- package/dist/scan/fingerprint-package-loader.d.ts +5 -0
- package/dist/scan/fingerprint-package-loader.d.ts.map +1 -0
- package/dist/scan/fingerprint-package-loader.js +105 -0
- package/dist/scan/fingerprint-package-loader.js.map +1 -0
- package/dist/scan/fingerprint-package.d.ts +58 -0
- package/dist/scan/fingerprint-package.d.ts.map +1 -0
- package/dist/scan/fingerprint-package.js +301 -0
- package/dist/scan/fingerprint-package.js.map +1 -0
- package/dist/scan/index.d.ts +3 -0
- package/dist/scan/index.d.ts.map +1 -0
- package/dist/scan/index.js +3 -0
- package/dist/scan/index.js.map +1 -0
- package/dist/scan/lint.d.ts +15 -0
- package/dist/scan/lint.d.ts.map +1 -0
- package/dist/scan/lint.js +2 -0
- package/dist/scan/lint.js.map +1 -0
- package/dist/scan/node-files.d.ts +25 -0
- package/dist/scan/node-files.d.ts.map +1 -0
- package/dist/scan/node-files.js +114 -0
- package/dist/scan/node-files.js.map +1 -0
- package/dist/scan/package-paths.d.ts +10 -0
- package/dist/scan/package-paths.d.ts.map +1 -0
- package/dist/scan/package-paths.js +49 -0
- package/dist/scan/package-paths.js.map +1 -0
- package/dist/scan/steering-template.d.ts +8 -0
- package/dist/scan/steering-template.d.ts.map +1 -0
- package/dist/scan/steering-template.js +266 -0
- package/dist/scan/steering-template.js.map +1 -0
- package/dist/scan/tarball.d.ts +23 -0
- package/dist/scan/tarball.d.ts.map +1 -0
- package/dist/scan/tarball.js +145 -0
- package/dist/scan/tarball.js.map +1 -0
- package/dist/scan/templates.d.ts +24 -0
- package/dist/scan/templates.d.ts.map +1 -0
- package/dist/scan/templates.js +295 -0
- package/dist/scan/templates.js.map +1 -0
- package/dist/skill-bundle/SKILL.md +140 -0
- package/dist/skill-bundle/references/authoring-scenarios.md +147 -0
- package/dist/skill-bundle/references/blocks.md +180 -0
- package/dist/skill-bundle/references/brief.md +49 -0
- package/dist/skill-bundle/references/capture.md +377 -0
- package/dist/skill-bundle/references/recall.md +38 -0
- package/dist/skill-bundle/references/schema.md +119 -0
- package/dist/skill-bundle/references/self-check.md +65 -0
- package/dist/skill-bundle/references/steering-audit.md +61 -0
- package/dist/skill-bundle/references/wild.md +30 -0
- package/package.json +79 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const GHOST_CHECK_SCHEMA: "ghost.check/v1";
|
|
2
|
+
/** Severity vocabulary, matching the established agent-check format. */
|
|
3
|
+
export declare const GHOST_CHECK_SEVERITIES: readonly ["high", "medium", "low"];
|
|
4
|
+
export type GhostCheckMarkdownSeverity = (typeof GHOST_CHECK_SEVERITIES)[number];
|
|
5
|
+
/**
|
|
6
|
+
* A Ghost check: markdown + frontmatter, evaluated by an agent — never run by
|
|
7
|
+
* Ghost. Shape-compatible with the established `.agents/checks` format, plus the
|
|
8
|
+
* Ghost addition `source:` (the fingerprint prose the check enforces). Every
|
|
9
|
+
* check is offered to the reviewer; the agent judges relevance.
|
|
10
|
+
*/
|
|
11
|
+
export interface GhostCheckFrontmatter {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
severity: GhostCheckMarkdownSeverity;
|
|
15
|
+
/** Tools the check is allowed to use (passthrough for the review pipeline). */
|
|
16
|
+
tools?: string[];
|
|
17
|
+
/** Max tool-use turns the check should spend (passthrough). */
|
|
18
|
+
turn_limit?: number;
|
|
19
|
+
/**
|
|
20
|
+
* The fingerprint prose this check enforces, as node path ids with optional
|
|
21
|
+
* `> Heading` anchors (`checkout/payment > Confirmation`). Unresolved refs are
|
|
22
|
+
* tolerated by validation as warnings: they may name not-yet-written prose.
|
|
23
|
+
*/
|
|
24
|
+
references?: string[];
|
|
25
|
+
/** Deprecated single-reference alias retained for artifact-level linting. */
|
|
26
|
+
source?: string;
|
|
27
|
+
/** Optional repo-owned shell probe run by `ghost review` as evidence only. */
|
|
28
|
+
probe?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface GhostCheckDocument {
|
|
31
|
+
frontmatter: GhostCheckFrontmatter;
|
|
32
|
+
/** The markdown body: prose instructions for the evaluating agent. */
|
|
33
|
+
body: string;
|
|
34
|
+
}
|
|
35
|
+
export type GhostCheckLintSeverity = "error" | "warning" | "info";
|
|
36
|
+
export interface GhostCheckLintIssue {
|
|
37
|
+
severity: GhostCheckLintSeverity;
|
|
38
|
+
rule: string;
|
|
39
|
+
message: string;
|
|
40
|
+
path: string;
|
|
41
|
+
}
|
|
42
|
+
export interface GhostCheckLintReport {
|
|
43
|
+
issues: GhostCheckLintIssue[];
|
|
44
|
+
errors: number;
|
|
45
|
+
warnings: number;
|
|
46
|
+
info: number;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ghost-core/check/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,EAAG,gBAAyB,CAAC;AAE5D,wEAAwE;AACxE,eAAO,MAAM,sBAAsB,oCAAqC,CAAC;AACzE,MAAM,MAAM,0BAA0B,GACpC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,0BAA0B,CAAC;IACrC,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,qBAAqB,CAAC;IACnC,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAElE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ghost-core/check/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAyB,CAAC;AAE5D,wEAAwE;AACxE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI exit-code contract, in one place so every command agrees and an agent
|
|
3
|
+
* can branch on the code:
|
|
4
|
+
*
|
|
5
|
+
* - `0` success
|
|
6
|
+
* - `1` ran, but unhappy: a lint/validate finding, or an unexpected error
|
|
7
|
+
* - `2` called wrong: a bad flag or argument, a missing package, an unknown
|
|
8
|
+
* node or surface
|
|
9
|
+
* - `3` a command-specific refusal (e.g. `skill install` without `--force`)
|
|
10
|
+
*
|
|
11
|
+
* Usage errors (`2`) are often surfaced by throwing from deep in a helper
|
|
12
|
+
* (path validation, byte budgets, overwrite guards). Throwing `UsageError`
|
|
13
|
+
* instead of a plain `Error` lets the shared catch tell those apart from a
|
|
14
|
+
* genuine crash, so the contract holds without each call site picking a code.
|
|
15
|
+
*/
|
|
16
|
+
export declare const EXIT: {
|
|
17
|
+
readonly ok: 0;
|
|
18
|
+
readonly failure: 1;
|
|
19
|
+
readonly usage: 2;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A caller-facing "you used it wrong" error: bad flag or argument, missing
|
|
23
|
+
* package, invalid environment, or a refused overwrite. Reported at exit code
|
|
24
|
+
* 2, distinct from an unexpected crash (1).
|
|
25
|
+
*/
|
|
26
|
+
export declare class UsageError extends Error {
|
|
27
|
+
readonly exitCode: 2;
|
|
28
|
+
constructor(message: string);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/ghost-core/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,IAAI;;;;CAIP,CAAC;AAEX;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,QAAQ,IAAc;gBACnB,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI exit-code contract, in one place so every command agrees and an agent
|
|
3
|
+
* can branch on the code:
|
|
4
|
+
*
|
|
5
|
+
* - `0` success
|
|
6
|
+
* - `1` ran, but unhappy: a lint/validate finding, or an unexpected error
|
|
7
|
+
* - `2` called wrong: a bad flag or argument, a missing package, an unknown
|
|
8
|
+
* node or surface
|
|
9
|
+
* - `3` a command-specific refusal (e.g. `skill install` without `--force`)
|
|
10
|
+
*
|
|
11
|
+
* Usage errors (`2`) are often surfaced by throwing from deep in a helper
|
|
12
|
+
* (path validation, byte budgets, overwrite guards). Throwing `UsageError`
|
|
13
|
+
* instead of a plain `Error` lets the shared catch tell those apart from a
|
|
14
|
+
* genuine crash, so the contract holds without each call site picking a code.
|
|
15
|
+
*/
|
|
16
|
+
export const EXIT = {
|
|
17
|
+
ok: 0,
|
|
18
|
+
failure: 1,
|
|
19
|
+
usage: 2,
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A caller-facing "you used it wrong" error: bad flag or argument, missing
|
|
23
|
+
* package, invalid environment, or a refused overwrite. Reported at exit code
|
|
24
|
+
* 2, distinct from an unexpected crash (1).
|
|
25
|
+
*/
|
|
26
|
+
export class UsageError extends Error {
|
|
27
|
+
exitCode = EXIT.usage;
|
|
28
|
+
constructor(message) {
|
|
29
|
+
super(message);
|
|
30
|
+
this.name = "UsageError";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/ghost-core/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,EAAE,EAAE,CAAC;IACL,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;CACA,CAAC;AAEX;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC1B,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC;IAC/B,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Tiny dependency-free glob matcher for repo-relative paths. */
|
|
2
|
+
export declare function matchesGlob(glob: string, path: string): boolean;
|
|
3
|
+
export declare function hasGlobMagic(path: string): boolean;
|
|
4
|
+
export declare function normalizeGlobPath(path: string): string;
|
|
5
|
+
//# sourceMappingURL=glob.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/ghost-core/glob.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAG/D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** Tiny dependency-free glob matcher for repo-relative paths. */
|
|
2
|
+
export function matchesGlob(glob, path) {
|
|
3
|
+
const re = globToRegExp(glob);
|
|
4
|
+
return re.test(normalize(path));
|
|
5
|
+
}
|
|
6
|
+
export function hasGlobMagic(path) {
|
|
7
|
+
return /[*?{]/.test(path);
|
|
8
|
+
}
|
|
9
|
+
export function normalizeGlobPath(path) {
|
|
10
|
+
return normalize(path);
|
|
11
|
+
}
|
|
12
|
+
function normalize(p) {
|
|
13
|
+
return p.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
14
|
+
}
|
|
15
|
+
const cache = new Map();
|
|
16
|
+
function globToRegExp(glob) {
|
|
17
|
+
const cached = cache.get(glob);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
const g = normalize(glob);
|
|
21
|
+
let re = "";
|
|
22
|
+
for (let i = 0; i < g.length; i++) {
|
|
23
|
+
const c = g[i];
|
|
24
|
+
if (c === "*") {
|
|
25
|
+
if (g[i + 1] === "*") {
|
|
26
|
+
i++;
|
|
27
|
+
if (g[i + 1] === "/") {
|
|
28
|
+
i++;
|
|
29
|
+
re += "(?:.*/)?";
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
re += ".*";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
re += "[^/]*";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else if (c === "?") {
|
|
40
|
+
re += "[^/]";
|
|
41
|
+
}
|
|
42
|
+
else if (c === "{") {
|
|
43
|
+
const close = g.indexOf("}", i);
|
|
44
|
+
if (close === -1) {
|
|
45
|
+
re += "\\{";
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const alts = g
|
|
49
|
+
.slice(i + 1, close)
|
|
50
|
+
.split(",")
|
|
51
|
+
.map(escapeLiteral)
|
|
52
|
+
.join("|");
|
|
53
|
+
re += `(?:${alts})`;
|
|
54
|
+
i = close;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
re += escapeLiteral(c);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const compiled = new RegExp(`^${re}$`);
|
|
62
|
+
cache.set(glob, compiled);
|
|
63
|
+
return compiled;
|
|
64
|
+
}
|
|
65
|
+
function escapeLiteral(s) {
|
|
66
|
+
return s.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=glob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/ghost-core/glob.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,IAAY;IACpD,MAAM,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5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MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YAChC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;gBACjB,EAAE,IAAI,KAAK,CAAC;YACd,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,GAAG,CAAC;qBACX,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC;qBACnB,KAAK,CAAC,GAAG,CAAC;qBACV,GAAG,CAAC,aAAa,CAAC;qBAClB,IAAI,CAAC,GAAG,CAAC,CAAC;gBACb,EAAE,IAAI,MAAM,IAAI,GAAG,CAAC;gBACpB,CAAC,GAAG,KAAK,CAAC;YACZ,CAAC;QACH,CAAC;aAAM,CAAC;YACN,EAAE,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IACD,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACvC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC1B,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,aAAa,CAAC,CAAS;IAC9B,OAAO,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const GhostGlossaryKindPostureSchema: z.ZodEnum<{
|
|
3
|
+
steady: "steady";
|
|
4
|
+
wild: "wild";
|
|
5
|
+
guard: "guard";
|
|
6
|
+
}>;
|
|
7
|
+
export type GhostGlossaryKindPosture = z.infer<typeof GhostGlossaryKindPostureSchema>;
|
|
8
|
+
export declare const GhostGlossaryFrontmatterSchema: z.ZodObject<{
|
|
9
|
+
kinds: z.ZodArray<z.ZodObject<{
|
|
10
|
+
name: z.ZodString;
|
|
11
|
+
posture: z.ZodDefault<z.ZodEnum<{
|
|
12
|
+
steady: "steady";
|
|
13
|
+
wild: "wild";
|
|
14
|
+
guard: "guard";
|
|
15
|
+
}>>;
|
|
16
|
+
}, z.core.$loose>>;
|
|
17
|
+
}, z.core.$loose>;
|
|
18
|
+
export interface GhostGlossaryKind {
|
|
19
|
+
name: string;
|
|
20
|
+
/** Consumption posture for nodes of this kind. */
|
|
21
|
+
posture: GhostGlossaryKindPosture;
|
|
22
|
+
/** Prose purpose/normative weight for this kind, parsed from its section. */
|
|
23
|
+
purpose: string;
|
|
24
|
+
}
|
|
25
|
+
export interface GhostGlossaryDocument {
|
|
26
|
+
frontmatter: z.infer<typeof GhostGlossaryFrontmatterSchema>;
|
|
27
|
+
body: string;
|
|
28
|
+
kinds: GhostGlossaryKind[];
|
|
29
|
+
}
|
|
30
|
+
export type GhostGlossaryParseResult = {
|
|
31
|
+
glossary: GhostGlossaryDocument;
|
|
32
|
+
errors: [];
|
|
33
|
+
} | {
|
|
34
|
+
glossary: null;
|
|
35
|
+
errors: string[];
|
|
36
|
+
};
|
|
37
|
+
export declare function parseGlossary(raw: string): GhostGlossaryParseResult;
|
|
38
|
+
//# sourceMappingURL=glossary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glossary.d.ts","sourceRoot":"","sources":["../../src/ghost-core/glossary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,8BAA8B;;;;EAIzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;iBAW3B,CAAC;AAEjB,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,OAAO,EAAE,wBAAwB,CAAC;IAClC,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC5B;AAED,MAAM,MAAM,wBAAwB,GAChC;IAAE,QAAQ,EAAE,qBAAqB,CAAC;IAAC,MAAM,EAAE,EAAE,CAAA;CAAE,GAC/C;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEzC,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,wBAAwB,CAiCnE"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { splitMarkdownFrontmatter } from "./markdown.js";
|
|
3
|
+
export const GhostGlossaryKindPostureSchema = z.enum([
|
|
4
|
+
"steady",
|
|
5
|
+
"wild",
|
|
6
|
+
"guard",
|
|
7
|
+
]);
|
|
8
|
+
export const GhostGlossaryFrontmatterSchema = z
|
|
9
|
+
.object({
|
|
10
|
+
kinds: z.array(z
|
|
11
|
+
.object({
|
|
12
|
+
name: z.string().min(1),
|
|
13
|
+
posture: GhostGlossaryKindPostureSchema.default("steady"),
|
|
14
|
+
})
|
|
15
|
+
.passthrough()),
|
|
16
|
+
})
|
|
17
|
+
.passthrough();
|
|
18
|
+
export function parseGlossary(raw) {
|
|
19
|
+
const { frontmatter, body } = splitMarkdownFrontmatter(raw);
|
|
20
|
+
if (frontmatter === null) {
|
|
21
|
+
return {
|
|
22
|
+
glossary: null,
|
|
23
|
+
errors: ["glossary must begin with YAML frontmatter"],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const result = GhostGlossaryFrontmatterSchema.safeParse(frontmatter);
|
|
27
|
+
if (!result.success) {
|
|
28
|
+
return {
|
|
29
|
+
glossary: null,
|
|
30
|
+
errors: result.error.issues.map((issue) => issue.message),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const normalizedBody = body.replace(/^\n+/, "").replace(/\s+$/, "");
|
|
34
|
+
const sections = parseMarkdownSections(normalizedBody);
|
|
35
|
+
const kinds = result.data.kinds.map((kind) => ({
|
|
36
|
+
name: kind.name,
|
|
37
|
+
posture: kind.posture,
|
|
38
|
+
purpose: sections.get(normalizeHeading(kind.name)) ?? "",
|
|
39
|
+
}));
|
|
40
|
+
return {
|
|
41
|
+
glossary: {
|
|
42
|
+
frontmatter: result.data,
|
|
43
|
+
body: normalizedBody,
|
|
44
|
+
kinds,
|
|
45
|
+
},
|
|
46
|
+
errors: [],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function parseMarkdownSections(body) {
|
|
50
|
+
const sections = new Map();
|
|
51
|
+
const lines = body.split(/\r?\n/);
|
|
52
|
+
let current;
|
|
53
|
+
let buffer = [];
|
|
54
|
+
const flush = () => {
|
|
55
|
+
if (current !== undefined) {
|
|
56
|
+
sections.set(current, buffer.join("\n").trim());
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
for (const line of lines) {
|
|
60
|
+
const match = /^(#{1,6})\s+(.+?)\s*$/.exec(line);
|
|
61
|
+
if (match) {
|
|
62
|
+
flush();
|
|
63
|
+
current = normalizeHeading(match[2] ?? "");
|
|
64
|
+
buffer = [];
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (current !== undefined)
|
|
68
|
+
buffer.push(line);
|
|
69
|
+
}
|
|
70
|
+
flush();
|
|
71
|
+
return sections;
|
|
72
|
+
}
|
|
73
|
+
function normalizeHeading(value) {
|
|
74
|
+
return value.trim().toLowerCase();
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=glossary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glossary.js","sourceRoot":"","sources":["../../src/ghost-core/glossary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAw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AC;IAC/C,CAAC;IACD,KAAK,EAAE,CAAC;IAER,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { type AssembleCatalogInput, assembleCatalog, type BuildCatalogMenuOptions, buildCatalogMenu, type CatalogMenuEntry, closestIds, type GhostCatalog, type GhostCatalogNode, type PlacedNode, } from "./catalog/index.js";
|
|
2
|
+
export { GHOST_CHECK_SCHEMA, GHOST_CHECK_SEVERITIES, type GhostCheckDocument, type GhostCheckFrontmatter, type GhostCheckLintIssue, type GhostCheckLintReport, type GhostCheckLintSeverity, type GhostCheckMarkdownSeverity, lintGhostCheck, loadGhostCheck, type ParsedCheckMarkdown, type ParsedSourceRef, parseCheckMarkdown, parseSourceRef, sliceNodeSection, } from "./check/index.js";
|
|
3
|
+
export { EXIT, UsageError } from "./errors.js";
|
|
4
|
+
export { hasGlobMagic, matchesGlob, normalizeGlobPath } from "./glob.js";
|
|
5
|
+
export { type GhostGlossaryDocument, GhostGlossaryFrontmatterSchema, type GhostGlossaryKind, type GhostGlossaryKindPosture, GhostGlossaryKindPostureSchema, type GhostGlossaryParseResult, parseGlossary, } from "./glossary.js";
|
|
6
|
+
export { type ExpandedLocalMaterialLocator, expandLocalMaterialLocator, listBundledMaterialFiles, type MaterialTransportOptions, type MaterialTransportResult, materialLocatorClaimsPath, resolveLocalMaterialLocator, type TransportedMaterial, type TransportedMaterialTier, transportMaterials, } from "./material-transport.js";
|
|
7
|
+
export { type ClassifiedGhostMaterialLocator, classifyMaterialLocator, type GhostMaterialLocatorKind, validateMaterialLocator, } from "./materials.js";
|
|
8
|
+
export { carriesConcreteMaterial, extractSkeletonFences, extractSkeletonSections, type FencedBlock, GHOST_NODE_SCHEMA, type GhostNodeDocument, type GhostNodeFrontmatter, GhostNodeFrontmatterSchema, type GhostNodeLintIssue, type GhostNodeLintReport, type GhostNodeLintSeverity, lintGhostNode, NodeIdSchema, NodeRefSchema, type ParseNodeResult, parseNode, type SkeletonSection, serializeNode, stripSkeletonSections, } from "./node/index.js";
|
|
9
|
+
export type { GhostFingerprintPackageManifest } from "./package-manifest.js";
|
|
10
|
+
export { GHOST_FINGERPRINT_PACKAGE_SCHEMA, GhostFingerprintPackageManifestSchema, } from "./package-manifest.js";
|
|
11
|
+
export type { SkillBundleFile } from "./skill-bundle-loader.js";
|
|
12
|
+
export { loadSkillBundle } from "./skill-bundle-loader.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ghost-core/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,oBAAoB,EACzB,eAAe,EACf,KAAK,uBAAuB,EAC5B,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,UAAU,EACV,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,UAAU,GAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,cAAc,EACd,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEzE,OAAO,EACL,KAAK,qBAAqB,EAC1B,8BAA8B,EAC9B,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,KAAK,wBAAwB,EAC7B,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,4BAA4B,EACjC,0BAA0B,EAC1B,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,KAAK,8BAA8B,EACnC,uBAAuB,EACvB,KAAK,wBAAwB,EAC7B,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,WAAW,EAChB,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,0BAA0B,EAC1B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,aAAa,EACb,YAAY,EACZ,aAAa,EACb,KAAK,eAAe,EACpB,SAAS,EACT,KAAK,eAAe,EACpB,aAAa,EACb,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EACL,gCAAgC,EAChC,qCAAqC,GACtC,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// --- Embedding primitives ---
|
|
2
|
+
// --- Catalog (flat in-memory fingerprint node map) ---
|
|
3
|
+
export { assembleCatalog, buildCatalogMenu, closestIds, } from "./catalog/index.js";
|
|
4
|
+
// --- Check (ghost.check/v1) — markdown checks, agent-evaluated ---
|
|
5
|
+
export { GHOST_CHECK_SCHEMA, GHOST_CHECK_SEVERITIES, lintGhostCheck, loadGhostCheck, parseCheckMarkdown, parseSourceRef, sliceNodeSection, } from "./check/index.js";
|
|
6
|
+
// --- CLI exit-code contract ---
|
|
7
|
+
export { EXIT, UsageError } from "./errors.js";
|
|
8
|
+
// --- Glob matching (repo-relative locators) ---
|
|
9
|
+
export { hasGlobMagic, matchesGlob, normalizeGlobPath } from "./glob.js";
|
|
10
|
+
// --- Glossary (reserved fingerprint vocabulary slot) ---
|
|
11
|
+
export { GhostGlossaryFrontmatterSchema, GhostGlossaryKindPostureSchema, parseGlossary, } from "./glossary.js";
|
|
12
|
+
export { expandLocalMaterialLocator, listBundledMaterialFiles, materialLocatorClaimsPath, resolveLocalMaterialLocator, transportMaterials, } from "./material-transport.js";
|
|
13
|
+
// --- Materials (node locators) ---
|
|
14
|
+
export { classifyMaterialLocator, validateMaterialLocator, } from "./materials.js";
|
|
15
|
+
// --- Node (ghost.node/v1) — the markdown node artifact ---
|
|
16
|
+
export { carriesConcreteMaterial, extractSkeletonFences, extractSkeletonSections, GHOST_NODE_SCHEMA, GhostNodeFrontmatterSchema, lintGhostNode, NodeIdSchema, NodeRefSchema, parseNode, serializeNode, stripSkeletonSections, } from "./node/index.js";
|
|
17
|
+
export { GHOST_FINGERPRINT_PACKAGE_SCHEMA, GhostFingerprintPackageManifestSchema, } from "./package-manifest.js";
|
|
18
|
+
export { loadSkillBundle } from "./skill-bundle-loader.js";
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ghost-core/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,wDAAwD;AACxD,OAAO,EAEL,eAAe,EAEf,gBAAgB,EAEhB,UAAU,GAIX,MAAM,oBAAoB,CAAC;AAC5B,oEAAoE;AACpE,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EAOtB,cAAc,EACd,cAAc,EAGd,kBAAkB,EAClB,cAAc,EACd,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,iCAAiC;AACjC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC/C,iDAAiD;AACjD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACzE,0DAA0D;AAC1D,OAAO,EAEL,8BAA8B,EAG9B,8BAA8B,EAE9B,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,0BAA0B,EAC1B,wBAAwB,EAGxB,yBAAyB,EACzB,2BAA2B,EAG3B,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,oCAAoC;AACpC,OAAO,EAEL,uBAAuB,EAEvB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AACxB,4DAA4D;AAC5D,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EAEvB,iBAAiB,EAGjB,0BAA0B,EAI1B,aAAa,EACb,YAAY,EACZ,aAAa,EAEb,SAAS,EAET,aAAa,EACb,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,gCAAgC,EAChC,qCAAqC,GACtC,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ParsedMarkdown {
|
|
2
|
+
/** Raw parsed frontmatter object (unvalidated), or null when absent. */
|
|
3
|
+
frontmatter: Record<string, unknown> | null;
|
|
4
|
+
body: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Split a markdown artifact into its YAML frontmatter and body. The artifact is
|
|
8
|
+
* `---\n<yaml>\n---\n<body>`. Returns `frontmatter: null` when there is no
|
|
9
|
+
* leading frontmatter block (callers report it as an error).
|
|
10
|
+
*
|
|
11
|
+
* Shared by every Ghost markdown+frontmatter artifact (checks, nodes): one
|
|
12
|
+
* envelope, one splitter.
|
|
13
|
+
*/
|
|
14
|
+
export declare function splitMarkdownFrontmatter(raw: string): ParsedMarkdown;
|
|
15
|
+
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/ghost-core/markdown.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5C,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAoBpE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { parse as parseYaml } from "yaml";
|
|
2
|
+
/**
|
|
3
|
+
* Split a markdown artifact into its YAML frontmatter and body. The artifact is
|
|
4
|
+
* `---\n<yaml>\n---\n<body>`. Returns `frontmatter: null` when there is no
|
|
5
|
+
* leading frontmatter block (callers report it as an error).
|
|
6
|
+
*
|
|
7
|
+
* Shared by every Ghost markdown+frontmatter artifact (checks, nodes): one
|
|
8
|
+
* envelope, one splitter.
|
|
9
|
+
*/
|
|
10
|
+
export function splitMarkdownFrontmatter(raw) {
|
|
11
|
+
const text = raw.replace(/^\uFEFF/, "");
|
|
12
|
+
const lines = text.split(/\r?\n/);
|
|
13
|
+
if (lines[0]?.trim() !== "---") {
|
|
14
|
+
return { frontmatter: null, body: text };
|
|
15
|
+
}
|
|
16
|
+
for (let i = 1; i < lines.length; i++) {
|
|
17
|
+
if (lines[i]?.trim() === "---") {
|
|
18
|
+
const yaml = lines.slice(1, i).join("\n");
|
|
19
|
+
const body = lines.slice(i + 1).join("\n");
|
|
20
|
+
const parsed = parseYaml(yaml);
|
|
21
|
+
const frontmatter = parsed && typeof parsed === "object" && !Array.isArray(parsed)
|
|
22
|
+
? parsed
|
|
23
|
+
: {};
|
|
24
|
+
return { frontmatter, body: body.replace(/^\n+/, "") };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// Opening fence with no close: treat the whole thing as body, no frontmatter.
|
|
28
|
+
return { frontmatter: null, body: text };
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/ghost-core/markdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAQ1C;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAW;IAClD,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,KAAK,EAAE,CAAC;QAC/B,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC3C,CAAC;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,KAAK,EAAE,CAAC;YAC/B,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3C,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAC/B,MAAM,WAAW,GACf,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBAC5D,CAAC,CAAE,MAAkC;gBACrC,CAAC,CAAC,EAAE,CAAC;YACT,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QACzD,CAAC;IACH,CAAC;IACD,8EAA8E;IAC9E,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type TransportedMaterialTier = "bundled" | "referenced" | "url";
|
|
2
|
+
export interface TransportedMaterial {
|
|
3
|
+
locator: string;
|
|
4
|
+
tier: TransportedMaterialTier;
|
|
5
|
+
/** Repo-relative concrete file path, when the locator resolved to a file. */
|
|
6
|
+
path?: string;
|
|
7
|
+
inlined?: string;
|
|
8
|
+
omitted?: true;
|
|
9
|
+
reason?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface MaterialTransportOptions {
|
|
12
|
+
repoRoot: string;
|
|
13
|
+
packageDir: string;
|
|
14
|
+
materialsDir?: string;
|
|
15
|
+
globCap?: number;
|
|
16
|
+
referencedInlineBytes?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface MaterialTransportResult {
|
|
19
|
+
materials: TransportedMaterial[];
|
|
20
|
+
inlined: number;
|
|
21
|
+
omitted: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ExpandedLocalMaterialLocator {
|
|
24
|
+
locator: string;
|
|
25
|
+
tier: Exclude<TransportedMaterialTier, "url">;
|
|
26
|
+
pattern: string;
|
|
27
|
+
matches: Array<{
|
|
28
|
+
absolutePath: string;
|
|
29
|
+
repoRelativePath: string;
|
|
30
|
+
}>;
|
|
31
|
+
truncated: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare function transportMaterials(locators: string[] | undefined, options: MaterialTransportOptions): Promise<MaterialTransportResult>;
|
|
34
|
+
export declare function expandLocalMaterialLocator(locator: string, options: MaterialTransportOptions, expandOptions?: {
|
|
35
|
+
cap?: number;
|
|
36
|
+
}): Promise<ExpandedLocalMaterialLocator>;
|
|
37
|
+
export declare function listBundledMaterialFiles(options: MaterialTransportOptions): Promise<string[]>;
|
|
38
|
+
export declare function materialLocatorClaimsPath(locator: string, repoRelativePath: string, options: MaterialTransportOptions): boolean;
|
|
39
|
+
export declare function resolveLocalMaterialLocator(locator: string, options: MaterialTransportOptions): {
|
|
40
|
+
tier: Exclude<TransportedMaterialTier, "url">;
|
|
41
|
+
pattern: string;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=material-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"material-transport.d.ts","sourceRoot":"","sources":["../../src/ghost-core/material-transport.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,YAAY,GAAG,KAAK,CAAC;AAEvE,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,uBAAuB,CAAC;IAC9B,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,mBAAmB,EAAE,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO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