Skip to content

Commit 4a1d0d1

Browse files
ndemiancclaude
andcommitted
Editor build: prune stale extensions on branding + skip Copilot compile in dev
apply-branding.mjs prunes orphaned LevelCode extensions from vscode/extensions (renamed-away atom-* copies double-registered commands). run-dev.sh compiles the client only (compile-client), skipping the proprietary Copilot build (stripped/disabled anyway, and broken under Node 24 by a glob CJS/ESM error). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent a4ad2b7 commit 4a1d0d1

2 files changed

Lines changed: 31 additions & 4 deletions

File tree

‎scripts/apply-branding.mjs‎

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,35 @@ if (existsSync(pngSrc) && existsSync(dirname(pngDst))) {
9393

9494
// Install our bundled LevelCode extensions into the checkout. The canonical, version-controlled
9595
// source lives in this repo's extensions/ folder; the copies inside vscode/ are generated.
96+
const OUR_PUBLISHERS = new Set(["levelcode", "atompp"]); // atompp = pre-rename, prune any leftovers
9697
const extSrcRoot = join(repoRoot, "extensions");
98+
const vscodeExtDir = join(vscodeDir, "extensions");
9799
if (existsSync(extSrcRoot)) {
98-
for (const name of readdirSync(extSrcRoot)) {
100+
const current = new Set(readdirSync(extSrcRoot).filter((n) => statSync(join(extSrcRoot, n)).isDirectory()));
101+
102+
// Prune stale copies of OUR extensions left in vscode/ from a previous rename (e.g. atom-ai →
103+
// levelcode-ai). Without this, both the old and new folder load and double-register commands
104+
// ("command 'levelcode.init.edit' already exists"). A dir is "ours" if its package.json publisher
105+
// is one of OUR_PUBLISHERS; drop any that isn't in the current repo set. Code-OSS built-ins (other
106+
// publishers) are never touched.
107+
if (existsSync(vscodeExtDir)) {
108+
for (const name of readdirSync(vscodeExtDir)) {
109+
if (current.has(name)) { continue; }
110+
const pkg = join(vscodeExtDir, name, "package.json");
111+
if (!existsSync(pkg)) { continue; }
112+
try {
113+
const publisher = JSON.parse(readFileSync(pkg, "utf8")).publisher;
114+
if (OUR_PUBLISHERS.has(publisher)) {
115+
rmSync(join(vscodeExtDir, name), { recursive: true, force: true });
116+
console.log(`[apply-branding] Pruned stale LevelCode extension -> ${name}`);
117+
}
118+
} catch { /* unreadable manifest: leave it alone */ }
119+
}
120+
}
121+
122+
for (const name of current) {
99123
const src = join(extSrcRoot, name);
100-
if (!statSync(src).isDirectory()) { continue; }
101-
const dst = join(vscodeDir, "extensions", name);
124+
const dst = join(vscodeExtDir, name);
102125
rmSync(dst, { recursive: true, force: true }); // clean overwrite (avoids stale/locked files)
103126
cpSync(src, dst, { recursive: true });
104127
console.log(`[apply-branding] Installed extension -> extensions/${name}`);

‎scripts/run-dev.sh‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ node "$SCRIPT_DIR/apply-branding.mjs" "$VSCODE_DIR" >/dev/null
1515

1616
cd "$VSCODE_DIR"
1717
echo "[run-dev] Building core (first run takes a while)…"
18-
npm run compile
18+
# compile-client ONLY — deliberately NOT `npm run compile`, which also runs compile-copilot (the
19+
# proprietary GitHub Copilot Chat extension). LevelCode disables Copilot at launch (--disable-extension
20+
# below) and strips it from the packaged app (build-macos.sh), so compiling it is pointless here — and
21+
# upstream's extensions/copilot/.esbuild.mts fails under Node 24 (glob CJS/ESM named-export error).
22+
npm run compile-client
1923
echo "[run-dev] Ensuring a clean LevelCode instance…"
2024
# LevelCode dev + packaged builds share the same macOS bundle identifier. If another
2125
# instance is already running, LaunchServices can hand this launch off to that

0 commit comments

Comments
 (0)