@polardbx/pxbaas 0.0.0-stage → 0.1.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +223 -2
- package/bin/pxbaas.js +13 -0
- package/dist/app/local-index.d.ts +70 -0
- package/dist/app/local-index.d.ts.map +1 -0
- package/dist/app/local-index.js +140 -0
- package/dist/app/local-index.js.map +1 -0
- package/dist/app/preflight.d.ts +61 -0
- package/dist/app/preflight.d.ts.map +1 -0
- package/dist/app/preflight.js +115 -0
- package/dist/app/preflight.js.map +1 -0
- package/dist/app/spec-lint.d.ts +45 -0
- package/dist/app/spec-lint.d.ts.map +1 -0
- package/dist/app/spec-lint.js +423 -0
- package/dist/app/spec-lint.js.map +1 -0
- package/dist/app/templates.d.ts +167 -0
- package/dist/app/templates.d.ts.map +1 -0
- package/dist/app/templates.js +151 -0
- package/dist/app/templates.js.map +1 -0
- package/dist/cli/help-guides.d.ts +17 -0
- package/dist/cli/help-guides.d.ts.map +1 -0
- package/dist/cli/help-guides.js +132 -0
- package/dist/cli/help-guides.js.map +1 -0
- package/dist/cli/root.d.ts +3 -0
- package/dist/cli/root.d.ts.map +1 -0
- package/dist/cli/root.js +75 -0
- package/dist/cli/root.js.map +1 -0
- package/dist/commands/app/index.d.ts +8 -0
- package/dist/commands/app/index.d.ts.map +1 -0
- package/dist/commands/app/index.js +1907 -0
- package/dist/commands/app/index.js.map +1 -0
- package/dist/commands/auth/index.d.ts +3 -0
- package/dist/commands/auth/index.d.ts.map +1 -0
- package/dist/commands/auth/index.js +198 -0
- package/dist/commands/auth/index.js.map +1 -0
- package/dist/commands/completion/index.d.ts +3 -0
- package/dist/commands/completion/index.d.ts.map +1 -0
- package/dist/commands/completion/index.js +14 -0
- package/dist/commands/completion/index.js.map +1 -0
- package/dist/commands/data/index.d.ts +55 -0
- package/dist/commands/data/index.d.ts.map +1 -0
- package/dist/commands/data/index.js +407 -0
- package/dist/commands/data/index.js.map +1 -0
- package/dist/commands/db/index.d.ts +29 -0
- package/dist/commands/db/index.d.ts.map +1 -0
- package/dist/commands/db/index.js +500 -0
- package/dist/commands/db/index.js.map +1 -0
- package/dist/commands/doctor/index.d.ts +3 -0
- package/dist/commands/doctor/index.d.ts.map +1 -0
- package/dist/commands/doctor/index.js +305 -0
- package/dist/commands/doctor/index.js.map +1 -0
- package/dist/commands/functions/delete.d.ts +3 -0
- package/dist/commands/functions/delete.d.ts.map +1 -0
- package/dist/commands/functions/delete.js +55 -0
- package/dist/commands/functions/delete.js.map +1 -0
- package/dist/commands/functions/deploy.d.ts +3 -0
- package/dist/commands/functions/deploy.d.ts.map +1 -0
- package/dist/commands/functions/deploy.js +118 -0
- package/dist/commands/functions/deploy.js.map +1 -0
- package/dist/commands/functions/index.d.ts +3 -0
- package/dist/commands/functions/index.d.ts.map +1 -0
- package/dist/commands/functions/index.js +15 -0
- package/dist/commands/functions/index.js.map +1 -0
- package/dist/commands/functions/list.d.ts +6 -0
- package/dist/commands/functions/list.d.ts.map +1 -0
- package/dist/commands/functions/list.js +63 -0
- package/dist/commands/functions/list.js.map +1 -0
- package/dist/commands/functions/new.d.ts +7 -0
- package/dist/commands/functions/new.d.ts.map +1 -0
- package/dist/commands/functions/new.js +72 -0
- package/dist/commands/functions/new.js.map +1 -0
- package/dist/commands/gen/index.d.ts +3 -0
- package/dist/commands/gen/index.d.ts.map +1 -0
- package/dist/commands/gen/index.js +323 -0
- package/dist/commands/gen/index.js.map +1 -0
- package/dist/commands/guide/index.d.ts +8 -0
- package/dist/commands/guide/index.d.ts.map +1 -0
- package/dist/commands/guide/index.js +20 -0
- package/dist/commands/guide/index.js.map +1 -0
- package/dist/commands/instance/index.d.ts +8 -0
- package/dist/commands/instance/index.d.ts.map +1 -0
- package/dist/commands/instance/index.js +481 -0
- package/dist/commands/instance/index.js.map +1 -0
- package/dist/commands/login/index.d.ts +3 -0
- package/dist/commands/login/index.d.ts.map +1 -0
- package/dist/commands/login/index.js +145 -0
- package/dist/commands/login/index.js.map +1 -0
- package/dist/commands/logout/index.d.ts +3 -0
- package/dist/commands/logout/index.d.ts.map +1 -0
- package/dist/commands/logout/index.js +41 -0
- package/dist/commands/logout/index.js.map +1 -0
- package/dist/commands/profile/import-env.d.ts +18 -0
- package/dist/commands/profile/import-env.d.ts.map +1 -0
- package/dist/commands/profile/import-env.js +206 -0
- package/dist/commands/profile/import-env.js.map +1 -0
- package/dist/commands/profile/index.d.ts +3 -0
- package/dist/commands/profile/index.d.ts.map +1 -0
- package/dist/commands/profile/index.js +124 -0
- package/dist/commands/profile/index.js.map +1 -0
- package/dist/commands/rest/index.d.ts +3 -0
- package/dist/commands/rest/index.d.ts.map +1 -0
- package/dist/commands/rest/index.js +102 -0
- package/dist/commands/rest/index.js.map +1 -0
- package/dist/commands/skill/index.d.ts +11 -0
- package/dist/commands/skill/index.d.ts.map +1 -0
- package/dist/commands/skill/index.js +228 -0
- package/dist/commands/skill/index.js.map +1 -0
- package/dist/commands/status/index.d.ts +3 -0
- package/dist/commands/status/index.d.ts.map +1 -0
- package/dist/commands/status/index.js +59 -0
- package/dist/commands/status/index.js.map +1 -0
- package/dist/commands/storage/index.d.ts +3 -0
- package/dist/commands/storage/index.d.ts.map +1 -0
- package/dist/commands/storage/index.js +400 -0
- package/dist/commands/storage/index.js.map +1 -0
- package/dist/commands/tenant/index.d.ts +19 -0
- package/dist/commands/tenant/index.d.ts.map +1 -0
- package/dist/commands/tenant/index.js +667 -0
- package/dist/commands/tenant/index.js.map +1 -0
- package/dist/commands/whoami/index.d.ts +3 -0
- package/dist/commands/whoami/index.d.ts.map +1 -0
- package/dist/commands/whoami/index.js +101 -0
- package/dist/commands/whoami/index.js.map +1 -0
- package/dist/credentials/commit.d.ts +38 -0
- package/dist/credentials/commit.d.ts.map +1 -0
- package/dist/credentials/commit.js +57 -0
- package/dist/credentials/commit.js.map +1 -0
- package/dist/credentials/credential-store.d.ts +86 -0
- package/dist/credentials/credential-store.d.ts.map +1 -0
- package/dist/credentials/credential-store.js +282 -0
- package/dist/credentials/credential-store.js.map +1 -0
- package/dist/credentials/env-file.d.ts +85 -0
- package/dist/credentials/env-file.d.ts.map +1 -0
- package/dist/credentials/env-file.js +193 -0
- package/dist/credentials/env-file.js.map +1 -0
- package/dist/credentials/formatter.d.ts +39 -0
- package/dist/credentials/formatter.d.ts.map +1 -0
- package/dist/credentials/formatter.js +79 -0
- package/dist/credentials/formatter.js.map +1 -0
- package/dist/credentials/index.d.ts +13 -0
- package/dist/credentials/index.d.ts.map +1 -0
- package/dist/credentials/index.js +13 -0
- package/dist/credentials/index.js.map +1 -0
- package/dist/credentials/jwt-introspect.d.ts +39 -0
- package/dist/credentials/jwt-introspect.d.ts.map +1 -0
- package/dist/credentials/jwt-introspect.js +64 -0
- package/dist/credentials/jwt-introspect.js.map +1 -0
- package/dist/credentials/masker.d.ts +23 -0
- package/dist/credentials/masker.d.ts.map +1 -0
- package/dist/credentials/masker.js +40 -0
- package/dist/credentials/masker.js.map +1 -0
- package/dist/credentials/profile.d.ts +95 -0
- package/dist/credentials/profile.d.ts.map +1 -0
- package/dist/credentials/profile.js +207 -0
- package/dist/credentials/profile.js.map +1 -0
- package/dist/credentials/tenant-guard.d.ts +16 -0
- package/dist/credentials/tenant-guard.d.ts.map +1 -0
- package/dist/credentials/tenant-guard.js +53 -0
- package/dist/credentials/tenant-guard.js.map +1 -0
- package/dist/credentials/tty-guard.d.ts +29 -0
- package/dist/credentials/tty-guard.d.ts.map +1 -0
- package/dist/credentials/tty-guard.js +79 -0
- package/dist/credentials/tty-guard.js.map +1 -0
- package/dist/db/apply-schema.d.ts +144 -0
- package/dist/db/apply-schema.d.ts.map +1 -0
- package/dist/db/apply-schema.js +359 -0
- package/dist/db/apply-schema.js.map +1 -0
- package/dist/db/introspect.d.ts +54 -0
- package/dist/db/introspect.d.ts.map +1 -0
- package/dist/db/introspect.js +140 -0
- package/dist/db/introspect.js.map +1 -0
- package/dist/db/sql-file.d.ts +104 -0
- package/dist/db/sql-file.d.ts.map +1 -0
- package/dist/db/sql-file.js +584 -0
- package/dist/db/sql-file.js.map +1 -0
- package/dist/instance/provision.d.ts +89 -0
- package/dist/instance/provision.d.ts.map +1 -0
- package/dist/instance/provision.js +139 -0
- package/dist/instance/provision.js.map +1 -0
- package/dist/instance/zero-store.d.ts +47 -0
- package/dist/instance/zero-store.d.ts.map +1 -0
- package/dist/instance/zero-store.js +91 -0
- package/dist/instance/zero-store.js.map +1 -0
- package/dist/instance/zero-whitelist.d.ts +39 -0
- package/dist/instance/zero-whitelist.d.ts.map +1 -0
- package/dist/instance/zero-whitelist.js +67 -0
- package/dist/instance/zero-whitelist.js.map +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +69 -0
- package/dist/main.js.map +1 -0
- package/dist/skill/agents-md.d.ts +25 -0
- package/dist/skill/agents-md.d.ts.map +1 -0
- package/dist/skill/agents-md.js +62 -0
- package/dist/skill/agents-md.js.map +1 -0
- package/dist/skill/assets.d.ts +38 -0
- package/dist/skill/assets.d.ts.map +1 -0
- package/dist/skill/assets.js +111 -0
- package/dist/skill/assets.js.map +1 -0
- package/dist/skill/hint.d.ts +39 -0
- package/dist/skill/hint.d.ts.map +1 -0
- package/dist/skill/hint.js +109 -0
- package/dist/skill/hint.js.map +1 -0
- package/dist/skill/hosts.d.ts +45 -0
- package/dist/skill/hosts.d.ts.map +1 -0
- package/dist/skill/hosts.js +96 -0
- package/dist/skill/hosts.js.map +1 -0
- package/dist/skill/installer.d.ts +100 -0
- package/dist/skill/installer.d.ts.map +1 -0
- package/dist/skill/installer.js +241 -0
- package/dist/skill/installer.js.map +1 -0
- package/dist/skill/ownership.d.ts +35 -0
- package/dist/skill/ownership.d.ts.map +1 -0
- package/dist/skill/ownership.js +52 -0
- package/dist/skill/ownership.js.map +1 -0
- package/dist/tenant/bundle.d.ts +66 -0
- package/dist/tenant/bundle.d.ts.map +1 -0
- package/dist/tenant/bundle.js +132 -0
- package/dist/tenant/bundle.js.map +1 -0
- package/dist/tenant/guide.d.ts +50 -0
- package/dist/tenant/guide.d.ts.map +1 -0
- package/dist/tenant/guide.js +152 -0
- package/dist/tenant/guide.js.map +1 -0
- package/dist/tenant/probe.d.ts +65 -0
- package/dist/tenant/probe.d.ts.map +1 -0
- package/dist/tenant/probe.js +159 -0
- package/dist/tenant/probe.js.map +1 -0
- package/dist/tenant/verify.d.ts +37 -0
- package/dist/tenant/verify.d.ts.map +1 -0
- package/dist/tenant/verify.js +132 -0
- package/dist/tenant/verify.js.map +1 -0
- package/dist/version.d.ts +29 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +65 -0
- package/dist/version.js.map +1 -0
- package/package.json +63 -3
- package/skills/pxbaas-app-spec/SKILL.md +165 -0
- package/skills/pxbaas-app-spec/references/deploy-options.md +158 -0
- package/skills/pxbaas-app-spec/references/guardrails-pitfalls.md +89 -0
- package/skills/pxbaas-app-spec/references/runtime-contract.md +151 -0
- package/skills/pxbaas-app-spec/references/ssr-session.md +121 -0
- package/skills/pxbaas-app-spec/references/templates-examples.md +311 -0
- package/skills/pxbaas-cli/SKILL.md +186 -0
- package/skills/pxbaas-cli/references/api-reference.md +68 -0
- package/skills/pxbaas-cli/references/app-deploy.md +186 -0
- package/skills/pxbaas-cli/references/auth-and-credentials.md +116 -0
- package/skills/pxbaas-cli/references/data-postgrest.md +101 -0
- package/skills/pxbaas-cli/references/db-and-meta.md +102 -0
- package/skills/pxbaas-cli/references/edge-functions.md +71 -0
- package/skills/pxbaas-cli/references/multi-tenant-apps.md +138 -0
- package/skills/pxbaas-cli/references/provision.md +101 -0
- package/skills/pxbaas-cli/references/safety-and-two-phase.md +78 -0
- package/skills/pxbaas-cli/references/storage.md +61 -0
- package/skills/pxbaas-cli/references/tenant-admin.md +122 -0
- package/skills/pxbaas-cli/references/troubleshooting.md +76 -0
- package/templates/webapp/api/index.ts +55 -0
- package/templates/webapp/csr-bff/README.md +81 -0
- package/templates/webapp/csr-bff/backend/index.ts +168 -0
- package/templates/webapp/csr-bff/db/rls.json +13 -0
- package/templates/webapp/csr-bff/db/schema.sql +49 -0
- package/templates/webapp/csr-bff/frontend/dist/admin.html +101 -0
- package/templates/webapp/csr-bff/frontend/dist/article.html +44 -0
- package/templates/webapp/csr-bff/frontend/dist/blog.js +206 -0
- package/templates/webapp/csr-bff/frontend/dist/blogger.html +53 -0
- package/templates/webapp/csr-bff/frontend/dist/index.html +70 -0
- package/templates/webapp/csr-bff/frontend/dist/login.html +56 -0
- package/templates/webapp/csr-bff/frontend/dist/profile.html +59 -0
- package/templates/webapp/csr-bff/frontend/dist/signup.html +78 -0
- package/templates/webapp/csr-bff/frontend/dist/style.css +27 -0
- package/templates/webapp/manifest.json +419 -0
- package/templates/webapp/mpa/about.html +29 -0
- package/templates/webapp/mpa/app.js +42 -0
- package/templates/webapp/mpa/index.html +42 -0
- package/templates/webapp/mpa/index.ts +60 -0
- package/templates/webapp/mpa/style.css +42 -0
- package/templates/webapp/react-vite/frontend/index.html +12 -0
- package/templates/webapp/react-vite/frontend/package-lock.json +1826 -0
- package/templates/webapp/react-vite/frontend/package.json +23 -0
- package/templates/webapp/react-vite/frontend/src/App.tsx +34 -0
- package/templates/webapp/react-vite/frontend/src/main.tsx +13 -0
- package/templates/webapp/react-vite/frontend/src/style.css +46 -0
- package/templates/webapp/react-vite/frontend/tsconfig.json +20 -0
- package/templates/webapp/react-vite/frontend/vite.config.ts +10 -0
- package/templates/webapp/react-vite-hono/backend/index.ts +38 -0
- package/templates/webapp/react-vite-hono/frontend/index.html +12 -0
- package/templates/webapp/react-vite-hono/frontend/package-lock.json +1826 -0
- package/templates/webapp/react-vite-hono/frontend/package.json +23 -0
- package/templates/webapp/react-vite-hono/frontend/src/App.tsx +47 -0
- package/templates/webapp/react-vite-hono/frontend/src/main.tsx +13 -0
- package/templates/webapp/react-vite-hono/frontend/src/style.css +66 -0
- package/templates/webapp/react-vite-hono/frontend/tsconfig.json +20 -0
- package/templates/webapp/react-vite-hono/frontend/vite.config.ts +10 -0
- package/templates/webapp/spa/index.ts +119 -0
- package/templates/webapp/ssr-auth/backend/index.ts +133 -0
- package/templates/webapp/ssr-auth/frontend/dist/index.html +15 -0
- package/templates/webapp/ssr-blog/README.md +111 -0
- package/templates/webapp/ssr-blog/backend/index.ts +764 -0
- package/templates/webapp/ssr-blog/db/rls.json +13 -0
- package/templates/webapp/ssr-blog/db/schema.sql +51 -0
- package/templates/webapp/ssr-blog/frontend/dist/index.html +39 -0
- package/templates/webapp/ssr-frameworks/README.md +64 -0
- package/templates/webapp/ssr-frameworks/backend/index.ts +241 -0
- package/templates/webapp/ssr-frameworks/frontend/dist/index.html +31 -0
- package/templates/webapp/ssr-hono/backend/index.ts +111 -0
- package/templates/webapp/ssr-hono/frontend/dist/index.html +12 -0
- package/templates/webapp/ssr-shop/README.md +80 -0
- package/templates/webapp/ssr-shop/backend/index.ts +491 -0
- package/templates/webapp/ssr-shop/db/rls.json +16 -0
- package/templates/webapp/ssr-shop/db/schema.sql +90 -0
- package/templates/webapp/ssr-shop/frontend/dist/index.html +12 -0
- package/templates/webapp/vanilla-static/frontend/dist/app.js +6 -0
- package/templates/webapp/vanilla-static/frontend/dist/index.html +19 -0
- package/templates/webapp/vanilla-static/frontend/dist/style.css +43 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webapp template resolution & scaffolding for `pxbaas app`.
|
|
3
|
+
*
|
|
4
|
+
* Templates ship as package files under `apps/baas/templates/webapp/` (route A,
|
|
5
|
+
* same as the bundled skill). We resolve the package root by walking up from this
|
|
6
|
+
* module until we find `templates/webapp/manifest.json`. The standalone single-file
|
|
7
|
+
* binary does not carry these assets; scaffolding then fails with a clear error.
|
|
8
|
+
*/
|
|
9
|
+
export type AppMode = "spa" | "api" | "mpa" | "webapp";
|
|
10
|
+
export type BackendFramework = "deno" | "hono";
|
|
11
|
+
export interface AppFrontend {
|
|
12
|
+
root: string;
|
|
13
|
+
routing: "files";
|
|
14
|
+
index: string;
|
|
15
|
+
/** null = static-only; "worker" = static-miss falls through to the worker (SSR). */
|
|
16
|
+
fallback: null | "worker";
|
|
17
|
+
}
|
|
18
|
+
export interface AppBackend {
|
|
19
|
+
entrypoint: string;
|
|
20
|
+
framework: BackendFramework;
|
|
21
|
+
pathMode: "strip-app-api-prefix";
|
|
22
|
+
verifyJwt: boolean;
|
|
23
|
+
secrets: string[];
|
|
24
|
+
egressPolicy: "deny";
|
|
25
|
+
/** 方案 C: session delivery. none | proxy-injected | browser-side. */
|
|
26
|
+
session?: "none" | "proxy-injected" | "browser-side";
|
|
27
|
+
/**
|
|
28
|
+
* Optional backend health probe path for `pxbaas app verify` (a mount-relative
|
|
29
|
+
* logical path such as "/api/health"). When absent, verify checks only the
|
|
30
|
+
* mount homepage and does NOT probe a fixed backend route.
|
|
31
|
+
*/
|
|
32
|
+
healthPath?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface TemplateMeta {
|
|
35
|
+
/** Delivery path: legacy single worker or schemaVersion 2 webapp mount. */
|
|
36
|
+
delivery: "legacy" | "webapp";
|
|
37
|
+
/** Rendering model of the delivered app. */
|
|
38
|
+
render: "static" | "csr" | "ssr" | "headless";
|
|
39
|
+
/** Frontend stack shipped by the template. */
|
|
40
|
+
frontend: "none" | "inline" | "html" | "vanilla" | "react" | "static-shell";
|
|
41
|
+
/** Backend framework inside the worker(s). */
|
|
42
|
+
backend: "none" | "deno" | "hono";
|
|
43
|
+
/** Session delivery contract. */
|
|
44
|
+
session: "none" | "proxy-injected" | "browser-side";
|
|
45
|
+
/** Ships db/schema.sql + db/rls.json (requires app db-init before deploy). */
|
|
46
|
+
hasDb: boolean;
|
|
47
|
+
/** Cold-start weight of the worker's npm import graph. */
|
|
48
|
+
coldStart: "light" | "moderate" | "heavy";
|
|
49
|
+
/** Intended role of the template. */
|
|
50
|
+
purpose: "legacy-demo" | "validation" | "starter" | "reference" | "showcase";
|
|
51
|
+
}
|
|
52
|
+
export interface WebappTemplate {
|
|
53
|
+
id: string;
|
|
54
|
+
description: string;
|
|
55
|
+
entrypoint: string;
|
|
56
|
+
/**
|
|
57
|
+
* Machine-readable selection metadata so agents and humans pick templates
|
|
58
|
+
* by capability instead of guessing from the id (names mix rendering,
|
|
59
|
+
* stack, session and content axes on purpose-free ids).
|
|
60
|
+
*/
|
|
61
|
+
meta?: TemplateMeta;
|
|
62
|
+
/** Deploy mode written into app.json; defaults to the template id (spa/api). */
|
|
63
|
+
mode?: AppMode;
|
|
64
|
+
/** Multi-file templates list every file to scaffold; paths may be nested. */
|
|
65
|
+
files?: string[];
|
|
66
|
+
/** mpa: the static HTML pages served by path. */
|
|
67
|
+
pages?: string[];
|
|
68
|
+
/** mpa: the static assets (css/js/images) served by path. */
|
|
69
|
+
assets?: string[];
|
|
70
|
+
/** webapp: prebuilt frontend artifact contract. */
|
|
71
|
+
frontend?: AppFrontend;
|
|
72
|
+
/** webapp: optional Deno/Hono backend contract. */
|
|
73
|
+
backend?: AppBackend | null;
|
|
74
|
+
/** webapp SSR (DX-2): publish-probe logical path; required when frontend.fallback==="worker". */
|
|
75
|
+
ssrProbePath?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Machine-readable post-scaffold TODOs surfaced by `app new --json` (R2-11):
|
|
78
|
+
* e.g. database initialization for templates that ship db/schema.sql. The CLI
|
|
79
|
+
* never auto-runs DDL; these are reminders requiring explicit user action.
|
|
80
|
+
*/
|
|
81
|
+
nextSteps?: string[];
|
|
82
|
+
}
|
|
83
|
+
export interface AppManifest {
|
|
84
|
+
schemaVersion?: 1 | 2;
|
|
85
|
+
name: string;
|
|
86
|
+
slug: string;
|
|
87
|
+
template: string;
|
|
88
|
+
entrypoint: string;
|
|
89
|
+
verifyJwt: boolean;
|
|
90
|
+
createdAt: string;
|
|
91
|
+
/** Legacy spa/api/mpa modes and the v2 webapp mode are both supported. */
|
|
92
|
+
mode?: AppMode;
|
|
93
|
+
/** mpa: static HTML pages that must exist and be served by path. */
|
|
94
|
+
pages?: string[];
|
|
95
|
+
/** mpa: static assets that must exist and be served by path. */
|
|
96
|
+
assets?: string[];
|
|
97
|
+
/** webapp: frontend staging layout. */
|
|
98
|
+
frontend?: AppFrontend;
|
|
99
|
+
/** webapp: backend runtime contract; null for static-only apps. */
|
|
100
|
+
backend?: AppBackend | null;
|
|
101
|
+
/** Optional SSR publish-probe path (DX-2): logical path returning the SSR page. */
|
|
102
|
+
ssrProbePath?: string;
|
|
103
|
+
/** Local deployment state used by lifecycle commands; ignored by the runtime. */
|
|
104
|
+
deployment?: {
|
|
105
|
+
mountId: string;
|
|
106
|
+
candidateFunctionSlug?: string;
|
|
107
|
+
generation: number;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/** Replaced with the exact capability version only in the uploaded candidate. */
|
|
111
|
+
export declare const HONO_VERSION_PLACEHOLDER = "{{HONO_VERSION}}";
|
|
112
|
+
export declare class TemplatesNotFoundError extends Error {
|
|
113
|
+
constructor(message: string);
|
|
114
|
+
}
|
|
115
|
+
/** Walk up to find the package root holding templates/webapp/manifest.json. */
|
|
116
|
+
export declare function resolveTemplatesRoot(startDir?: string): string | null;
|
|
117
|
+
export declare function resolveTemplatesDir(startDir?: string): string;
|
|
118
|
+
export declare function listTemplates(startDir?: string): Promise<WebappTemplate[]>;
|
|
119
|
+
/**
|
|
120
|
+
* Synchronous template-id list for CLI help text (command registration is sync).
|
|
121
|
+
* Returns [] when the bundled templates are unavailable (standalone binary), so
|
|
122
|
+
* callers can fall back to a generic hint instead of throwing at startup.
|
|
123
|
+
*/
|
|
124
|
+
export declare function listTemplateIdsSync(startDir?: string): string[];
|
|
125
|
+
/** Read a template's entrypoint and substitute {{APP_NAME}} / {{SLUG}}. */
|
|
126
|
+
export declare function renderTemplate(templateId: string, vars: {
|
|
127
|
+
appName: string;
|
|
128
|
+
slug: string;
|
|
129
|
+
}, startDir?: string): Promise<{
|
|
130
|
+
entrypoint: string;
|
|
131
|
+
source: string;
|
|
132
|
+
}>;
|
|
133
|
+
/**
|
|
134
|
+
* Resolve a template definition and render every file it declares.
|
|
135
|
+
*
|
|
136
|
+
* Single-file templates (spa/api) render just the entrypoint; multi-file
|
|
137
|
+
* templates (mpa) render each entry in `files` (falling back to the entrypoint).
|
|
138
|
+
* Returns the template definition plus the rendered `{ name, source }` list.
|
|
139
|
+
*/
|
|
140
|
+
export declare function renderTemplateFiles(templateId: string, vars: {
|
|
141
|
+
appName: string;
|
|
142
|
+
slug: string;
|
|
143
|
+
}, startDir?: string): Promise<{
|
|
144
|
+
template: WebappTemplate;
|
|
145
|
+
files: Array<{
|
|
146
|
+
name: string;
|
|
147
|
+
source: string;
|
|
148
|
+
}>;
|
|
149
|
+
}>;
|
|
150
|
+
/**
|
|
151
|
+
* Scaffold a new app under `<dir>/<name>/`: writes the rendered entrypoint and an
|
|
152
|
+
* `app.json` manifest. Refuses to overwrite an existing entrypoint unless forced.
|
|
153
|
+
*/
|
|
154
|
+
export declare function scaffoldApp(opts: {
|
|
155
|
+
name: string;
|
|
156
|
+
slug: string;
|
|
157
|
+
template: string;
|
|
158
|
+
dir: string;
|
|
159
|
+
force?: boolean;
|
|
160
|
+
startDir?: string;
|
|
161
|
+
}): Promise<{
|
|
162
|
+
appDir: string;
|
|
163
|
+
files: string[];
|
|
164
|
+
manifest: AppManifest;
|
|
165
|
+
nextSteps: string[];
|
|
166
|
+
}>;
|
|
167
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/app/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;AACvD,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACj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C;IACZ,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAwD3F"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webapp template resolution & scaffolding for `pxbaas app`.
|
|
3
|
+
*
|
|
4
|
+
* Templates ship as package files under `apps/baas/templates/webapp/` (route A,
|
|
5
|
+
* same as the bundled skill). We resolve the package root by walking up from this
|
|
6
|
+
* module until we find `templates/webapp/manifest.json`. The standalone single-file
|
|
7
|
+
* binary does not carry these assets; scaffolding then fails with a clear error.
|
|
8
|
+
*/
|
|
9
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
10
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
11
|
+
import { dirname, join } from "node:path";
|
|
12
|
+
import { fileURLToPath } from "node:url";
|
|
13
|
+
/** Replaced with the exact capability version only in the uploaded candidate. */
|
|
14
|
+
export const HONO_VERSION_PLACEHOLDER = "{{HONO_VERSION}}";
|
|
15
|
+
export class TemplatesNotFoundError extends Error {
|
|
16
|
+
constructor(message) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.name = "TemplatesNotFoundError";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function moduleDir() {
|
|
22
|
+
return dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
}
|
|
24
|
+
/** Walk up to find the package root holding templates/webapp/manifest.json. */
|
|
25
|
+
export function resolveTemplatesRoot(startDir = moduleDir()) {
|
|
26
|
+
let dir = startDir;
|
|
27
|
+
for (let i = 0; i < 8; i++) {
|
|
28
|
+
if (existsSync(join(dir, "templates", "webapp", "manifest.json")))
|
|
29
|
+
return dir;
|
|
30
|
+
const parent = dirname(dir);
|
|
31
|
+
if (parent === dir)
|
|
32
|
+
break;
|
|
33
|
+
dir = parent;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
export function resolveTemplatesDir(startDir = moduleDir()) {
|
|
38
|
+
const root = resolveTemplatesRoot(startDir);
|
|
39
|
+
if (!root) {
|
|
40
|
+
throw new TemplatesNotFoundError("Bundled webapp templates not found. `pxbaas app new` requires the npm or source install (the standalone single-file binary does not bundle templates).");
|
|
41
|
+
}
|
|
42
|
+
return join(root, "templates", "webapp");
|
|
43
|
+
}
|
|
44
|
+
export async function listTemplates(startDir) {
|
|
45
|
+
const dir = resolveTemplatesDir(startDir);
|
|
46
|
+
const manifest = JSON.parse(await readFile(join(dir, "manifest.json"), "utf8"));
|
|
47
|
+
return manifest.templates ?? [];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Synchronous template-id list for CLI help text (command registration is sync).
|
|
51
|
+
* Returns [] when the bundled templates are unavailable (standalone binary), so
|
|
52
|
+
* callers can fall back to a generic hint instead of throwing at startup.
|
|
53
|
+
*/
|
|
54
|
+
export function listTemplateIdsSync(startDir) {
|
|
55
|
+
try {
|
|
56
|
+
const dir = resolveTemplatesDir(startDir);
|
|
57
|
+
const manifest = JSON.parse(readFileSync(join(dir, "manifest.json"), "utf8"));
|
|
58
|
+
return (manifest.templates ?? []).map((t) => t.id);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** Read a template's entrypoint and substitute {{APP_NAME}} / {{SLUG}}. */
|
|
65
|
+
export async function renderTemplate(templateId, vars, startDir) {
|
|
66
|
+
const dir = resolveTemplatesDir(startDir);
|
|
67
|
+
const templates = await listTemplates(startDir);
|
|
68
|
+
const tpl = templates.find((t) => t.id === templateId);
|
|
69
|
+
if (!tpl) {
|
|
70
|
+
throw new Error(`Unknown template '${templateId}'. Available: ${templates.map((t) => t.id).join(", ")}.`);
|
|
71
|
+
}
|
|
72
|
+
const raw = await readFile(join(dir, templateId, tpl.entrypoint), "utf8");
|
|
73
|
+
const source = substitute(raw, vars);
|
|
74
|
+
return { entrypoint: tpl.entrypoint, source };
|
|
75
|
+
}
|
|
76
|
+
function substitute(raw, vars) {
|
|
77
|
+
return raw
|
|
78
|
+
.replace(/\{\{APP_NAME\}\}/g, vars.appName)
|
|
79
|
+
.replace(/\{\{SLUG\}\}/g, vars.slug);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Resolve a template definition and render every file it declares.
|
|
83
|
+
*
|
|
84
|
+
* Single-file templates (spa/api) render just the entrypoint; multi-file
|
|
85
|
+
* templates (mpa) render each entry in `files` (falling back to the entrypoint).
|
|
86
|
+
* Returns the template definition plus the rendered `{ name, source }` list.
|
|
87
|
+
*/
|
|
88
|
+
export async function renderTemplateFiles(templateId, vars, startDir) {
|
|
89
|
+
const dir = resolveTemplatesDir(startDir);
|
|
90
|
+
const templates = await listTemplates(startDir);
|
|
91
|
+
const tpl = templates.find((t) => t.id === templateId);
|
|
92
|
+
if (!tpl) {
|
|
93
|
+
throw new Error(`Unknown template '${templateId}'. Available: ${templates.map((t) => t.id).join(", ")}.`);
|
|
94
|
+
}
|
|
95
|
+
const names = tpl.files && tpl.files.length > 0 ? tpl.files : [tpl.entrypoint];
|
|
96
|
+
const files = [];
|
|
97
|
+
for (const name of names) {
|
|
98
|
+
const raw = await readFile(join(dir, templateId, name), "utf8");
|
|
99
|
+
files.push({ name, source: substitute(raw, vars) });
|
|
100
|
+
}
|
|
101
|
+
return { template: tpl, files };
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Scaffold a new app under `<dir>/<name>/`: writes the rendered entrypoint and an
|
|
105
|
+
* `app.json` manifest. Refuses to overwrite an existing entrypoint unless forced.
|
|
106
|
+
*/
|
|
107
|
+
export async function scaffoldApp(opts) {
|
|
108
|
+
const appDir = join(opts.dir, opts.name);
|
|
109
|
+
const { template, files } = await renderTemplateFiles(opts.template, { appName: opts.name, slug: opts.slug }, opts.startDir);
|
|
110
|
+
const entrypoint = template.entrypoint;
|
|
111
|
+
const entryPath = join(appDir, entrypoint);
|
|
112
|
+
const manifestPath = join(appDir, "app.json");
|
|
113
|
+
if ((existsSync(entryPath) || existsSync(manifestPath)) && !opts.force) {
|
|
114
|
+
throw new Error(`${appDir} already exists and contains an app scaffold. Pass --force to overwrite.`);
|
|
115
|
+
}
|
|
116
|
+
await mkdir(appDir, { recursive: true });
|
|
117
|
+
const written = [];
|
|
118
|
+
for (const f of files) {
|
|
119
|
+
const target = join(appDir, f.name);
|
|
120
|
+
await mkdir(dirname(target), { recursive: true });
|
|
121
|
+
await writeFile(target, f.source, "utf8");
|
|
122
|
+
written.push(f.name);
|
|
123
|
+
}
|
|
124
|
+
const mode = template.mode ?? template.id;
|
|
125
|
+
const manifest = {
|
|
126
|
+
...(mode === "webapp" ? { schemaVersion: 2 } : {}),
|
|
127
|
+
name: opts.name,
|
|
128
|
+
slug: opts.slug,
|
|
129
|
+
template: opts.template,
|
|
130
|
+
entrypoint,
|
|
131
|
+
verifyJwt: template.backend?.verifyJwt ?? false,
|
|
132
|
+
createdAt: new Date().toISOString(),
|
|
133
|
+
mode,
|
|
134
|
+
};
|
|
135
|
+
if (mode === "mpa") {
|
|
136
|
+
manifest.pages = template.pages ?? [];
|
|
137
|
+
manifest.assets = template.assets ?? [];
|
|
138
|
+
}
|
|
139
|
+
if (mode === "webapp") {
|
|
140
|
+
manifest.frontend = template.frontend;
|
|
141
|
+
manifest.backend = template.backend ?? null;
|
|
142
|
+
// Carry the SSR publish-probe path so fallback="worker" templates survive
|
|
143
|
+
// scaffold -> deploy (R2-01); spec-lint requires it and the platform probe
|
|
144
|
+
// contract depends on it.
|
|
145
|
+
if (template.ssrProbePath)
|
|
146
|
+
manifest.ssrProbePath = template.ssrProbePath;
|
|
147
|
+
}
|
|
148
|
+
await writeFile(manifestPath, JSON.stringify(manifest, null, 2) + "\n", "utf8");
|
|
149
|
+
return { appDir, files: [...written, "app.json"], manifest, nextSteps: template.nextSteps ?? [] };
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/app/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA6GzC,iFAAiF;AACjF,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAE3D,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAED,SAAS,SAAS;IAChB,OAAO,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACjD,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,oBAAoB,CAClC,WAAmB,SAAS,EAAE;IAE9B,IAAI,GAAG,GAAG,QAAQ,CAAC;IACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;YAC/D,OAAO,GAAG,CAAC;QACb,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,M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;QAC/C,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,IAAI;KACL,CAAC;IACF,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,QAAQ,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;QACtC,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC;IAC1C,CAAC;IACD,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtB,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACtC,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,IAAI,IAAI,CAAC;QAC5C,0EAA0E;QAC1E,2EAA2E;QAC3E,0BAA0B;QAC1B,IAAI,QAAQ,CAAC,YAAY;YAAE,QAAQ,CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;IAC3E,CAAC;IACD,MAAM,SAAS,CACb,YAAY,EACZ,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EACxC,MAAM,CACP,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,EAAE,UAAU,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;AACpG,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-facing best-practice guides appended to `--help` output.
|
|
3
|
+
*
|
|
4
|
+
* Purpose: a coding agent that only knows "install pxbaas and deploy an app"
|
|
5
|
+
* must be able to discover the full recommended workflow from the CLI itself.
|
|
6
|
+
* These strings are flow-level only (command names, ordering, safety lines);
|
|
7
|
+
* the authoritative runtime/spec details stay in the bundled skills so the
|
|
8
|
+
* help text cannot drift into a stale manual.
|
|
9
|
+
*
|
|
10
|
+
* Help printing never runs action hooks, so both guides are readable without
|
|
11
|
+
* a profile, credentials, or network access.
|
|
12
|
+
*/
|
|
13
|
+
/** Short pointer appended to the top-level `pxbaas --help`. */
|
|
14
|
+
export declare const TOP_LEVEL_AGENT_GUIDE = "\nDevelop and deploy an app with pxbaas?\n Run 'pxbaas guide' for the recommended end-to-end workflow\n (skills, instance, capabilities, code, build, init, deploy, verify, share).\n";
|
|
15
|
+
/** Full recommended workflow printed by `pxbaas guide`. */
|
|
16
|
+
export declare const WORKFLOW_GUIDE = "\nRECOMMENDED WORKFLOW (humans and coding agents)\n\n1. Load the bundled skills\n pxbaas skill install --host <agent-id> # user scope (default)\n pxbaas skill install --host <agent-id> --scope project # repo-local, travels with code\n user ids: qoder|claude|cursor|qwen|hermes|codex|gemini|copilot|qwenworkcn|agents\n project ids add: trae|codebuddy|cline; other hosts: --dir <skills-dir>\n Read pxbaas-cli/SKILL.md and pxbaas-app-spec/SKILL.md. They define the command\n surface, runtime contract, templates and deploy rules. Use <command> --help for\n exact syntax; never invent flags.\n\n2. Bind an instance (agents must not run 'pxbaas login'; it needs a TTY)\n pxbaas profile ls --json\n pxbaas profile import <env-file> --name <profile> --json # env file from the user\n pxbaas provision --name <profile> --json # only with user approval\n Multi-tenant instance: never deploy into the default or shared tenant and\n never use global keys. With my explicit approval, read DASHBOARD_USERNAME /\n DASHBOARD_PASSWORD only from my env file, pipe them via stdin (never echo),\n and create one isolated tenant bound to a fresh profile:\n printf '%s\\n%s\\n' \"$DASHBOARD_USERNAME\" \"$DASHBOARD_PASSWORD\" | \\\n pxbaas tenant login --endpoint <endpoint> --user-stdin --password-stdin --json\n pxbaas tenant create --generate-id --dry-run --json # preview first\n pxbaas tenant create --generate-id --yes --as-profile --json # after approval\n Continue every later step with that new tenant profile. Without dashboard\n credentials: ask the operator for a tenant access file; never reuse an\n existing tenant or its keys.\n pxbaas --profile <profile> doctor --json # require 0 fail first\n\n3. Check instance capabilities before writing code\n pxbaas --profile <profile> app capabilities --json\n Confirm schemaVersion 2 webapp delivery, Deno/Hono support and the SSR library\n allow-list. Unsupported requirement: stop and report; do not downgrade silently.\n\n4. Scaffold and implement inside the spec\n pxbaas app templates --json\n Pick by each template's meta (delivery/render/frontend/backend/session/\n hasDb/coldStart); spa|api|mpa are legacy workers, not webapps.\n pxbaas app new <name> --template <id> --dir <apps-dir> --json\n Follow pxbaas-app-spec: prebuilt frontend only, Deno backend, no outbound egress,\n no credentials in code or artifacts. Build the frontend when the template needs it.\n\n5. Preview database changes, then get one scoped approval\n pxbaas --profile <profile> app db-init <name> --dir <apps-dir> --dry-run --json\n Table names are fixed by the template: a new app name does not isolate data. Stop\n on unrelated existing tables. After approval:\n pxbaas --profile <profile> app db-init <name> --dir <apps-dir> --yes --json\n\n6. Preflight, then deploy\n pxbaas --profile <profile> app deploy <name> --dir <apps-dir> --dry-run --json\n pxbaas --profile <profile> app deploy <name> --dir <apps-dir> --json\n\n7. Recover by stage, never by restarting everything\n Upload ok but publish timed out (APP_SSR_PROBE_FAILED): retry the SAME candidate,\n max 3 times, 10s apart: pxbaas app publish <name> --dir <apps-dir> --json\n APP_MOUNT_CONFLICT: recover the real mount id from this run's output or local\n state; adopt/destroy only with explicit approval. Never guess ids or generations.\n\n8. Verify and deliver\n pxbaas --profile <profile> app verify <name> --dir <apps-dir> --json\n pxbaas --profile <profile> app url <name> --dir <apps-dir> --json\n Report the returned URL with its Public/Preview classification. A local HTTP 200\n does not prove access from other networks.\n The published URL and any share link (app share create) are gated by the instance\n IP whitelist, so AFTER publishing or sharing PROACTIVELY ask the user whether the\n recipient's egress IP must be allowed, then act by instance kind:\n - Zero trial instance (profile source=zero): offer to append it now \u2014 preview with\n 'pxbaas instance whitelist get --json', then ON APPROVAL\n 'pxbaas instance whitelist add <recipient-ip-or-cidr> --json' (append-only; the\n add itself must originate from an already-allowed IP).\n - Purchased/production instance: the CLI cannot edit its whitelist (instance\n whitelist is Zero-only); remind the user to add the recipient's egress IP via the\n cloud console / control plane promptly, or the shared URL stays unreachable.\n\nCOMMON FAILURES AND THE ONLY SANCTIONED RESPONSES\n- No active profile or not logged in: bind an instance per step 2; never run\n 'pxbaas login' and never paste keys into chat.\n- doctor fail or expired key: stop and report; do not swap in other\n credentials or hand-edit the env file.\n- TENANT_CREDENTIAL_GAP on import: the env lacks tenant-level keys; with my\n approval use the Studio-credential tenant-create chain in step 2, or ask the\n operator for a tenant access file; never use global keys or the default tenant.\n- 401/403 on data or management calls: wrong role or tenant for this profile;\n re-check 'pxbaas whoami --json'; do not broaden privileges.\n- APP_CAPABILITY_UNSUPPORTED or a missing ssrLibs entry: this instance cannot\n run the app shape; stop and report; do not downgrade template or mode.\n- spec-lint blocker: fix the code per the cited pxbaas-app-spec reference;\n --skip-spec-check is never a fix.\n- Quota blocker, or 429/503 from Zero provisioning: stop; do not loop retries\n and do not delete functions to free slots without approval.\n- db-init stops on the first error and never rolls back: report which\n statements completed; do not re-run blindly or hand-write rollback SQL.\n- 409 'Candidate is already active': confirm it is this run's candidate, then\n treat the publish as success.\n- APP_PUBLISH_CONFLICT (stale generation): stop and reconcile from server\n state; never guess a generation.\n- 502/503 right after publish: sandbox cold start; retry the read request\n only, up to 3 times; do not redeploy.\n- Endpoint unreachable or doctor connectivity fail: separate DNS/firewall\n problems from intranet-only endpoints; re-check with 'pxbaas status --json';\n import VPC-internal URLs with --intranet; do not hand-edit the endpoint.\n- Zero instance rejects this machine: the instance is IP-whitelisted to the\n claiming egress IP; run pxbaas on the claiming machine or re-provision with\n --whitelist-ip; do not treat it as an app defect.\n- Others cannot open the URL while you can: almost always the instance IP whitelist\n (or Preview exposure). State the limitation; for a Zero instance offer\n 'pxbaas instance whitelist add <their-ip>', for a purchased instance tell the user\n to add it via the cloud console / control plane. Do not promise public access.\n\nSafety: never print or embed credentials; never use --skip-spec-check; never delete\nor adopt resources to work around a blocker.\n";
|
|
17
|
+
//# sourceMappingURL=help-guides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-guides.d.ts","sourceRoot":"","sources":["../../src/cli/help-guides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,+DAA+D;AAC/D,eAAO,MAAM,qBAAqB,4LAIjC,CAAC;AAEF,2DAA2D;AAC3D,eAAO,MAAM,cAAc,m4NA+G1B,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-facing best-practice guides appended to `--help` output.
|
|
3
|
+
*
|
|
4
|
+
* Purpose: a coding agent that only knows "install pxbaas and deploy an app"
|
|
5
|
+
* must be able to discover the full recommended workflow from the CLI itself.
|
|
6
|
+
* These strings are flow-level only (command names, ordering, safety lines);
|
|
7
|
+
* the authoritative runtime/spec details stay in the bundled skills so the
|
|
8
|
+
* help text cannot drift into a stale manual.
|
|
9
|
+
*
|
|
10
|
+
* Help printing never runs action hooks, so both guides are readable without
|
|
11
|
+
* a profile, credentials, or network access.
|
|
12
|
+
*/
|
|
13
|
+
/** Short pointer appended to the top-level `pxbaas --help`. */
|
|
14
|
+
export const TOP_LEVEL_AGENT_GUIDE = `
|
|
15
|
+
Develop and deploy an app with pxbaas?
|
|
16
|
+
Run 'pxbaas guide' for the recommended end-to-end workflow
|
|
17
|
+
(skills, instance, capabilities, code, build, init, deploy, verify, share).
|
|
18
|
+
`;
|
|
19
|
+
/** Full recommended workflow printed by `pxbaas guide`. */
|
|
20
|
+
export const WORKFLOW_GUIDE = `
|
|
21
|
+
RECOMMENDED WORKFLOW (humans and coding agents)
|
|
22
|
+
|
|
23
|
+
1. Load the bundled skills
|
|
24
|
+
pxbaas skill install --host <agent-id> # user scope (default)
|
|
25
|
+
pxbaas skill install --host <agent-id> --scope project # repo-local, travels with code
|
|
26
|
+
user ids: qoder|claude|cursor|qwen|hermes|codex|gemini|copilot|qwenworkcn|agents
|
|
27
|
+
project ids add: trae|codebuddy|cline; other hosts: --dir <skills-dir>
|
|
28
|
+
Read pxbaas-cli/SKILL.md and pxbaas-app-spec/SKILL.md. They define the command
|
|
29
|
+
surface, runtime contract, templates and deploy rules. Use <command> --help for
|
|
30
|
+
exact syntax; never invent flags.
|
|
31
|
+
|
|
32
|
+
2. Bind an instance (agents must not run 'pxbaas login'; it needs a TTY)
|
|
33
|
+
pxbaas profile ls --json
|
|
34
|
+
pxbaas profile import <env-file> --name <profile> --json # env file from the user
|
|
35
|
+
pxbaas provision --name <profile> --json # only with user approval
|
|
36
|
+
Multi-tenant instance: never deploy into the default or shared tenant and
|
|
37
|
+
never use global keys. With my explicit approval, read DASHBOARD_USERNAME /
|
|
38
|
+
DASHBOARD_PASSWORD only from my env file, pipe them via stdin (never echo),
|
|
39
|
+
and create one isolated tenant bound to a fresh profile:
|
|
40
|
+
printf '%s\\n%s\\n' "$DASHBOARD_USERNAME" "$DASHBOARD_PASSWORD" | \\
|
|
41
|
+
pxbaas tenant login --endpoint <endpoint> --user-stdin --password-stdin --json
|
|
42
|
+
pxbaas tenant create --generate-id --dry-run --json # preview first
|
|
43
|
+
pxbaas tenant create --generate-id --yes --as-profile --json # after approval
|
|
44
|
+
Continue every later step with that new tenant profile. Without dashboard
|
|
45
|
+
credentials: ask the operator for a tenant access file; never reuse an
|
|
46
|
+
existing tenant or its keys.
|
|
47
|
+
pxbaas --profile <profile> doctor --json # require 0 fail first
|
|
48
|
+
|
|
49
|
+
3. Check instance capabilities before writing code
|
|
50
|
+
pxbaas --profile <profile> app capabilities --json
|
|
51
|
+
Confirm schemaVersion 2 webapp delivery, Deno/Hono support and the SSR library
|
|
52
|
+
allow-list. Unsupported requirement: stop and report; do not downgrade silently.
|
|
53
|
+
|
|
54
|
+
4. Scaffold and implement inside the spec
|
|
55
|
+
pxbaas app templates --json
|
|
56
|
+
Pick by each template's meta (delivery/render/frontend/backend/session/
|
|
57
|
+
hasDb/coldStart); spa|api|mpa are legacy workers, not webapps.
|
|
58
|
+
pxbaas app new <name> --template <id> --dir <apps-dir> --json
|
|
59
|
+
Follow pxbaas-app-spec: prebuilt frontend only, Deno backend, no outbound egress,
|
|
60
|
+
no credentials in code or artifacts. Build the frontend when the template needs it.
|
|
61
|
+
|
|
62
|
+
5. Preview database changes, then get one scoped approval
|
|
63
|
+
pxbaas --profile <profile> app db-init <name> --dir <apps-dir> --dry-run --json
|
|
64
|
+
Table names are fixed by the template: a new app name does not isolate data. Stop
|
|
65
|
+
on unrelated existing tables. After approval:
|
|
66
|
+
pxbaas --profile <profile> app db-init <name> --dir <apps-dir> --yes --json
|
|
67
|
+
|
|
68
|
+
6. Preflight, then deploy
|
|
69
|
+
pxbaas --profile <profile> app deploy <name> --dir <apps-dir> --dry-run --json
|
|
70
|
+
pxbaas --profile <profile> app deploy <name> --dir <apps-dir> --json
|
|
71
|
+
|
|
72
|
+
7. Recover by stage, never by restarting everything
|
|
73
|
+
Upload ok but publish timed out (APP_SSR_PROBE_FAILED): retry the SAME candidate,
|
|
74
|
+
max 3 times, 10s apart: pxbaas app publish <name> --dir <apps-dir> --json
|
|
75
|
+
APP_MOUNT_CONFLICT: recover the real mount id from this run's output or local
|
|
76
|
+
state; adopt/destroy only with explicit approval. Never guess ids or generations.
|
|
77
|
+
|
|
78
|
+
8. Verify and deliver
|
|
79
|
+
pxbaas --profile <profile> app verify <name> --dir <apps-dir> --json
|
|
80
|
+
pxbaas --profile <profile> app url <name> --dir <apps-dir> --json
|
|
81
|
+
Report the returned URL with its Public/Preview classification. A local HTTP 200
|
|
82
|
+
does not prove access from other networks.
|
|
83
|
+
The published URL and any share link (app share create) are gated by the instance
|
|
84
|
+
IP whitelist, so AFTER publishing or sharing PROACTIVELY ask the user whether the
|
|
85
|
+
recipient's egress IP must be allowed, then act by instance kind:
|
|
86
|
+
- Zero trial instance (profile source=zero): offer to append it now — preview with
|
|
87
|
+
'pxbaas instance whitelist get --json', then ON APPROVAL
|
|
88
|
+
'pxbaas instance whitelist add <recipient-ip-or-cidr> --json' (append-only; the
|
|
89
|
+
add itself must originate from an already-allowed IP).
|
|
90
|
+
- Purchased/production instance: the CLI cannot edit its whitelist (instance
|
|
91
|
+
whitelist is Zero-only); remind the user to add the recipient's egress IP via the
|
|
92
|
+
cloud console / control plane promptly, or the shared URL stays unreachable.
|
|
93
|
+
|
|
94
|
+
COMMON FAILURES AND THE ONLY SANCTIONED RESPONSES
|
|
95
|
+
- No active profile or not logged in: bind an instance per step 2; never run
|
|
96
|
+
'pxbaas login' and never paste keys into chat.
|
|
97
|
+
- doctor fail or expired key: stop and report; do not swap in other
|
|
98
|
+
credentials or hand-edit the env file.
|
|
99
|
+
- TENANT_CREDENTIAL_GAP on import: the env lacks tenant-level keys; with my
|
|
100
|
+
approval use the Studio-credential tenant-create chain in step 2, or ask the
|
|
101
|
+
operator for a tenant access file; never use global keys or the default tenant.
|
|
102
|
+
- 401/403 on data or management calls: wrong role or tenant for this profile;
|
|
103
|
+
re-check 'pxbaas whoami --json'; do not broaden privileges.
|
|
104
|
+
- APP_CAPABILITY_UNSUPPORTED or a missing ssrLibs entry: this instance cannot
|
|
105
|
+
run the app shape; stop and report; do not downgrade template or mode.
|
|
106
|
+
- spec-lint blocker: fix the code per the cited pxbaas-app-spec reference;
|
|
107
|
+
--skip-spec-check is never a fix.
|
|
108
|
+
- Quota blocker, or 429/503 from Zero provisioning: stop; do not loop retries
|
|
109
|
+
and do not delete functions to free slots without approval.
|
|
110
|
+
- db-init stops on the first error and never rolls back: report which
|
|
111
|
+
statements completed; do not re-run blindly or hand-write rollback SQL.
|
|
112
|
+
- 409 'Candidate is already active': confirm it is this run's candidate, then
|
|
113
|
+
treat the publish as success.
|
|
114
|
+
- APP_PUBLISH_CONFLICT (stale generation): stop and reconcile from server
|
|
115
|
+
state; never guess a generation.
|
|
116
|
+
- 502/503 right after publish: sandbox cold start; retry the read request
|
|
117
|
+
only, up to 3 times; do not redeploy.
|
|
118
|
+
- Endpoint unreachable or doctor connectivity fail: separate DNS/firewall
|
|
119
|
+
problems from intranet-only endpoints; re-check with 'pxbaas status --json';
|
|
120
|
+
import VPC-internal URLs with --intranet; do not hand-edit the endpoint.
|
|
121
|
+
- Zero instance rejects this machine: the instance is IP-whitelisted to the
|
|
122
|
+
claiming egress IP; run pxbaas on the claiming machine or re-provision with
|
|
123
|
+
--whitelist-ip; do not treat it as an app defect.
|
|
124
|
+
- Others cannot open the URL while you can: almost always the instance IP whitelist
|
|
125
|
+
(or Preview exposure). State the limitation; for a Zero instance offer
|
|
126
|
+
'pxbaas instance whitelist add <their-ip>', for a purchased instance tell the user
|
|
127
|
+
to add it via the cloud console / control plane. Do not promise public access.
|
|
128
|
+
|
|
129
|
+
Safety: never print or embed credentials; never use --skip-spec-check; never delete
|
|
130
|
+
or adopt resources to work around a blocker.
|
|
131
|
+
`;
|
|
132
|
+
//# sourceMappingURL=help-guides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-guides.js","sourceRoot":"","sources":["../../src/cli/help-guides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;CAIpC,CAAC;AAEF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+G7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/cli/root.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmCpC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkDvD"}
|
package/dist/cli/root.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Import command registrations
|
|
2
|
+
import { registerLoginCommand } from '../commands/login/index.js';
|
|
3
|
+
import { registerLogoutCommand } from '../commands/logout/index.js';
|
|
4
|
+
import { registerWhoamiCommand } from '../commands/whoami/index.js';
|
|
5
|
+
import { registerStatusCommand } from '../commands/status/index.js';
|
|
6
|
+
import { registerDoctorCommand } from '../commands/doctor/index.js';
|
|
7
|
+
import { registerProfileCommand } from '../commands/profile/index.js';
|
|
8
|
+
import { registerDbCommands } from '../commands/db/index.js';
|
|
9
|
+
import { registerGenCommands } from '../commands/gen/index.js';
|
|
10
|
+
import { registerFunctionsCommands } from '../commands/functions/index.js';
|
|
11
|
+
import { registerStorageCommands } from '../commands/storage/index.js';
|
|
12
|
+
import { registerAuthCommands } from '../commands/auth/index.js';
|
|
13
|
+
import { registerDataCommands } from '../commands/data/index.js';
|
|
14
|
+
import { registerRestCommand } from '../commands/rest/index.js';
|
|
15
|
+
import { registerCompletionCommand } from '../commands/completion/index.js';
|
|
16
|
+
import { registerSkillCommands } from '../commands/skill/index.js';
|
|
17
|
+
import { registerGuideCommand } from '../commands/guide/index.js';
|
|
18
|
+
import { registerInstanceCommands } from '../commands/instance/index.js';
|
|
19
|
+
import { registerAppCommands } from '../commands/app/index.js';
|
|
20
|
+
import { registerTenantCommands } from '../commands/tenant/index.js';
|
|
21
|
+
import { maybePrintSkillHint, maybePrintProvisionHint } from '../skill/hint.js';
|
|
22
|
+
/** Build the invoked command path (e.g. "db query") from an action command. */
|
|
23
|
+
function commandPath(program, actionCommand) {
|
|
24
|
+
const parts = [];
|
|
25
|
+
let c = actionCommand;
|
|
26
|
+
while (c && c !== program && c.name()) {
|
|
27
|
+
parts.unshift(c.name());
|
|
28
|
+
c = c.parent;
|
|
29
|
+
}
|
|
30
|
+
return parts.join(' ');
|
|
31
|
+
}
|
|
32
|
+
export function registerCommands(program) {
|
|
33
|
+
// First-run nudge: surface `pxbaas skill install` once when an Agent host is
|
|
34
|
+
// detected but the skill is not installed yet. Never blocks the command.
|
|
35
|
+
program.hook('preAction', async (_thisCommand, actionCommand) => {
|
|
36
|
+
try {
|
|
37
|
+
const path = commandPath(program, actionCommand);
|
|
38
|
+
const json = program.opts().json;
|
|
39
|
+
await maybePrintProvisionHint({ json, commandPath: path });
|
|
40
|
+
await maybePrintSkillHint({ json, commandPath: path });
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// cosmetic only — ignore
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
// Phase 1 (M2): Onboarding & diagnostics
|
|
47
|
+
registerLoginCommand(program);
|
|
48
|
+
registerLogoutCommand(program);
|
|
49
|
+
registerWhoamiCommand(program);
|
|
50
|
+
registerStatusCommand(program);
|
|
51
|
+
registerDoctorCommand(program);
|
|
52
|
+
registerProfileCommand(program);
|
|
53
|
+
// Phase 1 (M3): Database & types
|
|
54
|
+
registerDbCommands(program);
|
|
55
|
+
registerGenCommands(program);
|
|
56
|
+
// Phase 2 (M4): Functions & storage
|
|
57
|
+
registerFunctionsCommands(program);
|
|
58
|
+
registerStorageCommands(program);
|
|
59
|
+
registerCompletionCommand(program);
|
|
60
|
+
// Phase 3 (M5): Auth users, data ops, REST passthrough
|
|
61
|
+
registerAuthCommands(program);
|
|
62
|
+
registerDataCommands(program);
|
|
63
|
+
registerRestCommand(program);
|
|
64
|
+
// Tooling: install the bundled Agent Skill into supported hosts (offline)
|
|
65
|
+
registerSkillCommands(program);
|
|
66
|
+
// Best practice: printable end-to-end develop/deploy/verify/share workflow
|
|
67
|
+
registerGuideCommand(program);
|
|
68
|
+
// Onboarding: claim/manage disposable Zero BaaS instances
|
|
69
|
+
registerInstanceCommands(program);
|
|
70
|
+
// Webapp demos: scaffold/deploy/verify on edge functions
|
|
71
|
+
registerAppCommands(program);
|
|
72
|
+
// Platform-operator tenant management + dashboard credentials (multi-tenant)
|
|
73
|
+
registerTenantCommands(program);
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/cli/root.ts"],"names":[],"mappings":"AAEA,+BAA+B;AAC/B,OAAO,EAAE,o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CAAC,OAAO,CAAC,CAAC;IAEnC,uDAAuD;IACvD,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC9B,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC9B,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAE7B,0EAA0E;IAC1E,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAE/B,2EAA2E;IAC3E,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAE9B,0DAA0D;IAC1D,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAElC,yDAAyD;IACzD,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAE7B,6EAA6E;IAC7E,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* `pxbaas app` — scaffold, deploy, publish, verify, and share legacy Edge Function
|
|
4
|
+
* demos or schemaVersion 2 Webapps. Webapp deploys add capability gating, artifact
|
|
5
|
+
* linting, immutable candidates, and generation-CAS lifecycle operations.
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerAppCommands(program: Command): void;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuDpC;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqQ1D"}
|