@lotics/cli 0.154.0 → 0.155.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/cli.js +44 -4
- package/package.json +1 -1
package/dist/src/cli.js
CHANGED
|
@@ -66153,6 +66153,33 @@ var cForStepSchema = zod_default.lazy(
|
|
|
66153
66153
|
);
|
|
66154
66154
|
var workflowStepsSchema = zod_default.array(workflowStepSchema).min(1);
|
|
66155
66155
|
|
|
66156
|
+
// ../shared/src/suggest_tool_name.ts
|
|
66157
|
+
var VERB_ALIASES = {
|
|
66158
|
+
list: "query",
|
|
66159
|
+
find: "query",
|
|
66160
|
+
search: "query",
|
|
66161
|
+
fetch: "get",
|
|
66162
|
+
read: "get",
|
|
66163
|
+
add: "create",
|
|
66164
|
+
insert: "create",
|
|
66165
|
+
edit: "update",
|
|
66166
|
+
set: "update",
|
|
66167
|
+
remove: "delete"
|
|
66168
|
+
};
|
|
66169
|
+
function tokensOf(name2) {
|
|
66170
|
+
return name2.toLowerCase().split(/[^a-z0-9]+/).filter((t) => t !== "").map((t) => VERB_ALIASES[t] ?? t);
|
|
66171
|
+
}
|
|
66172
|
+
function suggestToolNames(wanted, candidates, limit = 3) {
|
|
66173
|
+
const parts = tokensOf(wanted);
|
|
66174
|
+
if (parts.length === 0) return [];
|
|
66175
|
+
const noun = parts[parts.length - 1];
|
|
66176
|
+
return [...candidates].map((candidate) => {
|
|
66177
|
+
const tokens = tokensOf(candidate);
|
|
66178
|
+
const shared = tokens.filter((t) => parts.includes(t)).length;
|
|
66179
|
+
return { candidate, score: shared + (tokens.includes(noun) ? 2 : 0), size: tokens.length };
|
|
66180
|
+
}).filter((c) => c.score > 0).sort((a, b) => b.score - a.score || a.size - b.size || a.candidate.localeCompare(b.candidate)).slice(0, limit).map((c) => c.candidate);
|
|
66181
|
+
}
|
|
66182
|
+
|
|
66156
66183
|
// ../shared/src/zod_issues.ts
|
|
66157
66184
|
function formatZodIssues(issues) {
|
|
66158
66185
|
return issues.map((i2) => `${i2.path.join(".") || "<root>"}: ${i2.message}`).join("; ");
|
|
@@ -69438,6 +69465,10 @@ function describeSyntaxError(source, raw, parseWith) {
|
|
|
69438
69465
|
|
|
69439
69466
|
This body parses as TypeScript but not as JavaScript \u2014 a workflow body is a JS subset, so type syntax (a parameter annotation, \`as\`, a generic) is not allowed. Remove it. If the type pass then reports an implicit \`any\`, give the VALUE a known type instead \u2014 read it from a typed source (a tool result, \`trigger.app_workflow.inputs\`) rather than annotating the parameter.`;
|
|
69440
69467
|
}
|
|
69468
|
+
function unknownToolMessage(name2, toolNames) {
|
|
69469
|
+
const suggestions = toolNames ? suggestToolNames(name2, toolNames) : [];
|
|
69470
|
+
return suggestions.length > 0 ? `Unknown tool "${name2}". Did you mean: ${suggestions.join(", ")}?` : `Unknown tool "${name2}".`;
|
|
69471
|
+
}
|
|
69441
69472
|
function parseWorkflowJs(source, opts) {
|
|
69442
69473
|
const tooLarge = checkSourceLength(source);
|
|
69443
69474
|
if (tooLarge) return tooLarge;
|
|
@@ -69949,7 +69980,7 @@ function walkExpressionStatement(stmt, scope, stepIds, opts, stepId, description
|
|
|
69949
69980
|
input
|
|
69950
69981
|
};
|
|
69951
69982
|
}
|
|
69952
|
-
fail(callee,
|
|
69983
|
+
fail(callee, unknownToolMessage(name2, opts.toolNames) + " Tools must be registered.");
|
|
69953
69984
|
}
|
|
69954
69985
|
if (e.type === "CallExpression" && e.callee.type === "MemberExpression" && !e.callee.computed && e.callee.property.type === "Identifier" && e.callee.property.name === "push") {
|
|
69955
69986
|
return walkPushStatement(e, scope, stepId, description);
|
|
@@ -70610,7 +70641,7 @@ function walkToolInvocation(call, scope, opts, allowWaits) {
|
|
|
70610
70641
|
fail(call, `${name2} is a wait step, not a tool. Use "await ${name2}({...})" as a standalone statement.`);
|
|
70611
70642
|
}
|
|
70612
70643
|
if (opts.toolNames && !opts.toolNames.has(name2)) {
|
|
70613
|
-
fail(callee,
|
|
70644
|
+
fail(callee, unknownToolMessage(name2, opts.toolNames));
|
|
70614
70645
|
}
|
|
70615
70646
|
if (call.arguments.length !== 1) {
|
|
70616
70647
|
fail(call, `${name2} requires exactly one options-object argument.`);
|
|
@@ -72307,7 +72338,15 @@ function isMissingWorkflowBodyError(error52) {
|
|
|
72307
72338
|
}
|
|
72308
72339
|
function workflowFileHeader(alias) {
|
|
72309
72340
|
const refPath = path9.join("..", "..", WORKFLOW_GLOBALS_DIR, `${alias}.globals.d.ts`).split(path9.sep).join("/");
|
|
72310
|
-
return
|
|
72341
|
+
return (
|
|
72342
|
+
// The scaffold ships oxlint, whose `triple-slash-reference` rule flags the
|
|
72343
|
+
// line below — so every pulled body arrived with a warning its author could
|
|
72344
|
+
// not act on: the reference is what types the body against the workspace, so
|
|
72345
|
+
// deleting it breaks `workflow check`. The disable rides the FILE rather than
|
|
72346
|
+
// sitting in the project's lint config, because a config entry is scoped to
|
|
72347
|
+
// where the file currently lives and stops covering it the moment it moves.
|
|
72348
|
+
`// oxlint-disable-next-line typescript-eslint/triple-slash-reference
|
|
72349
|
+
/// <reference path="${refPath}" />
|
|
72311
72350
|
// Auto-pulled workflow body for "${alias}". Edit the BODY between the wrapper
|
|
72312
72351
|
// lines below, then check + push with:
|
|
72313
72352
|
// lotics app workflow check ${alias}
|
|
@@ -72317,7 +72356,8 @@ function workflowFileHeader(alias) {
|
|
|
72317
72356
|
// set) \u2014 they only make the body typecheck locally against the workspace types.
|
|
72318
72357
|
// Do NOT rename this file \u2014 the filename is the alias the binding is keyed by.
|
|
72319
72358
|
export {};
|
|
72320
|
-
|
|
72359
|
+
`
|
|
72360
|
+
);
|
|
72321
72361
|
}
|
|
72322
72362
|
function workflowFilePath(projectDir, alias) {
|
|
72323
72363
|
return path9.join(projectDir, WORKFLOWS_DIR, `${alias}.ts`);
|