@orkestrel/scaffold 0.0.132 → 0.0.134

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.
Files changed (86) hide show
  1. package/dist/agents/skills/orkestrel-dispatch/scripts/bench.js +61 -96
  2. package/dist/agents/skills/orkestrel-dispatch/scripts/brief.js +48 -76
  3. package/dist/agents/skills/orkestrel-dispatch/scripts/chain.js +27 -66
  4. package/dist/agents/skills/orkestrel-dispatch/scripts/cite.js +31 -64
  5. package/dist/agents/skills/orkestrel-dispatch/scripts/launch.js +43 -57
  6. package/dist/agents/skills/orkestrel-dispatch/scripts/login.js +43 -86
  7. package/dist/agents/skills/orkestrel-dispatch/scripts/patch.js +68 -104
  8. package/dist/agents/skills/orkestrel-dispatch/scripts/result.js +35 -69
  9. package/dist/agents/skills/orkestrel-dispatch/scripts/sweep.js +47 -84
  10. package/dist/agents/skills/orkestrel-falsify/scripts/mutate.js +134 -116
  11. package/dist/agents/skills/orkestrel-harden/scripts/discovery.js +38 -90
  12. package/dist/agents/skills/orkestrel-harden/scripts/interleave.js +39 -103
  13. package/dist/agents/skills/orkestrel-harden/scripts/measure.js +40 -89
  14. package/dist/agents/skills/orkestrel-harden/scripts/titles.js +41 -87
  15. package/dist/agents/skills/orkestrel-parallel/scripts/cases.js +43 -88
  16. package/dist/agents/skills/orkestrel-parallel/scripts/lane.js +1018 -194
  17. package/dist/agents/skills/orkestrel-publish/scripts/compare.js +40 -60
  18. package/dist/agents/skills/orkestrel-publish/scripts/pins.js +47 -81
  19. package/dist/agents/skills/orkestrel-publish/scripts/steps.js +66 -104
  20. package/dist/agents/skills/orkestrel-publish/scripts/swap.js +74 -88
  21. package/dist/agents/skills/orkestrel-publish/scripts/wave.js +95 -108
  22. package/dist/agents/skills/orkestrel-publish/scripts/window.js +55 -96
  23. package/dist/agents/skills/orkestrel-scout/scripts/map.js +54 -101
  24. package/dist/bin/main.js +30 -6
  25. package/dist/bin/main.js.map +1 -1
  26. package/dist/host/agents/orchestration.md +1 -0
  27. package/dist/host/agents/skills/orkestrel-dispatch/scripts/bench.ts +81 -97
  28. package/dist/host/agents/skills/orkestrel-dispatch/scripts/brief.ts +64 -72
  29. package/dist/host/agents/skills/orkestrel-dispatch/scripts/chain.ts +41 -63
  30. package/dist/host/agents/skills/orkestrel-dispatch/scripts/cite.ts +56 -79
  31. package/dist/host/agents/skills/orkestrel-dispatch/scripts/launch.ts +61 -74
  32. package/dist/host/agents/skills/orkestrel-dispatch/scripts/login.ts +59 -89
  33. package/dist/host/agents/skills/orkestrel-dispatch/scripts/patch.ts +87 -106
  34. package/dist/host/agents/skills/orkestrel-dispatch/scripts/result.ts +57 -76
  35. package/dist/host/agents/skills/orkestrel-dispatch/scripts/sweep.ts +73 -88
  36. package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +2 -2
  37. package/dist/host/agents/skills/orkestrel-falsify/scripts/mutate.ts +167 -119
  38. package/dist/host/agents/skills/orkestrel-harden/references/methods.md +1 -1
  39. package/dist/host/agents/skills/orkestrel-harden/scripts/discovery.ts +58 -75
  40. package/dist/host/agents/skills/orkestrel-harden/scripts/interleave.ts +55 -99
  41. package/dist/host/agents/skills/orkestrel-harden/scripts/measure.ts +59 -90
  42. package/dist/host/agents/skills/orkestrel-harden/scripts/titles.ts +60 -80
  43. package/dist/host/agents/skills/orkestrel-parallel/SKILL.md +4 -4
  44. package/dist/host/agents/skills/orkestrel-parallel/scripts/cases.ts +71 -108
  45. package/dist/host/agents/skills/orkestrel-parallel/scripts/lane.ts +1288 -239
  46. package/dist/host/agents/skills/orkestrel-publish/references/wave.md +10 -6
  47. package/dist/host/agents/skills/orkestrel-publish/scripts/compare.ts +58 -79
  48. package/dist/host/agents/skills/orkestrel-publish/scripts/pins.ts +66 -87
  49. package/dist/host/agents/skills/orkestrel-publish/scripts/steps.ts +84 -102
  50. package/dist/host/agents/skills/orkestrel-publish/scripts/swap.ts +92 -99
  51. package/dist/host/agents/skills/orkestrel-publish/scripts/wave.ts +130 -126
  52. package/dist/host/agents/skills/orkestrel-publish/scripts/window.ts +82 -120
  53. package/dist/host/agents/skills/orkestrel-scout/SKILL.md +3 -3
  54. package/dist/host/agents/skills/orkestrel-scout/scripts/map.ts +85 -112
  55. package/dist/host/claude/agents/orkestrel.md +54 -54
  56. package/dist/host/claude/rules/documentation.md +1 -1
  57. package/dist/host/claude/rules/patterns.md +5 -4
  58. package/dist/host/claude/rules/styles.md +1 -1
  59. package/dist/host/claude/rules/tests.md +8 -3
  60. package/dist/host/claude/rules/workspace.md +47 -35
  61. package/dist/host/configs/helpers.ts +40 -15
  62. package/dist/host/dotfiles/oxlintrc.json +62 -0
  63. package/dist/host/guides/browser.md +1 -1
  64. package/dist/host/guides/form.md +79 -4
  65. package/dist/host/guides/queue.md +3 -1
  66. package/dist/host/guides/scaffold.md +95 -67
  67. package/dist/host/guides/table.md +20 -6
  68. package/dist/host/guides/test.md +342 -202
  69. package/dist/host/guides/workflow.md +4 -2
  70. package/dist/host/manifest.json +48 -48
  71. package/dist/host/tests/config.test.ts +201 -11
  72. package/dist/host/tests/policy.test.ts +15 -22
  73. package/dist/host/tests/setupPolicy.ts +43 -36
  74. package/dist/src/core/index.cjs +194 -97
  75. package/dist/src/core/index.cjs.map +1 -1
  76. package/dist/src/core/index.d.cts +27 -13
  77. package/dist/src/core/index.d.ts +27 -13
  78. package/dist/src/core/index.js +192 -97
  79. package/dist/src/core/index.js.map +1 -1
  80. package/dist/src/server/index.cjs +8 -9
  81. package/dist/src/server/index.cjs.map +1 -1
  82. package/dist/src/server/index.d.cts +1 -1
  83. package/dist/src/server/index.d.ts +1 -1
  84. package/dist/src/server/index.js +8 -9
  85. package/dist/src/server/index.js.map +1 -1
  86. package/package.json +5 -5
@@ -8,8 +8,10 @@ import { spawnSync } from 'node:child_process'
8
8
  import { createHash } from 'node:crypto'
9
9
  import {
10
10
  closeSync,
11
+ cpSync,
11
12
  existsSync,
12
13
  globSync,
14
+ lstatSync,
13
15
  mkdirSync,
14
16
  openSync,
15
17
  readdirSync,
@@ -751,6 +753,12 @@ describe('root configuration', () => {
751
753
  'tests/src/bin/**/*.test.ts',
752
754
  ['./tests/setup.ts', './tests/setupServer.ts'],
753
755
  ],
756
+ [
757
+ 'src:reporter',
758
+ 'src/reporter/main.ts',
759
+ 'tests/src/reporter/**/*.test.ts',
760
+ ['./tests/setup.ts', './tests/setupServer.ts'],
761
+ ],
754
762
  ['app:core', 'app/core', 'tests/app/core/**/*.test.ts', ['./tests/setup.ts']],
755
763
  [
756
764
  'app:browser',
@@ -1135,6 +1143,9 @@ describe('root configuration', () => {
1135
1143
  ...(existsSync(resolve(POLICY_ROOT, 'src/bin'))
1136
1144
  ? ['configs/src/tsconfig.bin.json', 'configs/src/vite.bin.config.ts']
1137
1145
  : []),
1146
+ ...(existsSync(resolve(POLICY_ROOT, 'src/reporter/main.ts'))
1147
+ ? ['configs/src/tsconfig.reporter.json', 'configs/src/vite.reporter.config.ts']
1148
+ : []),
1138
1149
  ...(existsSync(resolve(POLICY_ROOT, 'configs/app/vite.showcase.config.ts'))
1139
1150
  ? ['configs/app/vite.showcase.config.ts']
1140
1151
  : []),
@@ -1199,7 +1210,7 @@ describe('root configuration', () => {
1199
1210
  for (const { wrapper, directory } of targets) {
1200
1211
  expect(controlled).toContain(wrapper)
1201
1212
  const viteMatch =
1202
- /^configs\/(src|app)\/vite\.(core|browser|server|bin|showcase|journey)\.config\.ts$/u.exec(
1213
+ /^configs\/(src|app)\/vite\.(core|browser|server|bin|reporter|showcase|journey)\.config\.ts$/u.exec(
1203
1214
  wrapper,
1204
1215
  )
1205
1216
  if (viteMatch !== null) {
@@ -1259,8 +1270,8 @@ describe('root configuration', () => {
1259
1270
  const output = loaded.config.build?.outDir
1260
1271
  if (output === undefined) throw new Error(`${wrapper} carries no output`)
1261
1272
  const expected =
1262
- environment === 'bin'
1263
- ? 'dist/bin'
1273
+ environment === 'bin' || environment === 'reporter'
1274
+ ? `dist/${environment}`
1264
1275
  : environment === 'showcase'
1265
1276
  ? 'showcase'
1266
1277
  : `dist/${axis}/${environment}`
@@ -1272,7 +1283,9 @@ describe('root configuration', () => {
1272
1283
  }
1273
1284
 
1274
1285
  const tsconfigMatch =
1275
- /^configs\/(src|app)\/tsconfig\.(core|browser|server|bin|vue)\.json$/u.exec(wrapper)
1286
+ /^configs\/(src|app)\/tsconfig\.(core|browser|server|bin|reporter|vue)\.json$/u.exec(
1287
+ wrapper,
1288
+ )
1276
1289
  if (tsconfigMatch === null) {
1277
1290
  throw new Error(`${wrapper} is not a required target wrapper`)
1278
1291
  }
@@ -1547,6 +1560,97 @@ describe('root configuration', () => {
1547
1560
  }
1548
1561
  })
1549
1562
 
1563
+ // A workspace that holds `src/reporter/main.ts` publishes a Vitest reporter. The case copies the
1564
+ // workspace's build inputs into a scratch directory under `tmp/`, so the real `dist/` stays as
1565
+ // the last build left it, builds core, server, and the reporter there through the workspace's own
1566
+ // wrappers, and reads what the reporter ships. A child Node process loads the built entry, as a
1567
+ // consumer's Vitest does. A workspace without the entry has no wrapper, and the assertion
1568
+ // classifies the absence.
1569
+ it('builds the reporter entry to one ES module whose default is the server class', async () => {
1570
+ const wrapper = 'configs/src/vite.reporter.config.ts'
1571
+ const planned = existsSync(resolve(POLICY_ROOT, 'src/reporter/main.ts'))
1572
+ expect(existsSync(resolve(POLICY_ROOT, wrapper))).toBe(planned)
1573
+ if (!planned) return
1574
+ mkdirSync(resolve(POLICY_ROOT, 'tmp'), { recursive: true })
1575
+ const scratch = createPolicyScratch({
1576
+ parent: resolve(POLICY_ROOT, 'tmp'),
1577
+ prefix: 'config-reporter-',
1578
+ })
1579
+ try {
1580
+ for (const path of ['package.json', 'tsconfig.json', 'vite.config.ts', 'configs', 'src']) {
1581
+ cpSync(resolve(POLICY_ROOT, path), join(scratch.path, path), { recursive: true })
1582
+ }
1583
+ const configs = [
1584
+ ...['core', 'server']
1585
+ .filter((environment) => existsSync(resolve(POLICY_ROOT, 'src', environment)))
1586
+ .map((environment) => `configs/src/vite.${environment}.config.ts`),
1587
+ wrapper,
1588
+ ]
1589
+ for (const config of configs) {
1590
+ await build({
1591
+ configFile: join(scratch.path, config),
1592
+ root: scratch.path,
1593
+ mode: 'production',
1594
+ logLevel: 'silent',
1595
+ })
1596
+ }
1597
+ const output = join(scratch.path, 'dist/reporter')
1598
+ const code = readFileSync(join(output, 'main.js'), 'utf8')
1599
+ // Each reading names its file, so a failure's diff states which output kept the alias. The
1600
+ // bundler and the extractor each choose their own quote, so the specifier reads either one.
1601
+ const built = /from ["']\.\.\/src\/server\/index\.js["']/u
1602
+ expect({
1603
+ file: 'main.js',
1604
+ alias: code.includes('@src/server'),
1605
+ built: built.test(code),
1606
+ }).toStrictEqual({ file: 'main.js', alias: false, built: true })
1607
+ const declaration = readFileSync(join(output, 'main.d.ts'), 'utf8')
1608
+ expect({
1609
+ file: 'main.d.ts',
1610
+ alias: declaration.includes('@src/server'),
1611
+ built: built.test(declaration),
1612
+ exported: declaration.includes('export default'),
1613
+ }).toStrictEqual({ file: 'main.d.ts', alias: false, built: true, exported: true })
1614
+ // The distribution scan refuses a reporter map that names no `src/reporter/` source.
1615
+ const map = join(output, 'main.js.map')
1616
+ const parsed: unknown = existsSync(map) ? JSON.parse(readFileSync(map, 'utf8')) : undefined
1617
+ const sources: unknown =
1618
+ typeof parsed === 'object' && parsed !== null
1619
+ ? Object.getOwnPropertyDescriptor(parsed, 'sources')?.value
1620
+ : undefined
1621
+ const listed = Array.isArray(sources)
1622
+ ? sources.flatMap((source: unknown) =>
1623
+ typeof source === 'string'
1624
+ ? [relative(scratch.path, resolve(output, source)).replaceAll('\\', '/')]
1625
+ : [],
1626
+ )
1627
+ : []
1628
+ expect({ file: 'main.js.map', entry: listed.includes('src/reporter/main.ts') }).toStrictEqual(
1629
+ { file: 'main.js.map', entry: true },
1630
+ )
1631
+ const reporter = pathToFileURL(join(output, 'main.js')).href
1632
+ const server = pathToFileURL(join(scratch.path, 'dist/src/server/index.js')).href
1633
+ const loaded = spawnSync(
1634
+ process.execPath,
1635
+ [
1636
+ '--input-type=module',
1637
+ '--eval',
1638
+ `const reporter = await import(${JSON.stringify(reporter)})\nconst server = await import(${JSON.stringify(server)})\nprocess.stdout.write(JSON.stringify({ kind: typeof reporter.default, owned: Object.values(server).includes(reporter.default) }))`,
1639
+ ],
1640
+ { encoding: 'utf8' },
1641
+ )
1642
+ expect({ status: loaded.status, stderr: loaded.stderr }).toStrictEqual({
1643
+ status: 0,
1644
+ stderr: '',
1645
+ })
1646
+ expect(JSON.parse(loaded.stdout)).toStrictEqual({ kind: 'function', owned: true })
1647
+ } finally {
1648
+ scratch.destroy()
1649
+ }
1650
+ // Three real builds, two of them with a declaration roll-up that runs the compiler and the
1651
+ // extractor. The budget carries slack over that because the cost is contention, not work.
1652
+ }, 120_000)
1653
+
1550
1654
  it('registers proof scripts in the correct gate', () => {
1551
1655
  const manifest: unknown = JSON.parse(readFileSync(resolve(POLICY_ROOT, 'package.json'), 'utf8'))
1552
1656
  if (typeof manifest !== 'object' || manifest === null) {
@@ -4321,6 +4425,7 @@ createSomething({
4321
4425
  'src/server',
4322
4426
  'app/server',
4323
4427
  'src/bin',
4428
+ 'src/reporter',
4324
4429
  ].flatMap((owner) => {
4325
4430
  const sheet = ['src/bootstrap', 'src/tailwindcss', 'src/styles'].includes(owner)
4326
4431
  const refused: ReadonlyArray<string | readonly [string, string]> = [
@@ -4367,11 +4472,13 @@ createSomething({
4367
4472
  ]),
4368
4473
  ]
4369
4474
  : []),
4370
- ...(['src/browser', 'src/server', 'src/vue', 'src/bin'].includes(owner)
4475
+ ...(['src/browser', 'src/server', 'src/vue', 'src/bin', 'src/reporter'].includes(owner)
4371
4476
  ? ['../core/index.js', '../../src/core/index.js']
4372
4477
  : []),
4373
4478
  ...(owner === 'src/vue' ? ['../browser/index.js', '../../src/browser/index.js'] : []),
4374
- ...(owner === 'src/bin' ? ['../server/index.js', '../../src/server/index.js'] : []),
4479
+ ...(owner === 'src/bin' || owner === 'src/reporter'
4480
+ ? ['../server/index.js', '../../src/server/index.js']
4481
+ : []),
4375
4482
  ]
4376
4483
  const admitted = [
4377
4484
  ...(owner.endsWith('/vue')
@@ -4391,10 +4498,10 @@ createSomething({
4391
4498
  : []),
4392
4499
  ]
4393
4500
  : ['@src/core']),
4394
- ...(['src/browser', 'src/server', 'src/vue', 'src/bin'].includes(owner)
4501
+ ...(['src/browser', 'src/server', 'src/vue', 'src/bin', 'src/reporter'].includes(owner)
4395
4502
  ? []
4396
4503
  : ['../core/index.js']),
4397
- ...(owner === 'src/bin' ? ['@src/server'] : []),
4504
+ ...(owner === 'src/bin' || owner === 'src/reporter' ? ['@src/server'] : []),
4398
4505
  ...(sheet
4399
4506
  ? [
4400
4507
  ...faces
@@ -4422,7 +4529,9 @@ createSomething({
4422
4529
  [
4423
4530
  ...admitted,
4424
4531
  './index.js',
4425
- ...(owner.endsWith('/server') || owner === 'src/bin' ? ['node:fs'] : []),
4532
+ ...(owner.endsWith('/server') || owner === 'src/bin' || owner === 'src/reporter'
4533
+ ? ['node:fs']
4534
+ : []),
4426
4535
  ],
4427
4536
  false,
4428
4537
  ],
@@ -4443,6 +4552,21 @@ createSomething({
4443
4552
  }),
4444
4553
  )
4445
4554
  }),
4555
+ // The reporter entry itself, in the form a relative server import would take: only the
4556
+ // `@src/server` alias reaches `output.paths`, so this import would bundle a server copy.
4557
+ ...(
4558
+ [
4559
+ [
4560
+ 'src/reporter/main.ts',
4561
+ "import { ProgressReporter } from '../server/index.js'\n\nexport default ProgressReporter\ndebugger\n",
4562
+ true,
4563
+ ],
4564
+ ] as const
4565
+ ).map(([file, content, refusal]): [string, boolean] => {
4566
+ mkdirSync(dirname(resolve(scratch, file)), { recursive: true })
4567
+ writeFileSync(resolve(scratch, file), content)
4568
+ return [file, refusal]
4569
+ }),
4446
4570
  ...(
4447
4571
  [
4448
4572
  ['probe.config.ts', 'typescript', true],
@@ -4474,12 +4598,15 @@ createSomething({
4474
4598
  if (
4475
4599
  !Array.isArray(files) ||
4476
4600
  !files.some(
4477
- (file: unknown) => typeof file === 'string' && file.startsWith('src/vue/'),
4601
+ (file: unknown) =>
4602
+ typeof file === 'string' &&
4603
+ (file.startsWith('src/vue/') || file.startsWith('src/reporter/')),
4478
4604
  )
4479
4605
  )
4480
4606
  continue
4481
4607
  const rules: unknown = Object.getOwnPropertyDescriptor(block, 'rules')?.value
4482
- if (typeof rules !== 'object' || rules === null) throw new Error('Missing Vue rules')
4608
+ if (typeof rules !== 'object' || rules === null)
4609
+ throw new Error('Missing boundary rules')
4483
4610
  Reflect.set(rules, 'no-restricted-imports', 'off')
4484
4611
  }
4485
4612
  writeFileSync(resolve(scratch, '.oxlintrc.json'), JSON.stringify(parsed))
@@ -4509,6 +4636,11 @@ createSomething({
4509
4636
  ).toThrow('deeply equal')
4510
4637
  expect(control).toContainEqual({ path: 'src/vue/refused3.ts', expected: true, actual: false })
4511
4638
  expect(control).toContainEqual({ path: 'src/vue/refused8.ts', expected: true, actual: false })
4639
+ expect(control).toContainEqual({
4640
+ path: 'src/reporter/main.ts',
4641
+ expected: true,
4642
+ actual: false,
4643
+ })
4512
4644
  } finally {
4513
4645
  fixture.destroy()
4514
4646
  }
@@ -4828,6 +4960,23 @@ createSomething({
4828
4960
  '}',
4829
4961
  ].join('\n'),
4830
4962
  )
4963
+ // The default-export exemption names `src/reporter/main.ts` alone. The entry's `debugger`
4964
+ // statement is its arrival control, and a sibling in its folder and a `main.ts` in another
4965
+ // folder carry the same default export and must each still draw the rule.
4966
+ for (const path of [
4967
+ 'src/reporter/main.ts',
4968
+ 'src/reporter/helpers.ts',
4969
+ 'src/violations/main.ts',
4970
+ ]) {
4971
+ scratch.write(
4972
+ path,
4973
+ [
4974
+ "import { SampleReporter } from '@src/server'",
4975
+ 'debugger',
4976
+ 'export default SampleReporter',
4977
+ ].join('\n'),
4978
+ )
4979
+ }
4831
4980
  scratch.write(
4832
4981
  'src/clean/CleanMember.ts',
4833
4982
  [
@@ -4874,6 +5023,7 @@ createSomething({
4874
5023
  '--format',
4875
5024
  'json',
4876
5025
  'src/violations',
5026
+ 'src/reporter',
4877
5027
  'app',
4878
5028
  'scripts',
4879
5029
  'tests',
@@ -4986,6 +5136,21 @@ createSomething({
4986
5136
  expect(violationCodes).toContain(
4987
5137
  `eslint(no-debugger) ${normalizePolicyFilename(comparisonRoot, 'scripts/read.ts')}`,
4988
5138
  )
5139
+ expect(violationCodes).toContain(
5140
+ `eslint(no-debugger) ${normalizePolicyFilename(comparisonRoot, 'src/reporter/main.ts')}`,
5141
+ )
5142
+ expect(violationCodes).not.toContain(
5143
+ `import(no-default-export) ${normalizePolicyFilename(comparisonRoot, 'src/reporter/main.ts')}`,
5144
+ )
5145
+ // The entry's `@src/server` import is the form the reporter boundary admits.
5146
+ expect(violationCodes).not.toContain(
5147
+ `eslint(no-restricted-imports) ${normalizePolicyFilename(comparisonRoot, 'src/reporter/main.ts')}`,
5148
+ )
5149
+ for (const path of ['src/reporter/helpers.ts', 'src/violations/main.ts']) {
5150
+ expect(violationCodes).toContain(
5151
+ `import(no-default-export) ${normalizePolicyFilename(comparisonRoot, path)}`,
5152
+ )
5153
+ }
4989
5154
  expect(violationCodes).not.toContain(
4990
5155
  `policy(no-host-line-endings) ${normalizePolicyFilename(comparisonRoot, 'scripts/read.ts')}`,
4991
5156
  )
@@ -5194,6 +5359,7 @@ describe('configuration helpers', () => {
5194
5359
  'readCompilerOutput',
5195
5360
  'resolveCompiler',
5196
5361
  'rewriteCoreSpecifier',
5362
+ 'rewriteServerSpecifier',
5197
5363
  'sourceFallback',
5198
5364
  'workspacePath',
5199
5365
  ]
@@ -5289,6 +5455,26 @@ describe('configuration helpers', () => {
5289
5455
  }
5290
5456
  })
5291
5457
 
5458
+ it('resolves a package root from a path the host reports as absent or beneath a file', () => {
5459
+ const scratch = createPolicyScratch({ prefix: 'orkestrel-config-lstat-' })
5460
+ try {
5461
+ const packageRoot = resolve(scratch.path, 'node_modules/@sample/package')
5462
+ const source = resolve(packageRoot, 'src/index.ts')
5463
+ mkdirSync(dirname(source), { recursive: true })
5464
+ writeFileSync(resolve(packageRoot, 'package.json'), '{"name":"@sample/package"}', 'utf8')
5465
+ writeFileSync(source, 'export {}\n', 'utf8')
5466
+ const expected = realpathSync.native(packageRoot)
5467
+ const absent = resolve(packageRoot, 'src/absent.ts')
5468
+ const beneathFile = resolve(source, 'child')
5469
+ expect(lstatSync(absent, { throwIfNoEntry: false })).toBeUndefined()
5470
+ expect(lstatSync(beneathFile, { throwIfNoEntry: false })).toBeUndefined()
5471
+ expect(configHelpers.packageRootOf('@sample/package', absent)).toBe(expected)
5472
+ expect(configHelpers.packageRootForResolved(beneathFile)).toBe(expected)
5473
+ } finally {
5474
+ scratch.destroy()
5475
+ }
5476
+ })
5477
+
5292
5478
  it('returns a producer value, or undefined when the producer throws', () => {
5293
5479
  expect(configHelpers.attemptValue(() => decodeURI('%20'))).toBe(' ')
5294
5480
  expect(configHelpers.attemptValue(() => decodeURI('%E0%A4%A'))).toBeUndefined()
@@ -5767,6 +5953,10 @@ describe('configuration helpers', () => {
5767
5953
  `from '${name}/browser'`,
5768
5954
  )
5769
5955
  expect(configHelpers.rewriteBrowserSpecifier("from './sibling.js'")).toBe("from './sibling.js'")
5956
+ expect(configHelpers.rewriteServerSpecifier("import { Reporter } from '@src/server'")).toBe(
5957
+ "import { Reporter } from '../src/server/index.js'",
5958
+ )
5959
+ expect(configHelpers.rewriteServerSpecifier("from '@src/core'")).toBe("from '@src/core'")
5770
5960
 
5771
5961
  // The mechanism the roll-up proof's skip reads: an absent package rejects resolution.
5772
5962
  expect(() => createRequire(import.meta.url).resolve('@absent/declaration-extractor')).toThrow(
@@ -8,6 +8,7 @@ import {
8
8
  createPolicyCatalog,
9
9
  createPolicySurfaceFixture,
10
10
  createPolicySurfaceGuide,
11
+ describeSurfaceCollision,
11
12
  writePolicySurfaceHost,
12
13
  createSkillMetadata,
13
14
  DIST_POLICY_CONTROLS,
@@ -27,7 +28,6 @@ import {
27
28
  inspectSkillBridges,
28
29
  isPolicyFile,
29
30
  isPolicyMirror,
30
- isPolicyRecord,
31
31
  isPolicyStray,
32
32
  matchesSkillTrigger,
33
33
  parseSkillFrontmatter,
@@ -99,7 +99,7 @@ describe('surface policy controls', () => {
99
99
  rule: 'surface',
100
100
  path: 'src/core/shared helpers.ts',
101
101
  line: 1,
102
- message: 'surface name belongs to one package: readShared (other)',
102
+ message: describeSurfaceCollision('readShared', 'other'),
103
103
  },
104
104
  ])
105
105
  } finally {
@@ -150,7 +150,7 @@ describe('surface policy controls', () => {
150
150
  rule: 'surface',
151
151
  path: 'src/core/helpers.ts',
152
152
  line: 1,
153
- message: 'surface name belongs to one package: readCheckout (other)',
153
+ message: describeSurfaceCollision('readCheckout', 'other'),
154
154
  },
155
155
  ])
156
156
  } finally {
@@ -171,7 +171,7 @@ describe('surface policy controls', () => {
171
171
  rule: 'surface',
172
172
  path: 'src/core/helpers.ts',
173
173
  line: 2,
174
- message: 'surface name belongs to one package: readShared (other)',
174
+ message: describeSurfaceCollision('readShared', 'other'),
175
175
  },
176
176
  ])
177
177
  } finally {
@@ -192,7 +192,7 @@ describe('surface policy controls', () => {
192
192
  rule: 'surface',
193
193
  path: 'tests/setupServer.ts',
194
194
  line: 1,
195
- message: 'surface name belongs to one package: readShared (other)',
195
+ message: describeSurfaceCollision('readShared', 'other'),
196
196
  },
197
197
  ])
198
198
  } finally {
@@ -211,7 +211,7 @@ describe('surface policy controls', () => {
211
211
  rule: 'surface',
212
212
  path: 'src/core/helpers.ts',
213
213
  line: 1,
214
- message: 'surface name belongs to one package: readShared (other)',
214
+ message: describeSurfaceCollision('readShared', 'other'),
215
215
  },
216
216
  ])
217
217
  scratch.write(
@@ -234,7 +234,7 @@ describe('surface policy controls', () => {
234
234
  rule: 'surface',
235
235
  path: 'tests/setupServer.ts',
236
236
  line: 1,
237
- message: 'surface name belongs to one package: readShared (other)',
237
+ message: describeSurfaceCollision('readShared', 'other'),
238
238
  },
239
239
  ])
240
240
  rmSync(join(scratch.path, 'tests/setupServer.ts'), { recursive: true, force: true })
@@ -261,7 +261,7 @@ describe('surface policy controls', () => {
261
261
  rule: 'surface',
262
262
  path: 'tests/setupGlobal.ts',
263
263
  line: 1,
264
- message: 'surface name belongs to one package: readShared (other)',
264
+ message: describeSurfaceCollision('readShared', 'other'),
265
265
  },
266
266
  ])
267
267
  } finally {
@@ -324,7 +324,7 @@ describe('surface policy controls', () => {
324
324
  rule: 'surface',
325
325
  path: 'src/core/helpers.ts',
326
326
  line: 1,
327
- message: 'surface name belongs to one package: readShared (other)',
327
+ message: describeSurfaceCollision('readShared', 'other'),
328
328
  },
329
329
  ])
330
330
  scratch.write('guides/scaffold.md', createPolicySurfaceGuide(['readShared']))
@@ -363,31 +363,31 @@ describe('surface policy controls', () => {
363
363
  rule: 'surface',
364
364
  path: 'src/core/helpers.ts',
365
365
  line: 1,
366
- message: 'surface name belongs to one package: readShared (other)',
366
+ message: describeSurfaceCollision('readShared', 'other'),
367
367
  },
368
368
  {
369
369
  rule: 'surface',
370
370
  path: 'src/core/helpers.ts',
371
371
  line: 1,
372
- message: 'surface name belongs to one package: readShared (zebra)',
372
+ message: describeSurfaceCollision('readShared', 'zebra'),
373
373
  },
374
374
  {
375
375
  rule: 'surface',
376
376
  path: 'tests/setupServer.ts',
377
377
  line: 1,
378
- message: 'surface name belongs to one package: readLater (other)',
378
+ message: describeSurfaceCollision('readLater', 'other'),
379
379
  },
380
380
  {
381
381
  rule: 'surface',
382
382
  path: 'tests/setupServer.ts',
383
383
  line: 2,
384
- message: 'surface name belongs to one package: readShared (other)',
384
+ message: describeSurfaceCollision('readShared', 'other'),
385
385
  },
386
386
  {
387
387
  rule: 'surface',
388
388
  path: 'tests/setupServer.ts',
389
389
  line: 2,
390
- message: 'surface name belongs to one package: readShared (zebra)',
390
+ message: describeSurfaceCollision('readShared', 'zebra'),
391
391
  },
392
392
  ])
393
393
  } finally {
@@ -979,7 +979,7 @@ describe('denylist currency', () => {
979
979
  describe('repository policy', () => {
980
980
  it('enforces the workspace policy laws including surface ownership', () => {
981
981
  expect(inspectPolicyWorkspace(process.cwd())).toEqual([])
982
- })
982
+ }, 20_000)
983
983
 
984
984
  // A target reads the canon from the installed package, so its tree carries the
985
985
  // pointer pair and no `.agents/` directory, no rule map, and no skill bridges.
@@ -1074,11 +1074,4 @@ describe('policy configuration wiring', () => {
1074
1074
  it('reports a configuration that is not a record', () => {
1075
1075
  expect(inspectPolicyWiring([], [], [])).toEqual(['Oxlint configuration must be a record'])
1076
1076
  })
1077
-
1078
- it('admits a plain record and refuses an array, null, and a primitive', () => {
1079
- expect(isPolicyRecord({})).toBe(true)
1080
- expect(isPolicyRecord([])).toBe(false)
1081
- expect(isPolicyRecord(null)).toBe(false)
1082
- expect(isPolicyRecord('record')).toBe(false)
1083
- })
1084
1077
  })