@orkestrel/scaffold 0.0.112 → 0.0.113
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/agents/skills/orkestrel-harden/scripts/titles.js +3 -3
- package/dist/agents/skills/orkestrel-publish/scripts/wave.js +37 -5
- package/dist/bin/main.js +1 -1
- package/dist/bin/main.js.map +1 -1
- package/dist/host/agents/platforms/windows.md +1 -1
- package/dist/host/agents/skills/orkestrel-harden/scripts/titles.ts +3 -3
- package/dist/host/agents/skills/orkestrel-publish/references/wave.md +4 -1
- package/dist/host/agents/skills/orkestrel-publish/scripts/wave.ts +37 -5
- package/dist/host/claude/agents/orkestrel.md +1 -1
- package/dist/host/claude/rules/architecture.md +4 -3
- package/dist/host/claude/rules/tests.md +18 -3
- package/dist/host/claude/rules/typescript.md +11 -2
- package/dist/host/claude/rules/workspace.md +4 -0
- package/dist/host/configs/policy.ts +49 -0
- package/dist/host/dotfiles/gitignore +1 -0
- package/dist/host/dotfiles/oxlintrc.json +6 -0
- package/dist/host/manifest.json +16 -16
- package/dist/host/tests/config.test.ts +65 -3
- package/dist/host/tests/policy.test.ts +21 -7
- package/dist/host/tests/setupPolicy.ts +147 -12
- package/dist/src/core/index.cjs +3 -1
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +1 -1
- package/dist/src/core/index.d.ts +1 -1
- package/dist/src/core/index.js +3 -1
- package/dist/src/core/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -36,6 +36,8 @@ import {
|
|
|
36
36
|
POLICY_SURFACE_CATALOG,
|
|
37
37
|
POLICY_CONTROLS,
|
|
38
38
|
SETUP_POLICY_CONTROLS,
|
|
39
|
+
INFRASTRUCTURE_POLICY_CONTROLS,
|
|
40
|
+
POLICY_INFRASTRUCTURE_MESSAGE,
|
|
39
41
|
POLICY_MIRROR_PATTERN,
|
|
40
42
|
POLICY_SUPPRESSION_DIRECTIVE,
|
|
41
43
|
POLICY_TERM_FILE,
|
|
@@ -76,6 +78,16 @@ describe('root setup mirror controls', () => {
|
|
|
76
78
|
}
|
|
77
79
|
})
|
|
78
80
|
|
|
81
|
+
describe('tests-tree placement controls', () => {
|
|
82
|
+
for (const control of INFRASTRUCTURE_POLICY_CONTROLS) {
|
|
83
|
+
it(`${control.label} [membership: ${control.membership}]`, () => {
|
|
84
|
+
expect(
|
|
85
|
+
inspectPolicyControl(control).filter((violation) => violation.rule === 'mirror'),
|
|
86
|
+
).toEqual(control.violations)
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
|
|
79
91
|
describe('surface policy controls', () => {
|
|
80
92
|
it('accepts a quoted relative barrel target containing a space', () => {
|
|
81
93
|
const scratch = createPolicySurfaceFixture()
|
|
@@ -237,17 +249,17 @@ describe('surface policy controls', () => {
|
|
|
237
249
|
try {
|
|
238
250
|
scratch.write('tests/setupDistribution.ts', 'export function readShared() {}\n')
|
|
239
251
|
expect(inspectPolicyWorkspace(scratch.path)).toEqual([])
|
|
240
|
-
scratch.write('tests/
|
|
252
|
+
scratch.write('tests/setupGlobal.ts', 'export function readShared() {}\n')
|
|
241
253
|
expect(inspectPolicyWorkspace(scratch.path)).toEqual([
|
|
242
254
|
{
|
|
243
255
|
rule: 'mirror',
|
|
244
|
-
path: 'tests/
|
|
256
|
+
path: 'tests/setupGlobal.ts',
|
|
245
257
|
message:
|
|
246
258
|
'exporting setup module requires its sibling proof or an import from tests/setup.test.ts',
|
|
247
259
|
},
|
|
248
260
|
{
|
|
249
261
|
rule: 'surface',
|
|
250
|
-
path: 'tests/
|
|
262
|
+
path: 'tests/setupGlobal.ts',
|
|
251
263
|
line: 1,
|
|
252
264
|
message: 'surface name belongs to one package: readShared (other)',
|
|
253
265
|
},
|
|
@@ -517,18 +529,20 @@ describe('policy population controls', () => {
|
|
|
517
529
|
).toEqual([])
|
|
518
530
|
})
|
|
519
531
|
|
|
520
|
-
it('
|
|
532
|
+
it('refuses a nested setup module even where a test stem mirrors it', () => {
|
|
521
533
|
expect(
|
|
522
534
|
inspectPolicyControl({
|
|
523
|
-
label: '
|
|
524
|
-
membership: 'tests-axis setup modules
|
|
535
|
+
label: 'refuses a nested setup module even where a test stem mirrors it',
|
|
536
|
+
membership: 'tests-axis setup modules outside the root setup modules',
|
|
525
537
|
rule: 'mirror',
|
|
526
538
|
files: [
|
|
527
539
|
{ path: 'tests/app/core/setup.ts', content: '' },
|
|
528
540
|
{ path: 'tests/app/core/setup.test.ts', content: '' },
|
|
529
541
|
],
|
|
530
542
|
}),
|
|
531
|
-
).toEqual([
|
|
543
|
+
).toEqual([
|
|
544
|
+
{ rule: 'mirror', path: 'tests/app/core/setup.ts', message: POLICY_INFRASTRUCTURE_MESSAGE },
|
|
545
|
+
])
|
|
532
546
|
})
|
|
533
547
|
|
|
534
548
|
it('excludes documentation from the suppression population', () => {
|
|
@@ -891,6 +891,26 @@ export const POLICY_MODULE_GLOB = `{app,src}/**/*.{${POLICY_MODULE_EXTENSIONS.jo
|
|
|
891
891
|
/** Matches the tests-axis setup module population available to mirrored tests. */
|
|
892
892
|
export const POLICY_TESTS_MODULE_GLOB = `tests/**/${POLICY_TESTS_MODULE_PREFIX}*.ts`
|
|
893
893
|
|
|
894
|
+
/**
|
|
895
|
+
* Lists the root setup modules a workspace authors; scaffold owns `tests/setupPolicy.ts` and
|
|
896
|
+
* `tests/setupDistribution.ts` beside them.
|
|
897
|
+
*/
|
|
898
|
+
export const POLICY_SETUP_MODULES: readonly string[] = Object.freeze([
|
|
899
|
+
'tests/setup.ts',
|
|
900
|
+
'tests/setupServer.ts',
|
|
901
|
+
'tests/setupBrowser.ts',
|
|
902
|
+
'tests/setupStyles.ts',
|
|
903
|
+
'tests/setupStudy.ts',
|
|
904
|
+
'tests/setupService.ts',
|
|
905
|
+
'tests/setupGlobal.ts',
|
|
906
|
+
])
|
|
907
|
+
|
|
908
|
+
/** Names the correction a tests-tree module outside the root setup modules receives. */
|
|
909
|
+
export const POLICY_INFRASTRUCTURE_MESSAGE = `test infrastructure lives only in ${POLICY_SETUP_MODULES.join(', ')}: move this module's declarations into the one its environment names, or under a fixtures/ directory when a test runs it as its own entry`
|
|
910
|
+
|
|
911
|
+
/** Matches every TypeScript module the tests tree holds. */
|
|
912
|
+
export const POLICY_TESTS_SOURCE_GLOB = 'tests/**/*.{ts,mts,cts,tsx}'
|
|
913
|
+
|
|
894
914
|
/** Matches the mirrored module-test population inspected under either workspace axis. */
|
|
895
915
|
export const POLICY_TEST_GLOB = 'tests/{app,src}/**/*.test.ts'
|
|
896
916
|
|
|
@@ -1263,7 +1283,11 @@ export function inspectPolicyMirrors(root: string): readonly PolicyViolation[] {
|
|
|
1263
1283
|
...globSync(POLICY_MODULE_GLOB, { cwd: root }).sort().map(normalizePolicyPath),
|
|
1264
1284
|
...globSync(POLICY_TESTS_MODULE_GLOB, { cwd: root }).sort().map(normalizePolicyPath),
|
|
1265
1285
|
])
|
|
1266
|
-
return [
|
|
1286
|
+
return [
|
|
1287
|
+
...inspectPolicyMirrorPaths(tests, modules),
|
|
1288
|
+
...inspectPolicySetup(root),
|
|
1289
|
+
...inspectPolicyInfrastructure(root),
|
|
1290
|
+
]
|
|
1267
1291
|
}
|
|
1268
1292
|
|
|
1269
1293
|
/**
|
|
@@ -1312,6 +1336,8 @@ export function inspectPolicySetup(root: string): readonly PolicyViolation[] {
|
|
|
1312
1336
|
? []
|
|
1313
1337
|
: [createPolicyViolation('mirror', path, `setup proof requires its module: ${module}`)]
|
|
1314
1338
|
}
|
|
1339
|
+
// A setup-named module outside the canon's set is the placement inspector's finding alone.
|
|
1340
|
+
if (!POLICY_SETUP_MODULES.includes(path) && path !== DISTRIBUTION_SETUP_PATH) return []
|
|
1315
1341
|
return /^export /m.test(readFileSync(join(root, path), 'utf8')) &&
|
|
1316
1342
|
!paths.has(path.replace(/\.ts$/u, '.test.ts')) &&
|
|
1317
1343
|
!imports.has(path)
|
|
@@ -1326,6 +1352,46 @@ export function inspectPolicySetup(root: string): readonly PolicyViolation[] {
|
|
|
1326
1352
|
})
|
|
1327
1353
|
}
|
|
1328
1354
|
|
|
1355
|
+
/**
|
|
1356
|
+
* Checks whether a tests-tree module sits where test infrastructure may live.
|
|
1357
|
+
*
|
|
1358
|
+
* @param path - The workspace-relative module path.
|
|
1359
|
+
* @param root - The workspace root whose manifest determines harness ownership.
|
|
1360
|
+
* @returns True if the module is a test, a bench, a declaration file, a root setup module the
|
|
1361
|
+
* canon names, a scaffold-owned module, or a file under a `fixtures/` directory; false otherwise.
|
|
1362
|
+
* @example
|
|
1363
|
+
* ```ts
|
|
1364
|
+
* matchesPolicyInfrastructure('tests/setupServer.ts', root) // true
|
|
1365
|
+
* matchesPolicyInfrastructure('tests/setupConformance.ts', root) // false
|
|
1366
|
+
* ```
|
|
1367
|
+
*/
|
|
1368
|
+
export function matchesPolicyInfrastructure(path: string, root: string): boolean {
|
|
1369
|
+
const normalized = normalizePolicyPath(path)
|
|
1370
|
+
return (
|
|
1371
|
+
/\.(?:test|bench)\.ts$/u.test(normalized) ||
|
|
1372
|
+
/\.d\.[cm]?ts$/u.test(normalized) ||
|
|
1373
|
+
POLICY_SETUP_MODULES.includes(normalized) ||
|
|
1374
|
+
normalized === DISTRIBUTION_SETUP_PATH ||
|
|
1375
|
+
matchesScaffoldSetup(normalized, root) ||
|
|
1376
|
+
normalized.split('/').includes('fixtures')
|
|
1377
|
+
)
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
/**
|
|
1381
|
+
* Inspects the tests tree for test infrastructure outside the root setup modules the canon names.
|
|
1382
|
+
*
|
|
1383
|
+
* @param root - The workspace root to inspect.
|
|
1384
|
+
* @returns One mirror violation per misplaced module, in path order.
|
|
1385
|
+
*/
|
|
1386
|
+
export function inspectPolicyInfrastructure(root: string): readonly PolicyViolation[] {
|
|
1387
|
+
return globSync(POLICY_TESTS_SOURCE_GLOB, { cwd: root })
|
|
1388
|
+
.map(normalizePolicyPath)
|
|
1389
|
+
.filter((path) => !path.split('/').includes('node_modules'))
|
|
1390
|
+
.sort()
|
|
1391
|
+
.filter((path) => !matchesPolicyInfrastructure(path, root))
|
|
1392
|
+
.map((path) => createPolicyViolation('mirror', path, POLICY_INFRASTRUCTURE_MESSAGE))
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1329
1395
|
/**
|
|
1330
1396
|
* Inspects code-shaped and sheet workspace files for lint and formatter suppression directives.
|
|
1331
1397
|
*
|
|
@@ -3936,11 +4002,11 @@ export const SETUP_POLICY_CONTROLS: readonly PolicyControl[] = Object.freeze([
|
|
|
3936
4002
|
label: 'rejects an exporting setup module without proof',
|
|
3937
4003
|
membership: 'target-owned exporting root setup modules',
|
|
3938
4004
|
rule: 'mirror',
|
|
3939
|
-
files: [{ path: 'tests/
|
|
4005
|
+
files: [{ path: 'tests/setupStyles.ts', content: 'export const STYLES = 1\n' }],
|
|
3940
4006
|
violations: [
|
|
3941
4007
|
{
|
|
3942
4008
|
rule: 'mirror',
|
|
3943
|
-
path: 'tests/
|
|
4009
|
+
path: 'tests/setupStyles.ts',
|
|
3944
4010
|
message:
|
|
3945
4011
|
'exporting setup module requires its sibling proof or an import from tests/setup.test.ts',
|
|
3946
4012
|
},
|
|
@@ -3950,19 +4016,19 @@ export const SETUP_POLICY_CONTROLS: readonly PolicyControl[] = Object.freeze([
|
|
|
3950
4016
|
label: 'admits a non-exporting setup module without proof',
|
|
3951
4017
|
membership: 'root setup modules without exports',
|
|
3952
4018
|
rule: 'mirror',
|
|
3953
|
-
files: [{ path: 'tests/
|
|
4019
|
+
files: [{ path: 'tests/setupStyles.ts', content: 'const canvas = 1\nvoid canvas\n' }],
|
|
3954
4020
|
violations: [],
|
|
3955
4021
|
},
|
|
3956
4022
|
{
|
|
3957
4023
|
label: 'rejects a setup proof without its module',
|
|
3958
4024
|
membership: 'target-owned root setup proofs',
|
|
3959
4025
|
rule: 'mirror',
|
|
3960
|
-
files: [{ path: 'tests/
|
|
4026
|
+
files: [{ path: 'tests/setupStyles.test.ts', content: '' }],
|
|
3961
4027
|
violations: [
|
|
3962
4028
|
{
|
|
3963
4029
|
rule: 'mirror',
|
|
3964
|
-
path: 'tests/
|
|
3965
|
-
message: 'setup proof requires its module: tests/
|
|
4030
|
+
path: 'tests/setupStyles.test.ts',
|
|
4031
|
+
message: 'setup proof requires its module: tests/setupStyles.ts',
|
|
3966
4032
|
},
|
|
3967
4033
|
],
|
|
3968
4034
|
},
|
|
@@ -3971,9 +4037,9 @@ export const SETUP_POLICY_CONTROLS: readonly PolicyControl[] = Object.freeze([
|
|
|
3971
4037
|
membership: 'root setup modules with shared proof imports',
|
|
3972
4038
|
rule: 'mirror',
|
|
3973
4039
|
files: [
|
|
3974
|
-
{ path: 'tests/
|
|
4040
|
+
{ path: 'tests/setupStyles.ts', content: 'export const STYLES = 1\n' },
|
|
3975
4041
|
{ path: 'tests/setup.ts', content: '' },
|
|
3976
|
-
{ path: 'tests/setup.test.ts', content: "import {
|
|
4042
|
+
{ path: 'tests/setup.test.ts', content: "import { STYLES } from './setupStyles.js'\n" },
|
|
3977
4043
|
],
|
|
3978
4044
|
violations: [],
|
|
3979
4045
|
},
|
|
@@ -3982,17 +4048,17 @@ export const SETUP_POLICY_CONTROLS: readonly PolicyControl[] = Object.freeze([
|
|
|
3982
4048
|
membership: 'exporting root setup modules named only by comments',
|
|
3983
4049
|
rule: 'mirror',
|
|
3984
4050
|
files: [
|
|
3985
|
-
{ path: 'tests/
|
|
4051
|
+
{ path: 'tests/setupStyles.ts', content: 'export const STYLES = 1\n' },
|
|
3986
4052
|
{ path: 'tests/setup.ts', content: '' },
|
|
3987
4053
|
{
|
|
3988
4054
|
path: 'tests/setup.test.ts',
|
|
3989
|
-
content: "/*\nimport {
|
|
4055
|
+
content: "/*\nimport { STYLES } from './setupStyles.js'\n*/\nexport {}\n",
|
|
3990
4056
|
},
|
|
3991
4057
|
],
|
|
3992
4058
|
violations: [
|
|
3993
4059
|
{
|
|
3994
4060
|
rule: 'mirror',
|
|
3995
|
-
path: 'tests/
|
|
4061
|
+
path: 'tests/setupStyles.ts',
|
|
3996
4062
|
message:
|
|
3997
4063
|
'exporting setup module requires its sibling proof or an import from tests/setup.test.ts',
|
|
3998
4064
|
},
|
|
@@ -4031,6 +4097,75 @@ export const SETUP_POLICY_CONTROLS: readonly PolicyControl[] = Object.freeze([
|
|
|
4031
4097
|
},
|
|
4032
4098
|
])
|
|
4033
4099
|
|
|
4100
|
+
/** Lists tests-tree placement controls and their expected mirror readings. */
|
|
4101
|
+
export const INFRASTRUCTURE_POLICY_CONTROLS: readonly PolicyControl[] = Object.freeze([
|
|
4102
|
+
{
|
|
4103
|
+
label: 'rejects a root setup module outside the canon names',
|
|
4104
|
+
membership: 'root setup modules the canon does not name',
|
|
4105
|
+
rule: 'mirror',
|
|
4106
|
+
files: [{ path: 'tests/setupCanvas.ts', content: 'const canvas = 1\nvoid canvas\n' }],
|
|
4107
|
+
violations: [
|
|
4108
|
+
{ rule: 'mirror', path: 'tests/setupCanvas.ts', message: POLICY_INFRASTRUCTURE_MESSAGE },
|
|
4109
|
+
],
|
|
4110
|
+
},
|
|
4111
|
+
{
|
|
4112
|
+
label: 'rejects a helper module inside the mirrored tree',
|
|
4113
|
+
membership: 'non-test modules beneath tests outside the root setup modules',
|
|
4114
|
+
rule: 'mirror',
|
|
4115
|
+
files: [{ path: 'tests/src/core/suite.ts', content: '' }],
|
|
4116
|
+
violations: [
|
|
4117
|
+
{ rule: 'mirror', path: 'tests/src/core/suite.ts', message: POLICY_INFRASTRUCTURE_MESSAGE },
|
|
4118
|
+
],
|
|
4119
|
+
},
|
|
4120
|
+
{
|
|
4121
|
+
label: 'admits the canon setup modules, a bench, a declaration file, and a fixture entry',
|
|
4122
|
+
membership: 'modules the tests tree may hold',
|
|
4123
|
+
rule: 'mirror',
|
|
4124
|
+
files: [
|
|
4125
|
+
{ path: 'tests/setupServer.ts', content: 'const server = 1\nvoid server\n' },
|
|
4126
|
+
{ path: 'tests/setupBrowser.ts', content: 'const browser = 1\nvoid browser\n' },
|
|
4127
|
+
{ path: 'tests/src/core/helpers.bench.ts', content: '' },
|
|
4128
|
+
{ path: 'tests/env.d.ts', content: '' },
|
|
4129
|
+
{ path: 'tests/src/server/fixtures/child.ts', content: '' },
|
|
4130
|
+
],
|
|
4131
|
+
violations: [],
|
|
4132
|
+
},
|
|
4133
|
+
{
|
|
4134
|
+
label: 'reports an exporting setup module outside the canon names once',
|
|
4135
|
+
membership: 'exporting root setup modules the canon does not name',
|
|
4136
|
+
rule: 'mirror',
|
|
4137
|
+
files: [{ path: 'tests/setupCanvas.ts', content: 'export const CANVAS = 1\n' }],
|
|
4138
|
+
violations: [
|
|
4139
|
+
{ rule: 'mirror', path: 'tests/setupCanvas.ts', message: POLICY_INFRASTRUCTURE_MESSAGE },
|
|
4140
|
+
],
|
|
4141
|
+
},
|
|
4142
|
+
{
|
|
4143
|
+
label: 'reports an exporting setup module outside the canon names once in a private workspace',
|
|
4144
|
+
membership: 'exporting root setup modules the canon does not name, private workspace',
|
|
4145
|
+
rule: 'mirror',
|
|
4146
|
+
files: [
|
|
4147
|
+
{ path: 'package.json', content: '{"private":true}\n' },
|
|
4148
|
+
{ path: 'tests/setupCanvas.ts', content: 'export const CANVAS = 1\n' },
|
|
4149
|
+
],
|
|
4150
|
+
violations: [
|
|
4151
|
+
{ rule: 'mirror', path: 'tests/setupCanvas.ts', message: POLICY_INFRASTRUCTURE_MESSAGE },
|
|
4152
|
+
],
|
|
4153
|
+
},
|
|
4154
|
+
{
|
|
4155
|
+
label: 'admits an exporting setup-named declaration file and bench',
|
|
4156
|
+
membership: 'declaration files and benches whose names open with setup',
|
|
4157
|
+
rule: 'mirror',
|
|
4158
|
+
files: [
|
|
4159
|
+
{
|
|
4160
|
+
path: 'tests/setupTypes.d.ts',
|
|
4161
|
+
content: 'export interface Shape {\n\treadonly value: number\n}\n',
|
|
4162
|
+
},
|
|
4163
|
+
{ path: 'tests/setupTiming.bench.ts', content: 'export const TIMING = 1\n' },
|
|
4164
|
+
],
|
|
4165
|
+
violations: [],
|
|
4166
|
+
},
|
|
4167
|
+
])
|
|
4168
|
+
|
|
4034
4169
|
/** Lists standalone sheet selections and their core-bearing control for the vendored proof. */
|
|
4035
4170
|
export const SHEET_POLICY_SELECTIONS: ReadonlyArray<
|
|
4036
4171
|
Pick<Blueprint, 'src' | 'styles' | 'themes'> & {
|
package/dist/src/core/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ let _orkestrel_template = require("@orkestrel/template");
|
|
|
4
4
|
let _orkestrel_emitter = require("@orkestrel/emitter");
|
|
5
5
|
var package_default = {
|
|
6
6
|
name: "@orkestrel/scaffold",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.113",
|
|
8
8
|
description: "Scaffold workspaces with commands: new, audit, repair, catalog, and overwrite.",
|
|
9
9
|
keywords: [
|
|
10
10
|
"audit",
|
|
@@ -985,6 +985,8 @@ function isNamedPlugin(plugin: PluginOption): plugin is { name: string } {
|
|
|
985
985
|
{{factories}}export default defineConfig({
|
|
986
986
|
resolve,
|
|
987
987
|
test: {
|
|
988
|
+
// Vitest 5.0.5 hands cached code to the module runner as bytes, which breaks stack mapping.
|
|
989
|
+
fsModuleCache: false,
|
|
988
990
|
{{projects}}
|
|
989
991
|
},
|
|
990
992
|
})
|