@flowrunner/cli 0.1.6 → 0.1.7-dev.1

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.
Files changed (34) hide show
  1. package/ai-docs/instructions/service-code-format/01-service-structure.md +1 -1
  2. package/ai-docs/instructions/service-code-format/11-output-model.md +2 -1
  3. package/dist/cli.js +63 -10
  4. package/dist/cli.js.map +2 -2
  5. package/dist/index.js +56 -7
  6. package/dist/index.js.map +2 -2
  7. package/dist/types/flow-extension-runner/src/v2/model/model-types.d.ts +1 -0
  8. package/dist/types/flow-extension-runner/src/v2/types.d.ts +1 -1
  9. package/dist/types/packages/cli/src/operations/init/answers.d.ts +12 -1
  10. package/dist/types/packages/cli/src/templates/index.d.ts +2 -2
  11. package/dist/types/packages/cli/src/templates/manifest.d.ts +20 -2
  12. package/dist/types/packages/cli/src/templates/render.d.ts +2 -0
  13. package/dist/types/shared/src/scheme/flowrunner/custom-elements.d.ts +4 -0
  14. package/dist/types/shared/src/scheme/shared-extensions/base.d.ts +1 -0
  15. package/dist/types/shared/src/scheme/shared-extensions/custom-extensions.d.ts +5 -0
  16. package/dist/types/shared/src/scheme/shared-extensions/extension.d.ts +4 -0
  17. package/dist/types/shared/src/scheme/shared-extensions/resolve.d.ts +3 -0
  18. package/dist/types/shared/src/scheme/shared-extensions/search.d.ts +2 -0
  19. package/dist/types/shared/src/scheme/shared-extensions/service-info.d.ts +1 -0
  20. package/package.json +1 -1
  21. package/runtime/index.js +1 -0
  22. package/runtime/index.js.map +2 -2
  23. package/runtime/types/flow-extension-runner/src/v2/model/model-types.d.ts +1 -0
  24. package/runtime/types/flow-extension-runner/src/v2/types.d.ts +1 -1
  25. package/runtime/types/shared/src/scheme/flowrunner/custom-elements.d.ts +4 -0
  26. package/runtime/types/shared/src/scheme/shared-extensions/base.d.ts +1 -0
  27. package/runtime/types/shared/src/scheme/shared-extensions/custom-extensions.d.ts +5 -0
  28. package/runtime/types/shared/src/scheme/shared-extensions/extension.d.ts +4 -0
  29. package/runtime/types/shared/src/scheme/shared-extensions/resolve.d.ts +3 -0
  30. package/runtime/types/shared/src/scheme/shared-extensions/search.d.ts +2 -0
  31. package/runtime/types/shared/src/scheme/shared-extensions/service-info.d.ts +1 -0
  32. package/templates/blank/template.json +9 -9
  33. package/templates/demo-todo-list/template.json +9 -9
  34. package/templates/qa-test/template.json +9 -9
@@ -59,6 +59,7 @@ export interface SharedExtensionServiceInfo {
59
59
  serviceClassName: string;
60
60
  integrationName: string;
61
61
  integrationIcon: string | null;
62
+ description?: string | null;
62
63
  integrationTriggersScope: string | null;
63
64
  requireOAuth?: boolean | null;
64
65
  }
@@ -42,7 +42,7 @@ export type SampleResult<TShape extends ExtensionShape, TSchema> = Record<string
42
42
  export interface ExtensionProps<TConfigSchema extends AnySchema = AnySchema, TContext = unknown, THelpers = Record<string, unknown>, TApiRequest extends ApiRequestFn = ApiRequestFn> {
43
43
  id: string;
44
44
  name: string;
45
- description: string;
45
+ description?: string;
46
46
  logo: string;
47
47
  appearanceColors?: [string, string];
48
48
  usesFileStorage?: boolean;
@@ -8,6 +8,11 @@ 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;
11
16
  }
12
17
  export type Ask = (request: AskRequest) => Promise<string | boolean>;
13
18
  export interface ResolveAnswersOptions {
@@ -22,7 +27,13 @@ export interface ResolveAnswersOptions {
22
27
  /** How to ask a human. Omitted means nothing can be asked, and an unanswered prompt is an error. */
23
28
  ask?: Ask;
24
29
  }
25
- /** Resolve a prompt's declared default, which may interpolate answers collected before it. */
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
+ */
26
37
  export declare function resolveDefault(prompt: Prompt, answers: Answers): string | boolean;
27
38
  /**
28
39
  * 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 { PromptSchema, SERVICE_ID_PATTERN, TemplateManifestSchema, VALIDATORS } from './manifest';
2
+ export { availableServiceId, NORMALIZERS, PromptSchema, SERVICE_ID_PATTERN, TemplateManifestSchema, toServiceId, 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, interpolate, render, stripConditionals } from './render';
6
+ export { applyFilter, canInterpolate, interpolate, render, stripConditionals } from './render';
7
7
  export type { RenderedFile, ScaffoldResult } from './scaffold';
8
8
  export { renderTemplate, scaffoldService } from './scaffold';
@@ -1,5 +1,17 @@
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;
3
15
  export interface ValidationContext {
4
16
  /** The project being scaffolded into — an id is only "taken" relative to one project. */
5
17
  projectRoot: string;
@@ -11,12 +23,18 @@ export declare const VALIDATORS: {
11
23
  nonEmpty: (value: string) => "must not be empty" | null;
12
24
  };
13
25
  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>>;
14
32
  export declare const PromptSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
15
33
  name: z.ZodString;
16
34
  label: z.ZodString;
17
35
  type: z.ZodLiteral<"string">;
18
36
  hint: z.ZodOptional<z.ZodString>;
19
- default: z.ZodDefault<z.ZodString>;
37
+ default: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
20
38
  validate: z.ZodOptional<z.ZodEnum<{
21
39
  serviceId: "serviceId";
22
40
  nonEmpty: "nonEmpty";
@@ -53,7 +71,7 @@ export declare const TemplateManifestSchema: z.ZodObject<{
53
71
  label: z.ZodString;
54
72
  type: z.ZodLiteral<"string">;
55
73
  hint: z.ZodOptional<z.ZodString>;
56
- default: z.ZodDefault<z.ZodString>;
74
+ default: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
57
75
  validate: z.ZodOptional<z.ZodEnum<{
58
76
  serviceId: "serviceId";
59
77
  nonEmpty: "nonEmpty";
@@ -6,6 +6,8 @@ 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;
9
11
  export declare function interpolate(source: string, answers: Answers, origin: string): string;
10
12
  /** Drop the lines inside `{{#if flag}}` blocks whose flag is falsy, and the marker lines themselves. */
11
13
  export declare function stripConditionals(source: string, answers: Answers, origin: string): string;
@@ -3,6 +3,7 @@ export declare const CustomElementServiceInfoSchema: z.ZodObject<{
3
3
  serviceClassName: z.ZodString;
4
4
  integrationName: z.ZodString;
5
5
  integrationIcon: z.ZodNullable<z.ZodString>;
6
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
7
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
7
8
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
8
9
  appConfigDescriptions: z.ZodArray<z.ZodObject<{
@@ -85,6 +86,7 @@ export declare const CustomElementsBundleSchema: z.ZodObject<{
85
86
  serviceClassName: z.ZodString;
86
87
  integrationName: z.ZodString;
87
88
  integrationIcon: z.ZodNullable<z.ZodString>;
89
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
88
90
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
89
91
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
90
92
  appConfigDescriptions: z.ZodArray<z.ZodObject<{
@@ -169,6 +171,7 @@ export declare const SharedExtensionsElementsSchema: z.ZodObject<{
169
171
  serviceClassName: z.ZodString;
170
172
  integrationName: z.ZodString;
171
173
  integrationIcon: z.ZodNullable<z.ZodString>;
174
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
172
175
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
173
176
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
174
177
  appConfigDescriptions: z.ZodArray<z.ZodObject<{
@@ -281,6 +284,7 @@ export declare const CustomElementMethodWithServiceInfoSchema: z.ZodObject<{
281
284
  serviceClassName: z.ZodString;
282
285
  integrationName: z.ZodString;
283
286
  integrationIcon: z.ZodNullable<z.ZodString>;
287
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
284
288
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
285
289
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
286
290
  appConfigDescriptions: z.ZodArray<z.ZodObject<{
@@ -15,6 +15,7 @@ export declare const BaseInstalledExtensionDTOSchema: z.ZodObject<{
15
15
  serviceClassName: z.ZodString;
16
16
  integrationName: z.ZodString;
17
17
  integrationIcon: z.ZodNullable<z.ZodString>;
18
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
19
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
19
20
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
20
21
  }, z.core.$strip>;
@@ -15,6 +15,7 @@ export declare const CustomExtensionDTOSchema: z.ZodObject<{
15
15
  serviceClassName: z.ZodString;
16
16
  integrationName: z.ZodString;
17
17
  integrationIcon: z.ZodNullable<z.ZodString>;
18
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
19
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
19
20
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
20
21
  }, z.core.$strip>;
@@ -124,6 +125,7 @@ export declare const CustomExtensionDeployServiceSchema: z.ZodObject<{
124
125
  serviceClassName: z.ZodString;
125
126
  integrationName: z.ZodString;
126
127
  integrationIcon: z.ZodNullable<z.ZodString>;
128
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
127
129
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
128
130
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
129
131
  }, z.core.$strip>;
@@ -191,6 +193,7 @@ export declare const CustomExtensionDeployDefinitionSchema: z.ZodObject<{
191
193
  serviceClassName: z.ZodString;
192
194
  integrationName: z.ZodString;
193
195
  integrationIcon: z.ZodNullable<z.ZodString>;
196
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
194
197
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
195
198
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
196
199
  }, z.core.$strip>;
@@ -290,6 +293,7 @@ export declare const CustomExtensionElementsFullSchema: z.ZodObject<{
290
293
  serviceClassName: z.ZodString;
291
294
  integrationName: z.ZodString;
292
295
  integrationIcon: z.ZodNullable<z.ZodString>;
296
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
293
297
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
294
298
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
295
299
  appConfigDescriptions: z.ZodArray<z.ZodObject<{
@@ -381,6 +385,7 @@ export declare const CustomExtensionElementsSchema: z.ZodDiscriminatedUnion<[z.Z
381
385
  serviceClassName: z.ZodString;
382
386
  integrationName: z.ZodString;
383
387
  integrationIcon: z.ZodNullable<z.ZodString>;
388
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
384
389
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
385
390
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
386
391
  appConfigDescriptions: z.ZodArray<z.ZodObject<{
@@ -23,6 +23,7 @@ export declare const InstalledSharedExtensionDTOSchema: z.ZodObject<{
23
23
  serviceClassName: z.ZodString;
24
24
  integrationName: z.ZodString;
25
25
  integrationIcon: z.ZodNullable<z.ZodString>;
26
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
27
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
27
28
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
28
29
  }, z.core.$strip>;
@@ -112,6 +113,7 @@ export declare const MissingFSSharedExtensionDTOSchema: z.ZodObject<{
112
113
  serviceClassName: z.ZodString;
113
114
  integrationName: z.ZodString;
114
115
  integrationIcon: z.ZodNullable<z.ZodString>;
116
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
115
117
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
116
118
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
117
119
  }, z.core.$strip>;
@@ -211,6 +213,7 @@ export declare const AnySharedExtensionVersionSchema: z.ZodDiscriminatedUnion<[z
211
213
  serviceClassName: z.ZodString;
212
214
  integrationName: z.ZodString;
213
215
  integrationIcon: z.ZodNullable<z.ZodString>;
216
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
214
217
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
215
218
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
216
219
  }, z.core.$strip>;
@@ -299,6 +302,7 @@ export declare const AnySharedExtensionVersionSchema: z.ZodDiscriminatedUnion<[z
299
302
  serviceClassName: z.ZodString;
300
303
  integrationName: z.ZodString;
301
304
  integrationIcon: z.ZodNullable<z.ZodString>;
305
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
302
306
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
303
307
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
304
308
  }, z.core.$strip>;
@@ -34,6 +34,7 @@ export declare const ExtensionResolveUpdatedSchema: z.ZodObject<{
34
34
  serviceClassName: z.ZodString;
35
35
  integrationName: z.ZodString;
36
36
  integrationIcon: z.ZodNullable<z.ZodString>;
37
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
38
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
38
39
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
39
40
  appConfigDescriptions: z.ZodArray<z.ZodObject<{
@@ -144,6 +145,7 @@ export declare const ExtensionResolveResultItemSchema: z.ZodDiscriminatedUnion<[
144
145
  serviceClassName: z.ZodString;
145
146
  integrationName: z.ZodString;
146
147
  integrationIcon: z.ZodNullable<z.ZodString>;
148
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
147
149
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
148
150
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
149
151
  appConfigDescriptions: z.ZodArray<z.ZodObject<{
@@ -253,6 +255,7 @@ export declare const ExtensionResolveResponseSchema: z.ZodArray<z.ZodDiscriminat
253
255
  serviceClassName: z.ZodString;
254
256
  integrationName: z.ZodString;
255
257
  integrationIcon: z.ZodNullable<z.ZodString>;
258
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
256
259
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
257
260
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
258
261
  appConfigDescriptions: z.ZodArray<z.ZodObject<{
@@ -38,6 +38,7 @@ export declare const SharedExtensionSearchResultMethodSchema: z.ZodObject<{
38
38
  serviceClassName: z.ZodString;
39
39
  integrationName: z.ZodString;
40
40
  integrationIcon: z.ZodNullable<z.ZodString>;
41
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
42
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
42
43
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
43
44
  appConfigDescriptions: z.ZodArray<z.ZodObject<{
@@ -130,6 +131,7 @@ export declare const SearchSharedExtensionsResponseSchema: z.ZodObject<{
130
131
  serviceClassName: z.ZodString;
131
132
  integrationName: z.ZodString;
132
133
  integrationIcon: z.ZodNullable<z.ZodString>;
134
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
133
135
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
134
136
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
135
137
  appConfigDescriptions: z.ZodArray<z.ZodObject<{
@@ -3,6 +3,7 @@ export declare const ParsedFlowExtensionServiceInfoSchema: z.ZodObject<{
3
3
  serviceClassName: z.ZodString;
4
4
  integrationName: z.ZodString;
5
5
  integrationIcon: z.ZodNullable<z.ZodString>;
6
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
7
  integrationTriggersScope: z.ZodNullable<z.ZodString>;
7
8
  requireOAuth: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
8
9
  }, z.core.$strip>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowrunner/cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.7-dev.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/runtime/index.js CHANGED
@@ -4789,6 +4789,7 @@ var Extension = class {
4789
4789
  serviceClassName: this.props.id,
4790
4790
  integrationName: this.props.name,
4791
4791
  integrationIcon: this.props.logo ?? null,
4792
+ description: this.props.description || null,
4792
4793
  integrationTriggersScope: this.#realtime?.scope ?? null,
4793
4794
  requireOAuth: this.#oauth ? true : void 0
4794
4795
  };