@keystrokehq/cli 0.1.46 → 0.1.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -96,7 +96,7 @@ keystroke init --name my-app --dir ./my-app --yes --skip-install
96
96
  | `--skip-install` | Don't run package manager install |
97
97
  | `--pm` | Force npm, pnpm, yarn, or bun |
98
98
 
99
- Scaffolded projects include a committed `tsconfig.json` (extends `@keystrokehq/cli/tsconfig.json`) and `package.json` scripts for `lint`, `typecheck`, and `test`. Dev tooling (oxlint, TypeScript, vitest, `@types/node`) ships in the CLI not in project devDependencies.
99
+ Scaffolded projects include a committed `tsconfig.json` and `package.json` scripts for `lint`, `typecheck`, and `test`. Lint config (oxlint) ships in the CLI bundle; projects declare `@types/node`, TypeScript, and vitest in devDependencies.
100
100
 
101
101
  ### `lint`
102
102
 
@@ -29963,8 +29963,67 @@ function discoverSkillManifestEntries(projectRoot) {
29963
29963
  walkSkillFiles(projectRoot, skillsDir, entries);
29964
29964
  return entries;
29965
29965
  }
29966
+ const EXPORT_FIX = "Use plain structural Zod only (objects, strings, literals, unions). Remap or validate in .attach({ transform }) or at the top of run() instead.";
29967
+ function zodDef(schema) {
29968
+ return schema._zod?.def;
29969
+ }
29970
+ /** Finds code-based Zod nodes that cannot be faithfully exported to JSON Schema. */
29971
+ function findNonExportableSchemaNode(schema, path = "schema") {
29972
+ const def = zodDef(schema);
29973
+ if (!def) return;
29974
+ if (def.type === "transform") return `${path} uses .transform()`;
29975
+ if (def.checks?.some((check) => check._zod?.def?.type === "custom")) return `${path} uses .refine() or .superRefine()`;
29976
+ if (def.type === "pipe") {
29977
+ if (def.in && zodDef(def.in)?.type === "transform") return `${path} uses .preprocess()`;
29978
+ const inIssue = def.in ? findNonExportableSchemaNode(def.in, `${path}.pipe(in)`) : void 0;
29979
+ if (inIssue) return inIssue;
29980
+ const outIssue = def.out ? findNonExportableSchemaNode(def.out, `${path}.pipe(out)`) : void 0;
29981
+ if (outIssue) return outIssue;
29982
+ }
29983
+ if (def.shape) for (const [key, child] of Object.entries(def.shape)) {
29984
+ const issue = findNonExportableSchemaNode(child, `${path}.${key}`);
29985
+ if (issue) return issue;
29986
+ }
29987
+ if (def.element) {
29988
+ const issue = findNonExportableSchemaNode(def.element, `${path}[]`);
29989
+ if (issue) return issue;
29990
+ }
29991
+ if (def.options) for (const [index, option] of def.options.entries()) {
29992
+ const issue = findNonExportableSchemaNode(option, `${path}[${index}]`);
29993
+ if (issue) return issue;
29994
+ }
29995
+ if (def.left) {
29996
+ const issue = findNonExportableSchemaNode(def.left, `${path}.left`);
29997
+ if (issue) return issue;
29998
+ }
29999
+ if (def.right) {
30000
+ const issue = findNonExportableSchemaNode(def.right, `${path}.right`);
30001
+ if (issue) return issue;
30002
+ }
30003
+ if (def.valueType) {
30004
+ const issue = findNonExportableSchemaNode(def.valueType, `${path}.value`);
30005
+ if (issue) return issue;
30006
+ }
30007
+ if (def.items) for (const [index, item] of def.items.entries()) {
30008
+ const issue = findNonExportableSchemaNode(item, `${path}[${index}]`);
30009
+ if (issue) return issue;
30010
+ }
30011
+ if (def.rest) {
30012
+ const issue = findNonExportableSchemaNode(def.rest, `${path}.rest`);
30013
+ if (issue) return issue;
30014
+ }
30015
+ }
30016
+ function formatSchemaExportError(cause) {
30017
+ return /* @__PURE__ */ new Error(`Cannot export schema to JSON Schema: ${cause}. ${EXPORT_FIX}`);
30018
+ }
29966
30019
  function schemaToJson(schema) {
29967
- return toJSONSchema(schema, { target: "openapi-3.0" });
30020
+ const issue = findNonExportableSchemaNode(schema);
30021
+ if (issue) throw formatSchemaExportError(issue);
30022
+ try {
30023
+ return toJSONSchema(schema, { target: "openapi-3.0" });
30024
+ } catch (error) {
30025
+ throw formatSchemaExportError(error instanceof Error ? error.message : String(error));
30026
+ }
29968
30027
  }
29969
30028
  function collectIntegrationKeys(integrations) {
29970
30029
  return integrations.map((integration) => integration.key);
@@ -30745,4 +30804,4 @@ async function emitStoredRouteManifestForProject(projectRoot) {
30745
30804
  //#endregion
30746
30805
  export { validatePollGroups as A, attachmentSlugFromRecord as B, pollRouteFromSourceSlug as C, validateAttachmentTargets as D, toStoredRouteManifest as E, webhookManifestAttachmentSchemasFromBindings as F, packAssetDirs as G, computeCallSiteIds as H, webhookMatchSchemaForBindings as I, entryIdFromFile as J, discoverEntries as K, webhookRouteFromEndpoint as L, validateTriggerAttachments as M, validateUniqueAttachmentSlugs as N, validateImportedTriggerAttachment as O, validateUniqueTriggerSourceSlugs as P, walkTypeScriptFiles as Q, workflowKeyForAttachment as R, pollGroupRouteFromId as S, serializeRouteManifest as T, diagnoseWorkflowSource as U, classifyCall as V, locateWorkflow as W, shouldSkipKeystrokeModuleFile as X, readKeystrokeIgnoreDirective as Y, validateUniqueModuleKeys as Z, importAgentDefinition as _, buildStoredRouteManifestForProject as a, persistStoredRouteManifest as b, collectAgentAppSlugs as c, discoverAgentEntries as d, discoverSkillManifestEntries as f, emitStoredRouteManifestForProject as g, discoverWorkflows as h, buildPollGroups as i, validateProjectModules as j, validateImportedWorkflowDefinition as k, collectAgentToolSlugs as l, discoverWorkflowEntries as m, agentManifestEntry as n, buildStoredRouteManifestFromContext as o, discoverTriggerAttachments as p, discoverModuleFileEntries as q, agentRouteFromKey as r, buildWebhookBindingsByRoute as s, agentKeyForAttachment as t, countAgentCredentials as u, importTriggerAttachments as v, schemaToJson as w, pollGroupId as x, importWorkflowDefinition as y, workflowRouteFromKey as z };
30747
30806
 
30748
- //# sourceMappingURL=dist-BmO-d0ms.mjs.map
30807
+ //# sourceMappingURL=dist-BhVoGfcQ.mjs.map