diff --git a/CHECKLIST.md b/CHECKLIST.md index e7aa096..143f36d 100644 --- a/CHECKLIST.md +++ b/CHECKLIST.md @@ -4,6 +4,7 @@ - [x] Configure `build.gradle.kts` with dependencies - [x] Set up testing framework + # Core - [x] Create `Repository.kt` class @@ -14,6 +15,7 @@ - [x] Implement `Timeline.kt` for version tracking - [x] Add `RepoMetadata` and configuration + # File Operations - [x] Implement markdown file scanning @@ -23,8 +25,10 @@ - [x] Add file timestamp tracking - [ ] Create backup and restore mechanisms + # Core Commands + ## Init Command - [x] `notevc init` - Initialize repository @@ -32,6 +36,7 @@ - [x] Generate initial metadata file - [x] Handle existing repository detection + ## Status Command - [x] `notevc status` - Show file changes @@ -39,6 +44,7 @@ - [x] Display added/modified/deleted files - [x] Show clean working directory message + ## Commit command - [x] `notevc commit "message"` - Create snapshot @@ -47,6 +53,7 @@ - [x] Create snapshot with metadata - [x] Update repository head pointer + ## Log Command - [ ] `notevc log` - Show commit history @@ -54,8 +61,10 @@ - [ ] Show commit hashes, messages, and timestamps - [ ] add `--since` time filtering option + # Advanced Commands + ## Diff Command - [ ] `notevc diff` - Show current changes @@ -63,6 +72,7 @@ - [ ] `notevc diff ` - Compare with specific commit - [ ] Implement basic text diffing algorithm + ## Restore Command - [ ] `notevc restore ` - Restore entire state @@ -70,12 +80,14 @@ - [ ] Add conformation prompts for destructive operations - [ ] Handle file conflicts gracefully + ## Show Command - [ ] `notevc show ` - Display commit changes - [ ] Show commit metadata and file changes - [ ] Display file contents at specific commit + # Utilities and Polish - [ ] Add colored output for better UX @@ -85,6 +97,7 @@ - [ ] Add version information (`notevc --version`) - [ ] Implement configuration file support + # Testing - [ ] Write unit tests for `ObjectStore` @@ -94,6 +107,7 @@ - [ ] Add edge case testing (empty repos, corrupted data) - [ ] Performance testing with large note collections + # Build and Distribution - [ ] Create fat JAR for distribution @@ -102,6 +116,7 @@ - [ ] Create installation scripts - [ ] Add build automation (GitHub Actions) + # Future Features - [ ] Compression for stored content @@ -112,3 +127,4 @@ - [ ] Export/import functionality - [ ] NeoVim Plugin + diff --git a/README.md b/README.md index 4de86eb..67afc6a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # ![logo.png](./images/png/Color40X50.png) NoteVC: Version Control for Markdown + + # Repository management Initialize notevc repo: @@ -23,6 +25,7 @@ Show commit history: notevc log [--since=time] ``` + # Viewing changes Show changes since last commit: @@ -40,6 +43,8 @@ Show specific commit: notevc show ``` + + # Restoration Restore to specific version: @@ -57,6 +62,8 @@ Restore entire repo state: notevc checkout ``` + + # Utilities Remove old snapshots: @@ -73,3 +80,5 @@ Show/set configuration: ```bash notevc config ``` + + diff --git a/src/main/kotlin/io/notevc/core/BlockParser.kt b/src/main/kotlin/io/notevc/core/BlockParser.kt index 87a7343..15c8077 100644 --- a/src/main/kotlin/io/notevc/core/BlockParser.kt +++ b/src/main/kotlin/io/notevc/core/BlockParser.kt @@ -113,10 +113,12 @@ class BlockParser { } // Add blocks in order - parsedFile.blocks.sortedBy { it.order }.forEach { block -> - result.appendLine(block.content) - if (block != parsedFile.blocks.last()) { - result.appendLine() + val sortedBlocks = parsedFile.blocks.sortedBy { it.order } + sortedBlocks.forEachIndexed { index, block -> + result.append(block.content) + // Add separator between blocks (not after last block) + if (index < sortedBlocks.size - 1) { + result.append("\n") } } diff --git a/src/main/kotlin/io/notevc/core/BlockStore.kt b/src/main/kotlin/io/notevc/core/BlockStore.kt index 60e7579..02354dc 100644 --- a/src/main/kotlin/io/notevc/core/BlockStore.kt +++ b/src/main/kotlin/io/notevc/core/BlockStore.kt @@ -169,8 +169,8 @@ class BlockStore( val snapshot = json.decodeFromString(content) val snapshotTime = Instant.parse(snapshot.timestamp) - // Only include snapshots before the given timestamp - if (snapshotTime.isBefore(timestamp)) { + // Only include snapshots before or at the given timestamp + if (!snapshotTime.isAfter(timestamp)) { snapshots.add(snapshot to snapshotTime) } } catch (e: Exception) {