Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,12 @@ 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
# bump 1777865732
# bump 1777867214
# bump 1777910427
# bump 1777953613
# bump 1777996815
# bump 1778040019
# bump 1778083222
# bump 1778126419
25 changes: 24 additions & 1 deletion lib/shared/push-snippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 = {
Expand Down Expand Up @@ -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)
}
Expand Down