@cowliss/cli 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 (31) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +105 -0
  3. package/dist/guest/constants-OZrYz4I2.d.ts +42 -0
  4. package/dist/guest/driver-BOe7jBFw.js +5647 -0
  5. package/dist/guest/driver.d.ts +21 -0
  6. package/dist/guest/driver.js +3 -0
  7. package/dist/guest/emails.d.ts +24 -0
  8. package/dist/guest/emails.js +0 -0
  9. package/dist/guest/index-heC1gFE_.d.ts +296 -0
  10. package/dist/guest/journeys-CxuS-mHn.js +571 -0
  11. package/dist/guest/journeys.d.ts +127 -0
  12. package/dist/guest/journeys.js +3 -0
  13. package/dist/guest/prelude.d.ts +1 -0
  14. package/dist/guest/prelude.js +91 -0
  15. package/dist/guest/wasi.d.ts +6 -0
  16. package/dist/guest/wasi.js +43 -0
  17. package/dist/index.js +11235 -0
  18. package/examples/abandoned-checkout/emails/abandoned-checkout.tsx +104 -0
  19. package/examples/abandoned-checkout/journeys/abandoned-checkout.ts +39 -0
  20. package/examples/abandoned-checkout/scenarios/abandoned-checkout.recovered.json +10 -0
  21. package/examples/abandoned-checkout/scenarios/abandoned-checkout.timeout.json +16 -0
  22. package/examples/activity-decay/journeys/activity-decay.ts +36 -0
  23. package/examples/activity-decay/scenarios/activity-decay.json +8 -0
  24. package/examples/cross-app-pitch/emails/cross-app-pitch.tsx +77 -0
  25. package/examples/cross-app-pitch/journeys/cross-app-pitch.ts +30 -0
  26. package/examples/cross-app-pitch/scenarios/cross-app-pitch.json +16 -0
  27. package/examples/winback/emails/winback.tsx +78 -0
  28. package/examples/winback/journeys/winback.ts +33 -0
  29. package/examples/winback/scenarios/winback.json +18 -0
  30. package/package.json +82 -0
  31. package/project/tsconfig.json +18 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bogdan Radu
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 ADDED
@@ -0,0 +1,105 @@
1
+ # @cowliss/cli
2
+
3
+ `cow`, the command line for Cowliss. It does everything the dashboard does,
4
+ and it is where journeys and email templates live as TypeScript in your own
5
+ repo.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install -D @cowliss/cli
11
+ ```
12
+
13
+ Or run it without installing:
14
+
15
+ ```sh
16
+ npx -y @cowliss/cli whoami
17
+ ```
18
+
19
+ Node 22 and up.
20
+
21
+ ## Sign in
22
+
23
+ ```sh
24
+ cow login
25
+ cow whoami
26
+ ```
27
+
28
+ `cow login` opens the dashboard and caches a session token. In CI, set
29
+ `COW_DEPLOY_KEY` to a deploy key instead.
30
+
31
+ ## Journeys and emails as code
32
+
33
+ ```sh
34
+ cow init my-messaging
35
+ cd my-messaging
36
+ npm install
37
+ ```
38
+
39
+ You get `cow.json`, a `journeys/` folder, an `emails/` folder, and the files
40
+ that build them. Write a journey:
41
+
42
+ ```ts
43
+ import { defineJourney } from "@cowliss/cli/journeys";
44
+
45
+ export default defineJourney({
46
+ trigger: { event: "checkout_started" },
47
+ purpose: "emailMarketing",
48
+ run: async (event, api) => {
49
+ const purchased = await api.waitForEvent("purchase_completed", {
50
+ timeout: "24h",
51
+ });
52
+ if (purchased) {
53
+ return;
54
+ }
55
+ await api.email.send({
56
+ template: "abandoned-checkout",
57
+ props: { checkoutUrl: event.properties.checkoutUrl },
58
+ });
59
+ },
60
+ });
61
+ ```
62
+
63
+ Then:
64
+
65
+ ```sh
66
+ # run it on a virtual clock, nothing sent
67
+ cow test abandoned-checkout --scenario scenarios/cart.json
68
+
69
+ # typecheck and bundle, no API call
70
+ cow build
71
+
72
+ # publish it and make it the environment's live code
73
+ cow deploy --env development
74
+
75
+ # rebuild and redeploy on every save
76
+ cow dev
77
+ ```
78
+
79
+ Every push creates a numbered release. `cow deploy` makes one release an
80
+ environment's current code, `cow rollback` puts the previous one back, and a
81
+ run that has already started stays on the release it started on.
82
+
83
+ ## Admin, and everything else
84
+
85
+ `cow users`, `cow events`, `cow apps`, `cow sources`, `cow segments`,
86
+ `cow journeys`, `cow deliveries`, `cow domains`, `cow billing` and the rest
87
+ read and write the same API the dashboard uses. Add `--json` for output you
88
+ can pipe.
89
+
90
+ ## For agents in your editor
91
+
92
+ ```sh
93
+ cow mcp
94
+ ```
95
+
96
+ An MCP server over stdio, exposing the admin API as tools. Point your editor
97
+ at `npx -y @cowliss/cli mcp`.
98
+
99
+ ## Docs
100
+
101
+ [docs.cowliss.com](https://docs.cowliss.com)
102
+
103
+ ## License
104
+
105
+ MIT
@@ -0,0 +1,42 @@
1
+ //#region ../../packages/shared/src/constants.d.ts
2
+ /**
3
+ * The two fixed environments every org has (spec: Environments). An app
4
+ * belongs to one, so the environment of every write is the app's;
5
+ * profiles, identifiers, events, memberships, journey instances,
6
+ * deliveries, violations, quarantine, the address ledger, and idempotency
7
+ * keys are per environment, while the catalog, sending domains, the
8
+ * suppression mirror, billing, and journey code are shared. A third
9
+ * environment is a one-line change here plus the mirrored db enum.
10
+ */
11
+ declare const ENVIRONMENTS: readonly ["development", "production"];
12
+ type Environment = (typeof ENVIRONMENTS)[number];
13
+ /**
14
+ * Fixed consent purposes for the prototype. Consent is a per-purpose map on
15
+ * the profile, checked at send-step execution time.
16
+ *
17
+ * The two names describe what the recipient agreed to, not the pipe it
18
+ * arrives on: "emails I did not ask for individually" and "my data leaving
19
+ * for somewhere else". Naming them after the channel (`email`, `webhook`)
20
+ * said nothing a recipient could consent to, and transactional mail already
21
+ * bypasses the email purpose, so it was only ever marketing consent.
22
+ */
23
+ declare const CONSENT_PURPOSES: readonly ["emailMarketing", "dataProcessing"];
24
+ type ConsentPurpose = (typeof CONSENT_PURPOSES)[number];
25
+ /**
26
+ * The two classes of send, declared on the template rather than passed per
27
+ * call so the class cannot drift between two sends of the same message.
28
+ *
29
+ * Marketing is everything a journey sends on the org's behalf: it carries
30
+ * the RFC 8058 unsubscribe headers and runs the full gate list.
31
+ * Transactional is the developer's own operational mail (a receipt, an
32
+ * export-is-ready notice): it carries neither header and skips consent and
33
+ * the per-user frequency cap, because an unsubscribe link on an invoice is
34
+ * wrong and a receipt must not silently vanish for anyone who once left a
35
+ * newsletter. Suppression, the quota, the sending pause, and the from-domain
36
+ * check still apply to both: those bound cost and protect the shared SES
37
+ * account, and none of them are about what the recipient asked for.
38
+ */
39
+ declare const SEND_CLASSES: readonly ["marketing", "transactional"];
40
+ type SendClass = (typeof SEND_CLASSES)[number];
41
+ //#endregion
42
+ export { Environment as n, SendClass as r, ConsentPurpose as t };