@keystrokehq/cli 0.1.14 → 0.1.16

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 (46) hide show
  1. package/dist/{dist-CCMjOqMx.mjs → dist-B4pkCJsM.mjs} +2 -2
  2. package/dist/{dist-CCMjOqMx.mjs.map → dist-B4pkCJsM.mjs.map} +1 -1
  3. package/dist/{dist-CE8k4aAC.mjs → dist-BW3AMCud.mjs} +5 -3
  4. package/dist/dist-BW3AMCud.mjs.map +1 -0
  5. package/dist/{dist-D638kKxn.mjs → dist-BnIugffH.mjs} +10 -2
  6. package/dist/{dist-D638kKxn.mjs.map → dist-BnIugffH.mjs.map} +1 -1
  7. package/dist/{dist-CXBALGTP.mjs → dist-PBiyADK0.mjs} +3 -3
  8. package/dist/{dist-CXBALGTP.mjs.map → dist-PBiyADK0.mjs.map} +1 -1
  9. package/dist/dist-c4WWC9_F.mjs +3 -0
  10. package/dist/index.mjs +30 -15
  11. package/dist/index.mjs.map +1 -1
  12. package/dist/{maybe-auto-update-CT8ROK99.mjs → maybe-auto-update-BIarxWf3.mjs} +2 -2
  13. package/dist/{maybe-auto-update-CT8ROK99.mjs.map → maybe-auto-update-BIarxWf3.mjs.map} +1 -1
  14. package/dist/skills-bundle/_AGENTS.mcp.md +10 -3
  15. package/dist/skills-bundle/_AGENTS.md +61 -70
  16. package/dist/skills-bundle/skills/keystroke-actions/SKILL.md +60 -12
  17. package/dist/skills-bundle/skills/keystroke-actions/references/catalog-and-imports.md +32 -3
  18. package/dist/skills-bundle/skills/keystroke-agents/SKILL.md +50 -8
  19. package/dist/skills-bundle/skills/keystroke-agents/references/models.md +11 -13
  20. package/dist/skills-bundle/skills/keystroke-agents/references/tools-mcp-codemode.md +45 -3
  21. package/dist/skills-bundle/skills/keystroke-agents/references/workflows-and-testing.md +1 -1
  22. package/dist/skills-bundle/skills/keystroke-apps/SKILL.md +26 -13
  23. package/dist/skills-bundle/skills/keystroke-apps/references/cli-and-catalog.md +47 -16
  24. package/dist/skills-bundle/skills/keystroke-channels/SKILL.md +66 -0
  25. package/dist/skills-bundle/skills/keystroke-channels/references/slack-setup.md +41 -0
  26. package/dist/skills-bundle/skills/keystroke-cli/SKILL.md +41 -93
  27. package/dist/skills-bundle/skills/keystroke-deploy/SKILL.md +10 -9
  28. package/dist/skills-bundle/skills/keystroke-deploy/references/build-and-full-deploy.md +3 -1
  29. package/dist/skills-bundle/skills/keystroke-deploy/references/filtered-deploy.md +3 -2
  30. package/dist/skills-bundle/skills/keystroke-deploy/references/wip-ignore.md +5 -2
  31. package/dist/skills-bundle/skills/keystroke-files/SKILL.md +12 -4
  32. package/dist/skills-bundle/skills/keystroke-skills/SKILL.md +7 -2
  33. package/dist/skills-bundle/skills/keystroke-triggers/SKILL.md +30 -17
  34. package/dist/skills-bundle/skills/keystroke-workflows/SKILL.md +27 -12
  35. package/dist/skills-bundle/skills/keystroke-workflows/references/authoring.md +116 -4
  36. package/dist/skills-bundle/skills/keystroke-workflows/references/testing.md +17 -9
  37. package/dist/templates/hello-world/README.md +19 -8
  38. package/dist/templates/hello-world/src/workflows/greeting.test.ts +1 -1
  39. package/dist/{version-Brfe7Lb_.mjs → version-DScIhncv.mjs} +2 -2
  40. package/dist/{version-Brfe7Lb_.mjs.map → version-DScIhncv.mjs.map} +1 -1
  41. package/package.json +2 -2
  42. package/dist/dist-CE8k4aAC.mjs.map +0 -1
  43. package/dist/dist-CEqY8MN8.mjs +0 -3
  44. package/dist/skills-bundle/skills/keystroke-cli/references/api-targets.md +0 -87
  45. package/dist/skills-bundle/skills/keystroke-gateways/SKILL.md +0 -43
  46. package/dist/skills-bundle/skills/keystroke-gateways/references/slack-setup.md +0 -27
@@ -10,7 +10,11 @@ async run(input) {
10
10
  const summary = await support.prompt({
11
11
  message: `Summarize signup research:\n${brief}`,
12
12
  });
13
- return postMessage.run({ channel: "#pipeline", text: signupBriefMessage({ ...input, brief }) });
13
+ const sent = await slackSendMessage.run({
14
+ channel: "#pipeline",
15
+ markdown_text: signupBriefMessage({ ...input, brief }),
16
+ });
17
+ return { brief, ...sent };
14
18
  }
15
19
  ```
16
20
 
@@ -18,7 +22,7 @@ Actions are leaf units: an action never calls another action — compose them in
18
22
 
19
23
  ## Agents as workflow steps
20
24
 
21
- Import the agent and call `.prompt()` directly in the workflow `run`. Each call is a durable step keyed as `step:<agentKey>#<occurrence>` (same scheme as actions). No wrapper action required when the step is just "prompt this agent."
25
+ Import the agent and call `.prompt()` directly in the workflow `run`. Each call is a durable step keyed as `step:<agent-slug>#<occurrence>` (same scheme as actions). No wrapper action required when the step is just "prompt this agent."
22
26
 
23
27
  ```ts
24
28
  const result = await support.prompt({
@@ -28,6 +32,110 @@ const result = await support.prompt({
28
32
 
29
33
  Use a wrapper action only when the agent call should also be an agent tool, or when the step bundles non-prompt logic.
30
34
 
35
+ For an explicit step id, actions chain `.stepId("x")`; agent prompts take it as an option: `agent.prompt(input, { stepId: "x" })`.
36
+
37
+ ## LLM steps (`promptLlm`)
38
+
39
+ For a one-shot LLM call without a full agent, use `promptLlm` (from `@keystrokehq/keystroke/workflow`). It's a first-class durable step keyed `step:promptLlm#<occurrence>`. The signature is `promptLlm(prompt, opts)` — the prompt string comes **first**, options second:
40
+
41
+ ```ts
42
+ import { promptLlm } from "@keystrokehq/keystroke/workflow";
43
+
44
+ // Returns a string when no outputSchema is given:
45
+ const summary = await promptLlm(`Summarize:\n${brief}`, {
46
+ model: "anthropic/claude-sonnet-4-6",
47
+ });
48
+ ```
49
+
50
+ Pass `outputSchema` (Zod) to get a parsed, schema-validated object back instead of a string — the return type is inferred from the schema:
51
+
52
+ ```ts
53
+ import { z } from "zod";
54
+
55
+ const Category = z.object({ category: z.enum(["bug", "feature", "question"]) });
56
+
57
+ const { category } = await promptLlm(`Classify this ticket:\n${ticket}`, {
58
+ model: "anthropic/claude-sonnet-4-6",
59
+ outputSchema: Category,
60
+ });
61
+ ```
62
+
63
+ Other options: `system`, `thinkingLevel`, `temperature`, `maxTokens`, `stepId`.
64
+
65
+ ## Durability & retries
66
+
67
+ As each step completes, its result is written to a run event log. If a later step fails and the run is retried, Keystroke replays the log: completed steps return their recorded result instead of running again, and execution resumes at the first unfinished step. Design for this:
68
+
69
+ - **Put side effects inside steps.** Work in the `run` body that isn't an action / agent / `promptLlm` call (a raw `fetch`, a DB write, `Date.now()`, `Math.random()`) runs again on every replay. Move it into a step so it's recorded once.
70
+ - **Steps should be idempotent.** A step can be retried after a transient failure, so an action should tolerate being called twice with the same input (use idempotency keys for external writes where it matters).
71
+ - **Keep control flow deterministic.** Branch on the run's input and recorded step results — not on wall-clock time or randomness — so replays take the same path. Each step is recorded under `step:<slug>#<occurrence>`; pin `.stepId("x")` when an action's order can shift so replays still line up. Ids must be unique within a run.
72
+
73
+ You don't manage retries yourself. The runtime records `step_completed`, `step_retrying`, and `step_failed` events and surfaces them in `keystroke workflow runs get <slug> <run-id> --include steps,trace`.
74
+
75
+ ## Parallel steps
76
+
77
+ Independent steps run concurrently with `Promise.all` — each `.run()` / `.prompt()` / `promptLlm` inside it is still its own durable step, recorded and replayed individually:
78
+
79
+ ```ts
80
+ const [enriched, scored] = await Promise.all([
81
+ enrichLead.run({ leadId }),
82
+ scoreLead.run({ leadId }),
83
+ ]);
84
+ ```
85
+
86
+ Correlation ids are assigned per slug in array order (`step:enrich-lead#0`, `step:score-lead#0`). If the branches can change order between attempts (conditionally included, dynamic arrays), pin a stable `.stepId()` on each so replays line up:
87
+
88
+ ```ts
89
+ const results = await Promise.all(
90
+ leads.map((lead) => enrichLead.run({ leadId: lead.id }).stepId(`enrich:${lead.id}`)),
91
+ );
92
+ ```
93
+
94
+ There's no built-in concurrency limit or fan-out helper — `Promise.all` runs everything at once. For bounded concurrency, batch the array yourself (e.g. chunk and `await` each chunk).
95
+
96
+ ## Handling failures
97
+
98
+ Retries are **queue-level**: a failed run is re-enqueued (default 3 attempts, exponential backoff) and replays from the event log, so completed steps don't re-run. Each failed attempt emits `step_retrying`; the final failure emits `step_failed`. You don't write retry loops — make steps idempotent so a retried step is safe.
99
+
100
+ There's no built-in saga, compensation engine, or dead-letter queue. When a later step fails and you need to undo earlier work, orchestrate it yourself with `try/catch` in `run` — catching the error lets the run complete normally (so attach a `compensated` flag to the output rather than rethrowing if you've handled it):
101
+
102
+ ```ts
103
+ async run(input) {
104
+ await reserveBooking.run({ id: input.bookingId });
105
+ try {
106
+ await chargeCustomer.run({ id: input.bookingId });
107
+ return { ok: true };
108
+ } catch (error) {
109
+ await releaseBooking.run({ id: input.bookingId }); // best-effort cleanup
110
+ return { ok: false, compensated: true };
111
+ }
112
+ }
113
+ ```
114
+
115
+ If you let the error propagate instead, the run fails and the queue retries it — fine for transient failures, but it replays from the log, so any cleanup must itself be a recorded, idempotent step.
116
+
117
+ ## Durable run context (`ctx`)
118
+
119
+ `run(input, ctx)` receives a second argument exposing `runId`, `trigger` (`api` | `cron` | `webhook` | `poll` | `retry`), and the durable wait primitives `ctx.sleep(...)` and `ctx.hook(...)`. Both **suspend** the run (the replay engine resumes it later) so long waits and external callbacks don't hold a process open.
120
+
121
+ ```ts
122
+ // Durable delay: number (ms), duration string, or a Date
123
+ await ctx.sleep("1h");
124
+
125
+ // Durable hook: suspend until an external system POSTs to the resume URL
126
+ async run(input, ctx) {
127
+ const approval = ctx.hook<{ approved: boolean }>();
128
+ await slackSendMessage.run({
129
+ channel: "#approvals",
130
+ markdown_text: `Approve deploy? ${approval.resumeUrl}`,
131
+ });
132
+ const { approved } = await approval; // suspends here until resumed
133
+ return { approved };
134
+ }
135
+ ```
136
+
137
+ `ctx.hook(options?)` takes an optional `token` (reuse a stable resume token) and `schema` (Zod validation of the resume payload). The returned handle exposes `token` and `resumeUrl` before you await it — surface that URL so the approver/callback can resume the run.
138
+
31
139
  ## Agents inside actions
32
140
 
33
141
  When an action must call an agent (e.g. the action is reused as an agent tool), call `.prompt()` inside the action's `run`. That prompt is not a separate workflow step — the action is.
@@ -36,6 +144,10 @@ When an action must call an agent (e.g. the action is reused as an agent tool),
36
144
 
37
145
  Sync the app into `src/apps/`, author with `app.action()`, then `keystroke connect <slug>` before testing. Catalog integration actions from npm packages work once the app is connected.
38
146
 
39
- ## Keys
147
+ ## Slugs
148
+
149
+ Workflow `slug`, action `slug`, agent `slug`, and trigger `slug` share one namespace — pick unique names (`signup-pipeline`, not `pipeline`). The workflow's `slug` is also its HTTP route segment (`POST /workflows/{slug}`).
150
+
151
+ ## Subscription mode
40
152
 
41
- Workflow `key`, action `key`, agent `key`, and trigger `key` share one namespace pick unique names (`signup-pipeline`, not `pipeline`).
153
+ `defineWorkflow` accepts an optional `subscription: { mode: "system" | "subscribable" }` to control how the workflow can be subscribed to. Omit it for the default behavior.
@@ -2,15 +2,15 @@
2
2
 
3
3
  ## Unit tests (in-process, no server)
4
4
 
5
- Test through `executeWorkflow` from `@keystrokehq/workflow` — it parses input/output and wires up the action runner. **Never call `workflow.run(...)` directly**: that skips Zod validation and has no action context, so any action step throws.
5
+ Test through `executeWorkflow` from `@keystrokehq/keystroke/workflow` — it parses input/output and wires up the action runner. **Never call `workflow.run(...)` directly in a test**: called at top level (outside `executeWorkflow`) it skips Zod validation and has no action context, so any action step throws.
6
6
 
7
- `executeWorkflow` runs the workflow via the durable replay engine and resolves to a `ReplayResult`: `{ status: "completed", output }`, `{ status: "failed", error }`, or `{ status: "suspended", items }` (when the body hits `ctx.sleep`/`ctx.hook`). Assert on `status` and read `output`.
7
+ `executeWorkflow` runs the workflow via the durable replay engine and resolves to a `ReplayResult`: `{ status: "completed", output }`, `{ status: "failed", error }`, `{ status: "suspended", items }` (when the body hits `ctx.sleep`/`ctx.hook`), or `{ status: "canceled" }`. Assert on `status` and read `output`.
8
8
 
9
9
  `keystroke init` scaffolds Vitest and a starter test (e.g. `src/workflows/greeting.test.ts`):
10
10
 
11
11
  ```ts
12
12
  import { describe, expect, it } from "vitest";
13
- import { executeWorkflow } from "@keystrokehq/workflow";
13
+ import { executeWorkflow } from "@keystrokehq/keystroke/workflow";
14
14
  import greeting from "./greeting";
15
15
 
16
16
  describe("greeting workflow", () => {
@@ -27,7 +27,7 @@ For multi-step workflows:
27
27
 
28
28
  ```ts
29
29
  import { describe, expect, it } from "vitest";
30
- import { executeWorkflow } from "@keystrokehq/workflow";
30
+ import { executeWorkflow } from "@keystrokehq/keystroke/workflow";
31
31
  import workflow from "../signup-pipeline";
32
32
 
33
33
  it("runs the pipeline", async () => {
@@ -39,7 +39,7 @@ it("runs the pipeline", async () => {
39
39
 
40
40
  expect(result.status).toBe("completed");
41
41
  if (result.status === "completed") {
42
- expect(result.output).toMatchObject({ channel: "#signups" });
42
+ expect(result.output).toMatchObject({ channel: "#pipeline" });
43
43
  }
44
44
  });
45
45
  ```
@@ -51,7 +51,7 @@ Deterministic actions (pure logic, no network/LLM) need no mocks — run the wor
51
51
  Steps are checkpointed in the durable event log as `step_completed` events keyed by a stable **correlation id**. Before running a step the action runner checks the log for that correlation id; pre-seed a `step_completed` event to skip real work (LLM/agent/HTTP calls) and feed a fixture:
52
52
 
53
53
  ```ts
54
- import { executeWorkflow, MemoryEventLog } from "@keystrokehq/workflow";
54
+ import { executeWorkflow, MemoryEventLog } from "@keystrokehq/keystroke/workflow";
55
55
  import workflow from "../signup-pipeline";
56
56
 
57
57
  it("drafts without calling the agent", async () => {
@@ -83,7 +83,7 @@ it("drafts without calling the agent", async () => {
83
83
  Rules:
84
84
 
85
85
  - Pass a fixed `runId` and the same `MemoryEventLog` to `executeWorkflow`.
86
- - The correlation id is `step:<actionKey>#<occurrence>` — `#0` for the first call to that action, `#1` for the second, and so on — unless the step used `.stepId("x")`, in which case it is `step:x`.
86
+ - The correlation id is `step:<slug>#<occurrence>` — `#0` for the first call to that action/agent, `#1` for the second, and so on — unless an explicit step id was set (`action.stepId("x")` or `agent.prompt(input, { stepId: "x" })`), in which case it is `step:x`.
87
87
  - The action **output** is stored as the event `data` directly (no wrapper). It is re-validated against the action's output schema, so it must be schema-valid.
88
88
 
89
89
  This is the preferred mock: schema-checked, no module-mock hoisting, and it still exercises the real `run` orchestration (branching, loops, output shape) — only the action bodies are stubbed.
@@ -92,11 +92,19 @@ This is the preferred mock: schema-checked, no module-mock hoisting, and it stil
92
92
 
93
93
  When you'd rather stub the underlying dependency (e.g. the agent inside an action) or assert how it was called, use `vi.mock`:
94
94
 
95
+ `agent.prompt()` resolves to a `PromptResponse` — `{ sessionId, messages, error, canceled?, output? }` (`output` is the parsed result when the prompt was called with an `outputSchema`), **not** a bare messages array. Mock that shape:
96
+
95
97
  ```ts
96
98
  import { vi } from "vitest";
97
99
 
98
100
  vi.mock("../agents/support", () => ({
99
- default: { prompt: vi.fn().mockResolvedValue([{ role: "assistant", content: "mocked" }]) },
101
+ default: {
102
+ prompt: vi.fn().mockResolvedValue({
103
+ sessionId: "test-session",
104
+ messages: [{ role: "assistant", content: "mocked" }],
105
+ error: null,
106
+ }),
107
+ },
100
108
  }));
101
109
  ```
102
110
 
@@ -108,7 +116,7 @@ Validation happens at the `executeWorkflow` boundary, so contract tests are free
108
116
  await expect(executeWorkflow(workflow, { email: "x" } as never)).rejects.toThrow();
109
117
  ```
110
118
 
111
- ## Debug runs against a running server (CLI)
119
+ ## Debug runs from the CLI
112
120
 
113
121
  ```bash
114
122
  keystroke workflow run signup-pipeline --input '{"name":"Ada","email":"ada@acme.com","company":"Acme"}'
@@ -4,26 +4,35 @@ Keystroke project — agents, workflows, actions, and triggers under `src/`. See
4
4
 
5
5
  ## Getting started
6
6
 
7
+ Keystroke is deploy-first: build in `src/`, deploy to your platform project, then run and inspect what's deployed with the CLI.
8
+
7
9
  ```bash
8
- pnpm install # @keystrokehq/* from GitHub Packages (see .npmrc)
9
- # .env is created from .env.example on init — set ANTHROPIC_API_KEY and integration keys
10
- keystroke start # API :3002, dashboard :3000
10
+ pnpm install # @keystrokehq/* from GitHub Packages (see .npmrc)
11
+ keystroke auth login # once
12
+ keystroke deploy --project <id> # build + ship src/ (see: keystroke project list)
11
13
  ```
12
14
 
13
- Login at `http://localhost:3000` (`admin@example.com` / `adminadmin` by default).
14
-
15
- Prompt the hello agent:
15
+ <!-- example:start -->
16
+ Prompt the hello agent and run the greeting workflow against your deployed project:
16
17
 
17
18
  ```bash
18
19
  keystroke agent prompt hello --message "Hi"
20
+ keystroke workflow run greeting --input '{"name":"Ada"}'
19
21
  ```
20
22
 
21
- Run the greeting workflow:
23
+ Use `--filter agents/hello` (or `workflows/greeting`) to redeploy a single module fast.
24
+ <!-- example:end -->
25
+
26
+ ## Run locally (optional)
27
+
28
+ To iterate offline without deploying, run a local server. Set `ANTHROPIC_API_KEY` and any integration keys in `.env` (created from `.env.example` on init), then:
22
29
 
23
30
  ```bash
24
- keystroke workflow run greeting --input '{"name":"Ada"}'
31
+ keystroke dev # watch src/, rebuild, restart the API (API :3002, dashboard :3000)
25
32
  ```
26
33
 
34
+ The same `keystroke agent` / `keystroke workflow` commands then target your local server. Login at `http://localhost:3000` (`admin@example.com` / `adminadmin` by default).
35
+
27
36
  ## Linting
28
37
 
29
38
  ```bash
@@ -39,7 +48,9 @@ pnpm test:unit # src/**/*.test.ts
39
48
  pnpm test:int # src/**/*.int.test.ts (needs ANTHROPIC_API_KEY for agent tests)
40
49
  ```
41
50
 
51
+ <!-- example:start -->
42
52
  Example: `src/workflows/greeting.test.ts` uses `executeWorkflow` to test the `greeting` workflow in-process.
53
+ <!-- example:end -->
43
54
 
44
55
  ## Layout
45
56
 
@@ -6,6 +6,6 @@ describe("greeting workflow", () => {
6
6
  it("returns a greeting for a name", async () => {
7
7
  const result = await executeWorkflow(greeting, { name: "Ada" });
8
8
 
9
- expect(result).toEqual({ greeting: "Hello, Ada!" });
9
+ expect(result).toEqual({ status: "completed", output: { greeting: "Hello, Ada!" } });
10
10
  });
11
11
  });
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { Rn as originFromPublicUrl, st as LOCAL_PLATFORM_ORIGIN } from "./dist-D638kKxn.mjs";
2
+ import { st as LOCAL_PLATFORM_ORIGIN, zn as originFromPublicUrl } from "./dist-BnIugffH.mjs";
3
3
  import Conf from "conf";
4
4
  import { homedir } from "node:os";
5
5
  import { dirname, join } from "node:path";
@@ -166,4 +166,4 @@ function readCliVersion() {
166
166
  //#endregion
167
167
  export { installPlaygroundDependencies as a, createCliConfig as c, getEffectiveApiTarget as d, getPlatformUrl as f, resolvePlatformUrlForWebUrl as g, DEFAULT_WEB_URL as h, installDependencies as i, getCliConfigDir as l, DEFAULT_PLATFORM_URL as m, buildPlaygroundWorkspace as n, resolvePackageManager as o, getWebUrl as p, detectPackageManager as r, resolveCliRoot as s, readCliVersion as t, getConfigDir as u };
168
168
 
169
- //# sourceMappingURL=version-Brfe7Lb_.mjs.map
169
+ //# sourceMappingURL=version-DScIhncv.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"version-Brfe7Lb_.mjs","names":[],"sources":["../src/resolve-platform-url.ts","../src/config.ts","../src/project/resolve-cli-root.ts","../src/init/package-manager.ts","../src/version.ts"],"sourcesContent":["import { LOCAL_PLATFORM_ORIGIN, originFromPublicUrl } from \"@keystrokehq/shared\";\n\nexport const DEFAULT_WEB_URL = \"https://keystroke.ai\";\nexport const DEFAULT_PLATFORM_URL = \"https://api.keystroke.ai\";\nexport const LOCAL_WEB_URL = \"http://localhost:3000\";\n\nexport type ResolvePlatformUrlOptions = {\n platformUrl?: string;\n /** Used when webUrl does not match a known deployment. */\n fallback?: string;\n};\n\nfunction webOriginFromUrl(webUrl: string): string {\n return originFromPublicUrl(webUrl, webUrl.replace(/\\/+$/, \"\"));\n}\n\n/** Known web origins with a fixed platform API — undefined for custom/staging URLs. */\nexport function knownPlatformUrlForWebUrl(webUrl: string): string | undefined {\n const webOrigin = webOriginFromUrl(webUrl);\n\n if (webOrigin === LOCAL_WEB_URL || webOrigin === \"http://127.0.0.1:3000\") {\n return LOCAL_PLATFORM_ORIGIN;\n }\n\n if (webOrigin === DEFAULT_WEB_URL) {\n return DEFAULT_PLATFORM_URL;\n }\n\n return undefined;\n}\n\nexport function resolvePlatformUrlForWebUrl(\n webUrl: string,\n options: ResolvePlatformUrlOptions = {},\n): string {\n const explicit = options.platformUrl?.trim();\n if (explicit) {\n return explicit.replace(/\\/+$/, \"\");\n }\n\n const known = knownPlatformUrlForWebUrl(webUrl);\n if (known) {\n return known;\n }\n\n const fallback = options.fallback?.trim() || DEFAULT_PLATFORM_URL;\n return fallback.replace(/\\/+$/, \"\");\n}\n","import Conf from \"conf\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nimport {\n DEFAULT_PLATFORM_URL,\n DEFAULT_WEB_URL,\n knownPlatformUrlForWebUrl,\n resolvePlatformUrlForWebUrl,\n} from \"./resolve-platform-url\";\n\nexport type ApiTargetMode = \"local\" | \"platform\";\n\nexport type CliConfig = {\n webUrl: string;\n platformUrl: string;\n activeOrganizationId?: string;\n activeProjectId?: string;\n apiTarget?: ApiTargetMode;\n};\n\nexport function getCliConfigDir(cwd = join(homedir(), \".keystroke\")): string {\n return cwd;\n}\n\nexport function getConfigDir(config: Conf<CliConfig>): string {\n return dirname(config.path);\n}\n\nexport function getEffectiveApiTarget(config: Conf<CliConfig>): ApiTargetMode {\n const explicit = config.get(\"apiTarget\");\n if (explicit === \"local\" || explicit === \"platform\") {\n return explicit;\n }\n\n if (process.env.KEYSTROKE_API_KEY?.trim()) {\n return \"platform\";\n }\n\n return \"local\";\n}\n\nfunction syncPlatformUrlWithWebUrl(config: Conf<CliConfig>): void {\n const webUrl = config.get(\"webUrl\");\n const known = knownPlatformUrlForWebUrl(webUrl);\n if (!known) {\n return;\n }\n\n const stored = config.get(\"platformUrl\");\n if (stored !== known) {\n config.set(\"platformUrl\", known);\n }\n}\n\nexport function createCliConfig(cwd = getCliConfigDir()): Conf<CliConfig> {\n const config = new Conf<CliConfig>({\n projectName: \"keystroke\",\n cwd,\n schema: {\n webUrl: {\n type: \"string\",\n default: DEFAULT_WEB_URL,\n },\n platformUrl: {\n type: \"string\",\n default: DEFAULT_PLATFORM_URL,\n },\n activeOrganizationId: {\n type: \"string\",\n },\n activeProjectId: {\n type: \"string\",\n },\n apiTarget: {\n type: \"string\",\n enum: [\"local\", \"platform\"],\n },\n },\n });\n\n syncPlatformUrlWithWebUrl(config);\n return config;\n}\n\nexport function getWebUrl(config: Conf<CliConfig>): string {\n return config.get(\"webUrl\");\n}\n\nexport function getPlatformUrl(config: Conf<CliConfig>): string {\n const apiKey = process.env.KEYSTROKE_API_KEY?.trim();\n const fromEnv = process.env.KEYSTROKE_PLATFORM_URL?.trim();\n if (apiKey && fromEnv) {\n return fromEnv.replace(/\\/+$/, \"\");\n }\n return resolvePlatformUrlForWebUrl(getWebUrl(config), {\n fallback: config.get(\"platformUrl\"),\n });\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nfunction isCliPackage(dir: string): boolean {\n const packageJsonPath = join(dir, \"package.json\");\n if (!existsSync(packageJsonPath)) {\n return false;\n }\n\n const pkg = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as { name?: string };\n return pkg.name === \"@keystrokehq/cli\";\n}\n\nexport function resolveCliRoot(fromModuleUrl: string): string {\n let dir = dirname(fileURLToPath(fromModuleUrl));\n\n while (dir !== dirname(dir)) {\n if (isCliPackage(dir)) {\n return dir;\n }\n\n dir = dirname(dir);\n }\n\n throw new Error(\"Could not resolve keystroke CLI package root\");\n}\n","import { spawnSync } from \"node:child_process\";\n\nexport type PackageManager = \"npm\" | \"pnpm\" | \"yarn\" | \"bun\";\n\nconst MANAGERS: PackageManager[] = [\"pnpm\", \"npm\", \"yarn\", \"bun\"];\n\nexport function detectPackageManager(): PackageManager {\n const userAgent = process.env.npm_config_user_agent ?? \"\";\n\n for (const manager of MANAGERS) {\n if (userAgent.startsWith(manager)) {\n return manager;\n }\n }\n\n if (process.env.PNPM_HOME) {\n return \"pnpm\";\n }\n\n return \"npm\";\n}\n\nexport function resolvePackageManager(explicit?: string): PackageManager {\n if (!explicit) {\n return detectPackageManager();\n }\n\n const normalized = explicit.trim().toLowerCase();\n if (!MANAGERS.includes(normalized as PackageManager)) {\n throw new Error(`Unsupported package manager \"${explicit}\". Use npm, pnpm, yarn, or bun.`);\n }\n\n return normalized as PackageManager;\n}\n\n/** Resolve GitHub Packages auth for @keystrokehq/* when NODE_AUTH_TOKEN is unset. */\nexport function resolveGithubPackagesToken(): string | undefined {\n if (process.env.NODE_AUTH_TOKEN) {\n return process.env.NODE_AUTH_TOKEN;\n }\n\n for (const key of [\"GITHUB_TOKEN\", \"GH_TOKEN\"] as const) {\n const value = process.env[key];\n if (value) {\n return value;\n }\n }\n\n const gh = spawnSync(\"gh\", [\"auth\", \"token\"], { encoding: \"utf8\" });\n if (gh.status === 0) {\n const token = gh.stdout.trim();\n if (token) {\n return token;\n }\n }\n\n return undefined;\n}\n\nexport function installDependencies(cwd: string, manager: PackageManager): void {\n const token = resolveGithubPackagesToken();\n const env = token ? { ...process.env, NODE_AUTH_TOKEN: token } : process.env;\n\n const result = spawnSync(manager, [\"install\"], {\n cwd,\n stdio: \"inherit\",\n env,\n });\n\n if (result.status !== 0) {\n throw new Error(`${manager} install failed`);\n }\n}\n\nexport function installPlaygroundDependencies(cwd: string): void {\n const result = spawnSync(\"pnpm\", [\"install\", \"--ignore-workspace\"], {\n cwd,\n stdio: \"inherit\",\n env: process.env,\n });\n\n if (result.status !== 0) {\n throw new Error(\"pnpm install failed\");\n }\n}\n\n/**\n * Build every workspace package so the playground's `link:` deps resolve to\n * compiled `dist/`. Without this, `keystroke dev` fails with\n * `ERR_MODULE_NOT_FOUND` against whichever package was never built. Turbo\n * caches, so this is only slow on the first run.\n */\nexport function buildPlaygroundWorkspace(monorepoRoot: string): void {\n // Build with a clean Node env: the `keystroke-dev` wrapper sets\n // NODE_OPTIONS=--conditions=development, which would make tsdown/turbo resolve\n // their own deps to src/ and fail. Dropping NODE_OPTIONS builds to dist/ normally.\n const { NODE_OPTIONS: _drop, ...buildEnv } = process.env;\n const result = spawnSync(\"pnpm\", [\"run\", \"build\"], {\n cwd: monorepoRoot,\n stdio: \"inherit\",\n env: buildEnv,\n });\n\n if (result.status !== 0) {\n throw new Error(\"workspace build failed (pnpm run build)\");\n }\n}\n","import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { resolveCliRoot } from \"./project/resolve-cli-root\";\n\nexport function readCliVersion(): string {\n const packageJsonPath = join(resolveCliRoot(import.meta.url), \"package.json\");\n const pkg = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as { version?: string };\n return pkg.version ?? \"0.0.0\";\n}\n"],"mappings":";;;;;;;;;AAEA,MAAa,kBAAkB;AAC/B,MAAa,uBAAuB;AASpC,SAAS,iBAAiB,QAAwB;CAChD,OAAO,oBAAoB,QAAQ,OAAO,QAAQ,QAAQ,EAAE,CAAC;AAC/D;;AAGA,SAAgB,0BAA0B,QAAoC;CAC5E,MAAM,YAAY,iBAAiB,MAAM;CAEzC,IAAI,cAAA,2BAA+B,cAAc,yBAC/C,OAAO;CAGT,IAAI,cAAA,wBACF,OAAO;AAIX;AAEA,SAAgB,4BACd,QACA,UAAqC,CAAC,GAC9B;CACR,MAAM,WAAW,QAAQ,aAAa,KAAK;CAC3C,IAAI,UACF,OAAO,SAAS,QAAQ,QAAQ,EAAE;CAGpC,MAAM,QAAQ,0BAA0B,MAAM;CAC9C,IAAI,OACF,OAAO;CAIT,QADiB,QAAQ,UAAU,KAAK,KAAA,4BACxB,QAAQ,QAAQ,EAAE;AACpC;;;AC1BA,SAAgB,gBAAgB,MAAM,KAAK,QAAQ,GAAG,YAAY,GAAW;CAC3E,OAAO;AACT;AAEA,SAAgB,aAAa,QAAiC;CAC5D,OAAO,QAAQ,OAAO,IAAI;AAC5B;AAEA,SAAgB,sBAAsB,QAAwC;CAC5E,MAAM,WAAW,OAAO,IAAI,WAAW;CACvC,IAAI,aAAa,WAAW,aAAa,YACvC,OAAO;CAGT,IAAI,QAAQ,IAAI,mBAAmB,KAAK,GACtC,OAAO;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,QAAQ;CACf,CAES,EAAE,WAAW,GACpB,MAAM,IAAI,MAAM,qBAAqB;AAEzC;;;;;;;AAQA,SAAgB,yBAAyB,cAA4B;CAInE,MAAM,EAAE,cAAc,OAAO,GAAG,aAAa,QAAQ;CAOrD,IANe,UAAU,QAAQ,CAAC,OAAO,OAAO,GAAG;EACjD,KAAK;EACL,OAAO;EACP,KAAK;CACP,CAES,EAAE,WAAW,GACpB,MAAM,IAAI,MAAM,yCAAyC;AAE7D;;;ACtGA,SAAgB,iBAAyB;CACvC,MAAM,kBAAkB,KAAK,eAAe,OAAO,KAAK,GAAG,GAAG,cAAc;CAE5E,OADY,KAAK,MAAM,aAAa,iBAAiB,MAAM,CAClD,EAAE,WAAW;AACxB"}
1
+ {"version":3,"file":"version-DScIhncv.mjs","names":[],"sources":["../src/resolve-platform-url.ts","../src/config.ts","../src/project/resolve-cli-root.ts","../src/init/package-manager.ts","../src/version.ts"],"sourcesContent":["import { LOCAL_PLATFORM_ORIGIN, originFromPublicUrl } from \"@keystrokehq/shared\";\n\nexport const DEFAULT_WEB_URL = \"https://keystroke.ai\";\nexport const DEFAULT_PLATFORM_URL = \"https://api.keystroke.ai\";\nexport const LOCAL_WEB_URL = \"http://localhost:3000\";\n\nexport type ResolvePlatformUrlOptions = {\n platformUrl?: string;\n /** Used when webUrl does not match a known deployment. */\n fallback?: string;\n};\n\nfunction webOriginFromUrl(webUrl: string): string {\n return originFromPublicUrl(webUrl, webUrl.replace(/\\/+$/, \"\"));\n}\n\n/** Known web origins with a fixed platform API — undefined for custom/staging URLs. */\nexport function knownPlatformUrlForWebUrl(webUrl: string): string | undefined {\n const webOrigin = webOriginFromUrl(webUrl);\n\n if (webOrigin === LOCAL_WEB_URL || webOrigin === \"http://127.0.0.1:3000\") {\n return LOCAL_PLATFORM_ORIGIN;\n }\n\n if (webOrigin === DEFAULT_WEB_URL) {\n return DEFAULT_PLATFORM_URL;\n }\n\n return undefined;\n}\n\nexport function resolvePlatformUrlForWebUrl(\n webUrl: string,\n options: ResolvePlatformUrlOptions = {},\n): string {\n const explicit = options.platformUrl?.trim();\n if (explicit) {\n return explicit.replace(/\\/+$/, \"\");\n }\n\n const known = knownPlatformUrlForWebUrl(webUrl);\n if (known) {\n return known;\n }\n\n const fallback = options.fallback?.trim() || DEFAULT_PLATFORM_URL;\n return fallback.replace(/\\/+$/, \"\");\n}\n","import Conf from \"conf\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nimport {\n DEFAULT_PLATFORM_URL,\n DEFAULT_WEB_URL,\n knownPlatformUrlForWebUrl,\n resolvePlatformUrlForWebUrl,\n} from \"./resolve-platform-url\";\n\nexport type ApiTargetMode = \"local\" | \"platform\";\n\nexport type CliConfig = {\n webUrl: string;\n platformUrl: string;\n activeOrganizationId?: string;\n activeProjectId?: string;\n apiTarget?: ApiTargetMode;\n};\n\nexport function getCliConfigDir(cwd = join(homedir(), \".keystroke\")): string {\n return cwd;\n}\n\nexport function getConfigDir(config: Conf<CliConfig>): string {\n return dirname(config.path);\n}\n\nexport function getEffectiveApiTarget(config: Conf<CliConfig>): ApiTargetMode {\n const explicit = config.get(\"apiTarget\");\n if (explicit === \"local\" || explicit === \"platform\") {\n return explicit;\n }\n\n if (process.env.KEYSTROKE_API_KEY?.trim()) {\n return \"platform\";\n }\n\n return \"local\";\n}\n\nfunction syncPlatformUrlWithWebUrl(config: Conf<CliConfig>): void {\n const webUrl = config.get(\"webUrl\");\n const known = knownPlatformUrlForWebUrl(webUrl);\n if (!known) {\n return;\n }\n\n const stored = config.get(\"platformUrl\");\n if (stored !== known) {\n config.set(\"platformUrl\", known);\n }\n}\n\nexport function createCliConfig(cwd = getCliConfigDir()): Conf<CliConfig> {\n const config = new Conf<CliConfig>({\n projectName: \"keystroke\",\n cwd,\n schema: {\n webUrl: {\n type: \"string\",\n default: DEFAULT_WEB_URL,\n },\n platformUrl: {\n type: \"string\",\n default: DEFAULT_PLATFORM_URL,\n },\n activeOrganizationId: {\n type: \"string\",\n },\n activeProjectId: {\n type: \"string\",\n },\n apiTarget: {\n type: \"string\",\n enum: [\"local\", \"platform\"],\n },\n },\n });\n\n syncPlatformUrlWithWebUrl(config);\n return config;\n}\n\nexport function getWebUrl(config: Conf<CliConfig>): string {\n return config.get(\"webUrl\");\n}\n\nexport function getPlatformUrl(config: Conf<CliConfig>): string {\n const apiKey = process.env.KEYSTROKE_API_KEY?.trim();\n const fromEnv = process.env.KEYSTROKE_PLATFORM_URL?.trim();\n if (apiKey && fromEnv) {\n return fromEnv.replace(/\\/+$/, \"\");\n }\n return resolvePlatformUrlForWebUrl(getWebUrl(config), {\n fallback: config.get(\"platformUrl\"),\n });\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nfunction isCliPackage(dir: string): boolean {\n const packageJsonPath = join(dir, \"package.json\");\n if (!existsSync(packageJsonPath)) {\n return false;\n }\n\n const pkg = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as { name?: string };\n return pkg.name === \"@keystrokehq/cli\";\n}\n\nexport function resolveCliRoot(fromModuleUrl: string): string {\n let dir = dirname(fileURLToPath(fromModuleUrl));\n\n while (dir !== dirname(dir)) {\n if (isCliPackage(dir)) {\n return dir;\n }\n\n dir = dirname(dir);\n }\n\n throw new Error(\"Could not resolve keystroke CLI package root\");\n}\n","import { spawnSync } from \"node:child_process\";\n\nexport type PackageManager = \"npm\" | \"pnpm\" | \"yarn\" | \"bun\";\n\nconst MANAGERS: PackageManager[] = [\"pnpm\", \"npm\", \"yarn\", \"bun\"];\n\nexport function detectPackageManager(): PackageManager {\n const userAgent = process.env.npm_config_user_agent ?? \"\";\n\n for (const manager of MANAGERS) {\n if (userAgent.startsWith(manager)) {\n return manager;\n }\n }\n\n if (process.env.PNPM_HOME) {\n return \"pnpm\";\n }\n\n return \"npm\";\n}\n\nexport function resolvePackageManager(explicit?: string): PackageManager {\n if (!explicit) {\n return detectPackageManager();\n }\n\n const normalized = explicit.trim().toLowerCase();\n if (!MANAGERS.includes(normalized as PackageManager)) {\n throw new Error(`Unsupported package manager \"${explicit}\". Use npm, pnpm, yarn, or bun.`);\n }\n\n return normalized as PackageManager;\n}\n\n/** Resolve GitHub Packages auth for @keystrokehq/* when NODE_AUTH_TOKEN is unset. */\nexport function resolveGithubPackagesToken(): string | undefined {\n if (process.env.NODE_AUTH_TOKEN) {\n return process.env.NODE_AUTH_TOKEN;\n }\n\n for (const key of [\"GITHUB_TOKEN\", \"GH_TOKEN\"] as const) {\n const value = process.env[key];\n if (value) {\n return value;\n }\n }\n\n const gh = spawnSync(\"gh\", [\"auth\", \"token\"], { encoding: \"utf8\" });\n if (gh.status === 0) {\n const token = gh.stdout.trim();\n if (token) {\n return token;\n }\n }\n\n return undefined;\n}\n\nexport function installDependencies(cwd: string, manager: PackageManager): void {\n const token = resolveGithubPackagesToken();\n const env = token ? { ...process.env, NODE_AUTH_TOKEN: token } : process.env;\n\n const result = spawnSync(manager, [\"install\"], {\n cwd,\n stdio: \"inherit\",\n env,\n });\n\n if (result.status !== 0) {\n throw new Error(`${manager} install failed`);\n }\n}\n\nexport function installPlaygroundDependencies(cwd: string): void {\n const result = spawnSync(\"pnpm\", [\"install\", \"--ignore-workspace\"], {\n cwd,\n stdio: \"inherit\",\n env: process.env,\n });\n\n if (result.status !== 0) {\n throw new Error(\"pnpm install failed\");\n }\n}\n\n/**\n * Build every workspace package so the playground's `link:` deps resolve to\n * compiled `dist/`. Without this, `keystroke dev` fails with\n * `ERR_MODULE_NOT_FOUND` against whichever package was never built. Turbo\n * caches, so this is only slow on the first run.\n */\nexport function buildPlaygroundWorkspace(monorepoRoot: string): void {\n // Build with a clean Node env: the `keystroke-dev` wrapper sets\n // NODE_OPTIONS=--conditions=development, which would make tsdown/turbo resolve\n // their own deps to src/ and fail. Dropping NODE_OPTIONS builds to dist/ normally.\n const { NODE_OPTIONS: _drop, ...buildEnv } = process.env;\n const result = spawnSync(\"pnpm\", [\"run\", \"build\"], {\n cwd: monorepoRoot,\n stdio: \"inherit\",\n env: buildEnv,\n });\n\n if (result.status !== 0) {\n throw new Error(\"workspace build failed (pnpm run build)\");\n }\n}\n","import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { resolveCliRoot } from \"./project/resolve-cli-root\";\n\nexport function readCliVersion(): string {\n const packageJsonPath = join(resolveCliRoot(import.meta.url), \"package.json\");\n const pkg = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as { version?: string };\n return pkg.version ?? \"0.0.0\";\n}\n"],"mappings":";;;;;;;;;AAEA,MAAa,kBAAkB;AAC/B,MAAa,uBAAuB;AASpC,SAAS,iBAAiB,QAAwB;CAChD,OAAO,oBAAoB,QAAQ,OAAO,QAAQ,QAAQ,EAAE,CAAC;AAC/D;;AAGA,SAAgB,0BAA0B,QAAoC;CAC5E,MAAM,YAAY,iBAAiB,MAAM;CAEzC,IAAI,cAAA,2BAA+B,cAAc,yBAC/C,OAAO;CAGT,IAAI,cAAA,wBACF,OAAO;AAIX;AAEA,SAAgB,4BACd,QACA,UAAqC,CAAC,GAC9B;CACR,MAAM,WAAW,QAAQ,aAAa,KAAK;CAC3C,IAAI,UACF,OAAO,SAAS,QAAQ,QAAQ,EAAE;CAGpC,MAAM,QAAQ,0BAA0B,MAAM;CAC9C,IAAI,OACF,OAAO;CAIT,QADiB,QAAQ,UAAU,KAAK,KAAA,4BACxB,QAAQ,QAAQ,EAAE;AACpC;;;AC1BA,SAAgB,gBAAgB,MAAM,KAAK,QAAQ,GAAG,YAAY,GAAW;CAC3E,OAAO;AACT;AAEA,SAAgB,aAAa,QAAiC;CAC5D,OAAO,QAAQ,OAAO,IAAI;AAC5B;AAEA,SAAgB,sBAAsB,QAAwC;CAC5E,MAAM,WAAW,OAAO,IAAI,WAAW;CACvC,IAAI,aAAa,WAAW,aAAa,YACvC,OAAO;CAGT,IAAI,QAAQ,IAAI,mBAAmB,KAAK,GACtC,OAAO;CAGT,OAAO;AACT;AAE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AE,WAAW,GACpB,MAAM,IAAI,MAAM,qBAAqB;AAEzC;;;;;;;AAQA,SAAgB,yBAAyB,cAA4B;CAInE,MAAM,EAAE,cAAc,OAAO,GAAG,aAAa,QAAQ;CAOrD,IANe,UAAU,QAAQ,CAAC,OAAO,OAAO,GAAG;EACjD,KAAK;EACL,OAAO;EACP,KAAK;CACP,CAES,EAAE,WAAW,GACpB,MAAM,IAAI,MAAM,yCAAyC;AAE7D;;;ACtGA,SAAgB,iBAAyB;CACvC,MAAM,kBAAkB,KAAK,eAAe,OAAO,KAAK,GAAG,GAAG,cAAc;CAE5E,OADY,KAAK,MAAM,aAAa,iBAAiB,MAAM,CAClD,EAAE,WAAW;AACxB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keystrokehq/cli",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/keystrokehq/keystroke.git",
@@ -40,9 +40,9 @@
40
40
  "tsx": "^4.22.3",
41
41
  "typescript": "^6.0.3",
42
42
  "vitest": "^4.1.7",
43
- "@keystrokehq/oxlint-config": "0.0.4",
44
43
  "@keystrokehq/tsconfig": "0.0.3",
45
44
  "@keystrokehq/tsdown-config": "0.0.3",
45
+ "@keystrokehq/oxlint-config": "0.0.4",
46
46
  "@keystrokehq/vitest-config": "0.0.5"
47
47
  },
48
48
  "scripts": {