Skip to content

Commit 62acb44

Browse files
committed
Revert "feat: camelize llm_description"
This reverts commit 5d65c8a.
1 parent 3ec833e commit 62acb44

File tree

9 files changed

+22
-21
lines changed

9 files changed

+22
-21
lines changed

src/__tests__/metadata.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('createMetadata', () => {
7373
heading,
7474
n_api_version: undefined,
7575
introduced_in: undefined,
76-
llmDescription: undefined,
76+
llm_description: undefined,
7777
removed_in: undefined,
7878
slug: 'test-heading',
7979
source_link: 'test.com',

src/generators/llms-txt/utils/__tests__/buildApiDocLink.test.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import { describe, it } from 'node:test';
44
import { getEntryDescription, buildApiDocLink } from '../buildApiDocLink.mjs';
55

66
describe('getEntryDescription', () => {
7-
it('returns llmDescription when available', () => {
7+
it('returns llm_description when available', () => {
88
const entry = {
9-
llmDescription: 'LLM generated description',
9+
llm_description: 'LLM generated description',
1010
content: { children: [] },
1111
};
1212

1313
const result = getEntryDescription(entry);
1414
assert.equal(result, 'LLM generated description');
1515
});
1616

17-
it('extracts first paragraph when no llmDescription', () => {
17+
it('extracts first paragraph when no llm_description', () => {
1818
const entry = {
1919
content: {
2020
children: [
@@ -66,7 +66,7 @@ describe('buildApiDocLink', () => {
6666
const entry = {
6767
heading: { data: { name: 'Test API' } },
6868
api_doc_source: 'doc/api/test.md',
69-
llmDescription: 'Test description',
69+
llm_description: 'Test description',
7070
};
7171

7272
const result = buildApiDocLink(entry);

src/generators/llms-txt/utils/buildApiDocLink.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import { transformNodeToString } from '../../../utils/unist.mjs';
33

44
/**
55
* Retrieves the description of a given API doc entry. It first checks whether
6-
* the entry has a llmDescription property. If not, it extracts the first
6+
* the entry has a llm_description property. If not, it extracts the first
77
* paragraph from the entry's content.
88
*
99
* @param {ApiDocMetadataEntry} entry
1010
* @returns {string}
1111
*/
1212
export const getEntryDescription = entry => {
13-
if (entry.llmDescription) {
14-
return entry.llmDescription.trim();
13+
if (entry.llm_description) {
14+
return entry.llm_description.trim();
1515
}
1616

1717
const descriptionNode = entry.content.children.find(

src/linter/constants.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
export const INTRODUCED_IN_REGEX = /<!--\s?introduced_in=.*-->/;
44

5-
export const LLM_DESCRIPTION_REGEX = /<!--\s?llmDescription:.*-->/;
5+
export const LLM_DESCRIPTION_REGEX = /<!--\s?llm_description=.*-->/;
66

77
export const LINT_MESSAGES = {
88
missingIntroducedIn: "Missing 'introduced_in' field in the API doc entry",
@@ -11,5 +11,5 @@ export const LINT_MESSAGES = {
1111
invalidChangeVersion: 'Invalid version number: {{version}}',
1212
duplicateStabilityNode: 'Duplicate stability node',
1313
missingLlmDescription:
14-
'Missing llmDescription field or paragraph node in the API doc entry',
14+
'Missing llm_description field or paragraph node in the API doc entry',
1515
};

src/linter/rules/__tests__/missing-metadata.test.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ describe('missingMetadata', () => {
88
it('should not report when both fields are present', () => {
99
const context = createContext([
1010
{ type: 'html', value: '<!--introduced_in=12.0.0-->' },
11-
{ type: 'html', value: '<!--llmDescription:desc-->' },
11+
{ type: 'html', value: '<!--llm_description=desc-->' },
1212
]);
1313

1414
missingMetadata(context);
1515
strictEqual(context.report.mock.callCount(), 0);
1616
});
1717

18-
it('should report only llmDescription when introduced_in is present', () => {
18+
it('should report only llm_description when introduced_in is present', () => {
1919
const context = createContext([
2020
{ type: 'html', value: '<!--introduced_in=12.0.0-->' },
2121
]);
@@ -25,7 +25,7 @@ describe('missingMetadata', () => {
2525
strictEqual(context.report.mock.calls[0].arguments[0].level, 'warn');
2626
});
2727

28-
it('should not report llmDescription when paragraph fallback exists', () => {
28+
it('should not report llm_description when paragraph fallback exists', () => {
2929
const context = createContext([
3030
{ type: 'html', value: '<!--introduced_in=12.0.0-->' },
3131
{ type: 'paragraph', children: [{ type: 'text', value: 'desc' }] },
@@ -42,9 +42,9 @@ describe('missingMetadata', () => {
4242
strictEqual(context.report.mock.callCount(), 2);
4343
});
4444

45-
it('should report only introduced_in when llmDescription is present', () => {
45+
it('should report only introduced_in when llm_description is present', () => {
4646
const context = createContext([
47-
{ type: 'html', value: '<!--llmDescription:desc-->' },
47+
{ type: 'html', value: '<!--llm_description=desc-->' },
4848
]);
4949

5050
missingMetadata(context);

src/metadata.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const createMetadata = slugger => {
113113
updates = [],
114114
changes = [],
115115
tags = [],
116-
llmDescription,
116+
llm_description,
117117
} = internalMetadata.properties;
118118

119119
// Also add the slug to the heading data as it is used to build the heading
@@ -140,7 +140,7 @@ const createMetadata = slugger => {
140140
content: section,
141141
tags,
142142
introduced_in,
143-
llmDescription,
143+
llm_description,
144144
yaml_position: internalMetadata.yaml_position,
145145
};
146146
},

src/types.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ declare global {
6565
introduced_in?: string;
6666
napiVersion?: number;
6767
tags?: Array<string>;
68-
llmDescription?: string;
68+
llm_description?: string;
6969
}
7070

7171
export interface ApiDocMetadataEntry {
@@ -101,7 +101,7 @@ declare global {
101101
// to provide additional metadata about the API doc entry
102102
tags: Array<string>;
103103
// The llms.txt specific description
104-
llmDescription: string | undefined;
104+
llm_description: string | undefined;
105105
// The postion of the YAML of the API doc entry
106106
yaml_position: Position;
107107
}

src/utils/parser/__tests__/index.test.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('normalizeYamlSyntax', () => {
3030
source_link=lib/test.js
3131
type=module
3232
name=test_module
33-
llmDescription: This is a test module`;
33+
llm_description=This is a test module`;
3434

3535
const normalizedYaml = normalizeYamlSyntax(input);
3636

@@ -40,7 +40,7 @@ llmDescription: This is a test module`;
4040
source_link: lib/test.js
4141
type: module
4242
name: test_module
43-
llmDescription: This is a test module`
43+
llm_description: This is a test module`
4444
);
4545
});
4646

src/utils/parser/index.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const normalizeYamlSyntax = yamlContent => {
4141
.replace('source_link=', 'source_link: ')
4242
.replace('type=', 'type: ')
4343
.replace('name=', 'name: ')
44+
.replace('llm_description=', 'llm_description: ')
4445
.replace(/^[\r\n]+|[\r\n]+$/g, ''); // Remove initial and final line breaks
4546
};
4647

0 commit comments

Comments
 (0)