@boardwalk-labs/cli 0.1.8 → 0.1.9
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/commands/build.js +2 -2
- package/dist/commands/check.js +1 -1
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.js +21 -5
- package/dist/commands/init.js.map +1 -1
- package/dist/deployment.js +2 -2
- package/dist/manifest.d.ts +3 -3
- package/dist/manifest.js +10 -10
- package/package.json +3 -3
package/dist/commands/build.js
CHANGED
|
@@ -19,10 +19,10 @@ export async function runBuild(opts, deps = {}) {
|
|
|
19
19
|
// Validate before bundling: precise manifest errors here, and the name seeds the default output.
|
|
20
20
|
const manifest = extractValidatedManifest(readFileSync(entry, "utf8"), entry);
|
|
21
21
|
const program = await bundleWorkflow(entry);
|
|
22
|
-
const outPath = resolve(opts.out ?? `${manifest.
|
|
22
|
+
const outPath = resolve(opts.out ?? `${manifest.slug}.mjs`);
|
|
23
23
|
mkdirSync(dirname(outPath), { recursive: true });
|
|
24
24
|
writeFileSync(outPath, program, "utf8");
|
|
25
|
-
log(`built "${manifest.
|
|
25
|
+
log(`built "${manifest.slug}" → ${outPath}`);
|
|
26
26
|
return outPath;
|
|
27
27
|
}
|
|
28
28
|
//# sourceMappingURL=build.js.map
|
package/dist/commands/check.js
CHANGED
|
@@ -22,7 +22,7 @@ export async function runCheck(opts, deps = {}) {
|
|
|
22
22
|
// Build the artifact (esbuild bundle + assets) — proves the program compiles end-to-end.
|
|
23
23
|
const artifact = await buildArtifact(opts.file);
|
|
24
24
|
const assets = artifact.assetPaths.length;
|
|
25
|
-
log(`✓ "${manifest.
|
|
25
|
+
log(`✓ "${manifest.slug}" is valid`);
|
|
26
26
|
log(` entry: ${artifact.entry}`);
|
|
27
27
|
log(` triggers: ${manifest.triggers.map((t) => t.kind).join(", ")}`);
|
|
28
28
|
const secrets = manifest.permissions?.secrets;
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ export interface InitDeps {
|
|
|
8
8
|
env?: NodeJS.ProcessEnv;
|
|
9
9
|
}
|
|
10
10
|
export declare function runInit(opts: InitOptions, deps?: InitDeps): Promise<void>;
|
|
11
|
-
/** Derive a manifest-legal workflow
|
|
11
|
+
/** Derive a manifest-legal workflow slug from the target directory's basename. */
|
|
12
12
|
export declare function workflowNameFor(absDir: string): string;
|
package/dist/commands/init.js
CHANGED
|
@@ -17,7 +17,8 @@ const DEFAULT_TEMPLATES_URL = "https://raw.githubusercontent.com/boardwalk-labs/
|
|
|
17
17
|
const HELLO_PROGRAM = `import { input, output, type WorkflowMeta } from "@boardwalk-labs/workflow";
|
|
18
18
|
|
|
19
19
|
export const meta = {
|
|
20
|
-
|
|
20
|
+
slug: "{{slug}}",
|
|
21
|
+
title: "{{title}}",
|
|
21
22
|
description: "A starting point — run it locally with \`boardwalk dev\`.",
|
|
22
23
|
triggers: [{ kind: "manual" }],
|
|
23
24
|
} satisfies WorkflowMeta;
|
|
@@ -65,10 +66,17 @@ export async function runInit(opts, deps = {}) {
|
|
|
65
66
|
const builtin = BUILTIN_TEMPLATES[opts.template];
|
|
66
67
|
if (builtin !== undefined) {
|
|
67
68
|
const dir = resolve(opts.dir);
|
|
68
|
-
const
|
|
69
|
-
const
|
|
69
|
+
const slug = workflowNameFor(dir);
|
|
70
|
+
const title = titleCaseSlug(slug);
|
|
71
|
+
const files = Object.fromEntries(Object.entries(builtin).map(([rel, body]) => [
|
|
72
|
+
rel,
|
|
73
|
+
body
|
|
74
|
+
.replaceAll("{{slug}}", slug)
|
|
75
|
+
.replaceAll("{{title}}", title)
|
|
76
|
+
.replaceAll("{{name}}", slug),
|
|
77
|
+
]));
|
|
70
78
|
scaffold(dir, files);
|
|
71
|
-
finish(log, opts,
|
|
79
|
+
finish(log, opts, slug, opts.template, []);
|
|
72
80
|
return;
|
|
73
81
|
}
|
|
74
82
|
// Remote template: registry lookup, then fetch each listed file.
|
|
@@ -158,7 +166,7 @@ function isRegistryTemplate(value) {
|
|
|
158
166
|
value.files.every((f) => typeof f === "string") &&
|
|
159
167
|
value.files.length > 0);
|
|
160
168
|
}
|
|
161
|
-
/** Derive a manifest-legal workflow
|
|
169
|
+
/** Derive a manifest-legal workflow slug from the target directory's basename. */
|
|
162
170
|
export function workflowNameFor(absDir) {
|
|
163
171
|
const base = basename(absDir)
|
|
164
172
|
.toLowerCase()
|
|
@@ -167,4 +175,12 @@ export function workflowNameFor(absDir) {
|
|
|
167
175
|
.slice(0, 100);
|
|
168
176
|
return base.length > 0 ? base : "my-workflow";
|
|
169
177
|
}
|
|
178
|
+
/** A human-friendly title from a slug: "morning-digest" → "Morning Digest". */
|
|
179
|
+
function titleCaseSlug(slug) {
|
|
180
|
+
return slug
|
|
181
|
+
.split("-")
|
|
182
|
+
.filter((s) => s.length > 0)
|
|
183
|
+
.map((s) => s.charAt(0).toUpperCase() + s.slice(1))
|
|
184
|
+
.join(" ");
|
|
185
|
+
}
|
|
170
186
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,4DAA4D;AAC5D,EAAE;AACF,yEAAyE;AACzE,uEAAuE;AACvE,wFAAwF;AACxF,+DAA+D;AAC/D,EAAE;AACF,6EAA6E;AAE7E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAaxC,mFAAmF;AACnF,MAAM,qBAAqB,GAAG,gEAAgE,CAAC;AAE/F,2FAA2F;AAE3F,MAAM,aAAa,GAAG
|
|
1
|
+
{"version":3,"file":"init.js","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GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAClD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
|
package/dist/deployment.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// 3. upload the artifact, then update the linked workflow BY ID (rename-safe) — or, when unlinked,
|
|
11
11
|
// adopt an existing same-name workflow / create a new one — then (re)write the link.
|
|
12
12
|
import { CliError } from "./errors.js";
|
|
13
|
-
import {
|
|
13
|
+
import { extractWorkflowSlug } from "./manifest.js";
|
|
14
14
|
import { buildArtifact } from "./artifact.js";
|
|
15
15
|
import { projectDirFor, readLink, writeLink } from "./project.js";
|
|
16
16
|
/**
|
|
@@ -19,7 +19,7 @@ import { projectDirFor, readLink, writeLink } from "./project.js";
|
|
|
19
19
|
*/
|
|
20
20
|
export async function loadProgram(file) {
|
|
21
21
|
const artifact = await buildArtifact(file);
|
|
22
|
-
const name =
|
|
22
|
+
const name = extractWorkflowSlug(artifact.entrySource, artifact.entry);
|
|
23
23
|
return { name, entry: artifact.entry, artifact };
|
|
24
24
|
}
|
|
25
25
|
/** Decide create vs update by matching the program name against the org's existing workflows. */
|
package/dist/manifest.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type WorkflowManifest } from "@boardwalk-labs/workflow";
|
|
2
2
|
/**
|
|
3
|
-
* Statically read `export const meta = {
|
|
4
|
-
* Throws `CliError` when there is no pure-literal `meta` or `
|
|
3
|
+
* Statically read `export const meta = { slug: "...", ... }` and return the slug string.
|
|
4
|
+
* Throws `CliError` when there is no pure-literal `meta` or `slug` is missing/empty/not a string.
|
|
5
5
|
*/
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function extractWorkflowSlug(source: string, fileName?: string): string;
|
|
7
7
|
/**
|
|
8
8
|
* Statically extract `meta` and validate it against the manifest schema (the same one every
|
|
9
9
|
* engine consumes), returning the fully-defaulted manifest. Throws `CliError` with the precise
|
package/dist/manifest.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// translating extraction/validation failures into actionable `CliError`s.
|
|
4
4
|
//
|
|
5
5
|
// Two tiers, on purpose:
|
|
6
|
-
// - `
|
|
7
|
-
// is matched by
|
|
6
|
+
// - `extractWorkflowSlug` — slug only. `deploy`/`run` need the deploy identity (create-vs-update
|
|
7
|
+
// is matched by SLUG, which is environment-independent, unlike a path or stored id); the server
|
|
8
8
|
// re-derives and validates the FULL manifest from the uploaded source, so the CLI doesn't
|
|
9
9
|
// pre-judge field-level validity on the way to a deploy.
|
|
10
10
|
// - `extractValidatedManifest` — the full schema. `check` and `dev` run entirely locally, so they
|
|
@@ -15,18 +15,18 @@ import { extractManifest, extractMetaLiteral, MetaExtractionError, } from "@boar
|
|
|
15
15
|
import { MetaValidationError } from "@boardwalk-labs/workflow";
|
|
16
16
|
import { CliError } from "./errors.js";
|
|
17
17
|
/**
|
|
18
|
-
* Statically read `export const meta = {
|
|
19
|
-
* Throws `CliError` when there is no pure-literal `meta` or `
|
|
18
|
+
* Statically read `export const meta = { slug: "...", ... }` and return the slug string.
|
|
19
|
+
* Throws `CliError` when there is no pure-literal `meta` or `slug` is missing/empty/not a string.
|
|
20
20
|
*/
|
|
21
|
-
export function
|
|
21
|
+
export function extractWorkflowSlug(source, fileName = "index.ts") {
|
|
22
22
|
const meta = extractLiteralOrThrow(source, fileName);
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
throw new CliError("`meta.
|
|
23
|
+
const slug = meta.slug;
|
|
24
|
+
if (slug !== undefined && typeof slug !== "string") {
|
|
25
|
+
throw new CliError("`meta.slug` must be a plain string literal.");
|
|
26
26
|
}
|
|
27
|
-
const trimmed = typeof
|
|
27
|
+
const trimmed = typeof slug === "string" ? slug.trim() : "";
|
|
28
28
|
if (trimmed.length === 0) {
|
|
29
|
-
throw new CliError("`meta.
|
|
29
|
+
throw new CliError("`meta.slug` is missing or empty.", "Give the workflow a stable slug — it's the deploy identity used to match create vs update.");
|
|
30
30
|
}
|
|
31
31
|
return trimmed;
|
|
32
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boardwalk-labs/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "The boardwalk CLI: author, validate, run, and deploy Boardwalk workflows.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"boardwalk": "tsx src/index.ts"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@boardwalk-labs/engine": "^0.1.
|
|
39
|
-
"@boardwalk-labs/workflow": "^0.1.
|
|
38
|
+
"@boardwalk-labs/engine": "^0.1.4",
|
|
39
|
+
"@boardwalk-labs/workflow": "^0.1.5",
|
|
40
40
|
"commander": "^13.1.0",
|
|
41
41
|
"env-paths": "^3.0.0",
|
|
42
42
|
"esbuild": "^0.25.0",
|