@keystrokehq/cli 0.0.1

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 (122) hide show
  1. package/AGENTS-blurb.md +123 -0
  2. package/LICENSE +42 -0
  3. package/README.md +177 -0
  4. package/THIRD_PARTY_NOTICES.md +16 -0
  5. package/bin/keystroke.mjs +107 -0
  6. package/dist/_manifest-JSRE3H8k.mjs +385 -0
  7. package/dist/agent-bundle-package-DWV6B_5q-BtV7Xycc.mjs +2344 -0
  8. package/dist/agent-manifest-CDnbkR2f.mjs +245 -0
  9. package/dist/agents-CZJGxVqV.mjs +228 -0
  10. package/dist/api-keys-D2lgguuY.mjs +40 -0
  11. package/dist/auth-DN2VusyU.mjs +59 -0
  12. package/dist/auth.handler-CT1BQUvu.mjs +340 -0
  13. package/dist/browser-qwFrUH82.mjs +24 -0
  14. package/dist/build-agents-BmM_AsSd-BGi9wtzt.mjs +514 -0
  15. package/dist/build-metadata-BWS7uhd_-DR8gJjTX.mjs +1422 -0
  16. package/dist/build-progress-DgYKb4hB.mjs +183 -0
  17. package/dist/build-tasks-CdihpudT-D5r5HUHe.mjs +91 -0
  18. package/dist/build-workflows-CfxBnIWh-CdYPv8w2.mjs +370 -0
  19. package/dist/build.handler-4799CjWH.mjs +36 -0
  20. package/dist/chunk-CH6r78ws.mjs +37 -0
  21. package/dist/clear-cache.handler-B9tqSoSM.mjs +11 -0
  22. package/dist/clear.handler-BTIXXPTJ.mjs +42 -0
  23. package/dist/clear.handler-BydlX-zE.mjs +11 -0
  24. package/dist/commander-DfTVqQ-3.mjs +133 -0
  25. package/dist/concurrency-gXn9Rw8x-DNl2YtrS.mjs +20 -0
  26. package/dist/connect-BUXkeH0F.mjs +43 -0
  27. package/dist/connect.handler-CYel9cy6.mjs +430 -0
  28. package/dist/constants-CPpPdSNg.mjs +8 -0
  29. package/dist/context-T7HZuB97.mjs +138 -0
  30. package/dist/credential-env-map-CI8yWHVy.mjs +28 -0
  31. package/dist/credential-schema-mismatch-BKo5PjcQ.mjs +76 -0
  32. package/dist/credentials-CvmjU0lK.mjs +171 -0
  33. package/dist/credentials-OfVHOtG3.mjs +151216 -0
  34. package/dist/current-deployment-workflow-poHt27i3.mjs +94 -0
  35. package/dist/current.handler-B8zKzfPp.mjs +21 -0
  36. package/dist/delete.handler-bAu1iXVQ.mjs +17 -0
  37. package/dist/deploy-7Jjls436.mjs +26 -0
  38. package/dist/deploy-BOPIpRWm.mjs +74 -0
  39. package/dist/deploy-progress-BmGUNFKg.mjs +70 -0
  40. package/dist/deploy.handler-BAzgiNhd.mjs +370 -0
  41. package/dist/detect-env-access-CwkOYeYM-D_BCZqV6.mjs +209 -0
  42. package/dist/diff-utils-NEfcjqxt.mjs +185 -0
  43. package/dist/diff.handler-Du7SY8K4.mjs +47 -0
  44. package/dist/dist-BkJUoBiG.mjs +1116 -0
  45. package/dist/dist-CUK7yBM0.mjs +308 -0
  46. package/dist/env-91KwMKov.mjs +140 -0
  47. package/dist/env.handler-BAzBuMzQ.mjs +277 -0
  48. package/dist/error-boundary-VL-JLfIa.mjs +34 -0
  49. package/dist/file-metadata-D1vm-XY2.mjs +191 -0
  50. package/dist/get-intrinsic-zLxwtrLK.mjs +658 -0
  51. package/dist/import-module-CV84H5fZ-B_CBCmb4.mjs +1747 -0
  52. package/dist/init-DpMCotSK.mjs +45 -0
  53. package/dist/init.handler-CPRnif52.mjs +585 -0
  54. package/dist/inspect.handler-DT_cD036.mjs +146 -0
  55. package/dist/integration-catalog-Bt-L3GjF.mjs +104 -0
  56. package/dist/integrations-DlatPK4W.mjs +79 -0
  57. package/dist/keystroke.d.mts +3 -0
  58. package/dist/keystroke.mjs +707 -0
  59. package/dist/layout-CbMtQ2tm.mjs +67 -0
  60. package/dist/list-enrichment-y-cwizLr.mjs +189 -0
  61. package/dist/list.handler-BTWvCyjA.mjs +52 -0
  62. package/dist/list.handler-CWF_Dj15.mjs +24 -0
  63. package/dist/list.handler-CZ6G2x_G.mjs +75 -0
  64. package/dist/list.handler-DWaQkJaR.mjs +51 -0
  65. package/dist/list.handler-DqbFcBW7.mjs +180 -0
  66. package/dist/list.handler-lq3ZGAn4.mjs +104 -0
  67. package/dist/logs-BEg9L5l8.mjs +28 -0
  68. package/dist/logs.handler-6hoMBzqw.mjs +35 -0
  69. package/dist/logs.handler-BD_dXiL1.mjs +231 -0
  70. package/dist/metadata-layout-GUYIUo0i-_aG2zjue.mjs +5877 -0
  71. package/dist/normalize-path-CojS-CgQ-DLCOvnD1.mjs +20 -0
  72. package/dist/options-CeaTcFxP.mjs +43 -0
  73. package/dist/org-xLzBtt2_.mjs +41 -0
  74. package/dist/output-DM4b7KgY.mjs +72 -0
  75. package/dist/oxc-B3KI3rf_-n9d1hKNq.mjs +119 -0
  76. package/dist/paused.handler-BMFm9Cff.mjs +94 -0
  77. package/dist/project-config-D1qsQlO7.mjs +107 -0
  78. package/dist/projects-CHkRE9rS.mjs +1574 -0
  79. package/dist/projects-Cjb7sovS.mjs +30 -0
  80. package/dist/read-credential-keys-77a91T8M-KA0Iw0Z1.mjs +9 -0
  81. package/dist/register.handler-BPCdor1_.mjs +86 -0
  82. package/dist/requirements.handler-DPXdSks3.mjs +201 -0
  83. package/dist/resolve-project-DDJ29sCF.mjs +35 -0
  84. package/dist/rolldown-runtime-twds-ZHy-BWWzu8VG.mjs +15 -0
  85. package/dist/run-polling-CAgFRdK3.mjs +20 -0
  86. package/dist/runs-D9hNLb9A.mjs +259 -0
  87. package/dist/schedule-BXx3uXwr.mjs +1142 -0
  88. package/dist/schema-17qMfNyI.mjs +18 -0
  89. package/dist/schema-display-CgmeKigW.mjs +130 -0
  90. package/dist/schemas-CDib1RhE.mjs +125 -0
  91. package/dist/skills-sync.handler-DIy8GR16.mjs +34 -0
  92. package/dist/skills.command-CrjI2dN9.mjs +35 -0
  93. package/dist/skills.handler-Bz8bJKql.mjs +9 -0
  94. package/dist/source-analysis-Cj-ADyu--BJQcFPCG.mjs +144 -0
  95. package/dist/spinner-progress-DMVwgqO9.mjs +173 -0
  96. package/dist/src-C0X6u_Mw.mjs +1340 -0
  97. package/dist/src-eHwu-Gfw.mjs +369 -0
  98. package/dist/status.handler-BO4nwvWn.mjs +101 -0
  99. package/dist/switch.handler-D_9213Vf.mjs +51 -0
  100. package/dist/sync-BL_Mo5st.mjs +39 -0
  101. package/dist/sync-keystroke-agent-skills-Kx_H7UTd.mjs +70 -0
  102. package/dist/sync.handler-BUFPdzWz.mjs +82 -0
  103. package/dist/task-B2sZMaZu.mjs +8 -0
  104. package/dist/task-target-build-CBeCKbu2.mjs +432 -0
  105. package/dist/task-target-deploy-C5X-USeR.mjs +4 -0
  106. package/dist/task-target-deploy-CA6elFpF-BEr4gkol.mjs +271 -0
  107. package/dist/task-target-deploy-runner.d.mts +3 -0
  108. package/dist/task-target-deploy-runner.mjs +202 -0
  109. package/dist/test-BHTgR3UA.mjs +698 -0
  110. package/dist/test.handler-BcPQ8b74.mjs +13 -0
  111. package/dist/trigger-artifacts-DQPbQNqC-B4yeeFBY.mjs +239 -0
  112. package/dist/trigger-manifest-CY7brZeg.mjs +30 -0
  113. package/dist/try-deploy.handler-DqybNhXx.mjs +490 -0
  114. package/dist/upload-CkU--iDC.mjs +207 -0
  115. package/dist/upload.handler-DCtiznQp.mjs +441 -0
  116. package/dist/utils-CywxCDM7.mjs +14 -0
  117. package/dist/validate.handler-DOcTaJL0.mjs +280 -0
  118. package/dist/workflow-build-DBQaBfnn.mjs +1819 -0
  119. package/dist/workflow-bundler-BPiqVscj-X1PFFAuP.mjs +167 -0
  120. package/dist/workflows-g9z87AJJ.mjs +799 -0
  121. package/dist/writer-BG8poUm3-BbXlU2kI.mjs +426 -0
  122. package/package.json +87 -0
@@ -0,0 +1,167 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { n as identifierName, o as parseSourceFile, r as isNode } from "./oxc-B3KI3rf_-n9d1hKNq.mjs";
4
+ import { r as formatEnvAccessError, t as createEnvAccessPlugin } from "./detect-env-access-CwkOYeYM-D_BCZqV6.mjs";
5
+ import { existsSync, readFileSync, realpathSync } from "node:fs";
6
+ import * as path$1 from "node:path";
7
+ import { createHash } from "node:crypto";
8
+ import { rolldown } from "rolldown";
9
+ //#region ../../packages/workflow-builder/dist/workflow-bundler-BPiqVscj.mjs
10
+ function getDefaultExternal() {
11
+ return [
12
+ /^node:/,
13
+ "@swc/core",
14
+ /^@swc\/core-/,
15
+ /^@swc\/wasm/,
16
+ "playwright-core"
17
+ ];
18
+ }
19
+ function createVirtualEntry(filePath, localExportName) {
20
+ return `${localExportName === "default" ? `export { default } from ${JSON.stringify(filePath)};` : `export { ${localExportName} as default } from ${JSON.stringify(filePath)};`}\nexport * from ${JSON.stringify(filePath)};`;
21
+ }
22
+ function tryResolveRelativeModule(source, importer) {
23
+ if (!importer || !source.startsWith("./") && !source.startsWith("../")) return null;
24
+ const importerDir = path$1.dirname(importer);
25
+ const basePath = path$1.resolve(importerDir, source);
26
+ const candidates = [
27
+ basePath,
28
+ `${basePath}.ts`,
29
+ `${basePath}.tsx`,
30
+ `${basePath}.mts`,
31
+ `${basePath}.js`,
32
+ `${basePath}.mjs`,
33
+ path$1.join(basePath, "index.ts"),
34
+ path$1.join(basePath, "index.tsx"),
35
+ path$1.join(basePath, "index.mts"),
36
+ path$1.join(basePath, "index.js"),
37
+ path$1.join(basePath, "index.mjs")
38
+ ];
39
+ for (const candidate of candidates) try {
40
+ if (existsSync(candidate)) return realpathSync.native(candidate);
41
+ } catch {}
42
+ return null;
43
+ }
44
+ function collectRuntimeExportNames(resolvedFilePath) {
45
+ const sourceFile = parseSourceFile(resolvedFilePath, readFileSync(resolvedFilePath, "utf-8"));
46
+ const exportNames = /* @__PURE__ */ new Set();
47
+ for (const statement of sourceFile.statements) {
48
+ const declaration = statement.declaration;
49
+ if (statement.type === "ExportNamedDeclaration" && isNode(declaration)) {
50
+ if (Array.isArray(declaration.declarations)) {
51
+ for (const declarator of declaration.declarations) {
52
+ if (!isNode(declarator)) continue;
53
+ const localName = identifierName(declarator.id);
54
+ if (localName) exportNames.add(localName);
55
+ }
56
+ continue;
57
+ }
58
+ const localName = identifierName(declaration.id);
59
+ if (localName) exportNames.add(localName);
60
+ continue;
61
+ }
62
+ if (statement.type === "ExportNamedDeclaration" && Array.isArray(statement.specifiers)) for (const specifier of statement.specifiers) {
63
+ if (!isNode(specifier) || specifier.type !== "ExportSpecifier") continue;
64
+ const exportName = identifierName(specifier.exported) ?? identifierName(specifier.local);
65
+ if (exportName) exportNames.add(exportName);
66
+ }
67
+ }
68
+ return Array.from(exportNames).sort((left, right) => left.localeCompare(right));
69
+ }
70
+ function createDelegateStubModule(exports, resolvedFilePath) {
71
+ const lines = [
72
+ `import { Agent, Workflow } from '@keystroke/workflow-core';`,
73
+ `import { z } from 'zod';`,
74
+ ""
75
+ ];
76
+ for (const entry of exports) {
77
+ const binding = entry.exportName === "default" ? "__default_export__" : entry.exportName;
78
+ if (entry.kind === "workflow") lines.push(`const ${binding} = new Workflow({`, ` id: ${JSON.stringify(entry.authoredId)},`, ` name: ${JSON.stringify(entry.displayName)},`, ` input: z.unknown(),`, ` output: z.unknown(),`, ` run: async () => { throw new Error('Workflow delegate stub should never execute directly'); },`, `});`);
79
+ else lines.push(`const ${binding} = new Agent({`, ` id: ${JSON.stringify(entry.authoredId)},`, ` name: ${JSON.stringify(entry.displayName)},`, ` systemPrompt: 'workflow-delegate-stub',`, ` model: 'keystroke/delegate-stub',`, ` input: z.unknown(),`, ` output: z.unknown(),`, `});`);
80
+ if (entry.exportName === "default") lines.push(`export default ${binding};`);
81
+ else lines.push(`export { ${binding} };`);
82
+ lines.push("");
83
+ }
84
+ const delegatedExportNames = new Set(exports.map((entry) => entry.exportName));
85
+ const passthroughExportNames = collectRuntimeExportNames(resolvedFilePath).filter((exportName) => !delegatedExportNames.has(exportName));
86
+ for (const exportName of passthroughExportNames) {
87
+ lines.push(`const ${exportName} = z.unknown();`);
88
+ lines.push(`export { ${exportName} };`);
89
+ lines.push("");
90
+ }
91
+ return lines.join("\n");
92
+ }
93
+ async function bundleTarget(options) {
94
+ const trackedDependencies = /* @__PURE__ */ new Set();
95
+ const entryId = "\0virtual:workflow-builder-entry";
96
+ const exportReference = createVirtualEntry(options.filePath, options.localExportName);
97
+ const envViolations = [];
98
+ const delegateStubPrefix = "\0keystroke:delegate-stub:";
99
+ const bundle = await rolldown({
100
+ input: entryId,
101
+ platform: "node",
102
+ external: options.external ?? getDefaultExternal(),
103
+ treeshake: true,
104
+ plugins: [createEnvAccessPlugin(envViolations, options.projectRoot), {
105
+ name: "workflow-entry",
106
+ resolveId(source, importer) {
107
+ if (source === entryId) return entryId;
108
+ if (options.delegateRegistry) {
109
+ const resolvedPath = tryResolveRelativeModule(source, importer);
110
+ if (resolvedPath && options.delegateRegistry[resolvedPath]) return `${delegateStubPrefix}${resolvedPath}`;
111
+ }
112
+ return null;
113
+ },
114
+ load(id) {
115
+ if (id === entryId) return exportReference;
116
+ if (id.startsWith(delegateStubPrefix)) {
117
+ const resolvedPath = id.slice(25);
118
+ return createDelegateStubModule(options.delegateRegistry?.[resolvedPath] ?? [], resolvedPath);
119
+ }
120
+ return null;
121
+ },
122
+ moduleParsed(moduleInfo) {
123
+ if (!moduleInfo.id.includes("node_modules") && !moduleInfo.id.includes("\0")) trackedDependencies.add(moduleInfo.id);
124
+ }
125
+ }]
126
+ });
127
+ try {
128
+ const { output } = await bundle.generate({
129
+ codeSplitting: false,
130
+ format: "esm",
131
+ sourcemap: options.minify ? false : options.sourceMap ?? true,
132
+ minify: options.minify ?? false,
133
+ banner: options.agentCompatibilityBanner ? ["import { createRequire as __cr } from \"node:module\"; var require = __cr(import.meta.url);", "if (typeof globalThis.self === \"undefined\") globalThis.self = globalThis;"].join("\n") : void 0
134
+ });
135
+ if (envViolations.length > 0) throw new Error(formatEnvAccessError(envViolations));
136
+ const chunks = output.filter((candidate) => candidate.type === "chunk");
137
+ if (chunks.length !== 1) throw new Error(`Workflow bundle must produce exactly one chunk for ${options.filePath}`);
138
+ const [chunk] = chunks;
139
+ if (!chunk) throw new Error(`Expected rolldown to generate a chunk for ${options.filePath}`);
140
+ const sourceMap = chunk.map ? chunk.map.toString() : null;
141
+ return {
142
+ code: chunk.code,
143
+ sourceMap,
144
+ hash: createHash("sha256").update(chunk.code).digest("hex"),
145
+ ...sourceMap ? { sourceMapHash: createHash("sha256").update(sourceMap).digest("hex") } : {},
146
+ localDependencies: Array.from(trackedDependencies).sort((left, right) => left.localeCompare(right)),
147
+ externalImports: [...new Set([...chunk.imports, ...chunk.dynamicImports])].sort((left, right) => left.localeCompare(right)),
148
+ size: Buffer.byteLength(chunk.code)
149
+ };
150
+ } finally {
151
+ await bundle.close();
152
+ }
153
+ }
154
+ async function bundleWorkflowTarget(options) {
155
+ return bundleTarget({
156
+ ...options,
157
+ agentCompatibilityBanner: false
158
+ });
159
+ }
160
+ async function bundleSandboxAgentTarget(options) {
161
+ return bundleTarget({
162
+ ...options,
163
+ agentCompatibilityBanner: true
164
+ });
165
+ }
166
+ //#endregion
167
+ export { bundleWorkflowTarget as n, bundleSandboxAgentTarget as t };