@flowrunner/cli 0.1.6-dev.1 → 0.1.6

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.
@@ -8,11 +8,6 @@ export interface AskRequest {
8
8
  fallback: string | boolean;
9
9
  /** Returns a message to show before asking again, or null when the value is acceptable. */
10
10
  validate: (value: string) => string | null;
11
- /**
12
- * Repairs what the user typed into the closest acceptable value ("Token Generator" → "token-generator"),
13
- * or returns it unchanged. Run before `validate`; the asker should show the user a value it changed.
14
- */
15
- normalize: (value: string) => string;
16
11
  }
17
12
  export type Ask = (request: AskRequest) => Promise<string | boolean>;
18
13
  export interface ResolveAnswersOptions {
@@ -27,13 +22,7 @@ export interface ResolveAnswersOptions {
27
22
  /** How to ask a human. Omitted means nothing can be asked, and an unanswered prompt is an error. */
28
23
  ask?: Ask;
29
24
  }
30
- /**
31
- * Resolve a prompt's declared default, which may interpolate the answers known so far.
32
- *
33
- * A list default is tried in order and the first candidate that resolves to something non-empty wins. When
34
- * none does, the last one is interpolated anyway — an unresolvable placeholder then fails with the same
35
- * error a single-string default would, rather than being swallowed into an empty answer.
36
- */
25
+ /** Resolve a prompt's declared default, which may interpolate answers collected before it. */
37
26
  export declare function resolveDefault(prompt: Prompt, answers: Answers): string | boolean;
38
27
  /**
39
28
  * A prefill arrives as a raw string when it came from a flag; anything boolean has to interpret it.
@@ -1,8 +1,8 @@
1
1
  export type { Answers, Prompt, Template, TemplateFile, TemplateManifest, ValidationContext, Validator, ValidatorName, } from './manifest';
2
- export { availableServiceId, NORMALIZERS, PromptSchema, SERVICE_ID_PATTERN, TemplateManifestSchema, toServiceId, VALIDATORS, } from './manifest';
2
+ export { PromptSchema, SERVICE_ID_PATTERN, TemplateManifestSchema, VALIDATORS } from './manifest';
3
3
  export { packageRoot, templatesRoot } from './package-root';
4
4
  export { serviceDirectory, SERVICES_DIRECTORY, servicesDirectory } from './paths';
5
5
  export { DEFAULT_TEMPLATE_ALIAS, DEFAULT_TEMPLATE_ID, defaultTemplate, findTemplate, listTemplates, } from './registry';
6
- export { applyFilter, canInterpolate, interpolate, render, stripConditionals } from './render';
6
+ export { applyFilter, interpolate, render, stripConditionals } from './render';
7
7
  export type { RenderedFile, ScaffoldResult } from './scaffold';
8
8
  export { renderTemplate, scaffoldService } from './scaffold';
@@ -1,17 +1,5 @@
1
1
  import { z } from 'zod';
2
2
  export declare const SERVICE_ID_PATTERN: RegExp;
3
- /**
4
- * The closest legal service id to free text: "Token Generator" → "token-generator", "Café_Bot.v2" →
5
- * "cafe-bot-v2". Accents are folded, every run of anything else becomes one dash, and leading digits are
6
- * dropped because an id must start with a letter. Returns '' when nothing usable is left ("日本語"), so the
7
- * caller decides the fallback rather than this inventing one.
8
- */
9
- export declare function toServiceId(value: string): string;
10
- /**
11
- * `id` itself when no service uses it, otherwise the first free `id-2`, `id-3`, … — for a *suggested* id
12
- * only. An id the user typed or passed as a flag is never renamed behind their back; it is rejected as taken.
13
- */
14
- export declare function availableServiceId(id: string, projectRoot: string): string;
15
3
  export interface ValidationContext {
16
4
  /** The project being scaffolded into — an id is only "taken" relative to one project. */
17
5
  projectRoot: string;
@@ -23,18 +11,12 @@ export declare const VALIDATORS: {
23
11
  nonEmpty: (value: string) => "must not be empty" | null;
24
12
  };
25
13
  export type ValidatorName = keyof typeof VALIDATORS;
26
- /**
27
- * Rules that can also repair a value, keyed like VALIDATORS. Applied only to what a person types at the
28
- * prompt — where they see the result echoed back — never to a flag, which a script expects to be taken
29
- * exactly as given or refused.
30
- */
31
- export declare const NORMALIZERS: Partial<Record<ValidatorName, (value: string) => string>>;
32
14
  export declare const PromptSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
33
15
  name: z.ZodString;
34
16
  label: z.ZodString;
35
17
  type: z.ZodLiteral<"string">;
36
18
  hint: z.ZodOptional<z.ZodString>;
37
- default: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
19
+ default: z.ZodDefault<z.ZodString>;
38
20
  validate: z.ZodOptional<z.ZodEnum<{
39
21
  serviceId: "serviceId";
40
22
  nonEmpty: "nonEmpty";
@@ -71,7 +53,7 @@ export declare const TemplateManifestSchema: z.ZodObject<{
71
53
  label: z.ZodString;
72
54
  type: z.ZodLiteral<"string">;
73
55
  hint: z.ZodOptional<z.ZodString>;
74
- default: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
56
+ default: z.ZodDefault<z.ZodString>;
75
57
  validate: z.ZodOptional<z.ZodEnum<{
76
58
  serviceId: "serviceId";
77
59
  nonEmpty: "nonEmpty";
@@ -6,8 +6,6 @@ export declare function applyFilter(name: string, value: string): string;
6
6
  * An unknown key is an error rather than an empty string: a typo in a template would otherwise ship a
7
7
  * silently broken service, and the generated file is the thing a user reads to learn the format.
8
8
  */
9
- /** Whether every placeholder in `source` names a known answer — i.e. whether `interpolate` would succeed. */
10
- export declare function canInterpolate(source: string, answers: Answers): boolean;
11
9
  export declare function interpolate(source: string, answers: Answers, origin: string): string;
12
10
  /** Drop the lines inside `{{#if flag}}` blocks whose flag is falsy, and the marker lines themselves. */
13
11
  export declare function stripConditionals(source: string, answers: Answers, origin: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowrunner/cli",
3
- "version": "0.1.6-dev.1",
3
+ "version": "0.1.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -3,20 +3,20 @@
3
3
  "label": "Blank",
4
4
  "description": "A minimal service \u2014 one action, ready to build on. Optionally with OAuth2 and file storage wired up.",
5
5
  "prompts": [
6
- {
7
- "name": "name",
8
- "label": "Display name",
9
- "type": "string",
10
- "default": ["{{id|titleCase}}", "My Service"],
11
- "validate": "nonEmpty"
12
- },
13
6
  {
14
7
  "name": "id",
15
8
  "label": "Service id",
16
9
  "type": "string",
17
- "default": ["{{name|serviceId}}", "my-service"],
10
+ "default": "my-service",
18
11
  "validate": "serviceId",
19
- "hint": "Suggested from the display name \u2014 press Enter to accept it. Becomes the services/<id>/ folder and is frozen once deployed."
12
+ "hint": "Becomes the services/<id>/ folder and the service id, which is frozen once deployed."
13
+ },
14
+ {
15
+ "name": "name",
16
+ "label": "Display name",
17
+ "type": "string",
18
+ "default": "{{id|titleCase}}",
19
+ "validate": "nonEmpty"
20
20
  },
21
21
  {
22
22
  "name": "description",
@@ -3,20 +3,20 @@
3
3
  "label": "Demo To-do List",
4
4
  "description": "A working to-do list service \u2014 lists, tasks, completion, plus a generic HTTP Request action.",
5
5
  "prompts": [
6
- {
7
- "name": "name",
8
- "label": "Display name",
9
- "type": "string",
10
- "default": ["{{id|titleCase}}", "Demo Todo List"],
11
- "validate": "nonEmpty"
12
- },
13
6
  {
14
7
  "name": "id",
15
8
  "label": "Service id",
16
9
  "type": "string",
17
- "default": ["{{name|serviceId}}", "demo-todo-list"],
10
+ "default": "demo-todo-list",
18
11
  "validate": "serviceId",
19
- "hint": "Suggested from the display name \u2014 press Enter to accept it. Becomes the services/<id>/ folder and is frozen once deployed."
12
+ "hint": "Becomes the services/<id>/ folder and the service id, which is frozen once deployed."
13
+ },
14
+ {
15
+ "name": "name",
16
+ "label": "Display name",
17
+ "type": "string",
18
+ "default": "{{id|titleCase}}",
19
+ "validate": "nonEmpty"
20
20
  }
21
21
  ],
22
22
  "values": {
@@ -3,20 +3,20 @@
3
3
  "label": "QA Test Harness",
4
4
  "description": "Exercises every custom-extension capability so QA can verify a deployment end to end.",
5
5
  "prompts": [
6
- {
7
- "name": "name",
8
- "label": "Display name",
9
- "type": "string",
10
- "default": ["{{id|titleCase}}", "Qa Test"],
11
- "validate": "nonEmpty"
12
- },
13
6
  {
14
7
  "name": "id",
15
8
  "label": "Service id",
16
9
  "type": "string",
17
- "default": ["{{name|serviceId}}", "qa-test"],
10
+ "default": "qa-test",
18
11
  "validate": "serviceId",
19
- "hint": "Suggested from the display name \u2014 press Enter to accept it. Becomes the services/<id>/ folder and is frozen once deployed."
12
+ "hint": "Becomes the services/<id>/ folder and the service id, which is frozen once deployed."
13
+ },
14
+ {
15
+ "name": "name",
16
+ "label": "Display name",
17
+ "type": "string",
18
+ "default": "{{id|titleCase}}",
19
+ "validate": "nonEmpty"
20
20
  },
21
21
  {
22
22
  "name": "configMode",