@apardev/flare-cli 0.0.0-stage → 0.1.9
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/LICENSE +21 -0
- package/README.md +19 -2
- package/bin/flare.js +96 -0
- package/package.json +43 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Amin Parsa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @apardev/flare-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The [Flare](https://github.com/aminparsa18/Flare.Net) CLI, installable with npm. It manages a standing,
|
|
4
|
+
self-hosted Flare stack (`flare start`, `stop`, `status`, `update`, `open`, `logs`, `doctor`, `export`, `mcp`, …).
|
|
5
|
+
The binary is self-contained, so **no .NET SDK or runtime is needed**. Docker is.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install --global @apardev/flare-cli
|
|
9
|
+
flare start
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Or run it once without installing: `npx @apardev/flare-cli doctor`.
|
|
13
|
+
|
|
14
|
+
Supported: macOS (arm64, x64), Linux (glibc, arm64, x64), Windows (x64). On anything else, use the .NET tool:
|
|
15
|
+
`dotnet tool install --global Flare.Cli`. Both routes install the same `flare` command; use one of them, not both.
|
|
16
|
+
|
|
17
|
+
See the [CLI guide](https://github.com/aminparsa18/Flare.Net/blob/main/docs/how-to/deploy/run-with-cli.md) and the
|
|
18
|
+
[command reference](https://github.com/aminparsa18/Flare.Net/blob/main/docs/reference/cli-commands.md).
|
|
19
|
+
Do not install with `--omit=optional` (or `--no-optional`): the binary lives in an optional per-platform package,
|
|
20
|
+
`@apardev/flare-cli-<os>-<cpu>`.
|
package/bin/flare.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Launcher for the self-contained `flare` binary shipped in a per-platform npm package
|
|
3
|
+
// (@apardev/flare-cli-<os>-<arch>, pulled in through optionalDependencies so npm only
|
|
4
|
+
// downloads the one matching this machine). The idea - a thin Node shim over a
|
|
5
|
+
// self-contained .NET executable - is from https://github.com/adrianstevens/npm-cli-wrapper;
|
|
6
|
+
// the per-platform-package layout is the esbuild/swc one.
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const { spawn } = require('node:child_process');
|
|
10
|
+
const fs = require('node:fs');
|
|
11
|
+
const path = require('node:path');
|
|
12
|
+
|
|
13
|
+
const PLATFORM_PACKAGES = {
|
|
14
|
+
'darwin-arm64': '@apardev/flare-cli-darwin-arm64',
|
|
15
|
+
'darwin-x64': '@apardev/flare-cli-darwin-x64',
|
|
16
|
+
'linux-arm64': '@apardev/flare-cli-linux-arm64',
|
|
17
|
+
'linux-x64': '@apardev/flare-cli-linux-x64',
|
|
18
|
+
'win32-x64': '@apardev/flare-cli-win32-x64',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function fail(message) {
|
|
22
|
+
console.error(`flare: ${message}`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function resolveBinary() {
|
|
27
|
+
// Escape hatch for local testing / unsupported layouts.
|
|
28
|
+
if (process.env.FLARE_CLI_BINARY_PATH) {
|
|
29
|
+
return process.env.FLARE_CLI_BINARY_PATH;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const key = `${process.platform}-${process.arch}`;
|
|
33
|
+
const pkg = PLATFORM_PACKAGES[key];
|
|
34
|
+
if (!pkg) {
|
|
35
|
+
fail(
|
|
36
|
+
`unsupported platform ${key}. Supported: ${Object.keys(PLATFORM_PACKAGES).join(', ')}. ` +
|
|
37
|
+
'Install the .NET tool instead: dotnet tool install --global Flare.Cli');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let pkgJson;
|
|
41
|
+
try {
|
|
42
|
+
pkgJson = require.resolve(`${pkg}/package.json`);
|
|
43
|
+
} catch {
|
|
44
|
+
fail(
|
|
45
|
+
`the platform package ${pkg} is not installed. This happens when npm skipped optional ` +
|
|
46
|
+
'dependencies (--omit=optional) or the install was done on a different OS/CPU. ' +
|
|
47
|
+
'Reinstall with: npm install --global @apardev/flare-cli');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return path.join(path.dirname(pkgJson), 'bin', process.platform === 'win32' ? 'flare.exe' : 'flare');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const binary = resolveBinary();
|
|
54
|
+
|
|
55
|
+
if (!fs.existsSync(binary)) {
|
|
56
|
+
fail(`binary not found at ${binary}`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (process.platform !== 'win32') {
|
|
60
|
+
// Tarballs normally keep the exec bit; this covers installs that lost it.
|
|
61
|
+
try {
|
|
62
|
+
fs.accessSync(binary, fs.constants.X_OK);
|
|
63
|
+
} catch {
|
|
64
|
+
try {
|
|
65
|
+
fs.chmodSync(binary, 0o755);
|
|
66
|
+
} catch (err) {
|
|
67
|
+
fail(`${binary} is not executable and chmod failed: ${err.message}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let child;
|
|
73
|
+
try {
|
|
74
|
+
child = spawn(binary, process.argv.slice(2), { stdio: 'inherit' });
|
|
75
|
+
} catch (err) {
|
|
76
|
+
// spawn can throw synchronously (e.g. EBADARCH: an x64 Node cannot exec an arm64 binary).
|
|
77
|
+
fail(`could not start ${binary}: ${err.message}`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Ctrl+C reaches the child directly (same process group); forward the signals a
|
|
81
|
+
// terminal does not deliver itself (e.g. `kill`, service managers).
|
|
82
|
+
for (const signal of ['SIGTERM', 'SIGHUP']) {
|
|
83
|
+
process.on(signal, () => child.kill(signal));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
child.on('error', (err) => fail(`could not start ${binary}: ${err.message}`));
|
|
87
|
+
|
|
88
|
+
child.on('exit', (code, signal) => {
|
|
89
|
+
if (signal) {
|
|
90
|
+
// Re-raise so the caller sees "killed by signal", not a silent exit 0.
|
|
91
|
+
process.removeAllListeners(signal);
|
|
92
|
+
process.kill(process.pid, signal);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
process.exit(code ?? 1);
|
|
96
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apardev/flare-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.9",
|
|
4
|
+
"description": "Flare CLI - lifecycle manager for a standalone, self-hosted Flare observability stack. Self-contained, no .NET SDK required.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Amin Parsa",
|
|
7
|
+
"homepage": "https://github.com/aminparsa18/Flare.Net",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/aminparsa18/Flare.Net.git",
|
|
11
|
+
"directory": "src/Flare.Cli.Npm"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"flare",
|
|
15
|
+
"cli",
|
|
16
|
+
"opentelemetry",
|
|
17
|
+
"observability",
|
|
18
|
+
"logs",
|
|
19
|
+
"traces",
|
|
20
|
+
"metrics",
|
|
21
|
+
"docker"
|
|
22
|
+
],
|
|
23
|
+
"bin": {
|
|
24
|
+
"flare": "bin/flare.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"bin/flare.js",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public",
|
|
36
|
+
"provenance": true
|
|
37
|
+
},
|
|
38
|
+
"optionalDependencies": {
|
|
39
|
+
"@apardev/flare-cli-darwin-arm64": "0.1.9",
|
|
40
|
+
"@apardev/flare-cli-darwin-x64": "0.1.9",
|
|
41
|
+
"@apardev/flare-cli-linux-arm64": "0.1.9",
|
|
42
|
+
"@apardev/flare-cli-linux-x64": "0.1.9",
|
|
43
|
+
"@apardev/flare-cli-win32-x64": "0.1.9"
|
|
44
|
+
}
|
|
45
|
+
}
|