clawnify 0.17.0 → 0.18.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.
@@ -619,7 +619,7 @@ async function pollUntilReady(resourceId, options = {}) {
619
619
  }
620
620
 
621
621
  // src/version.ts
622
- var VERSION = "0.17.0";
622
+ var VERSION = "0.18.0";
623
623
 
624
624
  export {
625
625
  OAUTH_CLIENT_ID,
@@ -643,4 +643,4 @@ export {
643
643
  pollUntilReady,
644
644
  VERSION
645
645
  };
646
- //# sourceMappingURL=chunk-HESCKUK4.js.map
646
+ //# sourceMappingURL=chunk-IF377V6W.js.map
@@ -20,7 +20,7 @@ import {
20
20
  resolveOrgContext,
21
21
  saveAuth,
22
22
  saveProject
23
- } from "./chunk-HESCKUK4.js";
23
+ } from "./chunk-IF377V6W.js";
24
24
 
25
25
  // src/cli.ts
26
26
  import { Command, Option } from "commander";
@@ -652,6 +652,40 @@ async function uploadWebsiteDeploy(archive, name, orgId, sync) {
652
652
  const err = await res.json().catch(() => ({}));
653
653
  return { ok: false, error: err.error || res.statusText };
654
654
  }
655
+ async function websiteToReplace(orgId, linkedWebsiteId) {
656
+ const opts = orgId ? { orgId } : void 0;
657
+ const res = await api.get("/v1/websites", opts);
658
+ if (!res.ok) {
659
+ console.error(
660
+ `Could not check this organization's existing website (HTTP ${res.status}). Retry, or pass --replace to deploy anyway.`
661
+ );
662
+ process.exit(1);
663
+ }
664
+ const { website } = await res.json();
665
+ if (!website || website.id === linkedWebsiteId) return null;
666
+ const links = await api.get("/v1/github/links", opts);
667
+ if (links.ok) {
668
+ const data = await links.json();
669
+ if (data.links?.some((l) => l.target.type === "website" && l.target.slug === website.slug)) return null;
670
+ }
671
+ return { slug: website.slug };
672
+ }
673
+ async function refuseWebsiteReplace(orgId, linkedWebsiteId, options) {
674
+ if (options.replace) return;
675
+ const existing = await websiteToReplace(orgId, linkedWebsiteId);
676
+ if (!existing) return;
677
+ console.error(
678
+ `This organization already has a website (${existing.slug}), and this folder isn't linked to it.
679
+ Deploying replaces that site's pages, theme and code with this folder. The live site
680
+ stays up until someone publishes.
681
+
682
+ To edit the existing site: use the website editor in the dashboard, or ask an admin
683
+ to connect GitHub and work in a clone of the workspace repo.
684
+ To replace it on purpose: run this again with --replace.
685
+ `
686
+ );
687
+ process.exit(EXIT_CONFLICT_NEEDS_DECISION);
688
+ }
655
689
  async function deployWebsite(dir, options) {
656
690
  if (options.from) {
657
691
  console.error("--from is app-only for now. Run `clawnify deploy` inside the website project directory.");
@@ -744,13 +778,23 @@ async function deployWebsite(dir, options) {
744
778
  if (files.length > preview.length) {
745
779
  console.log(` ... and ${files.length - preview.length} more`);
746
780
  }
781
+ const existing = options.replace || linkedProject?.anon ? null : await websiteToReplace(orgId, linkedProject?.website_id);
782
+ if (existing) {
783
+ console.log(
784
+ `
785
+ Note: this would replace the organization's existing website (${existing.slug}).
786
+ A real deploy refuses unless you pass --replace.`
787
+ );
788
+ }
747
789
  console.log();
748
790
  return;
749
791
  }
792
+ if (!linkedProject?.anon) await refuseWebsiteReplace(orgId, linkedProject?.website_id, options);
750
793
  console.log(linkedProject?.website_id ? `Updating ${baseName}...` : `Deploying ${baseName}...`);
751
794
  let result = await uploadWebsiteDeploy(archive, baseName, orgId, { dir: resolvedDir, force: options.force });
752
795
  if (!result.ok && result.error === "org_not_accessible" && linkedProject?.anon) {
753
796
  orgId = await healStaleAnonLink(resolvedDir, linkedProject.anon);
797
+ await refuseWebsiteReplace(orgId, void 0, options);
754
798
  result = await uploadWebsiteDeploy(archive, baseName, orgId, { dir: resolvedDir, force: options.force });
755
799
  }
756
800
  if (!result.ok) {
@@ -1710,7 +1754,7 @@ function agentByName(name) {
1710
1754
  var ALL_AGENTS = DETECTORS.map((d) => d.agent);
1711
1755
 
1712
1756
  // src/lib/skills/content.gen.ts
1713
- var CLI_VERSION = "0.17.0";
1757
+ var CLI_VERSION = "0.18.0";
1714
1758
  var BUNDLED_SKILLS = [
1715
1759
  {
1716
1760
  name: "build-a-clawnify-app",
@@ -4343,7 +4387,7 @@ async function runCli() {
4343
4387
  "--agent-id <id>",
4344
4388
  "Agent deploy: which agent to push to when the org has several (saved as a link)"
4345
4389
  )
4346
- ).addOption(legacyServerOption()).option("--agent <name>", "Agent deploy: the named agent to push to (default: main)").option("--path <subdir>", "Subdirectory within the --from repo that holds the app (monorepo)").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 conflict, update the existing app").option("--update-existing", "Non-interactive: on conflict, overwrite the existing app").option("--create-new", "Non-interactive: on conflict, create a new app with the suggested slug").option("--dry-run", "List files that would be uploaded; do not deploy").option("--no-sync", "Skip the post-deploy schema.sql sync into the local working directory").option("--force", "Deploy even if it would overwrite newer changes in the synced GitHub repo").action(deployCommand);
4390
+ ).addOption(legacyServerOption()).option("--agent <name>", "Agent deploy: the named agent to push to (default: main)").option("--path <subdir>", "Subdirectory within the --from repo that holds the app (monorepo)").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 conflict, update the existing app").option("--update-existing", "Non-interactive: on conflict, overwrite the existing app").option("--create-new", "Non-interactive: on conflict, create a new app with the suggested slug").option("--dry-run", "List files that would be uploaded; do not deploy").option("--no-sync", "Skip the post-deploy schema.sql sync into the local working directory").option("--force", "Deploy even if it would overwrite newer changes in the synced GitHub repo").option("--replace", "Website deploy: replace the organization's existing website with this folder, which isn't linked to it").action(deployCommand);
4347
4391
  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);
4348
4392
  const pull = program.command("pull").description("Pull artifacts from a deployed app into the current directory");
4349
4393
  pull.command("schema").description("Fetch the deployed app's current schema.sql snapshot into the local repo").option("--from <app-id-or-slug>", "App to fetch from (required)").option("--out <path>", "Where to write (default: ./schema.sql)").option("--force", "Overwrite a locally-modified or uncommitted schema.sql").option("--org <slug-or-id>", "Restrict the app lookup to a specific org").action(pullSchemaCommand);
@@ -4409,4 +4453,4 @@ async function runCli() {
4409
4453
  export {
4410
4454
  runCli
4411
4455
  };
4412
- //# sourceMappingURL=cli-MFJLZHMN.js.map
4456
+ //# sourceMappingURL=cli-ONUETCNY.js.map