@0xsarwagya/ontoly-diagnostics 0.1.0-alpha.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sarwagya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # @0xsarwagya/ontoly-diagnostics
2
+
3
+ Shared diagnostic constructors for Ontoly.
4
+
5
+ This package is part of [Ontoly](https://github.com/0xsarwagya/ontoly), a TypeScript-native software intelligence engine that builds a deterministic Software Graph.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pnpm add @0xsarwagya/ontoly-diagnostics
11
+ ```
12
+
13
+ ## Status
14
+
15
+ Alpha package for Ontoly v0.1.0-alpha.1. The public API is versioned with the Software Graph and RFC process.
16
+
17
+ ## Links
18
+
19
+ - [Repository](https://github.com/0xsarwagya/ontoly)
20
+ - [Documentation](https://oss.sarwagya.wtf/ontoly)
21
+ - [Issues](https://github.com/0xsarwagya/ontoly/issues)
@@ -0,0 +1,15 @@
1
+ import { type DiagnosticSeverity, type JsonObject, type SoftwareGraphDiagnostic, type SourceSpan } from "@0xsarwagya/ontoly-core";
2
+ export interface CreateDiagnosticInput {
3
+ readonly code: string;
4
+ readonly severity: DiagnosticSeverity;
5
+ readonly message: string;
6
+ readonly nodeId?: string | undefined;
7
+ readonly edgeId?: string | undefined;
8
+ readonly span?: SourceSpan | undefined;
9
+ readonly metadata?: JsonObject | undefined;
10
+ }
11
+ export declare function createDiagnostic(input: CreateDiagnosticInput): SoftwareGraphDiagnostic;
12
+ export declare function brokenImportDiagnostic(file: string, specifier: string): SoftwareGraphDiagnostic;
13
+ export declare function circularImportDiagnostic(path: readonly string[]): SoftwareGraphDiagnostic;
14
+ export declare function lowConfidenceDiagnostic(message: string, metadata?: JsonObject): SoftwareGraphDiagnostic;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC5B,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CAC5C;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,uBAAuB,CAkBtF;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,uBAAuB,CAO/F;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,uBAAuB,CAOzF;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,UAAU,GACpB,uBAAuB,CAOzB"}
package/dist/index.js ADDED
@@ -0,0 +1,56 @@
1
+ // src/index.ts
2
+ import {
3
+ createDiagnosticId
4
+ } from "@0xsarwagya/ontoly-core";
5
+ function createDiagnostic(input) {
6
+ const location = input.span ? `${input.span.file}:${input.span.startLine}:${input.span.startColumn}` : input.nodeId ?? input.edgeId ?? "";
7
+ const base = {
8
+ id: createDiagnosticId(input.code, input.message, location),
9
+ code: input.code,
10
+ severity: input.severity,
11
+ message: input.message
12
+ };
13
+ return withOptionalDiagnosticProperties(base, {
14
+ nodeId: input.nodeId,
15
+ edgeId: input.edgeId,
16
+ span: input.span,
17
+ metadata: input.metadata
18
+ });
19
+ }
20
+ function brokenImportDiagnostic(file, specifier) {
21
+ return createDiagnostic({
22
+ code: "BROKEN_IMPORT",
23
+ severity: "warning",
24
+ message: `Could not resolve import "${specifier}" from ${file}.`,
25
+ metadata: { file, specifier }
26
+ });
27
+ }
28
+ function circularImportDiagnostic(path) {
29
+ return createDiagnostic({
30
+ code: "CIRCULAR_IMPORT",
31
+ severity: "warning",
32
+ message: `Circular import detected: ${path.join(" -> ")}.`,
33
+ metadata: { path: [...path] }
34
+ });
35
+ }
36
+ function lowConfidenceDiagnostic(message, metadata) {
37
+ return createDiagnostic({
38
+ code: "LOW_CONFIDENCE_INFERENCE",
39
+ severity: "info",
40
+ message,
41
+ metadata
42
+ });
43
+ }
44
+ function withOptionalDiagnosticProperties(target, optional) {
45
+ return {
46
+ ...target,
47
+ ...Object.fromEntries(Object.entries(optional).filter(([, value]) => value !== void 0))
48
+ };
49
+ }
50
+ export {
51
+ brokenImportDiagnostic,
52
+ circularImportDiagnostic,
53
+ createDiagnostic,
54
+ lowConfidenceDiagnostic
55
+ };
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n createDiagnosticId,\n type DiagnosticSeverity,\n type JsonObject,\n type SoftwareGraphDiagnostic,\n type SourceSpan,\n} from \"@0xsarwagya/ontoly-core\";\n\nexport interface CreateDiagnosticInput {\n readonly code: string;\n readonly severity: DiagnosticSeverity;\n readonly message: string;\n readonly nodeId?: string | undefined;\n readonly edgeId?: string | undefined;\n readonly span?: SourceSpan | undefined;\n readonly metadata?: JsonObject | undefined;\n}\n\nexport function createDiagnostic(input: CreateDiagnosticInput): SoftwareGraphDiagnostic {\n const location = input.span\n ? `${input.span.file}:${input.span.startLine}:${input.span.startColumn}`\n : input.nodeId ?? input.edgeId ?? \"\";\n\n const base: SoftwareGraphDiagnostic = {\n id: createDiagnosticId(input.code, input.message, location),\n code: input.code,\n severity: input.severity,\n message: input.message,\n };\n\n return withOptionalDiagnosticProperties(base, {\n nodeId: input.nodeId,\n edgeId: input.edgeId,\n span: input.span,\n metadata: input.metadata,\n });\n}\n\nexport function brokenImportDiagnostic(file: string, specifier: string): SoftwareGraphDiagnostic {\n return createDiagnostic({\n code: \"BROKEN_IMPORT\",\n severity: \"warning\",\n message: `Could not resolve import \"${specifier}\" from ${file}.`,\n metadata: { file, specifier },\n });\n}\n\nexport function circularImportDiagnostic(path: readonly string[]): SoftwareGraphDiagnostic {\n return createDiagnostic({\n code: \"CIRCULAR_IMPORT\",\n severity: \"warning\",\n message: `Circular import detected: ${path.join(\" -> \")}.`,\n metadata: { path: [...path] },\n });\n}\n\nexport function lowConfidenceDiagnostic(\n message: string,\n metadata?: JsonObject,\n): SoftwareGraphDiagnostic {\n return createDiagnostic({\n code: \"LOW_CONFIDENCE_INFERENCE\",\n severity: \"info\",\n message,\n metadata,\n });\n}\n\nfunction withOptionalDiagnosticProperties(\n target: SoftwareGraphDiagnostic,\n optional: Omit<SoftwareGraphDiagnostic, \"id\" | \"code\" | \"severity\" | \"message\">,\n): SoftwareGraphDiagnostic {\n return {\n ...target,\n ...Object.fromEntries(Object.entries(optional).filter(([, value]) => value !== undefined)),\n } as SoftwareGraphDiagnostic;\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAKK;AAYA,SAAS,iBAAiB,OAAuD;AACtF,QAAM,WAAW,MAAM,OACnB,GAAG,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,WAAW,KACpE,MAAM,UAAU,MAAM,UAAU;AAEpC,QAAM,OAAgC;AAAA,IACpC,IAAI,mBAAmB,MAAM,MAAM,MAAM,SAAS,QAAQ;AAAA,IAC1D,MAAM,MAAM;AAAA,IACZ,UAAU,MAAM;AAAA,IAChB,SAAS,MAAM;AAAA,EACjB;AAEA,SAAO,iCAAiC,MAAM;AAAA,IAC5C,QAAQ,MAAM;AAAA,IACd,QAAQ,MAAM;AAAA,IACd,MAAM,MAAM;AAAA,IACZ,UAAU,MAAM;AAAA,EAClB,CAAC;AACH;AAEO,SAAS,uBAAuB,MAAc,WAA4C;AAC/F,SAAO,iBAAiB;AAAA,IACtB,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS,6BAA6B,SAAS,UAAU,IAAI;AAAA,IAC7D,UAAU,EAAE,MAAM,UAAU;AAAA,EAC9B,CAAC;AACH;AAEO,SAAS,yBAAyB,MAAkD;AACzF,SAAO,iBAAiB;AAAA,IACtB,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS,6BAA6B,KAAK,KAAK,MAAM,CAAC;AAAA,IACvD,UAAU,EAAE,MAAM,CAAC,GAAG,IAAI,EAAE;AAAA,EAC9B,CAAC;AACH;AAEO,SAAS,wBACd,SACA,UACyB;AACzB,SAAO,iBAAiB;AAAA,IACtB,MAAM;AAAA,IACN,UAAU;AAAA,IACV;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAEA,SAAS,iCACP,QACA,UACyB;AACzB,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG,OAAO,YAAY,OAAO,QAAQ,QAAQ,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS,CAAC;AAAA,EAC3F;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@0xsarwagya/ontoly-diagnostics",
3
+ "version": "0.1.0-alpha.1",
4
+ "description": "Shared diagnostic constructors for Ontoly.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/0xsarwagya/ontoly.git",
10
+ "directory": "packages/diagnostics"
11
+ },
12
+ "homepage": "https://oss.sarwagya.wtf/ontoly",
13
+ "sideEffects": false,
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "dependencies": {
26
+ "@0xsarwagya/ontoly-core": "0.1.0-alpha.1"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "devDependencies": {
32
+ "@types/node": "^22.15.3",
33
+ "tsup": "^8.3.5",
34
+ "typescript": "5.9.2"
35
+ },
36
+ "bugs": {
37
+ "url": "https://github.com/0xsarwagya/ontoly/issues"
38
+ },
39
+ "funding": {
40
+ "type": "github",
41
+ "url": "https://github.com/sponsors/0xsarwagya"
42
+ },
43
+ "engines": {
44
+ "node": ">=22.0.0",
45
+ "pnpm": ">=11.0.0"
46
+ },
47
+ "main": "./dist/index.js",
48
+ "types": "./dist/index.d.ts",
49
+ "keywords": [
50
+ "ontoly",
51
+ "software-graph",
52
+ "typescript",
53
+ "static-analysis",
54
+ "developer-tools",
55
+ "diagnostics",
56
+ "graph-validation"
57
+ ],
58
+ "scripts": {
59
+ "build": "tsup && tsc -p tsconfig.build.json",
60
+ "check-types": "tsc --noEmit"
61
+ }
62
+ }