Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
8d11484
fix: tsci push should find fallback file when no entrypoint
64johnlee Apr 28, 2026
1252f29
fix: use static import for globbySync instead of dynamic import
64johnlee Apr 28, 2026
7b4309e
feat: add pnp-csv as standalone export format
64johnlee Apr 28, 2026
4ad60a7
feat: add bom-csv as standalone export format
64johnlee Apr 28, 2026
21c963d
style: run biome format
64johnlee Apr 30, 2026
76f4a9e
fix: resolve merge conflicts for PR #2953
64johnlee May 7, 2026
efef0b1
style: run biome format after rebase
64johnlee May 7, 2026
d607876
chore: bump PR
64johnlee May 8, 2026
9292393
chore: bump PR
64johnlee May 9, 2026
1862d13
chore: bump PR
64johnlee May 9, 2026
9dbe519
chore: bump PR
64johnlee May 10, 2026
5375518
fix: silence getEntrypoint console output in push fallback
64johnlee May 10, 2026
96f36c4
fix: correct push fallback order and error handling
64johnlee May 10, 2026
2f8adbf
fix: add type guards and format push-snippet.ts
64johnlee May 10, 2026
475cf94
chore: bump PR
64johnlee May 10, 2026
60fdead
chore: bump PR
64johnlee May 11, 2026
f3e3a6a
chore: bump PR
64johnlee May 11, 2026
beb39a3
chore: bump PR
64johnlee May 12, 2026
03efe73
chore: bump PR
64johnlee May 12, 2026
1ec0e25
chore: bump PR
64johnlee May 13, 2026
07ecf5e
chore: bump PR
64johnlee May 13, 2026
765866c
chore: bump PR
64johnlee May 14, 2026
392124a
chore: bump PR
64johnlee May 14, 2026
da8e33d
chore: bump PR
64johnlee May 15, 2026
32e3626
chore: bump PR
64johnlee May 15, 2026
1c1f61b
chore: bump PR
64johnlee May 16, 2026
a170f6e
chore: bump PR
64johnlee May 16, 2026
68e51cf
chore: bump PR
64johnlee May 17, 2026
97c10c5
chore: bump PR
64johnlee May 17, 2026
71b6742
chore: bump PR
64johnlee May 18, 2026
ac5145d
chore: bump PR
64johnlee May 18, 2026
a51a8b6
chore: bump tscircuit to fix circuit-json version conflict
64johnlee May 18, 2026
7d127a9
chore: sync bun.lock from upstream main
64johnlee May 18, 2026
10f97bf
chore: upgrade tscircuit to 0.0.1771 to resolve circuit-json conflict
64johnlee May 18, 2026
ceeadb1
chore: upgrade tscircuit to 0.0.1771 to resolve circuit-json conflict
64johnlee May 18, 2026
1e219d0
fix: move tscircuit to devDependencies to prevent npm runtime conflict
64johnlee May 18, 2026
8948ad8
fix: remove tscircuit from dependencies (keep in peerDeps) to fix cir…
64johnlee May 18, 2026
7924d52
chore: revert package.json to upstream main, keep synced bun.lock
64johnlee May 19, 2026
94037fe
fix: downgrade circuit-json-to-bom-csv and circuit-json-to-pnp-csv to…
64johnlee May 19, 2026
23ee8d0
chore: bump PR
64johnlee May 19, 2026
1b69a59
ci: retrigger CI after package.json version fix
64johnlee May 19, 2026
e8926e0
ci: retrigger CI after package.json version fix
64johnlee May 19, 2026
063f5bf
ci: retrigger CI after package.json version fix
64johnlee May 19, 2026
0b8d9ee
ci: retrigger CI after package.json version fix
64johnlee May 19, 2026
7c46289
chore: bump PR
64johnlee May 19, 2026
30ae246
chore: bump PR
64johnlee May 20, 2026
438b144
chore: bump PR
64johnlee May 20, 2026
bcad2a6
chore: bump PR
64johnlee May 21, 2026
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
26 changes: 26 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,29 @@ 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 1778256003
# bump 1778299204
# bump 1778342404
# bump 1778385604
# bump 1778428804
# bump 1778472004
# bump 1778515205
# bump 1778558404
# bump 1778601603
# bump 1778644803
# bump 1778688003
# bump 1778731202
# bump 1778774404
# bump 1778817605
# bump 1778860804
# bump 1778904002
# bump 1778947204
# bump 1778990404
# bump 1779033603
# bump 1779076804
# bump 1779120003
# bump 1779163203
# bump 1779206403
# bump 1779249604
# bump 1779292804
# bump 1779336003
2 changes: 1 addition & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions lib/shared/export-snippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export const ALLOWED_EXPORT_FORMATS = [
"srj",
"step",
"assembly-svg",
"pnp-csv",
"bom-csv",
] as const

export type ExportFormat = (typeof ALLOWED_EXPORT_FORMATS)[number]
Expand All @@ -78,6 +80,8 @@ const OUTPUT_EXTENSIONS: Record<ExportFormat, string> = {
"kicad-library": "",
srj: ".simple-route.json",
step: ".step",
"pnp-csv": "-pnp.csv",
"bom-csv": "-bom.csv",
}

const isRecord = (value: unknown): value is Record<string, unknown> =>
Expand Down Expand Up @@ -337,6 +341,14 @@ export const exportSnippet = async ({
case "assembly-svg":
outputContent = convertCircuitJsonToAssemblySvg(circuitJson)
break
case "pnp-csv":
outputContent = await convertCircuitJsonToPickAndPlaceCsv(circuitJson)
break
case "bom-csv":
outputContent = await convertBomRowsToCsv(
await convertCircuitJsonToBomRows({ circuitJson }),
)
break
default:
outputContent = JSON.stringify(circuitJson, null, 2)
}
Expand Down
57 changes: 49 additions & 8 deletions lib/shared/push-snippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import semver from "semver"
import Debug from "debug"
import kleur from "kleur"
import { getEntrypoint } from "./get-entrypoint"
import { globbySync } from "globby"
import prompts from "lib/utils/prompts"
import { getUnscopedPackageName } from "lib/utils/get-unscoped-package-name"
import { getPackageAuthor } from "lib/utils/get-package-author"
Expand Down Expand Up @@ -123,26 +124,62 @@ export const pushSnippet = async ({
return onExit(1)
}

// Use findPushProject to get project info
const pushProject = await findPushProject({
filePath,
onError,
})

if (!pushProject) {
return onExit(1)
const pkgResult = pushProject ?? {
packageJsonPath: undefined,
projectDir: process.cwd(),
}
const { packageJsonPath, projectDir } = pkgResult

const { snippetFilePath, packageJsonPath, projectDir } = pushProject

if (!packageJsonPath) {
if (!filePath && !packageJsonPath) {
onError(
"No package.json found, try running 'tsci init' to bootstrap the project",
)
return onExit(1)
}

// Extract snippetFilePath, with fallback to getEntrypoint and globby
let snippetFilePath = pushProject?.snippetFilePath

// Fallback 1: try getEntrypoint if findPushProject didn't find a file (silent)
if (!snippetFilePath) {
snippetFilePath =
(await getEntrypoint({
filePath,
onSuccess: () => {},
onError: () => {},
})) ?? undefined
}

// Fallback 2: use globby to find any circuit file if still not found
if (!snippetFilePath) {
const validFiles = globbySync(
["**/*.tsx", "**/*.ts", "**/*.circuit.json"],
{
cwd: projectDir,
ignore: ["node_modules/**", "**/.*"],
},
).filter((relativePath) =>
fs.existsSync(path.join(projectDir, relativePath)),
)

if (validFiles.length > 0) {
snippetFilePath = path.resolve(projectDir, validFiles[0])
onSuccess(`Using fallback file: '${validFiles[0]}'`)
}
}

if (!snippetFilePath && filePath) {
return onExit(1)
}

let packageJson: { name?: string; author?: string; version?: string } = {}
if (fs.existsSync(packageJsonPath)) {
if (packageJsonPath && fs.existsSync(packageJsonPath)) {
try {
packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString())
} catch {
Expand Down Expand Up @@ -204,7 +241,9 @@ export const pushSnippet = async ({

// Write the package name to the package.json file
packageJson.name = `@tsci/${currentUsername}.${unscopedPackageName}`
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
if (packageJsonPath) {
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
}
}

// Determine the account name to use (either user or org)
Expand Down Expand Up @@ -259,7 +298,9 @@ export const pushSnippet = async ({
const updatePackageJsonVersion = (newVersion?: string) => {
try {
packageJson.version = newVersion ?? `${packageVersion}`
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
if (packageJsonPath) {
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
}
} catch (error) {
onError(`Failed to update package.json version: ${error}`)
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
"bun-match-svg": "^0.0.12",
"chokidar": "4.0.1",
"circuit-json": "^0.0.425",
"circuit-json-to-bom-csv": "^0.0.7",
"circuit-json-to-bom-csv": "^0.0.6",
"circuit-json-to-gerber": "^0.0.51",
"circuit-json-to-kicad": "0.0.137",
"circuit-json-to-pnp-csv": "^0.0.7",
"circuit-json-to-pnp-csv": "^0.0.6",
"circuit-json-to-readable-netlist": "^0.0.15",
"circuit-json-to-spice": "^0.0.10",
"circuit-json-to-step": "^0.0.32",
Expand Down