@koppajs/koppajs-kpa-check 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/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@koppajs/koppajs-kpa-check` are recorded here.
4
+
5
+ ## [0.1.0]
6
+
7
+ - Establish the initial published CLI package boundary for deterministic `.kpa`
8
+ diagnostics runs through `kpa-check` and `runKpaCheck()`.
9
+ - Align the package, documentation, and local development flow with
10
+ `@koppajs/koppajs-language-core` as the shared KoppaJS language dependency.
11
+ - Add `--help`, `--version`, and `--json` so the release surface is usable for
12
+ both humans and automation.
13
+ - Lock the public package surface, package metadata, and manual release model
14
+ with explicit tests and repository documentation.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,198 @@
1
+ # @koppajs/koppajs-kpa-check
2
+
3
+ `@koppajs/koppajs-kpa-check` is the KoppaJS CLI diagnostics runner for `.kpa` files.
4
+ It resolves one or more filesystem targets, delegates semantic analysis to
5
+ `@koppajs/koppajs-language-core`, and emits deterministic command-line diagnostics.
6
+
7
+ ## Purpose
8
+
9
+ This repository exists to do one job well:
10
+
11
+ - accept explicit file and directory targets for `.kpa` analysis
12
+ - collect shared KoppaJS diagnostics outside editor or language-server hosts
13
+ - print stable, grep-friendly warning lines and explicit exit codes
14
+ - keep the CLI surface thin so language semantics continue to live in
15
+ `@koppajs/koppajs-language-core`
16
+
17
+ It is not a parser fork, a formatter, or a replacement for the language server.
18
+
19
+ ## Repository Classification
20
+
21
+ - Repo type: CLI diagnostics package
22
+ - Runtime responsibility: filesystem target resolution, workspace-graph
23
+ orchestration, output formatting, and process exit-code selection
24
+ - Build-time responsibility: compile the TypeScript package, emit declarations,
25
+ and validate the repository quality gates
26
+ - UI surface: none
27
+ - Maturity level: `v0` stabilization
28
+
29
+ ## Ownership Boundaries
30
+
31
+ - [`src/cli.ts`](./src/cli.ts) owns executable startup only.
32
+ - [`src/runner.ts`](./src/runner.ts) owns the diagnostics-runner contract:
33
+ target resolution, ordering, language-core calls, output formatting, and exit
34
+ codes.
35
+ - [`src/index.ts`](./src/index.ts) owns the minimal programmatic package export.
36
+ - [`src/test/unit/`](./src/test/unit) owns unit and lightweight integration
37
+ coverage for the runner.
38
+ - [`scripts/`](./scripts) owns repository-only quality guards.
39
+ - Root governance files and [`docs/`](./docs) own the repository doctrine,
40
+ specs, and quality baseline.
41
+
42
+ Language analysis rules, diagnostic messages, and workspace indexing remain the
43
+ responsibility of `@koppajs/koppajs-language-core`.
44
+
45
+ ## Public Contract
46
+
47
+ The stable public surface of this repository is intentionally small:
48
+
49
+ - the `kpa-check [targets...]` executable
50
+ - `kpa-check --help` and `kpa-check --version`
51
+ - defaulting to the current working directory when no target is supplied
52
+ - rejecting any requested target that does not exist with exit code `2`
53
+ - scanning all reachable `.kpa` files across the resolved target set
54
+ - printing diagnostics as `path:line:character warning message`
55
+ - emitting a single JSON document with `--json`
56
+ - returning exit code `0` for success, `1` for diagnostics, and `2` for invalid
57
+ input
58
+ - the root package export `runKpaCheck(argv, options?)` plus its public runner
59
+ types for programmatic reuse
60
+
61
+ The governing behavior spec is
62
+ [docs/specs/diagnostics-runner-contract.md](./docs/specs/diagnostics-runner-contract.md).
63
+
64
+ ## Usage
65
+
66
+ Installed command:
67
+
68
+ ```bash
69
+ kpa-check src
70
+ ```
71
+
72
+ Help:
73
+
74
+ ```bash
75
+ kpa-check --help
76
+ ```
77
+
78
+ Version:
79
+
80
+ ```bash
81
+ kpa-check --version
82
+ ```
83
+
84
+ Current working directory:
85
+
86
+ ```bash
87
+ kpa-check
88
+ ```
89
+
90
+ Multiple targets:
91
+
92
+ ```bash
93
+ kpa-check src components/Page.kpa
94
+ ```
95
+
96
+ Machine-readable JSON output:
97
+
98
+ ```bash
99
+ kpa-check --json src
100
+ ```
101
+
102
+ Programmatic usage:
103
+
104
+ ```ts
105
+ import { runKpaCheck } from '@koppajs/koppajs-kpa-check';
106
+
107
+ const exitCode = runKpaCheck(['src']);
108
+ ```
109
+
110
+ Programmatic JSON output:
111
+
112
+ ```ts
113
+ import { runKpaCheck } from '@koppajs/koppajs-kpa-check';
114
+
115
+ const exitCode = runKpaCheck(['src'], {
116
+ outputFormat: 'json',
117
+ });
118
+ ```
119
+
120
+ ## JSON Output
121
+
122
+ `--json` writes exactly one JSON document to stdout for each invocation,
123
+ including clean runs, diagnostics, help/version output, and invocation errors.
124
+
125
+ For diagnostics runs, the payload includes:
126
+
127
+ - `kind`, `status`, and `exitCode`
128
+ - `cwd`, requested targets, resolved targets, and missing targets
129
+ - a `summary` with checked-file and diagnostic counts
130
+ - a sorted `diagnostics` array with `filePath`, `relativeFilePath`, `line`,
131
+ `character`, `severity`, `message`, and optional `code` / `data`
132
+
133
+ The current JSON severity is always `warning`, matching the text output format.
134
+
135
+ ## Exit Codes
136
+
137
+ - `0`: all reachable `.kpa` files were checked and no diagnostics were found,
138
+ or no `.kpa` files were reachable, or `--help` / `--version` completed
139
+ - `1`: at least one diagnostic was emitted
140
+ - `2`: the invocation itself was invalid, currently because at least one target
141
+ path does not exist or an unknown/conflicting CLI option was provided
142
+
143
+ ## Ecosystem Fit
144
+
145
+ `@koppajs/koppajs-kpa-check` complements the rest of the KoppaJS language toolchain:
146
+
147
+ - `@koppajs/koppajs-language-core` owns parsing, indexing, and diagnostics
148
+ - `@koppajs/language-server` exposes the same language layer through LSP
149
+ - editor integrations can use the language server for interactive workflows
150
+ - `@koppajs/koppajs-kpa-check` remains the narrow non-editor entry point for CI,
151
+ scripts, and local validation
152
+
153
+ The package intentionally stays thin so diagnostics behavior evolves in one
154
+ place.
155
+
156
+ ## Quality Baseline
157
+
158
+ The enforced repository checks are:
159
+
160
+ - `npm run check`
161
+ - `npm run validate`
162
+
163
+ The release candidate should also pass:
164
+
165
+ - `npm run release:check`
166
+
167
+ ## Release Model
168
+
169
+ Releases are manual and tag-driven through GitHub Actions.
170
+
171
+ - `package.json` defines the intended release version
172
+ - `CHANGELOG.md` records the release notes
173
+ - `RELEASE.md` defines the repository-specific release workflow
174
+ - `.github/workflows/release.yml` validates and publishes tagged releases
175
+
176
+ ## Governance
177
+
178
+ Repository governance lives in:
179
+
180
+ - [AI_CONSTITUTION.md](./AI_CONSTITUTION.md)
181
+ - [ARCHITECTURE.md](./ARCHITECTURE.md)
182
+ - [CHANGELOG.md](./CHANGELOG.md)
183
+ - [DECISION_HIERARCHY.md](./DECISION_HIERARCHY.md)
184
+ - [DEVELOPMENT_RULES.md](./DEVELOPMENT_RULES.md)
185
+ - [RELEASE.md](./RELEASE.md)
186
+ - [TESTING_STRATEGY.md](./TESTING_STRATEGY.md)
187
+ - [CONTRIBUTING.md](./CONTRIBUTING.md)
188
+ - [ROADMAP.md](./ROADMAP.md)
189
+ - [docs/meta/README.md](./docs/meta/README.md)
190
+ - [docs/meta/maintenance.md](./docs/meta/maintenance.md)
191
+ - [docs/meta/tooling-baseline.md](./docs/meta/tooling-baseline.md)
192
+ - [docs/meta/version-compatibility.md](./docs/meta/version-compatibility.md)
193
+ - [docs/architecture/README.md](./docs/architecture/README.md)
194
+ - [docs/quality/README.md](./docs/quality/README.md)
195
+
196
+ ## License
197
+
198
+ Apache License 2.0
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const index_1 = require("./index");
5
+ process.exitCode = (0, index_1.runKpaCheck)(process.argv.slice(2));
6
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,mCAAsC;AAEtC,OAAO,CAAC,QAAQ,GAAG,IAAA,mBAAW,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export { runKpaCheck, type KpaCheckExitCode, type KpaCheckIo, type KpaCheckOutputFormat, type RunKpaCheckOptions, } from './runner';
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runKpaCheck = void 0;
4
+ var runner_1 = require("./runner");
5
+ Object.defineProperty(exports, "runKpaCheck", { enumerable: true, get: function () { return runner_1.runKpaCheck; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAMkB;AALhB,qGAAA,WAAW,OAAA"}
@@ -0,0 +1,46 @@
1
+ import { type KpaWorkspaceFileDiagnostics } from '@koppajs/koppajs-language-core';
2
+ export type KpaCheckExitCode = 0 | 1 | 2;
3
+ export type KpaCheckOutputFormat = 'text' | 'json';
4
+ export interface KpaCheckIo {
5
+ log(message: string): void;
6
+ error(message: string): void;
7
+ }
8
+ export interface ResolveCliTargetsOptions {
9
+ cwd?: string;
10
+ fileExists?: (targetPath: string) => boolean;
11
+ }
12
+ export interface KpaCheckWorkspaceGraph {
13
+ getKpaFilePaths(additionalPaths?: readonly (string | undefined)[]): readonly string[];
14
+ collectDiagnosticsForPaths(paths: readonly string[], additionalPaths?: readonly (string | undefined)[]): readonly KpaWorkspaceFileDiagnostics[];
15
+ }
16
+ export interface RunKpaCheckOptions {
17
+ cwd?: string;
18
+ io?: KpaCheckIo;
19
+ fileExists?: (targetPath: string) => boolean;
20
+ createWorkspaceGraph?: (targets: readonly string[]) => KpaCheckWorkspaceGraph;
21
+ outputFormat?: KpaCheckOutputFormat;
22
+ packageName?: string;
23
+ version?: string;
24
+ }
25
+ export interface KpaCheckDiagnostic {
26
+ code?: number | string;
27
+ data?: unknown;
28
+ message: string;
29
+ range: {
30
+ line: number;
31
+ startChar: number;
32
+ };
33
+ }
34
+ export type ResolveCliTargetsResult = {
35
+ status: 'ok';
36
+ targets: readonly string[];
37
+ } | {
38
+ errorKind: 'missing-targets';
39
+ exitCode: 2;
40
+ message: string;
41
+ missingTargets: readonly string[];
42
+ status: 'error';
43
+ };
44
+ export declare function resolveCliTargets(argv: readonly string[], options?: ResolveCliTargetsOptions): ResolveCliTargetsResult;
45
+ export declare function formatDiagnostic(filePath: string, diagnostic: KpaCheckDiagnostic, cwd?: string): string;
46
+ export declare function runKpaCheck(argv: readonly string[], options?: RunKpaCheckOptions): KpaCheckExitCode;
package/dist/runner.js ADDED
@@ -0,0 +1,385 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.resolveCliTargets = resolveCliTargets;
7
+ exports.formatDiagnostic = formatDiagnostic;
8
+ exports.runKpaCheck = runKpaCheck;
9
+ const fs_1 = __importDefault(require("fs"));
10
+ const path_1 = __importDefault(require("path"));
11
+ const koppajs_language_core_1 = require("@koppajs/koppajs-language-core");
12
+ const defaultIo = {
13
+ error(message) {
14
+ console.error(message);
15
+ },
16
+ log(message) {
17
+ console.log(message);
18
+ },
19
+ };
20
+ const helpOptions = [
21
+ {
22
+ description: 'Show this help text and exit.',
23
+ flag: '--help',
24
+ },
25
+ {
26
+ description: 'Print the package version and exit.',
27
+ flag: '--version',
28
+ },
29
+ {
30
+ description: 'Emit machine-readable JSON output.',
31
+ flag: '--json',
32
+ },
33
+ ];
34
+ let cachedPackageMetadata;
35
+ function compareDiagnostics(left, right) {
36
+ if (left.range.line !== right.range.line) {
37
+ return left.range.line - right.range.line;
38
+ }
39
+ if (left.range.startChar !== right.range.startChar) {
40
+ return left.range.startChar - right.range.startChar;
41
+ }
42
+ return left.message.localeCompare(right.message);
43
+ }
44
+ function getPackageMetadata() {
45
+ if (cachedPackageMetadata) {
46
+ return cachedPackageMetadata;
47
+ }
48
+ const packageJsonPath = path_1.default.resolve(__dirname, '..', 'package.json');
49
+ const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf8'));
50
+ cachedPackageMetadata = {
51
+ name: packageJson.name,
52
+ version: packageJson.version,
53
+ };
54
+ return cachedPackageMetadata;
55
+ }
56
+ function getEffectivePackageMetadata(options) {
57
+ const packageMetadata = getPackageMetadata();
58
+ return {
59
+ name: options.packageName ?? packageMetadata.name,
60
+ version: options.version ?? packageMetadata.version,
61
+ };
62
+ }
63
+ function formatRelativePath(cwd, filePath) {
64
+ return path_1.default.relative(cwd, filePath) || path_1.default.basename(filePath);
65
+ }
66
+ function formatHelpText(packageName, version) {
67
+ return [
68
+ `${packageName} ${version}`,
69
+ '',
70
+ 'Usage:',
71
+ ' kpa-check [options] [targets...]',
72
+ '',
73
+ 'Run KoppaJS diagnostics for .kpa files.',
74
+ '',
75
+ 'Options:',
76
+ ...helpOptions.map((option) => ` ${option.flag.padEnd(10)}${option.description}`),
77
+ '',
78
+ 'Notes:',
79
+ ' Targets may be files or directories.',
80
+ ' With no targets, kpa-check checks the current working directory.',
81
+ ].join('\n');
82
+ }
83
+ function writeJson(io, payload) {
84
+ io.log(JSON.stringify(payload, null, 2));
85
+ }
86
+ function determineOutputFormat(argv, defaultOutputFormat) {
87
+ let endOfOptions = false;
88
+ for (const argument of argv) {
89
+ if (endOfOptions) {
90
+ continue;
91
+ }
92
+ if (argument === '--') {
93
+ endOfOptions = true;
94
+ continue;
95
+ }
96
+ if (argument === '--json') {
97
+ return 'json';
98
+ }
99
+ }
100
+ return defaultOutputFormat;
101
+ }
102
+ function parseCliInvocation(argv, defaultOutputFormat) {
103
+ const outputFormat = determineOutputFormat(argv, defaultOutputFormat);
104
+ const targets = [];
105
+ let command = 'check';
106
+ let endOfOptions = false;
107
+ for (const argument of argv) {
108
+ if (endOfOptions) {
109
+ targets.push(argument);
110
+ continue;
111
+ }
112
+ if (argument === '--') {
113
+ endOfOptions = true;
114
+ continue;
115
+ }
116
+ if (argument === '--json') {
117
+ continue;
118
+ }
119
+ if (argument === '--help' || argument === '--version') {
120
+ const nextCommand = argument === '--help' ? 'help' : 'version';
121
+ if (command !== 'check' && command !== nextCommand) {
122
+ return {
123
+ errorKind: 'conflicting-options',
124
+ exitCode: 2,
125
+ message: 'kpa-check hat widerspruechliche Steueroptionen erhalten: --help, --version',
126
+ outputFormat,
127
+ requestedTargets: targets,
128
+ status: 'error',
129
+ };
130
+ }
131
+ command = nextCommand;
132
+ continue;
133
+ }
134
+ if (argument.startsWith('-')) {
135
+ return {
136
+ errorKind: 'invalid-option',
137
+ exitCode: 2,
138
+ message: `kpa-check hat eine unbekannte Option erhalten: ${argument}`,
139
+ outputFormat,
140
+ requestedTargets: targets,
141
+ status: 'error',
142
+ };
143
+ }
144
+ targets.push(argument);
145
+ }
146
+ return {
147
+ command,
148
+ outputFormat,
149
+ status: 'ok',
150
+ targets,
151
+ };
152
+ }
153
+ function toJsonDiagnostic(filePath, diagnostic, cwd) {
154
+ return {
155
+ character: diagnostic.range.startChar + 1,
156
+ code: diagnostic.code,
157
+ data: diagnostic.data,
158
+ filePath,
159
+ line: diagnostic.range.line + 1,
160
+ message: diagnostic.message,
161
+ relativeFilePath: formatRelativePath(cwd, filePath),
162
+ severity: 'warning',
163
+ };
164
+ }
165
+ function resolveCliTargets(argv, options = {}) {
166
+ const cwd = options.cwd ?? process.cwd();
167
+ const fileExists = options.fileExists ?? fs_1.default.existsSync;
168
+ const cliTargets = argv.length > 0 ? argv : [cwd];
169
+ const uniqueTargets = new Set();
170
+ const resolvedTargets = cliTargets
171
+ .map((targetPath) => path_1.default.resolve(cwd, targetPath))
172
+ .filter((targetPath) => {
173
+ if (uniqueTargets.has(targetPath)) {
174
+ return false;
175
+ }
176
+ uniqueTargets.add(targetPath);
177
+ return true;
178
+ });
179
+ const missingTargets = resolvedTargets.filter((targetPath) => !fileExists(targetPath));
180
+ if (missingTargets.length > 0) {
181
+ const formattedTargets = missingTargets.map((targetPath) => formatRelativePath(cwd, targetPath));
182
+ return {
183
+ errorKind: 'missing-targets',
184
+ exitCode: 2,
185
+ message: [
186
+ `kpa-check hat ${missingTargets.length} nicht existierende(s) Ziel(e) erhalten:`,
187
+ ...formattedTargets.map((targetPath) => `- ${targetPath}`),
188
+ ].join('\n'),
189
+ missingTargets,
190
+ status: 'error',
191
+ };
192
+ }
193
+ return {
194
+ status: 'ok',
195
+ targets: resolvedTargets,
196
+ };
197
+ }
198
+ function formatDiagnostic(filePath, diagnostic, cwd = process.cwd()) {
199
+ const relativeFilePath = formatRelativePath(cwd, filePath);
200
+ const line = diagnostic.range.line + 1;
201
+ const character = diagnostic.range.startChar + 1;
202
+ return `${relativeFilePath}:${line}:${character} warning ${diagnostic.message}`;
203
+ }
204
+ function runKpaCheck(argv, options = {}) {
205
+ const cwd = options.cwd ?? process.cwd();
206
+ const io = options.io ?? defaultIo;
207
+ const packageMetadata = getEffectivePackageMetadata(options);
208
+ const parsedInvocation = parseCliInvocation(argv, options.outputFormat ?? 'text');
209
+ if (parsedInvocation.status === 'error') {
210
+ if (parsedInvocation.outputFormat === 'json') {
211
+ writeJson(io, {
212
+ cwd,
213
+ diagnostics: [],
214
+ errorKind: parsedInvocation.errorKind,
215
+ exitCode: parsedInvocation.exitCode,
216
+ kind: 'check',
217
+ message: parsedInvocation.message,
218
+ missingTargets: [],
219
+ requestedTargets: parsedInvocation.requestedTargets,
220
+ resolvedTargets: [],
221
+ status: 'error',
222
+ summary: {
223
+ checkedFileCount: 0,
224
+ diagnosticCount: 0,
225
+ targetCount: parsedInvocation.requestedTargets.length,
226
+ },
227
+ });
228
+ }
229
+ else {
230
+ io.error(parsedInvocation.message);
231
+ }
232
+ return parsedInvocation.exitCode;
233
+ }
234
+ if (parsedInvocation.command === 'help') {
235
+ if (parsedInvocation.outputFormat === 'json') {
236
+ writeJson(io, {
237
+ description: 'Run KoppaJS diagnostics for .kpa files.',
238
+ kind: 'help',
239
+ options: helpOptions,
240
+ packageName: packageMetadata.name,
241
+ usage: 'kpa-check [options] [targets...]',
242
+ version: packageMetadata.version,
243
+ });
244
+ }
245
+ else {
246
+ io.log(formatHelpText(packageMetadata.name, packageMetadata.version));
247
+ }
248
+ return 0;
249
+ }
250
+ if (parsedInvocation.command === 'version') {
251
+ if (parsedInvocation.outputFormat === 'json') {
252
+ writeJson(io, {
253
+ kind: 'version',
254
+ packageName: packageMetadata.name,
255
+ version: packageMetadata.version,
256
+ });
257
+ }
258
+ else {
259
+ io.log(packageMetadata.version);
260
+ }
261
+ return 0;
262
+ }
263
+ const resolvedTargets = resolveCliTargets(parsedInvocation.targets, {
264
+ cwd,
265
+ fileExists: options.fileExists,
266
+ });
267
+ if (resolvedTargets.status === 'error') {
268
+ if (parsedInvocation.outputFormat === 'json') {
269
+ writeJson(io, {
270
+ cwd,
271
+ diagnostics: [],
272
+ errorKind: resolvedTargets.errorKind,
273
+ exitCode: resolvedTargets.exitCode,
274
+ kind: 'check',
275
+ message: resolvedTargets.message,
276
+ missingTargets: resolvedTargets.missingTargets,
277
+ requestedTargets: parsedInvocation.targets,
278
+ resolvedTargets: [],
279
+ status: 'error',
280
+ summary: {
281
+ checkedFileCount: 0,
282
+ diagnosticCount: 0,
283
+ targetCount: parsedInvocation.targets.length,
284
+ },
285
+ });
286
+ }
287
+ else {
288
+ io.error(resolvedTargets.message);
289
+ }
290
+ return resolvedTargets.exitCode;
291
+ }
292
+ const createWorkspaceGraph = options.createWorkspaceGraph ??
293
+ ((targets) => new koppajs_language_core_1.KpaWorkspaceGraph({ rootPaths: targets }));
294
+ const workspaceGraph = createWorkspaceGraph(resolvedTargets.targets);
295
+ const filePaths = [...workspaceGraph.getKpaFilePaths(resolvedTargets.targets)].sort((left, right) => left.localeCompare(right));
296
+ if (filePaths.length === 0) {
297
+ const message = 'kpa-check hat keine .kpa-Dateien gefunden.';
298
+ if (parsedInvocation.outputFormat === 'json') {
299
+ writeJson(io, {
300
+ cwd,
301
+ diagnostics: [],
302
+ exitCode: 0,
303
+ kind: 'check',
304
+ message,
305
+ missingTargets: [],
306
+ requestedTargets: parsedInvocation.targets,
307
+ resolvedTargets: resolvedTargets.targets,
308
+ status: 'ok',
309
+ summary: {
310
+ checkedFileCount: 0,
311
+ diagnosticCount: 0,
312
+ targetCount: resolvedTargets.targets.length,
313
+ },
314
+ });
315
+ }
316
+ else {
317
+ io.log(message);
318
+ }
319
+ return 0;
320
+ }
321
+ const diagnosticsByFile = [...workspaceGraph.collectDiagnosticsForPaths(filePaths)].sort((left, right) => left.filePath.localeCompare(right.filePath));
322
+ let diagnosticCount = 0;
323
+ const jsonDiagnostics = [];
324
+ for (const { diagnostics, filePath } of diagnosticsByFile) {
325
+ const sortedDiagnostics = [...diagnostics].sort(compareDiagnostics);
326
+ for (const diagnostic of sortedDiagnostics) {
327
+ if (parsedInvocation.outputFormat === 'json') {
328
+ jsonDiagnostics.push(toJsonDiagnostic(filePath, diagnostic, cwd));
329
+ }
330
+ else {
331
+ io.log(formatDiagnostic(filePath, diagnostic, cwd));
332
+ }
333
+ diagnosticCount++;
334
+ }
335
+ }
336
+ if (diagnosticCount === 0) {
337
+ const message = `kpa-check: ${diagnosticsByFile.length} .kpa-Datei(en) geprueft, keine Diagnostics gefunden.`;
338
+ if (parsedInvocation.outputFormat === 'json') {
339
+ writeJson(io, {
340
+ cwd,
341
+ diagnostics: [],
342
+ exitCode: 0,
343
+ kind: 'check',
344
+ message,
345
+ missingTargets: [],
346
+ requestedTargets: parsedInvocation.targets,
347
+ resolvedTargets: resolvedTargets.targets,
348
+ status: 'ok',
349
+ summary: {
350
+ checkedFileCount: diagnosticsByFile.length,
351
+ diagnosticCount,
352
+ targetCount: resolvedTargets.targets.length,
353
+ },
354
+ });
355
+ }
356
+ else {
357
+ io.log(message);
358
+ }
359
+ return 0;
360
+ }
361
+ const message = `kpa-check: ${diagnosticCount} Diagnostic(s) in ${diagnosticsByFile.length} .kpa-Datei(en) gefunden.`;
362
+ if (parsedInvocation.outputFormat === 'json') {
363
+ writeJson(io, {
364
+ cwd,
365
+ diagnostics: jsonDiagnostics,
366
+ exitCode: 1,
367
+ kind: 'check',
368
+ message,
369
+ missingTargets: [],
370
+ requestedTargets: parsedInvocation.targets,
371
+ resolvedTargets: resolvedTargets.targets,
372
+ status: 'diagnostics',
373
+ summary: {
374
+ checkedFileCount: diagnosticsByFile.length,
375
+ diagnosticCount,
376
+ targetCount: resolvedTargets.targets.length,
377
+ },
378
+ });
379
+ }
380
+ else {
381
+ io.error(message);
382
+ }
383
+ return 1;
384
+ }
385
+ //# sourceMappingURL=runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":";;;;;AAmVA,8CAuCC;AAED,4CAUC;AAED,kCA2MC;AAnlBD,4CAAoB;AACpB,gDAAwB;AACxB,0EAGwC;AAyIxC,MAAM,SAAS,GAAe;IAC5B,KAAK,CAAC,OAAO;QACX,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IACD,GAAG,CAAC,OAAO;QACT,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;CACF,CAAC;AAEF,MAAM,WAAW,GAAG;IAClB;QACE,WAAW,EAAE,+BAA+B;QAC5C,IAAI,EAAE,QAAQ;KACf;IACD;QACE,WAAW,EAAE,qCAAqC;QAClD,IAAI,EAAE,WAAW;KAClB;IACD;QACE,WAAW,EAAE,oCAAoC;QACjD,IAAI,EAAE,QAAQ;KACf;CACO,CAAC;AAEX,IAAI,qBAA0D,CAAC;AAE/D,SAAS,kBAAkB,CAAC,IAAwB,EAAE,KAAyB;IAC7E,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,C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,OAAO,EAAE;oBACP,gBAAgB,EAAE,iBAAiB,CAAC,MAAM;oBAC1C,eAAe;oBACf,WAAW,EAAE,eAAe,CAAC,OAAO,CAAC,MAAM;iBAC5C;aACF,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,OAAO,GAAG,cAAc,eAAe,qBAAqB,iBAAiB,CAAC,MAAM,2BAA2B,CAAC;IAEtH,IAAI,gBAAgB,CAAC,YAAY,KAAK,MAAM,EAAE,CAAC;QAC7C,SAAS,CAAC,EAAE,EAAE;YACZ,GAAG;YACH,WAAW,EAAE,eAAe;YAC5B,QAAQ,EAAE,CAAC;YACX,IAAI,EAAE,OAAO;YACb,OAAO;YACP,cAAc,EAAE,EAAE;YAClB,gBAAgB,EAAE,gBAAgB,CAAC,OAAO;YAC1C,eAAe,EAAE,eAAe,CAAC,OAAO;YACxC,MAAM,EAAE,aAAa;YACrB,OAAO,EAAE;gBACP,gBAAgB,EAAE,iBAAiB,CAAC,MAAM;gBAC1C,eAAe;gBACf,WAAW,EAAE,eAAe,CAAC,OAAO,CAAC,MAAM;aAC5C;SACF,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACpB,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC"}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@koppajs/koppajs-kpa-check",
3
+ "version": "0.1.0",
4
+ "description": "CLI diagnostics runner for KoppaJS .kpa files.",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/koppajs/koppajs-kpa-check.git"
9
+ },
10
+ "homepage": "https://github.com/koppajs/koppajs-kpa-check#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/koppajs/koppajs-kpa-check/issues"
13
+ },
14
+ "bin": {
15
+ "kpa-check": "./dist/cli.js"
16
+ },
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "files": [
20
+ "dist",
21
+ "README.md",
22
+ "CHANGELOG.md",
23
+ "LICENSE"
24
+ ],
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "default": "./dist/index.js"
29
+ }
30
+ },
31
+ "scripts": {
32
+ "check:meta": "node scripts/check-meta-layer.mjs",
33
+ "format:check": "node scripts/format-check.mjs",
34
+ "build": "tsc -p tsconfig.build.json",
35
+ "lint": "eslint . --ext .ts,.mjs --ignore-pattern dist --ignore-pattern node_modules --max-warnings=0",
36
+ "pack:dry-run": "npm pack --dry-run",
37
+ "prepack": "npm run validate",
38
+ "release:check": "npm pack --dry-run",
39
+ "test": "vitest run",
40
+ "test:watch": "vitest",
41
+ "typecheck": "tsc --noEmit -p tsconfig.json",
42
+ "check": "npm run validate && npm run release:check",
43
+ "validate": "npm run check:meta && npm run format:check && npm run lint && npm run typecheck && npm run test && npm run build"
44
+ },
45
+ "engines": {
46
+ "node": ">=20"
47
+ },
48
+ "dependencies": {
49
+ "@koppajs/koppajs-language-core": "^0.1.2"
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^22.19.15",
53
+ "@typescript-eslint/eslint-plugin": "^8.46.2",
54
+ "@typescript-eslint/parser": "^8.46.2",
55
+ "eslint": "^9.38.0",
56
+ "typescript": "^5.3.3",
57
+ "vitest": "^3.2.4"
58
+ },
59
+ "publishConfig": {
60
+ "access": "public"
61
+ }
62
+ }