You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Useful for reviewing changes before committing or validating context is up-to-date.
228
228
229
-
> ⚠️ **Note:** Context files are gitignored by default. For CI-based drift detection, the `--baseline git:<ref>` option (e.g., `--baseline git:main`) is **not yet implemented**. Until automation is available, use the manual workflow: generate context from current code, checkout baseline branch, generate context from baseline, then compare. See the [roadmap](https://logicstamp.dev/roadmap) for planned automation.
229
+
**Git baseline comparison***(v0.7.2)*: Compare against any git ref:
230
+
```bash
231
+
stamp context compare --baseline git:main # Compare against main branch
232
+
stamp context compare --baseline git:HEAD # Compare against HEAD
233
+
stamp context compare --baseline git:v1.0.0 # Compare against a tag
234
+
```
235
+
236
+
> **ℹ️ Note:** Context files are gitignored by default. Git baseline comparison uses git worktrees to generate context for both the baseline ref and the current working tree, then performs a structural contract comparison. See [docs/cli/compare.md](docs/cli/compare.md) for complete documentation.
230
237
231
238
## How it Works
232
239
@@ -286,6 +293,8 @@ npm install -g logicstamp-mcp
286
293
287
294
Then configure your AI assistant to use the LogicStamp MCP Server.
288
295
296
+
🔗 **See [LogicStamp MCP Server Repository](https://github.com/LogicStamp/logicstamp-mcp)**
297
+
289
298
📋 **See [MCP Getting Started Guide](https://logicstamp.dev/docs/mcp/getting-started)** for setup instructions.
@@ -404,60 +406,104 @@ These are longer-term features and improvements planned for future releases.
404
406
### Comparison & Drift Detection
405
407
406
408
#### Git Baseline for Compare
407
-
**Status:** 🔴 Not Started
409
+
**Status:** ✅ **Complete in v0.7.2**
410
+
411
+
Git-based baseline support for context comparison, enabling meaningful drift detection against known reference points.
408
412
409
-
Add git-based baseline support for context comparison, enabling meaningful drift detection against known reference points.
413
+
**What Works (v0.7.2):**
414
+
- ✅ `--baseline git:<ref>` option to compare against any local git ref
415
+
- ✅ Uses git worktrees for clean isolation during comparison
416
+
- ✅ Generates context for both baseline and current code, then compares
417
+
- ✅ Automatic cleanup of worktrees and temp directories
418
+
- ✅ Works with branches, tags, and commit hashes
410
419
411
420
**Current Behavior:**
412
421
- ✅ Watch mode compares against previous state (rolling baseline)
413
422
- ✅ `stamp context compare` compares disk files vs freshly generated
414
-
-❌ No git baseline support
423
+
-✅ `stamp context compare --baseline git:main` compares against git ref
415
424
416
-
**Why This Is Non-Trivial:**
417
-
Context files are gitignored by design - they don't exist in git history. So git baseline can't simply "checkout context files from a ref". Instead, it must:
418
-
1. Generate context from source code at the current state
419
-
2. Generate context from source code at the baseline git ref
420
-
3. Compare the two generated contexts
425
+
**How It Works:**
426
+
Context files are gitignored by design - they don't exist in git history. Git baseline generates context at two points and compares them:
421
427
422
-
**Planned Implementation:**
423
-
-`--baseline git:HEAD` - Compare against last commit
424
-
-`--baseline git:main` - Compare against main branch
425
-
-`--baseline git:<ref>` - Compare against any git ref (branch, tag, commit)
426
-
427
-
**Under the hood:**
428
428
```
429
429
stamp context compare --baseline git:main
430
430
431
-
1. Generate context for current working tree → temp/current/
432
-
2. Create git worktree at ref (or stash + checkout)
433
-
3. Generate context for baseline ref → temp/baseline/
434
-
4. Restore working directory
435
-
5. Compare temp/baseline/ vs temp/current/
436
-
6. Report drift/violations
437
-
7. Cleanup temp directories
431
+
1. Validate git repo and resolve ref
432
+
2. Create git worktree at ref → temp/worktree/
433
+
3. Generate context for baseline → .logicstamp/compare/baseline/
434
+
4. Generate context for current working tree → .logicstamp/compare/current/
435
+
5. Compare baseline vs current
436
+
6. Report drift
437
+
7. Cleanup worktree and temp directories
438
438
```
439
439
440
-
**Implementation Considerations:**
441
-
- Use `git worktree` for clean isolation (avoids disrupting working directory)
442
-
- Fallback to stash/checkout if worktrees unavailable
443
-
- Cache baseline context if ref hasn't changed (optimization)
444
-
- Handle uncommitted changes gracefully
440
+
**Implementation Details:**
441
+
- Uses `git worktree` for clean isolation (avoids disrupting working directory)
442
+
- Context stored in `.logicstamp/compare/` (already gitignored)
443
+
- Worktrees stored in system temp directory
444
+
- Automatic cleanup on success or failure
445
+
446
+
**Hash Behavior in Git Baseline Comparisons:**
447
+
448
+
Semantic hashes track meaningful structural and logical changes to components (props, emits, state, imports, hooks, functions, components). In git baseline mode, hash behavior differs from regular comparisons:
449
+
450
+
-**Hash-only changes are filtered**: When only the semantic hash differs (with no changes to imports, hooks, functions, components, props, emits, or exports), the hash change is ignored to prevent false positives
451
+
-**Hash changes with other changes are reported**: When the hash differs AND there are other structural changes, the hash is still reported to provide context
452
+
-**Why filter hash-only?** TypeScript project resolution can produce slightly different AST structures between worktree and working directory contexts (different absolute paths, module resolution contexts, or TypeScript compiler state) even for functionally identical code. Filtering hash-only changes ensures deterministic structural comparison while preserving hash information when there are real changes.
453
+
454
+
**Hash Behavior in Other Comparison Modes:**
455
+
456
+
-**Regular comparison modes** (single-file, multi-file, auto-mode): All hash changes are reported, as both sides are generated from the same environment context
457
+
-**Watch mode**: Hashes are used for incremental rebuild detection and bundle hashing
458
+
459
+
**Why Hashes Are Still Needed:**
460
+
461
+
Even though hash-only changes are filtered in git baseline mode, semantic hashes are still computed and used because:
462
+
- Context for real changes: When there ARE other changes, the hash provides context about what changed
463
+
- Regular comparisons: In non-git-baseline comparisons, hashes are always reported
- Only works with local refs (must `git fetch` first for remote branches)
478
+
- No caching yet (regenerates on every run)
451
479
452
-
**Enables:**
480
+
**Future Enhancements:**
453
481
-`--fail-on-breaking` flag for `stamp context compare` (exit non-zero on breaking changes)
482
+
- Baseline caching when ref hasn't changed (optimization)
483
+
- Remote ref auto-fetch option
454
484
455
-
**Note:** Can't use `--strict` as it already exists for missing dependency checking. No need for a `--no-fail` flag - without `--fail-on-breaking`, compare just shows drift without breaking change detection.
456
-
- Meaningful CI integration for contract drift detection
485
+
**Impact:** Enables meaningful drift detection against stable reference points, making CI integration straightforward.
457
486
458
-
**Impact:** Enables meaningful drift detection against stable reference points. This is the prerequisite for CI-friendly strict mode.
487
+
---
459
488
460
-
**Priority:** High
489
+
#### Enhanced Compare Command
490
+
**Status:** ✅ **Complete in v0.7.2**
491
+
492
+
Full contract comparison support for all contract fields, aligning compare command behavior with watch mode.
493
+
494
+
**What Works (v0.7.2):**
495
+
- ✅ State comparison - Detects added/removed/changed state variables with type information
- ✅ API signature comparison - Detects changes to backend API parameters, return types, request/response types
498
+
- ✅ Prop/emit type change detection - Detects when prop/emit types change (not just added/removed)
499
+
- ✅ New delta types: `state`, `variables`, `apiSignature`, `propsChanged`, `emitsChanged`
500
+
501
+
**Prop/Emit Type Changes:**
502
+
- Displays type changes as: `~ propName: "string" → "number"`
503
+
- Only detected in direct file comparisons (not in git baseline mode due to TypeScript resolution differences)
504
+
- Aligns with watch mode behavior
505
+
506
+
**Impact:** Compare command now provides comprehensive drift detection across all contract fields, matching watch mode capabilities for consistent behavior.
0 commit comments