@orkestrel/scaffold 0.0.117 → 0.0.119
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 +42 -15
- package/dist/bin/main.js.map +1 -1
- package/dist/host/agents/platforms/windows.md +2 -1
- package/dist/host/agents/skills/orkestrel-publish/references/release.md +1 -0
- package/dist/host/agents/skills/orkestrel-publish/references/wave.md +3 -1
- package/dist/host/claude/rules/names.md +3 -2
- package/dist/host/claude/rules/tests.md +2 -0
- package/dist/host/claude/rules/workspace.md +2 -1
- package/dist/host/guides/scaffold.md +71 -23
- package/dist/host/manifest.json +106 -9
- package/dist/host/tests/setupPolicy.ts +18 -6
- package/dist/src/core/index.cjs +188 -1
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +146 -2
- package/dist/src/core/index.d.ts +146 -2
- package/dist/src/core/index.js +183 -2
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +42 -17
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +15 -9
- package/dist/src/server/index.d.ts +15 -9
- package/dist/src/server/index.js +43 -18
- package/dist/src/server/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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.
|
|
@@ -348,7 +348,8 @@ export declare interface HostInventory {
|
|
|
348
348
|
* @remarks
|
|
349
349
|
* `roots` is the sorted directory inventory, which is what distinguishes a
|
|
350
350
|
* declared empty directory. `surface` records only names claimed by distinct
|
|
351
|
-
* guides
|
|
351
|
+
* guides or admitted to a keeper by `SURFACE_TRANSFERS`, sorted by name with each
|
|
352
|
+
* owner list sorted. `digest` is the SHA-256
|
|
352
353
|
* of the exact entries, roots, and surface, so an edit without its digest is
|
|
353
354
|
* detected. A self-consistent replacement manifest defines its own smaller
|
|
354
355
|
* membership; authenticating omitted membership is outside a checksum's
|
|
@@ -2067,7 +2068,7 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2067
2068
|
* readSurfaceClaims('./guides') // owners and the names their guides claim
|
|
2068
2069
|
* ```
|
|
2069
2070
|
*/
|
|
2070
|
-
export declare function readSurfaceClaims(root: string, loader?: SurfaceLoader): readonly
|
|
2071
|
+
export declare function readSurfaceClaims(root: string, loader?: SurfaceLoader): readonly SurfaceContract[];
|
|
2071
2072
|
|
|
2072
2073
|
/**
|
|
2073
2074
|
* Reads bare Surface names claimed by distinct package guides.
|
|
@@ -2111,7 +2112,7 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2111
2112
|
* readSurfaceFile('.', 'scaffold', 'candidate')?.names // the names the checkout's guide claims
|
|
2112
2113
|
* ```
|
|
2113
2114
|
*/
|
|
2114
|
-
export declare function readSurfaceFile(root: string | Host, owner: string, label: string, loader?: SurfaceLoader):
|
|
2115
|
+
export declare function readSurfaceFile(root: string | Host, owner: string, label: string, loader?: SurfaceLoader): SurfaceContract | undefined;
|
|
2115
2116
|
|
|
2116
2117
|
/**
|
|
2117
2118
|
* Reads one guide's claims and reports parser refusals with its owner and source.
|
|
@@ -2122,10 +2123,10 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2122
2123
|
* @example
|
|
2123
2124
|
* ```ts
|
|
2124
2125
|
* import { readSurfaceGuide } from '@orkestrel/scaffold/server'
|
|
2125
|
-
* readSurfaceGuide('# Sample', 'sample', 'live guides/sample.md') // { owner: 'sample', names: [] }
|
|
2126
|
+
* readSurfaceGuide('# Sample', 'sample', 'live guides/sample.md') // { owner: 'sample', names: [], signatures: new Map() }
|
|
2126
2127
|
* ```
|
|
2127
2128
|
*/
|
|
2128
|
-
export declare function readSurfaceGuide(text: string, owner: string, source: string, loader?: SurfaceLoader):
|
|
2129
|
+
export declare function readSurfaceGuide(text: string, owner: string, source: string, loader?: SurfaceLoader): SurfaceContract;
|
|
2129
2130
|
|
|
2130
2131
|
/**
|
|
2131
2132
|
* Loads and validates the guide functions required by surface reflection.
|
|
@@ -2330,8 +2331,9 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2330
2331
|
* host root is not vacant, the checkout does not carry every vendored path, two
|
|
2331
2332
|
* vendored files claim one storage name, a vendored file is not a plain file
|
|
2332
2333
|
* within the artifact ceiling, published guides are unreadable, a staged
|
|
2333
|
-
* collision's owner set is not a subset of its published owner set,
|
|
2334
|
-
* `
|
|
2334
|
+
* collision's owner set is not a subset of its published owner set, a
|
|
2335
|
+
* `SURFACE_TRANSFERS` entry is spent because its keeper alone claims the name, the
|
|
2336
|
+
* inventory is absent without `establish: true`, or the staged manifest does not read back.
|
|
2335
2337
|
* @throws `ScaffoldError('WRITE', …)` when a staged file or the manifest cannot
|
|
2336
2338
|
* be written.
|
|
2337
2339
|
*
|
|
@@ -2367,7 +2369,10 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2367
2369
|
* the canon and reference files for reading. Every catalog package must have a
|
|
2368
2370
|
* guide in the discovered membership before the host is written.
|
|
2369
2371
|
* Copied guides must carry no collision whose name and exact owner set the
|
|
2370
|
-
* committed inventory lacks.
|
|
2372
|
+
* committed inventory lacks. A `SURFACE_TRANSFERS` entry that another guide claims
|
|
2373
|
+
* admits its keeper beside the recorded owners, or beside the one owner of a name
|
|
2374
|
+
* the inventory lacks, and the staged surface records that keeper whether or not
|
|
2375
|
+
* its guide is mirrored. An absent inventory requires `establish: true`;
|
|
2371
2376
|
* an inventory without a valid recorded Surface is refused.
|
|
2372
2377
|
* Everything downstream — the missing-path refusal, the
|
|
2373
2378
|
* storage collision guard, the sort, the digests, and the root inventory — reads
|
|
@@ -2428,6 +2433,7 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2428
2433
|
readonly createGuide: (text: string) => {
|
|
2429
2434
|
readonly surface: () => ReadonlyArray<{
|
|
2430
2435
|
readonly name: string;
|
|
2436
|
+
readonly signature?: string;
|
|
2431
2437
|
}>;
|
|
2432
2438
|
};
|
|
2433
2439
|
readonly createSource: (options: {
|
|
@@ -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.
|
|
@@ -348,7 +348,8 @@ export declare interface HostInventory {
|
|
|
348
348
|
* @remarks
|
|
349
349
|
* `roots` is the sorted directory inventory, which is what distinguishes a
|
|
350
350
|
* declared empty directory. `surface` records only names claimed by distinct
|
|
351
|
-
* guides
|
|
351
|
+
* guides or admitted to a keeper by `SURFACE_TRANSFERS`, sorted by name with each
|
|
352
|
+
* owner list sorted. `digest` is the SHA-256
|
|
352
353
|
* of the exact entries, roots, and surface, so an edit without its digest is
|
|
353
354
|
* detected. A self-consistent replacement manifest defines its own smaller
|
|
354
355
|
* membership; authenticating omitted membership is outside a checksum's
|
|
@@ -2067,7 +2068,7 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2067
2068
|
* readSurfaceClaims('./guides') // owners and the names their guides claim
|
|
2068
2069
|
* ```
|
|
2069
2070
|
*/
|
|
2070
|
-
export declare function readSurfaceClaims(root: string, loader?: SurfaceLoader): readonly
|
|
2071
|
+
export declare function readSurfaceClaims(root: string, loader?: SurfaceLoader): readonly SurfaceContract[];
|
|
2071
2072
|
|
|
2072
2073
|
/**
|
|
2073
2074
|
* Reads bare Surface names claimed by distinct package guides.
|
|
@@ -2111,7 +2112,7 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2111
2112
|
* readSurfaceFile('.', 'scaffold', 'candidate')?.names // the names the checkout's guide claims
|
|
2112
2113
|
* ```
|
|
2113
2114
|
*/
|
|
2114
|
-
export declare function readSurfaceFile(root: string | Host, owner: string, label: string, loader?: SurfaceLoader):
|
|
2115
|
+
export declare function readSurfaceFile(root: string | Host, owner: string, label: string, loader?: SurfaceLoader): SurfaceContract | undefined;
|
|
2115
2116
|
|
|
2116
2117
|
/**
|
|
2117
2118
|
* Reads one guide's claims and reports parser refusals with its owner and source.
|
|
@@ -2122,10 +2123,10 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2122
2123
|
* @example
|
|
2123
2124
|
* ```ts
|
|
2124
2125
|
* import { readSurfaceGuide } from '@orkestrel/scaffold/server'
|
|
2125
|
-
* readSurfaceGuide('# Sample', 'sample', 'live guides/sample.md') // { owner: 'sample', names: [] }
|
|
2126
|
+
* readSurfaceGuide('# Sample', 'sample', 'live guides/sample.md') // { owner: 'sample', names: [], signatures: new Map() }
|
|
2126
2127
|
* ```
|
|
2127
2128
|
*/
|
|
2128
|
-
export declare function readSurfaceGuide(text: string, owner: string, source: string, loader?: SurfaceLoader):
|
|
2129
|
+
export declare function readSurfaceGuide(text: string, owner: string, source: string, loader?: SurfaceLoader): SurfaceContract;
|
|
2129
2130
|
|
|
2130
2131
|
/**
|
|
2131
2132
|
* Loads and validates the guide functions required by surface reflection.
|
|
@@ -2330,8 +2331,9 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2330
2331
|
* host root is not vacant, the checkout does not carry every vendored path, two
|
|
2331
2332
|
* vendored files claim one storage name, a vendored file is not a plain file
|
|
2332
2333
|
* within the artifact ceiling, published guides are unreadable, a staged
|
|
2333
|
-
* collision's owner set is not a subset of its published owner set,
|
|
2334
|
-
* `
|
|
2334
|
+
* collision's owner set is not a subset of its published owner set, a
|
|
2335
|
+
* `SURFACE_TRANSFERS` entry is spent because its keeper alone claims the name, the
|
|
2336
|
+
* inventory is absent without `establish: true`, or the staged manifest does not read back.
|
|
2335
2337
|
* @throws `ScaffoldError('WRITE', …)` when a staged file or the manifest cannot
|
|
2336
2338
|
* be written.
|
|
2337
2339
|
*
|
|
@@ -2367,7 +2369,10 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2367
2369
|
* the canon and reference files for reading. Every catalog package must have a
|
|
2368
2370
|
* guide in the discovered membership before the host is written.
|
|
2369
2371
|
* Copied guides must carry no collision whose name and exact owner set the
|
|
2370
|
-
* committed inventory lacks.
|
|
2372
|
+
* committed inventory lacks. A `SURFACE_TRANSFERS` entry that another guide claims
|
|
2373
|
+
* admits its keeper beside the recorded owners, or beside the one owner of a name
|
|
2374
|
+
* the inventory lacks, and the staged surface records that keeper whether or not
|
|
2375
|
+
* its guide is mirrored. An absent inventory requires `establish: true`;
|
|
2371
2376
|
* an inventory without a valid recorded Surface is refused.
|
|
2372
2377
|
* Everything downstream — the missing-path refusal, the
|
|
2373
2378
|
* storage collision guard, the sort, the digests, and the root inventory — reads
|
|
@@ -2428,6 +2433,7 @@ export declare class Materializer implements MaterializerInterface {
|
|
|
2428
2433
|
readonly createGuide: (text: string) => {
|
|
2429
2434
|
readonly surface: () => ReadonlyArray<{
|
|
2430
2435
|
readonly name: string;
|
|
2436
|
+
readonly signature?: string;
|
|
2431
2437
|
}>;
|
|
2432
2438
|
};
|
|
2433
2439
|
readonly createSource: (options: {
|
package/dist/src/server/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { andOf, arrayOf, attempt, boundsOf, compareValues, compileGuard, holds, isArray, isBoolean, isDefined, isError, isFunction, isInteger, isNonNegativeInteger, isNumber, isObject, isRecord, isString, parseJSON, parseJSONAs, parseStringField, recordOf, recordShape, stringOf, stringShape, unionOf, whereOf } from "@orkestrel/contract";
|
|
3
|
-
import { CANON_PATHS, CATALOG_AGENT_PATH, CATALOG_END_MARKER, CATALOG_START_MARKER, CONTROL_CHARACTER_PATTERN, DEPENDENCY_NAME_PATTERN, EXECUTABLE_PATHS, HOST_INVENTORY_PATH, HOST_PATHS, MAX_ARTIFACT_BYTES, MAX_COLLECTION_ITEMS, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_REGISTRY_BYTES, MAX_TOTAL_ARTIFACT_BYTES, MAX_TOTAL_REGISTRY_BYTES, REFERENCE_PATHS, ScaffoldError, bytesToHex, catalogToLayers, cloneValue, collectSurfaceCollisions, collectSurfaceConflicts, compareSurfaceCollisions, compareVersions, computeBytes, computeTotal, contentToHex, extractRangeMajor, extractVersion, inferGroup, insertManifestDependencies, isAudit, isCatalogEntry, isCollection, isDependency, isDependencyName, isFloorPath, isHex, isManifestScript, isMirror, isPath, isPlan, isRetainedPath, isSnapshot, iterateAnswers, manifestToName, matchesDriftReachability, matchesRange, nameToGuide, planToFindings, renderSkillPointer, replaceManifestOverrides, replaceManifestRanges, replaceManifestScripts } from "../core/index.js";
|
|
3
|
+
import { CANON_PATHS, CATALOG_AGENT_PATH, CATALOG_END_MARKER, CATALOG_START_MARKER, CONTROL_CHARACTER_PATTERN, DEPENDENCY_NAME_PATTERN, EXECUTABLE_PATHS, HOST_INVENTORY_PATH, HOST_PATHS, MAX_ARTIFACT_BYTES, MAX_COLLECTION_ITEMS, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_REGISTRY_BYTES, MAX_TOTAL_ARTIFACT_BYTES, MAX_TOTAL_REGISTRY_BYTES, REFERENCE_PATHS, SURFACE_TRANSFERS, ScaffoldError, bytesToHex, catalogToLayers, cloneValue, collectSurfaceCollisions, collectSurfaceConflicts, compareSurfaceCollisions, compareVersions, computeBytes, computeTotal, contentToHex, extractRangeMajor, extractVersion, inferGroup, insertManifestDependencies, isAudit, isCatalogEntry, isCollection, isDependency, isDependencyName, isFloorPath, isHex, isManifestScript, isMirror, isPath, isPlan, isRetainedPath, isSnapshot, iterateAnswers, manifestToName, matchesDriftReachability, matchesRange, nameToGuide, planToFindings, renderSkillPointer, replaceManifestOverrides, replaceManifestRanges, replaceManifestScripts } from "../core/index.js";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
5
|
import { chmodSync, closeSync, constants, copyFileSync, fstatSync, linkSync, lstatSync, mkdirSync, mkdtempSync, openSync, opendirSync, readSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, rmdirSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { tmpdir } from "node:os";
|
|
@@ -1491,8 +1491,9 @@ function stageBytes(host, root, destinations) {
|
|
|
1491
1491
|
* host root is not vacant, the checkout does not carry every vendored path, two
|
|
1492
1492
|
* vendored files claim one storage name, a vendored file is not a plain file
|
|
1493
1493
|
* within the artifact ceiling, published guides are unreadable, a staged
|
|
1494
|
-
* collision's owner set is not a subset of its published owner set,
|
|
1495
|
-
* `
|
|
1494
|
+
* collision's owner set is not a subset of its published owner set, a
|
|
1495
|
+
* `SURFACE_TRANSFERS` entry is spent because its keeper alone claims the name, the
|
|
1496
|
+
* inventory is absent without `establish: true`, or the staged manifest does not read back.
|
|
1496
1497
|
* @throws `ScaffoldError('WRITE', …)` when a staged file or the manifest cannot
|
|
1497
1498
|
* be written.
|
|
1498
1499
|
*
|
|
@@ -1528,7 +1529,10 @@ function stageBytes(host, root, destinations) {
|
|
|
1528
1529
|
* the canon and reference files for reading. Every catalog package must have a
|
|
1529
1530
|
* guide in the discovered membership before the host is written.
|
|
1530
1531
|
* Copied guides must carry no collision whose name and exact owner set the
|
|
1531
|
-
* committed inventory lacks.
|
|
1532
|
+
* committed inventory lacks. A `SURFACE_TRANSFERS` entry that another guide claims
|
|
1533
|
+
* admits its keeper beside the recorded owners, or beside the one owner of a name
|
|
1534
|
+
* the inventory lacks, and the staged surface records that keeper whether or not
|
|
1535
|
+
* its guide is mirrored. An absent inventory requires `establish: true`;
|
|
1532
1536
|
* an inventory without a valid recorded Surface is refused.
|
|
1533
1537
|
* Everything downstream — the missing-path refusal, the
|
|
1534
1538
|
* storage collision guard, the sort, the digests, and the root inventory — reads
|
|
@@ -1669,29 +1673,48 @@ function stageHost(checkout, host, options) {
|
|
|
1669
1673
|
digest
|
|
1670
1674
|
};
|
|
1671
1675
|
});
|
|
1672
|
-
const
|
|
1673
|
-
const
|
|
1676
|
+
const claims = readSurfaceClaims(join(root, "guides"));
|
|
1677
|
+
const claimants = Map.groupBy(claims.flatMap(({ owner, names }) => names.map((name) => ({
|
|
1674
1678
|
name,
|
|
1675
|
-
|
|
1676
|
-
})),
|
|
1679
|
+
owner
|
|
1680
|
+
}))), ({ name }) => name);
|
|
1681
|
+
const transfers = SURFACE_TRANSFERS.map((transfer) => {
|
|
1682
|
+
const owners = new Set(claimants.get(transfer.name)?.map(({ owner }) => owner));
|
|
1683
|
+
return {
|
|
1684
|
+
...transfer,
|
|
1685
|
+
claimed: owners.has(transfer.keeper),
|
|
1686
|
+
givers: [...owners].filter((owner) => owner !== transfer.keeper).sort()
|
|
1687
|
+
};
|
|
1688
|
+
});
|
|
1689
|
+
const spent = transfers.filter(({ claimed, givers }) => claimed && givers.length === 0).map(({ name, keeper, item }) => `${name} to ${keeper} under item ${item}`);
|
|
1690
|
+
if (spent.length > 0) throw new ScaffoldError("TARGET", `Surface transfers are spent, so remove them from SURFACE_TRANSFERS: ${spent.join("; ")}`, {
|
|
1691
|
+
checkout: source,
|
|
1692
|
+
host: root,
|
|
1693
|
+
transfers: spent
|
|
1694
|
+
});
|
|
1695
|
+
const active = transfers.filter(({ givers }) => givers.length > 0);
|
|
1696
|
+
const collisions = collectSurfaceCollisions([...claims, ...active.map(({ name, keeper }) => ({
|
|
1697
|
+
owner: keeper,
|
|
1698
|
+
names: [name]
|
|
1699
|
+
}))]);
|
|
1700
|
+
const growth = published === void 0 ? [] : compareSurfaceCollisions(collisions, [...new Map([...published, ...active.map(({ name, keeper, givers }) => [name, [...published.get(name) ?? (givers.length === 1 ? givers : []), keeper]])])].map(([name, owners]) => ({
|
|
1677
1701
|
name,
|
|
1678
1702
|
owners
|
|
1679
|
-
}))).filter(({ standing }) => standing === "error").map(({ name, owners }) =>
|
|
1703
|
+
}))).filter(({ standing }) => standing === "error").map(({ name, owners }) => {
|
|
1704
|
+
const keeper = active.find((transfer) => transfer.name === name)?.keeper;
|
|
1705
|
+
return `${name} staged (${owners.join(", ")}), recorded (${published.get(name)?.join(", ") ?? "absent"})${keeper === void 0 ? "" : `, transferred to ${keeper}`}`;
|
|
1706
|
+
});
|
|
1680
1707
|
if (growth.length > 0) throw new ScaffoldError("TARGET", `Staged Surface collisions differ from the inventory: ${growth.join("; ")}`, {
|
|
1681
1708
|
checkout: source,
|
|
1682
1709
|
host: root,
|
|
1683
1710
|
baseline,
|
|
1684
1711
|
collisions: growth
|
|
1685
1712
|
});
|
|
1686
|
-
const surface = [...collisions].map(([name, owners]) => ({
|
|
1687
|
-
name,
|
|
1688
|
-
owners
|
|
1689
|
-
}));
|
|
1690
1713
|
const manifest = {
|
|
1691
1714
|
entries,
|
|
1692
1715
|
roots,
|
|
1693
|
-
surface,
|
|
1694
|
-
digest: computeManifestDigest(entries, roots,
|
|
1716
|
+
surface: collisions,
|
|
1717
|
+
digest: computeManifestDigest(entries, roots, collisions)
|
|
1695
1718
|
};
|
|
1696
1719
|
const metadata = resolveContainedPath(root, MANIFEST_NAME);
|
|
1697
1720
|
if (metadata === void 0) throw new ScaffoldError("INVALID", `Host manifest leaves its root at ${root}`, { host: root });
|
|
@@ -1769,15 +1792,16 @@ function readSurfaceModule(loader = createRequire(import.meta.url)) {
|
|
|
1769
1792
|
* @example
|
|
1770
1793
|
* ```ts
|
|
1771
1794
|
* import { readSurfaceGuide } from '@orkestrel/scaffold/server'
|
|
1772
|
-
* readSurfaceGuide('# Sample', 'sample', 'live guides/sample.md') // { owner: 'sample', names: [] }
|
|
1795
|
+
* readSurfaceGuide('# Sample', 'sample', 'live guides/sample.md') // { owner: 'sample', names: [], signatures: new Map() }
|
|
1773
1796
|
* ```
|
|
1774
1797
|
*/
|
|
1775
1798
|
function readSurfaceGuide(text, owner, source, loader) {
|
|
1776
1799
|
const guide = readSurfaceModule(loader);
|
|
1777
|
-
const parsed = attempt(() => guide.createGuide(text).surface()
|
|
1800
|
+
const parsed = attempt(() => guide.createGuide(text).surface());
|
|
1778
1801
|
if (parsed.success) return {
|
|
1779
1802
|
owner,
|
|
1780
|
-
names: parsed.value
|
|
1803
|
+
names: parsed.value.map(({ name }) => name),
|
|
1804
|
+
signatures: new Map(parsed.value.flatMap(({ name, signature }) => isString(signature) ? [[name, signature]] : []))
|
|
1781
1805
|
};
|
|
1782
1806
|
if (!guide.isGuideError(parsed.error)) throw parsed.error;
|
|
1783
1807
|
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}`, {
|
|
@@ -1866,6 +1890,7 @@ function readSurfaceCandidate(root, loader) {
|
|
|
1866
1890
|
return {
|
|
1867
1891
|
owner,
|
|
1868
1892
|
names: [.../* @__PURE__ */ new Set([...guide?.names ?? [], ...Object.values(exports).flat()])].sort(),
|
|
1893
|
+
signatures: guide?.signatures ?? /* @__PURE__ */ new Map(),
|
|
1869
1894
|
conflicts: collectSurfaceConflicts(owner, exports)
|
|
1870
1895
|
};
|
|
1871
1896
|
}
|