@wordbricks/velen 0.2.13 → 0.2.14-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 +5 -1
- package/package.json +15 -16
- package/vendor/aarch64-apple-darwin/velen/velen +0 -0
- package/bin/velen.js +0 -143
package/README.md
CHANGED
|
@@ -12,18 +12,22 @@ Runtime config:
|
|
|
12
12
|
|
|
13
13
|
- On Unix-like systems, the user config file is `${XDG_CONFIG_HOME:-~/.config}/velen/config.toml`.
|
|
14
14
|
- On Windows, the user config file is `%APPDATA%\\velen\\config.toml`.
|
|
15
|
+
- Named profiles use `${XDG_CONFIG_HOME:-~/.config}/velen/profiles/<profile>/config.toml` on Unix-like systems and `%APPDATA%\\velen\\profiles\\<profile>\\config.toml` on Windows.
|
|
16
|
+
- Select a profile with `--profile <profile>` or `VELEN_PROFILE`; `--profile` takes precedence. The default profile keeps using the legacy flat paths above.
|
|
15
17
|
- The current persisted keys are `active_org` and `request_timeout_sec`.
|
|
16
18
|
- Runtime config is resolved in this order: built-in defaults -> user config file -> internal typed runtime overrides.
|
|
17
19
|
- `velen org use <org>` persists `active_org`. Passing `--org <org>` for a command takes precedence over the stored `active_org` value for that invocation.
|
|
18
|
-
- `velen auth logout` clears both the stored auth session and the stored `active_org
|
|
20
|
+
- `velen auth logout` clears both the stored auth session and the stored `active_org` for the selected profile, so later org-scoped commands fail explicitly until a new org is selected.
|
|
19
21
|
|
|
20
22
|
Credential storage:
|
|
21
23
|
|
|
22
24
|
- On Unix-like systems, the CLI persists the full auth session blob to `${XDG_CONFIG_HOME:-~/.config}/velen/auth.json`.
|
|
23
25
|
- On Windows, the CLI persists the full auth session blob to `%APPDATA%\\velen\\auth.json`.
|
|
26
|
+
- Named profiles use `${XDG_CONFIG_HOME:-~/.config}/velen/profiles/<profile>/auth.json` on Unix-like systems and `%APPDATA%\\velen\\profiles\\<profile>\\auth.json` on Windows.
|
|
24
27
|
- `auth.json` stores the user identity, bearer token, session timing metadata, and the last refresh timestamp.
|
|
25
28
|
- Authenticated commands now run an explicit auth-session lifecycle before building an authenticated API client:
|
|
26
29
|
load `auth.json` on startup -> call the CLI session refresh contract -> persist the returned token and timing metadata.
|
|
30
|
+
- `VELEN_ACCESS_TOKEN` remains invocation-only and takes precedence over the selected profile's stored auth session without implicitly writing to it.
|
|
27
31
|
|
|
28
32
|
Version cache:
|
|
29
33
|
|
package/package.json
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
2
|
+
"cpu": [
|
|
3
|
+
"arm64"
|
|
4
|
+
],
|
|
4
5
|
"description": "Velen CLI",
|
|
5
|
-
"license": "Apache-2.0",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/wordbricks/velen.git",
|
|
9
|
-
"directory": "apps/cli"
|
|
10
|
-
},
|
|
11
|
-
"bin": {
|
|
12
|
-
"velen": "bin/velen.js"
|
|
13
|
-
},
|
|
14
6
|
"files": [
|
|
15
|
-
"
|
|
7
|
+
"vendor",
|
|
16
8
|
"README.md"
|
|
17
9
|
],
|
|
18
|
-
"
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"name": "@wordbricks/velen",
|
|
12
|
+
"os": [
|
|
13
|
+
"darwin"
|
|
14
|
+
],
|
|
19
15
|
"publishConfig": {
|
|
20
16
|
"access": "public"
|
|
21
17
|
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/wordbricks/velen.git",
|
|
21
|
+
"directory": "apps/cli"
|
|
22
|
+
},
|
|
23
|
+
"version": "0.2.14-darwin-arm64",
|
|
22
24
|
"engines": {
|
|
23
25
|
"node": ">=18"
|
|
24
|
-
},
|
|
25
|
-
"optionalDependencies": {
|
|
26
|
-
"velen-darwin-arm64": "npm:@wordbricks/velen@0.2.13-darwin-arm64"
|
|
27
26
|
}
|
|
28
27
|
}
|
|
Binary file
|
package/bin/velen.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { spawn } from "node:child_process";
|
|
4
|
-
import { chmodSync, existsSync, statSync } from "node:fs";
|
|
5
|
-
import { createRequire } from "node:module";
|
|
6
|
-
import path from "node:path";
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
8
|
-
|
|
9
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
const __dirname = path.dirname(__filename);
|
|
11
|
-
const require = createRequire(import.meta.url);
|
|
12
|
-
|
|
13
|
-
const CLI_PACKAGE_NAME = "@wordbricks/velen";
|
|
14
|
-
const PLATFORM_PACKAGE_BY_TARGET = {
|
|
15
|
-
"aarch64-apple-darwin": "velen-darwin-arm64",
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const { platform, arch } = process;
|
|
19
|
-
let targetTriple = null;
|
|
20
|
-
if (platform === "darwin" && arch === "arm64") {
|
|
21
|
-
targetTriple = "aarch64-apple-darwin";
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (!targetTriple) {
|
|
25
|
-
throw new Error(`Unsupported platform: ${platform} (${arch})`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const platformPackage = PLATFORM_PACKAGE_BY_TARGET[targetTriple];
|
|
29
|
-
if (!platformPackage) {
|
|
30
|
-
throw new Error(`Unsupported target triple: ${targetTriple}`);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// COMMENT: This target map is intentionally duplicated here so the published
|
|
34
|
-
// Node launcher stays self-contained, while the typed helper lives in src/.
|
|
35
|
-
|
|
36
|
-
// CONTEXT: platform packages are installed through npm alias names so the
|
|
37
|
-
// launcher resolves the alias folder, not the underlying published package id.
|
|
38
|
-
const binaryName = "velen";
|
|
39
|
-
const localVendorRoot = path.join(__dirname, "..", "vendor");
|
|
40
|
-
const localBinaryPath = path.join(
|
|
41
|
-
localVendorRoot,
|
|
42
|
-
targetTriple,
|
|
43
|
-
"velen",
|
|
44
|
-
binaryName
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
let vendorRoot;
|
|
48
|
-
try {
|
|
49
|
-
const packageJsonPath = require.resolve(`${platformPackage}/package.json`);
|
|
50
|
-
vendorRoot = path.join(path.dirname(packageJsonPath), "vendor");
|
|
51
|
-
} catch {
|
|
52
|
-
if (existsSync(localBinaryPath)) {
|
|
53
|
-
vendorRoot = localVendorRoot;
|
|
54
|
-
} else {
|
|
55
|
-
const packageManager = detectPackageManager();
|
|
56
|
-
const reinstallCommand =
|
|
57
|
-
packageManager === "bun"
|
|
58
|
-
? `bun install -g ${CLI_PACKAGE_NAME}@latest`
|
|
59
|
-
: `npm install -g ${CLI_PACKAGE_NAME}@latest`;
|
|
60
|
-
throw new Error(
|
|
61
|
-
`Missing optional dependency ${platformPackage}. Reinstall Velen CLI: ${reinstallCommand}`
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const binaryPath = path.join(vendorRoot, targetTriple, "velen", binaryName);
|
|
67
|
-
|
|
68
|
-
ensureExecutable(binaryPath);
|
|
69
|
-
|
|
70
|
-
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
71
|
-
env: process.env,
|
|
72
|
-
stdio: "inherit",
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
child.on("error", (error) => {
|
|
76
|
-
console.error(error);
|
|
77
|
-
process.exit(1);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
const forwardSignal = (signal) => {
|
|
81
|
-
if (child.killed) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
try {
|
|
86
|
-
child.kill(signal);
|
|
87
|
-
} catch {
|
|
88
|
-
// Ignore forwarding failures if the child already exited.
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
["SIGINT", "SIGTERM", "SIGHUP"].forEach((signal) => {
|
|
93
|
-
process.on(signal, () => forwardSignal(signal));
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
const childResult = await new Promise((resolve) => {
|
|
97
|
-
child.on("exit", (code, signal) => {
|
|
98
|
-
if (signal) {
|
|
99
|
-
resolve({ signal, type: "signal" });
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
resolve({ exitCode: code ?? 1, type: "code" });
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
if (childResult.type === "signal") {
|
|
108
|
-
process.kill(process.pid, childResult.signal);
|
|
109
|
-
} else {
|
|
110
|
-
process.exit(childResult.exitCode);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function detectPackageManager() {
|
|
114
|
-
const userAgent = process.env.npm_config_user_agent ?? "";
|
|
115
|
-
if (/\bbun\//.test(userAgent)) {
|
|
116
|
-
return "bun";
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const execPath = process.env.npm_execpath ?? "";
|
|
120
|
-
if (execPath.includes("bun")) {
|
|
121
|
-
return "bun";
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (
|
|
125
|
-
__dirname.includes(".bun/install/global") ||
|
|
126
|
-
__dirname.includes(".bun\\install\\global")
|
|
127
|
-
) {
|
|
128
|
-
return "bun";
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return userAgent ? "npm" : null;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function ensureExecutable(filePath) {
|
|
135
|
-
const currentMode = statSync(filePath).mode & 0o777;
|
|
136
|
-
if ((currentMode & 0o111) !== 0) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// CONTEXT: npm tarballs store vendored native binaries without execute bits,
|
|
141
|
-
// so restore the expected mode before spawning the packaged CLI binary.
|
|
142
|
-
chmodSync(filePath, currentMode | 0o755);
|
|
143
|
-
}
|