@mediamonks/canopy-cli 0.7.41 → 0.7.43

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 (47) hide show
  1. package/dist/{ai-PXXMv7kO.mjs → ai-FBHTSCLZ.mjs} +2 -2
  2. package/dist/{api-BHzCvDcY.mjs → api-Bl6SG8Oq.mjs} +63 -5
  3. package/dist/{browse-DRz1DowL.mjs → browse-dyOThTyf.mjs} +2 -2
  4. package/dist/{db-5LfBG6N7.mjs → db-BJJGydgL.mjs} +4 -4
  5. package/dist/{deploy-6rYq1Iq8.mjs → deploy-ExrIeX_m.mjs} +27 -8
  6. package/dist/dev-BmI5kwoG.mjs +2 -0
  7. package/dist/{dev-D_gyIeUq.mjs → dev-adLLSY1F.mjs} +8 -8
  8. package/dist/{dev-worker-D78leKBJ.mjs → dev-worker-DJekKSdb.mjs} +1 -1
  9. package/dist/docs/ci.md +19 -1
  10. package/dist/docs/cli-rename.md +51 -0
  11. package/dist/docs/developers-architecture.md +12 -0
  12. package/dist/docs/git.md +5 -0
  13. package/dist/docs/index.json +11 -1
  14. package/dist/docs/platform-egress.md +14 -7
  15. package/dist/docs/rename.md +65 -0
  16. package/dist/docs/static-serving.md +13 -4
  17. package/dist/{docs-B9xGnLSR.mjs → docs-CaAgJWK3.mjs} +4 -4
  18. package/dist/{egress-CCpOsYpS.mjs → egress-C2amvqmE.mjs} +3 -3
  19. package/dist/{feedback-CdjtPumG.mjs → feedback-CMnG2Zvs.mjs} +4 -4
  20. package/dist/index.mjs +33 -32
  21. package/dist/{local-Dshy0NsJ.mjs → local-2xtxtoUd.mjs} +3 -3
  22. package/dist/{login-CKNFCp7c.mjs → login-CREcZfLH.mjs} +3 -3
  23. package/dist/{logs-D3WakFME.mjs → logs-BnrNZvLc.mjs} +3 -3
  24. package/dist/{mcp-CoVS5Mj3.mjs → mcp-BVIU4j9N.mjs} +8 -6
  25. package/dist/{migrations-DDJ5JJqj.mjs → migrations-D8NqjC5I.mjs} +2 -2
  26. package/dist/{open-BPYozPQo.mjs → open-Bpz4C2Sr.mjs} +2 -2
  27. package/dist/{package-SWgTmctH.mjs → package-XOtqboS1.mjs} +1 -1
  28. package/dist/project-template-715H_lnu.mjs +2 -0
  29. package/dist/{project-template-DACdMdpn.mjs → project-template-Cdr1uwwE.mjs} +3 -3
  30. package/dist/{projects-naWQ89Qj.mjs → projects-BRG2HnBs.mjs} +5 -5
  31. package/dist/rename-BGKa25Rq.mjs +81 -0
  32. package/dist/{repo-BCua4L-I.mjs → repo-CwT2RDoW.mjs} +5 -3
  33. package/dist/repo-DmFs6H9m.mjs +2 -0
  34. package/dist/{schedule-DjHcaxyt.mjs → schedule-BcqBspn3.mjs} +3 -3
  35. package/dist/{secrets-COwRvCev.mjs → secrets-BjbIi7Gp.mjs} +3 -3
  36. package/dist/{site-DM2J10CB.mjs → site-0i7wAJqg.mjs} +24 -1
  37. package/dist/{skill-DSYQA4Ls.mjs → skill-Ct-aCOzg.mjs} +2 -2
  38. package/dist/{src-RUf3Gfuh.mjs → src-CScXotBB.mjs} +727 -1
  39. package/dist/{staging-CYMTZyyM.mjs → staging-_2Js0Fkc.mjs} +3 -3
  40. package/dist/{token-CCpJ1ES4.mjs → token-7vSNuz-X.mjs} +3 -3
  41. package/dist/{ui-SBUdC9rX.mjs → ui-CLnICOne.mjs} +1 -1
  42. package/dist/{upgrade-B_tLCpc4.mjs → upgrade-DJogeXAF.mjs} +2 -2
  43. package/dist/{usage-BSPnsMXd.mjs → usage-DGGmTwjJ.mjs} +3 -3
  44. package/package.json +1 -1
  45. package/dist/dev-D38FQ2LD.mjs +0 -2
  46. package/dist/project-template-CMgD5hnV.mjs +0 -2
  47. package/dist/repo-Un_p617X.mjs +0 -2
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as version } from "./package-SWgTmctH.mjs";
3
- import { r as siteHeaderLine, t as setInvocationProfile } from "./site-DM2J10CB.mjs";
2
+ import { t as version } from "./package-XOtqboS1.mjs";
3
+ import { i as siteHeaderLine, n as setInvocationProfile } from "./site-0i7wAJqg.mjs";
4
4
  import { a as notifyOfUpdate, o as runRefresh } from "./version-check-CcsA1QjI.mjs";
5
5
  import { defineCommand, runMain } from "citty";
6
6
  //#region src/index.ts
@@ -63,36 +63,37 @@ const main = defineCommand({
63
63
  description: "canopy — create and deploy vibecoded projects"
64
64
  },
65
65
  subCommands: {
66
- login: () => import("./login-CKNFCp7c.mjs").then((m) => m.loginCommand),
67
- whoami: () => import("./login-CKNFCp7c.mjs").then((m) => m.whoamiCommand),
68
- logout: () => import("./login-CKNFCp7c.mjs").then((m) => m.logoutCommand),
69
- create: () => import("./projects-naWQ89Qj.mjs").then((m) => m.createCommand),
70
- init: () => import("./projects-naWQ89Qj.mjs").then((m) => m.initCommand),
71
- projects: () => import("./projects-naWQ89Qj.mjs").then((m) => m.projectsCommand),
72
- delete: () => import("./projects-naWQ89Qj.mjs").then((m) => m.deleteCommand),
73
- dev: () => import("./dev-D38FQ2LD.mjs").then((m) => m.devCommand),
74
- deploy: () => import("./deploy-6rYq1Iq8.mjs").then((m) => m.deployCommand),
75
- promote: () => import("./deploy-6rYq1Iq8.mjs").then((m) => m.promoteCommand),
76
- staging: () => import("./staging-CYMTZyyM.mjs").then((m) => m.stagingCommand),
77
- rollback: () => import("./deploy-6rYq1Iq8.mjs").then((m) => m.rollbackCommand),
78
- download: () => import("./deploy-6rYq1Iq8.mjs").then((m) => m.downloadCommand),
79
- token: () => import("./token-CCpJ1ES4.mjs").then((m) => m.tokenCommand),
80
- egress: () => import("./egress-CCpOsYpS.mjs").then((m) => m.egressCommand),
81
- secrets: () => import("./secrets-COwRvCev.mjs").then((m) => m.secretsCommand),
82
- schedule: () => import("./schedule-DjHcaxyt.mjs").then((m) => m.scheduleCommand),
83
- feedback: () => import("./feedback-CdjtPumG.mjs").then((m) => m.feedbackCommand),
84
- db: () => import("./db-5LfBG6N7.mjs").then((m) => m.dbCommand),
85
- usage: () => import("./usage-BSPnsMXd.mjs").then((m) => m.usageCommand),
86
- ai: () => import("./ai-PXXMv7kO.mjs").then((m) => m.aiCommand),
87
- open: () => import("./open-BPYozPQo.mjs").then((m) => m.openCommand),
88
- browse: () => import("./browse-DRz1DowL.mjs").then((m) => m.browseCommand),
89
- docs: () => import("./docs-B9xGnLSR.mjs").then((m) => m.docsCommand),
90
- skill: () => import("./skill-DSYQA4Ls.mjs").then((m) => m.skillCommand),
91
- upgrade: () => import("./upgrade-B_tLCpc4.mjs").then((m) => m.upgradeCommand),
92
- logs: () => import("./logs-D3WakFME.mjs").then((m) => m.logsCommand),
93
- mcp: () => import("./mcp-CoVS5Mj3.mjs").then((m) => m.mcpCommand),
94
- repo: () => import("./repo-Un_p617X.mjs").then((m) => m.repoCommand),
95
- template: () => import("./project-template-CMgD5hnV.mjs").then((m) => m.templateCommand)
66
+ login: () => import("./login-CREcZfLH.mjs").then((m) => m.loginCommand),
67
+ whoami: () => import("./login-CREcZfLH.mjs").then((m) => m.whoamiCommand),
68
+ logout: () => import("./login-CREcZfLH.mjs").then((m) => m.logoutCommand),
69
+ create: () => import("./projects-BRG2HnBs.mjs").then((m) => m.createCommand),
70
+ init: () => import("./projects-BRG2HnBs.mjs").then((m) => m.initCommand),
71
+ projects: () => import("./projects-BRG2HnBs.mjs").then((m) => m.projectsCommand),
72
+ delete: () => import("./projects-BRG2HnBs.mjs").then((m) => m.deleteCommand),
73
+ rename: () => import("./rename-BGKa25Rq.mjs").then((m) => m.renameCommand),
74
+ dev: () => import("./dev-BmI5kwoG.mjs").then((m) => m.devCommand),
75
+ deploy: () => import("./deploy-ExrIeX_m.mjs").then((m) => m.deployCommand),
76
+ promote: () => import("./deploy-ExrIeX_m.mjs").then((m) => m.promoteCommand),
77
+ staging: () => import("./staging-_2Js0Fkc.mjs").then((m) => m.stagingCommand),
78
+ rollback: () => import("./deploy-ExrIeX_m.mjs").then((m) => m.rollbackCommand),
79
+ download: () => import("./deploy-ExrIeX_m.mjs").then((m) => m.downloadCommand),
80
+ token: () => import("./token-7vSNuz-X.mjs").then((m) => m.tokenCommand),
81
+ egress: () => import("./egress-C2amvqmE.mjs").then((m) => m.egressCommand),
82
+ secrets: () => import("./secrets-BjbIi7Gp.mjs").then((m) => m.secretsCommand),
83
+ schedule: () => import("./schedule-BcqBspn3.mjs").then((m) => m.scheduleCommand),
84
+ feedback: () => import("./feedback-CMnG2Zvs.mjs").then((m) => m.feedbackCommand),
85
+ db: () => import("./db-BJJGydgL.mjs").then((m) => m.dbCommand),
86
+ usage: () => import("./usage-DGGmTwjJ.mjs").then((m) => m.usageCommand),
87
+ ai: () => import("./ai-FBHTSCLZ.mjs").then((m) => m.aiCommand),
88
+ open: () => import("./open-Bpz4C2Sr.mjs").then((m) => m.openCommand),
89
+ browse: () => import("./browse-dyOThTyf.mjs").then((m) => m.browseCommand),
90
+ docs: () => import("./docs-CaAgJWK3.mjs").then((m) => m.docsCommand),
91
+ skill: () => import("./skill-Ct-aCOzg.mjs").then((m) => m.skillCommand),
92
+ upgrade: () => import("./upgrade-DJogeXAF.mjs").then((m) => m.upgradeCommand),
93
+ logs: () => import("./logs-BnrNZvLc.mjs").then((m) => m.logsCommand),
94
+ mcp: () => import("./mcp-BVIU4j9N.mjs").then((m) => m.mcpCommand),
95
+ repo: () => import("./repo-DmFs6H9m.mjs").then((m) => m.repoCommand),
96
+ template: () => import("./project-template-715H_lnu.mjs").then((m) => m.templateCommand)
96
97
  }
97
98
  });
98
99
  const quiet = process.argv[2] === "mcp" && process.argv[3] === "serve" || process.argv[2] === "repo" && process.argv[3] === "credential";
@@ -1,6 +1,6 @@
1
- import { r as apiDataRequest } from "./api-BHzCvDcY.mjs";
2
- import { a as realtimeRouter, c as META_COLUMNS, l as blobRouter, n as WORKER_ATTEST_HEADER, o as dbRouter, s as hasPrivateNames } from "./src-RUf3Gfuh.mjs";
3
- import { a as rewriteApiPath } from "./dev-D_gyIeUq.mjs";
1
+ import { r as apiDataRequest } from "./api-Bl6SG8Oq.mjs";
2
+ import { a as realtimeRouter, c as META_COLUMNS, l as blobRouter, n as WORKER_ATTEST_HEADER, o as dbRouter, s as hasPrivateNames } from "./src-CScXotBB.mjs";
3
+ import { a as rewriteApiPath } from "./dev-adLLSY1F.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
6
6
  import { dirname, join, relative, sep } from "node:path";
@@ -1,6 +1,6 @@
1
- import { _ as writeConfigFile, f as clearAllProfileTokens, g as upsertProfileAuth, h as setActiveProfile, m as readConfigFile, n as siteConfig, p as listBakedProfiles, v as getBakedProfile, y as isProfileId } from "./site-DM2J10CB.mjs";
2
- import { n as agentHeaders } from "./api-BHzCvDcY.mjs";
3
- import { n as openBrowser, r as reportErrors } from "./ui-SBUdC9rX.mjs";
1
+ import { _ as setActiveProfile, b as getBakedProfile, g as readConfigFile, h as listBakedProfiles, m as clearAllProfileTokens, r as siteConfig, v as upsertProfileAuth, x as isProfileId, y as writeConfigFile } from "./site-0i7wAJqg.mjs";
2
+ import { n as agentHeaders } from "./api-Bl6SG8Oq.mjs";
3
+ import { n as openBrowser, r as reportErrors } from "./ui-CLnICOne.mjs";
4
4
  import { n as clearRepoTokenCache } from "./repo-credential-CNDRM-tG.mjs";
5
5
  import { defineCommand } from "citty";
6
6
  import { hostname } from "node:os";
@@ -1,6 +1,6 @@
1
- import { c as resolveProject, o as projectFlagArgs } from "./site-DM2J10CB.mjs";
2
- import { a as apiRequest, l as withContext } from "./api-BHzCvDcY.mjs";
3
- import { r as reportErrors } from "./ui-SBUdC9rX.mjs";
1
+ import { l as resolveProject, s as projectFlagArgs } from "./site-0i7wAJqg.mjs";
2
+ import { a as apiRequest, f as withContext } from "./api-Bl6SG8Oq.mjs";
3
+ import { r as reportErrors } from "./ui-CLnICOne.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  //#region src/logs.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { t as version } from "./package-SWgTmctH.mjs";
2
- import { d as tryResolveProject, l as stagingUrl, n as siteConfig, s as projectUrl } from "./site-DM2J10CB.mjs";
3
- import { a as apiRequest, t as ApiError } from "./api-BHzCvDcY.mjs";
1
+ import { t as version } from "./package-XOtqboS1.mjs";
2
+ import { c as projectUrl, d as stagingUrl, p as tryResolveProject, r as siteConfig } from "./site-0i7wAJqg.mjs";
3
+ import { a as apiRequest, d as noticeRenamesOnly, l as currentSlug, t as ApiError } from "./api-Bl6SG8Oq.mjs";
4
4
  import { t as liveDevServer } from "./dev-server-file-Dk9pk4AR.mjs";
5
5
  import { defineCommand } from "citty";
6
6
  import { serveStdio } from "@modelcontextprotocol/server/stdio";
@@ -342,15 +342,16 @@ async function connect(args) {
342
342
  requireSignIn();
343
343
  const tokens = agentTokens(slug, channel);
344
344
  await tokens.token();
345
+ const current = currentSlug(slug);
345
346
  const upstream = await connectUpstream({
346
- url: `${channel === "staging" ? stagingUrl(slug) : projectUrl(slug)}${MCP_PATH}`,
347
- project: slug,
347
+ url: `${channel === "staging" ? stagingUrl(current) : projectUrl(current)}${MCP_PATH}`,
348
+ project: current,
348
349
  tokens
349
350
  });
350
351
  const config = siteConfig();
351
352
  return {
352
353
  upstream,
353
- slug,
354
+ slug: current,
354
355
  channel,
355
356
  where: `${config.profileId ?? config.apiUrl}, ${channel}`
356
357
  };
@@ -375,6 +376,7 @@ const serveCommand = defineCommand({
375
376
  async run({ args }) {
376
377
  console.log = console.error;
377
378
  console.info = console.error;
379
+ noticeRenamesOnly();
378
380
  let connection;
379
381
  try {
380
382
  connection = await connect(args);
@@ -1,5 +1,5 @@
1
- import { u as tryReadCanopyJson } from "./site-DM2J10CB.mjs";
2
- import { r as apiDataRequest } from "./api-BHzCvDcY.mjs";
1
+ import { f as tryReadCanopyJson } from "./site-0i7wAJqg.mjs";
2
+ import { r as apiDataRequest } from "./api-Bl6SG8Oq.mjs";
3
3
  import { readFileSync, readdirSync } from "node:fs";
4
4
  import { join, resolve } from "node:path";
5
5
  //#region src/migrations.ts
@@ -1,5 +1,5 @@
1
- import { a as projectDirArgs, c as resolveProject, l as stagingUrl, s as projectUrl } from "./site-DM2J10CB.mjs";
2
- import { n as openBrowser, r as reportErrors } from "./ui-SBUdC9rX.mjs";
1
+ import { c as projectUrl, d as stagingUrl, l as resolveProject, o as projectDirArgs } from "./site-0i7wAJqg.mjs";
2
+ import { n as openBrowser, r as reportErrors } from "./ui-CLnICOne.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  //#region src/open.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.7.41";
2
+ var version = "0.7.43";
3
3
  //#endregion
4
4
  export { version as t };
@@ -0,0 +1,2 @@
1
+ import { a as templateCommand } from "./project-template-Cdr1uwwE.mjs";
2
+ export { templateCommand };
@@ -1,6 +1,6 @@
1
- import { a as projectDirArgs, c as resolveProject } from "./site-DM2J10CB.mjs";
2
- import { a as apiRequest, l as withContext } from "./api-BHzCvDcY.mjs";
3
- import { a as unwrap, i as requireTty, r as reportErrors } from "./ui-SBUdC9rX.mjs";
1
+ import { l as resolveProject, o as projectDirArgs } from "./site-0i7wAJqg.mjs";
2
+ import { a as apiRequest, f as withContext } from "./api-Bl6SG8Oq.mjs";
3
+ import { a as unwrap, i as requireTty, r as reportErrors } from "./ui-CLnICOne.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  import * as p from "@clack/prompts";
6
6
  /** Plain words for the API's template errors. */
@@ -1,8 +1,8 @@
1
- import { n as siteConfig, s as projectUrl, u as tryReadCanopyJson } from "./site-DM2J10CB.mjs";
2
- import { a as apiRequest, l as withContext } from "./api-BHzCvDcY.mjs";
3
- import { a as unwrap, i as requireTty, r as reportErrors } from "./ui-SBUdC9rX.mjs";
4
- import { i as nextSteps, n as describeCopy, r as fetchTemplate, t as TEMPLATE_FIXES } from "./project-template-DACdMdpn.mjs";
5
- import { i as offerRepoOnCreate, n as cloneProjectRepo } from "./repo-BCua4L-I.mjs";
1
+ import { c as projectUrl, f as tryReadCanopyJson, r as siteConfig } from "./site-0i7wAJqg.mjs";
2
+ import { a as apiRequest, f as withContext } from "./api-Bl6SG8Oq.mjs";
3
+ import { a as unwrap, i as requireTty, r as reportErrors } from "./ui-CLnICOne.mjs";
4
+ import { i as nextSteps, n as describeCopy, r as fetchTemplate, t as TEMPLATE_FIXES } from "./project-template-Cdr1uwwE.mjs";
5
+ import { i as offerRepoOnCreate, n as cloneProjectRepo } from "./repo-CwT2RDoW.mjs";
6
6
  import { defineCommand } from "citty";
7
7
  import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
8
8
  import { join, relative, resolve, sep } from "node:path";
@@ -0,0 +1,81 @@
1
+ import { c as projectUrl, l as resolveProject, o as projectDirArgs, u as rewriteCanopyJsonSlug } from "./site-0i7wAJqg.mjs";
2
+ import { a as apiRequest, f as withContext } from "./api-Bl6SG8Oq.mjs";
3
+ import { a as unwrap, i as requireTty, r as reportErrors } from "./ui-CLnICOne.mjs";
4
+ import { defineCommand } from "citty";
5
+ import * as p from "@clack/prompts";
6
+ //#region src/rename.ts
7
+ /**
8
+ * canopy rename <new-slug> — change a project's slug, its address on the
9
+ * site (OpenSpec project-slug-rename). The old slug stays the project's: its
10
+ * hostnames redirect, and everything that still names it (canopy.json
11
+ * elsewhere, CI, MCP configs, git remotes, report keys) keeps reaching the
12
+ * project. The canopy.json in this directory is pointed at the new slug.
13
+ */
14
+ /** What changes for people outside the platform — said before anything happens. */
15
+ function renameConsequences(from, to) {
16
+ return [
17
+ `The address becomes ${projectUrl(to)}; ${projectUrl(from)} redirects there.`,
18
+ `Email your project sends comes from ${to}@ instead of ${from}@.`,
19
+ "Visitors who signed in with the client password sign in again on the new address.",
20
+ "Visitors' browser storage for the project (localStorage, IndexedDB) starts empty on the new address.",
21
+ `Scripts, CI, MCP client configs and git remotes that say "${from}" keep working; update them when convenient.`
22
+ ];
23
+ }
24
+ const renameCommand = defineCommand({
25
+ meta: {
26
+ name: "rename",
27
+ description: "Change a project's slug (its address)"
28
+ },
29
+ args: {
30
+ slug: {
31
+ type: "positional",
32
+ description: "The new slug",
33
+ required: true
34
+ },
35
+ ...projectDirArgs,
36
+ yes: {
37
+ type: "boolean",
38
+ default: false,
39
+ description: "Skip the confirmation"
40
+ },
41
+ json: {
42
+ type: "boolean",
43
+ default: false,
44
+ description: "Print the result as JSON"
45
+ }
46
+ },
47
+ run: reportErrors("rename", async ({ args }) => {
48
+ const { dir, slug: from } = resolveProject(args);
49
+ const to = String(args.slug).trim().toLowerCase();
50
+ if (!args.yes) {
51
+ requireTty("pass --yes to rename without confirmation.");
52
+ p.note(renameConsequences(from, to).join("\n"), `Rename ${from} → ${to}`);
53
+ if (!unwrap(await p.confirm({ message: `Rename "${from}" to "${to}"?` }))) {
54
+ p.cancel("Aborted.");
55
+ return;
56
+ }
57
+ }
58
+ const result = await withContext(apiRequest("POST", `/projects/${from}/rename`, { slug: to }), {
59
+ action: `rename "${from}"`,
60
+ fixes: {
61
+ forbidden: "Only the project's owner or a Canopy admin can rename it — ask the owner.",
62
+ invalid_slug: "Use 2–40 lowercase letters, digits and dashes, starting with a letter — not a name Canopy reserves (www, docs, api, …).",
63
+ slug_taken: "Pick another slug: this one belongs to another project, now or in the past."
64
+ }
65
+ });
66
+ const updated = rewriteCanopyJsonSlug(dir, from, result.project.slug);
67
+ if (args.json) {
68
+ console.log(JSON.stringify({
69
+ ...result,
70
+ canopy_json_updated: updated
71
+ }, null, 2));
72
+ return;
73
+ }
74
+ p.log.success(`Renamed to ${result.project.slug}: ${projectUrl(result.project.slug)}`);
75
+ if (updated) p.log.info("Updated canopy.json.");
76
+ if (result.refresh.pending) p.log.warn("The backend still reports the old slug as PROJECT_SLUG (it keeps working). Canopy retries; `canopy deploy` or Settings → Retry refreshes it now.");
77
+ if (result.slack === "no_config_token" || result.slack === "rejected") p.log.info("The project's Slack app keeps its old URLs, which still work. They move on its next manifest update.");
78
+ })
79
+ });
80
+ //#endregion
81
+ export { renameCommand };
@@ -1,6 +1,6 @@
1
- import { a as projectDirArgs, c as resolveProject, n as siteConfig, u as tryReadCanopyJson } from "./site-DM2J10CB.mjs";
2
- import { a as apiRequest, l as withContext, n as agentHeaders } from "./api-BHzCvDcY.mjs";
3
- import { a as unwrap, i as requireTty, r as reportErrors, t as formatDateTime } from "./ui-SBUdC9rX.mjs";
1
+ import { f as tryReadCanopyJson, l as resolveProject, o as projectDirArgs, r as siteConfig } from "./site-0i7wAJqg.mjs";
2
+ import { a as apiRequest, d as noticeRenamesOnly, f as withContext, n as agentHeaders, u as followRename } from "./api-Bl6SG8Oq.mjs";
3
+ import { a as unwrap, i as requireTty, r as reportErrors, t as formatDateTime } from "./ui-CLnICOne.mjs";
4
4
  import { a as parseCredentialInput, i as helperCommand, o as runCredentialHelper, r as fileTokenCache, t as RepoCredentialError } from "./repo-credential-CNDRM-tG.mjs";
5
5
  import { defineCommand } from "citty";
6
6
  import { existsSync, realpathSync } from "node:fs";
@@ -328,6 +328,8 @@ async function mintRepoToken(profile, slug) {
328
328
  }
329
329
  }).catch(() => null);
330
330
  if (!res) throw new RepoCredentialError(`could not reach Canopy (${config.apiUrl}).`);
331
+ noticeRenamesOnly();
332
+ followRename(res, slug);
331
333
  if (res.status === 201) return await res.json();
332
334
  const body = await res.json().catch(() => ({}));
333
335
  if (res.status === 401) throw new RepoCredentialError(`your ${profile} sign-in has expired — ${login}.`);
@@ -0,0 +1,2 @@
1
+ import { a as repoCommand } from "./repo-CwT2RDoW.mjs";
2
+ export { repoCommand };
@@ -1,6 +1,6 @@
1
- import { c as resolveProject, o as projectFlagArgs } from "./site-DM2J10CB.mjs";
2
- import { a as apiRequest, l as withContext } from "./api-BHzCvDcY.mjs";
3
- import { r as reportErrors, t as formatDateTime } from "./ui-SBUdC9rX.mjs";
1
+ import { l as resolveProject, s as projectFlagArgs } from "./site-0i7wAJqg.mjs";
2
+ import { a as apiRequest, f as withContext } from "./api-Bl6SG8Oq.mjs";
3
+ import { r as reportErrors, t as formatDateTime } from "./ui-CLnICOne.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  //#region src/schedule.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { a as projectDirArgs, c as resolveProject } from "./site-DM2J10CB.mjs";
2
- import { a as apiRequest, l as withContext } from "./api-BHzCvDcY.mjs";
3
- import { a as unwrap, r as reportErrors, t as formatDateTime } from "./ui-SBUdC9rX.mjs";
1
+ import { l as resolveProject, o as projectDirArgs } from "./site-0i7wAJqg.mjs";
2
+ import { a as apiRequest, f as withContext } from "./api-Bl6SG8Oq.mjs";
3
+ import { a as unwrap, r as reportErrors, t as formatDateTime } from "./ui-CLnICOne.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  import * as p from "@clack/prompts";
6
6
  //#region src/secrets.ts
@@ -198,6 +198,25 @@ function projectDialect(dir) {
198
198
  if (dialect !== "sqlite" && dialect !== "postgres") throw new Error(`canopy.json "dialect" must be "sqlite" or "postgres", not ${JSON.stringify(dialect)}.`);
199
199
  return dialect;
200
200
  }
201
+ /**
202
+ * Point canopy.json at a project's new slug after a rename (OpenSpec
203
+ * project-slug-rename) — only when it still names `from`, and changing
204
+ * nothing else in the file. True when it was rewritten.
205
+ */
206
+ function rewriteCanopyJsonSlug(dir, from, to) {
207
+ let config;
208
+ try {
209
+ config = tryReadCanopyJson(dir);
210
+ } catch {
211
+ return false;
212
+ }
213
+ if (config?.slug !== from) return false;
214
+ writeFileSync(join(dir, "canopy.json"), `${JSON.stringify({
215
+ ...config,
216
+ slug: to
217
+ }, null, 2)}\n`);
218
+ return true;
219
+ }
201
220
  function readCanopyJson(dir) {
202
221
  const config = tryReadCanopyJson(dir);
203
222
  if (config === void 0) throw new Error(`No canopy.json in ${dir} — run from a project created by \`canopy create\`, add one ({"slug": "<slug>", "dist": "dist"}), or pass --project <slug>.`);
@@ -255,6 +274,10 @@ function setInvocationProfile(profile) {
255
274
  function setProjectDirForPin(dir) {
256
275
  projectDirForPin = dir;
257
276
  }
277
+ /** The project directory this invocation resolved (cwd when none was named). */
278
+ function projectDir() {
279
+ return projectDirForPin ?? ".";
280
+ }
258
281
  function projectProfileFromCwd() {
259
282
  return tryReadCanopyJson(projectDirForPin ?? ".")?.profile;
260
283
  }
@@ -277,4 +300,4 @@ function siteHeaderLine(cliVersion) {
277
300
  return `canopy ${cliVersion} · ${c.envOverride || !c.profileId ? c.apiUrl : `${c.profileId} (${c.projectDomain ?? new URL(c.apiUrl).hostname})`}`;
278
301
  }
279
302
  //#endregion
280
- export { writeConfigFile as _, projectDirArgs as a, resolveProject as c, tryResolveProject as d, clearAllProfileTokens as f, upsertProfileAuth as g, setActiveProfile as h, projectDialect as i, stagingUrl as l, readConfigFile as m, siteConfig as n, projectFlagArgs as o, listBakedProfiles as p, siteHeaderLine as r, projectUrl as s, setInvocationProfile as t, tryReadCanopyJson as u, getBakedProfile as v, isProfileId as y };
303
+ export { setActiveProfile as _, projectDialect as a, getBakedProfile as b, projectUrl as c, stagingUrl as d, tryReadCanopyJson as f, readConfigFile as g, listBakedProfiles as h, siteHeaderLine as i, resolveProject as l, clearAllProfileTokens as m, setInvocationProfile as n, projectDirArgs as o, tryResolveProject as p, siteConfig as r, projectFlagArgs as s, projectDir as t, rewriteCanopyJsonSlug as u, upsertProfileAuth as v, isProfileId as x, writeConfigFile as y };
@@ -1,5 +1,5 @@
1
- import { t as version } from "./package-SWgTmctH.mjs";
2
- import { r as reportErrors } from "./ui-SBUdC9rX.mjs";
1
+ import { t as version } from "./package-XOtqboS1.mjs";
2
+ import { r as reportErrors } from "./ui-CLnICOne.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  import { cpSync, existsSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
5
5
  import { homedir } from "node:os";