@fugood/bricks-cli 2.25.0-beta.74 → 2.25.0-beta.75

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
@@ -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
+ ```
58
60
 
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.
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:
60
64
 
61
- ### Method 2: Direct Token
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.
73
+
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.
76
+
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>
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"})})]})}}};
package/lib/1708.js CHANGED
@@ -6,4 +6,4 @@ ${t}
6
6
  ${s.map(({entry:n})=>n).join("\n")}
7
7
  `;yield(0,E.writeFile)(t,`${i}${l}${c}`),console.log(`Added ${s.map(({entry:n})=>n).join(", ")} to .prettierignore`)}}),function(n){return g.apply(this,arguments)}),H=(y=v(function*(n){var e=D.join(n,".claude","settings.local.json"),t={};if(yield P(e)){try{t=JSON.parse((yield(0,E.readFile)(e,"utf-8")))}catch{console.warn(`Skipping auto mode setup; ${e} is not valid JSON`);return}if(t.autoMode)return}t.autoMode={environment:U},yield(0,E.mkdir)(D.dirname(e),{recursive:!0}),yield(0,E.writeFile)(e,`${JSON.stringify(t,null,2)}
8
8
  `),console.log(`Set up auto mode in ${e}`),yield W(n)}),function(n){return y.apply(this,arguments)}),V=(f=v(function*(n,e){var t,a,r={...R(e),default_tools_approval_mode:"approve"};if(yield P(n)){try{a=T.q((yield(0,E.readFile)(n,"utf-8")))}catch{console.warn(`Skipping .codex/config.toml update; ${n} is not valid TOML`);return}(t=a&&"object"==typeof a?a:{mcp_servers:{}}).mcp_servers&&"object"==typeof t.mcp_servers||(t.mcp_servers={}),t.mcp_servers["bricks-ctor"]=r,delete t.mcp_servers["bricks-project"]}else t={mcp_servers:{"bricks-ctor":r}};yield(0,E.writeFile)(n,`${T.A(t)}
9
- `),console.log(`Updated ${n}`)}),function(n,e){return f.apply(this,arguments)});function q(){return j.apply(this,arguments)}function j(){return(j=v(function*(n=process.cwd()){var e,t=(e=v(function*(n,e){var t,a=[],r=[];return yield Promise.all(Object.entries(n).map((t=v(function*([n,t]){try{(yield(0,E.readFile)(D.join(e,n),"utf8")).replace(/\r\n/g,"\n")!==t.replace(/\r\n/g,"\n")&&a.push(n)}catch{r.push(n)}}),function(n){return t.apply(this,arguments)}))),{changed:a.sort(),missing:r.sort()}}),function(n,t){return e.apply(this,arguments)}),a=yield t(L,D.join(n,"ctor")),r=(yield P(D.join(n,"CLAUDE.md")))||(yield P(D.join(n,"AGENTS.md")))?yield t(w,D.join(n,".bricks","skills")):{changed:[],missing:[]};return{upToDate:a.changed.length+a.missing.length+r.changed.length+r.missing.length===0,cliVersion:"2.25.0-beta.74",lib:a,skills:r}})).apply(this,arguments)}function z(){return Y.apply(this,arguments)}function Y(){return(Y=v(function*(n={}){var e=process.cwd(),t=!!n.skipCopyProject,a=!!n.refreshSkills;yield O(e);var r=D.join(e,"project");(yield P(r))&&(yield(0,E.rm)(r,{recursive:!0,force:!0}),console.log("Removed legacy project/ directory")),t?console.log("Skipping copy of files to ctor/"):yield N(e),yield K(e);var i=yield P(`${e}/CLAUDE.md`),o=yield P(`${e}/AGENTS.md`);(i||o)&&(yield _(`${e}/.mcp.json`,R(e)),yield F(e,{refreshSkills:a})),i&&(yield H(e)),o&&(yield V(`${e}/.codex/config.toml`,e))})).apply(this,arguments)}},53241(n,e,t){t.r(e),t.d(e,{detectChannel:()=>s,detectInstallMethod:()=>l});var a=t(73024),r=t(76760),i=t(48161),o=n=>{if(!n)return n;try{return a.realpathSync(n)}catch{return n}},s=({version:n,execPath:e}={})=>{var t=e||process.execPath;return t&&/[\\/]bricks-beta(?:\.exe)?$/i.test(t)||/-(beta|alpha|rc|next)\b/i.test(n||"2.25.0-beta.74")?"beta":"release"},l=({execPath:n=process.execPath,scriptPath:e=process.argv[1],homeDir:t=i.homedir(),realpath:a=o}={})=>{let s;var l=(s=n)?r.basename(s).replace(/\.exe$/i,""):"";if("bricks"===l||"bricks-beta"===l)return{method:"binary",execPath:n,installDir:r.dirname(n)};var c=a(e),p=((n,e)=>{if(!n)return null;var t=r.sep,a=`${t}node_modules${t}${e.replace(/\//g,t)}${t}`,i=n.indexOf(a);return -1===i?null:n.slice(0,i)})(c,"@fugood/bricks-cli");if(p){var d=r.sep,u=r.join(t,".bun","install","global");return p===u||p.startsWith(u+d)?{method:"bun",installRoot:p}:/[\\/](?:\.pnpm|pnpm[\\/]global)[\\/]/.test(p)?{method:"pnpm",installRoot:p}:/[\\/](?:\.yarn|yarn[\\/]global)[\\/]/.test(p)?{method:"yarn",installRoot:p}:{method:"npm",installRoot:p.endsWith(`${d}lib`)?p.slice(0,-`${d}lib`.length):p}}return{method:"unknown",execPath:n,scriptPath:c}}}};
9
+ `),console.log(`Updated ${n}`)}),function(n,e){return f.apply(this,arguments)});function q(){return j.apply(this,arguments)}function j(){return(j=v(function*(n=process.cwd()){var e,t=(e=v(function*(n,e){var t,a=[],r=[];return yield Promise.all(Object.entries(n).map((t=v(function*([n,t]){try{(yield(0,E.readFile)(D.join(e,n),"utf8")).replace(/\r\n/g,"\n")!==t.replace(/\r\n/g,"\n")&&a.push(n)}catch{r.push(n)}}),function(n){return t.apply(this,arguments)}))),{changed:a.sort(),missing:r.sort()}}),function(n,t){return e.apply(this,arguments)}),a=yield t(L,D.join(n,"ctor")),r=(yield P(D.join(n,"CLAUDE.md")))||(yield P(D.join(n,"AGENTS.md")))?yield t(w,D.join(n,".bricks","skills")):{changed:[],missing:[]};return{upToDate:a.changed.length+a.missing.length+r.changed.length+r.missing.length===0,cliVersion:"2.25.0-beta.75",lib:a,skills:r}})).apply(this,arguments)}function z(){return Y.apply(this,arguments)}function Y(){return(Y=v(function*(n={}){var e=process.cwd(),t=!!n.skipCopyProject,a=!!n.refreshSkills;yield O(e);var r=D.join(e,"project");(yield P(r))&&(yield(0,E.rm)(r,{recursive:!0,force:!0}),console.log("Removed legacy project/ directory")),t?console.log("Skipping copy of files to ctor/"):yield N(e),yield K(e);var i=yield P(`${e}/CLAUDE.md`),o=yield P(`${e}/AGENTS.md`);(i||o)&&(yield _(`${e}/.mcp.json`,R(e)),yield F(e,{refreshSkills:a})),i&&(yield H(e)),o&&(yield V(`${e}/.codex/config.toml`,e))})).apply(this,arguments)}},53241(n,e,t){t.r(e),t.d(e,{detectChannel:()=>s,detectInstallMethod:()=>l});var a=t(73024),r=t(76760),i=t(48161),o=n=>{if(!n)return n;try{return a.realpathSync(n)}catch{return n}},s=({version:n,execPath:e}={})=>{var t=e||process.execPath;return t&&/[\\/]bricks-beta(?:\.exe)?$/i.test(t)||/-(beta|alpha|rc|next)\b/i.test(n||"2.25.0-beta.75")?"beta":"release"},l=({execPath:n=process.execPath,scriptPath:e=process.argv[1],homeDir:t=i.homedir(),realpath:a=o}={})=>{let s;var l=(s=n)?r.basename(s).replace(/\.exe$/i,""):"";if("bricks"===l||"bricks-beta"===l)return{method:"binary",execPath:n,installDir:r.dirname(n)};var c=a(e),p=((n,e)=>{if(!n)return null;var t=r.sep,a=`${t}node_modules${t}${e.replace(/\//g,t)}${t}`,i=n.indexOf(a);return -1===i?null:n.slice(0,i)})(c,"@fugood/bricks-cli");if(p){var d=r.sep,u=r.join(t,".bun","install","global");return p===u||p.startsWith(u+d)?{method:"bun",installRoot:p}:/[\\/](?:\.pnpm|pnpm[\\/]global)[\\/]/.test(p)?{method:"pnpm",installRoot:p}:/[\\/](?:\.yarn|yarn[\\/]global)[\\/]/.test(p)?{method:"yarn",installRoot:p}:{method:"npm",installRoot:p.endsWith(`${d}lib`)?p.slice(0,-`${d}lib`.length):p}}return{method:"unknown",execPath:n,scriptPath:c}}}};
package/lib/1936.js CHANGED
@@ -1 +1 @@
1
- export const __rspack_esm_id=1936;export const __rspack_esm_ids=[1936];export const __webpack_modules__={76627(e,a,r){r.r(a),r.d(a,{BANK_DISABLED_MESSAGE:()=>p.GE,DEFAULT_BANK_KEY_NAME:()=>o,clearStoredBankCredentials:()=>u,issueBankCredentials:()=>k,resolveBankCredentials:()=>l});var n,s,t,c=r(99436),i=r(47988),p=r(31596),o="bricks-cli",k=(n=c(function*(e,{keyName:a}={}){var r=(0,i.getCurrentProfile)(),n=yield e.workspace(),s=n?.bank;if(!s?.enable_remote_update||!s?.spacename)throw Error(p.GE);var t=(0,i.getBankCredentials)(r),c=new Set((s.keys||[]).map(e=>e.value)),k=a||o,l=yield e.updateWorkspace({newBankKey:{name:k,enableExpired:!1}}),u=(l?.bank?.keys||[]).find(e=>!c.has(e.value));if(!u)throw Error("Failed to issue a Data Bank space key");t?.spacekey&&t.spacekey!==u.value&&(yield e.updateWorkspace({revokeBankKey:t.spacekey}).catch(()=>{}));var d={spacename:l.bank.spacename,spacekey:u.value,keyName:u.name||k,issuedAt:u.createAt||new Date().toISOString()};return(0,i.setBankCredentials)(r,d),d}),function(e){return n.apply(this,arguments)}),l=(s=c(function*(e){if(process.env.BRICKS_BANK_SPACENAME&&process.env.BRICKS_BANK_SPACEKEY)return{spacename:process.env.BRICKS_BANK_SPACENAME,spacekey:process.env.BRICKS_BANK_SPACEKEY,source:"env"};var a=(0,i.getBankCredentials)((0,i.getCurrentProfile)());return a?.spacename&&a?.spacekey?{...a,source:"profile"}:{...yield k(e),source:"issued"}}),function(e){return s.apply(this,arguments)}),u=(t=c(function*(e,{revoke:a}={}){var r=(0,i.getCurrentProfile)(),n=(0,i.getBankCredentials)(r),s=!1;return a&&n?.spacekey&&(yield e.updateWorkspace({revokeBankKey:n.spacekey}),s=!0),{cleared:(0,i.clearBankCredentials)(r),revoked:s}}),function(e){return t.apply(this,arguments)})}};
1
+ export const __rspack_esm_id=1936;export const __rspack_esm_ids=[1936];export const __webpack_modules__={76627(e,r,a){a.r(r),a.d(r,{BANK_DISABLED_MESSAGE:()=>p.GE,DEFAULT_BANK_KEY_NAME:()=>k,clearStoredBankCredentials:()=>f,issueBankCredentials:()=>l,resolveBankCredentials:()=>u});var n,t,i,o=a(99436),s=a(77598),c=a(47988),p=a(31596),k="bricks-cli",d=(e,r,a)=>{var n,t=(0,c.getProfileCredentialSnapshot)(e);if(void 0!==r&&(n=t.fingerprint,n&&r?n.kind!==r.kind||n.workspaceId!==r.workspaceId||n.baseUrl!==r.baseUrl||n.activityLogBaseUrl!==r.activityLogBaseUrl||("oauth"===n.kind?n.oauthSubject!==r.oauthSubject:n.token!==r.token):n!==r))throw Error(`Profile ${e} changed or is no longer logged in. Retry.`);return{fingerprint:void 0===r?t.fingerprint:r,bank:void 0===a?t.bank:a}},l=(n=o(function*(e,{keyName:r,profile:a=(0,c.getCurrentProfile)(),expectedProfile:n,bank:t}={}){var i=d(a,n,t),o=i.fingerprint,l=i.bank;if(!o)throw Error(`Profile ${a} changed or is no longer logged in. Retry.`);var u=yield e.workspace();if(!u?._id||null==o.workspaceId||String(u._id)!==o.workspaceId)throw Error(`Profile ${a} changed or the client targets another workspace. Retry.`);var f=u?.bank;if(!f?.enable_remote_update||!f?.spacename)throw Error(p.GE);var y=new Set((f.keys||[]).map(e=>e.value)),_=`${r||k}-${s.randomUUID()}`,v=yield e.updateWorkspace({newBankKey:{name:_,enableExpired:!1}}),g=(v?.bank?.keys||[]).find(e=>e.name===_&&!y.has(e.value));if(!g)throw Error("Failed to issue a Data Bank space key");var h={spacename:v.bank.spacename,spacekey:g.value,keyName:g.name||_,issuedAt:g.createAt||new Date().toISOString()};if(!(0,c.setBankCredentials)(a,h,{expectedProfile:o}))throw yield e.updateWorkspace({revokeBankKey:g.value}).catch(()=>{}),Error(`Profile ${a} changed while issuing Data Bank credentials. Retry.`);return l?.spacekey&&l.spacekey!==g.value&&(yield e.updateWorkspace({revokeBankKey:l.spacekey}).catch(()=>{})),h}),function(e){return n.apply(this,arguments)}),u=(t=o(function*(e,{profile:r=(0,c.getCurrentProfile)(),expectedProfile:a,bank:n}={}){if(process.env.BRICKS_BANK_SPACENAME&&process.env.BRICKS_BANK_SPACEKEY)return{spacename:process.env.BRICKS_BANK_SPACENAME,spacekey:process.env.BRICKS_BANK_SPACEKEY,source:"env"};var t=d(r,a,n),i=t.fingerprint,o=t.bank;return o?.spacename&&o?.spacekey?{...o,source:"profile"}:{...yield l(e,{profile:r,expectedProfile:i,bank:o}),source:"issued"}}),function(e){return t.apply(this,arguments)}),f=(i=o(function*(e,{revoke:r,profile:a=(0,c.getCurrentProfile)(),expectedProfile:n,bank:t}={}){var i=d(a,n,t),o=i.fingerprint,s=i.bank;if(!s?.spacekey)return{cleared:!1,revoked:!1};var p=!1;if(r){var k=yield e.workspace();if(!k?._id||o?.workspaceId==null||String(k._id)!==o.workspaceId)throw Error(`Profile ${a} changed or the client targets another workspace. Retry.`);yield e.updateWorkspace({revokeBankKey:s.spacekey}),p=!0}return{cleared:(0,c.clearBankCredentials)(a,{expectedProfile:o,expectedSpacekey:s.spacekey}),revoked:p}}),function(e){return i.apply(this,arguments)})}};
package/lib/1946.js ADDED
@@ -0,0 +1 @@
1
+ import*as _ from"react";export const __rspack_esm_id=1946;export const __rspack_esm_ids=[1946];export const __webpack_modules__={51649(s){s.exports=_}};
package/lib/2486.js CHANGED
@@ -1 +1 @@
1
- export const __rspack_esm_id=2486;export const __rspack_esm_ids=[2486];export const __webpack_modules__={421(e,r,a){a.r(r),a.d(r,{buildDoctorReport:()=>k,renderDoctorReport:()=>v});var o,i,t=a(99436),s=a(85382),n=a(8479),c=a(7586),p=a(47988),l=(o=t(function*(){try{return yield Promise.all([a.e(9866),a.e(6645),a.e(4479),a.e(7648),a.e(853),a.e(1010),a.e(8117)]).then(a.bind(a,98372)),{available:!0}}catch(e){return{available:!1,error:e.message}}}),function(){return o.apply(this,arguments)}),u=(e,r,a)=>({severity:e,code:r,message:a}),k=(i=t(function*({version:e="2.25.0-beta.74",mcpCheck:r=l}={}){var a=(0,p.getCurrentProfile)(),o=(0,p.getCurrentProfileSource)(),i=(0,p.getTokenInfo)(a),t=(0,p.getBaseUrl)(),k=(0,p.getActivityLogBaseUrl)(),h=[],v={ok:!1,timestamp:new Date().toISOString(),cli:{name:"bricks",version:e},profile:{name:a,source:o},config:{path:p.CONFIG_PATH,baseUrl:t,activityLogBaseUrl:k},auth:{available:!!i?.token,source:i?.token?"config":"missing",workspaceId:i?.workspaceId||null,workspaceName:i?.workspaceName||null,createdAt:i?.createdAt||null,tokenPreview:(0,c.$l)(i?.token)},connectivity:{workspace:{ok:!1,skipped:!i?.token,error:null}},capabilities:{zeroArgMode:(0,n.isInteractiveTerminal)()?"interactive":"help",mcp:{available:!1,error:null}},issues:h};if(i?.token)try{var d=yield(0,s.createClient)(t,i.token).workspace();v.connectivity.workspace={ok:!0,skipped:!1,error:null,id:d?._id||i.workspaceId||null,name:d?.name||i.workspaceName||null},v.auth.workspaceId=d?._id||v.auth.workspaceId,v.auth.workspaceName=d?.name||v.auth.workspaceName}catch(e){v.connectivity.workspace={ok:!1,skipped:!1,error:e.message},h.push(u("error","workspace_unreachable",`Workspace query failed for ${t}: ${e.message}`))}else h.push(u("warning","auth_missing","No saved token for the current profile."));var m=yield r();return v.capabilities.mcp={available:m.available,error:m.error||null},m.available||h.push(u("warning","mcp_unavailable",`MCP stdio server is unavailable: ${m.error||"Unknown error"}`)),v.ok=0===h.length,v}),function(){return i.apply(this,arguments)}),h=(e,r,a)=>`${e.padEnd(14)} ${r}${a?` ${a}`:""}`,v=e=>{var r=[];if(r.push("BRICKS CLI Doctor"),r.push("─".repeat(60)),r.push(h("CLI","OK",`bricks v${e.cli.version}`)),r.push(h("Profile","OK",`${e.profile.name} (${e.profile.source})`)),r.push(h("BRICKS API","OK",e.config.baseUrl)),r.push(h("Activity Log","OK",e.config.activityLogBaseUrl)),e.auth.available){var a=e.auth.workspaceName||e.auth.workspaceId||"Unknown workspace";r.push(h("Auth","OK",`${a} (${e.auth.source}, ${e.auth.tokenPreview})`))}else r.push(h("Auth","WARN","No saved token for the current profile"));if(e.connectivity.workspace.skipped)r.push(h("Workspace","WARN","Skipped because no token is available"));else if(e.connectivity.workspace.ok){var o=e.connectivity.workspace.name||e.connectivity.workspace.id||"Unknown workspace";r.push(h("Workspace","OK",o))}else r.push(h("Workspace","FAIL",e.connectivity.workspace.error));return e.capabilities.mcp.available?r.push(h("MCP","OK","STDIO server import is available")):r.push(h("MCP","WARN",e.capabilities.mcp.error)),r.push(h("Zero-arg mode",((e,r=!1)=>e?"OK":r?"WARN":"FAIL")("interactive"===e.capabilities.zeroArgMode,"help"===e.capabilities.zeroArgMode),"interactive"===e.capabilities.zeroArgMode?"Starts Ink interactive mode on TTY":"Shows help outside TTY contexts")),e.issues.length>0&&(r.push("─".repeat(60)),r.push("Issues"),e.issues.forEach(e=>{r.push(`- [${e.severity}] ${e.message}`)})),r.join("\n")}}};
1
+ export const __rspack_esm_id=2486;export const __rspack_esm_ids=[2486];export const __webpack_modules__={421(e,r,a){a.r(r),a.d(r,{buildDoctorReport:()=>h,renderDoctorReport:()=>v});var i,o,t=a(99436),s=a(85382),n=a(31802),c=a(8479),l=a(7586),p=a(47988),u=(i=t(function*(){try{return yield Promise.all([a.e(9866),a.e(6645),a.e(4479),a.e(7648),a.e(853),a.e(1010),a.e(8117)]).then(a.bind(a,98372)),{available:!0}}catch(e){return{available:!1,error:e.message}}}),function(){return i.apply(this,arguments)}),k=(e,r,a)=>({severity:e,code:r,message:a}),h=(o=t(function*({version:e="2.25.0-beta.75",mcpCheck:r=u}={}){var a=(0,p.getCurrentProfile)(),i=(0,p.getCurrentProfileSource)(),o=(0,n.getConnectionContext)(a),t=o.tokenInfo,h=o.auth,d=o.baseUrl,v=o.activityLogBaseUrl,m=[],w={ok:!1,timestamp:new Date().toISOString(),cli:{name:"bricks",version:e},profile:{name:a,source:i},config:{path:p.CONFIG_PATH,baseUrl:d,activityLogBaseUrl:v},auth:{available:!!h,source:h?"config":"missing",kind:h?.kind||null,workspaceId:t?.workspaceId||null,workspaceName:t?.workspaceName||null,createdAt:t?.createdAt||null,tokenPreview:h?.kind==="token"?(0,l.$l)(h.token):null},connectivity:{workspace:{ok:!1,skipped:!h,error:null}},capabilities:{zeroArgMode:(0,c.isInteractiveTerminal)()?"interactive":"help",mcp:{available:!1,error:null}},issues:m};if(h)try{var b=yield(0,s.createClient)(d,h).workspace();w.connectivity.workspace={ok:!0,skipped:!1,error:null,id:b?._id||t.workspaceId||null,name:b?.name||t.workspaceName||null},w.auth.workspaceId=b?._id||w.auth.workspaceId,w.auth.workspaceName=b?.name||w.auth.workspaceName}catch(e){w.connectivity.workspace={ok:!1,skipped:!1,error:e.message},m.push(k("error","workspace_unreachable",`Workspace query failed for ${d}: ${e.message}`))}else m.push(k("warning","auth_missing","No usable credential for the current profile."));var f=yield r();return w.capabilities.mcp={available:f.available,error:f.error||null},f.available||m.push(k("warning","mcp_unavailable",`MCP stdio server is unavailable: ${f.error||"Unknown error"}`)),w.ok=0===m.length,w}),function(){return o.apply(this,arguments)}),d=(e,r,a)=>`${e.padEnd(14)} ${r}${a?` ${a}`:""}`,v=e=>{var r=[];if(r.push("BRICKS CLI Doctor"),r.push("─".repeat(60)),r.push(d("CLI","OK",`bricks v${e.cli.version}`)),r.push(d("Profile","OK",`${e.profile.name} (${e.profile.source})`)),r.push(d("BRICKS API","OK",e.config.baseUrl)),r.push(d("Activity Log","OK",e.config.activityLogBaseUrl)),e.auth.available){var a=e.auth.workspaceName||e.auth.workspaceId||"Unknown workspace",i=[e.auth.source,e.auth.kind,e.auth.tokenPreview].filter(Boolean).join(", ");r.push(d("Auth","OK",i?`${a} (${i})`:a))}else r.push(d("Auth","WARN","No usable credential for the current profile"));if(e.connectivity.workspace.skipped)r.push(d("Workspace","WARN","Skipped because no credential is available"));else if(e.connectivity.workspace.ok){var o=e.connectivity.workspace.name||e.connectivity.workspace.id||"Unknown workspace";r.push(d("Workspace","OK",o))}else r.push(d("Workspace","FAIL",e.connectivity.workspace.error));return e.capabilities.mcp.available?r.push(d("MCP","OK","STDIO server import is available")):r.push(d("MCP","WARN",e.capabilities.mcp.error)),r.push(d("Zero-arg mode",((e,r=!1)=>e?"OK":r?"WARN":"FAIL")("interactive"===e.capabilities.zeroArgMode,"help"===e.capabilities.zeroArgMode),"interactive"===e.capabilities.zeroArgMode?"Starts Ink interactive mode on TTY":"Shows help outside TTY contexts")),e.issues.length>0&&(r.push("─".repeat(60)),r.push("Issues"),e.issues.forEach(e=>{r.push(`- [${e.severity}] ${e.message}`)})),r.join("\n")}}};