@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,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest JSON reader for workspace lint projections.
|
|
3
|
+
*
|
|
4
|
+
* Reads through the already-rooted per-extension file accessor, parses loose
|
|
5
|
+
* JSON, and returns the raw parsed value. It intentionally does not decode
|
|
6
|
+
* against a manifest schema because unknown keys must remain visible to the
|
|
7
|
+
* `*-keys-recognized` rules.
|
|
8
|
+
*
|
|
9
|
+
* @experimental This API is unstable and may change without notice.
|
|
10
|
+
*/
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import * as Schema from "effect/Schema";
|
|
13
|
+
import { makeManifestJsonParseFailure } from "@agentxm/registry-protocol/unstable/lint/catalog/shared/manifest-json";
|
|
14
|
+
const decoder = new TextDecoder();
|
|
15
|
+
export const readManifestJson = (accessor, filename) => Effect.gen(function* () {
|
|
16
|
+
const exists = yield* accessor.exists(filename);
|
|
17
|
+
if (!exists) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
const bytes = yield* accessor.readBytes(filename).pipe(Effect.catch(() => Effect.void));
|
|
21
|
+
if (bytes === undefined) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const raw = decoder.decode(bytes);
|
|
25
|
+
return yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Unknown))(raw).pipe(Effect.catch(() => Effect.succeed(makeManifestJsonParseFailure(filename))));
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=manifest-json.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `workspace/*` rule catalog — the v1 rule set.
|
|
3
|
+
*
|
|
4
|
+
* Per the lint design, `axm lint` (locally only —
|
|
5
|
+
* never publish) runs exactly these rules against each workspace read model.
|
|
6
|
+
* Rules are grouped by classification invariant — foundation first, then
|
|
7
|
+
* one group per invariant that install-family rules enforce:
|
|
8
|
+
*
|
|
9
|
+
* | ID | Severity | Autofix |
|
|
10
|
+
* | --------------------------------------- | -------- | ----------- |
|
|
11
|
+
* | `workspace/initialized` | error | — |
|
|
12
|
+
* | `workspace/settings-schema-valid` | error | — |
|
|
13
|
+
* | `workspace/settings-keys-recognized` | error | — |
|
|
14
|
+
* | `workspace/lockfile-valid` | error | autofixing |
|
|
15
|
+
* | `workspace/desired-state-reconcilable` | error | — |
|
|
16
|
+
* | `workspace/agents-recognized` | error | — |
|
|
17
|
+
* | `workspace/agents-detected-declared` | warning | — |
|
|
18
|
+
* | `workspace/skills-declarations-valid` | error | — |
|
|
19
|
+
* | `workspace/packs-declarations-valid` | error | — |
|
|
20
|
+
* | `workspace/knowledge-state-valid` | error | — |
|
|
21
|
+
* | `workspace/skills-lockfile-aligned` | error | autofixing |
|
|
22
|
+
* | `workspace/skills-integrity-valid` | error | autofixing |
|
|
23
|
+
* | `workspace/skills-artifacts-correct` | error | autofixing |
|
|
24
|
+
* | `workspace/skills-managed` | error | — |
|
|
25
|
+
* | `workspace/packs-dependencies-resolved` | error | — |
|
|
26
|
+
* | `workspace/recommended-packs-retained` | warning | — |
|
|
27
|
+
*
|
|
28
|
+
* Autofix rides per-extension Operations only (§6). No `editFile`,
|
|
29
|
+
* `writeFile`, or `syncWorkspace()` reference — arms whose remediation can't
|
|
30
|
+
* be expressed in the operation vocabulary ship as `AdvisoryFinding` with a
|
|
31
|
+
* CLI suggestion instead.
|
|
32
|
+
*
|
|
33
|
+
* Rule ids are **registered with the lint config allowlist at module-load
|
|
34
|
+
* time**, so importing this catalog extends the set of accepted
|
|
35
|
+
* `axm.json` `lint.rules` keys.
|
|
36
|
+
*
|
|
37
|
+
* @experimental This API is unstable and may change without notice.
|
|
38
|
+
* @packageDocumentation
|
|
39
|
+
*/
|
|
40
|
+
import type { LintRule } from "@agentxm/registry-protocol/unstable/lint/rule";
|
|
41
|
+
import type { WorkspaceRuleContext } from "../workspace-context.js";
|
|
42
|
+
/**
|
|
43
|
+
* Ordered v1 `workspace/*` rule catalog. Declaration order is the evaluation
|
|
44
|
+
* order within a single `evaluateContexts` call (deterministic ordering is
|
|
45
|
+
* test-observable; see `evaluate.ts`). The catalog groups foundation rules
|
|
46
|
+
* first, then install-family rules by classification invariant: declaration
|
|
47
|
+
* validity, lockfile alignment, integrity, artifact correctness, the
|
|
48
|
+
* unmanaged-class-empty check, pack dependency resolution, and implicit
|
|
49
|
+
* retention.
|
|
50
|
+
*
|
|
51
|
+
* @experimental This API is unstable and may change without notice.
|
|
52
|
+
*/
|
|
53
|
+
export declare const repositoryWorkspaceRules: ReadonlyArray<LintRule<WorkspaceRuleContext>>;
|
|
54
|
+
/** Rules whose evidence exists only in the live managed workspace. */
|
|
55
|
+
export declare const liveOnlyWorkspaceRules: ReadonlyArray<LintRule<WorkspaceRuleContext>>;
|
|
56
|
+
/** Complete workspace-view catalog, retained as the public catalog surface. */
|
|
57
|
+
export declare const workspaceRules: ReadonlyArray<LintRule<WorkspaceRuleContext>>;
|
|
58
|
+
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `workspace/*` rule catalog — the v1 rule set.
|
|
3
|
+
*
|
|
4
|
+
* Per the lint design, `axm lint` (locally only —
|
|
5
|
+
* never publish) runs exactly these rules against each workspace read model.
|
|
6
|
+
* Rules are grouped by classification invariant — foundation first, then
|
|
7
|
+
* one group per invariant that install-family rules enforce:
|
|
8
|
+
*
|
|
9
|
+
* | ID | Severity | Autofix |
|
|
10
|
+
* | --------------------------------------- | -------- | ----------- |
|
|
11
|
+
* | `workspace/initialized` | error | — |
|
|
12
|
+
* | `workspace/settings-schema-valid` | error | — |
|
|
13
|
+
* | `workspace/settings-keys-recognized` | error | — |
|
|
14
|
+
* | `workspace/lockfile-valid` | error | autofixing |
|
|
15
|
+
* | `workspace/desired-state-reconcilable` | error | — |
|
|
16
|
+
* | `workspace/agents-recognized` | error | — |
|
|
17
|
+
* | `workspace/agents-detected-declared` | warning | — |
|
|
18
|
+
* | `workspace/skills-declarations-valid` | error | — |
|
|
19
|
+
* | `workspace/packs-declarations-valid` | error | — |
|
|
20
|
+
* | `workspace/knowledge-state-valid` | error | — |
|
|
21
|
+
* | `workspace/skills-lockfile-aligned` | error | autofixing |
|
|
22
|
+
* | `workspace/skills-integrity-valid` | error | autofixing |
|
|
23
|
+
* | `workspace/skills-artifacts-correct` | error | autofixing |
|
|
24
|
+
* | `workspace/skills-managed` | error | — |
|
|
25
|
+
* | `workspace/packs-dependencies-resolved` | error | — |
|
|
26
|
+
* | `workspace/recommended-packs-retained` | warning | — |
|
|
27
|
+
*
|
|
28
|
+
* Autofix rides per-extension Operations only (§6). No `editFile`,
|
|
29
|
+
* `writeFile`, or `syncWorkspace()` reference — arms whose remediation can't
|
|
30
|
+
* be expressed in the operation vocabulary ship as `AdvisoryFinding` with a
|
|
31
|
+
* CLI suggestion instead.
|
|
32
|
+
*
|
|
33
|
+
* Rule ids are **registered with the lint config allowlist at module-load
|
|
34
|
+
* time**, so importing this catalog extends the set of accepted
|
|
35
|
+
* `axm.json` `lint.rules` keys.
|
|
36
|
+
*
|
|
37
|
+
* @experimental This API is unstable and may change without notice.
|
|
38
|
+
* @packageDocumentation
|
|
39
|
+
*/
|
|
40
|
+
import { registerLintRuleIds } from "@agentxm/registry-protocol/unstable/lint/config";
|
|
41
|
+
import { initializedRule } from "./workspace/initialized.js";
|
|
42
|
+
import { settingsSchemaValidRule } from "./workspace/settings-schema-valid.js";
|
|
43
|
+
import { settingsKeysRecognizedRule } from "./workspace/settings-keys-recognized.js";
|
|
44
|
+
import { lockfileValidRule } from "./workspace/lockfile-valid.js";
|
|
45
|
+
import { agentsRecognizedRule } from "./workspace/agents-recognized.js";
|
|
46
|
+
import { agentsDetectedDeclaredRule } from "./workspace/agents-detected-declared.js";
|
|
47
|
+
import { instructionsSourcePresentRule } from "./workspace/instructions-source-present.js";
|
|
48
|
+
import { instructionsTargetCurrentRule } from "./workspace/instructions-target-current.js";
|
|
49
|
+
import { instructionsTargetUnownedRule } from "./workspace/instructions-target-unowned.js";
|
|
50
|
+
import { instructionsTargetStaleRule } from "./workspace/instructions-target-stale.js";
|
|
51
|
+
import { projectionsCurrentRule } from "./workspace/projections-current.js";
|
|
52
|
+
import { instructionsAgentSupportedRule } from "./workspace/instructions-agent-supported.js";
|
|
53
|
+
import { instructionsGitignoreCurrentRule } from "./workspace/instructions-gitignore-current.js";
|
|
54
|
+
import { skillsDeclarationsValidRule } from "./workspace/skills-declarations-valid.js";
|
|
55
|
+
import { skillsLockfileAlignedRule } from "./workspace/skills-lockfile-aligned.js";
|
|
56
|
+
import { skillsIntegrityValidRule } from "./workspace/skills-integrity-valid.js";
|
|
57
|
+
import { skillsArtifactsCorrectRule } from "./workspace/skills-artifacts-correct.js";
|
|
58
|
+
import { packsDeclarationsValidRule } from "./workspace/packs-declarations-valid.js";
|
|
59
|
+
import { packsDependenciesResolvedRule } from "./workspace/packs-dependencies-resolved.js";
|
|
60
|
+
import { configuredButNotInstalledRule } from "./workspace/configured-but-not-installed.js";
|
|
61
|
+
import { mcpServerNoSecretLiteralRule } from "./workspace/mcps-no-secret-literal.js";
|
|
62
|
+
import { mcpServerTransportExclusivityRule } from "./workspace/mcps-transport-exclusivity.js";
|
|
63
|
+
import { mcpServerAgentDriftRule } from "./workspace/mcps-agent-drift.js";
|
|
64
|
+
import { mcpServerSharedTargetCompatibleRule } from "./workspace/mcps-shared-target-compatible.js";
|
|
65
|
+
import { mcpServerAgentOrphanedRule } from "./workspace/mcps-agent-orphaned.js";
|
|
66
|
+
import { desiredStateReconcilableRule } from "./workspace/desired-state-reconcilable.js";
|
|
67
|
+
import { knowledgeStateValidRule } from "./workspace/knowledge-state-valid.js";
|
|
68
|
+
import { axmSkillCompatibleRule } from "./workspace/axm-skill-compatible.js";
|
|
69
|
+
import { hookOwnershipAmbiguousRule } from "./workspace/hook-ownership-ambiguous.js";
|
|
70
|
+
import { managedFileUnownedRule } from "./workspace/managed-file-unowned.js";
|
|
71
|
+
import { sourceEndpointsAlignedRule } from "./workspace/source-endpoints-aligned.js";
|
|
72
|
+
/**
|
|
73
|
+
* Ordered v1 `workspace/*` rule catalog. Declaration order is the evaluation
|
|
74
|
+
* order within a single `evaluateContexts` call (deterministic ordering is
|
|
75
|
+
* test-observable; see `evaluate.ts`). The catalog groups foundation rules
|
|
76
|
+
* first, then install-family rules by classification invariant: declaration
|
|
77
|
+
* validity, lockfile alignment, integrity, artifact correctness, the
|
|
78
|
+
* unmanaged-class-empty check, pack dependency resolution, and implicit
|
|
79
|
+
* retention.
|
|
80
|
+
*
|
|
81
|
+
* @experimental This API is unstable and may change without notice.
|
|
82
|
+
*/
|
|
83
|
+
export const repositoryWorkspaceRules = [
|
|
84
|
+
// Foundation (classification-independent workspace well-formedness).
|
|
85
|
+
initializedRule,
|
|
86
|
+
settingsSchemaValidRule,
|
|
87
|
+
settingsKeysRecognizedRule,
|
|
88
|
+
lockfileValidRule,
|
|
89
|
+
sourceEndpointsAlignedRule,
|
|
90
|
+
desiredStateReconcilableRule,
|
|
91
|
+
axmSkillCompatibleRule,
|
|
92
|
+
agentsRecognizedRule,
|
|
93
|
+
instructionsSourcePresentRule,
|
|
94
|
+
instructionsAgentSupportedRule,
|
|
95
|
+
instructionsGitignoreCurrentRule,
|
|
96
|
+
// Declaration valid (configured).
|
|
97
|
+
skillsDeclarationsValidRule,
|
|
98
|
+
packsDeclarationsValidRule,
|
|
99
|
+
configuredButNotInstalledRule,
|
|
100
|
+
knowledgeStateValidRule,
|
|
101
|
+
mcpServerTransportExclusivityRule,
|
|
102
|
+
mcpServerNoSecretLiteralRule,
|
|
103
|
+
mcpServerSharedTargetCompatibleRule,
|
|
104
|
+
// Lockfile aligned (configured).
|
|
105
|
+
skillsLockfileAlignedRule,
|
|
106
|
+
// Integrity intact (configured + implicit).
|
|
107
|
+
skillsIntegrityValidRule,
|
|
108
|
+
// Artifacts correct (configured + implicit).
|
|
109
|
+
// Managed — unmanaged class must be empty.
|
|
110
|
+
// Pack dependencies resolved (configured packs).
|
|
111
|
+
packsDependenciesResolvedRule,
|
|
112
|
+
];
|
|
113
|
+
/** Rules whose evidence exists only in the live managed workspace. */
|
|
114
|
+
export const liveOnlyWorkspaceRules = [
|
|
115
|
+
agentsDetectedDeclaredRule,
|
|
116
|
+
instructionsTargetCurrentRule,
|
|
117
|
+
instructionsTargetUnownedRule,
|
|
118
|
+
instructionsTargetStaleRule,
|
|
119
|
+
projectionsCurrentRule,
|
|
120
|
+
hookOwnershipAmbiguousRule,
|
|
121
|
+
managedFileUnownedRule,
|
|
122
|
+
skillsArtifactsCorrectRule,
|
|
123
|
+
mcpServerAgentDriftRule,
|
|
124
|
+
mcpServerAgentOrphanedRule,
|
|
125
|
+
];
|
|
126
|
+
/** Complete workspace-view catalog, retained as the public catalog surface. */
|
|
127
|
+
export const workspaceRules = [
|
|
128
|
+
initializedRule,
|
|
129
|
+
settingsSchemaValidRule,
|
|
130
|
+
settingsKeysRecognizedRule,
|
|
131
|
+
lockfileValidRule,
|
|
132
|
+
sourceEndpointsAlignedRule,
|
|
133
|
+
desiredStateReconcilableRule,
|
|
134
|
+
axmSkillCompatibleRule,
|
|
135
|
+
agentsRecognizedRule,
|
|
136
|
+
agentsDetectedDeclaredRule,
|
|
137
|
+
instructionsSourcePresentRule,
|
|
138
|
+
instructionsTargetCurrentRule,
|
|
139
|
+
instructionsTargetUnownedRule,
|
|
140
|
+
instructionsTargetStaleRule,
|
|
141
|
+
instructionsAgentSupportedRule,
|
|
142
|
+
instructionsGitignoreCurrentRule,
|
|
143
|
+
projectionsCurrentRule,
|
|
144
|
+
hookOwnershipAmbiguousRule,
|
|
145
|
+
managedFileUnownedRule,
|
|
146
|
+
skillsDeclarationsValidRule,
|
|
147
|
+
packsDeclarationsValidRule,
|
|
148
|
+
configuredButNotInstalledRule,
|
|
149
|
+
knowledgeStateValidRule,
|
|
150
|
+
mcpServerTransportExclusivityRule,
|
|
151
|
+
mcpServerNoSecretLiteralRule,
|
|
152
|
+
mcpServerSharedTargetCompatibleRule,
|
|
153
|
+
mcpServerAgentDriftRule,
|
|
154
|
+
mcpServerAgentOrphanedRule,
|
|
155
|
+
skillsLockfileAlignedRule,
|
|
156
|
+
skillsIntegrityValidRule,
|
|
157
|
+
skillsArtifactsCorrectRule,
|
|
158
|
+
packsDependenciesResolvedRule,
|
|
159
|
+
];
|
|
160
|
+
// Register ids into the `LintConfig.rules` allowlist. Module-load side effect:
|
|
161
|
+
// a consumer that imports this catalog (or the `catalog/index` barrel) enables
|
|
162
|
+
// `axm.json` `lint.rules` to reference any of the above rule ids.
|
|
163
|
+
registerLintRuleIds(workspaceRules.map((r) => r.id));
|
|
164
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lint runner's catalog table — one entry per rule namespace, total by
|
|
3
|
+
* construction over `ExtensionType`.
|
|
4
|
+
*
|
|
5
|
+
* `axm lint` used to name its catalogs seven times over (an import list, a
|
|
6
|
+
* group union, an evaluation tuple, a rendering list, a drift-detection call
|
|
7
|
+
* sequence), and a catalog could be — and was — added to the barrel while
|
|
8
|
+
* being silently skipped by the runner: `hookRules` shipped evaluated by the
|
|
9
|
+
* publish gate but never by `axm lint`.
|
|
10
|
+
*
|
|
11
|
+
* Now every catalog is a key of {@link CatalogRuleContexts} and a row of
|
|
12
|
+
* {@link LINT_CATALOGS}. Because the table is checked against
|
|
13
|
+
* `Record<ExtensionType | "workspace", ...>`, adding an extension type to
|
|
14
|
+
* `EXTENSION_TYPE_TABLE` fails compile here until its catalog is decided, and
|
|
15
|
+
* deleting a key from `CatalogRuleContexts` fails compile at the row that
|
|
16
|
+
* indexes it.
|
|
17
|
+
*
|
|
18
|
+
* @experimental This API is unstable and may change without notice.
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
*/
|
|
21
|
+
import type { ExtensionType } from "@agentxm/extension-model/unstable/extensions/common";
|
|
22
|
+
import type { HookRuleContext, KnowledgeRuleContext, McpServerRuleContext, PackRuleContext, RuleRuleContext, SkillRuleContext, SubagentRuleContext } from "@agentxm/registry-protocol/unstable/lint/context";
|
|
23
|
+
import type { WorkspaceRuleContext } from "./workspace-context.js";
|
|
24
|
+
import type { LintRule } from "@agentxm/registry-protocol/unstable/lint/rule";
|
|
25
|
+
/**
|
|
26
|
+
* The contexts a full lint run evaluates, one array per catalog.
|
|
27
|
+
*
|
|
28
|
+
* `workspace` is the one pseudo-group: it is not an extension type, and it
|
|
29
|
+
* always carries exactly the single workspace context.
|
|
30
|
+
*
|
|
31
|
+
* @experimental This API is unstable and may change without notice.
|
|
32
|
+
*/
|
|
33
|
+
export interface CatalogRuleContexts {
|
|
34
|
+
readonly skill: ReadonlyArray<SkillRuleContext>;
|
|
35
|
+
readonly pack: ReadonlyArray<PackRuleContext>;
|
|
36
|
+
readonly subagent: ReadonlyArray<SubagentRuleContext>;
|
|
37
|
+
readonly "mcp-server": ReadonlyArray<McpServerRuleContext>;
|
|
38
|
+
readonly rule: ReadonlyArray<RuleRuleContext>;
|
|
39
|
+
readonly hook: ReadonlyArray<HookRuleContext>;
|
|
40
|
+
readonly knowledge: ReadonlyArray<KnowledgeRuleContext>;
|
|
41
|
+
readonly workspace: ReadonlyArray<WorkspaceRuleContext>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A catalog key: every extension type, plus the `workspace` pseudo-group.
|
|
45
|
+
*
|
|
46
|
+
* Declared from `ExtensionType` rather than `keyof CatalogRuleContexts`, so
|
|
47
|
+
* the two must agree: a new extension type leaves `CatalogRuleContexts`
|
|
48
|
+
* missing a key, and a deleted `CatalogRuleContexts` key leaves
|
|
49
|
+
* {@link CatalogContext} indexing a key that no longer exists. Either way the
|
|
50
|
+
* build fails until the catalog is decided.
|
|
51
|
+
*
|
|
52
|
+
* @experimental This API is unstable and may change without notice.
|
|
53
|
+
*/
|
|
54
|
+
export type CatalogGroup = ExtensionType | "workspace";
|
|
55
|
+
/** Filesystem identity evaluated by a lint run. */
|
|
56
|
+
export type LintView = "workspace" | "git-index";
|
|
57
|
+
/** The context type a given catalog's rules consume. */
|
|
58
|
+
export type CatalogContext<K extends CatalogGroup> = CatalogRuleContexts[K][number];
|
|
59
|
+
/**
|
|
60
|
+
* Every rule catalog, keyed by group.
|
|
61
|
+
*
|
|
62
|
+
* The annotation is the totality gate: the key set is `ExtensionType |
|
|
63
|
+
* "workspace"`, and each value is checked against the context type
|
|
64
|
+
* `CatalogRuleContexts` declares for that key.
|
|
65
|
+
*
|
|
66
|
+
* @experimental This API is unstable and may change without notice.
|
|
67
|
+
*/
|
|
68
|
+
export declare const REPOSITORY_LINT_CATALOGS: {
|
|
69
|
+
readonly [K in CatalogGroup]: ReadonlyArray<LintRule<CatalogContext<K>>>;
|
|
70
|
+
};
|
|
71
|
+
/** Positive catalog of rules that require live operational state. */
|
|
72
|
+
export declare const LIVE_ONLY_LINT_CATALOGS: {
|
|
73
|
+
workspace: readonly LintRule<WorkspaceRuleContext>[];
|
|
74
|
+
};
|
|
75
|
+
/** Select positive rule catalogs for a view without an exclusion list. */
|
|
76
|
+
export declare const lintCatalogsForView: (view: LintView) => { readonly [K in CatalogGroup]: ReadonlyArray<LintRule<CatalogContext<K>>>; };
|
|
77
|
+
/** Complete workspace catalog retained for callers that do not select a view. */
|
|
78
|
+
export declare const LINT_CATALOGS: {
|
|
79
|
+
readonly skill: readonly LintRule<SkillRuleContext<import("@agentxm/registry-protocol/unstable/lint/context").SkillContent>>[];
|
|
80
|
+
readonly "mcp-server": readonly LintRule<McpServerRuleContext<import("@agentxm/registry-protocol/unstable/lint/context").McpServerContent>>[];
|
|
81
|
+
readonly subagent: readonly LintRule<SubagentRuleContext<import("@agentxm/registry-protocol/unstable/lint/context").SubagentContent>>[];
|
|
82
|
+
readonly rule: readonly LintRule<RuleRuleContext<import("@agentxm/registry-protocol/unstable/lint/context").RuleContent>>[];
|
|
83
|
+
readonly hook: readonly LintRule<HookRuleContext<import("@agentxm/registry-protocol/unstable/lint/context").HookContent>>[];
|
|
84
|
+
readonly knowledge: readonly LintRule<KnowledgeRuleContext<import("@agentxm/registry-protocol/unstable/lint/context").KnowledgeContent>>[];
|
|
85
|
+
readonly pack: readonly LintRule<PackRuleContext<import("@agentxm/registry-protocol/unstable/lint/context").PackContent>>[];
|
|
86
|
+
readonly workspace: readonly LintRule<WorkspaceRuleContext>[];
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Catalog evaluation and rendering order.
|
|
90
|
+
*
|
|
91
|
+
* Findings render group-by-group in this order and the order is
|
|
92
|
+
* test-observable, so it is declared explicitly rather than derived from
|
|
93
|
+
* object key order. It matches `allCatalogRuleIds` in the catalog barrel;
|
|
94
|
+
* `workspace` stays last.
|
|
95
|
+
*
|
|
96
|
+
* @experimental This API is unstable and may change without notice.
|
|
97
|
+
*/
|
|
98
|
+
export declare const CATALOG_GROUP_ORDER: readonly ["skill", "pack", "subagent", "mcp-server", "hook", "rule", "knowledge", "workspace"];
|
|
99
|
+
/**
|
|
100
|
+
* An empty context record. Callers that evaluate only some catalogs spread
|
|
101
|
+
* this so adding a catalog does not silently skip them.
|
|
102
|
+
*
|
|
103
|
+
* @experimental This API is unstable and may change without notice.
|
|
104
|
+
*/
|
|
105
|
+
export declare const emptyCatalogRuleContexts: CatalogRuleContexts;
|
|
106
|
+
//# sourceMappingURL=catalog-contexts.d.ts.map
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lint runner's catalog table — one entry per rule namespace, total by
|
|
3
|
+
* construction over `ExtensionType`.
|
|
4
|
+
*
|
|
5
|
+
* `axm lint` used to name its catalogs seven times over (an import list, a
|
|
6
|
+
* group union, an evaluation tuple, a rendering list, a drift-detection call
|
|
7
|
+
* sequence), and a catalog could be — and was — added to the barrel while
|
|
8
|
+
* being silently skipped by the runner: `hookRules` shipped evaluated by the
|
|
9
|
+
* publish gate but never by `axm lint`.
|
|
10
|
+
*
|
|
11
|
+
* Now every catalog is a key of {@link CatalogRuleContexts} and a row of
|
|
12
|
+
* {@link LINT_CATALOGS}. Because the table is checked against
|
|
13
|
+
* `Record<ExtensionType | "workspace", ...>`, adding an extension type to
|
|
14
|
+
* `EXTENSION_TYPE_TABLE` fails compile here until its catalog is decided, and
|
|
15
|
+
* deleting a key from `CatalogRuleContexts` fails compile at the row that
|
|
16
|
+
* indexes it.
|
|
17
|
+
*
|
|
18
|
+
* @experimental This API is unstable and may change without notice.
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
*/
|
|
21
|
+
import { hookRules } from "@agentxm/registry-protocol/unstable/lint/catalog/hook";
|
|
22
|
+
import { knowledgeRules } from "@agentxm/registry-protocol/unstable/lint/catalog/knowledge";
|
|
23
|
+
import { mcpServerRules } from "@agentxm/registry-protocol/unstable/lint/catalog/mcp-server";
|
|
24
|
+
import { packRules } from "@agentxm/registry-protocol/unstable/lint/catalog/pack";
|
|
25
|
+
import { ruleRules } from "@agentxm/registry-protocol/unstable/lint/catalog/rule";
|
|
26
|
+
import { skillRules } from "@agentxm/registry-protocol/unstable/lint/catalog/skill";
|
|
27
|
+
import { subagentRules } from "@agentxm/registry-protocol/unstable/lint/catalog/subagent";
|
|
28
|
+
import { liveOnlyWorkspaceRules, repositoryWorkspaceRules, workspaceRules, } from "./catalog/index.js";
|
|
29
|
+
/**
|
|
30
|
+
* Every rule catalog, keyed by group.
|
|
31
|
+
*
|
|
32
|
+
* The annotation is the totality gate: the key set is `ExtensionType |
|
|
33
|
+
* "workspace"`, and each value is checked against the context type
|
|
34
|
+
* `CatalogRuleContexts` declares for that key.
|
|
35
|
+
*
|
|
36
|
+
* @experimental This API is unstable and may change without notice.
|
|
37
|
+
*/
|
|
38
|
+
export const REPOSITORY_LINT_CATALOGS = {
|
|
39
|
+
skill: skillRules,
|
|
40
|
+
pack: packRules,
|
|
41
|
+
subagent: subagentRules,
|
|
42
|
+
"mcp-server": mcpServerRules,
|
|
43
|
+
rule: ruleRules,
|
|
44
|
+
hook: hookRules,
|
|
45
|
+
knowledge: knowledgeRules,
|
|
46
|
+
workspace: repositoryWorkspaceRules,
|
|
47
|
+
};
|
|
48
|
+
/** Positive catalog of rules that require live operational state. */
|
|
49
|
+
export const LIVE_ONLY_LINT_CATALOGS = {
|
|
50
|
+
workspace: liveOnlyWorkspaceRules,
|
|
51
|
+
};
|
|
52
|
+
/** Select positive rule catalogs for a view without an exclusion list. */
|
|
53
|
+
export const lintCatalogsForView = (view) => ({
|
|
54
|
+
...REPOSITORY_LINT_CATALOGS,
|
|
55
|
+
workspace: view === "workspace" ? workspaceRules : REPOSITORY_LINT_CATALOGS.workspace,
|
|
56
|
+
});
|
|
57
|
+
/** Complete workspace catalog retained for callers that do not select a view. */
|
|
58
|
+
export const LINT_CATALOGS = lintCatalogsForView("workspace");
|
|
59
|
+
/**
|
|
60
|
+
* Catalog evaluation and rendering order.
|
|
61
|
+
*
|
|
62
|
+
* Findings render group-by-group in this order and the order is
|
|
63
|
+
* test-observable, so it is declared explicitly rather than derived from
|
|
64
|
+
* object key order. It matches `allCatalogRuleIds` in the catalog barrel;
|
|
65
|
+
* `workspace` stays last.
|
|
66
|
+
*
|
|
67
|
+
* @experimental This API is unstable and may change without notice.
|
|
68
|
+
*/
|
|
69
|
+
export const CATALOG_GROUP_ORDER = [
|
|
70
|
+
"skill",
|
|
71
|
+
"pack",
|
|
72
|
+
"subagent",
|
|
73
|
+
"mcp-server",
|
|
74
|
+
"hook",
|
|
75
|
+
"rule",
|
|
76
|
+
"knowledge",
|
|
77
|
+
"workspace",
|
|
78
|
+
];
|
|
79
|
+
/**
|
|
80
|
+
* An empty context record. Callers that evaluate only some catalogs spread
|
|
81
|
+
* this so adding a catalog does not silently skip them.
|
|
82
|
+
*
|
|
83
|
+
* @experimental This API is unstable and may change without notice.
|
|
84
|
+
*/
|
|
85
|
+
export const emptyCatalogRuleContexts = {
|
|
86
|
+
skill: [],
|
|
87
|
+
pack: [],
|
|
88
|
+
subagent: [],
|
|
89
|
+
"mcp-server": [],
|
|
90
|
+
rule: [],
|
|
91
|
+
hook: [],
|
|
92
|
+
knowledge: [],
|
|
93
|
+
workspace: [],
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=catalog-contexts.js.map
|