@eightstate/escli 0.5.0

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 (54) hide show
  1. package/CONVENTIONS.md +59 -0
  2. package/LICENSE +21 -0
  3. package/README.md +106 -0
  4. package/RELEASE-NOTES-0.5.0.md +34 -0
  5. package/dist/base-command.js +166 -0
  6. package/dist/commands/audio/get.js +39 -0
  7. package/dist/commands/audio/index.js +18 -0
  8. package/dist/commands/audio/list.js +39 -0
  9. package/dist/commands/audio/status.js +34 -0
  10. package/dist/commands/audio/transcribe.js +99 -0
  11. package/dist/commands/auth/index.js +18 -0
  12. package/dist/commands/auth/login.js +38 -0
  13. package/dist/commands/auth/logout.js +27 -0
  14. package/dist/commands/auth/profiles.js +31 -0
  15. package/dist/commands/auth/status.js +27 -0
  16. package/dist/commands/auth/switch.js +24 -0
  17. package/dist/commands/docs/fetch.js +37 -0
  18. package/dist/commands/docs/get.js +47 -0
  19. package/dist/commands/docs/index.js +18 -0
  20. package/dist/commands/docs/search.js +55 -0
  21. package/dist/commands/fetch.js +55 -0
  22. package/dist/commands/image/edit.js +59 -0
  23. package/dist/commands/image/generate.js +67 -0
  24. package/dist/commands/image/index.js +18 -0
  25. package/dist/commands/models.js +27 -0
  26. package/dist/commands/research.js +92 -0
  27. package/dist/commands/search.js +54 -0
  28. package/dist/commands/social.js +69 -0
  29. package/dist/commands/usage.js +51 -0
  30. package/dist/commands/version.js +22 -0
  31. package/dist/entry.js +120 -0
  32. package/dist/io/io.js +322 -0
  33. package/dist/lib/build-flags.js +2 -0
  34. package/dist/lib/command-metadata.js +8 -0
  35. package/dist/lib/envelope.js +28 -0
  36. package/dist/lib/escli-error.js +20 -0
  37. package/dist/lib/global-flags.js +29 -0
  38. package/dist/lib/globals.js +2 -0
  39. package/dist/lib/manifest.js +67 -0
  40. package/dist/lib/oclif-manifest-check.js +11 -0
  41. package/dist/lib/registry.js +228 -0
  42. package/dist/services/audio.js +454 -0
  43. package/dist/services/auth.js +329 -0
  44. package/dist/services/credentials.js +137 -0
  45. package/dist/services/docs.js +303 -0
  46. package/dist/services/fetch.js +197 -0
  47. package/dist/services/image.js +297 -0
  48. package/dist/services/models.js +131 -0
  49. package/dist/services/research.js +504 -0
  50. package/dist/services/search.js +195 -0
  51. package/dist/services/social.js +224 -0
  52. package/dist/services/usage.js +165 -0
  53. package/oclif.manifest.json +3377 -0
  54. package/package.json +57 -0
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ import { EnvelopeSchema } from '@eightstate/contracts/envelope';
3
+ import { ErrorCode } from '@eightstate/contracts/errors';
4
+ import { ExitCodes } from '@eightstate/contracts/exit-codes';
5
+ import { EscliError } from './escli-error.js';
6
+ export function buildErrorEnvelope(command, version, error, durationMs) {
7
+ const errorObject = {
8
+ code: error.code,
9
+ message: error.message,
10
+ remediation: error.remediation,
11
+ details: error.details,
12
+ cause_code: error.causeCode,
13
+ };
14
+ return EnvelopeSchema(z.unknown()).parse({ ok: false, data: null, error: errorObject, meta: meta(command, version, durationMs) });
15
+ }
16
+ export function buildUsageError(message, code = ErrorCode.UsageInvalid, details) {
17
+ return new EscliError(message, { code, exitCode: ExitCodes.Usage, details });
18
+ }
19
+ export function meta(command, version, durationMs) {
20
+ return {
21
+ schema_version: '1',
22
+ escli_version: version,
23
+ command,
24
+ warnings: [],
25
+ duration_ms: durationMs,
26
+ };
27
+ }
28
+ //# sourceMappingURL=envelope.js.map
@@ -0,0 +1,20 @@
1
+ import { ErrorCode } from '@eightstate/contracts/errors';
2
+ import { exitCodeForErrorCode } from '@eightstate/contracts/failure-taxonomy';
3
+ export class EscliError extends Error {
4
+ code;
5
+ exitCode;
6
+ remediation;
7
+ details;
8
+ causeCode;
9
+ constructor(message, options = {}) {
10
+ super(message);
11
+ this.name = 'EscliError';
12
+ this.code = options.code ?? ErrorCode.Unknown;
13
+ this.exitCode = options.exitCode ?? exitCodeForErrorCode(this.code);
14
+ this.remediation = options.remediation;
15
+ this.details = options.details;
16
+ this.causeCode = options.causeCode;
17
+ }
18
+ }
19
+ export { exitCodeForErrorCode };
20
+ //# sourceMappingURL=escli-error.js.map
@@ -0,0 +1,29 @@
1
+ import { Flags } from '@oclif/core';
2
+ export const globalFlags = {
3
+ quiet: Flags.boolean({ description: 'Suppress diagnostic output.', default: false }),
4
+ 'api-key': Flags.string({ description: 'API key override.', helpGroup: 'GLOBAL' }),
5
+ 'base-url': Flags.string({ description: 'Base URL override.', helpGroup: 'GLOBAL' }),
6
+ timeout: Flags.integer({ description: 'Request timeout in seconds.', default: 300, helpGroup: 'GLOBAL' }),
7
+ describe: Flags.boolean({ description: 'Emit compact machine-readable command description.', helpGroup: 'GLOBAL' }),
8
+ schema: Flags.boolean({ description: 'Emit full machine-readable command schema.', helpGroup: 'GLOBAL', allowNo: false }),
9
+ version: Flags.boolean({ char: 'v', description: 'Emit version envelope.', helpGroup: 'GLOBAL' }),
10
+ };
11
+ export const GLOBAL_FLAG_NAMES = ['json', ...Object.keys(globalFlags)];
12
+ export const GLOBAL_VALUE_FLAG_NAMES = ['api-key', 'base-url', 'timeout'];
13
+ export const GLOBAL_SHORT_FLAGS = new Map([['-v', 'version'], ['-h', 'help']]);
14
+ const RUNNER_ONLY_GLOBAL_FLAG_NAMES = ['help'];
15
+ export function isGlobalFlagToken(token) {
16
+ if (GLOBAL_SHORT_FLAGS.has(token))
17
+ return true;
18
+ if (!token.startsWith('--'))
19
+ return false;
20
+ const name = token.slice(2).split('=', 1)[0];
21
+ return GLOBAL_FLAG_NAMES.includes(name) || RUNNER_ONLY_GLOBAL_FLAG_NAMES.includes(name);
22
+ }
23
+ export function globalFlagTakesValue(token) {
24
+ if (!token.startsWith('--'))
25
+ return false;
26
+ const name = token.slice(2).split('=', 1)[0];
27
+ return GLOBAL_VALUE_FLAG_NAMES.includes(name);
28
+ }
29
+ //# sourceMappingURL=global-flags.js.map
@@ -0,0 +1,2 @@
1
+ export { GLOBAL_FLAG_NAMES, GLOBAL_SHORT_FLAGS, GLOBAL_VALUE_FLAG_NAMES, globalFlags, globalFlagTakesValue, isGlobalFlagToken } from './global-flags.js';
2
+ //# sourceMappingURL=globals.js.map
@@ -0,0 +1,67 @@
1
+ import { z } from 'zod';
2
+ import { EnvelopeSchema } from '@eightstate/contracts/envelope';
3
+ import { ManifestSchema } from '@eightstate/contracts/manifest';
4
+ import { commandRegistry } from './registry.js';
5
+ function jsonSchema(schema) {
6
+ return z.toJSONSchema(schema);
7
+ }
8
+ export function buildManifest(compact = false, scope) {
9
+ const commands = {};
10
+ for (const command of commandRegistry) {
11
+ if (!isInScope(command.id, scope))
12
+ continue;
13
+ commands[command.id] = {
14
+ id: command.id,
15
+ aliases: [...command.aliases],
16
+ examples: [...command.examples],
17
+ flags: namedEntries(command.flags, normalizeFlag),
18
+ args: namedEntries(command.args, normalizeArg),
19
+ summary: command.summary,
20
+ description: command.description,
21
+ errors: [...command.errors],
22
+ ...(compact ? {} : {
23
+ input_schema: command.inputSchema ? jsonSchema(command.inputSchema) : undefined,
24
+ output_schema: jsonSchema(EnvelopeSchema(command.dataSchema)),
25
+ }),
26
+ };
27
+ }
28
+ return ManifestSchema.parse({ version: '0.5.0', commands });
29
+ }
30
+ function isInScope(commandId, scope) {
31
+ if (!scope)
32
+ return true;
33
+ return commandId === scope || commandId.startsWith(`${scope} `);
34
+ }
35
+ function namedEntries(entries, normalize) {
36
+ return Object.fromEntries(Object.entries(entries).map(([name, value]) => {
37
+ if (value && typeof value === 'object' && !Array.isArray(value))
38
+ return [name, normalize(name, value)];
39
+ return [name, { value, name }];
40
+ }));
41
+ }
42
+ function normalizeFlag(name, value) {
43
+ const normalized = { ...value, name };
44
+ normalized.type = normalized.type === 'option' ? inferOptionType(name, normalized) : normalized.type;
45
+ for (const key of ['input', 'allowNo'])
46
+ delete normalized[key];
47
+ if (normalized.multiple === false)
48
+ delete normalized.multiple;
49
+ return normalized;
50
+ }
51
+ function normalizeArg(name, value) {
52
+ const normalized = { ...value, name };
53
+ delete normalized.type;
54
+ delete normalized.input;
55
+ if (normalized.multiple === false)
56
+ delete normalized.multiple;
57
+ return normalized;
58
+ }
59
+ function inferOptionType(name, value) {
60
+ if (integerFlags.has(name) || Number.isInteger(value.default))
61
+ return 'integer';
62
+ if (Array.isArray(value.options) && value.options.every((option) => typeof option === 'number'))
63
+ return 'integer';
64
+ return 'string';
65
+ }
66
+ const integerFlags = new Set(['compression', 'speakers-expected', 'limit', 'tokens', 'page', 'max-results', 'days', 'timeout']);
67
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1,11 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { commandIds } from './registry.js';
3
+ export function assertOclifManifestMatchesRegistry(path = 'oclif.manifest.json') {
4
+ const raw = JSON.parse(readFileSync(path, 'utf8'));
5
+ const manifestIds = Object.keys(raw.commands ?? {}).map((id) => id.replaceAll(':', ' ')).sort();
6
+ const registryIds = [...commandIds].sort();
7
+ if (JSON.stringify(manifestIds) !== JSON.stringify(registryIds)) {
8
+ throw new Error(`oclif manifest commands ${JSON.stringify(manifestIds)} do not match registry commands ${JSON.stringify(registryIds)}`);
9
+ }
10
+ }
11
+ //# sourceMappingURL=oclif-manifest-check.js.map
@@ -0,0 +1,228 @@
1
+ import { z } from 'zod';
2
+ import ImageTopic from '../commands/image/index.js';
3
+ import AudioTopic from '../commands/audio/index.js';
4
+ import AuthTopic from '../commands/auth/index.js';
5
+ import DocsTopic from '../commands/docs/index.js';
6
+ import ImageGenerate, { ImageDataSchema } from '../commands/image/generate.js';
7
+ import ImageEdit from '../commands/image/edit.js';
8
+ import AudioGet, { AudioGetDataSchema } from '../commands/audio/get.js';
9
+ import AudioList, { AudioListDataSchema } from '../commands/audio/list.js';
10
+ import AudioStatus, { AudioStatusDataSchema } from '../commands/audio/status.js';
11
+ import AudioTranscribe, { AudioTranscribeDataSchema } from '../commands/audio/transcribe.js';
12
+ import AuthLogin, { AuthLoginDataSchema } from '../commands/auth/login.js';
13
+ import AuthLogout, { AuthLogoutDataSchema } from '../commands/auth/logout.js';
14
+ import AuthProfiles, { AuthProfilesDataSchema } from '../commands/auth/profiles.js';
15
+ import AuthStatus, { AuthStatusDataSchema } from '../commands/auth/status.js';
16
+ import AuthSwitch, { AuthSwitchDataSchema } from '../commands/auth/switch.js';
17
+ import DocsFetch, { DocsContentDataSchema } from '../commands/docs/fetch.js';
18
+ import DocsGet from '../commands/docs/get.js';
19
+ import DocsSearch, { DocsSearchDataSchema } from '../commands/docs/search.js';
20
+ import Fetch, { FetchDataSchema } from '../commands/fetch.js';
21
+ import Models, { ModelsDataSchema } from '../commands/models.js';
22
+ import Search, { SearchDataSchema } from '../commands/search.js';
23
+ import Research, { ResearchDataSchema } from '../commands/research.js';
24
+ import Social, { SocialDataSchema } from '../commands/social.js';
25
+ import Usage, { UsageDataSchema } from '../commands/usage.js';
26
+ import Version, { VersionDataSchema } from '../commands/version.js';
27
+ import { registerCommandMetadata } from './command-metadata.js';
28
+ import { renderAuthLogin, renderAuthLogout, renderAuthProfiles, renderAuthStatus, renderAuthSwitch, renderDocsContent, renderDocsSearch, renderFetch, renderModelList, renderResearch, renderSearch, renderSocial, renderUsage, renderVersion, } from '../io/io.js';
29
+ const commandClasses = [
30
+ { id: 'image', command: ImageTopic },
31
+ { id: 'image generate', command: ImageGenerate },
32
+ { id: 'image edit', command: ImageEdit },
33
+ { id: 'audio', command: AudioTopic },
34
+ { id: 'audio transcribe', command: AudioTranscribe },
35
+ { id: 'audio status', command: AudioStatus },
36
+ { id: 'audio get', command: AudioGet },
37
+ { id: 'audio list', command: AudioList },
38
+ { id: 'auth', command: AuthTopic },
39
+ { id: 'auth login', command: AuthLogin },
40
+ { id: 'auth logout', command: AuthLogout },
41
+ { id: 'auth status', command: AuthStatus },
42
+ { id: 'auth profiles', command: AuthProfiles },
43
+ { id: 'auth switch', command: AuthSwitch },
44
+ { id: 'docs', command: DocsTopic },
45
+ { id: 'docs search', command: DocsSearch },
46
+ { id: 'docs get', command: DocsGet },
47
+ { id: 'docs fetch', command: DocsFetch },
48
+ { id: 'fetch', command: Fetch },
49
+ { id: 'models', command: Models },
50
+ { id: 'search', command: Search },
51
+ { id: 'research', command: Research },
52
+ { id: 'social', command: Social },
53
+ { id: 'usage', command: Usage },
54
+ { id: 'version', command: Version },
55
+ ];
56
+ const aliasOverrides = new Map([
57
+ ['image', ['img', 'i']],
58
+ ['image generate', ['image gen', 'image g', 'img generate', 'img gen', 'img g', 'i generate', 'i gen', 'i g']],
59
+ ['image edit', ['image e', 'img edit', 'img e', 'i edit', 'i e']],
60
+ ['audio', ['au']],
61
+ ['audio transcribe', ['audio t', 'au transcribe', 'au t']],
62
+ ['audio status', ['audio s', 'au status', 'au s']],
63
+ ['audio get', ['audio g', 'au get', 'au g']],
64
+ ['audio list', ['audio ls', 'au list', 'au ls']],
65
+ ['auth', ['a']],
66
+ ['auth login', ['auth l', 'a login', 'a l']],
67
+ ['auth logout', ['auth out', 'a logout', 'a out']],
68
+ ['auth status', ['auth s', 'auth whoami', 'a status', 'a s', 'a whoami']],
69
+ ['auth profiles', ['auth ls', 'auth list', 'a profiles', 'a ls', 'a list']],
70
+ ['auth switch', ['auth use', 'a switch', 'a use']],
71
+ ['docs', ['d']],
72
+ ['docs search', ['docs s', 'd search', 'd s']],
73
+ ['docs get', ['docs g', 'd get', 'd g']],
74
+ ['docs fetch', ['docs f', 'd fetch', 'd f']],
75
+ ['fetch', ['f']],
76
+ ['models', ['m']],
77
+ ['search', ['s']],
78
+ ['research', ['r']],
79
+ ['social', []],
80
+ ['usage', ['u']],
81
+ ['version', []],
82
+ ]);
83
+ const metadataEntries = [
84
+ ['image', { inputSchema: z.object({}), dataSchema: z.object({}) }],
85
+ ['image generate', { inputSchema: z.object({
86
+ prompt: z.array(z.string()).min(1),
87
+ size: z.string().optional(),
88
+ quality: z.enum(['low', 'medium', 'high']).optional(),
89
+ format: z.enum(['png', 'jpeg', 'jpg', 'webp']).optional(),
90
+ model: z.string().optional(),
91
+ output: z.string().optional(),
92
+ 'out-dir': z.string().optional(),
93
+ open: z.boolean().optional(),
94
+ compression: z.number().int().optional(),
95
+ moderation: z.enum(['auto', 'low']).optional(),
96
+ background: z.enum(['auto', 'transparent']).optional(),
97
+ }), dataSchema: ImageDataSchema }],
98
+ ['image edit', { inputSchema: z.object({
99
+ prompt: z.array(z.string()).min(1),
100
+ input: z.string(),
101
+ size: z.string().optional(),
102
+ quality: z.enum(['low', 'medium', 'high']).optional(),
103
+ format: z.enum(['png', 'jpeg', 'jpg', 'webp']).optional(),
104
+ model: z.string().optional(),
105
+ output: z.string().optional(),
106
+ 'out-dir': z.string().optional(),
107
+ open: z.boolean().optional(),
108
+ compression: z.number().int().optional(),
109
+ moderation: z.enum(['auto', 'low']).optional(),
110
+ fidelity: z.enum(['low', 'high']).optional(),
111
+ }), dataSchema: ImageDataSchema }],
112
+ ['audio', { inputSchema: z.object({}), dataSchema: z.object({}) }],
113
+ ['audio transcribe', { inputSchema: z.object({
114
+ source: z.string(),
115
+ output: z.string().optional(),
116
+ format: z.enum(['text', 'json', 'srt', 'vtt']).optional(),
117
+ speakers: z.boolean().optional(),
118
+ 'speakers-expected': z.number().int().optional(),
119
+ 'speaker-names': z.string().optional(),
120
+ sentiment: z.boolean().optional(),
121
+ chapters: z.boolean().optional(),
122
+ entities: z.boolean().optional(),
123
+ summarize: z.boolean().optional(),
124
+ highlights: z.boolean().optional(),
125
+ topics: z.boolean().optional(),
126
+ 'content-safety': z.boolean().optional(),
127
+ language: z.string().optional(),
128
+ 'dual-channel': z.boolean().optional(),
129
+ multichannel: z.boolean().optional(),
130
+ 'word-boost': z.string().optional(),
131
+ disfluencies: z.boolean().optional(),
132
+ 'filter-profanity': z.boolean().optional(),
133
+ 'redact-pii': z.boolean().optional(),
134
+ }), dataSchema: AudioTranscribeDataSchema }],
135
+ ['audio status', { inputSchema: z.object({ transcript_id: z.string() }), dataSchema: AudioStatusDataSchema }],
136
+ ['audio get', { inputSchema: z.object({ transcript_id: z.string(), format: z.enum(['text', 'json', 'srt', 'vtt']).optional(), output: z.string().optional() }), dataSchema: AudioGetDataSchema }],
137
+ ['audio list', { inputSchema: z.object({}), dataSchema: AudioListDataSchema }],
138
+ ['auth', { inputSchema: z.object({}), dataSchema: z.object({}) }],
139
+ ['auth login', { inputSchema: z.object({
140
+ key: z.string().optional(),
141
+ endpoint: z.string().optional(),
142
+ profile: z.string().optional(),
143
+ label: z.string().optional(),
144
+ }), dataSchema: AuthLoginDataSchema, render: renderAuthLogin }],
145
+ ['auth logout', { inputSchema: z.object({ profile: z.string().optional(), all: z.boolean().optional() }), dataSchema: AuthLogoutDataSchema, render: renderAuthLogout }],
146
+ ['auth status', { inputSchema: z.object({}), dataSchema: AuthStatusDataSchema, render: renderAuthStatus }],
147
+ ['auth profiles', { inputSchema: z.object({}), dataSchema: AuthProfilesDataSchema, render: renderAuthProfiles }],
148
+ ['auth switch', { inputSchema: z.object({ profile: z.string() }), dataSchema: AuthSwitchDataSchema, render: renderAuthSwitch }],
149
+ ['docs', { inputSchema: z.object({}), dataSchema: z.object({}) }],
150
+ ['docs search', { inputSchema: z.object({ library: z.string(), query: z.string().optional(), limit: z.number().int().optional(), refresh: z.boolean().optional() }), dataSchema: DocsSearchDataSchema, render: renderDocsSearch }],
151
+ ['docs get', { inputSchema: z.object({ library: z.string(), query: z.string(), tokens: z.number().int().optional(), page: z.number().int().optional(), topic: z.string().optional(), refresh: z.boolean().optional() }), dataSchema: DocsContentDataSchema, render: renderDocsContent }],
152
+ ['docs fetch', { inputSchema: z.object({ 'library-id': z.string(), query: z.string(), tokens: z.number().int().optional(), page: z.number().int().optional(), topic: z.string().optional(), refresh: z.boolean().optional() }), dataSchema: DocsContentDataSchema, render: renderDocsContent }],
153
+ ['fetch', { inputSchema: z.object({ urls: z.array(z.string()).min(1), objective: z.string().optional(), full: z.boolean().optional() }), dataSchema: FetchDataSchema, render: renderFetch }],
154
+ ['models', { inputSchema: z.object({}), dataSchema: ModelsDataSchema, render: renderModelList }],
155
+ ['search', { inputSchema: z.object({ objective: z.array(z.string()).min(1), queries: z.array(z.string()).optional() }), dataSchema: SearchDataSchema, render: renderSearch }],
156
+ ['research', { inputSchema: z.object({
157
+ query: z.array(z.string()).optional(),
158
+ processors: z.boolean().optional(),
159
+ status: z.string().optional(),
160
+ result: z.string().optional(),
161
+ output: z.string().optional(),
162
+ processor: z.string().optional(),
163
+ text: z.boolean().optional(),
164
+ schema: z.string().optional(),
165
+ 'output-schema': z.string().optional(),
166
+ 'input-json': z.string().optional(),
167
+ 'input-file': z.string().optional(),
168
+ 'include-domains': z.string().optional(),
169
+ 'exclude-domains': z.string().optional(),
170
+ 'after-date': z.string().optional(),
171
+ location: z.string().optional(),
172
+ metadata: z.string().optional(),
173
+ 'follow-up': z.string().optional(),
174
+ 'no-basis': z.boolean().optional(),
175
+ }), dataSchema: ResearchDataSchema, render: renderResearch }],
176
+ ['social', { inputSchema: z.object({
177
+ query: z.array(z.string()).min(1),
178
+ platform: z.string().optional(),
179
+ time: z.enum(['day', 'week', 'month', 'year']).optional(),
180
+ 'max-results': z.number().int().optional(),
181
+ depth: z.enum(['basic', 'advanced', 'fast', 'ultra-fast']).optional(),
182
+ answer: z.boolean().optional(),
183
+ raw: z.boolean().optional(),
184
+ images: z.boolean().optional(),
185
+ country: z.string().optional(),
186
+ }), dataSchema: SocialDataSchema, render: renderSocial }],
187
+ ['usage', { inputSchema: z.object({
188
+ days: z.number().int().optional(),
189
+ service: z.string().optional(),
190
+ daily: z.boolean().optional(),
191
+ pricing: z.boolean().optional(),
192
+ }), dataSchema: UsageDataSchema, render: renderUsage }],
193
+ ['version', { inputSchema: z.object({}), dataSchema: VersionDataSchema, render: renderVersion }],
194
+ ];
195
+ const metadata = new Map(metadataEntries);
196
+ export const commandRegistry = commandClasses.map(({ id, command }) => buildRegistration(id, command));
197
+ for (const registration of commandRegistry) {
198
+ registerCommandMetadata({
199
+ id: registration.id,
200
+ dataSchema: registration.dataSchema,
201
+ inputSchema: registration.inputSchema,
202
+ errors: registration.errors,
203
+ render: registration.render,
204
+ });
205
+ }
206
+ function buildRegistration(id, command) {
207
+ const commandMetadata = metadata.get(id) ?? { dataSchema: z.object({}) };
208
+ return {
209
+ id,
210
+ command,
211
+ aliases: aliasOverrides.get(id) ?? command.aliases ?? [],
212
+ examples: normalizeExamples(command.examples ?? []),
213
+ flags: command.flags ?? {},
214
+ args: command.args ?? {},
215
+ summary: command.summary ?? '',
216
+ description: command.description,
217
+ dataSchema: commandMetadata.dataSchema,
218
+ inputSchema: commandMetadata.inputSchema,
219
+ errors: command.errors ?? [],
220
+ render: commandMetadata.render,
221
+ };
222
+ }
223
+ function normalizeExamples(examples) {
224
+ return examples.map((example) => example.replaceAll('<%= config.bin %>', 'escli'));
225
+ }
226
+ export const commandsById = new Map(commandRegistry.flatMap((command) => [[command.id, command], ...command.aliases.map((alias) => [alias, command])]));
227
+ export const commandIds = commandRegistry.map((command) => command.id);
228
+ //# sourceMappingURL=registry.js.map