mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-19 23:24:42 +00:00
Bump to 1.0.39: fix tf_sync module not found after npm install
getPythonSyncPath() only searched __dirname-relative paths which don't resolve correctly from the compiled binary. Added process.execPath- relative candidates so it finds <pkg>/python from <pkg>/bin/tfcode. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/package.json",
|
"$schema": "https://json.schemastore.org/package.json",
|
||||||
"version": "1.0.38",
|
"version": "1.0.39",
|
||||||
"name": "@toothfairyai/tfcode",
|
"name": "@toothfairyai/tfcode",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -64,20 +64,19 @@ const TFCODE_CONFIG_DIR = ".tfcode"
|
|||||||
const TFCODE_TOOLS_FILE = "tools.json"
|
const TFCODE_TOOLS_FILE = "tools.json"
|
||||||
|
|
||||||
function getPythonSyncPath(): string {
|
function getPythonSyncPath(): string {
|
||||||
// Check embedded python path first (for npm distribution)
|
const binDir = path.dirname(process.execPath)
|
||||||
const embedded = [
|
const candidates = [
|
||||||
path.join(__dirname, "..", "..", "..", "..", "python"), // packages/tfcode/python
|
// npm install: binary is at <pkg>/bin/tfcode, python at <pkg>/python
|
||||||
path.join(__dirname, "..", "..", "..", "python"), // dist/python
|
path.join(binDir, "..", "python"),
|
||||||
]
|
path.join(binDir, "python"),
|
||||||
for (const p of embedded) {
|
// Embedded paths relative to compiled source
|
||||||
if (existsSync(p)) return p
|
path.join(__dirname, "..", "..", "..", "..", "python"),
|
||||||
}
|
path.join(__dirname, "..", "..", "..", "python"),
|
||||||
// Fallback to development paths
|
// Development paths
|
||||||
const dev = [
|
|
||||||
path.join(__dirname, "..", "..", "..", "..", "tf-sync", "src", "tf_sync"),
|
path.join(__dirname, "..", "..", "..", "..", "tf-sync", "src", "tf_sync"),
|
||||||
path.join(process.cwd(), "packages", "tf-sync", "src", "tf_sync"),
|
path.join(process.cwd(), "packages", "tf-sync", "src", "tf_sync"),
|
||||||
]
|
]
|
||||||
for (const p of dev) {
|
for (const p of candidates) {
|
||||||
if (existsSync(p)) return p
|
if (existsSync(p)) return p
|
||||||
}
|
}
|
||||||
return "tf_sync"
|
return "tf_sync"
|
||||||
|
|||||||
Reference in New Issue
Block a user