Skip to content

Commit 38ea7e4

Browse files
committed
Threadlinking ignore modifications
1 parent 8470345 commit 38ea7e4

13 files changed

Lines changed: 267 additions & 176 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ dist/
44
.DS_Store
55
/.mcp.json
66
Context.md
7+
CHANGELOG.md
8+
HANDOFF-*.md
9+
*.jpg

Context.md

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

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ If you prefer to configure components individually instead of using `init`:
115115
| PostToolUse hook | Auto-tracks files you create/edit | `~/.claude/settings.json` |
116116
| MCP Server | Gives Claude direct tool access | `~/.claude/mcp.json` |
117117
| CLAUDE.md block | Teaches Claude when/how to use threadlinking | `~/.claude/CLAUDE.md` |
118+
| Ignore file | Filters noise from pending files | `~/.threadlinkingignore` |
118119

119120
All components are optional and can be skipped during init.
120121

package-lock.json

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands/init.ts

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import { readFileSync, writeFileSync, existsSync, mkdirSync, appendFileSync, cop
33
import { homedir } from 'os';
44
import { join } from 'path';
55
import { createInterface } from 'readline';
6+
import { getDefaultIgnoreContent } from '../core/ignore.js';
67

78
const CLAUDE_DIR = join(homedir(), '.claude');
89
const SETTINGS_PATH = join(CLAUDE_DIR, 'settings.json');
910
const MCP_JSON_PATH = join(CLAUDE_DIR, 'mcp.json');
1011
const CLAUDE_MD_PATH = join(CLAUDE_DIR, 'CLAUDE.md');
12+
const GLOBAL_IGNORE_PATH = join(homedir(), '.threadlinkingignore');
1113

1214
const POST_TOOL_USE_HOOK_CONFIG = {
1315
matcher: 'Edit|Write',
@@ -86,6 +88,7 @@ interface SetupStatus {
8688
sessionStartHookInstalled: boolean;
8789
mcpConfigured: boolean;
8890
claudeMdPresent: boolean;
91+
ignoreFilePresent: boolean;
8992
settingsJsonValid: boolean;
9093
mcpJsonValid: boolean;
9194
}
@@ -175,13 +178,17 @@ function checkStatus(): SetupStatus {
175178
claudeMdPresent = content.toLowerCase().includes('threadlinking');
176179
}
177180

181+
// Check ignore file
182+
const ignoreFilePresent = existsSync(GLOBAL_IGNORE_PATH);
183+
178184
return {
179185
claudeCodeDetected,
180186
claudeDirExists,
181187
postToolUseHookInstalled,
182188
sessionStartHookInstalled,
183189
mcpConfigured,
184190
claudeMdPresent,
191+
ignoreFilePresent,
185192
settingsJsonValid,
186193
mcpJsonValid,
187194
};
@@ -309,6 +316,7 @@ function printStatus(status: SetupStatus): void {
309316
console.log(` SessionStart hook: ${status.sessionStartHookInstalled ? '\u2713 Installed' : '\u2717 Not installed'}`);
310317
console.log(` MCP server: ${status.mcpConfigured ? '\u2713 Configured (mcp.json)' : '\u2717 Not configured'}`);
311318
console.log(` CLAUDE.md: ${status.claudeMdPresent ? '\u2713 Present' : '\u2717 Not present'}`);
319+
console.log(` Ignore file: ${status.ignoreFilePresent ? '\u2713 Present' : '\u2717 Not present'}`);
312320

313321
if (!status.settingsJsonValid && existsSync(SETTINGS_PATH)) {
314322
console.log(` settings.json: \u2717 Invalid JSON`);
@@ -371,7 +379,7 @@ export const initCommand = new Command('init')
371379
}
372380

373381
// Step 1: PostToolUse hook
374-
console.log('[1/4] PostToolUse hook (auto-tracks files you create)');
382+
console.log('[1/5] PostToolUse hook (auto-tracks files you create)');
375383
if (status.postToolUseHookInstalled) {
376384
console.log(' Status: Already installed');
377385
console.log(' \u2713 Skipping\n');
@@ -398,7 +406,7 @@ export const initCommand = new Command('init')
398406
}
399407

400408
// Step 2: SessionStart hook
401-
console.log('[2/4] SessionStart hook (shows context at session start)');
409+
console.log('[2/5] SessionStart hook (shows context at session start)');
402410
if (status.sessionStartHookInstalled) {
403411
console.log(' Status: Already installed');
404412
console.log(' \u2713 Skipping\n');
@@ -419,7 +427,7 @@ export const initCommand = new Command('init')
419427
}
420428

421429
// Step 3: MCP Server (uses separate mcp.json file)
422-
console.log('[3/4] MCP Server (gives Claude direct access to threadlinking tools)');
430+
console.log('[3/5] MCP Server (gives Claude direct access to threadlinking tools)');
423431
let { mcpJson, valid: mcpJsonValid } = loadMcpJson();
424432

425433
// Handle invalid mcp.json
@@ -475,7 +483,7 @@ export const initCommand = new Command('init')
475483
}
476484

477485
// Step 4: CLAUDE.md
478-
console.log('[4/4] CLAUDE.md instructions (teaches Claude when/how to use threadlinking)');
486+
console.log('[4/5] CLAUDE.md instructions (teaches Claude when/how to use threadlinking)');
479487
if (status.claudeMdPresent) {
480488
console.log(' Status: Already present');
481489
console.log(' \u2713 Skipping\n');
@@ -494,6 +502,26 @@ export const initCommand = new Command('init')
494502
}
495503
}
496504

505+
// Step 5: Ignore file
506+
console.log('[5/5] Ignore file (filters noise from pending files list)');
507+
if (status.ignoreFilePresent) {
508+
console.log(' Status: Already present');
509+
console.log(' \u2713 Skipping\n');
510+
} else {
511+
console.log(' Status: Not present');
512+
let shouldInstall = true;
513+
if (options.interactive !== false) {
514+
const answer = await ask(' Create ~/.threadlinkingignore? (Y/n) ');
515+
shouldInstall = answer !== 'n' && answer !== 'no';
516+
}
517+
if (shouldInstall) {
518+
writeFileSync(GLOBAL_IGNORE_PATH, getDefaultIgnoreContent(), 'utf-8');
519+
console.log(' \u2713 Ignore file created\n');
520+
} else {
521+
console.log(' Skipped\n');
522+
}
523+
}
524+
497525
// Done
498526
console.log('Done! Threadlinking is fully configured.\n');
499527
console.log('Start a new Claude Code session to begin.');

src/commands/prune.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Command } from 'commander';
2+
import { pruneIgnored } from '../core/index.js';
3+
4+
export const pruneCommand = new Command('prune')
5+
.description('Remove ignored files from the pending list')
6+
.option('--verbose', 'Show each removed file')
7+
.action((options) => {
8+
const result = pruneIgnored();
9+
10+
if (!result.success) {
11+
console.error(`Error: ${result.message}`);
12+
process.exitCode = 1;
13+
return;
14+
}
15+
16+
console.log(result.message);
17+
18+
if (options.verbose && result.data && result.data.removed.length > 0) {
19+
console.log('\nRemoved:');
20+
for (const path of result.data.removed) {
21+
console.log(` - ${path}`);
22+
}
23+
}
24+
25+
if (result.data && result.data.remaining > 0) {
26+
console.log(`\n${result.data.remaining} file${result.data.remaining > 1 ? 's' : ''} remaining in pending list.`);
27+
}
28+
});

src/commands/reindex.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export const reindexCommand = new Command('reindex')
3535
}
3636
process.exit(1);
3737
} finally {
38-
// Clean up Python process
3938
cleanup();
4039
}
4140
});

src/core/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export {
2828
truncate,
2929
parseTags,
3030
detectProjectRoot,
31+
prompt,
3132
MAX_SUMMARY_LENGTH,
3233
MAX_TAG_LENGTH,
3334
MAX_SNIPPET_LENGTH,

src/core/operations/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export { searchThreads } from './search.js';
1313
export { pruneIgnored } from './prune.js';
1414
export type { PruneResult } from './prune.js';
1515

16-
// Premium operations (license required)
1716
export { semanticSearch } from './semantic.js';
1817
export { getAnalytics } from './analytics.js';
1918
export { exportThread } from './export.js';

src/core/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export interface Thread {
1616
chat_url?: string;
1717
date_created: string;
1818
date_modified?: string;
19-
auto_generated?: boolean;
2019
}
2120

2221
export type ThreadIndex = Record<string, Thread>;

0 commit comments

Comments
 (0)