@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.
- package/LICENSE +110 -0
- package/README.md +13 -0
- package/dist/src/unstable/content/agent-skills-standard.d.ts +17 -0
- package/dist/src/unstable/content/agent-skills-standard.js +24 -0
- package/dist/src/unstable/content/frontmatter.d.ts +52 -0
- package/dist/src/unstable/content/frontmatter.js +115 -0
- package/dist/src/unstable/content/index.d.ts +11 -0
- package/dist/src/unstable/content/index.js +11 -0
- package/dist/src/unstable/content/skill-content.d.ts +43 -0
- package/dist/src/unstable/content/skill-content.js +184 -0
- package/dist/src/unstable/content/skill-types.d.ts +22 -0
- package/dist/src/unstable/content/skill-types.js +9 -0
- package/dist/src/unstable/content/subagent-content.d.ts +58 -0
- package/dist/src/unstable/content/subagent-content.js +101 -0
- package/dist/src/unstable/knowledge/index.d.ts +8 -0
- package/dist/src/unstable/knowledge/index.js +8 -0
- package/dist/src/unstable/knowledge/knowledge-search.d.ts +32 -0
- package/dist/src/unstable/knowledge/knowledge-search.js +147 -0
- package/dist/src/unstable/knowledge/okf.d.ts +86 -0
- package/dist/src/unstable/knowledge/okf.js +1090 -0
- package/dist/src/unstable/lint/catalog/hook/decision-portability.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/hook/decision-portability.js +40 -0
- package/dist/src/unstable/lint/catalog/hook/entrypoint-exists.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/hook/entrypoint-exists.js +39 -0
- package/dist/src/unstable/lint/catalog/hook/envelope.d.ts +6 -0
- package/dist/src/unstable/lint/catalog/hook/envelope.js +15 -0
- package/dist/src/unstable/lint/catalog/hook/matcher-raw-portability.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/hook/matcher-raw-portability.js +51 -0
- package/dist/src/unstable/lint/catalog/hook.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/hook.js +17 -0
- package/dist/src/unstable/lint/catalog/knowledge/diagnostics.d.ts +128 -0
- package/dist/src/unstable/lint/catalog/knowledge/diagnostics.js +78 -0
- package/dist/src/unstable/lint/catalog/knowledge/envelope.d.ts +6 -0
- package/dist/src/unstable/lint/catalog/knowledge/envelope.js +15 -0
- package/dist/src/unstable/lint/catalog/knowledge.d.ts +5 -0
- package/dist/src/unstable/lint/catalog/knowledge.js +11 -0
- package/dist/src/unstable/lint/catalog/mcp-server/envelope.d.ts +6 -0
- package/dist/src/unstable/lint/catalog/mcp-server/envelope.js +15 -0
- package/dist/src/unstable/lint/catalog/mcp-server.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/mcp-server.js +6 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-keys-recognized.d.ts +28 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-keys-recognized.js +38 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-present.d.ts +17 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-present.js +24 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-schema-valid.d.ts +25 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-schema-valid.js +33 -0
- package/dist/src/unstable/lint/catalog/pack-accessor/contexts.d.ts +51 -0
- package/dist/src/unstable/lint/catalog/pack-accessor/contexts.js +45 -0
- package/dist/src/unstable/lint/catalog/pack-accessor/vft.d.ts +60 -0
- package/dist/src/unstable/lint/catalog/pack-accessor/vft.js +85 -0
- package/dist/src/unstable/lint/catalog/pack.d.ts +37 -0
- package/dist/src/unstable/lint/catalog/pack.js +47 -0
- package/dist/src/unstable/lint/catalog/rule/envelope.d.ts +6 -0
- package/dist/src/unstable/lint/catalog/rule/envelope.js +15 -0
- package/dist/src/unstable/lint/catalog/rule.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/rule.js +6 -0
- package/dist/src/unstable/lint/catalog/shared/envelope-rules.d.ts +93 -0
- package/dist/src/unstable/lint/catalog/shared/envelope-rules.js +89 -0
- package/dist/src/unstable/lint/catalog/shared/manifest-json.d.ts +18 -0
- package/dist/src/unstable/lint/catalog/shared/manifest-json.js +28 -0
- package/dist/src/unstable/lint/catalog/shared/manifest-present.d.ts +25 -0
- package/dist/src/unstable/lint/catalog/shared/manifest-present.js +37 -0
- package/dist/src/unstable/lint/catalog/shared/recommended-packs-rules.d.ts +70 -0
- package/dist/src/unstable/lint/catalog/shared/recommended-packs-rules.js +139 -0
- package/dist/src/unstable/lint/catalog/shared/schema-rule.d.ts +58 -0
- package/dist/src/unstable/lint/catalog/shared/schema-rule.js +103 -0
- package/dist/src/unstable/lint/catalog/skill/frontmatter-parseable.d.ts +31 -0
- package/dist/src/unstable/lint/catalog/skill/frontmatter-parseable.js +148 -0
- package/dist/src/unstable/lint/catalog/skill/frontmatter-standard-valid.d.ts +13 -0
- package/dist/src/unstable/lint/catalog/skill/frontmatter-standard-valid.js +61 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-keys-recognized.d.ts +26 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-keys-recognized.js +41 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-present.d.ts +23 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-present.js +32 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-schema-valid.d.ts +21 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-schema-valid.js +36 -0
- package/dist/src/unstable/lint/catalog/skill/recommended-packs-valid.d.ts +8 -0
- package/dist/src/unstable/lint/catalog/skill/recommended-packs-valid.js +12 -0
- package/dist/src/unstable/lint/catalog/skill/skill-md-present.d.ts +17 -0
- package/dist/src/unstable/lint/catalog/skill/skill-md-present.js +37 -0
- package/dist/src/unstable/lint/catalog/skill/standalone-declaration-valid.d.ts +8 -0
- package/dist/src/unstable/lint/catalog/skill/standalone-declaration-valid.js +12 -0
- package/dist/src/unstable/lint/catalog/skill-accessor/contexts.d.ts +61 -0
- package/dist/src/unstable/lint/catalog/skill-accessor/contexts.js +55 -0
- package/dist/src/unstable/lint/catalog/skill-accessor/vft.d.ts +77 -0
- package/dist/src/unstable/lint/catalog/skill-accessor/vft.js +135 -0
- package/dist/src/unstable/lint/catalog/skill.d.ts +44 -0
- package/dist/src/unstable/lint/catalog/skill.js +64 -0
- package/dist/src/unstable/lint/catalog/subagent/envelope.d.ts +6 -0
- package/dist/src/unstable/lint/catalog/subagent/envelope.js +15 -0
- package/dist/src/unstable/lint/catalog/subagent.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/subagent.js +6 -0
- package/dist/src/unstable/lint/compose-path.d.ts +28 -0
- package/dist/src/unstable/lint/compose-path.js +64 -0
- package/dist/src/unstable/lint/config.d.ts +103 -0
- package/dist/src/unstable/lint/config.js +140 -0
- package/dist/src/unstable/lint/context.d.ts +246 -0
- package/dist/src/unstable/lint/context.js +21 -0
- package/dist/src/unstable/lint/describe-document.d.ts +31 -0
- package/dist/src/unstable/lint/describe-document.js +50 -0
- package/dist/src/unstable/lint/evaluate.d.ts +47 -0
- package/dist/src/unstable/lint/evaluate.js +82 -0
- package/dist/src/unstable/lint/issues-to-findings.d.ts +35 -0
- package/dist/src/unstable/lint/issues-to-findings.js +149 -0
- package/dist/src/unstable/lint/publish.d.ts +49 -0
- package/dist/src/unstable/lint/publish.js +86 -0
- package/dist/src/unstable/lint/rule.d.ts +98 -0
- package/dist/src/unstable/lint/rule.js +18 -0
- package/dist/src/unstable/publish/archive-guardrails.d.ts +39 -0
- package/dist/src/unstable/publish/archive-guardrails.js +250 -0
- package/dist/src/unstable/publish/filtered-package-validation.d.ts +24 -0
- package/dist/src/unstable/publish/filtered-package-validation.js +117 -0
- package/dist/src/unstable/publish/index.d.ts +12 -0
- package/dist/src/unstable/publish/index.js +12 -0
- package/dist/src/unstable/publish/ingest-limits.d.ts +25 -0
- package/dist/src/unstable/publish/ingest-limits.js +41 -0
- package/dist/src/unstable/publish/input-normalization.d.ts +40 -0
- package/dist/src/unstable/publish/input-normalization.js +125 -0
- package/dist/src/unstable/publish/manifest-policy.d.ts +611 -0
- package/dist/src/unstable/publish/manifest-policy.js +196 -0
- package/dist/src/unstable/publish/test-zip-helpers.d.ts +13 -0
- package/dist/src/unstable/publish/test-zip-helpers.js +117 -0
- package/dist/src/unstable/publish/visibility.d.ts +161 -0
- package/dist/src/unstable/publish/visibility.js +124 -0
- package/dist/src/unstable/registry/discover-schema.d.ts +68 -0
- package/dist/src/unstable/registry/discover-schema.js +35 -0
- package/dist/src/unstable/registry/index.d.ts +9 -0
- package/dist/src/unstable/registry/index.js +9 -0
- package/dist/src/unstable/registry/publication-set.d.ts +303 -0
- package/dist/src/unstable/registry/publication-set.js +507 -0
- package/dist/src/unstable/registry/release-age-policy.d.ts +57 -0
- package/dist/src/unstable/registry/release-age-policy.js +117 -0
- package/dist/src/unstable/registry/schema.d.ts +220 -0
- package/dist/src/unstable/registry/schema.js +114 -0
- package/dist/src/unstable/suggested-action.d.ts +19 -0
- package/dist/src/unstable/suggested-action.js +42 -0
- package/package.json +214 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `pack/manifest-schema-valid` — `pack.json` conforms to
|
|
3
|
+
* `PackManifestSchema`.
|
|
4
|
+
*
|
|
5
|
+
* Delegates to Effect Schema. Issues map 1:1 to findings via
|
|
6
|
+
* `issuesToFindings`.
|
|
7
|
+
*
|
|
8
|
+
* Early-return arm (no findings):
|
|
9
|
+
*
|
|
10
|
+
* - `subject.packJson === undefined` — manifest is absent (covered by
|
|
11
|
+
* `pack/manifest-present`).
|
|
12
|
+
*
|
|
13
|
+
* Dependency-map FQN grammar and `VersionRange` decode arms are owned by
|
|
14
|
+
* `PackManifestSchema` itself — the dependency sections are typed
|
|
15
|
+
* `Record<FQN, VersionRange>` so unknown FQNs, malformed grammar, and
|
|
16
|
+
* bad semver ranges surface as normal schema issues through the shared
|
|
17
|
+
* `schemaDecodeFindings` plumbing.
|
|
18
|
+
*
|
|
19
|
+
* @experimental This API is unstable and may change without notice.
|
|
20
|
+
* @packageDocumentation
|
|
21
|
+
*/
|
|
22
|
+
import { PackManifestSchema } from "@agentxm/extension-model/unstable/packs/manifest-schema";
|
|
23
|
+
import { schemaDecodeFindings } from "../shared/schema-rule.js";
|
|
24
|
+
const RULE_ID = "pack/manifest-schema-valid";
|
|
25
|
+
const PACK_JSON = "pack.json";
|
|
26
|
+
export const manifestSchemaValidRule = {
|
|
27
|
+
id: RULE_ID,
|
|
28
|
+
description: "pack.json defines a valid pack manifest.",
|
|
29
|
+
kind: "advisory",
|
|
30
|
+
severity: "error",
|
|
31
|
+
check: (context) => schemaDecodeFindings(RULE_ID, "error", PACK_JSON, PackManifestSchema, context.subject.packJson),
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=manifest-schema-valid.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `buildPackRuleContexts` — build `PackRuleContext[]` from a structural
|
|
3
|
+
* `installedPacks` input. The full lint workspace view
|
|
4
|
+
* (`LintWorkspaceView`) satisfies this by construction.
|
|
5
|
+
*
|
|
6
|
+
* The minimal shape is **exactly** the set of fields the function reads per
|
|
7
|
+
* installed pack:
|
|
8
|
+
*
|
|
9
|
+
* - `packJson` — pre-decoded `pack.json` when present (caller
|
|
10
|
+
* decodes once per pack, so rules don't re-read + re-parse).
|
|
11
|
+
* - `displayRoot` — posix-relative root used by the renderer; the caller
|
|
12
|
+
* picks per provenance (see the table below).
|
|
13
|
+
* - `files` — the pre-bound `PackFileAccessor`. The caller chooses VFT or
|
|
14
|
+
* platform-backed.
|
|
15
|
+
*
|
|
16
|
+
* Provenance → `displayRoot` table:
|
|
17
|
+
*
|
|
18
|
+
* | Surface | `displayRoot` |
|
|
19
|
+
* | ---------------------------------- | ----------------------------------------- |
|
|
20
|
+
* | Publish | `""` |
|
|
21
|
+
* | Registry-installed pack | `agent_extensions/<@owner>/packs/<name>` |
|
|
22
|
+
*
|
|
23
|
+
* @experimental This API is unstable and may change without notice.
|
|
24
|
+
* @packageDocumentation
|
|
25
|
+
*/
|
|
26
|
+
import type { PackFileAccessor, PackRuleContext } from "../../context.js";
|
|
27
|
+
/**
|
|
28
|
+
* Minimal structural shape `buildPackRuleContexts` needs per installed
|
|
29
|
+
* pack. The full lint workspace view exposes
|
|
30
|
+
* `installedPacks: ReadonlyArray<InstalledPackInfo>`.
|
|
31
|
+
*
|
|
32
|
+
* @experimental This API is unstable and may change without notice.
|
|
33
|
+
*/
|
|
34
|
+
export interface InstalledPackInfo {
|
|
35
|
+
readonly packJson: unknown;
|
|
36
|
+
readonly displayRoot: string;
|
|
37
|
+
readonly files: PackFileAccessor;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Project an input's `installedPacks` into `PackRuleContext`s with their
|
|
41
|
+
* `displayRoot` and `subject` fields pre-populated.
|
|
42
|
+
*
|
|
43
|
+
* Publish callers bypass this helper and construct a single context directly
|
|
44
|
+
* — they have exactly one pack in play and no workspace.
|
|
45
|
+
*
|
|
46
|
+
* @experimental This API is unstable and may change without notice.
|
|
47
|
+
*/
|
|
48
|
+
export declare const buildPackRuleContexts: (input: {
|
|
49
|
+
readonly installedPacks: ReadonlyArray<InstalledPackInfo>;
|
|
50
|
+
}) => ReadonlyArray<PackRuleContext>;
|
|
51
|
+
//# sourceMappingURL=contexts.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `buildPackRuleContexts` — build `PackRuleContext[]` from a structural
|
|
3
|
+
* `installedPacks` input. The full lint workspace view
|
|
4
|
+
* (`LintWorkspaceView`) satisfies this by construction.
|
|
5
|
+
*
|
|
6
|
+
* The minimal shape is **exactly** the set of fields the function reads per
|
|
7
|
+
* installed pack:
|
|
8
|
+
*
|
|
9
|
+
* - `packJson` — pre-decoded `pack.json` when present (caller
|
|
10
|
+
* decodes once per pack, so rules don't re-read + re-parse).
|
|
11
|
+
* - `displayRoot` — posix-relative root used by the renderer; the caller
|
|
12
|
+
* picks per provenance (see the table below).
|
|
13
|
+
* - `files` — the pre-bound `PackFileAccessor`. The caller chooses VFT or
|
|
14
|
+
* platform-backed.
|
|
15
|
+
*
|
|
16
|
+
* Provenance → `displayRoot` table:
|
|
17
|
+
*
|
|
18
|
+
* | Surface | `displayRoot` |
|
|
19
|
+
* | ---------------------------------- | ----------------------------------------- |
|
|
20
|
+
* | Publish | `""` |
|
|
21
|
+
* | Registry-installed pack | `agent_extensions/<@owner>/packs/<name>` |
|
|
22
|
+
*
|
|
23
|
+
* @experimental This API is unstable and may change without notice.
|
|
24
|
+
* @packageDocumentation
|
|
25
|
+
*/
|
|
26
|
+
// -----------------------------------------------------------------------------
|
|
27
|
+
// buildPackRuleContexts
|
|
28
|
+
// -----------------------------------------------------------------------------
|
|
29
|
+
/**
|
|
30
|
+
* Project an input's `installedPacks` into `PackRuleContext`s with their
|
|
31
|
+
* `displayRoot` and `subject` fields pre-populated.
|
|
32
|
+
*
|
|
33
|
+
* Publish callers bypass this helper and construct a single context directly
|
|
34
|
+
* — they have exactly one pack in play and no workspace.
|
|
35
|
+
*
|
|
36
|
+
* @experimental This API is unstable and may change without notice.
|
|
37
|
+
*/
|
|
38
|
+
export const buildPackRuleContexts = (input) => input.installedPacks.map((info) => ({
|
|
39
|
+
subject: {
|
|
40
|
+
packJson: info.packJson,
|
|
41
|
+
},
|
|
42
|
+
files: info.files,
|
|
43
|
+
displayRoot: info.displayRoot,
|
|
44
|
+
}));
|
|
45
|
+
//# sourceMappingURL=contexts.js.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VFT-backed `PackFileAccessor` for publish callers.
|
|
3
|
+
*
|
|
4
|
+
* A Virtual File Tree (VFT) is an in-memory representation of an extracted
|
|
5
|
+
* archive — the registry publish pipeline extracts an upload into a VFT, then
|
|
6
|
+
* passes that tree into Phase 4 decode/lint. The VFT's schema and bounds
|
|
7
|
+
* (max size, file count, path depth) are owned by the registry extract phase
|
|
8
|
+
* (Phase 4 concern); this accessor treats the tree as a read-only
|
|
9
|
+
* `path -> Uint8Array` map and enforces its own rooted-read + no-`..`-escape
|
|
10
|
+
* invariants at the rule boundary.
|
|
11
|
+
*
|
|
12
|
+
* Bounds enforcement here:
|
|
13
|
+
*
|
|
14
|
+
* - Paths are normalized to posix, `./` prefixes are stripped.
|
|
15
|
+
* - Empty path resolves to the accessor root itself.
|
|
16
|
+
* - Any path containing a `..` segment raises `FileAccessError {
|
|
17
|
+
* reason: "path-escape" }` from `readBytes` and resolves to `false` from
|
|
18
|
+
* `exists`.
|
|
19
|
+
* - Absolute paths (starting with `/` or a Windows drive letter) are
|
|
20
|
+
* treated as escape attempts.
|
|
21
|
+
*
|
|
22
|
+
* Mirrors the skill VFT accessor (`../skill-accessor/vft.ts`). The VFTNode
|
|
23
|
+
* interface is intentionally the same so a publish caller can extract a
|
|
24
|
+
* single archive once and pass the same tree to either accessor factory.
|
|
25
|
+
*
|
|
26
|
+
* @experimental This API is unstable and may change without notice.
|
|
27
|
+
* @packageDocumentation
|
|
28
|
+
*/
|
|
29
|
+
import type { PackFileAccessor } from "../../context.js";
|
|
30
|
+
/**
|
|
31
|
+
* Minimal shape of a Virtual File Tree consumed by the accessor.
|
|
32
|
+
*
|
|
33
|
+
* Shape-compatible with `../skill-accessor/vft.ts#VFTNode`; kept as a local
|
|
34
|
+
* declaration to avoid a cross-subfolder import and to document what this
|
|
35
|
+
* accessor uses.
|
|
36
|
+
*
|
|
37
|
+
* @experimental This API is unstable and may change without notice.
|
|
38
|
+
*/
|
|
39
|
+
export interface PackVFTNode {
|
|
40
|
+
/**
|
|
41
|
+
* Whether the given posix path points to a file within the tree.
|
|
42
|
+
*/
|
|
43
|
+
readonly hasFile: (posixPath: string) => boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Return the bytes for the given posix path, or `undefined` when the path
|
|
46
|
+
* does not resolve to a file (missing, directory, or outside the tree).
|
|
47
|
+
*/
|
|
48
|
+
readonly getFile: (posixPath: string) => Uint8Array | undefined;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Build a VFT-backed `PackFileAccessor` rooted at the tree's root.
|
|
52
|
+
*
|
|
53
|
+
* Callers that root the pack at a sub-path of the archive should pre-strip
|
|
54
|
+
* that sub-path before constructing the tree — the accessor enforces no
|
|
55
|
+
* `..` escape above the root it was given.
|
|
56
|
+
*
|
|
57
|
+
* @experimental This API is unstable and may change without notice.
|
|
58
|
+
*/
|
|
59
|
+
export declare const makeVftPackFileAccessor: (tree: PackVFTNode) => PackFileAccessor;
|
|
60
|
+
//# sourceMappingURL=vft.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VFT-backed `PackFileAccessor` for publish callers.
|
|
3
|
+
*
|
|
4
|
+
* A Virtual File Tree (VFT) is an in-memory representation of an extracted
|
|
5
|
+
* archive — the registry publish pipeline extracts an upload into a VFT, then
|
|
6
|
+
* passes that tree into Phase 4 decode/lint. The VFT's schema and bounds
|
|
7
|
+
* (max size, file count, path depth) are owned by the registry extract phase
|
|
8
|
+
* (Phase 4 concern); this accessor treats the tree as a read-only
|
|
9
|
+
* `path -> Uint8Array` map and enforces its own rooted-read + no-`..`-escape
|
|
10
|
+
* invariants at the rule boundary.
|
|
11
|
+
*
|
|
12
|
+
* Bounds enforcement here:
|
|
13
|
+
*
|
|
14
|
+
* - Paths are normalized to posix, `./` prefixes are stripped.
|
|
15
|
+
* - Empty path resolves to the accessor root itself.
|
|
16
|
+
* - Any path containing a `..` segment raises `FileAccessError {
|
|
17
|
+
* reason: "path-escape" }` from `readBytes` and resolves to `false` from
|
|
18
|
+
* `exists`.
|
|
19
|
+
* - Absolute paths (starting with `/` or a Windows drive letter) are
|
|
20
|
+
* treated as escape attempts.
|
|
21
|
+
*
|
|
22
|
+
* Mirrors the skill VFT accessor (`../skill-accessor/vft.ts`). The VFTNode
|
|
23
|
+
* interface is intentionally the same so a publish caller can extract a
|
|
24
|
+
* single archive once and pass the same tree to either accessor factory.
|
|
25
|
+
*
|
|
26
|
+
* @experimental This API is unstable and may change without notice.
|
|
27
|
+
* @packageDocumentation
|
|
28
|
+
*/
|
|
29
|
+
import * as Effect from "effect/Effect";
|
|
30
|
+
/**
|
|
31
|
+
* Build a VFT-backed `PackFileAccessor` rooted at the tree's root.
|
|
32
|
+
*
|
|
33
|
+
* Callers that root the pack at a sub-path of the archive should pre-strip
|
|
34
|
+
* that sub-path before constructing the tree — the accessor enforces no
|
|
35
|
+
* `..` escape above the root it was given.
|
|
36
|
+
*
|
|
37
|
+
* @experimental This API is unstable and may change without notice.
|
|
38
|
+
*/
|
|
39
|
+
export const makeVftPackFileAccessor = (tree) => {
|
|
40
|
+
return {
|
|
41
|
+
exists: (path) => {
|
|
42
|
+
const normalized = normalizeAndCheck(path);
|
|
43
|
+
if (normalized.kind !== "ok") {
|
|
44
|
+
return Effect.succeed(false);
|
|
45
|
+
}
|
|
46
|
+
return Effect.succeed(tree.hasFile(normalized.path));
|
|
47
|
+
},
|
|
48
|
+
readBytes: (path) => {
|
|
49
|
+
const normalized = normalizeAndCheck(path);
|
|
50
|
+
if (normalized.kind === "escape") {
|
|
51
|
+
return failFileAccess(path, "path-escape", `path escapes the accessor root: ${path}`);
|
|
52
|
+
}
|
|
53
|
+
const bytes = tree.getFile(normalized.path);
|
|
54
|
+
if (bytes === undefined) {
|
|
55
|
+
return failFileAccess(path, "read-error", `file not found at ${path}`);
|
|
56
|
+
}
|
|
57
|
+
return Effect.succeed(bytes);
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
const normalizeAndCheck = (path) => {
|
|
62
|
+
if (path === "" || path === "." || path === "./") {
|
|
63
|
+
return { kind: "ok", path: "" };
|
|
64
|
+
}
|
|
65
|
+
// Windows drive letters (`C:/`) and absolute posix paths both count as
|
|
66
|
+
// escape attempts at a pack-rooted accessor.
|
|
67
|
+
if (/^[a-z]:[\\/]/i.test(path) || path.startsWith("/") || path.startsWith("\\")) {
|
|
68
|
+
return { kind: "escape" };
|
|
69
|
+
}
|
|
70
|
+
const normalized = path.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
71
|
+
const segments = normalized.split("/");
|
|
72
|
+
for (const segment of segments) {
|
|
73
|
+
if (segment === "..") {
|
|
74
|
+
return { kind: "escape" };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return { kind: "ok", path: normalized };
|
|
78
|
+
};
|
|
79
|
+
const failFileAccess = (path, reason, message) => Effect.fail({
|
|
80
|
+
_tag: "FileAccessError",
|
|
81
|
+
path,
|
|
82
|
+
reason,
|
|
83
|
+
message,
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=vft.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `pack/*` rule catalog — the v1 three-rule set.
|
|
3
|
+
*
|
|
4
|
+
* Per the lint design, registry publish and `axm lint`
|
|
5
|
+
* run exactly these rules against each pack context:
|
|
6
|
+
*
|
|
7
|
+
* | ID | Severity | Autofix |
|
|
8
|
+
* | ------------------------------- | -------- | ------- |
|
|
9
|
+
* | `pack/manifest-present` | error | — |
|
|
10
|
+
* | `pack/manifest-schema-valid` | error | — |
|
|
11
|
+
* | `pack/manifest-keys-recognized` | error | — |
|
|
12
|
+
*
|
|
13
|
+
* All three ship `kind: "advisory"`. Packs are registry-only at v1 (no
|
|
14
|
+
* non-native arm), so there is no applicability discriminator — every pack
|
|
15
|
+
* context runs every rule and the `check` body's early-return arms handle
|
|
16
|
+
* manifest-absent cases.
|
|
17
|
+
*
|
|
18
|
+
* Rule ids are **registered with the lint config allowlist at module-load
|
|
19
|
+
* time**, so importing this catalog extends the set of accepted
|
|
20
|
+
* `axm.json` `lint.rules` keys. Consumers that never import the
|
|
21
|
+
* catalog (the registry Worker bundle for `skill`-only routes, e.g.) don't
|
|
22
|
+
* pay the registration cost.
|
|
23
|
+
*
|
|
24
|
+
* @experimental This API is unstable and may change without notice.
|
|
25
|
+
* @packageDocumentation
|
|
26
|
+
*/
|
|
27
|
+
import type { LintRule } from "../rule.js";
|
|
28
|
+
import type { PackRuleContext } from "../context.js";
|
|
29
|
+
/**
|
|
30
|
+
* Ordered v1 `pack/*` rule catalog. Declaration order is the evaluation
|
|
31
|
+
* order within a single `evaluateContexts` call (deterministic ordering is
|
|
32
|
+
* test-observable; see `evaluate.ts`).
|
|
33
|
+
*
|
|
34
|
+
* @experimental This API is unstable and may change without notice.
|
|
35
|
+
*/
|
|
36
|
+
export declare const packRules: ReadonlyArray<LintRule<PackRuleContext>>;
|
|
37
|
+
//# sourceMappingURL=pack.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `pack/*` rule catalog — the v1 three-rule set.
|
|
3
|
+
*
|
|
4
|
+
* Per the lint design, registry publish and `axm lint`
|
|
5
|
+
* run exactly these rules against each pack context:
|
|
6
|
+
*
|
|
7
|
+
* | ID | Severity | Autofix |
|
|
8
|
+
* | ------------------------------- | -------- | ------- |
|
|
9
|
+
* | `pack/manifest-present` | error | — |
|
|
10
|
+
* | `pack/manifest-schema-valid` | error | — |
|
|
11
|
+
* | `pack/manifest-keys-recognized` | error | — |
|
|
12
|
+
*
|
|
13
|
+
* All three ship `kind: "advisory"`. Packs are registry-only at v1 (no
|
|
14
|
+
* non-native arm), so there is no applicability discriminator — every pack
|
|
15
|
+
* context runs every rule and the `check` body's early-return arms handle
|
|
16
|
+
* manifest-absent cases.
|
|
17
|
+
*
|
|
18
|
+
* Rule ids are **registered with the lint config allowlist at module-load
|
|
19
|
+
* time**, so importing this catalog extends the set of accepted
|
|
20
|
+
* `axm.json` `lint.rules` keys. Consumers that never import the
|
|
21
|
+
* catalog (the registry Worker bundle for `skill`-only routes, e.g.) don't
|
|
22
|
+
* pay the registration cost.
|
|
23
|
+
*
|
|
24
|
+
* @experimental This API is unstable and may change without notice.
|
|
25
|
+
* @packageDocumentation
|
|
26
|
+
*/
|
|
27
|
+
import { registerLintRuleIds } from "../config.js";
|
|
28
|
+
import { manifestPresentRule } from "./pack/manifest-present.js";
|
|
29
|
+
import { manifestSchemaValidRule } from "./pack/manifest-schema-valid.js";
|
|
30
|
+
import { manifestKeysRecognizedRule } from "./pack/manifest-keys-recognized.js";
|
|
31
|
+
/**
|
|
32
|
+
* Ordered v1 `pack/*` rule catalog. Declaration order is the evaluation
|
|
33
|
+
* order within a single `evaluateContexts` call (deterministic ordering is
|
|
34
|
+
* test-observable; see `evaluate.ts`).
|
|
35
|
+
*
|
|
36
|
+
* @experimental This API is unstable and may change without notice.
|
|
37
|
+
*/
|
|
38
|
+
export const packRules = [
|
|
39
|
+
manifestPresentRule,
|
|
40
|
+
manifestSchemaValidRule,
|
|
41
|
+
manifestKeysRecognizedRule,
|
|
42
|
+
];
|
|
43
|
+
// Register ids into the `LintConfig.rules` allowlist. Module-load side effect:
|
|
44
|
+
// a consumer that imports this catalog (or the `catalog/index` barrel) enables
|
|
45
|
+
// `axm.json` `lint.rules` to reference any of the above rule ids.
|
|
46
|
+
registerLintRuleIds(packRules.map((r) => r.id));
|
|
47
|
+
//# sourceMappingURL=pack.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `rule/*` manifest envelope — see `../shared/envelope-rules.ts`.
|
|
3
|
+
*/
|
|
4
|
+
import type { RuleRuleContext } from "../../context.js";
|
|
5
|
+
export declare const ruleEnvelopeRules: import("../shared/envelope-rules.js").ManifestEnvelopeRules<RuleRuleContext<import("../../context.js").RuleContent>>;
|
|
6
|
+
//# sourceMappingURL=envelope.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `rule/*` manifest envelope — see `../shared/envelope-rules.ts`.
|
|
3
|
+
*/
|
|
4
|
+
import { RuleManifestSchema, RULE_MANIFEST_FILENAME, } from "@agentxm/extension-model/unstable/rules/manifest-schema";
|
|
5
|
+
import { makeManifestEnvelopeRules } from "../shared/envelope-rules.js";
|
|
6
|
+
export const ruleEnvelopeRules = makeManifestEnvelopeRules({
|
|
7
|
+
namespace: "rule",
|
|
8
|
+
manifestFile: RULE_MANIFEST_FILENAME,
|
|
9
|
+
schema: RuleManifestSchema,
|
|
10
|
+
manifestJson: (context) => context.subject.ruleJson,
|
|
11
|
+
presentDescription: "Rules include a root rule.json manifest.",
|
|
12
|
+
presentMissingMessage: "rule.json is missing. Create rule.json with the required manifest fields (`owner`, `type`, `name`, `version`).",
|
|
13
|
+
schemaDescription: "rule.json defines a valid rule manifest.",
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=envelope.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { registerLintRuleIds } from "../config.js";
|
|
2
|
+
import { ruleEnvelopeRules } from "./rule/envelope.js";
|
|
3
|
+
import { orderedEnvelopeRules } from "./shared/envelope-rules.js";
|
|
4
|
+
export const ruleRules = orderedEnvelopeRules(ruleEnvelopeRules);
|
|
5
|
+
registerLintRuleIds(ruleRules.map((r) => r.id));
|
|
6
|
+
//# sourceMappingURL=rule.js.map
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The five-rule manifest envelope every non-pack per-extension catalog ships.
|
|
3
|
+
*
|
|
4
|
+
* `skill`, `subagent`, `mcp-server`, `hook`, `rule`, and `knowledge` each
|
|
5
|
+
* enforce the same five invariants against their own
|
|
6
|
+
* manifest:
|
|
7
|
+
*
|
|
8
|
+
* 1. `<ns>/manifest-present` — the manifest file exists.
|
|
9
|
+
* 2. `<ns>/manifest-schema-valid` — it decodes against the canonical schema.
|
|
10
|
+
* 3. `<ns>/manifest-keys-recognized` — it carries no unknown top-level keys.
|
|
11
|
+
* 4. `<ns>/standalone-declaration-valid` — `standalone: false` names its packs.
|
|
12
|
+
* 5. `<ns>/recommended-packs-valid` — recommended packs are bare FQNs.
|
|
13
|
+
*
|
|
14
|
+
* Rules 1, 4, and 5 already had factories; rules 2 and 3 were hand-copied per
|
|
15
|
+
* type. This module composes all five so a new extension type's envelope is
|
|
16
|
+
* one call, and so the publish-safe barrel (`lint/publish.ts`) and the
|
|
17
|
+
* `axm lint` catalog (`catalog/<type>.ts`) build from the same definitions.
|
|
18
|
+
*
|
|
19
|
+
* The factory is deliberately free of `registerLintRuleIds` — that module-load
|
|
20
|
+
* side effect stays in `catalog/<type>.ts`, because it imports the workspace
|
|
21
|
+
* lint config schema that `lint/publish.ts` exists to keep out of the registry
|
|
22
|
+
* Worker bundle.
|
|
23
|
+
*
|
|
24
|
+
* @experimental This API is unstable and may change without notice.
|
|
25
|
+
* @packageDocumentation
|
|
26
|
+
*/
|
|
27
|
+
import * as Effect from "effect/Effect";
|
|
28
|
+
import type * as Schema from "effect/Schema";
|
|
29
|
+
import type { AdvisoryRule } from "../../rule.js";
|
|
30
|
+
/**
|
|
31
|
+
* A manifest schema usable by the envelope: decodable, and introspectable for
|
|
32
|
+
* its declared top-level field names.
|
|
33
|
+
*
|
|
34
|
+
* @experimental This API is unstable and may change without notice.
|
|
35
|
+
*/
|
|
36
|
+
export type ManifestEnvelopeSchema<A, I> = Schema.Codec<A, I> & {
|
|
37
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Per-catalog parameters for {@link makeManifestEnvelopeRules}.
|
|
41
|
+
*
|
|
42
|
+
* @experimental This API is unstable and may change without notice.
|
|
43
|
+
*/
|
|
44
|
+
export interface ManifestEnvelopeOptions<C, A, I> {
|
|
45
|
+
/** Rule-id namespace; matches the context kind (`skill`, `hook`, ...). */
|
|
46
|
+
readonly namespace: string;
|
|
47
|
+
/** Accessor-relative manifest filename stamped on `location.file`. */
|
|
48
|
+
readonly manifestFile: string;
|
|
49
|
+
/** Canonical manifest schema for this type. */
|
|
50
|
+
readonly schema: ManifestEnvelopeSchema<A, I>;
|
|
51
|
+
/** Reads the caller-decoded manifest JSON off the rule context. */
|
|
52
|
+
readonly manifestJson: (context: C) => unknown;
|
|
53
|
+
/** `description` for `<ns>/manifest-present`. */
|
|
54
|
+
readonly presentDescription: string;
|
|
55
|
+
/** Finding message emitted when the manifest file is absent. */
|
|
56
|
+
readonly presentMissingMessage: string;
|
|
57
|
+
/** `description` for `<ns>/manifest-schema-valid`. */
|
|
58
|
+
readonly schemaDescription: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The five envelope rules, named so callers can order them alongside their own
|
|
62
|
+
* bespoke rules rather than splicing an opaque array.
|
|
63
|
+
*
|
|
64
|
+
* @experimental This API is unstable and may change without notice.
|
|
65
|
+
*/
|
|
66
|
+
export interface ManifestEnvelopeRules<C> {
|
|
67
|
+
readonly manifestPresent: AdvisoryRule<C>;
|
|
68
|
+
readonly manifestSchemaValid: AdvisoryRule<C>;
|
|
69
|
+
readonly manifestKeysRecognized: AdvisoryRule<C>;
|
|
70
|
+
readonly standaloneDeclarationValid: AdvisoryRule<C>;
|
|
71
|
+
readonly recommendedPacksValid: AdvisoryRule<C>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Build one catalog's five manifest envelope rules.
|
|
75
|
+
*
|
|
76
|
+
* The context only has to expose a `files` accessor with `exists`; the
|
|
77
|
+
* manifest value itself is read through `options.manifestJson`, so the factory
|
|
78
|
+
* never assumes a subject field name.
|
|
79
|
+
*
|
|
80
|
+
* @experimental This API is unstable and may change without notice.
|
|
81
|
+
*/
|
|
82
|
+
export declare const makeManifestEnvelopeRules: <C extends {
|
|
83
|
+
readonly files: {
|
|
84
|
+
readonly exists: (path: string) => Effect.Effect<boolean>;
|
|
85
|
+
};
|
|
86
|
+
}, A, I>(options: ManifestEnvelopeOptions<C, A, I>) => ManifestEnvelopeRules<C>;
|
|
87
|
+
/**
|
|
88
|
+
* The envelope rules in canonical catalog order.
|
|
89
|
+
*
|
|
90
|
+
* @experimental This API is unstable and may change without notice.
|
|
91
|
+
*/
|
|
92
|
+
export declare const orderedEnvelopeRules: <C>(rules: ManifestEnvelopeRules<C>) => ReadonlyArray<AdvisoryRule<C>>;
|
|
93
|
+
//# sourceMappingURL=envelope-rules.d.ts.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The five-rule manifest envelope every non-pack per-extension catalog ships.
|
|
3
|
+
*
|
|
4
|
+
* `skill`, `subagent`, `mcp-server`, `hook`, `rule`, and `knowledge` each
|
|
5
|
+
* enforce the same five invariants against their own
|
|
6
|
+
* manifest:
|
|
7
|
+
*
|
|
8
|
+
* 1. `<ns>/manifest-present` — the manifest file exists.
|
|
9
|
+
* 2. `<ns>/manifest-schema-valid` — it decodes against the canonical schema.
|
|
10
|
+
* 3. `<ns>/manifest-keys-recognized` — it carries no unknown top-level keys.
|
|
11
|
+
* 4. `<ns>/standalone-declaration-valid` — `standalone: false` names its packs.
|
|
12
|
+
* 5. `<ns>/recommended-packs-valid` — recommended packs are bare FQNs.
|
|
13
|
+
*
|
|
14
|
+
* Rules 1, 4, and 5 already had factories; rules 2 and 3 were hand-copied per
|
|
15
|
+
* type. This module composes all five so a new extension type's envelope is
|
|
16
|
+
* one call, and so the publish-safe barrel (`lint/publish.ts`) and the
|
|
17
|
+
* `axm lint` catalog (`catalog/<type>.ts`) build from the same definitions.
|
|
18
|
+
*
|
|
19
|
+
* The factory is deliberately free of `registerLintRuleIds` — that module-load
|
|
20
|
+
* side effect stays in `catalog/<type>.ts`, because it imports the workspace
|
|
21
|
+
* lint config schema that `lint/publish.ts` exists to keep out of the registry
|
|
22
|
+
* Worker bundle.
|
|
23
|
+
*
|
|
24
|
+
* @experimental This API is unstable and may change without notice.
|
|
25
|
+
* @packageDocumentation
|
|
26
|
+
*/
|
|
27
|
+
import * as Effect from "effect/Effect";
|
|
28
|
+
import { makeManifestPresentRule } from "./manifest-present.js";
|
|
29
|
+
import { makeRecommendedPacksValidRule, makeStandaloneDeclarationValidRule, } from "./recommended-packs-rules.js";
|
|
30
|
+
import { enumerateUnknownTopLevelKeys, schemaDecodeFindings, structFieldKeys, } from "./schema-rule.js";
|
|
31
|
+
/**
|
|
32
|
+
* Build one catalog's five manifest envelope rules.
|
|
33
|
+
*
|
|
34
|
+
* The context only has to expose a `files` accessor with `exists`; the
|
|
35
|
+
* manifest value itself is read through `options.manifestJson`, so the factory
|
|
36
|
+
* never assumes a subject field name.
|
|
37
|
+
*
|
|
38
|
+
* @experimental This API is unstable and may change without notice.
|
|
39
|
+
*/
|
|
40
|
+
export const makeManifestEnvelopeRules = (options) => {
|
|
41
|
+
const schemaValidRuleId = `${options.namespace}/manifest-schema-valid`;
|
|
42
|
+
const keysRecognizedRuleId = `${options.namespace}/manifest-keys-recognized`;
|
|
43
|
+
const allowedKeys = structFieldKeys(options.schema);
|
|
44
|
+
return {
|
|
45
|
+
manifestPresent: makeManifestPresentRule({
|
|
46
|
+
ruleId: `${options.namespace}/manifest-present`,
|
|
47
|
+
description: options.presentDescription,
|
|
48
|
+
manifestFile: options.manifestFile,
|
|
49
|
+
missingMessage: options.presentMissingMessage,
|
|
50
|
+
}),
|
|
51
|
+
manifestSchemaValid: {
|
|
52
|
+
id: schemaValidRuleId,
|
|
53
|
+
description: options.schemaDescription,
|
|
54
|
+
kind: "advisory",
|
|
55
|
+
severity: "error",
|
|
56
|
+
check: (context) => schemaDecodeFindings(schemaValidRuleId, "error", options.manifestFile, options.schema, options.manifestJson(context)),
|
|
57
|
+
},
|
|
58
|
+
manifestKeysRecognized: {
|
|
59
|
+
id: keysRecognizedRuleId,
|
|
60
|
+
description: `${options.manifestFile} uses only supported top-level fields.`,
|
|
61
|
+
kind: "advisory",
|
|
62
|
+
severity: "error",
|
|
63
|
+
check: (context) => Effect.succeed(enumerateUnknownTopLevelKeys(keysRecognizedRuleId, "error", options.manifestFile, allowedKeys, options.manifestJson(context))),
|
|
64
|
+
},
|
|
65
|
+
standaloneDeclarationValid: makeStandaloneDeclarationValidRule({
|
|
66
|
+
namespace: options.namespace,
|
|
67
|
+
manifestFile: options.manifestFile,
|
|
68
|
+
manifestJson: options.manifestJson,
|
|
69
|
+
}),
|
|
70
|
+
recommendedPacksValid: makeRecommendedPacksValidRule({
|
|
71
|
+
namespace: options.namespace,
|
|
72
|
+
manifestFile: options.manifestFile,
|
|
73
|
+
manifestJson: options.manifestJson,
|
|
74
|
+
}),
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* The envelope rules in canonical catalog order.
|
|
79
|
+
*
|
|
80
|
+
* @experimental This API is unstable and may change without notice.
|
|
81
|
+
*/
|
|
82
|
+
export const orderedEnvelopeRules = (rules) => [
|
|
83
|
+
rules.manifestPresent,
|
|
84
|
+
rules.manifestSchemaValid,
|
|
85
|
+
rules.manifestKeysRecognized,
|
|
86
|
+
rules.standaloneDeclarationValid,
|
|
87
|
+
rules.recommendedPacksValid,
|
|
88
|
+
];
|
|
89
|
+
//# sourceMappingURL=envelope-rules.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared loose-manifest JSON helpers.
|
|
3
|
+
*
|
|
4
|
+
* Workspace lint parses installed manifests before per-extension rules run.
|
|
5
|
+
* The parsed value must stay raw JSON, not a schema-decoded manifest, so
|
|
6
|
+
* `*-keys-recognized` rules can still see excess top-level fields.
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
*/
|
|
10
|
+
import type { AdvisoryFinding, Severity } from "../../rule.js";
|
|
11
|
+
export interface ManifestJsonParseFailure {
|
|
12
|
+
readonly _tag: "ManifestJsonParseFailure";
|
|
13
|
+
readonly file: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const makeManifestJsonParseFailure: (file: string) => ManifestJsonParseFailure;
|
|
16
|
+
export declare const isManifestJsonParseFailure: (value: unknown) => value is ManifestJsonParseFailure;
|
|
17
|
+
export declare const manifestJsonParseFailureToFinding: (ruleId: string, severity: Severity, file: string, input: ManifestJsonParseFailure) => AdvisoryFinding;
|
|
18
|
+
//# sourceMappingURL=manifest-json.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared loose-manifest JSON helpers.
|
|
3
|
+
*
|
|
4
|
+
* Workspace lint parses installed manifests before per-extension rules run.
|
|
5
|
+
* The parsed value must stay raw JSON, not a schema-decoded manifest, so
|
|
6
|
+
* `*-keys-recognized` rules can still see excess top-level fields.
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
*/
|
|
10
|
+
import { describeSchemaDocument } from "../../describe-document.js";
|
|
11
|
+
export const makeManifestJsonParseFailure = (file) => ({
|
|
12
|
+
_tag: "ManifestJsonParseFailure",
|
|
13
|
+
file,
|
|
14
|
+
});
|
|
15
|
+
export const isManifestJsonParseFailure = (value) => {
|
|
16
|
+
if (value === null || typeof value !== "object") {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return "_tag" in value && value._tag === "ManifestJsonParseFailure";
|
|
20
|
+
};
|
|
21
|
+
export const manifestJsonParseFailureToFinding = (ruleId, severity, file, input) => ({
|
|
22
|
+
kind: "advisory",
|
|
23
|
+
ruleId,
|
|
24
|
+
severity,
|
|
25
|
+
message: `${describeSchemaDocument(file)} contains invalid JSON. Edit \`${input.file}\` and fix the JSON syntax.`,
|
|
26
|
+
location: { file },
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=manifest-json.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared factory for `manifest-present` advisory rules.
|
|
3
|
+
*
|
|
4
|
+
* @experimental This API is unstable and may change without notice.
|
|
5
|
+
*/
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
import type { AdvisoryRule, Severity } from "../../rule.js";
|
|
8
|
+
interface ManifestFileAccessor {
|
|
9
|
+
readonly exists: (path: string) => Effect.Effect<boolean>;
|
|
10
|
+
}
|
|
11
|
+
interface ManifestPresentRuleContext {
|
|
12
|
+
readonly files: ManifestFileAccessor;
|
|
13
|
+
}
|
|
14
|
+
interface ManifestPresentRuleArgs<C> {
|
|
15
|
+
readonly ruleId: string;
|
|
16
|
+
readonly description: string;
|
|
17
|
+
readonly manifestFile: string;
|
|
18
|
+
readonly missingMessage: string;
|
|
19
|
+
readonly severity?: Severity;
|
|
20
|
+
readonly getFiles?: (context: C) => ManifestFileAccessor;
|
|
21
|
+
readonly applies?: (context: C) => boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const makeManifestPresentRule: <C extends ManifestPresentRuleContext>(args: ManifestPresentRuleArgs<C>) => AdvisoryRule<C>;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=manifest-present.d.ts.map
|