chore(qol): Add instructions imports to CLAUDE.md

chore-agent-instructions
Jason Stirnaman 2025-07-10 11:25:28 -05:00
parent dd6c47ed50
commit 57cc50ef5a
2 changed files with 20 additions and 9 deletions

View File

@ -17,9 +17,19 @@ See @README.md
See @.github/copilot-instructions.md for style guidelines and
product-specific documentation paths and URLs managed in this project.
See @.github/instructions/contributing.instructions.md for contributing
information including using shortcodes and running tests.
See @.github/instructions/contributing.instructions.md for essential InfluxData
documentation contributing guidelines, such as style and
formatting, and commonly used shortcodes.
See @.github/instructions/shortcodes-reference.instructions.md for detailed
information about shortcodes used in this project.
See @.github/instructions/frontmatter-reference.instructions.md for detailed
information about frontmatter used in this project.
See @.github/instructions/influxdb3-code-placeholders.instructions.md for using
placeholders in code samples and CLI commands.
See @api-docs/README.md for information about the API reference documentation, how to
generate it, and how to contribute to it.

View File

@ -85,7 +85,7 @@ ${content}`;
execSync(`git add "${instructionsPath}"`);
console.log('✅ Added instructions file to git staging');
}
// Also add any extracted files to git
const extractedFiles = execSync(
`git status --porcelain "${instructionsDir}/*.md"`
@ -106,7 +106,8 @@ ${content}`;
function optimizeContentForContext(content) {
// Split content into sections based on agent:instruct tags
const sections = [];
const tagRegex = /<!-- agent:instruct: (essential|condense|remove|extract\s+\S+) -->/g;
const tagRegex =
/<!-- agent:instruct: (essential|condense|remove|extract\s+\S+) -->/g;
let lastIndex = 0;
let matches = [...content.matchAll(tagRegex)];
@ -254,22 +255,22 @@ function processExtractSection(content, filename) {
const header = headerMatch[1];
const sectionTitle = header.replace(/^#+\s+/, '');
// Write the section content to a separate file
const instructionsDir = path.join(process.cwd(), '.github', 'instructions');
const extractedFilePath = path.join(instructionsDir, filename);
// Add frontmatter to the extracted file
const extractedContent = `---
applyTo: "content/**/*.md, layouts/**/*.html"
---
${content}`;
fs.writeFileSync(extractedFilePath, extractedContent);
console.log(`✅ Extracted ${sectionTitle} to ${extractedFilePath}`);
// Create a placeholder that references the extracted file
return `${header}\n\n_For the complete ${sectionTitle} reference, see ${filename}._\n\n`;
}