Commit bbce916e45
Verified · cmc
Layout: unified · split
docs/plans/2026-10-04-document-session.md +16 −16
| @@ -44,7 +44,7 @@ Per-window session objects and main-actor wiring (they belong to the app target) | ||
| 44 | 44 | **Interfaces:** |
| 45 | 45 | - Produces: `MergeConflict(base:ours:theirs:)`, `MergeResult` (`.merged`, `.conflict`), `threeWayMerge(base:ours:theirs:)`, `lineEdits(from:to:) -> [TextEdit]`; internal `textLines`, `matchingLines`. |
| 46 | 46 | |
| 47 | - [ ] **Step 1: Add the target** | |
| 47 | - [x] **Step 1: Add the target** | |
| 48 | 48 | |
| 49 | 49 | ```swift |
| 50 | 50 | // swift-tools-version: 6.2 |
| @@ -66,7 +66,7 @@ let package = Package( | ||
| 66 | 66 | ) |
| 67 | 67 | ``` |
| 68 | 68 | |
| 69 | - [ ] **Step 2: Write the failing tests** | |
| 69 | - [x] **Step 2: Write the failing tests** | |
| 70 | 70 | |
| 71 | 71 | ```swift |
| 72 | 72 | import OrgCore |
| @@ -118,12 +118,12 @@ struct MergeTests { | ||
| 118 | 118 | } |
| 119 | 119 | ``` |
| 120 | 120 | |
| 121 | - [ ] **Step 3: Run to verify failure** | |
| 121 | - [x] **Step 3: Run to verify failure** | |
| 122 | 122 | |
| 123 | 123 | Run: `swift test --filter MergeTests` |
| 124 | 124 | Expected: build failure, `cannot find 'threeWayMerge' in scope`. |
| 125 | 125 | |
| 126 | - [ ] **Step 4: Implement** | |
| 126 | - [x] **Step 4: Implement** | |
| 127 | 127 | |
| 128 | 128 | ```swift |
| 129 | 129 | import OrgCore |
| @@ -303,7 +303,7 @@ private func myers(_ a: [Int], _ b: [Int]) -> [(Int, Int)] { | ||
| 303 | 303 | } |
| 304 | 304 | ``` |
| 305 | 305 | |
| 306 | - [ ] **Step 5: Run to verify pass, then commit** | |
| 306 | - [x] **Step 5: Run to verify pass, then commit** | |
| 307 | 307 | |
| 308 | 308 | Run: `swift test --filter MergeTests` |
| 309 | 309 | |
| @@ -324,7 +324,7 @@ git commit -m "Add OrgDocument target with three-way merge" | ||
| 324 | 324 | - Consumes: `threeWayMerge`, `lineEdits` (Task 1); `OrgParser.reparse`, `SourceText`, `TextEdit`. |
| 325 | 325 | - Produces: `DocumentState(bytes:defaults:)` with `source`, `text`, `tree`, `revision`, `mergeBase`, `isDirty`, `isEditable`, `canUndo`, `canRedo`, `encodedText()`, `apply(_:baseRevision:)`, `undo()`, `redo()`, `diskChanged(to:) -> ExternalChange`, `mergeOverwritten(_:base:)`, `didWrite(_:)`; `ViewState` with `mapped(through:)`, `pruned(to:)`; internal `mapOffset`, `utf16Slice`. |
| 326 | 326 | |
| 327 | - [ ] **Step 1: Write the failing tests** | |
| 327 | - [x] **Step 1: Write the failing tests** | |
| 328 | 328 | |
| 329 | 329 | ```swift |
| 330 | 330 | import OrgCore |
| @@ -446,12 +446,12 @@ struct ViewStateTests { | ||
| 446 | 446 | } |
| 447 | 447 | ``` |
| 448 | 448 | |
| 449 | - [ ] **Step 2: Run to verify failure** | |
| 449 | - [x] **Step 2: Run to verify failure** | |
| 450 | 450 | |
| 451 | 451 | Run: `swift test --filter DocumentStateTests` |
| 452 | 452 | Expected: build failure, `cannot find 'DocumentState' in scope`. |
| 453 | 453 | |
| 454 | - [ ] **Step 3: Implement `DocumentState.swift`** | |
| 454 | - [x] **Step 3: Implement `DocumentState.swift`** | |
| 455 | 455 | |
| 456 | 456 | ```swift |
| 457 | 457 | import OrgCore |
| @@ -612,7 +612,7 @@ func utf16Slice(_ text: String, _ range: Range<Int>) -> String { | ||
| 612 | 612 | } |
| 613 | 613 | ``` |
| 614 | 614 | |
| 615 | - [ ] **Step 4: Implement `ViewState.swift`** | |
| 615 | - [x] **Step 4: Implement `ViewState.swift`** | |
| 616 | 616 | |
| 617 | 617 | ```swift |
| 618 | 618 | import OrgCore |
| @@ -658,7 +658,7 @@ func mapOffset(_ offset: Int, _ sortedEdits: [TextEdit]) -> Int { | ||
| 658 | 658 | } |
| 659 | 659 | ``` |
| 660 | 660 | |
| 661 | - [ ] **Step 5: Run to verify pass, then commit** | |
| 661 | - [x] **Step 5: Run to verify pass, then commit** | |
| 662 | 662 | |
| 663 | 663 | Run: `swift test --filter "DocumentStateTests|ViewStateTests"` |
| 664 | 664 | |
| @@ -679,7 +679,7 @@ git commit -m "Add document state and view state" | ||
| 679 | 679 | - Consumes: `DocumentState` (Task 2). |
| 680 | 680 | - Produces: `FileSystem`, `RecoveryStore`, `SaveOutcome`, `SaveError`, `Saver(fileSystem:recovery:)` with `save(_:to:)`, `CoordinatedFileSystem`, `FileRecoveryStore(directory:limit:)` with `versions(for:)`. |
| 681 | 681 | |
| 682 | - [ ] **Step 1: Write the failing tests** | |
| 682 | - [x] **Step 1: Write the failing tests** | |
| 683 | 683 | |
| 684 | 684 | The fault-injection cases put another writer's change in place before each read and before the replace, and check that both versions survive. |
| 685 | 685 | |
| @@ -880,12 +880,12 @@ struct FileStorageTests { | ||
| 880 | 880 | } |
| 881 | 881 | ``` |
| 882 | 882 | |
| 883 | - [ ] **Step 2: Run to verify failure** | |
| 883 | - [x] **Step 2: Run to verify failure** | |
| 884 | 884 | |
| 885 | 885 | Run: `swift test --filter SaveTests` |
| 886 | 886 | Expected: build failure, `cannot find type 'FileSystem' in scope`. |
| 887 | 887 | |
| 888 | - [ ] **Step 3: Implement `Saving.swift`** | |
| 888 | - [x] **Step 3: Implement `Saving.swift`** | |
| 889 | 889 | |
| 890 | 890 | ```swift |
| 891 | 891 | import Foundation |
| @@ -971,7 +971,7 @@ public struct Saver: Sendable { | ||
| 971 | 971 | } |
| 972 | 972 | ``` |
| 973 | 973 | |
| 974 | - [ ] **Step 4: Implement `FileStorage.swift`** | |
| 974 | - [x] **Step 4: Implement `FileStorage.swift`** | |
| 975 | 975 | |
| 976 | 976 | ```swift |
| 977 | 977 | import CryptoKit |
| @@ -1068,12 +1068,12 @@ public struct FileRecoveryStore: RecoveryStore { | ||
| 1068 | 1068 | } |
| 1069 | 1069 | ``` |
| 1070 | 1070 | |
| 1071 | - [ ] **Step 5: Run everything, including the iOS build** | |
| 1071 | - [x] **Step 5: Run everything, including the iOS build** | |
| 1072 | 1072 | |
| 1073 | 1073 | Run: `swift test`, then `xcodebuild -scheme OrgDocument -destination 'generic/platform=iOS' build` |
| 1074 | 1074 | Expected: all pass; `BUILD SUCCEEDED`. |
| 1075 | 1075 | |
| 1076 | - [ ] **Step 6: Commit** | |
| 1076 | - [x] **Step 6: Commit** | |
| 1077 | 1077 | |
| 1078 | 1078 | ```bash |
| 1079 | 1079 | git add Sources/OrgDocument/Saving.swift Sources/OrgDocument/FileStorage.swift Tests/OrgDocumentTests/SaveTests.swift |
docs/plans/2026-10-04-editing-spike.md +13 −13
| @@ -39,9 +39,9 @@ Two bugs the differential test found and the plan fixes: a line split off by an | ||
| 39 | 39 | Work for the performance plan: reparse structural edits within the innermost section instead of the top-level section; a faster parser (about 3x for the open gate); style the visible region first on open and the rest after. |
| 40 | 40 | |
| 41 | 41 | Manual VoiceOver checklist (run `swift run OrgstarSpike <file>`, turn on VoiceOver): |
| 42 | - [ ] Line by line through a folded heading skips to the next visible heading. | |
| 43 | - [ ] Reading a heading with tags and a TODO keyword is understandable. | |
| 44 | - [ ] Selection announcements are correct across a fold. | |
| 42 | - [ ] Line by line through a folded heading skips to the next visible heading. — did not ship: the VoiceOver check is owed (see docs/design.md, phase 1) | |
| 43 | - [ ] Reading a heading with tags and a TODO keyword is understandable. — did not ship: the VoiceOver check is owed (see docs/design.md, phase 1) | |
| 44 | - [ ] Selection announcements are correct across a fold. — did not ship: the VoiceOver check is owed (see docs/design.md, phase 1) | |
| 45 | 45 | |
| 46 | 46 | ## File structure |
| 47 | 47 | |
| @@ -65,7 +65,7 @@ Manual VoiceOver checklist (run `swift run OrgstarSpike <file>`, turn on VoiceOv | ||
| 65 | 65 | **Interfaces:** |
| 66 | 66 | - Produces: `StyleRole`, `StyleRun`, `IndentRun`, `Presentation.styles(_:in:)`, `Presentation.indents(_:in:)`, `Presentation.hiddenRanges(_:folds:)`, `Presentation.heading(containing:in:)`, `Presentation.headings(_:)`. |
| 67 | 67 | |
| 68 | - [ ] **Step 1: Write the failing tests** | |
| 68 | - [x] **Step 1: Write the failing tests** | |
| 69 | 69 | |
| 70 | 70 | ```swift |
| 71 | 71 | import OrgCore |
| @@ -148,7 +148,7 @@ struct FoldTests { | ||
| 148 | 148 | } |
| 149 | 149 | ``` |
| 150 | 150 | |
| 151 | - [ ] **Step 2: Implement** | |
| 151 | - [x] **Step 2: Implement** | |
| 152 | 152 | |
| 153 | 153 | ```swift |
| 154 | 154 | import OrgCore |
| @@ -324,7 +324,7 @@ public enum Presentation { | ||
| 324 | 324 | } |
| 325 | 325 | ``` |
| 326 | 326 | |
| 327 | - [ ] **Step 3: Run, build for iOS, commit** | |
| 327 | - [x] **Step 3: Run, build for iOS, commit** | |
| 328 | 328 | |
| 329 | 329 | Run: `swift test --filter OrgPresentationTests`, then `xcodebuild -scheme OrgPresentation -destination 'generic/platform=iOS' build`. |
| 330 | 330 | |
| @@ -346,7 +346,7 @@ git commit -m "Add platform-free presentation policy" | ||
| 346 | 346 | - Consumes: `DocumentState`, `ViewState`, `Saver`, `lineEdits` (OrgDocument); Task 1. |
| 347 | 347 | - Produces: `OrgEditor(document:frame:)` with `textView`, `document`, `view`, `onEditTiming`, `makeScrollView()`, `setFolds(_:)`, `toggleFoldAtCaret()`, `toggleAllFolds()`, `save(using:to:)`. |
| 348 | 348 | |
| 349 | - [ ] **Step 1: Make pruning cheap** | |
| 349 | - [x] **Step 1: Make pruning cheap** | |
| 350 | 350 | |
| 351 | 351 | ```diff |
| 352 | 352 | @@ -22,11 +22,22 @@ public struct ViewState: Sendable, Equatable { |
| @@ -376,7 +376,7 @@ git commit -m "Add platform-free presentation policy" | ||
| 376 | 376 | func mapOffset(_ offset: Int, _ sortedEdits: [TextEdit]) -> Int { |
| 377 | 377 | ``` |
| 378 | 378 | |
| 379 | - [ ] **Step 2: Write the failing tests** | |
| 379 | - [x] **Step 2: Write the failing tests** | |
| 380 | 380 | |
| 381 | 381 | The tests drive a real `NSTextView` in an offscreen window. `RestyleFuzzTests` compares the incrementally styled storage with a fresh editor after every random edit. |
| 382 | 382 | |
| @@ -631,7 +631,7 @@ struct RestyleFuzzTests { | ||
| 631 | 631 | } |
| 632 | 632 | ``` |
| 633 | 633 | |
| 634 | - [ ] **Step 3: Implement `Theme.swift`** | |
| 634 | - [x] **Step 3: Implement `Theme.swift`** | |
| 635 | 635 | |
| 636 | 636 | ```swift |
| 637 | 637 | #if os(macOS) |
| @@ -710,7 +710,7 @@ struct Theme { | ||
| 710 | 710 | #endif |
| 711 | 711 | ``` |
| 712 | 712 | |
| 713 | - [ ] **Step 4: Implement `OrgEditor.swift`** | |
| 713 | - [x] **Step 4: Implement `OrgEditor.swift`** | |
| 714 | 714 | |
| 715 | 715 | ```swift |
| 716 | 716 | #if os(macOS) |
| @@ -1062,7 +1062,7 @@ final class FoldedHeadingFragment: NSTextLayoutFragment, @unchecked Sendable { | ||
| 1062 | 1062 | #endif |
| 1063 | 1063 | ``` |
| 1064 | 1064 | |
| 1065 | - [ ] **Step 5: Run, including longer fuzz runs, then commit** | |
| 1065 | - [x] **Step 5: Run, including longer fuzz runs, then commit** | |
| 1066 | 1066 | |
| 1067 | 1067 | Run: `swift test`, then `ORGSTAR_RESTYLE_EDITS=1500 ORGSTAR_FUZZ_SEED=<n> swift test --filter RestyleFuzzTests` for several seeds. |
| 1068 | 1068 | |
| @@ -1079,7 +1079,7 @@ git commit -m "Add TextKit 2 editor with folding and incremental restyle" | ||
| 1079 | 1079 | - Modify: `Package.swift` (add the `OrgstarSpike` executable) |
| 1080 | 1080 | - Create: `Sources/OrgstarSpike/main.swift` |
| 1081 | 1081 | |
| 1082 | - [ ] **Step 1: Implement** | |
| 1082 | - [x] **Step 1: Implement** | |
| 1083 | 1083 | |
| 1084 | 1084 | ```swift |
| 1085 | 1085 | #if os(macOS) |
| @@ -1173,7 +1173,7 @@ app.run() | ||
| 1173 | 1173 | #endif |
| 1174 | 1174 | ``` |
| 1175 | 1175 | |
| 1176 | - [ ] **Step 2: Run by hand, measure, commit** | |
| 1176 | - [x] **Step 2: Run by hand, measure, commit** (measured; the VoiceOver checklist did not run) | |
| 1177 | 1177 | |
| 1178 | 1178 | Run: `swift run -c release OrgstarSpike <large file>`; type, fold with TAB and Shift-TAB, save with ⌘S, watch the printed p50/p95; then the VoiceOver checklist above. |
| 1179 | 1179 | |
docs/plans/2026-10-04-incremental-reparse.md +6 −6
| @@ -41,7 +41,7 @@ The spec reparses structural edits from the innermost enclosing section. This pl | ||
| 41 | 41 | - Consumes: `Parser`, `splitRawLines`, `classifyLine`, `SyntaxNode`, `GreenNode`, `randomDocument`/`fragments`/`SeededGenerator` from `RoundTripTests.swift`. |
| 42 | 42 | - Produces: `TextEdit(range:replacement:)` with `apply(to:)`; `OrgParser.reparse(_:oldText:edit:defaults:) -> OrgTree`; internal `OrgParser.reparseWithStrategy` returning `(tree, ReparseStrategy)` with `.element`, `.sections`, `.full`; `Parser(text:settings:)`; `Parser.reparseElement(_:text:settings:) -> GreenNode?`. |
| 43 | 43 | |
| 44 | - [ ] **Step 1: Write the failing tests** | |
| 44 | - [x] **Step 1: Write the failing tests** | |
| 45 | 45 | |
| 46 | 46 | ```swift |
| 47 | 47 | import Foundation |
| @@ -148,12 +148,12 @@ struct IncrementalTests { | ||
| 148 | 148 | } |
| 149 | 149 | ``` |
| 150 | 150 | |
| 151 | - [ ] **Step 2: Run to verify failure** | |
| 151 | - [x] **Step 2: Run to verify failure** | |
| 152 | 152 | |
| 153 | 153 | Run: `swift test --filter IncrementalTests` |
| 154 | 154 | Expected: build failure, `cannot find 'TextEdit' in scope`. |
| 155 | 155 | |
| 156 | - [ ] **Step 3: Let the parser take known settings** | |
| 156 | - [x] **Step 3: Let the parser take known settings** | |
| 157 | 157 | |
| 158 | 158 | ```diff |
| 159 | 159 | @@ -16,10 +16,25 @@ struct Parser { |
| @@ -188,7 +188,7 @@ Expected: build failure, `cannot find 'TextEdit' in scope`. | ||
| 188 | 188 | static func matchEnds(_ info: [ClassifiedLine]) -> [Int: Int] { |
| 189 | 189 | ``` |
| 190 | 190 | |
| 191 | - [ ] **Step 4: Implement `Incremental.swift`** | |
| 191 | - [x] **Step 4: Implement `Incremental.swift`** | |
| 192 | 192 | |
| 193 | 193 | ```swift |
| 194 | 194 | import Foundation |
| @@ -442,7 +442,7 @@ extension Parser { | ||
| 442 | 442 | } |
| 443 | 443 | ``` |
| 444 | 444 | |
| 445 | - [ ] **Step 5: Run all tests, then the gate** | |
| 445 | - [x] **Step 5: Run all tests, then the gate** | |
| 446 | 446 | |
| 447 | 447 | Run: `swift test` |
| 448 | 448 | Expected: all pass. |
| @@ -450,7 +450,7 @@ Expected: all pass. | ||
| 450 | 450 | Run: `ORGSTAR_FUZZ_EDITS=100000 swift test -c release --filter incrementalEqualsFull`, and again with `ORGSTAR_FUZZ_SEED=1`, `2`, `3`. |
| 451 | 451 | Expected: pass. A failure prints the edit and the document; reduce it to a unit test before fixing. |
| 452 | 452 | |
| 453 | - [ ] **Step 6: Commit** | |
| 453 | - [x] **Step 6: Commit** | |
| 454 | 454 | |
| 455 | 455 | ```bash |
| 456 | 456 | git add Sources Tests |
docs/plans/2026-10-04-inline-objects.md +15 −15
| @@ -41,7 +41,7 @@ Entities (`\alpha`), subscripts, `$...$` LaTeX, export snippets, citations, radi | ||
| 41 | 41 | **Interfaces:** |
| 42 | 42 | - Produces: `Timestamp` (`active`, `start: Point`, `end: Point?`, `repeater: Repeater?`, `warning: Warning?`), `Timestamp.parse(_:) -> Timestamp?`; internal `scanTimestamp(_ chars: [Character], at: Int, limit: Int) -> (stamp: Timestamp, end: Int)?`. |
| 43 | 43 | |
| 44 | - [ ] **Step 1: Write the failing tests** | |
| 44 | - [x] **Step 1: Write the failing tests** | |
| 45 | 45 | |
| 46 | 46 | ```swift |
| 47 | 47 | import Testing |
| @@ -90,12 +90,12 @@ struct TimestampTests { | ||
| 90 | 90 | } |
| 91 | 91 | ``` |
| 92 | 92 | |
| 93 | - [ ] **Step 2: Run to verify failure** | |
| 93 | - [x] **Step 2: Run to verify failure** | |
| 94 | 94 | |
| 95 | 95 | Run: `swift test --filter TimestampTests` |
| 96 | 96 | Expected: build failure, `cannot find 'Timestamp' in scope`. |
| 97 | 97 | |
| 98 | - [ ] **Step 3: Implement** | |
| 98 | - [x] **Step 3: Implement** | |
| 99 | 99 | |
| 100 | 100 | ```swift |
| 101 | 101 | public struct Timestamp: Sendable, Equatable { |
| @@ -281,12 +281,12 @@ private func scanSingleTimestamp(_ chars: [Character], at start: Int, limit: Int | ||
| 281 | 281 | } |
| 282 | 282 | ``` |
| 283 | 283 | |
| 284 | - [ ] **Step 4: Run to verify pass** | |
| 284 | - [x] **Step 4: Run to verify pass** | |
| 285 | 285 | |
| 286 | 286 | Run: `swift test --filter TimestampTests` |
| 287 | 287 | Expected: all pass. |
| 288 | 288 | |
| 289 | - [ ] **Step 5: Commit** | |
| 289 | - [x] **Step 5: Commit** | |
| 290 | 290 | |
| 291 | 291 | ```bash |
| 292 | 292 | git add Sources/OrgCore/Timestamp.swift Tests/OrgCoreTests/TimestampTests.swift |
| @@ -306,7 +306,7 @@ git commit -m "Add timestamp recognizer and value type" | ||
| 306 | 306 | - Consumes: `scanTimestamp` (Task 1), `GreenBuilder`, `Parser`. |
| 307 | 307 | - Produces: `InlineScanner(chars:)` with `scan(_:into:inLink:)`; `Parser.inline(_ text: Substring)`; `Parser.span(from:through:)`; node kinds `title`, `tableCell`, `bold`, `italic`, `underline`, `strikeThrough`, `verbatim`, `code`, `link`, `linkDescription`, `timestamp`, `footnoteReference`, `statisticsCookie`, `target`, `macro`, `inlineSourceBlock`, `latexFragment`, `lineBreak`, `superscript`; token kinds `marker`, `linkPath`, `bullet`, `checkbox`. |
| 308 | 308 | |
| 309 | - [ ] **Step 1: Write the failing tests** | |
| 309 | - [x] **Step 1: Write the failing tests** | |
| 310 | 310 | |
| 311 | 311 | ```swift |
| 312 | 312 | import Testing |
| @@ -429,12 +429,12 @@ Update the two `ParserSectionTests` expectations that assumed `title` was a toke | ||
| 429 | 429 | @Test func todoKeywordsComeFromSettings() { |
| 430 | 430 | ``` |
| 431 | 431 | |
| 432 | - [ ] **Step 2: Run to verify failure** | |
| 432 | - [x] **Step 2: Run to verify failure** | |
| 433 | 433 | |
| 434 | 434 | Run: `swift test --filter InlineTests` |
| 435 | 435 | Expected: build failure on the new `SyntaxKind` cases. |
| 436 | 436 | |
| 437 | - [ ] **Step 3: Replace `SyntaxKind.swift`** | |
| 437 | - [x] **Step 3: Replace `SyntaxKind.swift`** | |
| 438 | 438 | |
| 439 | 439 | ```swift |
| 440 | 440 | public enum SyntaxKind: String, Sendable { |
| @@ -457,7 +457,7 @@ public enum SyntaxKind: String, Sendable { | ||
| 457 | 457 | } |
| 458 | 458 | ``` |
| 459 | 459 | |
| 460 | - [ ] **Step 4: Create `Inline.swift`** | |
| 460 | - [x] **Step 4: Create `Inline.swift`** | |
| 461 | 461 | |
| 462 | 462 | ```swift |
| 463 | 463 | /// Characters allowed before an emphasis opener, besides whitespace and the start of the run. |
| @@ -838,7 +838,7 @@ extension Parser { | ||
| 838 | 838 | } |
| 839 | 839 | ``` |
| 840 | 840 | |
| 841 | - [ ] **Step 5: Wire the scanner into the parser** | |
| 841 | - [x] **Step 5: Wire the scanner into the parser** | |
| 842 | 842 | |
| 843 | 843 | ```diff |
| 844 | 844 | diff --git a/Sources/OrgCore/Parser/Lines.swift b/Sources/OrgCore/Parser/Lines.swift |
| @@ -1037,12 +1037,12 @@ index ac210ff..6460486 100644 | ||
| 1037 | 1037 | builder.token(.whitespace, parts.trailing) |
| 1038 | 1038 | ``` |
| 1039 | 1039 | |
| 1040 | - [ ] **Step 6: Run all tests** | |
| 1040 | - [x] **Step 6: Run all tests** | |
| 1041 | 1041 | |
| 1042 | 1042 | Run: `swift test` |
| 1043 | 1043 | Expected: all pass. |
| 1044 | 1044 | |
| 1045 | - [ ] **Step 7: Commit** | |
| 1045 | - [x] **Step 7: Commit** | |
| 1046 | 1046 | |
| 1047 | 1047 | ```bash |
| 1048 | 1048 | git add Sources Tests |
| @@ -1056,7 +1056,7 @@ git commit -m "Parse inline objects" | ||
| 1056 | 1056 | **Files:** |
| 1057 | 1057 | - Modify: `Tests/OrgCoreTests/RoundTripTests.swift` (fragment list) |
| 1058 | 1058 | |
| 1059 | - [ ] **Step 1: Add inline fragments** | |
| 1059 | - [x] **Step 1: Add inline fragments** | |
| 1060 | 1060 | |
| 1061 | 1061 | ```diff |
| 1062 | 1062 | @@ -20,6 +20,10 @@ let fragments = [ |
| @@ -1072,12 +1072,12 @@ git commit -m "Parse inline objects" | ||
| 1072 | 1072 | func randomDocument(_ rng: inout SeededGenerator) -> String { |
| 1073 | 1073 | ``` |
| 1074 | 1074 | |
| 1075 | - [ ] **Step 2: Run the fuzz test and the private corpus** | |
| 1075 | - [x] **Step 2: Run the fuzz test and the private corpus** | |
| 1076 | 1076 | |
| 1077 | 1077 | Run: `swift test` then `ORGSTAR_CORPUS=~/Documents/notes swift test --filter corpusRoundTrips` |
| 1078 | 1078 | Expected: all pass. |
| 1079 | 1079 | |
| 1080 | - [ ] **Step 3: Commit** | |
| 1080 | - [x] **Step 3: Commit** | |
| 1081 | 1081 | |
| 1082 | 1082 | ```bash |
| 1083 | 1083 | git add Tests |
docs/plans/2026-10-04-orgcore-parser.md +40 −38
| @@ -1,5 +1,7 @@ | ||
| 1 | 1 | # OrgCore Parser Foundation Implementation Plan |
| 2 | 2 | |
| 3 | Shipped as one squashed commit, f4591a4 "OrgCore parser foundation (!1)"; the commit names below are the steps as planned. | |
| 4 | ||
| 3 | 5 | > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| 4 | 6 | |
| 5 | 7 | **Goal:** A Swift package, `OrgCore`, that turns org file bytes into a lossless syntax tree of block-level elements, with the byte and encoding contract from the design. |
| @@ -49,7 +51,7 @@ Inline objects (emphasis, links, timestamps), the semantic layer, incremental re | ||
| 49 | 51 | **Interfaces:** |
| 50 | 52 | - Produces: `SourceText(bytes: [UInt8])`, `SourceText(_ text: String)`, properties `originalBytes`, `hasBOM`, `isValidUTF8`, `isEditable`, `text`; `encode(_ newText: String) -> [UInt8]`. |
| 51 | 53 | |
| 52 | - [ ] **Step 1: Create the package** | |
| 54 | - [x] **Step 1: Create the package** | |
| 53 | 55 | |
| 54 | 56 | ```swift |
| 55 | 57 | // swift-tools-version: 6.2 |
| @@ -68,7 +70,7 @@ let package = Package( | ||
| 68 | 70 | ) |
| 69 | 71 | ``` |
| 70 | 72 | |
| 71 | - [ ] **Step 2: Write the failing tests** | |
| 73 | - [x] **Step 2: Write the failing tests** | |
| 72 | 74 | |
| 73 | 75 | ```swift |
| 74 | 76 | import Testing |
| @@ -113,12 +115,12 @@ struct SourceTextTests { | ||
| 113 | 115 | } |
| 114 | 116 | ``` |
| 115 | 117 | |
| 116 | - [ ] **Step 3: Run tests to verify they fail** | |
| 118 | - [x] **Step 3: Run tests to verify they fail** | |
| 117 | 119 | |
| 118 | 120 | Run: `swift test --filter SourceTextTests` |
| 119 | 121 | Expected: build failure, `cannot find 'SourceText' in scope`. |
| 120 | 122 | |
| 121 | - [ ] **Step 4: Implement** | |
| 123 | - [x] **Step 4: Implement** | |
| 122 | 124 | |
| 123 | 125 | ```swift |
| 124 | 126 | import Foundation |
| @@ -163,12 +165,12 @@ public struct SourceText: Sendable { | ||
| 163 | 165 | } |
| 164 | 166 | ``` |
| 165 | 167 | |
| 166 | - [ ] **Step 5: Run tests to verify they pass** | |
| 168 | - [x] **Step 5: Run tests to verify they pass** | |
| 167 | 169 | |
| 168 | 170 | Run: `swift test --filter SourceTextTests` |
| 169 | 171 | Expected: 5 tests pass. |
| 170 | 172 | |
| 171 | - [ ] **Step 6: Commit** | |
| 173 | - [x] **Step 6: Commit** | |
| 172 | 174 | |
| 173 | 175 | ```bash |
| 174 | 176 | git add Package.swift Sources Tests |
| @@ -188,7 +190,7 @@ git commit -m "Add OrgCore package and SourceText byte contract" | ||
| 188 | 190 | **Interfaces:** |
| 189 | 191 | - Produces: `SyntaxKind` (enum, `String` raw values), `GreenToken(kind:text:)`, `GreenNode(kind:children:)` with `.length`, `.text`; `GreenElement` (`.node`, `.token`); internal `GreenBuilder` with `start(_:)`, `token(_:_:)`, `finish()`, `build()`; `SyntaxNode` with `kind`, `range`, `text`, `children`, `tokens`, `descendants()`; `SyntaxToken`. `OrgTree` depends on `OrgSettings` (Task 4), so it is added in Task 5. |
| 190 | 192 | |
| 191 | - [ ] **Step 1: Write the failing tests** | |
| 193 | - [x] **Step 1: Write the failing tests** | |
| 192 | 194 | |
| 193 | 195 | ```swift |
| 194 | 196 | import Testing |
| @@ -238,12 +240,12 @@ struct SyntaxTreeTests { | ||
| 238 | 240 | } |
| 239 | 241 | ``` |
| 240 | 242 | |
| 241 | - [ ] **Step 2: Run tests to verify they fail** | |
| 243 | - [x] **Step 2: Run tests to verify they fail** | |
| 242 | 244 | |
| 243 | 245 | Run: `swift test --filter SyntaxTreeTests` |
| 244 | 246 | Expected: build failure, `cannot find 'GreenBuilder' in scope`. |
| 245 | 247 | |
| 246 | - [ ] **Step 3: Implement `SyntaxKind.swift`** | |
| 248 | - [x] **Step 3: Implement `SyntaxKind.swift`** | |
| 247 | 249 | |
| 248 | 250 | ```swift |
| 249 | 251 | public enum SyntaxKind: String, Sendable { |
| @@ -260,7 +262,7 @@ public enum SyntaxKind: String, Sendable { | ||
| 260 | 262 | } |
| 261 | 263 | ``` |
| 262 | 264 | |
| 263 | - [ ] **Step 4: Implement `GreenTree.swift`** | |
| 265 | - [x] **Step 4: Implement `GreenTree.swift`** | |
| 264 | 266 | |
| 265 | 267 | ```swift |
| 266 | 268 | public struct GreenToken: Sendable, Equatable { |
| @@ -352,7 +354,7 @@ struct GreenBuilder { | ||
| 352 | 354 | } |
| 353 | 355 | ``` |
| 354 | 356 | |
| 355 | - [ ] **Step 5: Implement `SyntaxNode.swift`** | |
| 357 | - [x] **Step 5: Implement `SyntaxNode.swift`** | |
| 356 | 358 | |
| 357 | 359 | ```swift |
| 358 | 360 | /// A view of a green node at an absolute offset, with a parent link. Created on demand. |
| @@ -408,12 +410,12 @@ public struct SyntaxToken: Sendable, Equatable { | ||
| 408 | 410 | } |
| 409 | 411 | ``` |
| 410 | 412 | |
| 411 | - [ ] **Step 6: Run tests to verify they pass** | |
| 413 | - [x] **Step 6: Run tests to verify they pass** | |
| 412 | 414 | |
| 413 | 415 | Run: `swift test --filter SyntaxTreeTests` |
| 414 | 416 | Expected: 4 tests pass. |
| 415 | 417 | |
| 416 | - [ ] **Step 7: Commit** | |
| 418 | - [x] **Step 7: Commit** | |
| 417 | 419 | |
| 418 | 420 | ```bash |
| 419 | 421 | git add Sources Tests |
| @@ -431,7 +433,7 @@ git commit -m "Add green and red syntax tree" | ||
| 431 | 433 | **Interfaces:** |
| 432 | 434 | - Produces (internal): `RawLine(content: Substring, ending: Substring)`, `splitRawLines(_ text: String) -> [RawLine]`, `LineClass` enum, `ClassifiedLine(cls:indent:)`, `classifyLine(_ line: Substring) -> ClassifiedLine`, `Substring.trimmingTrailingWhitespace`. |
| 433 | 435 | |
| 434 | - [ ] **Step 1: Write the failing tests** | |
| 436 | - [x] **Step 1: Write the failing tests** | |
| 435 | 437 | |
| 436 | 438 | ```swift |
| 437 | 439 | import Testing |
| @@ -500,12 +502,12 @@ struct LinesTests { | ||
| 500 | 502 | } |
| 501 | 503 | ``` |
| 502 | 504 | |
| 503 | - [ ] **Step 2: Run tests to verify they fail** | |
| 505 | - [x] **Step 2: Run tests to verify they fail** | |
| 504 | 506 | |
| 505 | 507 | Run: `swift test --filter LinesTests` |
| 506 | 508 | Expected: build failure, `cannot find 'splitRawLines' in scope`. |
| 507 | 509 | |
| 508 | - [ ] **Step 3: Implement** | |
| 510 | - [x] **Step 3: Implement** | |
| 509 | 511 | |
| 510 | 512 | ```swift |
| 511 | 513 | /// One line of source: its content and its terminator ("", "\n" or "\r\n"), both as slices of |
| @@ -663,12 +665,12 @@ extension Substring { | ||
| 663 | 665 | } |
| 664 | 666 | ``` |
| 665 | 667 | |
| 666 | - [ ] **Step 4: Run tests to verify they pass** | |
| 668 | - [x] **Step 4: Run tests to verify they pass** | |
| 667 | 669 | |
| 668 | 670 | Run: `swift test --filter LinesTests` |
| 669 | 671 | Expected: all pass. |
| 670 | 672 | |
| 671 | - [ ] **Step 5: Commit** | |
| 673 | - [x] **Step 5: Commit** | |
| 672 | 674 | |
| 673 | 675 | ```bash |
| 674 | 676 | git add Sources Tests |
| @@ -687,7 +689,7 @@ git commit -m "Add line splitting and classification" | ||
| 687 | 689 | - Consumes: `RawLine`, `ClassifiedLine`, `LineClass` (Task 3). |
| 688 | 690 | - Produces: `TodoKeyword`, `TodoSequence`, `Priorities`, `OrgSettings` with `.default`, `todoKeywordNames: Set<String>`, `isDone(_:)`; internal `SettingsScanner.scan(lines:info:blockEnds:defaults:) -> OrgSettings`, where `blockEnds: [Int: Int]` maps a block's begin line index to its end line index. |
| 689 | 691 | |
| 690 | - [ ] **Step 1: Write the failing tests** | |
| 692 | - [x] **Step 1: Write the failing tests** | |
| 691 | 693 | |
| 692 | 694 | ```swift |
| 693 | 695 | import Testing |
| @@ -740,12 +742,12 @@ struct SettingsTests { | ||
| 740 | 742 | } |
| 741 | 743 | ``` |
| 742 | 744 | |
| 743 | - [ ] **Step 2: Run tests to verify they fail** | |
| 745 | - [x] **Step 2: Run tests to verify they fail** | |
| 744 | 746 | |
| 745 | 747 | Run: `swift test --filter SettingsTests` |
| 746 | 748 | Expected: build failure, `cannot find 'SettingsScanner' in scope`. |
| 747 | 749 | |
| 748 | - [ ] **Step 3: Implement** | |
| 750 | - [x] **Step 3: Implement** | |
| 749 | 751 | |
| 750 | 752 | ```swift |
| 751 | 753 | public struct TodoKeyword: Sendable, Hashable { |
| @@ -879,12 +881,12 @@ enum SettingsScanner { | ||
| 879 | 881 | } |
| 880 | 882 | ``` |
| 881 | 883 | |
| 882 | - [ ] **Step 4: Run tests to verify they pass** | |
| 884 | - [x] **Step 4: Run tests to verify they pass** | |
| 883 | 885 | |
| 884 | 886 | Run: `swift test --filter SettingsTests` |
| 885 | 887 | Expected: all pass. |
| 886 | 888 | |
| 887 | - [ ] **Step 5: Commit** | |
| 889 | - [x] **Step 5: Commit** | |
| 888 | 890 | |
| 889 | 891 | ```bash |
| 890 | 892 | git add Sources Tests |
| @@ -904,7 +906,7 @@ git commit -m "Add in-buffer TODO and priority settings" | ||
| 904 | 906 | - Consumes: Tasks 2–4. |
| 905 | 907 | - Produces: `public enum OrgParser { static func parse(_ text: String, defaults: OrgSettings = .default) -> OrgTree }`; `public struct OrgTree { green: GreenNode; settings: OrgSettings; root: SyntaxNode; text: String }`; internal `struct Parser` with `element(limit:floor:)` that Task 6 fills in. In this task `element` handles every class as a paragraph or a blank line. |
| 906 | 908 | |
| 907 | - [ ] **Step 1: Write the failing tests** | |
| 909 | - [x] **Step 1: Write the failing tests** | |
| 908 | 910 | |
| 909 | 911 | ```swift |
| 910 | 912 | import Testing |
| @@ -975,12 +977,12 @@ struct ParserSectionTests { | ||
| 975 | 977 | } |
| 976 | 978 | ``` |
| 977 | 979 | |
| 978 | - [ ] **Step 2: Run tests to verify they fail** | |
| 980 | - [x] **Step 2: Run tests to verify they fail** | |
| 979 | 981 | |
| 980 | 982 | Run: `swift test --filter ParserSectionTests` |
| 981 | 983 | Expected: build failure, `cannot find 'OrgParser' in scope`. |
| 982 | 984 | |
| 983 | - [ ] **Step 3: Append `OrgTree` to `SyntaxNode.swift`** | |
| 985 | - [x] **Step 3: Append `OrgTree` to `SyntaxNode.swift`** | |
| 984 | 986 | |
| 985 | 987 | ```swift |
| 986 | 988 | public struct OrgTree: Sendable { |
| @@ -992,7 +994,7 @@ public struct OrgTree: Sendable { | ||
| 992 | 994 | } |
| 993 | 995 | ``` |
| 994 | 996 | |
| 995 | - [ ] **Step 4: Implement `Parser.swift`** | |
| 997 | - [x] **Step 4: Implement `Parser.swift`** | |
| 996 | 998 | |
| 997 | 999 | ```swift |
| 998 | 1000 | public enum OrgParser { |
| @@ -1226,12 +1228,12 @@ struct Parser { | ||
| 1226 | 1228 | } |
| 1227 | 1229 | ``` |
| 1228 | 1230 | |
| 1229 | - [ ] **Step 5: Run tests to verify they pass** | |
| 1231 | - [x] **Step 5: Run tests to verify they pass** | |
| 1230 | 1232 | |
| 1231 | 1233 | Run: `swift test --filter ParserSectionTests` |
| 1232 | 1234 | Expected: all pass. |
| 1233 | 1235 | |
| 1234 | - [ ] **Step 6: Commit** | |
| 1236 | - [x] **Step 6: Commit** | |
| 1235 | 1237 | |
| 1236 | 1238 | ```bash |
| 1237 | 1239 | git add Sources Tests |
| @@ -1250,7 +1252,7 @@ git commit -m "Parse document, sections and headings" | ||
| 1250 | 1252 | - Consumes: Task 5's `Parser`. |
| 1251 | 1253 | - Produces: nodes `block`, `dynamicBlock`, `drawer`, `keyword`, `affiliatedKeyword`, `comment`, `fixedWidth`, `horizontalRule`, `table`/`tableRow`/`tableFormula`, `footnoteDefinition`, `clock`, `plainList`/`item`, `planning` (after heading only), `propertyDrawer`/`nodeProperty`. |
| 1252 | 1254 | |
| 1253 | - [ ] **Step 1: Write the failing tests** | |
| 1255 | - [x] **Step 1: Write the failing tests** | |
| 1254 | 1256 | |
| 1255 | 1257 | ```swift |
| 1256 | 1258 | import Testing |
| @@ -1334,12 +1336,12 @@ struct ParserElementTests { | ||
| 1334 | 1336 | } |
| 1335 | 1337 | ``` |
| 1336 | 1338 | |
| 1337 | - [ ] **Step 2: Run tests to verify they fail** | |
| 1339 | - [x] **Step 2: Run tests to verify they fail** | |
| 1338 | 1340 | |
| 1339 | 1341 | Run: `swift test --filter ParserElementTests` |
| 1340 | 1342 | Expected: failures; every element parses as a paragraph. |
| 1341 | 1343 | |
| 1342 | - [ ] **Step 3: Replace `element` and `continuesParagraph`, add the element parsers** | |
| 1344 | - [x] **Step 3: Replace `element` and `continuesParagraph`, add the element parsers** | |
| 1343 | 1345 | |
| 1344 | 1346 | ```swift |
| 1345 | 1347 | static let affiliatedKeys: Set<String> = ["NAME", "CAPTION", "RESULTS", "HEADER", "PLOT"] |
| @@ -1479,12 +1481,12 @@ Expected: failures; every element parses as a paragraph. | ||
| 1479 | 1481 | } |
| 1480 | 1482 | ``` |
| 1481 | 1483 | |
| 1482 | - [ ] **Step 4: Run all tests** | |
| 1484 | - [x] **Step 4: Run all tests** | |
| 1483 | 1485 | |
| 1484 | 1486 | Run: `swift test` |
| 1485 | 1487 | Expected: all pass, including Task 5's tests. |
| 1486 | 1488 | |
| 1487 | - [ ] **Step 5: Commit** | |
| 1489 | - [x] **Step 5: Commit** | |
| 1488 | 1490 | |
| 1489 | 1491 | ```bash |
| 1490 | 1492 | git add Sources Tests |
| @@ -1502,7 +1504,7 @@ git commit -m "Parse block-level elements" | ||
| 1502 | 1504 | - Consumes: `SourceText`, `OrgParser`, `SyntaxNode`. |
| 1503 | 1505 | - Produces: a seeded fuzz test (2,000 documents), a structural invariant check, and an opt-in corpus test driven by `ORGSTAR_CORPUS`. |
| 1504 | 1506 | |
| 1505 | - [ ] **Step 1: Write the tests** | |
| 1507 | - [x] **Step 1: Write the tests** | |
| 1506 | 1508 | |
| 1507 | 1509 | ```swift |
| 1508 | 1510 | import Foundation |
| @@ -1582,17 +1584,17 @@ struct RoundTripTests { | ||
| 1582 | 1584 | } |
| 1583 | 1585 | ``` |
| 1584 | 1586 | |
| 1585 | - [ ] **Step 2: Run the tests** | |
| 1587 | - [x] **Step 2: Run the tests** | |
| 1586 | 1588 | |
| 1587 | 1589 | Run: `swift test` |
| 1588 | 1590 | Expected: all pass. The corpus test is skipped. |
| 1589 | 1591 | |
| 1590 | - [ ] **Step 3: Run the private corpus locally** | |
| 1592 | - [x] **Step 3: Run the private corpus locally** | |
| 1591 | 1593 | |
| 1592 | 1594 | Run: `ORGSTAR_CORPUS=~/org swift test --filter corpusRoundTrips` |
| 1593 | 1595 | Expected: pass. Any failure names the file; reduce it to a fuzz fragment or a unit test before fixing. |
| 1594 | 1596 | |
| 1595 | - [ ] **Step 4: Commit** | |
| 1597 | - [x] **Step 4: Commit** | |
| 1596 | 1598 | |
| 1597 | 1599 | ```bash |
| 1598 | 1600 | git add Tests |
docs/plans/2026-10-04-performance.md +10 −10
| @@ -48,7 +48,7 @@ Run the gates: `ORGSTAR_GATES=1 ORGSTAR_GATE_FILE=<a large real file> swift test | ||
| 48 | 48 | **Files:** |
| 49 | 49 | - Modify: `Sources/OrgCore/Parser/Inline.swift`, `Sources/OrgCore/Timestamp.swift` |
| 50 | 50 | |
| 51 | - [ ] **Step 1: Rewrite the scanner and the timestamp recognizer over `[Unicode.Scalar]`** | |
| 51 | - [x] **Step 1: Rewrite the scanner and the timestamp recognizer over `[Unicode.Scalar]`** | |
| 52 | 52 | |
| 53 | 53 | The existing inline, timestamp and round-trip tests are the specification; they don't change. |
| 54 | 54 | |
| @@ -572,7 +572,7 @@ index da5ac94..bd71851 100644 | ||
| 572 | 572 | +} |
| 573 | 573 | ``` |
| 574 | 574 | |
| 575 | - [ ] **Step 2: Run tests, the corpus and the reparse gate; commit** | |
| 575 | - [x] **Step 2: Run tests, the corpus and the reparse gate; commit** | |
| 576 | 576 | |
| 577 | 577 | Run: `swift test`; `ORGSTAR_CORPUS=<folder> swift test -c release --filter corpusRoundTrips` for each local folder; `ORGSTAR_FUZZ_EDITS=100000 swift test -c release --filter incrementalEqualsFull`. |
| 578 | 578 | |
| @@ -592,7 +592,7 @@ git commit -m "Scan inline objects over unicode scalars" | ||
| 592 | 592 | **Interfaces:** |
| 593 | 593 | - Produces: `ReparseStrategy.region`; `SyntaxNode.children(overlapping:)`, `child(containing:)`, `firstChild(_:)`; `GreenBuilder.node(_:)`; `Parser.reusableRows`. |
| 594 | 594 | |
| 595 | - [ ] **Step 1: Write the failing tests** | |
| 595 | - [x] **Step 1: Write the failing tests** | |
| 596 | 596 | |
| 597 | 597 | ```diff |
| 598 | 598 | @@ -49,8 +49,23 @@ struct IncrementalTests { |
| @@ -623,7 +623,7 @@ git commit -m "Scan inline objects over unicode scalars" | ||
| 623 | 623 | @Test func runGrowsUntilAHeadingEndsIt() { |
| 624 | 624 | ``` |
| 625 | 625 | |
| 626 | - [ ] **Step 2: Implement** | |
| 626 | - [x] **Step 2: Implement** | |
| 627 | 627 | |
| 628 | 628 | ```diff |
| 629 | 629 | diff --git a/Sources/OrgCore/Parser/Incremental.swift b/Sources/OrgCore/Parser/Incremental.swift |
| @@ -909,7 +909,7 @@ index 3473728..0430409 100644 | ||
| 909 | 909 | [self] + children.flatMap { $0.descendants() } |
| 910 | 910 | ``` |
| 911 | 911 | |
| 912 | - [ ] **Step 3: Run the gate on several seeds; commit** | |
| 912 | - [x] **Step 3: Run the gate on several seeds; commit** | |
| 913 | 913 | |
| 914 | 914 | Run: `ORGSTAR_FUZZ_SEED=<n> ORGSTAR_FUZZ_EDITS=100000 swift test -c release --filter incrementalEqualsFull` for at least five seeds. |
| 915 | 915 | |
| @@ -929,7 +929,7 @@ git commit -m "Reparse structural edits within one section's body" | ||
| 929 | 929 | **Interfaces:** |
| 930 | 930 | - Produces: `OrgEditor.finishStyling()`, `OrgEditor.styledUpTo`, `OrgEditor.firstStyleChunk`, `OrgEditor.styleChunk`; test `Harness(_:layout:)`, `Harness.drainStyling()`. |
| 931 | 931 | |
| 932 | - [ ] **Step 1: Write the failing tests** | |
| 932 | - [x] **Step 1: Write the failing tests** | |
| 933 | 933 | |
| 934 | 934 | ```diff |
| 935 | 935 | @@ -10,13 +10,24 @@ final class Harness { |
| @@ -989,7 +989,7 @@ git commit -m "Reparse structural edits within one section's body" | ||
| 989 | 989 | +} |
| 990 | 990 | ``` |
| 991 | 991 | |
| 992 | - [ ] **Step 2: Implement** | |
| 992 | - [x] **Step 2: Implement** | |
| 993 | 993 | |
| 994 | 994 | ```diff |
| 995 | 995 | diff --git a/Sources/OrgDocument/ViewState.swift b/Sources/OrgDocument/ViewState.swift |
| @@ -1179,7 +1179,7 @@ index 312d7f8..504e0b5 100644 | ||
| 1179 | 1179 | node = child |
| 1180 | 1180 | ``` |
| 1181 | 1181 | |
| 1182 | - [ ] **Step 3: Run the restyle fuzz on several seeds; commit** | |
| 1182 | - [x] **Step 3: Run the restyle fuzz on several seeds; commit** | |
| 1183 | 1183 | |
| 1184 | 1184 | Run: `ORGSTAR_FUZZ_SEED=<n> ORGSTAR_RESTYLE_EDITS=1500 swift test -c release --filter RestyleFuzzTests` for at least three seeds. |
| 1185 | 1185 | |
| @@ -1196,7 +1196,7 @@ git commit -m "Style the first screen first and narrow restyles" | ||
| 1196 | 1196 | - Create: `Tests/OrgEditorAppKitTests/GateTests.swift` |
| 1197 | 1197 | - Modify: `docs/design.md` (memory gate) |
| 1198 | 1198 | |
| 1199 | - [ ] **Step 1: Add the gate suite** | |
| 1199 | - [x] **Step 1: Add the gate suite** | |
| 1200 | 1200 | |
| 1201 | 1201 | ```swift |
| 1202 | 1202 | import AppKit |
| @@ -1306,7 +1306,7 @@ struct GateTests { | ||
| 1306 | 1306 | } |
| 1307 | 1307 | ``` |
| 1308 | 1308 | |
| 1309 | - [ ] **Step 2: Run the gates; commit** | |
| 1309 | - [x] **Step 2: Run the gates; commit** (gates run on an M-series Mac, recorded in docs/design.md; the M1 Air run is owed) | |
| 1310 | 1310 | |
| 1311 | 1311 | Run: `ORGSTAR_GATES=1 ORGSTAR_GATE_FILE=<large real file> swift test -c release --filter GateTests` |
| 1312 | 1312 | |
docs/plans/2026-10-04-semantic-layer.md +17 −17
| @@ -43,7 +43,7 @@ Merging `:results` values by group (collection, type, format, handling), languag | ||
| 43 | 43 | **Interfaces:** |
| 44 | 44 | - Produces: `SemanticSettings` (`.default`, `PropertyInheritance` `.none`/`.all`/`.only(Set<String>)` of upper-cased keys), `ValueSource` (`.defaults`, `.file`, `.heading(Int)`, `.element`), `Resolved<Value>(_:_:)`, `Property(key:value:additive:)` and internal `Property(line:)`, `Clock(start:end:minutes:)`, `HeadingInfo`, `displayWidth(_:)`, `TableModel` (internal `init(node:heading:)`), `SrcBlockInfo`, `HeaderArguments.defaults`, `HeaderArguments.parse(_:) -> [(key: String, value: String)]`. |
| 45 | 45 | |
| 46 | - [ ] **Step 1: Write the failing tests** | |
| 46 | - [x] **Step 1: Write the failing tests** | |
| 47 | 47 | |
| 48 | 48 | ```swift |
| 49 | 49 | import Testing |
| @@ -64,12 +64,12 @@ struct SemanticValueTests { | ||
| 64 | 64 | } |
| 65 | 65 | ``` |
| 66 | 66 | |
| 67 | - [ ] **Step 2: Run to verify failure** | |
| 67 | - [x] **Step 2: Run to verify failure** | |
| 68 | 68 | |
| 69 | 69 | Run: `swift test --filter SemanticValueTests` |
| 70 | 70 | Expected: build failure, `cannot find 'HeaderArguments' in scope`. |
| 71 | 71 | |
| 72 | - [ ] **Step 3: Implement `SemanticSettings.swift`** | |
| 72 | - [x] **Step 3: Implement `SemanticSettings.swift`** | |
| 73 | 73 | |
| 74 | 74 | ```swift |
| 75 | 75 | /// App-wide settings that change what a document means without changing how it parses. |
| @@ -121,7 +121,7 @@ public struct Resolved<Value: Sendable & Equatable>: Sendable, Equatable { | ||
| 121 | 121 | } |
| 122 | 122 | ``` |
| 123 | 123 | |
| 124 | - [ ] **Step 4: Implement `HeadingInfo.swift`** | |
| 124 | - [x] **Step 4: Implement `HeadingInfo.swift`** | |
| 125 | 125 | |
| 126 | 126 | ```swift |
| 127 | 127 | import Foundation |
| @@ -193,7 +193,7 @@ public struct HeadingInfo: Sendable, Equatable { | ||
| 193 | 193 | } |
| 194 | 194 | ``` |
| 195 | 195 | |
| 196 | - [ ] **Step 5: Implement `DisplayWidth.swift`** | |
| 196 | - [x] **Step 5: Implement `DisplayWidth.swift`** | |
| 197 | 197 | |
| 198 | 198 | ```swift |
| 199 | 199 | /// Columns a string occupies in a monospaced table: East Asian wide and fullwidth characters |
| @@ -215,7 +215,7 @@ func displayWidth(of character: Character) -> Int { | ||
| 215 | 215 | } |
| 216 | 216 | ``` |
| 217 | 217 | |
| 218 | - [ ] **Step 6: Implement `TableModel.swift`** | |
| 218 | - [x] **Step 6: Implement `TableModel.swift`** | |
| 219 | 219 | |
| 220 | 220 | ```swift |
| 221 | 221 | import Foundation |
| @@ -261,7 +261,7 @@ public struct TableModel: Sendable, Equatable { | ||
| 261 | 261 | } |
| 262 | 262 | ``` |
| 263 | 263 | |
| 264 | - [ ] **Step 7: Implement `SrcBlockInfo.swift`** | |
| 264 | - [x] **Step 7: Implement `SrcBlockInfo.swift`** | |
| 265 | 265 | |
| 266 | 266 | ```swift |
| 267 | 267 | public struct SrcBlockInfo: Sendable, Equatable { |
| @@ -302,12 +302,12 @@ public enum HeaderArguments { | ||
| 302 | 302 | } |
| 303 | 303 | ``` |
| 304 | 304 | |
| 305 | - [ ] **Step 8: Run to verify pass** | |
| 305 | - [x] **Step 8: Run to verify pass** | |
| 306 | 306 | |
| 307 | 307 | Run: `swift test --filter SemanticValueTests` |
| 308 | 308 | Expected: all pass. |
| 309 | 309 | |
| 310 | - [ ] **Step 9: Commit** | |
| 310 | - [x] **Step 9: Commit** | |
| 311 | 311 | |
| 312 | 312 | ```bash |
| 313 | 313 | git add Sources/OrgCore/Semantic Tests/OrgCoreTests/SemanticValueTests.swift |
| @@ -326,7 +326,7 @@ git commit -m "Add semantic value types" | ||
| 326 | 326 | - Consumes: Task 1 types, `OrgTree`, `SyntaxNode`, `Timestamp.parse`, `SettingsScanner.keywordValue`, `splitRawLines`. |
| 327 | 327 | - Produces: `DocumentModel(tree:settings:)` with `headings`, `fileTags`, `fileProperties`, `tables`, `srcBlocks`, `ancestors(of:)`, `outlinePath(of:)`, `inherits(_:)`, `property(_:of:) -> Resolved<String>?`, `tags(of:) -> [Resolved<String>]`. |
| 328 | 328 | |
| 329 | - [ ] **Step 1: Write the failing tests** | |
| 329 | - [x] **Step 1: Write the failing tests** | |
| 330 | 330 | |
| 331 | 331 | ```swift |
| 332 | 332 | import Testing |
| @@ -490,12 +490,12 @@ struct TableModelTests { | ||
| 490 | 490 | } |
| 491 | 491 | ``` |
| 492 | 492 | |
| 493 | - [ ] **Step 2: Run to verify failure** | |
| 493 | - [x] **Step 2: Run to verify failure** | |
| 494 | 494 | |
| 495 | 495 | Run: `swift test --filter HeadingInfoTests` |
| 496 | 496 | Expected: build failure, `cannot find 'DocumentModel' in scope`. |
| 497 | 497 | |
| 498 | - [ ] **Step 3: Implement** | |
| 498 | - [x] **Step 3: Implement** | |
| 499 | 499 | |
| 500 | 500 | ```swift |
| 501 | 501 | import Foundation |
| @@ -791,12 +791,12 @@ public struct DocumentModel: Sendable { | ||
| 791 | 791 | } |
| 792 | 792 | ``` |
| 793 | 793 | |
| 794 | - [ ] **Step 4: Run all tests** | |
| 794 | - [x] **Step 4: Run all tests** | |
| 795 | 795 | |
| 796 | 796 | Run: `swift test` |
| 797 | 797 | Expected: all pass. |
| 798 | 798 | |
| 799 | - [ ] **Step 5: Commit** | |
| 799 | - [x] **Step 5: Commit** | |
| 800 | 800 | |
| 801 | 801 | ```bash |
| 802 | 802 | git add Sources/OrgCore/Semantic/DocumentModel.swift Tests/OrgCoreTests/SemanticTests.swift |
| @@ -810,7 +810,7 @@ git commit -m "Add document model with inheritance and header arguments" | ||
| 810 | 810 | **Files:** |
| 811 | 811 | - Modify: `Tests/OrgCoreTests/RoundTripTests.swift` |
| 812 | 812 | |
| 813 | - [ ] **Step 1: Build a model for every parsed document** | |
| 813 | - [x] **Step 1: Build a model for every parsed document** | |
| 814 | 814 | |
| 815 | 815 | ```diff |
| 816 | 816 | @@ -45,6 +45,7 @@ struct RoundTripTests { |
| @@ -831,12 +831,12 @@ git commit -m "Add document model with inheritance and header arguments" | ||
| 831 | 831 | } |
| 832 | 832 | ``` |
| 833 | 833 | |
| 834 | - [ ] **Step 2: Run** | |
| 834 | - [x] **Step 2: Run** | |
| 835 | 835 | |
| 836 | 836 | Run: `swift test` then `ORGSTAR_CORPUS=~/Documents/notes swift test --filter corpusRoundTrips` |
| 837 | 837 | Expected: all pass, no crashes. |
| 838 | 838 | |
| 839 | - [ ] **Step 3: Commit** | |
| 839 | - [x] **Step 3: Commit** | |
| 840 | 840 | |
| 841 | 841 | ```bash |
| 842 | 842 | git add Tests/OrgCoreTests/RoundTripTests.swift |
docs/plans/2026-10-04-viewer.md +11 −11
| @@ -46,7 +46,7 @@ | ||
| 46 | 46 | **Interfaces:** |
| 47 | 47 | - Produces: `FoldState`, `GlobalVisibility`, `OutlineEntry`, `Presentation.outline(_:)`, `cycle(_:in:_:)`, `cycleGlobal(from:in:)`, `foldState(for:in:)`, `foldState(showingLevels:in:)`, `startupFoldState(_:)`, `startupOptions(_:)`; `ViewState.bodyFolds`; `OrgEditor(document:frame:editable:)`, `foldState`, `setFolds(_ state: FoldState)`, `cycleAtCaret()`, `cycleGlobal()`, `reveal(_:)`, `diskChanged(to:)`, `hangingColumns(_:)`. |
| 48 | 48 | |
| 49 | - [ ] **Step 1: Write the failing tests** | |
| 49 | - [x] **Step 1: Write the failing tests** | |
| 50 | 50 | |
| 51 | 51 | ```diff |
| 52 | 52 | diff --git a/Tests/OrgEditorAppKitTests/EditorTests.swift b/Tests/OrgEditorAppKitTests/EditorTests.swift |
| @@ -214,7 +214,7 @@ index 6e1ca3d..7007d92 100644 | ||
| 214 | 214 | +} |
| 215 | 215 | ``` |
| 216 | 216 | |
| 217 | - [ ] **Step 2: Implement** | |
| 217 | - [x] **Step 2: Implement** | |
| 218 | 218 | |
| 219 | 219 | ```swift |
| 220 | 220 | import OrgCore |
| @@ -658,7 +658,7 @@ index 504e0b5..1813443 100644 | ||
| 658 | 658 | |
| 659 | 659 | ``` |
| 660 | 660 | |
| 661 | - [ ] **Step 3: Run and commit** | |
| 661 | - [x] **Step 3: Run and commit** | |
| 662 | 662 | |
| 663 | 663 | Run: `swift test` |
| 664 | 664 | |
| @@ -676,7 +676,7 @@ git commit -m "Cycle folds, apply #+STARTUP visibility and indent wrapped lines" | ||
| 676 | 676 | - Create: `Sources/OrgApp/FileTree.swift`, `Sources/OrgApp/WorkspaceModel.swift`, `Sources/OrgApp/DocumentSession.swift` |
| 677 | 677 | - Test: `Tests/OrgAppTests/AppTests.swift` |
| 678 | 678 | |
| 679 | - [ ] **Step 1: Write the failing tests** | |
| 679 | - [x] **Step 1: Write the failing tests** | |
| 680 | 680 | |
| 681 | 681 | ```swift |
| 682 | 682 | import Foundation |
| @@ -796,7 +796,7 @@ struct DocumentSessionTests { | ||
| 796 | 796 | } |
| 797 | 797 | ``` |
| 798 | 798 | |
| 799 | - [ ] **Step 2: Implement** | |
| 799 | - [x] **Step 2: Implement** | |
| 800 | 800 | |
| 801 | 801 | ```swift |
| 802 | 802 | import Foundation |
| @@ -1202,7 +1202,7 @@ index 517c833..556ca69 100644 | ||
| 1202 | 1202 | /// One reconciliation's worth of changes, applied in a single transaction. |
| 1203 | 1203 | ``` |
| 1204 | 1204 | |
| 1205 | - [ ] **Step 3: Run and commit** | |
| 1205 | - [x] **Step 3: Run and commit** | |
| 1206 | 1206 | |
| 1207 | 1207 | Run: `swift test --filter OrgAppTests` |
| 1208 | 1208 | |
| @@ -1219,7 +1219,7 @@ git commit -m "Add workspace and document session models" | ||
| 1219 | 1219 | - Modify: `Package.swift` (add the `Orgstar` executable), `README.md` |
| 1220 | 1220 | - Create: `Sources/Orgstar/OrgstarApp.swift`, `ContentView.swift`, `EditorView.swift`, `DevelopmentHooks.swift`, `scripts/build-app.sh` |
| 1221 | 1221 | |
| 1222 | - [ ] **Step 1: Implement** | |
| 1222 | - [x] **Step 1: Implement** | |
| 1223 | 1223 | |
| 1224 | 1224 | ```swift |
| 1225 | 1225 | import OrgApp |
| @@ -1598,7 +1598,7 @@ codesign --force --sign - "$app" | ||
| 1598 | 1598 | echo "$app" |
| 1599 | 1599 | ``` |
| 1600 | 1600 | |
| 1601 | - [ ] **Step 2: Build, run and snapshot** | |
| 1601 | - [x] **Step 2: Build, run and snapshot** | |
| 1602 | 1602 | |
| 1603 | 1603 | Run: `scripts/build-app.sh`, then with a seeded data directory: |
| 1604 | 1604 | `ORGSTAR_DATA_DIR=<dir> ORGSTAR_OPEN=<file.org> ORGSTAR_SNAPSHOT=/tmp/shot.png .build/app/Orgstar.app/Contents/MacOS/Orgstar` |
| @@ -1606,7 +1606,7 @@ Check: outline column lists the file's headings by level; the editor shows hidde | ||
| 1606 | 1606 | |
| 1607 | 1607 | Manual: add a folder with ⇧⌘O; ⌘P opens a file; ⇧⌘F search opens results that reveal the heading; TAB and Shift-TAB fold; editing the file in Emacs reloads the view. |
| 1608 | 1608 | |
| 1609 | - [ ] **Step 3: Commit** | |
| 1609 | - [x] **Step 3: Commit** | |
| 1610 | 1610 | |
| 1611 | 1611 | ```bash |
| 1612 | 1612 | git add Package.swift README.md Sources/Orgstar scripts |
| @@ -1622,7 +1622,7 @@ Per-line hanging indents gave every line its own `NSParagraphStyle`, which pushe | ||
| 1622 | 1622 | **Files:** |
| 1623 | 1623 | - Modify: `Sources/OrgEditorAppKit/OrgEditor.swift` |
| 1624 | 1624 | |
| 1625 | - [ ] **Step 1: Implement** | |
| 1625 | - [x] **Step 1: Implement** | |
| 1626 | 1626 | |
| 1627 | 1627 | ```diff |
| 1628 | 1628 | @@ -59,6 +59,13 @@ public final class OrgEditor: NSObject { |
| @@ -1674,7 +1674,7 @@ Per-line hanging indents gave every line its own `NSParagraphStyle`, which pushe | ||
| 1674 | 1674 | return clipped.isEmpty ? nil : NSRange(clipped) |
| 1675 | 1675 | ``` |
| 1676 | 1676 | |
| 1677 | - [ ] **Step 2: Run the gates; commit** | |
| 1677 | - [x] **Step 2: Run the gates; commit** (gates run on an M-series Mac, recorded in docs/design.md; the M1 Air run is owed) | |
| 1678 | 1678 | |
| 1679 | 1679 | Run: `ORGSTAR_GATES=1 ORGSTAR_GATE_FILE=<large real file> swift test -c release --filter GateTests` |
| 1680 | 1680 | |
docs/plans/2026-10-04-workspace-index.md +18 −18
| @@ -46,7 +46,7 @@ Agenda queries (phase 3), security-scoped bookmark creation in a sandbox (the Ma | ||
| 46 | 46 | - Consumes: `OrgParser`, `DocumentModel`, `SourceText`, `Timestamp`. |
| 47 | 47 | - Produces: `FileKind`, `IndexSettings(version:org:semantic:)`, `FileRecord(path:root:kind:bytes:mtime:settings:)`, `FileRecord.hash(_:)`, `HeadingRecord`, `TagRow`, `PropertyRow`, `TimestampRow`, `ClockRow`, `LinkRow`. |
| 48 | 48 | |
| 49 | - [ ] **Step 1: Add the target** | |
| 49 | - [x] **Step 1: Add the target** | |
| 50 | 50 | |
| 51 | 51 | ```swift |
| 52 | 52 | // swift-tools-version: 6.2 |
| @@ -74,7 +74,7 @@ let package = Package( | ||
| 74 | 74 | ) |
| 75 | 75 | ``` |
| 76 | 76 | |
| 77 | - [ ] **Step 2: Write the failing tests** | |
| 77 | - [x] **Step 2: Write the failing tests** | |
| 78 | 78 | |
| 79 | 79 | ```swift |
| 80 | 80 | import OrgCore |
| @@ -144,7 +144,7 @@ struct FileRecordTests { | ||
| 144 | 144 | } |
| 145 | 145 | ``` |
| 146 | 146 | |
| 147 | - [ ] **Step 3: Implement** | |
| 147 | - [x] **Step 3: Implement** | |
| 148 | 148 | |
| 149 | 149 | ```swift |
| 150 | 150 | import CryptoKit |
| @@ -358,7 +358,7 @@ public struct FileRecord: Sendable, Equatable { | ||
| 358 | 358 | } |
| 359 | 359 | ``` |
| 360 | 360 | |
| 361 | - [ ] **Step 4: Run to verify pass, then commit** | |
| 361 | - [x] **Step 4: Run to verify pass, then commit** | |
| 362 | 362 | |
| 363 | 363 | Run: `swift test --filter FileRecordTests` |
| 364 | 364 | |
| @@ -379,7 +379,7 @@ git commit -m "Add index file records" | ||
| 379 | 379 | - Consumes: `FileRecord` (Task 1). |
| 380 | 380 | - Produces: `IndexStore(path:)`, `write(_:)`, `apply(_ change: IndexChange)`, `fileStates(root:) -> [String: FileState]`, `files()`, `search(_:overlay:limit:)`, `headings(withID:overlay:)`, `duplicateIDs(overlay:)`; `FileState`, `HeadingLocation`, `IndexChange`. |
| 381 | 381 | |
| 382 | - [ ] **Step 1: Write the failing tests** | |
| 382 | - [x] **Step 1: Write the failing tests** | |
| 383 | 383 | |
| 384 | 384 | ```swift |
| 385 | 385 | import OrgCore |
| @@ -450,7 +450,7 @@ struct IndexStoreTests { | ||
| 450 | 450 | } |
| 451 | 451 | ``` |
| 452 | 452 | |
| 453 | - [ ] **Step 2: Implement** | |
| 453 | - [x] **Step 2: Implement** | |
| 454 | 454 | |
| 455 | 455 | ```swift |
| 456 | 456 | import Foundation |
| @@ -770,7 +770,7 @@ public final class IndexStore: Sendable { | ||
| 770 | 770 | } |
| 771 | 771 | ``` |
| 772 | 772 | |
| 773 | - [ ] **Step 3: Run to verify pass, then commit** | |
| 773 | - [x] **Step 3: Run to verify pass, then commit** | |
| 774 | 774 | |
| 775 | 775 | Run: `swift test --filter IndexStoreTests` |
| 776 | 776 | |
| @@ -792,7 +792,7 @@ git commit -m "Add SQLite index store with search and overlay" | ||
| 792 | 792 | - Consumes: `FileKind` (Task 1). |
| 793 | 793 | - Produces: `WorkspaceRoot(url:)` with `resolve()`, `DiscoveredFile`, `Discovery`, `FileClassification`, `WorkspaceScanner.classify(_:)`, `WorkspaceScanner.scan(_:)`, `AgendaScope(globs:)` with `contains(relativePath:kind:)`; test helper `Folder`. |
| 794 | 794 | |
| 795 | - [ ] **Step 1: Add the target** | |
| 795 | - [x] **Step 1: Add the target** | |
| 796 | 796 | |
| 797 | 797 | ```swift |
| 798 | 798 | // swift-tools-version: 6.2 |
| @@ -823,7 +823,7 @@ let package = Package( | ||
| 823 | 823 | ) |
| 824 | 824 | ``` |
| 825 | 825 | |
| 826 | - [ ] **Step 2: Write the failing tests** | |
| 826 | - [x] **Step 2: Write the failing tests** | |
| 827 | 827 | |
| 828 | 828 | ```swift |
| 829 | 829 | import Foundation |
| @@ -900,7 +900,7 @@ struct ScanTests { | ||
| 900 | 900 | } |
| 901 | 901 | ``` |
| 902 | 902 | |
| 903 | - [ ] **Step 3: Implement** | |
| 903 | - [x] **Step 3: Implement** | |
| 904 | 904 | |
| 905 | 905 | ```swift |
| 906 | 906 | import Foundation |
| @@ -1015,7 +1015,7 @@ public struct AgendaScope: Sendable, Equatable { | ||
| 1015 | 1015 | } |
| 1016 | 1016 | ``` |
| 1017 | 1017 | |
| 1018 | - [ ] **Step 4: Run to verify pass, then commit** | |
| 1018 | - [x] **Step 4: Run to verify pass, then commit** | |
| 1019 | 1019 | |
| 1020 | 1020 | Run: `swift test --filter "ClassificationTests|ScanTests"` |
| 1021 | 1021 | |
| @@ -1036,7 +1036,7 @@ git commit -m "Add workspace discovery and agenda scope" | ||
| 1036 | 1036 | - Consumes: Tasks 1–3. |
| 1037 | 1037 | - Produces: `Reconciler(index:settings:)` with `reconcile(root:)` and `reconcile(root:paths:)`, `ReconcileReport`. |
| 1038 | 1038 | |
| 1039 | - [ ] **Step 1: Write the failing tests** | |
| 1039 | - [x] **Step 1: Write the failing tests** | |
| 1040 | 1040 | |
| 1041 | 1041 | ```swift |
| 1042 | 1042 | import Foundation |
| @@ -1122,7 +1122,7 @@ struct ReconcileTests { | ||
| 1122 | 1122 | } |
| 1123 | 1123 | ``` |
| 1124 | 1124 | |
| 1125 | - [ ] **Step 2: Implement** | |
| 1125 | - [x] **Step 2: Implement** | |
| 1126 | 1126 | |
| 1127 | 1127 | ```swift |
| 1128 | 1128 | import Foundation |
| @@ -1228,7 +1228,7 @@ public struct Reconciler: Sendable { | ||
| 1228 | 1228 | } |
| 1229 | 1229 | ``` |
| 1230 | 1230 | |
| 1231 | - [ ] **Step 3: Run to verify pass, then commit** | |
| 1231 | - [x] **Step 3: Run to verify pass, then commit** | |
| 1232 | 1232 | |
| 1233 | 1233 | Run: `swift test --filter ReconcileTests` |
| 1234 | 1234 | |
| @@ -1248,7 +1248,7 @@ git commit -m "Add index reconciliation" | ||
| 1248 | 1248 | **Interfaces:** |
| 1249 | 1249 | - Produces (macOS): `WatchEvent` (`.changed(URL)`, `.rescan(URL)`), `FSEventsWatcher(roots:latency:handler:)` with `start()`, `stop()`. |
| 1250 | 1250 | |
| 1251 | - [ ] **Step 1: Write the failing test** | |
| 1251 | - [x] **Step 1: Write the failing test** | |
| 1252 | 1252 | |
| 1253 | 1253 | ```swift |
| 1254 | 1254 | import Foundation |
| @@ -1291,7 +1291,7 @@ final class Received: @unchecked Sendable { | ||
| 1291 | 1291 | } |
| 1292 | 1292 | ``` |
| 1293 | 1293 | |
| 1294 | - [ ] **Step 2: Implement** | |
| 1294 | - [x] **Step 2: Implement** | |
| 1295 | 1295 | |
| 1296 | 1296 | ```swift |
| 1297 | 1297 | #if os(macOS) |
| @@ -1374,12 +1374,12 @@ public final class FSEventsWatcher: @unchecked Sendable { | ||
| 1374 | 1374 | #endif |
| 1375 | 1375 | ``` |
| 1376 | 1376 | |
| 1377 | - [ ] **Step 3: Run everything, the iOS build and the gates** | |
| 1377 | - [x] **Step 3: Run everything, the iOS build and the gates** (gates run on an M-series Mac, recorded in docs/design.md; the M1 Air run is owed) | |
| 1378 | 1378 | |
| 1379 | 1379 | Run: `swift test`, then `xcodebuild -scheme OrgWorkspace -destination 'generic/platform=iOS' build`. |
| 1380 | 1380 | Gates: reconcile a folder of 10,000 org files into an empty index (under 30 s), then again with no changes (under 2 s), in a release build on the reference machine. |
| 1381 | 1381 | |
| 1382 | - [ ] **Step 4: Commit** | |
| 1382 | - [x] **Step 4: Commit** | |
| 1383 | 1383 | |
| 1384 | 1384 | ```bash |
| 1385 | 1385 | git add Sources/OrgWorkspace/FSEventsWatcher.swift Tests/OrgWorkspaceTests/WatcherTests.swift |
docs/plans/2026-10-05-commands.md +4 −4
| @@ -122,7 +122,7 @@ Run `swift test`, the reparse gate and the corpus round trip; commit: `git commi | ||
| 122 | 122 | |
| 123 | 123 | **Files:** create `Sources/OrgCore/Commands/Command.swift`, `Sources/OrgCore/Commands/HeadingCommands.swift`, `Tests/OrgCoreTests/EmacsOracle.swift`, `Tests/OrgCoreTests/HeadingCommandTests.swift`; modify `Sources/OrgCore/Parser/Incremental.swift` (its private `EditContext` becomes `ReparseContext`). |
| 124 | 124 | |
| 125 | - [ ] **Step 1: The oracle and the tests** | |
| 125 | - [x] **Step 1: The oracle and the tests** | |
| 126 | 126 | |
| 127 | 127 | ```swift |
| 128 | 128 | import Foundation |
| @@ -387,7 +387,7 @@ struct HeadingOracleTests { | ||
| 387 | 387 | } |
| 388 | 388 | ``` |
| 389 | 389 | |
| 390 | - [ ] **Step 2: The command model** | |
| 390 | - [x] **Step 2: The command model** | |
| 391 | 391 | |
| 392 | 392 | ```swift |
| 393 | 393 | import Foundation |
| @@ -487,7 +487,7 @@ public enum Commands { | ||
| 487 | 487 | } |
| 488 | 488 | ``` |
| 489 | 489 | |
| 490 | - [ ] **Step 3: The heading commands** | |
| 490 | - [x] **Step 3: The heading commands** | |
| 491 | 491 | |
| 492 | 492 | ```swift |
| 493 | 493 | import Foundation |
| @@ -893,7 +893,7 @@ index 9f8347a..976b9b4 100644 | ||
| 893 | 893 | let edit: TextEdit |
| 894 | 894 | ``` |
| 895 | 895 | |
| 896 | - [ ] **Step 4: Run the oracle, including a corpus; commit** | |
| 896 | - [x] **Step 4: Run the oracle, including a corpus; commit** | |
| 897 | 897 | |
| 898 | 898 | Run: `swift test --filter HeadingOracleTests`, then `ORGSTAR_ORACLE_CORPUS=<folder> swift test --filter headingCommandsMatchEmacsOnACorpus` for each local folder. |
| 899 | 899 | |
docs/plans/2026-10-05-fill.md +3 −3
| @@ -25,9 +25,9 @@ | ||
| 25 | 25 | |
| 26 | 26 | ### Task 1: Fill |
| 27 | 27 | |
| 28 | - [ ] Port; oracle over 16 variants (items, comments, quotes, line breaks, timestamps, links, captions, markup at line start, extra spaces) at both fill columns, and over corpus paragraphs (src blocks excluded). | |
| 29 | - [ ] Commit "Port fill paragraph". | |
| 28 | - [x] Port; oracle over 16 variants (items, comments, quotes, line breaks, timestamps, links, captions, markup at line start, extra spaces) at both fill columns, and over corpus paragraphs (src blocks excluded). | |
| 29 | - [x] Commit "Port fill paragraph". | |
| 30 | 30 | |
| 31 | 31 | ### Task 2: App |
| 32 | 32 | |
| 33 | - [ ] M-q / ⌃⌘P; Settings fill column. | |
| 33 | - [x] M-q / ⌃⌘P; Settings fill column. | |
docs/plans/2026-10-05-highlighting.md +2 −2
| @@ -25,5 +25,5 @@ | ||
| 25 | 25 | |
| 26 | 26 | ### Task 1: Highlighting |
| 27 | 27 | |
| 28 | - [ ] Hook, highlighter, vendored grammars and scanners, embedded queries, theme colors; tests for categories in Python, shell and Emacs Lisp and for runs in a src block; app snapshot. | |
| 29 | - [ ] Commit "Highlight src blocks with tree-sitter". | |
| 28 | - [x] Hook, highlighter, vendored grammars and scanners, embedded queries, theme colors; tests for categories in Python, shell and Emacs Lisp and for runs in a src block; app snapshot. | |
| 29 | - [x] Commit "Highlight src blocks with tree-sitter". | |
docs/plans/2026-10-05-keymaps.md +5 −5
| @@ -43,8 +43,8 @@ | ||
| 43 | 43 | |
| 44 | 44 | `KeyChord.parse`, `KeySequence.parse/format`, `TOML.parse`, `Keymap(toml:problems:)`, `Keymap.layered`, `candidates(for:mode:)`, `isPrefix`, `continuations(of:)`, `keys(for:)`, `KeyContext.holds`, `KeyDispatcher.feed` returning `.pending`, `.complete`, `.undefined`, `.unbound` or `.cancelled`. |
| 45 | 45 | |
| 46 | - [ ] Tests: notation round trips and shift folding; TOML tables, escapes and error lines; bad entries skipped with problems; later layers win and `none` unbinds; prefix dispatch, undefined sequences and C-g; continuations; contexts; presets parse. | |
| 47 | - [ ] Commit "Add keymaps". | |
| 46 | - [x] Tests: notation round trips and shift folding; TOML tables, escapes and error lines; bad entries skipped with problems; later layers win and `none` unbinds; prefix dispatch, undefined sequences and C-g; continuations; contexts; presets parse. | |
| 47 | - [x] Commit "Add keymaps". | |
| 48 | 48 | |
| 49 | 49 | ### Task 2: Keys in the editor |
| 50 | 50 | |
| @@ -53,8 +53,8 @@ | ||
| 53 | 53 | - `edit.set-mark` starts a region that movement extends; C-g, editing, kill and copy end it. |
| 54 | 54 | - Option as Meta per side, from the device-dependent modifier bits. |
| 55 | 55 | - `onKeysPending(String?, [(key, title)])`, `onAppCommand(String)`, and `run(_ id:)` for menus and the palette. |
| 56 | - [ ] Tests with synthesized key events: C-c C-t cycles TODO; TAB folds on a heading and inserts a tab in a paragraph; C-SPC C-f C-w kills one character; M-f moves a word with left Option and types with right Option; C-x C-s reaches `onAppCommand`; an undefined sequence reports a message; pending keys are reported. | |
| 57 | - [ ] Commit "Run commands from keys". | |
| 56 | - [x] Tests with synthesized key events: C-c C-t cycles TODO; TAB folds on a heading and inserts a tab in a paragraph; C-SPC C-f C-w kills one character; M-f moves a word with left Option and types with right Option; C-x C-s reaches `onAppCommand`; an undefined sequence reports a message; pending keys are reported. | |
| 57 | - [x] Commit "Run commands from keys". | |
| 58 | 58 | |
| 59 | 59 | ### Task 3: App |
| 60 | 60 | |
| @@ -62,4 +62,4 @@ | ||
| 62 | 62 | - Echo area at the bottom of the editor: pending keys and command messages. which-key popup lists the continuations with command titles. |
| 63 | 63 | - Command palette (M-x, ⇧⌘P): fuzzy search over command titles, showing each command's keys; runs on the editor. |
| 64 | 64 | - Org menu with the org commands. |
| 65 | - [ ] Verify with the snapshot hook; commit "Keymaps, echo area and palette in the app". | |
| 65 | - [x] Verify with the snapshot hook; commit "Keymaps, echo area and palette in the app". | |
docs/plans/2026-10-05-lists.md +4 −4
| @@ -31,10 +31,10 @@ | ||
| 31 | 31 | |
| 32 | 32 | ### Task 1: List machinery and commands |
| 33 | 33 | |
| 34 | - [ ] Port the machinery and the nine commands; unit tests; oracle over 13 variants at every caret and over the corpus (`ORGSTAR_ORACLE_CORPUS`, item lines in files up to 20 KB). | |
| 35 | - [ ] Commit "Port plain list commands from org". | |
| 34 | - [x] Port the machinery and the nine commands; unit tests; oracle over 13 variants at every caret and over the corpus (`ORGSTAR_ORACLE_CORPUS`, item lines in files up to 20 KB). | |
| 35 | - [x] Commit "Port plain list commands from org". | |
| 36 | 36 | |
| 37 | 37 | ### Task 2: Keys |
| 38 | 38 | |
| 39 | - [ ] Emacs preset: item bindings on M-RET, M-S-RET, M-arrows, M-S-arrows with `when = "item"`; C-c C-c on items; C-c C-x C-b. Mac preset: the same on its chords, ⌃⌘C to toggle. | |
| 40 | - [ ] Commit "Bind list keys". | |
| 39 | - [x] Emacs preset: item bindings on M-RET, M-S-RET, M-arrows, M-S-arrows with `when = "item"`; C-c C-c on items; C-c C-x C-b. Mac preset: the same on its chords, ⌃⌘C to toggle. | |
| 40 | - [x] Commit "Bind list keys". | |
docs/plans/2026-10-05-options.md +5 −5
| @@ -23,11 +23,11 @@ The user's Emacs is Doom, which sets tags column 0, M-RET after the subtree with | ||
| 23 | 23 | |
| 24 | 24 | ### Task 1: Options in commands |
| 25 | 25 | |
| 26 | - [ ] `EditingOptions`; plumb through every command; alphabetical bullets. | |
| 27 | - [ ] Oracle: heading, structure and list suites again under the Doom options (`withOptions` binds the variables around each case), plus alphabetical list variants. | |
| 28 | - [ ] Commit "Make org editing options settings". | |
| 26 | - [x] `EditingOptions`; plumb through every command; alphabetical bullets. | |
| 27 | - [x] Oracle: heading, structure and list suites again under the Doom options (`withOptions` binds the variables around each case), plus alphabetical list variants. | |
| 28 | - [x] Commit "Make org editing options settings". | |
| 29 | 29 | |
| 30 | 30 | ### Task 2: App |
| 31 | 31 | |
| 32 | - [ ] Settings section; options to the editor and session; default keywords to documents and the index at launch. | |
| 33 | - [ ] Commit "Org options in Settings". | |
| 32 | - [x] Settings section; options to the editor and session; default keywords to documents and the index at launch. | |
| 33 | - [x] Commit "Org options in Settings". | |
docs/plans/2026-10-05-refile-archive.md +4 −4
| @@ -24,10 +24,10 @@ | ||
| 24 | 24 | |
| 25 | 25 | ### Task 1: Core |
| 26 | 26 | |
| 27 | - [ ] Port refile, archive and statistics; oracles: refile within a file and to another file (4 sources × every caret × every target, 5 target files), archive (7 sources × 4 archive files), TODO cycle and TODO-heading insert with parent cookies. | |
| 28 | - [ ] Commit "Port refile, archive and TODO statistics from org". | |
| 27 | - [x] Port refile, archive and statistics; oracles: refile within a file and to another file (4 sources × every caret × every target, 5 target files), archive (7 sources × 4 archive files), TODO cycle and TODO-heading insert with parent cookies. | |
| 28 | - [x] Commit "Port refile, archive and TODO statistics from org". | |
| 29 | 29 | |
| 30 | 30 | ### Task 2: Session and app |
| 31 | 31 | |
| 32 | - [ ] `DocumentBuffer.selection` and `perform`; `PrecomputedEdit`; `DocumentSession.refile(to:)`, `archive()`; `WorkspaceModel.refileTargets`; prompt choices; keys and palette entries. | |
| 33 | - [ ] Commit "Refile and archive in the app". | |
| 32 | - [x] `DocumentBuffer.selection` and `perform`; `PrecomputedEdit`; `DocumentSession.refile(to:)`, `archive()`; `WorkspaceModel.refileTargets`; prompt choices; keys and palette entries. | |
| 33 | - [x] Commit "Refile and archive in the app". | |
docs/plans/2026-10-05-structure.md +6 −6
| @@ -36,12 +36,12 @@ | ||
| 36 | 36 | |
| 37 | 37 | ### Task 1: Buffer and structure commands |
| 38 | 38 | |
| 39 | - [ ] Port `org-insert-heading` (with `org--blank-before-heading-p`, `org-N-empty-lines-before-current`), `org-insert-todo-heading`, `org-move-subtree-down`, `org-promote-subtree`/`org-demote-subtree` (`org-map-tree`, `org-promote`, `org-demote`, `org-fix-position-after-promote`), `org-next-visible-heading`, `org-forward-heading-same-level`, `outline-up-heading`. | |
| 40 | - [ ] Oracle: every command at every caret of ten variants (levels, blank lines, tags, text before the first heading, no final newline, non-BMP) and over the corpus (`ORGSTAR_ORACLE_CORPUS`, files up to 20 KB). | |
| 41 | - [ ] Commit "Port heading structure commands from org". | |
| 39 | - [x] Port `org-insert-heading` (with `org--blank-before-heading-p`, `org-N-empty-lines-before-current`), `org-insert-todo-heading`, `org-move-subtree-down`, `org-promote-subtree`/`org-demote-subtree` (`org-map-tree`, `org-promote`, `org-demote`, `org-fix-position-after-promote`), `org-next-visible-heading`, `org-forward-heading-same-level`, `outline-up-heading`. | |
| 40 | - [x] Oracle: every command at every caret of ten variants (levels, blank lines, tags, text before the first heading, no final newline, non-BMP) and over the corpus (`ORGSTAR_ORACLE_CORPUS`, files up to 20 KB). | |
| 41 | - [x] Commit "Port heading structure commands from org". | |
| 42 | 42 | |
| 43 | 43 | ### Task 2: Tags and prompts |
| 44 | 44 | |
| 45 | - [ ] `SetTags`: prompt with the current tags, then `org-set-tags` semantics (realign even when unchanged). Oracle with `completing-read-multiple` stubbed to the answer. | |
| 46 | - [ ] Editor `onPrompt`; app minibuffer field (Return answers, Escape cancels); key bindings in both presets. | |
| 47 | - [ ] Commit "Set tags through a prompt". | |
| 45 | - [x] `SetTags`: prompt with the current tags, then `org-set-tags` semantics (realign even when unchanged). Oracle with `completing-read-multiple` stubbed to the answer. | |
| 46 | - [x] Editor `onPrompt`; app minibuffer field (Return answers, Escape cancels); key bindings in both presets. | |
| 47 | - [x] Commit "Set tags through a prompt". | |
docs/plans/2026-10-05-tables.md +3 −3
| @@ -25,9 +25,9 @@ | ||
| 25 | 25 | |
| 26 | 26 | ### Task 1: Visible widths |
| 27 | 27 | |
| 28 | - [ ] `VisibleLine`; tag alignment, columns and fill use it; oracle passes refontified. | |
| 28 | - [x] `VisibleLine`; tag alignment, columns and fill use it; oracle passes refontified. | |
| 29 | 29 | |
| 30 | 30 | ### Task 2: Tables |
| 31 | 31 | |
| 32 | - [ ] Port; oracle over 11 tables (numbers, rules, indentation, links, emphasis, entities, cookies, TBLFM, unicode, ragged rows) × every caret × 13 commands at both option sets; table creation; real tables in all three corpora. | |
| 33 | - [ ] Commit "Port org tables". | |
| 32 | - [x] Port; oracle over 11 tables (numbers, rules, indentation, links, emphasis, entities, cookies, TBLFM, unicode, ragged rows) × every caret × 13 commands at both option sets; table creation; real tables in all three corpora. | |
| 33 | - [x] Commit "Port org tables". | |
docs/plans/2026-10-05-timestamps.md +5 −5
| @@ -24,14 +24,14 @@ | ||
| 24 | 24 | |
| 25 | 25 | ### Task 1: Date prompt |
| 26 | 26 | |
| 27 | - [ ] Port; oracle over 52 inputs (relative, weekdays, ISO weeks, US and European dates, am/pm, `HHhMM`, ranges, durations). | |
| 28 | - [ ] Commit "Port the date prompt". | |
| 27 | - [x] Port; oracle over 52 inputs (relative, weekdays, ISO weeks, US and European dates, am/pm, `HHhMM`, ranges, durations). | |
| 28 | - [x] Commit "Port the date prompt". | |
| 29 | 29 | |
| 30 | 30 | ### Task 2: Timestamps, planning, repeats |
| 31 | 31 | |
| 32 | - [ ] Port; oracle over 7 texts × every caret × 9 commands × 6 answers, and 10 repeating entries. | |
| 33 | - [ ] Commit "Port timestamp and planning commands". | |
| 32 | - [x] Port; oracle over 7 texts × every caret × 9 commands × 6 answers, and 10 repeating entries. | |
| 33 | - [x] Commit "Port timestamp and planning commands". | |
| 34 | 34 | |
| 35 | 35 | ### Task 3: Keys |
| 36 | 36 | |
| 37 | - [ ] Bind both presets; `timestamp` context. | |
| 37 | - [x] Bind both presets; `timestamp` context. | |
docs/plans/2026-10-05-writable-app.md +8 −8
| @@ -63,9 +63,9 @@ extension OrgEditor: DocumentBuffer // plus `public var onChange: (() -> Void) | ||
| 63 | 63 | |
| 64 | 64 | `OrgEditor.update` records the text and selection, runs the change, and if the text changed: computes `lineEdits(from:to:)`, reloads the storage, maps folds and the selection through the edits, and removes the text view's undo actions (they refer to the old text). `save(using:to:)` and `diskChanged(to:)` become `update` calls; `diskChanged` returns the `ExternalChange`. |
| 65 | 65 | |
| 66 | - [ ] Tests: `overwrite` writes ours and keeps the replaced version; editor `update` replacing text keeps the caret on the same line content, keeps folds, and leaves nothing to undo; typing calls `onChange`. | |
| 67 | - [ ] Implement; `swift test` green. | |
| 68 | - [ ] Commit "Add document buffers". | |
| 66 | - [x] Tests: `overwrite` writes ours and keeps the replaced version; editor `update` replacing text keeps the caret on the same line content, keeps folds, and leaves nothing to undo; typing calls `onChange`. | |
| 67 | - [x] Implement; `swift test` green. | |
| 68 | - [x] Commit "Add document buffers". | |
| 69 | 69 | |
| 70 | 70 | ### Task 2: Session saving |
| 71 | 71 | |
| @@ -99,9 +99,9 @@ extension WorkspaceModel { | ||
| 99 | 99 | |
| 100 | 100 | `fileChanged` calls `buffer.update { $0.diskChanged(to:) }` and sets `conflict` on a conflict; `diskBytes` goes away. `show(_:)` uses indexed offsets only when the buffer is clean. |
| 101 | 101 | |
| 102 | - [ ] Tests: edit then `save` writes and clears dirty; automatic mode saves after the delay, explicit does not; an external change merges into an edited buffer; a conflicting change sets `conflict`, blocks saving, and `keepMine` writes ours with theirs in recovery while `useDiskVersion` loads theirs with ours in recovery; search with the overlay finds an unsaved heading. | |
| 103 | - [ ] Implement; `swift test` green. | |
| 104 | - [ ] Commit "Save from the session". | |
| 102 | - [x] Tests: edit then `save` writes and clears dirty; automatic mode saves after the delay, explicit does not; an external change merges into an edited buffer; a conflicting change sets `conflict`, blocks saving, and `keepMine` writes ours with theirs in recovery while `useDiskVersion` loads theirs with ours in recovery; search with the overlay finds an unsaved heading. | |
| 103 | - [x] Implement; `swift test` green. | |
| 104 | - [x] Commit "Save from the session". | |
| 105 | 105 | |
| 106 | 106 | ### Task 3: The app |
| 107 | 107 | |
| @@ -112,5 +112,5 @@ extension WorkspaceModel { | ||
| 112 | 112 | - File ▸ Save (⌘S); Settings (⌘,) with the save mode in `@AppStorage("saveMode")`. |
| 113 | 113 | - Switching files and quitting with unsaved edits: save in automatic mode, ask in explicit mode; a failed save cancels. |
| 114 | 114 | - Conflict alert with the three choices. |
| 115 | - [ ] Verify in the built app with a scratch data dir: type, ⌘S, undo, external edit merges, conflicting external edit shows the alert, search finds unsaved text. | |
| 116 | - [ ] Commit "Edit and save in the app". | |
| 115 | - [x] Verify in the built app with a scratch data dir: type, ⌘S, undo, external edit merges, conflicting external edit shows the alert, search finds unsaved text. | |
| 116 | - [x] Commit "Edit and save in the app". | |