@lukoweb/apitogo 0.2.30 → 0.2.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/cli/cli.js +794 -248
  2. package/dist/declarations/app/entry.server.d.ts +2 -2
  3. package/dist/declarations/app/main.d.ts +3 -1
  4. package/dist/declarations/cli/platform/client/platform-api.d.ts +16 -5
  5. package/dist/declarations/cli/platform/helpers/deploy-artifact-hash.d.ts +1 -1
  6. package/dist/declarations/cli/platform/helpers/package-files.d.ts +1 -1
  7. package/dist/declarations/cli/platform/helpers/platform-plan.d.ts +1 -1
  8. package/dist/declarations/cli/platform/helpers/zip.d.ts +1 -1
  9. package/dist/declarations/cli/platform/tools/infrastructure.d.ts +0 -4
  10. package/dist/declarations/config/effective-redirects.d.ts +6 -0
  11. package/dist/declarations/config/header-navigation-guard.d.ts +2 -0
  12. package/dist/declarations/config/resolve-modules.d.ts +1 -4
  13. package/dist/declarations/config/validators/HeaderNavigationSchema.d.ts +1 -2
  14. package/docs/cli/commands.md +151 -75
  15. package/docs/cli/go-live.md +135 -123
  16. package/docs/cli/walkthrough.md +40 -1
  17. package/docs/configuration/gateway.md +52 -0
  18. package/docs/guides/customer-account.md +33 -2
  19. package/docs/mcp/tools.md +101 -102
  20. package/package.json +2 -1
  21. package/src/app/demo.tsx +78 -77
  22. package/src/app/entry.client.tsx +115 -107
  23. package/src/app/entry.server.tsx +164 -160
  24. package/src/app/main.tsx +175 -167
  25. package/src/app/standalone.tsx +61 -60
  26. package/src/config/effective-redirects.ts +31 -0
  27. package/src/config/header-navigation-guard.ts +13 -0
  28. package/src/config/resolve-modules.ts +331 -354
  29. package/src/config/v2/home-redirect.ts +104 -98
  30. package/src/config/v2/index.ts +127 -126
  31. package/src/config/v2/ledger.ts +242 -235
  32. package/src/config/v2/resolve.ts +12 -4
  33. package/src/config/v2/rules.ts +716 -714
  34. package/src/config/v2/services.ts +799 -663
  35. package/src/config/v2/workspace.ts +17 -1
  36. package/src/config/validators/HeaderNavigationSchema.ts +42 -44
  37. package/src/lib/assets/powered-by-icon.png +0 -0
  38. package/src/lib/authentication/providers/dev-portal-auth-pages.tsx +667 -602
  39. package/src/lib/authentication/providers/dev-portal.tsx +476 -448
  40. package/src/lib/components/HeaderNavigation.tsx +176 -176
  41. package/src/lib/components/MobileTopNavigation.tsx +283 -283
  42. package/src/lib/components/navigation/PoweredByZudoku.tsx +42 -39
  43. package/src/vite/plugin-offroot-resolve.ts +68 -67
  44. package/src/vite/prerender/prerender.ts +242 -242
@@ -1,7 +1,7 @@
1
1
  import { type RouteObject } from "react-router";
2
2
  import "vite/modulepreload-polyfill";
3
- import { getRoutesByConfig } from "./main.js";
4
- export { getRoutesByConfig };
3
+ import type { ApitogoConfig } from "../config/config.js";
4
+ export declare const getRoutesByConfig: (config: ApitogoConfig) => RouteObject[];
5
5
  export declare const handleRequest: ({ template, request, routes, basePath, bypassProtection, }: {
6
6
  template: string;
7
7
  request: Request;
@@ -2,6 +2,7 @@ import type { RouteObject } from "react-router";
2
2
  import type { HighlighterCore } from "shiki";
3
3
  import "virtual:zudoku-theme.css";
4
4
  import type { ApitogoConfig } from "../config/config.js";
5
+ import type { ResolvedModulesConfig } from "../config/validators/ModulesSchema.js";
5
6
  import "./main.css";
6
7
  import "./polyfills.js";
7
8
  import type { ZudokuContextOptions } from "../lib/core/ZudokuContext.js";
@@ -99,4 +100,5 @@ export declare const getRoutesByOptions: (options: ZudokuContextOptions, enableS
99
100
  ErrorBoundary?: (() => Promise<import("react").ComponentType<{}> | null | undefined>) | undefined;
100
101
  }) | import("react-router").LazyRouteFunction<RouteObject>;
101
102
  })[];
102
- export declare const getRoutesByConfig: (config: ApitogoConfig) => RouteObject[];
103
+ export type ModulesResolver = (config: ApitogoConfig) => ResolvedModulesConfig;
104
+ export declare const getRoutesByConfig: (config: ApitogoConfig, resolveModules: ModulesResolver) => RouteObject[];
@@ -203,10 +203,8 @@ export interface ProjectSubscriptionDto {
203
203
  availableCurrencies: string[];
204
204
  }
205
205
  export interface CheckoutSessionResponse {
206
- url: string;
207
- }
208
- export interface DeploymentTokenResponse {
209
- token: string;
206
+ url: string | null;
207
+ granted?: boolean;
210
208
  }
211
209
  export interface ProvisioningJobListItemDto {
212
210
  id: string;
@@ -443,6 +441,12 @@ export interface ProjectIdentityRequestBody {
443
441
  portalRedirectUris: string[];
444
442
  nativeSignup?: boolean;
445
443
  }
444
+ export interface DevPortalBillingDto {
445
+ jobId: string;
446
+ mode: string;
447
+ webhookUrl: string;
448
+ hasWebhookSecret: boolean;
449
+ }
446
450
  export interface DevPortalIdentityLinkDto {
447
451
  jobId: string;
448
452
  }
@@ -525,12 +529,12 @@ export declare class PlatformApiClient {
525
529
  createCheckoutSession(projectId: string, body: {
526
530
  planSlug: string;
527
531
  currency?: string;
532
+ skipPayment?: boolean;
528
533
  }): Promise<CheckoutSessionResponse>;
529
534
  getLatestAzureInfrastructureStatus(projectId: string): Promise<DeployStatusResponse>;
530
535
  retryAzureInfrastructure(projectId: string): Promise<StartDeployResponse>;
531
536
  getAzureInfrastructureDeployStatus(projectId: string, jobId: string): Promise<DeployStatusResponse>;
532
537
  listProvisioningJobs(projectId: string): Promise<ProvisioningJobListResponse>;
533
- getDeploymentToken(projectId: string, regenerate?: boolean): Promise<DeploymentTokenResponse>;
534
538
  uploadStaticWebDeployment(projectId: string, archivePath: string, env?: string): Promise<StaticWebSiteDeploymentDto>;
535
539
  listSecrets(projectId: string): Promise<ProjectSecretListResponse>;
536
540
  setSecret(projectId: string, name: string, value: string): Promise<SetProjectSecretResponse>;
@@ -560,6 +564,13 @@ export declare class PlatformApiClient {
560
564
  deleteProjectIdentityConnection(projectId: string, connectionId: string): Promise<void>;
561
565
  getProjectIdentity(projectId: string): Promise<ProjectIdentityDto | null>;
562
566
  deleteProjectIdentity(projectId: string): Promise<ProjectIdentityDto | null>;
567
+ putDevPortalBilling(projectId: string, body: {
568
+ provider: "stripe" | "none";
569
+ apiKey?: string;
570
+ webhookSecret?: string;
571
+ successUrl?: string;
572
+ cancelUrl?: string;
573
+ }): Promise<DevPortalBillingDto>;
563
574
  linkDevPortalIdentity(projectId: string): Promise<DevPortalIdentityLinkDto>;
564
575
  getDevPortalBackend(projectId: string): Promise<DevPortalBackendDto | null>;
565
576
  getDevPortalSetupStatus(projectId: string): Promise<DevPortalSetupStatusDto>;
@@ -1,6 +1,6 @@
1
1
  export declare function sha256File(filePath: string): Promise<string>;
2
2
  export declare function sha256Buffer(data: Buffer | string): Promise<string>;
3
- export declare function hashDirectoryContents(rootDirectory: string): Promise<string>;
3
+ export declare function hashDirectoryContents(rootDirectory: string, extraExcludes?: readonly string[]): Promise<string>;
4
4
  export declare function hashDevPortalSiteSources(siteDirectory: string, options?: {
5
5
  gatewayUrl?: string | null;
6
6
  }): Promise<string>;
@@ -1 +1 @@
1
- export declare function collectPackageableFiles(sourceDirectory: string): Promise<string[]>;
1
+ export declare function collectPackageableFiles(sourceDirectory: string, extraExcludes?: readonly string[]): Promise<string[]>;
@@ -3,7 +3,7 @@ import type { ProgressReporter } from "./progress.js";
3
3
  export declare function isPlatformPlanUnselected(planTier: string | undefined | null): boolean;
4
4
  export declare function isPlatformPlanSelected(subscription: ProjectSubscriptionDto): boolean;
5
5
  export declare function isPaidPlanTier(planTier: string): boolean;
6
- export declare function isPaidPlanActive(subscription: ProjectSubscriptionDto): boolean;
6
+ export declare function isPaidPlanActive(subscription: Pick<ProjectSubscriptionDto, "planTier" | "subscriptionLifecycle">): boolean;
7
7
  export declare function isPlatformPlanReady(subscription: ProjectSubscriptionDto): boolean;
8
8
  export interface PlatformPlanWaitResult {
9
9
  status: "succeeded" | "timeout" | "failed";
@@ -2,5 +2,5 @@ export interface PackageBackendResult {
2
2
  zipPath: string;
3
3
  byteSize: number;
4
4
  }
5
- export declare function packageBackendDirectory(sourceDirectory: string): Promise<PackageBackendResult>;
5
+ export declare function packageBackendDirectory(sourceDirectory: string, extraExcludes?: readonly string[]): Promise<PackageBackendResult>;
6
6
  export declare function cleanupZip(zipPath: string): Promise<void>;
@@ -21,10 +21,6 @@ export declare function handleRetryAzureInfrastructure(client: PlatformApiClient
21
21
  export declare function handleListProvisioningJobs(client: PlatformApiClient, config: ApitogoConfig, args: {
22
22
  projectId?: string;
23
23
  }): Promise<string>;
24
- export declare function handleGetDeploymentToken(client: PlatformApiClient, config: ApitogoConfig, args: {
25
- projectId?: string;
26
- regenerate?: boolean;
27
- }): Promise<string>;
28
24
  export declare function handleGetCustomDomain(client: PlatformApiClient, config: ApitogoConfig, args: {
29
25
  projectId?: string;
30
26
  }): Promise<string>;
@@ -0,0 +1,6 @@
1
+ import type { ResolvedModulesConfig } from "./validators/ModulesSchema.js";
2
+ import type { ZudokuConfig } from "./validators/ZudokuConfig.js";
3
+ export declare const getEffectiveRedirects: (config: ZudokuConfig, resolved: ResolvedModulesConfig) => {
4
+ from: string;
5
+ to: string;
6
+ }[];
@@ -0,0 +1,2 @@
1
+ import type { HeaderNavGroup, HeaderNavItem, HeaderNavLinkItem } from "./validators/HeaderNavigationSchema.js";
2
+ export declare const isHeaderNavGroup: (item: HeaderNavItem | HeaderNavLinkItem | HeaderNavGroup) => item is HeaderNavGroup;
@@ -8,10 +8,7 @@ export declare const resolveDashboardContent: (content?: DashboardContentConfig)
8
8
  export declare const resolveProfileContent: (content?: ProfileContentConfig) => ResolvedProfileContent;
9
9
  export declare const resolvePlansContent: (content?: PlansContentConfig) => ResolvedPlansContent;
10
10
  export declare const resolveModulesConfig: (config: ZudokuConfig) => ResolvedModulesConfig;
11
- export declare const getEffectiveRedirects: (config: ZudokuConfig, resolved: ResolvedModulesConfig) => {
12
- from: string;
13
- to: string;
14
- }[];
11
+ export { getEffectiveRedirects } from "./effective-redirects.js";
15
12
  export declare const getEffectiveDocsConfig: (_config: ZudokuConfig, resolved: ResolvedModulesConfig) => {
16
13
  files: string | string[];
17
14
  publishMarkdown: boolean;
@@ -15800,9 +15800,8 @@ export declare const HeaderNavigationSchema: z.ZodArray<z.ZodUnion<readonly [z.Z
15800
15800
  }, z.core.$strip>>;
15801
15801
  }, z.core.$strip>]>>;
15802
15802
  }, z.core.$strip>]>>;
15803
- export declare const isHeaderNavGroup: (item: HeaderNavItem | HeaderNavLinkItem | HeaderNavGroup) => item is HeaderNavGroup;
15803
+ export { isHeaderNavGroup } from "../header-navigation-guard.js";
15804
15804
  export type HeaderNavLinkItem = z.infer<typeof HeaderNavLinkItemSchema>;
15805
15805
  export type HeaderNavGroup = z.infer<typeof HeaderNavGroupSchema>;
15806
15806
  export type HeaderNavItem = z.infer<typeof HeaderNavItemSchema>;
15807
15807
  export type HeaderNavigation = z.infer<typeof HeaderNavigationSchema>;
15808
- export {};
@@ -1,75 +1,151 @@
1
- ---
2
- title: CLI commands
3
- description: APItoGo CLI command catalog by category.
4
- sidebar_icon: wrench
5
- ---
6
-
7
- Commands are exposed by the **`apitogo`** binary (`@lukoweb/apitogo`). The CLI is the **source of
8
- truth** for init, config, deploy, status, teardown, project create, and check. MCP tools spawn these
9
- same commands so agents and humans get identical behavior.
10
-
11
- ## Lifecycle (prefer these)
12
-
13
- | Command | Role |
14
- | ---------------- | --------------------------------------------------------------------- |
15
- | `init` | Scaffold portal (default `./dev-portal`; OpenAPI discovery + secrets) |
16
- | `config` | Write or update `apitogo.config.json` (interactive or flags) |
17
- | `run` | Local preview server |
18
- | `build` | Production build (`--preview` to serve locally) |
19
- | `check` | Publish readiness (secrets, manifest, site validation) |
20
- | `project create` | Create a platform project (plan unselected) |
21
- | `deploy` | Publish config to platform (apihub + portal) |
22
- | `status` | Account, project, and live readiness |
23
- | `teardown --yes` | Delete the linked platform project |
24
-
25
- ## Scaffold and config
26
-
27
- | Command | Role |
28
- | ------------ | ----------------------------------------------------------------------------------------------------------- |
29
- | `init [dir]` | Folder (default `dev-portal`); `--name`, `--install` (default), `--overwrite`, `--json`, `--openapi-search` |
30
- | `config` | Interactive on TTY; flags: `--openapi`, `--page-*`, `--plan`, `--backend`, `--theme`, `--patch`, `--json` |
31
-
32
- `npx @lukoweb/apitogo@latest init` auto-wires nearby OpenAPI and `docs/`/`doc/` markdown after
33
- scaffold. See [Install the CLI](./setup.md#scaffold-options).
34
-
35
- See [Make config (CLI)](../configuration/make-config.mdx) for all `config` flags.
36
-
37
- ## Local development
38
-
39
- | Command | Role |
40
- | ----------------- | --------------------------------------------------------- |
41
- | `run` | Run the local portal server (`--port`, `--open`, `--ssr`) |
42
- | `build` | Production static build |
43
- | `build --preview` | Build then serve locally |
44
-
45
- ## Platform (requires API credentials)
46
-
47
- | Command | Role |
48
- | -------------------------- | -------------------------------------------------------------- |
49
- | `project create --name` | Create platform project only |
50
- | `check` | Dry-run publish readiness |
51
- | `deploy` | Full publish — project, plans, apihub, portal backend/frontend |
52
- | `deploy --only <resource>` | Limit to `apihub`, `portal-backend`, or `portal-frontend` |
53
- | `deploy --force` | Redeploy selected resources even when healthy |
54
- | `deploy --platform-plan` | Select Free / Starter / Professional hosting |
55
- | `deploy --resume-from` | Resume interrupted publish |
56
- | `status` | Whoami + project + live verification |
57
- | `teardown --yes` | Delete platform project (confirmation required) |
58
-
59
- Env: `APITOGO_API_KEY_ID`, `APITOGO_API_SECRET`. Optional: `APITOGO_API_URL`.
60
-
61
- ## Hand-edit exceptions
62
-
63
- | Change | Where |
64
- | ----------------- | -------------------------------------------------------- |
65
- | Home page content | `landing/LandingPage.tsx` |
66
- | Site footer | `apitogo.config.json` → `modules.landing.content.footer` |
67
-
68
- There is no CLI command for arbitrary home page content.
69
-
70
- ## Related
71
-
72
- - [Overview](./overview.md)
73
- - [Shape](./shape.md)
74
- - [Go live](./go-live.md)
75
- - [MCP tools](../mcp/tools.md) — agent tool catalog (spawn the CLI)
1
+ ---
2
+ title: CLI commands
3
+ description: APItoGo CLI command catalog by category.
4
+ sidebar_icon: wrench
5
+ ---
6
+
7
+ Commands are exposed by the **`apitogo`** binary (`@lukoweb/apitogo`). The CLI is the **source of
8
+ truth** for init, config, deploy, status, teardown, project create, and check. MCP tools spawn these
9
+ same commands so agents and humans get identical behavior.
10
+
11
+ ## Lifecycle (prefer these)
12
+
13
+ | Command | Role |
14
+ | ---------------- | ------------------------------------------------------------------------ |
15
+ | `init` | Scaffold portal (default `./dev-portal`; OpenAPI discovery + secrets) |
16
+ | `config` | Write or update `apitogo.config.json` (interactive or flags) |
17
+ | `run` | Local preview server |
18
+ | `build` | Production build (`--preview` to serve locally) |
19
+ | `check` | Publish readiness (secrets, manifest, site validation) |
20
+ | `project create` | Create the platform project (Free plan in version 2) and link the folder |
21
+ | `deploy` | Publish config to platform (apihub + portal) |
22
+ | `status` | Account, project, and live readiness |
23
+ | `teardown --yes` | Delete the linked platform project |
24
+
25
+ ## Scaffold and config
26
+
27
+ | Command | Role |
28
+ | ------------ | ----------------------------------------------------------------------------------------------------------- |
29
+ | `init [dir]` | Folder (default `dev-portal`); `--name`, `--install` (default), `--overwrite`, `--json`, `--openapi-search` |
30
+ | `config` | Interactive on TTY; flags: `--openapi`, `--page-*`, `--plan`, `--backend`, `--theme`, `--patch`, `--json` |
31
+
32
+ `npx @lukoweb/apitogo@latest init` auto-wires nearby OpenAPI and `docs/`/`doc/` markdown after
33
+ scaffold. See [Install the CLI](./setup.md#scaffold-options).
34
+
35
+ See [Make config (CLI)](../configuration/make-config.mdx) for all `config` flags.
36
+
37
+ ## Local development
38
+
39
+ | Command | Role |
40
+ | ----------------- | --------------------------------------------------------- |
41
+ | `run` | Run the local portal server (`--port`, `--open`, `--ssr`) |
42
+ | `build` | Production static build |
43
+ | `build --preview` | Build then serve locally |
44
+
45
+ ## Platform (requires API credentials)
46
+
47
+ | Command | Role |
48
+ | -------------------------- | -------------------------------------------------------------------------------------------------------- |
49
+ | `project create` | Create the platform project only; version 2 also selects Free, waits for hosting and writes `project.id` |
50
+ | `check` | Dry-run publish readiness |
51
+ | `deploy` | Full publish — project, plans, apihub, portal backend/frontend |
52
+ | `deploy --only <resource>` | Limit to `apihub`, `portal-backend`, or `portal-frontend` |
53
+ | `deploy --force` | Redeploy selected resources even when healthy |
54
+ | `deploy --platform-plan` | Select Free / Starter / Professional hosting |
55
+ | `deploy --resume-from` | Resume interrupted publish |
56
+ | `status` | Whoami + project + live verification |
57
+ | `teardown --yes` | Delete platform project (confirmation required) |
58
+
59
+ Env: `APITOGO_API_KEY_ID`, `APITOGO_API_SECRET`. Optional: `APITOGO_API_URL`.
60
+
61
+ ## Config version 2: add a service
62
+
63
+ ```bash
64
+ npx apitogo add gateway
65
+ ```
66
+
67
+ `add` puts one service (`portal`, `gateway`, `identity` or `plans`) into `apitogo.config.json`. In a
68
+ terminal it **asks** for what you did not pass as a flag: for the gateway how it reaches your API
69
+ (an address you host, or code the platform runs, with the folder, runtime and version) and which
70
+ OpenAPI file to use. For an OIDC identity it asks for the issuer, and for external docs the address
71
+ of the docs site. It shows the change and asks before it writes.
72
+
73
+ Some services need another one. `plans` needs the gateway and an identity source, and a portal that
74
+ requires login needs an identity source. `add` then offers to add the missing service first, asks
75
+ for its values, and goes on with the one you named.
76
+
77
+ With `--yes`, `--json` or without a terminal it never asks: a missing value is an error that names
78
+ the flag to pass, and `--dry-run` shows the change without writing it.
79
+
80
+ ## Config version 2: create the project, then deploy
81
+
82
+ ```bash
83
+ npx apitogo project create
84
+ npx apitogo deploy
85
+ ```
86
+
87
+ `project create` makes the platform project, selects the **Free** plan (or the plan from `--plan`),
88
+ waits for the hosting that the enabled services need, and writes `project.id` into
89
+ `apitogo.config.json`. `deploy` then publishes each service. It needs the project id from
90
+ `project.id`, from `--project-id`, or from `APITOGO_DEFAULT_PROJECT_ID`, and says so when it has
91
+ none.
92
+
93
+ | `project create` option | In version 2 |
94
+ | ----------------------- | ------------------------------------------------------------------ |
95
+ | `--name` | Optional. Defaults to `project.name` |
96
+ | `--description` | Optional |
97
+ | `--plan` | `free` (default), `starter` or `professional`. See below |
98
+ | `--no-open` | Print the checkout link of a paid plan and do not open the browser |
99
+ | `--modules` | Ignored. The modules come from the config (the portal needs one) |
100
+ | `--no-wait` | Return before the hosting is ready |
101
+ | `--json` | Print raw JSON only |
102
+
103
+ | `deploy` option | In version 2 |
104
+ | ----------------- | ---------------------------------------------------------- |
105
+ | `--only` | `portal`, `gateway`, `identity`, `plans` (comma-separated) |
106
+ | `--env` | Static Web App environment (default: production) |
107
+ | `--force` | Redeploy even when nothing changed |
108
+ | `--resume-from` | Resume the publish ledger from a step id |
109
+ | `--no-wait` | Do not wait for long-running jobs |
110
+ | `--platform-plan` | Ignored. The plan is chosen by `project create --plan` |
111
+ | `--project-name` | Ignored. The name is `project.name` |
112
+
113
+ ### Selling paid plans needs Starter or Professional
114
+
115
+ A project on the **Free** platform plan can only publish free plans, and its limits are capped. To
116
+ charge your customers, create the project on a paid platform plan:
117
+
118
+ ```bash
119
+ npx apitogo project create --plan starter
120
+ ```
121
+
122
+ The command makes the project, then prints a link to the platform's own checkout (and opens it in
123
+ your browser). You pay there, and the command waits until the payment is confirmed (up to 15
124
+ minutes) before it waits for the hosting. If it stops early, run the same command again: it
125
+ continues the same project and does not start a second checkout. With `--json` the command prints
126
+ the link and exits, and a later run continues.
127
+
128
+ Only a **new** project can be created on a paid plan. A project that is already on the Free plan, or
129
+ on the other paid plan, is not moved: create a new project in a new folder, or change the plan in
130
+ the web app.
131
+
132
+ This is what you pay APItoGo for hosting. What your customers pay you for your plans is separate
133
+ (see `plans.billing` in the config).
134
+
135
+ See [Walkthrough: from an empty folder to a customer's first call](./walkthrough.md).
136
+
137
+ ## Hand-edit exceptions
138
+
139
+ | Change | Where |
140
+ | ----------------- | -------------------------------------------------------- |
141
+ | Home page content | `landing/LandingPage.tsx` |
142
+ | Site footer | `apitogo.config.json` → `modules.landing.content.footer` |
143
+
144
+ There is no CLI command for arbitrary home page content.
145
+
146
+ ## Related
147
+
148
+ - [Overview](./overview.md)
149
+ - [Shape](./shape.md)
150
+ - [Go live](./go-live.md)
151
+ - [MCP tools](../mcp/tools.md) — agent tool catalog (spawn the CLI)