@forge-ts/core 0.3.0 → 0.3.1
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/dist/index.d.ts +99 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -164,6 +164,12 @@ interface ForgeWarning {
|
|
|
164
164
|
*
|
|
165
165
|
* @param rootDir - Absolute path to the project root.
|
|
166
166
|
* @returns A fully-populated default configuration.
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* import { defaultConfig } from "@forge-ts/core";
|
|
170
|
+
* const config = defaultConfig("/path/to/project");
|
|
171
|
+
* console.log(config.enforce.enabled); // true
|
|
172
|
+
* ```
|
|
167
173
|
* @public
|
|
168
174
|
*/
|
|
169
175
|
declare function defaultConfig(rootDir: string): ForgeConfig;
|
|
@@ -178,6 +184,12 @@ declare function defaultConfig(rootDir: string): ForgeConfig;
|
|
|
178
184
|
*
|
|
179
185
|
* @param rootDir - The project root to search for config. Defaults to `process.cwd()`.
|
|
180
186
|
* @returns A fully-resolved {@link ForgeConfig}.
|
|
187
|
+
* @example
|
|
188
|
+
* ```typescript
|
|
189
|
+
* import { loadConfig } from "@forge-ts/core";
|
|
190
|
+
* const config = await loadConfig("/path/to/project");
|
|
191
|
+
* // config is fully resolved with defaults
|
|
192
|
+
* ```
|
|
181
193
|
* @public
|
|
182
194
|
*/
|
|
183
195
|
declare function loadConfig(rootDir?: string): Promise<ForgeConfig>;
|
|
@@ -196,20 +208,35 @@ declare function loadConfig(rootDir?: string): Promise<ForgeConfig>;
|
|
|
196
208
|
* @public
|
|
197
209
|
*/
|
|
198
210
|
interface OpenAPISchemaObject {
|
|
211
|
+
/** The data type of the schema (e.g., "string", "number", "object", "array"). */
|
|
199
212
|
type?: "string" | "number" | "integer" | "boolean" | "array" | "object" | "null";
|
|
213
|
+
/** A format hint for the data type (e.g., "int32", "date-time", "email", "uuid"). */
|
|
200
214
|
format?: string;
|
|
215
|
+
/** A human-readable description of the schema's purpose or constraints. */
|
|
201
216
|
description?: string;
|
|
217
|
+
/** Property definitions for object-type schemas. Maps each property name to its schema. */
|
|
202
218
|
properties?: Record<string, OpenAPISchemaObject>;
|
|
219
|
+
/** List of property names that must be present on the object. */
|
|
203
220
|
required?: string[];
|
|
221
|
+
/** Schema definition for the elements of an array-type schema. Required when `type` is "array". */
|
|
204
222
|
items?: OpenAPISchemaObject;
|
|
223
|
+
/** Controls whether additional properties are allowed (`true`/`false`) or defines their schema. */
|
|
205
224
|
additionalProperties?: boolean | OpenAPISchemaObject;
|
|
225
|
+
/** Restricts the value to one of the listed constants. */
|
|
206
226
|
enum?: Array<string | number | boolean>;
|
|
227
|
+
/** Validates the value against exactly one of the listed sub-schemas. */
|
|
207
228
|
oneOf?: OpenAPISchemaObject[];
|
|
229
|
+
/** Validates the value against all of the listed sub-schemas (intersection). */
|
|
208
230
|
allOf?: OpenAPISchemaObject[];
|
|
231
|
+
/** Validates the value against at least one of the listed sub-schemas. */
|
|
209
232
|
anyOf?: OpenAPISchemaObject[];
|
|
233
|
+
/** Indicates that the value may be `null` in addition to its declared type. */
|
|
210
234
|
nullable?: boolean;
|
|
235
|
+
/** Marks the schema as deprecated, signalling that it may be removed in a future version. */
|
|
211
236
|
deprecated?: boolean;
|
|
237
|
+
/** The default value to use when the property is absent. */
|
|
212
238
|
default?: string | number | boolean | null;
|
|
239
|
+
/** A JSON Reference (`$ref`) pointing to another schema definition in the document. */
|
|
213
240
|
$ref?: string;
|
|
214
241
|
}
|
|
215
242
|
/**
|
|
@@ -217,10 +244,15 @@ interface OpenAPISchemaObject {
|
|
|
217
244
|
* @public
|
|
218
245
|
*/
|
|
219
246
|
interface OpenAPIInfoObject {
|
|
247
|
+
/** The human-readable name of the API. */
|
|
220
248
|
title: string;
|
|
249
|
+
/** The version string for the API (e.g., "1.0.0"). */
|
|
221
250
|
version: string;
|
|
251
|
+
/** A detailed description of the API, supporting CommonMark markdown. */
|
|
222
252
|
description?: string;
|
|
253
|
+
/** A short summary of the API, intended for display in tooling. */
|
|
223
254
|
summary?: string;
|
|
255
|
+
/** Licensing information for the exposed API, including name, URL, and SPDX identifier. */
|
|
224
256
|
license?: {
|
|
225
257
|
name: string;
|
|
226
258
|
url?: string;
|
|
@@ -232,7 +264,9 @@ interface OpenAPIInfoObject {
|
|
|
232
264
|
* @public
|
|
233
265
|
*/
|
|
234
266
|
interface OpenAPITagObject {
|
|
267
|
+
/** The name of the tag, used to group operations in the document. */
|
|
235
268
|
name: string;
|
|
269
|
+
/** An optional description of the tag, supporting CommonMark markdown. */
|
|
236
270
|
description?: string;
|
|
237
271
|
}
|
|
238
272
|
/**
|
|
@@ -240,17 +274,29 @@ interface OpenAPITagObject {
|
|
|
240
274
|
* @public
|
|
241
275
|
*/
|
|
242
276
|
interface OpenAPIPathItemObject {
|
|
277
|
+
/** A short summary of the path item, intended for tooling display. */
|
|
243
278
|
summary?: string;
|
|
279
|
+
/** A detailed description of the path item, supporting CommonMark markdown. */
|
|
244
280
|
description?: string;
|
|
281
|
+
/** The operation definition for HTTP GET requests to this path. */
|
|
245
282
|
get?: OpenAPIOperationObject;
|
|
283
|
+
/** The operation definition for HTTP POST requests to this path. */
|
|
246
284
|
post?: OpenAPIOperationObject;
|
|
285
|
+
/** The operation definition for HTTP PUT requests to this path. */
|
|
247
286
|
put?: OpenAPIOperationObject;
|
|
287
|
+
/** The operation definition for HTTP DELETE requests to this path. */
|
|
248
288
|
delete?: OpenAPIOperationObject;
|
|
289
|
+
/** The operation definition for HTTP PATCH requests to this path. */
|
|
249
290
|
patch?: OpenAPIOperationObject;
|
|
291
|
+
/** The operation definition for HTTP OPTIONS requests to this path. */
|
|
250
292
|
options?: OpenAPIOperationObject;
|
|
293
|
+
/** The operation definition for HTTP HEAD requests to this path. */
|
|
251
294
|
head?: OpenAPIOperationObject;
|
|
295
|
+
/** The operation definition for HTTP TRACE requests to this path. */
|
|
252
296
|
trace?: OpenAPIOperationObject;
|
|
297
|
+
/** The operation definition for HTTP QUERY requests to this path (OpenAPI 3.2 extension). */
|
|
253
298
|
query?: OpenAPIOperationObject;
|
|
299
|
+
/** Additional non-standard HTTP method operations keyed by method name. */
|
|
254
300
|
additionalOperations?: Record<string, OpenAPIOperationObject>;
|
|
255
301
|
}
|
|
256
302
|
/**
|
|
@@ -258,11 +304,17 @@ interface OpenAPIPathItemObject {
|
|
|
258
304
|
* @public
|
|
259
305
|
*/
|
|
260
306
|
interface OpenAPIOperationObject {
|
|
307
|
+
/** A unique string identifier for the operation, used by tooling to reference it. */
|
|
261
308
|
operationId?: string;
|
|
309
|
+
/** A short, human-readable summary of what the operation does. */
|
|
262
310
|
summary?: string;
|
|
311
|
+
/** A detailed description of the operation's behaviour, supporting CommonMark markdown. */
|
|
263
312
|
description?: string;
|
|
313
|
+
/** A list of tag names that logically group this operation in documentation and tooling. */
|
|
264
314
|
tags?: string[];
|
|
315
|
+
/** The list of parameters applicable to this operation. */
|
|
265
316
|
parameters?: OpenAPIParameterObject[];
|
|
317
|
+
/** The possible responses returned by this operation, keyed by HTTP status code or "default". */
|
|
266
318
|
responses?: Record<string, OpenAPIResponseObject>;
|
|
267
319
|
}
|
|
268
320
|
/**
|
|
@@ -270,11 +322,17 @@ interface OpenAPIOperationObject {
|
|
|
270
322
|
* @public
|
|
271
323
|
*/
|
|
272
324
|
interface OpenAPIParameterObject {
|
|
325
|
+
/** The name of the parameter, case-sensitive. */
|
|
273
326
|
name: string;
|
|
327
|
+
/** The location of the parameter: path, query, header, cookie, or querystring. */
|
|
274
328
|
in: "query" | "header" | "path" | "cookie" | "querystring";
|
|
329
|
+
/** A human-readable description of the parameter's purpose, supporting CommonMark markdown. */
|
|
275
330
|
description?: string;
|
|
331
|
+
/** Whether the parameter is mandatory. Required for `in: "path"` parameters. */
|
|
276
332
|
required?: boolean;
|
|
333
|
+
/** The schema defining the type and constraints of the parameter value. */
|
|
277
334
|
schema?: OpenAPISchemaObject;
|
|
335
|
+
/** Marks the parameter as deprecated; clients should avoid using it. */
|
|
278
336
|
deprecated?: boolean;
|
|
279
337
|
}
|
|
280
338
|
/**
|
|
@@ -282,10 +340,15 @@ interface OpenAPIParameterObject {
|
|
|
282
340
|
* @public
|
|
283
341
|
*/
|
|
284
342
|
interface OpenAPIEncodingObject {
|
|
343
|
+
/** The MIME type to use for encoding a specific property (e.g., "application/json"). */
|
|
285
344
|
contentType?: string;
|
|
345
|
+
/** Additional headers to send alongside the encoded part, keyed by header name. */
|
|
286
346
|
headers?: Record<string, OpenAPIParameterObject>;
|
|
347
|
+
/** The serialization style for the encoded value (e.g., "form", "spaceDelimited"). */
|
|
287
348
|
style?: string;
|
|
349
|
+
/** Whether arrays and objects should be exploded into separate query parameters. */
|
|
288
350
|
explode?: boolean;
|
|
351
|
+
/** Whether reserved characters in the encoded value should be allowed without percent-encoding. */
|
|
289
352
|
allowReserved?: boolean;
|
|
290
353
|
}
|
|
291
354
|
/**
|
|
@@ -293,7 +356,9 @@ interface OpenAPIEncodingObject {
|
|
|
293
356
|
* @public
|
|
294
357
|
*/
|
|
295
358
|
interface OpenAPIMediaTypeObject {
|
|
359
|
+
/** The schema defining the structure and type of the media type's payload. */
|
|
296
360
|
schema?: OpenAPISchemaObject;
|
|
361
|
+
/** Encoding information for specific properties of a `multipart` or `application/x-www-form-urlencoded` request body. */
|
|
297
362
|
encoding?: Record<string, OpenAPIEncodingObject>;
|
|
298
363
|
}
|
|
299
364
|
/**
|
|
@@ -301,8 +366,11 @@ interface OpenAPIMediaTypeObject {
|
|
|
301
366
|
* @public
|
|
302
367
|
*/
|
|
303
368
|
interface OpenAPIResponseObject {
|
|
369
|
+
/** A required human-readable description of the response, supporting CommonMark markdown. */
|
|
304
370
|
description: string;
|
|
371
|
+
/** HTTP headers returned with this response, keyed by header name. */
|
|
305
372
|
headers?: Record<string, OpenAPIParameterObject>;
|
|
373
|
+
/** The response body content, keyed by media type (e.g., "application/json"). */
|
|
306
374
|
content?: Record<string, OpenAPIMediaTypeObject>;
|
|
307
375
|
}
|
|
308
376
|
/**
|
|
@@ -310,14 +378,20 @@ interface OpenAPIResponseObject {
|
|
|
310
378
|
* @public
|
|
311
379
|
*/
|
|
312
380
|
interface OpenAPIDocument {
|
|
381
|
+
/** The OpenAPI specification version this document conforms to. Must be "3.2.0". */
|
|
313
382
|
openapi: "3.2.0";
|
|
383
|
+
/** An optional self-referencing URL for this document, used for tooling and resolution. */
|
|
314
384
|
$self?: string;
|
|
385
|
+
/** Metadata about the API including title, version, and description. */
|
|
315
386
|
info: OpenAPIInfoObject;
|
|
387
|
+
/** The available paths and their operations, keyed by path template (e.g., "/users/{id}"). */
|
|
316
388
|
paths: Record<string, OpenAPIPathItemObject>;
|
|
389
|
+
/** Reusable schema and media type definitions shared across the document. */
|
|
317
390
|
components: {
|
|
318
391
|
schemas: Record<string, OpenAPISchemaObject>;
|
|
319
392
|
mediaTypes?: Record<string, OpenAPIMediaTypeObject>;
|
|
320
393
|
};
|
|
394
|
+
/** A list of tags used to group operations, with optional descriptions. */
|
|
321
395
|
tags?: OpenAPITagObject[];
|
|
322
396
|
}
|
|
323
397
|
|
|
@@ -332,6 +406,12 @@ interface OpenAPIDocument {
|
|
|
332
406
|
*
|
|
333
407
|
* @param tags - The parsed `tags` map from `ForgeSymbol.documentation`.
|
|
334
408
|
* @returns The resolved {@link Visibility} value.
|
|
409
|
+
* @example
|
|
410
|
+
* ```typescript
|
|
411
|
+
* import { resolveVisibility } from "@forge-ts/core";
|
|
412
|
+
* const vis = resolveVisibility({ internal: [] });
|
|
413
|
+
* // vis === Visibility.Internal
|
|
414
|
+
* ```
|
|
335
415
|
* @public
|
|
336
416
|
*/
|
|
337
417
|
declare function resolveVisibility(tags: Record<string, string[]> | undefined): Visibility;
|
|
@@ -344,6 +424,12 @@ declare function resolveVisibility(tags: Record<string, string[]> | undefined):
|
|
|
344
424
|
* @param candidate - The visibility of the symbol being tested.
|
|
345
425
|
* @param minVisibility - The minimum visibility threshold.
|
|
346
426
|
* @returns `true` if `candidate` is at least as visible as `minVisibility`.
|
|
427
|
+
* @example
|
|
428
|
+
* ```typescript
|
|
429
|
+
* import { meetsVisibility, Visibility } from "@forge-ts/core";
|
|
430
|
+
* meetsVisibility(Visibility.Public, Visibility.Public); // true
|
|
431
|
+
* meetsVisibility(Visibility.Internal, Visibility.Public); // false
|
|
432
|
+
* ```
|
|
347
433
|
* @public
|
|
348
434
|
*/
|
|
349
435
|
declare function meetsVisibility(candidate: Visibility, minVisibility: Visibility): boolean;
|
|
@@ -354,6 +440,11 @@ declare function meetsVisibility(candidate: Visibility, minVisibility: Visibilit
|
|
|
354
440
|
* @param symbols - The full list of symbols to filter.
|
|
355
441
|
* @param minVisibility - The minimum visibility threshold to keep.
|
|
356
442
|
* @returns A new array containing only symbols that pass the visibility check.
|
|
443
|
+
* @example
|
|
444
|
+
* ```typescript
|
|
445
|
+
* import { filterByVisibility, Visibility } from "@forge-ts/core";
|
|
446
|
+
* const publicOnly = filterByVisibility(symbols, Visibility.Public);
|
|
447
|
+
* ```
|
|
357
448
|
* @public
|
|
358
449
|
*/
|
|
359
450
|
declare function filterByVisibility(symbols: ForgeSymbol[], minVisibility: Visibility): ForgeSymbol[];
|
|
@@ -379,6 +470,14 @@ interface ASTWalker {
|
|
|
379
470
|
*
|
|
380
471
|
* @param config - The resolved {@link ForgeConfig} for the project.
|
|
381
472
|
* @returns An {@link ASTWalker} instance whose `walk()` method performs the extraction.
|
|
473
|
+
* @example
|
|
474
|
+
* ```typescript
|
|
475
|
+
* import { loadConfig, createWalker } from "@forge-ts/core";
|
|
476
|
+
* const config = await loadConfig();
|
|
477
|
+
* const walker = createWalker(config);
|
|
478
|
+
* const symbols = walker.walk();
|
|
479
|
+
* console.log(`Found ${symbols.length} symbols`);
|
|
480
|
+
* ```
|
|
382
481
|
* @public
|
|
383
482
|
*/
|
|
384
483
|
declare function createWalker(config: ForgeConfig): ASTWalker;
|
package/dist/index.js
CHANGED
|
@@ -190,6 +190,9 @@ function parseTSDoc(rawComment, startLine) {
|
|
|
190
190
|
if (comment.modifierTagSet.hasTag(StandardTags.alpha)) {
|
|
191
191
|
tags.alpha = [];
|
|
192
192
|
}
|
|
193
|
+
if (comment.modifierTagSet.hasTag(StandardTags.packageDocumentation)) {
|
|
194
|
+
tags.packageDocumentation = [];
|
|
195
|
+
}
|
|
193
196
|
let deprecated;
|
|
194
197
|
if (comment.deprecatedBlock) {
|
|
195
198
|
deprecated = renderBlock(comment.deprecatedBlock).trim() || "true";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config.ts","../src/types.ts","../src/visibility.ts","../src/walker.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { type ForgeConfig, Visibility } from \"./types.js\";\n\n/**\n * Constructs a sensible default {@link ForgeConfig} rooted at `rootDir`.\n *\n * @param rootDir - Absolute path to the project root.\n * @returns A fully-populated default configuration.\n * @public\n */\nexport function defaultConfig(rootDir: string): ForgeConfig {\n\treturn {\n\t\trootDir,\n\t\ttsconfig: join(rootDir, \"tsconfig.json\"),\n\t\toutDir: join(rootDir, \"docs\"),\n\t\tenforce: {\n\t\t\tenabled: true,\n\t\t\tminVisibility: Visibility.Public,\n\t\t\tstrict: false,\n\t\t},\n\t\tdoctest: {\n\t\t\tenabled: true,\n\t\t\tcacheDir: join(rootDir, \".cache\", \"doctest\"),\n\t\t},\n\t\tapi: {\n\t\t\tenabled: false,\n\t\t\topenapi: false,\n\t\t\topenapiPath: join(rootDir, \"docs\", \"openapi.json\"),\n\t\t},\n\t\tgen: {\n\t\t\tenabled: true,\n\t\t\tformats: [\"markdown\"],\n\t\t\tllmsTxt: true,\n\t\t\treadmeSync: false,\n\t\t},\n\t};\n}\n\n/**\n * Merges a partial user config with the defaults so every field is present.\n *\n * @param rootDir - Absolute path to the project root.\n * @param partial - Partial config from the user's config file.\n * @returns A fully-populated {@link ForgeConfig}.\n * @internal\n */\nfunction mergeWithDefaults(rootDir: string, partial: Partial<ForgeConfig>): ForgeConfig {\n\tconst defaults = defaultConfig(rootDir);\n\treturn {\n\t\t...defaults,\n\t\t...partial,\n\t\tenforce: { ...defaults.enforce, ...partial.enforce },\n\t\tdoctest: { ...defaults.doctest, ...partial.doctest },\n\t\tapi: { ...defaults.api, ...partial.api },\n\t\tgen: { ...defaults.gen, ...partial.gen },\n\t};\n}\n\n/**\n * Attempts to load a TypeScript or JavaScript config file via dynamic import.\n *\n * @param filePath - Absolute path to the config file.\n * @returns The default export of the config module, or `null` on failure.\n * @internal\n */\nasync function loadModuleConfig(filePath: string): Promise<Partial<ForgeConfig> | null> {\n\ttry {\n\t\tconst fileUrl = pathToFileURL(filePath).href;\n\t\tconst mod = (await import(fileUrl)) as {\n\t\t\tdefault?: Partial<ForgeConfig>;\n\t\t};\n\t\treturn mod.default ?? null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/**\n * Minimal shape of a `package.json` file relevant to forge-ts config loading.\n * @internal\n */\ninterface PackageJson {\n\tname?: string;\n\tversion?: string;\n\t\"forge-ts\"?: Partial<ForgeConfig>;\n}\n\n/**\n * Attempts to read the `\"forge-ts\"` key from a `package.json` file.\n *\n * @param pkgPath - Absolute path to `package.json`.\n * @returns The value of the `\"forge-ts\"` key, or `null` if absent.\n * @internal\n */\nasync function loadPackageJsonConfig(pkgPath: string): Promise<Partial<ForgeConfig> | null> {\n\ttry {\n\t\tconst raw = await readFile(pkgPath, \"utf8\");\n\t\tconst pkg = JSON.parse(raw) as PackageJson;\n\t\tconst key = pkg[\"forge-ts\"];\n\t\tif (key) {\n\t\t\treturn key;\n\t\t}\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/**\n * Loads the forge-ts configuration for a project.\n *\n * Resolution order:\n * 1. `<rootDir>/forge-ts.config.ts`\n * 2. `<rootDir>/forge-ts.config.js`\n * 3. `\"forge-ts\"` key inside `<rootDir>/package.json`\n * 4. Built-in defaults (returned when none of the above is found)\n *\n * @param rootDir - The project root to search for config. Defaults to `process.cwd()`.\n * @returns A fully-resolved {@link ForgeConfig}.\n * @public\n */\nexport async function loadConfig(rootDir?: string): Promise<ForgeConfig> {\n\tconst root = resolve(rootDir ?? process.cwd());\n\n\tconst candidates = [join(root, \"forge-ts.config.ts\"), join(root, \"forge-ts.config.js\")];\n\n\tfor (const candidate of candidates) {\n\t\tif (existsSync(candidate)) {\n\t\t\tconst partial = await loadModuleConfig(candidate);\n\t\t\tif (partial) {\n\t\t\t\treturn mergeWithDefaults(root, partial);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst pkgPath = join(root, \"package.json\");\n\tif (existsSync(pkgPath)) {\n\t\tconst partial = await loadPackageJsonConfig(pkgPath);\n\t\tif (partial) {\n\t\t\treturn mergeWithDefaults(root, partial);\n\t\t}\n\t}\n\n\treturn defaultConfig(root);\n}\n","/**\n * Visibility levels for exported symbols.\n * Derived from TSDoc release tags (@public, @beta, @internal).\n * @public\n */\nexport enum Visibility {\n\tPublic = \"public\",\n\tBeta = \"beta\",\n\tInternal = \"internal\",\n\tPrivate = \"private\",\n}\n\n/**\n * A single extracted and annotated symbol from the TypeScript AST.\n * @public\n */\nexport interface ForgeSymbol {\n\t/** The declared name of the symbol. */\n\tname: string;\n\t/** The syntactic kind of the symbol. */\n\tkind: \"function\" | \"class\" | \"interface\" | \"type\" | \"enum\" | \"variable\" | \"method\" | \"property\";\n\t/** Resolved visibility from TSDoc release tags. */\n\tvisibility: Visibility;\n\t/** Absolute path to the source file. */\n\tfilePath: string;\n\t/** 1-based line number of the declaration. */\n\tline: number;\n\t/** 0-based column of the declaration. */\n\tcolumn: number;\n\t/** Parsed TSDoc documentation, if present. */\n\tdocumentation?: {\n\t\tsummary?: string;\n\t\tparams?: Array<{ name: string; description: string; type?: string }>;\n\t\treturns?: { description: string; type?: string };\n\t\tthrows?: Array<{ type?: string; description: string }>;\n\t\texamples?: Array<{ code: string; language: string; line: number }>;\n\t\ttags?: Record<string, string[]>;\n\t\tdeprecated?: string;\n\t};\n\t/** Human-readable type signature of the symbol. */\n\tsignature?: string;\n\t/** Child symbols (e.g., class members, enum values). */\n\tchildren?: ForgeSymbol[];\n\t/** Whether this symbol is part of the public module exports. */\n\texported: boolean;\n}\n\n/**\n * Full configuration for a forge-ts run.\n * Loaded from forge-ts.config.ts or the \"forge-ts\" key in package.json.\n * @public\n */\nexport interface ForgeConfig {\n\t/** Root directory of the project. */\n\trootDir: string;\n\t/** Path to the tsconfig.json to compile against. */\n\ttsconfig: string;\n\t/** Output directory for generated files. */\n\toutDir: string;\n\t/** Enforce TSDoc on all public exports. */\n\tenforce: {\n\t\tenabled: boolean;\n\t\t/** Minimum visibility level to enforce documentation on. */\n\t\tminVisibility: Visibility;\n\t\t/** Fail on warnings rather than only on errors. */\n\t\tstrict: boolean;\n\t};\n\t/** DocTest configuration. */\n\tdoctest: {\n\t\tenabled: boolean;\n\t\t/** Cache directory for virtual test files. */\n\t\tcacheDir: string;\n\t};\n\t/** API generation configuration. */\n\tapi: {\n\t\tenabled: boolean;\n\t\t/** Generate an OpenAPI spec from exported HTTP handlers. */\n\t\topenapi: boolean;\n\t\t/** Output path for the OpenAPI spec file. */\n\t\topenapiPath: string;\n\t};\n\t/** Output generation configuration. */\n\tgen: {\n\t\tenabled: boolean;\n\t\t/** Output formats to generate. */\n\t\tformats: Array<\"markdown\" | \"mdx\">;\n\t\t/** Generate an llms.txt companion file. */\n\t\tllmsTxt: boolean;\n\t\t/** Synchronise summaries back into README.md. */\n\t\treadmeSync: boolean;\n\t\t/** Static site generator to target for output format. */\n\t\tssgTarget?: \"docusaurus\" | \"mintlify\" | \"nextra\" | \"vitepress\";\n\t};\n}\n\n/**\n * The result of a forge-ts compilation pass.\n * @public\n */\nexport interface ForgeResult {\n\t/** Whether the run succeeded without errors. */\n\tsuccess: boolean;\n\t/** All symbols extracted during this run. */\n\tsymbols: ForgeSymbol[];\n\t/** Errors that caused or would cause failure. */\n\terrors: ForgeError[];\n\t/** Non-fatal warnings. */\n\twarnings: ForgeWarning[];\n\t/** Wall-clock duration of the run in milliseconds. */\n\tduration: number;\n}\n\n/**\n * A diagnostic error produced during a forge-ts run.\n * @public\n */\nexport interface ForgeError {\n\t/** Machine-readable error code (e.g. \"E001\"). */\n\tcode: string;\n\t/** Human-readable description of the error. */\n\tmessage: string;\n\t/** Absolute path of the file where the error occurred. */\n\tfilePath: string;\n\t/** 1-based line number. */\n\tline: number;\n\t/** 0-based column. */\n\tcolumn: number;\n\t/** Suggested fix for the agent — exact TSDoc block to add. */\n\tsuggestedFix?: string;\n\t/** The symbol name that needs fixing. */\n\tsymbolName?: string;\n\t/** The symbol kind (function, class, interface, etc.). */\n\tsymbolKind?: string;\n}\n\n/**\n * A diagnostic warning produced during a forge-ts run.\n * @public\n */\nexport interface ForgeWarning {\n\t/** Machine-readable warning code (e.g. \"W001\"). */\n\tcode: string;\n\t/** Human-readable description of the warning. */\n\tmessage: string;\n\t/** Absolute path of the file where the warning occurred. */\n\tfilePath: string;\n\t/** 1-based line number. */\n\tline: number;\n\t/** 0-based column. */\n\tcolumn: number;\n}\n","import { type ForgeSymbol, Visibility } from \"./types.js\";\n\n/**\n * Determines the visibility level of a symbol from its TSDoc release tags.\n *\n * The precedence order is:\n * 1. `@internal` → {@link Visibility.Internal}\n * 2. `@beta` → {@link Visibility.Beta}\n * 3. `@public` → {@link Visibility.Public}\n * 4. (no tag) → {@link Visibility.Public} (default for exports)\n *\n * @param tags - The parsed `tags` map from `ForgeSymbol.documentation`.\n * @returns The resolved {@link Visibility} value.\n * @public\n */\nexport function resolveVisibility(tags: Record<string, string[]> | undefined): Visibility {\n\tif (!tags) return Visibility.Public;\n\n\tif (\"internal\" in tags) return Visibility.Internal;\n\tif (\"beta\" in tags) return Visibility.Beta;\n\tif (\"public\" in tags) return Visibility.Public;\n\n\treturn Visibility.Public;\n}\n\n/**\n * Numeric rank used for visibility comparisons.\n * Lower numbers are more restrictive.\n * @internal\n */\nconst VISIBILITY_RANK: Record<Visibility, number> = {\n\t[Visibility.Public]: 0,\n\t[Visibility.Beta]: 1,\n\t[Visibility.Internal]: 2,\n\t[Visibility.Private]: 3,\n};\n\n/**\n * Returns whether `candidate` meets or exceeds the required minimum visibility.\n *\n * \"Meets\" means the symbol is at least as visible as `minVisibility`.\n * For example, `Public` meets a minimum of `Public`, but `Internal` does not.\n *\n * @param candidate - The visibility of the symbol being tested.\n * @param minVisibility - The minimum visibility threshold.\n * @returns `true` if `candidate` is at least as visible as `minVisibility`.\n * @public\n */\nexport function meetsVisibility(candidate: Visibility, minVisibility: Visibility): boolean {\n\treturn VISIBILITY_RANK[candidate] <= VISIBILITY_RANK[minVisibility];\n}\n\n/**\n * Filters an array of {@link ForgeSymbol} objects to only include symbols\n * whose visibility meets or exceeds `minVisibility`.\n *\n * @param symbols - The full list of symbols to filter.\n * @param minVisibility - The minimum visibility threshold to keep.\n * @returns A new array containing only symbols that pass the visibility check.\n * @public\n */\nexport function filterByVisibility(\n\tsymbols: ForgeSymbol[],\n\tminVisibility: Visibility,\n): ForgeSymbol[] {\n\treturn symbols.filter((s) => meetsVisibility(s.visibility, minVisibility));\n}\n","import { readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport {\n\ttype DocBlock,\n\ttype DocCodeSpan,\n\ttype DocComment,\n\ttype DocFencedCode,\n\ttype DocNode,\n\tDocNodeKind,\n\ttype DocParagraph,\n\ttype DocPlainText,\n\ttype DocSection,\n\tStandardTags,\n\tTSDocConfiguration,\n\tTSDocParser,\n} from \"@microsoft/tsdoc\";\nimport ts from \"typescript\";\nimport type { ForgeConfig, ForgeSymbol } from \"./types.js\";\nimport { resolveVisibility } from \"./visibility.js\";\n\n// ---------------------------------------------------------------------------\n// Public API surface\n// ---------------------------------------------------------------------------\n\n/**\n * The return type of {@link createWalker}.\n * @public\n */\nexport interface ASTWalker {\n\t/**\n\t * Walk all source files referenced by the configured tsconfig and return\n\t * one {@link ForgeSymbol} per exported declaration.\n\t */\n\twalk(): ForgeSymbol[];\n}\n\n// ---------------------------------------------------------------------------\n// TSDoc helpers\n// ---------------------------------------------------------------------------\n\n/** Render inline nodes (PlainText, CodeSpan, SoftBreak) to a plain string. @internal */\nfunction renderInlineNodes(nodes: readonly DocNode[]): string {\n\tconst parts: string[] = [];\n\tfor (const node of nodes) {\n\t\tswitch (node.kind) {\n\t\t\tcase DocNodeKind.PlainText:\n\t\t\t\tparts.push((node as DocPlainText).text);\n\t\t\t\tbreak;\n\t\t\tcase DocNodeKind.CodeSpan:\n\t\t\t\tparts.push(`\\`${(node as DocCodeSpan).code}\\``);\n\t\t\t\tbreak;\n\t\t\tcase DocNodeKind.SoftBreak:\n\t\t\t\tparts.push(\" \");\n\t\t\t\tbreak;\n\t\t\tcase DocNodeKind.Paragraph:\n\t\t\t\t// Recurse into paragraph nodes to extract nested text\n\t\t\t\tparts.push(renderInlineNodes((node as DocParagraph).nodes));\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn parts.join(\"\");\n}\n\n/** Render a `DocSection` (or similar node) to a plain string. @internal */\nfunction renderDocSection(section: DocSection | undefined): string {\n\tif (!section) return \"\";\n\treturn renderInlineNodes(section.nodes).trim();\n}\n\n/** Render a `DocBlock`'s content to a plain string. @internal */\nfunction renderBlock(block: DocBlock): string {\n\treturn renderDocSection(block.content);\n}\n\n/** Extract all `@example` fenced code blocks from a parsed comment. @internal */\nfunction extractExamples(\n\tcomment: DocComment,\n\tstartLine: number,\n): Array<{ code: string; language: string; line: number }> {\n\tconst examples: Array<{ code: string; language: string; line: number }> = [];\n\n\tfor (const block of comment.customBlocks) {\n\t\tif (block.blockTag.tagName.toLowerCase() !== \"@example\") continue;\n\n\t\tfor (const node of block.content.nodes) {\n\t\t\tif (node.kind === DocNodeKind.FencedCode) {\n\t\t\t\tconst fenced = node as DocFencedCode;\n\t\t\t\texamples.push({\n\t\t\t\t\tcode: fenced.code,\n\t\t\t\t\tlanguage: fenced.language || \"typescript\",\n\t\t\t\t\tline: startLine,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\treturn examples;\n}\n\n/** Parse a raw JSDoc/TSDoc comment string into a structured documentation object. @internal */\nfunction parseTSDoc(rawComment: string, startLine: number): ForgeSymbol[\"documentation\"] {\n\tconst configuration = new TSDocConfiguration();\n\tconst parser = new TSDocParser(configuration);\n\tconst result = parser.parseString(rawComment);\n\tconst comment = result.docComment;\n\n\tconst tags: Record<string, string[]> = {};\n\n\t// Release tags\n\tif (comment.modifierTagSet.hasTag(StandardTags.public)) {\n\t\ttags.public = [];\n\t}\n\tif (comment.modifierTagSet.hasTag(StandardTags.beta)) {\n\t\ttags.beta = [];\n\t}\n\tif (comment.modifierTagSet.hasTag(StandardTags.internal)) {\n\t\ttags.internal = [];\n\t}\n\tif (comment.modifierTagSet.hasTag(StandardTags.alpha)) {\n\t\ttags.alpha = [];\n\t}\n\n\t// @deprecated\n\tlet deprecated: string | undefined;\n\tif (comment.deprecatedBlock) {\n\t\tdeprecated = renderBlock(comment.deprecatedBlock).trim() || \"true\";\n\t}\n\n\t// @param blocks\n\tconst params: Array<{ name: string; description: string; type?: string }> = [];\n\tfor (const paramBlock of comment.params.blocks) {\n\t\tparams.push({\n\t\t\tname: paramBlock.parameterName,\n\t\t\tdescription: renderBlock(paramBlock),\n\t\t});\n\t}\n\n\t// @returns block\n\tlet returns: { description: string; type?: string } | undefined;\n\tif (comment.returnsBlock) {\n\t\tconst desc = renderBlock(comment.returnsBlock);\n\t\tif (desc) returns = { description: desc };\n\t}\n\n\t// @throws blocks\n\tconst throws: Array<{ type?: string; description: string }> = [];\n\tfor (const block of comment.customBlocks) {\n\t\tif (block.blockTag.tagName.toLowerCase() === \"@throws\") {\n\t\t\tthrows.push({ description: renderBlock(block) });\n\t\t}\n\t}\n\n\t// @example blocks\n\tconst examples = extractExamples(comment, startLine);\n\n\tconst summary = renderDocSection(comment.summarySection);\n\n\treturn {\n\t\tsummary: summary || undefined,\n\t\tparams: params.length > 0 ? params : undefined,\n\t\treturns,\n\t\tthrows: throws.length > 0 ? throws : undefined,\n\t\texamples: examples.length > 0 ? examples : undefined,\n\t\ttags: Object.keys(tags).length > 0 ? tags : undefined,\n\t\tdeprecated,\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// TypeScript AST helpers\n// ---------------------------------------------------------------------------\n\n/** Extract the leading JSDoc comment text for a node. @internal */\nfunction getLeadingComment(node: ts.Node, sourceFile: ts.SourceFile): string | undefined {\n\tconst fullText = sourceFile.getFullText();\n\tconst ranges = ts.getLeadingCommentRanges(fullText, node.getFullStart());\n\tif (!ranges || ranges.length === 0) return undefined;\n\n\t// Take the last leading comment (closest to the declaration)\n\tconst range = ranges[ranges.length - 1];\n\tif (\n\t\trange.kind !== ts.SyntaxKind.MultiLineCommentTrivia ||\n\t\t!fullText.slice(range.pos, range.end).startsWith(\"/**\")\n\t) {\n\t\treturn undefined;\n\t}\n\n\treturn fullText.slice(range.pos, range.end);\n}\n\n/** Map a TypeScript `SyntaxKind` to a `ForgeSymbol` kind string. @internal */\nfunction kindToString(kind: ts.SyntaxKind): ForgeSymbol[\"kind\"] | null {\n\tswitch (kind) {\n\t\tcase ts.SyntaxKind.FunctionDeclaration:\n\t\tcase ts.SyntaxKind.ArrowFunction:\n\t\tcase ts.SyntaxKind.FunctionExpression:\n\t\t\treturn \"function\";\n\t\tcase ts.SyntaxKind.ClassDeclaration:\n\t\t\treturn \"class\";\n\t\tcase ts.SyntaxKind.InterfaceDeclaration:\n\t\t\treturn \"interface\";\n\t\tcase ts.SyntaxKind.TypeAliasDeclaration:\n\t\t\treturn \"type\";\n\t\tcase ts.SyntaxKind.EnumDeclaration:\n\t\t\treturn \"enum\";\n\t\tcase ts.SyntaxKind.VariableDeclaration:\n\t\tcase ts.SyntaxKind.VariableStatement:\n\t\t\treturn \"variable\";\n\t\tcase ts.SyntaxKind.MethodDeclaration:\n\t\tcase ts.SyntaxKind.MethodSignature:\n\t\t\treturn \"method\";\n\t\tcase ts.SyntaxKind.PropertyDeclaration:\n\t\tcase ts.SyntaxKind.PropertySignature:\n\t\tcase ts.SyntaxKind.EnumMember:\n\t\t\treturn \"property\";\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n\n/** Build a human-readable type signature string using the type checker. @internal */\nfunction buildSignature(node: ts.Declaration, checker: ts.TypeChecker): string | undefined {\n\ttry {\n\t\tconst symbol = checker.getSymbolAtLocation((node as ts.NamedDeclaration).name ?? node);\n\t\tif (!symbol) return undefined;\n\t\tconst type = checker.getTypeOfSymbolAtLocation(symbol, node);\n\t\treturn checker.typeToString(type);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Walker implementation\n// ---------------------------------------------------------------------------\n\n/** @internal */\nfunction extractSymbolsFromFile(\n\tsourceFile: ts.SourceFile,\n\tchecker: ts.TypeChecker,\n\t_tsdocParser: TSDocParser,\n): ForgeSymbol[] {\n\tconst symbols: ForgeSymbol[] = [];\n\tconst filePath = sourceFile.fileName;\n\n\tfunction visit(node: ts.Node, parentExported: boolean): void {\n\t\tconst isExported =\n\t\t\tparentExported ||\n\t\t\t(ts.getCombinedModifierFlags(node as ts.Declaration) & ts.ModifierFlags.Export) !== 0;\n\n\t\t// Handle export declarations: `export { Foo, Bar }`\n\t\tif (ts.isExportDeclaration(node)) {\n\t\t\tts.forEachChild(node, (child) => visit(child, true));\n\t\t\treturn;\n\t\t}\n\n\t\tconst kind = kindToString(node.kind);\n\n\t\t// Variable statements need special handling: `export const foo = ...`\n\t\tif (ts.isVariableStatement(node)) {\n\t\t\tif (!isExported) {\n\t\t\t\tts.forEachChild(node, (child) => visit(child, false));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (const decl of node.declarationList.declarations) {\n\t\t\t\tconst name = decl.name.getText(sourceFile);\n\t\t\t\tconst pos = sourceFile.getLineAndCharacterOfPosition(decl.getStart());\n\t\t\t\tconst rawComment = getLeadingComment(node, sourceFile);\n\t\t\t\tconst documentation = rawComment ? parseTSDoc(rawComment, pos.line + 1) : undefined;\n\t\t\t\tconst tags = documentation?.tags;\n\t\t\t\tconst visibility = resolveVisibility(tags);\n\n\t\t\t\tsymbols.push({\n\t\t\t\t\tname,\n\t\t\t\t\tkind: \"variable\",\n\t\t\t\t\tvisibility,\n\t\t\t\t\tfilePath,\n\t\t\t\t\tline: pos.line + 1,\n\t\t\t\t\tcolumn: pos.character,\n\t\t\t\t\tdocumentation,\n\t\t\t\t\tsignature: buildSignature(decl, checker),\n\t\t\t\t\texported: true,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (kind === null || !isExported) {\n\t\t\tts.forEachChild(node, (child) => visit(child, isExported));\n\t\t\treturn;\n\t\t}\n\n\t\tconst namedNode = node as ts.NamedDeclaration;\n\t\tconst nameNode = namedNode.name;\n\t\tif (!nameNode) {\n\t\t\tts.forEachChild(node, (child) => visit(child, isExported));\n\t\t\treturn;\n\t\t}\n\n\t\tconst name = nameNode.getText(sourceFile);\n\t\tconst pos = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n\t\tconst rawComment = getLeadingComment(node, sourceFile);\n\t\tconst documentation = rawComment ? parseTSDoc(rawComment, pos.line + 1) : undefined;\n\t\tconst tags = documentation?.tags;\n\t\tconst visibility = resolveVisibility(tags);\n\n\t\tconst children: ForgeSymbol[] = [];\n\n\t\t// Walk class members / interface members / enum members\n\t\tif (\n\t\t\tts.isClassDeclaration(node) ||\n\t\t\tts.isInterfaceDeclaration(node) ||\n\t\t\tts.isEnumDeclaration(node)\n\t\t) {\n\t\t\tfor (const member of node.members) {\n\t\t\t\tconst memberKind = kindToString(member.kind);\n\t\t\t\tif (!memberKind) continue;\n\t\t\t\tconst memberName = (member as ts.NamedDeclaration).name?.getText(sourceFile) ?? \"\";\n\t\t\t\tconst memberPos = sourceFile.getLineAndCharacterOfPosition(member.getStart());\n\t\t\t\tconst memberComment = getLeadingComment(member, sourceFile);\n\t\t\t\tconst memberDoc = memberComment ? parseTSDoc(memberComment, memberPos.line + 1) : undefined;\n\t\t\t\tconst memberTags = memberDoc?.tags;\n\t\t\t\tconst memberVisibility = resolveVisibility(memberTags);\n\n\t\t\t\tchildren.push({\n\t\t\t\t\tname: memberName,\n\t\t\t\t\tkind: memberKind,\n\t\t\t\t\tvisibility: memberVisibility,\n\t\t\t\t\tfilePath,\n\t\t\t\t\tline: memberPos.line + 1,\n\t\t\t\t\tcolumn: memberPos.character,\n\t\t\t\t\tdocumentation: memberDoc,\n\t\t\t\t\tsignature: buildSignature(member as ts.Declaration, checker),\n\t\t\t\t\texported: false,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tsymbols.push({\n\t\t\tname,\n\t\t\tkind,\n\t\t\tvisibility,\n\t\t\tfilePath,\n\t\t\tline: pos.line + 1,\n\t\t\tcolumn: pos.character,\n\t\t\tdocumentation,\n\t\t\tsignature: buildSignature(namedNode as ts.Declaration, checker),\n\t\t\tchildren: children.length > 0 ? children : undefined,\n\t\t\texported: isExported,\n\t\t});\n\t}\n\n\tts.forEachChild(sourceFile, (node) => visit(node, false));\n\treturn symbols;\n}\n\n/**\n * Creates an {@link ASTWalker} configured for the given forge config.\n *\n * The walker uses the TypeScript Compiler API to create a `ts.Program` from\n * the project's tsconfig, then visits every source file to extract exported\n * declarations. TSDoc comments are parsed with `@microsoft/tsdoc` to\n * populate the `documentation` field on each {@link ForgeSymbol}.\n *\n * @param config - The resolved {@link ForgeConfig} for the project.\n * @returns An {@link ASTWalker} instance whose `walk()` method performs the extraction.\n * @public\n */\nexport function createWalker(config: ForgeConfig): ASTWalker {\n\treturn {\n\t\twalk(): ForgeSymbol[] {\n\t\t\t// Load tsconfig\n\t\t\tconst tsconfigPath = resolve(config.tsconfig);\n\t\t\tconst configFile = ts.readConfigFile(tsconfigPath, (path) => readFileSync(path, \"utf8\"));\n\n\t\t\tif (configFile.error) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Failed to read tsconfig at ${tsconfigPath}: ${ts.flattenDiagnosticMessageText(configFile.error.messageText, \"\\n\")}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst parsedCommandLine = ts.parseJsonConfigFileContent(\n\t\t\t\tconfigFile.config,\n\t\t\t\tts.sys,\n\t\t\t\tresolve(config.rootDir),\n\t\t\t);\n\n\t\t\tconst program = ts.createProgram({\n\t\t\t\trootNames: parsedCommandLine.fileNames,\n\t\t\t\toptions: parsedCommandLine.options,\n\t\t\t});\n\n\t\t\tconst checker = program.getTypeChecker();\n\n\t\t\tconst tsdocConfiguration = new TSDocConfiguration();\n\t\t\tconst tsdocParser = new TSDocParser(tsdocConfiguration);\n\n\t\t\tconst allSymbols: ForgeSymbol[] = [];\n\n\t\t\tfor (const sourceFile of program.getSourceFiles()) {\n\t\t\t\t// Skip declaration files and node_modules\n\t\t\t\tif (sourceFile.isDeclarationFile || sourceFile.fileName.includes(\"node_modules\")) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst fileSymbols = extractSymbolsFromFile(sourceFile, checker, tsdocParser);\n\t\t\t\tallSymbols.push(...fileSymbols);\n\t\t\t}\n\n\t\t\treturn allSymbols;\n\t\t},\n\t};\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;;;ACEvB,IAAK,aAAL,kBAAKA,gBAAL;AACN,EAAAA,YAAA,YAAS;AACT,EAAAA,YAAA,UAAO;AACP,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,aAAU;AAJC,SAAAA;AAAA,GAAA;;;ADQL,SAAS,cAAc,SAA8B;AAC3D,SAAO;AAAA,IACN;AAAA,IACA,UAAU,KAAK,SAAS,eAAe;AAAA,IACvC,QAAQ,KAAK,SAAS,MAAM;AAAA,IAC5B,SAAS;AAAA,M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AO;AACR;AAcO,SAAS,aAAa,QAAgC;AAC5D,SAAO;AAAA,IACN,OAAsB;AAErB,YAAM,eAAeG,SAAQ,OAAO,QAAQ;AAC5C,YAAM,aAAa,GAAG,eAAe,cAAc,CAAC,SAAS,aAAa,MAAM,MAAM,CAAC;AAEvF,UAAI,WAAW,OAAO;AACrB,cAAM,IAAI;AAAA,UACT,8BAA8B,YAAY,KAAK,GAAG,6BAA6B,WAAW,MAAM,aAAa,IAAI,CAAC;AAAA,QACnH;AAAA,MACD;AAEA,YAAM,oBAAoB,GAAG;AAAA,QAC5B,WAAW;AAAA,QACX,GAAG;AAAA,QACHA,SAAQ,OAAO,OAAO;AAAA,MACvB;AAEA,YAAM,UAAU,GAAG,cAAc;AAAA,QAChC,WAAW,kBAAkB;AAAA,QAC7B,SAAS,kBAAkB;AAAA,MAC5B,CAAC;AAED,YAAM,UAAU,QAAQ,eAAe;AAEvC,YAAM,qBAAqB,IAAI,mBAAmB;AAClD,YAAM,cAAc,IAAI,YAAY,kBAAkB;AAEtD,YAAM,aAA4B,CAAC;AAEnC,iBAAW,cAAc,QAAQ,eAAe,GAAG;AAElD,YAAI,WAAW,qBAAqB,WAAW,SAAS,SAAS,cAAc,GAAG;AACjF;AAAA,QACD;AAEA,cAAM,cAAc,uBAAuB,YAAY,SAAS,WAAW;AAC3E,mBAAW,KAAK,GAAG,WAAW;AAAA,MAC/B;AAEA,aAAO;AAAA,IACR;AAAA,EACD;AACD;","names":["Visibility","resolve","name","pos","rawComment","documentation","tags","visibility","resolve"]}
|
|
1
|
+
{"version":3,"sources":["../src/config.ts","../src/types.ts","../src/visibility.ts","../src/walker.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { type ForgeConfig, Visibility } from \"./types.js\";\n\n/**\n * Constructs a sensible default {@link ForgeConfig} rooted at `rootDir`.\n *\n * @param rootDir - Absolute path to the project root.\n * @returns A fully-populated default configuration.\n * @example\n * ```typescript\n * import { defaultConfig } from \"@forge-ts/core\";\n * const config = defaultConfig(\"/path/to/project\");\n * console.log(config.enforce.enabled); // true\n * ```\n * @public\n */\nexport function defaultConfig(rootDir: string): ForgeConfig {\n\treturn {\n\t\trootDir,\n\t\ttsconfig: join(rootDir, \"tsconfig.json\"),\n\t\toutDir: join(rootDir, \"docs\"),\n\t\tenforce: {\n\t\t\tenabled: true,\n\t\t\tminVisibility: Visibility.Public,\n\t\t\tstrict: false,\n\t\t},\n\t\tdoctest: {\n\t\t\tenabled: true,\n\t\t\tcacheDir: join(rootDir, \".cache\", \"doctest\"),\n\t\t},\n\t\tapi: {\n\t\t\tenabled: false,\n\t\t\topenapi: false,\n\t\t\topenapiPath: join(rootDir, \"docs\", \"openapi.json\"),\n\t\t},\n\t\tgen: {\n\t\t\tenabled: true,\n\t\t\tformats: [\"markdown\"],\n\t\t\tllmsTxt: true,\n\t\t\treadmeSync: false,\n\t\t},\n\t};\n}\n\n/**\n * Merges a partial user config with the defaults so every field is present.\n *\n * @param rootDir - Absolute path to the project root.\n * @param partial - Partial config from the user's config file.\n * @returns A fully-populated {@link ForgeConfig}.\n * @internal\n */\nfunction mergeWithDefaults(rootDir: string, partial: Partial<ForgeConfig>): ForgeConfig {\n\tconst defaults = defaultConfig(rootDir);\n\treturn {\n\t\t...defaults,\n\t\t...partial,\n\t\tenforce: { ...defaults.enforce, ...partial.enforce },\n\t\tdoctest: { ...defaults.doctest, ...partial.doctest },\n\t\tapi: { ...defaults.api, ...partial.api },\n\t\tgen: { ...defaults.gen, ...partial.gen },\n\t};\n}\n\n/**\n * Attempts to load a TypeScript or JavaScript config file via dynamic import.\n *\n * @param filePath - Absolute path to the config file.\n * @returns The default export of the config module, or `null` on failure.\n * @internal\n */\nasync function loadModuleConfig(filePath: string): Promise<Partial<ForgeConfig> | null> {\n\ttry {\n\t\tconst fileUrl = pathToFileURL(filePath).href;\n\t\tconst mod = (await import(fileUrl)) as {\n\t\t\tdefault?: Partial<ForgeConfig>;\n\t\t};\n\t\treturn mod.default ?? null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/**\n * Minimal shape of a `package.json` file relevant to forge-ts config loading.\n * @internal\n */\ninterface PackageJson {\n\tname?: string;\n\tversion?: string;\n\t\"forge-ts\"?: Partial<ForgeConfig>;\n}\n\n/**\n * Attempts to read the `\"forge-ts\"` key from a `package.json` file.\n *\n * @param pkgPath - Absolute path to `package.json`.\n * @returns The value of the `\"forge-ts\"` key, or `null` if absent.\n * @internal\n */\nasync function loadPackageJsonConfig(pkgPath: string): Promise<Partial<ForgeConfig> | null> {\n\ttry {\n\t\tconst raw = await readFile(pkgPath, \"utf8\");\n\t\tconst pkg = JSON.parse(raw) as PackageJson;\n\t\tconst key = pkg[\"forge-ts\"];\n\t\tif (key) {\n\t\t\treturn key;\n\t\t}\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/**\n * Loads the forge-ts configuration for a project.\n *\n * Resolution order:\n * 1. `<rootDir>/forge-ts.config.ts`\n * 2. `<rootDir>/forge-ts.config.js`\n * 3. `\"forge-ts\"` key inside `<rootDir>/package.json`\n * 4. Built-in defaults (returned when none of the above is found)\n *\n * @param rootDir - The project root to search for config. Defaults to `process.cwd()`.\n * @returns A fully-resolved {@link ForgeConfig}.\n * @example\n * ```typescript\n * import { loadConfig } from \"@forge-ts/core\";\n * const config = await loadConfig(\"/path/to/project\");\n * // config is fully resolved with defaults\n * ```\n * @public\n */\nexport async function loadConfig(rootDir?: string): Promise<ForgeConfig> {\n\tconst root = resolve(rootDir ?? process.cwd());\n\n\tconst candidates = [join(root, \"forge-ts.config.ts\"), join(root, \"forge-ts.config.js\")];\n\n\tfor (const candidate of candidates) {\n\t\tif (existsSync(candidate)) {\n\t\t\tconst partial = await loadModuleConfig(candidate);\n\t\t\tif (partial) {\n\t\t\t\treturn mergeWithDefaults(root, partial);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst pkgPath = join(root, \"package.json\");\n\tif (existsSync(pkgPath)) {\n\t\tconst partial = await loadPackageJsonConfig(pkgPath);\n\t\tif (partial) {\n\t\t\treturn mergeWithDefaults(root, partial);\n\t\t}\n\t}\n\n\treturn defaultConfig(root);\n}\n","/**\n * Visibility levels for exported symbols.\n * Derived from TSDoc release tags (@public, @beta, @internal).\n * @public\n */\nexport enum Visibility {\n\tPublic = \"public\",\n\tBeta = \"beta\",\n\tInternal = \"internal\",\n\tPrivate = \"private\",\n}\n\n/**\n * A single extracted and annotated symbol from the TypeScript AST.\n * @public\n */\nexport interface ForgeSymbol {\n\t/** The declared name of the symbol. */\n\tname: string;\n\t/** The syntactic kind of the symbol. */\n\tkind: \"function\" | \"class\" | \"interface\" | \"type\" | \"enum\" | \"variable\" | \"method\" | \"property\";\n\t/** Resolved visibility from TSDoc release tags. */\n\tvisibility: Visibility;\n\t/** Absolute path to the source file. */\n\tfilePath: string;\n\t/** 1-based line number of the declaration. */\n\tline: number;\n\t/** 0-based column of the declaration. */\n\tcolumn: number;\n\t/** Parsed TSDoc documentation, if present. */\n\tdocumentation?: {\n\t\tsummary?: string;\n\t\tparams?: Array<{ name: string; description: string; type?: string }>;\n\t\treturns?: { description: string; type?: string };\n\t\tthrows?: Array<{ type?: string; description: string }>;\n\t\texamples?: Array<{ code: string; language: string; line: number }>;\n\t\ttags?: Record<string, string[]>;\n\t\tdeprecated?: string;\n\t};\n\t/** Human-readable type signature of the symbol. */\n\tsignature?: string;\n\t/** Child symbols (e.g., class members, enum values). */\n\tchildren?: ForgeSymbol[];\n\t/** Whether this symbol is part of the public module exports. */\n\texported: boolean;\n}\n\n/**\n * Full configuration for a forge-ts run.\n * Loaded from forge-ts.config.ts or the \"forge-ts\" key in package.json.\n * @public\n */\nexport interface ForgeConfig {\n\t/** Root directory of the project. */\n\trootDir: string;\n\t/** Path to the tsconfig.json to compile against. */\n\ttsconfig: string;\n\t/** Output directory for generated files. */\n\toutDir: string;\n\t/** Enforce TSDoc on all public exports. */\n\tenforce: {\n\t\tenabled: boolean;\n\t\t/** Minimum visibility level to enforce documentation on. */\n\t\tminVisibility: Visibility;\n\t\t/** Fail on warnings rather than only on errors. */\n\t\tstrict: boolean;\n\t};\n\t/** DocTest configuration. */\n\tdoctest: {\n\t\tenabled: boolean;\n\t\t/** Cache directory for virtual test files. */\n\t\tcacheDir: string;\n\t};\n\t/** API generation configuration. */\n\tapi: {\n\t\tenabled: boolean;\n\t\t/** Generate an OpenAPI spec from exported HTTP handlers. */\n\t\topenapi: boolean;\n\t\t/** Output path for the OpenAPI spec file. */\n\t\topenapiPath: string;\n\t};\n\t/** Output generation configuration. */\n\tgen: {\n\t\tenabled: boolean;\n\t\t/** Output formats to generate. */\n\t\tformats: Array<\"markdown\" | \"mdx\">;\n\t\t/** Generate an llms.txt companion file. */\n\t\tllmsTxt: boolean;\n\t\t/** Synchronise summaries back into README.md. */\n\t\treadmeSync: boolean;\n\t\t/** Static site generator to target for output format. */\n\t\tssgTarget?: \"docusaurus\" | \"mintlify\" | \"nextra\" | \"vitepress\";\n\t};\n}\n\n/**\n * The result of a forge-ts compilation pass.\n * @public\n */\nexport interface ForgeResult {\n\t/** Whether the run succeeded without errors. */\n\tsuccess: boolean;\n\t/** All symbols extracted during this run. */\n\tsymbols: ForgeSymbol[];\n\t/** Errors that caused or would cause failure. */\n\terrors: ForgeError[];\n\t/** Non-fatal warnings. */\n\twarnings: ForgeWarning[];\n\t/** Wall-clock duration of the run in milliseconds. */\n\tduration: number;\n}\n\n/**\n * A diagnostic error produced during a forge-ts run.\n * @public\n */\nexport interface ForgeError {\n\t/** Machine-readable error code (e.g. \"E001\"). */\n\tcode: string;\n\t/** Human-readable description of the error. */\n\tmessage: string;\n\t/** Absolute path of the file where the error occurred. */\n\tfilePath: string;\n\t/** 1-based line number. */\n\tline: number;\n\t/** 0-based column. */\n\tcolumn: number;\n\t/** Suggested fix for the agent — exact TSDoc block to add. */\n\tsuggestedFix?: string;\n\t/** The symbol name that needs fixing. */\n\tsymbolName?: string;\n\t/** The symbol kind (function, class, interface, etc.). */\n\tsymbolKind?: string;\n}\n\n/**\n * A diagnostic warning produced during a forge-ts run.\n * @public\n */\nexport interface ForgeWarning {\n\t/** Machine-readable warning code (e.g. \"W001\"). */\n\tcode: string;\n\t/** Human-readable description of the warning. */\n\tmessage: string;\n\t/** Absolute path of the file where the warning occurred. */\n\tfilePath: string;\n\t/** 1-based line number. */\n\tline: number;\n\t/** 0-based column. */\n\tcolumn: number;\n}\n","import { type ForgeSymbol, Visibility } from \"./types.js\";\n\n/**\n * Determines the visibility level of a symbol from its TSDoc release tags.\n *\n * The precedence order is:\n * 1. `@internal` → {@link Visibility.Internal}\n * 2. `@beta` → {@link Visibility.Beta}\n * 3. `@public` → {@link Visibility.Public}\n * 4. (no tag) → {@link Visibility.Public} (default for exports)\n *\n * @param tags - The parsed `tags` map from `ForgeSymbol.documentation`.\n * @returns The resolved {@link Visibility} value.\n * @example\n * ```typescript\n * import { resolveVisibility } from \"@forge-ts/core\";\n * const vis = resolveVisibility({ internal: [] });\n * // vis === Visibility.Internal\n * ```\n * @public\n */\nexport function resolveVisibility(tags: Record<string, string[]> | undefined): Visibility {\n\tif (!tags) return Visibility.Public;\n\n\tif (\"internal\" in tags) return Visibility.Internal;\n\tif (\"beta\" in tags) return Visibility.Beta;\n\tif (\"public\" in tags) return Visibility.Public;\n\n\treturn Visibility.Public;\n}\n\n/**\n * Numeric rank used for visibility comparisons.\n * Lower numbers are more restrictive.\n * @internal\n */\nconst VISIBILITY_RANK: Record<Visibility, number> = {\n\t[Visibility.Public]: 0,\n\t[Visibility.Beta]: 1,\n\t[Visibility.Internal]: 2,\n\t[Visibility.Private]: 3,\n};\n\n/**\n * Returns whether `candidate` meets or exceeds the required minimum visibility.\n *\n * \"Meets\" means the symbol is at least as visible as `minVisibility`.\n * For example, `Public` meets a minimum of `Public`, but `Internal` does not.\n *\n * @param candidate - The visibility of the symbol being tested.\n * @param minVisibility - The minimum visibility threshold.\n * @returns `true` if `candidate` is at least as visible as `minVisibility`.\n * @example\n * ```typescript\n * import { meetsVisibility, Visibility } from \"@forge-ts/core\";\n * meetsVisibility(Visibility.Public, Visibility.Public); // true\n * meetsVisibility(Visibility.Internal, Visibility.Public); // false\n * ```\n * @public\n */\nexport function meetsVisibility(candidate: Visibility, minVisibility: Visibility): boolean {\n\treturn VISIBILITY_RANK[candidate] <= VISIBILITY_RANK[minVisibility];\n}\n\n/**\n * Filters an array of {@link ForgeSymbol} objects to only include symbols\n * whose visibility meets or exceeds `minVisibility`.\n *\n * @param symbols - The full list of symbols to filter.\n * @param minVisibility - The minimum visibility threshold to keep.\n * @returns A new array containing only symbols that pass the visibility check.\n * @example\n * ```typescript\n * import { filterByVisibility, Visibility } from \"@forge-ts/core\";\n * const publicOnly = filterByVisibility(symbols, Visibility.Public);\n * ```\n * @public\n */\nexport function filterByVisibility(\n\tsymbols: ForgeSymbol[],\n\tminVisibility: Visibility,\n): ForgeSymbol[] {\n\treturn symbols.filter((s) => meetsVisibility(s.visibility, minVisibility));\n}\n","import { readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport {\n\ttype DocBlock,\n\ttype DocCodeSpan,\n\ttype DocComment,\n\ttype DocFencedCode,\n\ttype DocNode,\n\tDocNodeKind,\n\ttype DocParagraph,\n\ttype DocPlainText,\n\ttype DocSection,\n\tStandardTags,\n\tTSDocConfiguration,\n\tTSDocParser,\n} from \"@microsoft/tsdoc\";\nimport ts from \"typescript\";\nimport type { ForgeConfig, ForgeSymbol } from \"./types.js\";\nimport { resolveVisibility } from \"./visibility.js\";\n\n// ---------------------------------------------------------------------------\n// Public API surface\n// ---------------------------------------------------------------------------\n\n/**\n * The return type of {@link createWalker}.\n * @public\n */\nexport interface ASTWalker {\n\t/**\n\t * Walk all source files referenced by the configured tsconfig and return\n\t * one {@link ForgeSymbol} per exported declaration.\n\t */\n\twalk(): ForgeSymbol[];\n}\n\n// ---------------------------------------------------------------------------\n// TSDoc helpers\n// ---------------------------------------------------------------------------\n\n/** Render inline nodes (PlainText, CodeSpan, SoftBreak) to a plain string. @internal */\nfunction renderInlineNodes(nodes: readonly DocNode[]): string {\n\tconst parts: string[] = [];\n\tfor (const node of nodes) {\n\t\tswitch (node.kind) {\n\t\t\tcase DocNodeKind.PlainText:\n\t\t\t\tparts.push((node as DocPlainText).text);\n\t\t\t\tbreak;\n\t\t\tcase DocNodeKind.CodeSpan:\n\t\t\t\tparts.push(`\\`${(node as DocCodeSpan).code}\\``);\n\t\t\t\tbreak;\n\t\t\tcase DocNodeKind.SoftBreak:\n\t\t\t\tparts.push(\" \");\n\t\t\t\tbreak;\n\t\t\tcase DocNodeKind.Paragraph:\n\t\t\t\t// Recurse into paragraph nodes to extract nested text\n\t\t\t\tparts.push(renderInlineNodes((node as DocParagraph).nodes));\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn parts.join(\"\");\n}\n\n/** Render a `DocSection` (or similar node) to a plain string. @internal */\nfunction renderDocSection(section: DocSection | undefined): string {\n\tif (!section) return \"\";\n\treturn renderInlineNodes(section.nodes).trim();\n}\n\n/** Render a `DocBlock`'s content to a plain string. @internal */\nfunction renderBlock(block: DocBlock): string {\n\treturn renderDocSection(block.content);\n}\n\n/** Extract all `@example` fenced code blocks from a parsed comment. @internal */\nfunction extractExamples(\n\tcomment: DocComment,\n\tstartLine: number,\n): Array<{ code: string; language: string; line: number }> {\n\tconst examples: Array<{ code: string; language: string; line: number }> = [];\n\n\tfor (const block of comment.customBlocks) {\n\t\tif (block.blockTag.tagName.toLowerCase() !== \"@example\") continue;\n\n\t\tfor (const node of block.content.nodes) {\n\t\t\tif (node.kind === DocNodeKind.FencedCode) {\n\t\t\t\tconst fenced = node as DocFencedCode;\n\t\t\t\texamples.push({\n\t\t\t\t\tcode: fenced.code,\n\t\t\t\t\tlanguage: fenced.language || \"typescript\",\n\t\t\t\t\tline: startLine,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\treturn examples;\n}\n\n/** Parse a raw JSDoc/TSDoc comment string into a structured documentation object. @internal */\nfunction parseTSDoc(rawComment: string, startLine: number): ForgeSymbol[\"documentation\"] {\n\tconst configuration = new TSDocConfiguration();\n\tconst parser = new TSDocParser(configuration);\n\tconst result = parser.parseString(rawComment);\n\tconst comment = result.docComment;\n\n\tconst tags: Record<string, string[]> = {};\n\n\t// Release tags\n\tif (comment.modifierTagSet.hasTag(StandardTags.public)) {\n\t\ttags.public = [];\n\t}\n\tif (comment.modifierTagSet.hasTag(StandardTags.beta)) {\n\t\ttags.beta = [];\n\t}\n\tif (comment.modifierTagSet.hasTag(StandardTags.internal)) {\n\t\ttags.internal = [];\n\t}\n\tif (comment.modifierTagSet.hasTag(StandardTags.alpha)) {\n\t\ttags.alpha = [];\n\t}\n\tif (comment.modifierTagSet.hasTag(StandardTags.packageDocumentation)) {\n\t\ttags.packageDocumentation = [];\n\t}\n\n\t// @deprecated\n\tlet deprecated: string | undefined;\n\tif (comment.deprecatedBlock) {\n\t\tdeprecated = renderBlock(comment.deprecatedBlock).trim() || \"true\";\n\t}\n\n\t// @param blocks\n\tconst params: Array<{ name: string; description: string; type?: string }> = [];\n\tfor (const paramBlock of comment.params.blocks) {\n\t\tparams.push({\n\t\t\tname: paramBlock.parameterName,\n\t\t\tdescription: renderBlock(paramBlock),\n\t\t});\n\t}\n\n\t// @returns block\n\tlet returns: { description: string; type?: string } | undefined;\n\tif (comment.returnsBlock) {\n\t\tconst desc = renderBlock(comment.returnsBlock);\n\t\tif (desc) returns = { description: desc };\n\t}\n\n\t// @throws blocks\n\tconst throws: Array<{ type?: string; description: string }> = [];\n\tfor (const block of comment.customBlocks) {\n\t\tif (block.blockTag.tagName.toLowerCase() === \"@throws\") {\n\t\t\tthrows.push({ description: renderBlock(block) });\n\t\t}\n\t}\n\n\t// @example blocks\n\tconst examples = extractExamples(comment, startLine);\n\n\tconst summary = renderDocSection(comment.summarySection);\n\n\treturn {\n\t\tsummary: summary || undefined,\n\t\tparams: params.length > 0 ? params : undefined,\n\t\treturns,\n\t\tthrows: throws.length > 0 ? throws : undefined,\n\t\texamples: examples.length > 0 ? examples : undefined,\n\t\ttags: Object.keys(tags).length > 0 ? tags : undefined,\n\t\tdeprecated,\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// TypeScript AST helpers\n// ---------------------------------------------------------------------------\n\n/** Extract the leading JSDoc comment text for a node. @internal */\nfunction getLeadingComment(node: ts.Node, sourceFile: ts.SourceFile): string | undefined {\n\tconst fullText = sourceFile.getFullText();\n\tconst ranges = ts.getLeadingCommentRanges(fullText, node.getFullStart());\n\tif (!ranges || ranges.length === 0) return undefined;\n\n\t// Take the last leading comment (closest to the declaration)\n\tconst range = ranges[ranges.length - 1];\n\tif (\n\t\trange.kind !== ts.SyntaxKind.MultiLineCommentTrivia ||\n\t\t!fullText.slice(range.pos, range.end).startsWith(\"/**\")\n\t) {\n\t\treturn undefined;\n\t}\n\n\treturn fullText.slice(range.pos, range.end);\n}\n\n/** Map a TypeScript `SyntaxKind` to a `ForgeSymbol` kind string. @internal */\nfunction kindToString(kind: ts.SyntaxKind): ForgeSymbol[\"kind\"] | null {\n\tswitch (kind) {\n\t\tcase ts.SyntaxKind.FunctionDeclaration:\n\t\tcase ts.SyntaxKind.ArrowFunction:\n\t\tcase ts.SyntaxKind.FunctionExpression:\n\t\t\treturn \"function\";\n\t\tcase ts.SyntaxKind.ClassDeclaration:\n\t\t\treturn \"class\";\n\t\tcase ts.SyntaxKind.InterfaceDeclaration:\n\t\t\treturn \"interface\";\n\t\tcase ts.SyntaxKind.TypeAliasDeclaration:\n\t\t\treturn \"type\";\n\t\tcase ts.SyntaxKind.EnumDeclaration:\n\t\t\treturn \"enum\";\n\t\tcase ts.SyntaxKind.VariableDeclaration:\n\t\tcase ts.SyntaxKind.VariableStatement:\n\t\t\treturn \"variable\";\n\t\tcase ts.SyntaxKind.MethodDeclaration:\n\t\tcase ts.SyntaxKind.MethodSignature:\n\t\t\treturn \"method\";\n\t\tcase ts.SyntaxKind.PropertyDeclaration:\n\t\tcase ts.SyntaxKind.PropertySignature:\n\t\tcase ts.SyntaxKind.EnumMember:\n\t\t\treturn \"property\";\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n\n/** Build a human-readable type signature string using the type checker. @internal */\nfunction buildSignature(node: ts.Declaration, checker: ts.TypeChecker): string | undefined {\n\ttry {\n\t\tconst symbol = checker.getSymbolAtLocation((node as ts.NamedDeclaration).name ?? node);\n\t\tif (!symbol) return undefined;\n\t\tconst type = checker.getTypeOfSymbolAtLocation(symbol, node);\n\t\treturn checker.typeToString(type);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Walker implementation\n// ---------------------------------------------------------------------------\n\n/** @internal */\nfunction extractSymbolsFromFile(\n\tsourceFile: ts.SourceFile,\n\tchecker: ts.TypeChecker,\n\t_tsdocParser: TSDocParser,\n): ForgeSymbol[] {\n\tconst symbols: ForgeSymbol[] = [];\n\tconst filePath = sourceFile.fileName;\n\n\tfunction visit(node: ts.Node, parentExported: boolean): void {\n\t\tconst isExported =\n\t\t\tparentExported ||\n\t\t\t(ts.getCombinedModifierFlags(node as ts.Declaration) & ts.ModifierFlags.Export) !== 0;\n\n\t\t// Handle export declarations: `export { Foo, Bar }`\n\t\tif (ts.isExportDeclaration(node)) {\n\t\t\tts.forEachChild(node, (child) => visit(child, true));\n\t\t\treturn;\n\t\t}\n\n\t\tconst kind = kindToString(node.kind);\n\n\t\t// Variable statements need special handling: `export const foo = ...`\n\t\tif (ts.isVariableStatement(node)) {\n\t\t\tif (!isExported) {\n\t\t\t\tts.forEachChild(node, (child) => visit(child, false));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (const decl of node.declarationList.declarations) {\n\t\t\t\tconst name = decl.name.getText(sourceFile);\n\t\t\t\tconst pos = sourceFile.getLineAndCharacterOfPosition(decl.getStart());\n\t\t\t\tconst rawComment = getLeadingComment(node, sourceFile);\n\t\t\t\tconst documentation = rawComment ? parseTSDoc(rawComment, pos.line + 1) : undefined;\n\t\t\t\tconst tags = documentation?.tags;\n\t\t\t\tconst visibility = resolveVisibility(tags);\n\n\t\t\t\tsymbols.push({\n\t\t\t\t\tname,\n\t\t\t\t\tkind: \"variable\",\n\t\t\t\t\tvisibility,\n\t\t\t\t\tfilePath,\n\t\t\t\t\tline: pos.line + 1,\n\t\t\t\t\tcolumn: pos.character,\n\t\t\t\t\tdocumentation,\n\t\t\t\t\tsignature: buildSignature(decl, checker),\n\t\t\t\t\texported: true,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (kind === null || !isExported) {\n\t\t\tts.forEachChild(node, (child) => visit(child, isExported));\n\t\t\treturn;\n\t\t}\n\n\t\tconst namedNode = node as ts.NamedDeclaration;\n\t\tconst nameNode = namedNode.name;\n\t\tif (!nameNode) {\n\t\t\tts.forEachChild(node, (child) => visit(child, isExported));\n\t\t\treturn;\n\t\t}\n\n\t\tconst name = nameNode.getText(sourceFile);\n\t\tconst pos = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n\t\tconst rawComment = getLeadingComment(node, sourceFile);\n\t\tconst documentation = rawComment ? parseTSDoc(rawComment, pos.line + 1) : undefined;\n\t\tconst tags = documentation?.tags;\n\t\tconst visibility = resolveVisibility(tags);\n\n\t\tconst children: ForgeSymbol[] = [];\n\n\t\t// Walk class members / interface members / enum members\n\t\tif (\n\t\t\tts.isClassDeclaration(node) ||\n\t\t\tts.isInterfaceDeclaration(node) ||\n\t\t\tts.isEnumDeclaration(node)\n\t\t) {\n\t\t\tfor (const member of node.members) {\n\t\t\t\tconst memberKind = kindToString(member.kind);\n\t\t\t\tif (!memberKind) continue;\n\t\t\t\tconst memberName = (member as ts.NamedDeclaration).name?.getText(sourceFile) ?? \"\";\n\t\t\t\tconst memberPos = sourceFile.getLineAndCharacterOfPosition(member.getStart());\n\t\t\t\tconst memberComment = getLeadingComment(member, sourceFile);\n\t\t\t\tconst memberDoc = memberComment ? parseTSDoc(memberComment, memberPos.line + 1) : undefined;\n\t\t\t\tconst memberTags = memberDoc?.tags;\n\t\t\t\tconst memberVisibility = resolveVisibility(memberTags);\n\n\t\t\t\tchildren.push({\n\t\t\t\t\tname: memberName,\n\t\t\t\t\tkind: memberKind,\n\t\t\t\t\tvisibility: memberVisibility,\n\t\t\t\t\tfilePath,\n\t\t\t\t\tline: memberPos.line + 1,\n\t\t\t\t\tcolumn: memberPos.character,\n\t\t\t\t\tdocumentation: memberDoc,\n\t\t\t\t\tsignature: buildSignature(member as ts.Declaration, checker),\n\t\t\t\t\texported: false,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tsymbols.push({\n\t\t\tname,\n\t\t\tkind,\n\t\t\tvisibility,\n\t\t\tfilePath,\n\t\t\tline: pos.line + 1,\n\t\t\tcolumn: pos.character,\n\t\t\tdocumentation,\n\t\t\tsignature: buildSignature(namedNode as ts.Declaration, checker),\n\t\t\tchildren: children.length > 0 ? children : undefined,\n\t\t\texported: isExported,\n\t\t});\n\t}\n\n\tts.forEachChild(sourceFile, (node) => visit(node, false));\n\treturn symbols;\n}\n\n/**\n * Creates an {@link ASTWalker} configured for the given forge config.\n *\n * The walker uses the TypeScript Compiler API to create a `ts.Program` from\n * the project's tsconfig, then visits every source file to extract exported\n * declarations. TSDoc comments are parsed with `@microsoft/tsdoc` to\n * populate the `documentation` field on each {@link ForgeSymbol}.\n *\n * @param config - The resolved {@link ForgeConfig} for the project.\n * @returns An {@link ASTWalker} instance whose `walk()` method performs the extraction.\n * @example\n * ```typescript\n * import { loadConfig, createWalker } from \"@forge-ts/core\";\n * const config = await loadConfig();\n * const walker = createWalker(config);\n * const symbols = walker.walk();\n * console.log(`Found ${symbols.length} symbols`);\n * ```\n * @public\n */\nexport function createWalker(config: ForgeConfig): ASTWalker {\n\treturn {\n\t\twalk(): ForgeSymbol[] {\n\t\t\t// Load tsconfig\n\t\t\tconst tsconfigPath = resolve(config.tsconfig);\n\t\t\tconst configFile = ts.readConfigFile(tsconfigPath, (path) => readFileSync(path, \"utf8\"));\n\n\t\t\tif (configFile.error) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Failed to read tsconfig at ${tsconfigPath}: ${ts.flattenDiagnosticMessageText(configFile.error.messageText, \"\\n\")}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst parsedCommandLine = ts.parseJsonConfigFileContent(\n\t\t\t\tconfigFile.config,\n\t\t\t\tts.sys,\n\t\t\t\tresolve(config.rootDir),\n\t\t\t);\n\n\t\t\tconst program = ts.createProgram({\n\t\t\t\trootNames: parsedCommandLine.fileNames,\n\t\t\t\toptions: parsedCommandLine.options,\n\t\t\t});\n\n\t\t\tconst checker = program.getTypeChecker();\n\n\t\t\tconst tsdocConfiguration = new TSDocConfiguration();\n\t\t\tconst tsdocParser = new TSDocParser(tsdocConfiguration);\n\n\t\t\tconst allSymbols: ForgeSymbol[] = [];\n\n\t\t\tfor (const sourceFile of program.getSourceFiles()) {\n\t\t\t\t// Skip declaration files and node_modules\n\t\t\t\tif (sourceFile.isDeclarationFile || sourceFile.fileName.includes(\"node_modules\")) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst fileSymbols = extractSymbolsFromFile(sourceFile, checker, tsdocParser);\n\t\t\t\tallSymbols.push(...fileSymbols);\n\t\t\t}\n\n\t\t\treturn allSymbols;\n\t\t},\n\t};\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;;;ACEvB,IAAK,aAAL,kBAAKA,gBAAL;AACN,EAAAA,YAAA,YAAS;AACT,EAAAA,YAAA,UAAO;AACP,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,aAAU;AAJC,SAAAA;AAAA,GAAA;;;ADcL,SAAS,cAAc,SAA8B;AAC3D,SAAO;AAAA,IACN;AAAA,IACA,UAAU,KAAK,SA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6B,OAAO;AAAA,MAC9D,UAAU,SAAS,SAAS,IAAI,WAAW;AAAA,MAC3C,UAAU;AAAA,IACX,CAAC;AAAA,EACF;AAEA,KAAG,aAAa,YAAY,CAAC,SAAS,MAAM,MAAM,KAAK,CAAC;AACxD,SAAO;AACR;AAsBO,SAAS,aAAa,QAAgC;AAC5D,SAAO;AAAA,IACN,OAAsB;AAErB,YAAM,eAAeG,SAAQ,OAAO,QAAQ;AAC5C,YAAM,aAAa,GAAG,eAAe,cAAc,CAAC,SAAS,aAAa,MAAM,MAAM,CAAC;AAEvF,UAAI,WAAW,OAAO;AACrB,cAAM,IAAI;AAAA,UACT,8BAA8B,YAAY,KAAK,GAAG,6BAA6B,WAAW,MAAM,aAAa,IAAI,CAAC;AAAA,QACnH;AAAA,MACD;AAEA,YAAM,oBAAoB,GAAG;AAAA,QAC5B,WAAW;AAAA,QACX,GAAG;AAAA,QACHA,SAAQ,OAAO,OAAO;AAAA,MACvB;AAEA,YAAM,UAAU,GAAG,cAAc;AAAA,QAChC,WAAW,kBAAkB;AAAA,QAC7B,SAAS,kBAAkB;AAAA,MAC5B,CAAC;AAED,YAAM,UAAU,QAAQ,eAAe;AAEvC,YAAM,qBAAqB,IAAI,mBAAmB;AAClD,YAAM,cAAc,IAAI,YAAY,kBAAkB;AAEtD,YAAM,aAA4B,CAAC;AAEnC,iBAAW,cAAc,QAAQ,eAAe,GAAG;AAElD,YAAI,WAAW,qBAAqB,WAAW,SAAS,SAAS,cAAc,GAAG;AACjF;AAAA,QACD;AAEA,cAAM,cAAc,uBAAuB,YAAY,SAAS,WAAW;AAC3E,mBAAW,KAAK,GAAG,WAAW;AAAA,MAC/B;AAEA,aAAO;AAAA,IACR;AAAA,EACD;AACD;","names":["Visibility","resolve","name","pos","rawComment","documentation","tags","visibility","resolve"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge-ts/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared types, interfaces, and core AST walker for forge-ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"tsup": "^8.3.5",
|
|
32
|
-
"@forge-ts/api": "0.3.
|
|
33
|
-
"@forge-ts/
|
|
34
|
-
"@forge-ts/
|
|
32
|
+
"@forge-ts/api": "0.3.1",
|
|
33
|
+
"@forge-ts/gen": "0.3.1",
|
|
34
|
+
"@forge-ts/enforcer": "0.3.1"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsup",
|