@agentxm/workspace-lint 0.28.4-bootstrap.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 +110 -0
- package/dist/src/catalog/index.d.ts +31 -0
- package/dist/src/catalog/index.js +60 -0
- package/dist/src/catalog/workspace/agents-detected-declared.d.ts +23 -0
- package/dist/src/catalog/workspace/agents-detected-declared.js +61 -0
- package/dist/src/catalog/workspace/agents-recognized.d.ts +23 -0
- package/dist/src/catalog/workspace/agents-recognized.js +64 -0
- package/dist/src/catalog/workspace/axm-skill-compatible.d.ts +4 -0
- package/dist/src/catalog/workspace/axm-skill-compatible.js +51 -0
- package/dist/src/catalog/workspace/configured-but-not-installed.d.ts +4 -0
- package/dist/src/catalog/workspace/configured-but-not-installed.js +88 -0
- package/dist/src/catalog/workspace/desired-state-reconcilable.d.ts +4 -0
- package/dist/src/catalog/workspace/desired-state-reconcilable.js +96 -0
- package/dist/src/catalog/workspace/display-paths.d.ts +7 -0
- package/dist/src/catalog/workspace/display-paths.js +4 -0
- package/dist/src/catalog/workspace/helpers/empty.d.ts +18 -0
- package/dist/src/catalog/workspace/helpers/empty.js +16 -0
- package/dist/src/catalog/workspace/helpers/finding.d.ts +10 -0
- package/dist/src/catalog/workspace/helpers/finding.js +11 -0
- package/dist/src/catalog/workspace/helpers/source-categorize.d.ts +16 -0
- package/dist/src/catalog/workspace/helpers/source-categorize.js +51 -0
- package/dist/src/catalog/workspace/hook-ownership-ambiguous.d.ts +4 -0
- package/dist/src/catalog/workspace/hook-ownership-ambiguous.js +25 -0
- package/dist/src/catalog/workspace/initialized.d.ts +22 -0
- package/dist/src/catalog/workspace/initialized.js +58 -0
- package/dist/src/catalog/workspace/instructions-agent-supported.d.ts +4 -0
- package/dist/src/catalog/workspace/instructions-agent-supported.js +38 -0
- package/dist/src/catalog/workspace/instructions-gitignore-current.d.ts +4 -0
- package/dist/src/catalog/workspace/instructions-gitignore-current.js +49 -0
- package/dist/src/catalog/workspace/instructions-source-present.d.ts +4 -0
- package/dist/src/catalog/workspace/instructions-source-present.js +41 -0
- package/dist/src/catalog/workspace/instructions-target-current.d.ts +4 -0
- package/dist/src/catalog/workspace/instructions-target-current.js +51 -0
- package/dist/src/catalog/workspace/instructions-target-stale.d.ts +9 -0
- package/dist/src/catalog/workspace/instructions-target-stale.js +41 -0
- package/dist/src/catalog/workspace/instructions-target-unowned.d.ts +10 -0
- package/dist/src/catalog/workspace/instructions-target-unowned.js +59 -0
- package/dist/src/catalog/workspace/knowledge-state-valid.d.ts +5 -0
- package/dist/src/catalog/workspace/knowledge-state-valid.js +65 -0
- package/dist/src/catalog/workspace/lockfile-valid.d.ts +5 -0
- package/dist/src/catalog/workspace/lockfile-valid.js +63 -0
- package/dist/src/catalog/workspace/managed-file-unowned.d.ts +4 -0
- package/dist/src/catalog/workspace/managed-file-unowned.js +25 -0
- package/dist/src/catalog/workspace/mcps-agent-drift.d.ts +4 -0
- package/dist/src/catalog/workspace/mcps-agent-drift.js +139 -0
- package/dist/src/catalog/workspace/mcps-agent-orphaned.d.ts +4 -0
- package/dist/src/catalog/workspace/mcps-agent-orphaned.js +64 -0
- package/dist/src/catalog/workspace/mcps-no-secret-literal.d.ts +4 -0
- package/dist/src/catalog/workspace/mcps-no-secret-literal.js +67 -0
- package/dist/src/catalog/workspace/mcps-shared-target-compatible.d.ts +4 -0
- package/dist/src/catalog/workspace/mcps-shared-target-compatible.js +58 -0
- package/dist/src/catalog/workspace/mcps-transport-exclusivity.d.ts +4 -0
- package/dist/src/catalog/workspace/mcps-transport-exclusivity.js +67 -0
- package/dist/src/catalog/workspace/packs-declarations-valid.d.ts +19 -0
- package/dist/src/catalog/workspace/packs-declarations-valid.js +110 -0
- package/dist/src/catalog/workspace/packs-dependencies-resolved.d.ts +5 -0
- package/dist/src/catalog/workspace/packs-dependencies-resolved.js +49 -0
- package/dist/src/catalog/workspace/projections-current.d.ts +15 -0
- package/dist/src/catalog/workspace/projections-current.js +35 -0
- package/dist/src/catalog/workspace/settings-keys-recognized.d.ts +17 -0
- package/dist/src/catalog/workspace/settings-keys-recognized.js +90 -0
- package/dist/src/catalog/workspace/settings-schema-valid.d.ts +27 -0
- package/dist/src/catalog/workspace/settings-schema-valid.js +68 -0
- package/dist/src/catalog/workspace/skills-artifacts-correct.d.ts +28 -0
- package/dist/src/catalog/workspace/skills-artifacts-correct.js +143 -0
- package/dist/src/catalog/workspace/skills-declarations-valid.d.ts +27 -0
- package/dist/src/catalog/workspace/skills-declarations-valid.js +102 -0
- package/dist/src/catalog/workspace/skills-integrity-valid.d.ts +28 -0
- package/dist/src/catalog/workspace/skills-integrity-valid.js +95 -0
- package/dist/src/catalog/workspace/skills-lockfile-aligned.d.ts +5 -0
- package/dist/src/catalog/workspace/skills-lockfile-aligned.js +64 -0
- package/dist/src/catalog/workspace/source-endpoints-aligned.d.ts +5 -0
- package/dist/src/catalog/workspace/source-endpoints-aligned.js +75 -0
- package/dist/src/catalog/workspace-fixtures/fixture-state.d.ts +8 -0
- package/dist/src/catalog/workspace-fixtures/fixture-state.js +120 -0
- package/dist/src/catalog/workspace-fixtures/interpret-ops.d.ts +11 -0
- package/dist/src/catalog/workspace-fixtures/interpret-ops.js +9 -0
- package/dist/src/catalog/workspace-read-model/lint-workspace.d.ts +191 -0
- package/dist/src/catalog/workspace-read-model/lint-workspace.js +651 -0
- package/dist/src/catalog/workspace-read-model/manifest-json.d.ts +14 -0
- package/dist/src/catalog/workspace-read-model/manifest-json.js +27 -0
- package/dist/src/catalog/workspace.d.ts +58 -0
- package/dist/src/catalog/workspace.js +164 -0
- package/dist/src/catalog-contexts.d.ts +106 -0
- package/dist/src/catalog-contexts.js +95 -0
- package/dist/src/cli.d.ts +239 -0
- package/dist/src/cli.js +1077 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.js +21 -0
- package/dist/src/json-schema.d.ts +121 -0
- package/dist/src/json-schema.js +99 -0
- package/dist/src/run/errors.d.ts +23 -0
- package/dist/src/run/errors.js +21 -0
- package/dist/src/run/settings.d.ts +63 -0
- package/dist/src/run/settings.js +139 -0
- package/dist/src/run/staged-workspace.d.ts +31 -0
- package/dist/src/run/staged-workspace.js +273 -0
- package/dist/src/workspace-context.d.ts +129 -0
- package/dist/src/workspace-context.js +12 -0
- package/package.json +55 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lint runner — the reusable core of `axm lint`.
|
|
3
|
+
*
|
|
4
|
+
* The `axm lint` CLI command file is a thin surface over flag parsing and
|
|
5
|
+
* rendering; the logic that evaluates rule catalogs, renders findings, and
|
|
6
|
+
* detects publish-gate drift lives in this module.
|
|
7
|
+
*
|
|
8
|
+
* Lint engine entry points:
|
|
9
|
+
*
|
|
10
|
+
* - {@link evaluateAllCatalogs} — concurrent evaluation of the three
|
|
11
|
+
* v1 rule catalogs against pre-built contexts.
|
|
12
|
+
* - {@link summarizeEvaluations} — group, count, and derive the exit
|
|
13
|
+
* category from raw `Evaluated<*>` lists.
|
|
14
|
+
* - {@link detectPublishGateDrift} — compute whether the configured
|
|
15
|
+
* `LintConfig` weakens any `skill/*` / `pack/*` platform-default-`error`
|
|
16
|
+
* rule (task 5.7).
|
|
17
|
+
* - {@link renderFindingsText} — finding-first human renderer (task
|
|
18
|
+
* 5.6).
|
|
19
|
+
* - {@link toLintJsonDocument} — `--json` document shape (task 5.6).
|
|
20
|
+
* - {@link resolveLintExitCategory} — exit-code contract evaluator (task
|
|
21
|
+
* 5.9).
|
|
22
|
+
*
|
|
23
|
+
* Lint-intent → canonical `Operation` adapter composition happens in the CLI
|
|
24
|
+
* handler (`packages/cli/src/root/lint/handler.ts`), which re-resolves each
|
|
25
|
+
* intent's `source` via the `resolveConfigured*` helpers and hands the
|
|
26
|
+
* resulting canonical Operation to the per-extension plan-step builder. The
|
|
27
|
+
* runner here stays accessor-free.
|
|
28
|
+
*
|
|
29
|
+
* @experimental This API is unstable and may change without notice.
|
|
30
|
+
* @packageDocumentation
|
|
31
|
+
*/
|
|
32
|
+
import * as Effect from "effect/Effect";
|
|
33
|
+
import type { LintConfig } from "@agentxm/registry-protocol/unstable/lint/config";
|
|
34
|
+
import { platformCanonicalLintConfig } from "@agentxm/registry-protocol/unstable/lint/config";
|
|
35
|
+
import type { Evaluated } from "@agentxm/registry-protocol/unstable/lint/evaluate";
|
|
36
|
+
import type { LintInput, LintJsonDocument } from "./json-schema.js";
|
|
37
|
+
import type { LintFinding, Severity } from "@agentxm/registry-protocol/unstable/lint/rule";
|
|
38
|
+
import type { AxmSkillCompatibility } from "@agentxm/extension-workspace";
|
|
39
|
+
import { type CatalogContext, type CatalogGroup, type CatalogRuleContexts, type LintView } from "./catalog-contexts.js";
|
|
40
|
+
/**
|
|
41
|
+
* A single finding annotated with the context that produced it.
|
|
42
|
+
*
|
|
43
|
+
* `displayRoot` carries the context's rendering root; `path` is the
|
|
44
|
+
* pre-composed display path for the finding so consumers (text / JSON /
|
|
45
|
+
* summary logs) don't re-derive it.
|
|
46
|
+
*
|
|
47
|
+
* @experimental This API is unstable and may change without notice.
|
|
48
|
+
*/
|
|
49
|
+
export interface RenderedFinding {
|
|
50
|
+
readonly group: CatalogGroup;
|
|
51
|
+
readonly ruleDescription: string;
|
|
52
|
+
readonly displayRoot: string;
|
|
53
|
+
readonly path: string;
|
|
54
|
+
readonly finding: LintFinding;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Per-group evaluation result, one entry per catalog. The raw `Evaluated<*>`
|
|
58
|
+
* list is retained so downstream consumers can render and emit JSON without
|
|
59
|
+
* re-running rules.
|
|
60
|
+
*
|
|
61
|
+
* Every group is required: a catalog that produced no findings still reports
|
|
62
|
+
* an empty list, so a missing group means a runner bug rather than "nothing to
|
|
63
|
+
* say".
|
|
64
|
+
*
|
|
65
|
+
* @experimental This API is unstable and may change without notice.
|
|
66
|
+
*/
|
|
67
|
+
export type GroupEvaluations = {
|
|
68
|
+
readonly [K in CatalogGroup]: ReadonlyArray<Evaluated<CatalogContext<K>>>;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Aggregate counts across all emitted findings.
|
|
72
|
+
*
|
|
73
|
+
* `total` === `errors + warnings + infos` — info findings participate in
|
|
74
|
+
* rendering and in the JSON envelope, but never influence exit code.
|
|
75
|
+
*
|
|
76
|
+
* @experimental This API is unstable and may change without notice.
|
|
77
|
+
*/
|
|
78
|
+
export interface FindingCounts {
|
|
79
|
+
readonly total: number;
|
|
80
|
+
readonly errors: number;
|
|
81
|
+
readonly warnings: number;
|
|
82
|
+
readonly infos: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Possible exit-code categories for `axm lint`.
|
|
86
|
+
*
|
|
87
|
+
* - `"clean"` — zero findings, or only info-severity findings; zero exit.
|
|
88
|
+
* - `"warnings"` — at least one warning, no errors; non-zero only when
|
|
89
|
+
* `--strict` is set (see {@link resolveLintExitCategory}).
|
|
90
|
+
* - `"errors"` — at least one error; non-zero exit regardless of flags.
|
|
91
|
+
*
|
|
92
|
+
* @experimental This API is unstable and may change without notice.
|
|
93
|
+
*/
|
|
94
|
+
export type LintExitCategory = "clean" | "warnings" | "errors";
|
|
95
|
+
/**
|
|
96
|
+
* Evaluate every rule catalog against its contexts, concurrently.
|
|
97
|
+
*
|
|
98
|
+
* Catalogs run in parallel; findings stay in stable catalog order inside each
|
|
99
|
+
* group, and groups render in {@link CATALOG_GROUP_ORDER}.
|
|
100
|
+
*
|
|
101
|
+
* @experimental This API is unstable and may change without notice.
|
|
102
|
+
*/
|
|
103
|
+
export declare const evaluateAllCatalogs: (args: {
|
|
104
|
+
readonly contexts: CatalogRuleContexts;
|
|
105
|
+
readonly config: LintConfig;
|
|
106
|
+
readonly view: LintView;
|
|
107
|
+
}) => Effect.Effect<GroupEvaluations>;
|
|
108
|
+
/**
|
|
109
|
+
* Flatten a {@link GroupEvaluations} record into a single `RenderedFinding[]`
|
|
110
|
+
* in stable group-then-catalog order.
|
|
111
|
+
*
|
|
112
|
+
* @experimental This API is unstable and may change without notice.
|
|
113
|
+
*/
|
|
114
|
+
export declare const collectRenderedFindings: (evaluations: GroupEvaluations) => ReadonlyArray<RenderedFinding>;
|
|
115
|
+
/**
|
|
116
|
+
* Count findings by severity across every group.
|
|
117
|
+
*
|
|
118
|
+
* @experimental This API is unstable and may change without notice.
|
|
119
|
+
*/
|
|
120
|
+
export declare const countFindings: (findings: ReadonlyArray<RenderedFinding>) => FindingCounts;
|
|
121
|
+
/**
|
|
122
|
+
* Aggregated summary — counts + derived exit category — computed from a
|
|
123
|
+
* {@link GroupEvaluations} triple.
|
|
124
|
+
*
|
|
125
|
+
* @experimental This API is unstable and may change without notice.
|
|
126
|
+
*/
|
|
127
|
+
export interface LintSummary {
|
|
128
|
+
readonly findings: ReadonlyArray<RenderedFinding>;
|
|
129
|
+
readonly counts: FindingCounts;
|
|
130
|
+
readonly exitCategory: LintExitCategory;
|
|
131
|
+
readonly driftBanner: ReadonlyArray<string>;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Derive a full {@link LintSummary} (findings, counts, exit category, drift
|
|
135
|
+
* banner rule ids) from raw evaluations + the configured severity overrides.
|
|
136
|
+
*
|
|
137
|
+
* @experimental This API is unstable and may change without notice.
|
|
138
|
+
*/
|
|
139
|
+
export declare const summarizeEvaluations: (evaluations: GroupEvaluations, config: LintConfig) => LintSummary;
|
|
140
|
+
/**
|
|
141
|
+
* Translate a {@link LintExitCategory} + `--strict` into the exit-code
|
|
142
|
+
* policy.
|
|
143
|
+
*
|
|
144
|
+
* | Category | --strict=false | --strict=true |
|
|
145
|
+
* | ------------ | -------------- | ------------- |
|
|
146
|
+
* | `"clean"` | `0` | `0` |
|
|
147
|
+
* | `"warnings"` | `0` | non-zero |
|
|
148
|
+
* | `"errors"` | non-zero | non-zero |
|
|
149
|
+
*
|
|
150
|
+
* The return value is a discriminated enum; the CLI handler maps the `"fail"`
|
|
151
|
+
* branch to its platform exit-code primitive.
|
|
152
|
+
*
|
|
153
|
+
* @experimental This API is unstable and may change without notice.
|
|
154
|
+
*/
|
|
155
|
+
export declare const resolveLintExitCategory: (args: {
|
|
156
|
+
readonly category: LintExitCategory;
|
|
157
|
+
readonly strict: boolean;
|
|
158
|
+
}) => "success" | "fail";
|
|
159
|
+
/**
|
|
160
|
+
* Identify every configured `lint.rules` entry that weakens a platform-canonical
|
|
161
|
+
* `error`-severity `skill/*` or `pack/*` rule.
|
|
162
|
+
*
|
|
163
|
+
* The publish gate runs the `skill/*` and `pack/*` catalogs against
|
|
164
|
+
* {@link platformCanonicalLintConfig}; any workspace override that lowers a
|
|
165
|
+
* rule in those namespaces from `error` to `off | info | warn` creates a
|
|
166
|
+
* publish-gate divergence the user should know about (they'll see `error`
|
|
167
|
+
* findings from the registry that don't appear locally).
|
|
168
|
+
*
|
|
169
|
+
* WorkspaceMutations-only rule weakenings (`workspace/*`) do NOT trigger the banner —
|
|
170
|
+
* those never reach publish.
|
|
171
|
+
*
|
|
172
|
+
* Returns the rule ids that trigger the banner, in catalog order, so the
|
|
173
|
+
* renderer can produce stable deterministic output.
|
|
174
|
+
*
|
|
175
|
+
* @experimental This API is unstable and may change without notice.
|
|
176
|
+
*/
|
|
177
|
+
export declare const detectPublishGateDrift: (config: LintConfig) => ReadonlyArray<string>;
|
|
178
|
+
/**
|
|
179
|
+
* Input for the human text renderer.
|
|
180
|
+
*
|
|
181
|
+
* @experimental This API is unstable and may change without notice.
|
|
182
|
+
*/
|
|
183
|
+
export type LintHumanReporter = "grouped" | "full" | "summary";
|
|
184
|
+
export interface RenderFindingsArgs {
|
|
185
|
+
readonly summary: LintSummary;
|
|
186
|
+
readonly reporter?: LintHumanReporter;
|
|
187
|
+
}
|
|
188
|
+
export interface LintHumanDiagnostic {
|
|
189
|
+
readonly severity: Severity;
|
|
190
|
+
readonly ruleId: string;
|
|
191
|
+
readonly title: string;
|
|
192
|
+
readonly details: ReadonlyArray<string>;
|
|
193
|
+
readonly helps: ReadonlyArray<string>;
|
|
194
|
+
readonly fixable: boolean;
|
|
195
|
+
readonly paths: ReadonlyArray<string>;
|
|
196
|
+
}
|
|
197
|
+
export type LintHumanBlock = {
|
|
198
|
+
readonly kind: "overview";
|
|
199
|
+
readonly message: string;
|
|
200
|
+
readonly counts: FindingCounts;
|
|
201
|
+
readonly notes: ReadonlyArray<string>;
|
|
202
|
+
} | {
|
|
203
|
+
readonly kind: "driftBanner";
|
|
204
|
+
readonly title: string;
|
|
205
|
+
readonly ruleIds: ReadonlyArray<string>;
|
|
206
|
+
} | {
|
|
207
|
+
readonly kind: "section";
|
|
208
|
+
readonly title: string;
|
|
209
|
+
readonly note?: string;
|
|
210
|
+
} | {
|
|
211
|
+
readonly kind: "diagnostic";
|
|
212
|
+
readonly diagnostic: LintHumanDiagnostic;
|
|
213
|
+
} | {
|
|
214
|
+
readonly kind: "pathGroup";
|
|
215
|
+
readonly path: string;
|
|
216
|
+
readonly diagnostics: ReadonlyArray<LintHumanDiagnostic>;
|
|
217
|
+
} | {
|
|
218
|
+
readonly kind: "blank";
|
|
219
|
+
} | {
|
|
220
|
+
readonly kind: "empty";
|
|
221
|
+
readonly message: string;
|
|
222
|
+
} | {
|
|
223
|
+
readonly kind: "footer";
|
|
224
|
+
readonly message: string;
|
|
225
|
+
};
|
|
226
|
+
export declare const toLintHumanBlocks: (args: RenderFindingsArgs) => ReadonlyArray<LintHumanBlock>;
|
|
227
|
+
export declare const renderFindingsText: (args: RenderFindingsArgs) => ReadonlyArray<string>;
|
|
228
|
+
/**
|
|
229
|
+
* Build the `--json` document from a {@link LintSummary}.
|
|
230
|
+
*
|
|
231
|
+
* @experimental This API is unstable and may change without notice.
|
|
232
|
+
*/
|
|
233
|
+
export declare const toLintJsonDocument: (args: {
|
|
234
|
+
readonly summary: LintSummary;
|
|
235
|
+
readonly input: LintInput;
|
|
236
|
+
readonly axmSkillCompatibility?: AxmSkillCompatibility;
|
|
237
|
+
}) => LintJsonDocument;
|
|
238
|
+
export { platformCanonicalLintConfig };
|
|
239
|
+
//# sourceMappingURL=cli.d.ts.map
|