@fugood/bricks-cli 2.25.0-beta.8 → 2.25.0-beta.80

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.
Files changed (70) hide show
  1. package/README.md +115 -28
  2. package/lib/1001.js +1 -0
  3. package/lib/1010.js +1 -0
  4. package/lib/1178.js +1 -0
  5. package/lib/1215.js +1 -0
  6. package/lib/1708.js +9 -0
  7. package/lib/1759.js +1 -0
  8. package/lib/1936.js +1 -0
  9. package/lib/1946.js +1 -0
  10. package/lib/2151.js +1 -0
  11. package/lib/2247.js +1 -0
  12. package/lib/2486.js +1 -0
  13. package/lib/2557.js +1 -0
  14. package/lib/3223.js +4 -0
  15. package/lib/3332.js +13 -0
  16. package/lib/3593.js +1 -0
  17. package/lib/3690.js +1 -0
  18. package/lib/3774.js +44 -0
  19. package/lib/3976.js +14 -0
  20. package/lib/4305.js +1 -0
  21. package/lib/4456.js +3 -0
  22. package/lib/4479.js +30 -0
  23. package/lib/4530.js +22 -0
  24. package/lib/4642.js +9 -0
  25. package/lib/4685.js +1202 -0
  26. package/lib/5212.js +1 -0
  27. package/lib/563.js +4 -0
  28. package/lib/5658.js +2 -0
  29. package/lib/6194.js +3 -0
  30. package/lib/6645.js +1 -0
  31. package/lib/6818.js +1 -0
  32. package/lib/7111.js +2 -0
  33. package/lib/7233.js +2546 -0
  34. package/lib/7294.js +19 -0
  35. package/lib/7456.js +1 -0
  36. package/lib/7494.js +18 -0
  37. package/lib/7511.js +1 -0
  38. package/lib/7574.js +1 -0
  39. package/lib/7648.js +1 -0
  40. package/lib/8166.js +1 -0
  41. package/lib/8295.js +109 -0
  42. package/lib/831.js +1 -0
  43. package/lib/853.js +1 -0
  44. package/lib/907.js +918 -0
  45. package/lib/9215.js +1 -0
  46. package/lib/9320.js +3 -0
  47. package/lib/9387.js +32 -0
  48. package/lib/9405.js +1 -0
  49. package/lib/9430.js +1 -0
  50. package/lib/9583.js +19 -0
  51. package/lib/9590.js +7 -0
  52. package/lib/9663.js +1 -0
  53. package/lib/9866.js +7 -0
  54. package/lib/index.js +165 -974
  55. package/lib/lib.js +1121 -0
  56. package/lib/simulator-host-bridge.cjs +1 -0
  57. package/lib/simulator-main.mjs +23 -0
  58. package/lib/simulator-preload.cjs +1 -0
  59. package/package.json +28 -8
  60. package/lib/10.js +0 -1
  61. package/lib/117.js +0 -2543
  62. package/lib/166.js +0 -1
  63. package/lib/178.js +0 -1
  64. package/lib/3.js +0 -1
  65. package/lib/456.js +0 -1
  66. package/lib/511.js +0 -1
  67. package/lib/587.js +0 -7
  68. package/lib/602.js +0 -3
  69. package/lib/647.js +0 -30
  70. package/lib/940.js +0 -1
package/README.md CHANGED
@@ -15,11 +15,15 @@ npm install -g @fugood/bricks-cli
15
15
  ## Quick Start
16
16
 
17
17
  ```bash
18
- # Login with a one-time passcode (recommended)
19
- bricks auth login <passcode>
18
+ # Sign in with your BRICKS account (opens the browser, recommended)
19
+ bricks auth login
20
20
 
21
- # Or login with your workspace token directly
22
- bricks auth login-token -t <your-workspace-token>
21
+ # Select a workspace as the active profile
22
+ bricks auth use-workspace
23
+
24
+ # Workspace auth for CI/automation: one-time passcode or token
25
+ bricks auth login-workspace <passcode>
26
+ bricks auth login-workspace --token <your-workspace-token>
23
27
 
24
28
  # Check connection status
25
29
  bricks auth status
@@ -44,54 +48,78 @@ bricks media boxes
44
48
 
45
49
  ## Authentication Methods
46
50
 
47
- ### Method 1: One-Time Passcode (Recommended)
51
+ ### Method 1: OAuth Sign-in (Recommended)
48
52
 
49
- The easiest way to authenticate is using a one-time passcode:
53
+ Sign in with your BRICKS account the CLI opens your browser (Authorization
54
+ Code + PKCE against Auth0) and keeps the session refreshed automatically:
50
55
 
51
- 1. Go to [BRICKS Controller](https://control.bricks.tools)
52
- 2. Navigate to Workspace Settings > API Token
53
- 3. Click "Create CLI Passcode"
54
- 4. Use the passcode in the CLI:
55
- ```bash
56
- bricks auth login <passcode>
57
- ```
56
+ ```bash
57
+ bricks auth login # opens the browser
58
+ bricks auth login --no-browser # device-code flow for SSH/headless terminals
59
+ ```
60
+
61
+ Only one account can be signed in at a time; signing in again replaces the
62
+ identity (saved profiles are kept). After signing in, pick which workspaces to
63
+ work with — each becomes a profile:
64
+
65
+ ```bash
66
+ bricks auth workspaces # list workspaces your account can access
67
+ bricks auth use-workspace # interactive picker (or pass an id/name)
68
+ ```
69
+
70
+ OAuth profiles authorize by your role in the workspace — the same permissions
71
+ you have in the web controller. `bricks auth logout` revokes the session;
72
+ profiles remain and reactivate on the next login.
58
73
 
59
- The passcode is valid for 5 minutes and can only be used once. This method is more secure as you don't need to copy/paste long tokens.
74
+ > Note: OAuth login requires the Auth0 native client to be configured in the
75
+ > build (or `BRICKS_OAUTH_CLIENT_ID`). Until then, use workspace auth below.
60
76
 
61
- ### Method 2: Direct Token
77
+ ### Method 2: Workspace Auth (CI / automation)
62
78
 
63
- You can also login with a workspace token directly:
79
+ Workspace tokens are scoped, self-contained credentials ideal for CI:
64
80
 
65
81
  1. Go to [BRICKS Controller](https://control.bricks.tools)
66
82
  2. Navigate to Workspace Settings > API Token
67
- 3. Generate a new token with the required permissions
68
- 4. Use the token in the CLI:
83
+ 3. Click "Generate OTP" (valid 5 minutes, single use) or create a token
84
+ 4. Use it in the CLI:
69
85
  ```bash
70
- bricks auth login-token -t <your-workspace-token>
86
+ bricks auth login-workspace <passcode>
87
+ bricks auth login-workspace --token <your-workspace-token>
71
88
  ```
72
89
 
90
+ > `bricks auth login <passcode>` remains as a deprecated alias for
91
+ > `bricks auth login-workspace <passcode>`; `bricks auth login` without a
92
+ > passcode now performs the OAuth browser sign-in. `login-token` is also deprecated.
93
+
73
94
  ## Commands
74
95
 
75
96
  ### Authentication
76
97
 
77
98
  ```bash
78
- # Login with one-time passcode (recommended)
79
- bricks auth login <passcode> [-p profile-name]
99
+ # Sign in with your BRICKS account (OAuth via browser)
100
+ bricks auth login [--no-browser]
101
+
102
+ # List workspaces / select one as the active profile
103
+ bricks auth workspaces [-j|--json]
104
+ bricks auth use-workspace [workspace] [-p profile-name]
80
105
 
81
- # Login with token
82
- bricks auth login-token -t <token> [-p profile-name]
106
+ # Workspace auth (one-time passcode or token)
107
+ bricks auth login-workspace [passcode] [--token <token>] [-p profile-name]
83
108
 
84
109
  # Check status
85
110
  bricks auth status [-j|--json]
86
111
 
87
- # List all profiles
112
+ # List all profiles (kind: oauth | token)
88
113
  bricks auth list
89
114
 
90
115
  # Switch profile
91
116
  bricks auth use <profile-name>
92
117
 
93
- # Logout
94
- bricks auth logout [-p profile-name] [--all]
118
+ # Sign out of the OAuth session (profiles are kept; --all removes them too)
119
+ bricks auth logout [--all]
120
+
121
+ # Remove a saved profile
122
+ bricks auth remove <profile-name>
95
123
 
96
124
  # Set custom API URL
97
125
  bricks auth set-url <url>
@@ -187,7 +215,13 @@ bricks app bind <app-id> [-b device-ids] [-u device-ids] [--dry-run] [-j|--json]
187
215
  bricks app trigger <app-id> <test-id> [--play|--stop] [--setup-at-launch]
188
216
 
189
217
  # Preview a release without publishing
190
- bricks app release <app-id> -c <config-path-or-json> [--dry-run] [-j|--json]
218
+ bricks app release <app-id> -c <config-path-or-json> [-n name] [--version version] [--changelogs text] [--dry-run] [-j|--json]
219
+
220
+ # Diagnose a config: schema validation + semantic lint rules
221
+ # (data-update-race, redundant-rect-overlay, off-grid-frame, out-of-bounds-frame,
222
+ # wait-async-no-op, missing-result-param, unused-data-node, z-order-cover)
223
+ # Accepts a local file path or a remote application id.
224
+ bricks app doctor <app-id-or-path> [-c|--composed] [--strict] [--only codes] [--ignore codes] [-j|--json]
191
225
  ```
192
226
 
193
227
  ### Module Management
@@ -209,7 +243,11 @@ bricks module update <module-id> [-n name] [-d description] [-c config-json] [-f
209
243
  bricks module short-edit <module-id> -l '[{"shortId":"<subspace-short-id>","path":"property.name","content":"value"}]'
210
244
 
211
245
  # Preview a release without publishing
212
- bricks module release <module-id> -c <config-path-or-json> [--dry-run] [-j|--json]
246
+ bricks module release <module-id> -c <config-path-or-json> [-n name] [--version version] [--changelogs text] [--dry-run] [-j|--json]
247
+
248
+ # Diagnose a module config (same rules as `app doctor`; the root subspace's
249
+ # data nodes are treated as the module's exposed interface)
250
+ bricks module doctor <module-id-or-path> [--strict] [--only codes] [--ignore codes] [-j|--json]
213
251
  ```
214
252
 
215
253
  ### Device Group Management
@@ -258,6 +296,55 @@ bricks media files <box-id> \
258
296
  bricks media file <file-id> [-j|--json]
259
297
  ```
260
298
 
299
+ ### Data Bank (Remote Properties)
300
+
301
+ Manage the workspace Data Bank: settings and space keys go through the Workspace API
302
+ (workspace token); property CRUD talks to the Data Bank API directly using a space key.
303
+ On the first property command the CLI issues a key via the Workspace API and saves it
304
+ to the active profile (`~/.bricks-cli/config.json`) — no manual setup needed.
305
+
306
+ ```bash
307
+ # Workspace-level settings
308
+ bricks data status [-j|--json] # also shows the stored CLI key (masked)
309
+ bricks data enable
310
+ bricks data disable
311
+
312
+ # Stored CLI key management
313
+ bricks data login [--name <keyName>] # (re)issue a key and save it to the profile
314
+ bricks data logout [--revoke] # remove the stored key; --revoke also revokes it
315
+
316
+ # Space key management (human output masks key values; --json includes them)
317
+ bricks data keys list [-j|--json]
318
+ bricks data keys new <name> \
319
+ [--expire-at <ISO date>] \ # between 1 hour and 90 days from now
320
+ [--read <propId,...>] \ # limit readable properties
321
+ [--write <propId,...>] \ # limit writable properties
322
+ [-j|--json]
323
+ bricks data keys revoke <keyValue|name> [-y] [-j|--json]
324
+
325
+ # Property CRUD (Data Bank API, uses the stored key)
326
+ bricks data list [-k keyword] [-m InSubspace|Global] [-j|--json]
327
+ bricks data get <propertyId> [-j|--json]
328
+ bricks data set <propertyId> \
329
+ [-v <json-or-string> | --value-file <path>] \
330
+ [-d <definition-json> | --definition-file <path>] \
331
+ [-m InSubspace|Global] [-t tag1,tag2] [-n "<update note>"] \
332
+ [--no-upsert] \ # fail when the property does not exist
333
+ [--no-notify] \ # skip notifying subscribed devices
334
+ [--dry-run] [-j|--json]
335
+ bricks data remove <propertyId> [-y] [--dry-run] [-j|--json]
336
+ ```
337
+
338
+ Notes:
339
+ - `set` is an upsert by default and notifies subscribed devices, the same as editing in the controller Bank page.
340
+ - When no `-v/--value-file` is given, `set` keeps the current value (useful to change only tags or the definition).
341
+ - `-v` parses the input as JSON and falls back to a plain string (`-v '{"a":1}'` → object, `-v hello` → string).
342
+ - Revoking the auto-provisioned `manager` / `used-by-device` keys rotates them instead of deleting them.
343
+ - The Data Bank endpoint is derived from the configured BRICKS endpoint
344
+ (prod → `bank.bricks.tools`, beta → `bank-beta.bricks.tools`, dev → `localhost:8080`).
345
+ - Environment overrides for CI / custom setups: `BRICKS_BANK_SPACENAME` + `BRICKS_BANK_SPACEKEY`
346
+ (skip the stored key) and `BRICKS_BANK_ENDPOINT` (custom Bank URL).
347
+
261
348
  ### Interactive Mode
262
349
 
263
350
  ```bash
package/lib/1001.js ADDED
@@ -0,0 +1 @@
1
+ import*as e from"ink";import*as r from"react";import*as o from"react/jsx-runtime";export const __rspack_esm_id=1001;export const __rspack_esm_ids=[1001];export const __webpack_modules__={8498(r){r.exports=e},51649(e){e.exports=r},71178(e){e.exports=o},52928(e,r,o){o.r(r),o.d(r,{WorkspacePicker:()=>l,applyWorkspaceSearchInput:()=>i,filterWorkspaces:()=>a});var t=o(68832),s=o(51649),c=o(8498),n=o(71178),a=(e,r)=>{var o=r.trim().toLowerCase();return o?e.filter(e=>[e.name,e._id].some(e=>String(e||"").toLowerCase().includes(o))):e},i=(e,r,o={})=>o.backspace||o.delete?e.slice(0,-1):!r||o.ctrl||o.meta?e:e+r,l=({workspaces:e,onSelect:r,onCancel:o})=>{var l=t((0,s.useState)(""),2),x=l[0],d=l[1],p=t((0,s.useState)(0),2),m=p[0],h=p[1],u=(0,s.useMemo)(()=>a(e,x),[e,x]);(0,c.useInput)((e,t)=>{if(t.escape)return void o();if(t.upArrow||t.downArrow){if(0===u.length)return;var s=t.upArrow?-1:1;h(e=>(e+s+u.length)%u.length);return}if(t.return){var c=u[m];c&&r(c);return}var n=i(x,e,t);n!==x&&(d(n),h(0))});var j=Math.min(Math.max(m-Math.floor(5),0),Math.max(u.length-10,0)),_=u.slice(j,j+10);return(0,n.jsxs)(c.Box,{flexDirection:"column",children:[(0,n.jsx)(c.Text,{bold:!0,children:"Select a workspace"}),(0,n.jsxs)(c.Box,{marginTop:1,children:[(0,n.jsx)(c.Text,{children:"Search: "}),x?(0,n.jsx)(c.Text,{color:"cyan",children:x}):(0,n.jsx)(c.Text,{dimColor:!0,children:"Name or workspace ID"}),(0,n.jsx)(c.Text,{inverse:!0,children:" "})]}),(0,n.jsx)(c.Box,{marginTop:1,flexDirection:"column",children:_.length>0?_.map((e,r)=>{var o=j+r===m;return(0,n.jsxs)(c.Box,{children:[(0,n.jsx)(c.Text,{color:o?"cyan":void 0,children:o?"❯ ":" "}),(0,n.jsx)(c.Text,{color:o?"cyan":void 0,children:e.name}),(0,n.jsxs)(c.Text,{dimColor:!0,children:[" ",e._id]})]},e._id)}):(0,n.jsx)(c.Text,{color:"yellow",children:"No matching workspaces"})}),(0,n.jsx)(c.Box,{marginTop:1,children:(0,n.jsx)(c.Text,{dimColor:!0,children:"Type anywhere to search \xb7 ↑/↓ navigate \xb7 Enter select \xb7 Esc cancel"})})]})}}};