@agentxm/registry-protocol 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 (137) hide show
  1. package/LICENSE +110 -0
  2. package/README.md +13 -0
  3. package/dist/src/unstable/content/agent-skills-standard.d.ts +17 -0
  4. package/dist/src/unstable/content/agent-skills-standard.js +24 -0
  5. package/dist/src/unstable/content/frontmatter.d.ts +52 -0
  6. package/dist/src/unstable/content/frontmatter.js +115 -0
  7. package/dist/src/unstable/content/index.d.ts +11 -0
  8. package/dist/src/unstable/content/index.js +11 -0
  9. package/dist/src/unstable/content/skill-content.d.ts +43 -0
  10. package/dist/src/unstable/content/skill-content.js +184 -0
  11. package/dist/src/unstable/content/skill-types.d.ts +22 -0
  12. package/dist/src/unstable/content/skill-types.js +9 -0
  13. package/dist/src/unstable/content/subagent-content.d.ts +58 -0
  14. package/dist/src/unstable/content/subagent-content.js +101 -0
  15. package/dist/src/unstable/knowledge/index.d.ts +8 -0
  16. package/dist/src/unstable/knowledge/index.js +8 -0
  17. package/dist/src/unstable/knowledge/knowledge-search.d.ts +32 -0
  18. package/dist/src/unstable/knowledge/knowledge-search.js +147 -0
  19. package/dist/src/unstable/knowledge/okf.d.ts +86 -0
  20. package/dist/src/unstable/knowledge/okf.js +1090 -0
  21. package/dist/src/unstable/lint/catalog/hook/decision-portability.d.ts +4 -0
  22. package/dist/src/unstable/lint/catalog/hook/decision-portability.js +40 -0
  23. package/dist/src/unstable/lint/catalog/hook/entrypoint-exists.d.ts +4 -0
  24. package/dist/src/unstable/lint/catalog/hook/entrypoint-exists.js +39 -0
  25. package/dist/src/unstable/lint/catalog/hook/envelope.d.ts +6 -0
  26. package/dist/src/unstable/lint/catalog/hook/envelope.js +15 -0
  27. package/dist/src/unstable/lint/catalog/hook/matcher-raw-portability.d.ts +4 -0
  28. package/dist/src/unstable/lint/catalog/hook/matcher-raw-portability.js +51 -0
  29. package/dist/src/unstable/lint/catalog/hook.d.ts +4 -0
  30. package/dist/src/unstable/lint/catalog/hook.js +17 -0
  31. package/dist/src/unstable/lint/catalog/knowledge/diagnostics.d.ts +128 -0
  32. package/dist/src/unstable/lint/catalog/knowledge/diagnostics.js +78 -0
  33. package/dist/src/unstable/lint/catalog/knowledge/envelope.d.ts +6 -0
  34. package/dist/src/unstable/lint/catalog/knowledge/envelope.js +15 -0
  35. package/dist/src/unstable/lint/catalog/knowledge.d.ts +5 -0
  36. package/dist/src/unstable/lint/catalog/knowledge.js +11 -0
  37. package/dist/src/unstable/lint/catalog/mcp-server/envelope.d.ts +6 -0
  38. package/dist/src/unstable/lint/catalog/mcp-server/envelope.js +15 -0
  39. package/dist/src/unstable/lint/catalog/mcp-server.d.ts +4 -0
  40. package/dist/src/unstable/lint/catalog/mcp-server.js +6 -0
  41. package/dist/src/unstable/lint/catalog/pack/manifest-keys-recognized.d.ts +28 -0
  42. package/dist/src/unstable/lint/catalog/pack/manifest-keys-recognized.js +38 -0
  43. package/dist/src/unstable/lint/catalog/pack/manifest-present.d.ts +17 -0
  44. package/dist/src/unstable/lint/catalog/pack/manifest-present.js +24 -0
  45. package/dist/src/unstable/lint/catalog/pack/manifest-schema-valid.d.ts +25 -0
  46. package/dist/src/unstable/lint/catalog/pack/manifest-schema-valid.js +33 -0
  47. package/dist/src/unstable/lint/catalog/pack-accessor/contexts.d.ts +51 -0
  48. package/dist/src/unstable/lint/catalog/pack-accessor/contexts.js +45 -0
  49. package/dist/src/unstable/lint/catalog/pack-accessor/vft.d.ts +60 -0
  50. package/dist/src/unstable/lint/catalog/pack-accessor/vft.js +85 -0
  51. package/dist/src/unstable/lint/catalog/pack.d.ts +37 -0
  52. package/dist/src/unstable/lint/catalog/pack.js +47 -0
  53. package/dist/src/unstable/lint/catalog/rule/envelope.d.ts +6 -0
  54. package/dist/src/unstable/lint/catalog/rule/envelope.js +15 -0
  55. package/dist/src/unstable/lint/catalog/rule.d.ts +4 -0
  56. package/dist/src/unstable/lint/catalog/rule.js +6 -0
  57. package/dist/src/unstable/lint/catalog/shared/envelope-rules.d.ts +93 -0
  58. package/dist/src/unstable/lint/catalog/shared/envelope-rules.js +89 -0
  59. package/dist/src/unstable/lint/catalog/shared/manifest-json.d.ts +18 -0
  60. package/dist/src/unstable/lint/catalog/shared/manifest-json.js +28 -0
  61. package/dist/src/unstable/lint/catalog/shared/manifest-present.d.ts +25 -0
  62. package/dist/src/unstable/lint/catalog/shared/manifest-present.js +37 -0
  63. package/dist/src/unstable/lint/catalog/shared/recommended-packs-rules.d.ts +70 -0
  64. package/dist/src/unstable/lint/catalog/shared/recommended-packs-rules.js +139 -0
  65. package/dist/src/unstable/lint/catalog/shared/schema-rule.d.ts +58 -0
  66. package/dist/src/unstable/lint/catalog/shared/schema-rule.js +103 -0
  67. package/dist/src/unstable/lint/catalog/skill/frontmatter-parseable.d.ts +31 -0
  68. package/dist/src/unstable/lint/catalog/skill/frontmatter-parseable.js +148 -0
  69. package/dist/src/unstable/lint/catalog/skill/frontmatter-standard-valid.d.ts +13 -0
  70. package/dist/src/unstable/lint/catalog/skill/frontmatter-standard-valid.js +61 -0
  71. package/dist/src/unstable/lint/catalog/skill/manifest-keys-recognized.d.ts +26 -0
  72. package/dist/src/unstable/lint/catalog/skill/manifest-keys-recognized.js +41 -0
  73. package/dist/src/unstable/lint/catalog/skill/manifest-present.d.ts +23 -0
  74. package/dist/src/unstable/lint/catalog/skill/manifest-present.js +32 -0
  75. package/dist/src/unstable/lint/catalog/skill/manifest-schema-valid.d.ts +21 -0
  76. package/dist/src/unstable/lint/catalog/skill/manifest-schema-valid.js +36 -0
  77. package/dist/src/unstable/lint/catalog/skill/recommended-packs-valid.d.ts +8 -0
  78. package/dist/src/unstable/lint/catalog/skill/recommended-packs-valid.js +12 -0
  79. package/dist/src/unstable/lint/catalog/skill/skill-md-present.d.ts +17 -0
  80. package/dist/src/unstable/lint/catalog/skill/skill-md-present.js +37 -0
  81. package/dist/src/unstable/lint/catalog/skill/standalone-declaration-valid.d.ts +8 -0
  82. package/dist/src/unstable/lint/catalog/skill/standalone-declaration-valid.js +12 -0
  83. package/dist/src/unstable/lint/catalog/skill-accessor/contexts.d.ts +61 -0
  84. package/dist/src/unstable/lint/catalog/skill-accessor/contexts.js +55 -0
  85. package/dist/src/unstable/lint/catalog/skill-accessor/vft.d.ts +77 -0
  86. package/dist/src/unstable/lint/catalog/skill-accessor/vft.js +135 -0
  87. package/dist/src/unstable/lint/catalog/skill.d.ts +44 -0
  88. package/dist/src/unstable/lint/catalog/skill.js +64 -0
  89. package/dist/src/unstable/lint/catalog/subagent/envelope.d.ts +6 -0
  90. package/dist/src/unstable/lint/catalog/subagent/envelope.js +15 -0
  91. package/dist/src/unstable/lint/catalog/subagent.d.ts +4 -0
  92. package/dist/src/unstable/lint/catalog/subagent.js +6 -0
  93. package/dist/src/unstable/lint/compose-path.d.ts +28 -0
  94. package/dist/src/unstable/lint/compose-path.js +64 -0
  95. package/dist/src/unstable/lint/config.d.ts +103 -0
  96. package/dist/src/unstable/lint/config.js +140 -0
  97. package/dist/src/unstable/lint/context.d.ts +246 -0
  98. package/dist/src/unstable/lint/context.js +21 -0
  99. package/dist/src/unstable/lint/describe-document.d.ts +31 -0
  100. package/dist/src/unstable/lint/describe-document.js +50 -0
  101. package/dist/src/unstable/lint/evaluate.d.ts +47 -0
  102. package/dist/src/unstable/lint/evaluate.js +82 -0
  103. package/dist/src/unstable/lint/issues-to-findings.d.ts +35 -0
  104. package/dist/src/unstable/lint/issues-to-findings.js +149 -0
  105. package/dist/src/unstable/lint/publish.d.ts +49 -0
  106. package/dist/src/unstable/lint/publish.js +86 -0
  107. package/dist/src/unstable/lint/rule.d.ts +98 -0
  108. package/dist/src/unstable/lint/rule.js +18 -0
  109. package/dist/src/unstable/publish/archive-guardrails.d.ts +39 -0
  110. package/dist/src/unstable/publish/archive-guardrails.js +250 -0
  111. package/dist/src/unstable/publish/filtered-package-validation.d.ts +24 -0
  112. package/dist/src/unstable/publish/filtered-package-validation.js +117 -0
  113. package/dist/src/unstable/publish/index.d.ts +12 -0
  114. package/dist/src/unstable/publish/index.js +12 -0
  115. package/dist/src/unstable/publish/ingest-limits.d.ts +25 -0
  116. package/dist/src/unstable/publish/ingest-limits.js +41 -0
  117. package/dist/src/unstable/publish/input-normalization.d.ts +40 -0
  118. package/dist/src/unstable/publish/input-normalization.js +125 -0
  119. package/dist/src/unstable/publish/manifest-policy.d.ts +611 -0
  120. package/dist/src/unstable/publish/manifest-policy.js +196 -0
  121. package/dist/src/unstable/publish/test-zip-helpers.d.ts +13 -0
  122. package/dist/src/unstable/publish/test-zip-helpers.js +117 -0
  123. package/dist/src/unstable/publish/visibility.d.ts +161 -0
  124. package/dist/src/unstable/publish/visibility.js +124 -0
  125. package/dist/src/unstable/registry/discover-schema.d.ts +68 -0
  126. package/dist/src/unstable/registry/discover-schema.js +35 -0
  127. package/dist/src/unstable/registry/index.d.ts +9 -0
  128. package/dist/src/unstable/registry/index.js +9 -0
  129. package/dist/src/unstable/registry/publication-set.d.ts +303 -0
  130. package/dist/src/unstable/registry/publication-set.js +507 -0
  131. package/dist/src/unstable/registry/release-age-policy.d.ts +57 -0
  132. package/dist/src/unstable/registry/release-age-policy.js +117 -0
  133. package/dist/src/unstable/registry/schema.d.ts +220 -0
  134. package/dist/src/unstable/registry/schema.js +114 -0
  135. package/dist/src/unstable/suggested-action.d.ts +19 -0
  136. package/dist/src/unstable/suggested-action.js +42 -0
  137. package/package.json +214 -0
@@ -0,0 +1,64 @@
1
+ /**
2
+ * `skill/*` rule catalog.
3
+ *
4
+ * Per the lint design, registry publish and `axm lint`
5
+ * run exactly these rules against each skill context:
6
+ *
7
+ * | ID | Severity | Autofix |
8
+ * | -------------------------------------- | -------- | ------- |
9
+ * | `skill/skill-md-present` | error | — |
10
+ * | `skill/manifest-present` | error | — |
11
+ * | `skill/frontmatter-parseable` | error | — |
12
+ * | `skill/frontmatter-standard-valid` | error | — |
13
+ * | `skill/manifest-schema-valid` | error | — |
14
+ * | `skill/manifest-keys-recognized` | error | — |
15
+ * | `skill/standalone-declaration-valid` | warning | — |
16
+ * | `skill/recommended-packs-valid` | warning | — |
17
+ *
18
+ * The last two come from `catalog/shared/recommended-packs-rules.ts`; every
19
+ * non-pack catalog registers the same pair against its own manifest.
20
+ *
21
+ * All ship `kind: "advisory"`. Native-vs-non-native applicability is
22
+ * expressed via `check` early-return (no separate `applies` predicate); see
23
+ * each rule's module for the guard.
24
+ *
25
+ * Rule ids are **registered with the lint config allowlist at module-load
26
+ * time**, so importing this catalog extends the set of accepted
27
+ * `axm.json` `lint.rules` keys. Consumers that never import the
28
+ * catalog (the registry Worker bundle for `pack`-only routes, e.g.) don't pay
29
+ * the registration cost.
30
+ *
31
+ * @experimental This API is unstable and may change without notice.
32
+ * @packageDocumentation
33
+ */
34
+ import { registerLintRuleIds } from "../config.js";
35
+ import { skillMdPresentRule } from "./skill/skill-md-present.js";
36
+ import { manifestPresentRule } from "./skill/manifest-present.js";
37
+ import { frontmatterParseableRule } from "./skill/frontmatter-parseable.js";
38
+ import { frontmatterStandardValidRule } from "./skill/frontmatter-standard-valid.js";
39
+ import { manifestSchemaValidRule } from "./skill/manifest-schema-valid.js";
40
+ import { manifestKeysRecognizedRule } from "./skill/manifest-keys-recognized.js";
41
+ import { recommendedPacksValidRule } from "./skill/recommended-packs-valid.js";
42
+ import { standaloneDeclarationValidRule } from "./skill/standalone-declaration-valid.js";
43
+ /**
44
+ * Ordered v1 `skill/*` rule catalog. Declaration order is the evaluation
45
+ * order within a single `evaluateContexts` call (deterministic ordering is
46
+ * test-observable; see `evaluate.ts`).
47
+ *
48
+ * @experimental This API is unstable and may change without notice.
49
+ */
50
+ export const skillRules = [
51
+ skillMdPresentRule,
52
+ manifestPresentRule,
53
+ frontmatterParseableRule,
54
+ frontmatterStandardValidRule,
55
+ manifestSchemaValidRule,
56
+ manifestKeysRecognizedRule,
57
+ standaloneDeclarationValidRule,
58
+ recommendedPacksValidRule,
59
+ ];
60
+ // Register ids into the `LintConfig.rules` allowlist. Module-load side effect:
61
+ // a consumer that imports this catalog (or the `catalog/index` barrel) enables
62
+ // `axm.json` `lint.rules` to reference any of the above rule ids.
63
+ registerLintRuleIds(skillRules.map((r) => r.id));
64
+ //# sourceMappingURL=skill.js.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * `subagent/*` manifest envelope — see `../shared/envelope-rules.ts`.
3
+ */
4
+ import type { SubagentRuleContext } from "../../context.js";
5
+ export declare const subagentEnvelopeRules: import("../shared/envelope-rules.js").ManifestEnvelopeRules<SubagentRuleContext<import("../../context.js").SubagentContent>>;
6
+ //# sourceMappingURL=envelope.d.ts.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `subagent/*` manifest envelope — see `../shared/envelope-rules.ts`.
3
+ */
4
+ import { MANIFEST_FILENAME, SubagentManifestSchema, } from "@agentxm/extension-model/unstable/subagents/manifest-schema";
5
+ import { makeManifestEnvelopeRules } from "../shared/envelope-rules.js";
6
+ export const subagentEnvelopeRules = makeManifestEnvelopeRules({
7
+ namespace: "subagent",
8
+ manifestFile: MANIFEST_FILENAME,
9
+ schema: SubagentManifestSchema,
10
+ manifestJson: (context) => context.subject.subagentJson,
11
+ presentDescription: "Subagents include a root subagent.json manifest.",
12
+ presentMissingMessage: "subagent.json is missing. Create subagent.json with the required manifest fields (`owner`, `type`, `name`, `version`).",
13
+ schemaDescription: "subagent.json defines a valid subagent manifest.",
14
+ });
15
+ //# sourceMappingURL=envelope.js.map
@@ -0,0 +1,4 @@
1
+ import type { SubagentRuleContext } from "../context.js";
2
+ import type { LintRule } from "../rule.js";
3
+ export declare const subagentRules: ReadonlyArray<LintRule<SubagentRuleContext>>;
4
+ //# sourceMappingURL=subagent.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { registerLintRuleIds } from "../config.js";
2
+ import { orderedEnvelopeRules } from "./shared/envelope-rules.js";
3
+ import { subagentEnvelopeRules } from "./subagent/envelope.js";
4
+ export const subagentRules = orderedEnvelopeRules(subagentEnvelopeRules);
5
+ registerLintRuleIds(subagentRules.map((r) => r.id));
6
+ //# sourceMappingURL=subagent.js.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * `composePath` — render a display path from a rule context's `displayRoot`
3
+ * and a finding's accessor-relative `location.file`.
4
+ *
5
+ * Rules emit accessor-relative `location.file` values only; messages carry no
6
+ * paths or coordinates. The format-time composition here lets the same rule
7
+ * render different paths for publish (`displayRoot: ""`), registry-installed
8
+ * skills, external skills, and workspace-scope findings.
9
+ *
10
+ * Relative rendered paths are posix and prefixed with `./` so logs are
11
+ * unambiguous about relative-ness. Absolute finding paths are preserved for
12
+ * files outside the workspace root. `location.line` / `location.column`
13
+ * append as `:line:column` when present.
14
+ *
15
+ * @experimental This API is unstable and may change without notice.
16
+ * @packageDocumentation
17
+ */
18
+ import type { FindingLocation } from "./rule.js";
19
+ /**
20
+ * Compose the rendered path for a finding.
21
+ *
22
+ * @param displayRoot - Context-supplied posix-relative root (or `""`).
23
+ * @param location - Accessor-relative or absolute file + optional coordinates.
24
+ *
25
+ * @experimental This API is unstable and may change without notice.
26
+ */
27
+ export declare const composePath: (displayRoot: string, location: FindingLocation | undefined) => string;
28
+ //# sourceMappingURL=compose-path.d.ts.map
@@ -0,0 +1,64 @@
1
+ /**
2
+ * `composePath` — render a display path from a rule context's `displayRoot`
3
+ * and a finding's accessor-relative `location.file`.
4
+ *
5
+ * Rules emit accessor-relative `location.file` values only; messages carry no
6
+ * paths or coordinates. The format-time composition here lets the same rule
7
+ * render different paths for publish (`displayRoot: ""`), registry-installed
8
+ * skills, external skills, and workspace-scope findings.
9
+ *
10
+ * Relative rendered paths are posix and prefixed with `./` so logs are
11
+ * unambiguous about relative-ness. Absolute finding paths are preserved for
12
+ * files outside the workspace root. `location.line` / `location.column`
13
+ * append as `:line:column` when present.
14
+ *
15
+ * @experimental This API is unstable and may change without notice.
16
+ * @packageDocumentation
17
+ */
18
+ // -----------------------------------------------------------------------------
19
+ // composePath
20
+ // -----------------------------------------------------------------------------
21
+ /**
22
+ * Compose the rendered path for a finding.
23
+ *
24
+ * @param displayRoot - Context-supplied posix-relative root (or `""`).
25
+ * @param location - Accessor-relative or absolute file + optional coordinates.
26
+ *
27
+ * @experimental This API is unstable and may change without notice.
28
+ */
29
+ export const composePath = (displayRoot, location) => {
30
+ const locationFile = location?.file ?? "";
31
+ const base = isAbsolutePath(locationFile) ? locationFile : joinPosix(displayRoot, locationFile);
32
+ const withPrefix = base === "" ? "." : isAbsolutePath(base) || base.startsWith("./") ? base : `./${base}`;
33
+ if (location === undefined) {
34
+ return withPrefix;
35
+ }
36
+ return appendCoordinates(withPrefix, location);
37
+ };
38
+ const isAbsolutePath = (value) => value.startsWith("/") || value.startsWith("\\\\") || /^[A-Za-z]:[\\/]/.test(value);
39
+ const joinPosix = (left, right) => {
40
+ const l = stripTrailingSlash(left);
41
+ const r = stripLeadingSlash(right);
42
+ if (l === "" && r === "") {
43
+ return "";
44
+ }
45
+ if (l === "") {
46
+ return r;
47
+ }
48
+ if (r === "") {
49
+ return l;
50
+ }
51
+ return `${l}/${r}`;
52
+ };
53
+ const stripTrailingSlash = (s) => (s.endsWith("/") ? s.slice(0, -1) : s);
54
+ const stripLeadingSlash = (s) => (s.startsWith("/") ? s.slice(1) : s);
55
+ const appendCoordinates = (path, location) => {
56
+ if (location.line === undefined) {
57
+ return path;
58
+ }
59
+ if (location.column === undefined) {
60
+ return `${path}:${location.line}`;
61
+ }
62
+ return `${path}:${location.line}:${location.column}`;
63
+ };
64
+ //# sourceMappingURL=compose-path.js.map
@@ -0,0 +1,103 @@
1
+ /**
2
+ * `LintConfig` — workspace-settings-level lint configuration.
3
+ *
4
+ * Workspace settings carry a `lint` section whose `rules` map binds rule ids
5
+ * to `"off" | "info" | "warn" | "error"`. The registry publish
6
+ * gate ignores workspace overrides; this config affects `axm lint` only.
7
+ *
8
+ * Keys are **exact** rule ids (`<namespace>/<name>`). No glob, wildcard, or
9
+ * regex syntax is accepted in v1. The accepted-key set is built at schema
10
+ * construction time from rule ids registered via `registerLintRuleIds` — the
11
+ * three v1 catalogs (`skill/*`, `pack/*`, `workspace/*`) each register their
12
+ * ids so adding a catalog in a later phase extends the set by construction.
13
+ *
14
+ * @experimental This API is unstable and may change without notice.
15
+ * @packageDocumentation
16
+ */
17
+ import * as Schema from "effect/Schema";
18
+ /**
19
+ * Accepted values for a `lint.rules` entry.
20
+ *
21
+ * Note: `"warn"` is the config surface for `Severity` `"warning"`; mirror's
22
+ * ESLint convention. The evaluator treats `"warn"` as equivalent to `warning`
23
+ * severity; `"off"` suppresses emission.
24
+ *
25
+ * @experimental This API is unstable and may change without notice.
26
+ */
27
+ export declare const LintRuleSeveritySchema: Schema.Literals<readonly ["off", "info", "warn", "error"]>;
28
+ /**
29
+ * Effective severity of a `lint.rules` entry.
30
+ *
31
+ * @experimental This API is unstable and may change without notice.
32
+ */
33
+ export type LintRuleSeverity = Schema.Schema.Type<typeof LintRuleSeveritySchema>;
34
+ /**
35
+ * Register one or more rule ids into the config allowlist.
36
+ *
37
+ * Each v1 rule catalog calls this once at module-load to extend the set of
38
+ * accepted `lint.rules` keys. Calls are additive and idempotent — registering
39
+ * an id twice is a no-op. A rule id that isn't registered will cause
40
+ * `SettingsSchema` decode to fail at the `lint.rules` key, surfacing the
41
+ * unknown id in the error path.
42
+ *
43
+ * Consumers (Phases 3a/3b/3c) should register from the catalog module by
44
+ * iterating the catalog's own rule array: no copy-paste of rule ids into this
45
+ * file.
46
+ *
47
+ * @experimental This API is unstable and may change without notice.
48
+ */
49
+ export declare const registerLintRuleIds: (ids: Iterable<string>) => void;
50
+ /**
51
+ * Read-only view of the currently-registered rule ids.
52
+ *
53
+ * Mainly useful for tests and snapshots; production callers should not depend
54
+ * on ordering.
55
+ *
56
+ * @experimental This API is unstable and may change without notice.
57
+ */
58
+ export declare const registeredLintRuleIds: () => ReadonlySet<string>;
59
+ /**
60
+ * Record of `<namespace>/<name>` ids to severity overrides.
61
+ *
62
+ * Unknown / wildcard / regex keys are rejected at decode by the filter — the
63
+ * filter walks the decoded record's keys and checks every key against the
64
+ * registered rule-id set. Wildcard patterns like `"skill/*"` fail the filter
65
+ * because they are not registered ids.
66
+ *
67
+ * @experimental This API is unstable and may change without notice.
68
+ */
69
+ export declare const LintRulesMapSchema: Schema.$Record<Schema.String, Schema.Literals<readonly ["off", "info", "warn", "error"]>>;
70
+ /**
71
+ * Inferred type for `LintRulesMap`.
72
+ *
73
+ * @experimental This API is unstable and may change without notice.
74
+ */
75
+ export type LintRulesMap = Schema.Schema.Type<typeof LintRulesMapSchema>;
76
+ /**
77
+ * `lint` section of `axm.json`.
78
+ *
79
+ * Today only `rules` is defined; future fields (per-rule options, reporter
80
+ * selection) extend this struct. The schema rejects excess top-level keys so
81
+ * typos surface at decode.
82
+ *
83
+ * @experimental This API is unstable and may change without notice.
84
+ */
85
+ export declare const LintConfigSchema: Schema.Struct<{
86
+ readonly rules: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Literals<readonly ["off", "info", "warn", "error"]>>>;
87
+ }>;
88
+ /**
89
+ * Inferred type for `LintConfig`.
90
+ *
91
+ * @experimental This API is unstable and may change without notice.
92
+ */
93
+ export type LintConfig = Schema.Schema.Type<typeof LintConfigSchema>;
94
+ /**
95
+ * The platform-canonical `LintConfig` — empty rules, no overrides.
96
+ *
97
+ * Registry publish uses this config; it carries no overrides so every rule
98
+ * fires at its catalog severity.
99
+ *
100
+ * @experimental This API is unstable and may change without notice.
101
+ */
102
+ export declare const platformCanonicalLintConfig: LintConfig;
103
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,140 @@
1
+ /**
2
+ * `LintConfig` — workspace-settings-level lint configuration.
3
+ *
4
+ * Workspace settings carry a `lint` section whose `rules` map binds rule ids
5
+ * to `"off" | "info" | "warn" | "error"`. The registry publish
6
+ * gate ignores workspace overrides; this config affects `axm lint` only.
7
+ *
8
+ * Keys are **exact** rule ids (`<namespace>/<name>`). No glob, wildcard, or
9
+ * regex syntax is accepted in v1. The accepted-key set is built at schema
10
+ * construction time from rule ids registered via `registerLintRuleIds` — the
11
+ * three v1 catalogs (`skill/*`, `pack/*`, `workspace/*`) each register their
12
+ * ids so adding a catalog in a later phase extends the set by construction.
13
+ *
14
+ * @experimental This API is unstable and may change without notice.
15
+ * @packageDocumentation
16
+ */
17
+ import * as Schema from "effect/Schema";
18
+ // -----------------------------------------------------------------------------
19
+ // Config value schema
20
+ // -----------------------------------------------------------------------------
21
+ /**
22
+ * Accepted values for a `lint.rules` entry.
23
+ *
24
+ * Note: `"warn"` is the config surface for `Severity` `"warning"`; mirror's
25
+ * ESLint convention. The evaluator treats `"warn"` as equivalent to `warning`
26
+ * severity; `"off"` suppresses emission.
27
+ *
28
+ * @experimental This API is unstable and may change without notice.
29
+ */
30
+ export const LintRuleSeveritySchema = Schema.Literals(["off", "info", "warn", "error"]).annotate({
31
+ identifier: "LintRuleSeverity",
32
+ title: "Lint Rule Severity",
33
+ description: "Severity override for a lint rule: 'off' silences it, 'info'/'warn'/'error' raise or lower severity.",
34
+ });
35
+ // -----------------------------------------------------------------------------
36
+ // Registered rule-id allowlist
37
+ // -----------------------------------------------------------------------------
38
+ /**
39
+ * Internal mutable registry of accepted rule ids, populated at module-load
40
+ * time by each rule catalog's side-effecting `registerLintRuleIds` call.
41
+ *
42
+ * The registry is module-local so callers in other packages can't extend it
43
+ * without going through `registerLintRuleIds`; the v1 catalogs register from
44
+ * `./catalog/skill.ts`, `./catalog/pack.ts`, and `./catalog/workspace.ts` in
45
+ * Phases 3a/3b/3c.
46
+ */
47
+ const registeredRuleIds = new Set();
48
+ /**
49
+ * Register one or more rule ids into the config allowlist.
50
+ *
51
+ * Each v1 rule catalog calls this once at module-load to extend the set of
52
+ * accepted `lint.rules` keys. Calls are additive and idempotent — registering
53
+ * an id twice is a no-op. A rule id that isn't registered will cause
54
+ * `SettingsSchema` decode to fail at the `lint.rules` key, surfacing the
55
+ * unknown id in the error path.
56
+ *
57
+ * Consumers (Phases 3a/3b/3c) should register from the catalog module by
58
+ * iterating the catalog's own rule array: no copy-paste of rule ids into this
59
+ * file.
60
+ *
61
+ * @experimental This API is unstable and may change without notice.
62
+ */
63
+ export const registerLintRuleIds = (ids) => {
64
+ for (const id of ids) {
65
+ registeredRuleIds.add(id);
66
+ }
67
+ };
68
+ /**
69
+ * Read-only view of the currently-registered rule ids.
70
+ *
71
+ * Mainly useful for tests and snapshots; production callers should not depend
72
+ * on ordering.
73
+ *
74
+ * @experimental This API is unstable and may change without notice.
75
+ */
76
+ export const registeredLintRuleIds = () => registeredRuleIds;
77
+ // -----------------------------------------------------------------------------
78
+ // Rules map schema
79
+ // -----------------------------------------------------------------------------
80
+ const ruleIdKeyFilter = Schema.makeFilter((input) => {
81
+ const invalid = [];
82
+ for (const key of Object.keys(input)) {
83
+ if (!registeredRuleIds.has(key)) {
84
+ invalid.push(key);
85
+ }
86
+ }
87
+ if (invalid.length === 0) {
88
+ return undefined;
89
+ }
90
+ return `Unknown lint rule IDs in lint.rules: ${invalid.join(", ")}. Keys must be exact <namespace>/<name> IDs; wildcards and globs are not supported.`;
91
+ });
92
+ /**
93
+ * Record of `<namespace>/<name>` ids to severity overrides.
94
+ *
95
+ * Unknown / wildcard / regex keys are rejected at decode by the filter — the
96
+ * filter walks the decoded record's keys and checks every key against the
97
+ * registered rule-id set. Wildcard patterns like `"skill/*"` fail the filter
98
+ * because they are not registered ids.
99
+ *
100
+ * @experimental This API is unstable and may change without notice.
101
+ */
102
+ export const LintRulesMapSchema = Schema.Record(Schema.String, LintRuleSeveritySchema)
103
+ .annotate({
104
+ identifier: "LintRulesMap",
105
+ title: "Lint Rules Map",
106
+ description: "Map of exact <namespace>/<name> rule ids to severity overrides for `axm lint`.",
107
+ })
108
+ .check(ruleIdKeyFilter);
109
+ // -----------------------------------------------------------------------------
110
+ // LintConfig schema
111
+ // -----------------------------------------------------------------------------
112
+ /**
113
+ * `lint` section of `axm.json`.
114
+ *
115
+ * Today only `rules` is defined; future fields (per-rule options, reporter
116
+ * selection) extend this struct. The schema rejects excess top-level keys so
117
+ * typos surface at decode.
118
+ *
119
+ * @experimental This API is unstable and may change without notice.
120
+ */
121
+ export const LintConfigSchema = Schema.Struct({
122
+ rules: Schema.optionalKey(LintRulesMapSchema.annotate({
123
+ description: "Exact lint rule ids mapped to severity overrides.",
124
+ examples: [{ "workspace/settings-schema-valid": "error" }],
125
+ })),
126
+ }).annotate({
127
+ identifier: "LintConfig",
128
+ title: "Lint Config",
129
+ description: "Lint configuration under `lint` in workspace settings.",
130
+ });
131
+ /**
132
+ * The platform-canonical `LintConfig` — empty rules, no overrides.
133
+ *
134
+ * Registry publish uses this config; it carries no overrides so every rule
135
+ * fires at its catalog severity.
136
+ *
137
+ * @experimental This API is unstable and may change without notice.
138
+ */
139
+ export const platformCanonicalLintConfig = { rules: {} };
140
+ //# sourceMappingURL=config.js.map