From e05bb3be71f8e1b6db24cb521bd421affce2d5d8 Mon Sep 17 00:00:00 2001 From: 64johnlee <64lamei@gmail.com> Date: Sat, 2 May 2026 09:31:49 +0800 Subject: [PATCH 1/9] fix: add fallback to find any .tsx/.ts/.circuit.json when no standard entrypoint found tsci push currently fails when no index.circuit.tsx or mainEntrypoint is configured, even though tsci dev finds alternative files. This mirrors the fallback behavior already present in resolve-dev-target.ts where it looks for any .tsx/.ts/.circuit.json file if getEntrypoint() returns null. The fallback is gated behind getEntrypoint() returning null, so if the user provided a specific filePath or configured mainEntrypoint, those still take precedence. Only when no entrypoint can be detected does the fallback kick in. Fixes #2797 --- lib/shared/push-snippet.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/shared/push-snippet.ts b/lib/shared/push-snippet.ts index 75bc61dea..48a785c73 100644 --- a/lib/shared/push-snippet.ts +++ b/lib/shared/push-snippet.ts @@ -5,6 +5,7 @@ import * as path from "node:path" import semver from "semver" import Debug from "debug" import kleur from "kleur" +import { globbySync } from "globby" import { getEntrypoint } from "./get-entrypoint" import prompts from "lib/utils/prompts" import { getUnscopedPackageName } from "lib/utils/get-unscoped-package-name" @@ -14,6 +15,7 @@ import { getPackageFilePaths } from "lib/dev/get-package-file-paths" import { checkOrgAccess } from "lib/utils/check-org-access" import { isBinaryFile } from "./is-binary-file" import { hasBinaryContent } from "./has-binary-content" +import { DEFAULT_IGNORED_PATTERNS } from "./should-ignore-path" import JSZip from "jszip" type PushOptions = { @@ -75,12 +77,33 @@ export const pushSnippet = async ({ } // Detect the entrypoint file - const snippetFilePath = await getEntrypoint({ + let snippetFilePath = await getEntrypoint({ filePath, onSuccess: () => {}, onError, }) + // Fallback: if no entrypoint found, look for any .tsx/.ts/.circuit.json file + // This mirrors `tsci dev` behavior which also finds alternative files + if (!snippetFilePath) { + const fallbackFiles = globbySync( + ["**/*.tsx", "**/*.ts", "**/*.circuit.json"], + { + cwd: process.cwd(), + ignore: DEFAULT_IGNORED_PATTERNS, + }, + ) + if (fallbackFiles.length > 0) { + const fallbackPath = path.resolve(process.cwd(), fallbackFiles[0]) + console.log( + kleur.gray( + `No standard entrypoint found. Using fallback file: '${path.relative(process.cwd(), fallbackPath)}'`, + ), + ) + snippetFilePath = fallbackPath + } + } + if (!snippetFilePath) { return onExit(1) } From 4ce85aabd351f11b3d16551aa58efb8fe0d1ae5f Mon Sep 17 00:00:00 2001 From: 64johnlee <64lamei@gmail.com> Date: Mon, 4 May 2026 11:34:04 +0800 Subject: [PATCH 2/9] chore: bump PR --- AGENTS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AGENTS.md b/AGENTS.md index a7894f2a2..f0a263a5d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -80,3 +80,4 @@ Test fixture provides: ## Runtime The CLI entrypoint (`cli/entrypoint.js`) selects between Bun and tsx as the TypeScript runner, preferring Bun when available. This allows hot-reload during development while maintaining Node.js compatibility. +# bump 1777865644 From 6e5007dea169d671516218500292b9ff1aeb4a9e Mon Sep 17 00:00:00 2001 From: 64johnlee <64lamei@gmail.com> Date: Mon, 4 May 2026 11:35:32 +0800 Subject: [PATCH 3/9] chore: bump PR --- AGENTS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AGENTS.md b/AGENTS.md index f0a263a5d..8414bd01d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -81,3 +81,4 @@ Test fixture provides: The CLI entrypoint (`cli/entrypoint.js`) selects between Bun and tsx as the TypeScript runner, preferring Bun when available. This allows hot-reload during development while maintaining Node.js compatibility. # bump 1777865644 +# bump 1777865732 From 4f46e1673e06ea735fd6981994e3fabbad0f94f8 Mon Sep 17 00:00:00 2001 From: 64johnlee <64lamei@gmail.com> Date: Mon, 4 May 2026 12:00:14 +0800 Subject: [PATCH 4/9] chore: bump PR --- AGENTS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AGENTS.md b/AGENTS.md index 8414bd01d..2bda4fe67 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -82,3 +82,4 @@ Test fixture provides: The CLI entrypoint (`cli/entrypoint.js`) selects between Bun and tsx as the TypeScript runner, preferring Bun when available. This allows hot-reload during development while maintaining Node.js compatibility. # bump 1777865644 # bump 1777865732 +# bump 1777867214 From c7b11c4728d6b127e8780019f716107d821b6c7a Mon Sep 17 00:00:00 2001 From: 64johnlee <64lamei@gmail.com> Date: Tue, 5 May 2026 00:00:27 +0800 Subject: [PATCH 5/9] chore: bump PR --- AGENTS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AGENTS.md b/AGENTS.md index 2bda4fe67..88ea6aa4f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -83,3 +83,4 @@ The CLI entrypoint (`cli/entrypoint.js`) selects between Bun and tsx as the Type # bump 1777865644 # bump 1777865732 # bump 1777867214 +# bump 1777910427 From 63a86f3bbed5df21bb12722899feb622427d6d99 Mon Sep 17 00:00:00 2001 From: John Lee Date: Tue, 5 May 2026 12:00:13 +0800 Subject: [PATCH 6/9] chore: bump PR --- AGENTS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AGENTS.md b/AGENTS.md index 88ea6aa4f..95adc9c1a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -84,3 +84,4 @@ The CLI entrypoint (`cli/entrypoint.js`) selects between Bun and tsx as the Type # bump 1777865732 # bump 1777867214 # bump 1777910427 +# bump 1777953613 From 8b4e0ca22de25846dc8642afe0bb06c4e07615b2 Mon Sep 17 00:00:00 2001 From: John Lee <64lamei@gmail.com> Date: Wed, 6 May 2026 00:00:15 +0800 Subject: [PATCH 7/9] chore: bump PR --- AGENTS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AGENTS.md b/AGENTS.md index 95adc9c1a..82fdfd9fc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -85,3 +85,4 @@ The CLI entrypoint (`cli/entrypoint.js`) selects between Bun and tsx as the Type # bump 1777867214 # bump 1777910427 # bump 1777953613 +# bump 1777996815 From b577a1cd3fcf487f37e41a0ce14c2158801afce3 Mon Sep 17 00:00:00 2001 From: John Lee <64lamei@gmail.com> Date: Wed, 6 May 2026 12:00:19 +0800 Subject: [PATCH 8/9] chore: bump PR --- AGENTS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AGENTS.md b/AGENTS.md index 82fdfd9fc..f565cb5f9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -86,3 +86,4 @@ The CLI entrypoint (`cli/entrypoint.js`) selects between Bun and tsx as the Type # bump 1777910427 # bump 1777953613 # bump 1777996815 +# bump 1778040019 From 1e2520db797c105b27eb6fccbd916fb7208f93e0 Mon Sep 17 00:00:00 2001 From: John Lee <64lamei@gmail.com> Date: Thu, 7 May 2026 00:00:22 +0800 Subject: [PATCH 9/9] chore: bump PR --- AGENTS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AGENTS.md b/AGENTS.md index f565cb5f9..51cfecf6c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -87,3 +87,4 @@ The CLI entrypoint (`cli/entrypoint.js`) selects between Bun and tsx as the Type # bump 1777953613 # bump 1777996815 # bump 1778040019 +# bump 1778083222