Skip to content

Commit 17f5bf5

Browse files
committed
usage report
1 parent ca1ac82 commit 17f5bf5

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

packages/cli/src/convert.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export async function convertFiles(
134134
(filename) => ({ filename }) as WorkspaceFile
135135
)
136136

137+
const stats: object[] = []
137138
const usage = new GenerationStats("")
138139
const results: Record<string, string> = {}
139140
const p = new PLimitPromiseQueue(normalizeInt(concurrency) || 1)
@@ -232,6 +233,7 @@ export async function convertFiles(
232233
results[file.filename] = text
233234
const end = m()
234235
usage.addUsage(result.stats, end)
236+
if (result.stats) stats.push(result.stats)
235237
} catch (error) {
236238
logError(error)
237239
fileTrace.error(undefined, error)
@@ -242,5 +244,8 @@ export async function convertFiles(
242244
})
243245

244246
usage.log()
247+
usage.trace(convertTrace)
248+
249+
convertTrace.table(stats)
245250
logVerbose(`trace: ${outTraceFilename}`)
246251
}

packages/core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
"typecheck": "tsc -p src",
109109
"prompts:bundle": "node bundleprompts.js",
110110
"pretypecheck": "yarn prompts:bundle",
111+
"pretty": "prettier **.ts --write",
111112
"test": "node --import tsx --test src/**.test.*ts"
112113
},
113114
"dependencies": {

packages/sample/genaisrc/ast-docs-update.genai.mts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,8 @@ const file = env.files[0]
1616

1717
const prettier = async (file) => {
1818
// format
19-
const res = await host.exec("prettier", [
20-
"--write",
21-
file.filename,
22-
])
23-
if (!res.exitCode) throw new Error(res.stderr)
19+
const res = await host.exec("prettier", ["--write", file.filename])
20+
if (res.exitCode) throw new Error(`${res.stdout} (${res.exitCode})`)
2421
}
2522

2623
// normalize spacing
@@ -70,7 +67,7 @@ for (const match of matches) {
7067
responseType: "text",
7168
flexTokens: 12000,
7269
label: match.child(0).text(),
73-
temperature: 0.2
70+
temperature: 0.2,
7471
}
7572
)
7673
// if generation is successful, insert the docs

0 commit comments

Comments
 (0)