-
Notifications
You must be signed in to change notification settings - Fork 0
feat(config): ship conventional src/scripts/ modules through the scripts pipeline (#102 stage 1) #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat(config): ship conventional src/scripts/ modules through the scripts pipeline (#102 stage 1) #143
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
| "agent-bundle": patch | ||
| --- | ||
|
|
||
| Discover plain `src/scripts/` modules as conventional script entries (#102 | ||
| stage 1). An unclaimed plain `.ts` module directly under `src/scripts/` now | ||
| compiles through the existing explicit-`scripts` pipeline to | ||
| `scripts/<name>.mjs` in every selected target artifact, carrying | ||
| `provenance.kind: 'conventional'`; explicit `scripts` configuration keeps | ||
| claiming its files. Rendered (`.tsx`/`.jsx`), nested, and | ||
| identity-conflicting script routes fail source validation with the new | ||
| `AB4807`–`AB4809` diagnostics instead of building silently. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { extname } from 'node:path'; | ||
|
|
||
| import { isRecord } from '../core/strict-json.ts'; | ||
| import type { AgentBundleConfig } from '../core/types.ts'; | ||
| import type { CompiledAgentRoute } from '../routes/types.ts'; | ||
|
|
||
| /** | ||
| * The #102 stage-1 judgment of one conventional `src/scripts/` route. | ||
| * Normalization ships exactly the `shippable` routes through the explicit | ||
| * `scripts` pipeline; source validation reports every other state as a hard | ||
| * error (`AB4807`-`AB4809`). Both sides share this rule so no discovered | ||
| * script route is ever dropped silently. | ||
| */ | ||
| export type ScriptRouteJudgment = | ||
| /** A configured `scripts` entry already uses this identity for another file. */ | ||
| | 'conflicting' | ||
| /** Nested below the scripts root; the flat scripts artifact layout cannot place it yet. */ | ||
| | 'nested' | ||
| /** A rendered-script module (`.tsx`/`.jsx`); needs the Agent renderer (#102 stage 3). */ | ||
| | 'rendered' | ||
| /** A plain module directly under `src/scripts/` with an unclaimed identity. */ | ||
| | 'shippable'; | ||
|
|
||
| const renderedScriptExtensions = new Set(['.jsx', '.tsx']); | ||
|
|
||
| /** The path-derived identity of one script route (`script:release/verify` -> `release/verify`). */ | ||
| export const scriptRouteName = (route: CompiledAgentRoute): string => | ||
| route.id.slice('script:'.length); | ||
|
|
||
| /** The script names explicit configuration declares, tolerant of malformed config shapes. */ | ||
| export const configuredScriptNames = (config: Readonly<AgentBundleConfig>): ReadonlySet<string> => | ||
| new Set(isRecord(config.scripts) ? Object.keys(config.scripts) : []); | ||
|
|
||
| export const judgeScriptRoute = ( | ||
| route: CompiledAgentRoute, | ||
| configuredNames: ReadonlySet<string>, | ||
| ): ScriptRouteJudgment => { | ||
| if (renderedScriptExtensions.has(extname(route.source).toLowerCase())) return 'rendered'; | ||
| const name = scriptRouteName(route); | ||
| if (name.includes('/')) return 'nested'; | ||
| return configuredNames.has(name) ? 'conflicting' : 'shippable'; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.