clawnify 0.1.15 → 0.1.16

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.
@@ -14,7 +14,7 @@ import {
14
14
  readProject,
15
15
  saveAuth,
16
16
  saveProject
17
- } from "./chunk-GXEDX326.js";
17
+ } from "./chunk-CMM323B2.js";
18
18
 
19
19
  // src/cli.ts
20
20
  import { Command } from "commander";
@@ -171,6 +171,8 @@ async function loginCommand() {
171
171
  // src/commands/deploy.ts
172
172
  import path from "path";
173
173
  import readline2 from "readline";
174
+ var EXIT_USAGE = 64;
175
+ var EXIT_CONFLICT_NEEDS_DECISION = 75;
174
176
  function ask(question) {
175
177
  const rl = readline2.createInterface({
176
178
  input: process.stdin,
@@ -226,15 +228,95 @@ function assertNodeVersion() {
226
228
  process.exit(1);
227
229
  }
228
230
  }
229
- async function deployCommand(dir, options) {
231
+ async function resolveOrgId(options, linkedProject) {
232
+ if (options.org) {
233
+ const orgs = await listMyOrgs();
234
+ const match = orgs.find((o) => o.id === options.org || o.slug === options.org);
235
+ if (!match) {
236
+ console.error(
237
+ `No org matched "${options.org}". Available: ${orgs.map((o) => o.slug).join(", ")}`
238
+ );
239
+ process.exit(EXIT_USAGE);
240
+ }
241
+ if (linkedProject?.app_id && linkedProject.org_id && linkedProject.org_id !== match.id) {
242
+ console.error(
243
+ `This project is linked to a different org (${linkedProject.org_id}).
244
+ --org ${options.org} resolves to ${match.id}.
245
+ Re-link first: clawnify link ${linkedProject.app_id} --org ${options.org}`
246
+ );
247
+ process.exit(1);
248
+ }
249
+ return match.id;
250
+ }
251
+ if (linkedProject?.app_id && linkedProject.org_id) {
252
+ return linkedProject.org_id;
253
+ }
254
+ return void 0;
255
+ }
256
+ async function resolveConflictDecision(options, conflict) {
257
+ if (options.updateExisting) return "update";
258
+ if (options.createNew) return "create";
259
+ if (options.yes) return "update";
260
+ if (!process.stdin.isTTY) {
261
+ console.error(
262
+ `
263
+ Slug '${conflict.slug}' is taken in this organization.
264
+ Pass one of:
265
+ --update-existing overwrite the existing app
266
+ --create-new deploy as '${conflict.suggested_slug}'
267
+ --yes default to update (safest)
268
+ `
269
+ );
270
+ process.exit(EXIT_CONFLICT_NEEDS_DECISION);
271
+ }
272
+ console.log(
273
+ `
274
+ Slug '${conflict.slug}' is taken in this organization (currently held by an app named '${conflict.existing_app_name}').
275
+ `
276
+ );
277
+ console.log(` 1) Update that app \u2014 deploy this source over it`);
278
+ console.log(` 2) Create a new app at slug '${conflict.suggested_slug}'
279
+ `);
280
+ const answer = await ask(" Choose [1/2] (default 1): ");
281
+ if (answer === "" || answer === "1") return "update";
282
+ if (answer === "2") return "create";
283
+ console.error(
284
+ `
285
+ Cancelled. Received '${answer}' \u2014 expected 1 or 2.
286
+ For non-interactive use, pass --update-existing or --create-new.
287
+ `
288
+ );
289
+ return "cancel";
290
+ }
291
+ function summarizeArchive(buf, files, framework, name) {
292
+ const sizeKB = (buf.length / 1024).toFixed(1);
293
+ console.log(`
294
+ Dry run \u2014 would deploy '${name}' (${framework})`);
295
+ console.log(` Archive: ${files.length} files, ${sizeKB}KB gzipped
296
+ `);
297
+ const preview = files.slice(0, 25);
298
+ for (const f of preview) console.log(` ${f}`);
299
+ if (files.length > preview.length) {
300
+ console.log(` ... and ${files.length - preview.length} more`);
301
+ }
302
+ console.log();
303
+ }
304
+ async function deployCommand(dir, options = {}) {
230
305
  assertNodeVersion();
231
306
  let appId;
232
307
  let slug;
233
308
  let appToken;
234
- if (options?.from) {
309
+ if (options.from) {
235
310
  const repo = options.from.replace(/^github:/, "");
311
+ if (options.dryRun) {
312
+ console.log(`
313
+ Dry run \u2014 would deploy from GitHub repo '${repo}' (branch: main)
314
+ `);
315
+ return;
316
+ }
236
317
  console.log(`Deploying from ${repo}...`);
237
- const res = await api.post("/v1/apps/deploy", { repo, branch: "main" });
318
+ const orgId = options.org ? await resolveOrgId(options, null) : void 0;
319
+ const res = await api.post("/v1/apps/deploy", { repo, branch: "main" }, { orgId });
238
320
  if (!res.ok) {
239
321
  const err = await res.json().catch(() => ({}));
240
322
  console.error(`Deploy failed: ${err.error || res.statusText}`);
@@ -247,14 +329,25 @@ async function deployCommand(dir, options) {
247
329
  } else {
248
330
  const resolvedDir = dir ? path.resolve(dir) : process.cwd();
249
331
  const manifest = readManifest(resolvedDir);
250
- const baseName = options?.name || manifest?.name || path.basename(resolvedDir);
332
+ const baseName = options.name || manifest?.name || path.basename(resolvedDir);
251
333
  const framework = manifest?.app?.framework || "vite-preact";
252
334
  const linkedProject = readProject(resolvedDir);
253
- const archive = createArchive(resolvedDir);
254
- const projectOrgId = linkedProject?.org_id;
335
+ const { archive, files } = createArchive(resolvedDir);
336
+ const orgId = await resolveOrgId(options, linkedProject);
337
+ if (options.dryRun) {
338
+ summarizeArchive(archive, files, framework, baseName);
339
+ if (linkedProject?.app_id) {
340
+ console.log(` Would update existing app: ${linkedProject.slug ?? linkedProject.app_id}
341
+ `);
342
+ } else {
343
+ console.log(` Would create new app: ${baseName}
344
+ `);
345
+ }
346
+ return;
347
+ }
255
348
  if (linkedProject?.app_id) {
256
349
  console.log(`Updating ${baseName} (${linkedProject.slug ?? linkedProject.app_id})...`);
257
- const result2 = await uploadRedeploy(linkedProject.app_id, archive, projectOrgId);
350
+ const result2 = await uploadRedeploy(linkedProject.app_id, archive, orgId);
258
351
  if (!result2.ok) {
259
352
  console.error(`Deploy failed: ${result2.error}`);
260
353
  process.exit(1);
@@ -262,23 +355,14 @@ async function deployCommand(dir, options) {
262
355
  appId = result2.data.app_id;
263
356
  slug = result2.data.slug;
264
357
  appToken = result2.data.app_token;
265
- saveProject(resolvedDir, { org_id: projectOrgId, app_id: appId, slug, app_token: appToken });
358
+ saveProject(resolvedDir, { org_id: orgId, app_id: appId, slug, app_token: appToken });
266
359
  } else {
267
360
  console.log(`Deploying ${baseName}...`);
268
- let result2 = await uploadDeploy(archive, baseName, framework, projectOrgId);
361
+ let result2 = await uploadDeploy(archive, baseName, framework, orgId);
269
362
  if (!result2.ok && "conflict" in result2) {
270
- const c = result2.conflict;
271
- console.log(
272
- `
273
- An app named '${c.existing_app_name}' (slug: ${c.slug}) already exists in this organization.
274
- `
275
- );
276
- console.log(` 1) Update the existing app`);
277
- console.log(` 2) Create a new app as '${c.suggested_slug}'
278
- `);
279
- const answer = await ask(" Choose [1/2]: ");
280
- if (answer === "1" || answer === "") {
281
- const redeployResult = await uploadRedeploy(c.existing_app_id, archive, projectOrgId);
363
+ const decision = await resolveConflictDecision(options, result2.conflict);
364
+ if (decision === "update") {
365
+ const redeployResult = await uploadRedeploy(result2.conflict.existing_app_id, archive, orgId);
282
366
  if (!redeployResult.ok) {
283
367
  console.error(`Deploy failed: ${redeployResult.error}`);
284
368
  process.exit(1);
@@ -286,8 +370,8 @@ async function deployCommand(dir, options) {
286
370
  appId = redeployResult.data.app_id;
287
371
  slug = redeployResult.data.slug;
288
372
  appToken = redeployResult.data.app_token;
289
- } else if (answer === "2") {
290
- result2 = await uploadDeploy(archive, c.suggested_slug, framework, projectOrgId);
373
+ } else if (decision === "create") {
374
+ result2 = await uploadDeploy(archive, result2.conflict.suggested_slug, framework, orgId);
291
375
  if (!result2.ok) {
292
376
  const errMsg = "conflict" in result2 ? "Slug still conflicts" : result2.error;
293
377
  console.error(`Deploy failed: ${errMsg}`);
@@ -297,8 +381,7 @@ async function deployCommand(dir, options) {
297
381
  slug = result2.data.slug;
298
382
  appToken = result2.data.app_token;
299
383
  } else {
300
- console.error("Cancelled.");
301
- process.exit(1);
384
+ process.exit(EXIT_CONFLICT_NEEDS_DECISION);
302
385
  }
303
386
  } else if (!result2.ok) {
304
387
  console.error(`Deploy failed: ${result2.error}`);
@@ -308,7 +391,7 @@ async function deployCommand(dir, options) {
308
391
  slug = result2.data.slug;
309
392
  appToken = result2.data.app_token;
310
393
  }
311
- saveProject(resolvedDir, { org_id: projectOrgId, app_id: appId, slug, app_token: appToken });
394
+ saveProject(resolvedDir, { org_id: orgId, app_id: appId, slug, app_token: appToken });
312
395
  }
313
396
  }
314
397
  const result = await pollUntilReady(appId);
@@ -503,7 +586,7 @@ async function initCommand(dir, opts) {
503
586
  "@types/react": "^19.0.0",
504
587
  "@types/react-dom": "^19.0.0",
505
588
  "@vitejs/plugin-react": "^4.0.0",
506
- "clawnify": "^0.1.13",
589
+ "clawnify": "^0.1.15",
507
590
  "tailwindcss": "^4.0.0",
508
591
  "vite": "^6.0.0",
509
592
  "wrangler": "^4.0.0"
@@ -518,9 +601,11 @@ async function initCommand(dir, opts) {
518
601
  deploy: "clawnify deploy"
519
602
  },
520
603
  dependencies: {
604
+ "@hono/zod-openapi": "^0.19.0",
521
605
  hono: "^4.0.0",
522
606
  react: "^19.0.0",
523
- "react-dom": "^19.0.0"
607
+ "react-dom": "^19.0.0",
608
+ zod: "^3.0.0"
524
609
  },
525
610
  devDependencies: devDeps,
526
611
  engines: { node: ">=22" },
@@ -625,14 +710,14 @@ export async function run(
625
710
  }
626
711
  `);
627
712
  if (storage) {
628
- write(targetDir, "src/server/index.ts", `import { Hono } from "hono";
713
+ write(targetDir, "src/server/index.ts", `import { OpenAPIHono } from "@hono/zod-openapi";
629
714
  import { initDB } from "./db";
630
715
  import { initUploads } from "./uploads";
631
716
  import api from "./routes";
632
717
 
633
718
  type Env = { Bindings: { DB: D1Database; UPLOADS: R2Bucket } };
634
719
 
635
- const app = new Hono<Env>();
720
+ const app = new OpenAPIHono<Env>();
636
721
 
637
722
  app.use("*", async (c, next) => {
638
723
  initDB(c.env.DB);
@@ -642,6 +727,11 @@ app.use("*", async (c, next) => {
642
727
 
643
728
  app.route("/", api);
644
729
 
730
+ app.doc("/api/openapi.json", {
731
+ openapi: "3.0.0",
732
+ info: { title: "${name}", version: "1.0.0" },
733
+ });
734
+
645
735
  export default app;
646
736
  `);
647
737
  write(targetDir, "src/server/uploads.ts", `let _bucket: R2Bucket;
@@ -686,13 +776,13 @@ export async function readUploadAsBase64DataUrl(
686
776
  }
687
777
  `);
688
778
  } else {
689
- write(targetDir, "src/server/index.ts", `import { Hono } from "hono";
779
+ write(targetDir, "src/server/index.ts", `import { OpenAPIHono } from "@hono/zod-openapi";
690
780
  import { initDB } from "./db";
691
781
  import api from "./routes";
692
782
 
693
783
  type Env = { Bindings: { DB: D1Database } };
694
784
 
695
- const app = new Hono<Env>();
785
+ const app = new OpenAPIHono<Env>();
696
786
 
697
787
  app.use("*", async (c, next) => {
698
788
  initDB(c.env.DB);
@@ -701,6 +791,11 @@ app.use("*", async (c, next) => {
701
791
 
702
792
  app.route("/", api);
703
793
 
794
+ app.doc("/api/openapi.json", {
795
+ openapi: "3.0.0",
796
+ info: { title: "${name}", version: "1.0.0" },
797
+ });
798
+
704
799
  export default app;
705
800
  `);
706
801
  }
@@ -739,15 +834,34 @@ function writeBlankTemplate(dir, name) {
739
834
  created_at TEXT NOT NULL DEFAULT (datetime('now'))
740
835
  );
741
836
  `);
742
- write(dir, "src/server/routes.ts", `import { Hono } from "hono";
837
+ write(dir, "src/server/routes.ts", `import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
743
838
  import { query } from "./db";
744
839
 
745
- const api = new Hono();
840
+ const api = new OpenAPIHono();
746
841
 
747
- api.get("/api/items", async (c) => {
748
- const items = await query("SELECT * FROM items ORDER BY created_at DESC");
749
- return c.json(items);
750
- });
842
+ const ItemSchema = z.object({
843
+ id: z.number(),
844
+ name: z.string(),
845
+ created_at: z.string(),
846
+ }).openapi("Item");
847
+
848
+ api.openapi(
849
+ createRoute({
850
+ method: "get",
851
+ path: "/api/items",
852
+ summary: "List items",
853
+ responses: {
854
+ 200: {
855
+ description: "List of items",
856
+ content: { "application/json": { schema: z.array(ItemSchema) } },
857
+ },
858
+ },
859
+ }),
860
+ async (c) => {
861
+ const items = await query("SELECT * FROM items ORDER BY created_at DESC");
862
+ return c.json(items);
863
+ },
864
+ );
751
865
 
752
866
  export default api;
753
867
  `);
@@ -786,41 +900,107 @@ function writeCrudTemplate(dir, name) {
786
900
  created_at TEXT NOT NULL DEFAULT (datetime('now'))
787
901
  );
788
902
  `);
789
- write(dir, "src/server/routes.ts", `import { Hono } from "hono";
903
+ write(dir, "src/server/routes.ts", `import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
790
904
  import { query, run } from "./db";
791
905
 
792
- const api = new Hono();
906
+ const api = new OpenAPIHono();
793
907
 
794
- api.get("/api/items", async (c) => {
795
- const items = await query("SELECT * FROM items ORDER BY created_at DESC");
796
- return c.json(items);
797
- });
908
+ const ItemSchema = z.object({
909
+ id: z.number(),
910
+ title: z.string(),
911
+ status: z.string(),
912
+ created_at: z.string(),
913
+ }).openapi("Item");
798
914
 
799
- api.post("/api/items", async (c) => {
800
- const { title } = await c.req.json<{ title: string }>();
801
- if (!title?.trim()) return c.json({ error: "Title required" }, 400);
802
- const result = await run("INSERT INTO items (title) VALUES (?)", [title.trim()]);
803
- return c.json({ id: result.lastInsertRowid, title: title.trim(), status: "active" }, 201);
804
- });
915
+ const CreateItemSchema = z.object({ title: z.string().min(1) }).openapi("CreateItem");
916
+ const UpdateItemSchema = z.object({
917
+ title: z.string().min(1).optional(),
918
+ status: z.string().optional(),
919
+ }).openapi("UpdateItem");
920
+ const IdParamSchema = z.object({ id: z.string() });
921
+ const OkSchema = z.object({ ok: z.boolean() }).openapi("Ok");
805
922
 
806
- api.patch("/api/items/:id", async (c) => {
807
- const id = c.req.param("id");
808
- const body = await c.req.json<{ title?: string; status?: string }>();
809
- const sets: string[] = [];
810
- const params: unknown[] = [];
811
- if (body.title !== undefined) { sets.push("title = ?"); params.push(body.title); }
812
- if (body.status !== undefined) { sets.push("status = ?"); params.push(body.status); }
813
- if (sets.length === 0) return c.json({ error: "Nothing to update" }, 400);
814
- params.push(id);
815
- await run(\`UPDATE items SET \${sets.join(", ")} WHERE id = ?\`, params);
816
- return c.json({ ok: true });
817
- });
923
+ api.openapi(
924
+ createRoute({
925
+ method: "get",
926
+ path: "/api/items",
927
+ summary: "List items",
928
+ responses: {
929
+ 200: {
930
+ description: "List of items",
931
+ content: { "application/json": { schema: z.array(ItemSchema) } },
932
+ },
933
+ },
934
+ }),
935
+ async (c) => {
936
+ const items = await query("SELECT * FROM items ORDER BY created_at DESC");
937
+ return c.json(items);
938
+ },
939
+ );
818
940
 
819
- api.delete("/api/items/:id", async (c) => {
820
- const id = c.req.param("id");
821
- await run("DELETE FROM items WHERE id = ?", [id]);
822
- return c.json({ ok: true });
823
- });
941
+ api.openapi(
942
+ createRoute({
943
+ method: "post",
944
+ path: "/api/items",
945
+ summary: "Create item",
946
+ request: { body: { content: { "application/json": { schema: CreateItemSchema } } } },
947
+ responses: {
948
+ 201: {
949
+ description: "Created item",
950
+ content: { "application/json": { schema: ItemSchema } },
951
+ },
952
+ },
953
+ }),
954
+ async (c) => {
955
+ const { title } = c.req.valid("json");
956
+ const result = await run("INSERT INTO items (title) VALUES (?)", [title.trim()]);
957
+ return c.json({ id: result.lastInsertRowid, title: title.trim(), status: "active", created_at: new Date().toISOString() }, 201);
958
+ },
959
+ );
960
+
961
+ api.openapi(
962
+ createRoute({
963
+ method: "patch",
964
+ path: "/api/items/:id",
965
+ summary: "Update item",
966
+ request: {
967
+ params: IdParamSchema,
968
+ body: { content: { "application/json": { schema: UpdateItemSchema } } },
969
+ },
970
+ responses: {
971
+ 200: { description: "Updated", content: { "application/json": { schema: OkSchema } } },
972
+ },
973
+ }),
974
+ async (c) => {
975
+ const { id } = c.req.valid("param");
976
+ const body = c.req.valid("json");
977
+ const sets: string[] = [];
978
+ const params: unknown[] = [];
979
+ if (body.title !== undefined) { sets.push("title = ?"); params.push(body.title); }
980
+ if (body.status !== undefined) { sets.push("status = ?"); params.push(body.status); }
981
+ if (sets.length === 0) return c.json({ ok: false }, 400);
982
+ params.push(id);
983
+ await run(\`UPDATE items SET \${sets.join(", ")} WHERE id = ?\`, params);
984
+ return c.json({ ok: true });
985
+ },
986
+ );
987
+
988
+ api.openapi(
989
+ createRoute({
990
+ method: "delete",
991
+ path: "/api/items/:id",
992
+ summary: "Delete item",
993
+ request: { params: IdParamSchema },
994
+ responses: {
995
+ 200: { description: "Deleted", content: { "application/json": { schema: OkSchema } } },
996
+ },
997
+ }),
998
+ async (c) => {
999
+ const { id } = c.req.valid("param");
1000
+ await run("DELETE FROM items WHERE id = ?", [id]);
1001
+ return c.json({ ok: true });
1002
+ },
1003
+ );
824
1004
 
825
1005
  export default api;
826
1006
  `);
@@ -1089,7 +1269,44 @@ function runQuiet(cwd, cmd, args) {
1089
1269
 
1090
1270
  // src/commands/link.ts
1091
1271
  import path4 from "path";
1092
- async function linkCommand(appId, options) {
1272
+ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1273
+ async function findByAppId(orgs, appId) {
1274
+ for (const org of orgs) {
1275
+ const res = await api.get(`/v1/apps/${appId}`, { orgId: org.id });
1276
+ if (res.ok) {
1277
+ return { app: await res.json(), org };
1278
+ }
1279
+ if (res.status !== 404) {
1280
+ const err = await res.json().catch(() => ({}));
1281
+ console.error(`Link failed (${org.name}): ${err.error || res.statusText}`);
1282
+ process.exit(1);
1283
+ }
1284
+ }
1285
+ return null;
1286
+ }
1287
+ async function findBySlug(orgs, slug) {
1288
+ for (const org of orgs) {
1289
+ const res = await api.get(`/v1/apps`, { orgId: org.id });
1290
+ if (!res.ok) {
1291
+ if (res.status === 404) continue;
1292
+ const err = await res.json().catch(() => ({}));
1293
+ console.error(`Link failed (${org.name}): ${err.error || res.statusText}`);
1294
+ process.exit(1);
1295
+ }
1296
+ const payload = await res.json();
1297
+ const apps = Array.isArray(payload) ? payload : payload.apps;
1298
+ const match = apps.find((a) => a.slug === slug);
1299
+ if (match) {
1300
+ const detailRes = await api.get(`/v1/apps/${match.id}`, { orgId: org.id });
1301
+ if (detailRes.ok) {
1302
+ return { app: await detailRes.json(), org };
1303
+ }
1304
+ return { app: match, org };
1305
+ }
1306
+ }
1307
+ return null;
1308
+ }
1309
+ async function linkCommand(appIdOrSlug, options) {
1093
1310
  const dir = options?.dir ? path4.resolve(options.dir) : process.cwd();
1094
1311
  const orgs = await listMyOrgs();
1095
1312
  if (orgs.length === 0) {
@@ -1098,36 +1315,28 @@ async function linkCommand(appId, options) {
1098
1315
  }
1099
1316
  const candidates = options?.org ? orgs.filter((o) => o.id === options.org || o.slug === options.org) : orgs;
1100
1317
  if (candidates.length === 0) {
1101
- console.error(`No org matched "${options?.org}". Available: ${orgs.map((o) => o.slug).join(", ")}`);
1318
+ console.error(
1319
+ `No org matched "${options?.org}". Available: ${orgs.map((o) => o.slug).join(", ")}`
1320
+ );
1102
1321
  process.exit(1);
1103
1322
  }
1104
- let matched = null;
1105
- for (const org of candidates) {
1106
- const res = await api.get(`/v1/apps/${appId}`, { orgId: org.id });
1107
- if (res.ok) {
1108
- matched = { app: await res.json(), orgId: org.id, orgName: org.name };
1109
- break;
1110
- }
1111
- if (res.status !== 404) {
1112
- const err = await res.json().catch(() => ({}));
1113
- console.error(`Link failed (${org.name}): ${err.error || res.statusText}`);
1114
- process.exit(1);
1115
- }
1116
- }
1323
+ const isUuid = UUID_RE.test(appIdOrSlug);
1324
+ const matched = isUuid ? await findByAppId(candidates, appIdOrSlug) : await findBySlug(candidates, appIdOrSlug);
1117
1325
  if (!matched) {
1326
+ const kind = isUuid ? "id" : "slug";
1118
1327
  console.error(
1119
- `App ${appId} not found in any org you belong to (${candidates.map((o) => o.slug).join(", ")}). Check the id in the dashboard.`
1328
+ `App with ${kind} '${appIdOrSlug}' not found in ${candidates.map((o) => o.slug).join(", ")}.`
1120
1329
  );
1121
1330
  process.exit(1);
1122
1331
  }
1123
1332
  saveProject(dir, {
1124
- org_id: matched.orgId,
1333
+ org_id: matched.org.id,
1125
1334
  app_id: matched.app.id,
1126
1335
  slug: matched.app.slug,
1127
1336
  app_token: matched.app.app_token
1128
1337
  });
1129
1338
  const rel = path4.relative(process.cwd(), dir) || ".";
1130
- console.log(` Linked ${matched.app.name} (${matched.app.slug}) in ${matched.orgName}`);
1339
+ console.log(` Linked ${matched.app.name} (${matched.app.slug}) in ${matched.org.name}`);
1131
1340
  console.log(` Wrote ${rel}/.clawnify/project.json`);
1132
1341
  console.log(` Run \`clawnify deploy\` to push the current source to this app.`);
1133
1342
  }
@@ -1176,8 +1385,8 @@ function runCli() {
1176
1385
  program.command("init [dir]").description("Scaffold a new Clawnify app").option("--name <name>", "App name (skips prompt)").option("--template <template>", "Template: blank or crud (skips prompt)").option("--storage", "Enable file uploads (R2)").action(initCommand);
1177
1386
  program.command("dev [dir]").description("Start local dev server").option("--port <port>", "API server port (default: 8787)").action(devCommand);
1178
1387
  program.command("login").description("Authenticate with Clawnify").action(loginCommand);
1179
- program.command("deploy [dir]").description("Deploy an app to Clawnify").option("--from <repo>", "Deploy from a GitHub repo (owner/repo)").option("--name <name>", "Override app name").action(deployCommand);
1180
- program.command("link <app-id>").description("Link the current directory to an existing Clawnify app").option("--dir <dir>", "Directory to link (default: cwd)").option("--org <slug-or-id>", "Restrict the app lookup to a specific org").action(linkCommand);
1388
+ program.command("deploy [dir]").description("Deploy an app to Clawnify").option("--from <repo>", "Deploy from a GitHub repo (owner/repo)").option("--name <name>", "Override app name").option("--org <slug-or-id>", "Deploy to a specific org (overrides active org)").option("-y, --yes", "Non-interactive: on slug conflict, update existing app").option("--update-existing", "Non-interactive: on slug conflict, overwrite existing app").option("--create-new", "Non-interactive: on slug conflict, create a new app with the suggested slug").option("--dry-run", "List files that would be uploaded; do not deploy").action(deployCommand);
1389
+ program.command("link <app-id-or-slug>").description("Link the current directory to an existing Clawnify app (accepts id or slug)").option("--dir <dir>", "Directory to link (default: cwd)").option("--org <slug-or-id>", "Restrict the app lookup to a specific org").action(linkCommand);
1181
1390
  const org = program.command("org").description("Manage organizations");
1182
1391
  org.command("list").description("List orgs you belong to").action(orgListCommand);
1183
1392
  org.command("use <slug-or-id>").description("Set the active org for global commands (ls, whoami, etc.)").action(orgUseCommand);
@@ -1191,4 +1400,4 @@ function runCli() {
1191
1400
  export {
1192
1401
  runCli
1193
1402
  };
1194
- //# sourceMappingURL=cli-VQJAJZQV.js.map
1403
+ //# sourceMappingURL=cli-KWGS4LVM.js.map