@cloudhal/cli 0.6.2 → 0.6.4
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/dist/assets/starters/blog/package.json +7 -7
- package/dist/assets/starters/blog/src/pages/[...path]/llms.txt.ts +2 -1
- package/dist/assets/starters/blog/src/pages/[...path]/rss.xml.ts +2 -1
- package/dist/assets/starters/blog/src/pages/[...path].astro +3 -1
- package/dist/assets/starters/blog/src/pages/llms.txt.ts +2 -1
- package/dist/assets/starters/blog/src/pages/rss.xml.ts +2 -1
- package/dist/assets/starters/blog/src/pages/sitemap.xml.ts +2 -1
- package/dist/assets/starters/blog/src/styles/features/chrome-menus.css +1 -1
- package/dist/assets/starters/blog/src/styles/features/motion.css +2 -2
- package/dist/assets/starters/blog/src/styles/features/surfaces.css +8 -7
- package/dist/assets/studio/assets/{AccountPage-NTvVQ9j4.js → AccountPage-H-WA4dGT.js} +2 -2
- package/dist/assets/studio/assets/{ActivityPage-DQSyrOOA.js → ActivityPage-Srypf6N4.js} +2 -2
- package/dist/assets/studio/assets/{AgentModes-KSlPlZBo.js → AgentModes-BpVQlSk6.js} +2 -2
- package/dist/assets/studio/assets/{AgentsPage-5NPtJdv3.js → AgentsPage-qv2YlGAV.js} +2 -2
- package/dist/assets/studio/assets/{AnalyticsPage-CeeJ1CyW.js → AnalyticsPage-CLtrDh7Z.js} +2 -2
- package/dist/assets/studio/assets/{ApprovalsPage-BAb_T-Yg.js → ApprovalsPage-CUR9ed9S.js} +3 -3
- package/dist/assets/studio/assets/{ArticleEditorPage-Ggx_BDgH.js → ArticleEditorPage-BDeeSrWu.js} +3 -3
- package/dist/assets/studio/assets/{ArticlesPage-B7pYvOqZ.js → ArticlesPage-CbVEh_35.js} +3 -3
- package/dist/assets/studio/assets/{AssetPage-CoLQ7g6-.js → AssetPage-DlChJGnk.js} +2 -2
- package/dist/assets/studio/assets/{Audit-DzVhy7HF.js → Audit-Cu1AA_BU.js} +2 -2
- package/dist/assets/studio/assets/{AuditBadges-fg0FKAHS.js → AuditBadges-CAG3kk0E.js} +2 -2
- package/dist/assets/studio/assets/{AutomationsPage-ClhZd5Ds.js → AutomationsPage-B3FtFLH9.js} +2 -2
- package/dist/assets/studio/assets/{BlockSection-Cy4Qt5cS.js → BlockSection-Di7jTvtZ.js} +2 -2
- package/dist/assets/studio/assets/{BodyChanges-BV19ywfj.js → BodyChanges-D0KudPII.js} +2 -2
- package/dist/assets/studio/assets/{BodyEditor-nuTuUMKM.js → BodyEditor-CA9Mrbxr.js} +3 -3
- package/dist/assets/studio/assets/{BuildPage-CP6uMSA_.js → BuildPage-BRqgk24y.js} +2 -2
- package/dist/assets/studio/assets/{CodeHighlighted-uUDbvdKY.js → CodeHighlighted-DOw6b1bt.js} +2 -2
- package/dist/assets/studio/assets/{CollectionSettingsPage-B5s4v1Iz.js → CollectionSettingsPage-CYrVbSYX.js} +3 -3
- package/dist/assets/studio/assets/{CollectionsPage-BzY00I6q.js → CollectionsPage-CS1VN18t.js} +2 -2
- package/dist/assets/studio/assets/{CommandMenu-CO5U3JH5.js → CommandMenu-C8yL2U9-.js} +2 -2
- package/dist/assets/studio/assets/{CommentThreadControls-Cmh1R66Y.js → CommentThreadControls-C0BWavL5.js} +2 -2
- package/dist/assets/studio/assets/{CommentThreadPage-UiAi6-KV.js → CommentThreadPage-cYaOeczW.js} +2 -2
- package/dist/assets/studio/assets/{CommenterPage-5j673AfC.js → CommenterPage-C523SRcJ.js} +2 -2
- package/dist/assets/studio/assets/{Comments-DvqfPRIm.js → Comments-CvWYWy69.js} +2 -2
- package/dist/assets/studio/assets/{CommentsPage-Dq6ZPgBd.js → CommentsPage-CRiP84dZ.js} +2 -2
- package/dist/assets/studio/assets/{ConfirmDialog-OVRiEm85.js → ConfirmDialog-CsHmHVMF.js} +2 -2
- package/dist/assets/studio/assets/{ContentListQuery-BuxxdIsz.js → ContentListQuery-BSHtfRw_.js} +2 -2
- package/dist/assets/studio/assets/{Crumbs-DcQ6-fG2.js → Crumbs-BtXRFlc6.js} +2 -2
- package/dist/assets/studio/assets/{DateTimeField-COCBK21M.js → DateTimeField-CFudnuoh.js} +2 -2
- package/dist/assets/studio/assets/{EditorLayout-Dp_3DB2G.js → EditorLayout-DxQ1u__q.js} +2 -2
- package/dist/assets/studio/assets/{EditorPreview-CkyWXFtR.js → EditorPreview-Bo99QOzI.js} +2 -2
- package/dist/assets/studio/assets/{Elevation-DkpPCdiH.js → Elevation-CiKay2aG.js} +2 -2
- package/dist/assets/studio/assets/{ElevationRequest-CmgLclFL.js → ElevationRequest-BDSQJrIU.js} +2 -2
- package/dist/assets/studio/assets/{EndedBadge-BDwG33LH.js → EndedBadge-B6Zr5zNC.js} +2 -2
- package/dist/assets/studio/assets/{EntryFieldsCard-D5y1dpXL.js → EntryFieldsCard-vnCp1-sA.js} +2 -2
- package/dist/assets/studio/assets/{EntryPath-DBK2nqWS.js → EntryPath-C7FxCw7K.js} +2 -2
- package/dist/assets/studio/assets/{FieldsSection-B_CkinDZ.js → FieldsSection-DtZdExyR.js} +2 -2
- package/dist/assets/studio/assets/{ForgotPasswordPage-WCD-LFli.js → ForgotPasswordPage-Dn07bnoC.js} +2 -2
- package/dist/assets/studio/assets/{Gating-Dh2NroLN.js → Gating-Dgf85WmM.js} +2 -2
- package/dist/assets/studio/assets/{GovernanceDialog-ZGDW8GHB.js → GovernanceDialog-BY_KYC1q.js} +2 -2
- package/dist/assets/studio/assets/{InvitePage-nDt4YwRU.js → InvitePage-DrPRmzk5.js} +2 -2
- package/dist/assets/studio/assets/{ListFieldColumns-JgalLO4N.js → ListFieldColumns-BTLtwnNa.js} +2 -2
- package/dist/assets/studio/assets/{ListToolbar-BJEEg5eE.js → ListToolbar-B2reIfhH.js} +2 -2
- package/dist/assets/studio/assets/{ListingSections-oP_0yN1S.js → ListingSections-jx5ry8y3.js} +2 -2
- package/dist/assets/studio/assets/LoginPage-LRB8Hz6E.js +2 -0
- package/dist/assets/studio/assets/{MediaPage-YcmyGDWC.js → MediaPage-DxC-O72m.js} +2 -2
- package/dist/assets/studio/assets/{MediaPicker-D0dErr8k.js → MediaPicker-DyTkkW4K.js} +2 -2
- package/dist/assets/studio/assets/{MediaUpload-Dz_c75sO.js → MediaUpload-Cd9LNKs1.js} +2 -2
- package/dist/assets/studio/assets/{MembersPage-loaFEpdr.js → MembersPage-BJTx93gb.js} +2 -2
- package/dist/assets/studio/assets/{Menus-BLkbHiMI.js → Menus-W8XZpgqq.js} +2 -2
- package/dist/assets/studio/assets/{NavigationPage-Da7rjZRB.js → NavigationPage-4VQ3989y.js} +2 -2
- package/dist/assets/studio/assets/{NewSiteDialog-BHHd21ht.js → NewSiteDialog-BgdpEYuC.js} +2 -2
- package/dist/assets/studio/assets/{NotificationItems-CZg5_NHZ.js → NotificationItems-x_CrRI18.js} +2 -2
- package/dist/assets/studio/assets/{PageEditorPage-Dj-U2pjK.js → PageEditorPage-NTyB8eKT.js} +3 -3
- package/dist/assets/studio/assets/{PagesPage-nsroU5tN.js → PagesPage-Dra8wqhZ.js} +2 -2
- package/dist/assets/studio/assets/{PasswordField-1kzPgqLo.js → PasswordField-BwLcXkWe.js} +2 -2
- package/dist/assets/studio/assets/{PreviewPanel-Cji7Fp5q.js → PreviewPanel-C3ouq_VT.js} +2 -2
- package/dist/assets/studio/assets/{ProjectPage-BQxm4g99.js → ProjectPage-BZwBNht9.js} +2 -2
- package/dist/assets/studio/assets/{Readers-CcVVgmpi.js → Readers-Crbc6-d2.js} +3 -3
- package/dist/assets/studio/assets/{RedirectDialog-B5yl4oD-.js → RedirectDialog-CVeubZoX.js} +2 -2
- package/dist/assets/studio/assets/{RedirectsPage-B1pa4mQJ.js → RedirectsPage-CszTpqLO.js} +2 -2
- package/dist/assets/studio/assets/{RelativeTime-C_SQCdsk.js → RelativeTime-Cz0kO5a6.js} +2 -2
- package/dist/assets/studio/assets/{ReleaseApproval-DT1ecFLG.js → ReleaseApproval-Cnv1iobY.js} +2 -2
- package/dist/assets/studio/assets/{ReleasePage-DVSL_YM-.js → ReleasePage-D2VfXa8K.js} +2 -2
- package/dist/assets/studio/assets/{ReleaseParts-D8k7e2qx.js → ReleaseParts-D351Bl88.js} +2 -2
- package/dist/assets/studio/assets/{ResetPasswordPage-p1BeXN56.js → ResetPasswordPage-CHf_0zZv.js} +2 -2
- package/dist/assets/studio/assets/{RowMenu-D0g1yTqW.js → RowMenu-BlS9vXie.js} +2 -2
- package/dist/assets/studio/assets/{ScheduleCard-DsR36_fP.js → ScheduleCard-C87eLMht.js} +2 -2
- package/dist/assets/studio/assets/{ScheduleDialog-C_bduc0o.js → ScheduleDialog-BwBYA6pc.js} +2 -2
- package/dist/assets/studio/assets/{ScheduleHistoryPage-BzmQSThY.js → ScheduleHistoryPage-CL25zeNn.js} +2 -2
- package/dist/assets/studio/assets/{ScheduleStatusBadge-t8qrRkdh.js → ScheduleStatusBadge-ChmmnC94.js} +2 -2
- package/dist/assets/studio/assets/{SchedulerStalled-mEbvw7Q_.js → SchedulerStalled-D-r-bG15.js} +2 -2
- package/dist/assets/studio/assets/{Schedules-6cMSrwUb.js → Schedules-BcAUO3yt.js} +2 -2
- package/dist/assets/studio/assets/{SchedulesPage-LN1rNJ_S.js → SchedulesPage-CSUkrDNZ.js} +2 -2
- package/dist/assets/studio/assets/{ScopeBadge-J87LKFHA.js → ScopeBadge-DhZzXufT.js} +2 -2
- package/dist/assets/studio/assets/{Seo-DffNYWOM.js → Seo-CNeksZ_k.js} +2 -2
- package/dist/assets/studio/assets/{SeoPreview-VTTiQ0Ig.js → SeoPreview-lOFM26fE.js} +2 -2
- package/dist/assets/studio/assets/{Settings-Bgn96K2D.js → Settings-C-MzOZKZ.js} +2 -2
- package/dist/assets/studio/assets/{SiteAccessField-DQaQg5ez.js → SiteAccessField-B6QH60a2.js} +2 -2
- package/dist/assets/studio/assets/{SiteOverviewPage-Dz8vVdMJ.js → SiteOverviewPage-CsBoUK1t.js} +3 -3
- package/dist/assets/studio/assets/{SiteSettingsPage-vve5XcFj.js → SiteSettingsPage--dJ4ixUw.js} +3 -3
- package/dist/assets/studio/assets/{SitesPage-CYccS5X4.js → SitesPage-vSr-9mb5.js} +3 -3
- package/dist/assets/studio/assets/{SkillsPage-DIeleLju.js → SkillsPage-BVXLmxiw.js} +2 -2
- package/dist/assets/studio/assets/{SnapshotsPage-FUNSFjvW.js → SnapshotsPage-Yh4XX1pY.js} +2 -2
- package/dist/assets/studio/assets/{StatTile-CN_o8uLc.js → StatTile-3dmRmP7D.js} +2 -2
- package/dist/assets/studio/assets/{Status-W9nLsw86.js → Status-WIcIPfpv.js} +2 -2
- package/dist/assets/studio/assets/{StatusActions-UX4cJWR0.js → StatusActions-bOOicoBx.js} +3 -3
- package/dist/assets/studio/assets/{TableSkeleton-BDGXoCWS.js → TableSkeleton-DJFmIeGf.js} +2 -2
- package/dist/assets/studio/assets/{TagsMigration-CDN47duJ.js → TagsMigration-BkgKXkPv.js} +2 -2
- package/dist/assets/studio/assets/{Taxonomy-CZjclj3o.js → Taxonomy-ClnBvp37.js} +2 -2
- package/dist/assets/studio/assets/{TaxonomyPage-DsTl6LUJ.js → TaxonomyPage-BQ9-YC7N.js} +2 -2
- package/dist/assets/studio/assets/{TaxonomySettingsDialog-BdXSJnYn.js → TaxonomySettingsDialog-wbik9O2h.js} +2 -2
- package/dist/assets/studio/assets/{TermEditorPage-CpY3StQ8.js → TermEditorPage-TlMOvCCe.js} +2 -2
- package/dist/assets/studio/assets/{TermPickers-De-2BW8j.js → TermPickers-Blo4P5i0.js} +2 -2
- package/dist/assets/studio/assets/{TranslationList-0QP6cnHn.js → TranslationList-DBk1eLpg.js} +2 -2
- package/dist/assets/studio/assets/{TranslationsPage-vhO1MEXc.js → TranslationsPage-QM9l7PZ7.js} +2 -2
- package/dist/assets/studio/assets/{api-errors-tZYwLeo6.js → api-errors-CrlMh7Uh.js} +2 -2
- package/dist/assets/studio/assets/{ar-BUKtNVP6.js → ar-kwcrV10j.js} +2 -2
- package/dist/assets/studio/assets/auth-BzR8abXz.js +4 -0
- package/dist/assets/studio/assets/{charts-C_1bsD44.js → charts-CfsBpX7Q.js} +2 -2
- package/dist/assets/studio/assets/{collapsible-l8g94on4w7qfosmn-CcuxOZc3.js → collapsible-l8g94on4w7qfosmn-HrcveUz2.js} +2 -2
- package/dist/assets/studio/assets/{collection-icons-vQBNxoLg.js → collection-icons-9ine0lwT.js} +2 -2
- package/dist/assets/studio/assets/{combobox-hdxtsm2gqcxxgfju-DZri6Aur.js → combobox-hdxtsm2gqcxxgfju-KnLrjt1Y.js} +2 -2
- package/dist/assets/studio/assets/{de-DWHO_HkU.js → de-C-Bbcibt.js} +2 -2
- package/dist/assets/studio/assets/{deleteLabels-DFkO1iOx.js → deleteLabels-BfWGeH4k.js} +2 -2
- package/dist/assets/studio/assets/{editor-a2ZIJiuW.js → editor-CimRuo-s.js} +66 -61
- package/dist/assets/studio/assets/{es-C07OD_XS.js → es-DRXEyf0l.js} +2 -2
- package/dist/assets/studio/assets/{fa-Cgls-bgZ.js → fa-C1MtIlym.js} +2 -2
- package/dist/assets/studio/assets/{fr-QRT6iq33.js → fr-B396areL.js} +2 -2
- package/dist/assets/studio/assets/{he-CBKpkqQI.js → he-CZwil4jG.js} +2 -2
- package/dist/assets/studio/assets/{hi-eQ3OUtm4.js → hi-Crgk0N23.js} +2 -2
- package/dist/assets/studio/assets/{i18n-BsaF_Usk.js → i18n-Dab0ajqW.js} +3 -3
- package/dist/assets/studio/assets/{id-C93G1k_A.js → id-Z3wSQ21N.js} +2 -2
- package/dist/assets/studio/assets/{index-CZfdz1iP.js → index-E8BSdBPW.js} +3 -3
- package/dist/assets/studio/assets/{it-DYqXpRiP.js → it-D_e5w1W5.js} +2 -2
- package/dist/assets/studio/assets/{ja-D9n_rxyV.js → ja-XexIMFCE.js} +2 -2
- package/dist/assets/studio/assets/{ko-hS1dOTFu.js → ko-BphIzzGa.js} +2 -2
- package/dist/assets/studio/assets/{layer-dialog-j5ywmzs46ccg6oqy-DkKZqCVk.js → layer-dialog-j5ywmzs46ccg6oqy-_2cczT-K.js} +2 -2
- package/dist/assets/studio/assets/{nl-Dh6z5Vys.js → nl-D2pGOej6.js} +2 -2
- package/dist/assets/studio/assets/{pl-ClD48bGQ.js → pl-BdQ-KeLm.js} +2 -2
- package/dist/assets/studio/assets/{pt-BR-B1t2IuB6.js → pt-BR-lI2va4Ax.js} +2 -2
- package/dist/assets/studio/assets/{ru-1Ypf-SpC.js → ru-BuBa5alG.js} +2 -2
- package/dist/assets/studio/assets/{tag-input-ohfybx5dbxy3houy-tsg1b-Oa.js → tag-input-ohfybx5dbxy3houy-Bosoy5du.js} +2 -2
- package/dist/assets/studio/assets/{tr-CYoHJpqA.js → tr-2tUDztjs.js} +2 -2
- package/dist/assets/studio/assets/{uk-UznF4_3D.js → uk-D-x13N_h.js} +2 -2
- package/dist/assets/studio/assets/{useAnalyticsCard-DkpiYb5T.js → useAnalyticsCard-3ehEghuO.js} +2 -2
- package/dist/assets/studio/assets/{useCollectionView-DX7hhan1.js → useCollectionView-BvImCfGW.js} +3 -3
- package/dist/assets/studio/assets/{useLiveSite-BCjxnCp4.js → useLiveSite-BXT7Tep7.js} +2 -2
- package/dist/assets/studio/assets/{useMe-CxI04z9a.js → useMe-BQDOgqHt.js} +2 -2
- package/dist/assets/studio/assets/{usePaging-4q9qSaT2.js → usePaging-Mr18xaY2.js} +2 -2
- package/dist/assets/studio/assets/{zh-Hans-3w2oZuI1.js → zh-Hans-hT5IaMLb.js} +2 -2
- package/dist/assets/studio/index.html +6 -6
- package/dist/src/cli/commands-local.js +13 -1
- package/dist/src/cli/help.d.ts +1 -2
- package/dist/src/cli/help.js +46 -10
- package/dist/src/cli.d.ts +10 -0
- package/dist/src/cli.js +33 -2
- package/dist/src/commands/astro.d.ts +2 -1
- package/dist/src/commands/astro.js +3 -2
- package/dist/src/commands/init.d.ts +12 -0
- package/dist/src/commands/init.js +28 -9
- package/dist/src/commands/studio-auth.d.ts +52 -0
- package/dist/src/commands/studio-auth.js +130 -0
- package/dist/src/commands/studio-options.d.ts +78 -0
- package/dist/src/commands/studio-options.js +223 -0
- package/dist/src/commands/studio.d.ts +21 -7
- package/dist/src/commands/studio.js +98 -30
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +2 -1
- package/package.json +16 -16
- package/dist/assets/studio/assets/LoginPage-L984KqI8.js +0 -2
- package/dist/assets/studio/assets/auth-BsoY4NJQ.js +0 -4
package/dist/src/cli/help.js
CHANGED
|
@@ -1,15 +1,40 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `cloudhal --help`; every command it names has an entry in `COMMANDS` (cli.ts). The usage text is
|
|
3
|
+
* in four pieces, each a readable size: the project on this machine, Cloudflare, content and sites,
|
|
4
|
+
* operations. `HELP` prints them in that order.
|
|
5
|
+
*/
|
|
6
|
+
/** init, dev, snapshot, build, studio, mcp: the project on this machine. */
|
|
7
|
+
const PROJECT = ` cloudhal init <dir> [--name <name>] [--starter blog] create a site project with a seeded local store
|
|
8
|
+
cloudhal dev [--port <n>] [--host [<addr>]] live preview (drafts visible); --host alone is
|
|
9
|
+
0.0.0.0, every IPv4 address (:: for IPv6 too)
|
|
7
10
|
cloudhal snapshot [--label <text>] [--publish] freeze the current graph (optionally publish)
|
|
8
11
|
cloudhal build [--snapshot <id>] static HTML from the published/latest snapshot
|
|
9
|
-
cloudhal studio [--port <n>] [--
|
|
12
|
+
cloudhal studio [--port <n>] [--host [<addr>]] [--base-url <url>] [--behind-proxy] [--no-auth]
|
|
13
|
+
[--init-if-empty [--starter blog] [--name <name>]]
|
|
14
|
+
API + Studio UI for this project (default :8787);
|
|
15
|
+
while nobody has an account it prints a one-time
|
|
16
|
+
setup link for the owner (or set CLOUDHAL_SETUP_TOKEN:
|
|
17
|
+
32+ characters of A-Z a-z 0-9 - . _ ~); --no-auth
|
|
18
|
+
skips sign-in for local scripts and is refused
|
|
19
|
+
unless --host is loopback and --behind-proxy is off;
|
|
20
|
+
self-hosting: --host 0.0.0.0 (CLOUDHAL_HOST) listens
|
|
21
|
+
beyond this machine (alone: every IPv4 address),
|
|
22
|
+
--base-url (CLOUDHAL_BASE_URL) is the origin browsers
|
|
23
|
+
open Studio at, required behind a reverse proxy and
|
|
24
|
+
recommended whenever --host is not loopback (without
|
|
25
|
+
it sign-in accepts each request's own origin),
|
|
26
|
+
--behind-proxy (CLOUDHAL_BEHIND_PROXY=1) trusts its
|
|
27
|
+
X-Forwarded-Proto/Host and the last X-Forwarded-For
|
|
28
|
+
hop and needs --base-url, --init-if-empty
|
|
29
|
+
(CLOUDHAL_INIT=<starter>) creates the project first
|
|
30
|
+
when the folder is empty (lost+found aside) and has
|
|
31
|
+
no cloudhal.json
|
|
10
32
|
cloudhal mcp [--mode plan|manual|edits|auto|bypass] [--scopes a,b] [--skills <dir>] [--preview-url <url>]
|
|
11
33
|
MCP server over stdio for this project
|
|
12
|
-
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
/** deploy, domain, push, pull: the Cloudflare deployment. */
|
|
37
|
+
const CLOUDFLARE = ` cloudhal deploy [--name <base>] [--dry-run] [--jurisdiction eu] [--scheduler cron|alarm] [--plan free|paid]
|
|
13
38
|
[--force-downgrade] [--no-build-studio]
|
|
14
39
|
site + admin Workers on Cloudflare (uses wrangler login);
|
|
15
40
|
--jurisdiction eu keeps a newly created D1 database
|
|
@@ -27,7 +52,10 @@ Usage:
|
|
|
27
52
|
local site → deployment (refused while releases are
|
|
28
53
|
open unless --cancel-schedules cancels them)
|
|
29
54
|
cloudhal pull [--replace] [--admin-url <url>] deployment → local site
|
|
30
|
-
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
/** export, import, owner, site, migrate, fields: content and sites. */
|
|
58
|
+
const CONTENT = ` cloudhal export [--out <file>] [--site <id>] [--no-media] [--latest-only]
|
|
31
59
|
one site as a .cloudhal file (RFC-0039): its graph,
|
|
32
60
|
snapshots and media; never user accounts, comments,
|
|
33
61
|
analytics or secrets (its history names who made each
|
|
@@ -67,7 +95,10 @@ Usage:
|
|
|
67
95
|
change a collection's typed fields with their values
|
|
68
96
|
(RFC-0041): snapshotted, resumable; --dry-run reports
|
|
69
97
|
and greps the theme; revert <id> undoes a run
|
|
70
|
-
|
|
98
|
+
`;
|
|
99
|
+
|
|
100
|
+
/** media, analytics, comments, schedules, ai, render, motion, tokens, chrome, search. */
|
|
101
|
+
const OPERATIONS = ` cloudhal media import-urls [--dry-run] [--include-markdown] [--allow-host <host>]… | --revert <id>
|
|
71
102
|
copy linked images into the media library
|
|
72
103
|
(RFC-0004); revertible
|
|
73
104
|
cloudhal media verify [<assetId>] recompute media checksums
|
|
@@ -111,3 +142,8 @@ Usage:
|
|
|
111
142
|
(publishing keeps it current; for restored backups)
|
|
112
143
|
cloudhal --help
|
|
113
144
|
`;
|
|
145
|
+
|
|
146
|
+
export const HELP = `cloudhal — agent-native sites
|
|
147
|
+
|
|
148
|
+
Usage:
|
|
149
|
+
${PROJECT}${CLOUDFLARE}${CONTENT}${OPERATIONS}`;
|
package/dist/src/cli.d.ts
CHANGED
|
@@ -15,6 +15,15 @@ export declare const OPTIONS: {
|
|
|
15
15
|
readonly type: "string";
|
|
16
16
|
};
|
|
17
17
|
readonly host: {
|
|
18
|
+
readonly type: "string";
|
|
19
|
+
};
|
|
20
|
+
readonly "base-url": {
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
};
|
|
23
|
+
readonly "behind-proxy": {
|
|
24
|
+
readonly type: "boolean";
|
|
25
|
+
};
|
|
26
|
+
readonly "init-if-empty": {
|
|
18
27
|
readonly type: "boolean";
|
|
19
28
|
};
|
|
20
29
|
readonly label: {
|
|
@@ -191,6 +200,7 @@ export declare const OPTIONS: {
|
|
|
191
200
|
readonly type: "boolean";
|
|
192
201
|
};
|
|
193
202
|
};
|
|
203
|
+
export declare function fillOptionalValues(argv: string[]): string[];
|
|
194
204
|
/** `cloudhal <command>` → its handler. */
|
|
195
205
|
export declare const COMMANDS: Record<string, CliCommand>;
|
|
196
206
|
export declare function main(argv: string[]): Promise<number>;
|
package/dist/src/cli.js
CHANGED
|
@@ -13,7 +13,10 @@ export const OPTIONS = {
|
|
|
13
13
|
name: { type: "string" },
|
|
14
14
|
starter: { type: "string" },
|
|
15
15
|
port: { type: "string" },
|
|
16
|
-
host: { type: "
|
|
16
|
+
host: { type: "string" },
|
|
17
|
+
"base-url": { type: "string" },
|
|
18
|
+
"behind-proxy": { type: "boolean" },
|
|
19
|
+
"init-if-empty": { type: "boolean" },
|
|
17
20
|
label: { type: "string" },
|
|
18
21
|
publish: { type: "boolean" },
|
|
19
22
|
snapshot: { type: "string" },
|
|
@@ -84,8 +87,36 @@ const ONLY_FOR
|
|
|
84
87
|
"no-media": { commands: ["export"] },
|
|
85
88
|
"latest-only": { commands: ["export"] },
|
|
86
89
|
"cancel-schedules": { commands: ["push"] },
|
|
90
|
+
"base-url": { commands: ["studio"] },
|
|
91
|
+
"behind-proxy": { commands: ["studio"] },
|
|
92
|
+
"init-if-empty": { commands: ["studio"] },
|
|
87
93
|
};
|
|
88
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Flags whose value may be left out (`cloudhal dev --host`, as before `--host` took an address):
|
|
97
|
+
* the value they then stand for. `parseArgs` has no optional values, so a bare flag — at the end,
|
|
98
|
+
* or followed by another flag — gets it filled in first.
|
|
99
|
+
*/
|
|
100
|
+
const OPTIONAL_VALUE = { host: "0.0.0.0" };
|
|
101
|
+
|
|
102
|
+
export function fillOptionalValues(argv ) {
|
|
103
|
+
const out = [];
|
|
104
|
+
for (let i = 0; i < argv.length; i++) {
|
|
105
|
+
const arg = argv[i] ;
|
|
106
|
+
out.push(arg);
|
|
107
|
+
if (arg === "--") {
|
|
108
|
+
out.push(...argv.slice(i + 1));
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
const flag = arg.startsWith("--") ? arg.slice(2) : undefined;
|
|
112
|
+
const fill = flag && Object.hasOwn(OPTIONAL_VALUE, flag) ? OPTIONAL_VALUE[flag] : undefined;
|
|
113
|
+
if (fill === undefined) continue;
|
|
114
|
+
const next = argv[i + 1];
|
|
115
|
+
if (next === undefined || next.startsWith("-")) out.push(fill);
|
|
116
|
+
}
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
|
|
89
120
|
function refuseForeignFlags(command , values ) {
|
|
90
121
|
for (const [flag, only] of Object.entries(ONLY_FOR))
|
|
91
122
|
if (values[flag] !== undefined && !only.commands.includes(command))
|
|
@@ -105,7 +136,7 @@ export const COMMANDS = {
|
|
|
105
136
|
|
|
106
137
|
export async function main(argv ) {
|
|
107
138
|
const { values, positionals } = parseArgs({
|
|
108
|
-
args: argv,
|
|
139
|
+
args: fillOptionalValues(argv),
|
|
109
140
|
allowPositionals: true,
|
|
110
141
|
options: OPTIONS,
|
|
111
142
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export interface DevOptions {
|
|
2
2
|
readonly projectDir: string;
|
|
3
3
|
readonly port?: number;
|
|
4
|
-
|
|
4
|
+
/** `true` (every interface) or an address to listen on; default: this machine only. */
|
|
5
|
+
readonly host?: boolean | string;
|
|
5
6
|
/** `false` skips the scheduler's Node ticker (RFC-0008 §8.4). */
|
|
6
7
|
readonly scheduler?: boolean;
|
|
7
8
|
}
|
|
@@ -7,7 +7,8 @@ import { resolveBuildSnapshot } from "./snapshot.js";
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
|
|
@@ -27,7 +28,7 @@ export async function dev(
|
|
|
27
28
|
logLevel: "info",
|
|
28
29
|
server: {
|
|
29
30
|
...(options.port !== undefined ? { port: options.port } : {}),
|
|
30
|
-
...(options.host ? { host:
|
|
31
|
+
...(options.host ? { host: options.host } : {}),
|
|
31
32
|
},
|
|
32
33
|
});
|
|
33
34
|
const addr = server.address;
|
|
@@ -3,9 +3,21 @@ export interface InitOptions {
|
|
|
3
3
|
readonly name?: string;
|
|
4
4
|
readonly starter?: string;
|
|
5
5
|
readonly log?: (line: string) => void;
|
|
6
|
+
/**
|
|
7
|
+
* The folder the project will live in when `dir` is only a staging folder it is moved from
|
|
8
|
+
* (`cloudhal studio --init-if-empty`): relative `link:` paths to a source checkout are computed
|
|
9
|
+
* from here. Default: `dir`.
|
|
10
|
+
*/
|
|
11
|
+
readonly finalDir?: string;
|
|
6
12
|
}
|
|
7
13
|
/** Walks up from `dir` to find a pnpm workspace root (so copied starters keep `workspace:*` links). */
|
|
8
14
|
export declare function findWorkspaceRoot(dir: string): Promise<string | undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* A package name from a site name: lowercase, every run of other characters one `-`, no `-` at
|
|
17
|
+
* either end, at most 64 characters. One pass, linear in the input (no backtracking regex: CodeQL
|
|
18
|
+
* js/polynomial-redos).
|
|
19
|
+
*/
|
|
20
|
+
export declare function slugify(s: string): string;
|
|
9
21
|
export interface InitResult {
|
|
10
22
|
readonly projectDir: string;
|
|
11
23
|
readonly siteId: string;
|
|
@@ -20,6 +20,12 @@ import { starterFilter } from "../starter-files.js";
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
23
29
|
|
|
24
30
|
|
|
25
31
|
async function exists(p ) {
|
|
@@ -42,14 +48,27 @@ export async function findWorkspaceRoot(dir )
|
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
/**
|
|
52
|
+
* A package name from a site name: lowercase, every run of other characters one `-`, no `-` at
|
|
53
|
+
* either end, at most 64 characters. One pass, linear in the input (no backtracking regex: CodeQL
|
|
54
|
+
* js/polynomial-redos).
|
|
55
|
+
*/
|
|
56
|
+
export function slugify(s ) {
|
|
57
|
+
let out = "";
|
|
58
|
+
let dash = false;
|
|
59
|
+
for (const ch of s.toLowerCase()) {
|
|
60
|
+
if ((ch >= "a" && ch <= "z") || (ch >= "0" && ch <= "9")) {
|
|
61
|
+
if (dash && out) {
|
|
62
|
+
// a dash only when the character after it fits too: never a trailing "-"
|
|
63
|
+
if (out.length + 2 > 64) break;
|
|
64
|
+
out += "-";
|
|
65
|
+
}
|
|
66
|
+
dash = false;
|
|
67
|
+
out += ch;
|
|
68
|
+
if (out.length >= 64) break;
|
|
69
|
+
} else dash = true;
|
|
70
|
+
}
|
|
71
|
+
return out || "site";
|
|
53
72
|
}
|
|
54
73
|
|
|
55
74
|
|
|
@@ -96,7 +115,7 @@ export async function init(options ) {
|
|
|
96
115
|
const out = repo
|
|
97
116
|
? materializeDependencies(pkg, await monorepoVersions(repo), {
|
|
98
117
|
// real paths, so the relative link survives symlinked folders (macOS /var → /private/var)
|
|
99
|
-
linkFrom: await realpath(projectDir),
|
|
118
|
+
linkFrom: await realpath(options.finalDir ?? projectDir),
|
|
100
119
|
})
|
|
101
120
|
: pkg;
|
|
102
121
|
await writeFile(pkgPath, `${JSON.stringify(out, null, 2)}\n`);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `cloudhal studio` does about authentication where it does not run on the author's own
|
|
3
|
+
* machine (#165): `--no-auth` stays on this machine, the first account needs a one-time setup
|
|
4
|
+
* token (RFC-0005 §7; `CLOUDHAL_SETUP_TOKEN`, or one printed at start) so a fresh Studio on a
|
|
5
|
+
* network cannot be claimed by whoever reaches it first, and a Studio reachable beyond loopback
|
|
6
|
+
* without a public origin is warned about.
|
|
7
|
+
*/
|
|
8
|
+
import type { SqlDriver } from "@cloudhal/storage";
|
|
9
|
+
import type { StudioServer } from "./studio-options.js";
|
|
10
|
+
type Env = Readonly<Record<string, string | undefined>>;
|
|
11
|
+
/** Loopback addresses: the default bind (`127.0.0.1`), and the only ones `--no-auth` may use. */
|
|
12
|
+
export declare function isLoopbackHost(host: string | undefined): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* `--no-auth` publishes every scope to whoever reaches the port (its only guard is a `Host` allow
|
|
15
|
+
* list any client can satisfy), so it is for this machine only: a loopback address and no proxy in
|
|
16
|
+
* front (#165).
|
|
17
|
+
*/
|
|
18
|
+
export declare function assertNoAuthLocal(server: StudioServer): void;
|
|
19
|
+
/** The token the first account must present, and where it came from. */
|
|
20
|
+
export interface SetupToken {
|
|
21
|
+
readonly token: string;
|
|
22
|
+
readonly source: "env" | "generated";
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The one-time token the first account must present (header `x-cloudhal-setup-token`; RFC-0005 §7,
|
|
26
|
+
* #165): `CLOUDHAL_SETUP_TOKEN` when set, else a fresh random one for this process. It is only
|
|
27
|
+
* asked for while nobody has an account.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveSetupToken(env?: Env): SetupToken;
|
|
30
|
+
/** Whether anybody has an account yet (Better Auth's `user` table, storage migration 0002). */
|
|
31
|
+
export declare function hasAccounts(sql: Pick<SqlDriver, "get">): Promise<boolean>;
|
|
32
|
+
/** The setup link `studio()` reports while nobody has an account. */
|
|
33
|
+
export interface StudioSetup {
|
|
34
|
+
/** `<studio url>login#setup=<token>`: the token travels in the fragment, never to a server. */
|
|
35
|
+
readonly url: string;
|
|
36
|
+
readonly tokenSource: "env" | "generated";
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* What `cloudhal studio` prints for a `StudioSetup` (an operator reads it from the container's
|
|
40
|
+
* log). A token the operator set themselves is not repeated: logs may be kept.
|
|
41
|
+
*/
|
|
42
|
+
export declare function describeSetup(setup: StudioSetup): string;
|
|
43
|
+
/**
|
|
44
|
+
* Behind a reverse proxy the public origin is known, and Better Auth needs it as its base URL: for
|
|
45
|
+
* `Secure` session cookies on https and for the one origin sign-in accepts. Without it the server
|
|
46
|
+
* would trust whatever origin the forwarded headers name, or (on loopback) refuse every sign-in, so
|
|
47
|
+
* `--behind-proxy` without `--base-url` is refused at start (#165).
|
|
48
|
+
*/
|
|
49
|
+
export declare function assertProxyHasBaseUrl(server: StudioServer): void;
|
|
50
|
+
/** One line for a Studio reachable beyond this machine without a public origin (#165). */
|
|
51
|
+
export declare function noBaseUrlWarning(server: StudioServer): string | undefined;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `cloudhal studio` does about authentication where it does not run on the author's own
|
|
3
|
+
* machine (#165): `--no-auth` stays on this machine, the first account needs a one-time setup
|
|
4
|
+
* token (RFC-0005 §7; `CLOUDHAL_SETUP_TOKEN`, or one printed at start) so a fresh Studio on a
|
|
5
|
+
* network cannot be claimed by whoever reaches it first, and a Studio reachable beyond loopback
|
|
6
|
+
* without a public origin is warned about.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/** Loopback addresses: the default bind (`127.0.0.1`), and the only ones `--no-auth` may use. */
|
|
14
|
+
export function isLoopbackHost(host ) {
|
|
15
|
+
if (host === undefined) return true;
|
|
16
|
+
const h = host
|
|
17
|
+
.trim()
|
|
18
|
+
.toLowerCase()
|
|
19
|
+
.replace(/^\[(.*)\]$/, "$1");
|
|
20
|
+
return (
|
|
21
|
+
h === "localhost" ||
|
|
22
|
+
h === "::1" ||
|
|
23
|
+
h === "::ffff:127.0.0.1" ||
|
|
24
|
+
/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(h)
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* `--no-auth` publishes every scope to whoever reaches the port (its only guard is a `Host` allow
|
|
30
|
+
* list any client can satisfy), so it is for this machine only: a loopback address and no proxy in
|
|
31
|
+
* front (#165).
|
|
32
|
+
*/
|
|
33
|
+
export function assertNoAuthLocal(server ) {
|
|
34
|
+
if (isLoopbackHost(server.hostname) && !server.behindProxy) return;
|
|
35
|
+
const why = server.behindProxy ? "--behind-proxy is set" : `--host is ${server.hostname}`;
|
|
36
|
+
throw new Error(
|
|
37
|
+
`--no-auth is for this machine only: it needs a loopback --host (127.0.0.1, the default, or ::1) and no --behind-proxy, but ${why}. Run with authentication to serve Studio beyond localhost.`,
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** The token the first account must present, and where it came from. */
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
/** A `CLOUDHAL_SETUP_TOKEN` must be hard to guess (the same floor `cloudhal deploy` asks for). */
|
|
48
|
+
const MIN_SETUP_TOKEN_LENGTH = 32;
|
|
49
|
+
/**
|
|
50
|
+
* The characters a token may use: it travels in a URL fragment, where Studio's login page reads
|
|
51
|
+
* `+` as a space and `%`, `&` or `#` change the value (base64url, hex and UUIDs fit).
|
|
52
|
+
*/
|
|
53
|
+
const SETUP_TOKEN_CHARS = /^[A-Za-z0-9._~-]+$/;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The one-time token the first account must present (header `x-cloudhal-setup-token`; RFC-0005 §7,
|
|
57
|
+
* #165): `CLOUDHAL_SETUP_TOKEN` when set, else a fresh random one for this process. It is only
|
|
58
|
+
* asked for while nobody has an account.
|
|
59
|
+
*/
|
|
60
|
+
export function resolveSetupToken(env = process.env) {
|
|
61
|
+
const given = env.CLOUDHAL_SETUP_TOKEN?.trim();
|
|
62
|
+
if (given) {
|
|
63
|
+
if (given.length < MIN_SETUP_TOKEN_LENGTH)
|
|
64
|
+
throw new Error(
|
|
65
|
+
`CLOUDHAL_SETUP_TOKEN must be at least ${MIN_SETUP_TOKEN_LENGTH} characters (a random value); unset it and cloudhal studio prints a setup link instead`,
|
|
66
|
+
);
|
|
67
|
+
if (!SETUP_TOKEN_CHARS.test(given))
|
|
68
|
+
throw new Error(
|
|
69
|
+
"CLOUDHAL_SETUP_TOKEN may only use letters, digits and - . _ ~ (it travels in the setup link): use e.g. `openssl rand -hex 32`",
|
|
70
|
+
);
|
|
71
|
+
return { token: given, source: "env" };
|
|
72
|
+
}
|
|
73
|
+
const bytes = crypto.getRandomValues(new Uint8Array(32));
|
|
74
|
+
return { token: Buffer.from(bytes).toString("base64url"), source: "generated" };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Whether anybody has an account yet (Better Auth's `user` table, storage migration 0002). */
|
|
78
|
+
export async function hasAccounts(sql ) {
|
|
79
|
+
const row = await sql.get ('SELECT COUNT(*) AS n FROM "user"');
|
|
80
|
+
return (row?.n ?? 0) > 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** The setup link `studio()` reports while nobody has an account. */
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
/** The setup link with the token replaced by its variable's name (a string search, no regex). */
|
|
91
|
+
function withoutToken(url ) {
|
|
92
|
+
const at = url.indexOf("#setup=");
|
|
93
|
+
return `${at === -1 ? url : url.slice(0, at)}#setup=<CLOUDHAL_SETUP_TOKEN>`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* What `cloudhal studio` prints for a `StudioSetup` (an operator reads it from the container's
|
|
98
|
+
* log). A token the operator set themselves is not repeated: logs may be kept.
|
|
99
|
+
*/
|
|
100
|
+
export function describeSetup(setup ) {
|
|
101
|
+
const fromEnv = setup.tokenSource === "env";
|
|
102
|
+
const link = fromEnv ? withoutToken(setup.url) : setup.url;
|
|
103
|
+
return [
|
|
104
|
+
"No account yet. Create the owner account (once) at this one-time setup link:",
|
|
105
|
+
` ${link}`,
|
|
106
|
+
fromEnv
|
|
107
|
+
? " (the token is the value of CLOUDHAL_SETUP_TOKEN; it is not printed)"
|
|
108
|
+
: " (printed only here; without it nobody can sign up)",
|
|
109
|
+
" If you open Studio at another address, keep the #setup=… part of the link.",
|
|
110
|
+
].join("\n");
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Behind a reverse proxy the public origin is known, and Better Auth needs it as its base URL: for
|
|
115
|
+
* `Secure` session cookies on https and for the one origin sign-in accepts. Without it the server
|
|
116
|
+
* would trust whatever origin the forwarded headers name, or (on loopback) refuse every sign-in, so
|
|
117
|
+
* `--behind-proxy` without `--base-url` is refused at start (#165).
|
|
118
|
+
*/
|
|
119
|
+
export function assertProxyHasBaseUrl(server ) {
|
|
120
|
+
if (!server.behindProxy || server.baseUrl !== undefined) return;
|
|
121
|
+
throw new Error(
|
|
122
|
+
"--behind-proxy (CLOUDHAL_BEHIND_PROXY) needs --base-url: set CLOUDHAL_BASE_URL to the public origin browsers open Studio at, e.g. https://studio.example.com",
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** One line for a Studio reachable beyond this machine without a public origin (#165). */
|
|
127
|
+
export function noBaseUrlWarning(server ) {
|
|
128
|
+
if (server.baseUrl !== undefined || isLoopbackHost(server.hostname)) return undefined;
|
|
129
|
+
return `--host ${server.hostname} without --base-url: sign-in accepts the origin of each request; set --base-url (CLOUDHAL_BASE_URL) to the origin browsers open Studio at, e.g. http://<this machine's address>:${server.port}`;
|
|
130
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
type Env = Readonly<Record<string, string | undefined>>;
|
|
2
|
+
/** The flags `cloudhal studio` takes for where and how it is served. */
|
|
3
|
+
export interface StudioServerFlags {
|
|
4
|
+
readonly port?: number;
|
|
5
|
+
/** `--host`: the address to listen on (default `127.0.0.1`; `0.0.0.0` for every IPv4 address). */
|
|
6
|
+
readonly host?: string;
|
|
7
|
+
/**
|
|
8
|
+
* `--base-url`: the origin browsers open Studio at (scheme, host, port), e.g.
|
|
9
|
+
* `https://studio.example.com`; required behind a reverse proxy, recommended whenever `--host`
|
|
10
|
+
* is not loopback. Without it sign-in accepts each request's own origin (#165).
|
|
11
|
+
*/
|
|
12
|
+
readonly baseUrl?: string;
|
|
13
|
+
/** `--behind-proxy`: trust `X-Forwarded-Proto` / `X-Forwarded-Host`. */
|
|
14
|
+
readonly behindProxy?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** What `studio()` serves with: flags, then the environment, then the defaults. */
|
|
17
|
+
export interface StudioServer {
|
|
18
|
+
readonly port: number;
|
|
19
|
+
readonly hostname: string | undefined;
|
|
20
|
+
/** The public origin, without a trailing slash; undefined means `http://localhost:<port>`. */
|
|
21
|
+
readonly baseUrl: string | undefined;
|
|
22
|
+
readonly behindProxy: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* `--base-url` / `CLOUDHAL_BASE_URL` as an origin: http or https, host, optional port; a path,
|
|
26
|
+
* query or fragment is refused (Studio is served at the root, and Better Auth's `baseURL` is an
|
|
27
|
+
* origin).
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseBaseUrl(value: string): string;
|
|
30
|
+
/** Resolves the server options from flags and the environment. */
|
|
31
|
+
export declare function resolveStudioServer(flags: StudioServerFlags, env?: Env): StudioServer;
|
|
32
|
+
/** Where to open Studio: the public origin when there is one, else this machine. */
|
|
33
|
+
export declare function studioUrl(server: StudioServer, port: number): string;
|
|
34
|
+
/**
|
|
35
|
+
* Better Auth's `baseURL` (the origin browsers use; its cookies are `Secure` for https) and the
|
|
36
|
+
* origins the API accepts state-changing requests from: the Studio dev server, the public origin
|
|
37
|
+
* (so a proxy that keeps the request on http still passes the API's CSRF check), and
|
|
38
|
+
* `CLOUDHAL_TRUSTED_ORIGINS`. Without a public origin (#165) Better Auth also trusts the origin
|
|
39
|
+
* each request was made to, as the API's CSRF check does: any (`"any"`, a server listening beyond
|
|
40
|
+
* loopback, reached at `http://<lan-ip>:8787`), or on a loopback server only this machine's names
|
|
41
|
+
* (`"loopback"`: `localhost`, `127.0.0.1`, `[::1]`, so a rebound DNS name is not). With a public
|
|
42
|
+
* origin (`false`) only it and the list may sign in.
|
|
43
|
+
*/
|
|
44
|
+
export declare function studioAuthOrigins(server: StudioServer, env?: Env): {
|
|
45
|
+
baseURL: string;
|
|
46
|
+
trustedOrigins: string[];
|
|
47
|
+
trustRequestOrigin: "any" | "loopback" | false;
|
|
48
|
+
};
|
|
49
|
+
/** `--init-if-empty` and its `--starter` / `--name`; from the environment, `CLOUDHAL_INIT=<starter>`. */
|
|
50
|
+
export interface StudioInitFlags {
|
|
51
|
+
readonly initIfEmpty?: boolean;
|
|
52
|
+
readonly starter?: string;
|
|
53
|
+
readonly name?: string;
|
|
54
|
+
}
|
|
55
|
+
/** The first-run scaffold to perform, or undefined when none was asked for. */
|
|
56
|
+
export declare function resolveStudioInit(flags: StudioInitFlags, env?: Env): {
|
|
57
|
+
starter: string;
|
|
58
|
+
name: string | undefined;
|
|
59
|
+
} | undefined;
|
|
60
|
+
/** The folder inside the project where `--init-if-empty` stages the scaffold before moving it up. */
|
|
61
|
+
export declare const INIT_STAGING_DIR = ".cloudhal-init";
|
|
62
|
+
/**
|
|
63
|
+
* Creates the project the way `cloudhal init` does when the folder has no `cloudhal.json` (a
|
|
64
|
+
* container starting on an empty volume). A folder that has other files but no config is refused,
|
|
65
|
+
* as `init` refuses it, so a volume mounted at the wrong path is never written over. The scaffold
|
|
66
|
+
* is staged in `.cloudhal-init` inside the folder and moved up entry by entry, `cloudhal.json`
|
|
67
|
+
* last, so a container stopped at any point starts again cleanly: a staging folder without a
|
|
68
|
+
* complete config (missing, cut off, no `siteId`) is redone, one with a complete config is moved
|
|
69
|
+
* the rest of the way (#165; before, a stop mid-scaffold crash-looped on "is not empty"). A fresh
|
|
70
|
+
* ext4 volume's `lost+found` does not make the folder non-empty. Returns whether a project was
|
|
71
|
+
* created.
|
|
72
|
+
*/
|
|
73
|
+
export declare function initIfEmpty(projectDir: string, options: {
|
|
74
|
+
starter: string;
|
|
75
|
+
name?: string | undefined;
|
|
76
|
+
log?: (line: string) => void;
|
|
77
|
+
}): Promise<boolean>;
|
|
78
|
+
export {};
|