coss-cli 0.0.0-stage → 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cal.com, Inc.
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 CHANGED
@@ -1,3 +1,51 @@
1
- # Temporary Holding Version
1
+ # coss-cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The command line for [coss.com](https://coss.com): sign in, send test emails, follow your environment's
4
+ log, and receive its webhook events on your machine.
5
+
6
+ ```sh
7
+ npm install -g coss-cli # or: npx coss-cli <command>
8
+ coss login
9
+ coss listen --forward-to localhost:3000/webhooks
10
+ ```
11
+
12
+ Published from [cosscom/coss](https://github.com/cosscom/coss) by CI, with
13
+ [provenance](https://docs.npmjs.com/generating-provenance-statements). Full guide:
14
+ [coss.com/docs/cli](https://coss.com/docs/cli).
15
+
16
+ ## Commands
17
+
18
+ | Command | |
19
+ | --- | --- |
20
+ | `coss login` | Opens the dashboard, where you pick an environment; the CLI gets a new API key of it. `--manual` pastes an existing key instead; `--no-browser` (the default over SSH) shows a link and asks for the code it displays. |
21
+ | `coss logout` | Removes the saved key, and revokes it if `coss login` created it (`--revoke` revokes a pasted one too). |
22
+ | `coss whoami` | The key in use, where it comes from, and its organization, project and environment. |
23
+ | `coss emails send` | A test email: `--to`, or `--simulate delivered\|bounced\|complained\|suppressed` for the mailbox simulator; `--template` with `--var name=value`; `--wait` follows it to its outcome. |
24
+ | `coss logs tail` | New lines of the environment's log as they arrive: API requests, email events, webhook attempts. Filter with `--source`, `--level`, `--type`, `--status`, `-q`; `--since 15m` starts earlier. |
25
+ | `coss listen` | Receives the environment's webhook events and forwards each one to `--forward-to`, signed like coss.com signs real deliveries. Verify them with `verifyWebhook` from the `coss` SDK and the signing secret it prints (it stays the same for the profile). |
26
+
27
+ Every command takes `--json` (one JSON object per line), `--profile <name>` and `--help`.
28
+
29
+ ## Configuration
30
+
31
+ | Variable | |
32
+ | --- | --- |
33
+ | `COSS_API_KEY` | Use this key instead of a saved profile (CI, scripts). |
34
+ | `COSS_PROFILE` | The saved profile to use (default: the one `coss login` saved first). |
35
+ | `COSS_BASE_URL` | Another API origin, e.g. `http://localhost:3001`. Remembered by `coss login`. |
36
+ | `COSS_DASHBOARD_URL` | Another dashboard for `coss login`, e.g. `http://localhost:3000`. |
37
+
38
+ Keys are saved in `$XDG_CONFIG_HOME/coss/config.json` (`~/.config/coss`, `%APPDATA%\coss` on Windows),
39
+ readable only by you. No flag takes a key: command lines are visible to other local processes.
40
+
41
+ ## Development
42
+
43
+ ```sh
44
+ bun run --cwd packages/cli build # tsdown, publint, attw
45
+ bun run --cwd packages/cli test
46
+ node packages/cli/dist/cli.js --help
47
+ ```
48
+
49
+ ## License
50
+
51
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {}
package/dist/cli.js ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ import { c as nodeIo, n as run } from "./run-DiBz6lcE.js";
3
+ //#region src/cli.ts
4
+ /** Resolves once everything written to `stream` so far has reached the OS (pipes are async). */
5
+ function flushed(stream) {
6
+ return new Promise((resolve) => {
7
+ if (stream.writableLength === 0) return resolve();
8
+ stream.write("", () => resolve());
9
+ });
10
+ }
11
+ process.exitCode = await run(process.argv.slice(2), nodeIo());
12
+ await Promise.all([flushed(process.stdout), flushed(process.stderr)]);
13
+ process.exit();
14
+ //#endregion
15
+ export {};
@@ -0,0 +1,56 @@
1
+ //#region src/io.d.ts
2
+ interface OutputStream {
3
+ write(text: string): void;
4
+ isTTY?: boolean;
5
+ }
6
+ /** `fetch` as the CLI calls it (the SDK's `FetchLike` too). */
7
+ type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
8
+ interface CliIo {
9
+ env: Record<string, string | undefined>;
10
+ stdout: OutputStream;
11
+ stderr: OutputStream;
12
+ /** Whether stdin is a terminal (prompts can be answered). */
13
+ stdinIsTTY: boolean;
14
+ fetch: Fetch;
15
+ now(): Date;
16
+ /** Resolves after `ms`, or as soon as `signal` aborts. */
17
+ sleep(ms: number, signal?: AbortSignal): Promise<void>;
18
+ /** Opens `url` in the default browser; `false` when none could be started. */
19
+ openBrowser(url: string): Promise<boolean>;
20
+ /** Asks a question on stderr and reads one line (not echoed when `secret`). */
21
+ prompt(question: string, options?: {
22
+ secret?: boolean;
23
+ }): Promise<string>;
24
+ /** This machine's name (names the CLI's API key and listener). */
25
+ hostname(): string;
26
+ /** Where `config.json` lives. */
27
+ configDir: string;
28
+ /** Aborted on Ctrl-C (SIGINT) and SIGTERM. */
29
+ signal: AbortSignal;
30
+ }
31
+ /** `$XDG_CONFIG_HOME/coss`, `%APPDATA%\coss` on Windows, else `~/.config/coss`. */
32
+ export declare function defaultConfigDir(env: Record<string, string | undefined>, platform?: NodeJS.Platform, home?: string): string;
33
+ /** The real process: its environment, streams, network and signals. */
34
+ export declare function nodeIo(): CliIo;
35
+ //#endregion
36
+ //#region src/listen/sign.d.ts
37
+ export declare function generateSecret(): string;
38
+ export declare function sign(secret: string, id: string, timestamp: number, body: string): string;
39
+ /** The three headers a coss.com webhook carries. */
40
+ export declare function signatureHeaders(input: {
41
+ secret: string;
42
+ id: string;
43
+ timestamp: number;
44
+ body: string;
45
+ }): Record<string, string>;
46
+ //#endregion
47
+ //#region src/run.d.ts
48
+ export declare const HELP: string;
49
+ /** Runs one invocation (`argv` without node and the script) and returns the exit code. */
50
+ export declare function run(argv: string[], io: CliIo): Promise<number>;
51
+ //#endregion
52
+ //#region src/version.d.ts
53
+ /** The package version (`coss --version`, the forwarded requests' user agent). */
54
+ export declare const VERSION: string;
55
+ //#endregion
56
+ export type { CliIo, Fetch, OutputStream };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { t as HELP, r as VERSION, s as defaultConfigDir, i as generateSecret, c as nodeIo, n as run, a as sign, o as signatureHeaders } from "./run-DiBz6lcE.js";