Repository navigation
refactor(repo): make core scripts independent of Fleet bootstrap - #84
Open
John-David Dalton (jdalton) wants to merge 1 commit into
Open
John-David Dalton (jdalton) wants to merge 1 commit into
John-David Dalton (jdalton) wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Test suite imports missing Fleet plugin
- The version-define test now imports the tracked repo plugin instead of the gitignored Fleet file, so Vitest can load it on a clean checkout.
Or push these changes by commenting:
@cursor push 4a6c756613
Preview (4a6c756613)
diff --git a/.config/repo/rolldown.config.mts b/.config/repo/rolldown.config.mts
--- a/.config/repo/rolldown.config.mts
+++ b/.config/repo/rolldown.config.mts
@@ -46,6 +46,18 @@
}
}
+export function defineExtensionVersionPlugin(version: string): Plugin {
+ return {
+ name: 'define-extension-version',
+ transform(source) {
+ return source.replace(
+ /process\s*\.\s*env\s*\[\s*(['"])INLINED_EXTENSION_VERSION\1\s*\]/gu,
+ JSON.stringify(version),
+ )
+ },
+ }
+}
+
const pkg = JSON.parse(
readFileSync(path.join(rootPath, 'package.json'), 'utf8'),
) as { version?: string | undefined }
@@ -83,20 +95,7 @@
},
platform: 'node',
plugins: [
- // `defineGuarded` keys are dotted member chains. Source may spell the
- // access with a dot or with quoted brackets — TypeScript forces
- // `process.env['X']` on index-signature types — and both normalize to this
- // same key. The `INLINED_*` name follows the fleet convention (see
- // socket-cli) for build-inlined values.
- {
- name: 'define-extension-version',
- transform(source) {
- return source.replace(
- /process\s*\.\s*env\s*\[\s*(['"])INLINED_EXTENSION_VERSION\1\s*\]/gu,
- JSON.stringify(extensionVersion),
- )
- },
- },
+ defineExtensionVersionPlugin(extensionVersion),
stageParserWasmPlugin(),
],
// The sources are `.mts` (the fleet's sources-are-mts rule) and import each
diff --git a/test/repo/unit/define-guarded.test.mts b/test/repo/unit/define-guarded.test.mts
deleted file mode 100644
--- a/test/repo/unit/define-guarded.test.mts
+++ /dev/null
@@ -1,83 +1,0 @@
-/**
- * @file Tests for the guarded compile-time define plugin
- * (.config/fleet/rolldown/define-guarded.mts). Locks in that a single dotted
- * define
- * key matches dot, single-quote, and double-quote member access alike (TS
- * forces quoted bracket access on `process.env`), that TS source is parsed
- * (not rejected as JS), and that write / dynamic positions are left
- * untouched.
- */
-
-import { describe, expect, test } from 'vitest'
-
-import { defineGuardedPlugin } from '../../../.config/fleet/rolldown/define-guarded.mts'
-
-// Exported `function` declaration: satisfies both fleet rules —
-// socket/prefer-function-declaration (no module-scope arrow) and
-// socket/export-top-level-functions (top-level functions must be exported).
-export function run(code: string, id = 'src/example.ts'): string | undefined {
- const plugin = defineGuardedPlugin({
- 'process.env.INLINED_EXTENSION_VERSION': JSON.stringify('2.0.3'),
- })
- // rolldown's transform hook signature is (code, id); call it directly.
- const transform = plugin.transform as (
- this: unknown,
- code: string,
- id: string,
- ) => { code: string } | undefined
- const result = transform.call({}, code, id)
- return result?.code
-}
-
-describe('defineGuardedPlugin', () => {
- test('rewrites dot access', () => {
- const out = run('const a = process.env.INLINED_EXTENSION_VERSION')
- expect(out).toContain('"2.0.3"')
- expect(out).not.toContain('INLINED_EXTENSION_VERSION')
- })
-
- test('rewrites single-quote bracket access', () => {
- const out = run("const b = process.env['INLINED_EXTENSION_VERSION']")
- expect(out).toContain('"2.0.3"')
- expect(out).not.toContain('INLINED_EXTENSION_VERSION')
- })
-
- test('rewrites double-quote bracket access', () => {
- const out = run('const c = process.env["INLINED_EXTENSION_VERSION"]')
- expect(out).toContain('"2.0.3"')
- expect(out).not.toContain('INLINED_EXTENSION_VERSION')
- })
-
- test('parses TypeScript source (type annotations do not abort the rewrite)', () => {
- const out = run(
- 'export function f(ctx: vscode.ExtensionContext): string {\n' +
- " return process.env['INLINED_EXTENSION_VERSION']\n" +
- '}\n',
- )
- expect(out).toContain('"2.0.3"')
- })
-
- test('parses .tsx source', () => {
- const out = run(
- 'const e = <div>{process.env["INLINED_EXTENSION_VERSION"]}</div>',
- 'src/example.tsx',
- )
- expect(out).toContain('"2.0.3"')
- })
-
- test('leaves an assignment target untouched', () => {
- const code = "process.env['INLINED_EXTENSION_VERSION'] = 'x'"
- expect(run(code)).toBeUndefined()
- })
-
- test('leaves dynamic computed access untouched', () => {
- const code =
- 'const k = "INLINED_EXTENSION_VERSION"\nconst d = process.env[k]'
- expect(run(code)).toBeUndefined()
- })
-
- test('does not rewrite an unrelated env var', () => {
- const code = "const u = process.env['SOMETHING_ELSE']"
- expect(run(code)).toBeUndefined()
- })
-})
\ No newline at end of file
diff --git a/test/repo/unit/rolldown.config-extension-version.test.mts b/test/repo/unit/rolldown.config-extension-version.test.mts
new file mode 100644
--- /dev/null
+++ b/test/repo/unit/rolldown.config-extension-version.test.mts
@@ -1,0 +1,78 @@
+import { describe, expect, test } from 'vitest'
+
+import { defineExtensionVersionPlugin } from '../../../.config/repo/rolldown.config.mts'
+
+export function rewriteInlinedExtensionVersion(
+ code: string,
+ version = '2.0.3',
+): string {
+ const plugin = defineExtensionVersionPlugin(version)
+ const transform = plugin.transform
+ if (typeof transform !== 'function') {
+ throw new TypeError(
+ 'Extension version define requires a transform function.',
+ )
+ }
+ const result: unknown = Reflect.apply(transform, {}, [
+ code,
+ 'src/example.mts',
+ ])
+ if (typeof result !== 'string') {
+ throw new TypeError('Extension version define returned no code.')
+ }
+ return result
+}
+
+describe('defineExtensionVersionPlugin', () => {
+ test('rewrites single-quote bracket access', () => {
+ expect(
+ rewriteInlinedExtensionVersion(
+ "const version = process.env['INLINED_EXTENSION_VERSION']",
+ ),
+ ).toBe('const version = "2.0.3"')
+ })
+
+ test('rewrites double-quote bracket access', () => {
+ expect(
+ rewriteInlinedExtensionVersion(
+ 'const version = process.env["INLINED_EXTENSION_VERSION"]',
+ ),
+ ).toBe('const version = "2.0.3"')
+ })
+
+ test('rewrites bracket access inside TypeScript', () => {
+ const source =
+ 'export function readVersion(ctx: vscode.ExtensionContext): string {\n' +
+ " return process.env['INLINED_EXTENSION_VERSION']\n" +
+ '}\n'
+ expect(rewriteInlinedExtensionVersion(source)).toBe(
+ 'export function readVersion(ctx: vscode.ExtensionContext): string {\n' +
+ ' return "2.0.3"\n' +
+ '}\n',
+ )
+ })
+
+ test('rewrites bracket access inside tsx text', () => {
+ expect(
+ rewriteInlinedExtensionVersion(
+ 'const element = <div>{process.env["INLINED_EXTENSION_VERSION"]}</div>',
+ ),
+ ).toBe('const element = <div>{"2.0.3"}</div>')
+ })
+
+ test('leaves dot access untouched', () => {
+ const source = 'const version = process.env.INLINED_EXTENSION_VERSION'
+ expect(rewriteInlinedExtensionVersion(source)).toBe(source)
+ })
+
+ test('leaves dynamic computed access untouched', () => {
+ const source =
+ 'const key = "INLINED_EXTENSION_VERSION"\nconst version = process.env[key]'
+ expect(rewriteInlinedExtensionVersion(source)).toBe(source)
+ })
+
+ test('does not rewrite an unrelated env var', () => {
+ const source = "const value = process.env['SOMETHING_ELSE']"
+ expect(rewriteInlinedExtensionVersion(source)).toBe(source)
+ })
+})You can send follow-ups to the cloud agent here.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 0b66ef1. Configure here.
John-David Dalton (jdalton)
enabled auto-merge (squash)
November 6, 2026 16:21
Keep repository checks and tests independent of Fleet bootstrap scripts and configs. Assisted-by: Codex:unknown
John-David Dalton (jdalton)
force-pushed
the
chore/remove-local-fleet-bootstrap
branch
from
November 6, 2026 16:43
e3e7267 to
c5f0590
Compare
John-David Dalton (jdalton)
requested a review
from Vasco Santos (vasco-santos)
November 8, 2026 16:34
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Summary
check,lint,format,fix, andcleanavailable as repository-owned commands.The shared Fleet setup actions remain in CI because release and workflow jobs still use them.
Validation
node --checkon the changed.mtsfilespackage.jsonand the local TypeScript configgit diff --checkNote
Medium Risk
Broad changes to default scripts, TS project layout, lint rules, rolldown env inlining, and CI job wiring could hide regressions until a full
pnpm check/ workflow run; the new transform only matches bracketedprocess.env['INLINED_EXTENSION_VERSION']patterns.Overview
Core developer commands no longer depend on Fleet scripts.
package.jsonreplaces the sprawlingscripts/fleet/*surface with directoxlint,oxfmt,tsc, andvitestinvocations, chainscheckas build → typecheck → lint → format check, and adds a tiny repo-ownedcleanscript. Install-time hooks like the oldpreparepath are removed along with most Fleet-only script entries.Lint, build, typecheck, and test configs are checked in under
.config/repo/. Oxlint is a plain exported object instead of wrapping the Fleet factory; rolldown dropsdefineGuardedPluginfor a small transform that inlinesINLINED_EXTENSION_VERSIONfrom bracket-styleprocess.env[...]reads; roottsconfig.jsonextends an explicit localcompilerOptionsblock; new Vitest config aliasesvscodefor tests.CI and shared setup align with standalone repos.
ci-gatescomposesfleet/setupwith explicitpnpm install --frozen-lockfile, thenpnpm run checkorpnpm test, instead of the old setup-and-install / run-script composites and release app token wiring; shallow clones stay the default. The Fleetsetupaction only reads the optional SFW bypass list when the file exists so repos without Fleet scaffolding keep working.Minor: Extension manifest
capabilitiesdescription swaps ASCII hyphens for unicode em dashes.Reviewed by Cursor Bugbot for commit 0b66ef1. Configure here.