Instruction file imported from hellhellpnick/context-graph (
.github/instructions/.cursor/rules/_bundle_p27.instructions.md). Copyright stays with the author.
When to Read
- editing or refactoring
ctxgraph--src-graph-builder-extract-imports.mdc - editing or refactoring
ctxgraph--src-graph-builder-extract-misc.mdc - editing or refactoring
ctxgraph--src-graph-builder-index.mdc - editing or refactoring
ctxgraph--src-graph-builder-llm-notes.mdc
Overview
.cursor/rules/ctxgraph--src-graph-builder-extract-imports.mdc(41 lines · 2 top-level symbols) — # When to Read.cursor/rules/ctxgraph--src-graph-builder-extract-misc.mdc(42 lines · 5 top-level symbols) — # When to Read.cursor/rules/ctxgraph--src-graph-builder-index.mdc(84 lines · 30 top-level symbols) — # When to Read.cursor/rules/ctxgraph--src-graph-builder-llm-notes.mdc(50 lines · 6 top-level symbols) — # When to Read
Graph
graph LR
Rules[Rules]
Rules --> node[""]
Signatures
// ── .cursor/rules/ctxgraph--src-graph-builder-extract-imports.mdc ──
// ── src/graph-builder/extract/imports.ts ──
export function extractImports(scan: ScanResult, sourceFiles: string[]): string[] { /* ~103 lines */ }
/** Check if a file is a barrel (re-exports only, no own logic). */
export function isBarrelFile(content: string): boolean { const lines = content.split('\n').filter(l => l.trim() && !l.trim().startsWith('//')); if (lines.length === 0) return false; const reExportLines = lines.filter(l => /^export\s+(\{.…
// ── .cursor/rules/ctxgraph--src-graph-builder-extract-misc.mdc ──
// ── src/graph-builder/extract/misc.ts ──
export function extractCliCommands(content: string): string[] { const commands: string[] = []; const lines = content.split('\n'); for (const line of lines) { // Commander: .command('build [dir]') const m = line.match(/\.command\(\s*['"](…
/** `export * from` / `export { } from` targets (barrel files). */
export function extractReExportTargets(content: string): string[] { const out: string[] = []; for (const line of content.split('\n')) { const t = line.trim(); const star = t.match(/^export\s+\*\s+from\s+['"]([^'"]+)['"]/); if (star) out.…
/** Reject auto-extracted purpose lines that are code hints, not file intent. */
export function isWeakFilePurpose(purpose: string): boolean { const t = purpose.trim(); if (t.length < 12) return true; return PURPOSE_COMMENT_SKIP.test(t); }
/** Lines before first top-level declaration (file banner only). */
export function fileHeaderSlice(content: string): string { const lines = content.split('\n'); const header: string[] = []; for (const line of lines) { const t = line.trim(); if (!t) { header.push(line); continue; } if ( /^(export\s|impor…
/** One-line purpose summary: JSDoc / file-level `//` / `#` (PHP) — not in-function comments. */
export function extractFilePurpose(content: string): string | null { /* ~45 lines */ }
// ── .cursor/rules/ctxgraph--src-graph-builder-index.mdc ──
// ── src/graph-builder/index.ts ──
/**
* Graph builder — modular layout (was monolithic graph-builder.ts).
*/
export * from './types'
export { /* prompt template (~1 lines) */ }
export { loadSystemPrompt, loadExistingGraph, styleDirective, fileReadsEnvironment } from './prompt'
export { extractExports, buildDeterministicSourceSection, shouldIncludeDeterministicSource, buildVueMermaidNodes, } from './extract/exports'
export { extractImports } from './extract/imports'
export { buildDeterministicDependencyGraph } from './extract/deps-graph'
export { extractCliCommands, extractFilePurpose } from './extract/misc'
export { isBarrelFile } from './extract/imports'
export { parseBuildPlan } from './plan/parse'
export { buildPlanningContextLight, inferDefaultsFromScan } from './plan/infer'
export { partitionInstructionChunks, humanAreaName, } from './plan/layout'
export { repairBuildPlan, repairOptionsFromConfig, resolveRepairOptions, groupPathsIntoAutoSubsystems, } from './plan/repair'
export { detectProjectStackProfile, shouldAutoFolderGrouping } from './plan/stack-profile'
export { inferFilePriority, inferSubsystemPriority, maxPriority } from './plan/priority'
export type { InstructionPriority } from './plan/priority'
export { buildDeterministicCopilotInstructions, buildDeterministicChangelog, buildDeterministicCopilotIgnore, injectDeterministicRootFiles, } from './deterministic/root'
export { appendCursorRuleFiles } from './deterministic/cursor-rules'
export { buildMetadataJson, buildContextGraphPathIndexMd, buildIndexMd, } from './deterministic/metadata'
export { buildDeterministicSubsystemFile } from './deterministic/subsystem'
export { mergeLlmProse, sanitizeMermaidBlocks, subsystemOutputLooksOk, llmContentMatchesRealExports, buildSubsystemRepairMessage, insertAfterHeading, } from './llm/validate'
export { /* prompt template (~8 lines) */ }
export { buildPlanningPassMessage } from './messages/planning'
export { buildRootPassMessage } from './messages/root'
export { /* prompt template (~1 lines) */ }
export { parseSubsystemMappings, findMissingSubsystemPaths } from './discovery'
export { estimateCost } from './cost'
export { buildGraphDeterministic } from './build/deterministic'
export { buildGraph } from './build/single'
export { buildGraphHybrid } from './build/hybrid'
export { buildGraphMultiPass } from './build/multipass'
// ── .cursor/rules/ctxgraph--src-graph-builder-llm-notes.mdc ──
// ── src/graph-builder/llm/notes.ts ──
export function insertNotesSection(md: string, notes: string, afterHeading: string): string { /* ~14 lines */ }
export function buildNotesPrompt( config: Config, kind: 'root' | 'subsystem', title: string, exportsBlock: string, snippet: string ): string { /* prompt template (~32 lines) */ }
export function buildSnippetForFiles(scan: ScanResult, sourceFiles: string[], maxChars: number): string { /* prompt template (~101 lines) */ }
export function insertExportNotesUnderSignatures(md: string, notes: string): string { if (!notes.trim()) return md; const clean = notes.trim().replace(/\r\n/g, '\n'); const section = `### Notes (LLM)\n\n${clean}\n`; return insertAfterHea…
export function extractExportNamesForNotes(scan: ScanResult, sourceFiles: string[]): string[] { /* ~114 lines */ }
export function buildExportNotesPrompt(config: Config, title: string, exportNames: string[], snippet: string): string { /* prompt template (~23 lines) */ }
// CLI commands:
// build
Dependencies
External:
- ``