@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.
Files changed (100) hide show
  1. package/LICENSE +110 -0
  2. package/dist/src/catalog/index.d.ts +31 -0
  3. package/dist/src/catalog/index.js +60 -0
  4. package/dist/src/catalog/workspace/agents-detected-declared.d.ts +23 -0
  5. package/dist/src/catalog/workspace/agents-detected-declared.js +61 -0
  6. package/dist/src/catalog/workspace/agents-recognized.d.ts +23 -0
  7. package/dist/src/catalog/workspace/agents-recognized.js +64 -0
  8. package/dist/src/catalog/workspace/axm-skill-compatible.d.ts +4 -0
  9. package/dist/src/catalog/workspace/axm-skill-compatible.js +51 -0
  10. package/dist/src/catalog/workspace/configured-but-not-installed.d.ts +4 -0
  11. package/dist/src/catalog/workspace/configured-but-not-installed.js +88 -0
  12. package/dist/src/catalog/workspace/desired-state-reconcilable.d.ts +4 -0
  13. package/dist/src/catalog/workspace/desired-state-reconcilable.js +96 -0
  14. package/dist/src/catalog/workspace/display-paths.d.ts +7 -0
  15. package/dist/src/catalog/workspace/display-paths.js +4 -0
  16. package/dist/src/catalog/workspace/helpers/empty.d.ts +18 -0
  17. package/dist/src/catalog/workspace/helpers/empty.js +16 -0
  18. package/dist/src/catalog/workspace/helpers/finding.d.ts +10 -0
  19. package/dist/src/catalog/workspace/helpers/finding.js +11 -0
  20. package/dist/src/catalog/workspace/helpers/source-categorize.d.ts +16 -0
  21. package/dist/src/catalog/workspace/helpers/source-categorize.js +51 -0
  22. package/dist/src/catalog/workspace/hook-ownership-ambiguous.d.ts +4 -0
  23. package/dist/src/catalog/workspace/hook-ownership-ambiguous.js +25 -0
  24. package/dist/src/catalog/workspace/initialized.d.ts +22 -0
  25. package/dist/src/catalog/workspace/initialized.js +58 -0
  26. package/dist/src/catalog/workspace/instructions-agent-supported.d.ts +4 -0
  27. package/dist/src/catalog/workspace/instructions-agent-supported.js +38 -0
  28. package/dist/src/catalog/workspace/instructions-gitignore-current.d.ts +4 -0
  29. package/dist/src/catalog/workspace/instructions-gitignore-current.js +49 -0
  30. package/dist/src/catalog/workspace/instructions-source-present.d.ts +4 -0
  31. package/dist/src/catalog/workspace/instructions-source-present.js +41 -0
  32. package/dist/src/catalog/workspace/instructions-target-current.d.ts +4 -0
  33. package/dist/src/catalog/workspace/instructions-target-current.js +51 -0
  34. package/dist/src/catalog/workspace/instructions-target-stale.d.ts +9 -0
  35. package/dist/src/catalog/workspace/instructions-target-stale.js +41 -0
  36. package/dist/src/catalog/workspace/instructions-target-unowned.d.ts +10 -0
  37. package/dist/src/catalog/workspace/instructions-target-unowned.js +59 -0
  38. package/dist/src/catalog/workspace/knowledge-state-valid.d.ts +5 -0
  39. package/dist/src/catalog/workspace/knowledge-state-valid.js +65 -0
  40. package/dist/src/catalog/workspace/lockfile-valid.d.ts +5 -0
  41. package/dist/src/catalog/workspace/lockfile-valid.js +63 -0
  42. package/dist/src/catalog/workspace/managed-file-unowned.d.ts +4 -0
  43. package/dist/src/catalog/workspace/managed-file-unowned.js +25 -0
  44. package/dist/src/catalog/workspace/mcps-agent-drift.d.ts +4 -0
  45. package/dist/src/catalog/workspace/mcps-agent-drift.js +139 -0
  46. package/dist/src/catalog/workspace/mcps-agent-orphaned.d.ts +4 -0
  47. package/dist/src/catalog/workspace/mcps-agent-orphaned.js +64 -0
  48. package/dist/src/catalog/workspace/mcps-no-secret-literal.d.ts +4 -0
  49. package/dist/src/catalog/workspace/mcps-no-secret-literal.js +67 -0
  50. package/dist/src/catalog/workspace/mcps-shared-target-compatible.d.ts +4 -0
  51. package/dist/src/catalog/workspace/mcps-shared-target-compatible.js +58 -0
  52. package/dist/src/catalog/workspace/mcps-transport-exclusivity.d.ts +4 -0
  53. package/dist/src/catalog/workspace/mcps-transport-exclusivity.js +67 -0
  54. package/dist/src/catalog/workspace/packs-declarations-valid.d.ts +19 -0
  55. package/dist/src/catalog/workspace/packs-declarations-valid.js +110 -0
  56. package/dist/src/catalog/workspace/packs-dependencies-resolved.d.ts +5 -0
  57. package/dist/src/catalog/workspace/packs-dependencies-resolved.js +49 -0
  58. package/dist/src/catalog/workspace/projections-current.d.ts +15 -0
  59. package/dist/src/catalog/workspace/projections-current.js +35 -0
  60. package/dist/src/catalog/workspace/settings-keys-recognized.d.ts +17 -0
  61. package/dist/src/catalog/workspace/settings-keys-recognized.js +90 -0
  62. package/dist/src/catalog/workspace/settings-schema-valid.d.ts +27 -0
  63. package/dist/src/catalog/workspace/settings-schema-valid.js +68 -0
  64. package/dist/src/catalog/workspace/skills-artifacts-correct.d.ts +28 -0
  65. package/dist/src/catalog/workspace/skills-artifacts-correct.js +143 -0
  66. package/dist/src/catalog/workspace/skills-declarations-valid.d.ts +27 -0
  67. package/dist/src/catalog/workspace/skills-declarations-valid.js +102 -0
  68. package/dist/src/catalog/workspace/skills-integrity-valid.d.ts +28 -0
  69. package/dist/src/catalog/workspace/skills-integrity-valid.js +95 -0
  70. package/dist/src/catalog/workspace/skills-lockfile-aligned.d.ts +5 -0
  71. package/dist/src/catalog/workspace/skills-lockfile-aligned.js +64 -0
  72. package/dist/src/catalog/workspace/source-endpoints-aligned.d.ts +5 -0
  73. package/dist/src/catalog/workspace/source-endpoints-aligned.js +75 -0
  74. package/dist/src/catalog/workspace-fixtures/fixture-state.d.ts +8 -0
  75. package/dist/src/catalog/workspace-fixtures/fixture-state.js +120 -0
  76. package/dist/src/catalog/workspace-fixtures/interpret-ops.d.ts +11 -0
  77. package/dist/src/catalog/workspace-fixtures/interpret-ops.js +9 -0
  78. package/dist/src/catalog/workspace-read-model/lint-workspace.d.ts +191 -0
  79. package/dist/src/catalog/workspace-read-model/lint-workspace.js +651 -0
  80. package/dist/src/catalog/workspace-read-model/manifest-json.d.ts +14 -0
  81. package/dist/src/catalog/workspace-read-model/manifest-json.js +27 -0
  82. package/dist/src/catalog/workspace.d.ts +58 -0
  83. package/dist/src/catalog/workspace.js +164 -0
  84. package/dist/src/catalog-contexts.d.ts +106 -0
  85. package/dist/src/catalog-contexts.js +95 -0
  86. package/dist/src/cli.d.ts +239 -0
  87. package/dist/src/cli.js +1077 -0
  88. package/dist/src/index.d.ts +10 -0
  89. package/dist/src/index.js +21 -0
  90. package/dist/src/json-schema.d.ts +121 -0
  91. package/dist/src/json-schema.js +99 -0
  92. package/dist/src/run/errors.d.ts +23 -0
  93. package/dist/src/run/errors.js +21 -0
  94. package/dist/src/run/settings.d.ts +63 -0
  95. package/dist/src/run/settings.js +139 -0
  96. package/dist/src/run/staged-workspace.d.ts +31 -0
  97. package/dist/src/run/staged-workspace.js +273 -0
  98. package/dist/src/workspace-context.d.ts +129 -0
  99. package/dist/src/workspace-context.js +12 -0
  100. package/package.json +55 -0
package/LICENSE ADDED
@@ -0,0 +1,110 @@
1
+ # Functional Source License, Version 1.1, MIT Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-MIT
6
+
7
+ ## Notice
8
+
9
+ Copyright 2025-2026 AgentXM, Inc.
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the MIT license that is effective on the second anniversary of the date we make
91
+ the Software available. On or after that date, you may use the Software under
92
+ the MIT license, in which case the following will apply:
93
+
94
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
95
+ this software and associated documentation files (the "Software"), to deal in
96
+ the Software without restriction, including without limitation the rights to
97
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
98
+ of the Software, and to permit persons to whom the Software is furnished to do
99
+ so, subject to the following conditions:
100
+
101
+ The above copyright notice and this permission notice shall be included in all
102
+ copies or substantial portions of the Software.
103
+
104
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
105
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
106
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
107
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
108
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
109
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
110
+ SOFTWARE.
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Catalog barrel — aggregates the per-namespace rule catalogs for consumers
3
+ * that want the full v1 rule set.
4
+ *
5
+ * Phase 3a lands `skillRules`; Phase 3b lands `packRules`; Phase 3c will
6
+ * append `workspaceRules` without touching existing imports.
7
+ *
8
+ * `allCatalogRuleIds` is the concatenation used by the rule-id snapshot test
9
+ * (`./rule-ids.snapshot.test.ts`). Per-catalog consumers (registry publish,
10
+ * `axm lint`) should import the specific catalog they need so the other
11
+ * catalogs tree-shake out.
12
+ *
13
+ * @experimental This API is unstable and may change without notice.
14
+ * @packageDocumentation
15
+ */
16
+ export { liveOnlyWorkspaceRules, repositoryWorkspaceRules, workspaceRules } from "./workspace.js";
17
+ export { buildLintWorkspace, buildNativeInstalledSkillInfo, buildAcquiredInstalledSkillInfo, buildInstalledPackInfo, acquiredSkillDisplayRoot, registryNativeSkillDisplayRoot, registryPackDisplayRoot, type BuildLintWorkspaceArgs, type BuildInstalledPackInfoArgs, type BuildAcquiredInstalledSkillInfoArgs, type BuildInstalledSkillInfoNativeArgs, type LintWorkspace, type LintWorkspaceView, } from "./workspace-read-model/lint-workspace.js";
18
+ /**
19
+ * Concatenated rule-id array across every currently-exported catalog, in the
20
+ * order catalogs were introduced (Phase 3a: `skillRules`; Phase 3b:
21
+ * `packRules`; Phase 3c: `workspaceRules`).
22
+ *
23
+ * Used by the rule-id snapshot test; production callers should not depend on
24
+ * this value.
25
+ *
26
+ * @experimental This API is unstable and may change without notice.
27
+ */
28
+ export declare const allCatalogRuleIds: ReadonlyArray<string>;
29
+ /** Error-severity rule identities that require an exhaustive recovery contract. */
30
+ export declare const allCatalogErrorRuleIds: ReadonlyArray<string>;
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Catalog barrel — aggregates the per-namespace rule catalogs for consumers
3
+ * that want the full v1 rule set.
4
+ *
5
+ * Phase 3a lands `skillRules`; Phase 3b lands `packRules`; Phase 3c will
6
+ * append `workspaceRules` without touching existing imports.
7
+ *
8
+ * `allCatalogRuleIds` is the concatenation used by the rule-id snapshot test
9
+ * (`./rule-ids.snapshot.test.ts`). Per-catalog consumers (registry publish,
10
+ * `axm lint`) should import the specific catalog they need so the other
11
+ * catalogs tree-shake out.
12
+ *
13
+ * @experimental This API is unstable and may change without notice.
14
+ * @packageDocumentation
15
+ */
16
+ import { skillRules } from "@agentxm/registry-protocol/unstable/lint/catalog/skill";
17
+ import { packRules } from "@agentxm/registry-protocol/unstable/lint/catalog/pack";
18
+ import { subagentRules } from "@agentxm/registry-protocol/unstable/lint/catalog/subagent";
19
+ import { mcpServerRules } from "@agentxm/registry-protocol/unstable/lint/catalog/mcp-server";
20
+ import { hookRules } from "@agentxm/registry-protocol/unstable/lint/catalog/hook";
21
+ import { ruleRules } from "@agentxm/registry-protocol/unstable/lint/catalog/rule";
22
+ import { knowledgeRules } from "@agentxm/registry-protocol/unstable/lint/catalog/knowledge";
23
+ import { workspaceRules } from "./workspace.js";
24
+ export { liveOnlyWorkspaceRules, repositoryWorkspaceRules, workspaceRules } from "./workspace.js";
25
+ // Phase 3c workspace read-model builder helpers.
26
+ export { buildLintWorkspace, buildNativeInstalledSkillInfo, buildAcquiredInstalledSkillInfo, buildInstalledPackInfo, acquiredSkillDisplayRoot, registryNativeSkillDisplayRoot, registryPackDisplayRoot, } from "./workspace-read-model/lint-workspace.js";
27
+ /**
28
+ * Concatenated rule-id array across every currently-exported catalog, in the
29
+ * order catalogs were introduced (Phase 3a: `skillRules`; Phase 3b:
30
+ * `packRules`; Phase 3c: `workspaceRules`).
31
+ *
32
+ * Used by the rule-id snapshot test; production callers should not depend on
33
+ * this value.
34
+ *
35
+ * @experimental This API is unstable and may change without notice.
36
+ */
37
+ export const allCatalogRuleIds = [
38
+ ...skillRules.map((r) => r.id),
39
+ ...packRules.map((r) => r.id),
40
+ ...subagentRules.map((r) => r.id),
41
+ ...mcpServerRules.map((r) => r.id),
42
+ ...hookRules.map((r) => r.id),
43
+ ...ruleRules.map((r) => r.id),
44
+ ...knowledgeRules.map((r) => r.id),
45
+ ...workspaceRules.map((r) => r.id),
46
+ ];
47
+ /** Error-severity rule identities that require an exhaustive recovery contract. */
48
+ export const allCatalogErrorRuleIds = [
49
+ ...skillRules,
50
+ ...packRules,
51
+ ...subagentRules,
52
+ ...mcpServerRules,
53
+ ...hookRules,
54
+ ...ruleRules,
55
+ ...knowledgeRules,
56
+ ...workspaceRules,
57
+ ]
58
+ .filter((rule) => rule.severity === "error")
59
+ .map((rule) => rule.id);
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * `workspace/agents-detected-declared` — every agent footprint detected on
3
+ * disk appears in `settings.agents[]`.
4
+ *
5
+ * Per the lint design:
6
+ *
7
+ * Project scope only (early-returns at user scope). For each detected
8
+ * agent whose id is missing from settings.agents[], emit one finding.
9
+ *
10
+ * Project scope only: detection relies on scanning workspace-root-adjacent
11
+ * agent dirs (`.claude/`, `.cursor/`, …). At user scope the detection target
12
+ * is ambiguous, so the rule early-returns `[]`.
13
+ *
14
+ * Advisory, warning — the user may be intentionally using an agent AXM
15
+ * doesn't manage.
16
+ *
17
+ * @experimental This API is unstable and may change without notice.
18
+ * @packageDocumentation
19
+ */
20
+ import type { WorkspaceRuleContext } from "../../workspace-context.js";
21
+ import type { AdvisoryRule } from "@agentxm/registry-protocol/unstable/lint/rule";
22
+ export declare const agentsDetectedDeclaredRule: AdvisoryRule<WorkspaceRuleContext>;
23
+ //# sourceMappingURL=agents-detected-declared.d.ts.map
@@ -0,0 +1,61 @@
1
+ /**
2
+ * `workspace/agents-detected-declared` — every agent footprint detected on
3
+ * disk appears in `settings.agents[]`.
4
+ *
5
+ * Per the lint design:
6
+ *
7
+ * Project scope only (early-returns at user scope). For each detected
8
+ * agent whose id is missing from settings.agents[], emit one finding.
9
+ *
10
+ * Project scope only: detection relies on scanning workspace-root-adjacent
11
+ * agent dirs (`.claude/`, `.cursor/`, …). At user scope the detection target
12
+ * is ambiguous, so the rule early-returns `[]`.
13
+ *
14
+ * Advisory, warning — the user may be intentionally using an agent AXM
15
+ * doesn't manage.
16
+ *
17
+ * @experimental This API is unstable and may change without notice.
18
+ * @packageDocumentation
19
+ */
20
+ import * as Effect from "effect/Effect";
21
+ import * as Option from "effect/Option";
22
+ import * as Result from "effect/Result";
23
+ import { settingsDisplayPath } from "./display-paths.js";
24
+ import { EMPTY_ADVISORY_FINDINGS } from "./helpers/empty.js";
25
+ const RULE_ID = "workspace/agents-detected-declared";
26
+ export const agentsDetectedDeclaredRule = {
27
+ id: RULE_ID,
28
+ description: "Agents detected on disk are declared in `settings.agents[]`.",
29
+ kind: "advisory",
30
+ severity: "warning",
31
+ check: (context) => Effect.gen(function* () {
32
+ // Scope-aware early-return — detection only applies at project scope.
33
+ if (context.subject.scope === "user") {
34
+ return EMPTY_ADVISORY_FINDINGS;
35
+ }
36
+ const scoped = context.workspace;
37
+ const settingsResult = yield* Effect.result(scoped.state.settings);
38
+ if (Result.isFailure(settingsResult)) {
39
+ return EMPTY_ADVISORY_FINDINGS;
40
+ }
41
+ if (Option.isNone(settingsResult.success)) {
42
+ return EMPTY_ADVISORY_FINDINGS;
43
+ }
44
+ const detected = yield* scoped.agents.detected;
45
+ const findings = [];
46
+ for (const detection of detected) {
47
+ if (detection.status !== "unmanaged-present") {
48
+ continue;
49
+ }
50
+ findings.push({
51
+ kind: "advisory",
52
+ ruleId: RULE_ID,
53
+ severity: "warning",
54
+ message: `Agent '${detection.agentId}' is present on disk but missing from \`settings.agents[]\`.`,
55
+ location: { file: settingsDisplayPath(context.subject.scope) },
56
+ });
57
+ }
58
+ return findings;
59
+ }),
60
+ };
61
+ //# sourceMappingURL=agents-detected-declared.js.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * `workspace/agents-recognized` — every agent id in `settings.agents[]` is
3
+ * in AXM's known-agent catalog.
4
+ *
5
+ * Per the lint design "Foundation" row:
6
+ *
7
+ * Agent recognition invariant — unknown IDs can't be materialized into.
8
+ * Absorbs doctor `agents-configured.unrecognized`. Known-agent catalog
9
+ * lives at `packages/extension-model/src/unstable/agents/types.ts`.
10
+ *
11
+ * Cascade: the rule walks `settings.agents[]` and checks each id against
12
+ * the set returned by `workspace.scope(scope).agents.known`. Unknown ids
13
+ * each emit one finding — the cascade is per-entity, not per-cascade-arm.
14
+ *
15
+ * Advisory — fixing an unrecognized id is a user-authored settings edit.
16
+ *
17
+ * @experimental This API is unstable and may change without notice.
18
+ * @packageDocumentation
19
+ */
20
+ import type { WorkspaceRuleContext } from "../../workspace-context.js";
21
+ import type { AdvisoryRule } from "@agentxm/registry-protocol/unstable/lint/rule";
22
+ export declare const agentsRecognizedRule: AdvisoryRule<WorkspaceRuleContext>;
23
+ //# sourceMappingURL=agents-recognized.d.ts.map
@@ -0,0 +1,64 @@
1
+ /**
2
+ * `workspace/agents-recognized` — every agent id in `settings.agents[]` is
3
+ * in AXM's known-agent catalog.
4
+ *
5
+ * Per the lint design "Foundation" row:
6
+ *
7
+ * Agent recognition invariant — unknown IDs can't be materialized into.
8
+ * Absorbs doctor `agents-configured.unrecognized`. Known-agent catalog
9
+ * lives at `packages/extension-model/src/unstable/agents/types.ts`.
10
+ *
11
+ * Cascade: the rule walks `settings.agents[]` and checks each id against
12
+ * the set returned by `workspace.scope(scope).agents.known`. Unknown ids
13
+ * each emit one finding — the cascade is per-entity, not per-cascade-arm.
14
+ *
15
+ * Advisory — fixing an unrecognized id is a user-authored settings edit.
16
+ *
17
+ * @experimental This API is unstable and may change without notice.
18
+ * @packageDocumentation
19
+ */
20
+ import * as Effect from "effect/Effect";
21
+ import * as Option from "effect/Option";
22
+ import * as Result from "effect/Result";
23
+ import { EMPTY_ADVISORY_FINDINGS } from "./helpers/empty.js";
24
+ import { settingsDisplayPath } from "./display-paths.js";
25
+ const RULE_ID = "workspace/agents-recognized";
26
+ export const agentsRecognizedRule = {
27
+ id: RULE_ID,
28
+ description: "Every `settings.agents[]` entry names a supported agent.",
29
+ kind: "advisory",
30
+ severity: "error",
31
+ check: (context) => Effect.gen(function* () {
32
+ const scoped = context.workspace;
33
+ const settingsPath = settingsDisplayPath(context.subject.scope);
34
+ // `state.settings` returns the decoded `Settings` already; the
35
+ // `SettingsReadError` family (io / parse / decode) is owned by
36
+ // `workspace/initialized` and `workspace/settings-schema-valid`, so
37
+ // we silently bail on any failure here.
38
+ const settings = yield* Effect.result(scoped.state.settings);
39
+ if (Result.isFailure(settings))
40
+ return EMPTY_ADVISORY_FINDINGS;
41
+ if (Option.isNone(settings.success))
42
+ return EMPTY_ADVISORY_FINDINGS;
43
+ const declared = settings.success.value.agents ?? [];
44
+ if (declared.length === 0)
45
+ return EMPTY_ADVISORY_FINDINGS;
46
+ const knownAgents = yield* scoped.agents.known;
47
+ const knownIds = new Set(knownAgents.map((agent) => agent.id));
48
+ const findings = [];
49
+ for (const id of declared) {
50
+ if (knownIds.has(id))
51
+ continue;
52
+ findings.push({
53
+ kind: "advisory",
54
+ ruleId: RULE_ID,
55
+ severity: "error",
56
+ message: `Agent id '${id}' in \`settings.agents[]\` is not supported. ` +
57
+ `Edit \`${settingsPath}\` and remove '${id}' from \`agents\`, or replace it there with the intended agent id.`,
58
+ location: { file: settingsPath },
59
+ });
60
+ }
61
+ return findings;
62
+ }),
63
+ };
64
+ //# sourceMappingURL=agents-recognized.js.map
@@ -0,0 +1,4 @@
1
+ import type { WorkspaceRuleContext } from "../../workspace-context.js";
2
+ import type { AdvisoryRule } from "@agentxm/registry-protocol/unstable/lint/rule";
3
+ export declare const axmSkillCompatibleRule: AdvisoryRule<WorkspaceRuleContext>;
4
+ //# sourceMappingURL=axm-skill-compatible.d.ts.map
@@ -0,0 +1,51 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Result from "effect/Result";
3
+ import { formatAxmSkillCompatibilityTarget } from "@agentxm/extension-workspace";
4
+ import { canonicalDisplayRoot } from "./display-paths.js";
5
+ import { EMPTY_ADVISORY_FINDINGS } from "./helpers/empty.js";
6
+ const RULE_ID = "workspace/axm-skill-compatible";
7
+ export const axmSkillCompatibleRule = {
8
+ id: RULE_ID,
9
+ description: "The official AXM skill is compatible with the running AXM CLI.",
10
+ kind: "advisory",
11
+ severity: "error",
12
+ check: (context) => Effect.gen(function* () {
13
+ if (context.axmSkillCompatibility === undefined)
14
+ return EMPTY_ADVISORY_FINDINGS;
15
+ const compatibilityResult = yield* Effect.result(context.axmSkillCompatibility);
16
+ if (Result.isFailure(compatibilityResult)) {
17
+ return [
18
+ {
19
+ kind: "advisory",
20
+ ruleId: RULE_ID,
21
+ severity: "error",
22
+ message: `The official AXM skill compatibility state is unreadable: ${compatibilityResult.failure._tag}. Repair the workspace state, then rerun lint.`,
23
+ location: {
24
+ file: context.subject.scope === "project"
25
+ ? "skills/axm"
26
+ : `${canonicalDisplayRoot(context.subject.scope)}/@agentxm/skills/axm`,
27
+ },
28
+ },
29
+ ];
30
+ }
31
+ const compatibility = compatibilityResult.success;
32
+ if (compatibility.status === "compatible")
33
+ return EMPTY_ADVISORY_FINDINGS;
34
+ const recovery = compatibility.recovery.nextAction;
35
+ const target = formatAxmSkillCompatibilityTarget(compatibility.recovery);
36
+ return [
37
+ {
38
+ kind: "advisory",
39
+ ruleId: RULE_ID,
40
+ severity: "error",
41
+ message: `${compatibility.detail ?? "The official AXM skill is incompatible with this AXM CLI."} Reason: ${compatibility.reasonCode ?? "unknown"}. Target: ${target}.${recovery === null ? "" : ` Next: \`${recovery}\`.`}`,
42
+ location: {
43
+ file: context.subject.scope === "project"
44
+ ? "skills/axm"
45
+ : `${canonicalDisplayRoot(context.subject.scope)}/@agentxm/skills/axm`,
46
+ },
47
+ },
48
+ ];
49
+ }),
50
+ };
51
+ //# sourceMappingURL=axm-skill-compatible.js.map
@@ -0,0 +1,4 @@
1
+ import type { WorkspaceRuleContext } from "../../workspace-context.js";
2
+ import type { AdvisoryRule } from "@agentxm/registry-protocol/unstable/lint/rule";
3
+ export declare const configuredButNotInstalledRule: AdvisoryRule<WorkspaceRuleContext>;
4
+ //# sourceMappingURL=configured-but-not-installed.d.ts.map
@@ -0,0 +1,88 @@
1
+ // @effect-diagnostics anyUnknownInErrorContext:off — lint converts opaque observation failures into fact-only findings at this boundary
2
+ import * as Effect from "effect/Effect";
3
+ import * as Result from "effect/Result";
4
+ import { extensionTypeSentenceLabels, } from "@agentxm/extension-model/unstable/extensions/common";
5
+ import { canonicalDisplayRoot, settingsDisplayPath } from "./display-paths.js";
6
+ import { categorizeEntry } from "./helpers/source-categorize.js";
7
+ const RULE_ID = "workspace/configured-but-not-installed";
8
+ /**
9
+ * Every read-model family whose rows this rule walks.
10
+ *
11
+ * Total over `ExtensionType`: the rule used to read five of the nine families
12
+ * and silently said nothing about a configured-but-absent context package,
13
+ * rule, hook, or knowledge bundle. Keyed off the type table, a new extension
14
+ * type now fails compile here until its coverage is decided.
15
+ */
16
+ const INSTALLED_ROWS_BY_TYPE = {
17
+ skill: (workspace) => workspace.skills.installed,
18
+ "mcp-server": (workspace) => workspace.mcpServers.installed,
19
+ subagent: (workspace) => workspace.subagents.installed,
20
+ rule: (workspace) => workspace.rules.installed,
21
+ hook: (workspace) => workspace.hooks.installed,
22
+ knowledge: (workspace) => workspace.knowledge.installed,
23
+ pack: (workspace) => workspace.packs.installed,
24
+ };
25
+ /**
26
+ * Read order. Findings render in this order, so it is declared rather than
27
+ * derived from object key order.
28
+ */
29
+ const READ_ORDER = [
30
+ "skill",
31
+ "mcp-server",
32
+ "subagent",
33
+ "rule",
34
+ "hook",
35
+ "knowledge",
36
+ "pack",
37
+ ];
38
+ const extensionLabel = (type) => extensionTypeSentenceLabels[type];
39
+ const hasCanonicalContent = (actual) => actual.some((entry) => entry.origin._tag.startsWith("canonical-axm-") ||
40
+ entry.origin._tag.startsWith("external-axm-"));
41
+ const findingFor = (row, scope) => ({
42
+ kind: "advisory",
43
+ ruleId: RULE_ID,
44
+ severity: "error",
45
+ message: row.installationOrigin._tag === "direct" &&
46
+ row.installationOrigin.declared.entry.source !== undefined &&
47
+ categorizeEntry(row.key.name, row.installationOrigin.declared.entry.source).kind === "workspace"
48
+ ? `${extensionLabel(row.key.type)} '${row.key.name}' declares a workspace source, but its authored canonical package is missing from the configured authored root.`
49
+ : `${extensionLabel(row.key.type)} '${row.key.name}' is desired, but its canonical content is missing from ${canonicalDisplayRoot(scope)}.`,
50
+ location: { file: settingsDisplayPath(scope) },
51
+ });
52
+ const hasLintableInstallSource = (row) => {
53
+ if (row.installationOrigin._tag === "pack-member")
54
+ return true;
55
+ const source = row.installationOrigin.declared.entry.source;
56
+ if (source === undefined)
57
+ return false;
58
+ const categorized = categorizeEntry(row.key.name, source);
59
+ return (categorized.kind === "registry" ||
60
+ categorized.kind === "workspace" ||
61
+ categorized.kind === "non-registry");
62
+ };
63
+ const checkRows = (rows, scope) => rows.flatMap((row) => {
64
+ if (row.activation === "disabled")
65
+ return [];
66
+ if (row.installationOrigin._tag !== "direct" && row.installationOrigin._tag !== "pack-member") {
67
+ return [];
68
+ }
69
+ if (!hasLintableInstallSource(row))
70
+ return [];
71
+ if (hasCanonicalContent(row.actual))
72
+ return [];
73
+ return [findingFor(row, scope)];
74
+ });
75
+ const readRows = (effect) => Effect.gen(function* () {
76
+ const result = yield* Effect.result(effect);
77
+ if (Result.isFailure(result))
78
+ return [];
79
+ return result.success;
80
+ });
81
+ export const configuredButNotInstalledRule = {
82
+ id: RULE_ID,
83
+ description: "Configured extensions have canonical content in the scope's canonical roots.",
84
+ kind: "advisory",
85
+ severity: "error",
86
+ check: (context) => Effect.map(Effect.forEach(READ_ORDER, (type) => readRows(INSTALLED_ROWS_BY_TYPE[type](context.workspace)), { concurrency: "unbounded" }), (families) => families.flatMap((rows) => checkRows(rows, context.subject.scope))),
87
+ };
88
+ //# sourceMappingURL=configured-but-not-installed.js.map
@@ -0,0 +1,4 @@
1
+ import type { WorkspaceRuleContext } from "../../workspace-context.js";
2
+ import type { AdvisoryRule } from "@agentxm/registry-protocol/unstable/lint/rule";
3
+ export declare const desiredStateReconcilableRule: AdvisoryRule<WorkspaceRuleContext>;
4
+ //# sourceMappingURL=desired-state-reconcilable.d.ts.map
@@ -0,0 +1,96 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Result from "effect/Result";
3
+ import { extensionConstraintFactText, makeExtensionConstraintInvariantFact, } from "@agentxm/extension-workspace";
4
+ import { isWorkspaceSourceLocator } from "@agentxm/extension-model/unstable/sources/workspace";
5
+ const RULE_ID = "workspace/desired-state-reconcilable";
6
+ export const desiredStateReconcilableRule = {
7
+ id: RULE_ID,
8
+ description: "Desired-state declarations and observations are mutually reconcilable.",
9
+ kind: "advisory",
10
+ severity: "error",
11
+ check: (context) => Effect.gen(function* () {
12
+ if (context.health === undefined)
13
+ return [];
14
+ const graph = yield* Effect.result(context.health.desiredState);
15
+ if (Result.isFailure(graph))
16
+ return [];
17
+ const graphFindings = graph.success.problems.map((problem) => {
18
+ if ("pack" in problem) {
19
+ const observed = problem.type === "pack-manifest-content-mismatch"
20
+ ? ` Accepted version=${problem.acceptedVersion} content=${problem.acceptedContentIdentity}; observed status=${problem.status}${problem.observedVersion === undefined ? "" : ` version=${problem.observedVersion} content=${problem.observedContentIdentity}`}.`
21
+ : "";
22
+ return {
23
+ kind: "advisory",
24
+ ruleId: RULE_ID,
25
+ severity: "error",
26
+ message: `Pack '${problem.pack}' does not currently form a reconcilable desired-state route.${observed}`,
27
+ location: { file: "axm.json" },
28
+ };
29
+ }
30
+ return {
31
+ kind: "advisory",
32
+ ruleId: RULE_ID,
33
+ severity: "error",
34
+ message: problem.type === "workspace-owner-missing"
35
+ ? `${problem.extensionType} '${problem.name}' uses source 'workspace', but axm.json does not declare an owner.`
36
+ : problem.type === "projection-collision"
37
+ ? `${problem.extensionType} '${problem.name}' has competing desired identities: ${problem.identities.join(", ")}.`
38
+ : `${problem.extensionType} '${problem.name}' has incompatible constraints: ${problem.contributors
39
+ .map((contributor) => contributor.source === "pack"
40
+ ? `${contributor.dependingPack ?? "unknown Pack"} range=${contributor.range} location=${contributor.location}`
41
+ : `settings range=${contributor.range} location=${contributor.location}`)
42
+ .join(", ")}. Decision=blocked; reason=no-satisfying-version.`,
43
+ location: { file: "axm.json" },
44
+ };
45
+ });
46
+ if (context.health.canonicalObservations === undefined)
47
+ return graphFindings;
48
+ const observations = yield* Effect.result(context.health.canonicalObservations);
49
+ if (Result.isFailure(observations))
50
+ return graphFindings;
51
+ const observationFindings = observations.success.flatMap(({ desired, observation }) => {
52
+ if (observation.status === "usable" ||
53
+ observation.status === "not-applicable" ||
54
+ observation.status === "missing") {
55
+ return [];
56
+ }
57
+ const identity = desired.identity.replace(/^workspace:/, "");
58
+ const label = `${observation.type} '${identity}'`;
59
+ if (observation.status === "constraint-mismatch") {
60
+ const blockedByConflict = graph.success.problems.some((problem) => problem.type === "constraint-conflict" &&
61
+ problem.extensionType === desired.type &&
62
+ problem.name === desired.name);
63
+ if (blockedByConflict)
64
+ return [];
65
+ const fact = makeExtensionConstraintInvariantFact(desired, observation);
66
+ return [
67
+ {
68
+ kind: "advisory",
69
+ ruleId: RULE_ID,
70
+ severity: "error",
71
+ message: `${extensionConstraintFactText(fact)}; decision=reconcilable.`,
72
+ location: { file: observation.path ?? "axm.json" },
73
+ },
74
+ ];
75
+ }
76
+ if (observation.status === "locally-modified" &&
77
+ desired.source !== undefined &&
78
+ isWorkspaceSourceLocator(desired.source)) {
79
+ return [];
80
+ }
81
+ return [
82
+ {
83
+ kind: "advisory",
84
+ ruleId: RULE_ID,
85
+ severity: "error",
86
+ message: observation.status === "materialization-mismatch"
87
+ ? `${label} differs from its accepted materialized package-tree integrity.`
88
+ : `${label} has canonical state ${observation.status}.`,
89
+ location: { file: observation.path ?? "axm.json" },
90
+ },
91
+ ];
92
+ });
93
+ return [...graphFindings, ...observationFindings];
94
+ }),
95
+ };
96
+ //# sourceMappingURL=desired-state-reconcilable.js.map
@@ -0,0 +1,7 @@
1
+ import type { WorkspaceRuleContext } from "../../workspace-context.js";
2
+ type WorkspaceScope = WorkspaceRuleContext["subject"]["scope"];
3
+ export declare const settingsDisplayPath: (scope: WorkspaceScope) => string;
4
+ export declare const lockfileDisplayPath: (scope: WorkspaceScope) => string;
5
+ export declare const canonicalDisplayRoot: (scope: WorkspaceScope) => string;
6
+ export {};
7
+ //# sourceMappingURL=display-paths.d.ts.map
@@ -0,0 +1,4 @@
1
+ export const settingsDisplayPath = (scope) => scope === "project" ? "axm.json" : ".axm/workspace/axm.json";
2
+ export const lockfileDisplayPath = (scope) => scope === "project" ? "axm-lock.yaml" : ".axm/workspace/axm-lock.yaml";
3
+ export const canonicalDisplayRoot = (scope) => scope === "project" ? "agent_extensions" : ".axm/workspace/agent_extensions";
4
+ //# sourceMappingURL=display-paths.js.map