Commit Graph

132 Commits

Author SHA1 Message Date
Bill
b18e41c6d0 Step 78: line numbers and gutter 2026-02-09 09:06:07 -07:00
Bill
65b714547f Step 77: custom code editor renderer 2026-02-09 09:04:12 -07:00
Bill
a65e0b13ee Step 76: LayoutManager with docking layout presets (Sprint 4 start)
Three preset layouts (VSCode/Emacs/JetBrains) with panel visibility,
size ratios, dirty flag for rebuild, and file-based persistence.
Also includes revised sprint4_plan.md and new sprint5_plan.md.
10/10 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 08:22:02 -07:00
Bill
dc94ad7274 Sprint 3 complete: Phases 3g+3h (Steps 68-75), all 75 steps done
Phase 3g — Optimization Pipeline (17/17 tests):
  Step 68: TransformEngine — constant folding, dead code elimination, OptimizationLock warning
  Step 69: StrategyAwareOptimizer — annotation-constrained (@Reclaim allows, @Owner blocks duplication, @Deallocate blocks reorder, @Allocate blocks dynamic)
  Step 70: StrategyValidator — post-optimization invariants (use-after-free, leak, aliasing)
  Step 71: IncrementalOptimizer — transform journal, undo by ID, provenance tracking

Phase 3h — Integration & Validation (26/26 tests):
  Step 72: Pipeline — end-to-end parse→infer→validate→optimize→generate for Python/C++
  Step 73: Error handling — empty ASTs, null roots, nonexistent IDs, unannotated code
  Step 74: Performance benchmarks — 1000-fn AST 1ms, JSON round-trip 4ms, 50 transforms+undo 1ms
  Step 75: APIDocGenerator — structured docs for 23 components across 6 categories

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 07:35:37 -07:00
Bill
650e8557ae Phase 3f complete: Advanced Memory Management (Steps 64-67)
Step 64: AnnotationValidator — @Deallocate missing-intent, @Owner(Single) alias detection, parent/child conflict (5/5 tests)
Step 65: MemoryStrategyInference — language defaults, per-function pattern analysis, confidence scores (5/5 tests)
Step 66: CrossLanguageProjector — deep-copy AST projection, annotation-aware CppGenerator (shared_ptr/unique_ptr) (5/5 tests)
Step 67: Optimization annotations — HotCold, Inline, Pure, ConstExpr with C++ attribute generation (9/9 tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 20:57:58 -07:00
Bill
7fb9e89e25 Phase 3e complete: Agent API Extend (Steps 59, 61-63)
Step 59: WebSocketAgentServer with session management, JSON-RPC routing, MockWebSocketTransport (10/10 tests)
Step 61: ASTMutationAPI with setProperty, updateNode, deleteNode, insertNode, journal, OptimizationLock warning (6/6 tests)
Step 62: ContextAPI with getInScopeSymbols, getCallHierarchy, getDependencyGraph (6/6 tests)
Step 63: BatchMutationAPI with atomic applySequence and reverse-order rollback (5/5 tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 20:57:39 -07:00
Bill
bb7981d4d7 Phase 3d complete: editor infrastructure (Steps 55-58)
Step 55: WelcomeScreen (actions, recent files, tips, visibility) - 7/7 tests
Step 56: ElispCommandBuilder + MockEmacsConnection (escaping, daemon lifecycle) - 6/6 tests
Step 57: BufferManager (multi-file open/close/switch, language/modified tracking) - 7/7 tests
Step 58: EditorMode (per-language indent, comment toggle, bracket pairs, snippets) - 8/8 tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 16:27:22 -07:00
Bill
16cc60b36c Wire up GUI: functional editor with VSCode Dark theme and docking layout
Rewrote main.cpp from Step 12 scaffold to full editor shell. Added tree-sitter
linking to whetstone_editor target. Fixed WMOD_ prefix to avoid Windows SDK
MOD_SHIFT/MOD_ALT macro conflicts. Editor now has editable text area, live AST
view, syntax-highlighted preview, generated code tab, find/replace, keybinding
profile selector, and status bar.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 16:21:22 -07:00
Bill
5190e12b89 Phase 3c complete: syntax highlighting and configurable keybindings (Steps 52, 54)
Step 52: SyntaxHighlighter walks tree-sitter CST to produce colored
token spans (keyword, string, comment, number, function, parameter,
type, operator, etc.) for Python, C++, and Elisp.

Step 54: KeybindingManager with swappable profiles — VSCode (default),
JetBrains, and Emacs. Each profile maps 25+ actions (file, edit,
search, nav, view, code, build) to key combos. Supports custom
overrides and reverse lookup.

Design direction: editor targets VSCode/JetBrains look-and-feel.
Keybinding profile selectable at startup. VSCode is default.

Phase 3c totals: 37/37 tests pass across 5 steps (50-54).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 16:12:10 -07:00
Bill
742c33d813 Phase 3c: Classical editing mode (Steps 50-53)
Implement TextASTSync and TextEditor — the core text editing layer
that bridges raw text and the structured AST. TextASTSync provides
bidirectional text-AST sync with debounce via TreeSitterParser and
generators. TextEditor wraps a text buffer with edit operations,
undo/redo that tracks AST state, find/replace, and selection.

New files: TextASTSync.h, TextEditor.h, step50_test.cpp
Updated: step51/53 tests (replaced stubs with real includes),
CMakeLists.txt (tree-sitter linking), PROGRESS.md
Fixed: step53 find-position off-by-one, canRedo assert logic

19/19 tests pass (step50: 8, step51: 5, step53: 6)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 15:45:59 -07:00
Bill
41166812b0 Phase 3b: Real tree-sitter integration (Steps 45-49)
Replace TreeSitterParser stubs with real tree-sitter C bindings for
Python, C++, and Elisp parsing. Add tree-sitter core via vcpkg and
language grammars via FetchContent. Implement CST-to-AST converters
with auto-annotation, memory pattern detection, error recovery, and
ParseResult/ParseDiagnostic types. All 34 tests pass (6+7+6+8+7).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 09:06:50 -07:00
Bill
7c0b0c759e Sprint 3 Step 60: AST query API implementation
- Implement ASTQueryAPI class with tree walking, JSON output,
  findNodesByType, findNodesByProperty, findNodesWithAnnotation
- Add nlohmann_json link for step60_test in CMakeLists.txt
- Add PROGRESS.md for cross-session continuity tracking

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 22:54:18 -07:00
Bill
d0a039e567 Sprint 2 Step 38: OptimizationLock warnings 2026-02-07 10:53:35 -07:00
Bill
ea79d2b484 Sprint 2 Step 37: Agent batch mode 2026-02-07 10:49:48 -07:00
Bill
e6044f92e4 Sprint 2 Step 36: Agent API 2026-02-07 10:46:17 -07:00
Bill
5404fa24b0 Sprint 2 Step 35: C++ generator — memory strategies 2026-02-07 10:42:49 -07:00
Bill
6f8c2341dd Sprint 2 Step 34: C++ generator — basic output 2026-02-07 10:38:03 -07:00
Bill
4515443860 Sprint 2 Step 33: Elisp round-trip 2026-02-07 10:32:35 -07:00
Bill
b00610508b Step 71 TDD test: Incremental optimization with rollback
Tests IncrementalOptimizer: transforms recorded in history, undoLast
restores original AST, undo specific transform by ID while keeping
others, and provenance tracking (node knows which transform created it).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:32:59 -07:00
Bill
5ba255cbca Step 70 TDD test: Cross-strategy validation
Tests StrategyValidator: use-after-free detection for @Deallocate(Explicit),
leaked allocation detection, @Owner(Single) aliasing detection, clean code
passes validation, violations include node IDs for diagnostics.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:32:11 -07:00
Bill
26cf9bc9fb Step 69 TDD test: Strategy-aware optimization
Tests StrategyAwareOptimizer: @Reclaim(Tracing) allows free restructuring,
@Owner(Single) blocks duplication/aliasing, @Deallocate(Explicit) blocks
reordering around dealloc, @Allocate(Static) blocks dynamic allocation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:31:30 -07:00
Bill
01a094f28e Step 68 TDD test: Transformation engine
Tests TransformEngine: constant folding (3+4->7), dead code elimination
after return, OptimizationLock produces warning but doesn't block, and
no-op when nothing to transform. Defines TransformEngine interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:30:51 -07:00
Bill
89778c4b02 Step 67 TDD test: Optimization annotations
Tests HotColdAnnotation, InlineAnnotation, PureAnnotation, ConstExprAnnotation
classes exist. Tests C++ generation: @Hot->__attribute__((hot)),
@Cold->__attribute__((cold)), @Inline(Always)->always_inline,
@Pure->[[nodiscard]], @ConstExpr->constexpr.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:30:09 -07:00
Bill
1a1416472b Step 66 TDD test: Cross-language memory projection
Tests Lossless Projection Logic: Python @Reclaim(Tracing)->C++ shared_ptr,
C++ @Deallocate(Explicit)->Python wrapper, @Owner(Single) preserved in
Python metadata, round-trip annotation preservation, @Lifetime(RAII)->
unique_ptr. Defines CrossLanguageProjector interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:29:33 -07:00
Bill
52b59428f2 Step 65 TDD test: Memory strategy inference
Tests MemoryStrategyInference: Python->@Reclaim(Tracing), C++ gets
suggestions, inference does NOT auto-apply to AST, suggestions have
confidence scores and reasons, Elisp->@Reclaim(Tracing).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:28:51 -07:00
Bill
880ecda73e Step 64 TDD test: Memory annotation validation
Tests AnnotationValidator: valid @Reclaim(Tracing) passes,
@Deallocate(Explicit) without dealloc -> Missing Intent error,
@Owner(Single) aliasing -> error, conflicting parent/child annotations,
and valid @Lifetime(RAII) passes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:28:18 -07:00
Bill
605fddc600 Step 63 TDD test: Batch operations (extend)
Tests applySequence: successful batch of 3, failed batch rolls back
all preceding mutations, journal recording, empty batch, and 5-mutation
batch with error at step 3 rolling back all 5.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:27:36 -07:00
Bill
761e37b369 Step 62 TDD test: Context API
Tests getInScopeSymbols with nested scoping (inner sees outer, not
vice versa), getCallHierarchy for caller/callee tracking, and
getDependencyGraph for data flow. Defines ContextAPI interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:26:57 -07:00
Bill
9a7d180522 Step 61 TDD test: AST mutation API (extend)
Tests setProperty, updateNode bulk update, journal recording,
OptimizationLock warning on mutation (not rejection), deleteNode,
and insertNode. Defines ASTMutationAPI interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:26:14 -07:00
Bill
16b7384cd0 Step 60 TDD test: AST query API
Tests ASTQueryAPI: getAST returns JSON, findNodesByType for Functions/
Parameters/VariableReferences, findNodesByProperty by name,
findNodesWithAnnotation, and getSubtree with depth limit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:25:37 -07:00
Bill
f438005413 Step 57 TDD test: Buffer management
Tests BufferManager: open/close/switch buffers, multiple buffers
tracked simultaneously, buffer content retrieval, language tracking,
and modification flag. Defines BufferManager interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:24:58 -07:00
Bill
9df08cbe18 Step 56 TDD test: Robust Emacs command integration
Tests ElispCommandBuilder for escaping, findFile/saveBuffer Elisp
generation, paths with spaces, and EmacsConnection daemon management
with ensureDaemon and error handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:24:23 -07:00
Bill
e287e96470 Step 53 TDD test: Classical editing operations
Tests text undo/redo with bidirectional AST sync, find/replaceAll,
selection, and verifies AST stays consistent through edit operations.
Defines TextEditor interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:23:48 -07:00
Bill
76ae96cdb4 Step 51 TDD test: Text-AST synchronization
Tests bidirectional sync: text->parse->AST, AST mutation->text regen,
round-trip preservation, debounce coalescing of rapid edits, and
C++ text sync. Defines TextASTSync interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:23:11 -07:00
Bill
e0c5bf2a9e Step 47 TDD test: Tree-sitter Elisp integration
Tests parseElisp() with defun parsing, parameter extraction, BinaryOperation
from (+ x 1), auto-annotation with @Reclaim(Tracing), and cross-language
equivalence with Python AST output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:22:35 -07:00
Bill
6666109f38 Step 46 TDD test: Tree-sitter C++ integration
Tests parseCpp() produces real AST: Function with name and return type,
typed Parameters, and memory pattern detection: unique_ptr->@Lifetime(RAII),
shared_ptr->@Owner(Shared_ARC), raw new/delete->@Deallocate(Explicit).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:22:00 -07:00
Bill
d8a67cfe10 Step 45 TDD test: Tree-sitter Python integration
Tests parsePython() produces real AST: Function with name, Parameters,
Return with BinaryOperation, and auto-annotation with @Reclaim(Tracing).
Tests multiple functions parsed. Will fail until real tree-sitter-python
replaces the placeholder stub.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:21:27 -07:00
Bill
7a847c4f03 Step 44 TDD test: C++-specific idioms
Tests FunctionCall, const reference parameters via LangSpecific annotation,
#include directives, using namespace declarations, void return type,
IndexAccess bracket notation, and MemberAccess dot/arrow notation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:20:41 -07:00
Bill
d966eae2cf Step 43 TDD test: Memory strategy code generation
Tests canonical annotation classes (DeallocateAnnotation, LifetimeAnnotation,
ReclaimAnnotation, OwnerAnnotation, AllocateAnnotation) exist and inherit from
Annotation. Tests C++ generation: @Deallocate(Explicit)->raw pointers,
@Lifetime(RAII)->unique_ptr, @Reclaim(Tracing)->shared_ptr,
@Owner(Shared_ARC)->shared_ptr. Verifies old DerefStrategy backward compat.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:20:04 -07:00
Bill
5952c51cb9 Step 42 TDD test: C++ type generation
Tests PrimitiveType mapping (int, string->std::string, bool, float->double),
ListType->std::vector, MapType->std::map, SetType->std::unordered_set,
OptionalType->std::optional, CustomType, and typed function parameters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:19:25 -07:00
Bill
07f40c4786 Step 41 TDD test: C++ expression generation
Tests BinaryOperation, UnaryOperation, VariableReference, all literals
(int, float, string, bool, null->nullptr), FunctionCall, and nested
expression parenthesization for CppGenerator.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:18:51 -07:00
Bill
217a38a2c8 Step 40 TDD test: C++ statement generation
Tests Assignment, Return, IfStatement, WhileLoop, ForLoop produce
correct C++ syntax with semicolons, braces, and parentheses.
Verifies no Python syntax leaks through.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:18:13 -07:00
Bill
fe32389271 Step 39 TDD test: CppGenerator basic skeleton
Tests CppGenerator inherits ProjectionGenerator, generates namespace
from Module, produces C++ function signatures with types and braces,
and does NOT emit Python syntax. Will fail to compile until
CppGenerator is implemented.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:17:35 -07:00
Bill
6643b7c2c7 Sprint 3 plan and docs: adopt canonical annotation system from annotations/Memory strategy.md
- Add Sprint 3 plan (37 steps, global 39-75) with canonical memory annotations,
  test quality requirements, global step numbering, and Sprint 2 overlap notes
- Refactor all docs to use canonical annotation families (@Deallocate, @Lifetime,
  @Reclaim, @Owner, @Allocate) replacing simplified @deref 4-strategy system
- Replace @perf with canonical @Hot/@Cold, @Inline, @Pure from annotations/6 optimization
- Replace @memory-footprint, @execution-mode, @deref-explicit with canonical equivalents
- Update REQUIREMENTS_OVERVIEW, SPRINT_1_REQUIREMENTS, SPRINT_2_PLAN, SPRINT_2_VISION,
  C++ Implementation Roadmap, example files, and progress report
- Remove duplicate bonus steps 41-42, consolidate Phase 3h from 7 to 4 steps

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:11:23 -07:00
Bill
ab05001068 Sprint 2 Step 38: Final integration test 2026-02-07 07:01:23 -07:00
Bill
c69e1a4250 Sprint 2 Step 37: Emacs ↔ AST synchronization 2026-02-07 06:52:35 -07:00
Bill
7dc31f48a7 Sprint 2 Step 36: Lock warnings in UI 2026-02-07 06:19:10 -07:00
Bill
8f39c8edfb Sprint 2 Step 35: Optimization lock annotations 2026-02-07 05:31:36 -07:00
Bill
e4f9cfb78d Sprint 2 Step 34: Full round-trip 2026-02-06 23:50:56 -07:00
Bill
9e080bebfe Sprint 2 Step 33: Export via generator 2026-02-06 23:47:18 -07:00