@ankhorage/paradox 0.1.27 → 0.2.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/CHANGELOG.md +14 -0
- package/README.md +53 -61
- package/dist/analyze/analyze.d.ts +2 -2
- package/dist/analyze/analyze.js +51 -35
- package/dist/analyze/badges.d.ts +2 -1
- package/dist/analyze/badges.js +14 -4
- package/dist/analyze/components.js +12 -11
- package/dist/analyze/documentation/collectDocumentationCommentsAsync.d.ts +11 -0
- package/dist/analyze/documentation/collectDocumentationCommentsAsync.js +72 -0
- package/dist/analyze/documentation/findings.d.ts +5 -0
- package/dist/analyze/documentation/findings.js +17 -0
- package/dist/analyze/documentation/validateDocumentationPolicyAsync.d.ts +13 -0
- package/dist/analyze/documentation/validateDocumentationPolicyAsync.js +150 -0
- package/dist/analyze/documentation/validateReferencesAsync.d.ts +11 -0
- package/dist/analyze/documentation/validateReferencesAsync.js +148 -0
- package/dist/analyze/exports.d.ts +4 -0
- package/dist/analyze/exports.js +17 -15
- package/dist/analyze/modules.js +3 -8
- package/dist/analyze/readmeConfig.d.ts +1 -3
- package/dist/analyze/readmeConfig.js +8 -19
- package/dist/analyze/readmeUsage.d.ts +7 -10
- package/dist/analyze/readmeUsage.js +124 -48
- package/dist/analyze/semantic/docBlocks.js +18 -48
- package/dist/analyze/semantic/exports.js +3 -7
- package/dist/analyze/semantic/model.d.ts +0 -2
- package/dist/analyze/semantic/paradoxComment.d.ts +1 -11
- package/dist/analyze/semantic/paradoxComment.js +1 -43
- package/dist/analyze/semantic/tagRegistry.js +2 -1
- package/dist/analyze/sequenceScenarios.js +2 -4
- package/dist/analyze/sourceFunctions.js +4 -4
- package/dist/analyze/types.d.ts +31 -24
- package/dist/analyze/usage.d.ts +2 -2
- package/dist/analyze/usage.js +3 -33
- package/dist/analyze/utils/getExportMetadata.js +11 -40
- package/dist/analyze/utils/parseParadoxComment.d.ts +12 -9
- package/dist/analyze/utils/parseParadoxComment.js +66 -78
- package/dist/cli/index.d.ts +3 -2
- package/dist/cli/index.js +3 -2
- package/dist/cli/standalone.js +11 -0
- package/dist/config/defineParadoxConfig.d.ts +1 -1
- package/dist/doc-tags/registry.d.ts +28 -32
- package/dist/doc-tags/registry.js +35 -39
- package/dist/index.d.ts +1 -1
- package/dist/model/buildModel.d.ts +26 -19
- package/dist/model/buildModel.js +33 -99
- package/dist/model/types.d.ts +27 -20
- package/dist/paths/policy.d.ts +1 -1
- package/dist/render/renderers/diagrams.js +3 -11
- package/dist/render/renderers/html.js +89 -58
- package/dist/render/renderers/markdown.js +139 -86
- package/dist/render/toFileStem.d.ts +2 -0
- package/dist/render/toFileStem.js +8 -0
- package/dist/{config/types.d.ts → types/config.d.ts} +3 -5
- package/dist/write/write.d.ts +1 -1
- package/package.json +2 -1
- package/dist/analyze/readmeCli.d.ts +0 -9
- package/dist/analyze/readmeCli.js +0 -33
- package/dist/analyze/utils/getLeadingParadoxComment.d.ts +0 -10
- package/dist/analyze/utils/getLeadingParadoxComment.js +0 -16
- /package/dist/{config/types.js → types/config.js} +0 -0
|
@@ -42,8 +42,7 @@ function getSourceLocation(node, root) {
|
|
|
42
42
|
* Extracts callable signatures for exported functions and callable values.
|
|
43
43
|
*/
|
|
44
44
|
function getSignatures(symbol, node, root) {
|
|
45
|
-
const
|
|
46
|
-
const signatures = getCallableDeclarations(symbol, node).map((declaration) => getSignature(declaration, parsed.params, parsed.returns, root));
|
|
45
|
+
const signatures = getCallableDeclarations(symbol, node).map((declaration) => getSignature(declaration, root));
|
|
47
46
|
return uniqueBy(signatures.filter((signature) => signature.parameters.length > 0 ||
|
|
48
47
|
signature.returnType !== null ||
|
|
49
48
|
signature.returnDescription !== null), (signature) => signature.label);
|
|
@@ -51,16 +50,13 @@ function getSignatures(symbol, node, root) {
|
|
|
51
50
|
/***
|
|
52
51
|
* Builds one normalized call signature from a callable declaration.
|
|
53
52
|
*/
|
|
54
|
-
function getSignature(declaration,
|
|
55
|
-
const normalizedParameters = declaration.getParameters().map((parameter) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
description: parameterDescription ? parameterDescription.trim() : null,
|
|
62
|
-
};
|
|
63
|
-
});
|
|
53
|
+
function getSignature(declaration, root) {
|
|
54
|
+
const normalizedParameters = declaration.getParameters().map((parameter) => ({
|
|
55
|
+
name: parameter.getName(),
|
|
56
|
+
type: normalizeTypeText(parameter.getType().getText(parameter), root),
|
|
57
|
+
required: !parameter.isOptional(),
|
|
58
|
+
description: null,
|
|
59
|
+
}));
|
|
64
60
|
const returnType = normalizeTypeText(declaration.getReturnType().getText(declaration), root);
|
|
65
61
|
const parameterLabel = normalizedParameters
|
|
66
62
|
.map((parameter) => `${parameter.name}${parameter.required ? '' : '?'}: ${parameter.type}`)
|
|
@@ -69,7 +65,7 @@ function getSignature(declaration, params, returns, root) {
|
|
|
69
65
|
label: `(${parameterLabel})${returnType === 'void' ? '' : ` => ${returnType}`}`,
|
|
70
66
|
parameters: normalizedParameters,
|
|
71
67
|
returnType,
|
|
72
|
-
returnDescription:
|
|
68
|
+
returnDescription: null,
|
|
73
69
|
};
|
|
74
70
|
}
|
|
75
71
|
/***
|
|
@@ -99,23 +95,14 @@ function getMembersFromProperties(properties, root) {
|
|
|
99
95
|
return [];
|
|
100
96
|
}
|
|
101
97
|
const rawComment = getParadoxComment(declaration);
|
|
102
|
-
const parsed = rawComment
|
|
103
|
-
? parseParadoxComment(rawComment)
|
|
104
|
-
: {
|
|
105
|
-
description: null,
|
|
106
|
-
isConfig: false,
|
|
107
|
-
isReadme: false,
|
|
108
|
-
examples: [],
|
|
109
|
-
params: {},
|
|
110
|
-
returns: null,
|
|
111
|
-
};
|
|
98
|
+
const parsed = rawComment === null ? null : parseParadoxComment(rawComment);
|
|
112
99
|
return [
|
|
113
100
|
{
|
|
114
101
|
name: property.getName(),
|
|
115
102
|
kind: isMemberMethodDeclaration(declaration) ? 'method' : 'property',
|
|
116
103
|
type: normalizeTypeText(property.getTypeAtLocation(declaration).getText(declaration), root),
|
|
117
104
|
required: !property.isOptional(),
|
|
118
|
-
description: parsed
|
|
105
|
+
description: parsed?.description ?? null,
|
|
119
106
|
},
|
|
120
107
|
];
|
|
121
108
|
});
|
|
@@ -256,22 +243,6 @@ function getCallableNode(node) {
|
|
|
256
243
|
function isMemberMethodDeclaration(node) {
|
|
257
244
|
return Node.isMethodDeclaration(node) || Node.isMethodSignature(node);
|
|
258
245
|
}
|
|
259
|
-
/***
|
|
260
|
-
* Reads Paradox comment metadata from a declaration.
|
|
261
|
-
*/
|
|
262
|
-
function readParadoxMetadata(node) {
|
|
263
|
-
const rawComment = getParadoxComment(node);
|
|
264
|
-
return rawComment
|
|
265
|
-
? parseParadoxComment(rawComment)
|
|
266
|
-
: {
|
|
267
|
-
description: null,
|
|
268
|
-
isConfig: false,
|
|
269
|
-
isReadme: false,
|
|
270
|
-
examples: [],
|
|
271
|
-
params: {},
|
|
272
|
-
returns: null,
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
246
|
/***
|
|
276
247
|
* Finds related exported symbols mentioned in signature and member type text.
|
|
277
248
|
*/
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
+
import { type ParadoxDocTagName } from '../../doc-tags/registry.js';
|
|
2
|
+
interface ParsedParadoxTag {
|
|
3
|
+
readonly name: ParadoxDocTagName;
|
|
4
|
+
readonly value: string | null;
|
|
5
|
+
}
|
|
1
6
|
/***
|
|
2
|
-
* Parsed representation of a Paradox
|
|
7
|
+
* Parsed representation of a Paradox documentation comment.
|
|
3
8
|
*/
|
|
4
9
|
export interface ParsedParadoxComment {
|
|
5
10
|
description: string | null;
|
|
6
11
|
isConfig: boolean;
|
|
7
12
|
isReadme: boolean;
|
|
8
13
|
isUsage: boolean;
|
|
9
|
-
examples: ParsedExample[];
|
|
10
|
-
params: Record<string, string>;
|
|
11
|
-
returns: string | null;
|
|
12
|
-
}
|
|
13
|
-
interface ParsedExample {
|
|
14
14
|
title: string | null;
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
see: string[];
|
|
16
|
+
security: string[];
|
|
17
|
+
tags: ParsedParadoxTag[];
|
|
18
|
+
unsupportedTags: string[];
|
|
19
|
+
hasCodeBlock: boolean;
|
|
17
20
|
}
|
|
18
21
|
/***
|
|
19
|
-
* Parses a Paradox
|
|
22
|
+
* Parses a Paradox comment into prose, supported tags, and validation evidence.
|
|
20
23
|
*/
|
|
21
24
|
export declare function parseParadoxComment(rawComment: string): ParsedParadoxComment;
|
|
22
25
|
export {};
|
|
@@ -1,97 +1,85 @@
|
|
|
1
|
-
|
|
1
|
+
import { isParadoxDocTagName } from '../../doc-tags/registry.js';
|
|
2
2
|
/***
|
|
3
|
-
* Parses a Paradox
|
|
3
|
+
* Parses a Paradox comment into prose, supported tags, and validation evidence.
|
|
4
4
|
*/
|
|
5
5
|
export function parseParadoxComment(rawComment) {
|
|
6
6
|
const lines = normalizeCommentLines(rawComment);
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const line = lines[index] ?? '';
|
|
16
|
-
const trimmed = line.trimStart();
|
|
17
|
-
if (trimmed.startsWith('@config')) {
|
|
18
|
-
isConfig = true;
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
if (trimmed.startsWith('@readme')) {
|
|
22
|
-
isReadme = true;
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
if (trimmed.startsWith(USAGE_TAG)) {
|
|
26
|
-
isUsage = true;
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
if (trimmed.startsWith('@example')) {
|
|
30
|
-
const parsed = parseExample(lines, index);
|
|
31
|
-
examples.push(parsed.example);
|
|
32
|
-
index = parsed.nextIndex;
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
if (trimmed.startsWith('@param ')) {
|
|
36
|
-
const paramBody = trimmed.slice('@param '.length).trim();
|
|
37
|
-
const [name, ...descriptionParts] = paramBody.split(/\s+/);
|
|
38
|
-
if (name) {
|
|
39
|
-
params[name] = descriptionParts.join(' ').trim();
|
|
40
|
-
}
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
if (trimmed.startsWith('@returns') || trimmed.startsWith('@return')) {
|
|
44
|
-
const returnBody = trimmed.replace(/^@returns?/, '').trim();
|
|
45
|
-
returns = returnBody.length > 0 ? returnBody : null;
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
descriptionLines.push(line);
|
|
49
|
-
}
|
|
50
|
-
const description = descriptionLines.join('\n').trim();
|
|
7
|
+
const parsedLines = lines.map(parseCommentLine);
|
|
8
|
+
const tags = parsedLines.flatMap((line) => line.tag ?? []);
|
|
9
|
+
const unsupportedTags = parsedLines.flatMap((line) => line.unsupportedTag ?? []);
|
|
10
|
+
const description = parsedLines
|
|
11
|
+
.filter((line) => line.tag === undefined && line.unsupportedTag === undefined)
|
|
12
|
+
.map((line) => line.text)
|
|
13
|
+
.join('\n')
|
|
14
|
+
.trim();
|
|
51
15
|
return {
|
|
52
16
|
description: description.length > 0 ? description : null,
|
|
53
|
-
isConfig,
|
|
54
|
-
isReadme,
|
|
55
|
-
isUsage,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
17
|
+
isConfig: hasTag(tags, 'config'),
|
|
18
|
+
isReadme: hasTag(tags, 'readme'),
|
|
19
|
+
isUsage: hasTag(tags, 'usage'),
|
|
20
|
+
title: getSingleTagValue(tags, 'title'),
|
|
21
|
+
see: getTagValues(tags, 'see'),
|
|
22
|
+
security: getTagValues(tags, 'security'),
|
|
23
|
+
tags,
|
|
24
|
+
unsupportedTags,
|
|
25
|
+
hasCodeBlock: hasCodeBlock(lines),
|
|
59
26
|
};
|
|
60
27
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
index += 1;
|
|
74
|
-
while (index < lines.length) {
|
|
75
|
-
const current = lines[index] ?? '';
|
|
76
|
-
if (current.trim() === '```')
|
|
77
|
-
break;
|
|
78
|
-
codeLines.push(current);
|
|
79
|
-
index += 1;
|
|
80
|
-
}
|
|
28
|
+
/***
|
|
29
|
+
* Parses one normalized comment line when it has explicit tag-line syntax.
|
|
30
|
+
*/
|
|
31
|
+
function parseCommentLine(text) {
|
|
32
|
+
const trimmed = text.trim();
|
|
33
|
+
const match = /^@([A-Za-z][A-Za-z0-9-]*)(?:\s+(.*))?$/.exec(trimmed);
|
|
34
|
+
if (match === null)
|
|
35
|
+
return { text };
|
|
36
|
+
const [, name] = match;
|
|
37
|
+
const value = match.slice(2).join('').trim();
|
|
38
|
+
if (!isParadoxDocTagName(name)) {
|
|
39
|
+
return { text, unsupportedTag: name };
|
|
81
40
|
}
|
|
82
41
|
return {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
42
|
+
text,
|
|
43
|
+
tag: {
|
|
44
|
+
name,
|
|
45
|
+
value: value.length > 0 ? value : null,
|
|
87
46
|
},
|
|
88
|
-
nextIndex: index,
|
|
89
47
|
};
|
|
90
48
|
}
|
|
49
|
+
/***
|
|
50
|
+
* Returns whether a parsed tag set contains the requested tag.
|
|
51
|
+
*/
|
|
52
|
+
function hasTag(tags, name) {
|
|
53
|
+
return tags.some((tag) => tag.name === name);
|
|
54
|
+
}
|
|
55
|
+
/***
|
|
56
|
+
* Returns all non-empty values for a repeatable tag.
|
|
57
|
+
*/
|
|
58
|
+
function getTagValues(tags, name) {
|
|
59
|
+
return tags.flatMap((tag) => (tag.name === name && tag.value !== null ? [tag.value] : []));
|
|
60
|
+
}
|
|
61
|
+
/***
|
|
62
|
+
* Returns the first non-empty value for a singular tag.
|
|
63
|
+
*/
|
|
64
|
+
function getSingleTagValue(tags, name) {
|
|
65
|
+
return getTagValues(tags, name)[0] ?? null;
|
|
66
|
+
}
|
|
67
|
+
/***
|
|
68
|
+
* Detects fenced or Markdown-indented code blocks while leaving inline code spans untouched.
|
|
69
|
+
*/
|
|
70
|
+
function hasCodeBlock(lines) {
|
|
71
|
+
return lines.some((line) => {
|
|
72
|
+
const trimmed = line.trimStart();
|
|
73
|
+
return trimmed.startsWith('```') || trimmed.startsWith('~~~') || /^(?: {4}|\t)\S/.test(line);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/***
|
|
77
|
+
* Removes Paradox comment syntax while preserving prose indentation for code-block validation.
|
|
78
|
+
*/
|
|
91
79
|
function normalizeCommentLines(rawComment) {
|
|
92
80
|
return rawComment
|
|
93
81
|
.replace(/^\/\*\*\*/, '')
|
|
94
82
|
.replace(/\*\/$/, '')
|
|
95
83
|
.split('\n')
|
|
96
|
-
.map((line) => line.replace(/^\s
|
|
84
|
+
.map((line) => line.replace(/^\s*\* ?/, '').replace(/\s+$/, ''));
|
|
97
85
|
}
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/***
|
|
2
|
-
*
|
|
2
|
+
* Exposes the Paradox command provider through the canonical Ankhorage CLI surface.
|
|
3
3
|
*
|
|
4
|
-
* @
|
|
4
|
+
* @title CLI
|
|
5
|
+
* @usage
|
|
5
6
|
*/
|
|
6
7
|
export { default } from '../docsSurface.js';
|
package/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/***
|
|
2
|
-
*
|
|
2
|
+
* Exposes the Paradox command provider through the canonical Ankhorage CLI surface.
|
|
3
3
|
*
|
|
4
|
-
* @
|
|
4
|
+
* @title CLI
|
|
5
|
+
* @usage
|
|
5
6
|
*/
|
|
6
7
|
export { default } from '../docsSurface.js';
|
package/dist/cli/standalone.js
CHANGED
|
@@ -23,10 +23,21 @@ async function main() {
|
|
|
23
23
|
const packageRoot = await resolvePackageRoot(config, configDir);
|
|
24
24
|
const { outputDir, outputRoot } = resolveOutputRoot(config, packageRoot);
|
|
25
25
|
const analysis = await analyze(config, { packageRoot, configFilePath });
|
|
26
|
+
assertNoDocumentationErrors(analysis.findings);
|
|
26
27
|
const model = buildModel(analysis);
|
|
27
28
|
const result = render(model, { outputDir });
|
|
28
29
|
await write(result, config, { packageRoot, outputRoot });
|
|
29
30
|
}
|
|
31
|
+
/***
|
|
32
|
+
* Refuses to write generated artifacts when canonical documentation policy contains errors.
|
|
33
|
+
*/
|
|
34
|
+
function assertNoDocumentationErrors(findings) {
|
|
35
|
+
const errors = findings.filter((finding) => finding.severity === 'error');
|
|
36
|
+
if (errors.length === 0)
|
|
37
|
+
return;
|
|
38
|
+
const details = errors.map((finding) => `- [${finding.ruleId}] ${finding.message}`).join('\n');
|
|
39
|
+
throw new Error(`Paradox documentation policy is invalid:\n${details}`);
|
|
40
|
+
}
|
|
30
41
|
main().catch((error) => {
|
|
31
42
|
console.error(error);
|
|
32
43
|
process.exit(1);
|
|
@@ -1,39 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
readonly
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
readonly
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
readonly repeatable: false;
|
|
28
|
-
readonly handler: "markUsage";
|
|
29
|
-
}];
|
|
30
|
-
export type ParadoxDocTagName = (typeof PARADOX_DOC_TAGS)[number]['name'];
|
|
31
|
-
export type ParadoxDocTagHandlerId = (typeof PARADOX_DOC_TAGS)[number]['handler'];
|
|
1
|
+
import { type DocumentationTagName, type DocumentationTagTarget, type DocumentationTagValueKind } from '@ankhorage/policy/documentation';
|
|
2
|
+
declare const HANDLERS: {
|
|
3
|
+
readonly readme: "markReadme";
|
|
4
|
+
readonly usage: "markUsage";
|
|
5
|
+
readonly config: "markConfig";
|
|
6
|
+
readonly title: "setTitle";
|
|
7
|
+
readonly see: "addSee";
|
|
8
|
+
readonly security: "addSecurity";
|
|
9
|
+
};
|
|
10
|
+
interface ParadoxDocTag {
|
|
11
|
+
name: DocumentationTagName;
|
|
12
|
+
syntax: string;
|
|
13
|
+
description: string;
|
|
14
|
+
appliesTo: readonly DocumentationTagTarget[];
|
|
15
|
+
repeatable: boolean;
|
|
16
|
+
valueKind: DocumentationTagValueKind;
|
|
17
|
+
handler: (typeof HANDLERS)[DocumentationTagName];
|
|
18
|
+
}
|
|
19
|
+
/***
|
|
20
|
+
* Supported Paradox documentation tags projected from the canonical Ankhorage documentation policy.
|
|
21
|
+
*
|
|
22
|
+
* @readme
|
|
23
|
+
*/
|
|
24
|
+
export declare const PARADOX_DOC_TAGS: readonly ParadoxDocTag[];
|
|
25
|
+
export type ParadoxDocTagName = DocumentationTagName;
|
|
26
|
+
export type ParadoxDocTagHandlerId = (typeof HANDLERS)[DocumentationTagName];
|
|
32
27
|
/***
|
|
33
28
|
* Looks up documentation tag metadata by tag name.
|
|
34
29
|
*/
|
|
35
|
-
export declare function getParadoxDocTag(name: string):
|
|
30
|
+
export declare function getParadoxDocTag(name: string): ParadoxDocTag | null;
|
|
36
31
|
/***
|
|
37
32
|
* Checks whether a string is a supported Paradox documentation tag name.
|
|
38
33
|
*/
|
|
39
34
|
export declare function isParadoxDocTagName(name: string): name is ParadoxDocTagName;
|
|
35
|
+
export {};
|
|
@@ -1,46 +1,23 @@
|
|
|
1
|
+
import { DOCUMENTATION_POLICY, } from '@ankhorage/policy/documentation';
|
|
2
|
+
const HANDLERS = {
|
|
3
|
+
readme: 'markReadme',
|
|
4
|
+
usage: 'markUsage',
|
|
5
|
+
config: 'markConfig',
|
|
6
|
+
title: 'setTitle',
|
|
7
|
+
see: 'addSee',
|
|
8
|
+
security: 'addSecurity',
|
|
9
|
+
};
|
|
1
10
|
/***
|
|
2
|
-
* Supported Paradox documentation tags.
|
|
3
|
-
*
|
|
4
|
-
* Paradox supports doc tags inside triple-star documentation comments.
|
|
11
|
+
* Supported Paradox documentation tags projected from the canonical Ankhorage documentation policy.
|
|
5
12
|
*
|
|
6
13
|
* @readme
|
|
7
14
|
*/
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
description: 'Includes a documentation block or exported symbol in README output.',
|
|
15
|
-
appliesTo: ['block', 'symbol'],
|
|
16
|
-
repeatable: false,
|
|
17
|
-
handler: 'markReadme',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: 'config',
|
|
21
|
-
syntax: '@config',
|
|
22
|
-
description: 'Marks a configuration type, interface, or source block. Pair with @readme to include the schema or actual config source in README Configuration output.',
|
|
23
|
-
appliesTo: ['block', 'interface', 'type'],
|
|
24
|
-
repeatable: false,
|
|
25
|
-
handler: 'markConfig',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: 'example',
|
|
29
|
-
syntax: '@example',
|
|
30
|
-
description: 'Adds a titled fenced code example to the generated documentation for a symbol.',
|
|
31
|
-
appliesTo: ['symbol'],
|
|
32
|
-
repeatable: true,
|
|
33
|
-
handler: 'parseExample',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: 'usage',
|
|
37
|
-
syntax: USAGE_DOC_TAG,
|
|
38
|
-
description: 'Promotes a real source example into the generated README Usage section.',
|
|
39
|
-
appliesTo: ['block', 'symbol'],
|
|
40
|
-
repeatable: false,
|
|
41
|
-
handler: 'markUsage',
|
|
42
|
-
},
|
|
43
|
-
];
|
|
15
|
+
export const PARADOX_DOC_TAGS = DOCUMENTATION_POLICY.tags.map((tag) => ({
|
|
16
|
+
...tag,
|
|
17
|
+
syntax: `@${tag.name}`,
|
|
18
|
+
description: describeTag(tag.name),
|
|
19
|
+
handler: HANDLERS[tag.name],
|
|
20
|
+
}));
|
|
44
21
|
/***
|
|
45
22
|
* Looks up documentation tag metadata by tag name.
|
|
46
23
|
*/
|
|
@@ -53,3 +30,22 @@ export function getParadoxDocTag(name) {
|
|
|
53
30
|
export function isParadoxDocTagName(name) {
|
|
54
31
|
return getParadoxDocTag(name) !== null;
|
|
55
32
|
}
|
|
33
|
+
/***
|
|
34
|
+
* Describes the rendering meaning of one policy-owned documentation tag.
|
|
35
|
+
*/
|
|
36
|
+
function describeTag(name) {
|
|
37
|
+
switch (name) {
|
|
38
|
+
case 'readme':
|
|
39
|
+
return 'Promotes the documented item into generated README output.';
|
|
40
|
+
case 'usage':
|
|
41
|
+
return 'Marks real source as package usage documentation.';
|
|
42
|
+
case 'config':
|
|
43
|
+
return 'Marks the canonical package configuration schema root.';
|
|
44
|
+
case 'title':
|
|
45
|
+
return 'Provides an explicit presentation title for a documented item.';
|
|
46
|
+
case 'see':
|
|
47
|
+
return 'Adds a validated external documentation reference.';
|
|
48
|
+
case 'security':
|
|
49
|
+
return 'Links security-sensitive behavior to an exact colocated executable test.';
|
|
50
|
+
}
|
|
51
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { defineParadoxConfig } from './config/defineParadoxConfig.js';
|
|
2
|
-
export type { ParadoxConfig } from './config/types.js';
|
|
3
2
|
export type { ParadoxDocTagHandlerId, ParadoxDocTagName } from './doc-tags/registry.js';
|
|
4
3
|
export { getParadoxDocTag, isParadoxDocTagName, PARADOX_DOC_TAGS } from './doc-tags/registry.js';
|
|
5
4
|
export { packageMetadata as paradoxPackageMetadata } from './packageMetadata.js';
|
|
5
|
+
export type { ParadoxConfig } from './types/config.js';
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import type { DocumentationModel, ExportKind } from './types.js';
|
|
2
|
-
interface ExampleInput {
|
|
3
|
-
title: string | null;
|
|
4
|
-
language: string | null;
|
|
5
|
-
code: string;
|
|
6
|
-
}
|
|
7
2
|
interface ExportMemberInput {
|
|
8
3
|
name: string;
|
|
9
4
|
kind: 'property' | 'method';
|
|
@@ -39,9 +34,11 @@ interface BuildModelInput {
|
|
|
39
34
|
}[];
|
|
40
35
|
exports: {
|
|
41
36
|
name: string;
|
|
37
|
+
title: string | null;
|
|
42
38
|
description: string | null;
|
|
43
39
|
isReadme: boolean;
|
|
44
|
-
|
|
40
|
+
see: string[];
|
|
41
|
+
security: string[];
|
|
45
42
|
kind: ExportKind;
|
|
46
43
|
modulePath: string;
|
|
47
44
|
sourceLocation: {
|
|
@@ -71,7 +68,8 @@ interface BuildModelInput {
|
|
|
71
68
|
name: string;
|
|
72
69
|
description: string | null;
|
|
73
70
|
isReadme: boolean;
|
|
74
|
-
|
|
71
|
+
see: string[];
|
|
72
|
+
security: string[];
|
|
75
73
|
modulePath: string;
|
|
76
74
|
sourceLocation: {
|
|
77
75
|
filePath: string;
|
|
@@ -90,6 +88,8 @@ interface BuildModelInput {
|
|
|
90
88
|
sourceFunctions: {
|
|
91
89
|
name: string;
|
|
92
90
|
description: string | null;
|
|
91
|
+
see: string[];
|
|
92
|
+
security: string[];
|
|
93
93
|
sourceLocation: {
|
|
94
94
|
filePath: string;
|
|
95
95
|
line: number;
|
|
@@ -106,32 +106,39 @@ interface BuildModelInput {
|
|
|
106
106
|
}[];
|
|
107
107
|
usage: {
|
|
108
108
|
packageName: string;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
} | null;
|
|
114
|
-
readmeUsageDescription: string | null;
|
|
115
|
-
readmeUsage: {
|
|
109
|
+
command: string;
|
|
110
|
+
};
|
|
111
|
+
usageEntries: {
|
|
112
|
+
area: 'cli' | 'examples';
|
|
116
113
|
title: string | null;
|
|
117
114
|
description: string | null;
|
|
118
115
|
language: string;
|
|
119
116
|
code: string;
|
|
120
117
|
sourcePath: string;
|
|
118
|
+
isReadme: boolean;
|
|
119
|
+
see: string[];
|
|
120
|
+
security: string[];
|
|
121
|
+
}[];
|
|
122
|
+
exampleCount: number;
|
|
123
|
+
findings: {
|
|
124
|
+
ruleId: string;
|
|
125
|
+
severity: 'warning' | 'error';
|
|
126
|
+
message: string;
|
|
127
|
+
sourcePath: string | null;
|
|
128
|
+
line: number | null;
|
|
121
129
|
}[];
|
|
122
|
-
readmeCli: {
|
|
123
|
-
description: string | null;
|
|
124
|
-
sourcePath: string;
|
|
125
|
-
} | null;
|
|
126
130
|
readmeConfig: {
|
|
127
|
-
description: string | null;
|
|
128
131
|
language: string;
|
|
129
132
|
code: string;
|
|
130
133
|
sourcePath: string;
|
|
131
134
|
} | null;
|
|
132
135
|
config: {
|
|
133
136
|
exportName: string;
|
|
137
|
+
title: string | null;
|
|
138
|
+
description: string | null;
|
|
134
139
|
isReadme: boolean;
|
|
140
|
+
see: string[];
|
|
141
|
+
security: string[];
|
|
135
142
|
members: ConfigMemberInput[];
|
|
136
143
|
} | null;
|
|
137
144
|
entrypoints: string[];
|