blokctl 0.6.20 → 0.6.21

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.
@@ -17,7 +17,7 @@ const exec = util.promisify(child_process.exec);
17
17
  const HOME_DIR = `${os.homedir()}/.blok`;
18
18
  const GITHUB_REPO_LOCAL = `${HOME_DIR}/blok`;
19
19
  const GITHUB_REPO_REMOTE = "https://github.com/well-prado/blok.git";
20
- const GITHUB_REPO_RELEASE_TAG = "v0.6.20";
20
+ const GITHUB_REPO_RELEASE_TAG = "v0.6.21";
21
21
  const RUNTIME_HELLO_EXAMPLES = {
22
22
  go: "runtime-go-hello.ts",
23
23
  rust: "runtime-rust-hello.ts",
@@ -515,7 +515,7 @@ export async function createProject(opts, version, currentPath = false, localRep
515
515
  "@blokjs/trigger-websocket": "triggers/websocket",
516
516
  "@blokjs/trigger-worker": "triggers/worker",
517
517
  };
518
- const BLOKJS_DEP_RANGE = "^0.6.20";
518
+ const BLOKJS_DEP_RANGE = "^0.6.21";
519
519
  for (const depGroup of ["dependencies", "devDependencies", "peerDependencies"]) {
520
520
  const deps = packageJsonContent[depGroup];
521
521
  if (!deps)
@@ -126,6 +126,35 @@ async function collectTsFiles(dir) {
126
126
  }
127
127
  return out;
128
128
  }
129
+ async function collectJsonWorkflowNames(dir) {
130
+ const names = [];
131
+ let dirents;
132
+ try {
133
+ dirents = await fsp.readdir(dir, { withFileTypes: true });
134
+ }
135
+ catch {
136
+ return names;
137
+ }
138
+ for (const d of dirents) {
139
+ if (d.name.startsWith("_") || d.name.startsWith("."))
140
+ continue;
141
+ const full = path.join(dir, d.name);
142
+ if (d.isDirectory()) {
143
+ names.push(...(await collectJsonWorkflowNames(full)));
144
+ }
145
+ else if (d.name.endsWith(".json")) {
146
+ try {
147
+ const parsed = JSON.parse(await fsp.readFile(full, "utf8"));
148
+ if (typeof parsed.name === "string" && (parsed.trigger !== undefined || parsed.steps !== undefined)) {
149
+ names.push(parsed.name);
150
+ }
151
+ }
152
+ catch {
153
+ }
154
+ }
155
+ }
156
+ return names;
157
+ }
129
158
  async function resolveWorkflowsDir(cwd, explicit) {
130
159
  const candidates = explicit
131
160
  ? [explicit]
@@ -159,6 +188,14 @@ export async function generateAppTypes(opts) {
159
188
  : path.join(cwd, opts.out ?? "blok-app.d.ts");
160
189
  console.log(color.dim(`Scanning ${color.cyan(dir)} (recursive)\n`));
161
190
  const files = await collectTsFiles(dir);
191
+ const jsonScanDirs = [dir, path.join(cwd, "workflows/json"), path.join(cwd, "triggers/http/workflows/json")];
192
+ const jsonNames = [...new Set((await Promise.all(jsonScanDirs.map((d) => collectJsonWorkflowNames(d)))).flat())];
193
+ const warnJsonSkipped = () => {
194
+ if (jsonNames.length === 0)
195
+ return;
196
+ console.log(color.yellow(`ℹ️ ${jsonNames.length} JSON workflow(s) are NOT in app-types (JSON has no TS type to import): ${jsonNames.join(", ")}.`));
197
+ console.log(color.dim(" Convert them to TS workflows to type them, or call them by string name on the client.\n"));
198
+ };
162
199
  const entries = [];
163
200
  const skipped = [];
164
201
  for (const file of files) {
@@ -173,6 +210,7 @@ export async function generateAppTypes(opts) {
173
210
  console.log(color.yellow("No TS workflows with a literal `name:` found — nothing to generate."));
174
211
  if (skipped.length > 0)
175
212
  console.log(color.dim(`Skipped (no literal name): ${skipped.join(", ")}`));
213
+ warnJsonSkipped();
176
214
  return;
177
215
  }
178
216
  const { source, collisions } = buildAppTypeSource(entries, outFile);
@@ -191,5 +229,6 @@ export async function generateAppTypes(opts) {
191
229
  if (skipped.length > 0) {
192
230
  console.log(color.dim(`ℹ️ Skipped ${skipped.length} file(s) without a literal workflow name (dynamic name or not a workflow): ${skipped.join(", ")}`));
193
231
  }
194
- console.log(color.dim('\nNext: `import type { BlokApp } from "<out>"` and `createBlokClient<BlokApp>({ baseUrl })`.\n'));
232
+ warnJsonSkipped();
233
+ console.log(color.dim('Next: `import type { BlokApp } from "<out>"` and `createBlokClient<BlokApp>({ baseUrl })`.\n'));
195
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blokctl",
3
- "version": "0.6.20",
3
+ "version": "0.6.21",
4
4
  "author": "Deskree Technologies Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "description": "cli for blok",
@@ -30,7 +30,7 @@
30
30
  "keywords": ["blokctl", "cli", "blok", "blok"],
31
31
  "dependencies": {
32
32
  "@ai-sdk/openai": "^1.3.22",
33
- "@blokjs/runner": "^0.6.20",
33
+ "@blokjs/runner": "^0.6.21",
34
34
  "@clack/prompts": "^1.0.0",
35
35
  "ai": "^4.3.16",
36
36
  "better-sqlite3": "^12.6.2",