@keystrokehq/cli 0.0.21 → 0.0.23

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 (83) hide show
  1. package/dist/{accept.handler-C6KBLKmW.mjs → accept.handler-tvT9pleH.mjs} +1 -1
  2. package/dist/{admin-D2CQoZAN.mjs → admin-DsAQ0WWj.mjs} +9 -9
  3. package/dist/{agents-Bn0g5o0o.mjs → agents-Ccw0IZCx.mjs} +4 -4
  4. package/dist/{api-J9UL8pqZ.mjs → api-O5tdGdzc.mjs} +29 -3
  5. package/dist/{api-keys-BixCnZJW.mjs → api-keys-tle_m3kk.mjs} +5 -5
  6. package/dist/{auth-yCNMT8sJ.mjs → auth-DLaY5yCZ.mjs} +6 -11
  7. package/dist/{auth.handler-BedGpKh1.mjs → auth.handler-Dq2fXO3S.mjs} +16 -47
  8. package/dist/{build.handler-CyDc8jiZ.mjs → build.handler-ChqSwsT_.mjs} +3 -3
  9. package/dist/{clear-cache.handler-FmJPHdWG.mjs → clear-cache.handler-DpP1VlbR.mjs} +1 -1
  10. package/dist/{clear.handler-Cvb9chs4.mjs → clear.handler-FzohTmpU.mjs} +2 -6
  11. package/dist/{commander-9Kro0Dl3.mjs → commander-BTMzBiLq.mjs} +1 -1
  12. package/dist/{connect-DzVxjeYr.mjs → connect-BUu2ojK7.mjs} +26 -2
  13. package/dist/{connect.handler-DFQdxkWZ.mjs → connect.handler-D7oO_5WS.mjs} +38 -3
  14. package/dist/{context-B2cQ-Nt3.mjs → context-DHOTSgPb.mjs} +5 -10
  15. package/dist/{create.handler-v9B0Z9Yf.mjs → create.handler-BuxP18uj.mjs} +1 -1
  16. package/dist/{credential-env-map-Dvp00a4M.mjs → credential-env-map-CtmzNkwU.mjs} +1 -1
  17. package/dist/{credentials-Dr5lD7Hm.mjs → credentials-CELZ0QHu.mjs} +5 -5
  18. package/dist/{current-deployment-workflow-qMfOrRIu.mjs → current-deployment-workflow-CnzlDCBv.mjs} +2 -2
  19. package/dist/{current.handler-Cm_-JLyZ.mjs → current.handler-BXec-Bhy.mjs} +1 -1
  20. package/dist/{delete.handler-DtP_zUaq.mjs → delete.handler-CpYOMtsv.mjs} +1 -1
  21. package/dist/{deploy-CB6pfCuB.mjs → deploy-Cn3jN7Rl.mjs} +2 -2
  22. package/dist/{deploy.handler-Bg0dpSTj.mjs → deploy.handler-BikVS9ER.mjs} +7 -7
  23. package/dist/{diff.handler-CJPrszL1.mjs → diff.handler-C3EWVBOj.mjs} +3 -3
  24. package/dist/dist-D_KgdxW5.mjs +539 -0
  25. package/dist/{env.handler-6TrLd3fo.mjs → env.handler-BuFdzUoX.mjs} +4 -4
  26. package/dist/{init-DBMtY3eO.mjs → init-6tGGTpYO.mjs} +2 -2
  27. package/dist/{init.handler-BoYbE-6H.mjs → init.handler-Dcg9MOqx.mjs} +2 -2
  28. package/dist/{inspect.handler-Juu2vGbB.mjs → inspect.handler-BN6p2hI_.mjs} +3 -3
  29. package/dist/{integration-catalog-cYlTmOSb.mjs → integration-catalog-Cub_7xCw.mjs} +1 -1
  30. package/dist/{integrations-cwRfplNG.mjs → integrations-BRMzYHz1.mjs} +4 -4
  31. package/dist/{invites-DHyHZOY_.mjs → invites-RO4Dy-m6.mjs} +4 -4
  32. package/dist/{invites.list.handler-C-QpsG2J.mjs → invites.list.handler-B2RoiFCu.mjs} +1 -1
  33. package/dist/{invites.resend.handler-KFKbSPzR.mjs → invites.resend.handler-C4rzRkqX.mjs} +1 -1
  34. package/dist/{invites.revoke.handler-Cuz7jrGC.mjs → invites.revoke.handler-CMf6PpeL.mjs} +1 -1
  35. package/dist/keystroke.mjs +21 -21
  36. package/dist/{list.handler-DRe38pAj.mjs → list.handler-BjKZ9-QO.mjs} +2 -2
  37. package/dist/{list.handler-Cc-V1TNz.mjs → list.handler-DpdVFRYl.mjs} +1 -1
  38. package/dist/{list.handler-Do2tVOnu.mjs → list.handler-DrY5bgm1.mjs} +1 -1
  39. package/dist/{list.handler-CLGQDuo5.mjs → list.handler-cK8Y-daR.mjs} +3 -3
  40. package/dist/{list.handler-BWsl4iYw.mjs → list.handler-fcyAKTQe.mjs} +3 -3
  41. package/dist/{list.handler-6x3GVumu.mjs → list.handler-ijBH6Ow_.mjs} +1 -1
  42. package/dist/{list.handler-RtHhrTZ3.mjs → list.handler-wYGZhl1g.mjs} +1 -1
  43. package/dist/{listen-DZdSevsB.mjs → listen-CEn4PucV.mjs} +2 -2
  44. package/dist/{listen.handler-BccHe1jh.mjs → listen.handler-B7s6mz82.mjs} +1 -1
  45. package/dist/{logs-Bh_PBnu6.mjs → logs-DiH8JXn1.mjs} +1 -1
  46. package/dist/{logs.handler-DItDS1zw.mjs → logs.handler-D0sNlOz4.mjs} +1 -1
  47. package/dist/{members.add.handler-D3nQ_Ln6.mjs → members.add.handler-Dr9SCjrS.mjs} +1 -1
  48. package/dist/{members.invite.handler-rKhg5n_C.mjs → members.invite.handler-8-pTOtw_.mjs} +1 -1
  49. package/dist/{members.list.handler-C9Yh469k.mjs → members.list.handler-CUZGd-3B.mjs} +1 -1
  50. package/dist/{members.remove.handler-Dnrck-E6.mjs → members.remove.handler-BCiLt3pa.mjs} +1 -1
  51. package/dist/{members.update.handler-qo5r6arJ.mjs → members.update.handler-BAbB9ssa.mjs} +1 -1
  52. package/dist/{org-DnES84sS.mjs → org-BD4fj8Yh.mjs} +15 -15
  53. package/dist/{orgs.create.handler-DF4eEL-2.mjs → orgs.create.handler-B_7WjV3s.mjs} +1 -1
  54. package/dist/{orgs.get.handler-BmJnseQa.mjs → orgs.get.handler-BgjeDmfl.mjs} +1 -1
  55. package/dist/{orgs.list.handler-DDVvSbsT.mjs → orgs.list.handler-ZRdb-yu5.mjs} +1 -1
  56. package/dist/{paused.handler-BLUchSMD.mjs → paused.handler-CzQkBKS6.mjs} +1 -1
  57. package/dist/{projects-Cv14bBGy.mjs → projects-CgtfPFGu.mjs} +4 -4
  58. package/dist/{requirements.handler-BKFocUof.mjs → requirements.handler-ZZfHV6f0.mjs} +2 -2
  59. package/dist/{resolve-cli-credentials-DaMDaamj.mjs → resolve-cli-credentials-B4crOe_y.mjs} +5 -5
  60. package/dist/{resolve-project-Cj3MFnU0.mjs → resolve-project-DJJZIOmu.mjs} +1 -1
  61. package/dist/{run.handler-DZuUx0fi.mjs → run.handler-xeUVmlFk.mjs} +4 -4
  62. package/dist/{runs-BOo3j297.mjs → runs-CZRwB58H.mjs} +2 -2
  63. package/dist/{skills.command-B-MhRN3J.mjs → skills.command-DGIIIRX_.mjs} +1 -1
  64. package/dist/{status.handler-CW-EFhy3.mjs → status.handler-Ch_DtyBp.mjs} +4 -11
  65. package/dist/{switch.handler-BFGvj5c6.mjs → switch.handler-B3QBoSSl.mjs} +2 -2
  66. package/dist/{sync-CZ3iUPTA.mjs → sync-BlmgsC2W.mjs} +2 -2
  67. package/dist/{sync.handler-B1L8I9lF.mjs → sync.handler-xVxeG-S0.mjs} +4 -4
  68. package/dist/{task-target-build-CTgl4L42.mjs → task-target-build-CrPLSXnu.mjs} +1 -1
  69. package/dist/task-target-deploy-runner.mjs +4 -4
  70. package/dist/{test-Byq4hG3C.mjs → test-cuU0rf9C.mjs} +2 -2
  71. package/dist/{test.handler-BsrMMj5O.mjs → test.handler-B_C-T_IM.mjs} +4 -4
  72. package/dist/{test.handler-CAsVgOpT.mjs → test.handler-CLqnDqY6.mjs} +1 -1
  73. package/dist/{tool.handler-BHS5Z4J_.mjs → tool.handler-CmpzYYiC.mjs} +6 -6
  74. package/dist/{upgrade-bZVjVXnu.mjs → upgrade-B6Prb1K-.mjs} +1 -1
  75. package/dist/{upload.handler-DXVx2u3A.mjs → upload.handler-81mbKHTY.mjs} +4 -4
  76. package/dist/{users.get.handler-DqD2ELK2.mjs → users.get.handler-DoajzImx.mjs} +1 -1
  77. package/dist/{users.list.handler-DZSPvpGF.mjs → users.list.handler-CRk2J8mi.mjs} +1 -1
  78. package/dist/{users.set-role.handler-73smNUVF.mjs → users.set-role.handler-CHYjbx5M.mjs} +1 -1
  79. package/dist/{validate.handler-CmfcMX0t.mjs → validate.handler-CWG5HyO3.mjs} +3 -3
  80. package/dist/{workflow-build-Bi1Aacc5.mjs → workflow-build-CVG4DSCw.mjs} +1 -1
  81. package/dist/{workflows-C_C13Zr0.mjs → workflows-eztTnue4.mjs} +12 -12
  82. package/package.json +8 -8
  83. package/dist/dist-DuJjDZIf.mjs +0 -1094
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { a as ui } from "./keystroke.mjs";
4
4
  import { i as writeJson } from "./output-BWcVRt-T.mjs";
5
- import { i as requireClient } from "./context-B2cQ-Nt3.mjs";
5
+ import { i as requireClient } from "./context-DHOTSgPb.mjs";
6
6
  import { n as isIamJsonMode, t as handleIamError } from "./iam-command-utils-CSZj4XlH.mjs";
7
7
  //#region src/commands/invites/accept.handler.ts
8
8
  async function handleInvitesAccept(options, ctx) {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-BWcVRt-T.mjs";
4
- import { t as createTypedCommand } from "./commander-9Kro0Dl3.mjs";
4
+ import { t as createTypedCommand } from "./commander-BTMzBiLq.mjs";
5
5
  import { t as OrgRoleSchema } from "./schema-Lbp5lGJu.mjs";
6
6
  import { z } from "zod";
7
7
  //#region src/commands/admin/orgs.command.ts
@@ -28,21 +28,21 @@ function createAdminOrgsCommand() {
28
28
  description: "Manage organizations as a platform admin",
29
29
  schema: AdminOrgsListOptionsSchema,
30
30
  optionsConfig: { ...JSON_OPTION_CONFIG },
31
- loadHandler: async () => (await import("./orgs.list.handler-DDVvSbsT.mjs")).handleAdminOrgsList,
31
+ loadHandler: async () => (await import("./orgs.list.handler-ZRdb-yu5.mjs")).handleAdminOrgsList,
32
32
  subcommands: [
33
33
  createTypedCommand({
34
34
  name: "create",
35
35
  description: "Create an organization (requires system.create_org)",
36
36
  schema: AdminOrgsCreateOptionsSchema,
37
37
  optionsConfig: CREATE_OPTIONS_CONFIG,
38
- loadHandler: async () => (await import("./orgs.create.handler-DF4eEL-2.mjs")).handleAdminOrgsCreate
38
+ loadHandler: async () => (await import("./orgs.create.handler-B_7WjV3s.mjs")).handleAdminOrgsCreate
39
39
  }),
40
40
  createTypedCommand({
41
41
  name: "list",
42
42
  description: "List organizations (requires system.view_orgs)",
43
43
  schema: AdminOrgsListOptionsSchema,
44
44
  optionsConfig: { ...JSON_OPTION_CONFIG },
45
- loadHandler: async () => (await import("./orgs.list.handler-DDVvSbsT.mjs")).handleAdminOrgsList
45
+ loadHandler: async () => (await import("./orgs.list.handler-ZRdb-yu5.mjs")).handleAdminOrgsList
46
46
  }),
47
47
  createTypedCommand({
48
48
  name: "get",
@@ -54,7 +54,7 @@ function createAdminOrgsCommand() {
54
54
  description: "Organization ID",
55
55
  key: "orgId"
56
56
  },
57
- loadHandler: async () => (await import("./orgs.get.handler-BmJnseQa.mjs")).handleAdminOrgsGet
57
+ loadHandler: async () => (await import("./orgs.get.handler-BgjeDmfl.mjs")).handleAdminOrgsGet
58
58
  })
59
59
  ]
60
60
  });
@@ -157,14 +157,14 @@ function createAdminUsersCommand() {
157
157
  description: "Manage platform users",
158
158
  schema: AdminUsersListOptionsSchema,
159
159
  optionsConfig: { ...JSON_OPTION_CONFIG },
160
- loadHandler: async () => (await import("./users.list.handler-DZSPvpGF.mjs")).handleAdminUsersList,
160
+ loadHandler: async () => (await import("./users.list.handler-CRk2J8mi.mjs")).handleAdminUsersList,
161
161
  subcommands: [
162
162
  createTypedCommand({
163
163
  name: "list",
164
164
  description: "List platform users",
165
165
  schema: AdminUsersListOptionsSchema,
166
166
  optionsConfig: { ...JSON_OPTION_CONFIG },
167
- loadHandler: async () => (await import("./users.list.handler-DZSPvpGF.mjs")).handleAdminUsersList
167
+ loadHandler: async () => (await import("./users.list.handler-CRk2J8mi.mjs")).handleAdminUsersList
168
168
  }),
169
169
  createTypedCommand({
170
170
  name: "get",
@@ -176,7 +176,7 @@ function createAdminUsersCommand() {
176
176
  description: "User ID",
177
177
  key: "userId"
178
178
  },
179
- loadHandler: async () => (await import("./users.get.handler-DqD2ELK2.mjs")).handleAdminUsersGet
179
+ loadHandler: async () => (await import("./users.get.handler-DoajzImx.mjs")).handleAdminUsersGet
180
180
  }),
181
181
  createTypedCommand({
182
182
  name: "set-role",
@@ -188,7 +188,7 @@ function createAdminUsersCommand() {
188
188
  description: "User ID",
189
189
  key: "userId"
190
190
  },
191
- loadHandler: async () => (await import("./users.set-role.handler-73smNUVF.mjs")).handleAdminUsersSetRole
191
+ loadHandler: async () => (await import("./users.set-role.handler-CHYjbx5M.mjs")).handleAdminUsersSetRole
192
192
  })
193
193
  ]
194
194
  });
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { a as ui, j as throwReportedCliExit, n as style, t as ANSI, y as toErrorMessage } from "./keystroke.mjs";
4
- import { i as projects } from "./dist-DuJjDZIf.mjs";
4
+ import { i as projects } from "./dist-D_KgdxW5.mjs";
5
5
  import { i as writeJson, n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-BWcVRt-T.mjs";
6
- import { t as createTypedCommand } from "./commander-9Kro0Dl3.mjs";
6
+ import { t as createTypedCommand } from "./commander-BTMzBiLq.mjs";
7
7
  import { i as readAgentManifestsFromOutDir } from "./dist-Br4m3sFZ.mjs";
8
- import { t as requireWorkflowsDir } from "./resolve-project-Cj3MFnU0.mjs";
8
+ import { t as requireWorkflowsDir } from "./resolve-project-DJJZIOmu.mjs";
9
9
  import { t as createSpinnerProgress } from "./spinner-progress-BtEIJRX4.mjs";
10
- import { a as runWorkflowBuild, n as renderBuildFailure } from "./workflow-build-Bi1Aacc5.mjs";
10
+ import { a as runWorkflowBuild, n as renderBuildFailure } from "./workflow-build-CVG4DSCw.mjs";
11
11
  import { i as resolveTypeHint } from "./schema-display-XrRCdFL0.mjs";
12
12
  import { z } from "zod";
13
13
  //#region src/commands/agents/inspect-display.ts
@@ -29,7 +29,33 @@ const InitiateConnectionRequestSchema = z.object({
29
29
  * tenant-specific authorize URL.
30
30
  */
31
31
  input: z.record(z.string(), z.unknown()).optional(),
32
- requestedScopes: z.array(z.string()).optional()
32
+ requestedScopes: z.array(z.string()).optional(),
33
+ /**
34
+ * Scope target for the resulting credential set. Optional — the
35
+ * server resolves the default at request time: an explicit value
36
+ * wins; absent that, the presence of `projectId` selects
37
+ * `project`, and otherwise the request defaults to
38
+ * `organization`. User scope must always be explicit.
39
+ */
40
+ scope: CredentialScopeSchema.optional(),
41
+ /**
42
+ * Required when `scope === 'project'` (whether explicit or
43
+ * resolved). Must not be present for the other scopes.
44
+ */
45
+ projectId: z.uuid().optional(),
46
+ /**
47
+ * Optional caller-supplied display name for the resulting
48
+ * connection. Falls back to the integration's display name on
49
+ * persist; collisions at the same scope target are auto-suffixed
50
+ * server-side.
51
+ */
52
+ name: z.string().min(1).max(255).optional()
53
+ }).refine((data) => !(data.scope === "project" && !data.projectId), {
54
+ message: "projectId is required when scope is 'project'",
55
+ path: ["projectId"]
56
+ }).refine((data) => !(data.projectId && data.scope && data.scope !== "project"), {
57
+ message: "projectId must not be supplied when scope is not 'project'",
58
+ path: ["projectId"]
33
59
  });
34
60
  const InitiateConnectionResponseSchema = z.object({
35
61
  authUrl: z.string(),
@@ -56,8 +82,8 @@ const ConnectionStatusFailedSchema = z.object({
56
82
  /**
57
83
  * Optional human-readable detail. Truncated by the server to
58
84
  * {@link CONNECTION_FAILURE_DETAIL_MAX_CHARS} characters before being
59
- * persisted in `credential_sets.last_callback_error_detail` and
60
- * before being echoed in the callback redirect query.
85
+ * persisted in `connection_flows.error_detail` and before being
86
+ * echoed in the callback redirect query.
61
87
  */
62
88
  message: z.string().max(300).optional(),
63
89
  /** ISO-8601 timestamp of when the failure was recorded. */
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-BWcVRt-T.mjs";
4
- import { t as createTypedCommand } from "./commander-9Kro0Dl3.mjs";
4
+ import { t as createTypedCommand } from "./commander-BTMzBiLq.mjs";
5
5
  import { z } from "zod";
6
6
  //#region src/commands/api-keys/api-keys.command.ts
7
7
  const ApiKeysCreateOptionsSchema = JsonOptionSchema.extend({ name: z.string().optional() });
@@ -23,21 +23,21 @@ function createApiKeysCommand() {
23
23
  description: "Manage API keys for your organization",
24
24
  schema: JsonOptionSchema,
25
25
  optionsConfig: { ...JSON_OPTION_CONFIG },
26
- loadHandler: async () => (await import("./list.handler-Do2tVOnu.mjs")).handleApiKeysList,
26
+ loadHandler: async () => (await import("./list.handler-DrY5bgm1.mjs")).handleApiKeysList,
27
27
  subcommands: [
28
28
  createTypedCommand({
29
29
  name: "list",
30
30
  description: "List all API keys for your organization",
31
31
  schema: JsonOptionSchema,
32
32
  optionsConfig: { ...JSON_OPTION_CONFIG },
33
- loadHandler: async () => (await import("./list.handler-Do2tVOnu.mjs")).handleApiKeysList
33
+ loadHandler: async () => (await import("./list.handler-DrY5bgm1.mjs")).handleApiKeysList
34
34
  }),
35
35
  createTypedCommand({
36
36
  name: "create",
37
37
  description: "Create a new API key (raw key shown once)",
38
38
  schema: ApiKeysCreateOptionsSchema,
39
39
  optionsConfig: CREATE_OPTIONS_CONFIG,
40
- loadHandler: async () => (await import("./create.handler-v9B0Z9Yf.mjs")).handleApiKeysCreate
40
+ loadHandler: async () => (await import("./create.handler-BuxP18uj.mjs")).handleApiKeysCreate
41
41
  }),
42
42
  createTypedCommand({
43
43
  name: "delete",
@@ -49,7 +49,7 @@ function createApiKeysCommand() {
49
49
  description: "API key ID to delete",
50
50
  key: "apiKeyId"
51
51
  },
52
- loadHandler: async () => (await import("./delete.handler-DtP_zUaq.mjs")).handleApiKeysDelete
52
+ loadHandler: async () => (await import("./delete.handler-CpYOMtsv.mjs")).handleApiKeysDelete
53
53
  })
54
54
  ]
55
55
  });
@@ -2,24 +2,19 @@
2
2
 
3
3
  import { n as DEFAULT_CLI_WEB_URL } from "./default-urls-BoSm4s9C.mjs";
4
4
  import { b as AUTH_TIMEOUT_SECONDS } from "./keystroke.mjs";
5
- import { t as createTypedCommand } from "./commander-9Kro0Dl3.mjs";
5
+ import { t as createTypedCommand } from "./commander-BTMzBiLq.mjs";
6
6
  import { z } from "zod";
7
7
  //#region src/commands/auth/auth.command.ts
8
8
  const AuthOptionsSchema = z.object({
9
9
  webUrl: z.url().optional().describe("Keystroke web URL"),
10
- insecureStorage: z.boolean().default(false).describe("Store API keys in plaintext file storage instead of the OS credential store"),
11
10
  timeout: z.coerce.number().int().min(AUTH_TIMEOUT_SECONDS.min).max(AUTH_TIMEOUT_SECONDS.max).default(AUTH_TIMEOUT_SECONDS.default).describe("Timeout in seconds")
12
11
  });
13
- const AuthClearOptionsSchema = z.object({ localOnly: z.boolean().default(false).describe("Remove local credentials without reading the OS credential store for server revocation") });
12
+ const AuthClearOptionsSchema = z.object({ localOnly: z.boolean().default(false).describe("Remove local credentials without reading the saved API key for server revocation") });
14
13
  const AUTH_OPTIONS_CONFIG = {
15
14
  webUrl: {
16
15
  flag: "--web-url <url>",
17
16
  description: `Keystroke web URL (default: saved credentials, WEB_URL env, or ${DEFAULT_CLI_WEB_URL})`
18
17
  },
19
- insecureStorage: {
20
- flag: "--insecure-storage",
21
- description: "Store the API key in plaintext file storage instead of the OS credential store"
22
- },
23
18
  timeout: {
24
19
  flag: "--timeout <seconds>",
25
20
  description: `Authentication timeout in seconds (default: ${AUTH_TIMEOUT_SECONDS.default})`
@@ -36,7 +31,7 @@ function createAuthCommand() {
36
31
  schema: AuthOptionsSchema,
37
32
  optionsConfig: AUTH_OPTIONS_CONFIG,
38
33
  contextMode: "auth-metadata",
39
- loadHandler: async () => (await import("./auth.handler-BedGpKh1.mjs")).handleAuth,
34
+ loadHandler: async () => (await import("./auth.handler-Dq2fXO3S.mjs")).handleAuth,
40
35
  subcommands: [
41
36
  createTypedCommand({
42
37
  name: "clear",
@@ -44,21 +39,21 @@ function createAuthCommand() {
44
39
  schema: AuthClearOptionsSchema,
45
40
  optionsConfig: AUTH_CLEAR_OPTIONS_CONFIG,
46
41
  contextMode: "auth-metadata",
47
- loadHandler: async () => (await import("./clear.handler-Cvb9chs4.mjs")).handleAuthClear
42
+ loadHandler: async () => (await import("./clear.handler-FzohTmpU.mjs")).handleAuthClear
48
43
  }),
49
44
  createTypedCommand({
50
45
  name: "test",
51
46
  description: "Verify that the saved API key is valid",
52
47
  schema: z.object({}),
53
48
  optionsConfig: {},
54
- loadHandler: async () => (await import("./test.handler-CAsVgOpT.mjs")).handleAuthTest
49
+ loadHandler: async () => (await import("./test.handler-CLqnDqY6.mjs")).handleAuthTest
55
50
  }),
56
51
  createTypedCommand({
57
52
  name: "status",
58
53
  description: "Show the current signed-in identity and organization context",
59
54
  schema: z.object({}),
60
55
  optionsConfig: {},
61
- loadHandler: async () => (await import("./status.handler-CW-EFhy3.mjs")).handleAuthStatus
56
+ loadHandler: async () => (await import("./status.handler-Ch_DtyBp.mjs")).handleAuthStatus
62
57
  })
63
58
  ]
64
59
  });
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { n as DEFAULT_CLI_WEB_URL, t as DEFAULT_CLI_SERVER_URL } from "./default-urls-BoSm4s9C.mjs";
4
4
  import { C as CALLBACK_LOOPBACK_ORIGIN, D as CliExitError, P as logger, S as CALLBACK_LOOPBACK_HOST, T as CLI_AUTH_COMMAND, a as ui, d as resolveCliWebUrl, u as resolveCliServerUrl, w as CALLBACK_PATH, x as AUTH_URL_PATH, y as toErrorMessage } from "./keystroke.mjs";
5
- import { n as credentials } from "./dist-DuJjDZIf.mjs";
5
+ import { n as credentials } from "./dist-D_KgdxW5.mjs";
6
6
  import { t as openBrowser } from "./browser-Dvv5OQrt.mjs";
7
7
  import { hostname } from "node:os";
8
8
  import { z } from "zod";
@@ -283,7 +283,7 @@ function printResolvedHosts(hosts) {
283
283
  async function confirmLoopbackHostsOrExit(hosts) {
284
284
  ui.br();
285
285
  ui.warn("About to authenticate against a local development environment");
286
- if (hosts.webMatchesSaved || hosts.serverMatchesSaved) ui.hint(`Saved at: ${credentials.metadataFilePath} (from a previous keystroke auth run)`);
286
+ if (hosts.webMatchesSaved || hosts.serverMatchesSaved) ui.hint(`Saved at: ${credentials.credentialsFilePath} (from a previous keystroke auth run)`);
287
287
  else ui.hint("Resolved from your environment (WEB_URL / SERVER_URL).");
288
288
  ui.hint(`CLI default is ${DEFAULT_CLI_WEB_URL} / ${DEFAULT_CLI_SERVER_URL}.`);
289
289
  ui.hint("To switch hosts:");
@@ -326,26 +326,7 @@ function printAuthSuccess(params) {
326
326
  ui.success("Authentication successful.");
327
327
  if (params.email) ui.hint(`Connected as: ${params.email}`);
328
328
  if (params.organizationName) ui.hint(`Organization: ${params.organizationName}`);
329
- ui.hint(`Credentials metadata saved to ${credentials.metadataFilePath}`);
330
- if (params.insecureStorage) {
331
- ui.warn(`API key saved to plaintext file storage at ${credentials.secretsFilePath}`);
332
- return;
333
- }
334
- ui.hint("Secret saved to OS credential store.");
335
- }
336
- function isCredentialStoreError(message) {
337
- const normalized = message.toLowerCase();
338
- return normalized.includes("credential store") || normalized.includes("keychain");
339
- }
340
- function exitCredentialStoreSaveFailed(error) {
341
- const message = toErrorMessage(error);
342
- ui.error("Could not save the API key to the OS credential store.");
343
- ui.hint("Unlock your keychain or credential store, then rerun `keystroke auth`.");
344
- ui.hint("For intentional plaintext file storage, rerun `keystroke auth --insecure-storage`.");
345
- throw new CliExitError(message, {
346
- cause: error,
347
- reported: true
348
- });
329
+ ui.hint(`Credentials saved to ${credentials.credentialsFilePath}`);
349
330
  }
350
331
  function warnIfSavedCredentialsExist(ctx) {
351
332
  if (ctx.storedOrgs.length === 0) return;
@@ -361,10 +342,6 @@ async function handleAuth(options, ctx, overrides) {
361
342
  warnIfSavedCredentialsExist(ctx);
362
343
  const hosts = resolveAuthHosts(options, ctx);
363
344
  printResolvedHosts(hosts);
364
- if (options.insecureStorage) {
365
- ui.warn("Using insecure plaintext file storage for this API key.");
366
- ui.hint("For CI/headless usage, prefer KEYSTROKE_API_KEY.");
367
- }
368
345
  if (shouldConfirmLoopback(hosts)) await confirmLoopbackHostsOrExit(hosts);
369
346
  const { webUrl, serverUrl } = hosts;
370
347
  const timeoutMs = options.timeout * 1e3;
@@ -402,33 +379,25 @@ async function handleAuth(options, ctx, overrides) {
402
379
  email: callbackPayload.userEmail,
403
380
  name: callbackPayload.userName
404
381
  } : void 0;
405
- if (callbackPayload.organizationId) try {
406
- await credentials.upsertOrg({
407
- org: {
408
- organizationId: callbackPayload.organizationId,
409
- organizationName: callbackPayload.organizationName ?? "Unknown",
410
- apiKeyId: callbackPayload.apiKeyId,
411
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
412
- },
413
- apiKey: callbackPayload.apiKey,
414
- serverUrl: callbackPayload.serverUrl,
415
- webUrl,
416
- user,
417
- secretStorage: options.insecureStorage ? "file" : "keychain"
418
- });
419
- } catch (error) {
420
- const message = toErrorMessage(error);
421
- if (!options.insecureStorage && isCredentialStoreError(message)) exitCredentialStoreSaveFailed(error);
422
- throw error;
423
- }
382
+ if (callbackPayload.organizationId) await credentials.upsertOrg({
383
+ org: {
384
+ organizationId: callbackPayload.organizationId,
385
+ organizationName: callbackPayload.organizationName ?? "Unknown",
386
+ apiKeyId: callbackPayload.apiKeyId,
387
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
388
+ },
389
+ apiKey: callbackPayload.apiKey,
390
+ serverUrl: callbackPayload.serverUrl,
391
+ webUrl,
392
+ user
393
+ });
424
394
  logger.info("Auth successful", {
425
395
  email: callbackPayload.userEmail,
426
396
  organizationId: callbackPayload.organizationId
427
397
  });
428
398
  printAuthSuccess({
429
399
  email: callbackPayload.userEmail,
430
- organizationName: callbackPayload.organizationName,
431
- insecureStorage: options.insecureStorage
400
+ organizationName: callbackPayload.organizationName
432
401
  });
433
402
  } catch (error) {
434
403
  if (toErrorMessage(error).includes("Timed out waiting for device authentication")) ui.error(`Authentication timed out after ${options.timeout}s. Re-run ${CLI_AUTH_COMMAND} and complete the browser prompt before timeout.`);
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { D as CliExitError } from "./keystroke.mjs";
4
- import { i as projects } from "./dist-DuJjDZIf.mjs";
5
- import { t as requireWorkflowsDir } from "./resolve-project-Cj3MFnU0.mjs";
6
- import { a as runWorkflowBuild, i as renderBuildSummary, n as renderBuildFailure, r as renderBuildHeader } from "./workflow-build-Bi1Aacc5.mjs";
4
+ import { i as projects } from "./dist-D_KgdxW5.mjs";
5
+ import { t as requireWorkflowsDir } from "./resolve-project-DJJZIOmu.mjs";
6
+ import { a as runWorkflowBuild, i as renderBuildSummary, n as renderBuildFailure, r as renderBuildHeader } from "./workflow-build-CVG4DSCw.mjs";
7
7
  import { t as createBuildProgress } from "./build-progress-nYa14iBP.mjs";
8
8
  import { t as withErrorBoundary } from "./error-boundary-DVZipk-A.mjs";
9
9
  //#region src/commands/workflows/build.handler.ts
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { a as ui } from "./keystroke.mjs";
4
- import { i as projects } from "./dist-DuJjDZIf.mjs";
4
+ import { i as projects } from "./dist-D_KgdxW5.mjs";
5
5
  //#region src/commands/projects/clear-cache.handler.ts
6
6
  async function handleProjectsClearCache(_options, _ctx) {
7
7
  if (await projects.clear()) ui.success("Projects cache cleared.");
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { P as logger, a as ui, p as AUTH_HINT, y as toErrorMessage } from "./keystroke.mjs";
4
- import { n as credentials } from "./dist-DuJjDZIf.mjs";
4
+ import { n as credentials } from "./dist-D_KgdxW5.mjs";
5
5
  import { createClient } from "./src-DNhUmpSl.mjs";
6
6
  //#region src/commands/auth/clear.handler.ts
7
7
  async function tryRevokeKey(apiKey, apiKeyId, baseUrl, organizationId) {
@@ -45,10 +45,7 @@ async function handleAuthClear(options, ctx) {
45
45
  return;
46
46
  }
47
47
  let apiKey = null;
48
- if (!options.localOnly && serverUrl) {
49
- ui.hint("Your OS credential store may ask for permission to read the saved API key.");
50
- apiKey = await readApiKeyForRevocation(ctx.organizationId);
51
- }
48
+ if (!options.localOnly && serverUrl) apiKey = await readApiKeyForRevocation(ctx.organizationId);
52
49
  const removed = await credentials.removeOrg(ctx.organizationId);
53
50
  if (!removed) {
54
51
  ui.warn(`No stored credentials for organization ${ctx.organizationId}.`);
@@ -63,7 +60,6 @@ async function handleAuthClear(options, ctx) {
63
60
  if (options.localOnly) ui.hint("Skipped server revocation because --local-only was provided.");
64
61
  else {
65
62
  const revocableOrgs = storedOrgs.filter((org) => org.apiKeyId && serverUrl);
66
- if (revocableOrgs.length > 0) ui.hint("Your OS credential store may ask for permission to read saved API keys.");
67
63
  for (const org of revocableOrgs) if (org.apiKeyId && serverUrl) {
68
64
  const apiKey = await readApiKeyForRevocation(org.organizationId);
69
65
  if (apiKey) revokeInputs.push({
@@ -78,7 +78,7 @@ function createTypedCommand(params) {
78
78
  const globalOpts = cmd.optsWithGlobals();
79
79
  if (globalOpts.debug) setDebug(true);
80
80
  const contextMode = params.contextMode ?? "full";
81
- const contextModule = await import("./context-B2cQ-Nt3.mjs").then((n) => n.n);
81
+ const contextModule = await import("./context-DHOTSgPb.mjs").then((n) => n.n);
82
82
  const contextOptions = {
83
83
  apiKey: globalOpts.apiKey,
84
84
  serverUrl: globalOpts.serverUrl,
@@ -1,13 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-BWcVRt-T.mjs";
4
- import { t as createTypedCommand } from "./commander-9Kro0Dl3.mjs";
4
+ import { t as createTypedCommand } from "./commander-BTMzBiLq.mjs";
5
5
  import { z } from "zod";
6
6
  //#region src/commands/connect/connect.command.ts
7
7
  const ConnectOptionsSchema = JsonOptionSchema.extend({
8
8
  integrationId: z.string().optional(),
9
9
  connection: z.string().optional().describe("Credential connection path to use when an integration has multiple OAuth paths"),
10
10
  input: z.array(z.string()).optional().describe("Connection input as key=value. Repeat for multiple fields."),
11
+ scope: z.enum([
12
+ "organization",
13
+ "project",
14
+ "user"
15
+ ]).optional().describe("Connection scope (organization | project | user). Defaults to project when a project is detected, otherwise organization. Use 'user' for personal credentials."),
16
+ projectId: z.string().optional().describe("Project to scope the connection to. Auto-detected from keystroke.config.ts when run inside a project directory."),
17
+ path: z.string().optional().describe("Path to the project root (default: nearest keystroke.config.ts walking up from cwd)"),
18
+ name: z.string().optional().describe("Display name for the resulting connection. Defaults to the integration name; duplicates are auto-suffixed."),
11
19
  timeout: z.coerce.number().int().min(30).max(600).default(300).describe("Timeout in seconds (default: 5 minutes)"),
12
20
  noOpen: z.boolean().optional().describe("Print the authorization URL instead of opening a browser")
13
21
  });
@@ -21,6 +29,22 @@ const CONNECT_OPTIONS_CONFIG = {
21
29
  description: "Connection input as key=value. Repeat for multiple fields.",
22
30
  collect: true
23
31
  },
32
+ scope: {
33
+ flag: "--scope <organization|project|user>",
34
+ description: "Connection scope. Defaults to 'project' when a project is detected, otherwise 'organization'."
35
+ },
36
+ projectId: {
37
+ flag: "--project-id <uuid>",
38
+ description: "Project to scope the connection to. Required when --scope project is used outside a project directory."
39
+ },
40
+ path: {
41
+ flag: "--path <dir>",
42
+ description: "Path to the project root (default: walk up from cwd looking for keystroke.config.ts)"
43
+ },
44
+ name: {
45
+ flag: "--name <name>",
46
+ description: "Display name for the resulting connection."
47
+ },
24
48
  timeout: {
25
49
  flag: "--timeout <seconds>",
26
50
  description: "Timeout in seconds (default: 300)"
@@ -37,7 +61,7 @@ function createConnectCommand() {
37
61
  description: "Connect an official integration via OAuth (e.g., keystroke connect slack)",
38
62
  schema: ConnectOptionsSchema,
39
63
  optionsConfig: CONNECT_OPTIONS_CONFIG,
40
- loadHandler: async () => (await import("./connect.handler-DFQdxkWZ.mjs")).handleConnect,
64
+ loadHandler: async () => (await import("./connect.handler-D7oO_5WS.mjs")).handleConnect,
41
65
  argument: {
42
66
  name: "integrationId",
43
67
  description: "Integration to connect (e.g., slack, linear)",
@@ -1,10 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { a as ui, j as throwReportedCliExit, p as AUTH_HINT, v as isNetworkError, y as toErrorMessage } from "./keystroke.mjs";
4
+ import { t as assertWorkflowProjectRoot } from "./project-config-DudGRFPO.mjs";
4
5
  import { i as writeJson } from "./output-BWcVRt-T.mjs";
6
+ import { n as resolveWorkflowsDir } from "./resolve-project-DJJZIOmu.mjs";
5
7
  import { t as openBrowser } from "./browser-Dvv5OQrt.mjs";
6
- import { i as InitiateConnectionResponseSchema, n as ConnectionStatusResponseSchema, r as InitiateConnectionRequestSchema } from "./api-J9UL8pqZ.mjs";
7
- import { t as getIntegrationCatalog } from "./integration-catalog-cYlTmOSb.mjs";
8
+ import { i as InitiateConnectionResponseSchema, n as ConnectionStatusResponseSchema, r as InitiateConnectionRequestSchema } from "./api-O5tdGdzc.mjs";
9
+ import { t as getIntegrationCatalog } from "./integration-catalog-Cub_7xCw.mjs";
8
10
  //#region src/commands/connect/connect.handler.ts
9
11
  function formatIntegrationLabel(catalog, integrationId) {
10
12
  return catalog.lookupByPublicId(integrationId)?.name ?? integrationId;
@@ -75,6 +77,29 @@ function exitWithError(ctx, message, opts) {
75
77
  if (opts?.hint) ui.hint(opts.hint);
76
78
  throwReportedCliExit(message);
77
79
  }
80
+ /**
81
+ * Resolve the project id for this connect attempt.
82
+ *
83
+ * Precedence:
84
+ * 1. Explicit `--project-id <uuid>` flag.
85
+ * 2. `keystroke.config.ts` discovered from `--path` or by walking up
86
+ * from cwd. Best-effort — silently returns `null` when nothing is
87
+ * found.
88
+ *
89
+ * Caller decides whether `null` is fatal: with `--scope project` it's
90
+ * a usage error; with the default resolution it falls back to
91
+ * organization scope.
92
+ */
93
+ async function resolveConnectProjectId(options) {
94
+ if (options.projectId) return options.projectId;
95
+ const workflowsDir = await resolveWorkflowsDir(options.path);
96
+ if (!workflowsDir) return null;
97
+ try {
98
+ return (await assertWorkflowProjectRoot(workflowsDir)).projectId;
99
+ } catch {
100
+ return null;
101
+ }
102
+ }
78
103
  function parseConnectionInput(rawInputs, ctx) {
79
104
  const input = {};
80
105
  for (const rawInput of rawInputs) {
@@ -127,12 +152,22 @@ async function handleConnect(options, ctx) {
127
152
  if (oauthConnection && ((catalogEntry?.connections.length ?? 0) > 1 || options.connection)) ui.text(`Connection: ${formatConnectionLabel(oauthConnection)} (id: ${oauthConnection.id}${formatConnectionFlags(oauthConnection)})`);
128
153
  ui.br();
129
154
  }
155
+ const resolvedProjectId = await resolveConnectProjectId(options);
156
+ if (options.scope === "project" && !resolvedProjectId) exitWithError(ctx, "--scope project requires a project context. Pass --project-id <uuid>, --path <dir>, or run inside a project directory.", {
157
+ code: "USAGE_ERROR",
158
+ hint: "Use `keystroke init` to create a project, or pick a different scope."
159
+ });
160
+ const scopeForRequest = options.scope;
161
+ const projectIdForRequest = scopeForRequest === "user" || scopeForRequest === "organization" ? void 0 : resolvedProjectId ?? void 0;
130
162
  let authUrl;
131
163
  let initiatedAt;
132
164
  try {
133
165
  const requestBody = InitiateConnectionRequestSchema.parse({
134
166
  ...oauthConnection ? { credentialConnectionId: oauthConnection.id } : {},
135
- ...Object.keys(connectionInput).length > 0 ? { input: connectionInput } : {}
167
+ ...Object.keys(connectionInput).length > 0 ? { input: connectionInput } : {},
168
+ ...scopeForRequest ? { scope: scopeForRequest } : {},
169
+ ...projectIdForRequest ? { projectId: projectIdForRequest } : {},
170
+ ...options.name ? { name: options.name } : {}
136
171
  });
137
172
  const hasRequestBody = Object.keys(requestBody).length > 0;
138
173
  const response = await fetch(`${baseUrl}/api/v1/connections/${integrationId}/initiate`, {
@@ -2,8 +2,8 @@
2
2
 
3
3
  import { n as __exportAll } from "./chunk-CH6r78ws.mjs";
4
4
  import { D as CliExitError, E as AuthenticationError, P as logger, _ as isAuthError, a as ui, c as getProcessEnv, m as REAUTH_HINT, p as AUTH_HINT, s as getEnv, y as toErrorMessage } from "./keystroke.mjs";
5
- import { n as credentials } from "./dist-DuJjDZIf.mjs";
6
- import { t as resolveCliCredentials } from "./resolve-cli-credentials-DaMDaamj.mjs";
5
+ import { n as credentials } from "./dist-D_KgdxW5.mjs";
6
+ import { t as resolveCliCredentials } from "./resolve-cli-credentials-B4crOe_y.mjs";
7
7
  import { a as writeJsonError } from "./output-BWcVRt-T.mjs";
8
8
  //#region src/lib/context.ts
9
9
  var context_exports = /* @__PURE__ */ __exportAll({
@@ -110,7 +110,7 @@ async function resolveAuthContext(overrides = {}) {
110
110
  storedServerUrls,
111
111
  credentialStorageInfo,
112
112
  credentialReadError: auth.readErrorMessage,
113
- metadataFilePath: auth.metadataFilePath
113
+ credentialsFilePath: auth.credentialsFilePath
114
114
  };
115
115
  }
116
116
  async function resolveAuthMetadataContext(overrides = {}) {
@@ -135,19 +135,14 @@ async function resolveAuthMetadataContext(overrides = {}) {
135
135
  storedServerUrls,
136
136
  credentialStorageInfo,
137
137
  credentialReadError: void 0,
138
- metadataFilePath: credentials.metadataFilePath
138
+ credentialsFilePath: credentials.credentialsFilePath
139
139
  };
140
140
  }
141
141
  async function resolveCredentialStorageInfo() {
142
142
  try {
143
143
  return await credentials.getStorageInfo();
144
144
  } catch {
145
- return {
146
- metadataFilePath: credentials.metadataFilePath,
147
- legacySecretsFilePath: credentials.secretsFilePath,
148
- secretStorageKind: "file",
149
- insecureFileStorage: true
150
- };
145
+ return { credentialsFilePath: credentials.credentialsFilePath };
151
146
  }
152
147
  }
153
148
  /**
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { a as ui, j as throwReportedCliExit, y as toErrorMessage } from "./keystroke.mjs";
4
4
  import { i as writeJson } from "./output-BWcVRt-T.mjs";
5
- import { i as requireClient } from "./context-B2cQ-Nt3.mjs";
5
+ import { i as requireClient } from "./context-DHOTSgPb.mjs";
6
6
  //#region src/commands/api-keys/create.handler.ts
7
7
  async function handleApiKeysCreate(options, ctx) {
8
8
  const client = requireClient(ctx);
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { r as getKeystrokeProjectPath } from "./paths-JzzFkXQA-CEipIeVl.mjs";
4
- import "./dist-DuJjDZIf.mjs";
4
+ import "./dist-D_KgdxW5.mjs";
5
5
  import * as fs from "node:fs/promises";
6
6
  import { z } from "zod";
7
7
  //#region src/lib/credential-env-map.ts