@occam-scaly/scaly-cli 0.1.0

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 ADDED
@@ -0,0 +1,39 @@
1
+ # @occam-scaly/scaly-cli
2
+
3
+ Scaly CLI for end users. Primary use today is enabling advanced Scaly MCP tools (databases, storage, logs) without copying tokens into editor config or restarting your IDE.
4
+
5
+ ## Install (recommended)
6
+
7
+ ```bash
8
+ npm install -g @occam-scaly/scaly-cli
9
+ ```
10
+
11
+ ## No-install (works anywhere Node is available)
12
+
13
+ ```bash
14
+ npx -y @occam-scaly/scaly-cli auth login
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```bash
20
+ scaly auth login
21
+ scaly auth status
22
+ scaly auth logout
23
+ ```
24
+
25
+ ### Stages
26
+
27
+ ```bash
28
+ scaly auth login --stage dev
29
+ scaly auth login --stage qa
30
+ scaly auth login --stage prod
31
+ ```
32
+
33
+ ## Auth store
34
+
35
+ The CLI writes a short-lived session token to:
36
+
37
+ - `~/.config/scaly/auth.json` (or `$XDG_CONFIG_HOME/scaly/auth.json`)
38
+
39
+ The Scaly MCP server reads this on-demand, so refreshing your token does not require restarting VS Code/Codex.
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const { runAuth } = require('../lib/scaly-auth');
5
+
6
+ function parseFlags(argv) {
7
+ const out = {};
8
+ for (let i = 0; i < argv.length; i++) {
9
+ const a = argv[i];
10
+ if (!a.startsWith('--')) {
11
+ if (!out._) out._ = [a];
12
+ else out._.push(a);
13
+ continue;
14
+ }
15
+ const key = a.slice(2);
16
+ const val =
17
+ argv[i + 1] && !argv[i + 1].startsWith('--') ? argv[++i] : 'true';
18
+ out[key] = val;
19
+ }
20
+ return out;
21
+ }
22
+
23
+ function printHelp() {
24
+ // eslint-disable-next-line no-console
25
+ console.log(`
26
+ Scaly CLI
27
+
28
+ Usage:
29
+ scaly auth login [--stage prod|dev|qa] [--no-open]
30
+ scaly auth status [--json]
31
+ scaly auth logout [--json]
32
+
33
+ Notes:
34
+ - To enable advanced MCP tools (databases/storage/logs), run: scaly auth login
35
+ - This writes a short-lived session token to ~/.config/scaly/auth.json
36
+ - The Scaly MCP server reads that file on-demand (no IDE restart required)
37
+ `);
38
+ }
39
+
40
+ async function main() {
41
+ const argv = process.argv.slice(2);
42
+ const [cmd, sub, ...rest] = argv;
43
+
44
+ if (!cmd || cmd === '-h' || cmd === '--help') {
45
+ printHelp();
46
+ process.exit(0);
47
+ }
48
+
49
+ if (cmd === 'auth') {
50
+ const flags = parseFlags(rest);
51
+ const code = await runAuth(sub, flags);
52
+ process.exit(code);
53
+ }
54
+
55
+ // eslint-disable-next-line no-console
56
+ console.error(`Unknown command: ${cmd}\n\nRun: scaly --help`);
57
+ process.exit(2);
58
+ }
59
+
60
+ main().catch((err) => {
61
+ // eslint-disable-next-line no-console
62
+ console.error(err?.message || String(err));
63
+ process.exit(1);
64
+ });