cloudhop 0.1.0 → 0.1.1

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 (5) hide show
  1. package/LICENSE +202 -21
  2. package/NOTICE +4 -0
  3. package/README.md +26 -10
  4. package/dist/cli.js +4 -262
  5. package/package.json +6 -5
package/LICENSE CHANGED
@@ -1,21 +1,202 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 dayepesb
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.
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ cloudhop
2
+ Copyright 2026 dayepesb and the cloudhop contributors
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
package/README.md CHANGED
@@ -1,20 +1,32 @@
1
- # cloudhop
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/dayepesb/cloudhop/main/assets/logo.svg" width="96" height="96" alt="cloudhop logo">
3
+ </p>
4
+
5
+ <h1 align="center">cloudhop</h1>
6
+
7
+ <p align="center">
8
+ Hop between cloud accounts, roles and regions with one command.<br>
9
+ Automatic login, no access keys.
10
+ </p>
11
+
12
+ <p align="center">
2
13
 
3
14
  [![Pipeline](https://github.com/dayepesb/cloudhop/actions/workflows/pipeline.yml/badge.svg)](https://github.com/dayepesb/cloudhop/actions/workflows/pipeline.yml)
4
15
  [![npm](https://img.shields.io/npm/v/cloudhop)](https://www.npmjs.com/package/cloudhop)
16
+ [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
5
17
 
6
- > 🚧 Early preview. AWS works today; Azure and Google Cloud are planned.
18
+ </p>
7
19
 
8
- Hop between cloud accounts, roles and regions with one command.
20
+ > 🚧 Early preview. AWS works today; Azure and Google Cloud are planned.
9
21
 
10
22
  ```bash
11
23
  npm i -g cloudhop
12
- cloudhop setup # pick your clouds, add an SSO portal or personal account
24
+ cloudhop setup # add an SSO portal or personal account
13
25
 
14
- hop pragma1 s3 ls # runs `aws s3 ls` with the right account, role and region
15
- hop pragma1 # who am I?
16
- cloudhop exec pragma1 -- terraform plan
17
- cloudhop ui # or manage everything from a local web page
26
+ hop acme-prod s3 ls # `aws s3 ls` with the right account, role and region
27
+ hop acme-prod # who am I?
28
+ cloudhop exec acme-prod -- terraform plan # any tool, with temporary credentials
29
+ cloudhop ui # or manage everything from a local web page
18
30
  ```
19
31
 
20
32
  ## Why
@@ -34,7 +46,7 @@ cloudhop is a thin proxy over the AWS CLI that:
34
46
 
35
47
  ## Documentation
36
48
 
37
- https://dayepesb.github.io/cloudhop (English and Spanish).
49
+ [dayepesb.github.io/cloudhop](https://dayepesb.github.io/cloudhop/), in English and Spanish.
38
50
 
39
51
  ## Contributing
40
52
 
@@ -58,4 +70,8 @@ real configuration.
58
70
 
59
71
  ## License
60
72
 
61
- MIT
73
+ [Apache License 2.0](LICENSE). See [NOTICE](NOTICE).
74
+
75
+ Contributions are welcome: read [CONTRIBUTING.md](CONTRIBUTING.md) and the
76
+ [Code of Conduct](CODE_OF_CONDUCT.md). Report security problems privately as
77
+ described in [SECURITY.md](SECURITY.md).
package/dist/cli.js CHANGED
@@ -11620,265 +11620,7 @@ import { createServer } from "http";
11620
11620
  var app_default = "// cloudhop local UI. Plain DOM, no build step: served as-is by `cloudhop ui`.\n\nconst TOKEN_KEY = 'cloudhop-token';\nconst SESSION_TEXT = {\n valid: 'Session valid',\n refreshable: 'Renews on next use',\n expired: 'Expired: sign in on next use',\n unknown: 'Managed by the cloud CLI',\n};\n\n// The token arrives in the URL fragment once; keep it for this tab and clean the address bar.\nconst fromHash = new URLSearchParams(location.hash.slice(1)).get('token');\nif (fromHash) {\n try {\n sessionStorage.setItem(TOKEN_KEY, fromHash);\n } catch {}\n history.replaceState(null, '', location.pathname);\n}\nlet token = fromHash;\ntry {\n token = token ?? sessionStorage.getItem(TOKEN_KEY);\n} catch {}\n\n// A fresh link opened in this same tab only changes the fragment: reload to pick up its token.\naddEventListener('hashchange', () => {\n if (new URLSearchParams(location.hash.slice(1)).has('token')) location.reload();\n});\n\nconst $main = document.getElementById('main');\nconst $dialog = document.getElementById('dialog');\nconst $toasts = document.getElementById('toasts');\nconst $addSource = document.getElementById('add-source');\nlet state;\n\n/** Tiny element builder: h('button', { class: 'primary', onclick }, 'Save'). */\nfunction h(tag, attrs = {}, ...children) {\n const el = document.createElement(tag);\n for (const [key, value] of Object.entries(attrs)) {\n if (value === undefined || value === null || value === false) continue;\n if (key.startsWith('on')) el.addEventListener(key.slice(2), value);\n else if (key === 'class') el.className = value;\n else if (value === true) el.setAttribute(key, '');\n else el.setAttribute(key, value);\n }\n for (const child of children.flat()) {\n if (child === undefined || child === null || child === false) continue;\n el.append(child instanceof Node ? child : document.createTextNode(String(child)));\n }\n return el;\n}\n\nclass ApiError extends Error {\n constructor(message, hint) {\n super(message);\n this.hint = hint;\n }\n}\n\n// Calls that may sign in wait for the person in the browser; everything else should answer quickly.\nconst MAY_SIGN_IN = /^\\/api\\/sources(\\/[^/]+\\/(login|sync|targets))?$/;\nconst QUICK_TIMEOUT_MS = 20_000;\n\nasync function api(method, path, body) {\n const waitsForPerson = MAY_SIGN_IN.test(path);\n let response;\n try {\n response = await fetch(path, {\n method,\n headers: {\n 'x-cloudhop-token': token ?? '',\n ...(body ? { 'content-type': 'application/json' } : {}),\n },\n body: body ? JSON.stringify(body) : undefined,\n signal: waitsForPerson ? undefined : AbortSignal.timeout(QUICK_TIMEOUT_MS),\n });\n } catch (error) {\n if (error.name === 'TimeoutError') {\n throw new ApiError(\n 'cloudhop ui is not responding.',\n 'Is it paused in your terminal (Ctrl-Z)? Run `fg` there, or stop it and run `cloudhop ui` again.',\n );\n }\n throw new ApiError(\n 'cloudhop ui is not running.',\n 'Run `cloudhop ui` again and open the new link it prints.',\n );\n }\n const data = await response.json().catch(() => ({}));\n if (!response.ok)\n throw new ApiError(data.error ?? `Request failed (${response.status}).`, data.hint);\n return data;\n}\n\nfunction toast(message, { error = false, hint } = {}) {\n const el = h(\n 'div',\n { class: `toast${error ? ' error' : ''}` },\n message,\n hint && h('small', {}, hint),\n );\n $toasts.append(el);\n setTimeout(() => el.remove(), error ? 9000 : 4000);\n}\n\nconst fail = (error) => toast(error.message, { error: true, hint: error.hint });\n\n/** Disables a button while its action runs. */\nasync function busy(button, action) {\n button.disabled = true;\n try {\n return await action();\n } finally {\n button.disabled = false;\n }\n}\n\nasync function refresh() {\n try {\n state = await api('GET', '/api/state');\n render();\n checkDoctor();\n } catch (error) {\n $main.replaceChildren(\n h(\n 'div',\n { class: 'hero' },\n h('h2', {}, 'Cannot reach cloudhop'),\n h('p', {}, error.message, error.hint ? ` ${error.hint}` : ''),\n ),\n );\n }\n}\n\nasync function checkDoctor() {\n try {\n const entries = await api('GET', '/api/doctor');\n const problems = entries.filter((e) => !e.installed || e.outdated);\n document.getElementById('doctor')?.remove();\n if (problems.length === 0) return;\n $main.prepend(\n h(\n 'div',\n { class: 'notice', id: 'doctor' },\n ...problems.map((e) =>\n h(\n 'div',\n {},\n e.installed\n ? `${e.cli} ${e.version} is older than ${e.minVersion}. `\n : `${e.cli} is not installed, so aliases cannot run commands yet. `,\n 'Run ',\n h('code', {}, 'cloudhop doctor'),\n ' in a terminal to install it.',\n ),\n ),\n ),\n );\n } catch {}\n}\n\n// ---------- main view ----------\n\nfunction render() {\n const enabled = state.enabledProviders;\n $addSource.hidden = enabled.length === 0;\n if (enabled.length === 0) return renderChooseClouds();\n if (state.sources.length === 0) {\n $main.replaceChildren(\n h(\n 'div',\n { class: 'hero' },\n h('h2', {}, 'Add your first account'),\n h(\n 'p',\n {},\n 'Add a company SSO portal or a personal account. cloudhop signs you in, finds every account and role you can use, and lets you give each one a short alias.',\n ),\n h('button', { class: 'primary', onclick: () => openAddSource() }, '+ Add source'),\n ),\n );\n return;\n }\n $main.replaceChildren(...state.sources.map(sourceCard));\n}\n\nfunction renderChooseClouds() {\n const boxes = state.providers.map((p) =>\n h(\n 'label',\n { class: 'choice' },\n h('input', { type: 'checkbox', value: p.id, checked: true }),\n h('span', {}, p.name),\n ),\n );\n const save = h(\n 'button',\n {\n class: 'primary',\n onclick: (e) =>\n busy(e.currentTarget, async () => {\n const ids = boxes\n .map((b) => b.querySelector('input'))\n .filter((i) => i.checked)\n .map((i) => i.value);\n await api('PUT', '/api/providers', { enabled: ids }).catch(fail);\n await refresh();\n }),\n },\n 'Continue',\n );\n $main.replaceChildren(\n h(\n 'div',\n { class: 'hero' },\n h('h2', {}, 'Which clouds do you use?'),\n h('p', {}, 'Azure and Google Cloud are coming soon.'),\n h(\n 'div',\n { class: 'choices', style: 'max-width:320px;margin:0 auto 16px;text-align:left' },\n boxes,\n ),\n save,\n ),\n );\n}\n\nfunction sourceCard(source) {\n const aliases = state.aliases.filter((a) => a.source === source.id);\n const where = source.settings.startUrl ?? source.kindLabel;\n const head = h(\n 'div',\n { class: 'card-head' },\n h('h2', {}, source.id),\n h('span', { class: `badge ${source.session}` }, SESSION_TEXT[source.session] ?? source.session),\n h('span', { class: 'meta' }, `${source.providerName} \xB7 ${where}`),\n h('div', { class: 'spacer' }),\n h(\n 'div',\n { class: 'actions' },\n h('button', { onclick: () => openAliasPicker(source) }, '+ Aliases'),\n h(\n 'button',\n {\n title: 'Sign in again and refresh its accounts',\n onclick: (e) =>\n busy(e.currentTarget, async () => {\n toast('Opening the browser to sign in\u2026');\n const report = await api(\n 'POST',\n `/api/sources/${encodeURIComponent(source.id)}/login`,\n ).catch(fail);\n if (report)\n toast(`${source.id}: signed in, ${report.targets.length} account/role(s).`);\n await refresh();\n }),\n },\n 'Sign in',\n ),\n h(\n 'button',\n {\n title: 'Refresh the accounts and roles you have access to',\n onclick: (e) =>\n busy(e.currentTarget, async () => {\n const report = await api(\n 'POST',\n `/api/sources/${encodeURIComponent(source.id)}/sync`,\n ).catch(fail);\n if (report) toast(syncMessage(source.id, report));\n await refresh();\n }),\n },\n 'Sync',\n ),\n h(\n 'button',\n {\n class: 'danger',\n onclick: (e) => {\n const count = aliases.length;\n const message = `Remove \"${source.id}\"${count ? ` and its ${count} alias(es)` : ''}?`;\n if (!confirm(message)) return;\n busy(e.currentTarget, async () => {\n await api('DELETE', `/api/sources/${encodeURIComponent(source.id)}`).catch(fail);\n await refresh();\n });\n },\n },\n 'Remove',\n ),\n ),\n );\n\n const body =\n aliases.length === 0\n ? h(\n 'div',\n { class: 'empty' },\n 'No aliases yet. ',\n h(\n 'button',\n { class: 'primary', onclick: () => openAliasPicker(source) },\n 'Pick accounts',\n ),\n )\n : h(\n 'table',\n {},\n h(\n 'thead',\n {},\n h(\n 'tr',\n {},\n h('th', {}, 'Alias'),\n h('th', {}, 'Region'),\n h('th', {}, 'Account / role'),\n h('th'),\n ),\n ),\n h('tbody', {}, aliases.map(aliasRow)),\n );\n return h('section', { class: 'card' }, head, h('div', { class: 'card-body' }, body));\n}\n\nfunction syncMessage(id, report) {\n const parts = [`${report.targets.length} available`];\n if (report.added) parts.push(`${report.added} new`);\n if (report.removed) parts.push(`${report.removed} removed`);\n const orphaned = report.orphanedAliases.length\n ? ` No longer available: ${report.orphanedAliases.join(', ')}.`\n : '';\n return `${id}: ${parts.join(', ')}.${orphaned}`;\n}\n\nfunction aliasRow(alias) {\n const input = h('input', {\n value: alias.region ?? '',\n 'aria-label': `Region for ${alias.name}`,\n class: 'mono',\n spellcheck: 'false',\n });\n const save = h('button', { hidden: true }, 'Save');\n const commit = () =>\n busy(save, async () => {\n const region = input.value.trim();\n const done = await api('PATCH', `/api/aliases/${encodeURIComponent(alias.name)}`, {\n region,\n }).catch(fail);\n if (done) toast(`${alias.name} now runs in ${region}.`);\n await refresh();\n });\n input.addEventListener('input', () => {\n save.hidden = input.value.trim() === (alias.region ?? '');\n });\n input.addEventListener('keydown', (e) => {\n if (e.key === 'Enter' && !save.hidden) commit();\n if (e.key === 'Escape') {\n input.value = alias.region ?? '';\n save.hidden = true;\n }\n });\n save.addEventListener('click', commit);\n\n return h(\n 'tr',\n {},\n h('td', { class: 'alias', title: `hop ${alias.name} <command>` }, alias.name),\n h('td', {}, h('div', { class: 'region' }, input, save)),\n h(\n 'td',\n {},\n alias.missing\n ? h('span', { class: 'missing' }, `${alias.target} (no longer available)`)\n : alias.label,\n ),\n h(\n 'td',\n { style: 'text-align:right' },\n h(\n 'button',\n {\n class: 'link',\n title: `Remove ${alias.name}`,\n 'aria-label': `Remove ${alias.name}`,\n onclick: (e) => {\n if (!confirm(`Remove alias \"${alias.name}\"?`)) return;\n busy(e.currentTarget, async () => {\n await api('DELETE', `/api/aliases/${encodeURIComponent(alias.name)}`).catch(fail);\n await refresh();\n });\n },\n },\n '\u2715',\n ),\n ),\n );\n}\n\n// ---------- dialogs ----------\n\nfunction showDialog(title, body, footer) {\n $dialog.replaceChildren(\n h(\n 'div',\n { class: 'dlg-head' },\n h('h2', {}, title),\n h('button', { class: 'link', 'aria-label': 'Close', onclick: () => $dialog.close() }, '\u2715'),\n ),\n h('div', { class: 'dlg-body' }, body),\n footer ? h('div', { class: 'dlg-foot' }, footer) : null,\n );\n if (!$dialog.open) $dialog.showModal();\n}\n\nfunction suggestSourceId(settings, kind) {\n const host = /^https:\\/\\/([^./]+)\\./.exec(settings.startUrl ?? '')?.[1];\n return slug(host ?? (kind === 'console-login' ? 'personal' : 'main'));\n}\n\nconst slug = (text) =>\n text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .slice(0, 63) || 'main';\n\n/** `previous` refills the form after a failed sign-in: { provider, kind, id, settings, error }. */\nfunction openAddSource(previous) {\n const providers = state.providers.filter((p) => state.enabledProviders.includes(p.id));\n let provider = providers.find((p) => p.id === previous?.provider) ?? providers[0];\n let kind = provider.kinds.find((k) => k.kind === previous?.kind) ?? provider.kinds[0];\n\n const form = h('form', { onsubmit: (e) => e.preventDefault() });\n const nameInput = h('input', {\n id: 'f-name',\n required: true,\n class: 'mono',\n spellcheck: 'false',\n });\n let nameTouched = Boolean(previous);\n nameInput.addEventListener('input', () => {\n nameTouched = true;\n });\n\n const fieldInputs = {};\n const fieldsBox = h('div');\n const nameLabel = h('label', { for: 'f-name' });\n\n function updateSuggestion() {\n if (nameTouched) return;\n const settings = Object.fromEntries(\n Object.entries(fieldInputs).map(([k, i]) => [k, i.value.trim()]),\n );\n const taken = new Set(state.sources.map((s) => s.id));\n let id = suggestSourceId(settings, kind.kind);\n for (let i = 2; taken.has(id); i++) id = `${suggestSourceId(settings, kind.kind)}-${i}`;\n nameInput.value = id;\n }\n\n function renderFields() {\n for (const key of Object.keys(fieldInputs)) delete fieldInputs[key];\n fieldsBox.replaceChildren(\n ...kind.fields.map((f) => {\n const input = h('input', {\n id: `f-${f.key}`,\n placeholder: f.placeholder ?? f.defaultValue ?? '',\n value: previous?.settings?.[f.key] ?? f.defaultValue ?? '',\n required: true,\n class: 'mono',\n spellcheck: 'false',\n oninput: updateSuggestion,\n });\n fieldInputs[f.key] = input;\n return h('div', { class: 'field' }, h('label', { for: input.id }, f.label), input);\n }),\n );\n nameLabel.textContent = kind.nameLabel ?? 'Short name for this source';\n updateSuggestion();\n }\n\n const providerSelect =\n providers.length > 1\n ? h(\n 'div',\n { class: 'field' },\n h('label', { for: 'f-provider' }, 'Cloud'),\n h(\n 'select',\n {\n id: 'f-provider',\n onchange: (e) => {\n provider = providers.find((p) => p.id === e.target.value);\n kind = provider.kinds[0];\n renderKinds();\n },\n },\n providers.map((p) => h('option', { value: p.id, selected: p === provider }, p.name)),\n ),\n )\n : null;\n\n const kindsBox = h('div', { class: 'choices' });\n function renderKinds() {\n kindsBox.replaceChildren(\n ...provider.kinds.map((k) =>\n h(\n 'label',\n { class: 'choice' },\n h('input', {\n type: 'radio',\n name: 'kind',\n value: k.kind,\n checked: k === kind,\n onchange: () => {\n kind = k;\n renderFields();\n },\n }),\n h('span', {}, h('strong', {}, k.label), k.hint ? h('small', {}, k.hint) : null),\n ),\n ),\n );\n renderFields();\n }\n\n form.append(\n previous?.error\n ? h(\n 'div',\n { class: 'notice error' },\n h('strong', {}, 'Could not sign in, so nothing was saved. '),\n previous.error.message,\n previous.error.hint ? h('div', { class: 'help' }, previous.error.hint) : null,\n )\n : '',\n providerSelect ?? '',\n h('div', { class: 'field' }, h('label', {}, 'What do you want to add?')),\n kindsBox,\n fieldsBox,\n h(\n 'div',\n { class: 'field' },\n nameLabel,\n nameInput,\n h(\n 'span',\n { class: 'help' },\n 'Lowercase letters, numbers and dashes. You will see it in ',\n h('code', {}, 'cloudhop ls'),\n '.',\n ),\n ),\n );\n renderKinds();\n if (previous) nameInput.value = previous.id;\n\n const submit = h('button', { class: 'primary', type: 'submit' }, 'Add and sign in');\n form.addEventListener('submit', async () => {\n if (!form.reportValidity()) return;\n const body = {\n provider: provider.id,\n kind: kind.kind,\n id: nameInput.value.trim(),\n settings: Object.fromEntries(\n Object.entries(fieldInputs).map(([k, i]) => [k, i.value.trim()]),\n ),\n };\n showDialog(\n 'Sign in',\n h(\n 'div',\n { class: 'waiting' },\n h('div', { class: 'spinner' }),\n h('strong', {}, 'Finish signing in in the browser tab that just opened.'),\n h('p', { class: 'help' }, 'This page continues on its own once you approve the request.'),\n ),\n );\n try {\n const report = await api('POST', '/api/sources', body);\n await refresh();\n const source = state.sources.find((s) => s.id === body.id);\n toast(`Signed in to ${body.id}. ${report.targets.length} account/role(s) found.`);\n openAliasPicker(source, report.targets);\n } catch (error) {\n // Nothing was saved: reopen the form with what was typed so it can be fixed.\n await refresh();\n openAddSource({ ...body, error });\n }\n });\n\n showDialog('Add source', form, [\n h('button', { type: 'button', onclick: () => $dialog.close() }, 'Cancel'),\n submit,\n ]);\n submit.setAttribute('form', 'add-form');\n form.id = 'add-form';\n}\n\nasync function openAliasPicker(source, preloaded) {\n let targets = preloaded;\n if (!targets) {\n showDialog(\n `Aliases for ${source.id}`,\n h('div', { class: 'waiting' }, h('div', { class: 'spinner' }), 'Loading accounts\u2026'),\n );\n try {\n targets = (await api('GET', `/api/sources/${encodeURIComponent(source.id)}/targets`)).targets;\n } catch (error) {\n $dialog.close();\n return fail(error);\n }\n }\n\n const used = new Map(\n state.aliases.filter((a) => a.source === source.id).map((a) => [a.target, a.name]),\n );\n const taken = new Set(state.aliases.map((a) => a.name));\n const defaultRegion = source.settings.region ?? '';\n const filter = h('input', {\n type: 'search',\n placeholder: `Filter ${targets.length} account/role(s)\u2026`,\n style: 'width:100%;margin-bottom:12px',\n });\n\n const rows = targets.map((t) => {\n const existing = used.get(t.id);\n let name = t.suggestedAlias;\n for (let i = 2; taken.has(name); i++) name = `${t.suggestedAlias}-${i}`;\n const check = h('input', {\n type: 'checkbox',\n disabled: Boolean(existing),\n 'aria-label': t.label,\n });\n const aliasInput = h('input', {\n value: name,\n class: 'mono',\n spellcheck: 'false',\n 'aria-label': `Alias for ${t.label}`,\n placeholder: 'alias',\n });\n const regionInput = h('input', {\n value: defaultRegion,\n class: 'mono',\n spellcheck: 'false',\n 'aria-label': `Region for ${t.label}`,\n placeholder: 'region',\n });\n // Only the checkbox and its text sit in the label, so clicking the inputs never toggles it.\n const el = h(\n 'div',\n { class: 'target' },\n h(\n 'label',\n { class: 'pick' },\n check,\n h(\n 'span',\n {},\n t.label,\n existing ? h('small', { class: 'already' }, `Already: ${existing}`) : null,\n ),\n ),\n h('div', { class: 'inputs' }, aliasInput, regionInput),\n );\n return { target: t, el, check, aliasInput, regionInput };\n });\n\n filter.addEventListener('input', () => {\n const q = filter.value.trim().toLowerCase();\n for (const row of rows) row.el.hidden = q !== '' && !row.target.label.toLowerCase().includes(q);\n });\n\n const save = h('button', { class: 'primary' }, 'Create aliases');\n save.addEventListener('click', () =>\n busy(save, async () => {\n const aliases = rows\n .filter((r) => r.check.checked)\n .map((r) => ({\n source: source.id,\n target: r.target.id,\n name: r.aliasInput.value.trim(),\n region: r.regionInput.value.trim(),\n }));\n if (aliases.length === 0) return toast('Pick at least one account/role.', { error: true });\n try {\n const result = await api('POST', '/api/aliases', { aliases });\n $dialog.close();\n toast(`Created ${result.created.join(', ')}. Try: hop ${result.created[0]}`);\n await refresh();\n } catch (error) {\n fail(error);\n }\n }),\n );\n\n const body =\n targets.length === 0\n ? h('p', { class: 'empty' }, 'This source has no accounts or roles assigned to you.')\n : h(\n 'div',\n {},\n filter,\n h(\n 'div',\n { class: 'targets' },\n rows.map((r) => r.el),\n ),\n );\n showDialog(`Aliases for ${source.id}`, body, [\n h('span', { class: 'note' }, 'Check an account/role, then name its alias and region.'),\n h('button', { onclick: () => $dialog.close() }, 'Cancel'),\n targets.length ? save : null,\n ]);\n}\n\n$addSource.addEventListener('click', () => openAddSource());\n\nif (!token) {\n $main.replaceChildren(\n h(\n 'div',\n { class: 'hero' },\n h('h2', {}, 'Open the link from your terminal'),\n h('p', {}, 'Run cloudhop ui and open the link it prints. It includes a one-time access key.'),\n ),\n );\n} else {\n refresh();\n}\n";
11621
11621
 
11622
11622
  // ../ui/src/assets/index.html
11623
- var assets_default = `<!doctype html>
11624
- <html lang="en">
11625
- <head>
11626
- <meta charset="utf-8" />
11627
- <meta name="viewport" content="width=device-width, initial-scale=1" />
11628
- <title>cloudhop</title>
11629
- <link
11630
- rel="icon"
11631
- href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='%230ea5b7'/%3E%3Cpath d='M9 19c2-6 12-6 14 0' stroke='white' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"
11632
- />
11633
- <style>
11634
- :root {
11635
- --bg: #f6f7f9;
11636
- --surface: #ffffff;
11637
- --surface-2: #f1f3f6;
11638
- --border: #e2e6eb;
11639
- --text: #18202b;
11640
- --muted: #5d6877;
11641
- --accent: #0b8fa0;
11642
- --accent-strong: #08707e;
11643
- --accent-soft: #e0f4f6;
11644
- --ok: #1f8a4c;
11645
- --warn: #a86400;
11646
- --bad: #c23934;
11647
- --radius: 10px;
11648
- --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
11649
- color-scheme: light;
11650
- }
11651
- @media (prefers-color-scheme: dark) {
11652
- :root {
11653
- --bg: #0f141a;
11654
- --surface: #161d25;
11655
- --surface-2: #1d2630;
11656
- --border: #2a3542;
11657
- --text: #e6ebf1;
11658
- --muted: #93a1b1;
11659
- --accent: #35c2d3;
11660
- --accent-strong: #5fd3e1;
11661
- --accent-soft: #123a41;
11662
- --ok: #4cc27f;
11663
- --warn: #e0a341;
11664
- --bad: #f06b66;
11665
- --shadow: none;
11666
- color-scheme: dark;
11667
- }
11668
- }
11669
- * { box-sizing: border-box; }
11670
- /* biome-ignore lint/complexity/noImportantStyles: the hidden attribute must beat component display rules */
11671
- [hidden] { display: none !important; }
11672
- body {
11673
- margin: 0;
11674
- background: var(--bg);
11675
- color: var(--text);
11676
- font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
11677
- }
11678
- code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
11679
- header {
11680
- background: var(--surface);
11681
- border-bottom: 1px solid var(--border);
11682
- }
11683
- .bar {
11684
- max-width: 1040px;
11685
- margin: 0 auto;
11686
- padding: 14px 20px;
11687
- display: flex;
11688
- align-items: center;
11689
- gap: 16px;
11690
- }
11691
- .logo { font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
11692
- .logo span { color: var(--accent); }
11693
- .tagline { color: var(--muted); font-size: 14px; }
11694
- .spacer { flex: 1; }
11695
- main { max-width: 1040px; margin: 0 auto; padding: 24px 20px 64px; }
11696
- h2 { font-size: 15px; margin: 0; }
11697
- .card {
11698
- background: var(--surface);
11699
- border: 1px solid var(--border);
11700
- border-radius: var(--radius);
11701
- box-shadow: var(--shadow);
11702
- margin-bottom: 18px;
11703
- }
11704
- .card-head {
11705
- display: flex;
11706
- flex-wrap: wrap;
11707
- align-items: center;
11708
- gap: 10px 14px;
11709
- padding: 14px 16px;
11710
- border-bottom: 1px solid var(--border);
11711
- }
11712
- .card-head .meta { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
11713
- .card-body { padding: 4px 0; }
11714
- .actions { display: flex; gap: 8px; flex-wrap: wrap; }
11715
- button {
11716
- font: inherit;
11717
- font-size: 14px;
11718
- border-radius: 8px;
11719
- border: 1px solid var(--border);
11720
- background: var(--surface);
11721
- color: var(--text);
11722
- padding: 6px 12px;
11723
- cursor: pointer;
11724
- }
11725
- button:hover { background: var(--surface-2); }
11726
- button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
11727
- button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
11728
- button.primary:hover { background: var(--accent-strong); }
11729
- button.danger { color: var(--bad); }
11730
- button.link { border: none; background: none; color: var(--muted); padding: 4px 6px; }
11731
- button.link:hover { color: var(--bad); }
11732
- button:disabled { opacity: 0.55; cursor: progress; }
11733
- input, select {
11734
- font: inherit;
11735
- font-size: 14px;
11736
- color: var(--text);
11737
- background: var(--surface);
11738
- border: 1px solid var(--border);
11739
- border-radius: 8px;
11740
- padding: 6px 10px;
11741
- min-width: 0;
11742
- }
11743
- table { width: 100%; border-collapse: collapse; }
11744
- th {
11745
- text-align: left;
11746
- font-size: 12px;
11747
- text-transform: uppercase;
11748
- letter-spacing: 0.04em;
11749
- color: var(--muted);
11750
- font-weight: 600;
11751
- padding: 8px 16px;
11752
- }
11753
- td { padding: 8px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
11754
- td.alias { font-weight: 600; white-space: nowrap; }
11755
- .region { display: flex; gap: 6px; align-items: center; }
11756
- .region input { width: 140px; }
11757
- .badge {
11758
- display: inline-flex;
11759
- align-items: center;
11760
- gap: 6px;
11761
- font-size: 12px;
11762
- font-weight: 600;
11763
- padding: 2px 10px;
11764
- border-radius: 999px;
11765
- background: var(--surface-2);
11766
- color: var(--muted);
11767
- white-space: nowrap;
11768
- }
11769
- .badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
11770
- .badge.valid { color: var(--ok); }
11771
- .badge.refreshable { color: var(--warn); }
11772
- .badge.expired { color: var(--bad); }
11773
- .empty { padding: 14px 16px; color: var(--muted); }
11774
- .missing { color: var(--bad); }
11775
- .hero {
11776
- text-align: center;
11777
- padding: 48px 20px;
11778
- }
11779
- .hero p { color: var(--muted); max-width: 560px; margin: 8px auto 20px; }
11780
- dialog {
11781
- border: 1px solid var(--border);
11782
- border-radius: 14px;
11783
- padding: 0;
11784
- width: min(720px, calc(100vw - 32px));
11785
- max-height: calc(100vh - 48px);
11786
- background: var(--surface);
11787
- color: var(--text);
11788
- box-shadow: 0 20px 60px rgb(0 0 0 / 30%);
11789
- }
11790
- dialog::backdrop { background: rgb(10 15 20 / 45%); }
11791
- .dlg-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
11792
- .dlg-head h2 { font-size: 17px; flex: 1; }
11793
- .dlg-body { padding: 18px 20px; overflow: auto; max-height: calc(100vh - 200px); overflow-wrap: anywhere; }
11794
- .dlg-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
11795
- .dlg-foot .note { flex: 1; color: var(--muted); font-size: 13px; }
11796
- .field { display: grid; gap: 4px; margin-bottom: 14px; }
11797
- .field label { font-weight: 600; font-size: 14px; }
11798
- .field .help { color: var(--muted); font-size: 13px; }
11799
- .choices { display: grid; gap: 8px; margin-bottom: 16px; }
11800
- .choice {
11801
- display: flex;
11802
- gap: 10px;
11803
- align-items: flex-start;
11804
- border: 1px solid var(--border);
11805
- border-radius: 10px;
11806
- padding: 10px 12px;
11807
- cursor: pointer;
11808
- }
11809
- .choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
11810
- .choice small { display: block; color: var(--muted); }
11811
- .targets { display: grid; gap: 6px; }
11812
- .target {
11813
- display: grid;
11814
- grid-template-columns: auto 1fr;
11815
- gap: 6px 10px;
11816
- align-items: center;
11817
- border: 1px solid var(--border);
11818
- border-radius: 10px;
11819
- padding: 8px 12px;
11820
- }
11821
- .target:has(input[type="checkbox"]:checked) { border-color: var(--accent); }
11822
- .target .pick { display: contents; cursor: pointer; }
11823
- .target .already { display: block; color: var(--muted); font-size: 13px; }
11824
- .target .inputs { grid-column: 2; display: none; gap: 8px; flex-wrap: wrap; }
11825
- .target:has(input[type="checkbox"]:checked) .inputs { display: flex; }
11826
- .target .inputs input { flex: 1 1 160px; }
11827
- .waiting { text-align: center; padding: 28px 8px; }
11828
- .spinner {
11829
- width: 28px; height: 28px; margin: 0 auto 14px;
11830
- border: 3px solid var(--border); border-top-color: var(--accent);
11831
- border-radius: 50%; animation: spin 0.9s linear infinite;
11832
- }
11833
- @keyframes spin { to { transform: rotate(360deg); } }
11834
- #toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 10; }
11835
- .toast {
11836
- background: var(--text);
11837
- color: var(--bg);
11838
- padding: 10px 14px;
11839
- border-radius: 10px;
11840
- max-width: 420px;
11841
- box-shadow: 0 6px 20px rgb(0 0 0 / 25%);
11842
- font-size: 14px;
11843
- }
11844
- .toast.error { background: var(--bad); color: #fff; }
11845
- .toast small { display: block; opacity: 0.85; }
11846
- .notice {
11847
- border: 1px solid var(--border);
11848
- border-left: 4px solid var(--warn);
11849
- background: var(--surface);
11850
- border-radius: var(--radius);
11851
- padding: 10px 14px;
11852
- margin-bottom: 18px;
11853
- }
11854
- .notice.error { border-left-color: var(--bad); }
11855
- @media (max-width: 640px) {
11856
- .tagline { display: none; }
11857
- th:nth-child(3), td:nth-child(3) { display: none; }
11858
- td, th { padding: 8px 10px; }
11859
- td.alias { white-space: normal; overflow-wrap: anywhere; }
11860
- .region input { width: 96px; }
11861
- }
11862
- </style>
11863
- </head>
11864
- <body>
11865
- <header>
11866
- <div class="bar">
11867
- <div class="logo">cloud<span>hop</span></div>
11868
- <div class="tagline">Hop between cloud accounts, roles and regions</div>
11869
- <div class="spacer"></div>
11870
- <button type="button" class="primary" id="add-source" hidden>+ Add source</button>
11871
- </div>
11872
- </header>
11873
- <main id="main" aria-live="polite">
11874
- <div class="waiting"><div class="spinner"></div>Loading\u2026</div>
11875
- </main>
11876
- <dialog id="dialog"></dialog>
11877
- <div id="toasts" role="status"></div>
11878
- <script type="module" src="/app.js"></script>
11879
- </body>
11880
- </html>
11881
- `;
11623
+ var assets_default = '<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <title>cloudhop</title>\n <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 64 64%22 role=%22img%22 aria-label=%22cloudhop%22%3E%3Cdefs%3E%3ClinearGradient id=%22ch-bg%22 x1=%220%22 y1=%220%22 x2=%221%22 y2=%221%22%3E%3Cstop offset=%220%22 stop-color=%22%2319c3d1%22/%3E%3Cstop offset=%221%22 stop-color=%22%230a6a82%22/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width=%2264%22 height=%2264%22 rx=%2215%22 fill=%22url(%23ch-bg)%22/%3E%3Cpath d=%22M8.5 47.5a5.5 5.5 0 0 1 5-5.5 6.8 6.8 0 0 1 13 1.6 4.4 4.4 0 0 1-.9 8.7H13.4a4.9 4.9 0 0 1-4.9-4.8z%22 fill=%22%23fff%22 fill-opacity=%22.55%22/%3E%3Cpath d=%22M31 44.6a7.6 7.6 0 0 1 7-7.6 9.6 9.6 0 0 1 18.2 2.6 6.3 6.3 0 0 1-1.3 12.5H38.3A7.4 7.4 0 0 1 31 44.6z%22 fill=%22%23fff%22/%3E%3Cpath d=%22M18 37.5C19 21 33 13.5 40.6 23%22 fill=%22none%22 stroke=%22%23fff%22 stroke-width=%223.6%22 stroke-linecap=%22round%22 stroke-dasharray=%220.01 6.3%22/%3E%3Cpath d=%22M46 30.2l-7.4-2.1 5.4-4.3z%22 fill=%22%23fff%22 stroke=%22%23fff%22 stroke-width=%222.4%22 stroke-linejoin=%22round%22/%3E%3C/svg%3E" />\n <style>\n :root {\n --bg: #f6f7f9;\n --surface: #ffffff;\n --surface-2: #f1f3f6;\n --border: #e2e6eb;\n --text: #18202b;\n --muted: #5d6877;\n --accent: #0b8fa0;\n --accent-strong: #08707e;\n --accent-soft: #e0f4f6;\n --ok: #1f8a4c;\n --warn: #a86400;\n --bad: #c23934;\n --radius: 10px;\n --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);\n color-scheme: light;\n }\n @media (prefers-color-scheme: dark) {\n :root {\n --bg: #0f141a;\n --surface: #161d25;\n --surface-2: #1d2630;\n --border: #2a3542;\n --text: #e6ebf1;\n --muted: #93a1b1;\n --accent: #35c2d3;\n --accent-strong: #5fd3e1;\n --accent-soft: #123a41;\n --ok: #4cc27f;\n --warn: #e0a341;\n --bad: #f06b66;\n --shadow: none;\n color-scheme: dark;\n }\n }\n * { box-sizing: border-box; }\n /* biome-ignore lint/complexity/noImportantStyles: the hidden attribute must beat component display rules */\n [hidden] { display: none !important; }\n body {\n margin: 0;\n background: var(--bg);\n color: var(--text);\n font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;\n }\n code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }\n header {\n background: var(--surface);\n border-bottom: 1px solid var(--border);\n }\n .bar {\n max-width: 1040px;\n margin: 0 auto;\n padding: 14px 20px;\n display: flex;\n align-items: center;\n gap: 16px;\n }\n .logo { font-weight: 700; font-size: 20px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }\n .logo span span { color: var(--accent); }\n .tagline { color: var(--muted); font-size: 14px; }\n .spacer { flex: 1; }\n main { max-width: 1040px; margin: 0 auto; padding: 24px 20px 64px; }\n h2 { font-size: 15px; margin: 0; }\n .card {\n background: var(--surface);\n border: 1px solid var(--border);\n border-radius: var(--radius);\n box-shadow: var(--shadow);\n margin-bottom: 18px;\n }\n .card-head {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 10px 14px;\n padding: 14px 16px;\n border-bottom: 1px solid var(--border);\n }\n .card-head .meta { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }\n .card-body { padding: 4px 0; }\n .actions { display: flex; gap: 8px; flex-wrap: wrap; }\n button {\n font: inherit;\n font-size: 14px;\n border-radius: 8px;\n border: 1px solid var(--border);\n background: var(--surface);\n color: var(--text);\n padding: 6px 12px;\n cursor: pointer;\n }\n button:hover { background: var(--surface-2); }\n button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }\n button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }\n button.primary:hover { background: var(--accent-strong); }\n button.danger { color: var(--bad); }\n button.link { border: none; background: none; color: var(--muted); padding: 4px 6px; }\n button.link:hover { color: var(--bad); }\n button:disabled { opacity: 0.55; cursor: progress; }\n input, select {\n font: inherit;\n font-size: 14px;\n color: var(--text);\n background: var(--surface);\n border: 1px solid var(--border);\n border-radius: 8px;\n padding: 6px 10px;\n min-width: 0;\n }\n table { width: 100%; border-collapse: collapse; }\n th {\n text-align: left;\n font-size: 12px;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n color: var(--muted);\n font-weight: 600;\n padding: 8px 16px;\n }\n td { padding: 8px 16px; border-top: 1px solid var(--border); vertical-align: middle; }\n td.alias { font-weight: 600; white-space: nowrap; }\n .region { display: flex; gap: 6px; align-items: center; }\n .region input { width: 140px; }\n .badge {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n font-weight: 600;\n padding: 2px 10px;\n border-radius: 999px;\n background: var(--surface-2);\n color: var(--muted);\n white-space: nowrap;\n }\n .badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }\n .badge.valid { color: var(--ok); }\n .badge.refreshable { color: var(--warn); }\n .badge.expired { color: var(--bad); }\n .empty { padding: 14px 16px; color: var(--muted); }\n .missing { color: var(--bad); }\n .hero {\n text-align: center;\n padding: 48px 20px;\n }\n .hero p { color: var(--muted); max-width: 560px; margin: 8px auto 20px; }\n dialog {\n border: 1px solid var(--border);\n border-radius: 14px;\n padding: 0;\n width: min(720px, calc(100vw - 32px));\n max-height: calc(100vh - 48px);\n background: var(--surface);\n color: var(--text);\n box-shadow: 0 20px 60px rgb(0 0 0 / 30%);\n }\n dialog::backdrop { background: rgb(10 15 20 / 45%); }\n .dlg-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }\n .dlg-head h2 { font-size: 17px; flex: 1; }\n .dlg-body { padding: 18px 20px; overflow: auto; max-height: calc(100vh - 200px); overflow-wrap: anywhere; }\n .dlg-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; align-items: center; }\n .dlg-foot .note { flex: 1; color: var(--muted); font-size: 13px; }\n .field { display: grid; gap: 4px; margin-bottom: 14px; }\n .field label { font-weight: 600; font-size: 14px; }\n .field .help { color: var(--muted); font-size: 13px; }\n .choices { display: grid; gap: 8px; margin-bottom: 16px; }\n .choice {\n display: flex;\n gap: 10px;\n align-items: flex-start;\n border: 1px solid var(--border);\n border-radius: 10px;\n padding: 10px 12px;\n cursor: pointer;\n }\n .choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }\n .choice small { display: block; color: var(--muted); }\n .targets { display: grid; gap: 6px; }\n .target {\n display: grid;\n grid-template-columns: auto 1fr;\n gap: 6px 10px;\n align-items: center;\n border: 1px solid var(--border);\n border-radius: 10px;\n padding: 8px 12px;\n }\n .target:has(input[type="checkbox"]:checked) { border-color: var(--accent); }\n .target .pick { display: contents; cursor: pointer; }\n .target .already { display: block; color: var(--muted); font-size: 13px; }\n .target .inputs { grid-column: 2; display: none; gap: 8px; flex-wrap: wrap; }\n .target:has(input[type="checkbox"]:checked) .inputs { display: flex; }\n .target .inputs input { flex: 1 1 160px; }\n .waiting { text-align: center; padding: 28px 8px; }\n .spinner {\n width: 28px; height: 28px; margin: 0 auto 14px;\n border: 3px solid var(--border); border-top-color: var(--accent);\n border-radius: 50%; animation: spin 0.9s linear infinite;\n }\n @keyframes spin { to { transform: rotate(360deg); } }\n #toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 10; }\n .toast {\n background: var(--text);\n color: var(--bg);\n padding: 10px 14px;\n border-radius: 10px;\n max-width: 420px;\n box-shadow: 0 6px 20px rgb(0 0 0 / 25%);\n font-size: 14px;\n }\n .toast.error { background: var(--bad); color: #fff; }\n .toast small { display: block; opacity: 0.85; }\n .notice {\n border: 1px solid var(--border);\n border-left: 4px solid var(--warn);\n background: var(--surface);\n border-radius: var(--radius);\n padding: 10px 14px;\n margin-bottom: 18px;\n }\n .notice.error { border-left-color: var(--bad); }\n @media (max-width: 640px) {\n .tagline { display: none; }\n th:nth-child(3), td:nth-child(3) { display: none; }\n td, th { padding: 8px 10px; }\n td.alias { white-space: normal; overflow-wrap: anywhere; }\n .region input { width: 96px; }\n }\n </style>\n </head>\n <body>\n <header>\n <div class="bar">\n <div class="logo"><img src="data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 64 64%22 role=%22img%22 aria-label=%22cloudhop%22%3E%3Cdefs%3E%3ClinearGradient id=%22ch-bg%22 x1=%220%22 y1=%220%22 x2=%221%22 y2=%221%22%3E%3Cstop offset=%220%22 stop-color=%22%2319c3d1%22/%3E%3Cstop offset=%221%22 stop-color=%22%230a6a82%22/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width=%2264%22 height=%2264%22 rx=%2215%22 fill=%22url(%23ch-bg)%22/%3E%3Cpath d=%22M8.5 47.5a5.5 5.5 0 0 1 5-5.5 6.8 6.8 0 0 1 13 1.6 4.4 4.4 0 0 1-.9 8.7H13.4a4.9 4.9 0 0 1-4.9-4.8z%22 fill=%22%23fff%22 fill-opacity=%22.55%22/%3E%3Cpath d=%22M31 44.6a7.6 7.6 0 0 1 7-7.6 9.6 9.6 0 0 1 18.2 2.6 6.3 6.3 0 0 1-1.3 12.5H38.3A7.4 7.4 0 0 1 31 44.6z%22 fill=%22%23fff%22/%3E%3Cpath d=%22M18 37.5C19 21 33 13.5 40.6 23%22 fill=%22none%22 stroke=%22%23fff%22 stroke-width=%223.6%22 stroke-linecap=%22round%22 stroke-dasharray=%220.01 6.3%22/%3E%3Cpath d=%22M46 30.2l-7.4-2.1 5.4-4.3z%22 fill=%22%23fff%22 stroke=%22%23fff%22 stroke-width=%222.4%22 stroke-linejoin=%22round%22/%3E%3C/svg%3E" alt="" width="28" height="28" /><span>cloud<span>hop</span></span></div>\n <div class="tagline">Hop between cloud accounts, roles and regions</div>\n <div class="spacer"></div>\n <button type="button" class="primary" id="add-source" hidden>+ Add source</button>\n </div>\n </header>\n <main id="main" aria-live="polite">\n <div class="waiting"><div class="spinner"></div>Loading\u2026</div>\n </main>\n <dialog id="dialog"></dialog>\n <div id="toasts" role="status"></div>\n <script type="module" src="/app.js"></script>\n </body>\n</html>\n';
11882
11624
 
11883
11625
  // ../ui/src/server.ts
11884
11626
  var MAX_BODY = 64 * 1024;
@@ -12623,7 +12365,7 @@ function createApp(env = process.env) {
12623
12365
  }
12624
12366
 
12625
12367
  // src/cli.ts
12626
- var HELP = `cloudhop ${"0.1.0"}
12368
+ var HELP = `cloudhop ${"0.1.1"}
12627
12369
  Hop between cloud accounts, roles and regions with one command.
12628
12370
 
12629
12371
  Usage
@@ -12653,7 +12395,7 @@ Options
12653
12395
  --device-code Log in with a code instead of the browser redirect
12654
12396
  -v, --version Show the version
12655
12397
 
12656
- Docs: https://github.com/dayepesb/cloudhop`;
12398
+ Docs: https://dayepesb.github.io/cloudhop/`;
12657
12399
  function takeGlobalFlags(argv) {
12658
12400
  const rest = [];
12659
12401
  for (const arg of argv) {
@@ -12669,7 +12411,7 @@ async function main(argv) {
12669
12411
  return 0;
12670
12412
  }
12671
12413
  if (command === "--version" || command === "-v" || command === "version") {
12672
- console.log("0.1.0");
12414
+ console.log("0.1.1");
12673
12415
  return 0;
12674
12416
  }
12675
12417
  const app = createApp();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudhop",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Hop between cloud accounts, roles and regions with one command. Automatic login, no copied credentials.",
5
5
  "keywords": [
6
6
  "cli",
@@ -13,7 +13,7 @@
13
13
  "credentials",
14
14
  "cloud"
15
15
  ],
16
- "license": "MIT",
16
+ "license": "Apache-2.0",
17
17
  "author": "dayepesb",
18
18
  "homepage": "https://github.com/dayepesb/cloudhop#readme",
19
19
  "repository": {
@@ -30,17 +30,18 @@
30
30
  "hop": "dist/cli.js"
31
31
  },
32
32
  "files": [
33
- "dist"
33
+ "dist",
34
+ "NOTICE"
34
35
  ],
35
36
  "engines": {
36
37
  "node": ">=20"
37
38
  },
38
39
  "devDependencies": {
39
40
  "@clack/prompts": "^1.8.1",
40
- "@cloudhop/core": "0.0.0",
41
41
  "@cloudhop/adapters-node": "0.0.0",
42
+ "@cloudhop/provider-aws": "0.0.0",
42
43
  "@cloudhop/ui": "0.0.0",
43
- "@cloudhop/provider-aws": "0.0.0"
44
+ "@cloudhop/core": "0.0.0"
44
45
  },
45
46
  "scripts": {
46
47
  "build": "tsup",