@substructure.ai/cli 0.1.22 → 0.2.1
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 +2 -2
- package/install.mjs +35 -0
- package/package.json +10 -6
- package/src/index.js +2 -2
- /package/bin/{substructure.js → subs.js} +0 -0
package/README.md
CHANGED
|
@@ -15,10 +15,10 @@ Supported platforms: macOS (arm64, x64), Linux (arm64, x64).
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
|
-
|
|
18
|
+
subs serve --dev --provider openrouter --worker-url http://localhost:4444
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Run `
|
|
21
|
+
Run `subs --help` for the full command list. Cloud management commands (`apps`, `keys`, `webhook`, `sessions`, …) are top-level subcommands.
|
|
22
22
|
|
|
23
23
|
## Links
|
|
24
24
|
|
package/install.mjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Overwrite the bin shim with the native binary so `subs` execs it directly,
|
|
3
|
+
// skipping Node startup. Best-effort: on any failure the Node shim
|
|
4
|
+
// (bin/subs.js) stays in place and still works, just slower.
|
|
5
|
+
import { linkSync, copyFileSync, chmodSync, renameSync, unlinkSync } from "node:fs";
|
|
6
|
+
import { dirname, join } from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { resolve } from "./src/index.js";
|
|
9
|
+
|
|
10
|
+
// Skip under Yarn (overwriting a package file can corrupt its shared cache) and
|
|
11
|
+
// when a binary is supplied out of band.
|
|
12
|
+
const isYarn = (process.env.npm_config_user_agent || "").startsWith("yarn");
|
|
13
|
+
if (process.env.SUBS_BIN || process.env.SUBS_SKIP_POSTINSTALL || isYarn) process.exit(0);
|
|
14
|
+
|
|
15
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
const shim = join(here, "bin", "subs.js");
|
|
17
|
+
const tmp = `${shim}.tmp`;
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const bin = resolve();
|
|
21
|
+
if (bin === shim) process.exit(0);
|
|
22
|
+
let linked = false;
|
|
23
|
+
try {
|
|
24
|
+
linkSync(bin, tmp); // hardlink: no duplicate on disk
|
|
25
|
+
linked = true;
|
|
26
|
+
} catch {
|
|
27
|
+
copyFileSync(bin, tmp); // cross-device or unsupported: fall back to a copy
|
|
28
|
+
chmodSync(tmp, 0o755);
|
|
29
|
+
}
|
|
30
|
+
renameSync(tmp, shim); // atomic replace
|
|
31
|
+
} catch {
|
|
32
|
+
try {
|
|
33
|
+
unlinkSync(tmp);
|
|
34
|
+
} catch {}
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@substructure.ai/cli",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "CLI for Substructure",
|
|
5
5
|
"license": "FSL-1.1-ALv2",
|
|
6
6
|
"type": "module",
|
|
@@ -26,19 +26,23 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"bin": {
|
|
29
|
-
"
|
|
29
|
+
"subs": "./bin/subs.js"
|
|
30
30
|
},
|
|
31
31
|
"main": "./src/index.js",
|
|
32
32
|
"files": [
|
|
33
33
|
"bin",
|
|
34
34
|
"src",
|
|
35
|
+
"install.mjs",
|
|
35
36
|
"LICENSE",
|
|
36
37
|
"README.md"
|
|
37
38
|
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"postinstall": "node ./install.mjs"
|
|
41
|
+
},
|
|
38
42
|
"optionalDependencies": {
|
|
39
|
-
"@substructure.ai/cli-darwin-arm64": "0.1
|
|
40
|
-
"@substructure.ai/cli-darwin-x64": "0.1
|
|
41
|
-
"@substructure.ai/cli-linux-arm64": "0.1
|
|
42
|
-
"@substructure.ai/cli-linux-x64": "0.1
|
|
43
|
+
"@substructure.ai/cli-darwin-arm64": "0.2.1",
|
|
44
|
+
"@substructure.ai/cli-darwin-x64": "0.2.1",
|
|
45
|
+
"@substructure.ai/cli-linux-arm64": "0.2.1",
|
|
46
|
+
"@substructure.ai/cli-linux-x64": "0.2.1"
|
|
43
47
|
}
|
|
44
48
|
}
|
package/src/index.js
CHANGED
|
@@ -24,11 +24,11 @@ export function resolve() {
|
|
|
24
24
|
|
|
25
25
|
try {
|
|
26
26
|
const pkgJson = require.resolve(`${pkg}/package.json`);
|
|
27
|
-
return join(pkgJson, "..", "bin", "
|
|
27
|
+
return join(pkgJson, "..", "bin", "subs");
|
|
28
28
|
} catch {
|
|
29
29
|
throw new Error(
|
|
30
30
|
`Could not find package ${pkg}. Make sure it's installed.\n` +
|
|
31
|
-
`If you're developing locally, build the Rust binary with: cargo build -p substructure-core --bin
|
|
31
|
+
`If you're developing locally, build the Rust binary with: cargo build -p substructure-core --bin subs`
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
File without changes
|