@descryy/core 0.1.0
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/dist/capabilities/index.d.ts +3 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +2 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/preconditions.d.ts +99 -0
- package/dist/capabilities/preconditions.d.ts.map +1 -0
- package/dist/capabilities/preconditions.js +94 -0
- package/dist/capabilities/preconditions.js.map +1 -0
- package/dist/contracts/engine.d.ts +90 -0
- package/dist/contracts/engine.d.ts.map +1 -0
- package/dist/contracts/engine.js +291 -0
- package/dist/contracts/engine.js.map +1 -0
- package/dist/contracts/index.d.ts +9 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +5 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/orphans.d.ts +96 -0
- package/dist/contracts/orphans.d.ts.map +1 -0
- package/dist/contracts/orphans.js +241 -0
- package/dist/contracts/orphans.js.map +1 -0
- package/dist/contracts/paths.d.ts +132 -0
- package/dist/contracts/paths.d.ts.map +1 -0
- package/dist/contracts/paths.js +245 -0
- package/dist/contracts/paths.js.map +1 -0
- package/dist/contracts/shapes.d.ts +99 -0
- package/dist/contracts/shapes.d.ts.map +1 -0
- package/dist/contracts/shapes.js +196 -0
- package/dist/contracts/shapes.js.map +1 -0
- package/dist/governance/budget.d.ts +89 -0
- package/dist/governance/budget.d.ts.map +1 -0
- package/dist/governance/budget.js +101 -0
- package/dist/governance/budget.js.map +1 -0
- package/dist/governance/candidate-boundary.d.ts +49 -0
- package/dist/governance/candidate-boundary.d.ts.map +1 -0
- package/dist/governance/candidate-boundary.js +51 -0
- package/dist/governance/candidate-boundary.js.map +1 -0
- package/dist/governance/escalation.d.ts +63 -0
- package/dist/governance/escalation.d.ts.map +1 -0
- package/dist/governance/escalation.js +72 -0
- package/dist/governance/escalation.js.map +1 -0
- package/dist/governance/fact-boundary.d.ts +77 -0
- package/dist/governance/fact-boundary.d.ts.map +1 -0
- package/dist/governance/fact-boundary.js +91 -0
- package/dist/governance/fact-boundary.js.map +1 -0
- package/dist/governance/finding-funnel.d.ts +109 -0
- package/dist/governance/finding-funnel.d.ts.map +1 -0
- package/dist/governance/finding-funnel.js +137 -0
- package/dist/governance/finding-funnel.js.map +1 -0
- package/dist/governance/index.d.ts +11 -0
- package/dist/governance/index.d.ts.map +1 -0
- package/dist/governance/index.js +6 -0
- package/dist/governance/index.js.map +1 -0
- package/dist/graph/build.d.ts +127 -0
- package/dist/graph/build.d.ts.map +1 -0
- package/dist/graph/build.js +0 -0
- package/dist/graph/build.js.map +1 -0
- package/dist/graph/cross-language.d.ts +70 -0
- package/dist/graph/cross-language.d.ts.map +1 -0
- package/dist/graph/cross-language.js +104 -0
- package/dist/graph/cross-language.js.map +1 -0
- package/dist/graph/index.d.ts +11 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +6 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/merge.d.ts +95 -0
- package/dist/graph/merge.d.ts.map +1 -0
- package/dist/graph/merge.js +131 -0
- package/dist/graph/merge.js.map +1 -0
- package/dist/graph/persist.d.ts +42 -0
- package/dist/graph/persist.d.ts.map +1 -0
- package/dist/graph/persist.js +52 -0
- package/dist/graph/persist.js.map +1 -0
- package/dist/graph/runtime-confirmation.d.ts +169 -0
- package/dist/graph/runtime-confirmation.d.ts.map +1 -0
- package/dist/graph/runtime-confirmation.js +318 -0
- package/dist/graph/runtime-confirmation.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/ledger/index.d.ts +5 -0
- package/dist/ledger/index.d.ts.map +1 -0
- package/dist/ledger/index.js +3 -0
- package/dist/ledger/index.js.map +1 -0
- package/dist/ledger/mint.d.ts +81 -0
- package/dist/ledger/mint.d.ts.map +1 -0
- package/dist/ledger/mint.js +138 -0
- package/dist/ledger/mint.js.map +1 -0
- package/dist/ledger/resolve.d.ts +124 -0
- package/dist/ledger/resolve.d.ts.map +1 -0
- package/dist/ledger/resolve.js +290 -0
- package/dist/ledger/resolve.js.map +1 -0
- package/dist/multipr/fingerprint.d.ts +56 -0
- package/dist/multipr/fingerprint.d.ts.map +1 -0
- package/dist/multipr/fingerprint.js +169 -0
- package/dist/multipr/fingerprint.js.map +1 -0
- package/dist/multipr/hidden-dependency.d.ts +120 -0
- package/dist/multipr/hidden-dependency.d.ts.map +1 -0
- package/dist/multipr/hidden-dependency.js +185 -0
- package/dist/multipr/hidden-dependency.js.map +1 -0
- package/dist/multipr/index.d.ts +14 -0
- package/dist/multipr/index.d.ts.map +1 -0
- package/dist/multipr/index.js +8 -0
- package/dist/multipr/index.js.map +1 -0
- package/dist/multipr/mechanical.d.ts +239 -0
- package/dist/multipr/mechanical.d.ts.map +1 -0
- package/dist/multipr/mechanical.js +333 -0
- package/dist/multipr/mechanical.js.map +1 -0
- package/dist/multipr/migration-heads.d.ts +160 -0
- package/dist/multipr/migration-heads.d.ts.map +1 -0
- package/dist/multipr/migration-heads.js +212 -0
- package/dist/multipr/migration-heads.js.map +1 -0
- package/dist/multipr/overlap.d.ts +186 -0
- package/dist/multipr/overlap.d.ts.map +1 -0
- package/dist/multipr/overlap.js +254 -0
- package/dist/multipr/overlap.js.map +1 -0
- package/dist/multipr/scope-store.d.ts +105 -0
- package/dist/multipr/scope-store.d.ts.map +1 -0
- package/dist/multipr/scope-store.js +182 -0
- package/dist/multipr/scope-store.js.map +1 -0
- package/dist/multipr/superseded.d.ts +133 -0
- package/dist/multipr/superseded.d.ts.map +1 -0
- package/dist/multipr/superseded.js +128 -0
- package/dist/multipr/superseded.js.map +1 -0
- package/dist/query/confirmed-facts.d.ts +56 -0
- package/dist/query/confirmed-facts.d.ts.map +1 -0
- package/dist/query/confirmed-facts.js +64 -0
- package/dist/query/confirmed-facts.js.map +1 -0
- package/dist/query/declared-value-closure.d.ts +126 -0
- package/dist/query/declared-value-closure.d.ts.map +1 -0
- package/dist/query/declared-value-closure.js +156 -0
- package/dist/query/declared-value-closure.js.map +1 -0
- package/dist/query/index.d.ts +28 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +15 -0
- package/dist/query/index.js.map +1 -0
- package/dist/query/memory.d.ts +20 -0
- package/dist/query/memory.d.ts.map +1 -0
- package/dist/query/memory.js +55 -0
- package/dist/query/memory.js.map +1 -0
- package/dist/query/provider.d.ts +127 -0
- package/dist/query/provider.d.ts.map +1 -0
- package/dist/query/provider.js +54 -0
- package/dist/query/provider.js.map +1 -0
- package/dist/query/queries.d.ts +119 -0
- package/dist/query/queries.d.ts.map +1 -0
- package/dist/query/queries.js +267 -0
- package/dist/query/queries.js.map +1 -0
- package/dist/query/refusal-fetch.d.ts +114 -0
- package/dist/query/refusal-fetch.d.ts.map +1 -0
- package/dist/query/refusal-fetch.js +200 -0
- package/dist/query/refusal-fetch.js.map +1 -0
- package/dist/query/refusal-questions.d.ts +123 -0
- package/dist/query/refusal-questions.d.ts.map +1 -0
- package/dist/query/refusal-questions.js +122 -0
- package/dist/query/refusal-questions.js.map +1 -0
- package/dist/query/root-cause-score.d.ts +218 -0
- package/dist/query/root-cause-score.d.ts.map +1 -0
- package/dist/query/root-cause-score.js +251 -0
- package/dist/query/root-cause-score.js.map +1 -0
- package/dist/query/row-closure-picture.d.ts +108 -0
- package/dist/query/row-closure-picture.d.ts.map +1 -0
- package/dist/query/row-closure-picture.js +131 -0
- package/dist/query/row-closure-picture.js.map +1 -0
- package/dist/query/similar-incidents.d.ts +76 -0
- package/dist/query/similar-incidents.d.ts.map +1 -0
- package/dist/query/similar-incidents.js +169 -0
- package/dist/query/similar-incidents.js.map +1 -0
- package/dist/query/sqlite.d.ts +13 -0
- package/dist/query/sqlite.d.ts.map +1 -0
- package/dist/query/sqlite.js +54 -0
- package/dist/query/sqlite.js.map +1 -0
- package/dist/query/traverse.d.ts +110 -0
- package/dist/query/traverse.d.ts.map +1 -0
- package/dist/query/traverse.js +0 -0
- package/dist/query/traverse.js.map +1 -0
- package/dist/query/unresolved.d.ts +195 -0
- package/dist/query/unresolved.d.ts.map +1 -0
- package/dist/query/unresolved.js +225 -0
- package/dist/query/unresolved.js.map +1 -0
- package/dist/query/verification-status.d.ts +134 -0
- package/dist/query/verification-status.d.ts.map +1 -0
- package/dist/query/verification-status.js +163 -0
- package/dist/query/verification-status.js.map +1 -0
- package/dist/recording/index.d.ts +26 -0
- package/dist/recording/index.d.ts.map +1 -0
- package/dist/recording/index.js +30 -0
- package/dist/recording/index.js.map +1 -0
- package/dist/recording/migrate.d.ts +22 -0
- package/dist/recording/migrate.d.ts.map +1 -0
- package/dist/recording/migrate.js +51 -0
- package/dist/recording/migrate.js.map +1 -0
- package/dist/recording/reader.d.ts +27 -0
- package/dist/recording/reader.d.ts.map +1 -0
- package/dist/recording/reader.js +55 -0
- package/dist/recording/reader.js.map +1 -0
- package/dist/recording/redact.d.ts +63 -0
- package/dist/recording/redact.d.ts.map +1 -0
- package/dist/recording/redact.js +98 -0
- package/dist/recording/redact.js.map +1 -0
- package/dist/recording/schema.d.ts +41 -0
- package/dist/recording/schema.d.ts.map +1 -0
- package/dist/recording/schema.js +104 -0
- package/dist/recording/schema.js.map +1 -0
- package/dist/recording/writer.d.ts +120 -0
- package/dist/recording/writer.d.ts.map +1 -0
- package/dist/recording/writer.js +81 -0
- package/dist/recording/writer.js.map +1 -0
- package/dist/scoping/fanout.d.ts +86 -0
- package/dist/scoping/fanout.d.ts.map +1 -0
- package/dist/scoping/fanout.js +95 -0
- package/dist/scoping/fanout.js.map +1 -0
- package/dist/scoping/index.d.ts +10 -0
- package/dist/scoping/index.d.ts.map +1 -0
- package/dist/scoping/index.js +6 -0
- package/dist/scoping/index.js.map +1 -0
- package/dist/scoping/score.d.ts +83 -0
- package/dist/scoping/score.d.ts.map +1 -0
- package/dist/scoping/score.js +125 -0
- package/dist/scoping/score.js.map +1 -0
- package/dist/scoping/tiers.d.ts +32 -0
- package/dist/scoping/tiers.d.ts.map +1 -0
- package/dist/scoping/tiers.js +35 -0
- package/dist/scoping/tiers.js.map +1 -0
- package/dist/scoping/traverse.d.ts +60 -0
- package/dist/scoping/traverse.d.ts.map +1 -0
- package/dist/scoping/traverse.js +172 -0
- package/dist/scoping/traverse.js.map +1 -0
- package/dist/scoping/weights.d.ts +97 -0
- package/dist/scoping/weights.d.ts.map +1 -0
- package/dist/scoping/weights.js +167 -0
- package/dist/scoping/weights.js.map +1 -0
- package/dist/sources/git/diff.d.ts +53 -0
- package/dist/sources/git/diff.d.ts.map +1 -0
- package/dist/sources/git/diff.js +140 -0
- package/dist/sources/git/diff.js.map +1 -0
- package/dist/sources/git/env.d.ts +2 -0
- package/dist/sources/git/env.d.ts.map +1 -0
- package/dist/sources/git/env.js +21 -0
- package/dist/sources/git/env.js.map +1 -0
- package/dist/sources/git/history.d.ts +140 -0
- package/dist/sources/git/history.d.ts.map +1 -0
- package/dist/sources/git/history.js +314 -0
- package/dist/sources/git/history.js.map +1 -0
- package/dist/sources/git/index.d.ts +7 -0
- package/dist/sources/git/index.d.ts.map +1 -0
- package/dist/sources/git/index.js +4 -0
- package/dist/sources/git/index.js.map +1 -0
- package/dist/sources/git/source.d.ts +95 -0
- package/dist/sources/git/source.d.ts.map +1 -0
- package/dist/sources/git/source.js +0 -0
- package/dist/sources/git/source.js.map +1 -0
- package/dist/sources/migrations/dialects.d.ts +59 -0
- package/dist/sources/migrations/dialects.d.ts.map +1 -0
- package/dist/sources/migrations/dialects.js +84 -0
- package/dist/sources/migrations/dialects.js.map +1 -0
- package/dist/sources/migrations/index.d.ts +3 -0
- package/dist/sources/migrations/index.d.ts.map +1 -0
- package/dist/sources/migrations/index.js +2 -0
- package/dist/sources/migrations/index.js.map +1 -0
- package/dist/sources/migrations/read.d.ts +113 -0
- package/dist/sources/migrations/read.d.ts.map +1 -0
- package/dist/sources/migrations/read.js +270 -0
- package/dist/sources/migrations/read.js.map +1 -0
- package/dist/sources/workspace/index.d.ts +3 -0
- package/dist/sources/workspace/index.d.ts.map +1 -0
- package/dist/sources/workspace/index.js +2 -0
- package/dist/sources/workspace/index.js.map +1 -0
- package/dist/sources/workspace/workspace.d.ts +64 -0
- package/dist/sources/workspace/workspace.d.ts.map +1 -0
- package/dist/sources/workspace/workspace.js +294 -0
- package/dist/sources/workspace/workspace.js.map +1 -0
- package/dist/store/driver/driver.d.ts +82 -0
- package/dist/store/driver/driver.d.ts.map +1 -0
- package/dist/store/driver/driver.js +31 -0
- package/dist/store/driver/driver.js.map +1 -0
- package/dist/store/driver/node-sqlite.d.ts +28 -0
- package/dist/store/driver/node-sqlite.d.ts.map +1 -0
- package/dist/store/driver/node-sqlite.js +188 -0
- package/dist/store/driver/node-sqlite.js.map +1 -0
- package/dist/store/index.d.ts +33 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +46 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/migrate.d.ts +68 -0
- package/dist/store/migrate.d.ts.map +1 -0
- package/dist/store/migrate.js +140 -0
- package/dist/store/migrate.js.map +1 -0
- package/dist/store/reader.d.ts +127 -0
- package/dist/store/reader.d.ts.map +1 -0
- package/dist/store/reader.js +269 -0
- package/dist/store/reader.js.map +1 -0
- package/dist/store/schema.d.ts +87 -0
- package/dist/store/schema.d.ts.map +1 -0
- package/dist/store/schema.js +322 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/writer.d.ts +116 -0
- package/dist/store/writer.d.ts.map +1 -0
- package/dist/store/writer.js +279 -0
- package/dist/store/writer.js.map +1 -0
- package/dist/tiers/certify.d.ts +375 -0
- package/dist/tiers/certify.d.ts.map +1 -0
- package/dist/tiers/certify.js +434 -0
- package/dist/tiers/certify.js.map +1 -0
- package/dist/tiers/index.d.ts +5 -0
- package/dist/tiers/index.d.ts.map +1 -0
- package/dist/tiers/index.js +3 -0
- package/dist/tiers/index.js.map +1 -0
- package/dist/tiers/ladder.d.ts +73 -0
- package/dist/tiers/ladder.d.ts.map +1 -0
- package/dist/tiers/ladder.js +197 -0
- package/dist/tiers/ladder.js.map +1 -0
- package/dist/validation/config-graph.d.ts +104 -0
- package/dist/validation/config-graph.d.ts.map +1 -0
- package/dist/validation/config-graph.js +205 -0
- package/dist/validation/config-graph.js.map +1 -0
- package/dist/validation/env.d.ts +243 -0
- package/dist/validation/env.d.ts.map +1 -0
- package/dist/validation/env.js +447 -0
- package/dist/validation/env.js.map +1 -0
- package/dist/validation/index.d.ts +16 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +9 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/join-substitution.d.ts +186 -0
- package/dist/validation/join-substitution.d.ts.map +1 -0
- package/dist/validation/join-substitution.js +191 -0
- package/dist/validation/join-substitution.js.map +1 -0
- package/dist/validation/migrations.d.ts +133 -0
- package/dist/validation/migrations.d.ts.map +1 -0
- package/dist/validation/migrations.js +315 -0
- package/dist/validation/migrations.js.map +1 -0
- package/dist/validation/nodes.d.ts +32 -0
- package/dist/validation/nodes.d.ts.map +1 -0
- package/dist/validation/nodes.js +45 -0
- package/dist/validation/nodes.js.map +1 -0
- package/dist/validation/rollback.d.ts +124 -0
- package/dist/validation/rollback.d.ts.map +1 -0
- package/dist/validation/rollback.js +302 -0
- package/dist/validation/rollback.js.map +1 -0
- package/dist/validation/route-drift.d.ts +108 -0
- package/dist/validation/route-drift.d.ts.map +1 -0
- package/dist/validation/route-drift.js +103 -0
- package/dist/validation/route-drift.js.map +1 -0
- package/dist/validation/sources.d.ts +153 -0
- package/dist/validation/sources.d.ts.map +1 -0
- package/dist/validation/sources.js +409 -0
- package/dist/validation/sources.js.map +1 -0
- package/dist/worker/index.d.ts +5 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +3 -0
- package/dist/worker/index.js.map +1 -0
- package/dist/worker/pool.d.ts +73 -0
- package/dist/worker/pool.d.ts.map +1 -0
- package/dist/worker/pool.js +203 -0
- package/dist/worker/pool.js.map +1 -0
- package/dist/worker/protocol.d.ts +91 -0
- package/dist/worker/protocol.d.ts.map +1 -0
- package/dist/worker/protocol.js +19 -0
- package/dist/worker/protocol.js.map +1 -0
- package/dist/worker/traversal.worker.d.ts +25 -0
- package/dist/worker/traversal.worker.d.ts.map +1 -0
- package/dist/worker/traversal.worker.js +124 -0
- package/dist/worker/traversal.worker.js.map +1 -0
- package/package.json +29 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading git history.
|
|
3
|
+
*
|
|
4
|
+
* No dependency: `git` is invoked directly. A library would buy parsing help and
|
|
5
|
+
* cost a dependency in a package that has none by design, and the format below
|
|
6
|
+
* is chosen so parsing is unambiguous rather than clever.
|
|
7
|
+
*
|
|
8
|
+
* ## Renames are resolved, not ignored
|
|
9
|
+
*
|
|
10
|
+
* `CHANGES_WITH` is file-to-file, and `FILE` identity is DEC-004's documented
|
|
11
|
+
* path fallback — a file's only stable name *is* its path. So a rename silently
|
|
12
|
+
* splits a file's history in two: the co-change weight built up over two years
|
|
13
|
+
* resets to zero, and nothing in the output reveals it happened. That is the
|
|
14
|
+
* exact failure DEC-004 exists to prevent, arriving through the one node type
|
|
15
|
+
* that cannot avoid it.
|
|
16
|
+
*
|
|
17
|
+
* The fix is `-M` plus a canonicalisation pass: history is walked newest-first,
|
|
18
|
+
* and every historical path is mapped forward to the name the file has today. It
|
|
19
|
+
* makes DEC-004's guarantee total for files that git can *follow*; where git's
|
|
20
|
+
* rename detection fails (a rewrite with no similarity), the guarantee stays
|
|
21
|
+
* partial and that is now a bounded, stated gap rather than an unbounded one.
|
|
22
|
+
*/
|
|
23
|
+
import { execFile } from "node:child_process";
|
|
24
|
+
import { promisify } from "node:util";
|
|
25
|
+
import { cleanGitEnv } from "./env.js";
|
|
26
|
+
const execFileAsync = promisify(execFile);
|
|
27
|
+
// Always strips GIT_DIR/GIT_WORK_TREE/GIT_INDEX_FILE/GIT_COMMON_DIR — see env.ts.
|
|
28
|
+
function run(command, args, options) {
|
|
29
|
+
return execFileAsync(command, args, {
|
|
30
|
+
...options,
|
|
31
|
+
encoding: "utf8",
|
|
32
|
+
env: cleanGitEnv(),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/** Record and field separators — chosen because they cannot occur in a path or subject. */
|
|
36
|
+
const RECORD = "";
|
|
37
|
+
const FIELD = "";
|
|
38
|
+
export async function gitHead(cwd) {
|
|
39
|
+
const { stdout } = await run("git", ["rev-parse", "HEAD"], { cwd });
|
|
40
|
+
return stdout.trim();
|
|
41
|
+
}
|
|
42
|
+
export async function isGitRepository(cwd) {
|
|
43
|
+
try {
|
|
44
|
+
const { stdout } = await run("git", ["rev-parse", "--is-inside-work-tree"], { cwd });
|
|
45
|
+
return stdout.trim() === "true";
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const LOG_FORMAT = `${RECORD}%H${FIELD}%at${FIELD}%s${FIELD}%b${FIELD}`;
|
|
52
|
+
/**
|
|
53
|
+
* Split one `--format=<RECORD>%H<FIELD>%at<FIELD>%s<FIELD>%b<FIELD>` record
|
|
54
|
+
* into its four fields plus the raw `--name-status` block that follows them.
|
|
55
|
+
* Shared by `readHistory` and `logForPath` — everything past this point
|
|
56
|
+
* (how paths are resolved, whether a rename mutates shared state) differs
|
|
57
|
+
* enough between the two that sharing further would cost more than it
|
|
58
|
+
* saves; see `readHistory`'s own resolve closure for why.
|
|
59
|
+
*/
|
|
60
|
+
function splitRecord(record) {
|
|
61
|
+
if (record.trim() === "")
|
|
62
|
+
return null;
|
|
63
|
+
const parts = record.split(FIELD);
|
|
64
|
+
const sha = parts[0]?.trim();
|
|
65
|
+
if (sha === undefined || sha === "")
|
|
66
|
+
return null;
|
|
67
|
+
return {
|
|
68
|
+
sha,
|
|
69
|
+
timestamp: Number(parts[1] ?? 0),
|
|
70
|
+
subject: parts[2] ?? "",
|
|
71
|
+
body: parts[3] ?? "",
|
|
72
|
+
nameStatus: parts.slice(4).join(FIELD),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Read history newest-first, with renames followed forward to today's paths.
|
|
77
|
+
*
|
|
78
|
+
* `--no-merges` is deliberate: a merge commit's file list is the union of both
|
|
79
|
+
* branches, so counting it as co-change would report every file in a large merge
|
|
80
|
+
* as coupled to every other. That is the single largest source of false
|
|
81
|
+
* `CHANGES_WITH` edges, and it is free to exclude.
|
|
82
|
+
*/
|
|
83
|
+
export async function readHistory(cwd, options = {}) {
|
|
84
|
+
const maxCommits = options.maxCommits ?? 2000;
|
|
85
|
+
const maxFiles = options.maxFilesPerCommit ?? 50;
|
|
86
|
+
const { stdout } = await run("git", ["log", "--no-merges", "-M", "--name-status", `--max-count=${maxCommits}`, `--format=${LOG_FORMAT}`], { cwd, maxBuffer: 256 * 1024 * 1024 });
|
|
87
|
+
/** Historical path → the name that file has today. */
|
|
88
|
+
const canonical = new Map();
|
|
89
|
+
const resolve = (path) => canonical.get(path) ?? path;
|
|
90
|
+
const commits = [];
|
|
91
|
+
for (const record of stdout.split(RECORD)) {
|
|
92
|
+
const split = splitRecord(record);
|
|
93
|
+
if (split === null)
|
|
94
|
+
continue;
|
|
95
|
+
const { sha, timestamp, subject, body, nameStatus } = split;
|
|
96
|
+
const changes = [];
|
|
97
|
+
for (const line of nameStatus.split("\n")) {
|
|
98
|
+
if (line.trim() === "")
|
|
99
|
+
continue;
|
|
100
|
+
const fields = line.split("\t");
|
|
101
|
+
const code = fields[0];
|
|
102
|
+
if (code === undefined)
|
|
103
|
+
continue;
|
|
104
|
+
if (code.startsWith("R") || code.startsWith("C")) {
|
|
105
|
+
const from = fields[1];
|
|
106
|
+
const to = fields[2];
|
|
107
|
+
if (from === undefined || to === undefined)
|
|
108
|
+
continue;
|
|
109
|
+
// Walking newest-first, so `to` is the newer name: anything older that
|
|
110
|
+
// called this file `from` is the same file, known today as whatever
|
|
111
|
+
// `to` currently resolves to.
|
|
112
|
+
if (code.startsWith("R"))
|
|
113
|
+
canonical.set(from, resolve(to));
|
|
114
|
+
changes.push({ path: resolve(to), status: code.startsWith("R") ? "R" : "C", fromPath: resolve(from) });
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const path = fields[1];
|
|
118
|
+
if (path === undefined)
|
|
119
|
+
continue;
|
|
120
|
+
const status = code[0];
|
|
121
|
+
if (status !== "A" && status !== "M" && status !== "D")
|
|
122
|
+
continue;
|
|
123
|
+
changes.push({ path: resolve(path), status });
|
|
124
|
+
}
|
|
125
|
+
// A commit touching hundreds of files is a reformat, a dependency bump or a
|
|
126
|
+
// move — it says nothing about which files are logically coupled, and
|
|
127
|
+
// including it makes every file in it co-change with every other. That is
|
|
128
|
+
// O(n^2) noise from a single commit.
|
|
129
|
+
if (changes.length === 0 || changes.length > maxFiles) {
|
|
130
|
+
commits.push({ sha, timestamp, subject, body, changes: [] });
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
commits.push({ sha, timestamp, subject, body, changes });
|
|
134
|
+
}
|
|
135
|
+
return commits;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Live commit history for one file, right now — distinct from `history.ts`'s
|
|
139
|
+
* `changesWith`, which only reads the graph's stored `CHANGES_WITH` ledger
|
|
140
|
+
* built once at `analyze` time. `--follow` tracks the file across renames;
|
|
141
|
+
* unlike `readHistory`'s whole-repo walk, each commit here reports its own
|
|
142
|
+
* historical name rather than today's — the rename itself is part of what a
|
|
143
|
+
* caller asking "what happened to this file" wants to see.
|
|
144
|
+
*/
|
|
145
|
+
export async function logForPath(cwd, path, options = {}) {
|
|
146
|
+
const maxCommits = options.maxCommits ?? 20;
|
|
147
|
+
const { stdout } = await run("git", ["log", "--no-merges", "--follow", "-M", "--name-status", `--max-count=${maxCommits}`, `--format=${LOG_FORMAT}`, "--", path], { cwd, maxBuffer: 64 * 1024 * 1024 });
|
|
148
|
+
const commits = [];
|
|
149
|
+
for (const record of stdout.split(RECORD)) {
|
|
150
|
+
const split = splitRecord(record);
|
|
151
|
+
if (split === null)
|
|
152
|
+
continue;
|
|
153
|
+
const { sha, timestamp, subject, body, nameStatus } = split;
|
|
154
|
+
// `--follow` scopes the walk to one file's lineage, so exactly one
|
|
155
|
+
// name-status line is expected per commit; the first is taken rather
|
|
156
|
+
// than asserting an invariant a future git version could quietly break.
|
|
157
|
+
const line = nameStatus.split("\n").find((l) => l.trim() !== "");
|
|
158
|
+
if (line === undefined)
|
|
159
|
+
continue;
|
|
160
|
+
const fields = line.split("\t");
|
|
161
|
+
const code = fields[0];
|
|
162
|
+
if (code === undefined)
|
|
163
|
+
continue;
|
|
164
|
+
if (code.startsWith("R") || code.startsWith("C")) {
|
|
165
|
+
const from = fields[1];
|
|
166
|
+
const to = fields[2];
|
|
167
|
+
if (from === undefined || to === undefined)
|
|
168
|
+
continue;
|
|
169
|
+
commits.push({
|
|
170
|
+
sha,
|
|
171
|
+
timestamp,
|
|
172
|
+
subject,
|
|
173
|
+
body,
|
|
174
|
+
status: code.startsWith("R") ? "R" : "C",
|
|
175
|
+
path: to,
|
|
176
|
+
fromPath: from,
|
|
177
|
+
});
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
const changePath = fields[1];
|
|
181
|
+
if (changePath === undefined)
|
|
182
|
+
continue;
|
|
183
|
+
const status = code[0];
|
|
184
|
+
if (status !== "A" && status !== "M" && status !== "D")
|
|
185
|
+
continue;
|
|
186
|
+
commits.push({ sha, timestamp, subject, body, status, path: changePath, fromPath: null });
|
|
187
|
+
}
|
|
188
|
+
const { stdout: countOut } = await run("git", ["log", "--no-merges", "--follow", "-M", "--format=%H", "--", path], { cwd, maxBuffer: 64 * 1024 * 1024 });
|
|
189
|
+
const totalTouching = countOut.split("\n").filter((l) => l.trim() !== "").length;
|
|
190
|
+
return { commits, totalTouching };
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Resolve one commit directly by sha, bypassing both `readHistory`'s
|
|
194
|
+
* reachability filter and its `--no-merges` exclusion.
|
|
195
|
+
*
|
|
196
|
+
* `readHistory` walks history from `HEAD` only — co-change must stay scoped to
|
|
197
|
+
* mainline, or work in progress on other branches would pollute
|
|
198
|
+
* `CHANGES_WITH` — and drops merge commits, because a merge's file list is
|
|
199
|
+
* the union of both branches (see the module doc). Both are correct for
|
|
200
|
+
* co-change. Neither is correct for resolving what a revert commit names:
|
|
201
|
+
* `git revert`'s `This reverts commit <sha>` line can point at a commit that
|
|
202
|
+
* **is** a merge ("Revert Merge pull request #N"), or at a commit that is
|
|
203
|
+
* real and still in the object database but not an ancestor of `HEAD` — an
|
|
204
|
+
* abandoned branch, or one deleted after a squash/rebase merge whose objects
|
|
205
|
+
* have not yet been garbage-collected. Neither case means the commit does
|
|
206
|
+
* not exist; `readHistory`'s index just cannot see it.
|
|
207
|
+
*
|
|
208
|
+
* `git cat-file` and `git diff-tree` operate on the object database directly
|
|
209
|
+
* and enforce neither constraint, so this is the fallback `createGitSource`
|
|
210
|
+
* uses once `readHistory`'s own index has already missed a revert target.
|
|
211
|
+
*
|
|
212
|
+
* Returns `null` only when the object genuinely does not exist — the
|
|
213
|
+
* squash-merge case, where the original commit was never an ancestor of
|
|
214
|
+
* anything that survived and its object is gone from the store. That is the
|
|
215
|
+
* one case nothing can resolve; the caller must disclose it rather than
|
|
216
|
+
* drop it silently (CLAUDE.md rule 7 — every fallback is labelled).
|
|
217
|
+
*
|
|
218
|
+
* File paths returned here are **not** forward-canonicalised through
|
|
219
|
+
* `readHistory`'s rename map — this commit was never visited by that walk.
|
|
220
|
+
* A file renamed on mainline *after* this commit landed will show under its
|
|
221
|
+
* name at the time, not today's name. That is a narrower, disclosed version
|
|
222
|
+
* of the same rename gap the module doc already states for the primary walk.
|
|
223
|
+
*/
|
|
224
|
+
export async function resolveCommitBySha(cwd, sha, maxFilesPerCommit = 50) {
|
|
225
|
+
try {
|
|
226
|
+
await run("git", ["cat-file", "-e", `${sha}^{commit}`], { cwd });
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
const format = `%at${FIELD}%s${FIELD}%b`;
|
|
232
|
+
const { stdout: metaOut } = await run("git", ["show", "--no-patch", `--format=${format}`, sha], { cwd });
|
|
233
|
+
const [tsRaw, subject, ...bodyParts] = metaOut.split(FIELD);
|
|
234
|
+
const timestamp = Number(tsRaw ?? 0);
|
|
235
|
+
const body = bodyParts.join(FIELD).replace(/\n+$/, "");
|
|
236
|
+
// Diff against the first parent: for an ordinary commit that is its only
|
|
237
|
+
// parent, so this is identical to a normal diff. For a merge commit it is
|
|
238
|
+
// "what this merge brought in relative to mainline" — exactly the file
|
|
239
|
+
// list a revert of that merge names. A root commit has no parent at all;
|
|
240
|
+
// fall back to a diff against the empty tree.
|
|
241
|
+
let nameStatus;
|
|
242
|
+
try {
|
|
243
|
+
({ stdout: nameStatus } = await run("git", ["diff-tree", "-M", "--no-commit-id", "--name-status", "-r", `${sha}^1`, sha], { cwd, maxBuffer: 64 * 1024 * 1024 }));
|
|
244
|
+
}
|
|
245
|
+
catch {
|
|
246
|
+
({ stdout: nameStatus } = await run("git", ["diff-tree", "-M", "--no-commit-id", "--name-status", "-r", "--root", sha], { cwd, maxBuffer: 64 * 1024 * 1024 }));
|
|
247
|
+
}
|
|
248
|
+
const changes = [];
|
|
249
|
+
for (const line of nameStatus.split("\n")) {
|
|
250
|
+
if (line.trim() === "")
|
|
251
|
+
continue;
|
|
252
|
+
const fields = line.split("\t");
|
|
253
|
+
const code = fields[0];
|
|
254
|
+
if (code === undefined)
|
|
255
|
+
continue;
|
|
256
|
+
if (code.startsWith("R") || code.startsWith("C")) {
|
|
257
|
+
const to = fields[2];
|
|
258
|
+
if (to === undefined)
|
|
259
|
+
continue;
|
|
260
|
+
changes.push({ path: to, status: code.startsWith("R") ? "R" : "C" });
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
const path = fields[1];
|
|
264
|
+
if (path === undefined)
|
|
265
|
+
continue;
|
|
266
|
+
const status = code[0];
|
|
267
|
+
if (status !== "A" && status !== "M" && status !== "D")
|
|
268
|
+
continue;
|
|
269
|
+
changes.push({ path, status });
|
|
270
|
+
}
|
|
271
|
+
return {
|
|
272
|
+
sha,
|
|
273
|
+
timestamp,
|
|
274
|
+
subject: subject ?? "",
|
|
275
|
+
body,
|
|
276
|
+
// Same reformat/dependency-bump cap `readHistory` applies — a revert of a
|
|
277
|
+
// merge that brought in hundreds of files should not fan
|
|
278
|
+
// INCIDENT_CORRELATED out into hundreds of edges either.
|
|
279
|
+
changes: changes.length > maxFilesPerCommit ? [] : changes,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Files changed between two refs — the input to PR analysis.
|
|
284
|
+
*
|
|
285
|
+
* `base...head` (three dots) rather than `base..head`, and the difference is the
|
|
286
|
+
* whole point: two dots diffs the two tips, so every file changed on `base`
|
|
287
|
+
* since the branch point appears in the result as though the PR had touched it.
|
|
288
|
+
* On a branch a week behind `main` that is most of the diff, and the blast
|
|
289
|
+
* radius it produces belongs to somebody else's change. Three dots diffs against
|
|
290
|
+
* the merge base, which is what a reviewer is actually looking at.
|
|
291
|
+
*
|
|
292
|
+
* Deletions are included. A deleted file's nodes may still be in the graph, and
|
|
293
|
+
* *what called the thing you just removed* is the most useful question a diff
|
|
294
|
+
* can be asked.
|
|
295
|
+
*/
|
|
296
|
+
export async function changedFiles(cwd, base, head = "HEAD") {
|
|
297
|
+
const { stdout } = await run("git", ["diff", "--name-only", "-M", `${base}...${head}`], {
|
|
298
|
+
cwd,
|
|
299
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
300
|
+
});
|
|
301
|
+
return stdout
|
|
302
|
+
.split("\n")
|
|
303
|
+
.map((l) => l.trim())
|
|
304
|
+
.filter((l) => l !== "");
|
|
305
|
+
}
|
|
306
|
+
/** `git show --name-only` for one commit, with today's paths where known. */
|
|
307
|
+
export async function filesInCommit(cwd, sha) {
|
|
308
|
+
const { stdout } = await run("git", ["show", "--no-merges", "--name-only", "--format=", sha], { cwd, maxBuffer: 64 * 1024 * 1024 });
|
|
309
|
+
return stdout
|
|
310
|
+
.split("\n")
|
|
311
|
+
.map((l) => l.trim())
|
|
312
|
+
.filter((l) => l !== "");
|
|
313
|
+
}
|
|
314
|
+
//# sourceMappingURL=history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/sources/git/history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,kFAAkF;AAClF,SAAS,GAAG,CACV,OAAe,EACf,IAAuB,EACvB,OAA4C;IAE5C,OAAO,aAAa,CAAC,OAAO,EAAE,IAAgB,EAAE;QAC9C,GAAG,OAAO;QACV,QAAQ,EAAE,MAAe;QACzB,GAAG,EAAE,WAAW,EAAE;KACnB,CAAC,CAAC;AACL,CAAC;AAED,2FAA2F;AAC3F,MAAM,MAAM,GAAG,GAAG,CAAC;AACnB,MAAM,KAAK,GAAG,GAAG,CAAC;AA0BlB,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,GAAW;IACvC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IACpE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,GAAW;IAC/C,IAAI,CAAC;QAC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;AAC7E,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,GAAW,EAAE,GAAW;IAC1D,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAC1B,KAAK,EACL,CAAC,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,CAAC,EACxD,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,CACrC,CAAC;IACF,OAAO,MAAM;SACV,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createGitSource, revertedShaOf, GIT_SOURCE_ID, GIT_SOURCE_VERSION, UNDIRECTED_EDGE_TYPES, } from "./source.ts";
|
|
2
|
+
export type { GitSourceOptions } from "./source.ts";
|
|
3
|
+
export { readHistory, gitHead, isGitRepository, filesInCommit, changedFiles, resolveCommitBySha, logForPath, } from "./history.ts";
|
|
4
|
+
export type { Commit, CommitChange, HistoryOptions, PathLogCommit, PathLogOptions, PathLogResult, } from "./history.ts";
|
|
5
|
+
export { gitDiff } from "./diff.ts";
|
|
6
|
+
export type { GitDiffFile, GitDiffOptions } from "./diff.ts";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sources/git/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EACL,WAAW,EACX,OAAO,EACP,eAAe,EACf,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,MAAM,EACN,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createGitSource, revertedShaOf, GIT_SOURCE_ID, GIT_SOURCE_VERSION, UNDIRECTED_EDGE_TYPES, } from "./source.js";
|
|
2
|
+
export { readHistory, gitHead, isGitRepository, filesInCommit, changedFiles, resolveCommitBySha, logForPath, } from "./history.js";
|
|
3
|
+
export { gitDiff } from "./diff.js";
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sources/git/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,WAAW,EACX,OAAO,EACP,eAAe,EACf,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,UAAU,GACX,MAAM,cAAc,CAAC;AAUtB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The git history `IRSource` — architecture §11.6 and §11.7.
|
|
3
|
+
*
|
|
4
|
+
* It is an `IRSource` and **not** a `LanguageAdapter`, which is the whole reason
|
|
5
|
+
* that split exists: history is a producer of IR with no parser, no language and
|
|
6
|
+
* no resolution beyond R0, and without the narrower interface it would need a
|
|
7
|
+
* second write path — and a second write path is how un-provenanced rows reach
|
|
8
|
+
* storage.
|
|
9
|
+
*
|
|
10
|
+
* ## Everything here is R0, and that is not a formality
|
|
11
|
+
*
|
|
12
|
+
* Co-change is not code analysis. It observes that two files were edited in the
|
|
13
|
+
* same commit, which is evidence about *people*, not about program structure.
|
|
14
|
+
* R0's confidence ceiling (DEC-019) therefore caps every edge this source emits
|
|
15
|
+
* at 0.5, and §11A.5's reliability cap makes any finding resting on one Class C
|
|
16
|
+
* — a behavioural prediction that must be live-confirmed or dropped. That is the
|
|
17
|
+
* correct treatment: "these two files usually change together" is a hint for a
|
|
18
|
+
* human, never a claim about what breaks.
|
|
19
|
+
*
|
|
20
|
+
* ## Precision over recall, applied three times
|
|
21
|
+
*
|
|
22
|
+
* 1. **Merge commits are excluded from co-change.** A merge's file list is the
|
|
23
|
+
* union of both branches, so counting it would report every file in a large
|
|
24
|
+
* merge as coupled to every other. This exclusion is scoped to co-change —
|
|
25
|
+
* it does **not** apply to resolving what a revert names (see below): a
|
|
26
|
+
* revert of "Merge pull request #N" is a real incident whose target
|
|
27
|
+
* happens to be a merge commit, and excluding it from co-change is not a
|
|
28
|
+
* reason to also make it unresolvable as an incident.
|
|
29
|
+
* 2. **Large commits are excluded.** A commit touching hundreds of files is a
|
|
30
|
+
* reformat or a dependency bump; including it adds O(n²) edges that mean
|
|
31
|
+
* nothing.
|
|
32
|
+
* 3. **Only explicit reverts become incidents.** A commit whose message merely
|
|
33
|
+
* contains "fix" is not evidence of an incident. `git revert` writes a
|
|
34
|
+
* machine-generated `This reverts commit <sha>.` line, and that is the only
|
|
35
|
+
* signal used.
|
|
36
|
+
*
|
|
37
|
+
* ## Resolving what a revert names
|
|
38
|
+
*
|
|
39
|
+
* `readHistory` indexes commits reachable from `HEAD`, minus merges. A revert
|
|
40
|
+
* commit's target sha can miss that index for two reasons that have nothing to
|
|
41
|
+
* do with whether the incident is real: the target is a merge commit (excluded
|
|
42
|
+
* above), or the target was never merged as itself — a squash/rebase-merge
|
|
43
|
+
* workflow (GitHub's default) discards the original commits and only the
|
|
44
|
+
* squashed commit survives on `HEAD`, so "Revert PR #N" names a sha that is
|
|
45
|
+
* either real-but-unreachable (still sitting on an abandoned branch) or
|
|
46
|
+
* genuinely gone (garbage-collected after the branch was deleted). Measured
|
|
47
|
+
* against 5 real repos, 6 of 9 real reverts fell into these two buckets and
|
|
48
|
+
* were silently dropped by a naive index lookup.
|
|
49
|
+
*
|
|
50
|
+
* `resolveCommitBySha` is the fallback: it goes straight to the object
|
|
51
|
+
* database (`git cat-file` / `git diff-tree`), which enforces neither
|
|
52
|
+
* constraint `readHistory` applies. It resolves the merge case and the
|
|
53
|
+
* unreachable-but-present case. Only the genuinely-gone case still fails, and
|
|
54
|
+
* that failure is disclosed via `unresolved` (below) rather than dropped with
|
|
55
|
+
* no trace — this is the fallback CLAUDE.md rule 7 requires labelling.
|
|
56
|
+
*/
|
|
57
|
+
import { type IRSource } from "@descryy/ir";
|
|
58
|
+
import { type Commit, type HistoryOptions } from "./history.ts";
|
|
59
|
+
export declare const GIT_SOURCE_ID = "git-history";
|
|
60
|
+
export declare const GIT_SOURCE_VERSION = "0.1.0";
|
|
61
|
+
/**
|
|
62
|
+
* `CHANGES_WITH` is a symmetric relationship stored in one canonical direction.
|
|
63
|
+
*
|
|
64
|
+
* Emitting both directions would double the edge count and make the pair count
|
|
65
|
+
* twice in any per-edge aggregate. The cost is that a caller must traverse it
|
|
66
|
+
* undirected — `direction: "both"` — and forgetting that yields a *missing*
|
|
67
|
+
* edge, which is a disclosed gap rather than a wrong answer. That asymmetry is
|
|
68
|
+
* why this is the safe default and not the convenient one.
|
|
69
|
+
*/
|
|
70
|
+
export declare const UNDIRECTED_EDGE_TYPES: readonly ["CHANGES_WITH"];
|
|
71
|
+
export interface GitSourceOptions extends HistoryOptions {
|
|
72
|
+
readonly repo: string;
|
|
73
|
+
readonly cwd: string;
|
|
74
|
+
/**
|
|
75
|
+
* Minimum times two files must change together before an edge is emitted.
|
|
76
|
+
*
|
|
77
|
+
* **Provisional.** The architecture's own illustration is that 18x co-change
|
|
78
|
+
* is a warning and 2x is noise, which fixes the shape of the threshold but not
|
|
79
|
+
* its value; §32's tuning register has no number for it either. 5 is a
|
|
80
|
+
* defensible floor for a repo with a few hundred commits and is expected to
|
|
81
|
+
* move once measured. See DEC-033.
|
|
82
|
+
*/
|
|
83
|
+
readonly minSupport?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Minimum `support / timesTheSourceFileChanged`.
|
|
86
|
+
*
|
|
87
|
+
* Support alone over-reports the files that change constantly: a config file
|
|
88
|
+
* touched in half of all commits co-occurs with everything. Confidence is what
|
|
89
|
+
* separates "coupled" from "always busy".
|
|
90
|
+
*/
|
|
91
|
+
readonly minConfidence?: number;
|
|
92
|
+
}
|
|
93
|
+
export declare function revertedShaOf(commit: Commit): string | null;
|
|
94
|
+
export declare function createGitSource(options: GitSourceOptions): IRSource;
|
|
95
|
+
//# sourceMappingURL=source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../src/sources/git/source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,EAQL,KAAK,QAAQ,EAGd,MAAM,aAAa,CAAC;AAErB,OAAO,EAKL,KAAK,MAAM,EACX,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAEtB,eAAO,MAAM,aAAa,gBAAgB,CAAC;AAC3C,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAG1C;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,2BAA4B,CAAC;AAE/D,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;;;;OAQG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,aAA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S,EAAE,IAAI;gBACf,UAAU,EAAE,WAAW;gBACvB,WAAW;gBACX,YAAY,EAAE,EAAE;gBAChB,iBAAiB,EAAE,CAAC;gBACpB,KAAK;gBACL,KAAK;gBACL,UAAU;aACX,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,IAAY,EAAE,SAA6B,EAAE,SAAiB;IAChF,OAAO;QACL,IAAI;QACJ,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;QACjD,SAAS;QACT,UAAU,EAAE,WAAW;QACvB,WAAW,EAAE,EAAE;QACf,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,CAAC;QACpB,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,EAAE;QACT,UAAU,EAAE,EAAE;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dialect table — the only place in `descry-core` that describes a migration
|
|
3
|
+
* file format, and it does so **without naming a single tool**.
|
|
4
|
+
*
|
|
5
|
+
* That is not a dodge around the boundary lint; it is the design the lint is a
|
|
6
|
+
* proxy for. Rule 1 forbids a language or framework name above the Canonical IR.
|
|
7
|
+
* A migration-file reader is a producer and sits below it — exactly like
|
|
8
|
+
* `sources/git` and like an adapter — so naming a tool here would be defensible.
|
|
9
|
+
* It turned out not to be necessary: every distinction §14.6 needs is a
|
|
10
|
+
* distinction about **shape**, and a table written in shapes is one an unfamiliar
|
|
11
|
+
* reader can check against a file without knowing which ecosystem it came from.
|
|
12
|
+
*
|
|
13
|
+
* The consequence worth having is that `read.ts` knows nothing but this table, so
|
|
14
|
+
* **adding a dialect is a data change and never a code change**.
|
|
15
|
+
*
|
|
16
|
+
* `parentsKind` names a shape:
|
|
17
|
+
*
|
|
18
|
+
* | kind | the captured expression is |
|
|
19
|
+
* | --- | --- |
|
|
20
|
+
* | `single-or-none` | one quoted id, a null literal, or a tuple for a merge |
|
|
21
|
+
* | `id-list` | a bracketed list of quoted ids |
|
|
22
|
+
* | `pair-list` | a bracketed list of two-element tuples, joined with `/` |
|
|
23
|
+
*
|
|
24
|
+
* Every dialect here is **R0** — a regex over source text. DEC-058 and §15.3: a
|
|
25
|
+
* record carries the resolution of its own evidence, so a head conflict computed
|
|
26
|
+
* from these caps at class C however certain the arithmetic on top of it. Class A
|
|
27
|
+
* needs the framework's own migration history, which is DEC-115's promotion path
|
|
28
|
+
* and needs the tool installed and run. **Nothing here installs or runs
|
|
29
|
+
* anything.**
|
|
30
|
+
*/
|
|
31
|
+
export type ParentsKind = "single-or-none" | "id-list" | "pair-list";
|
|
32
|
+
export interface Dialect {
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly displayName: string;
|
|
35
|
+
readonly files: readonly string[];
|
|
36
|
+
/** Read from the file's text. */
|
|
37
|
+
readonly revision?: string;
|
|
38
|
+
/** Read from the file's name, when the format puts identity in the path. */
|
|
39
|
+
readonly revisionFromFilename?: string;
|
|
40
|
+
readonly parents: string;
|
|
41
|
+
readonly parentsKind: ParentsKind;
|
|
42
|
+
/** A second, additive predecessor channel where the format has one. */
|
|
43
|
+
readonly alsoParents?: string;
|
|
44
|
+
readonly why: string;
|
|
45
|
+
}
|
|
46
|
+
export interface RefusedFamily {
|
|
47
|
+
readonly id: string;
|
|
48
|
+
readonly files: readonly string[];
|
|
49
|
+
readonly why: string;
|
|
50
|
+
}
|
|
51
|
+
export declare const DIALECTS: readonly Dialect[];
|
|
52
|
+
/**
|
|
53
|
+
* Families this producer declines, by design rather than by failure.
|
|
54
|
+
*
|
|
55
|
+
* The refusal is the interesting half of this table, so it is data too — a
|
|
56
|
+
* refused file produces a row carrying this sentence, not a silence.
|
|
57
|
+
*/
|
|
58
|
+
export declare const REFUSED: readonly RefusedFamily[];
|
|
59
|
+
//# sourceMappingURL=dialects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialects.d.ts","sourceRoot":"","sources":["../../../src/sources/migrations/dialects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,SAAS,GAAG,WAAW,CAAC;AAErE,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,iCAAiC;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,uEAAuE;IACvE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,QAAQ,EAAE,SAAS,OAAO,EAyBtC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,OAAO,EAAE,SAAS,aAAa,EAuB3C,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dialect table — the only place in `descry-core` that describes a migration
|
|
3
|
+
* file format, and it does so **without naming a single tool**.
|
|
4
|
+
*
|
|
5
|
+
* That is not a dodge around the boundary lint; it is the design the lint is a
|
|
6
|
+
* proxy for. Rule 1 forbids a language or framework name above the Canonical IR.
|
|
7
|
+
* A migration-file reader is a producer and sits below it — exactly like
|
|
8
|
+
* `sources/git` and like an adapter — so naming a tool here would be defensible.
|
|
9
|
+
* It turned out not to be necessary: every distinction §14.6 needs is a
|
|
10
|
+
* distinction about **shape**, and a table written in shapes is one an unfamiliar
|
|
11
|
+
* reader can check against a file without knowing which ecosystem it came from.
|
|
12
|
+
*
|
|
13
|
+
* The consequence worth having is that `read.ts` knows nothing but this table, so
|
|
14
|
+
* **adding a dialect is a data change and never a code change**.
|
|
15
|
+
*
|
|
16
|
+
* `parentsKind` names a shape:
|
|
17
|
+
*
|
|
18
|
+
* | kind | the captured expression is |
|
|
19
|
+
* | --- | --- |
|
|
20
|
+
* | `single-or-none` | one quoted id, a null literal, or a tuple for a merge |
|
|
21
|
+
* | `id-list` | a bracketed list of quoted ids |
|
|
22
|
+
* | `pair-list` | a bracketed list of two-element tuples, joined with `/` |
|
|
23
|
+
*
|
|
24
|
+
* Every dialect here is **R0** — a regex over source text. DEC-058 and §15.3: a
|
|
25
|
+
* record carries the resolution of its own evidence, so a head conflict computed
|
|
26
|
+
* from these caps at class C however certain the arithmetic on top of it. Class A
|
|
27
|
+
* needs the framework's own migration history, which is DEC-115's promotion path
|
|
28
|
+
* and needs the tool installed and run. **Nothing here installs or runs
|
|
29
|
+
* anything.**
|
|
30
|
+
*/
|
|
31
|
+
export const DIALECTS = [
|
|
32
|
+
{
|
|
33
|
+
id: "revision-chain",
|
|
34
|
+
displayName: "revision/down-revision chain",
|
|
35
|
+
files: ["**/versions/*.py", "**/migrations/versions/*.py"],
|
|
36
|
+
revision: "^\\s*revision(?:\\s*:\\s*str)?\\s*=\\s*[\"']([^\"']+)[\"']",
|
|
37
|
+
parents: "^\\s*down_revision(?:\\s*:\\s*[^=]+)?\\s*=\\s*(.+)$",
|
|
38
|
+
parentsKind: "single-or-none",
|
|
39
|
+
alsoParents: "^\\s*depends_on(?:\\s*:\\s*[^=]+)?\\s*=\\s*(.+)$",
|
|
40
|
+
why: "Each revision names exactly one predecessor, or a null literal for the root; a merge " +
|
|
41
|
+
"revision names a tuple. A declared DAG, and the tool itself refuses to run with more " +
|
|
42
|
+
"than one head — which is the failure §14.6 predicts.",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "dependency-list",
|
|
46
|
+
displayName: "dependency list",
|
|
47
|
+
files: ["**/migrations/*.py"],
|
|
48
|
+
revisionFromFilename: "^(\\d{4}[^.]*)\\.py$",
|
|
49
|
+
parents: "dependencies\\s*=\\s*\\[([\\s\\S]*?)\\]",
|
|
50
|
+
parentsKind: "pair-list",
|
|
51
|
+
why: "Each migration declares its predecessors as (application, name) pairs. A declared DAG, " +
|
|
52
|
+
"and the tool detects conflicting leaves by name.",
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
/**
|
|
56
|
+
* Families this producer declines, by design rather than by failure.
|
|
57
|
+
*
|
|
58
|
+
* The refusal is the interesting half of this table, so it is data too — a
|
|
59
|
+
* refused file produces a row carrying this sentence, not a silence.
|
|
60
|
+
*/
|
|
61
|
+
export const REFUSED = [
|
|
62
|
+
{
|
|
63
|
+
id: "timestamp-ordered-directory",
|
|
64
|
+
files: ["**/database/migrations/*.php", "**/db/migrate/*.rb"],
|
|
65
|
+
why: "This family does not declare parents and has no head concept to conflict. A file is " +
|
|
66
|
+
"pending or applied, and the applied set is a SET tracked in a table, not a chain. Two " +
|
|
67
|
+
"changes each adding a migration is the normal case and it succeeds — there is no " +
|
|
68
|
+
"multiple-head failure to predict. Synthesising a parent from the previous file by " +
|
|
69
|
+
"timestamp would manufacture exactly the DAG the check consumes, and would then report " +
|
|
70
|
+
"a conflict for EVERY pair of changes that each add a migration, since both would carry " +
|
|
71
|
+
"the same synthesised parent: a maybe-list built from an invented format, published " +
|
|
72
|
+
"beside real structural facts and indistinguishable from them. " +
|
|
73
|
+
"MEASURED, AND BY THIS METHOD, because the method belongs beside the number: a WIDE net " +
|
|
74
|
+
"over 604 migrations in three real applications — every file under the directory, " +
|
|
75
|
+
"matched against every spelling of a revision or parent declaration this producer knows, " +
|
|
76
|
+
"plus a bare /parent/ sweep — returning 0. A swept zero and a leftover residual read " +
|
|
77
|
+
"identically as counts, so which one this is has to be said: it was DERIVED from a net " +
|
|
78
|
+
"cast wider than the claim, not expected and then confirmed. The twelve files the bare " +
|
|
79
|
+
"sweep did match matched a `parent_id` COLUMN and one comment. The second pattern is " +
|
|
80
|
+
"refused on documented behaviour only, because no corpus using it was available — a " +
|
|
81
|
+
"weaker basis, labelled rather than folded in beside the measured one.",
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
//# sourceMappingURL=dialects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialects.js","sourceRoot":"","sources":["../../../src/sources/migrations/dialects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAyBH,MAAM,CAAC,MAAM,QAAQ,GAAuB;IAC1C;QACE,EAAE,EAAE,gBAAgB;QACpB,WAAW,EAAE,8BAA8B;QAC3C,KAAK,EAAE,CAAC,kBAAkB,EAAE,6BAA6B,CAAC;QAC1D,QAAQ,EAAE,4DAA4D;QACtE,OAAO,EAAE,qDAAqD;QAC9D,WAAW,EAAE,gBAAgB;QAC7B,WAAW,EAAE,kDAAkD;QAC/D,GAAG,EACD,uFAAuF;YACvF,uFAAuF;YACvF,sDAAsD;KACzD;IACD;QACE,EAAE,EAAE,iBAAiB;QACrB,WAAW,EAAE,iBAAiB;QAC9B,KAAK,EAAE,CAAC,oBAAoB,CAAC;QAC7B,oBAAoB,EAAE,sBAAsB;QAC5C,OAAO,EAAE,yCAAyC;QAClD,WAAW,EAAE,WAAW;QACxB,GAAG,EACD,yFAAyF;YACzF,kDAAkD;KACrD;CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAA6B;IAC/C;QACE,EAAE,EAAE,6BAA6B;QACjC,KAAK,EAAE,CAAC,8BAA8B,EAAE,oBAAoB,CAAC;QAC7D,GAAG,EACD,sFAAsF;YACtF,wFAAwF;YACxF,mFAAmF;YACnF,oFAAoF;YACpF,wFAAwF;YACxF,yFAAyF;YACzF,qFAAqF;YACrF,gEAAgE;YAChE,yFAAyF;YACzF,mFAAmF;YACnF,0FAA0F;YAC1F,sFAAsF;YACtF,wFAAwF;YACxF,wFAAwF;YACxF,sFAAsF;YACtF,qFAAqF;YACrF,uEAAuE;KAC1E;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sources/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9D,YAAY,EACV,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,WAAW,GACZ,MAAM,WAAW,CAAC"}
|