Skip to content

Commit a62b8d0

Browse files
committed
Delete references
1 parent bdf0abc commit a62b8d0

9 files changed

+65
-460
lines changed

.github/instructions/_index.instructions.md

Lines changed: 0 additions & 386 deletions
This file was deleted.

.github/instructions/blocks-development.instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,4 +819,4 @@ import { useState, useEffect, useCallback, useMemo } from '@wordpress/element';
819819

820820
---
821821

822-
**Stay updated** — consult `.github/instructions/README.md` for the latest instruction list and navigation tips.
822+
**For the latest and any additional instructions, always check all files in `.github/instructions/`.**

.github/instructions/instructions.instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,11 @@ Explain when to create a new block, when to extend an existing one, and how regi
177177
- Confirm each instruction file includes frontmatter with `description` and `applyTo`.
178178
- Check that the role declaration follows the standard pattern directly under the H1.
179179
- Ensure the recommended sections (Overview, General Rules, Detailed Guidance, Examples, Validation, References) are present.
180-
- Validate internal links after renames or new files via `.github/instructions/README.md`.
180+
- Validate internal links after renames or new files.
181181

182182
## References
183183

184184
- AGENTS.md
185185
- CONTRIBUTING.md
186186
- docs/ARCHITECTURE.md
187-
- .github/instructions/README.md
187+
- .github/instructions/_index.instructions.md

.github/instructions/patterns-and-templates.instructions.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ applyTo: "**/patterns/**/*.php"
1212
license: "GPL-3.0"
1313
domain: "wp-core"
1414
stability: "stable"
15-
references:
16-
- path: "./wpcs-php.instructions.md"
17-
description: "WordPress PHP coding standards"
18-
- path: "./wpcs-html.instructions.md"
19-
description: "WordPress HTML standards"
20-
- path: "./wpcs-accessibility.instructions.md"
21-
description: "Accessibility standards"
2215
---
2316

2417
> ⚠️ **Scope Notice**: These instructions are intended for **WordPress block plugin and theme repositories** within the `lightspeedwp` GitHub organisation. They should **not** be applied to the `lightspeedwp/.github` community health repository, as that repository does not contain WordPress code.
@@ -708,6 +701,7 @@ function myplugin_register_synced_pattern() {
708701

709702
### Related Instructions
710703

704+
- [blocks-development.instructions.md](./blocks-development.instructions.md) — Core block development
711705
- [wpcs-html.instructions.md](./wpcs-html.instructions.md) — HTML standards
712706
- [wpcs-accessibility.instructions.md](./wpcs-accessibility.instructions.md) — Accessibility standards
713707
- [wpcs-php.instructions.md](./wpcs-php.instructions.md) — PHP standards
@@ -754,5 +748,3 @@ function myplugin_register_synced_pattern() {
754748
- `page` — Full page layouts
755749

756750
---
757-
758-
**Stay updated** — refer to `.github/instructions/README.md` for navigation and new instruction releases.

.github/instructions/readme.instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ flowchart LR
7272

7373
## Reference hygiene
7474

75-
- Run `node scripts/fix-instruction-references.js` before you edit instruction metadata so only `custom-instructions.md` and `_index.instructions.md` remain in frontmatter references.
75+
- Run `node scripts/fix-instruction-references.js` before you edit instruction metadata so only `custom-instructions.md` remains in frontmatter references.
7676
- Whenever you encounter `## References` or `## See Also` sections in `.github/instructions/*.instructions.md`, avoid manually linking to other `.instructions.md` files and let the fixer reintroduce those links safely.
7777
- Include the latest `.github/reports/analysis/*-frontmatter-audit.csv` file with the PR so reviewers can confirm the reference graph stayed cycle-free.
7878

.github/instructions/reporting.instructions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ These instructions define standards for creating, storing, and managing reports
5151

5252
- docs/REPORTING.md
5353
- instructions.instructions.md
54-
- .github/instructions/README.md
5554

5655
### Analysis Reports
5756

.github/instructions/task-planner.instructions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,3 @@ Use these rules when outlining implementation plans or task lists for this repos
4545
## References
4646

4747
- instructions.instructions.md
48-
- .github/instructions/README.md

.github/instructions/task-researcher.instructions.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@ Use these steps when asked to research a feature, bug, or process. Focus on evid
4040
## Validation
4141

4242
- Validate citations by re-opening files/lines mentioned.
43-
- Check `.github/instructions/README.md` for any relevant guidance not yet referenced.
43+
- Check `_index.instructions.md` for any relevant guidance not yet referenced.
4444

4545
## References
4646

4747
- instructions.instructions.md
4848
- folder-structure.instructions.md
49-
- .github/instructions/README.md
Lines changed: 59 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,126 @@
11
#!/usr/bin/env node
2-
const fs = require( 'fs' );
3-
const path = require( 'path' );
4-
const matter = require( 'gray-matter' );
2+
const fs = require('fs');
3+
const path = require('path');
4+
const matter = require('gray-matter');
55

6-
const instructionsDir = path.resolve( __dirname, '../.github/instructions' );
6+
const instructionsDir = path.resolve(__dirname, '../.github/instructions');
77
const allowedReferences = {
8-
'_index.instructions.md': [ '../custom-instructions.md' ],
8+
// '_index.instructions.md': [ '../custom-instructions.md' ],
99
};
1010

11-
function getAllowedReferences( fileName ) {
12-
if ( allowedReferences[ fileName ] ) {
13-
return allowedReferences[ fileName ];
14-
}
15-
16-
return [ '../custom-instructions.md', './_index.instructions.md' ];
11+
function getAllowedReferences(fileName) {
12+
return ['../custom-instructions.md'];
1713
}
1814

19-
function removeSection( content, heading ) {
20-
const lines = content.split( /\r?\n/ );
21-
const headingPattern = new RegExp( `^#{1,6}\\s+${ heading }\\s*$`, 'i' );
15+
function removeSection(content, heading) {
16+
const lines = content.split(/\r?\n/);
17+
const headingPattern = new RegExp(`^#{1,6}\\s+${heading}\\s*$`, 'i');
2218
const result = [];
2319
let skipping = false;
2420

25-
for ( let i = 0; i < lines.length; i++ ) {
21+
for (let i = 0; i < lines.length; i++) {
2622
const line = lines[i];
2723
const trimmed = line.trim();
2824

29-
if ( ! skipping && headingPattern.test( trimmed ) ) {
25+
if (!skipping && headingPattern.test(trimmed)) {
3026
skipping = true;
3127
continue;
3228
}
3329

34-
if ( skipping && /^#{1,6}\s+/.test( trimmed ) ) {
30+
if (skipping && /^#{1,6}\s+/.test(trimmed)) {
3531
skipping = false;
3632
}
3733

38-
if ( skipping ) {
34+
if (skipping) {
3935
continue;
4036
}
4137

42-
result.push( line );
38+
result.push(line);
4339
}
4440

45-
return result.join( '\n' );
41+
return result.join('\n');
4642
}
4743

48-
function extractReferences( content ) {
49-
const lines = content.split( /\r?\n/ );
44+
function extractReferences(content) {
45+
const lines = content.split(/\r?\n/);
5046
const headingPattern = /^#{1,6}\s+/;
51-
const referenceIndex = lines.findIndex( ( line ) =>
52-
/^#{1,6}\s+References$/i.test( line.trim() )
47+
const referenceIndex = lines.findIndex((line) =>
48+
/^#{1,6}\s+References$/i.test(line.trim())
5349
);
5450

55-
if ( referenceIndex === -1 ) {
51+
if (referenceIndex === -1) {
5652
return { cleaned: content, references: [] };
5753
}
5854

5955
let endIndex = referenceIndex + 1;
60-
while ( endIndex < lines.length && ! headingPattern.test( lines[ endIndex ].trim() ) ) {
56+
while (
57+
endIndex < lines.length &&
58+
!headingPattern.test(lines[endIndex].trim())
59+
) {
6160
endIndex++;
6261
}
6362

6463
const entries = lines
65-
.slice( referenceIndex + 1, endIndex )
66-
.map( ( line ) => line.trim() )
67-
.filter( ( line ) => line.startsWith( '- ' ) )
68-
.map( ( line ) => line.slice( 2 ).trim() )
69-
.filter( Boolean );
64+
.slice(referenceIndex + 1, endIndex)
65+
.map((line) => line.trim())
66+
.filter((line) => line.startsWith('- '))
67+
.map((line) => line.slice(2).trim())
68+
.filter(Boolean);
7069

7170
const cleanedLines = [
72-
...lines.slice( 0, referenceIndex ),
73-
...lines.slice( endIndex ),
71+
...lines.slice(0, referenceIndex),
72+
...lines.slice(endIndex),
7473
];
7574

76-
return { cleaned: cleanedLines.join( '\n' ), references: entries };
75+
return { cleaned: cleanedLines.join('\n'), references: entries };
7776
}
7877

79-
function ensureTrailingNewline( text ) {
80-
if ( text.endsWith( '\n' ) ) {
78+
function ensureTrailingNewline(text) {
79+
if (text.endsWith('\n')) {
8180
return text;
8281
}
8382

84-
return `${ text }\n`;
83+
return `${text}\n`;
8584
}
8685

8786
(async function main() {
8887
const files = fs
89-
.readdirSync( instructionsDir )
90-
.filter( ( file ) => file.endsWith( '.instructions.md' ) )
91-
.map( ( file ) => path.join( instructionsDir, file ) );
92-
93-
for ( const filePath of files ) {
94-
const fileName = path.basename( filePath );
95-
const raw = fs.readFileSync( filePath, 'utf8' );
96-
const parsed = matter( raw );
88+
.readdirSync(instructionsDir)
89+
.filter((file) => file.endsWith('.instructions.md'))
90+
.map((file) => path.join(instructionsDir, file));
91+
92+
for (const filePath of files) {
93+
const fileName = path.basename(filePath);
94+
const raw = fs.readFileSync(filePath, 'utf8');
95+
const parsed = matter(raw);
9796
const data = parsed.data || {};
9897
const content = parsed.content;
9998

100-
data.references = getAllowedReferences( fileName );
99+
data.references = getAllowedReferences(fileName);
101100

102-
let body = removeSection( content, 'See Also' );
103-
const extracted = extractReferences( body );
101+
let body = removeSection(content, 'See Also');
102+
const extracted = extractReferences(body);
104103
body = extracted.cleaned;
105104

106-
const seeAlsoEntries = Array.from( new Set( extracted.references ) );
105+
const seeAlsoEntries = Array.from(new Set(extracted.references));
107106

108-
if ( seeAlsoEntries.length ) {
107+
if (seeAlsoEntries.length) {
109108
body = body.trimEnd() + '\n\n## See Also\n\n';
110-
body += seeAlsoEntries.map( ( entry ) => `- ${ entry }` ).join( '\n' ) + '\n';
109+
body +=
110+
seeAlsoEntries.map((entry) => `- ${entry}`).join('\n') + '\n';
111111
} else {
112-
body = ensureTrailingNewline( body.trimEnd() );
112+
body = ensureTrailingNewline(body.trimEnd());
113113
}
114114

115-
const output = matter.stringify( body, data );
116-
fs.writeFileSync( filePath, output, 'utf8' );
115+
const output = matter.stringify(body, data);
116+
fs.writeFileSync(filePath, output, 'utf8');
117117

118118
console.log(
119-
`Updated ${ fileName }: ${ seeAlsoEntries.length } See Also entr${ seeAlsoEntries.length === 1 ? 'y' : 'ies' }.`
119+
`Updated ${fileName}: ${seeAlsoEntries.length} See Also entr${seeAlsoEntries.length === 1 ? 'y' : 'ies'}.`
120120
);
121121
}
122122

123-
console.log( '\n✅ Instruction references cleaned. Run the audit if desired.' );
124-
} )();
123+
console.log(
124+
'\n✅ Instruction references cleaned. Run the audit if desired.'
125+
);
126+
})();

0 commit comments

Comments
 (0)