@mediamonks/canopy-cli 0.7.18 → 0.7.20

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 (29) hide show
  1. package/dist/{db-BAaqh_2O.mjs → db-TaSLpQZ5.mjs} +2 -2
  2. package/dist/{deploy-DID3xhMJ.mjs → deploy-DCggsLD7.mjs} +2 -2
  3. package/dist/dev-DjkK-50R.mjs +2 -0
  4. package/dist/{dev-CjaomJ2D.mjs → dev-DtEwiNYi.mjs} +4 -4
  5. package/dist/docs/index.json +7 -2
  6. package/dist/docs/notifications.md +14 -1
  7. package/dist/docs/sdk-email.md +114 -0
  8. package/dist/docs/sdk.md +4 -4
  9. package/dist/{docs-DP_p_mmy.mjs → docs-C2D7__Iz.mjs} +2 -2
  10. package/dist/{egress-DDM-_7Yo.mjs → egress-BhbQfjjV.mjs} +1 -1
  11. package/dist/{feedback-DX99gDFp.mjs → feedback-BvkCjS-g.mjs} +2 -2
  12. package/dist/index.mjs +25 -25
  13. package/dist/{local-dAQdVFEK.mjs → local-CKRZur_5.mjs} +2 -2
  14. package/dist/login-D-Ac_kFW.mjs +285 -0
  15. package/dist/{logs-D60VRbHZ.mjs → logs-Beqz--Df.mjs} +1 -1
  16. package/dist/{migrations-kKKDlR_H.mjs → migrations-Bg9FEGFh.mjs} +1 -1
  17. package/dist/{open-B5XHmEmv.mjs → open-D7f1wNn3.mjs} +1 -1
  18. package/dist/{package-x-_qF58q.mjs → package-B-aXVcQu.mjs} +1 -1
  19. package/dist/{projects-TE1PVwMy.mjs → projects-1r5387ui.mjs} +1 -1
  20. package/dist/{schedule-Blldchmj.mjs → schedule-DK_Cv6Xf.mjs} +1 -1
  21. package/dist/{skill-CSFhZmBk.mjs → skill-CqiSkac0.mjs} +2 -2
  22. package/dist/{staging-Cw-Rzbsj.mjs → staging-CdpV2YHB.mjs} +1 -1
  23. package/dist/{token-BqxRIRkT.mjs → token-C8Bmzwfl.mjs} +1 -1
  24. package/dist/{ui-DLZNEen6.mjs → ui--atbZ-TM.mjs} +4 -0
  25. package/dist/{upgrade-DcU4YMr_.mjs → upgrade-CpUCVTrN.mjs} +2 -2
  26. package/dist/{usage-2cGnpSVc.mjs → usage-CRpVLLi6.mjs} +1 -1
  27. package/package.json +4 -3
  28. package/dist/dev-A2doKMCS.mjs +0 -2
  29. package/dist/login-CU0pev0k.mjs +0 -401
@@ -1,6 +1,6 @@
1
1
  import { c as resolveProject, o as projectFlagArgs } from "./site-BFaWfSVu.mjs";
2
- import { a as unwrap, d as withContext, i as requireTty, r as reportErrors, s as apiDataRequest } from "./ui-DLZNEen6.mjs";
3
- import { n as migrateProject, r as readMigrationFiles, t as describeMigrateResult } from "./migrations-kKKDlR_H.mjs";
2
+ import { a as unwrap, d as withContext, i as requireTty, r as reportErrors, s as apiDataRequest } from "./ui--atbZ-TM.mjs";
3
+ import { n as migrateProject, r as readMigrationFiles, t as describeMigrateResult } from "./migrations-Bg9FEGFh.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  import { readFileSync, writeFileSync } from "node:fs";
6
6
  import * as p from "@clack/prompts";
@@ -1,6 +1,6 @@
1
1
  import { a as projectDirArgs, c as resolveProject, l as stagingUrl, n as siteConfig, o as projectFlagArgs, s as projectUrl, u as tryReadCanopyJson } from "./site-BFaWfSVu.mjs";
2
- import { a as unwrap, c as apiDownload, d as withContext, l as apiRequest, r as reportErrors, s as apiDataRequest, t as formatDateTime } from "./ui-DLZNEen6.mjs";
3
- import { n as migrateProject, r as readMigrationFiles, t as describeMigrateResult } from "./migrations-kKKDlR_H.mjs";
2
+ import { a as unwrap, c as apiDownload, d as withContext, l as apiRequest, r as reportErrors, s as apiDataRequest, t as formatDateTime } from "./ui--atbZ-TM.mjs";
3
+ import { n as migrateProject, r as readMigrationFiles, t as describeMigrateResult } from "./migrations-Bg9FEGFh.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  import { mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
6
6
  import { tmpdir } from "node:os";
@@ -0,0 +1,2 @@
1
+ import { t as devCommand } from "./dev-DtEwiNYi.mjs";
2
+ export { devCommand };
@@ -1,6 +1,6 @@
1
1
  import { a as projectDirArgs, c as resolveProject, i as projectDialect, n as siteConfig, u as tryReadCanopyJson } from "./site-BFaWfSVu.mjs";
2
- import { d as withContext, l as apiRequest, o as ApiError, r as reportErrors, t as formatDateTime } from "./ui-DLZNEen6.mjs";
3
- import { r as readMigrationFiles } from "./migrations-kKKDlR_H.mjs";
2
+ import { d as withContext, l as apiRequest, o as ApiError, r as reportErrors, t as formatDateTime } from "./ui--atbZ-TM.mjs";
3
+ import { r as readMigrationFiles } from "./migrations-Bg9FEGFh.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { defineCommand } from "citty";
6
6
  import { existsSync } from "node:fs";
@@ -165,7 +165,7 @@ async function devRemote(flags, slug) {
165
165
  async function devLocal(flags, slug) {
166
166
  let dump;
167
167
  if (flags.pull) {
168
- const { fetchProjectDump } = await import("./local-dAQdVFEK.mjs");
168
+ const { fetchProjectDump } = await import("./local-CKRZur_5.mjs");
169
169
  console.log(`Pulling a fresh export of ${slug}${flags.staging ? " [staging]" : ""}…`);
170
170
  dump = await fetchProjectDump(slug, flags.staging ? "staging" : "live");
171
171
  }
@@ -180,7 +180,7 @@ async function devLocal(flags, slug) {
180
180
  const reason = err instanceof ApiError ? err.explain().why : String(err);
181
181
  console.log(`Note: ai/services will be unavailable — could not reach the platform (${reason}).`);
182
182
  }
183
- const { createSandbox } = await import("./local-dAQdVFEK.mjs");
183
+ const { createSandbox } = await import("./local-CKRZur_5.mjs");
184
184
  const sandbox = await createSandbox({
185
185
  slug,
186
186
  persistDir: join(flags.dir, ".canopy", "local"),
@@ -80,7 +80,7 @@
80
80
  {
81
81
  "slug": "notifications",
82
82
  "title": "Slack notifications",
83
- "summary": "Canopy DMs you about your reports and projects — replies, new reports, blocked fetches, budget hits, failing schedules."
83
+ "summary": "Canopy DMs you about your reports and projects — replies, new reports, blocked fetches, budget hits, failing schedules — and answers questions when you ask."
84
84
  },
85
85
  {
86
86
  "slug": "static-serving",
@@ -296,7 +296,7 @@
296
296
  {
297
297
  "slug": "sdk",
298
298
  "title": "Using the SDK",
299
- "summary": "One typed client for auth, data, files, AI, and services — no keys, no connection strings, the platform authenticates for you."
299
+ "summary": "One typed client for auth, data, files, AI, email, and services — no keys, no connection strings, the platform authenticates for you."
300
300
  },
301
301
  {
302
302
  "slug": "sdk-auth",
@@ -318,6 +318,11 @@
318
318
  "title": "AI",
319
319
  "summary": "Metered LLM access through the project's budget-capped gateway key — chat, streaming, and an OpenAI-compatible endpoint."
320
320
  },
321
+ {
322
+ "slug": "sdk-email",
323
+ "title": "Email",
324
+ "summary": "Send email from your project without a mail server or an API key — Monks recipients only, with a per-project daily quota and a sent log."
325
+ },
321
326
  {
322
327
  "slug": "sdk-google",
323
328
  "title": "Google",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Slack notifications
3
- description: Canopy DMs you about your reports and projects — replies, new reports, blocked fetches, budget hits, failing schedules.
3
+ description: Canopy DMs you about your reports and projects — replies, new reports, blocked fetches, budget hits, failing schedules — and answers questions when you ask.
4
4
  ---
5
5
 
6
6
  Canopy sends you Slack DMs when something on the platform needs your
@@ -38,6 +38,19 @@ the categories on or off. To silence one noisy project entirely, use **Mute
38
38
  project** on its Settings tab — personal to you, and your own reports
39
39
  elsewhere keep notifying.
40
40
 
41
+ ## Asking Canopy things
42
+
43
+ The same bot answers questions. DM **Canopy** in Slack — or mention
44
+ **@Canopy** in a channel — and ask in plain language: "what projects do I
45
+ have?", "why is my fetch to that API failing?", "how do I roll back a bad
46
+ deploy?". It looks at your projects (only the ones you can already see) and
47
+ at these docs, and answers with links to the right guide.
48
+
49
+ It can only read. It never deploys, changes settings, or touches your data —
50
+ for that it points you at the dashboard or the CLI. In a channel that's
51
+ linked to a project, it already knows which project you mean; replying in a
52
+ report's notification thread, it knows which report.
53
+
41
54
  ## If DMs don't arrive
42
55
 
43
56
  The bot finds you by your work email. If your Slack account uses a different
@@ -0,0 +1,114 @@
1
+ ---
2
+ title: Email
3
+ description: Send email from your project without a mail server or an API key — Monks recipients only, with a per-project daily quota and a sent log.
4
+ ---
5
+
6
+ `canopy.email` sends transactional email — a digest, a notification, a
7
+ "your request was approved" — from your project code. There is no mail
8
+ server to run, no provider account to open, no API key in your project, and
9
+ no DNS to configure. The platform sends on your behalf and keeps a log of
10
+ what went out.
11
+
12
+ Two rules are enforced by the platform, not by your code:
13
+
14
+ - **Monks recipients only.** Every address must be an `@monks.com` one.
15
+ Anything else is refused before the message is sent.
16
+ - **A daily quota per project**, 100 emails by default. Each recipient
17
+ counts as one. Ask an admin if your project genuinely needs more.
18
+
19
+ ## email.send(options)
20
+
21
+ Resolves once the platform has accepted the message:
22
+
23
+ ```ts
24
+ await canopy.email.send({
25
+ to: "someone@monks.com",
26
+ subject: "Weekly digest",
27
+ text: "Three new entries this week.",
28
+ });
29
+ ```
30
+
31
+ **`EmailSendOptions`:**
32
+
33
+ - `to` — required. One address, or an array of up to 10.
34
+ - `subject` — required, up to 200 characters.
35
+ - `text` — required. The plain-text body. Always sent, even alongside
36
+ `html`: some clients show only this, and it helps you stay out of spam
37
+ folders.
38
+ - `html` — optional HTML body. `text` and `html` together are capped at
39
+ 256 KB.
40
+ - `replyTo` — optional. Follows the same recipient rule as `to`, so replies
41
+ cannot be routed off to an outside address.
42
+
43
+ **Returns** `{ delivered, queued, bounced }` — three arrays of addresses.
44
+ `delivered` is accepted for delivery, `queued` will be retried, and
45
+ `bounced` will never arrive (a wrong address, usually).
46
+
47
+ Attachments are not supported. Link to something in your app instead.
48
+
49
+ ## Who the email comes from
50
+
51
+ Your project sends as itself: the From address is your project's slug at the
52
+ platform's mail domain, with your project's name attached — so a recipient
53
+ can tell at a glance which app is writing to them, and replies do not land
54
+ in a shared inbox.
55
+
56
+ Set `replyTo` when you want answers to reach a real person or team.
57
+
58
+ ## Sending from the backend
59
+
60
+ The most useful sends have nobody signed in — a nightly digest, a
61
+ [scheduled](https://docs.canopy.website/platform/schedules) summary. Email works there too: call it from
62
+ a worker route or a scheduled handler and it authenticates as the project
63
+ itself.
64
+
65
+ ```ts
66
+ export default {
67
+ async scheduled(event, env) {
68
+ const canopy = createCanopy({ fetch: env.CANOPY.fetch.bind(env.CANOPY) });
69
+ const entries = await recentEntries(env.DB);
70
+
71
+ await canopy.email.send({
72
+ to: "team@monks.com",
73
+ subject: `Digest · ${entries.length} new entries`,
74
+ text: entries.map((e) => `· ${e.title}`).join("\n"),
75
+ });
76
+ },
77
+ };
78
+ ```
79
+
80
+ ## Seeing what was sent
81
+
82
+ Your project's **Usage** tab in the dashboard shows how much of today's
83
+ quota you have used and the recent sends — when, to whom, the subject, and
84
+ whether it went out. Message bodies are never stored.
85
+
86
+ ## When it fails
87
+
88
+ Every failure is a `CanopyError` with a status you can branch on:
89
+
90
+ - **400** — the recipient isn't a Monks address, or the request broke one of
91
+ the limits above (too many recipients, subject too long, missing `text`).
92
+ - **429** — the project used its daily quota. It resets at UTC midnight.
93
+ - **501** — email isn't set up on this Canopy site.
94
+ - **502** — the platform accepted the request but the send failed downstream.
95
+
96
+ ```ts
97
+ import { CanopyError } from "@mediamonks/canopy";
98
+
99
+ try {
100
+ await canopy.email.send({ to, subject, text });
101
+ } catch (err) {
102
+ if (err instanceof CanopyError && err.status === 429) {
103
+ // Out of quota for today — queue it, or tell the user.
104
+ }
105
+ }
106
+ ```
107
+
108
+ ## What this is not
109
+
110
+ This is transactional email for a small internal audience. It is not a
111
+ newsletter platform: there are no mailing lists, no subscriber management,
112
+ and no unsubscribe handling — if you send something people can opt into,
113
+ you own that list and that opt-out inside your own app. A project that
114
+ outgrows "email some Monks" should graduate to a dedicated email provider.
package/dist/docs/sdk.md CHANGED
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  title: Using the SDK
3
- description: One typed client for auth, data, files, AI, and services — no keys, no connection strings, the platform authenticates for you.
3
+ description: One typed client for auth, data, files, AI, email, and services — no keys, no connection strings, the platform authenticates for you.
4
4
  ---
5
5
 
6
6
  `@mediamonks/canopy` is a thin, typed client over the platform's project API.
7
- One `createCanopy()` call gives you six modules — `auth`, `db`, `blob`, `ai`,
8
- `google`, and `services` — and that is the entire surface. There are no API keys,
7
+ One `createCanopy()` call gives you seven modules — `auth`, `db`, `blob`, `ai`,
8
+ `email`, `google`, and `services` — and that is the entire surface. There are no API keys,
9
9
  connection strings, or environment variables to manage: every call rides the
10
10
  session the platform already established before your code ran.
11
11
 
@@ -35,7 +35,7 @@ import { createCanopy } from "/_api/data/v1/sdk.js";
35
35
  import { createCanopy } from "@mediamonks/canopy";
36
36
 
37
37
  const canopy = createCanopy();
38
- // canopy.auth, canopy.db, canopy.blob, canopy.ai, canopy.google, canopy.services
38
+ // canopy.auth, canopy.db, canopy.blob, canopy.ai, canopy.email, canopy.google, canopy.services
39
39
  ```
40
40
 
41
41
  | Option | Type | Default | What it does |
@@ -1,7 +1,7 @@
1
- import { t as version } from "./package-x-_qF58q.mjs";
1
+ import { t as version } from "./package-B-aXVcQu.mjs";
2
2
  import { n as siteConfig } from "./site-BFaWfSVu.mjs";
3
3
  import { i as latestKnownVersion, r as compareSemver } from "./version-check-CcsA1QjI.mjs";
4
- import { r as reportErrors } from "./ui-DLZNEen6.mjs";
4
+ import { r as reportErrors } from "./ui--atbZ-TM.mjs";
5
5
  import { defineCommand } from "citty";
6
6
  import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
7
7
  import { homedir } from "node:os";
@@ -1,5 +1,5 @@
1
1
  import { a as projectDirArgs, c as resolveProject } from "./site-BFaWfSVu.mjs";
2
- import { a as unwrap, i as requireTty, l as apiRequest, r as reportErrors, t as formatDateTime } from "./ui-DLZNEen6.mjs";
2
+ import { a as unwrap, i as requireTty, l as apiRequest, r as reportErrors, t as formatDateTime } from "./ui--atbZ-TM.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  import * as p from "@clack/prompts";
5
5
  //#region src/egress.ts
@@ -1,6 +1,6 @@
1
- import { t as version } from "./package-x-_qF58q.mjs";
1
+ import { t as version } from "./package-B-aXVcQu.mjs";
2
2
  import { a as projectDirArgs, c as resolveProject, d as tryResolveProject, n as siteConfig, u as tryReadCanopyJson } from "./site-BFaWfSVu.mjs";
3
- import { c as apiDownload, l as apiRequest, r as reportErrors, t as formatDateTime, u as apiUpload } from "./ui-DLZNEen6.mjs";
3
+ import { c as apiDownload, l as apiRequest, r as reportErrors, t as formatDateTime, u as apiUpload } from "./ui--atbZ-TM.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  import { basename, extname, join } from "node:path";
6
6
  import { readFile, writeFile } from "node:fs/promises";
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as version } from "./package-x-_qF58q.mjs";
2
+ import { t as version } from "./package-B-aXVcQu.mjs";
3
3
  import { r as siteHeaderLine, t as setInvocationProfile } from "./site-BFaWfSVu.mjs";
4
4
  import { a as notifyOfUpdate, o as runRefresh } from "./version-check-CcsA1QjI.mjs";
5
5
  import { defineCommand, runMain } from "citty";
@@ -60,30 +60,30 @@ const main = defineCommand({
60
60
  description: "canopy — create and deploy vibecoded projects"
61
61
  },
62
62
  subCommands: {
63
- login: () => import("./login-CU0pev0k.mjs").then((m) => m.loginCommand),
64
- whoami: () => import("./login-CU0pev0k.mjs").then((m) => m.whoamiCommand),
65
- logout: () => import("./login-CU0pev0k.mjs").then((m) => m.logoutCommand),
66
- create: () => import("./projects-TE1PVwMy.mjs").then((m) => m.createCommand),
67
- init: () => import("./projects-TE1PVwMy.mjs").then((m) => m.initCommand),
68
- projects: () => import("./projects-TE1PVwMy.mjs").then((m) => m.projectsCommand),
69
- delete: () => import("./projects-TE1PVwMy.mjs").then((m) => m.deleteCommand),
70
- dev: () => import("./dev-A2doKMCS.mjs").then((m) => m.devCommand),
71
- deploy: () => import("./deploy-DID3xhMJ.mjs").then((m) => m.deployCommand),
72
- promote: () => import("./deploy-DID3xhMJ.mjs").then((m) => m.promoteCommand),
73
- staging: () => import("./staging-Cw-Rzbsj.mjs").then((m) => m.stagingCommand),
74
- rollback: () => import("./deploy-DID3xhMJ.mjs").then((m) => m.rollbackCommand),
75
- download: () => import("./deploy-DID3xhMJ.mjs").then((m) => m.downloadCommand),
76
- token: () => import("./token-BqxRIRkT.mjs").then((m) => m.tokenCommand),
77
- egress: () => import("./egress-DDM-_7Yo.mjs").then((m) => m.egressCommand),
78
- schedule: () => import("./schedule-Blldchmj.mjs").then((m) => m.scheduleCommand),
79
- feedback: () => import("./feedback-DX99gDFp.mjs").then((m) => m.feedbackCommand),
80
- db: () => import("./db-BAaqh_2O.mjs").then((m) => m.dbCommand),
81
- usage: () => import("./usage-2cGnpSVc.mjs").then((m) => m.usageCommand),
82
- open: () => import("./open-B5XHmEmv.mjs").then((m) => m.openCommand),
83
- docs: () => import("./docs-DP_p_mmy.mjs").then((m) => m.docsCommand),
84
- skill: () => import("./skill-CSFhZmBk.mjs").then((m) => m.skillCommand),
85
- upgrade: () => import("./upgrade-DcU4YMr_.mjs").then((m) => m.upgradeCommand),
86
- logs: () => import("./logs-D60VRbHZ.mjs").then((m) => m.logsCommand)
63
+ login: () => import("./login-D-Ac_kFW.mjs").then((m) => m.loginCommand),
64
+ whoami: () => import("./login-D-Ac_kFW.mjs").then((m) => m.whoamiCommand),
65
+ logout: () => import("./login-D-Ac_kFW.mjs").then((m) => m.logoutCommand),
66
+ create: () => import("./projects-1r5387ui.mjs").then((m) => m.createCommand),
67
+ init: () => import("./projects-1r5387ui.mjs").then((m) => m.initCommand),
68
+ projects: () => import("./projects-1r5387ui.mjs").then((m) => m.projectsCommand),
69
+ delete: () => import("./projects-1r5387ui.mjs").then((m) => m.deleteCommand),
70
+ dev: () => import("./dev-DjkK-50R.mjs").then((m) => m.devCommand),
71
+ deploy: () => import("./deploy-DCggsLD7.mjs").then((m) => m.deployCommand),
72
+ promote: () => import("./deploy-DCggsLD7.mjs").then((m) => m.promoteCommand),
73
+ staging: () => import("./staging-CdpV2YHB.mjs").then((m) => m.stagingCommand),
74
+ rollback: () => import("./deploy-DCggsLD7.mjs").then((m) => m.rollbackCommand),
75
+ download: () => import("./deploy-DCggsLD7.mjs").then((m) => m.downloadCommand),
76
+ token: () => import("./token-C8Bmzwfl.mjs").then((m) => m.tokenCommand),
77
+ egress: () => import("./egress-BhbQfjjV.mjs").then((m) => m.egressCommand),
78
+ schedule: () => import("./schedule-DK_Cv6Xf.mjs").then((m) => m.scheduleCommand),
79
+ feedback: () => import("./feedback-BvkCjS-g.mjs").then((m) => m.feedbackCommand),
80
+ db: () => import("./db-TaSLpQZ5.mjs").then((m) => m.dbCommand),
81
+ usage: () => import("./usage-CRpVLLi6.mjs").then((m) => m.usageCommand),
82
+ open: () => import("./open-D7f1wNn3.mjs").then((m) => m.openCommand),
83
+ docs: () => import("./docs-C2D7__Iz.mjs").then((m) => m.docsCommand),
84
+ skill: () => import("./skill-CqiSkac0.mjs").then((m) => m.skillCommand),
85
+ upgrade: () => import("./upgrade-CpUCVTrN.mjs").then((m) => m.upgradeCommand),
86
+ logs: () => import("./logs-Beqz--Df.mjs").then((m) => m.logsCommand)
87
87
  }
88
88
  });
89
89
  if (process.argv[2] !== "upgrade") notifyOfUpdate(version);
@@ -1,6 +1,6 @@
1
- import { s as apiDataRequest } from "./ui-DLZNEen6.mjs";
1
+ import { s as apiDataRequest } from "./ui--atbZ-TM.mjs";
2
2
  import { n as META_COLUMNS, r as blobRouter, t as dbRouter } from "./src-Bu4Ze32I.mjs";
3
- import { n as rewriteApiPath } from "./dev-CjaomJ2D.mjs";
3
+ import { n as rewriteApiPath } from "./dev-DtEwiNYi.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";