@occam-scaly/scaly-cli 0.1.0 → 0.2.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 CHANGED
@@ -1,6 +1,9 @@
1
1
  # @occam-scaly/scaly-cli
2
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.
3
+ Scaly CLI for end users. Enables:
4
+
5
+ - `scaly auth login` (session token for advanced MCP tools: databases/storage/logs)
6
+ - `.scaly/config.yaml` workflows (`scaly plan` / `scaly apply` / `scaly pull`)
4
7
 
5
8
  ## Install (recommended)
6
9
 
@@ -22,6 +25,16 @@ scaly auth status
22
25
  scaly auth logout
23
26
  ```
24
27
 
28
+ ## Project config
29
+
30
+ From a project repo containing `.scaly/config.yaml`:
31
+
32
+ ```bash
33
+ scaly plan --json
34
+ scaly apply --auto-approve --plan-hash sha256:... --json
35
+ scaly pull --json
36
+ ```
37
+
25
38
  ### Stages
26
39
 
27
40
  ```bash
package/lib/scaly-api.js CHANGED
@@ -3,20 +3,30 @@
3
3
  const axios = require('axios');
4
4
 
5
5
  const STAGE_ENDPOINTS = {
6
- prod: 'https://api.scaly.cloud/graphql',
7
- dev: 'https://api-dev.scaly.cloud/graphql',
8
- staging: 'https://api-staging.scaly.cloud/graphql'
6
+ prod: 'https://api.scalyapps.io/graphql',
7
+ dev: 'https://api.dev.scalyapps.io/graphql',
8
+ qa: 'https://api.qa.scalyapps.io/graphql'
9
9
  };
10
10
 
11
11
  function resolveApiEndpoint() {
12
12
  return (
13
13
  process.env.SCALY_API_URL ||
14
14
  process.env.API_ENDPOINT ||
15
- STAGE_ENDPOINTS[process.env.SCALY_STAGE || 'prod'] ||
15
+ STAGE_ENDPOINTS[normalizeStage(process.env.SCALY_STAGE) || 'prod'] ||
16
16
  STAGE_ENDPOINTS.prod
17
17
  );
18
18
  }
19
19
 
20
+ function normalizeStage(stage) {
21
+ const s = String(stage || '')
22
+ .trim()
23
+ .toLowerCase();
24
+ if (!s) return 'prod';
25
+ if (s === 'production') return 'prod';
26
+ if (s === 'staging') return 'qa';
27
+ return s;
28
+ }
29
+
20
30
  function resolveAuth() {
21
31
  const bearer =
22
32
  process.env.SCALY_API_BEARER ||
@@ -27,7 +37,16 @@ function resolveAuth() {
27
37
  }
28
38
 
29
39
  const scalyApiKey = process.env.SCALY_API_KEY;
30
- const appSyncApiKey = process.env.SCALY_APPSYNC_KEY;
40
+ const stage = normalizeStage(process.env.SCALY_STAGE);
41
+ const appSyncApiKey =
42
+ process.env.SCALY_APPSYNC_KEY ||
43
+ {
44
+ prod: 'da2-2veyt7vqrbaqbjio56tcgpbboe',
45
+ dev: 'da2-ujszvu6uwbenxfbtuy6svpffxi',
46
+ qa: 'da2-riqkqxfjpjfihewbm4e2buq2xm'
47
+ }[stage] ||
48
+ null;
49
+
31
50
  if (scalyApiKey && appSyncApiKey) {
32
51
  return { mode: 'keys', scalyApiKey, appSyncApiKey };
33
52
  }
@@ -51,7 +70,7 @@ async function graphqlRequest(query, variables) {
51
70
  const auth = resolveAuth();
52
71
  if (!auth) {
53
72
  const e = new Error(
54
- 'Missing auth. Provide SCALY_API_BEARER (or run `scaly login`) OR set SCALY_API_KEY + SCALY_APPSYNC_KEY.'
73
+ 'Missing auth. Provide SCALY_API_BEARER (or run `scaly login`) OR set SCALY_API_KEY.'
55
74
  );
56
75
  e.code = 'SCALY_AUTH_MISSING';
57
76
  throw e;
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "@occam-scaly/scaly-cli",
3
- "version": "0.1.0",
4
- "description": "Scaly CLI (auth + MCP helpers)",
3
+ "version": "0.2.0",
4
+ "description": "Scaly CLI (auth + project config helpers)",
5
5
  "bin": {
6
- "scaly": "./bin/scaly-public.js"
6
+ "scaly": "./bin/scaly.js"
7
7
  },
8
8
  "scripts": {
9
- "test": "node -c ./bin/scaly-public.js && node -c ./lib/scaly-auth.js"
9
+ "test": "node -c ./bin/scaly.js && node -c ./lib/scaly-auth.js"
10
10
  },
11
11
  "dependencies": {
12
- "axios": "^1.7.9"
12
+ "axios": "^1.7.9",
13
+ "ws": "^8.18.3",
14
+ "yaml": "^2.8.1"
13
15
  },
14
16
  "engines": {
15
17
  "node": ">=18.0.0"
@@ -24,4 +26,3 @@
24
26
  "README.md"
25
27
  ]
26
28
  }
27
-