67 lines
3.3 KiB
Markdown
67 lines
3.3 KiB
Markdown
# Implementation Plan: Copy-Paste Detection Quality Gate
|
|
|
|
**Branch**: `015-add-jscpd-gate` | **Date**: 2026-03-06 | **Spec**: [spec.md](./spec.md)
|
|
**Input**: Feature specification from `/specs/015-add-jscpd-gate/spec.md`
|
|
|
|
## Summary
|
|
|
|
Add jscpd as a copy-paste detection tool to the project, configured with appropriate thresholds for TypeScript/TSX source files. Integrate it into the existing pre-commit quality gate (`pnpm check`) via Lefthook, and expose a standalone `pnpm jscpd` command for on-demand scanning. This is a tooling/configuration feature — no domain, application, or adapter code changes are required.
|
|
|
|
## Technical Context
|
|
|
|
**Language/Version**: TypeScript 5.8 (strict mode, verbatimModuleSyntax)
|
|
**Primary Dependencies**: jscpd (new dev dependency), Lefthook (existing), Biome 2.0 (existing), Knip (existing)
|
|
**Storage**: N/A (no storage changes)
|
|
**Testing**: Vitest (existing) — verification via manual/script testing of jscpd config and pre-commit hook behavior
|
|
**Target Platform**: Node.js / developer workstation (macOS, Linux)
|
|
**Project Type**: Monorepo workspace (pnpm) — web app with domain/application/adapter layers
|
|
**Performance Goals**: Scan completes in under 10 seconds for the current codebase
|
|
**Constraints**: Must not introduce false positives on structurally repeated patterns (imports, type declarations)
|
|
**Scale/Scope**: ~3 workspace packages, small codebase
|
|
|
|
## Constitution Check
|
|
|
|
*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*
|
|
|
|
| Principle | Status | Notes |
|
|
|-----------|--------|-------|
|
|
| I. Deterministic Domain Core | N/A | No domain changes |
|
|
| II. Layered Architecture | N/A | No layer changes — tooling config only |
|
|
| III. Agent Boundary | N/A | No agent layer involvement |
|
|
| IV. Clarification-First | PASS | Feature scope is clear from spec |
|
|
| V. Escalation Gates | PASS | All work within spec scope |
|
|
| VI. MVP Baseline Language | PASS | Scope boundaries use MVP baseline language |
|
|
| VII. No Gameplay Rules | N/A | Not applicable |
|
|
| Dev Workflow: Merge gate | PASS | Integrates into existing `pnpm check` gate |
|
|
| Dev Workflow: Spec-first | PASS | Spec exists at `specs/015-add-jscpd-gate/spec.md` |
|
|
|
|
All gates pass. No violations to justify.
|
|
|
|
## Project Structure
|
|
|
|
### Documentation (this feature)
|
|
|
|
```text
|
|
specs/015-add-jscpd-gate/
|
|
├── plan.md
|
|
├── research.md
|
|
├── data-model.md
|
|
├── quickstart.md
|
|
└── tasks.md # Created by /speckit.tasks
|
|
```
|
|
|
|
### Source Code (repository root)
|
|
|
|
```text
|
|
(root)
|
|
├── package.json # Add jscpd devDependency + "jscpd" script, update "check" script
|
|
├── lefthook.yml # Already runs `pnpm check` — no changes needed
|
|
└── .jscpd.json # New: jscpd configuration file (thresholds, patterns, ignore)
|
|
```
|
|
|
|
**Structure Decision**: This feature is purely tooling configuration at the workspace root. No changes to `packages/` or `apps/` directories. The jscpd config file (`.jscpd.json`) lives at the repo root alongside existing config files (`biome.json`, `knip.json`). The `pnpm check` script in `package.json` already serves as the Lefthook pre-commit command, so adding jscpd to the check script chain automatically integrates it into the pre-commit gate.
|
|
|
|
## Complexity Tracking
|
|
|
|
No constitution violations. Table not applicable.
|