@sys9/tape9-cli 0.12.0 → 0.13.0-darwin-arm64
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 +18 -0
- package/package.json +10 -18
- package/vendor/darwin_arm64/tape9 +0 -0
- package/bin/tape9 +0 -95
- package/lib/platform.js +0 -60
package/README.md
CHANGED
|
@@ -17,3 +17,21 @@ sys9 tape --help
|
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
`@sys9/tape9-cli` remains the tape9 package used by `@sys9/cli`.
|
|
20
|
+
|
|
21
|
+
## Append with a predecessor
|
|
22
|
+
|
|
23
|
+
Start a conditional chain on a new or existing Tape, keeping its ordinary content:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
printf 'first batch\n' | tape9 append history --after='' --space my-space
|
|
27
|
+
# Use the batch ID printed by the previous command:
|
|
28
|
+
printf 'next batch\n' | tape9 append history --after BATCH_ID --space my-space
|
|
29
|
+
tape9 append-state history --space my-space --json
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Each invocation reads at most 32 MiB and commits one atomic batch. A predecessor
|
|
33
|
+
conflict reports the current tail without appending. The CLI retries within the
|
|
34
|
+
invocation; use the SDK to persist batch identity and payload across processes.
|
|
35
|
+
Ordinary `append` and `capture` remain allowed and do not change the conditional
|
|
36
|
+
tail. Ordering only applies between conditional batches. Once one succeeds, the
|
|
37
|
+
Tape ID cannot be reused after deletion.
|
package/package.json
CHANGED
|
@@ -1,30 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sys9/tape9-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0-darwin-arm64",
|
|
4
4
|
"description": "tape9 CLI package used by @sys9/cli",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
|
+
"os": [
|
|
7
|
+
"darwin"
|
|
8
|
+
],
|
|
9
|
+
"cpu": [
|
|
10
|
+
"arm64"
|
|
11
|
+
],
|
|
12
|
+
"files": [
|
|
13
|
+
"vendor"
|
|
14
|
+
],
|
|
6
15
|
"repository": {
|
|
7
16
|
"type": "git",
|
|
8
17
|
"url": "git+https://github.com/sys9-ai/bricks.git"
|
|
9
18
|
},
|
|
10
|
-
"publishConfig": {
|
|
11
|
-
"access": "public"
|
|
12
|
-
},
|
|
13
|
-
"bin": {
|
|
14
|
-
"tape9": "bin/tape9"
|
|
15
|
-
},
|
|
16
|
-
"files": [
|
|
17
|
-
"README.md",
|
|
18
|
-
"bin",
|
|
19
|
-
"lib"
|
|
20
|
-
],
|
|
21
19
|
"engines": {
|
|
22
20
|
"node": ">=16"
|
|
23
|
-
},
|
|
24
|
-
"optionalDependencies": {
|
|
25
|
-
"@sys9/tape9-cli-linux-x64": "npm:@sys9/tape9-cli@0.12.0-linux-x64",
|
|
26
|
-
"@sys9/tape9-cli-linux-arm64": "npm:@sys9/tape9-cli@0.12.0-linux-arm64",
|
|
27
|
-
"@sys9/tape9-cli-darwin-x64": "npm:@sys9/tape9-cli@0.12.0-darwin-x64",
|
|
28
|
-
"@sys9/tape9-cli-darwin-arm64": "npm:@sys9/tape9-cli@0.12.0-darwin-arm64"
|
|
29
21
|
}
|
|
30
22
|
}
|
|
Binary file
|
package/bin/tape9
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
"use strict";
|
|
4
|
-
|
|
5
|
-
const { spawn } = require("node:child_process");
|
|
6
|
-
const { existsSync } = require("node:fs");
|
|
7
|
-
const path = require("node:path");
|
|
8
|
-
|
|
9
|
-
const packageJSON = require("../package.json");
|
|
10
|
-
const {
|
|
11
|
-
resolvePackagedBinaryPath,
|
|
12
|
-
resolvePlatformPackageName,
|
|
13
|
-
} = require("../lib/platform");
|
|
14
|
-
|
|
15
|
-
function detectPackageManager() {
|
|
16
|
-
const userAgent = process.env.npm_config_user_agent || "";
|
|
17
|
-
if (/\bbun\//.test(userAgent)) {
|
|
18
|
-
return "bun";
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const execPath = process.env.npm_execpath || "";
|
|
22
|
-
if (execPath.includes("bun")) {
|
|
23
|
-
return "bun";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
__dirname.includes(".bun/install/global") ||
|
|
28
|
-
__dirname.includes(".bun\\install\\global")
|
|
29
|
-
) {
|
|
30
|
-
return "bun";
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return userAgent ? "npm" : null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function resolveBinaryPath() {
|
|
37
|
-
const platformPackage = resolvePlatformPackageName(packageJSON.name);
|
|
38
|
-
try {
|
|
39
|
-
const packageJSONPath = require.resolve(platformPackage + "/package.json");
|
|
40
|
-
return {
|
|
41
|
-
binaryPath: resolvePackagedBinaryPath(path.dirname(packageJSONPath)),
|
|
42
|
-
platformPackage,
|
|
43
|
-
};
|
|
44
|
-
} catch {
|
|
45
|
-
return {
|
|
46
|
-
binaryPath: resolvePackagedBinaryPath(path.join(__dirname, "..")),
|
|
47
|
-
platformPackage,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const { binaryPath, platformPackage } = resolveBinaryPath();
|
|
53
|
-
if (!existsSync(binaryPath)) {
|
|
54
|
-
const packageManager = detectPackageManager();
|
|
55
|
-
const updateCommand =
|
|
56
|
-
packageManager === "bun"
|
|
57
|
-
? "bun add -g @sys9/tape9-cli@latest"
|
|
58
|
-
: "npm install -g @sys9/tape9-cli@latest";
|
|
59
|
-
throw new Error(
|
|
60
|
-
"Missing optional dependency " + platformPackage + ". Reinstall tape9: " + updateCommand,
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
65
|
-
stdio: "inherit",
|
|
66
|
-
env: process.env,
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
child.on("error", (error) => {
|
|
70
|
-
console.error(error);
|
|
71
|
-
process.exit(1);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const forwardSignal = (signal) => {
|
|
75
|
-
if (child.killed) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
try {
|
|
79
|
-
child.kill(signal);
|
|
80
|
-
} catch {
|
|
81
|
-
// Ignore failures while the child is already exiting.
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
["SIGINT", "SIGTERM", "SIGHUP"].forEach((signal) => {
|
|
86
|
-
process.on(signal, () => forwardSignal(signal));
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
child.on("exit", (code, signal) => {
|
|
90
|
-
if (signal) {
|
|
91
|
-
process.kill(process.pid, signal);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
process.exit(code ?? 1);
|
|
95
|
-
});
|
package/lib/platform.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const path = require("node:path");
|
|
4
|
-
|
|
5
|
-
const SUPPORTED_TARGETS = [
|
|
6
|
-
{
|
|
7
|
-
slug: "linux-x64",
|
|
8
|
-
os: "linux",
|
|
9
|
-
cpu: "x64",
|
|
10
|
-
vendorDir: "linux_amd64",
|
|
11
|
-
targetTriple: "x86_64-unknown-linux-musl",
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
slug: "linux-arm64",
|
|
15
|
-
os: "linux",
|
|
16
|
-
cpu: "arm64",
|
|
17
|
-
vendorDir: "linux_arm64",
|
|
18
|
-
targetTriple: "aarch64-unknown-linux-musl",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
slug: "darwin-x64",
|
|
22
|
-
os: "darwin",
|
|
23
|
-
cpu: "x64",
|
|
24
|
-
vendorDir: "darwin_amd64",
|
|
25
|
-
targetTriple: "x86_64-apple-darwin",
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
slug: "darwin-arm64",
|
|
29
|
-
os: "darwin",
|
|
30
|
-
cpu: "arm64",
|
|
31
|
-
vendorDir: "darwin_arm64",
|
|
32
|
-
targetTriple: "aarch64-apple-darwin",
|
|
33
|
-
}
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
function resolveSupportedTarget(platform = process.platform, arch = process.arch) {
|
|
37
|
-
for (const target of SUPPORTED_TARGETS) {
|
|
38
|
-
if (target.os === platform && target.cpu === arch) {
|
|
39
|
-
return target;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
throw new Error("unsupported platform: " + platform + " (" + arch + ")");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function resolvePackagedBinaryPath(rootDir, platform = process.platform, arch = process.arch) {
|
|
46
|
-
const target = resolveSupportedTarget(platform, arch);
|
|
47
|
-
return path.join(rootDir, "vendor", target.vendorDir, "tape9");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function resolvePlatformPackageName(rootPackageName, platform = process.platform, arch = process.arch) {
|
|
51
|
-
const target = resolveSupportedTarget(platform, arch);
|
|
52
|
-
return rootPackageName + "-" + target.slug;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
module.exports = {
|
|
56
|
-
SUPPORTED_TARGETS,
|
|
57
|
-
resolvePackagedBinaryPath,
|
|
58
|
-
resolvePlatformPackageName,
|
|
59
|
-
resolveSupportedTarget,
|
|
60
|
-
};
|