@descryy/adapter-common 0.3.0 → 0.3.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/dist/file-node.d.ts +35 -0
- package/dist/file-node.d.ts.map +1 -0
- package/dist/file-node.js +50 -0
- package/dist/file-node.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared, language-blind `FILE`-node minter.
|
|
3
|
+
*
|
|
4
|
+
* `FILE` is one of the fifteen canonical node types and was already real and
|
|
5
|
+
* populated before this file existed — `packages/core/src/sources/git/
|
|
6
|
+
* source.ts` in `descry-core` mints one per touched file, for `CHANGES_WITH`
|
|
7
|
+
* blast-radius edges, via `nodeId(scope, "FILE", fileQsp(path), null)`. No
|
|
8
|
+
* *adapter* had ever minted one; every adapter's own filesystem-level
|
|
9
|
+
* fallback used `MODULE` instead (see `adapter-python`'s `degradedGraph`).
|
|
10
|
+
*
|
|
11
|
+
* This helper exists so an adapter's degraded-extraction path can assert the
|
|
12
|
+
* one fact that survives a parse failure — the file exists — using the exact
|
|
13
|
+
* id computation the git-history producer already uses. Two `FILE` nodes for
|
|
14
|
+
* the same repo-relative path, one minted here and one minted by git
|
|
15
|
+
* history, hash to the same id and merge into one node rather than
|
|
16
|
+
* duplicate. `producedBy` is deliberately excluded from identity (it is not
|
|
17
|
+
* part of `nodeId`'s hash inputs) for the same reason: two adapters
|
|
18
|
+
* degrading on the same file must also merge, not fork.
|
|
19
|
+
*
|
|
20
|
+
* Filesystem-level only, per the product owner's ruling on
|
|
21
|
+
* `DEC-NEXT-degraded-graph-shape-for-adapters-without-one` (2026-09-15): a
|
|
22
|
+
* fallback "may assert filesystem-level facts... and nothing more." No
|
|
23
|
+
* language is guessed from the extension (DEC-026's reasoning, restated here
|
|
24
|
+
* for `FILE` the way `source.ts` already states it for its own).
|
|
25
|
+
*/
|
|
26
|
+
import { type IdentityScope, type IRNode } from "@descryy/ir";
|
|
27
|
+
/**
|
|
28
|
+
* Mint a `FILE` node for one repo-relative path.
|
|
29
|
+
*
|
|
30
|
+
* `producedBy` names the caller for provenance only — it plays no part in
|
|
31
|
+
* the node's identity, so callers must not rely on it to keep two callers'
|
|
32
|
+
* nodes apart.
|
|
33
|
+
*/
|
|
34
|
+
export declare function fileNode(scope: IdentityScope, repoRelativePath: string, producedBy: string): IRNode;
|
|
35
|
+
//# sourceMappingURL=file-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-node.d.ts","sourceRoot":"","sources":["../src/file-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAmB,KAAK,aAAa,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAE/E;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAenG"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared, language-blind `FILE`-node minter.
|
|
3
|
+
*
|
|
4
|
+
* `FILE` is one of the fifteen canonical node types and was already real and
|
|
5
|
+
* populated before this file existed — `packages/core/src/sources/git/
|
|
6
|
+
* source.ts` in `descry-core` mints one per touched file, for `CHANGES_WITH`
|
|
7
|
+
* blast-radius edges, via `nodeId(scope, "FILE", fileQsp(path), null)`. No
|
|
8
|
+
* *adapter* had ever minted one; every adapter's own filesystem-level
|
|
9
|
+
* fallback used `MODULE` instead (see `adapter-python`'s `degradedGraph`).
|
|
10
|
+
*
|
|
11
|
+
* This helper exists so an adapter's degraded-extraction path can assert the
|
|
12
|
+
* one fact that survives a parse failure — the file exists — using the exact
|
|
13
|
+
* id computation the git-history producer already uses. Two `FILE` nodes for
|
|
14
|
+
* the same repo-relative path, one minted here and one minted by git
|
|
15
|
+
* history, hash to the same id and merge into one node rather than
|
|
16
|
+
* duplicate. `producedBy` is deliberately excluded from identity (it is not
|
|
17
|
+
* part of `nodeId`'s hash inputs) for the same reason: two adapters
|
|
18
|
+
* degrading on the same file must also merge, not fork.
|
|
19
|
+
*
|
|
20
|
+
* Filesystem-level only, per the product owner's ruling on
|
|
21
|
+
* `DEC-NEXT-degraded-graph-shape-for-adapters-without-one` (2026-09-15): a
|
|
22
|
+
* fallback "may assert filesystem-level facts... and nothing more." No
|
|
23
|
+
* language is guessed from the extension (DEC-026's reasoning, restated here
|
|
24
|
+
* for `FILE` the way `source.ts` already states it for its own).
|
|
25
|
+
*/
|
|
26
|
+
import { fileQsp, nodeId } from "@descryy/ir";
|
|
27
|
+
/**
|
|
28
|
+
* Mint a `FILE` node for one repo-relative path.
|
|
29
|
+
*
|
|
30
|
+
* `producedBy` names the caller for provenance only — it plays no part in
|
|
31
|
+
* the node's identity, so callers must not rely on it to keep two callers'
|
|
32
|
+
* nodes apart.
|
|
33
|
+
*/
|
|
34
|
+
export function fileNode(scope, repoRelativePath, producedBy) {
|
|
35
|
+
return {
|
|
36
|
+
id: nodeId(scope, "FILE", fileQsp(repoRelativePath), null),
|
|
37
|
+
type: "FILE",
|
|
38
|
+
name: repoRelativePath.split("/").pop() ?? repoRelativePath,
|
|
39
|
+
file: repoRelativePath,
|
|
40
|
+
range: null,
|
|
41
|
+
// Guessing language from the extension would be a language decision made
|
|
42
|
+
// by a helper with no business making one — the same reasoning
|
|
43
|
+
// `source.ts` states for its own FILE nodes.
|
|
44
|
+
language: null,
|
|
45
|
+
producedBy,
|
|
46
|
+
resolution: 0,
|
|
47
|
+
attrs: { parsed: false },
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=file-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-node.js","sourceRoot":"","sources":["../src/file-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAmC,MAAM,aAAa,CAAC;AAE/E;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAoB,EAAE,gBAAwB,EAAE,UAAkB;IACzF,OAAO;QACL,EAAE,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC;QAC1D,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,gBAAgB;QAC3D,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,IAAI;QACX,yEAAyE;QACzE,+DAA+D;QAC/D,6CAA6C;QAC7C,QAAQ,EAAE,IAAI;QACd,UAAU;QACV,UAAU,EAAE,CAAC;QACb,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;KACzB,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,4 +11,5 @@ export type { DiscoverOptions } from "./discover.ts";
|
|
|
11
11
|
export { isolateFile } from "./isolate.ts";
|
|
12
12
|
export type { Isolated, IsolatedFailure } from "./isolate.ts";
|
|
13
13
|
export { extractOrDegrade, describeThrown } from "./degrade.ts";
|
|
14
|
+
export { fileNode } from "./file-node.ts";
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACvG,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACvG,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,4 +9,5 @@
|
|
|
9
9
|
export { discover, globToRegExp, ignoredDirectories, matchesAny, toRepoRelative } from "./discover.js";
|
|
10
10
|
export { isolateFile } from "./isolate.js";
|
|
11
11
|
export { extractOrDegrade, describeThrown } from "./degrade.js";
|
|
12
|
+
export { fileNode } from "./file-node.js";
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEvG,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEvG,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@descryy/adapter-common",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared adapter infrastructure: file discovery, glob matching, path normalisation. No language knowledge.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -32,5 +32,7 @@
|
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "tsc -b"
|
|
34
34
|
},
|
|
35
|
-
"dependencies": {
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@descryy/ir": "0.10.0"
|
|
37
|
+
}
|
|
36
38
|
}
|