dsh-clear-debug 0.0.0-stage → 0.0.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/LICENSE +21 -0
- package/README.md +64 -2
- package/cordis.patch.yml +3 -0
- package/docs/DETAIL.md +184 -0
- package/icon.svg +6 -0
- package/index.js +872 -0
- package/lib/checks.js +322 -0
- package/lib/config.js +37 -0
- package/lib/fingerprint.js +127 -0
- package/lib/gate.js +71 -0
- package/lib/invariants.js +231 -0
- package/lib/paths.js +101 -0
- package/lib/scope-store.js +205 -0
- package/lib/session.js +114 -0
- package/lib/site-history.js +63 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +44 -3
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-file history of attributions.
|
|
3
|
+
*
|
|
4
|
+
* Keyed by file rather than file:line: line numbers drift with every edit,
|
|
5
|
+
* files do not. The record is what a later session needs most — this file has
|
|
6
|
+
* been blamed before, and here is what was already ruled out.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { promises as fsp } from 'node:fs';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
|
|
12
|
+
const STORE = '.dsh/site-history.json';
|
|
13
|
+
const KEEP = 20;
|
|
14
|
+
|
|
15
|
+
export function fileOf(site) {
|
|
16
|
+
return String(site ?? '').replace(/:\d+$/, '').trim().toLowerCase();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function readAll(root) {
|
|
20
|
+
try {
|
|
21
|
+
const parsed = JSON.parse(await fsp.readFile(join(root, STORE), 'utf8'));
|
|
22
|
+
return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};
|
|
23
|
+
} catch {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function writeAll(root, all) {
|
|
29
|
+
await fsp.mkdir(join(root, '.dsh'), { recursive: true });
|
|
30
|
+
await fsp.writeFile(join(root, STORE), `${JSON.stringify(all, null, 2)}\n`, 'utf8');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function bucket(all, file) {
|
|
34
|
+
if (!all[file]) all[file] = { file, attributed: 0, refuted: [], fixed: [] };
|
|
35
|
+
return all[file];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export async function recordFixed(root, site, record) {
|
|
39
|
+
if (!root || !site) return null;
|
|
40
|
+
const all = await readAll(root);
|
|
41
|
+
const entry = bucket(all, fileOf(site));
|
|
42
|
+
entry.attributed += 1;
|
|
43
|
+
entry.fixed.push({ at: Date.now(), ...record });
|
|
44
|
+
entry.fixed = entry.fixed.slice(-KEEP);
|
|
45
|
+
await writeAll(root, all);
|
|
46
|
+
return entry;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function recordRefuted(root, site, record) {
|
|
50
|
+
if (!root || !site) return null;
|
|
51
|
+
const all = await readAll(root);
|
|
52
|
+
const entry = bucket(all, fileOf(site));
|
|
53
|
+
entry.refuted.push({ at: Date.now(), ...record });
|
|
54
|
+
entry.refuted = entry.refuted.slice(-KEEP);
|
|
55
|
+
await writeAll(root, all);
|
|
56
|
+
return entry;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export async function siteHistory(root, site) {
|
|
60
|
+
if (!root || !site) return null;
|
|
61
|
+
const all = await readAll(root);
|
|
62
|
+
return all[fileOf(site)] ?? null;
|
|
63
|
+
}
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-clear-debug",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Declare the scope of a change before editing, enforce it, verify the result against the log, and record one executable invariant per fix.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/high-landway/dsh-clear-debug.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/high-landway/dsh-clear-debug#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/high-landway/dsh-clear-debug/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"deepseek",
|
|
17
|
+
"dsh",
|
|
18
|
+
"dsh-plugin",
|
|
19
|
+
"debugging",
|
|
20
|
+
"root-cause",
|
|
21
|
+
"code-review"
|
|
22
|
+
],
|
|
23
|
+
"exports": {
|
|
24
|
+
".": "./index.js",
|
|
25
|
+
"./locale/*.json": "./locale/*.json",
|
|
26
|
+
"./icon": "./icon.svg"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"index.js",
|
|
30
|
+
"lib",
|
|
31
|
+
"cordis.patch.yml",
|
|
32
|
+
"locale/*.json",
|
|
33
|
+
"docs/DETAIL.md",
|
|
34
|
+
"icon.svg",
|
|
35
|
+
"README.md",
|
|
36
|
+
"LICENSE"
|
|
37
|
+
],
|
|
38
|
+
"dsh": {
|
|
39
|
+
"bundle": {
|
|
40
|
+
"patch": "./cordis.patch.yml"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@deepseek-ai/cosmokit": "~1.9.0",
|
|
45
|
+
"@deepseek-ai/schemastery": "~3.19.0"
|
|
46
|
+
}
|
|
6
47
|
}
|