@darkrymit/crunes-cli 0.14.1 → 0.14.3

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.
@@ -212,7 +212,7 @@ async function createScriptRune({ key, lang, runeRelPath, name, description, con
212
212
  output.info(`Run: crunes run ${key}`);
213
213
  }
214
214
  function template(key, format) {
215
- const imports = format === "tree" ? `import { md, section, tree } from '@utils'` : `import { md, section } from '@utils'`;
215
+ const imports = format === "tree" ? `import { md, rune, section, tree } from '@utils'` : `import { md, rune, section } from '@utils'`;
216
216
  const header = [
217
217
  `// permissions:`,
218
218
  `// run:`,
@@ -221,17 +221,19 @@ function template(key, format) {
221
221
  ``,
222
222
  imports,
223
223
  ``,
224
- `// export async function args(b) {`,
225
- `// return b`,
226
- `// .option('-v, --verbose', 'Verbose output', false)`,
227
- `// .build()`,
228
- `// }`,
224
+ `export async function args(b) {`,
225
+ ` return b`,
226
+ ` .option('-h, --help', 'Show help')`,
227
+ ` .option('-v, --verbose', 'Verbose output', false)`,
228
+ `}`,
229
229
  ``,
230
230
  `export async function run(args) {`,
231
+ ` const stop = rune.guard(args)`,
232
+ ` if (stop) return stop`,
233
+ ``,
231
234
  ` // args._ \u2014 data positionals (command tokens stripped)`,
232
235
  ` // args.$rest \u2014 unmapped positional arguments`,
233
- ` // args.verbose \u2014 named flag (if args export is defined above)`,
234
- ` // utils.fs.cwd() \u2014 absolute path to the project root`
236
+ ` // args.verbose \u2014 named flag (defined in args() above)`
235
237
  ].join("\n");
236
238
  if (format === "tree") {
237
239
  return header + "\n" + [
@@ -440,7 +440,7 @@ async function getRunBlockSchema(desc, projectDir, { vars = {}, runeKey = null }
440
440
  if (/\.json$/i.test(desc.argsModule)) {
441
441
  return loadJsonSchema(desc.argsModule, relative(projectDir, desc.argsModule).replace(/\\/g, "/") || desc.argsModule);
442
442
  }
443
- const { getArgsSchema } = await import("./runner-RYJO4AN3.js");
443
+ const { getArgsSchema } = await import("./runner-OU2W6JAG.js");
444
444
  return getArgsSchema(desc.argsModule, blockGrants({ permissions: desc.argsPermissions }), projectDir, { vars, runeKey });
445
445
  }
446
446
  function parseOutputLine(line) {
@@ -474,7 +474,7 @@ async function runRunBlock({ dir, key, args, entry, opts = {}, configDir, runeCa
474
474
  const desc = describeRunBlock(entry, configDir);
475
475
  let callArgs = [...desc.argv, ...args];
476
476
  if (desc.runtime === "isolate") {
477
- const { runRuneInIsolate } = await import("./runner-RYJO4AN3.js");
477
+ const { runRuneInIsolate } = await import("./runner-OU2W6JAG.js");
478
478
  return runRuneInIsolate(desc.command, blockGrants(desc), callArgs, dir, {
479
479
  runeCallback,
480
480
  sections: opts.sections ?? null,