@parlor/cli 0.0.0-stage → 0.1.0

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 (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -2
  3. package/dist/agent-host-process.d.ts +22 -0
  4. package/dist/agent-host-process.d.ts.map +1 -0
  5. package/dist/agent-host-process.js +35 -0
  6. package/dist/agent-host-process.js.map +1 -0
  7. package/dist/chat-warning.d.ts +8 -0
  8. package/dist/chat-warning.d.ts.map +1 -0
  9. package/dist/chat-warning.js +13 -0
  10. package/dist/chat-warning.js.map +1 -0
  11. package/dist/commands/add.d.ts +32 -0
  12. package/dist/commands/add.d.ts.map +1 -0
  13. package/dist/commands/add.js +79 -0
  14. package/dist/commands/add.js.map +1 -0
  15. package/dist/commands/build.d.ts +12 -0
  16. package/dist/commands/build.d.ts.map +1 -0
  17. package/dist/commands/build.js +27 -0
  18. package/dist/commands/build.js.map +1 -0
  19. package/dist/commands/db.d.ts +12 -0
  20. package/dist/commands/db.d.ts.map +1 -0
  21. package/dist/commands/db.js +131 -0
  22. package/dist/commands/db.js.map +1 -0
  23. package/dist/commands/deploy.d.ts +8 -0
  24. package/dist/commands/deploy.d.ts.map +1 -0
  25. package/dist/commands/deploy.js +44 -0
  26. package/dist/commands/deploy.js.map +1 -0
  27. package/dist/commands/dev.d.ts +22 -0
  28. package/dist/commands/dev.d.ts.map +1 -0
  29. package/dist/commands/dev.js +86 -0
  30. package/dist/commands/dev.js.map +1 -0
  31. package/dist/commands/typegen.d.ts +2 -0
  32. package/dist/commands/typegen.d.ts.map +1 -0
  33. package/dist/commands/typegen.js +13 -0
  34. package/dist/commands/typegen.js.map +1 -0
  35. package/dist/desktop-target.d.ts +4 -0
  36. package/dist/desktop-target.d.ts.map +1 -0
  37. package/dist/desktop-target.js +45 -0
  38. package/dist/desktop-target.js.map +1 -0
  39. package/dist/dev-session.d.ts +15 -0
  40. package/dist/dev-session.d.ts.map +1 -0
  41. package/dist/dev-session.js +65 -0
  42. package/dist/dev-session.js.map +1 -0
  43. package/dist/errors.d.ts +4 -0
  44. package/dist/errors.d.ts.map +1 -0
  45. package/dist/errors.js +4 -0
  46. package/dist/errors.js.map +1 -0
  47. package/dist/handlers.d.ts +3 -0
  48. package/dist/handlers.d.ts.map +1 -0
  49. package/dist/handlers.js +12 -0
  50. package/dist/handlers.js.map +1 -0
  51. package/dist/index.d.ts +2 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +2 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/main.d.ts +3 -0
  56. package/dist/main.d.ts.map +1 -0
  57. package/dist/main.js +37 -0
  58. package/dist/main.js.map +1 -0
  59. package/dist/mobile-target.d.ts +5 -0
  60. package/dist/mobile-target.d.ts.map +1 -0
  61. package/dist/mobile-target.js +40 -0
  62. package/dist/mobile-target.js.map +1 -0
  63. package/dist/ports.d.ts +14 -0
  64. package/dist/ports.d.ts.map +1 -0
  65. package/dist/ports.js +45 -0
  66. package/dist/ports.js.map +1 -0
  67. package/dist/serve-entry.d.ts +2 -0
  68. package/dist/serve-entry.d.ts.map +1 -0
  69. package/dist/serve-entry.js +20 -0
  70. package/dist/serve-entry.js.map +1 -0
  71. package/dist/server-process.d.ts +13 -0
  72. package/dist/server-process.d.ts.map +1 -0
  73. package/dist/server-process.js +68 -0
  74. package/dist/server-process.js.map +1 -0
  75. package/dist/serverless-warning.d.ts +4 -0
  76. package/dist/serverless-warning.d.ts.map +1 -0
  77. package/dist/serverless-warning.js +6 -0
  78. package/dist/serverless-warning.js.map +1 -0
  79. package/dist/shutdown.d.ts +6 -0
  80. package/dist/shutdown.d.ts.map +1 -0
  81. package/dist/shutdown.js +22 -0
  82. package/dist/shutdown.js.map +1 -0
  83. package/dist/targets.d.ts +27 -0
  84. package/dist/targets.d.ts.map +1 -0
  85. package/dist/targets.js +31 -0
  86. package/dist/targets.js.map +1 -0
  87. package/dist/web-target.d.ts +6 -0
  88. package/dist/web-target.d.ts.map +1 -0
  89. package/dist/web-target.js +45 -0
  90. package/dist/web-target.js.map +1 -0
  91. package/package.json +48 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 cychien
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,20 @@
1
- # Temporary Holding Version
1
+ # @parlor/cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The `parlor` command: `dev`, `build`, `deploy`, `db`, `add` and `typegen` for a Parlor app, on web, desktop and mobile.
4
+
5
+ ```sh
6
+ pnpm add -D @parlor/cli
7
+ pnpm parlor dev
8
+ pnpm parlor add auth
9
+ pnpm parlor dev --target mac
10
+ ```
11
+
12
+ Its configuration is `parlor.config.ts`:
13
+
14
+ ```ts
15
+ import { defineConfig } from "@parlor/config";
16
+
17
+ export default defineConfig({ app: { id: "com.example.todos", name: "Todos" } });
18
+ ```
19
+
20
+ Docs: https://cychien.github.io/parlor/reference/cli/
@@ -0,0 +1,22 @@
1
+ import { type ChildProcess } from "node:child_process";
2
+ import type { LoadedConfig } from "@parlor/config";
3
+ export interface DevAgentHostOptions {
4
+ /** `--no-agent-host` turns it off. */
5
+ readonly enabled: boolean;
6
+ /** The server is running with its own auth provider, so `devAuth` is not there to pair with. */
7
+ readonly serverHasAuth: boolean;
8
+ }
9
+ export declare const AGENT_HOST_BIN = "parlor-host";
10
+ /**
11
+ * The `parlor-host` bin as the installed manifest declares it: `bin/parlor-host-dev.mjs` (tsx on
12
+ * `src/`) in the repo, `dist/main.js` once `publishConfig` is applied. Resolving the exported
13
+ * `package.json` works under CJS resolution, which the package's `import`-only entry does not.
14
+ */
15
+ export declare function agentHostBin(): string;
16
+ /**
17
+ * `parlor dev` runs `parlor-host dev --app http://localhost:<port>` next to the server, so
18
+ * the chat works against the developer's own agents with no pairing. Orchestration only;
19
+ * `undefined` when skipped.
20
+ */
21
+ export declare function startDevAgentHost({ config, rootDir }: LoadedConfig, options: DevAgentHostOptions): ChildProcess | undefined;
22
+ //# sourceMappingURL=agent-host-process.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-host-process.d.ts","sourceRoot":"","sources":["../src/agent-host-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,oBAAoB,CAAC;AAK9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQnD,MAAM,WAAW,mBAAmB;IAClC,sCAAsC;IACtC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,gGAAgG;IAChG,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAQrC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,YAAY,EACjC,OAAO,EAAE,mBAAmB,GAC3B,YAAY,GAAG,SAAS,CAS1B"}
@@ -0,0 +1,35 @@
1
+ import { spawn } from "node:child_process";
2
+ import { readFileSync } from "node:fs";
3
+ import { createRequire } from "node:module";
4
+ import { dirname, join } from "node:path";
5
+ import { CliError } from "./errors.js";
6
+ import { stopServerProcess } from "./server-process.js";
7
+ import { onShutdown } from "./shutdown.js";
8
+ const require = createRequire(import.meta.url);
9
+ export const AGENT_HOST_BIN = "parlor-host";
10
+ /**
11
+ * The `parlor-host` bin as the installed manifest declares it: `bin/parlor-host-dev.mjs` (tsx on
12
+ * `src/`) in the repo, `dist/main.js` once `publishConfig` is applied. Resolving the exported
13
+ * `package.json` works under CJS resolution, which the package's `import`-only entry does not.
14
+ */
15
+ export function agentHostBin() {
16
+ const manifestPath = require.resolve("@parlor/agent-host/package.json");
17
+ const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
18
+ const bin = manifest.bin?.[AGENT_HOST_BIN];
19
+ if (!bin)
20
+ throw new CliError(`@parlor/agent-host has no ${AGENT_HOST_BIN} bin`);
21
+ return join(dirname(manifestPath), bin);
22
+ }
23
+ /**
24
+ * `parlor dev` runs `parlor-host dev --app http://localhost:<port>` next to the server, so
25
+ * the chat works against the developer's own agents with no pairing. Orchestration only;
26
+ * `undefined` when skipped.
27
+ */
28
+ export function startDevAgentHost({ config, rootDir }, options) {
29
+ if (!options.enabled || options.serverHasAuth)
30
+ return undefined;
31
+ const child = spawn(process.execPath, [agentHostBin(), "dev", "--app", `http://localhost:${config.server.port}`], { cwd: rootDir, stdio: "inherit", env: process.env });
32
+ onShutdown((signaled) => stopServerProcess(child, signaled ? undefined : 0));
33
+ return child;
34
+ }
35
+ //# sourceMappingURL=agent-host-process.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-host-process.js","sourceRoot":"","sources":["../src/agent-host-process.ts"],"names":[],"mappings":"AAAA,OA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CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,EAC1E,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CACrD,CAAC;IACF,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7E,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { LoadedConfig } from "@parlor/config";
2
+ import { type ServerShape } from "@parlor/scaffold";
3
+ export declare const AGENT_UNAVAILABLE_WARNING = "Warning: this app installs chat() without sign-in, so in production the agent sidebar is unavailable (useChat().status is \"unavailable\"). Run `parlor add auth` to turn it on.";
4
+ /** Only when sure: an `unknown` shape stays quiet rather than warn about a working app. */
5
+ export declare function agentUnavailableInProduction(server: ServerShape): boolean;
6
+ /** The server is the same for every target, so every production build warns, not only web. */
7
+ export declare function warnChatWithoutAuth({ config, rootDir, }: LoadedConfig): Promise<void>;
8
+ //# sourceMappingURL=chat-warning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-warning.d.ts","sourceRoot":"","sources":["../src/chat-warning.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAExE,eAAO,MAAM,yBAAyB,qLAC4I,CAAC;AAEnL,2FAA2F;AAC3F,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAEzE;AAED,8FAA8F;AAC9F,wBAAsB,mBAAmB,CAAC,EACxC,MAAM,EACN,OAAO,GACR,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9B"}
@@ -0,0 +1,13 @@
1
+ import { inspectServerEntry } from "@parlor/scaffold";
2
+ export const AGENT_UNAVAILABLE_WARNING = 'Warning: this app installs chat() without sign-in, so in production the agent sidebar is unavailable (useChat().status is "unavailable"). Run `parlor add auth` to turn it on.';
3
+ /** Only when sure: an `unknown` shape stays quiet rather than warn about a working app. */
4
+ export function agentUnavailableInProduction(server) {
5
+ return server.chat === "installed" && server.auth === "absent";
6
+ }
7
+ /** The server is the same for every target, so every production build warns, not only web. */
8
+ export async function warnChatWithoutAuth({ config, rootDir, }) {
9
+ const server = await inspectServerEntry(rootDir, config.server.entry);
10
+ if (agentUnavailableInProduction(server))
11
+ console.warn(AGENT_UNAVAILABLE_WARNING);
12
+ }
13
+ //# sourceMappingURL=chat-warning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-warning.js","sourceRoot":"","sources":["../src/chat-warning.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAoB,MAAM,kBAAkB,CAAC;AAExE,MAAM,CAAC,MAAM,yBAAyB,GACpC,gLAAgL,CAAC;AAEnL,2FAA2F;AAC3F,MAAM,UAAU,4BAA4B,CAAC,MAAmB;IAC9D,OAAO,MAAM,CAAC,IAAI,KAAK,WAAW,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AACjE,CAAC;AAED,8FAA8F;AAC9F,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EACxC,MAAM,EACN,OAAO,GACM;IACb,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtE,IAAI,4BAA4B,CAAC,MAAM,CAAC;QAAE,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AACpF,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { type LoadedConfig } from "@parlor/config";
2
+ import { type AddonName, type AddTools, type ProjectLayout } from "@parlor/scaffold";
3
+ export declare function projectLayout({ config, rootDir }: LoadedConfig): ProjectLayout;
4
+ /**
5
+ * The same code `parlor typegen` and `parlor db generate` run, pointed at whatever directory
6
+ * the transaction names: the staging copy, never the project.
7
+ */
8
+ export declare function addTools(loaded: LoadedConfig): AddTools;
9
+ export declare function parseAddonNames(values: readonly string[]): readonly AddonName[];
10
+ export declare const add: import("citty").CommandDef<{
11
+ readonly addon: {
12
+ readonly type: "positional";
13
+ readonly description: string;
14
+ readonly required: false;
15
+ };
16
+ readonly "dry-run": {
17
+ readonly type: "boolean";
18
+ readonly default: false;
19
+ readonly description: "Print the changes without writing or installing anything";
20
+ };
21
+ readonly install: {
22
+ readonly type: "boolean";
23
+ readonly default: true;
24
+ readonly description: "Install dependencies and generate files (--no-install to only write files)";
25
+ };
26
+ readonly "git-check": {
27
+ readonly type: "boolean";
28
+ readonly default: true;
29
+ readonly description: "Refuse to edit a project with uncommitted changes (--no-git-check to proceed)";
30
+ };
31
+ }>;
32
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,QAAQ,EAIb,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAO1B,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,YAAY,GAAG,aAAa,CAQ9E;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,QAAQ,CAUvD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,SAAS,EAAE,CAW/E;AAED,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;EA2Cd,CAAC"}
@@ -0,0 +1,79 @@
1
+ import { loadParlorConfig } from "@parlor/config";
2
+ import { ADDON_NAMES, addAddons, detectProjectPackageManager, formatAddResult, isAddonName, } from "@parlor/scaffold";
3
+ import { generateRouteTree, routeTreeFile } from "@parlor/shell-web";
4
+ import { defineCommand } from "citty";
5
+ import { CliError } from "../errors.js";
6
+ import { drizzleKitArgs, runDrizzleKit } from "./db.js";
7
+ export function projectLayout({ config, rootDir }) {
8
+ return {
9
+ rootDir,
10
+ serverEntry: config.server.entry,
11
+ schemaDir: config.database.schema,
12
+ migrationsDir: config.database.migrations,
13
+ routeTree: routeTreeFile(config),
14
+ };
15
+ }
16
+ /**
17
+ * The same code `parlor typegen` and `parlor db generate` run, pointed at whatever directory
18
+ * the transaction names: the staging copy, never the project.
19
+ */
20
+ export function addTools(loaded) {
21
+ const { config } = loaded;
22
+ return {
23
+ routeTree: (rootDir) => generateRouteTree({ ...loaded, rootDir }),
24
+ migration: (rootDir, name) => runDrizzleKit(drizzleKitArgs(config.database.schema, config.database.migrations, name), rootDir),
25
+ };
26
+ }
27
+ export function parseAddonNames(values) {
28
+ if (values.length === 0) {
29
+ throw new CliError(`Name what to add: ${ADDON_NAMES.join(", ")}`);
30
+ }
31
+ const unknown = values.filter((value) => !isAddonName(value));
32
+ if (unknown.length > 0) {
33
+ throw new CliError(`Unknown add-on ${unknown.map((name) => `"${name}"`).join(", ")}. Expected one of: ${ADDON_NAMES.join(", ")}`);
34
+ }
35
+ return [...new Set(values)];
36
+ }
37
+ export const add = defineCommand({
38
+ meta: {
39
+ name: "add",
40
+ description: `Add a feature to this app by editing its files: ${ADDON_NAMES.join(", ")}`,
41
+ },
42
+ args: {
43
+ addon: { type: "positional", description: ADDON_NAMES.join(" | "), required: false },
44
+ "dry-run": {
45
+ type: "boolean",
46
+ default: false,
47
+ description: "Print the changes without writing or installing anything",
48
+ },
49
+ install: {
50
+ type: "boolean",
51
+ default: true,
52
+ description: "Install dependencies and generate files (--no-install to only write files)",
53
+ },
54
+ "git-check": {
55
+ type: "boolean",
56
+ default: true,
57
+ description: "Refuse to edit a project with uncommitted changes (--no-git-check to proceed)",
58
+ },
59
+ },
60
+ async run({ args }) {
61
+ const loaded = await loadParlorConfig();
62
+ const addons = parseAddonNames(args._);
63
+ const packageManager = await detectProjectPackageManager(loaded.rootDir);
64
+ const result = await addAddons({
65
+ layout: projectLayout(loaded),
66
+ addons,
67
+ packageManager,
68
+ tools: addTools(loaded),
69
+ mode: args["dry-run"] ? "dry-run" : "apply",
70
+ install: args.install,
71
+ gitCheck: args["git-check"],
72
+ log: (line) => console.log(line),
73
+ });
74
+ const { text, exitCode } = formatAddResult(result, packageManager);
75
+ console.log(text);
76
+ process.exitCode = exitCode;
77
+ },
78
+ });
79
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EACL,WAAW,EACX,SAAS,EAGT,2BAA2B,EAC3B,eAAe,EACf,WAAW,GAEZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExD,MAAM,UAAU,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAgB;IAC7D,OAAO;QACL,OAAO;QACP,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;QAChC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM;QACjC,aAAa,EAAE,MAAM,CAAC,QAAQ,CAAC,UAAU;QACzC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC;KACjC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAoB;IAC3C,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC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AAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const build: import("citty").CommandDef<{
2
+ readonly target: {
3
+ readonly type: "string";
4
+ readonly description: "web | ios | android | mac | windows | linux";
5
+ readonly default: "web";
6
+ };
7
+ readonly preset: {
8
+ readonly type: "string";
9
+ readonly description: "Server deploy preset for the web target: node-server, vercel, netlify, …";
10
+ };
11
+ }>;
12
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,KAAK;;;;;;;;;;EAqBhB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { loadParlorConfig } from "@parlor/config";
2
+ import { defineCommand } from "citty";
3
+ import { warnChatWithoutAuth } from "../chat-warning.js";
4
+ import { handlers } from "../handlers.js";
5
+ import { parseTarget, resolveHandler } from "../targets.js";
6
+ export const build = defineCommand({
7
+ meta: { name: "build", description: "Build the app for a target" },
8
+ args: {
9
+ target: {
10
+ type: "string",
11
+ description: "web | ios | android | mac | windows | linux",
12
+ default: "web",
13
+ },
14
+ preset: {
15
+ type: "string",
16
+ description: "Server deploy preset for the web target: node-server, vercel, netlify, …",
17
+ },
18
+ },
19
+ async run({ args }) {
20
+ const target = parseTarget(args.target);
21
+ const handler = resolveHandler(handlers, target);
22
+ const loaded = await loadParlorConfig();
23
+ await warnChatWithoutAuth(loaded);
24
+ await handler.build(loaded, { preset: args.preset });
25
+ },
26
+ });
27
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC;IACjC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,4BAA4B,EAAE;IAClE,IAAI,EAAE;QACJ,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,6CAA6C;YAC1D,OAAO,EAAE,KAAK;SACf;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,0EAA0E;SAC7E;KACF;IACD,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE;QAChB,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjD,MAAM,MAAM,GAAG,MAAM,gBAAgB,EAAE,CAAC;QACxC,MAAM,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACvD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Writable } from "node:stream";
2
+ /** `name` replaces drizzle-kit's random suffix, so a generated migration has a stable file name. */
3
+ export declare function drizzleKitArgs(schema: string, migrations: string, name?: string): string[];
4
+ export interface DrizzleKitOptions {
5
+ readonly stdout?: "inherit" | "ignore";
6
+ readonly stderr?: Writable;
7
+ readonly signal?: AbortSignal;
8
+ readonly timeoutMs?: number;
9
+ }
10
+ export declare function runDrizzleKit(args: readonly string[], cwd: string, options?: DrizzleKitOptions): Promise<void>;
11
+ export declare const db: import("citty").CommandDef<import("citty").ArgsDef>;
12
+ //# sourceMappingURL=db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/commands/db.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAU5C,oGAAoG;AACpG,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,MAAM,GACZ,MAAM,EAAE,CAWV;AAOD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACvC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAwEf;AAmCD,eAAO,MAAM,EAAE,qDAGb,CAAC"}
@@ -0,0 +1,131 @@
1
+ import { spawn } from "node:child_process";
2
+ import { createRequire } from "node:module";
3
+ import { dirname, join } from "node:path";
4
+ import { loadParlorConfig } from "@parlor/config";
5
+ import { createDatabase } from "@parlor/data";
6
+ import { defineCommand } from "citty";
7
+ import { CliError } from "../errors.js";
8
+ const require = createRequire(import.meta.url);
9
+ /** `name` replaces drizzle-kit's random suffix, so a generated migration has a stable file name. */
10
+ export function drizzleKitArgs(schema, migrations, name) {
11
+ return [
12
+ "generate",
13
+ "--dialect",
14
+ "postgresql",
15
+ "--schema",
16
+ schema,
17
+ "--out",
18
+ migrations,
19
+ ...(name === undefined ? [] : ["--name", name]),
20
+ ];
21
+ }
22
+ const STACK_FRAME = /^\s+at \S/m;
23
+ const KILL_GRACE_MS = 2000;
24
+ const PARENT_SIGNALS = ["SIGINT", "SIGTERM"];
25
+ export function runDrizzleKit(args, cwd, options = {}) {
26
+ const { stdout = "inherit", stderr = process.stderr, signal, timeoutMs } = options;
27
+ const command = `drizzle-kit ${args[0]}`;
28
+ const bin = join(dirname(require.resolve("drizzle-kit")), "bin.cjs");
29
+ return new Promise((resolve, reject) => {
30
+ if (signal?.aborted) {
31
+ reject(new CliError(`${command} aborted`));
32
+ return;
33
+ }
34
+ const child = spawn(process.execPath, [bin, ...args], {
35
+ cwd,
36
+ env: { ...process.env, NODE_NO_WARNINGS: "1" },
37
+ // the rename prompt needs a TTY; without one stdin would only keep the child waiting
38
+ stdio: [process.stdin.isTTY ? "inherit" : "ignore", stdout, "pipe"],
39
+ });
40
+ let stderrText = "";
41
+ let stopReason;
42
+ let parentSignal;
43
+ let killTimer;
44
+ const stop = (reason) => {
45
+ if (stopReason)
46
+ return;
47
+ stopReason = reason;
48
+ child.kill("SIGTERM");
49
+ killTimer = setTimeout(() => child.kill("SIGKILL"), KILL_GRACE_MS);
50
+ };
51
+ const onAbort = () => stop(new CliError(`${command} aborted`));
52
+ const onParentExit = () => {
53
+ child.kill("SIGKILL");
54
+ };
55
+ const onParentSignal = (name) => {
56
+ parentSignal = name;
57
+ stop(new CliError(`${command} interrupted by ${name}`));
58
+ };
59
+ const timeoutTimer = timeoutMs === undefined
60
+ ? undefined
61
+ : setTimeout(() => stop(new CliError(`${command} timed out after ${timeoutMs}ms`)), timeoutMs);
62
+ signal?.addEventListener("abort", onAbort, { once: true });
63
+ process.once("exit", onParentExit);
64
+ for (const name of PARENT_SIGNALS)
65
+ process.on(name, onParentSignal);
66
+ const release = () => {
67
+ clearTimeout(timeoutTimer);
68
+ clearTimeout(killTimer);
69
+ signal?.removeEventListener("abort", onAbort);
70
+ process.removeListener("exit", onParentExit);
71
+ for (const name of PARENT_SIGNALS)
72
+ process.removeListener(name, onParentSignal);
73
+ };
74
+ child.stderr.on("data", (chunk) => {
75
+ stderrText += chunk.toString();
76
+ stderr.write(chunk);
77
+ });
78
+ child.once("error", (error) => {
79
+ release();
80
+ reject(error);
81
+ });
82
+ child.once("close", (code) => {
83
+ release();
84
+ if (stopReason)
85
+ reject(stopReason);
86
+ else if (code !== 0)
87
+ reject(new CliError(`${command} failed with exit code ${code}`));
88
+ // drizzle-kit catches its own errors, prints the Error to stderr and still exits 0
89
+ else if (STACK_FRAME.test(stderrText))
90
+ reject(new CliError(`${command} failed`));
91
+ else
92
+ resolve();
93
+ if (parentSignal)
94
+ process.kill(process.pid, parentSignal);
95
+ });
96
+ });
97
+ }
98
+ const generate = defineCommand({
99
+ meta: { name: "generate", description: "Generate a SQL migration from the schema" },
100
+ args: {
101
+ name: {
102
+ type: "string",
103
+ description: "Name of the migration file instead of a random one",
104
+ },
105
+ },
106
+ async run({ args }) {
107
+ const { config, rootDir } = await loadParlorConfig();
108
+ await runDrizzleKit(drizzleKitArgs(config.database.schema, config.database.migrations, args.name), rootDir);
109
+ },
110
+ });
111
+ const migrate = defineCommand({
112
+ meta: { name: "migrate", description: "Apply pending migrations to the database" },
113
+ async run() {
114
+ const { config, rootDir } = await loadParlorConfig();
115
+ const database = await createDatabase({
116
+ dataDir: join(rootDir, ".parlor", "pglite"),
117
+ });
118
+ try {
119
+ await database.migrate(join(rootDir, config.database.migrations));
120
+ console.log(`migrations applied with ${database.driver}`);
121
+ }
122
+ finally {
123
+ await database.close();
124
+ }
125
+ },
126
+ });
127
+ export const db = defineCommand({
128
+ meta: { name: "db", description: "Database migrations" },
129
+ subCommands: { generate, migrate },
130
+ });
131
+ //# sourceMappingURL=db.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.js","sourceRoot":"","sources":["../../src/commands/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACl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AE,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC;SAC5C,CAAC,CAAC;QACH,IAAI,CAAC;YACH,MAAM,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;YAClE,OAAO,CAAC,GAAG,CAAC,2BAA2B,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAC5D,CAAC;gBAAS,CAAC;YACT,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EAAE,GAAG,aAAa,CAAC;IAC9B,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,qBAAqB,EAAE;IACxD,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE;CACnC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare function runNitroDeploy(hostRoot: string, preset: string): Promise<void>;
2
+ export declare const deploy: import("citty").CommandDef<{
3
+ readonly preset: {
4
+ readonly type: "string";
5
+ readonly description: "Deploy preset: node-server, vercel, netlify, …";
6
+ };
7
+ }>;
8
+ //# sourceMappingURL=deploy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAYA,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAc9E;AAED,eAAO,MAAM,MAAM;;;;;EAuBjB,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { spawn } from "node:child_process";
2
+ import { createRequire } from "node:module";
3
+ import { loadParlorConfig } from "@parlor/config";
4
+ import { defineCommand } from "citty";
5
+ import { warnChatWithoutAuth } from "../chat-warning.js";
6
+ import { CliError } from "../errors.js";
7
+ import { buildWebAndServer } from "../web-target.js";
8
+ const require = createRequire(import.meta.url);
9
+ export function runNitroDeploy(hostRoot, preset) {
10
+ const bin = require.resolve("nitro/cli");
11
+ return new Promise((resolve, reject) => {
12
+ const child = spawn(process.execPath, [bin, "deploy", "--prebuilt", "--preset", preset, "--dir", hostRoot], { stdio: "inherit" });
13
+ child.once("error", reject);
14
+ child.once("exit", (code) => {
15
+ if (code === 0)
16
+ resolve();
17
+ else
18
+ reject(new CliError(`nitro deploy exited with code ${code}`));
19
+ });
20
+ });
21
+ }
22
+ export const deploy = defineCommand({
23
+ meta: {
24
+ name: "deploy",
25
+ description: "Build the app and deploy the server to its preset",
26
+ },
27
+ args: {
28
+ preset: {
29
+ type: "string",
30
+ description: "Deploy preset: node-server, vercel, netlify, …",
31
+ },
32
+ },
33
+ async run({ args }) {
34
+ const loaded = await loadParlorConfig();
35
+ await warnChatWithoutAuth(loaded);
36
+ const result = await buildWebAndServer(loaded, { preset: args.preset });
37
+ if (result.preset === "node-server") {
38
+ console.log(`node-server has no remote to deploy to. Run: node ${result.outputDir}/server/index.mjs`);
39
+ return;
40
+ }
41
+ await runNitroDeploy(result.rootDir, result.preset);
42
+ },
43
+ });
44
+ //# sourceMappingURL=deploy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,OAAO,GAAG,aAAa,CAAC,O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C,MAAM,KAAK,aAAa,EAAE,CAAC;YACpC,OAAO,CAAC,GAAG,CACT,qDAAqD,MAAM,CAAC,SAAS,mBAAmB,CACzF,CAAC;YACF,OAAO;QACT,CAAC;QACD,MAAM,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ export declare function parsePort(value: unknown): number | undefined;
2
+ export declare const dev: import("citty").CommandDef<{
3
+ readonly target: {
4
+ readonly type: "string";
5
+ readonly description: "web | ios | android | mac | windows | linux, or several joined by commas (web,mac) to run them against one server";
6
+ readonly default: "web";
7
+ };
8
+ readonly port: {
9
+ readonly type: "string";
10
+ readonly description: "Override web.port from parlor.config.ts; a busy port moves to the next free one";
11
+ };
12
+ readonly device: {
13
+ readonly type: "string";
14
+ readonly description: "Simulator or device name for ios and android";
15
+ };
16
+ readonly "agent-host": {
17
+ readonly type: "boolean";
18
+ readonly default: true;
19
+ readonly description: "Serve the chat with this computer's agents (--no-agent-host to skip)";
20
+ };
21
+ }>;
22
+ //# sourceMappingURL=dev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAaA,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAO5D;AAED,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;EAqEd,CAAC"}