@meistrari/tela-cli 0.7.55 → 0.7.56
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/index.js +102 -43
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7749,7 +7749,7 @@ var require_env = __commonJS({
|
|
|
7749
7749
|
if (!await fileExists(path)) {
|
|
7750
7750
|
return {
|
|
7751
7751
|
ok: false,
|
|
7752
|
-
diagnostics: [(0, diagnostics_1.diagnostic)("config.env_file.missing", "error", `Workflow Code env file not found at ${path}`, "
|
|
7752
|
+
diagnostics: [(0, diagnostics_1.diagnostic)("config.env_file.missing", "error", `Workflow Code env file not found at ${path}`, "Create the dotenv file, fix the --env path, or omit --env to use default `.env` / `.env.local` loading. Example: `tela workflow compile --env .env.staging`.")]
|
|
7753
7753
|
};
|
|
7754
7754
|
}
|
|
7755
7755
|
Object.assign(loaded, parseDotenv(await (0, promises_1.readFile)(path, "utf8")));
|
|
@@ -219681,7 +219681,8 @@ var require_evaluate_typescript_config = __commonJS({
|
|
|
219681
219681
|
var node_vm_1 = require("node:vm");
|
|
219682
219682
|
var typescript_1 = __importDefault(require_typescript());
|
|
219683
219683
|
var diagnostics_1 = require_diagnostics();
|
|
219684
|
-
function evaluateTypeScriptConfig(content, path) {
|
|
219684
|
+
function evaluateTypeScriptConfig(content, path, options = {}) {
|
|
219685
|
+
const compileCommand = options.compileCommand ?? "tela workflow compile";
|
|
219685
219686
|
let outputText;
|
|
219686
219687
|
try {
|
|
219687
219688
|
outputText = typescript_1.default.transpileModule(content, {
|
|
@@ -219693,10 +219694,10 @@ var require_evaluate_typescript_config = __commonJS({
|
|
|
219693
219694
|
target: typescript_1.default.ScriptTarget.ES2022
|
|
219694
219695
|
}
|
|
219695
219696
|
}).outputText;
|
|
219696
|
-
} catch
|
|
219697
|
+
} catch {
|
|
219697
219698
|
return {
|
|
219698
219699
|
ok: false,
|
|
219699
|
-
diagnostics: [(0, diagnostics_1.diagnostic)("config.parse_failed", "error", `Unable to transpile Workflow Code config at ${path}`,
|
|
219700
|
+
diagnostics: [(0, diagnostics_1.diagnostic)("config.parse_failed", "error", `Unable to transpile Workflow Code config at ${path}`, `Fix TypeScript syntax in \`${path}\`, then rerun \`${compileCommand}\`. If you need a fresh template, run \`tela workflow init\` in an empty directory.`)]
|
|
219700
219701
|
};
|
|
219701
219702
|
}
|
|
219702
219703
|
const module3 = { exports: {} };
|
|
@@ -219717,16 +219718,16 @@ var require_evaluate_typescript_config = __commonJS({
|
|
|
219717
219718
|
setInterval,
|
|
219718
219719
|
setTimeout
|
|
219719
219720
|
});
|
|
219720
|
-
} catch
|
|
219721
|
+
} catch {
|
|
219721
219722
|
return {
|
|
219722
219723
|
ok: false,
|
|
219723
|
-
diagnostics: [(0, diagnostics_1.diagnostic)("config.evaluate_failed", "error", `Unable to evaluate Workflow Code config at ${path}`,
|
|
219724
|
+
diagnostics: [(0, diagnostics_1.diagnostic)("config.evaluate_failed", "error", `Unable to evaluate Workflow Code config at ${path}`, `Fix \`${path}\` so it can be imported without throwing. If it reads env vars, define them in \`.env\` / \`.env.local\` or pass the matching file with \`${compileCommand} --env <path>\`.`)]
|
|
219724
219725
|
};
|
|
219725
219726
|
}
|
|
219726
219727
|
if (!("default" in module3.exports)) {
|
|
219727
219728
|
return {
|
|
219728
219729
|
ok: false,
|
|
219729
|
-
diagnostics: [(0, diagnostics_1.diagnostic)("config.export.invalid", "error", `Workflow Code TypeScript config at ${path} must export a default config object`)]
|
|
219730
|
+
diagnostics: [(0, diagnostics_1.diagnostic)("config.export.invalid", "error", `Workflow Code TypeScript config at ${path} must export a default config object`, `Add \`export default { version: 1, workflows: { ... } }\` to \`${path}\`, or run \`tela workflow init\` in an empty directory to generate a template.`)]
|
|
219730
219731
|
};
|
|
219731
219732
|
}
|
|
219732
219733
|
return { ok: true, value: module3.exports.default };
|
|
@@ -219734,6 +219735,29 @@ var require_evaluate_typescript_config = __commonJS({
|
|
|
219734
219735
|
}
|
|
219735
219736
|
});
|
|
219736
219737
|
|
|
219738
|
+
// ../../packages/workflow-code/dist/cli/config/format-config-path.js
|
|
219739
|
+
var require_format_config_path = __commonJS({
|
|
219740
|
+
"../../packages/workflow-code/dist/cli/config/format-config-path.js"(exports2) {
|
|
219741
|
+
"use strict";
|
|
219742
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
219743
|
+
exports2.formatConfigPath = formatConfigPath;
|
|
219744
|
+
exports2.formatObjectKey = formatObjectKey;
|
|
219745
|
+
var IDENTIFIER_PATTERN = /^[A-Z_$][\w$]*$/i;
|
|
219746
|
+
function formatConfigPath(...segments) {
|
|
219747
|
+
return segments.map((segment, index) => index === 0 ? segment : formatConfigPathSegment(segment)).join("");
|
|
219748
|
+
}
|
|
219749
|
+
function formatObjectKey(key) {
|
|
219750
|
+
return IDENTIFIER_PATTERN.test(key) ? key : `'${escapeSingleQuotedString(key)}'`;
|
|
219751
|
+
}
|
|
219752
|
+
function formatConfigPathSegment(segment) {
|
|
219753
|
+
return IDENTIFIER_PATTERN.test(segment) ? `.${segment}` : `['${escapeSingleQuotedString(segment)}']`;
|
|
219754
|
+
}
|
|
219755
|
+
function escapeSingleQuotedString(value) {
|
|
219756
|
+
return value.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
219757
|
+
}
|
|
219758
|
+
}
|
|
219759
|
+
});
|
|
219760
|
+
|
|
219737
219761
|
// ../../packages/workflow-code/dist/cli/config/load-config.js
|
|
219738
219762
|
var require_load_config = __commonJS({
|
|
219739
219763
|
"../../packages/workflow-code/dist/cli/config/load-config.js"(exports2) {
|
|
@@ -219745,8 +219769,10 @@ var require_load_config = __commonJS({
|
|
|
219745
219769
|
var diagnostics_1 = require_diagnostics();
|
|
219746
219770
|
var env_1 = require_env();
|
|
219747
219771
|
var evaluate_typescript_config_1 = require_evaluate_typescript_config();
|
|
219772
|
+
var format_config_path_1 = require_format_config_path();
|
|
219748
219773
|
async function loadWorkflowCodeConfig(cwd, configPath, options = {}) {
|
|
219749
219774
|
const path = (0, node_path_1.resolve)(cwd, configPath ?? "workflow-code.config.ts");
|
|
219775
|
+
const compileCommand = workflowCompileCommand(configPath);
|
|
219750
219776
|
const extensionDiagnostic = validateConfigExtension(path);
|
|
219751
219777
|
if (extensionDiagnostic)
|
|
219752
219778
|
return { ok: false, diagnostics: [extensionDiagnostic] };
|
|
@@ -219759,13 +219785,15 @@ var require_load_config = __commonJS({
|
|
|
219759
219785
|
} catch (error) {
|
|
219760
219786
|
return {
|
|
219761
219787
|
ok: false,
|
|
219762
|
-
diagnostics: [(0, diagnostics_1.diagnostic)("config.read_failed", "error", `Unable to read Workflow Code config at ${path}`, error
|
|
219788
|
+
diagnostics: [(0, diagnostics_1.diagnostic)("config.read_failed", "error", `Unable to read Workflow Code config at ${path}`, readConfigHint(error, path, compileCommand))]
|
|
219763
219789
|
};
|
|
219764
219790
|
}
|
|
219765
|
-
const parsedResult = await (0, env_1.withWorkflowEnv)(envResult.env, () => (0, evaluate_typescript_config_1.evaluateTypeScriptConfig)(content, path
|
|
219791
|
+
const parsedResult = await (0, env_1.withWorkflowEnv)(envResult.env, () => (0, evaluate_typescript_config_1.evaluateTypeScriptConfig)(content, path, {
|
|
219792
|
+
compileCommand
|
|
219793
|
+
}));
|
|
219766
219794
|
if (!parsedResult.ok)
|
|
219767
219795
|
return parsedResult;
|
|
219768
|
-
const diagnostics = validateWorkflowCodeConfig(parsedResult.value);
|
|
219796
|
+
const diagnostics = validateWorkflowCodeConfig(parsedResult.value, compileCommand);
|
|
219769
219797
|
if (diagnostics.length > 0)
|
|
219770
219798
|
return { ok: false, diagnostics };
|
|
219771
219799
|
return { ok: true, value: { path, config: parsedResult.value } };
|
|
@@ -219773,82 +219801,113 @@ var require_load_config = __commonJS({
|
|
|
219773
219801
|
function validateConfigExtension(path) {
|
|
219774
219802
|
if ((0, node_path_1.extname)(path) === ".ts")
|
|
219775
219803
|
return void 0;
|
|
219776
|
-
return (0, diagnostics_1.diagnostic)("config.extension.unsupported", "error", `Unsupported Workflow Code config extension for ${path}`, "
|
|
219804
|
+
return (0, diagnostics_1.diagnostic)("config.extension.unsupported", "error", `Unsupported Workflow Code config extension for ${path}`, "Rename the config to `workflow-code.config.ts`, pass a TypeScript config with `--config <path>.ts`, or create one with `tela workflow init`.");
|
|
219777
219805
|
}
|
|
219778
|
-
function validateWorkflowCodeConfig(value) {
|
|
219806
|
+
function validateWorkflowCodeConfig(value, compileCommand) {
|
|
219779
219807
|
const diagnostics = [];
|
|
219780
219808
|
if (!isRecord2(value)) {
|
|
219781
|
-
return [(0, diagnostics_1.diagnostic)("config.invalid", "error", "Workflow Code config must be an object")];
|
|
219809
|
+
return [(0, diagnostics_1.diagnostic)("config.invalid", "error", "Workflow Code config must be an object", configHint("Export a default object with `version: 1` and a non-empty `workflows` map. To recreate the template in an empty directory, run `tela workflow init`.", compileCommand))];
|
|
219782
219810
|
}
|
|
219783
219811
|
if (value.version !== 1) {
|
|
219784
|
-
diagnostics.push((0, diagnostics_1.diagnostic)("config.version.invalid", "error", "Workflow Code config version must be 1"));
|
|
219812
|
+
diagnostics.push((0, diagnostics_1.diagnostic)("config.version.invalid", "error", "Workflow Code config version must be 1", configHint("Set the top-level field to `version: 1`; this is the only supported Workflow Code config schema version.", compileCommand)));
|
|
219785
219813
|
}
|
|
219786
219814
|
if (value.tsconfig !== void 0 && typeof value.tsconfig !== "string") {
|
|
219787
|
-
diagnostics.push((0, diagnostics_1.diagnostic)("config.tsconfig.invalid", "error", "Config field tsconfig must be a string when provided"));
|
|
219815
|
+
diagnostics.push((0, diagnostics_1.diagnostic)("config.tsconfig.invalid", "error", "Config field tsconfig must be a string when provided", configHint("Set `tsconfig` to a string path such as `./tsconfig.json`, or remove the field to use default TypeScript resolution.", compileCommand)));
|
|
219788
219816
|
}
|
|
219789
219817
|
if (value.outDir !== void 0 && typeof value.outDir !== "string") {
|
|
219790
|
-
diagnostics.push((0, diagnostics_1.diagnostic)("config.out_dir.invalid", "error", "Config field outDir must be a string when provided"));
|
|
219818
|
+
diagnostics.push((0, diagnostics_1.diagnostic)("config.out_dir.invalid", "error", "Config field outDir must be a string when provided", configHint("Set `outDir` to a string path such as `.tela/workflows`, or remove the field to use the default output directory.", compileCommand)));
|
|
219791
219819
|
}
|
|
219792
219820
|
if (!isRecord2(value.workflows) || Object.keys(value.workflows).length === 0) {
|
|
219793
|
-
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflows.invalid", "error", "Config field workflows must contain at least one workflow target"));
|
|
219821
|
+
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflows.invalid", "error", "Config field workflows must contain at least one workflow target", configHint("Add at least one target, for example `workflows: { demo: { entry: './src/workflows/demo.workflow.ts', projectId: 'proj_...' } }`, or run `tela workflow init` in an empty directory for a template.", compileCommand)));
|
|
219794
219822
|
return diagnostics;
|
|
219795
219823
|
}
|
|
219796
219824
|
for (const [targetName, target] of Object.entries(value.workflows)) {
|
|
219797
|
-
diagnostics.push(...validateWorkflowTarget(targetName, target));
|
|
219825
|
+
diagnostics.push(...validateWorkflowTarget(targetName, target, compileCommand));
|
|
219798
219826
|
}
|
|
219799
219827
|
return diagnostics;
|
|
219800
219828
|
}
|
|
219801
|
-
function validateWorkflowTarget(targetName, value) {
|
|
219829
|
+
function validateWorkflowTarget(targetName, value, compileCommand) {
|
|
219802
219830
|
const diagnostics = [];
|
|
219803
219831
|
if (!isRecord2(value)) {
|
|
219804
|
-
return [(0, diagnostics_1.diagnostic)("config.workflow.invalid", "error", `Workflow target ${targetName} must be an object`)];
|
|
219832
|
+
return [(0, diagnostics_1.diagnostic)("config.workflow.invalid", "error", `Workflow target ${targetName} must be an object`, targetHint(targetName, "Change this target to an object with `entry` and either top-level `projectId` or a `contexts` map.", compileCommand))];
|
|
219805
219833
|
}
|
|
219806
219834
|
const target = value;
|
|
219807
219835
|
if (!target.entry || typeof target.entry !== "string") {
|
|
219808
|
-
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflow.entry.invalid", "error", `Workflow target ${targetName} must define string field entry`));
|
|
219836
|
+
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflow.entry.invalid", "error", `Workflow target ${targetName} must define string field entry`, targetFieldHint(targetName, "entry", "to the workflow source file path, for example `./src/workflows/demo.workflow.ts`", compileCommand)));
|
|
219809
219837
|
}
|
|
219810
219838
|
if (target.projectId !== void 0 && (typeof target.projectId !== "string" || target.projectId.length === 0)) {
|
|
219811
|
-
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflow.project_id.invalid", "error", `Workflow target ${targetName} field projectId must be a non-empty string when provided`));
|
|
219839
|
+
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflow.project_id.invalid", "error", `Workflow target ${targetName} field projectId must be a non-empty string when provided`, targetFieldHint(targetName, "projectId", "to a non-empty Tela project id from the Tela UI, or move environment-specific project ids under `contexts`", compileCommand)));
|
|
219812
219840
|
}
|
|
219813
219841
|
if (target.export !== void 0 && target.export !== "default") {
|
|
219814
|
-
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflow.export.invalid", "error", `Workflow target ${targetName} only supports export: "default"`));
|
|
219842
|
+
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflow.export.invalid", "error", `Workflow target ${targetName} only supports export: "default"`, targetFieldHint(targetName, "export", "to `default`, or remove the field; named workflow exports are not supported yet", compileCommand)));
|
|
219815
219843
|
}
|
|
219816
219844
|
for (const field of ["workflowKey", "title"]) {
|
|
219817
219845
|
if (target[field] !== void 0 && typeof target[field] !== "string") {
|
|
219818
|
-
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflow.optional_field.invalid", "error", `Workflow target ${targetName} field ${field} must be a string when provided
|
|
219846
|
+
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflow.optional_field.invalid", "error", `Workflow target ${targetName} field ${field} must be a string when provided`, targetFieldHint(targetName, field, "to a string value, or remove the field if you do not need it", compileCommand)));
|
|
219819
219847
|
}
|
|
219820
219848
|
}
|
|
219821
219849
|
if (target.promptId !== void 0 && (typeof target.promptId !== "string" || target.promptId.length === 0)) {
|
|
219822
|
-
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflow.prompt_id.invalid", "error", `Workflow target ${targetName} field promptId must be a non-empty string when provided
|
|
219850
|
+
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflow.prompt_id.invalid", "error", `Workflow target ${targetName} field promptId must be a non-empty string when provided`, targetFieldHint(targetName, "promptId", "to a non-empty Tela prompt id from the Tela UI, or remove it to create/sync without an existing prompt binding", compileCommand)));
|
|
219823
219851
|
}
|
|
219824
219852
|
if (target.contexts !== void 0)
|
|
219825
|
-
diagnostics.push(...validateWorkflowContexts(targetName, target.contexts));
|
|
219853
|
+
diagnostics.push(...validateWorkflowContexts(targetName, target.contexts, compileCommand));
|
|
219826
219854
|
return diagnostics;
|
|
219827
219855
|
}
|
|
219828
|
-
function validateWorkflowContexts(targetName, value) {
|
|
219856
|
+
function validateWorkflowContexts(targetName, value, compileCommand) {
|
|
219829
219857
|
const diagnostics = [];
|
|
219830
219858
|
if (!isRecord2(value) || Object.keys(value).length === 0) {
|
|
219831
|
-
return [(0, diagnostics_1.diagnostic)("config.workflow.contexts.invalid", "error", `Workflow target ${targetName} field contexts must contain at least one context binding when provided`)];
|
|
219859
|
+
return [(0, diagnostics_1.diagnostic)("config.workflow.contexts.invalid", "error", `Workflow target ${targetName} field contexts must contain at least one context binding when provided`, targetFieldHint(targetName, "contexts", "to an object keyed by Tela context ids or environment aliases such as `dev`, `staging`, or `prod`; each binding needs `projectId`", compileCommand))];
|
|
219832
219860
|
}
|
|
219833
219861
|
for (const [contextName, binding] of Object.entries(value)) {
|
|
219834
|
-
diagnostics.push(...validateWorkflowContextBinding(targetName, contextName, binding));
|
|
219862
|
+
diagnostics.push(...validateWorkflowContextBinding(targetName, contextName, binding, compileCommand));
|
|
219835
219863
|
}
|
|
219836
219864
|
return diagnostics;
|
|
219837
219865
|
}
|
|
219838
|
-
function validateWorkflowContextBinding(targetName, contextName, value) {
|
|
219866
|
+
function validateWorkflowContextBinding(targetName, contextName, value, compileCommand) {
|
|
219839
219867
|
const diagnostics = [];
|
|
219840
219868
|
if (!isRecord2(value)) {
|
|
219841
|
-
return [(0, diagnostics_1.diagnostic)("config.workflow.context.invalid", "error", `Workflow target ${targetName} context ${contextName} must be an object`)];
|
|
219869
|
+
return [(0, diagnostics_1.diagnostic)("config.workflow.context.invalid", "error", `Workflow target ${targetName} context ${contextName} must be an object`, contextHint(targetName, contextName, "Change this binding to an object like `{ projectId: 'proj_...' }`.", compileCommand))];
|
|
219842
219870
|
}
|
|
219843
219871
|
const binding = value;
|
|
219844
219872
|
if (!binding.projectId || typeof binding.projectId !== "string") {
|
|
219845
|
-
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflow.project_id.missing", "error", `Workflow target ${targetName} context ${contextName} must define string field projectId`));
|
|
219873
|
+
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflow.project_id.missing", "error", `Workflow target ${targetName} context ${contextName} must define string field projectId`, contextFieldHint(targetName, contextName, "projectId", "to a non-empty Tela project id from the Tela UI or a required env var such as `process.env.TELA_PROJECT_ID!`", compileCommand)));
|
|
219846
219874
|
}
|
|
219847
219875
|
if (binding.promptId !== void 0 && (typeof binding.promptId !== "string" || binding.promptId.length === 0)) {
|
|
219848
|
-
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflow.prompt_id.invalid", "error", `Workflow target ${targetName} context ${contextName} field promptId must be a non-empty string when provided
|
|
219876
|
+
diagnostics.push((0, diagnostics_1.diagnostic)("config.workflow.prompt_id.invalid", "error", `Workflow target ${targetName} context ${contextName} field promptId must be a non-empty string when provided`, contextFieldHint(targetName, contextName, "promptId", "to a non-empty Tela prompt id from the Tela UI, or remove it if this context has no existing prompt binding", compileCommand)));
|
|
219849
219877
|
}
|
|
219850
219878
|
return diagnostics;
|
|
219851
219879
|
}
|
|
219880
|
+
function configHint(action, compileCommand) {
|
|
219881
|
+
return `${action} Then rerun \`${compileCommand}\`.`;
|
|
219882
|
+
}
|
|
219883
|
+
function targetHint(targetName, action, compileCommand) {
|
|
219884
|
+
return configHint(`${action} Location: \`${(0, format_config_path_1.formatConfigPath)("workflows", targetName)}\`.`, compileCommand);
|
|
219885
|
+
}
|
|
219886
|
+
function targetFieldHint(targetName, field, action, compileCommand) {
|
|
219887
|
+
return configHint(`Set \`${(0, format_config_path_1.formatConfigPath)("workflows", targetName, field)}\` ${action}.`, compileCommand);
|
|
219888
|
+
}
|
|
219889
|
+
function contextHint(targetName, contextName, action, compileCommand) {
|
|
219890
|
+
return configHint(`${action} Location: \`${(0, format_config_path_1.formatConfigPath)("workflows", targetName, "contexts", contextName)}\`.`, compileCommand);
|
|
219891
|
+
}
|
|
219892
|
+
function contextFieldHint(targetName, contextName, field, action, compileCommand) {
|
|
219893
|
+
return configHint(`Set \`${(0, format_config_path_1.formatConfigPath)("workflows", targetName, "contexts", contextName, field)}\` ${action}.`, compileCommand);
|
|
219894
|
+
}
|
|
219895
|
+
function workflowCompileCommand(configPath) {
|
|
219896
|
+
return configPath === void 0 ? "tela workflow compile" : `tela workflow compile --config ${shellArg(configPath)}`;
|
|
219897
|
+
}
|
|
219898
|
+
function shellArg(value) {
|
|
219899
|
+
return /^[\w./:-]+$/.test(value) ? value : `'${value.replace(/'/g, "'\\''")}'`;
|
|
219900
|
+
}
|
|
219901
|
+
function readConfigHint(error, path, compileCommand) {
|
|
219902
|
+
if (isNodeErrorCode(error, "ENOENT")) {
|
|
219903
|
+
return `Create \`${path}\` with \`tela workflow init --config ${shellArg(path)}\`, or pass an existing TypeScript config path. Then rerun \`${compileCommand}\`.`;
|
|
219904
|
+
}
|
|
219905
|
+
const detail = error instanceof Error && error.message.trim() ? ` Detail: ${error.message}` : "";
|
|
219906
|
+
return `${configHint("Check that the config path exists and is readable, or pass another path with `--config <path>.ts`.", compileCommand)}${detail}`;
|
|
219907
|
+
}
|
|
219908
|
+
function isNodeErrorCode(error, code) {
|
|
219909
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
219910
|
+
}
|
|
219852
219911
|
function isRecord2(value) {
|
|
219853
219912
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
219854
219913
|
}
|
|
@@ -220054,12 +220113,12 @@ export default {
|
|
|
220054
220113
|
if (isFileExistsError(error)) {
|
|
220055
220114
|
return {
|
|
220056
220115
|
exitCode: 1,
|
|
220057
|
-
diagnostics: [(0, diagnostics_1.diagnostic)("init.config_exists", "error", `Workflow Code config already exists at ${path}`, "
|
|
220116
|
+
diagnostics: [(0, diagnostics_1.diagnostic)("init.config_exists", "error", `Workflow Code config already exists at ${path}`, "Run `tela workflow compile` to validate the existing config, edit it in place, or pass `--config <new-path>.ts` to create a separate config.")]
|
|
220058
220117
|
};
|
|
220059
220118
|
}
|
|
220060
220119
|
return {
|
|
220061
220120
|
exitCode: 1,
|
|
220062
|
-
diagnostics: [(0, diagnostics_1.diagnostic)("init.write_failed", "error", `Unable to write Workflow Code config at ${path}`, error
|
|
220121
|
+
diagnostics: [(0, diagnostics_1.diagnostic)("init.write_failed", "error", `Unable to write Workflow Code config at ${path}`, initWriteFailedHint(error))]
|
|
220063
220122
|
};
|
|
220064
220123
|
}
|
|
220065
220124
|
return {
|
|
@@ -220077,6 +220136,10 @@ export default {
|
|
|
220077
220136
|
])
|
|
220078
220137
|
};
|
|
220079
220138
|
}
|
|
220139
|
+
function initWriteFailedHint(error) {
|
|
220140
|
+
const detail = error instanceof Error && error.message.trim() ? ` Detail: ${error.message}` : "";
|
|
220141
|
+
return `Check that the destination directory exists and is writable, then rerun \`tela workflow init\`, or pass \`--config <writable-path>.ts\`.${detail}`;
|
|
220142
|
+
}
|
|
220080
220143
|
function isFileExistsError(error) {
|
|
220081
220144
|
return typeof error === "object" && error !== null && "code" in error && error.code === "EEXIST";
|
|
220082
220145
|
}
|
|
@@ -220093,7 +220156,7 @@ var require_not_implemented = __commonJS({
|
|
|
220093
220156
|
function notImplementedCommand(command) {
|
|
220094
220157
|
return {
|
|
220095
220158
|
exitCode: 1,
|
|
220096
|
-
diagnostics: [(0, diagnostics_1.diagnostic)("cli.command.not_implemented", "error", `tela workflow ${command} is not yet available.`, "This command is planned for a future release.")]
|
|
220159
|
+
diagnostics: [(0, diagnostics_1.diagnostic)("cli.command.not_implemented", "error", `tela workflow ${command} is not yet available.`, "This command is planned for a future release. Today, use `tela workflow init` to create config and `tela workflow compile` to validate it.")]
|
|
220097
220160
|
};
|
|
220098
220161
|
}
|
|
220099
220162
|
}
|
|
@@ -220159,11 +220222,7 @@ var require_cli2 = __commonJS({
|
|
|
220159
220222
|
} else {
|
|
220160
220223
|
result = {
|
|
220161
220224
|
exitCode: 1,
|
|
220162
|
-
diagnostics: [{
|
|
220163
|
-
code: "cli.command.unknown",
|
|
220164
|
-
severity: "error",
|
|
220165
|
-
message: `Unknown tela workflow command: ${command}`
|
|
220166
|
-
}]
|
|
220225
|
+
diagnostics: [(0, diagnostics_1.diagnostic)("cli.command.unknown", "error", `Unknown tela workflow command: ${command}`, "Run `tela workflow help` to list supported commands. Common commands: `tela workflow init` and `tela workflow compile`.")]
|
|
220167
220226
|
};
|
|
220168
220227
|
}
|
|
220169
220228
|
if (globalOptions.json === true) {
|
|
@@ -220194,7 +220253,7 @@ var require_cli2 = __commonJS({
|
|
|
220194
220253
|
return void 0;
|
|
220195
220254
|
return {
|
|
220196
220255
|
exitCode: 1,
|
|
220197
|
-
diagnostics: [(0, diagnostics_1.diagnostic)("cli.flag.missing_value", "error", `Flag --${missingFlag} requires a value.`, missingFlag === "config" ? `Use --config <path
|
|
220256
|
+
diagnostics: [(0, diagnostics_1.diagnostic)("cli.flag.missing_value", "error", `Flag --${missingFlag} requires a value.`, missingFlag === "config" ? `Use --config <path>.ts, for example: tela workflow ${command} --config workflow-code.config.ts. To create the default config, run tela workflow init.` : `Use --env <path>, for example: tela workflow ${command} --env .env.staging. Omit --env to load .env and .env.local automatically.`)]
|
|
220198
220257
|
};
|
|
220199
220258
|
}
|
|
220200
220259
|
function unexpectedPassthroughResult(command, passthrough) {
|
|
@@ -220202,7 +220261,7 @@ var require_cli2 = __commonJS({
|
|
|
220202
220261
|
return void 0;
|
|
220203
220262
|
return {
|
|
220204
220263
|
exitCode: 1,
|
|
220205
|
-
diagnostics: [(0, diagnostics_1.diagnostic)("cli.command.unexpected_args", "error", `Unexpected positional arguments for tela workflow ${command}: ${passthrough.join(" ")}`,
|
|
220264
|
+
diagnostics: [(0, diagnostics_1.diagnostic)("cli.command.unexpected_args", "error", `Unexpected positional arguments for tela workflow ${command}: ${passthrough.join(" ")}`, "Remove the positional arguments. Run `tela workflow help` to see supported workflow commands and flags.")]
|
|
220206
220265
|
};
|
|
220207
220266
|
}
|
|
220208
220267
|
function writeHelp2(io) {
|