@skmtc/core 0.0.923 → 0.0.926
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.
- package/esm/context/CoreContext.d.ts +1 -1
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +3 -3
- package/esm/context/RenderContext.d.ts +10 -11
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/RenderContext.js +19 -34
- package/esm/helpers/naming.d.ts.map +1 -1
- package/esm/helpers/naming.js +1 -1
- package/esm/mod.d.ts +0 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +0 -1
- package/esm/run/toArtifacts.d.ts +2 -2
- package/esm/run/toArtifacts.d.ts.map +1 -1
- package/esm/run/toArtifacts.js +2 -2
- package/esm/typescript/FunctionParameter.d.ts.map +1 -1
- package/esm/typescript/FunctionParameter.js +1 -1
- package/package.json +1 -7
- package/script/context/CoreContext.d.ts +1 -1
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +3 -3
- package/script/context/RenderContext.d.ts +10 -11
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/RenderContext.js +19 -34
- package/script/helpers/naming.d.ts.map +1 -1
- package/script/helpers/naming.js +2 -2
- package/script/mod.d.ts +0 -1
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +0 -1
- package/script/run/toArtifacts.d.ts +2 -2
- package/script/run/toArtifacts.d.ts.map +1 -1
- package/script/run/toArtifacts.js +2 -2
- package/script/typescript/FunctionParameter.d.ts.map +1 -1
- package/script/typescript/FunctionParameter.js +2 -2
- package/esm/helpers/generationStats.d.ts +0 -312
- package/esm/helpers/generationStats.d.ts.map +0 -1
- package/esm/helpers/generationStats.js +0 -330
- package/script/helpers/generationStats.d.ts +0 -312
- package/script/helpers/generationStats.d.ts.map +0 -1
- package/script/helpers/generationStats.js +0 -339
|
@@ -55,13 +55,12 @@ const normalize_js_1 = require("../deps/jsr.io/@std/path/1.1.2/normalize.js");
|
|
|
55
55
|
const toResolvedArtifactPath_js_1 = require("../helpers/toResolvedArtifactPath.js");
|
|
56
56
|
const tracer_js_1 = require("../helpers/tracer.js");
|
|
57
57
|
const File_js_1 = require("../dsl/File.js");
|
|
58
|
-
const prettier = __importStar(require("prettier"));
|
|
59
58
|
/**
|
|
60
59
|
* The rendering context for the final phase of the SKMTC transformation pipeline.
|
|
61
60
|
*
|
|
62
61
|
* `RenderContext` is responsible for taking the generated artifacts from the generation
|
|
63
62
|
* phase and rendering them into their final form with proper formatting, path resolution,
|
|
64
|
-
* and file preparation. It handles code formatting via
|
|
63
|
+
* and file preparation. It handles code formatting via Biome, path normalization,
|
|
65
64
|
* and produces the final artifacts ready for writing to the filesystem.
|
|
66
65
|
*
|
|
67
66
|
* This context represents the culmination of the three-phase SKMTC pipeline, transforming
|
|
@@ -69,7 +68,7 @@ const prettier = __importStar(require("prettier"));
|
|
|
69
68
|
*
|
|
70
69
|
* ## Key Features
|
|
71
70
|
*
|
|
72
|
-
* - **Code Formatting**: Automatic
|
|
71
|
+
* - **Code Formatting**: Automatic Biome formatting for generated TypeScript/JavaScript code
|
|
73
72
|
* - **Path Resolution**: Intelligent path resolution with base path support
|
|
74
73
|
* - **Content Collation**: Combines all generated content into organized file structures
|
|
75
74
|
* - **Metadata Generation**: Tracks file statistics (lines, characters) and relationships
|
|
@@ -105,14 +104,13 @@ const prettier = __importStar(require("prettier"));
|
|
|
105
104
|
* });
|
|
106
105
|
* ```
|
|
107
106
|
*
|
|
108
|
-
* @example With custom
|
|
107
|
+
* @example With custom formatter configuration
|
|
109
108
|
* ```typescript
|
|
110
109
|
* const renderContext = new RenderContext({
|
|
111
110
|
* files: generatedFiles,
|
|
112
111
|
* previews: {},
|
|
113
112
|
* mappings: {},
|
|
114
113
|
* prettierConfig: {
|
|
115
|
-
* parser: 'typescript',
|
|
116
114
|
* printWidth: 120,
|
|
117
115
|
* tabWidth: 2,
|
|
118
116
|
* semi: true,
|
|
@@ -266,7 +264,7 @@ class RenderContext {
|
|
|
266
264
|
writable: true,
|
|
267
265
|
value: void 0
|
|
268
266
|
});
|
|
269
|
-
/** Optional
|
|
267
|
+
/** Optional formatter configuration (using Prettier format for compatibility) */
|
|
270
268
|
_RenderContext_prettierConfig.set(this, void 0);
|
|
271
269
|
/** Base path for resolving file paths */
|
|
272
270
|
Object.defineProperty(this, "basePath", {
|
|
@@ -304,7 +302,7 @@ class RenderContext {
|
|
|
304
302
|
* Renders all files in the context to their final formatted form.
|
|
305
303
|
*
|
|
306
304
|
* This is the main rendering method that orchestrates the collation and
|
|
307
|
-
* formatting of all generated files. It processes files through
|
|
305
|
+
* formatting of all generated files. It processes files through Biome
|
|
308
306
|
* formatting (if configured), resolves paths, and produces the final
|
|
309
307
|
* artifacts ready for writing to the filesystem.
|
|
310
308
|
*
|
|
@@ -334,10 +332,10 @@ class RenderContext {
|
|
|
334
332
|
* });
|
|
335
333
|
* ```
|
|
336
334
|
*/
|
|
337
|
-
|
|
338
|
-
return
|
|
339
|
-
const result =
|
|
340
|
-
return
|
|
335
|
+
render() {
|
|
336
|
+
return Sentry.startSpan({ name: 'Render artifacts' }, () => {
|
|
337
|
+
const result = Sentry.startSpan({ name: 'Collate content' }, () => {
|
|
338
|
+
return this.collate();
|
|
341
339
|
});
|
|
342
340
|
const rendered = {
|
|
343
341
|
artifacts: result.artifacts,
|
|
@@ -352,11 +350,11 @@ class RenderContext {
|
|
|
352
350
|
* Collates all files in the context into a unified render result.
|
|
353
351
|
*
|
|
354
352
|
* This method processes each file in the context through the rendering pipeline,
|
|
355
|
-
* applying
|
|
353
|
+
* applying Biome formatting and path resolution. It coordinates the parallel
|
|
356
354
|
* processing of all files and aggregates the results into a single output structure.
|
|
357
355
|
*
|
|
358
356
|
* The collation process includes:
|
|
359
|
-
* - File content rendering with optional
|
|
357
|
+
* - File content rendering with optional Biome formatting
|
|
360
358
|
* - Path resolution using base path configuration
|
|
361
359
|
* - Metadata calculation (line count, character count)
|
|
362
360
|
* - Result aggregation into artifacts and file metadata maps
|
|
@@ -375,9 +373,9 @@ class RenderContext {
|
|
|
375
373
|
* console.log(collated.files['/path/to/file.ts'].characters);
|
|
376
374
|
* ```
|
|
377
375
|
*/
|
|
378
|
-
|
|
376
|
+
collate() {
|
|
379
377
|
const fileEntries = Array.from(this.files.entries());
|
|
380
|
-
const
|
|
378
|
+
const fileObjects = fileEntries
|
|
381
379
|
.map(([destinationPath, file]) => {
|
|
382
380
|
return this.trace(destinationPath, () => {
|
|
383
381
|
const renderedFile = renderFile({
|
|
@@ -391,7 +389,6 @@ class RenderContext {
|
|
|
391
389
|
});
|
|
392
390
|
})
|
|
393
391
|
.filter(fileObject => fileObject !== undefined);
|
|
394
|
-
const fileObjects = await Promise.all(fileObjectPromises);
|
|
395
392
|
const output = {
|
|
396
393
|
artifacts: {},
|
|
397
394
|
files: {}
|
|
@@ -421,7 +418,7 @@ class RenderContext {
|
|
|
421
418
|
* @example
|
|
422
419
|
* ```typescript
|
|
423
420
|
* const result = renderContext.trace('format-file', () => {
|
|
424
|
-
* return
|
|
421
|
+
* return biome.formatContent(projectKey, content, { filePath: 'file.ts' });
|
|
425
422
|
* });
|
|
426
423
|
*
|
|
427
424
|
* // With hierarchical tracing
|
|
@@ -503,7 +500,7 @@ _RenderContext_prettierConfig = new WeakMap(), _RenderContext_stackTrail = new W
|
|
|
503
500
|
* Renders a single file with formatting and metadata calculation.
|
|
504
501
|
*
|
|
505
502
|
* This function processes a single file through the rendering pipeline,
|
|
506
|
-
* applying
|
|
503
|
+
* applying Biome formatting if configured and calculating file metadata
|
|
507
504
|
* such as line count and character count. It resolves the final path using
|
|
508
505
|
* the base path configuration.
|
|
509
506
|
*
|
|
@@ -525,25 +522,13 @@ _RenderContext_prettierConfig = new WeakMap(), _RenderContext_stackTrail = new W
|
|
|
525
522
|
* console.log(fileObject.characters); // 11
|
|
526
523
|
* ```
|
|
527
524
|
*/
|
|
528
|
-
const renderFile =
|
|
525
|
+
const renderFile = ({ content, destinationPath, basePath }) => {
|
|
529
526
|
const path = (0, toResolvedArtifactPath_js_1.toResolvedArtifactPath)({ basePath, destinationPath });
|
|
530
|
-
const formatted = await formatFile({ content, prettierConfig });
|
|
531
527
|
return {
|
|
532
|
-
content:
|
|
528
|
+
content: content,
|
|
533
529
|
path,
|
|
534
530
|
destinationPath,
|
|
535
|
-
lines:
|
|
536
|
-
characters:
|
|
531
|
+
lines: content.split('\n').length,
|
|
532
|
+
characters: content.length
|
|
537
533
|
};
|
|
538
534
|
};
|
|
539
|
-
const formatFile = async ({ content, prettierConfig }) => {
|
|
540
|
-
try {
|
|
541
|
-
return prettierConfig
|
|
542
|
-
? await prettier.format(content, { ...prettierConfig, parser: 'typescript' })
|
|
543
|
-
: content;
|
|
544
|
-
}
|
|
545
|
-
catch (e) {
|
|
546
|
-
console.error(e);
|
|
547
|
-
return content;
|
|
548
|
-
}
|
|
549
|
-
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"naming.d.ts","sourceRoot":"","sources":["../../src/helpers/naming.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"naming.d.ts","sourceRoot":"","sources":["../../src/helpers/naming.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAGhD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,YAAY,KAAG,OAAO,GAAG,UAElE,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,YAAY,KAAG,MAMxD,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,YAAY,KAAG,MAIxD,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,GAAI,WAAW,YAAY,KAAG,MAIpD,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,KAAG,MAK7C,CAAA"}
|
package/script/helpers/naming.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toMethodVerb = exports.toArgsName = exports.toResponseName = exports.toEndpointName = exports.toEndpointType = void 0;
|
|
4
|
-
const
|
|
4
|
+
const strings_js_1 = require("./strings.js");
|
|
5
5
|
const ts_pattern_1 = require("ts-pattern");
|
|
6
6
|
/**
|
|
7
7
|
* Determines the endpoint type based on HTTP method.
|
|
@@ -37,7 +37,7 @@ exports.toEndpointType = toEndpointType;
|
|
|
37
37
|
const toEndpointName = (operation) => {
|
|
38
38
|
const { path, method } = operation;
|
|
39
39
|
const verb = (0, exports.toMethodVerb)(method);
|
|
40
|
-
return (0,
|
|
40
|
+
return (0, strings_js_1.camelCase)(`${verb}Api${path}`);
|
|
41
41
|
};
|
|
42
42
|
exports.toEndpointName = toEndpointName;
|
|
43
43
|
/**
|
package/script/mod.d.ts
CHANGED
|
@@ -95,7 +95,6 @@ export * from './dsl/operation/types.js';
|
|
|
95
95
|
export * from './dsl/Stringable.js';
|
|
96
96
|
export * from './helpers/collateExamples.js';
|
|
97
97
|
export * from './helpers/formatNumber.js';
|
|
98
|
-
export * from './helpers/generationStats.js';
|
|
99
98
|
export * from './helpers/isEmpty.js';
|
|
100
99
|
export * from './helpers/isImported.js';
|
|
101
100
|
export * from './helpers/isGeneratorName.js';
|
package/script/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,OAAO,qBAAqB,CAAC;AAG7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,0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0B,CAAA;AACxC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,mCAAmC,CAAA;AACjD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uCAAuC,CAAA;AACrD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,iCAAiC,CAAA"}
|
package/script/mod.js
CHANGED
|
@@ -111,7 +111,6 @@ __exportStar(require("./dsl/operation/types.js"), exports);
|
|
|
111
111
|
__exportStar(require("./dsl/Stringable.js"), exports);
|
|
112
112
|
__exportStar(require("./helpers/collateExamples.js"), exports);
|
|
113
113
|
__exportStar(require("./helpers/formatNumber.js"), exports);
|
|
114
|
-
__exportStar(require("./helpers/generationStats.js"), exports);
|
|
115
114
|
__exportStar(require("./helpers/isEmpty.js"), exports);
|
|
116
115
|
__exportStar(require("./helpers/isImported.js"), exports);
|
|
117
116
|
__exportStar(require("./helpers/isGeneratorName.js"), exports);
|
|
@@ -128,9 +128,9 @@ type TransformArgs = {
|
|
|
128
128
|
* }
|
|
129
129
|
* ```
|
|
130
130
|
*/
|
|
131
|
-
export declare const toArtifacts: ({ traceId, spanId, documentObject, settings, prettier, toGeneratorConfigMap, logsPath, startAt, silent }: TransformArgs) =>
|
|
131
|
+
export declare const toArtifacts: ({ traceId, spanId, documentObject, settings, prettier, toGeneratorConfigMap, logsPath, startAt, silent }: TransformArgs) => {
|
|
132
132
|
artifacts: Record<string, string>;
|
|
133
133
|
manifest: ManifestContent;
|
|
134
|
-
}
|
|
134
|
+
};
|
|
135
135
|
export {};
|
|
136
136
|
//# sourceMappingURL=toArtifacts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toArtifacts.d.ts","sourceRoot":"","sources":["../../src/run/toArtifacts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,KAAK,aAAa,GAAG;IACnB,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAA;IACf,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAA;IACd,yCAAyC;IACzC,cAAc,EAAE,SAAS,CAAC,QAAQ,CAAA;IAClC,0DAA0D;IAC1D,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAA;IACpC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,4DAA4D;IAC5D,oBAAoB,EAA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AO,CAAA;CAChB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AACH,eAAO,MAAM,WAAW,GAAI,0GAUzB,aAAa,KAAG;IAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,QAAQ,EAAE,eAAe,CAAA;CAyBhF,CAAA"}
|
|
@@ -122,9 +122,9 @@ const CoreContext_js_1 = require("../context/CoreContext.js");
|
|
|
122
122
|
* }
|
|
123
123
|
* ```
|
|
124
124
|
*/
|
|
125
|
-
const toArtifacts =
|
|
125
|
+
const toArtifacts = ({ traceId, spanId, documentObject, settings, prettier, toGeneratorConfigMap, logsPath, startAt, silent }) => {
|
|
126
126
|
const context = new CoreContext_js_1.CoreContext({ spanId, logsPath, silent });
|
|
127
|
-
const { artifacts, files, previews, results, mappings } =
|
|
127
|
+
const { artifacts, files, previews, results, mappings } = context.toArtifacts({
|
|
128
128
|
settings,
|
|
129
129
|
toGeneratorConfigMap,
|
|
130
130
|
prettier,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionParameter.d.ts","sourceRoot":"","sources":["../../src/typescript/FunctionParameter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FunctionParameter.d.ts","sourceRoot":"","sources":["../../src/typescript/FunctionParameter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC/F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,IAAI,EAAwB,MAAM,WAAW,CAAA;AAItD;;GAEG;AACH,KAAK,qBAAqB,GAAG;IAC3B,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4CAA4C;IAC5C,cAAc,EAAE,UAAU,C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;;;;;;;OA8BG;IACH,cAAc,IAAI,IAAI;IAUtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,SAAS,IAAI,MAAM;IAUnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,QAAQ,IAAI,MAAM;CAoBnB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FunctionParameter = void 0;
|
|
4
4
|
const helper_validator_identifier_1 = require("@babel/helper-validator-identifier");
|
|
5
|
-
const
|
|
5
|
+
const strings_js_1 = require("../helpers/strings.js");
|
|
6
6
|
const ts_pattern_1 = require("ts-pattern");
|
|
7
7
|
const List_js_1 = require("./List.js");
|
|
8
8
|
const isEmpty_js_1 = require("../helpers/isEmpty.js");
|
|
@@ -420,7 +420,7 @@ exports.FunctionParameter = FunctionParameter;
|
|
|
420
420
|
*/
|
|
421
421
|
const toDestructured = (typeDefinition, { skipEmpty } = {}) => {
|
|
422
422
|
return List_js_1.List.fromKeys(typeDefinition.value.objectProperties?.properties).toObject(key => {
|
|
423
|
-
return (0, helper_validator_identifier_1.isIdentifierName)(key) ? key : List_js_1.List.toKeyValue(key, (0,
|
|
423
|
+
return (0, helper_validator_identifier_1.isIdentifierName)(key) ? key : List_js_1.List.toKeyValue(key, (0, strings_js_1.camelCase)(key));
|
|
424
424
|
}, {
|
|
425
425
|
skipEmpty
|
|
426
426
|
});
|
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
import "../_dnt.polyfills.js";
|
|
2
|
-
import type { ManifestContent } from '../types/Manifest.js';
|
|
3
|
-
import type { ResultsItem, ResultType } from '../types/Results.js';
|
|
4
|
-
/**
|
|
5
|
-
* Arguments for generating comprehensive statistics from the build manifest and artifacts.
|
|
6
|
-
*/
|
|
7
|
-
type GenerationStatsArgs = {
|
|
8
|
-
/** The generation manifest containing build metadata and results */
|
|
9
|
-
manifest: ManifestContent;
|
|
10
|
-
/** Generated artifacts as a map of file paths to content */
|
|
11
|
-
artifacts: Record<string, string>;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Comprehensive generation statistics extracted from build artifacts and manifest.
|
|
15
|
-
*/
|
|
16
|
-
export type GenerationStats = {
|
|
17
|
-
/** Total number of GPT tokens in generated content */
|
|
18
|
-
tokens: number;
|
|
19
|
-
/** Total number of lines generated */
|
|
20
|
-
lines: number;
|
|
21
|
-
/** Total generation time in milliseconds */
|
|
22
|
-
totalTime: number;
|
|
23
|
-
/** Error paths organized as nested arrays */
|
|
24
|
-
errors: string[][];
|
|
25
|
-
/** Total number of generated files */
|
|
26
|
-
files: number;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Generates comprehensive statistics about the code generation process.
|
|
30
|
-
*
|
|
31
|
-
* This function analyzes the generation manifest and produced artifacts to create
|
|
32
|
-
* detailed statistics including token counts, lines of code, timing information,
|
|
33
|
-
* error tracking, and file counts. It's used for performance monitoring, debugging,
|
|
34
|
-
* and reporting on generation runs.
|
|
35
|
-
*
|
|
36
|
-
* The function combines multiple analysis methods to provide a complete picture
|
|
37
|
-
* of the generation process, including tokenization analysis for cost estimation,
|
|
38
|
-
* error path extraction for debugging, and timing analysis for performance optimization.
|
|
39
|
-
*
|
|
40
|
-
* @param args - Generation analysis configuration
|
|
41
|
-
* @param args.manifest - The generation manifest with metadata and results
|
|
42
|
-
* @param args.artifacts - Map of file paths to generated content
|
|
43
|
-
* @returns Comprehensive generation statistics object
|
|
44
|
-
*
|
|
45
|
-
* @example Basic usage
|
|
46
|
-
* ```typescript
|
|
47
|
-
* import { toGenerationStats } from '@skmtc/core';
|
|
48
|
-
*
|
|
49
|
-
* const stats = toGenerationStats({
|
|
50
|
-
* manifest: {
|
|
51
|
-
* startAt: 1672531200000,
|
|
52
|
-
* endAt: 1672531245000,
|
|
53
|
-
* files: {
|
|
54
|
-
* './models.ts': { lines: 150, characters: 4500 },
|
|
55
|
-
* './types.ts': { lines: 80, characters: 2100 }
|
|
56
|
-
* },
|
|
57
|
-
* results: { }
|
|
58
|
-
* },
|
|
59
|
-
* artifacts: {
|
|
60
|
-
* './models.ts': 'export interface User { id: string; name: string; }',
|
|
61
|
-
* './types.ts': 'export type Status = "active" | "inactive";'
|
|
62
|
-
* }
|
|
63
|
-
* });
|
|
64
|
-
*
|
|
65
|
-
* console.log(stats);
|
|
66
|
-
* // {
|
|
67
|
-
* // tokens: 250,
|
|
68
|
-
* // lines: 230,
|
|
69
|
-
* // totalTime: 45000,
|
|
70
|
-
* // errors: [],
|
|
71
|
-
* // files: 2
|
|
72
|
-
* // }
|
|
73
|
-
* ```
|
|
74
|
-
*
|
|
75
|
-
* @example Performance monitoring
|
|
76
|
-
* ```typescript
|
|
77
|
-
* class GenerationMonitor {
|
|
78
|
-
* analyzeGeneration(manifest: ManifestContent, artifacts: Record<string, string>) {
|
|
79
|
-
* const stats = toGenerationStats({ manifest, artifacts });
|
|
80
|
-
*
|
|
81
|
-
* console.log(`Generation completed in ${stats.totalTime}ms`);
|
|
82
|
-
* console.log(`Generated ${stats.files} files with ${stats.lines} lines`);
|
|
83
|
-
* console.log(`Token usage: ${stats.tokens} tokens`);
|
|
84
|
-
*
|
|
85
|
-
* if (stats.errors.length > 0) {
|
|
86
|
-
* console.warn(`Found ${stats.errors.length} errors:`);
|
|
87
|
-
* stats.errors.forEach((errorPath, index) => {
|
|
88
|
-
* console.warn(` ${index + 1}. ${errorPath.join(' -> ')}`);
|
|
89
|
-
* });
|
|
90
|
-
* }
|
|
91
|
-
*
|
|
92
|
-
* return stats;
|
|
93
|
-
* }
|
|
94
|
-
* }
|
|
95
|
-
* ```
|
|
96
|
-
*
|
|
97
|
-
* @example Cost estimation
|
|
98
|
-
* ```typescript
|
|
99
|
-
* function estimateGenerationCost(stats: GenerationStats): number {
|
|
100
|
-
* const tokensPerDollar = 1000000; // Example rate
|
|
101
|
-
* const estimatedCost = stats.tokens / tokensPerDollar;
|
|
102
|
-
*
|
|
103
|
-
* console.log(`Estimated cost: $${estimatedCost.toFixed(4)}`);
|
|
104
|
-
* console.log(`Efficiency: ${stats.lines / stats.tokens} lines per token`);
|
|
105
|
-
*
|
|
106
|
-
* return estimatedCost;
|
|
107
|
-
* }
|
|
108
|
-
* ```
|
|
109
|
-
*
|
|
110
|
-
* @example Build reporting
|
|
111
|
-
* ```typescript
|
|
112
|
-
* function generateBuildReport(stats: GenerationStats): string {
|
|
113
|
-
* const efficiency = stats.totalTime / stats.files;
|
|
114
|
-
* const successRate = ((stats.files - stats.errors.length) / stats.files * 100).toFixed(1);
|
|
115
|
-
*
|
|
116
|
-
* return `
|
|
117
|
-
* Build Report:
|
|
118
|
-
* -----------
|
|
119
|
-
* Files Generated: ${stats.files}
|
|
120
|
-
* Total Lines: ${stats.lines.toLocaleString()}
|
|
121
|
-
* Token Count: ${stats.tokens.toLocaleString()}
|
|
122
|
-
* Generation Time: ${(stats.totalTime / 1000).toFixed(2)}s
|
|
123
|
-
* Average per File: ${efficiency.toFixed(0)}ms
|
|
124
|
-
* Success Rate: ${successRate}%
|
|
125
|
-
* Errors: ${stats.errors.length}
|
|
126
|
-
* `.trim();
|
|
127
|
-
* }
|
|
128
|
-
* ```
|
|
129
|
-
*/
|
|
130
|
-
export declare const toGenerationStats: ({ manifest, artifacts }: GenerationStatsArgs) => GenerationStats;
|
|
131
|
-
/**
|
|
132
|
-
* Calculates the total number of GPT tokens in all generated artifacts.
|
|
133
|
-
*
|
|
134
|
-
* This function uses GPT tokenization to count the total number of tokens
|
|
135
|
-
* across all generated code artifacts. This is useful for cost estimation
|
|
136
|
-
* when using token-based pricing models and for understanding the size
|
|
137
|
-
* and complexity of generated content.
|
|
138
|
-
*
|
|
139
|
-
* @param artifacts - Map of file paths to generated content strings
|
|
140
|
-
* @returns Total number of GPT tokens across all artifacts
|
|
141
|
-
*
|
|
142
|
-
* @example
|
|
143
|
-
* ```typescript
|
|
144
|
-
* const artifacts = {
|
|
145
|
-
* './models.ts': 'export interface User { id: string; name: string; }',
|
|
146
|
-
* './types.ts': 'export type Status = "active" | "inactive";'
|
|
147
|
-
* };
|
|
148
|
-
*
|
|
149
|
-
* const tokens = toManifestTokens(artifacts);
|
|
150
|
-
* console.log(tokens); // e.g., 24 tokens
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
export declare const toManifestTokens: (artifacts: Record<string, string>) => number;
|
|
154
|
-
/**
|
|
155
|
-
* Calculates the total number of lines across all generated files.
|
|
156
|
-
*
|
|
157
|
-
* This function sums up the line counts from the manifest's file metadata
|
|
158
|
-
* to provide the total lines of code generated. This metric is useful
|
|
159
|
-
* for understanding the scale of code generation and tracking productivity.
|
|
160
|
-
*
|
|
161
|
-
* @param manifest - The generation manifest containing file metadata
|
|
162
|
-
* @returns Total number of lines across all generated files
|
|
163
|
-
*
|
|
164
|
-
* @example
|
|
165
|
-
* ```typescript
|
|
166
|
-
* const manifest = {
|
|
167
|
-
* files: {
|
|
168
|
-
* './models.ts': { lines: 150, characters: 4500 },
|
|
169
|
-
* './types.ts': { lines: 80, characters: 2100 }
|
|
170
|
-
* },
|
|
171
|
-
* // ... other manifest properties
|
|
172
|
-
* };
|
|
173
|
-
*
|
|
174
|
-
* const lines = toManifestLines(manifest);
|
|
175
|
-
* console.log(lines); // 230
|
|
176
|
-
* ```
|
|
177
|
-
*/
|
|
178
|
-
export declare const toManifestLines: (manifest: ManifestContent) => number;
|
|
179
|
-
/**
|
|
180
|
-
* Calculates the total generation time from the manifest timestamps.
|
|
181
|
-
*
|
|
182
|
-
* This function computes the duration of the generation process by
|
|
183
|
-
* calculating the difference between the end and start timestamps
|
|
184
|
-
* recorded in the manifest. The result is in milliseconds.
|
|
185
|
-
*
|
|
186
|
-
* @param manifest - The generation manifest with timing information
|
|
187
|
-
* @returns Total generation time in milliseconds
|
|
188
|
-
*
|
|
189
|
-
* @example
|
|
190
|
-
* ```typescript
|
|
191
|
-
* const manifest = {
|
|
192
|
-
* startAt: 1672531200000, // January 1, 2023 00:00:00 GMT
|
|
193
|
-
* endAt: 1672531245000, // January 1, 2023 00:00:45 GMT
|
|
194
|
-
* // ... other manifest properties
|
|
195
|
-
* };
|
|
196
|
-
*
|
|
197
|
-
* const duration = toTotalTime(manifest);
|
|
198
|
-
* console.log(duration); // 45000 (45 seconds)
|
|
199
|
-
* console.log(`${duration / 1000}s`); // "45s"
|
|
200
|
-
* ```
|
|
201
|
-
*/
|
|
202
|
-
export declare const toTotalTime: (manifest: ManifestContent) => number;
|
|
203
|
-
/**
|
|
204
|
-
* Extracts and organizes error paths from the manifest results.
|
|
205
|
-
*
|
|
206
|
-
* This function recursively traverses the results structure in the manifest
|
|
207
|
-
* to identify all error conditions and their associated file paths. Errors
|
|
208
|
-
* are returned as arrays of path segments, making it easy to understand
|
|
209
|
-
* the location and context of each error.
|
|
210
|
-
*
|
|
211
|
-
* @param results - The results object from the generation manifest
|
|
212
|
-
* @returns Array of error paths, each represented as an array of path segments
|
|
213
|
-
*
|
|
214
|
-
* @example
|
|
215
|
-
* ```typescript
|
|
216
|
-
* const results = {
|
|
217
|
-
* 'models.ts': {
|
|
218
|
-
* 'User': 'success',
|
|
219
|
-
* 'Product': 'error'
|
|
220
|
-
* },
|
|
221
|
-
* 'types.ts': 'success'
|
|
222
|
-
* };
|
|
223
|
-
*
|
|
224
|
-
* const errors = toManifestErrors(results);
|
|
225
|
-
* console.log(errors); // [['models.ts', 'Product']]
|
|
226
|
-
*
|
|
227
|
-
* // Display errors in readable format
|
|
228
|
-
* errors.forEach(errorPath => {
|
|
229
|
-
* console.log(`Error at: ${errorPath.join(' -> ')}`);
|
|
230
|
-
* });
|
|
231
|
-
* // Output: "Error at: models.ts -> Product"
|
|
232
|
-
* ```
|
|
233
|
-
*/
|
|
234
|
-
export declare const toManifestErrors: (results: ManifestContent["results"]) => string[][];
|
|
235
|
-
/**
|
|
236
|
-
* Arguments for recursively checking results for error conditions.
|
|
237
|
-
*/
|
|
238
|
-
type CheckResultArgs = {
|
|
239
|
-
/** Current path segments being traversed */
|
|
240
|
-
path: string[];
|
|
241
|
-
/** The result value to check (can be nested) */
|
|
242
|
-
result: ResultsItem | (ResultsItem | null)[] | ResultType | null;
|
|
243
|
-
/** Array to accumulate error paths (mutated) */
|
|
244
|
-
errors: string[][];
|
|
245
|
-
};
|
|
246
|
-
/**
|
|
247
|
-
* Recursively checks results structure for error conditions and collects error paths.
|
|
248
|
-
*
|
|
249
|
-
* This function traverses the complex nested structure of generation results,
|
|
250
|
-
* identifying error conditions at any level and recording their full path context.
|
|
251
|
-
* It handles arrays, objects, strings, and null values, building a comprehensive
|
|
252
|
-
* map of all errors that occurred during generation.
|
|
253
|
-
*
|
|
254
|
-
* The function mutates the errors array parameter, accumulating error paths
|
|
255
|
-
* as it traverses the results structure. This approach is used for performance
|
|
256
|
-
* when processing large result sets.
|
|
257
|
-
*
|
|
258
|
-
* @param args - Arguments for result checking
|
|
259
|
-
* @param args.path - Current path segments being traversed
|
|
260
|
-
* @param args.result - The result value to check for errors
|
|
261
|
-
* @param args.errors - Array to accumulate error paths (mutated by function)
|
|
262
|
-
*
|
|
263
|
-
* @example Simple error detection
|
|
264
|
-
* ```typescript
|
|
265
|
-
* const errors: string[][] = [];
|
|
266
|
-
*
|
|
267
|
-
* checkResult({
|
|
268
|
-
* path: ['models.ts'],
|
|
269
|
-
* result: 'error',
|
|
270
|
-
* errors
|
|
271
|
-
* });
|
|
272
|
-
*
|
|
273
|
-
* console.log(errors); // [['models.ts']]
|
|
274
|
-
* ```
|
|
275
|
-
*
|
|
276
|
-
* @example Nested structure error detection
|
|
277
|
-
* ```typescript
|
|
278
|
-
* const errors: string[][] = [];
|
|
279
|
-
* const nestedResult = {
|
|
280
|
-
* 'User': 'success',
|
|
281
|
-
* 'Product': {
|
|
282
|
-
* 'validation': 'error',
|
|
283
|
-
* 'generation': 'success'
|
|
284
|
-
* }
|
|
285
|
-
* };
|
|
286
|
-
*
|
|
287
|
-
* checkResult({
|
|
288
|
-
* path: ['models.ts'],
|
|
289
|
-
* result: nestedResult,
|
|
290
|
-
* errors
|
|
291
|
-
* });
|
|
292
|
-
*
|
|
293
|
-
* console.log(errors); // [['models.ts', 'Product', 'validation']]
|
|
294
|
-
* ```
|
|
295
|
-
*
|
|
296
|
-
* @example Array handling
|
|
297
|
-
* ```typescript
|
|
298
|
-
* const errors: string[][] = [];
|
|
299
|
-
* const arrayResult = ['success', null, 'error', 'success'];
|
|
300
|
-
*
|
|
301
|
-
* checkResult({
|
|
302
|
-
* path: ['batch'],
|
|
303
|
-
* result: arrayResult,
|
|
304
|
-
* errors
|
|
305
|
-
* });
|
|
306
|
-
*
|
|
307
|
-
* console.log(errors); // [['batch']] - for the 'error' item
|
|
308
|
-
* ```
|
|
309
|
-
*/
|
|
310
|
-
export declare const checkResult: ({ path, result, errors }: CheckResultArgs) => void;
|
|
311
|
-
export {};
|
|
312
|
-
//# sourceMappingURL=generationStats.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generationStats.d.ts","sourceRoot":"","sources":["../../src/helpers/generationStats.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAIlE;;GAEG;AACH,KAAK,mBAAmB,GAAG;IACzB,oEAAoE;IACpE,QAAQ,EAAE,eAAe,CAAA;IACzB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAA;IACd,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAA;IACjB,6CAA6C;IAC7C,MAAM,EAAE,MAAM,EAAE,EAAE,CAA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