@uluops/cli 0.2.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 (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +825 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +93 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/analytics.d.ts +6 -0
  8. package/dist/commands/analytics.d.ts.map +1 -0
  9. package/dist/commands/analytics.js +445 -0
  10. package/dist/commands/analytics.js.map +1 -0
  11. package/dist/commands/auth.d.ts +6 -0
  12. package/dist/commands/auth.d.ts.map +1 -0
  13. package/dist/commands/auth.js +496 -0
  14. package/dist/commands/auth.js.map +1 -0
  15. package/dist/commands/completion.d.ts +7 -0
  16. package/dist/commands/completion.d.ts.map +1 -0
  17. package/dist/commands/completion.js +188 -0
  18. package/dist/commands/completion.js.map +1 -0
  19. package/dist/commands/config.d.ts +6 -0
  20. package/dist/commands/config.d.ts.map +1 -0
  21. package/dist/commands/config.js +279 -0
  22. package/dist/commands/config.js.map +1 -0
  23. package/dist/commands/definitions.d.ts +6 -0
  24. package/dist/commands/definitions.d.ts.map +1 -0
  25. package/dist/commands/definitions.js +229 -0
  26. package/dist/commands/definitions.js.map +1 -0
  27. package/dist/commands/deps.d.ts +6 -0
  28. package/dist/commands/deps.d.ts.map +1 -0
  29. package/dist/commands/deps.js +87 -0
  30. package/dist/commands/deps.js.map +1 -0
  31. package/dist/commands/exec.d.ts +6 -0
  32. package/dist/commands/exec.d.ts.map +1 -0
  33. package/dist/commands/exec.js +334 -0
  34. package/dist/commands/exec.js.map +1 -0
  35. package/dist/commands/executions.d.ts +6 -0
  36. package/dist/commands/executions.d.ts.map +1 -0
  37. package/dist/commands/executions.js +63 -0
  38. package/dist/commands/executions.js.map +1 -0
  39. package/dist/commands/forks.d.ts +6 -0
  40. package/dist/commands/forks.d.ts.map +1 -0
  41. package/dist/commands/forks.js +145 -0
  42. package/dist/commands/forks.js.map +1 -0
  43. package/dist/commands/issues.d.ts +6 -0
  44. package/dist/commands/issues.d.ts.map +1 -0
  45. package/dist/commands/issues.js +458 -0
  46. package/dist/commands/issues.js.map +1 -0
  47. package/dist/commands/models.d.ts +6 -0
  48. package/dist/commands/models.d.ts.map +1 -0
  49. package/dist/commands/models.js +156 -0
  50. package/dist/commands/models.js.map +1 -0
  51. package/dist/commands/projects.d.ts +6 -0
  52. package/dist/commands/projects.d.ts.map +1 -0
  53. package/dist/commands/projects.js +262 -0
  54. package/dist/commands/projects.js.map +1 -0
  55. package/dist/commands/render.d.ts +6 -0
  56. package/dist/commands/render.d.ts.map +1 -0
  57. package/dist/commands/render.js +59 -0
  58. package/dist/commands/render.js.map +1 -0
  59. package/dist/commands/runs.d.ts +6 -0
  60. package/dist/commands/runs.d.ts.map +1 -0
  61. package/dist/commands/runs.js +442 -0
  62. package/dist/commands/runs.js.map +1 -0
  63. package/dist/commands/taxonomy.d.ts +6 -0
  64. package/dist/commands/taxonomy.d.ts.map +1 -0
  65. package/dist/commands/taxonomy.js +45 -0
  66. package/dist/commands/taxonomy.js.map +1 -0
  67. package/dist/commands/translation.d.ts +6 -0
  68. package/dist/commands/translation.d.ts.map +1 -0
  69. package/dist/commands/translation.js +85 -0
  70. package/dist/commands/translation.js.map +1 -0
  71. package/dist/commands/versions.d.ts +6 -0
  72. package/dist/commands/versions.d.ts.map +1 -0
  73. package/dist/commands/versions.js +61 -0
  74. package/dist/commands/versions.js.map +1 -0
  75. package/dist/context.d.ts +85 -0
  76. package/dist/context.d.ts.map +1 -0
  77. package/dist/context.js +386 -0
  78. package/dist/context.js.map +1 -0
  79. package/dist/formatters/core.d.ts +31 -0
  80. package/dist/formatters/core.d.ts.map +1 -0
  81. package/dist/formatters/core.js +176 -0
  82. package/dist/formatters/core.js.map +1 -0
  83. package/dist/formatters/ops.d.ts +43 -0
  84. package/dist/formatters/ops.d.ts.map +1 -0
  85. package/dist/formatters/ops.js +112 -0
  86. package/dist/formatters/ops.js.map +1 -0
  87. package/dist/formatters/registry.d.ts +41 -0
  88. package/dist/formatters/registry.d.ts.map +1 -0
  89. package/dist/formatters/registry.js +167 -0
  90. package/dist/formatters/registry.js.map +1 -0
  91. package/dist/formatters/table.d.ts +18 -0
  92. package/dist/formatters/table.d.ts.map +1 -0
  93. package/dist/formatters/table.js +76 -0
  94. package/dist/formatters/table.js.map +1 -0
  95. package/dist/utils.d.ts +99 -0
  96. package/dist/utils.d.ts.map +1 -0
  97. package/dist/utils.js +201 -0
  98. package/dist/utils.js.map +1 -0
  99. package/package.json +57 -0
@@ -0,0 +1,61 @@
1
+ import { createRegistryContext, handleRegistryError } from '../context.js';
2
+ import { withSpinner } from '../utils.js';
3
+ import { formatVersions, formatVersionDiff } from '../formatters/registry.js';
4
+ /**
5
+ * Register version commands
6
+ */
7
+ export function registerVersionCommands(program) {
8
+ const versions = program
9
+ .command('versions')
10
+ .description('Manage definition versions');
11
+ // ulu versions list <type> <name>
12
+ versions
13
+ .command('list <type> <name>')
14
+ .description('List version history for a definition')
15
+ .action(async (type, name, _, cmd) => {
16
+ const globalOpts = cmd.optsWithGlobals();
17
+ const ctx = createRegistryContext(globalOpts);
18
+ try {
19
+ const data = await withSpinner(ctx, { start: 'Fetching versions...', failure: 'Failed to fetch versions' }, () => ctx.client.versions.list(type, name));
20
+ if (ctx.json) {
21
+ console.log(JSON.stringify(data, null, 2));
22
+ }
23
+ else if (!data.versions || data.versions.length === 0) {
24
+ console.log('No versions found');
25
+ }
26
+ else {
27
+ console.log(formatVersions(data.versions));
28
+ console.log(`\n${data.versions.length} versions`);
29
+ }
30
+ }
31
+ catch (error) {
32
+ handleRegistryError(error, ctx);
33
+ }
34
+ });
35
+ // ulu versions diff <type> <name> <from> <to>
36
+ versions
37
+ .command('diff <type> <name> <from> <to>')
38
+ .description('Compare two versions of a definition')
39
+ .action(async (type, name, from, to, _, cmd) => {
40
+ const globalOpts = cmd.optsWithGlobals();
41
+ const ctx = createRegistryContext(globalOpts);
42
+ try {
43
+ const result = await withSpinner(ctx, { start: 'Comparing versions...', failure: 'Failed to compare versions' }, () => ctx.client.versions.diff(type, name, from, to));
44
+ if (ctx.json) {
45
+ console.log(JSON.stringify(result, null, 2));
46
+ }
47
+ else {
48
+ if ('fromYaml' in result || 'sectionsModified' in result) {
49
+ console.log(formatVersionDiff(result));
50
+ }
51
+ else {
52
+ console.log(JSON.stringify(result, null, 2));
53
+ }
54
+ }
55
+ }
56
+ catch (error) {
57
+ handleRegistryError(error, ctx);
58
+ }
59
+ });
60
+ }
61
+ //# sourceMappingURL=versions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../src/commands/versions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAsB,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9E;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,MAAM,QAAQ,GAAG,OAAO;SACrB,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,4BAA4B,CAAC,CAAC;IAE7C,kCAAkC;IAClC,QAAQ;SACL,OAAO,CAAC,oBAAoB,CAAC;SAC7B,WAAW,CAAC,uCAAuC,CAAC;SACpD,MAAM,CAAC,KAAK,EAAE,IAAY,EAAE,IAAY,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE;QACnD,MAAM,UAAU,GAAG,GAAG,CAAC,eAAe,EAAmB,CAAC;QAC1D,MAAM,GAAG,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAE9C,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,WAAW,CAC5B,GAAG,EACH,EAAE,KAAK,EAAE,sBAAsB,EAAE,OAAO,EAAE,0BAA0B,EAAE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C,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAsB,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CACvE,CAAC;YAEF,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;gBACb,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC/C,CAAC;iBAAM,CAAC;gBACN,IAAI,UAAU,IAAI,MAAM,IAAI,kBAAkB,IAAI,MAAM,EAAE,CAAC;oBACzD,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,MAA0C,CAAC,CAAC,CAAC;gBAC7E,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBAC/C,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,mBAAmB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAClC,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { OpsClient } from '@uluops/ops-sdk';
2
+ import { RegistryClient } from '@uluops/registry-sdk';
3
+ import { UluOpsClient } from '@uluops/core';
4
+ /**
5
+ * Global CLI options passed from commander
6
+ */
7
+ export interface GlobalOptions {
8
+ apiKey?: string;
9
+ profile?: string;
10
+ baseUrl?: string;
11
+ json?: boolean;
12
+ debug?: boolean;
13
+ quiet?: boolean;
14
+ timeout?: string;
15
+ }
16
+ /**
17
+ * CLI execution context for ops commands
18
+ */
19
+ export interface OpsCliContext {
20
+ client: OpsClient;
21
+ json: boolean;
22
+ debug: boolean;
23
+ quiet: boolean;
24
+ }
25
+ /**
26
+ * CLI execution context for registry commands
27
+ */
28
+ export interface RegistryCliContext {
29
+ client: RegistryClient;
30
+ json: boolean;
31
+ debug: boolean;
32
+ quiet: boolean;
33
+ }
34
+ /**
35
+ * Options specific to exec commands
36
+ */
37
+ export interface CoreExecOptions {
38
+ localDefinitions?: string;
39
+ registryUrl?: string;
40
+ project?: string;
41
+ tracking?: boolean;
42
+ }
43
+ /**
44
+ * CLI execution context for core SDK commands (exec)
45
+ */
46
+ export interface CoreCliContext {
47
+ client: UluOpsClient;
48
+ json: boolean;
49
+ debug: boolean;
50
+ quiet: boolean;
51
+ }
52
+ /**
53
+ * Create CLI context for ops commands
54
+ */
55
+ export declare function createOpsContext(options: GlobalOptions): OpsCliContext;
56
+ /**
57
+ * Create CLI context for registry commands
58
+ */
59
+ export declare function createRegistryContext(options: GlobalOptions): RegistryCliContext;
60
+ /**
61
+ * Create context without requiring credentials (for commands like login)
62
+ */
63
+ export declare function createUnauthenticatedContext(options: GlobalOptions): {
64
+ baseUrl: string;
65
+ json: boolean;
66
+ debug: boolean;
67
+ quiet: boolean;
68
+ };
69
+ /**
70
+ * Create CLI context for core SDK commands (exec)
71
+ */
72
+ export declare function createCoreContext(options: GlobalOptions & CoreExecOptions, modelOverride?: string): CoreCliContext;
73
+ /**
74
+ * Handle ops errors consistently
75
+ */
76
+ export declare function handleOpsError(error: unknown, ctx: Pick<OpsCliContext, 'json' | 'debug'>): never;
77
+ /**
78
+ * Handle registry errors consistently
79
+ */
80
+ export declare function handleRegistryError(error: unknown, ctx: Pick<RegistryCliContext, 'json' | 'debug'>): never;
81
+ /**
82
+ * Handle core SDK errors consistently
83
+ */
84
+ export declare function handleCoreError(error: unknown, ctx: Pick<CoreCliContext, 'json' | 'debug'>): never;
85
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA4C,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,EACL,YAAY,EAYb,MAAM,cAAc,CAAC;AAOt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AAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAavI;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,aAAa,GAAG,eAAe,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,cAAc,CAuDlH;AA6ED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,KAAK,CAOhG;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,KAAK,CAW1G;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,KAAK,CAqGlG"}
@@ -0,0 +1,386 @@
1
+ import { OpsClient, loadConfig as loadOpsConfig, OpsApiError } from '@uluops/ops-sdk';
2
+ import { RegistryClient } from '@uluops/registry-sdk';
3
+ import { RegistryApiError } from '@uluops/registry-sdk/errors';
4
+ import { loadConfig as loadRegistryConfig } from '@uluops/registry-sdk/config';
5
+ import { UluOpsClient, UluOpsError, ConfigurationError, ExecutionError, ModelNotFoundError, PreflightError, ParseError, SubmissionError, WorkflowError, PipelineError, SdkApiError, SubscriptionRequiredError, } from '@uluops/core';
6
+ import { existsSync, readFileSync } from 'node:fs';
7
+ import { join } from 'node:path';
8
+ import { homedir } from 'node:os';
9
+ import { exitWithError, parseIntOption } from './utils.js';
10
+ /**
11
+ * Check if the stored session for a profile is expired.
12
+ * Used to give a specific error message instead of generic "No credentials found".
13
+ */
14
+ function isSessionExpired(profile) {
15
+ const credPath = join(homedir(), '.uluops', 'credentials.json');
16
+ if (!existsSync(credPath))
17
+ return false;
18
+ try {
19
+ const stored = JSON.parse(readFileSync(credPath, 'utf-8'));
20
+ const creds = stored[profile];
21
+ if (creds?.type === 'session' && creds.expiresAt) {
22
+ return new Date(creds.expiresAt) <= new Date();
23
+ }
24
+ }
25
+ catch {
26
+ // Ignore parse errors — handled elsewhere
27
+ }
28
+ return false;
29
+ }
30
+ /**
31
+ * Validate that credentials exist, exiting with a helpful message if not.
32
+ * Checks for expired sessions and provides appropriate guidance.
33
+ */
34
+ function requireCredentials(hasCredentials, profile) {
35
+ if (hasCredentials)
36
+ return;
37
+ if (isSessionExpired(profile)) {
38
+ exitWithError(`Session expired for profile "${profile}".\n` +
39
+ 'Run "ulu auth login" to re-authenticate.');
40
+ }
41
+ exitWithError('No credentials found.\n' +
42
+ 'Set ULUOPS_API_KEY environment variable, use --api-key flag,\n' +
43
+ 'or run "ulu auth login" to authenticate.');
44
+ }
45
+ /**
46
+ * Create CLI context for ops commands
47
+ */
48
+ export function createOpsContext(options) {
49
+ const config = loadOpsConfig({
50
+ apiKey: options.apiKey,
51
+ baseUrl: options.baseUrl,
52
+ profile: options.profile,
53
+ debug: options.debug,
54
+ });
55
+ const hasCredentials = config.credentials.apiKey ||
56
+ config.credentials.sessionToken ||
57
+ (config.credentials.email && config.credentials.password);
58
+ requireCredentials(hasCredentials, options.profile ?? 'default');
59
+ const timeout = options.timeout ? parseIntOption(options.timeout, '--timeout') : undefined;
60
+ let client;
61
+ try {
62
+ client = new OpsClient({
63
+ apiKey: config.credentials.apiKey,
64
+ sessionToken: config.credentials.sessionToken,
65
+ email: config.credentials.email,
66
+ password: config.credentials.password,
67
+ baseUrl: config.baseUrl,
68
+ debug: config.debug,
69
+ timeout,
70
+ });
71
+ }
72
+ catch (error) {
73
+ exitWithError(error instanceof Error ? error.message : String(error));
74
+ }
75
+ return {
76
+ client,
77
+ json: options.json ?? false,
78
+ debug: options.debug ?? false,
79
+ quiet: options.quiet ?? false,
80
+ };
81
+ }
82
+ /**
83
+ * Create CLI context for registry commands
84
+ */
85
+ export function createRegistryContext(options) {
86
+ // Load ops config to get authBaseUrl (ops API URL for login/refresh)
87
+ const opsConfig = loadOpsConfig({
88
+ baseUrl: options.baseUrl,
89
+ profile: options.profile,
90
+ debug: options.debug,
91
+ });
92
+ const config = loadRegistryConfig({
93
+ apiKey: options.apiKey,
94
+ baseUrl: options.baseUrl,
95
+ authBaseUrl: opsConfig.baseUrl,
96
+ profile: options.profile,
97
+ debug: options.debug,
98
+ });
99
+ const hasCredentials = config.credentials.apiKey ||
100
+ config.credentials.sessionToken ||
101
+ (config.credentials.email && config.credentials.password);
102
+ requireCredentials(hasCredentials, options.profile ?? 'default');
103
+ const timeout = options.timeout ? parseIntOption(options.timeout, '--timeout') : undefined;
104
+ let client;
105
+ try {
106
+ client = new RegistryClient({
107
+ apiKey: config.credentials.apiKey,
108
+ email: config.credentials.email,
109
+ password: config.credentials.password,
110
+ sessionToken: config.credentials.sessionToken,
111
+ baseUrl: config.baseUrl,
112
+ authBaseUrl: config.authBaseUrl,
113
+ debug: config.debug,
114
+ timeout,
115
+ });
116
+ }
117
+ catch (error) {
118
+ exitWithError(error instanceof Error ? error.message : String(error));
119
+ }
120
+ return {
121
+ client,
122
+ json: options.json ?? false,
123
+ debug: options.debug ?? false,
124
+ quiet: options.quiet ?? false,
125
+ };
126
+ }
127
+ /**
128
+ * Create context without requiring credentials (for commands like login)
129
+ */
130
+ export function createUnauthenticatedContext(options) {
131
+ const config = loadOpsConfig({
132
+ baseUrl: options.baseUrl,
133
+ profile: options.profile,
134
+ debug: options.debug,
135
+ });
136
+ return {
137
+ baseUrl: config.baseUrl,
138
+ json: options.json ?? false,
139
+ debug: options.debug ?? false,
140
+ quiet: options.quiet ?? false,
141
+ };
142
+ }
143
+ /**
144
+ * Create CLI context for core SDK commands (exec)
145
+ */
146
+ export function createCoreContext(options, modelOverride) {
147
+ // Resolve API key from global options or env
148
+ const opsConfig = loadOpsConfig({
149
+ apiKey: options.apiKey,
150
+ baseUrl: options.baseUrl,
151
+ profile: options.profile,
152
+ debug: options.debug,
153
+ });
154
+ const apiKey = opsConfig.credentials.apiKey ?? options.apiKey;
155
+ // API key is optional when using local definitions with tracking disabled —
156
+ // the core SDK handles this gracefully (local-only execution, no remote calls).
157
+ const localOnly = !!options.localDefinitions && options.tracking === false;
158
+ if (!apiKey && !localOnly) {
159
+ requireCredentials(false, options.profile ?? 'default');
160
+ }
161
+ const thinkingBudgetEnv = process.env['ULUOPS_THINKING_BUDGET'];
162
+ const thinkingBudget = thinkingBudgetEnv ? parseInt(thinkingBudgetEnv, 10) : undefined;
163
+ const config = {
164
+ apiKey,
165
+ localDefinitions: options.localDefinitions,
166
+ trackingEnabled: options.tracking,
167
+ defaultProject: options.project,
168
+ submissionUrl: process.env['ULUOPS_SUBMISSION_URL'] ?? opsConfig.baseUrl,
169
+ debug: options.debug,
170
+ ...(thinkingBudget !== undefined && !Number.isNaN(thinkingBudget) ? { defaultThinkingBudget: thinkingBudget } : {}),
171
+ };
172
+ if (modelOverride) {
173
+ config.ai = { ...config.ai, modelOverride };
174
+ }
175
+ if (options.registryUrl) {
176
+ config.registryUrl = options.registryUrl;
177
+ }
178
+ const timeout = options.timeout ? parseIntOption(options.timeout, '--timeout') : undefined;
179
+ if (timeout !== undefined) {
180
+ config.timeout = timeout;
181
+ }
182
+ let client;
183
+ try {
184
+ client = new UluOpsClient(config);
185
+ }
186
+ catch (error) {
187
+ exitWithError(error instanceof Error ? error.message : String(error));
188
+ }
189
+ return {
190
+ client,
191
+ json: options.json ?? false,
192
+ debug: options.debug ?? false,
193
+ quiet: options.quiet ?? false,
194
+ };
195
+ }
196
+ /**
197
+ * Print error details with contextual hints based on status code/error code.
198
+ * Shared logic for both ops and registry error handlers.
199
+ */
200
+ function printApiErrorDetails(error, ctx, hints = {}) {
201
+ if (ctx.json) {
202
+ console.error(JSON.stringify(error.toJSON(), null, 2));
203
+ }
204
+ else {
205
+ console.error(`Error: ${error.message}`);
206
+ if (error.code === 'UNAUTHORIZED' || error.statusCode === 401) {
207
+ console.error('\nHint: Your credentials may be invalid or expired.');
208
+ console.error(hints.unauthorized ?? 'Run "ulu auth login" or check your ULUOPS_API_KEY.');
209
+ }
210
+ else if (error.code === 'NOT_FOUND' || error.statusCode === 404) {
211
+ console.error(`\nHint: ${hints.notFound ?? 'The resource was not found. Check the name or ID.'}`);
212
+ }
213
+ else if (error.code === 'VALIDATION_ERROR' || error.statusCode === 400) {
214
+ console.error(`\nHint: ${hints.validation ?? 'Invalid input. Check the command arguments.'}`);
215
+ }
216
+ else if (error.code === 'SUBSCRIPTION_REQUIRED' || error.statusCode === 402) {
217
+ const details = error.details;
218
+ const requiredTier = details?.requiredTier;
219
+ const upgradeUrl = details?.upgradeUrl;
220
+ const sep = upgradeUrl?.includes('?') ? '&' : '?';
221
+ const trackedUrl = upgradeUrl ? `${upgradeUrl}${sep}source=cli` : undefined;
222
+ console.error('');
223
+ console.error('┌─────────────────────────────────────────────────┐');
224
+ console.error(`│ Subscription required${requiredTier ? `: ${requiredTier} tier or higher` : ''}`.padEnd(50) + '│');
225
+ console.error('│ │');
226
+ if (trackedUrl) {
227
+ console.error(`│ Upgrade: ${trackedUrl}`.padEnd(50) + '│');
228
+ }
229
+ console.error('└─────────────────────────────────────────────────┘');
230
+ }
231
+ else if (error.code === 'RATE_LIMITED' || error.statusCode === 429) {
232
+ console.error('\nHint: Rate limited. Wait a moment and try again.');
233
+ }
234
+ else if (error.code === 'SERVICE_UNAVAILABLE' || error.statusCode === 503) {
235
+ const retryAfter = error.details?.retryAfter;
236
+ if (retryAfter) {
237
+ console.error(`\nHint: Service unavailable. Try again in ${retryAfter} seconds.`);
238
+ }
239
+ else {
240
+ console.error('\nHint: Service unavailable. Try again in a few moments.');
241
+ }
242
+ }
243
+ if (ctx.debug && error.details) {
244
+ console.error('\nDetails:', JSON.stringify(error.details, null, 2));
245
+ }
246
+ if (error.requestId) {
247
+ console.error(`\nRequest ID: ${error.requestId}`);
248
+ }
249
+ }
250
+ }
251
+ /**
252
+ * Handle ops errors consistently
253
+ */
254
+ export function handleOpsError(error, ctx) {
255
+ if (error instanceof OpsApiError) {
256
+ printApiErrorDetails(error, ctx);
257
+ process.exit(1);
258
+ }
259
+ handleGenericError(error, ctx);
260
+ }
261
+ /**
262
+ * Handle registry errors consistently
263
+ */
264
+ export function handleRegistryError(error, ctx) {
265
+ if (error instanceof RegistryApiError) {
266
+ printApiErrorDetails(error, ctx, {
267
+ unauthorized: 'Check your ULUOPS_API_KEY or session token.',
268
+ notFound: 'The resource was not found. Check the type, name, and version.',
269
+ validation: 'Invalid input. Check the command arguments or YAML file.',
270
+ });
271
+ process.exit(1);
272
+ }
273
+ handleGenericError(error, ctx);
274
+ }
275
+ /**
276
+ * Handle core SDK errors consistently
277
+ */
278
+ export function handleCoreError(error, ctx) {
279
+ if (error instanceof SubscriptionRequiredError) {
280
+ if (ctx.json) {
281
+ console.error(JSON.stringify(error.toJSON(), null, 2));
282
+ }
283
+ else {
284
+ const defLabel = error.definition?.name
285
+ ? `"${error.definition.displayName ?? error.definition.name}"`
286
+ : 'this definition';
287
+ const trackedUrl = error.trackedUpgradeUrl('cli');
288
+ console.error(`Error: ${defLabel} requires ${error.requiredTier} tier or higher (current: ${error.currentTier})`);
289
+ console.error('');
290
+ console.error('┌─────────────────────────────────────────────────┐');
291
+ console.error(`│ Upgrade to ${error.requiredTier} to access this content`.padEnd(50) + '│');
292
+ console.error('│ │');
293
+ if (trackedUrl) {
294
+ console.error(`│ ${trackedUrl}`.padEnd(50) + '│');
295
+ }
296
+ console.error('└─────────────────────────────────────────────────┘');
297
+ }
298
+ process.exit(1);
299
+ }
300
+ if (error instanceof SdkApiError) {
301
+ printApiErrorDetails(error, ctx, {
302
+ unauthorized: 'Check your ULUOPS_API_KEY environment variable.',
303
+ notFound: 'The definition was not found. Check the name and version.',
304
+ validation: 'Invalid request. Check the command arguments.',
305
+ });
306
+ process.exit(1);
307
+ }
308
+ if (error instanceof ConfigurationError) {
309
+ console.error(`Error: ${error.message}`);
310
+ console.error('\nHint: Check ULUOPS_API_KEY and ANTHROPIC_API_KEY environment variables.');
311
+ process.exit(1);
312
+ }
313
+ if (error instanceof ModelNotFoundError) {
314
+ console.error(`Error: ${error.message}`);
315
+ console.error('\nHint: Use --model with a known alias (haiku, sonnet, opus) or provider:modelId format.');
316
+ process.exit(1);
317
+ }
318
+ if (error instanceof PreflightError) {
319
+ console.error(`Error: Pre-flight check "${error.check}" failed: ${error.message}`);
320
+ if (ctx.debug && error.details) {
321
+ console.error('\nDetails:', JSON.stringify(error.details, null, 2));
322
+ }
323
+ process.exit(1);
324
+ }
325
+ if (error instanceof ParseError) {
326
+ console.error(`Error: ${error.message}`);
327
+ if (ctx.debug) {
328
+ console.error('\nContent preview:', error.contentPreview);
329
+ }
330
+ else {
331
+ console.error('\nHint: Run with --debug to see the raw output that failed to parse.');
332
+ }
333
+ process.exit(1);
334
+ }
335
+ if (error instanceof SubmissionError) {
336
+ console.error(`Error: ${error.message}`);
337
+ if (error.code) {
338
+ console.error(`\nSubmission error code: ${error.code}`);
339
+ }
340
+ process.exit(1);
341
+ }
342
+ if (error instanceof ExecutionError) {
343
+ console.error(`Error: ${error.message}`);
344
+ console.error('\nHint: Check that the target path exists and the agent definition is valid.');
345
+ if (ctx.debug && error.partialResult) {
346
+ console.error('\nPartial result:', JSON.stringify(error.partialResult, null, 2));
347
+ }
348
+ process.exit(1);
349
+ }
350
+ if (error instanceof WorkflowError) {
351
+ console.error(`Error: ${error.message}`);
352
+ if (ctx.debug && error.context?.partialResult) {
353
+ console.error('\nPartial result:', JSON.stringify(error.context.partialResult, null, 2));
354
+ }
355
+ process.exit(1);
356
+ }
357
+ if (error instanceof PipelineError) {
358
+ console.error(`Error: ${error.message}`);
359
+ process.exit(1);
360
+ }
361
+ if (error instanceof UluOpsError) {
362
+ console.error(`Error: ${error.message}`);
363
+ process.exit(1);
364
+ }
365
+ handleGenericError(error, ctx);
366
+ }
367
+ /**
368
+ * Handle generic/network errors
369
+ */
370
+ function handleGenericError(error, ctx) {
371
+ if (ctx.json) {
372
+ console.error(JSON.stringify({ error: String(error) }));
373
+ }
374
+ else {
375
+ const message = error instanceof Error ? error.message : String(error);
376
+ console.error(`Error: ${message}`);
377
+ if (message.includes('ECONNREFUSED') || message.includes('network')) {
378
+ console.error('\nHint: Cannot connect to the API. Check if the server is running.');
379
+ }
380
+ if (ctx.debug && error instanceof Error && error.stack) {
381
+ console.error('\nStack trace:', error.stack);
382
+ }
383
+ }
384
+ process.exit(1);
385
+ }
386
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,IAAI,aAAa,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EACL,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,eAAe,EACf,aAAa,EACb,aAAa,EACb,WAAW,EACX,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAuD3D;;;GAGG;AACH,SAAS,gBAAgB,CAAC,OAAe;IACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAAC;IAChE,IAAI,CA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AAY,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YACvD,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Formatters for @uluops/core SDK types (agent results, execution results, definitions)
3
+ */
4
+ import type { AgentResult, ExecutionResult, Recommendation, DefinitionSummary, DefinitionType } from '@uluops/core';
5
+ /**
6
+ * Format an agent execution result
7
+ */
8
+ export declare function formatAgentResult(result: AgentResult): string;
9
+ /**
10
+ * Format a generic execution result (commands, workflows)
11
+ */
12
+ export declare function formatExecutionResult(result: ExecutionResult): string;
13
+ /**
14
+ * Format recommendations grouped by priority
15
+ */
16
+ export declare function formatRecommendations(recs: Recommendation[]): string;
17
+ /**
18
+ * Format a list of definitions as a table
19
+ */
20
+ export declare function formatDefinitionList(items: DefinitionSummary[]): string;
21
+ /**
22
+ * Format definition details from describe()
23
+ */
24
+ export declare function formatDefinitionDetails(details: {
25
+ type: DefinitionType;
26
+ name: string;
27
+ version: string;
28
+ hash: string;
29
+ interface: unknown;
30
+ }): string;
31
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/formatters/core.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,cAAc,EACf,MAAM,cAAc,CAAC;AAItB;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CA8D7D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAmCrE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,MAAM,CAyBpE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAWvE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAC/C,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,GAAG,MAAM,CAiBT"}