veryfront 0.1.76 → 0.1.78
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/esm/cli/commands/pull/command.js +2 -2
- package/esm/cli/commands/task/command.d.ts.map +1 -1
- package/esm/cli/commands/task/command.js +57 -51
- package/esm/cli/commands/workflow/command-help.d.ts +3 -0
- package/esm/cli/commands/workflow/command-help.d.ts.map +1 -0
- package/esm/cli/commands/workflow/command-help.js +19 -0
- package/esm/cli/commands/workflow/command.d.ts +5 -0
- package/esm/cli/commands/workflow/command.d.ts.map +1 -0
- package/esm/cli/commands/workflow/command.js +119 -0
- package/esm/cli/commands/workflow/handler.d.ts +28 -0
- package/esm/cli/commands/workflow/handler.d.ts.map +1 -0
- package/esm/cli/commands/workflow/handler.js +19 -0
- package/esm/cli/help/command-definitions.d.ts.map +1 -1
- package/esm/cli/help/command-definitions.js +2 -0
- package/esm/cli/router.d.ts.map +1 -1
- package/esm/cli/router.js +2 -0
- package/esm/cli/shared/project-source-context.d.ts +18 -0
- package/esm/cli/shared/project-source-context.d.ts.map +1 -0
- package/esm/cli/shared/project-source-context.js +52 -0
- package/esm/deno.d.ts +1 -0
- package/esm/deno.js +2 -1
- package/esm/src/discovery/module-import.d.ts +8 -0
- package/esm/src/discovery/module-import.d.ts.map +1 -0
- package/esm/src/discovery/module-import.js +24 -0
- package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts +3 -3
- package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts.map +1 -1
- package/esm/src/platform/adapters/veryfront-api-client/operations.js +12 -10
- package/esm/src/platform/adapters/veryfront-api-client/schemas/api.schema.d.ts +4 -4
- package/esm/src/platform/adapters/veryfront-api-client/schemas/api.schema.js +4 -4
- package/esm/src/platform/index.d.ts +1 -0
- package/esm/src/platform/index.d.ts.map +1 -1
- package/esm/src/platform/index.js +1 -0
- package/esm/src/server/runtime-handler/index.d.ts +1 -1
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +0 -3
- package/esm/src/task/discovery.d.ts.map +1 -1
- package/esm/src/task/discovery.js +5 -13
- package/esm/src/workflow/discovery/workflow-discovery.d.ts.map +1 -1
- package/esm/src/workflow/discovery/workflow-discovery.js +3 -8
- package/package.json +1 -1
- package/src/cli/commands/pull/command.ts +3 -3
- package/src/cli/commands/task/command.ts +66 -57
- package/src/cli/commands/workflow/command-help.ts +21 -0
- package/src/cli/commands/workflow/command.ts +152 -0
- package/src/cli/commands/workflow/handler.ts +25 -0
- package/src/cli/help/command-definitions.ts +2 -0
- package/src/cli/router.ts +2 -0
- package/src/cli/shared/project-source-context.ts +96 -0
- package/src/deno.js +2 -1
- package/src/src/discovery/module-import.ts +36 -0
- package/src/src/platform/adapters/veryfront-api-client/operations.ts +14 -14
- package/src/src/platform/adapters/veryfront-api-client/schemas/api.schema.ts +4 -4
- package/src/src/platform/index.ts +1 -0
- package/src/src/server/runtime-handler/index.ts +0 -3
- package/src/src/task/discovery.ts +7 -15
- package/src/src/workflow/discovery/workflow-discovery.ts +3 -9
- package/esm/src/server/handlers/request/internal-tasks-list.handler.d.ts +0 -11
- package/esm/src/server/handlers/request/internal-tasks-list.handler.d.ts.map +0 -1
- package/esm/src/server/handlers/request/internal-tasks-list.handler.js +0 -72
- package/esm/src/task/control-plane.d.ts +0 -105
- package/esm/src/task/control-plane.d.ts.map +0 -1
- package/esm/src/task/control-plane.js +0 -52
- package/src/src/server/handlers/request/internal-tasks-list.handler.ts +0 -103
- package/src/src/task/control-plane.ts +0 -76
|
@@ -89,7 +89,7 @@ export function buildFilesListUrl(projectSlug, source) {
|
|
|
89
89
|
case "release":
|
|
90
90
|
return `/projects/${projectSlug}/releases/${encodeURIComponent(source.version)}/files`;
|
|
91
91
|
case "branch":
|
|
92
|
-
return `/projects/${projectSlug}/
|
|
92
|
+
return `/projects/${projectSlug}/files?branch=${encodeURIComponent(source.name)}`;
|
|
93
93
|
case "main":
|
|
94
94
|
return `/projects/${projectSlug}/files`;
|
|
95
95
|
}
|
|
@@ -127,7 +127,7 @@ export function buildFileContentUrl(projectSlug, path, source) {
|
|
|
127
127
|
case "release":
|
|
128
128
|
return `/projects/${projectSlug}/releases/${encodeURIComponent(source.version)}/files/${encodedPath}`;
|
|
129
129
|
case "branch":
|
|
130
|
-
return `/projects/${projectSlug}/
|
|
130
|
+
return `/projects/${projectSlug}/files/${encodedPath}?branch=${encodeURIComponent(source.name)}`;
|
|
131
131
|
case "main":
|
|
132
132
|
return `/projects/${projectSlug}/files/${encodedPath}`;
|
|
133
133
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/task/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/task/command.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,WAAW,WAAY,SAAQ,QAAQ;CAAG;AAEhD,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA0FrE"}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import * as dntShim from "../../../_dnt.shims.js";
|
|
8
8
|
import { cliLogger } from "../../utils/index.js";
|
|
9
9
|
import { exitProcess } from "../../utils/index.js";
|
|
10
|
+
import { withProjectSourceContext } from "../../shared/project-source-context.js";
|
|
10
11
|
export async function taskCommand(options) {
|
|
11
|
-
const { getAdapter } = await import("../../../src/platform/adapters/detect.js");
|
|
12
12
|
const { discoverTasks } = await import("../../../src/task/discovery.js");
|
|
13
13
|
const { runTask } = await import("../../../src/task/runner.js");
|
|
14
14
|
const taskName = options.name;
|
|
@@ -18,62 +18,68 @@ export async function taskCommand(options) {
|
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
const projectDir = dntShim.Deno.cwd();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
cliLogger.info("Available tasks:");
|
|
38
|
-
for (const t of tasks) {
|
|
39
|
-
cliLogger.info(` - ${t.id}${t.name !== t.id ? ` (${t.name})` : ""}`);
|
|
21
|
+
await withProjectSourceContext(projectDir, async ({ adapter, config, projectId, proxyContext }) => {
|
|
22
|
+
const sourceLabel = proxyContext?.branchRef
|
|
23
|
+
? `branch ${proxyContext.branchRef}`
|
|
24
|
+
: proxyContext
|
|
25
|
+
? "main"
|
|
26
|
+
: `${projectDir}/tasks/...`;
|
|
27
|
+
cliLogger.info(`Discovering tasks in ${sourceLabel}`);
|
|
28
|
+
const { tasks, errors } = await discoverTasks({
|
|
29
|
+
projectDir,
|
|
30
|
+
adapter,
|
|
31
|
+
config,
|
|
32
|
+
debug: options.debug,
|
|
33
|
+
});
|
|
34
|
+
if (errors.length > 0 && options.debug) {
|
|
35
|
+
for (const err of errors) {
|
|
36
|
+
cliLogger.warn(` Warning: ${err.filePath}: ${err.error}`);
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
cliLogger.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
catch {
|
|
56
|
-
cliLogger.error("Invalid --config JSON");
|
|
39
|
+
const task = tasks.find((t) => t.id === taskName);
|
|
40
|
+
if (!task) {
|
|
41
|
+
cliLogger.error(`Task "${taskName}" not found.`);
|
|
42
|
+
if (tasks.length > 0) {
|
|
43
|
+
cliLogger.info("Available tasks:");
|
|
44
|
+
for (const t of tasks) {
|
|
45
|
+
cliLogger.info(` - ${t.id}${t.name !== t.id ? ` (${t.name})` : ""}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
cliLogger.info("No tasks found. Create a task file in tasks/ directory:");
|
|
50
|
+
cliLogger.info(" tasks/my-task.ts");
|
|
51
|
+
}
|
|
57
52
|
exitProcess(1);
|
|
58
53
|
return;
|
|
59
54
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
55
|
+
let taskConfig = {};
|
|
56
|
+
if (options.config) {
|
|
57
|
+
try {
|
|
58
|
+
taskConfig = JSON.parse(options.config);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
cliLogger.error("Invalid --config JSON");
|
|
62
|
+
exitProcess(1);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
cliLogger.info(`Running task: ${task.name} (${task.id})`);
|
|
67
|
+
cliLogger.info("");
|
|
68
|
+
const result = await runTask({
|
|
69
|
+
task,
|
|
70
|
+
config: taskConfig,
|
|
71
|
+
projectId,
|
|
72
|
+
debug: options.debug,
|
|
73
|
+
});
|
|
74
|
+
cliLogger.info("");
|
|
75
|
+
if (result.success) {
|
|
76
|
+
cliLogger.info(`Task completed in ${result.durationMs}ms`);
|
|
77
|
+
if (result.result !== undefined) {
|
|
78
|
+
cliLogger.info(`Result: ${JSON.stringify(result.result, null, 2)}`);
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
73
81
|
}
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
82
|
cliLogger.error(`Task failed after ${result.durationMs}ms: ${result.error}`);
|
|
77
83
|
exitProcess(1);
|
|
78
|
-
}
|
|
84
|
+
});
|
|
79
85
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-help.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/workflow/command-help.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,eAAO,MAAM,YAAY,EAAE,WAkB1B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const workflowHelp = {
|
|
2
|
+
name: "workflow",
|
|
3
|
+
description: "Run a workflow from the app/workflows directory",
|
|
4
|
+
usage: "veryfront workflow run <id> [options]",
|
|
5
|
+
options: [
|
|
6
|
+
{
|
|
7
|
+
flag: "--input <json>",
|
|
8
|
+
description: "JSON input to pass to the workflow",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
flag: "--debug",
|
|
12
|
+
description: "Enable debug logging",
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
examples: [
|
|
16
|
+
"veryfront workflow run publish-site",
|
|
17
|
+
'veryfront workflow run content-pipeline --input \'{"topic":"AI"}\'',
|
|
18
|
+
],
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/workflow/command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAIjD,MAAM,WAAW,eAAgB,SAAQ,YAAY;CAAG;AA2DxD,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAmF7E"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
|
+
import { cliLogger } from "../../utils/index.js";
|
|
3
|
+
import { exitProcess } from "../../utils/index.js";
|
|
4
|
+
import { withProjectSourceContext } from "../../shared/project-source-context.js";
|
|
5
|
+
import { getEnv } from "../../../src/platform/index.js";
|
|
6
|
+
const WORKFLOW_STATUS_POLL_INTERVAL_MS = 1_000;
|
|
7
|
+
async function createWorkflowClient(debug) {
|
|
8
|
+
const { createWorkflowClient } = await import("../../../src/workflow/api/workflow-client.js");
|
|
9
|
+
const redisUrl = getEnv("REDIS_URL")?.trim();
|
|
10
|
+
if (!redisUrl) {
|
|
11
|
+
return createWorkflowClient({ debug });
|
|
12
|
+
}
|
|
13
|
+
const { RedisBackend } = await import("../../../src/workflow/backends/redis.js");
|
|
14
|
+
const backend = new RedisBackend({ url: redisUrl, debug });
|
|
15
|
+
if (backend.initialize) {
|
|
16
|
+
await backend.initialize();
|
|
17
|
+
}
|
|
18
|
+
return createWorkflowClient({ backend, debug });
|
|
19
|
+
}
|
|
20
|
+
async function waitForWorkflowExit(client, runId) {
|
|
21
|
+
while (true) {
|
|
22
|
+
const run = await client.getRun(runId);
|
|
23
|
+
if (!run) {
|
|
24
|
+
throw new Error(`Workflow run not found: ${runId}`);
|
|
25
|
+
}
|
|
26
|
+
if (run.status === "completed") {
|
|
27
|
+
cliLogger.info(`Workflow completed: ${runId}`);
|
|
28
|
+
if (run.output !== undefined) {
|
|
29
|
+
cliLogger.info(`Result: ${JSON.stringify(run.output, null, 2)}`);
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (run.status === "waiting") {
|
|
34
|
+
cliLogger.info(`Workflow is waiting: ${runId}`);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (run.status === "failed") {
|
|
38
|
+
throw new Error(run.error?.message || `Workflow failed: ${runId}`);
|
|
39
|
+
}
|
|
40
|
+
if (run.status === "cancelled") {
|
|
41
|
+
throw new Error(`Workflow was cancelled: ${runId}`);
|
|
42
|
+
}
|
|
43
|
+
await new Promise((resolve) => dntShim.setTimeout(resolve, WORKFLOW_STATUS_POLL_INTERVAL_MS));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export async function workflowCommand(options) {
|
|
47
|
+
if (options.action !== "run") {
|
|
48
|
+
cliLogger.error(`Unknown workflow action: ${options.action}`);
|
|
49
|
+
exitProcess(1);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const workflowId = options.name;
|
|
53
|
+
if (!workflowId) {
|
|
54
|
+
cliLogger.error("Workflow ID is required. Usage: veryfront workflow run <id>");
|
|
55
|
+
exitProcess(1);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
let input = {};
|
|
59
|
+
if (options.input) {
|
|
60
|
+
try {
|
|
61
|
+
input = JSON.parse(options.input);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
cliLogger.error("Invalid --input JSON");
|
|
65
|
+
exitProcess(1);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const { discoverWorkflows } = await import("../../../src/workflow/discovery/index.js");
|
|
70
|
+
await withProjectSourceContext(dntShim.Deno.cwd(), async ({ adapter, config, proxyContext }) => {
|
|
71
|
+
const sourceLabel = proxyContext?.branchRef
|
|
72
|
+
? `branch ${proxyContext.branchRef}`
|
|
73
|
+
: proxyContext
|
|
74
|
+
? "main"
|
|
75
|
+
: `${dntShim.Deno.cwd()}/app/workflows/...`;
|
|
76
|
+
cliLogger.info(`Discovering workflows in ${sourceLabel}`);
|
|
77
|
+
const discovery = await discoverWorkflows({
|
|
78
|
+
projectDir: dntShim.Deno.cwd(),
|
|
79
|
+
adapter,
|
|
80
|
+
config,
|
|
81
|
+
debug: options.debug,
|
|
82
|
+
});
|
|
83
|
+
if (discovery.errors.length > 0 && options.debug) {
|
|
84
|
+
for (const err of discovery.errors) {
|
|
85
|
+
cliLogger.warn(` Warning: ${err.filePath}: ${err.error}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const workflow = discovery.workflows.find((candidate) => candidate.id === workflowId);
|
|
89
|
+
if (!workflow) {
|
|
90
|
+
cliLogger.error(`Workflow "${workflowId}" not found.`);
|
|
91
|
+
if (discovery.workflows.length > 0) {
|
|
92
|
+
cliLogger.info("Available workflows:");
|
|
93
|
+
for (const candidate of discovery.workflows) {
|
|
94
|
+
cliLogger.info(` - ${candidate.id}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
cliLogger.info("No workflows found. Create a workflow file in app/workflows/.");
|
|
99
|
+
}
|
|
100
|
+
exitProcess(1);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const client = await createWorkflowClient(options.debug);
|
|
104
|
+
try {
|
|
105
|
+
client.register(workflow.definition);
|
|
106
|
+
cliLogger.info(`Running workflow: ${workflow.id}`);
|
|
107
|
+
cliLogger.info("");
|
|
108
|
+
const handle = await client.start(workflow.id, input);
|
|
109
|
+
await waitForWorkflowExit(client, handle.runId);
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
await client.destroy();
|
|
113
|
+
}
|
|
114
|
+
}).catch((error) => {
|
|
115
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
116
|
+
cliLogger.error(message);
|
|
117
|
+
exitProcess(1);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ParsedArgs } from "../../shared/types.js";
|
|
3
|
+
declare const WorkflowArgsSchema: z.ZodObject<{
|
|
4
|
+
action: z.ZodEnum<["run"]>;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
input: z.ZodOptional<z.ZodString>;
|
|
7
|
+
debug: z.ZodDefault<z.ZodBoolean>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
name: string;
|
|
10
|
+
debug: boolean;
|
|
11
|
+
action: "run";
|
|
12
|
+
input?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
name: string;
|
|
15
|
+
action: "run";
|
|
16
|
+
input?: string | undefined;
|
|
17
|
+
debug?: boolean | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export type WorkflowArgs = z.infer<typeof WorkflowArgsSchema>;
|
|
20
|
+
export declare const parseWorkflowArgs: (args: ParsedArgs) => z.SafeParseReturnType<unknown, {
|
|
21
|
+
name: string;
|
|
22
|
+
debug: boolean;
|
|
23
|
+
action: "run";
|
|
24
|
+
input?: string | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
export declare function handleWorkflowCommand(args: ParsedArgs): Promise<void>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/workflow/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;EAKtB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,iBAAiB;;;;;EAK5B,CAAC;AAEH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAI3E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createArgParser, parseArgsOrThrow } from "../../shared/args.js";
|
|
3
|
+
const WorkflowArgsSchema = z.object({
|
|
4
|
+
action: z.enum(["run"]),
|
|
5
|
+
name: z.string(),
|
|
6
|
+
input: z.string().optional(),
|
|
7
|
+
debug: z.boolean().default(false),
|
|
8
|
+
});
|
|
9
|
+
export const parseWorkflowArgs = createArgParser(WorkflowArgsSchema, {
|
|
10
|
+
action: { keys: ["action"], type: "string", positional: 0 },
|
|
11
|
+
name: { keys: ["name"], type: "string", positional: 1 },
|
|
12
|
+
input: { keys: ["input"], type: "string" },
|
|
13
|
+
debug: { keys: ["debug"], type: "boolean" },
|
|
14
|
+
});
|
|
15
|
+
export async function handleWorkflowCommand(args) {
|
|
16
|
+
const opts = parseArgsOrThrow(parseWorkflowArgs, "workflow", args);
|
|
17
|
+
const { workflowCommand } = await import("./command.js");
|
|
18
|
+
await workflowCommand(opts);
|
|
19
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-definitions.d.ts","sourceRoot":"","sources":["../../../src/cli/help/command-definitions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"command-definitions.d.ts","sourceRoot":"","sources":["../../../src/cli/help/command-definitions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAiClD;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,eA+BtB,CAAC"}
|
|
@@ -33,6 +33,7 @@ import { mcpHelp } from "../commands/mcp/command-help.js";
|
|
|
33
33
|
import { issuesHelp } from "../commands/issues/command-help.js";
|
|
34
34
|
import { startHelp } from "../commands/start/command-help.js";
|
|
35
35
|
import { taskHelp } from "../commands/task/command-help.js";
|
|
36
|
+
import { workflowHelp } from "../commands/workflow/command-help.js";
|
|
36
37
|
/**
|
|
37
38
|
* Central registry of all command help definitions.
|
|
38
39
|
* Each command's help is imported from its respective command-help.ts file.
|
|
@@ -67,4 +68,5 @@ export const COMMANDS = {
|
|
|
67
68
|
issues: issuesHelp,
|
|
68
69
|
start: startHelp,
|
|
69
70
|
task: taskHelp,
|
|
71
|
+
workflow: workflowHelp,
|
|
70
72
|
};
|
package/esm/cli/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/cli/router.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/cli/router.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoCH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AA2DpD;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAwClE"}
|
package/esm/cli/router.js
CHANGED
|
@@ -30,6 +30,7 @@ import { handleStartCommand } from "./commands/start/handler.js";
|
|
|
30
30
|
import { handleStudioCommand } from "./commands/studio/handler.js";
|
|
31
31
|
import { handleUpCommand } from "./commands/up/index.js";
|
|
32
32
|
import { handleTaskCommand } from "./commands/task/handler.js";
|
|
33
|
+
import { handleWorkflowCommand } from "./commands/workflow/handler.js";
|
|
33
34
|
import { handleWorkerCommand } from "./commands/worker/handler.js";
|
|
34
35
|
import { login, logout, whoami } from "./auth/index.js";
|
|
35
36
|
import { parseLoginMethod } from "./auth/utils.js";
|
|
@@ -78,6 +79,7 @@ const commands = {
|
|
|
78
79
|
"issues": handleIssuesCommand,
|
|
79
80
|
"start": handleStartCommand,
|
|
80
81
|
"task": handleTaskCommand,
|
|
82
|
+
"workflow": handleWorkflowCommand,
|
|
81
83
|
"worker": handleWorkerCommand,
|
|
82
84
|
};
|
|
83
85
|
/**
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type VeryfrontConfig } from "../../src/config/index.js";
|
|
2
|
+
import { type RuntimeAdapter } from "../../src/platform/index.js";
|
|
3
|
+
interface ProxyProjectSourceContext {
|
|
4
|
+
projectSlug: string;
|
|
5
|
+
token: string;
|
|
6
|
+
projectId?: string;
|
|
7
|
+
branchRef?: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface ProjectSourceExecutionContext {
|
|
10
|
+
adapter: RuntimeAdapter;
|
|
11
|
+
config: VeryfrontConfig;
|
|
12
|
+
projectDir: string;
|
|
13
|
+
projectId?: string;
|
|
14
|
+
proxyContext?: ProxyProjectSourceContext;
|
|
15
|
+
}
|
|
16
|
+
export declare function withProjectSourceContext<T>(projectDir: string, run: (context: ProjectSourceExecutionContext) => Promise<T>): Promise<T>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=project-source-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-source-context.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/project-source-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,6BAA6B,CAAC;AAErC,UAAU,yBAAyB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,yBAAyB,CAAC;CAC1C;AA8BD,wBAAsB,wBAAwB,CAAC,CAAC,EAC9C,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,CAAC,OAAO,EAAE,6BAA6B,KAAK,OAAO,CAAC,CAAC,CAAC,GAC1D,OAAO,CAAC,CAAC,CAAC,CAwCZ"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { getConfig } from "../../src/config/index.js";
|
|
2
|
+
import { enhanceAdapterWithFS, getEnv, isExtendedFSAdapter, runtime, } from "../../src/platform/index.js";
|
|
3
|
+
function getProxyProjectSourceContext() {
|
|
4
|
+
const projectSlug = getEnv("VERYFRONT_PROJECT_SLUG")?.trim();
|
|
5
|
+
const token = getEnv("VERYFRONT_API_TOKEN")?.trim();
|
|
6
|
+
if (!projectSlug || !token) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const projectId = getEnv("VERYFRONT_PROJECT_ID")?.trim();
|
|
10
|
+
const branchRef = getEnv("VERYFRONT_BRANCH_REF")?.trim();
|
|
11
|
+
return {
|
|
12
|
+
projectSlug,
|
|
13
|
+
token,
|
|
14
|
+
projectId: projectId || undefined,
|
|
15
|
+
branchRef: branchRef || null,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
async function loadProjectConfig(projectDir, adapter, proxyContext) {
|
|
19
|
+
const cacheKey = proxyContext?.projectId ?? proxyContext?.projectSlug;
|
|
20
|
+
return await getConfig(projectDir, adapter, cacheKey ? { cacheKey } : undefined);
|
|
21
|
+
}
|
|
22
|
+
export async function withProjectSourceContext(projectDir, run) {
|
|
23
|
+
const baseAdapter = await runtime.get();
|
|
24
|
+
const initialConfig = await getConfig(projectDir, baseAdapter);
|
|
25
|
+
const adapter = await enhanceAdapterWithFS(baseAdapter, initialConfig, projectDir);
|
|
26
|
+
const proxyContext = getProxyProjectSourceContext();
|
|
27
|
+
if (proxyContext &&
|
|
28
|
+
isExtendedFSAdapter(adapter.fs) &&
|
|
29
|
+
adapter.fs.isMultiProjectMode()) {
|
|
30
|
+
return await adapter.fs.runWithContext(proxyContext.projectSlug, proxyContext.token, async () => {
|
|
31
|
+
const config = await loadProjectConfig(projectDir, adapter, proxyContext);
|
|
32
|
+
return await run({
|
|
33
|
+
adapter,
|
|
34
|
+
config,
|
|
35
|
+
projectDir,
|
|
36
|
+
projectId: proxyContext.projectId,
|
|
37
|
+
proxyContext,
|
|
38
|
+
});
|
|
39
|
+
}, proxyContext.projectId, {
|
|
40
|
+
productionMode: false,
|
|
41
|
+
branch: proxyContext.branchRef ?? null,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const config = await loadProjectConfig(projectDir, adapter);
|
|
45
|
+
return await run({
|
|
46
|
+
adapter,
|
|
47
|
+
config,
|
|
48
|
+
projectDir,
|
|
49
|
+
projectId: proxyContext?.projectId,
|
|
50
|
+
proxyContext: proxyContext ?? undefined,
|
|
51
|
+
});
|
|
52
|
+
}
|
package/esm/deno.d.ts
CHANGED
|
@@ -104,6 +104,7 @@ declare namespace _default {
|
|
|
104
104
|
"#cli/shared/types": string;
|
|
105
105
|
"#cli/shared/constants": string;
|
|
106
106
|
"#cli/shared/config": string;
|
|
107
|
+
"#cli/shared/project-source-context": string;
|
|
107
108
|
"#cli/shared/slug": string;
|
|
108
109
|
"#cli/shared/reserve-slug": string;
|
|
109
110
|
"#cli/shared/server-startup": string;
|
package/esm/deno.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.78",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"exclude": [
|
|
@@ -114,6 +114,7 @@ export default {
|
|
|
114
114
|
"#cli/shared/types": "./cli/shared/types.ts",
|
|
115
115
|
"#cli/shared/constants": "./cli/shared/constants.ts",
|
|
116
116
|
"#cli/shared/config": "./cli/shared/config.ts",
|
|
117
|
+
"#cli/shared/project-source-context": "./cli/shared/project-source-context.ts",
|
|
117
118
|
"#cli/shared/slug": "./cli/shared/slug.ts",
|
|
118
119
|
"#cli/shared/reserve-slug": "./cli/shared/reserve-slug.ts",
|
|
119
120
|
"#cli/shared/server-startup": "./cli/shared/server-startup.ts",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RuntimeAdapter } from "../platform/index.js";
|
|
2
|
+
interface ImportDiscoveryModuleOptions {
|
|
3
|
+
adapter: RuntimeAdapter;
|
|
4
|
+
projectDir?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function importDiscoveryModule(filePath: string, options: ImportDiscoveryModuleOptions): Promise<Record<string, unknown>>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=module-import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-import.d.ts","sourceRoot":"","sources":["../../../src/src/discovery/module-import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAK3D,UAAU,4BAA4B;IACpC,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAgBD,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAQlC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { detectPlatform } from "../platform/core-platform.js";
|
|
2
|
+
import * as pathHelper from "../platform/compat/path/index.js";
|
|
3
|
+
import { importModule } from "./transpiler.js";
|
|
4
|
+
function normalizeModulePath(filePath) {
|
|
5
|
+
return filePath.startsWith("file://") ? filePath : `file://${filePath}`;
|
|
6
|
+
}
|
|
7
|
+
function resolveModulePath(filePath, projectDir) {
|
|
8
|
+
if (filePath.startsWith("file://"))
|
|
9
|
+
return filePath;
|
|
10
|
+
if (pathHelper.isAbsolute(filePath))
|
|
11
|
+
return normalizeModulePath(filePath);
|
|
12
|
+
if (!projectDir || projectDir === "." || projectDir === "") {
|
|
13
|
+
return normalizeModulePath(`/${filePath.replace(/^\/+/, "")}`);
|
|
14
|
+
}
|
|
15
|
+
return normalizeModulePath(pathHelper.join(projectDir, filePath));
|
|
16
|
+
}
|
|
17
|
+
export async function importDiscoveryModule(filePath, options) {
|
|
18
|
+
const module = await importModule(resolveModulePath(filePath, options.projectDir), {
|
|
19
|
+
platform: detectPlatform(),
|
|
20
|
+
fsAdapter: options.adapter.fs,
|
|
21
|
+
baseDir: options.projectDir || ".",
|
|
22
|
+
});
|
|
23
|
+
return module;
|
|
24
|
+
}
|
|
@@ -43,9 +43,9 @@ export declare class VeryfrontAPIOperations {
|
|
|
43
43
|
sortOrder?: "asc" | "desc";
|
|
44
44
|
}): Promise<Project[]>;
|
|
45
45
|
getProject(projectRef: string): Promise<Project>;
|
|
46
|
-
listBranchFiles(projectRef: string,
|
|
47
|
-
listAllBranchFiles(projectRef: string,
|
|
48
|
-
getBranchFile(projectRef: string,
|
|
46
|
+
listBranchFiles(projectRef: string, branchRef?: string, options?: ListFilesOptions): Promise<FileListResult>;
|
|
47
|
+
listAllBranchFiles(projectRef: string, branchRef?: string, options?: Omit<ListFilesOptions, "cursor">): Promise<ProjectFile[]>;
|
|
48
|
+
getBranchFile(projectRef: string, branchRef: string, pathOrId: string): Promise<FileDetail>;
|
|
49
49
|
listEnvironmentFiles(projectRef: string, environmentName?: string, options?: ListFilesOptions): Promise<FileListResult>;
|
|
50
50
|
listAllEnvironmentFiles(projectRef: string, environmentName?: string, options?: Omit<ListFilesOptions, "cursor">): Promise<ProjectFile[]>;
|
|
51
51
|
getEnvironmentFile(projectRef: string, environmentName: string, pathOrId: string): Promise<FileDetail>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/adapters/veryfront-api-client/operations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EAOL,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,WAAW,EAGjB,MAAM,oBAAoB,CAAC;AAQ5B,MAAM,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC;AAEzC,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAC/B,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,SAAS,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AA6CD,qBAAa,sBAAsB;IAI/B,OAAO,CAAC,UAAU;IAElB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,SAAS,CAAC;IANpB,OAAO,CAAC,aAAa,CAAgB;gBAG3B,UAAU,EAAE,MAAM,EAC1B,eAAe,EAAE,MAAM,GAAG,aAAa,EAC/B,WAAW,EAAE,WAAW,EACxB,SAAS,CAAC,EAAE,MAAM,YAAA;IAO5B,gBAAgB,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAI/C,QAAQ,IAAI,MAAM;IAIlB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAIrC,YAAY,IAAI,MAAM;IAQhB,YAAY,CAAC,OAAO,CAAC,EAAE;QAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;KAC5B,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAYhB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKhD,eAAe,CACnB,UAAU,EAAE,MAAM,EAClB,
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/adapters/veryfront-api-client/operations.ts"],"names":[],"mappings":"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"}
|
|
@@ -88,10 +88,11 @@ export class VeryfrontAPIOperations {
|
|
|
88
88
|
const raw = await this.request(`/projects/${encodeURIComponent(projectRef)}`);
|
|
89
89
|
return ProjectSchema.parse(raw);
|
|
90
90
|
}
|
|
91
|
-
async listBranchFiles(projectRef,
|
|
91
|
+
async listBranchFiles(projectRef, branchRef = "main", options = {}) {
|
|
92
92
|
const params = buildListParams(options);
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
params.set("branch", branchRef);
|
|
94
|
+
const url = `/projects/${encodeURIComponent(projectRef)}/files?${params}`;
|
|
95
|
+
logger.debug("listBranchFiles", { projectRef, branchRef, pattern: options.pattern });
|
|
95
96
|
const raw = await this.request(url);
|
|
96
97
|
const response = ListBranchFilesResponseSchema.parse(raw);
|
|
97
98
|
return {
|
|
@@ -99,23 +100,24 @@ export class VeryfrontAPIOperations {
|
|
|
99
100
|
page_info: response.page_info,
|
|
100
101
|
};
|
|
101
102
|
}
|
|
102
|
-
async listAllBranchFiles(projectRef,
|
|
103
|
-
const allFiles = await listAllFiles((cursor) => this.listBranchFiles(projectRef,
|
|
103
|
+
async listAllBranchFiles(projectRef, branchRef = "main", options = {}) {
|
|
104
|
+
const allFiles = await listAllFiles((cursor) => this.listBranchFiles(projectRef, branchRef, {
|
|
104
105
|
...options,
|
|
105
106
|
cursor,
|
|
106
107
|
limit: DEFAULT_PAGE_LIMIT,
|
|
107
108
|
}));
|
|
108
109
|
logger.debug("listAllBranchFiles DONE", {
|
|
109
110
|
projectRef,
|
|
110
|
-
|
|
111
|
+
branchRef,
|
|
111
112
|
totalFiles: allFiles.length,
|
|
112
113
|
});
|
|
113
114
|
return allFiles;
|
|
114
115
|
}
|
|
115
|
-
getBranchFile(projectRef,
|
|
116
|
+
getBranchFile(projectRef, branchRef, pathOrId) {
|
|
116
117
|
return withSpan(SpanNames.API_GET_FILE, async () => {
|
|
117
|
-
const
|
|
118
|
-
|
|
118
|
+
const params = new URLSearchParams({ branch: branchRef });
|
|
119
|
+
const url = `/projects/${encodeURIComponent(projectRef)}/files/${encodeURIComponent(pathOrId)}?${params}`;
|
|
120
|
+
logger.debug("getBranchFile", { projectRef, branchRef, pathOrId });
|
|
119
121
|
const raw = await this.request(url);
|
|
120
122
|
const response = BranchFileDetailSchema.parse(raw);
|
|
121
123
|
return {
|
|
@@ -128,7 +130,7 @@ export class VeryfrontAPIOperations {
|
|
|
128
130
|
}, {
|
|
129
131
|
"api.operation": "getBranchFile",
|
|
130
132
|
"api.project": projectRef,
|
|
131
|
-
"api.branch":
|
|
133
|
+
"api.branch": branchRef,
|
|
132
134
|
"api.path": pathOrId,
|
|
133
135
|
});
|
|
134
136
|
}
|