@outputai/cli 0.12.0 → 0.12.1-next.1243f78.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.
@@ -0,0 +1,60 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { formatCostReport } from '#utils/cost_formatter.js';
3
+ function llmResult(overrides = {}) {
4
+ return {
5
+ step: 'gen',
6
+ model: 'gemini-2.5-flash',
7
+ input: 1032,
8
+ output: 793,
9
+ cached: 0,
10
+ reasoning: 0,
11
+ originalCost: 0.0037,
12
+ adjustedCost: 0.0037,
13
+ incomplete: false,
14
+ ...overrides
15
+ };
16
+ }
17
+ function report(llmCalls) {
18
+ const originalCost = llmCalls.reduce((s, c) => s + c.originalCost, 0);
19
+ const adjustedCost = llmCalls.reduce((s, c) => s + c.adjustedCost, 0);
20
+ return {
21
+ traceFile: 'trace.json',
22
+ workflowName: 'w',
23
+ durationMs: 1000,
24
+ llmCalls,
25
+ llmOriginalCost: originalCost,
26
+ llmAdjustedCost: adjustedCost,
27
+ totalInputTokens: 1032,
28
+ totalOutputTokens: 793,
29
+ totalCachedTokens: 0,
30
+ totalReasoningTokens: 0,
31
+ httpCosts: [],
32
+ httpOriginalCost: 0,
33
+ httpAdjustedCost: 0,
34
+ originalTotalCost: originalCost,
35
+ totalCost: adjustedCost
36
+ };
37
+ }
38
+ describe('formatCostReport incomplete marker', () => {
39
+ it('marks the model row with an unpriced charge and prints the footnote', () => {
40
+ const out = formatCostReport(report([llmResult({ model: 'gemini-2.5-flash', incomplete: true })]));
41
+ const modelRow = out.split('\n').find(line => line.includes('gemini-2.5-flash'));
42
+ expect(modelRow).toContain('$0.0037 *');
43
+ expect(out).toContain('cost incomplete');
44
+ });
45
+ it('omits the marker and footnote when every call is fully priced', () => {
46
+ const out = formatCostReport(report([llmResult()]));
47
+ const modelRow = out.split('\n').find(line => line.includes('gemini-2.5-flash'));
48
+ expect(modelRow).not.toContain('*');
49
+ expect(out).not.toContain('cost incomplete');
50
+ });
51
+ it('marks the flagged call row in the verbose table', () => {
52
+ const out = formatCostReport(report([llmResult({ step: 'grounded', incomplete: true }), llmResult({ step: 'plain' })]), { verbose: true });
53
+ const lines = out.split('\n');
54
+ const groundedRow = lines.find(line => line.includes('grounded'));
55
+ const plainRow = lines.find(line => line.includes('plain'));
56
+ expect(groundedRow).toContain('$0.0037 *');
57
+ expect(plainRow).not.toContain('*');
58
+ expect(out).toContain('cost incomplete');
59
+ });
60
+ });
@@ -1752,5 +1752,5 @@
1752
1752
  ]
1753
1753
  }
1754
1754
  },
1755
- "version": "0.12.0"
1755
+ "version": "0.12.1-next.1243f78.0"
1756
1756
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outputai/cli",
3
- "version": "0.12.0",
3
+ "version": "0.12.1-next.1243f78.0",
4
4
  "description": "CLI for Output.ai workflow generation",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -30,15 +30,15 @@
30
30
  "handlebars": "4.7.9",
31
31
  "ink": "7.0.1",
32
32
  "ink-spinner": "5.0.0",
33
- "js-yaml": "4.3.1",
33
+ "js-yaml": "4.3.2",
34
34
  "json-schema-library": "11.4.0",
35
35
  "ky": "2.0.2",
36
36
  "react": "19.2.5",
37
37
  "semver": "7.7.4",
38
38
  "undici": "8.9.0",
39
- "@outputai/credentials": "0.12.0",
40
- "@outputai/llm": "0.12.0",
41
- "@outputai/evals": "0.12.0"
39
+ "@outputai/evals": "0.12.1-next.1243f78.0",
40
+ "@outputai/llm": "0.12.1-next.1243f78.0",
41
+ "@outputai/credentials": "0.12.1-next.1243f78.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/cli-progress": "3.11.6",
@@ -47,7 +47,7 @@
47
47
  "@types/react": "19.2.14",
48
48
  "@types/semver": "7.7.1",
49
49
  "oclif": "4.23.10",
50
- "orval": "8.9.0"
50
+ "orval": "8.24.0"
51
51
  },
52
52
  "license": "Apache-2.0",
53
53
  "publishConfig": {
@@ -1,11 +0,0 @@
1
- /**
2
- * Orval post-generation hook to fix ES module imports by adding .js extensions
3
- * and update RequestInit types to use our custom ApiRequestOptions.
4
- * This is necessary because the SDK uses "type": "module" in package.json,
5
- * which requires all relative imports to have explicit .js extensions.
6
- */
7
- export declare function fixEsmImports(outputPath: string): Promise<void>;
8
- /**
9
- * Run ESLint fix on generated files to ensure they follow project standards
10
- */
11
- export declare function runEslintFix(): Promise<void>;
@@ -1,46 +0,0 @@
1
- import { readFileSync, writeFileSync } from 'fs';
2
- import { execSync } from 'child_process';
3
- /**
4
- * Orval post-generation hook to fix ES module imports by adding .js extensions
5
- * and update RequestInit types to use our custom ApiRequestOptions.
6
- * This is necessary because the SDK uses "type": "module" in package.json,
7
- * which requires all relative imports to have explicit .js extensions.
8
- */
9
- export async function fixEsmImports(outputPath) {
10
- const originalContent = readFileSync(outputPath, 'utf8');
11
- // Apply all transformations in sequence
12
- const transformedContent = originalContent
13
- // Fix ESM imports
14
- .replace(/from '\.\.\/http_client'/g, 'from \'../http_client.js\'')
15
- // Import ApiRequestOptions type from http_client
16
- .replace(/import { customFetchInstance } from '\.\.\/http_client\.js';/, match => {
17
- if (!originalContent.includes('ApiRequestOptions')) {
18
- return 'import { customFetchInstance, type ApiRequestOptions } from \'../http_client.js\';';
19
- }
20
- return match;
21
- })
22
- // Replace RequestInit with ApiRequestOptions in function signatures
23
- .replace(/options\?: RequestInit/g, 'options?: ApiRequestOptions');
24
- writeFileSync(outputPath, transformedContent, 'utf8');
25
- console.log('✅ Fixed ESM imports and updated types in Orval generated file');
26
- }
27
- /**
28
- * Run ESLint fix on generated files to ensure they follow project standards
29
- */
30
- export async function runEslintFix() {
31
- try {
32
- execSync('npx eslint --fix src/api/generated/api.ts', {
33
- cwd: process.cwd(),
34
- stdio: 'pipe' // Suppress output
35
- });
36
- console.log('✅ Applied ESLint fixes to generated file');
37
- }
38
- catch (error) {
39
- if (error instanceof Error && 'status' in error && error.status === 1) {
40
- console.log('✅ Applied ESLint fixes to generated file (with warnings)');
41
- }
42
- else {
43
- console.warn('⚠️ ESLint fix encountered an issue:', error instanceof Error ? error.message : error);
44
- }
45
- }
46
- }