Skip to content

Commit e56805f

Browse files
committed
Address CodeRabbit suggestions and apply other minor fixes
1 parent 2f9d7c7 commit e56805f

18 files changed

Lines changed: 187 additions & 334 deletions

.github/copilot/tasktracker-commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This document helps GitHub Copilot understand TaskTracker commands and functiona
2323
## Task Fields
2424

2525
Update these fields with the `update` command:
26-
- status: The task status (e.g., todo, in_progress, done, blocked)
26+
- status: The task status. Valid statuses are: todo, in-progress, done, blocked.
2727
- category: The type of task (e.g., feature, bugfix, refactor, docs, test, chore)
2828
- title: The task title
2929
- description: The task description

.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ Thumbs.db
109109
logs
110110
*.log
111111

112-
# Runtime data
113-
pids
114-
*.pid
115-
*.seed
116-
117112
# Temporary files
118113
tmp/
119114
temp/

README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![npm version](https://badge.fury.io/js/tasktracker-cli.svg)](https://badge.fury.io/js/tasktracker-cli)
44
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5-
[![Node.js CI](https://github.com/tasktracker-cli/tasktracker/workflows/Node.js%20CI/badge.svg)](https://github.com/tasktracker-cli/tasktracker/actions)
5+
[![Node.js CI](https://github.com/DVC2/task_tracker/actions/workflows/test.yml/badge.svg)](https://github.com/DVC2/task_tracker/actions/workflows/test.yml)
66

77
**Your development memory across AI sessions.**
88

@@ -223,13 +223,6 @@ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) f
223223
3. Make your changes with tests
224224
4. Submit a pull request
225225

226-
## 📊 **Project Stats**
227-
228-
- 🧪 **28 tests** - All passing
229-
- 🎯 **Zero lint issues** - Clean codebase
230-
- 📦 **Lightweight** - Minimal dependencies
231-
- 🚀 **Fast** - Optimized for developer workflow
232-
233226
## 🐛 **Issues & Support**
234227

235228
- **Bug Reports**: [GitHub Issues](https://github.com/tasktracker-cli/tasktracker/issues)

bin/tt.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ _tasktracker_completions()
1212
local commands="init add quick list view update delete help context link unlink files-for-task ai ls status attach detach"
1313

1414
# Task statuses for filtering
15-
local statuses="todo in_progress done blocked" // Assuming 'review' was removed/optional
15+
local statuses="todo in_progress done blocked"
1616

1717
# Task categories (Example - might need update based on actual usage)
1818
local categories="feature bug docs test refactor chore"

eslint_output.txt

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

lib/commands/journal.js

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
const fs = require('fs');
99
const path = require('path');
1010
const { output } = require('../core/formatting');
11+
const { getCurrentSession, saveJournalEntry, loadJournalEntries } = require('../utils/journal-utils');
1112

1213
/**
1314
* Initialize paths required by the journal command
@@ -321,47 +322,6 @@ function displayEntries(entries, options) {
321322
});
322323
}
323324

324-
/**
325-
* Save a journal entry to storage
326-
*/
327-
function saveJournalEntry(entry) {
328-
const journalDir = path.join(process.cwd(), '.tasktracker', 'journal');
329-
if (!fs.existsSync(journalDir)) {
330-
fs.mkdirSync(journalDir, { recursive: true });
331-
}
332-
333-
const journalFile = path.join(journalDir, 'entries.json');
334-
let entries = [];
335-
336-
if (fs.existsSync(journalFile)) {
337-
try {
338-
entries = JSON.parse(fs.readFileSync(journalFile, 'utf8'));
339-
} catch (e) {
340-
entries = [];
341-
}
342-
}
343-
344-
entries.push(entry);
345-
fs.writeFileSync(journalFile, JSON.stringify(entries, null, 2));
346-
}
347-
348-
/**
349-
* Load all journal entries
350-
*/
351-
function loadJournalEntries() {
352-
const journalFile = path.join(process.cwd(), '.tasktracker', 'journal', 'entries.json');
353-
354-
if (!fs.existsSync(journalFile)) {
355-
return [];
356-
}
357-
358-
try {
359-
return JSON.parse(fs.readFileSync(journalFile, 'utf8'));
360-
} catch (e) {
361-
return [];
362-
}
363-
}
364-
365325
/**
366326
* Build context summary for AI assistants
367327
*/
@@ -441,15 +401,6 @@ function buildContextSummary(entries, options) {
441401
return context;
442402
}
443403

444-
/**
445-
* Get current session identifier
446-
*/
447-
function getCurrentSession() {
448-
// Simple session based on day + hour
449-
const now = new Date();
450-
return `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()}-${now.getHours()}`;
451-
}
452-
453404
/**
454405
* Get emoji for entry type
455406
*/
@@ -469,8 +420,9 @@ function getTypeEmoji(type) {
469420
module.exports = {
470421
initPaths,
471422
addEntry,
423+
searchEntries,
472424
generateContext,
473425
showEntries,
474-
searchEntries,
475-
exportEntries
426+
exportEntries,
427+
// Potentially other exported functions if they exist
476428
};

lib/commands/prd.js

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
const fs = require('fs');
99
const path = require('path');
1010
const { output } = require('../core/formatting');
11+
const { loadJournalEntries, saveJournalEntry, getCurrentSession } = require('../utils/journal-utils');
1112

1213
/**
1314
* Initialize paths required by the PRD command
@@ -452,9 +453,11 @@ function buildPRDContext(prd) {
452453
* Generate initial journal entries from PRD
453454
*/
454455
function generateJournalFromPRD(prd) {
456+
const baseTimestamp = Date.now(); // Capture base timestamp
457+
455458
// Add PRD context entry
456459
const contextEntry = {
457-
id: Date.now(),
460+
id: baseTimestamp, // Use base
458461
timestamp: new Date().toISOString(),
459462
type: 'context',
460463
content: `Project initialized: ${prd.title}. Goals: ${prd.goals.length}, Features: ${prd.features.length}, Requirements: ${prd.requirements.length}`,
@@ -464,57 +467,29 @@ function generateJournalFromPRD(prd) {
464467
};
465468

466469
// Add goal entries
470+
const goalEntries = [];
467471
prd.goals.forEach((goal, i) => {
468472
const goalEntry = {
469-
id: Date.now() + i + 1,
473+
id: baseTimestamp + 1000 + i, // Offset significantly to avoid collision with contextEntry and other goal entries
470474
timestamp: new Date().toISOString(),
471475
type: 'idea',
472476
content: `Project Goal: ${goal}`,
473477
tags: ['prd', 'goal'],
474478
files: [],
475479
session: getCurrentSession()
476480
};
477-
saveJournalEntry(goalEntry);
481+
goalEntries.push(goalEntry); // Collect goal entries before saving
478482
});
479483

484+
// Save entries - goals first, then context. Order can be debated but this is fine.
485+
goalEntries.forEach(entry => saveJournalEntry(entry));
480486
saveJournalEntry(contextEntry);
481487
}
482488

483-
/**
484-
* Get current session identifier
485-
*/
486-
function getCurrentSession() {
487-
const now = new Date();
488-
return `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()}-${now.getHours()}`;
489-
}
490-
491-
/**
492-
* Save a journal entry (helper function)
493-
*/
494-
function saveJournalEntry(entry) {
495-
const journalDir = path.join(process.cwd(), '.tasktracker', 'journal');
496-
if (!fs.existsSync(journalDir)) {
497-
fs.mkdirSync(journalDir, { recursive: true });
498-
}
499-
500-
const journalFile = path.join(journalDir, 'entries.json');
501-
let entries = [];
502-
503-
if (fs.existsSync(journalFile)) {
504-
try {
505-
entries = JSON.parse(fs.readFileSync(journalFile, 'utf8'));
506-
} catch (e) {
507-
entries = [];
508-
}
509-
}
510-
511-
entries.push(entry);
512-
fs.writeFileSync(journalFile, JSON.stringify(entries, null, 2));
513-
}
514-
515489
module.exports = {
516490
initPaths,
517491
parsePRD,
518492
showPRD,
519-
generatePRDContext
493+
generatePRDContext,
494+
loadPRD
520495
};

0 commit comments

Comments
 (0)