calvyn-code 0.14.12 → 0.14.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/calvyn.js +15 -3
- package/package.json +1 -1
package/bin/calvyn.js
CHANGED
|
@@ -56,15 +56,27 @@ function runPostinstallIfNeeded() {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
const args = process.argv.slice(2)
|
|
59
|
-
runPostinstallIfNeeded()
|
|
59
|
+
const calvynBinary = runPostinstallIfNeeded()
|
|
60
60
|
const venvPython = resolveVenvPython()
|
|
61
61
|
const cliEntry = path.join(packageRoot, "cli.py")
|
|
62
|
-
const
|
|
62
|
+
const chatLikeFlags = new Set([
|
|
63
|
+
"", "chat", "-q", "--query", "-Q", "--quiet", "--model", "-m", "--image",
|
|
64
|
+
])
|
|
65
|
+
const firstArg = (args[0] || "").trim().toLowerCase()
|
|
66
|
+
const runClassicCli =
|
|
67
|
+
args.length === 0 ||
|
|
68
|
+
firstArg.startsWith("/") ||
|
|
69
|
+
chatLikeFlags.has(firstArg)
|
|
70
|
+
|
|
71
|
+
const command = runClassicCli ? venvPython : calvynBinary
|
|
72
|
+
const commandArgs = runClassicCli ? [cliEntry, ...args] : args
|
|
73
|
+
|
|
74
|
+
const result = spawnSync(command, commandArgs, {
|
|
63
75
|
stdio: "inherit",
|
|
64
76
|
shell: false,
|
|
65
77
|
env: {
|
|
66
78
|
...process.env,
|
|
67
|
-
CALVYN_LAUNCHED_FROM_NPM: "",
|
|
79
|
+
CALVYN_LAUNCHED_FROM_NPM: "1",
|
|
68
80
|
CALVYN_REPO_ROOT: packageRoot,
|
|
69
81
|
CALVYN_HOME: process.env.CALVYN_HOME || path.join(require("os").homedir(), ".calvyn"),
|
|
70
82
|
},
|