@rebasepro/cli 0.13.0 → 0.13.1-canary.g1822133

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 (39) hide show
  1. package/dist/bundle.d.ts +4 -3
  2. package/dist/commands/api-keys.d.ts +51 -0
  3. package/dist/commands/auth.d.ts +62 -0
  4. package/dist/commands/cloud/context.d.ts +143 -10
  5. package/dist/commands/cloud/databases.d.ts +39 -0
  6. package/dist/commands/cloud/debug.d.ts +1 -0
  7. package/dist/commands/cloud/deployments.d.ts +22 -0
  8. package/dist/commands/cloud/domains.d.ts +10 -0
  9. package/dist/commands/cloud/env.d.ts +51 -0
  10. package/dist/commands/cloud/extensions.d.ts +21 -0
  11. package/dist/commands/cloud/orgs.d.ts +1 -0
  12. package/dist/commands/cloud/projects.d.ts +29 -0
  13. package/dist/commands/cloud/resources.d.ts +14 -0
  14. package/dist/commands/cloud/settings.d.ts +1 -0
  15. package/dist/commands/dev.d.ts +17 -6
  16. package/dist/commands/eject.d.ts +42 -0
  17. package/dist/commands/init.d.ts +67 -0
  18. package/dist/commands/skills.d.ts +81 -0
  19. package/dist/fold-static.d.ts +47 -0
  20. package/dist/index.es.js +2272 -765
  21. package/dist/index.es.js.map +1 -1
  22. package/dist/manifest.d.ts +16 -1
  23. package/dist/telemetry/payload.d.ts +1 -1
  24. package/dist/utils/args.d.ts +76 -0
  25. package/dist/utils/collection-drift.d.ts +27 -0
  26. package/dist/utils/project.d.ts +20 -0
  27. package/package.json +7 -7
  28. package/templates/eject/Dockerfile +29 -4
  29. package/templates/eject/backend/src/index.ts +60 -8
  30. package/templates/eject/docker-compose.custom.yml +13 -5
  31. package/templates/overlays/baas/backend/tsconfig.json +6 -1
  32. package/templates/overlays/baas/config/index.ts +9 -0
  33. package/templates/overlays/baas/config/package.json +1 -0
  34. package/templates/template/.env.example +13 -4
  35. package/templates/template/backend/functions/hello.ts +8 -4
  36. package/templates/template/backend/tsconfig.json +6 -1
  37. package/templates/template/config/package.json +1 -0
  38. package/templates/template/docker-compose.yml +4 -4
  39. package/templates/template/frontend/vite.config.ts +33 -2
@@ -68,4 +68,71 @@ export declare function formatCdTarget(cwd: string, targetDirectory: string): st
68
68
  * triggering the non-TTY error. */
69
69
  export declare function printInitHelp(): void;
70
70
  export declare function createRebaseApp(rawArgs: string[]): Promise<void>;
71
+ /** The flags `rebase init` takes. */
72
+ export declare const INIT_FLAGS: {
73
+ readonly "--git": BooleanConstructor;
74
+ readonly "--install": BooleanConstructor;
75
+ readonly "--database-url": StringConstructor;
76
+ readonly "--introspect": BooleanConstructor;
77
+ readonly "--template": StringConstructor;
78
+ readonly "--headless": BooleanConstructor;
79
+ readonly "--project": StringConstructor;
80
+ readonly "--setup-key": StringConstructor;
81
+ readonly "--yes": BooleanConstructor;
82
+ readonly "-g": "--git";
83
+ readonly "-i": "--install";
84
+ readonly "-t": "--template";
85
+ readonly "-y": "--yes";
86
+ };
87
+ /**
88
+ * Whether `port` is free — on the wildcard address *and* on both loopback addresses.
89
+ *
90
+ * All three, because on macOS/BSD a successful bind does not mean the port is
91
+ * unused. Sockets carry `SO_REUSEADDR` (Node sets it), under which a wildcard
92
+ * bind and a specific-address bind on the same port do not conflict — in either
93
+ * direction. So each probe alone has a blind spot, and they are different ones:
94
+ *
95
+ * - **Wildcard only** (what this used to do) misses a server bound to
96
+ * `127.0.0.1` and `[::1]` — a Homebrew or Postgres.app install, i.e. most
97
+ * developer machines. 5432 was reported free while it was already serving
98
+ * another project's database. Docker then published `*:5432` for the same
99
+ * reason and the container started cleanly, with no "port already allocated"
100
+ * error anywhere to hint at the collision. `DATABASE_URL` pointed at
101
+ * `localhost:5432`, `localhost` resolves to `::1` first, and every command
102
+ * reported success while reading and writing the *pre-existing* database — a
103
+ * `db push` would have created tables, roles and RLS policies inside it.
104
+ *
105
+ * - **Loopback only** misses the opposite case: Docker Desktop publishes a
106
+ * container's port on `*`, and a specific-address bind succeeds right past it.
107
+ * That port is free to probe and unusable to publish, so `docker compose up -d
108
+ * db` fails on "Bind for 0.0.0.0:PORT failed: port is already allocated" —
109
+ * loudly, but only after the project has been generated around the bad port.
110
+ *
111
+ * Requiring all three costs three sockets and leaves neither gap. The wildcard
112
+ * bind is the one the container itself has to make; the loopback binds are the
113
+ * addresses `DATABASE_URL` will actually name.
114
+ */
115
+ export declare function isPortAvailable(port: number): Promise<boolean>;
116
+ /**
117
+ * The runtime image tag to pin, given the version of the CLI doing the scaffolding.
118
+ *
119
+ * Only a stable release publishes `rebasepro/server` — a multi-arch build on
120
+ * every push to main would cost minutes per commit for an image nobody pulls.
121
+ * So pinning a prerelease CLI's own version writes a tag that cannot exist, and
122
+ * `docker compose up` fails on `manifest unknown`, which is the same dead end
123
+ * as the missing-repository bug this pinning was added to prevent.
124
+ *
125
+ * A prerelease therefore falls back to `latest`, which is correct rather than
126
+ * merely available: a bundle's manifest declares the runtime range it needs
127
+ * (`^1`), the image supplies only `@rebasepro/server`, and the framework a
128
+ * bundle runs is installed from its own `deps.declared` at boot. The current
129
+ * stable runtime boots a canary bundle by design.
130
+ *
131
+ * A floating tag is a real cost — it is what pinning exists to avoid — so say
132
+ * so in the file rather than leaving a reader to discover it.
133
+ */
134
+ export declare function resolveRuntimeImageTag(cliVersion: string): {
135
+ tag: string;
136
+ note?: string;
137
+ };
71
138
  export declare function configureEnvFile(targetDirectory: string, databaseUrl?: string): Promise<void>;
@@ -1 +1,82 @@
1
+ /**
2
+ * Supported agent environments and their target directories.
3
+ *
4
+ * `flatLayout` says where the installed rule file sits relative to the skill's
5
+ * own assets. A subdirectory layout writes `<skill>/SKILL.md`, so a link the
6
+ * skill spells `references/x.md` resolves as written; a flat layout writes
7
+ * `<skill>.md` one level up, so those links have to be re-pointed at the
8
+ * per-skill asset directory. See `rewriteAssetLinks`.
9
+ */
10
+ declare const AGENTS: {
11
+ readonly cursor: {
12
+ readonly label: "Cursor";
13
+ readonly detectDir: ".cursor";
14
+ readonly targetDir: ".cursor/rules";
15
+ readonly flatLayout: true;
16
+ /** Cursor uses .mdc files (Markdown with Context). */
17
+ readonly transformFile: (skillName: string, content: string) => {
18
+ fileName: string;
19
+ content: string;
20
+ };
21
+ };
22
+ readonly claude: {
23
+ readonly label: "Claude Code";
24
+ readonly detectDir: ".claude";
25
+ readonly targetDir: ".claude/skills";
26
+ readonly flatLayout: false;
27
+ /** Claude Code uses the standard SKILL.md format in subdirectories. */
28
+ readonly transformFile: (skillName: string, content: string) => {
29
+ fileName: string;
30
+ content: string;
31
+ };
32
+ };
33
+ readonly windsurf: {
34
+ readonly label: "Windsurf";
35
+ readonly detectDir: ".windsurf";
36
+ readonly targetDir: ".windsurf/rules";
37
+ readonly flatLayout: true;
38
+ /** Windsurf uses plain .md files. */
39
+ readonly transformFile: (skillName: string, content: string) => {
40
+ fileName: string;
41
+ content: string;
42
+ };
43
+ };
44
+ readonly gemini: {
45
+ readonly label: "Gemini CLI / Antigravity";
46
+ readonly detectDir: ".agents";
47
+ readonly targetDir: ".agents/skills";
48
+ readonly flatLayout: false;
49
+ /** Gemini uses the standard SKILL.md format in subdirectories. */
50
+ readonly transformFile: (skillName: string, content: string) => {
51
+ fileName: string;
52
+ content: string;
53
+ };
54
+ };
55
+ };
56
+ type AgentKey = keyof typeof AGENTS;
57
+ export interface LoadedSkill {
58
+ name: string;
59
+ /** Absolute path of the skill's source directory. */
60
+ dir: string;
61
+ content: string;
62
+ /** Every file the skill ships besides SKILL.md, relative to `dir`. */
63
+ assets: string[];
64
+ }
65
+ /** Read all skill directories and return their names, content and assets. */
66
+ export declare function loadSkills(skillsDir: string): LoadedSkill[];
67
+ /**
68
+ * Re-point a skill's own asset links at the per-skill subdirectory, for the
69
+ * agents whose rule file does not live in it.
70
+ *
71
+ * Only paths that name a file the skill actually ships are rewritten, and only
72
+ * where they start a path segment — so prose that happens to contain the same
73
+ * words is left alone.
74
+ */
75
+ export declare function rewriteAssetLinks(content: string, assets: string[], skillName: string): string;
76
+ /** Install skills for a specific agent into the project directory. */
77
+ export declare function installForAgent(agentKey: AgentKey, skills: LoadedSkill[], projectDir: string): {
78
+ skills: number;
79
+ assets: number;
80
+ };
1
81
  export declare function skillsCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
82
+ export {};
@@ -62,6 +62,53 @@ export declare function foldableApps(manifest: FoldableManifest): {
62
62
  * evidence of a misbuild.
63
63
  */
64
64
  export declare function assertBuiltForPath(indexHtml: string, basePath: string, appName: string): void;
65
+ /**
66
+ * The environment every static app is built with, wherever that build is driven from.
67
+ *
68
+ * Shared because there are two drivers — `foldFrontendIntoBundle` here, and
69
+ * `buildAssetApp` in `build.ts` for a standalone `type: "static"` app — and they
70
+ * had already drifted: the path variables were duplicated into both, so a fix
71
+ * applied to one shipped a bundle built the old way from the other. One function
72
+ * makes that impossible rather than merely unlikely.
73
+ *
74
+ * ## REBASE_APP_*
75
+ *
76
+ * The declared path is a build-time input, not only a serving concern: Vite
77
+ * reads `base` from REBASE_APP_BASE, and the trailing slash is that field's
78
+ * convention. See `assertBuiltForPath`.
79
+ *
80
+ * ## NODE_ENV
81
+ *
82
+ * A built app is a production artifact by construction, so build it as one. Not
83
+ * a formality: the scaffold's `.env` carries `NODE_ENV=development` for the dev
84
+ * backend, and Vite's `loadEnv` promotes a `NODE_ENV` found in an env file into
85
+ * the build unless the environment already sets one. So `rebase build` and
86
+ * `rebase cloud deploy` shipped a *development* bundle — `import.meta.env.DEV
87
+ * === true`, development React, dev-only branches live — from commands whose
88
+ * whole purpose is to produce something deployable. Setting it here is what
89
+ * closes it: Vite consults the env file's NODE_ENV only when `process.env`
90
+ * has none.
91
+ *
92
+ * ## VITE_API_URL
93
+ *
94
+ * An app served by the backend it talks to has its API on its own origin by
95
+ * construction, so a baked-in absolute URL can only be wrong. It was: that same
96
+ * `.env` carries `VITE_API_URL=http://localhost:3001` and
97
+ * `frontend/vite.config.ts` reads the project root via `envDir: ".."`, so a
98
+ * stock deploy shipped a site whose every request went to whoever ran the build
99
+ * — passing every server-side health check on the way out. Blanking it here
100
+ * fixes the bundle even for a project whose `.env` predates the `init` fix, or
101
+ * was written by hand. Empty is the right value rather than a missing one: the
102
+ * client falls back to `window.location.origin`, which keeps working when a
103
+ * custom domain is added.
104
+ *
105
+ * Vite prioritises `process.env.VITE_*` over `.env` files, so an explicit
106
+ * `VITE_API_URL=https://api.example.com rebase cloud deploy` still wins — the
107
+ * cross-origin escape hatch stays open, it just has to be deliberate. Nothing on
108
+ * this path loads the project `.env` into `process.env`, so a value inherited
109
+ * here really was set by the caller.
110
+ */
111
+ export declare function staticBuildEnv(appPath: string, appName: string): Record<string, string>;
65
112
  /**
66
113
  * Build the project's static apps and fold them into the backend bundle.
67
114
  *