@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.
- package/dist/agents/skills/orkestrel-dispatch/scripts/bench.js +61 -96
- package/dist/agents/skills/orkestrel-dispatch/scripts/brief.js +48 -76
- package/dist/agents/skills/orkestrel-dispatch/scripts/chain.js +27 -66
- package/dist/agents/skills/orkestrel-dispatch/scripts/cite.js +31 -64
- package/dist/agents/skills/orkestrel-dispatch/scripts/launch.js +43 -57
- package/dist/agents/skills/orkestrel-dispatch/scripts/login.js +43 -86
- package/dist/agents/skills/orkestrel-dispatch/scripts/patch.js +68 -104
- package/dist/agents/skills/orkestrel-dispatch/scripts/result.js +35 -69
- package/dist/agents/skills/orkestrel-dispatch/scripts/sweep.js +47 -84
- package/dist/agents/skills/orkestrel-falsify/scripts/mutate.js +134 -116
- package/dist/agents/skills/orkestrel-harden/scripts/discovery.js +38 -90
- package/dist/agents/skills/orkestrel-harden/scripts/interleave.js +39 -103
- package/dist/agents/skills/orkestrel-harden/scripts/measure.js +40 -89
- package/dist/agents/skills/orkestrel-harden/scripts/titles.js +41 -87
- package/dist/agents/skills/orkestrel-parallel/scripts/cases.js +43 -88
- package/dist/agents/skills/orkestrel-parallel/scripts/lane.js +1568 -213
- package/dist/agents/skills/orkestrel-publish/scripts/compare.js +40 -60
- package/dist/agents/skills/orkestrel-publish/scripts/pins.js +47 -81
- package/dist/agents/skills/orkestrel-publish/scripts/steps.js +66 -104
- package/dist/agents/skills/orkestrel-publish/scripts/swap.js +74 -88
- package/dist/agents/skills/orkestrel-publish/scripts/wave.js +387 -109
- package/dist/agents/skills/orkestrel-publish/scripts/window.js +55 -96
- package/dist/agents/skills/orkestrel-scout/scripts/map.js +54 -101
- package/dist/bin/main.js +275 -33
- package/dist/bin/main.js.map +1 -1
- package/dist/host/AGENTS.md +1 -1
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/bench.ts +81 -97
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/brief.ts +64 -72
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/chain.ts +41 -63
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/cite.ts +56 -79
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/launch.ts +61 -74
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/login.ts +59 -89
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/patch.ts +87 -106
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/result.ts +57 -76
- package/dist/host/agents/skills/orkestrel-dispatch/scripts/sweep.ts +73 -88
- package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +2 -2
- package/dist/host/agents/skills/orkestrel-falsify/scripts/mutate.ts +167 -119
- package/dist/host/agents/skills/orkestrel-harden/references/methods.md +1 -1
- package/dist/host/agents/skills/orkestrel-harden/scripts/discovery.ts +58 -75
- package/dist/host/agents/skills/orkestrel-harden/scripts/interleave.ts +55 -99
- package/dist/host/agents/skills/orkestrel-harden/scripts/measure.ts +59 -90
- package/dist/host/agents/skills/orkestrel-harden/scripts/titles.ts +60 -80
- package/dist/host/agents/skills/orkestrel-parallel/SKILL.md +4 -4
- package/dist/host/agents/skills/orkestrel-parallel/scripts/cases.ts +71 -108
- package/dist/host/agents/skills/orkestrel-parallel/scripts/lane.ts +1990 -274
- package/dist/host/agents/skills/orkestrel-publish/references/release.md +1 -0
- package/dist/host/agents/skills/orkestrel-publish/references/wave.md +28 -7
- package/dist/host/agents/skills/orkestrel-publish/scripts/compare.ts +58 -79
- package/dist/host/agents/skills/orkestrel-publish/scripts/pins.ts +66 -87
- package/dist/host/agents/skills/orkestrel-publish/scripts/steps.ts +84 -102
- package/dist/host/agents/skills/orkestrel-publish/scripts/swap.ts +92 -99
- package/dist/host/agents/skills/orkestrel-publish/scripts/wave.ts +483 -127
- package/dist/host/agents/skills/orkestrel-publish/scripts/window.ts +82 -120
- package/dist/host/agents/skills/orkestrel-scout/SKILL.md +3 -3
- package/dist/host/agents/skills/orkestrel-scout/scripts/map.ts +85 -112
- package/dist/host/claude/agents/orkestrel.md +16 -16
- package/dist/host/claude/rules/architecture.md +1 -1
- package/dist/host/claude/rules/documentation.md +1 -1
- package/dist/host/claude/rules/patterns.md +7 -4
- package/dist/host/claude/rules/styles.md +1 -1
- package/dist/host/claude/rules/tests.md +3 -3
- package/dist/host/claude/rules/workspace.md +50 -37
- package/dist/host/configs/helpers.ts +117 -71
- package/dist/host/dotfiles/oxlintrc.json +6 -0
- package/dist/host/guides/agent.md +989 -395
- package/dist/host/guides/database.md +357 -342
- package/dist/host/guides/form.md +79 -4
- package/dist/host/guides/middleware.md +5 -5
- package/dist/host/guides/ollama.md +41 -42
- package/dist/host/guides/scaffold.md +170 -70
- package/dist/host/guides/study.md +12 -12
- package/dist/host/guides/table.md +20 -6
- package/dist/host/guides/test.md +166 -52
- package/dist/host/guides/toolbox.md +127 -81
- package/dist/host/guides/workspace.md +21 -14
- package/dist/host/manifest.json +54 -54
- package/dist/host/tests/config.test.ts +251 -7
- package/dist/host/tests/policy.test.ts +14 -21
- package/dist/host/tests/setupPolicy.ts +43 -36
- package/dist/src/core/index.cjs +533 -139
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +223 -16
- package/dist/src/core/index.d.ts +223 -16
- package/dist/src/core/index.js +524 -139
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +23 -14
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +3 -2
- package/dist/src/server/index.d.ts +3 -2
- package/dist/src/server/index.js +24 -15
- package/dist/src/server/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -19,14 +19,19 @@ import {
|
|
|
19
19
|
rmSync,
|
|
20
20
|
writeFileSync,
|
|
21
21
|
} from 'node:fs'
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
basename,
|
|
24
|
+
dirname,
|
|
25
|
+
extname,
|
|
26
|
+
isAbsolute,
|
|
27
|
+
join,
|
|
28
|
+
relative,
|
|
29
|
+
resolve as resolvePath,
|
|
30
|
+
sep,
|
|
31
|
+
} from 'node:path'
|
|
23
32
|
|
|
24
33
|
export function hasASCIIURLControl(value: string): boolean {
|
|
25
|
-
|
|
26
|
-
const code = character.codePointAt(0)
|
|
27
|
-
if (code !== undefined && (code <= 0x1f || code === 0x7f)) return true
|
|
28
|
-
}
|
|
29
|
-
return false
|
|
34
|
+
return /[\p{Cc}--[\u0080-\u009f]]/v.test(value)
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
/**
|
|
@@ -372,7 +377,7 @@ export function findPackageDirectory(current: string): string | undefined {
|
|
|
372
377
|
export function packageRootOf(packageName: string, resolvedPath: string): string | undefined {
|
|
373
378
|
const physical = physicalPath(resolvedPath)
|
|
374
379
|
const directory = findPackageDirectory(
|
|
375
|
-
|
|
380
|
+
lstatSync(physical, { throwIfNoEntry: false })?.isDirectory() ? physical : dirname(physical),
|
|
376
381
|
)
|
|
377
382
|
return directory !== undefined && packageManifestName(directory) === packageName
|
|
378
383
|
? realpathSync.native(directory)
|
|
@@ -382,7 +387,7 @@ export function packageRootOf(packageName: string, resolvedPath: string): string
|
|
|
382
387
|
export function packageRootForResolved(resolvedPath: string): string | undefined {
|
|
383
388
|
const physical = physicalPath(resolvedPath)
|
|
384
389
|
const directory = findPackageDirectory(
|
|
385
|
-
|
|
390
|
+
lstatSync(physical, { throwIfNoEntry: false })?.isDirectory() ? physical : dirname(physical),
|
|
386
391
|
)
|
|
387
392
|
return directory !== undefined && packageManifestName(directory) !== undefined
|
|
388
393
|
? realpathSync.native(directory)
|
|
@@ -518,7 +523,7 @@ export class BuildState {
|
|
|
518
523
|
#building = false
|
|
519
524
|
#output: string
|
|
520
525
|
#root = WORKSPACE_ROOT
|
|
521
|
-
#
|
|
526
|
+
#entries: Readonly<Record<string, string>> = {}
|
|
522
527
|
readonly #trusted = new Set<string>()
|
|
523
528
|
|
|
524
529
|
constructor(output = WORKSPACE_ROOT) {
|
|
@@ -540,9 +545,9 @@ export class BuildState {
|
|
|
540
545
|
return this.#root
|
|
541
546
|
}
|
|
542
547
|
|
|
543
|
-
/** The library entry
|
|
544
|
-
get
|
|
545
|
-
return this.#
|
|
548
|
+
/** The library entry paths by entry name, empty when the build has none. */
|
|
549
|
+
get entries(): Readonly<Record<string, string>> {
|
|
550
|
+
return this.#entries
|
|
546
551
|
}
|
|
547
552
|
|
|
548
553
|
/**
|
|
@@ -567,7 +572,10 @@ export class BuildState {
|
|
|
567
572
|
}
|
|
568
573
|
|
|
569
574
|
/**
|
|
570
|
-
* Reads the command, output directory, project root, and library
|
|
575
|
+
* Reads the command, output directory, project root, and library entries from a resolved config.
|
|
576
|
+
*
|
|
577
|
+
* @remarks
|
|
578
|
+
* A single-path entry and each member of an entry list take their file's stem as their name.
|
|
571
579
|
*
|
|
572
580
|
* @param config - The resolved Vite configuration.
|
|
573
581
|
*/
|
|
@@ -575,10 +583,11 @@ export class BuildState {
|
|
|
575
583
|
this.#building = config.command === 'build'
|
|
576
584
|
this.#output = resolvePath(config.root, config.build.outDir)
|
|
577
585
|
this.#root = physicalPath(config.root)
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
586
|
+
const entry = config.build.lib === false ? {} : config.build.lib.entry
|
|
587
|
+
this.#entries =
|
|
588
|
+
typeof entry === 'string' || Array.isArray(entry)
|
|
589
|
+
? Object.fromEntries([entry].flat().map((path) => [basename(path, extname(path)), path]))
|
|
590
|
+
: { ...entry }
|
|
582
591
|
}
|
|
583
592
|
}
|
|
584
593
|
|
|
@@ -692,13 +701,15 @@ export interface ExtractorModule {
|
|
|
692
701
|
*
|
|
693
702
|
* @remarks
|
|
694
703
|
* `project` is the absolute path of that face's TypeScript project file. `types` overrides the
|
|
695
|
-
* `types` the extractor's own program reads, and defaults to the face's resolved `types`. `
|
|
696
|
-
*
|
|
697
|
-
*
|
|
704
|
+
* `types` the extractor's own program reads, and defaults to the face's resolved `types`. `entries`
|
|
705
|
+
* names the library entries that roll up, and defaults to every entry the build declares; a
|
|
706
|
+
* single-path entry takes its file's stem as its name. `rewrite` receives each finished roll-up and
|
|
707
|
+
* returns what the face ships; a face that omits it ships the roll-up as the extractor wrote it.
|
|
698
708
|
*/
|
|
699
709
|
export interface DeclarationRollupOptions {
|
|
700
710
|
readonly project: string
|
|
701
711
|
readonly types?: readonly string[]
|
|
712
|
+
readonly entries?: readonly string[]
|
|
702
713
|
readonly rewrite?: (content: string) => string
|
|
703
714
|
}
|
|
704
715
|
|
|
@@ -874,7 +885,28 @@ export function rewriteBrowserSpecifier(content: string): string {
|
|
|
874
885
|
}
|
|
875
886
|
|
|
876
887
|
/**
|
|
877
|
-
*
|
|
888
|
+
* Rewrites every source environment alias in a roll-up to the built environment beside `dist/bin`.
|
|
889
|
+
*
|
|
890
|
+
* @param content - The finished roll-up.
|
|
891
|
+
* @returns That roll-up with each `@src/<environment>` specifier replaced by
|
|
892
|
+
* `../src/<environment>/index.js`.
|
|
893
|
+
*
|
|
894
|
+
* @remarks
|
|
895
|
+
* A `src/bin` module reaches a library environment through its `@src/*` alias, and the extractor
|
|
896
|
+
* keeps the alias external and writes it through unchanged. `dist/bin/<name>.d.ts` resolves the
|
|
897
|
+
* environment's declarations at the relative path its `<name>.js` imports through `output.paths`.
|
|
898
|
+
*
|
|
899
|
+
* @example
|
|
900
|
+
* ```ts
|
|
901
|
+
* rewriteSourceSpecifier("from '@src/server'") // "from '../src/server/index.js'"
|
|
902
|
+
* ```
|
|
903
|
+
*/
|
|
904
|
+
export function rewriteSourceSpecifier(content: string): string {
|
|
905
|
+
return content.replaceAll(/@src\/([a-z][a-z0-9-]*)(?=['"])/gu, '../src/$1/index.js')
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* Rolls each named library entry's declarations into the single file that entry ships.
|
|
878
910
|
*
|
|
879
911
|
* @param options - The face's roll-up options.
|
|
880
912
|
* @returns The Vite plugin that performs that roll-up.
|
|
@@ -882,13 +914,15 @@ export function rewriteBrowserSpecifier(content: string): string {
|
|
|
882
914
|
* @remarks
|
|
883
915
|
* At `closeBundle`, after Vite has written every format of the face, the plugin emits the face's
|
|
884
916
|
* declarations with the workspace compiler run as a process into a scratch directory made fresh
|
|
885
|
-
* under the host temporary directory, hands
|
|
886
|
-
* applies `rewrite`, and removes the scratch directory.
|
|
887
|
-
*
|
|
888
|
-
*
|
|
889
|
-
*
|
|
890
|
-
*
|
|
891
|
-
*
|
|
917
|
+
* under the host temporary directory, hands each named entry to the extractor's own engine,
|
|
918
|
+
* applies `rewrite`, and removes the scratch directory. Each roll-up takes its entry's name, so
|
|
919
|
+
* an `index.ts` face ships `index.d.ts` and a `reporter` entry ships `reporter.d.ts`. An empty
|
|
920
|
+
* `entries` list rolls up nothing. Keeping the
|
|
921
|
+
* scratch outside the face's own output means its unconditional removal can never take a sibling
|
|
922
|
+
* the face already published, such as its own `declarations` folder. The extractor is a publishing
|
|
923
|
+
* workspace's development dependency, so this vendored leaf defers loading it to that hook: a
|
|
924
|
+
* workspace that publishes no library installs no extractor, never reaches the hook, and never
|
|
925
|
+
* resolves the package at build or at check.
|
|
892
926
|
*/
|
|
893
927
|
export function declarationRollup(options: DeclarationRollupOptions): Plugin {
|
|
894
928
|
const state = new BuildState()
|
|
@@ -899,12 +933,20 @@ export function declarationRollup(options: DeclarationRollupOptions): Plugin {
|
|
|
899
933
|
},
|
|
900
934
|
closeBundle() {
|
|
901
935
|
if (!state.building) return
|
|
902
|
-
const
|
|
903
|
-
|
|
936
|
+
const named = options.entries ?? Object.keys(state.entries)
|
|
937
|
+
const declarations = named.map((name) => {
|
|
938
|
+
const source = state.entries[name] ?? ''
|
|
939
|
+
return { name, source, declaration: source.replace(/\.tsx?$/, '.d.ts') }
|
|
940
|
+
})
|
|
941
|
+
if (
|
|
942
|
+
(options.entries === undefined && declarations.length === 0) ||
|
|
943
|
+
declarations.some(({ source, declaration }) => declaration === source)
|
|
944
|
+
) {
|
|
904
945
|
throw new Error(
|
|
905
|
-
'[orkestrel-declaration-rollup] The face must build
|
|
946
|
+
'[orkestrel-declaration-rollup] The face must build each named TypeScript library entry',
|
|
906
947
|
)
|
|
907
948
|
}
|
|
949
|
+
if (declarations.length === 0) return
|
|
908
950
|
const load = createRequire(import.meta.url)
|
|
909
951
|
const compiler = resolveCompiler(import.meta.url)
|
|
910
952
|
const scope = parseProjectScope(
|
|
@@ -917,7 +959,6 @@ export function declarationRollup(options: DeclarationRollupOptions): Plugin {
|
|
|
917
959
|
)
|
|
918
960
|
}
|
|
919
961
|
const scratch = mkdtempSync(join(tmpdir(), 'orkestrel-declarations-'))
|
|
920
|
-
const rollup = resolvePath(state.output, 'index.d.ts')
|
|
921
962
|
try {
|
|
922
963
|
readCompilerOutput(compiler, [
|
|
923
964
|
'-p',
|
|
@@ -929,7 +970,6 @@ export function declarationRollup(options: DeclarationRollupOptions): Plugin {
|
|
|
929
970
|
'--outDir',
|
|
930
971
|
scratch,
|
|
931
972
|
])
|
|
932
|
-
const entry = resolvePath(scratch, relative(scope.root, declaration))
|
|
933
973
|
// A literal `import()` of the extractor reddens `tsc` in a workspace that does not
|
|
934
974
|
// install it, so the literal `createRequire` call is the form that clears the
|
|
935
975
|
// typecheck in an app-only workspace.
|
|
@@ -939,45 +979,51 @@ export function declarationRollup(options: DeclarationRollupOptions): Plugin {
|
|
|
939
979
|
'[orkestrel-declaration-rollup] The declaration extractor exposes no entry point',
|
|
940
980
|
)
|
|
941
981
|
}
|
|
942
|
-
const
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
982
|
+
for (const { name, declaration } of declarations) {
|
|
983
|
+
const entry = resolvePath(scratch, relative(scope.root, declaration))
|
|
984
|
+
const rollup = resolvePath(state.output, `${name}.d.ts`)
|
|
985
|
+
const prepared: unknown = loaded.ExtractorConfig.prepare({
|
|
986
|
+
configObject: {
|
|
987
|
+
projectFolder: WORKSPACE_ROOT,
|
|
988
|
+
mainEntryPointFilePath: entry,
|
|
989
|
+
bundledPackages: [],
|
|
990
|
+
compiler: {
|
|
991
|
+
overrideTsconfig: buildExtractorOverride(
|
|
992
|
+
entry,
|
|
993
|
+
scope.lib,
|
|
994
|
+
options.types ?? scope.types,
|
|
995
|
+
),
|
|
996
|
+
},
|
|
997
|
+
apiReport: { enabled: false },
|
|
998
|
+
docModel: { enabled: false },
|
|
999
|
+
tsdocMetadata: { enabled: false },
|
|
1000
|
+
dtsRollup: { enabled: true, untrimmedFilePath: rollup },
|
|
1001
|
+
messages: {
|
|
1002
|
+
compilerMessageReporting: { default: { logLevel: 'none' } },
|
|
1003
|
+
extractorMessageReporting: { default: { logLevel: 'none' } },
|
|
1004
|
+
tsdocMessageReporting: { default: { logLevel: 'none' } },
|
|
1005
|
+
},
|
|
962
1006
|
},
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
1007
|
+
configObjectFullPath: resolvePath(WORKSPACE_ROOT, 'api-extractor.json'),
|
|
1008
|
+
packageJsonFullPath: resolvePath(WORKSPACE_ROOT, 'package.json'),
|
|
1009
|
+
})
|
|
1010
|
+
const outcome: unknown = loaded.Extractor.invoke(prepared, {
|
|
1011
|
+
localBuild: true,
|
|
1012
|
+
showVerboseMessages: false,
|
|
1013
|
+
showDiagnostics: false,
|
|
1014
|
+
})
|
|
1015
|
+
const succeeded: unknown =
|
|
1016
|
+
typeof outcome === 'object' && outcome !== null
|
|
1017
|
+
? Reflect.get(outcome, 'succeeded')
|
|
1018
|
+
: undefined
|
|
1019
|
+
if (succeeded !== true) {
|
|
1020
|
+
throw new Error(
|
|
1021
|
+
`[orkestrel-declaration-rollup] The declaration roll-up of ${name} failed`,
|
|
1022
|
+
)
|
|
1023
|
+
}
|
|
1024
|
+
if (options.rewrite !== undefined) {
|
|
1025
|
+
writeFileSync(rollup, options.rewrite(readFileSync(rollup, 'utf8')), 'utf8')
|
|
1026
|
+
}
|
|
981
1027
|
}
|
|
982
1028
|
} finally {
|
|
983
1029
|
rmSync(scratch, { recursive: true, force: true })
|