@nowline/cli 0.0.0-dev.20261016131303.g46e5473 → 0.0.0-dev.20261016141905.g9cdb033
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/diagnostics/adapt.d.ts +8 -5
- package/dist/diagnostics/adapt.d.ts.map +1 -1
- package/dist/diagnostics/adapt.js +38 -12
- package/dist/diagnostics/adapt.js.map +1 -1
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +2 -2
- package/package.json +14 -14
- package/src/diagnostics/adapt.ts +40 -12
- package/src/generated/version.ts +2 -2
|
@@ -4,11 +4,14 @@ export declare function adaptLangiumDiagnostic(diag: LangiumLikeDiagnostic, file
|
|
|
4
4
|
export declare function adaptParserError(err: ParserErrorLike, file: string): CliDiagnostic;
|
|
5
5
|
export declare function adaptLexerError(err: LexerErrorLike, file: string): CliDiagnostic;
|
|
6
6
|
/**
|
|
7
|
-
* Adapt a routed
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* Adapt a routed include-resolver diagnostic (a wave rule or an included
|
|
8
|
+
* file's NL.E0302). With a `range`, the column and span are the validator's
|
|
9
|
+
* for the same finding. Without one, the diagnostic carries only a 0-based
|
|
10
|
+
* line: `contents` is the text of the file it points into, when known, and
|
|
11
|
+
* the span covers the line's text, so the code frame still underlines the
|
|
12
|
+
* declaration. A coded diagnostic keeps `{ code, args }` in `data` for
|
|
13
|
+
* re-localization. An included file's syntax error is adapted like that
|
|
14
|
+
* file's own (`lex-error` / `parse-error`).
|
|
12
15
|
*/
|
|
13
16
|
export declare function adaptResolveDiagnostic(diag: ResolveDiagnostic, file: string, contents?: string): CliDiagnostic;
|
|
14
17
|
//# sourceMappingURL=adapt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapt.d.ts","sourceRoot":"","sources":["../../src/diagnostics/adapt.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAEzB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,aAAa,EAA4C,MAAM,YAAY,CAAC;AAE1F,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CA2B/F;AAgBD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CAclF;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CAgBhF;AAMD
|
|
1
|
+
{"version":3,"file":"adapt.d.ts","sourceRoot":"","sources":["../../src/diagnostics/adapt.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAEzB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,aAAa,EAA4C,MAAM,YAAY,CAAC;AAE1F,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CA2B/F;AAgBD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CAclF;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CAgBhF;AAMD;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,iBAAiB,EACvB,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,GAClB,aAAa,CAef"}
|
|
@@ -79,29 +79,55 @@ function mapSeverity(severity) {
|
|
|
79
79
|
return severity === 2 ? 'warning' : 'error';
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
|
-
* Adapt a routed
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
82
|
+
* Adapt a routed include-resolver diagnostic (a wave rule or an included
|
|
83
|
+
* file's NL.E0302). With a `range`, the column and span are the validator's
|
|
84
|
+
* for the same finding. Without one, the diagnostic carries only a 0-based
|
|
85
|
+
* line: `contents` is the text of the file it points into, when known, and
|
|
86
|
+
* the span covers the line's text, so the code frame still underlines the
|
|
87
|
+
* declaration. A coded diagnostic keeps `{ code, args }` in `data` for
|
|
88
|
+
* re-localization. An included file's syntax error is adapted like that
|
|
89
|
+
* file's own (`lex-error` / `parse-error`).
|
|
87
90
|
*/
|
|
88
91
|
export function adaptResolveDiagnostic(diag, file, contents) {
|
|
92
|
+
// An included file's syntax error reads as it does when that file is
|
|
93
|
+
// checked on its own.
|
|
94
|
+
if (diag.syntax?.origin === 'lexer')
|
|
95
|
+
return adaptLexerError(diag.syntax.error, file);
|
|
96
|
+
if (diag.syntax?.origin === 'parser')
|
|
97
|
+
return adaptParserError(diag.syntax.error, file);
|
|
98
|
+
return {
|
|
99
|
+
file,
|
|
100
|
+
...resolveLocation(diag, contents),
|
|
101
|
+
severity: diag.severity,
|
|
102
|
+
// WV8 is uncoded; label it the way the validator's copy is labelled.
|
|
103
|
+
code: diag.code ?? inferCodeFromMessage(diag.message),
|
|
104
|
+
message: diag.message,
|
|
105
|
+
suggestion: extractSuggestion(diag.message),
|
|
106
|
+
data: diag.code === undefined ? undefined : { code: diag.code, args: diag.args ?? [] },
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function resolveLocation(diag, contents) {
|
|
110
|
+
if (diag.range) {
|
|
111
|
+
const line = diag.range.start.line + 1;
|
|
112
|
+
const column = diag.range.start.character + 1;
|
|
113
|
+
return {
|
|
114
|
+
line,
|
|
115
|
+
column,
|
|
116
|
+
span: {
|
|
117
|
+
start: { line, column },
|
|
118
|
+
end: { line: diag.range.end.line + 1, column: diag.range.end.character + 1 },
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
89
122
|
const line = (diag.line ?? 0) + 1;
|
|
90
123
|
const text = contents?.split(/\r?\n/)[line - 1]?.trimEnd() ?? '';
|
|
91
124
|
const column = text.length - text.trimStart().length + 1;
|
|
92
125
|
return {
|
|
93
|
-
file,
|
|
94
126
|
line,
|
|
95
127
|
column,
|
|
96
|
-
severity: diag.severity,
|
|
97
128
|
span: text.trim() === ''
|
|
98
129
|
? undefined
|
|
99
130
|
: { start: { line, column }, end: { line, column: text.length + 1 } },
|
|
100
|
-
// WV8 is uncoded; label it the way the validator's copy is labelled.
|
|
101
|
-
code: diag.code ?? inferCodeFromMessage(diag.message),
|
|
102
|
-
message: diag.message,
|
|
103
|
-
suggestion: extractSuggestion(diag.message),
|
|
104
|
-
data: diag.code === undefined ? undefined : { code: diag.code, args: diag.args ?? [] },
|
|
105
131
|
};
|
|
106
132
|
}
|
|
107
133
|
//# sourceMappingURL=adapt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapt.js","sourceRoot":"","sources":["../../src/diagnostics/adapt.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,iBAAiB,EACjB,oBAAoB,EAKpB,qBAAqB,GACxB,MAAM,eAAe,CAAC;AAGvB,MAAM,UAAU,sBAAsB,CAAC,IAA2B,EAAE,IAAY;IAC5E,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACtD,OAAO;QACH,IAAI;QACJ,IAAI;QACJ,MAAM;QACN,QAAQ;QACR,qEAAqE;QACrE,2DAA2D;QAC3D,IAAI,EAA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EAAE,EAAE;KAChF,CAAC;AACN,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "0.0.0-dev.
|
|
1
|
+
export declare const CLI_VERSION = "0.0.0-dev.20261016141905.g9cdb033";
|
|
2
2
|
export interface CliBuild {
|
|
3
3
|
/** Short git SHA at build time, or empty when not in a git checkout. */
|
|
4
4
|
readonly sha: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Auto-generated by scripts/bundle-templates.mjs. Do not edit by hand.
|
|
2
|
-
export const CLI_VERSION = "0.0.0-dev.
|
|
2
|
+
export const CLI_VERSION = "0.0.0-dev.20261016141905.g9cdb033";
|
|
3
3
|
export const CLI_BUILD = {
|
|
4
|
-
"sha": "
|
|
4
|
+
"sha": "9cdb033",
|
|
5
5
|
"isRelease": false,
|
|
6
6
|
"isDirty": true
|
|
7
7
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nowline/cli",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.20261016141905.g9cdb033",
|
|
4
4
|
"description": "Command-line tool to check, convert, and create Nowline roadmaps.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|
|
@@ -34,19 +34,19 @@
|
|
|
34
34
|
"@clack/prompts": "^1.8.1",
|
|
35
35
|
"@modelcontextprotocol/node": "^2.1.0",
|
|
36
36
|
"@modelcontextprotocol/server": "^2.2.0",
|
|
37
|
-
"@nowline/config": "0.0.0-dev.
|
|
38
|
-
"@nowline/core": "0.0.0-dev.
|
|
39
|
-
"@nowline/export": "0.0.0-dev.
|
|
40
|
-
"@nowline/export-core": "0.0.0-dev.
|
|
41
|
-
"@nowline/export-html": "0.0.0-dev.
|
|
42
|
-
"@nowline/export-mermaid": "0.0.0-dev.
|
|
43
|
-
"@nowline/export-msproj": "0.0.0-dev.
|
|
44
|
-
"@nowline/export-pdf": "0.0.0-dev.
|
|
45
|
-
"@nowline/export-png": "0.0.0-dev.
|
|
46
|
-
"@nowline/export-xlsx": "0.0.0-dev.
|
|
47
|
-
"@nowline/layout": "0.0.0-dev.
|
|
48
|
-
"@nowline/mcp": "0.0.0-dev.
|
|
49
|
-
"@nowline/renderer": "0.0.0-dev.
|
|
37
|
+
"@nowline/config": "0.0.0-dev.20261016141905.g9cdb033",
|
|
38
|
+
"@nowline/core": "0.0.0-dev.20261016141905.g9cdb033",
|
|
39
|
+
"@nowline/export": "0.0.0-dev.20261016141905.g9cdb033",
|
|
40
|
+
"@nowline/export-core": "0.0.0-dev.20261016141905.g9cdb033",
|
|
41
|
+
"@nowline/export-html": "0.0.0-dev.20261016141905.g9cdb033",
|
|
42
|
+
"@nowline/export-mermaid": "0.0.0-dev.20261016141905.g9cdb033",
|
|
43
|
+
"@nowline/export-msproj": "0.0.0-dev.20261016141905.g9cdb033",
|
|
44
|
+
"@nowline/export-pdf": "0.0.0-dev.20261016141905.g9cdb033",
|
|
45
|
+
"@nowline/export-png": "0.0.0-dev.20261016141905.g9cdb033",
|
|
46
|
+
"@nowline/export-xlsx": "0.0.0-dev.20261016141905.g9cdb033",
|
|
47
|
+
"@nowline/layout": "0.0.0-dev.20261016141905.g9cdb033",
|
|
48
|
+
"@nowline/mcp": "0.0.0-dev.20261016141905.g9cdb033",
|
|
49
|
+
"@nowline/renderer": "0.0.0-dev.20261016141905.g9cdb033",
|
|
50
50
|
"chalk": "^6.0.1",
|
|
51
51
|
"citty": "^0.2.2",
|
|
52
52
|
"consola": "^3.4.2",
|
package/src/diagnostics/adapt.ts
CHANGED
|
@@ -91,33 +91,61 @@ function mapSeverity(severity: number | undefined): DiagnosticSeverity {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
* Adapt a routed
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
94
|
+
* Adapt a routed include-resolver diagnostic (a wave rule or an included
|
|
95
|
+
* file's NL.E0302). With a `range`, the column and span are the validator's
|
|
96
|
+
* for the same finding. Without one, the diagnostic carries only a 0-based
|
|
97
|
+
* line: `contents` is the text of the file it points into, when known, and
|
|
98
|
+
* the span covers the line's text, so the code frame still underlines the
|
|
99
|
+
* declaration. A coded diagnostic keeps `{ code, args }` in `data` for
|
|
100
|
+
* re-localization. An included file's syntax error is adapted like that
|
|
101
|
+
* file's own (`lex-error` / `parse-error`).
|
|
99
102
|
*/
|
|
100
103
|
export function adaptResolveDiagnostic(
|
|
101
104
|
diag: ResolveDiagnostic,
|
|
102
105
|
file: string,
|
|
103
106
|
contents?: string,
|
|
104
107
|
): CliDiagnostic {
|
|
108
|
+
// An included file's syntax error reads as it does when that file is
|
|
109
|
+
// checked on its own.
|
|
110
|
+
if (diag.syntax?.origin === 'lexer') return adaptLexerError(diag.syntax.error, file);
|
|
111
|
+
if (diag.syntax?.origin === 'parser') return adaptParserError(diag.syntax.error, file);
|
|
112
|
+
return {
|
|
113
|
+
file,
|
|
114
|
+
...resolveLocation(diag, contents),
|
|
115
|
+
severity: diag.severity,
|
|
116
|
+
// WV8 is uncoded; label it the way the validator's copy is labelled.
|
|
117
|
+
code: diag.code ?? inferCodeFromMessage(diag.message),
|
|
118
|
+
message: diag.message,
|
|
119
|
+
suggestion: extractSuggestion(diag.message),
|
|
120
|
+
data: diag.code === undefined ? undefined : { code: diag.code, args: diag.args ?? [] },
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function resolveLocation(
|
|
125
|
+
diag: ResolveDiagnostic,
|
|
126
|
+
contents: string | undefined,
|
|
127
|
+
): Pick<CliDiagnostic, 'line' | 'column' | 'span'> {
|
|
128
|
+
if (diag.range) {
|
|
129
|
+
const line = diag.range.start.line + 1;
|
|
130
|
+
const column = diag.range.start.character + 1;
|
|
131
|
+
return {
|
|
132
|
+
line,
|
|
133
|
+
column,
|
|
134
|
+
span: {
|
|
135
|
+
start: { line, column },
|
|
136
|
+
end: { line: diag.range.end.line + 1, column: diag.range.end.character + 1 },
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
105
140
|
const line = (diag.line ?? 0) + 1;
|
|
106
141
|
const text = contents?.split(/\r?\n/)[line - 1]?.trimEnd() ?? '';
|
|
107
142
|
const column = text.length - text.trimStart().length + 1;
|
|
108
143
|
return {
|
|
109
|
-
file,
|
|
110
144
|
line,
|
|
111
145
|
column,
|
|
112
|
-
severity: diag.severity,
|
|
113
146
|
span:
|
|
114
147
|
text.trim() === ''
|
|
115
148
|
? undefined
|
|
116
149
|
: { start: { line, column }, end: { line, column: text.length + 1 } },
|
|
117
|
-
// WV8 is uncoded; label it the way the validator's copy is labelled.
|
|
118
|
-
code: diag.code ?? inferCodeFromMessage(diag.message),
|
|
119
|
-
message: diag.message,
|
|
120
|
-
suggestion: extractSuggestion(diag.message),
|
|
121
|
-
data: diag.code === undefined ? undefined : { code: diag.code, args: diag.args ?? [] },
|
|
122
150
|
};
|
|
123
151
|
}
|
package/src/generated/version.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Auto-generated by scripts/bundle-templates.mjs. Do not edit by hand.
|
|
2
2
|
|
|
3
|
-
export const CLI_VERSION = "0.0.0-dev.
|
|
3
|
+
export const CLI_VERSION = "0.0.0-dev.20261016141905.g9cdb033";
|
|
4
4
|
|
|
5
5
|
export interface CliBuild {
|
|
6
6
|
/** Short git SHA at build time, or empty when not in a git checkout. */
|
|
@@ -12,7 +12,7 @@ export interface CliBuild {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export const CLI_BUILD: CliBuild = {
|
|
15
|
-
"sha": "
|
|
15
|
+
"sha": "9cdb033",
|
|
16
16
|
"isRelease": false,
|
|
17
17
|
"isDirty": true
|
|
18
18
|
};
|