@orkestrel/scaffold 0.0.117 → 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 +42 -15
- package/dist/bin/main.js.map +1 -1
- package/dist/host/agents/skills/orkestrel-publish/references/wave.md +1 -0
- package/dist/host/guides/scaffold.md +60 -22
- package/dist/host/manifest.json +3 -3
- package/dist/src/core/index.cjs +124 -1
- 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 +120 -2
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +5 -3
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +6 -5
- package/dist/src/server/index.d.ts +6 -5
- package/dist/src/server/index.js +5 -3
- package/dist/src/server/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1245,6 +1245,35 @@ export declare function catalogToLayers(entries: readonly CatalogEntry[]): Reado
|
|
|
1245
1245
|
*/
|
|
1246
1246
|
export declare function cloneValue(value: unknown): JSONValue | undefined;
|
|
1247
1247
|
|
|
1248
|
+
/**
|
|
1249
|
+
* Collects the near names and equal contracts other owners claim beside each name a candidate adds.
|
|
1250
|
+
*
|
|
1251
|
+
* @param candidate - The candidate owner's contract.
|
|
1252
|
+
* @param published - The names the candidate owner's published guide claims; empty when none.
|
|
1253
|
+
* @param contracts - Every owner's contract; the candidate owner's own entry is skipped.
|
|
1254
|
+
* @returns One advisory per added name, peer, and class, sorted by added name, peer owner, and peer
|
|
1255
|
+
* name, with a spelling class before `signature`.
|
|
1256
|
+
*
|
|
1257
|
+
* @remarks
|
|
1258
|
+
* An added name is one `candidate` claims and `published` does not. A spelling class comes from
|
|
1259
|
+
* `inferSurfaceSimilarity`; `signature` holds when both names carry equal cells that
|
|
1260
|
+
* `matchesSurfaceStructure` accepts. A name equal to the added name is a collision, not an
|
|
1261
|
+
* advisory.
|
|
1262
|
+
*
|
|
1263
|
+
* @example
|
|
1264
|
+
* ```ts
|
|
1265
|
+
* import { collectSurfaceAdvisories } from '@orkestrel/scaffold'
|
|
1266
|
+
*
|
|
1267
|
+
* const advisories = collectSurfaceAdvisories(
|
|
1268
|
+
* { owner: 'alpha', names: ['Routes'], signatures: new Map() },
|
|
1269
|
+
* [],
|
|
1270
|
+
* [{ owner: 'router', names: ['Route'], signatures: new Map() }],
|
|
1271
|
+
* )
|
|
1272
|
+
* advisories[0]?.similarity // 'plural'
|
|
1273
|
+
* ```
|
|
1274
|
+
*/
|
|
1275
|
+
export declare function collectSurfaceAdvisories(candidate: SurfaceContract, published: readonly string[], contracts: readonly SurfaceContract[]): readonly SurfaceAdvisory[];
|
|
1276
|
+
|
|
1248
1277
|
/**
|
|
1249
1278
|
* Collects bare names claimed by distinct owners in sorted order.
|
|
1250
1279
|
*
|
|
@@ -2258,6 +2287,25 @@ export declare class Compiler implements CompilerInterface {
|
|
|
2258
2287
|
*/
|
|
2259
2288
|
export declare function inferGroup(path: string): Group;
|
|
2260
2289
|
|
|
2290
|
+
/**
|
|
2291
|
+
* Infers how two different names resemble each other by spelling.
|
|
2292
|
+
*
|
|
2293
|
+
* @returns The first class that holds, or `undefined` when none does or the names are equal.
|
|
2294
|
+
*
|
|
2295
|
+
* @remarks
|
|
2296
|
+
* Reads, in order, a case-fold twin, a singular or plural form (`s`, `es`, or `y` to `ies`), and
|
|
2297
|
+
* one insertion, deletion, or substitution of a code unit when both names hold at least
|
|
2298
|
+
* `SURFACE_EDIT_LENGTH` characters. Never returns `signature`, which compares cells.
|
|
2299
|
+
*
|
|
2300
|
+
* @example
|
|
2301
|
+
* ```ts
|
|
2302
|
+
* import { inferSurfaceSimilarity } from '@orkestrel/scaffold'
|
|
2303
|
+
*
|
|
2304
|
+
* inferSurfaceSimilarity('Route', 'Routes') // 'plural'
|
|
2305
|
+
* ```
|
|
2306
|
+
*/
|
|
2307
|
+
export declare function inferSurfaceSimilarity(name: string, other: string): SurfaceSimilarity | undefined;
|
|
2308
|
+
|
|
2261
2309
|
/**
|
|
2262
2310
|
* Inserts dependencies a package manifest does not declare into the section each one names.
|
|
2263
2311
|
*
|
|
@@ -3082,6 +3130,21 @@ export declare class Compiler implements CompilerInterface {
|
|
|
3082
3130
|
*/
|
|
3083
3131
|
export declare function matchesEngines(engines: string): boolean;
|
|
3084
3132
|
|
|
3133
|
+
/**
|
|
3134
|
+
* Checks whether an error is the `TARGET` refusal a surface reader raises for a guide its parser
|
|
3135
|
+
* refuses, which carries the parser's code in its context.
|
|
3136
|
+
*
|
|
3137
|
+
* @returns True if the error is that refusal; false otherwise.
|
|
3138
|
+
*
|
|
3139
|
+
* @example
|
|
3140
|
+
* ```ts
|
|
3141
|
+
* import { matchesGuideRefusal, ScaffoldError } from '@orkestrel/scaffold'
|
|
3142
|
+
*
|
|
3143
|
+
* matchesGuideRefusal(new ScaffoldError('TARGET', 'Refused', { code: 'header' })) // true
|
|
3144
|
+
* ```
|
|
3145
|
+
*/
|
|
3146
|
+
export declare function matchesGuideRefusal(error: unknown): boolean;
|
|
3147
|
+
|
|
3085
3148
|
/**
|
|
3086
3149
|
* Tests whether a path instructs or wires an agent rather than the toolchain.
|
|
3087
3150
|
*
|
|
@@ -3174,6 +3237,26 @@ export declare class Compiler implements CompilerInterface {
|
|
|
3174
3237
|
*/
|
|
3175
3238
|
export declare function matchesRange(range: string, latest: string): boolean;
|
|
3176
3239
|
|
|
3240
|
+
/**
|
|
3241
|
+
* Checks whether a guide `Signature` cell spells a structure rather than a literal or a type name.
|
|
3242
|
+
*
|
|
3243
|
+
* @returns True if the cell is one code span that opens with a member list holding at least one
|
|
3244
|
+
* member, its array and union forms included; false otherwise.
|
|
3245
|
+
*
|
|
3246
|
+
* @remarks
|
|
3247
|
+
* A literal (`2000`, `" "`, `'live' | 'floor'`), a bare primitive (`string`), a type reference
|
|
3248
|
+
* (`RegExp`, `Guard<string>`, `readonly string[]`), a function type, an empty member list, and
|
|
3249
|
+
* prose are no structure: two names sharing one of those share a type, not a contract.
|
|
3250
|
+
*
|
|
3251
|
+
* @example
|
|
3252
|
+
* ```ts
|
|
3253
|
+
* import { matchesSurfaceStructure } from '@orkestrel/scaffold'
|
|
3254
|
+
*
|
|
3255
|
+
* matchesSurfaceStructure('`{ owner, names }`') // true
|
|
3256
|
+
* ```
|
|
3257
|
+
*/
|
|
3258
|
+
export declare function matchesSurfaceStructure(signature: string): boolean;
|
|
3259
|
+
|
|
3177
3260
|
/** Caps the bytes accepted for one artifact. */
|
|
3178
3261
|
export declare const MAX_ARTIFACT_BYTES = 5242880;
|
|
3179
3262
|
|
|
@@ -4171,8 +4254,27 @@ export declare class Compiler implements CompilerInterface {
|
|
|
4171
4254
|
/** Names the surface an extension extends. */
|
|
4172
4255
|
export declare type Surface = 'browser' | 'styles';
|
|
4173
4256
|
|
|
4174
|
-
/**
|
|
4175
|
-
export declare
|
|
4257
|
+
/** Sets the shortest name length at which a one-edit neighbor counts as a near name. */
|
|
4258
|
+
export declare const SURFACE_EDIT_LENGTH = 6;
|
|
4259
|
+
|
|
4260
|
+
/**
|
|
4261
|
+
* Reports a name a candidate adds beside a near name or an equal contract another owner claims.
|
|
4262
|
+
*
|
|
4263
|
+
* @remarks
|
|
4264
|
+
* `name` and `owner` are the candidate's; `peer` is the other owner's claimed name.
|
|
4265
|
+
*/
|
|
4266
|
+
export declare interface SurfaceAdvisory {
|
|
4267
|
+
readonly name: string;
|
|
4268
|
+
readonly owner: string;
|
|
4269
|
+
readonly peer: {
|
|
4270
|
+
readonly name: string;
|
|
4271
|
+
readonly owner: string;
|
|
4272
|
+
};
|
|
4273
|
+
readonly similarity: SurfaceSimilarity;
|
|
4274
|
+
}
|
|
4275
|
+
|
|
4276
|
+
/** Represents a candidate checkout's contract with each name two or more of its environments export. */
|
|
4277
|
+
export declare interface SurfaceCandidate extends SurfaceContract {
|
|
4176
4278
|
readonly conflicts: readonly SurfaceConflict[];
|
|
4177
4279
|
}
|
|
4178
4280
|
|
|
@@ -4195,6 +4297,16 @@ export declare class Compiler implements CompilerInterface {
|
|
|
4195
4297
|
readonly environments: readonly string[];
|
|
4196
4298
|
}
|
|
4197
4299
|
|
|
4300
|
+
/**
|
|
4301
|
+
* Represents one owner's claim with the guide `Signature` cell of each name a Surface row documents.
|
|
4302
|
+
*
|
|
4303
|
+
* @remarks
|
|
4304
|
+
* `signatures` maps a claimed name to its cell; a name only a barrel claims has no entry.
|
|
4305
|
+
*/
|
|
4306
|
+
export declare interface SurfaceContract extends SurfaceClaim {
|
|
4307
|
+
readonly signatures: ReadonlyMap<string, string>;
|
|
4308
|
+
}
|
|
4309
|
+
|
|
4198
4310
|
/** Reports a collision's standing against the recorded owner set. */
|
|
4199
4311
|
export declare interface SurfaceFinding extends SurfaceCollision {
|
|
4200
4312
|
readonly standing: 'error' | 'recorded' | 'closed';
|
|
@@ -4203,6 +4315,15 @@ export declare class Compiler implements CompilerInterface {
|
|
|
4203
4315
|
/** Lists the surfaces an extension may extend, frozen. */
|
|
4204
4316
|
export declare const SURFACES: readonly Surface[];
|
|
4205
4317
|
|
|
4318
|
+
/**
|
|
4319
|
+
* Names how an added name resembles a name another owner claims.
|
|
4320
|
+
*
|
|
4321
|
+
* @remarks
|
|
4322
|
+
* `case` is a case-fold twin, `plural` a singular or plural form, `edit` a name one insertion,
|
|
4323
|
+
* deletion, or substitution away, and `signature` a different name with an equal structure cell.
|
|
4324
|
+
*/
|
|
4325
|
+
export declare type SurfaceSimilarity = 'case' | 'plural' | 'edit' | 'signature';
|
|
4326
|
+
|
|
4206
4327
|
/** Sets the columns one tab occupies when the formatter measures a line, matching `tabWidth`. */
|
|
4207
4328
|
export declare const TAB_WIDTH = 2;
|
|
4208
4329
|
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -1245,6 +1245,35 @@ export declare function catalogToLayers(entries: readonly CatalogEntry[]): Reado
|
|
|
1245
1245
|
*/
|
|
1246
1246
|
export declare function cloneValue(value: unknown): JSONValue | undefined;
|
|
1247
1247
|
|
|
1248
|
+
/**
|
|
1249
|
+
* Collects the near names and equal contracts other owners claim beside each name a candidate adds.
|
|
1250
|
+
*
|
|
1251
|
+
* @param candidate - The candidate owner's contract.
|
|
1252
|
+
* @param published - The names the candidate owner's published guide claims; empty when none.
|
|
1253
|
+
* @param contracts - Every owner's contract; the candidate owner's own entry is skipped.
|
|
1254
|
+
* @returns One advisory per added name, peer, and class, sorted by added name, peer owner, and peer
|
|
1255
|
+
* name, with a spelling class before `signature`.
|
|
1256
|
+
*
|
|
1257
|
+
* @remarks
|
|
1258
|
+
* An added name is one `candidate` claims and `published` does not. A spelling class comes from
|
|
1259
|
+
* `inferSurfaceSimilarity`; `signature` holds when both names carry equal cells that
|
|
1260
|
+
* `matchesSurfaceStructure` accepts. A name equal to the added name is a collision, not an
|
|
1261
|
+
* advisory.
|
|
1262
|
+
*
|
|
1263
|
+
* @example
|
|
1264
|
+
* ```ts
|
|
1265
|
+
* import { collectSurfaceAdvisories } from '@orkestrel/scaffold'
|
|
1266
|
+
*
|
|
1267
|
+
* const advisories = collectSurfaceAdvisories(
|
|
1268
|
+
* { owner: 'alpha', names: ['Routes'], signatures: new Map() },
|
|
1269
|
+
* [],
|
|
1270
|
+
* [{ owner: 'router', names: ['Route'], signatures: new Map() }],
|
|
1271
|
+
* )
|
|
1272
|
+
* advisories[0]?.similarity // 'plural'
|
|
1273
|
+
* ```
|
|
1274
|
+
*/
|
|
1275
|
+
export declare function collectSurfaceAdvisories(candidate: SurfaceContract, published: readonly string[], contracts: readonly SurfaceContract[]): readonly SurfaceAdvisory[];
|
|
1276
|
+
|
|
1248
1277
|
/**
|
|
1249
1278
|
* Collects bare names claimed by distinct owners in sorted order.
|
|
1250
1279
|
*
|
|
@@ -2258,6 +2287,25 @@ export declare class Compiler implements CompilerInterface {
|
|
|
2258
2287
|
*/
|
|
2259
2288
|
export declare function inferGroup(path: string): Group;
|
|
2260
2289
|
|
|
2290
|
+
/**
|
|
2291
|
+
* Infers how two different names resemble each other by spelling.
|
|
2292
|
+
*
|
|
2293
|
+
* @returns The first class that holds, or `undefined` when none does or the names are equal.
|
|
2294
|
+
*
|
|
2295
|
+
* @remarks
|
|
2296
|
+
* Reads, in order, a case-fold twin, a singular or plural form (`s`, `es`, or `y` to `ies`), and
|
|
2297
|
+
* one insertion, deletion, or substitution of a code unit when both names hold at least
|
|
2298
|
+
* `SURFACE_EDIT_LENGTH` characters. Never returns `signature`, which compares cells.
|
|
2299
|
+
*
|
|
2300
|
+
* @example
|
|
2301
|
+
* ```ts
|
|
2302
|
+
* import { inferSurfaceSimilarity } from '@orkestrel/scaffold'
|
|
2303
|
+
*
|
|
2304
|
+
* inferSurfaceSimilarity('Route', 'Routes') // 'plural'
|
|
2305
|
+
* ```
|
|
2306
|
+
*/
|
|
2307
|
+
export declare function inferSurfaceSimilarity(name: string, other: string): SurfaceSimilarity | undefined;
|
|
2308
|
+
|
|
2261
2309
|
/**
|
|
2262
2310
|
* Inserts dependencies a package manifest does not declare into the section each one names.
|
|
2263
2311
|
*
|
|
@@ -3082,6 +3130,21 @@ export declare class Compiler implements CompilerInterface {
|
|
|
3082
3130
|
*/
|
|
3083
3131
|
export declare function matchesEngines(engines: string): boolean;
|
|
3084
3132
|
|
|
3133
|
+
/**
|
|
3134
|
+
* Checks whether an error is the `TARGET` refusal a surface reader raises for a guide its parser
|
|
3135
|
+
* refuses, which carries the parser's code in its context.
|
|
3136
|
+
*
|
|
3137
|
+
* @returns True if the error is that refusal; false otherwise.
|
|
3138
|
+
*
|
|
3139
|
+
* @example
|
|
3140
|
+
* ```ts
|
|
3141
|
+
* import { matchesGuideRefusal, ScaffoldError } from '@orkestrel/scaffold'
|
|
3142
|
+
*
|
|
3143
|
+
* matchesGuideRefusal(new ScaffoldError('TARGET', 'Refused', { code: 'header' })) // true
|
|
3144
|
+
* ```
|
|
3145
|
+
*/
|
|
3146
|
+
export declare function matchesGuideRefusal(error: unknown): boolean;
|
|
3147
|
+
|
|
3085
3148
|
/**
|
|
3086
3149
|
* Tests whether a path instructs or wires an agent rather than the toolchain.
|
|
3087
3150
|
*
|
|
@@ -3174,6 +3237,26 @@ export declare class Compiler implements CompilerInterface {
|
|
|
3174
3237
|
*/
|
|
3175
3238
|
export declare function matchesRange(range: string, latest: string): boolean;
|
|
3176
3239
|
|
|
3240
|
+
/**
|
|
3241
|
+
* Checks whether a guide `Signature` cell spells a structure rather than a literal or a type name.
|
|
3242
|
+
*
|
|
3243
|
+
* @returns True if the cell is one code span that opens with a member list holding at least one
|
|
3244
|
+
* member, its array and union forms included; false otherwise.
|
|
3245
|
+
*
|
|
3246
|
+
* @remarks
|
|
3247
|
+
* A literal (`2000`, `" "`, `'live' | 'floor'`), a bare primitive (`string`), a type reference
|
|
3248
|
+
* (`RegExp`, `Guard<string>`, `readonly string[]`), a function type, an empty member list, and
|
|
3249
|
+
* prose are no structure: two names sharing one of those share a type, not a contract.
|
|
3250
|
+
*
|
|
3251
|
+
* @example
|
|
3252
|
+
* ```ts
|
|
3253
|
+
* import { matchesSurfaceStructure } from '@orkestrel/scaffold'
|
|
3254
|
+
*
|
|
3255
|
+
* matchesSurfaceStructure('`{ owner, names }`') // true
|
|
3256
|
+
* ```
|
|
3257
|
+
*/
|
|
3258
|
+
export declare function matchesSurfaceStructure(signature: string): boolean;
|
|
3259
|
+
|
|
3177
3260
|
/** Caps the bytes accepted for one artifact. */
|
|
3178
3261
|
export declare const MAX_ARTIFACT_BYTES = 5242880;
|
|
3179
3262
|
|
|
@@ -4171,8 +4254,27 @@ export declare class Compiler implements CompilerInterface {
|
|
|
4171
4254
|
/** Names the surface an extension extends. */
|
|
4172
4255
|
export declare type Surface = 'browser' | 'styles';
|
|
4173
4256
|
|
|
4174
|
-
/**
|
|
4175
|
-
export declare
|
|
4257
|
+
/** Sets the shortest name length at which a one-edit neighbor counts as a near name. */
|
|
4258
|
+
export declare const SURFACE_EDIT_LENGTH = 6;
|
|
4259
|
+
|
|
4260
|
+
/**
|
|
4261
|
+
* Reports a name a candidate adds beside a near name or an equal contract another owner claims.
|
|
4262
|
+
*
|
|
4263
|
+
* @remarks
|
|
4264
|
+
* `name` and `owner` are the candidate's; `peer` is the other owner's claimed name.
|
|
4265
|
+
*/
|
|
4266
|
+
export declare interface SurfaceAdvisory {
|
|
4267
|
+
readonly name: string;
|
|
4268
|
+
readonly owner: string;
|
|
4269
|
+
readonly peer: {
|
|
4270
|
+
readonly name: string;
|
|
4271
|
+
readonly owner: string;
|
|
4272
|
+
};
|
|
4273
|
+
readonly similarity: SurfaceSimilarity;
|
|
4274
|
+
}
|
|
4275
|
+
|
|
4276
|
+
/** Represents a candidate checkout's contract with each name two or more of its environments export. */
|
|
4277
|
+
export declare interface SurfaceCandidate extends SurfaceContract {
|
|
4176
4278
|
readonly conflicts: readonly SurfaceConflict[];
|
|
4177
4279
|
}
|
|
4178
4280
|
|
|
@@ -4195,6 +4297,16 @@ export declare class Compiler implements CompilerInterface {
|
|
|
4195
4297
|
readonly environments: readonly string[];
|
|
4196
4298
|
}
|
|
4197
4299
|
|
|
4300
|
+
/**
|
|
4301
|
+
* Represents one owner's claim with the guide `Signature` cell of each name a Surface row documents.
|
|
4302
|
+
*
|
|
4303
|
+
* @remarks
|
|
4304
|
+
* `signatures` maps a claimed name to its cell; a name only a barrel claims has no entry.
|
|
4305
|
+
*/
|
|
4306
|
+
export declare interface SurfaceContract extends SurfaceClaim {
|
|
4307
|
+
readonly signatures: ReadonlyMap<string, string>;
|
|
4308
|
+
}
|
|
4309
|
+
|
|
4198
4310
|
/** Reports a collision's standing against the recorded owner set. */
|
|
4199
4311
|
export declare interface SurfaceFinding extends SurfaceCollision {
|
|
4200
4312
|
readonly standing: 'error' | 'recorded' | 'closed';
|
|
@@ -4203,6 +4315,15 @@ export declare class Compiler implements CompilerInterface {
|
|
|
4203
4315
|
/** Lists the surfaces an extension may extend, frozen. */
|
|
4204
4316
|
export declare const SURFACES: readonly Surface[];
|
|
4205
4317
|
|
|
4318
|
+
/**
|
|
4319
|
+
* Names how an added name resembles a name another owner claims.
|
|
4320
|
+
*
|
|
4321
|
+
* @remarks
|
|
4322
|
+
* `case` is a case-fold twin, `plural` a singular or plural form, `edit` a name one insertion,
|
|
4323
|
+
* deletion, or substitution away, and `signature` a different name with an equal structure cell.
|
|
4324
|
+
*/
|
|
4325
|
+
export declare type SurfaceSimilarity = 'case' | 'plural' | 'edit' | 'signature';
|
|
4326
|
+
|
|
4206
4327
|
/** Sets the columns one tab occupies when the formatter measures a line, matching `tabWidth`. */
|
|
4207
4328
|
export declare const TAB_WIDTH = 2;
|
|
4208
4329
|
|
package/dist/src/core/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { fillTemplate } from "@orkestrel/template";
|
|
|
3
3
|
import { Emitter } from "@orkestrel/emitter";
|
|
4
4
|
var package_default = {
|
|
5
5
|
name: "@orkestrel/scaffold",
|
|
6
|
-
version: "0.0.
|
|
6
|
+
version: "0.0.118",
|
|
7
7
|
description: "Scaffold workspaces with commands: new, audit, surface, repair, catalog, and overwrite.",
|
|
8
8
|
keywords: [
|
|
9
9
|
"audit",
|
|
@@ -599,6 +599,8 @@ var MAX_RANGE_LENGTH = 2048;
|
|
|
599
599
|
var MAX_SCRIPT_LENGTH = 4096;
|
|
600
600
|
/** Caps the length of one path, matching the longest a supported filesystem accepts. */
|
|
601
601
|
var MAX_PATH_LENGTH = 32767;
|
|
602
|
+
/** Sets the shortest name length at which a one-edit neighbor counts as a near name. */
|
|
603
|
+
var SURFACE_EDIT_LENGTH = 6;
|
|
602
604
|
/** Caps the items accepted in one public collection. */
|
|
603
605
|
var MAX_COLLECTION_ITEMS = 1e3;
|
|
604
606
|
/** Caps the columns one emitted line may occupy, matching `printWidth` in `.oxfmtrc.json`. */
|
|
@@ -5591,6 +5593,122 @@ function collectSurfaceConflicts(owner, exports) {
|
|
|
5591
5593
|
});
|
|
5592
5594
|
}
|
|
5593
5595
|
/**
|
|
5596
|
+
* Infers how two different names resemble each other by spelling.
|
|
5597
|
+
*
|
|
5598
|
+
* @returns The first class that holds, or `undefined` when none does or the names are equal.
|
|
5599
|
+
*
|
|
5600
|
+
* @remarks
|
|
5601
|
+
* Reads, in order, a case-fold twin, a singular or plural form (`s`, `es`, or `y` to `ies`), and
|
|
5602
|
+
* one insertion, deletion, or substitution of a code unit when both names hold at least
|
|
5603
|
+
* `SURFACE_EDIT_LENGTH` characters. Never returns `signature`, which compares cells.
|
|
5604
|
+
*
|
|
5605
|
+
* @example
|
|
5606
|
+
* ```ts
|
|
5607
|
+
* import { inferSurfaceSimilarity } from '@orkestrel/scaffold'
|
|
5608
|
+
*
|
|
5609
|
+
* inferSurfaceSimilarity('Route', 'Routes') // 'plural'
|
|
5610
|
+
* ```
|
|
5611
|
+
*/
|
|
5612
|
+
function inferSurfaceSimilarity(name, other) {
|
|
5613
|
+
const [short, long] = name.length <= other.length ? [name, other] : [other, name];
|
|
5614
|
+
if (name === other) return void 0;
|
|
5615
|
+
if (name.toLowerCase() === other.toLowerCase()) return "case";
|
|
5616
|
+
if (long === `${short}s` || long === `${short}es` || short.endsWith("y") && long === `${short.slice(0, -1)}ies`) return "plural";
|
|
5617
|
+
if (short.length < 6 || long.length - short.length > 1) return void 0;
|
|
5618
|
+
const found = short.split("").findIndex((character, position) => character !== long[position]);
|
|
5619
|
+
const index = found === -1 ? short.length : found;
|
|
5620
|
+
const rest = long.length === short.length ? short.slice(index + 1) : short.slice(index);
|
|
5621
|
+
return long.slice(index + 1) === rest ? "edit" : void 0;
|
|
5622
|
+
}
|
|
5623
|
+
/**
|
|
5624
|
+
* Checks whether an error is the `TARGET` refusal a surface reader raises for a guide its parser
|
|
5625
|
+
* refuses, which carries the parser's code in its context.
|
|
5626
|
+
*
|
|
5627
|
+
* @returns True if the error is that refusal; false otherwise.
|
|
5628
|
+
*
|
|
5629
|
+
* @example
|
|
5630
|
+
* ```ts
|
|
5631
|
+
* import { matchesGuideRefusal, ScaffoldError } from '@orkestrel/scaffold'
|
|
5632
|
+
*
|
|
5633
|
+
* matchesGuideRefusal(new ScaffoldError('TARGET', 'Refused', { code: 'header' })) // true
|
|
5634
|
+
* ```
|
|
5635
|
+
*/
|
|
5636
|
+
function matchesGuideRefusal(error) {
|
|
5637
|
+
return isScaffoldError(error) && error.code === "TARGET" && isRecord(error.context) && isString(error.context.code);
|
|
5638
|
+
}
|
|
5639
|
+
/**
|
|
5640
|
+
* Checks whether a guide `Signature` cell spells a structure rather than a literal or a type name.
|
|
5641
|
+
*
|
|
5642
|
+
* @returns True if the cell is one code span that opens with a member list holding at least one
|
|
5643
|
+
* member, its array and union forms included; false otherwise.
|
|
5644
|
+
*
|
|
5645
|
+
* @remarks
|
|
5646
|
+
* A literal (`2000`, `" "`, `'live' | 'floor'`), a bare primitive (`string`), a type reference
|
|
5647
|
+
* (`RegExp`, `Guard<string>`, `readonly string[]`), a function type, an empty member list, and
|
|
5648
|
+
* prose are no structure: two names sharing one of those share a type, not a contract.
|
|
5649
|
+
*
|
|
5650
|
+
* @example
|
|
5651
|
+
* ```ts
|
|
5652
|
+
* import { matchesSurfaceStructure } from '@orkestrel/scaffold'
|
|
5653
|
+
*
|
|
5654
|
+
* matchesSurfaceStructure('`{ owner, names }`') // true
|
|
5655
|
+
* ```
|
|
5656
|
+
*/
|
|
5657
|
+
function matchesSurfaceStructure(signature) {
|
|
5658
|
+
const code = /^`([^`]+)`$/u.exec(signature)?.[1]?.trim();
|
|
5659
|
+
return code !== void 0 && code.startsWith("{") && !/^\{\s*\}$/u.test(code);
|
|
5660
|
+
}
|
|
5661
|
+
/**
|
|
5662
|
+
* Collects the near names and equal contracts other owners claim beside each name a candidate adds.
|
|
5663
|
+
*
|
|
5664
|
+
* @param candidate - The candidate owner's contract.
|
|
5665
|
+
* @param published - The names the candidate owner's published guide claims; empty when none.
|
|
5666
|
+
* @param contracts - Every owner's contract; the candidate owner's own entry is skipped.
|
|
5667
|
+
* @returns One advisory per added name, peer, and class, sorted by added name, peer owner, and peer
|
|
5668
|
+
* name, with a spelling class before `signature`.
|
|
5669
|
+
*
|
|
5670
|
+
* @remarks
|
|
5671
|
+
* An added name is one `candidate` claims and `published` does not. A spelling class comes from
|
|
5672
|
+
* `inferSurfaceSimilarity`; `signature` holds when both names carry equal cells that
|
|
5673
|
+
* `matchesSurfaceStructure` accepts. A name equal to the added name is a collision, not an
|
|
5674
|
+
* advisory.
|
|
5675
|
+
*
|
|
5676
|
+
* @example
|
|
5677
|
+
* ```ts
|
|
5678
|
+
* import { collectSurfaceAdvisories } from '@orkestrel/scaffold'
|
|
5679
|
+
*
|
|
5680
|
+
* const advisories = collectSurfaceAdvisories(
|
|
5681
|
+
* { owner: 'alpha', names: ['Routes'], signatures: new Map() },
|
|
5682
|
+
* [],
|
|
5683
|
+
* [{ owner: 'router', names: ['Route'], signatures: new Map() }],
|
|
5684
|
+
* )
|
|
5685
|
+
* advisories[0]?.similarity // 'plural'
|
|
5686
|
+
* ```
|
|
5687
|
+
*/
|
|
5688
|
+
function collectSurfaceAdvisories(candidate, published, contracts) {
|
|
5689
|
+
const known = new Set(published);
|
|
5690
|
+
const peers = contracts.filter(({ owner }) => owner !== candidate.owner).flatMap(({ owner, names, signatures }) => [...new Set(names)].map((name) => ({
|
|
5691
|
+
name,
|
|
5692
|
+
owner,
|
|
5693
|
+
signature: signatures.get(name)
|
|
5694
|
+
}))).sort((left, right) => compareValues(left.owner, right.owner) || compareValues(left.name, right.name));
|
|
5695
|
+
return [...new Set(candidate.names)].filter((name) => !known.has(name)).sort(compareValues).flatMap((name) => {
|
|
5696
|
+
const signature = candidate.signatures.get(name);
|
|
5697
|
+
const structure = signature !== void 0 && matchesSurfaceStructure(signature);
|
|
5698
|
+
return peers.flatMap((peer) => {
|
|
5699
|
+
return [inferSurfaceSimilarity(name, peer.name), structure && peer.name !== name && peer.signature === signature ? "signature" : void 0].flatMap((similarity) => similarity === void 0 ? [] : [{
|
|
5700
|
+
name,
|
|
5701
|
+
owner: candidate.owner,
|
|
5702
|
+
peer: {
|
|
5703
|
+
name: peer.name,
|
|
5704
|
+
owner: peer.owner
|
|
5705
|
+
},
|
|
5706
|
+
similarity
|
|
5707
|
+
}]);
|
|
5708
|
+
});
|
|
5709
|
+
});
|
|
5710
|
+
}
|
|
5711
|
+
/**
|
|
5594
5712
|
* Encodes bytes as exact lowercase hexadecimal text.
|
|
5595
5713
|
*
|
|
5596
5714
|
* @param bytes - The bytes to encode.
|
|
@@ -9707,6 +9825,6 @@ var Compiler = class {
|
|
|
9707
9825
|
return error;
|
|
9708
9826
|
}
|
|
9709
9827
|
};
|
|
9710
|
-
export { APP_BROWSER_DEV_DEPENDENCIES, APP_DEV_DEPENDENCIES, APP_MATRIX, APP_SERVER_DEV_DEPENDENCIES, ARTIFACT_TEMPLATES, AXES, BASE_DEV_DEPENDENCIES, BIN_CONFIGS, BIN_ENTRY_PATH, BIN_OUTPUT_PATH, BROWSE_DEV_DEPENDENCIES, BROWSE_UPSTREAM, CANON_PATHS, CAPTURE_DEV_DEPENDENCIES, CAPTURE_UPSTREAM, CATALOG_AGENT_PATH, CATALOG_END_MARKER, CATALOG_START_MARKER, CONFIG_TEMPLATES, CONFORMANCE_TEST_PATH, CONTROL_CHARACTER_PATTERN, Compiler, DECLARATION_DEV_DEPENDENCIES, DEFAULT_ENGINES, DEFAULT_VERSION, DEPENDENCY_NAME_PATTERN, DISTRIBUTION_SETUP_PATH, DISTRIBUTION_TEST_PATH, ENGINES_PATTERN, ENVIRONMENTS, EXECUTABLE_PATHS, EXTRA_RANGE_PATTERN, FLOOR_RANGE_PATTERN, FOREIGN_NAME_PATTERN, FRAMEWORKS, FRAMEWORK_MATRIX, GLOBAL_SETUP_PATH, GROUPS, GUIDES_TEST_PATH, HEX_PATTERN, HOST_INVENTORY_PATH, HOST_PATHS, INTEGRATION_TEST_PATH, INVALID_PATH_CHARACTER_PATTERN, JOURNEY_CONFIG_PATH, MANIFEST_PATH, MAX_ARTIFACT_BYTES, MAX_ARTIFACT_HEX_LENGTH, MAX_AUDIT_FINDINGS, MAX_COLLECTION_ITEMS, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_NAME_LENGTH, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_REGISTRY_BYTES, MAX_SCRIPT_LENGTH, MAX_TOTAL_ARTIFACT_BYTES, MAX_TOTAL_REGISTRY_BYTES, MINIMUM_NODE_VERSION, MINIMUM_NPM_VERSION, NAME_PATTERN, ORCHESTRATION_PATH_NAMES, ORCHESTRATION_PATH_PREFIXES, ORKESTREL_RANGE_PATTERN, PRINT_WIDTH, REFERENCE_PATHS, RELEASE_PROOF_COMMAND, RESERVED_SHEET_NAMES, SEED_GUIDE_PATHS, SERVICE_SCRIPT_PATH, SERVICE_SETUP_PATH, SERVICE_TEST_INCLUDE, SHEET_ENTRY_NAME, SHOWCASE_CONFIG_PATH, SHOWCASE_DEV_DEPENDENCIES, SHOWCASE_OVERRIDES, SHOWCASE_PAGES_PATH, SKILLS_CONFIG_PATH, SOURCE_BROWSER_DEV_DEPENDENCIES, SRC_MATRIX, STUDIES_TEST_INCLUDE, STYLES_DEV_DEPENDENCIES, STYLES_ENTRY_PATH, SURFACES, ScaffoldError, TAB_WIDTH, TARGET_SKILL_NAMES, THEMES_BARREL_PATH, THEMES_ENTRY_PATH, TOOLCHAIN_HOLDS, TREE_TEST_PATH, VERSION_PATTERN, WORKSPACE_DEV_ENGINES, WORKSPACE_OWNED_PATHS, applyOverrides, artifactToFinding, artifactToHex, artifactsToQuestions, blueprintToConfigArtifacts, blueprintToDevDependencies, blueprintToDocumentArtifacts, blueprintToExports, blueprintToFaces, blueprintToGuideArtifacts, blueprintToHostArtifacts, blueprintToMachinery, blueprintToManifest, blueprintToManifestOverrides, blueprintToOptimizedDependencies, blueprintToOrchestrationArtifacts, blueprintToProjects, blueprintToQuestions, blueprintToRootTsconfig, blueprintToRootVite, blueprintToScripts, blueprintToSheets, blueprintToSourceArtifacts, blueprintToTestArtifacts, blueprintToToolchainHolds, blueprintToWritableScripts, bytesToHex, catalogToLayers, cloneValue, collectSurfaceCollisions, collectSurfaceConflicts, compareSurfaceCollisions, compareVersions, computeBytes, computeHash, computeTotal, contentToHex, createBlueprint, dependenciesToQuestions, extractRangeMajor, extractVersion, inferDrift, inferGroup, insertManifestDependencies, insertManifestSection, isArtifact, isAudit, isBlueprint, isBrowserExtension, isCanonPath, isCatalogEntry, isCollection, isCompilerHooks, isCompilerOptions, isContent, isDeferredPath, isDependency, isDependencyName, isEnvironment, isExtension, isFinding, isFloorPath, isGroup, isGroups, isHex, isManifestScript, isMirror, isOverride, isPath, isPlan, isQuestion, isRetainedPath, isScaffoldError, isSheetName, isSnapshot, isStylesExtension, isSurface, iterateAnswers, manifestToDependencies, manifestToName, matchesDriftReachability, matchesEngines, matchesOrchestrationPath, matchesPrintWidth, matchesRange, nameToGuide, overridesToQuestions, parseBlueprint, parseCompilerOptions, parseExtension, parseGroups, parseSnapshot, pathToCondition, planToFindings, planToHash, planToSummary, renderSkillPointer, replaceManifestOverride, replaceManifestOverrides, replaceManifestRanges, replaceManifestScripts, replacePlanRanges, scanManifestTokens, selectGroups, selectHostPaths, serializeTypeScriptString, srcToEntry, srcToExports, srcToRoot };
|
|
9828
|
+
export { APP_BROWSER_DEV_DEPENDENCIES, APP_DEV_DEPENDENCIES, APP_MATRIX, APP_SERVER_DEV_DEPENDENCIES, ARTIFACT_TEMPLATES, AXES, BASE_DEV_DEPENDENCIES, BIN_CONFIGS, BIN_ENTRY_PATH, BIN_OUTPUT_PATH, BROWSE_DEV_DEPENDENCIES, BROWSE_UPSTREAM, CANON_PATHS, CAPTURE_DEV_DEPENDENCIES, CAPTURE_UPSTREAM, CATALOG_AGENT_PATH, CATALOG_END_MARKER, CATALOG_START_MARKER, CONFIG_TEMPLATES, CONFORMANCE_TEST_PATH, CONTROL_CHARACTER_PATTERN, Compiler, DECLARATION_DEV_DEPENDENCIES, DEFAULT_ENGINES, DEFAULT_VERSION, DEPENDENCY_NAME_PATTERN, DISTRIBUTION_SETUP_PATH, DISTRIBUTION_TEST_PATH, ENGINES_PATTERN, ENVIRONMENTS, EXECUTABLE_PATHS, EXTRA_RANGE_PATTERN, FLOOR_RANGE_PATTERN, FOREIGN_NAME_PATTERN, FRAMEWORKS, FRAMEWORK_MATRIX, GLOBAL_SETUP_PATH, GROUPS, GUIDES_TEST_PATH, HEX_PATTERN, HOST_INVENTORY_PATH, HOST_PATHS, INTEGRATION_TEST_PATH, INVALID_PATH_CHARACTER_PATTERN, JOURNEY_CONFIG_PATH, MANIFEST_PATH, MAX_ARTIFACT_BYTES, MAX_ARTIFACT_HEX_LENGTH, MAX_AUDIT_FINDINGS, MAX_COLLECTION_ITEMS, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_NAME_LENGTH, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_REGISTRY_BYTES, MAX_SCRIPT_LENGTH, MAX_TOTAL_ARTIFACT_BYTES, MAX_TOTAL_REGISTRY_BYTES, MINIMUM_NODE_VERSION, MINIMUM_NPM_VERSION, NAME_PATTERN, ORCHESTRATION_PATH_NAMES, ORCHESTRATION_PATH_PREFIXES, ORKESTREL_RANGE_PATTERN, PRINT_WIDTH, REFERENCE_PATHS, RELEASE_PROOF_COMMAND, RESERVED_SHEET_NAMES, SEED_GUIDE_PATHS, SERVICE_SCRIPT_PATH, SERVICE_SETUP_PATH, SERVICE_TEST_INCLUDE, SHEET_ENTRY_NAME, SHOWCASE_CONFIG_PATH, SHOWCASE_DEV_DEPENDENCIES, SHOWCASE_OVERRIDES, SHOWCASE_PAGES_PATH, SKILLS_CONFIG_PATH, SOURCE_BROWSER_DEV_DEPENDENCIES, SRC_MATRIX, STUDIES_TEST_INCLUDE, STYLES_DEV_DEPENDENCIES, STYLES_ENTRY_PATH, SURFACES, SURFACE_EDIT_LENGTH, ScaffoldError, TAB_WIDTH, TARGET_SKILL_NAMES, THEMES_BARREL_PATH, THEMES_ENTRY_PATH, TOOLCHAIN_HOLDS, TREE_TEST_PATH, VERSION_PATTERN, WORKSPACE_DEV_ENGINES, WORKSPACE_OWNED_PATHS, applyOverrides, artifactToFinding, artifactToHex, artifactsToQuestions, blueprintToConfigArtifacts, blueprintToDevDependencies, blueprintToDocumentArtifacts, blueprintToExports, blueprintToFaces, blueprintToGuideArtifacts, blueprintToHostArtifacts, blueprintToMachinery, blueprintToManifest, blueprintToManifestOverrides, blueprintToOptimizedDependencies, blueprintToOrchestrationArtifacts, blueprintToProjects, blueprintToQuestions, blueprintToRootTsconfig, blueprintToRootVite, blueprintToScripts, blueprintToSheets, blueprintToSourceArtifacts, blueprintToTestArtifacts, blueprintToToolchainHolds, blueprintToWritableScripts, bytesToHex, catalogToLayers, cloneValue, collectSurfaceAdvisories, collectSurfaceCollisions, collectSurfaceConflicts, compareSurfaceCollisions, compareVersions, computeBytes, computeHash, computeTotal, contentToHex, createBlueprint, dependenciesToQuestions, extractRangeMajor, extractVersion, inferDrift, inferGroup, inferSurfaceSimilarity, insertManifestDependencies, insertManifestSection, isArtifact, isAudit, isBlueprint, isBrowserExtension, isCanonPath, isCatalogEntry, isCollection, isCompilerHooks, isCompilerOptions, isContent, isDeferredPath, isDependency, isDependencyName, isEnvironment, isExtension, isFinding, isFloorPath, isGroup, isGroups, isHex, isManifestScript, isMirror, isOverride, isPath, isPlan, isQuestion, isRetainedPath, isScaffoldError, isSheetName, isSnapshot, isStylesExtension, isSurface, iterateAnswers, manifestToDependencies, manifestToName, matchesDriftReachability, matchesEngines, matchesGuideRefusal, matchesOrchestrationPath, matchesPrintWidth, matchesRange, matchesSurfaceStructure, nameToGuide, overridesToQuestions, parseBlueprint, parseCompilerOptions, parseExtension, parseGroups, parseSnapshot, pathToCondition, planToFindings, planToHash, planToSummary, renderSkillPointer, replaceManifestOverride, replaceManifestOverrides, replaceManifestRanges, replaceManifestScripts, replacePlanRanges, scanManifestTokens, selectGroups, selectHostPaths, serializeTypeScriptString, srcToEntry, srcToExports, srcToRoot };
|
|
9711
9829
|
|
|
9712
9830
|
//# sourceMappingURL=index.js.map
|