@taco-ai/cli 0.2.5 → 0.2.7
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/README.md +6 -6
- package/bin/taco.cjs +24 -12
- package/dist/taco.mjs +47 -45
- package/lib/installHelpers.ts +7 -1
- package/lib/installSchtasks.ts +94 -47
- package/lib/paths.ts +23 -5
- package/lib/sidecarLauncher.ts +86 -28
- package/lib/start.ts +7 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -45,10 +45,10 @@ in stack traces.
|
|
|
45
45
|
| Platform | Data socket | Control socket |
|
|
46
46
|
|---|---|---|
|
|
47
47
|
| Unix | `$TACO_RUNTIME_DIR/sidecar.sock` | `$TACO_RUNTIME_DIR/sidecar-ctl.sock` |
|
|
48
|
-
| Windows | `\\.\pipe\taco-sidecar
|
|
48
|
+
| Windows | `\\.\pipe\taco-sidecar-<slug>` | `\\.\pipe\taco-sidecar-ctl-<slug>` |
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
`<slug>` is the first 16 hex chars of SHA-256 over a normalized
|
|
51
|
+
`$TACO_RUNTIME_DIR` (slash direction, trailing separator, and the
|
|
52
|
+
Windows `\\?\` prefix are stripped so equivalent paths hash the same).
|
|
53
|
+
Debug (`~/.taco-dev/run`) and release (`~/.taco/run`) therefore get
|
|
54
|
+
distinct pipes instead of colliding on a global `\\.\pipe\taco-sidecar`.
|
package/bin/taco.cjs
CHANGED
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
* This file is CJS so npm `bin` entries can bootstrap the ESM runtime
|
|
6
6
|
* without a `--loader` flag. Resolution order:
|
|
7
7
|
* 1. TACO_CLI_ENTRY env var — an explicit path to a compiled bundle.
|
|
8
|
-
* 2. ../
|
|
8
|
+
* 2. ../lib/index.ts via a locally resolvable tsx loader — the repo-dev
|
|
9
|
+
* path. Preferred over dist/ so launcher edits apply without a rebuild,
|
|
10
|
+
* and so we never spawn tsx/dist/cli.mjs (it re-forks node).
|
|
11
|
+
* 3. ../dist/taco.mjs — the esbuild bundle produced by `pnpm build`,
|
|
9
12
|
* which is what ships in the published package and runs under plain
|
|
10
13
|
* Node (no tsx).
|
|
11
|
-
* 3. ../lib/index.ts via a locally resolvable tsx — the repo-dev path,
|
|
12
|
-
* where dist/ may not have been built yet.
|
|
13
14
|
*/
|
|
14
15
|
|
|
15
16
|
const path = require("node:path");
|
|
@@ -19,13 +20,13 @@ const { existsSync } = require("node:fs");
|
|
|
19
20
|
const DIST_ENTRY = path.join(__dirname, "..", "dist", "taco.mjs");
|
|
20
21
|
const SRC_ENTRY = path.join(__dirname, "..", "lib", "index.ts");
|
|
21
22
|
|
|
22
|
-
function
|
|
23
|
-
// Walk up from this file looking for `tsx/dist/
|
|
24
|
-
// nested node_modules as well as global installs.
|
|
25
|
-
//
|
|
23
|
+
function locateTsxLoader() {
|
|
24
|
+
// Walk up from this file looking for `tsx/dist/loader.mjs`. Handles pnpm's
|
|
25
|
+
// nested node_modules as well as global installs. Used on the repo-dev
|
|
26
|
+
// path, where tsx is a devDependency.
|
|
26
27
|
let dir = __dirname;
|
|
27
28
|
for (let i = 0; i < 8; i++) {
|
|
28
|
-
const candidate = path.join(dir, "node_modules", "tsx", "dist", "
|
|
29
|
+
const candidate = path.join(dir, "node_modules", "tsx", "dist", "loader.mjs");
|
|
29
30
|
if (existsSync(candidate)) return candidate;
|
|
30
31
|
const parent = path.dirname(dir);
|
|
31
32
|
if (parent === dir) break;
|
|
@@ -36,19 +37,30 @@ function locateTsxCli() {
|
|
|
36
37
|
|
|
37
38
|
function resolveEntry() {
|
|
38
39
|
if (process.env.TACO_CLI_ENTRY) return [process.env.TACO_CLI_ENTRY];
|
|
40
|
+
// Prefer TypeScript source in a checkout so `pnpm tauri:dev` picks up
|
|
41
|
+
// launcher edits without a CLI rebuild. `tsx/dist/cli.mjs` re-forks
|
|
42
|
+
// node (and flashes a console on Windows); `--import` the loader
|
|
43
|
+
// instead so this process is the one that runs lib/index.ts.
|
|
44
|
+
const tsx = locateTsxLoader();
|
|
45
|
+
if (tsx && existsSync(SRC_ENTRY)) {
|
|
46
|
+
const { pathToFileURL } = require("node:url");
|
|
47
|
+
return ["--import", pathToFileURL(tsx).href, SRC_ENTRY];
|
|
48
|
+
}
|
|
39
49
|
if (existsSync(DIST_ENTRY)) return [DIST_ENTRY];
|
|
40
|
-
const tsx = locateTsxCli();
|
|
41
|
-
if (tsx) return [tsx, SRC_ENTRY];
|
|
42
50
|
throw new Error(
|
|
43
51
|
"Could not find the taco CLI entry point.\n" +
|
|
44
52
|
` Expected the built bundle at ${DIST_ENTRY}.\n` +
|
|
45
|
-
" In a source checkout, run `pnpm
|
|
46
|
-
"(or
|
|
53
|
+
" In a source checkout, run `pnpm install` so tsx can run the TypeScript source " +
|
|
54
|
+
"(or `pnpm --filter @taco-ai/cli build` for the published bundle).",
|
|
47
55
|
);
|
|
48
56
|
}
|
|
49
57
|
|
|
50
58
|
const child = spawn(process.execPath, [...resolveEntry(), ...process.argv.slice(2)], {
|
|
51
59
|
stdio: "inherit",
|
|
60
|
+
// Windows: this shim is itself a console node.exe. Hide the inner
|
|
61
|
+
// process so a GUI parent (debug TACO.exe with CREATE_NO_WINDOW) does
|
|
62
|
+
// not flash a second console. Ignored on POSIX.
|
|
63
|
+
windowsHide: true,
|
|
52
64
|
});
|
|
53
65
|
|
|
54
66
|
child.on("exit", (code, sig) => {
|