@orkestrel/scaffold 0.0.116 → 0.0.118
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/dist/bin/main.js +43 -16
- package/dist/bin/main.js.map +1 -1
- package/dist/host/agents/skills/orkestrel-publish/references/wave.md +1 -0
- package/dist/host/claude/agents/orkestrel.md +2 -2
- package/dist/host/guides/guide.md +19 -12
- package/dist/host/guides/scaffold.md +69 -27
- package/dist/host/manifest.json +5 -5
- package/dist/src/core/index.cjs +125 -2
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +123 -2
- package/dist/src/core/index.d.ts +123 -2
- package/dist/src/core/index.js +121 -3
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +16 -11
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +12 -6
- package/dist/src/server/index.d.ts +12 -6
- package/dist/src/server/index.js +16 -11
- package/dist/src/server/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -14,8 +14,8 @@ import type { Plan } from '@orkestrel/scaffold';
|
|
|
14
14
|
import type { Release } from '@orkestrel/scaffold';
|
|
15
15
|
import type { Snapshot } from '@orkestrel/scaffold';
|
|
16
16
|
import type { SurfaceCandidate } from '@orkestrel/scaffold';
|
|
17
|
-
import type { SurfaceClaim } from '@orkestrel/scaffold';
|
|
18
17
|
import type { SurfaceCollision } from '@orkestrel/scaffold';
|
|
18
|
+
import type { SurfaceContract } from '@orkestrel/scaffold';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Matches the Git branch syntax the repository endpoint accepts.
|
|
@@ -2067,7 +2067,7 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2067
2067
|
* readSurfaceClaims('./guides') // owners and the names their guides claim
|
|
2068
2068
|
* ```
|
|
2069
2069
|
*/
|
|
2070
|
-
export declare function readSurfaceClaims(root: string, loader?: SurfaceLoader): readonly
|
|
2070
|
+
export declare function readSurfaceClaims(root: string, loader?: SurfaceLoader): readonly SurfaceContract[];
|
|
2071
2071
|
|
|
2072
2072
|
/**
|
|
2073
2073
|
* Reads bare Surface names claimed by distinct package guides.
|
|
@@ -2111,20 +2111,21 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2111
2111
|
* readSurfaceFile('.', 'scaffold', 'candidate')?.names // the names the checkout's guide claims
|
|
2112
2112
|
* ```
|
|
2113
2113
|
*/
|
|
2114
|
-
export declare function readSurfaceFile(root: string | Host, owner: string, label: string, loader?: SurfaceLoader):
|
|
2114
|
+
export declare function readSurfaceFile(root: string | Host, owner: string, label: string, loader?: SurfaceLoader): SurfaceContract | undefined;
|
|
2115
2115
|
|
|
2116
2116
|
/**
|
|
2117
2117
|
* Reads one guide's claims and reports parser refusals with its owner and source.
|
|
2118
2118
|
*
|
|
2119
2119
|
* @param source - The source label or path to name in a refusal.
|
|
2120
|
-
* @throws Thrown with TARGET when the module or the guide parser refuses the
|
|
2120
|
+
* @throws Thrown with TARGET when the module is unusable or the guide parser refuses the guide
|
|
2121
|
+
* with an error its `isGuideError` guard accepts; every other parser error propagates unchanged.
|
|
2121
2122
|
* @example
|
|
2122
2123
|
* ```ts
|
|
2123
2124
|
* import { readSurfaceGuide } from '@orkestrel/scaffold/server'
|
|
2124
|
-
* readSurfaceGuide('# Sample', 'sample', 'live guides/sample.md') // { owner: 'sample', names: [] }
|
|
2125
|
+
* readSurfaceGuide('# Sample', 'sample', 'live guides/sample.md') // { owner: 'sample', names: [], signatures: new Map() }
|
|
2125
2126
|
* ```
|
|
2126
2127
|
*/
|
|
2127
|
-
export declare function readSurfaceGuide(text: string, owner: string, source: string, loader?: SurfaceLoader):
|
|
2128
|
+
export declare function readSurfaceGuide(text: string, owner: string, source: string, loader?: SurfaceLoader): SurfaceContract;
|
|
2128
2129
|
|
|
2129
2130
|
/**
|
|
2130
2131
|
* Loads and validates the guide functions required by surface reflection.
|
|
@@ -2427,6 +2428,7 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2427
2428
|
readonly createGuide: (text: string) => {
|
|
2428
2429
|
readonly surface: () => ReadonlyArray<{
|
|
2429
2430
|
readonly name: string;
|
|
2431
|
+
readonly signature?: string;
|
|
2430
2432
|
}>;
|
|
2431
2433
|
};
|
|
2432
2434
|
readonly createSource: (options: {
|
|
@@ -2441,6 +2443,10 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2441
2443
|
readonly code: string;
|
|
2442
2444
|
readonly source: string;
|
|
2443
2445
|
}>;
|
|
2446
|
+
readonly isGuideError: (value: unknown) => value is Error & {
|
|
2447
|
+
readonly code: string;
|
|
2448
|
+
readonly message: string;
|
|
2449
|
+
};
|
|
2444
2450
|
}
|
|
2445
2451
|
|
|
2446
2452
|
/**
|
|
@@ -14,8 +14,8 @@ import type { Plan } from '@orkestrel/scaffold';
|
|
|
14
14
|
import type { Release } from '@orkestrel/scaffold';
|
|
15
15
|
import type { Snapshot } from '@orkestrel/scaffold';
|
|
16
16
|
import type { SurfaceCandidate } from '@orkestrel/scaffold';
|
|
17
|
-
import type { SurfaceClaim } from '@orkestrel/scaffold';
|
|
18
17
|
import type { SurfaceCollision } from '@orkestrel/scaffold';
|
|
18
|
+
import type { SurfaceContract } from '@orkestrel/scaffold';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Matches the Git branch syntax the repository endpoint accepts.
|
|
@@ -2067,7 +2067,7 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2067
2067
|
* readSurfaceClaims('./guides') // owners and the names their guides claim
|
|
2068
2068
|
* ```
|
|
2069
2069
|
*/
|
|
2070
|
-
export declare function readSurfaceClaims(root: string, loader?: SurfaceLoader): readonly
|
|
2070
|
+
export declare function readSurfaceClaims(root: string, loader?: SurfaceLoader): readonly SurfaceContract[];
|
|
2071
2071
|
|
|
2072
2072
|
/**
|
|
2073
2073
|
* Reads bare Surface names claimed by distinct package guides.
|
|
@@ -2111,20 +2111,21 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2111
2111
|
* readSurfaceFile('.', 'scaffold', 'candidate')?.names // the names the checkout's guide claims
|
|
2112
2112
|
* ```
|
|
2113
2113
|
*/
|
|
2114
|
-
export declare function readSurfaceFile(root: string | Host, owner: string, label: string, loader?: SurfaceLoader):
|
|
2114
|
+
export declare function readSurfaceFile(root: string | Host, owner: string, label: string, loader?: SurfaceLoader): SurfaceContract | undefined;
|
|
2115
2115
|
|
|
2116
2116
|
/**
|
|
2117
2117
|
* Reads one guide's claims and reports parser refusals with its owner and source.
|
|
2118
2118
|
*
|
|
2119
2119
|
* @param source - The source label or path to name in a refusal.
|
|
2120
|
-
* @throws Thrown with TARGET when the module or the guide parser refuses the
|
|
2120
|
+
* @throws Thrown with TARGET when the module is unusable or the guide parser refuses the guide
|
|
2121
|
+
* with an error its `isGuideError` guard accepts; every other parser error propagates unchanged.
|
|
2121
2122
|
* @example
|
|
2122
2123
|
* ```ts
|
|
2123
2124
|
* import { readSurfaceGuide } from '@orkestrel/scaffold/server'
|
|
2124
|
-
* readSurfaceGuide('# Sample', 'sample', 'live guides/sample.md') // { owner: 'sample', names: [] }
|
|
2125
|
+
* readSurfaceGuide('# Sample', 'sample', 'live guides/sample.md') // { owner: 'sample', names: [], signatures: new Map() }
|
|
2125
2126
|
* ```
|
|
2126
2127
|
*/
|
|
2127
|
-
export declare function readSurfaceGuide(text: string, owner: string, source: string, loader?: SurfaceLoader):
|
|
2128
|
+
export declare function readSurfaceGuide(text: string, owner: string, source: string, loader?: SurfaceLoader): SurfaceContract;
|
|
2128
2129
|
|
|
2129
2130
|
/**
|
|
2130
2131
|
* Loads and validates the guide functions required by surface reflection.
|
|
@@ -2427,6 +2428,7 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2427
2428
|
readonly createGuide: (text: string) => {
|
|
2428
2429
|
readonly surface: () => ReadonlyArray<{
|
|
2429
2430
|
readonly name: string;
|
|
2431
|
+
readonly signature?: string;
|
|
2430
2432
|
}>;
|
|
2431
2433
|
};
|
|
2432
2434
|
readonly createSource: (options: {
|
|
@@ -2441,6 +2443,10 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2441
2443
|
readonly code: string;
|
|
2442
2444
|
readonly source: string;
|
|
2443
2445
|
}>;
|
|
2446
|
+
readonly isGuideError: (value: unknown) => value is Error & {
|
|
2447
|
+
readonly code: string;
|
|
2448
|
+
readonly message: string;
|
|
2449
|
+
};
|
|
2444
2450
|
}
|
|
2445
2451
|
|
|
2446
2452
|
/**
|
package/dist/src/server/index.js
CHANGED
|
@@ -1757,31 +1757,35 @@ function resolveHostRoot() {
|
|
|
1757
1757
|
*/
|
|
1758
1758
|
function readSurfaceModule(loader = createRequire(import.meta.url)) {
|
|
1759
1759
|
const loaded = attempt(() => loader("@orkestrel/guide"));
|
|
1760
|
-
if (!loaded.success || !isSurfaceModule(loaded.value)) throw new ScaffoldError("TARGET", "Surface reflection requires @orkestrel/guide with createGuide, createSource, and
|
|
1760
|
+
if (!loaded.success || !isSurfaceModule(loaded.value)) throw new ScaffoldError("TARGET", "Surface reflection requires @orkestrel/guide with createGuide, createSource, extractSourceLines, and isGuideError. Supply that module in scaffold's resolution path.", { ...!loaded.success ? { error: loaded.error } : {} });
|
|
1761
1761
|
return loaded.value;
|
|
1762
1762
|
}
|
|
1763
1763
|
/**
|
|
1764
1764
|
* Reads one guide's claims and reports parser refusals with its owner and source.
|
|
1765
1765
|
*
|
|
1766
1766
|
* @param source - The source label or path to name in a refusal.
|
|
1767
|
-
* @throws Thrown with TARGET when the module or the guide parser refuses the
|
|
1767
|
+
* @throws Thrown with TARGET when the module is unusable or the guide parser refuses the guide
|
|
1768
|
+
* with an error its `isGuideError` guard accepts; every other parser error propagates unchanged.
|
|
1768
1769
|
* @example
|
|
1769
1770
|
* ```ts
|
|
1770
1771
|
* import { readSurfaceGuide } from '@orkestrel/scaffold/server'
|
|
1771
|
-
* readSurfaceGuide('# Sample', 'sample', 'live guides/sample.md') // { owner: 'sample', names: [] }
|
|
1772
|
+
* readSurfaceGuide('# Sample', 'sample', 'live guides/sample.md') // { owner: 'sample', names: [], signatures: new Map() }
|
|
1772
1773
|
* ```
|
|
1773
1774
|
*/
|
|
1774
1775
|
function readSurfaceGuide(text, owner, source, loader) {
|
|
1775
1776
|
const guide = readSurfaceModule(loader);
|
|
1776
|
-
const parsed = attempt(() => guide.createGuide(text).surface()
|
|
1777
|
-
if (
|
|
1777
|
+
const parsed = attempt(() => guide.createGuide(text).surface());
|
|
1778
|
+
if (parsed.success) return {
|
|
1778
1779
|
owner,
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
return {
|
|
1782
|
-
owner,
|
|
1783
|
-
names: parsed.value
|
|
1780
|
+
names: parsed.value.map(({ name }) => name),
|
|
1781
|
+
signatures: new Map(parsed.value.flatMap(({ name, signature }) => isString(signature) ? [[name, signature]] : []))
|
|
1784
1782
|
};
|
|
1783
|
+
if (!guide.isGuideError(parsed.error)) throw parsed.error;
|
|
1784
|
+
throw new ScaffoldError("TARGET", `Surface guide for ${JSON.stringify(owner.slice(0, 512))} from ${JSON.stringify(source.slice(0, 512))} was refused: ${parsed.error.message}`, {
|
|
1785
|
+
owner,
|
|
1786
|
+
source,
|
|
1787
|
+
code: parsed.error.code
|
|
1788
|
+
});
|
|
1785
1789
|
}
|
|
1786
1790
|
/**
|
|
1787
1791
|
* Reads each immediate package guide's bare names under its file owner.
|
|
@@ -1863,6 +1867,7 @@ function readSurfaceCandidate(root, loader) {
|
|
|
1863
1867
|
return {
|
|
1864
1868
|
owner,
|
|
1865
1869
|
names: [.../* @__PURE__ */ new Set([...guide?.names ?? [], ...Object.values(exports).flat()])].sort(),
|
|
1870
|
+
signatures: guide?.signatures ?? /* @__PURE__ */ new Map(),
|
|
1866
1871
|
conflicts: collectSurfaceConflicts(owner, exports)
|
|
1867
1872
|
};
|
|
1868
1873
|
}
|
|
@@ -2175,7 +2180,7 @@ function matchesPrecondition(precondition) {
|
|
|
2175
2180
|
* ```
|
|
2176
2181
|
*/
|
|
2177
2182
|
function isSurfaceModule(value) {
|
|
2178
|
-
return holds(() => isObject(value) && "createGuide" in value && isFunction(value.createGuide) && "createSource" in value && isFunction(value.createSource) && "extractSourceLines" in value && isFunction(value.extractSourceLines));
|
|
2183
|
+
return holds(() => isObject(value) && "createGuide" in value && isFunction(value.createGuide) && "createSource" in value && isFunction(value.createSource) && "extractSourceLines" in value && isFunction(value.extractSourceLines) && "isGuideError" in value && isFunction(value.isGuideError));
|
|
2179
2184
|
}
|
|
2180
2185
|
/**
|
|
2181
2186
|
* Narrows a value to a path naming a location on this host.
|