@orkestrel/scaffold 0.0.133 → 0.0.135

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 (92) 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 +1568 -213
  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 +387 -109
  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 +275 -33
  25. package/dist/bin/main.js.map +1 -1
  26. package/dist/host/AGENTS.md +1 -1
  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 +1990 -274
  46. package/dist/host/agents/skills/orkestrel-publish/references/release.md +1 -0
  47. package/dist/host/agents/skills/orkestrel-publish/references/wave.md +28 -7
  48. package/dist/host/agents/skills/orkestrel-publish/scripts/compare.ts +58 -79
  49. package/dist/host/agents/skills/orkestrel-publish/scripts/pins.ts +66 -87
  50. package/dist/host/agents/skills/orkestrel-publish/scripts/steps.ts +84 -102
  51. package/dist/host/agents/skills/orkestrel-publish/scripts/swap.ts +92 -99
  52. package/dist/host/agents/skills/orkestrel-publish/scripts/wave.ts +483 -127
  53. package/dist/host/agents/skills/orkestrel-publish/scripts/window.ts +82 -120
  54. package/dist/host/agents/skills/orkestrel-scout/SKILL.md +3 -3
  55. package/dist/host/agents/skills/orkestrel-scout/scripts/map.ts +85 -112
  56. package/dist/host/claude/agents/orkestrel.md +16 -16
  57. package/dist/host/claude/rules/architecture.md +1 -1
  58. package/dist/host/claude/rules/documentation.md +1 -1
  59. package/dist/host/claude/rules/patterns.md +7 -4
  60. package/dist/host/claude/rules/styles.md +1 -1
  61. package/dist/host/claude/rules/tests.md +3 -3
  62. package/dist/host/claude/rules/workspace.md +50 -37
  63. package/dist/host/configs/helpers.ts +117 -71
  64. package/dist/host/dotfiles/oxlintrc.json +6 -0
  65. package/dist/host/guides/agent.md +989 -395
  66. package/dist/host/guides/database.md +357 -342
  67. package/dist/host/guides/form.md +79 -4
  68. package/dist/host/guides/middleware.md +5 -5
  69. package/dist/host/guides/ollama.md +41 -42
  70. package/dist/host/guides/scaffold.md +170 -70
  71. package/dist/host/guides/study.md +12 -12
  72. package/dist/host/guides/table.md +20 -6
  73. package/dist/host/guides/test.md +166 -52
  74. package/dist/host/guides/toolbox.md +127 -81
  75. package/dist/host/guides/workspace.md +21 -14
  76. package/dist/host/manifest.json +54 -54
  77. package/dist/host/tests/config.test.ts +251 -7
  78. package/dist/host/tests/policy.test.ts +14 -21
  79. package/dist/host/tests/setupPolicy.ts +43 -36
  80. package/dist/src/core/index.cjs +533 -139
  81. package/dist/src/core/index.cjs.map +1 -1
  82. package/dist/src/core/index.d.cts +223 -16
  83. package/dist/src/core/index.d.ts +223 -16
  84. package/dist/src/core/index.js +524 -139
  85. package/dist/src/core/index.js.map +1 -1
  86. package/dist/src/server/index.cjs +23 -14
  87. package/dist/src/server/index.cjs.map +1 -1
  88. package/dist/src/server/index.d.cts +3 -2
  89. package/dist/src/server/index.d.ts +3 -2
  90. package/dist/src/server/index.js +24 -15
  91. package/dist/src/server/index.js.map +1 -1
  92. package/package.json +2 -2
@@ -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,
@@ -1260,7 +1262,7 @@ describe('root configuration', () => {
1260
1262
  if (output === undefined) throw new Error(`${wrapper} carries no output`)
1261
1263
  const expected =
1262
1264
  environment === 'bin'
1263
- ? 'dist/bin'
1265
+ ? `dist/${environment}`
1264
1266
  : environment === 'showcase'
1265
1267
  ? 'showcase'
1266
1268
  : `dist/${axis}/${environment}`
@@ -1547,6 +1549,130 @@ describe('root configuration', () => {
1547
1549
  }
1548
1550
  })
1549
1551
 
1552
+ // A workspace publishes each `src/bin` module other than `main`: a direct lowercase `.ts` child
1553
+ // that no centralized file names. The case copies the workspace's build inputs into a scratch
1554
+ // directory under `tmp/`, so the real `dist/` stays as the last build left it, builds the
1555
+ // library environments and the bin there through the workspace's own wrappers, and reads what
1556
+ // each module ships. A child Node process loads each built module, as a host tool does, and
1557
+ // its default must be a value an environment it imports exports. A workspace with no such
1558
+ // module builds nothing here.
1559
+ it('builds each src/bin module to one ES module whose default an environment exports', async () => {
1560
+ const wrapper = 'configs/src/vite.bin.config.ts'
1561
+ const directory = resolve(POLICY_ROOT, 'src/bin')
1562
+ const modules = existsSync(directory)
1563
+ ? readdirSync(directory)
1564
+ .filter(
1565
+ (file) => /^[a-z][a-z0-9]*\.ts$/u.test(file) && !CENTRAL_SOURCE_FILES.includes(file),
1566
+ )
1567
+ .map((file) => file.slice(0, -'.ts'.length))
1568
+ : []
1569
+ expect(existsSync(resolve(POLICY_ROOT, wrapper))).toBe(modules.length > 0)
1570
+ const published = modules.filter((name) => name !== 'main')
1571
+ if (published.length === 0) return
1572
+ mkdirSync(resolve(POLICY_ROOT, 'tmp'), { recursive: true })
1573
+ const scratch = createPolicyScratch({
1574
+ parent: resolve(POLICY_ROOT, 'tmp'),
1575
+ prefix: 'config-bin-',
1576
+ })
1577
+ try {
1578
+ for (const path of ['package.json', 'tsconfig.json', 'vite.config.ts', 'configs', 'src']) {
1579
+ cpSync(resolve(POLICY_ROOT, path), join(scratch.path, path), { recursive: true })
1580
+ }
1581
+ const environments = ['core', 'server'].filter((environment) =>
1582
+ existsSync(resolve(POLICY_ROOT, 'src', environment)),
1583
+ )
1584
+ for (const config of [
1585
+ ...environments.map((environment) => `configs/src/vite.${environment}.config.ts`),
1586
+ wrapper,
1587
+ ]) {
1588
+ await build({
1589
+ configFile: join(scratch.path, config),
1590
+ root: scratch.path,
1591
+ mode: 'production',
1592
+ logLevel: 'silent',
1593
+ })
1594
+ }
1595
+ const output = join(scratch.path, 'dist/bin')
1596
+ // Rolldown strips a source shebang, so the executable carries the banner and no module does.
1597
+ const executable = join(output, 'main.js')
1598
+ expect({
1599
+ file: 'main.js',
1600
+ shebang: existsSync(executable)
1601
+ ? readFileSync(executable, 'utf8').startsWith('#!/usr/bin/env node\n')
1602
+ : undefined,
1603
+ }).toStrictEqual({ file: 'main.js', shebang: modules.includes('main') ? true : undefined })
1604
+ for (const name of published) {
1605
+ const source = readFileSync(join(directory, `${name}.ts`), 'utf8')
1606
+ const imported = [...source.matchAll(/from ["']@src\/([a-z][a-z0-9-]*)["']/gu)].flatMap(
1607
+ (match) => (match[1] === undefined ? [] : [match[1]]),
1608
+ )
1609
+ const code = readFileSync(join(output, `${name}.js`), 'utf8')
1610
+ // Each reading names its file, so a failure's diff states which output kept the alias. The
1611
+ // bundler and the extractor each choose their own quote, so a specifier is read without one.
1612
+ expect({
1613
+ file: `${name}.js`,
1614
+ alias: code.includes('@src/'),
1615
+ built: imported.every((environment) => code.includes(`../src/${environment}/index.js`)),
1616
+ shebang: code.startsWith('#!'),
1617
+ }).toStrictEqual({ file: `${name}.js`, alias: false, built: true, shebang: false })
1618
+ const typed = join(output, `${name}.d.ts`)
1619
+ const declaration = existsSync(typed) ? readFileSync(typed, 'utf8') : ''
1620
+ expect({
1621
+ file: `${name}.d.ts`,
1622
+ present: existsSync(typed),
1623
+ alias: declaration.includes('@src/'),
1624
+ built: imported.every((environment) =>
1625
+ declaration.includes(`../src/${environment}/index.js`),
1626
+ ),
1627
+ exported: declaration.includes('export default'),
1628
+ }).toStrictEqual({
1629
+ file: `${name}.d.ts`,
1630
+ present: true,
1631
+ alias: false,
1632
+ built: true,
1633
+ exported: true,
1634
+ })
1635
+ // The distribution scan refuses a module map that names no `src/bin/` source.
1636
+ const map = join(output, `${name}.js.map`)
1637
+ const parsed: unknown = existsSync(map) ? JSON.parse(readFileSync(map, 'utf8')) : undefined
1638
+ const sources: unknown =
1639
+ typeof parsed === 'object' && parsed !== null
1640
+ ? Object.getOwnPropertyDescriptor(parsed, 'sources')?.value
1641
+ : undefined
1642
+ const listed = Array.isArray(sources)
1643
+ ? sources.flatMap((entry: unknown) =>
1644
+ typeof entry === 'string'
1645
+ ? [relative(scratch.path, resolve(output, entry)).replaceAll('\\', '/')]
1646
+ : [],
1647
+ )
1648
+ : []
1649
+ expect({
1650
+ file: `${name}.js.map`,
1651
+ entry: listed.includes(`src/bin/${name}.ts`),
1652
+ }).toStrictEqual({ file: `${name}.js.map`, entry: true })
1653
+ const loaded = spawnSync(
1654
+ process.execPath,
1655
+ [
1656
+ '--input-type=module',
1657
+ '--eval',
1658
+ `const module = await import(${JSON.stringify(pathToFileURL(join(output, `${name}.js`)).href)})\nconst values = []\nfor (const href of ${JSON.stringify(imported.map((environment) => pathToFileURL(join(scratch.path, `dist/src/${environment}/index.js`)).href))}) values.push(...Object.values(await import(href)))\nprocess.stdout.write(JSON.stringify({ defined: module.default !== undefined, owned: values.includes(module.default) }))`,
1659
+ ],
1660
+ { encoding: 'utf8' },
1661
+ )
1662
+ expect({ file: `${name}.js`, status: loaded.status, stderr: loaded.stderr }).toStrictEqual({
1663
+ file: `${name}.js`,
1664
+ status: 0,
1665
+ stderr: '',
1666
+ })
1667
+ expect(JSON.parse(loaded.stdout)).toStrictEqual({ defined: true, owned: true })
1668
+ }
1669
+ } finally {
1670
+ scratch.destroy()
1671
+ }
1672
+ // Three real builds, two of them with a declaration roll-up that runs the compiler and the
1673
+ // extractor. The budget carries slack over that because the cost is contention, not work.
1674
+ }, 120_000)
1675
+
1550
1676
  it('registers proof scripts in the correct gate', () => {
1551
1677
  const manifest: unknown = JSON.parse(readFileSync(resolve(POLICY_ROOT, 'package.json'), 'utf8'))
1552
1678
  if (typeof manifest !== 'object' || manifest === null) {
@@ -4443,6 +4569,21 @@ createSomething({
4443
4569
  }),
4444
4570
  )
4445
4571
  }),
4572
+ // A bin module in the form a relative server import would take: only the
4573
+ // `@src/server` alias reaches `output.paths`, so this import would bundle a server copy.
4574
+ ...(
4575
+ [
4576
+ [
4577
+ 'src/bin/reporter.ts',
4578
+ "import { ProgressReporter } from '../server/index.js'\n\nexport default ProgressReporter\ndebugger\n",
4579
+ true,
4580
+ ],
4581
+ ] as const
4582
+ ).map(([file, content, refusal]): [string, boolean] => {
4583
+ mkdirSync(dirname(resolve(scratch, file)), { recursive: true })
4584
+ writeFileSync(resolve(scratch, file), content)
4585
+ return [file, refusal]
4586
+ }),
4446
4587
  ...(
4447
4588
  [
4448
4589
  ['probe.config.ts', 'typescript', true],
@@ -4474,12 +4615,15 @@ createSomething({
4474
4615
  if (
4475
4616
  !Array.isArray(files) ||
4476
4617
  !files.some(
4477
- (file: unknown) => typeof file === 'string' && file.startsWith('src/vue/'),
4618
+ (file: unknown) =>
4619
+ typeof file === 'string' &&
4620
+ (file.startsWith('src/vue/') || file.startsWith('src/bin/')),
4478
4621
  )
4479
4622
  )
4480
4623
  continue
4481
4624
  const rules: unknown = Object.getOwnPropertyDescriptor(block, 'rules')?.value
4482
- if (typeof rules !== 'object' || rules === null) throw new Error('Missing Vue rules')
4625
+ if (typeof rules !== 'object' || rules === null)
4626
+ throw new Error('Missing boundary rules')
4483
4627
  Reflect.set(rules, 'no-restricted-imports', 'off')
4484
4628
  }
4485
4629
  writeFileSync(resolve(scratch, '.oxlintrc.json'), JSON.stringify(parsed))
@@ -4509,6 +4653,11 @@ createSomething({
4509
4653
  ).toThrow('deeply equal')
4510
4654
  expect(control).toContainEqual({ path: 'src/vue/refused3.ts', expected: true, actual: false })
4511
4655
  expect(control).toContainEqual({ path: 'src/vue/refused8.ts', expected: true, actual: false })
4656
+ expect(control).toContainEqual({
4657
+ path: 'src/bin/reporter.ts',
4658
+ expected: true,
4659
+ actual: false,
4660
+ })
4512
4661
  } finally {
4513
4662
  fixture.destroy()
4514
4663
  }
@@ -4828,6 +4977,23 @@ createSomething({
4828
4977
  '}',
4829
4978
  ].join('\n'),
4830
4979
  )
4980
+ // The default-export exemption names the direct `src/bin` modules alone. The module's `debugger`
4981
+ // statement is its arrival control, and a server module and a `main.ts` in another
4982
+ // folder carry the same default export and must each still draw the rule.
4983
+ for (const path of [
4984
+ 'src/bin/reporter.ts',
4985
+ 'src/server/reporter.ts',
4986
+ 'src/violations/main.ts',
4987
+ ]) {
4988
+ scratch.write(
4989
+ path,
4990
+ [
4991
+ "import { SampleReporter } from '@src/server'",
4992
+ 'debugger',
4993
+ 'export default SampleReporter',
4994
+ ].join('\n'),
4995
+ )
4996
+ }
4831
4997
  scratch.write(
4832
4998
  'src/clean/CleanMember.ts',
4833
4999
  [
@@ -4874,6 +5040,8 @@ createSomething({
4874
5040
  '--format',
4875
5041
  'json',
4876
5042
  'src/violations',
5043
+ 'src/bin',
5044
+ 'src/server',
4877
5045
  'app',
4878
5046
  'scripts',
4879
5047
  'tests',
@@ -4986,6 +5154,29 @@ createSomething({
4986
5154
  expect(violationCodes).toContain(
4987
5155
  `eslint(no-debugger) ${normalizePolicyFilename(comparisonRoot, 'scripts/read.ts')}`,
4988
5156
  )
5157
+ expect(violationCodes).toContain(
5158
+ `eslint(no-debugger) ${normalizePolicyFilename(comparisonRoot, 'src/bin/reporter.ts')}`,
5159
+ )
5160
+ expect(violationCodes).not.toContain(
5161
+ `import(no-default-export) ${normalizePolicyFilename(comparisonRoot, 'src/bin/reporter.ts')}`,
5162
+ )
5163
+ // The module's `@src/server` import is the form the `src/bin` boundary admits, and the
5164
+ // placement rules read a lowercase module beside `main.ts` as no misplaced file.
5165
+ expect(violationCodes).not.toContain(
5166
+ `eslint(no-restricted-imports) ${normalizePolicyFilename(comparisonRoot, 'src/bin/reporter.ts')}`,
5167
+ )
5168
+ expect(
5169
+ violationCodes.filter(
5170
+ (code) =>
5171
+ code.startsWith('policy(') &&
5172
+ code.endsWith(` ${normalizePolicyFilename(comparisonRoot, 'src/bin/reporter.ts')}`),
5173
+ ),
5174
+ ).toStrictEqual([])
5175
+ for (const path of ['src/server/reporter.ts', 'src/violations/main.ts']) {
5176
+ expect(violationCodes).toContain(
5177
+ `import(no-default-export) ${normalizePolicyFilename(comparisonRoot, path)}`,
5178
+ )
5179
+ }
4989
5180
  expect(violationCodes).not.toContain(
4990
5181
  `policy(no-host-line-endings) ${normalizePolicyFilename(comparisonRoot, 'scripts/read.ts')}`,
4991
5182
  )
@@ -5194,6 +5385,7 @@ describe('configuration helpers', () => {
5194
5385
  'readCompilerOutput',
5195
5386
  'resolveCompiler',
5196
5387
  'rewriteCoreSpecifier',
5388
+ 'rewriteSourceSpecifier',
5197
5389
  'sourceFallback',
5198
5390
  'workspacePath',
5199
5391
  ]
@@ -5289,6 +5481,26 @@ describe('configuration helpers', () => {
5289
5481
  }
5290
5482
  })
5291
5483
 
5484
+ it('resolves a package root from a path the host reports as absent or beneath a file', () => {
5485
+ const scratch = createPolicyScratch({ prefix: 'orkestrel-config-lstat-' })
5486
+ try {
5487
+ const packageRoot = resolve(scratch.path, 'node_modules/@sample/package')
5488
+ const source = resolve(packageRoot, 'src/index.ts')
5489
+ mkdirSync(dirname(source), { recursive: true })
5490
+ writeFileSync(resolve(packageRoot, 'package.json'), '{"name":"@sample/package"}', 'utf8')
5491
+ writeFileSync(source, 'export {}\n', 'utf8')
5492
+ const expected = realpathSync.native(packageRoot)
5493
+ const absent = resolve(packageRoot, 'src/absent.ts')
5494
+ const beneathFile = resolve(source, 'child')
5495
+ expect(lstatSync(absent, { throwIfNoEntry: false })).toBeUndefined()
5496
+ expect(lstatSync(beneathFile, { throwIfNoEntry: false })).toBeUndefined()
5497
+ expect(configHelpers.packageRootOf('@sample/package', absent)).toBe(expected)
5498
+ expect(configHelpers.packageRootForResolved(beneathFile)).toBe(expected)
5499
+ } finally {
5500
+ scratch.destroy()
5501
+ }
5502
+ })
5503
+
5292
5504
  it('returns a producer value, or undefined when the producer throws', () => {
5293
5505
  expect(configHelpers.attemptValue(() => decodeURI('%20'))).toBe(' ')
5294
5506
  expect(configHelpers.attemptValue(() => decodeURI('%E0%A4%A'))).toBeUndefined()
@@ -5364,7 +5576,7 @@ describe('configuration helpers', () => {
5364
5576
  expect(fresh.building).toBe(false)
5365
5577
  expect(fresh.output).toBe(configHelpers.WORKSPACE_ROOT)
5366
5578
  expect(fresh.root).toBe(configHelpers.WORKSPACE_ROOT)
5367
- expect(fresh.source).toBe('')
5579
+ expect(fresh.entries).toStrictEqual({})
5368
5580
  expect(new configHelpers.BuildState('C:/output').output).toBe('C:/output')
5369
5581
 
5370
5582
  const entry = resolve(scratch.path, 'index.ts')
@@ -5379,13 +5591,34 @@ describe('configuration helpers', () => {
5379
5591
  expect(buildState.building).toBe(true)
5380
5592
  expect(buildState.output).toBe(resolve(scratch.path, 'out'))
5381
5593
  expect(buildState.root).toBe(realpathSync.native(scratch.path))
5382
- expect(buildState.source).toBe(entry)
5594
+ expect(buildState.entries).toStrictEqual({ index: entry })
5595
+ // A named entry map keeps its names; a list names each member by its file's stem.
5596
+ const tool = resolve(scratch.path, 'reporter.ts')
5597
+ const named = new configHelpers.BuildState()
5598
+ named.resolve(
5599
+ await resolveConfig(
5600
+ {
5601
+ ...inline,
5602
+ build: { outDir: 'out', lib: { entry: { main: entry, tool }, formats: ['es'] } },
5603
+ },
5604
+ 'build',
5605
+ ),
5606
+ )
5607
+ expect(named.entries).toStrictEqual({ main: entry, tool })
5608
+ const listed = new configHelpers.BuildState()
5609
+ listed.resolve(
5610
+ await resolveConfig(
5611
+ { ...inline, build: { outDir: 'out', lib: { entry: [entry, tool], formats: ['es'] } } },
5612
+ 'build',
5613
+ ),
5614
+ )
5615
+ expect(listed.entries).toStrictEqual({ index: entry, reporter: tool })
5383
5616
 
5384
5617
  // The control: a serve command is not a build, and a config with no library entry has no source.
5385
5618
  const serveState = new configHelpers.BuildState()
5386
5619
  serveState.resolve(await resolveConfig({ ...inline, build: { outDir: 'out' } }, 'serve'))
5387
5620
  expect(serveState.building).toBe(false)
5388
- expect(serveState.source).toBe('')
5621
+ expect(serveState.entries).toStrictEqual({})
5389
5622
  } finally {
5390
5623
  scratch.destroy()
5391
5624
  }
@@ -5419,11 +5652,11 @@ describe('configuration helpers', () => {
5419
5652
  expect(Object.getOwnPropertyNames(configHelpers.BuildState.prototype).sort()).toEqual([
5420
5653
  'building',
5421
5654
  'constructor',
5655
+ 'entries',
5422
5656
  'locate',
5423
5657
  'output',
5424
5658
  'resolve',
5425
5659
  'root',
5426
- 'source',
5427
5660
  'trust',
5428
5661
  ])
5429
5662
  } finally {
@@ -5767,6 +6000,17 @@ describe('configuration helpers', () => {
5767
6000
  `from '${name}/browser'`,
5768
6001
  )
5769
6002
  expect(configHelpers.rewriteBrowserSpecifier("from './sibling.js'")).toBe("from './sibling.js'")
6003
+ expect(
6004
+ configHelpers.rewriteSourceSpecifier(
6005
+ 'import { Reporter } from \'@src/server\'\nimport type { Shape } from "@src/core"',
6006
+ ),
6007
+ ).toBe(
6008
+ 'import { Reporter } from \'../src/server/index.js\'\nimport type { Shape } from "../src/core/index.js"',
6009
+ )
6010
+ // A specifier past the environment, and a mention outside quotes, are no environment alias.
6011
+ expect(configHelpers.rewriteSourceSpecifier("from '@src/core/types.js' // @src/server")).toBe(
6012
+ "from '@src/core/types.js' // @src/server",
6013
+ )
5770
6014
 
5771
6015
  // The mechanism the roll-up proof's skip reads: an absent package rejects resolution.
5772
6016
  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 {
@@ -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
  })