Cursor rule
.cursor/rules/dependencies.mdcGuidelines for managing task dependencies and relationships
Cursor rules
Quality
66/100
Scores the file, not the repository.Length
928 words
7 headings · 11 code blocksRepository
192
— · pushed 309 days agoLast changed
3 days ago
First indexed 3 days ago.1234567# Dependency Management Guidelines89## Dependency Structure Principles1011- **Dependency References**:12 - ✅ DO: Represent task dependencies as arrays of task IDs13 - ✅ DO: Use numeric IDs for direct task references14 - ✅ DO: Use string IDs with dot notation (e.g., "1.2") for subtask references15 - ❌ DON'T: Mix reference types without proper conversion1617```javascript18 // ✅ DO: Use consistent dependency formats19 // For main tasks20 task.dependencies = [1, 2, 3]; // Dependencies on other main tasks2122 // For subtasks23 subtask.dependencies = [1, "3.2"]; // Dependency on main task 1 and subtask 2 of task 324```2526- **Subtask Dependencies**:27 - ✅ DO: Allow numeric subtask IDs to reference other subtasks within the same parent28 - ✅ DO: Convert between formats appropriately when needed29 - ❌ DON'T: Create circular dependencies between subtasks3031```javascript32 // ✅ DO: Properly normalize subtask dependencies33 // When a subtask refers to another subtask in the same parent34 if (typeof depId === 'number' && depId < 100) {35 // It's likely a reference to another subtask in the same parent task36 const fullSubtaskId = `${parentId}.${depId}`;37 // Now use fullSubtaskId for validation38 }39```4041## Dependency Validation4243- **Existence Checking**:44 - ✅ DO: Validate that referenced tasks exist before adding dependencies45 - ✅ DO: Provide clear error messages for non-existent dependencies46 - ✅ DO: Remove references to non-existent tasks during validation4748```javascript49 // ✅ DO: Check if the dependency exists before adding50 if (!taskExists(data.tasks, formattedDependencyId)) {51 log('error', `Dependency target ${formattedDependencyId} does not exist in tasks.json`);52 process.exit(1);53 }54```5556- **Circular Dependency Prevention**:57 - ✅ DO: Check for circular dependencies before adding new relationships58 - ✅ DO: Use graph traversal algorithms (DFS) to detect cycles59 - ✅ DO: Provide clear error messages explaining the circular chain6061```javascript62 // ✅ DO: Check for circular dependencies before adding63 const dependencyChain = [formattedTaskId];64 if (isCircularDependency(data.tasks, formattedDependencyId, dependencyChain)) {65 log('error', `Cannot add dependency ${formattedDependencyId} to task ${formattedTaskId} as it would create a circular dependency.`);66 process.exit(1);67 }68```6970- **Self-Dependency Prevention**:71 - ✅ DO: Prevent tasks from depending on themselves72 - ✅ DO: Handle both direct and indirect self-dependencies7374```javascript75 // ✅ DO: Prevent self-dependencies76 if (String(formattedTaskId) === String(formattedDependencyId)) {77 log('error', `Task ${formattedTaskId} cannot depend on itself.`);78 process.exit(1);79 }80```8182## Dependency Modification8384- **Adding Dependencies**:85 - ✅ DO: Format task and dependency IDs consistently86 - ✅ DO: Check for existing dependencies to prevent duplicates87 - ✅ DO: Sort dependencies for better readability8889```javascript90 // ✅ DO: Format IDs consistently when adding dependencies91 const formattedTaskId = typeof taskId === 'string' && taskId.includes('.')92 ? taskId : parseInt(taskId, 10);9394 const formattedDependencyId = formatTaskId(dependencyId);95```9697- **Removing Dependencies**:98 - ✅ DO: Check if the dependency exists before removing99 - ✅ DO: Handle different ID formats consistently100 - ✅ DO: Provide feedback about the removal result101102```javascript103 // ✅ DO: Properly handle dependency removal104 const dependencyIndex = targetTask.dependencies.findIndex(dep => {105 // Convert both to strings for comparison106 let depStr = String(dep);107108 // Handle relative subtask references109 if (typeof dep === 'number' && dep < 100 && isSubtask) {110 const [parentId] = formattedTaskId.split('.');111 depStr = `${parentId}.${dep}`;112 }113114 return depStr === normalizedDependencyId;115 });116117 if (dependencyIndex === -1) {118 log('info', `Task ${formattedTaskId} does not depend on ${formattedDependencyId}, no changes made.`);119 return;120 }121122 // Remove the dependency123 targetTask.dependencies.splice(dependencyIndex, 1);124```125126## Dependency Cleanup127128- **Duplicate Removal**:129 - ✅ DO: Use Set objects to identify and remove duplicates130 - ✅ DO: Handle both numeric and string ID formats131132```javascript133 // ✅ DO: Remove duplicate dependencies134 const uniqueDeps = new Set();135 const uniqueDependencies = task.dependencies.filter(depId => {136 // Convert to string for comparison to handle both numeric and string IDs137 const depIdStr = String(depId);138 if (uniqueDeps.has(depIdStr)) {139 log('warn', `Removing duplicate dependency from task ${task.id}: ${depId}`);140 return false;141 }142 uniqueDeps.add(depIdStr);143 return true;144 });145```146147- **Invalid Reference Cleanup**:148 - ✅ DO: Check for and remove references to non-existent tasks149 - ✅ DO: Check for and remove self-references150 - ✅ DO: Track and report changes made during cleanup151152```javascript153 // ✅ DO: Filter invalid task dependencies154 task.dependencies = task.dependencies.filter(depId => {155 const numericId = typeof depId === 'string' ? parseInt(depId, 10) : depId;156 if (!validTaskIds.has(numericId)) {157 log('warn', `Removing invalid task dependency from task ${task.id}: ${depId} (task does not exist)`);158 return false;159 }160 return true;161 });162```163164## Dependency Visualization165166- **Status Indicators**:167 - ✅ DO: Use visual indicators to show dependency status (✅/⏱️)168 - ✅ DO: Format dependency lists consistently169170```javascript171 // ✅ DO: Format dependencies with status indicators172 function formatDependenciesWithStatus(dependencies, allTasks) {173 if (!dependencies || dependencies.length === 0) {174 return 'None';175 }176177 return dependencies.map(depId => {178 const depTask = findTaskById(allTasks, depId);179 if (!depTask) return `${depId} (Not found)`;180181 const isDone = depTask.status === 'done' || depTask.status === 'completed';182 const statusIcon = isDone ? '✅' : '⏱️';183184 return `${statusIcon} ${depId} (${depTask.status})`;185 }).join(', ');186 }187```188189## Cycle Detection190191- **Graph Traversal**:192 - ✅ DO: Use depth-first search (DFS) for cycle detection193 - ✅ DO: Track visited nodes and recursion stack194 - ✅ DO: Support both task and subtask dependencies195196```javascript197 // ✅ DO: Use proper cycle detection algorithms198 function findCycles(subtaskId, dependencyMap, visited = new Set(), recursionStack = new Set()) {199 // Mark the current node as visited and part of recursion stack200 visited.add(subtaskId);201 recursionStack.add(subtaskId);202203 const cyclesToBreak = [];204 const dependencies = dependencyMap.get(subtaskId) || [];205206 for (const depId of dependencies) {207 if (!visited.has(depId)) {208 const cycles = findCycles(depId, dependencyMap, visited, recursionStack);209 cyclesToBreak.push(...cycles);210 }211 else if (recursionStack.has(depId)) {212 // Found a cycle, add the edge to break213 cyclesToBreak.push(depId);214 }215 }216217 // Remove the node from recursion stack before returning218 recursionStack.delete(subtaskId);219220 return cyclesToBreak;221 }222```223224Refer to [`dependency-manager.js`](mdc:scripts/modules/dependency-manager.js) for implementation examples and [`new_features.mdc`](mdc:.cursor/rules/new_features.mdc) for integration guidelines.
Also in skindhu/AI-TASK-MANAGER
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| skindhu/AI-TASK-MANAGER.cursor/rules/ui.mdc · 192 | Cursor rules | ui | 62/100 | 3 days ago | |
| skindhu/AI-TASK-MANAGER.cursor/rules/architecture.mdc · 192 | Cursor rules | testarchtesting-strategy | 42/100 | 3 days ago | |
| skindhu/AI-TASK-MANAGER.cursor/rules/commands.mdc · 192 | Cursor rules | stylearch | 62/100 | 3 days ago | |
| skindhu/AI-TASK-MANAGER.cursor/rules/cursor_rules.mdc · 192 | Cursor rules | no sections | 36/100 | 3 days ago | |
| skindhu/AI-TASK-MANAGER.cursor/rules/dev_workflow.mdc · 192 | Cursor rules | setup | 52/100 | 3 days ago | |
| skindhu/AI-TASK-MANAGER.cursor/rules/new_features.mdc · 192 | Cursor rules | testtesting-strategydocs | 65/100 | 3 days ago | |
| skindhu/AI-TASK-MANAGER.cursor/rules/self_improve.mdc · 192 | Cursor rules | no sections | 36/100 | 3 days ago | |
| skindhu/AI-TASK-MANAGER.cursor/rules/tasks.mdc · 192 | Cursor rules | arch | 70/100 | 3 days ago | |
| skindhu/AI-TASK-MANAGER.cursor/rules/tests.mdc · 192 | Cursor rules | teststylearchtesting-strategy+1 | 74/100 | 3 days ago | |
| skindhu/AI-TASK-MANAGER.cursor/rules/utilities.mdc · 192 | Cursor rules | securitydocs | 54/100 | 3 days ago | |
| skindhu/AI-TASK-MANAGERassets/.windsurfrules · 192 | Windsurf rules | setup | 40/100 | 3 days ago |
Diff against .cursor/rules/ui.mdc Diff against .cursor/rules/architecture.mdc Diff against .cursor/rules/commands.mdc Diff against .cursor/rules/cursor_rules.mdc Diff against .cursor/rules/dev_workflow.mdc Diff against .cursor/rules/new_features.mdc Diff against .cursor/rules/self_improve.mdc Diff against .cursor/rules/tasks.mdc Diff against .cursor/rules/tests.mdc Diff against .cursor/rules/utilities.mdc Diff against assets/.windsurfrules
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
