omp-plugin-duplicate-detector 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -16
- package/package.json +1 -1
- package/src/coordinator.ts +9 -1
package/README.md
CHANGED
|
@@ -2,32 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Real-time duplicate code detection for [oh-my-pi](https://github.com/oh-my-pi/oh-my-pi) (`omp`), built on [jscpd](https://github.com/kucherenko/jscpd).
|
|
4
4
|
|
|
5
|
+
<img width="717" height="254" alt="image" src="https://github.com/user-attachments/assets/d4673964-1842-4a38-93de-72772edede98" />
|
|
6
|
+
|
|
5
7
|
The plugin indexes your repository in the background and watches the agent as it works. When newly written or edited code duplicates existing logic anywhere in the workspace, the agent is warned immediately, before the copy-paste hardens into a maintenance problem. Duplicate detection can be toggled on or off per project using `/duplicates on|off`.
|
|
6
8
|
|
|
7
9
|
Indexing and mutation checks run entirely in a background worker with a persistent on-disk cache, so sessions start instantly and the agent loop is never blocked, even in large repositories.
|
|
8
10
|
## Installation
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
Install directly via the `omp` CLI:
|
|
11
13
|
|
|
12
14
|
```bash
|
|
13
|
-
omp plugin
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Or declare it in `~/.omp/agent/config.yml` (or a project-level `.omp/config.yml`):
|
|
17
|
-
|
|
18
|
-
```yaml
|
|
19
|
-
extensions:
|
|
20
|
-
- /path/to/omp-plugin-duplicate-detector
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Or load it for a single session:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
omp -e /path/to/omp-plugin-duplicate-detector
|
|
15
|
+
omp plugin install omp-plugin-duplicate-detector
|
|
27
16
|
```
|
|
28
17
|
|
|
29
18
|
On startup you'll see a short readiness note in the transcript, e.g. `Duplicate detector: Ready (1,420 Git files indexed, cached)`.
|
|
30
|
-
|
|
31
19
|
## Usage
|
|
32
20
|
|
|
33
21
|
### Real-time warnings
|
package/package.json
CHANGED
package/src/coordinator.ts
CHANGED
|
@@ -158,6 +158,9 @@ export class DuplicateDetectorCoordinator extends EventEmitter<CoordinatorEvents
|
|
|
158
158
|
|
|
159
159
|
try {
|
|
160
160
|
const worker = new Worker(this.#workerUrl);
|
|
161
|
+
if (typeof worker.unref === "function") {
|
|
162
|
+
worker.unref();
|
|
163
|
+
}
|
|
161
164
|
|
|
162
165
|
worker.onmessage = (event: MessageEvent<unknown>) => {
|
|
163
166
|
this.#handleWorkerMessage(event.data);
|
|
@@ -264,6 +267,9 @@ export class DuplicateDetectorCoordinator extends EventEmitter<CoordinatorEvents
|
|
|
264
267
|
).catch(() => {});
|
|
265
268
|
}
|
|
266
269
|
}, delay);
|
|
270
|
+
if (typeof this.#restartTimer.unref === "function") {
|
|
271
|
+
this.#restartTimer.unref();
|
|
272
|
+
}
|
|
267
273
|
}
|
|
268
274
|
}
|
|
269
275
|
|
|
@@ -300,7 +306,9 @@ export class DuplicateDetectorCoordinator extends EventEmitter<CoordinatorEvents
|
|
|
300
306
|
),
|
|
301
307
|
);
|
|
302
308
|
}, this.#requestTimeoutMs);
|
|
303
|
-
|
|
309
|
+
if (typeof timeoutTimer.unref === "function") {
|
|
310
|
+
timeoutTimer.unref();
|
|
311
|
+
}
|
|
304
312
|
this.#pendingRequests.set(id, {
|
|
305
313
|
resolve: resolve as (value: unknown) => void,
|
|
306
314
|
reject,
|