@mostra/protocol 0.14.0 → 0.15.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/dist/artifact-path.d.ts +22 -0
- package/dist/artifact-path.d.ts.map +1 -0
- package/dist/artifact-path.js +39 -0
- package/dist/artifact-path.js.map +1 -0
- package/dist/diagnostics/codes/index.d.ts +5 -2
- package/dist/diagnostics/codes/index.d.ts.map +1 -1
- package/dist/diagnostics/codes/index.js +7 -1
- package/dist/diagnostics/codes/index.js.map +1 -1
- package/dist/diagnostics/codes/license.d.ts +8 -0
- package/dist/diagnostics/codes/license.d.ts.map +1 -0
- package/dist/diagnostics/codes/license.js +55 -0
- package/dist/diagnostics/codes/license.js.map +1 -0
- package/dist/diagnostics/codes/pack.d.ts +8 -0
- package/dist/diagnostics/codes/pack.d.ts.map +1 -0
- package/dist/diagnostics/codes/pack.js +110 -0
- package/dist/diagnostics/codes/pack.js.map +1 -0
- package/dist/diagnostics/codes/plugin.d.ts +8 -0
- package/dist/diagnostics/codes/plugin.d.ts.map +1 -0
- package/dist/diagnostics/codes/plugin.js +154 -0
- package/dist/diagnostics/codes/plugin.js.map +1 -0
- package/dist/diagnostics/diagnostic.d.ts +1 -1
- package/dist/diagnostics/diagnostic.d.ts.map +1 -1
- package/dist/diagnostics/diagnostic.js +4 -1
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +13 -1
- package/dist/methods/deps/add.d.ts +6 -0
- package/dist/methods/deps/add.d.ts.map +1 -1
- package/dist/methods/deps/add.js +1 -0
- package/dist/methods/deps/add.js.map +1 -1
- package/dist/methods/index.d.ts.map +1 -1
- package/dist/methods/index.js +15 -1
- package/dist/methods/index.js.map +1 -1
- package/dist/methods/mostra/initialize.d.ts +7 -0
- package/dist/methods/mostra/initialize.d.ts.map +1 -1
- package/dist/methods/mostra/initialize.js +4 -2
- package/dist/methods/mostra/initialize.js.map +1 -1
- package/dist/methods/pack/add.d.ts +80 -0
- package/dist/methods/pack/add.d.ts.map +1 -0
- package/dist/methods/pack/add.js +59 -0
- package/dist/methods/pack/add.js.map +1 -0
- package/dist/methods/plugin/add.d.ts +43 -0
- package/dist/methods/plugin/add.d.ts.map +1 -0
- package/dist/methods/plugin/add.js +39 -0
- package/dist/methods/plugin/add.js.map +1 -0
- package/dist/methods/plugin/commands.d.ts +38 -0
- package/dist/methods/plugin/commands.d.ts.map +1 -0
- package/dist/methods/plugin/commands.js +33 -0
- package/dist/methods/plugin/commands.js.map +1 -0
- package/dist/methods/plugin/export.d.ts +58 -0
- package/dist/methods/plugin/export.d.ts.map +1 -0
- package/dist/methods/plugin/export.js +57 -0
- package/dist/methods/plugin/export.js.map +1 -0
- package/dist/methods/plugin/list.d.ts +26 -0
- package/dist/methods/plugin/list.d.ts.map +1 -0
- package/dist/methods/plugin/list.js +30 -0
- package/dist/methods/plugin/list.js.map +1 -0
- package/dist/methods/plugin/remove.d.ts +32 -0
- package/dist/methods/plugin/remove.d.ts.map +1 -0
- package/dist/methods/plugin/remove.js +33 -0
- package/dist/methods/plugin/remove.js.map +1 -0
- package/dist/methods/plugin/validate.d.ts +35 -0
- package/dist/methods/plugin/validate.d.ts.map +1 -0
- package/dist/methods/plugin/validate.js +33 -0
- package/dist/methods/plugin/validate.js.map +1 -0
- package/dist/plugin/contract-versions.generated.js +14 -0
- package/dist/plugin/contract-versions.generated.js.map +1 -0
- package/dist/plugin/contracts.d.ts +51 -0
- package/dist/plugin/contracts.d.ts.map +1 -0
- package/dist/plugin/contracts.js +129 -0
- package/dist/plugin/contracts.js.map +1 -0
- package/dist/plugin/license.d.ts +87 -0
- package/dist/plugin/license.d.ts.map +1 -0
- package/dist/plugin/license.js +243 -0
- package/dist/plugin/license.js.map +1 -0
- package/dist/plugin/manifest.d.ts +141 -0
- package/dist/plugin/manifest.d.ts.map +1 -0
- package/dist/plugin/manifest.js +281 -0
- package/dist/plugin/manifest.js.map +1 -0
- package/dist/plugin/registry-item.d.ts +171 -0
- package/dist/plugin/registry-item.d.ts.map +1 -0
- package/dist/plugin/registry-item.js +162 -0
- package/dist/plugin/registry-item.js.map +1 -0
- package/dist/plugin/spdx.generated.d.ts +9 -0
- package/dist/plugin/spdx.generated.d.ts.map +1 -0
- package/dist/plugin/spdx.generated.js +846 -0
- package/dist/plugin/spdx.generated.js.map +1 -0
- package/dist/plugin.d.ts +7 -0
- package/dist/plugin.js +6 -0
- package/dist/plugins.d.ts +118 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/plugins.js +109 -0
- package/dist/plugins.js.map +1 -0
- package/package.json +19 -4
- package/schemas/plugin-manifest.draft-07.json +611 -0
- package/schemas/plugin-manifest.schema.json +607 -0
- package/schemas/protocol.draft-07.json +899 -1
- package/schemas/protocol.schema.json +875 -1
- package/src/artifact-path.ts +46 -0
- package/src/diagnostics/codes/index.ts +14 -2
- package/src/diagnostics/codes/license.ts +65 -0
- package/src/diagnostics/codes/pack.ts +125 -0
- package/src/diagnostics/codes/plugin.ts +173 -0
- package/src/diagnostics/diagnostic.ts +7 -1
- package/src/index.ts +57 -0
- package/src/methods/deps/add.ts +7 -0
- package/src/methods/index.ts +14 -0
- package/src/methods/mostra/initialize.ts +9 -1
- package/src/methods/pack/add.ts +133 -0
- package/src/methods/plugin/add.ts +70 -0
- package/src/methods/plugin/commands.ts +67 -0
- package/src/methods/plugin/export.ts +100 -0
- package/src/methods/plugin/list.ts +45 -0
- package/src/methods/plugin/remove.ts +58 -0
- package/src/methods/plugin/validate.ts +60 -0
- package/src/plugin/contract-versions.generated.ts +15 -0
- package/src/plugin/contracts.ts +171 -0
- package/src/plugin/license.ts +320 -0
- package/src/plugin/manifest.ts +546 -0
- package/src/plugin/registry-item.ts +330 -0
- package/src/plugin/spdx-tables.ts +74 -0
- package/src/plugin/spdx.generated.ts +844 -0
- package/src/plugin.ts +77 -0
- package/src/plugins.ts +239 -0
- package/LICENSE +0 -202
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/artifact-path.d.ts
|
|
2
|
+
/** What {@link checkArtifactPath} found. */
|
|
3
|
+
export type ArtifactPathCheck = {
|
|
4
|
+
readonly ok: true;
|
|
5
|
+
readonly path: string;
|
|
6
|
+
} | {
|
|
7
|
+
readonly ok: false;
|
|
8
|
+
readonly reason: "outside";
|
|
9
|
+
} | {
|
|
10
|
+
readonly ok: false;
|
|
11
|
+
readonly reason: "unportable";
|
|
12
|
+
readonly segment: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Checks a path inside an artifact and spells it with `/`. `outside`: empty, absolute, a drive, a
|
|
16
|
+
* control character, or an empty, `.` or `..` segment. `unportable`: a segment with one of
|
|
17
|
+
* Windows' reserved characters, a Windows device name, or a dot or space at its end, which
|
|
18
|
+
* Windows strips (`index.tsx.` would be `index.tsx`).
|
|
19
|
+
*/
|
|
20
|
+
export declare function checkArtifactPath(path: string): ArtifactPathCheck;
|
|
21
|
+
//#endregion
|
|
22
|
+
//# sourceMappingURL=artifact-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-path.d.ts","names":[],"sources":["../src/artifact-path.ts"],"mappings":";;YAiBY;WACG;WAAmB;;WACnB;WAAoB;;WACpB;WAAoB;WAA+B;;;;;;;;wBAQlD,kBAAkB,eAAe"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region src/artifact-path.ts
|
|
2
|
+
/**
|
|
3
|
+
* A file's path inside an artifact, as every writer of an artifact's files checks it (the MCP
|
|
4
|
+
* server's workspace, D164; source packs, WP-16): relative, `/`-separated, no `.` or `..` segment,
|
|
5
|
+
* no empty segment, no drive or control character, and only names every system can hold, so an
|
|
6
|
+
* artifact written on one system moves to another whole.
|
|
7
|
+
*/
|
|
8
|
+
const CONTROL = /[\u0000-\u001f\u007f]/;
|
|
9
|
+
/** Characters Windows refuses in a name (`:` would also name an NTFS stream). */
|
|
10
|
+
const UNPORTABLE = /[<>:"|?*]/;
|
|
11
|
+
/** Windows' device names, with any extension (`nul.tsx` is the device too), any case. */
|
|
12
|
+
const DEVICE = /^(con|prn|aux|nul|com[0-9¹²³]|lpt[0-9¹²³])(\..*)?$/i;
|
|
13
|
+
/**
|
|
14
|
+
* Checks a path inside an artifact and spells it with `/`. `outside`: empty, absolute, a drive, a
|
|
15
|
+
* control character, or an empty, `.` or `..` segment. `unportable`: a segment with one of
|
|
16
|
+
* Windows' reserved characters, a Windows device name, or a dot or space at its end, which
|
|
17
|
+
* Windows strips (`index.tsx.` would be `index.tsx`).
|
|
18
|
+
*/
|
|
19
|
+
function checkArtifactPath(path) {
|
|
20
|
+
const segments = path.split(/[\\/]/);
|
|
21
|
+
if (path === "" || path.startsWith("/") || path.startsWith("\\") || /^[A-Za-z]:/.test(path) || CONTROL.test(path) || segments.some((segment) => segment === "" || segment === "." || segment === "..")) return {
|
|
22
|
+
ok: false,
|
|
23
|
+
reason: "outside"
|
|
24
|
+
};
|
|
25
|
+
const segment = segments.find((part) => UNPORTABLE.test(part) || DEVICE.test(part) || /[. ]$/.test(part));
|
|
26
|
+
if (segment !== void 0) return {
|
|
27
|
+
ok: false,
|
|
28
|
+
reason: "unportable",
|
|
29
|
+
segment
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
ok: true,
|
|
33
|
+
path: segments.join("/")
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { checkArtifactPath };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=artifact-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-path.js","names":[],"sources":["../src/artifact-path.ts"],"sourcesContent":["/**\n * A file's path inside an artifact, as every writer of an artifact's files checks it (the MCP\n * server's workspace, D164; source packs, WP-16): relative, `/`-separated, no `.` or `..` segment,\n * no empty segment, no drive or control character, and only names every system can hold, so an\n * artifact written on one system moves to another whole.\n */\n\n// biome-ignore lint/suspicious/noControlCharactersInRegex: control characters are what it refuses.\nconst CONTROL = /[\\u0000-\\u001f\\u007f]/;\n\n/** Characters Windows refuses in a name (`:` would also name an NTFS stream). */\nconst UNPORTABLE = /[<>:\"|?*]/;\n\n/** Windows' device names, with any extension (`nul.tsx` is the device too), any case. */\nconst DEVICE = /^(con|prn|aux|nul|com[0-9¹²³]|lpt[0-9¹²³])(\\..*)?$/i;\n\n/** What {@link checkArtifactPath} found. */\nexport type ArtifactPathCheck =\n | { readonly ok: true; readonly path: string }\n | { readonly ok: false; readonly reason: \"outside\" }\n | { readonly ok: false; readonly reason: \"unportable\"; readonly segment: string };\n\n/**\n * Checks a path inside an artifact and spells it with `/`. `outside`: empty, absolute, a drive, a\n * control character, or an empty, `.` or `..` segment. `unportable`: a segment with one of\n * Windows' reserved characters, a Windows device name, or a dot or space at its end, which\n * Windows strips (`index.tsx.` would be `index.tsx`).\n */\nexport function checkArtifactPath(path: string): ArtifactPathCheck {\n const segments = path.split(/[\\\\/]/);\n if (\n path === \"\" ||\n path.startsWith(\"/\") ||\n path.startsWith(\"\\\\\") ||\n /^[A-Za-z]:/.test(path) ||\n CONTROL.test(path) ||\n segments.some((segment) => segment === \"\" || segment === \".\" || segment === \"..\")\n ) {\n return { ok: false, reason: \"outside\" };\n }\n const segment = segments.find(\n (part) => UNPORTABLE.test(part) || DEVICE.test(part) || /[. ]$/.test(part),\n );\n if (segment !== undefined) return { ok: false, reason: \"unportable\", segment };\n return { ok: true, path: segments.join(\"/\") };\n}\n"],"mappings":";;;;;;;AAQA,MAAM,UAAU;;AAGhB,MAAM,aAAa;;AAGnB,MAAM,SAAS;;;;;;;AAcf,SAAgB,kBAAkB,MAAiC;CACjE,MAAM,WAAW,KAAK,MAAM,OAAO;CACnC,IACE,SAAS,MACT,KAAK,WAAW,GAAG,KACnB,KAAK,WAAW,IAAI,KACpB,aAAa,KAAK,IAAI,KACtB,QAAQ,KAAK,IAAI,KACjB,SAAS,MAAM,YAAY,YAAY,MAAM,YAAY,OAAO,YAAY,IAAI,GAEhF,OAAO;EAAE,IAAI;EAAO,QAAQ;CAAU;CAExC,MAAM,UAAU,SAAS,MACtB,SAAS,WAAW,KAAK,IAAI,KAAK,OAAO,KAAK,IAAI,KAAK,QAAQ,KAAK,IAAI,CAC3E;CACA,IAAI,YAAY,KAAA,GAAW,OAAO;EAAE,IAAI;EAAO,QAAQ;EAAc;CAAQ;CAC7E,OAAO;EAAE,IAAI;EAAM,MAAM,SAAS,KAAK,GAAG;CAAE;AAC9C"}
|
|
@@ -12,10 +12,13 @@ import { FieldDiagnosticCode, fieldDiagnosticCodes } from "./field.js";
|
|
|
12
12
|
import { HomeDiagnosticCode, homeDiagnosticCodes } from "./home.js";
|
|
13
13
|
import { HostDiagnosticCode, hostDiagnosticCodes } from "./host.js";
|
|
14
14
|
import { HygieneDiagnosticCode, hygieneDiagnosticCodes } from "./hygiene.js";
|
|
15
|
+
import { LicenseDiagnosticCode, licenseDiagnosticCodes } from "./license.js";
|
|
15
16
|
import { LiveDiagnosticCode, liveDiagnosticCodes } from "./live.js";
|
|
16
17
|
import { ManifestDiagnosticCode, manifestDiagnosticCodes } from "./manifest.js";
|
|
17
18
|
import { NetworkDiagnosticCode, networkDiagnosticCodes } from "./network.js";
|
|
19
|
+
import { PackDiagnosticCode, packDiagnosticCodes } from "./pack.js";
|
|
18
20
|
import { PlatformDiagnosticCode, platformDiagnosticCodes } from "./platform.js";
|
|
21
|
+
import { PluginDiagnosticCode, pluginDiagnosticCodes } from "./plugin.js";
|
|
19
22
|
import { PublishDiagnosticCode, publishDiagnosticCodes } from "./publish.js";
|
|
20
23
|
import { RegressionDiagnosticCode, regressionDiagnosticCodes } from "./regression.js";
|
|
21
24
|
import { RemoteDiagnosticCode, remoteDiagnosticCodes } from "./remote.js";
|
|
@@ -30,7 +33,7 @@ import { TypeDiagnosticCode, typeDiagnosticCodes } from "./type.js";
|
|
|
30
33
|
import { VerifyDiagnosticCode, verifyDiagnosticCodes } from "./verify.js";
|
|
31
34
|
//#region src/diagnostics/codes/index.d.ts
|
|
32
35
|
/** Every code in the catalog. Codes are semver surface and are never removed (AX-03). */
|
|
33
|
-
export type KnownDiagnosticCode = TeamDiagnosticCode | RemoteDiagnosticCode | ShareDiagnosticCode | CliDiagnosticCode | RegressionDiagnosticCode | SmokeDiagnosticCode | A11yDiagnosticCode | NetworkDiagnosticCode | ConsoleDiagnosticCode | TypeDiagnosticCode | VerifyDiagnosticCode | LiveDiagnosticCode | SecretDiagnosticCode | RuntimeDiagnosticCode | FieldDiagnosticCode | SubmitDiagnosticCode | HygieneDiagnosticCode | DepDiagnosticCode | EnvDiagnosticCode | TargetDiagnosticCode | ArtifactDiagnosticCode | PublishDiagnosticCode | ActionDiagnosticCode | BuildDiagnosticCode | ManifestDiagnosticCode | HomeDiagnosticCode | PlatformDiagnosticCode | HostDiagnosticCode;
|
|
36
|
+
export type KnownDiagnosticCode = LicenseDiagnosticCode | PackDiagnosticCode | PluginDiagnosticCode | TeamDiagnosticCode | RemoteDiagnosticCode | ShareDiagnosticCode | CliDiagnosticCode | RegressionDiagnosticCode | SmokeDiagnosticCode | A11yDiagnosticCode | NetworkDiagnosticCode | ConsoleDiagnosticCode | TypeDiagnosticCode | VerifyDiagnosticCode | LiveDiagnosticCode | SecretDiagnosticCode | RuntimeDiagnosticCode | FieldDiagnosticCode | SubmitDiagnosticCode | HygieneDiagnosticCode | DepDiagnosticCode | EnvDiagnosticCode | TargetDiagnosticCode | ArtifactDiagnosticCode | PublishDiagnosticCode | ActionDiagnosticCode | BuildDiagnosticCode | ManifestDiagnosticCode | HomeDiagnosticCode | PlatformDiagnosticCode | HostDiagnosticCode;
|
|
34
37
|
/** Every cataloged code with its severity, phase, title, default hint and docs text. */
|
|
35
38
|
export declare const diagnosticCatalog: Readonly<Record<KnownDiagnosticCode, DiagnosticSpec>>;
|
|
36
39
|
/** Options for {@link createDiagnostic}. */
|
|
@@ -50,5 +53,5 @@ export interface CreateDiagnosticOptions {
|
|
|
50
53
|
*/
|
|
51
54
|
export declare function createDiagnostic(code: KnownDiagnosticCode, details: DiagnosticDetails, options?: CreateDiagnosticOptions): Diagnostic;
|
|
52
55
|
//#endregion
|
|
53
|
-
export { type A11yDiagnosticCode, type ActionDiagnosticCode, type ArtifactDiagnosticCode, type BuildDiagnosticCode, type CliDiagnosticCode, type ConsoleDiagnosticCode, type DepDiagnosticCode, type EnvDiagnosticCode, type FieldDiagnosticCode, type HomeDiagnosticCode, type HostDiagnosticCode, type HygieneDiagnosticCode, type LiveDiagnosticCode, type ManifestDiagnosticCode, type NetworkDiagnosticCode, type PlatformDiagnosticCode, type PublishDiagnosticCode, type RegressionDiagnosticCode, type RemoteDiagnosticCode, type RuntimeDiagnosticCode, type SecretDiagnosticCode, type ShareDiagnosticCode, type SmokeDiagnosticCode, type SubmitDiagnosticCode, type TargetDiagnosticCode, type TeamDiagnosticCode, type TypeDiagnosticCode, type VerifyDiagnosticCode, a11yDiagnosticCodes, actionDiagnosticCodes, artifactDiagnosticCodes, buildDiagnosticCodes, cliDiagnosticCodes, consoleDiagnosticCodes, depDiagnosticCodes, envDiagnosticCodes, fieldDiagnosticCodes, homeDiagnosticCodes, hostDiagnosticCodes, hygieneDiagnosticCodes, liveDiagnosticCodes, manifestDiagnosticCodes, networkDiagnosticCodes, platformDiagnosticCodes, publishDiagnosticCodes, regressionDiagnosticCodes, remoteDiagnosticCodes, runtimeDiagnosticCodes, secretDiagnosticCodes, shareDiagnosticCodes, smokeDiagnosticCodes, submitDiagnosticCodes, targetDiagnosticCodes, teamDiagnosticCodes, typeDiagnosticCodes, verifyDiagnosticCodes };
|
|
56
|
+
export { type A11yDiagnosticCode, type ActionDiagnosticCode, type ArtifactDiagnosticCode, type BuildDiagnosticCode, type CliDiagnosticCode, type ConsoleDiagnosticCode, type DepDiagnosticCode, type EnvDiagnosticCode, type FieldDiagnosticCode, type HomeDiagnosticCode, type HostDiagnosticCode, type HygieneDiagnosticCode, type LicenseDiagnosticCode, type LiveDiagnosticCode, type ManifestDiagnosticCode, type NetworkDiagnosticCode, type PackDiagnosticCode, type PlatformDiagnosticCode, type PluginDiagnosticCode, type PublishDiagnosticCode, type RegressionDiagnosticCode, type RemoteDiagnosticCode, type RuntimeDiagnosticCode, type SecretDiagnosticCode, type ShareDiagnosticCode, type SmokeDiagnosticCode, type SubmitDiagnosticCode, type TargetDiagnosticCode, type TeamDiagnosticCode, type TypeDiagnosticCode, type VerifyDiagnosticCode, a11yDiagnosticCodes, actionDiagnosticCodes, artifactDiagnosticCodes, buildDiagnosticCodes, cliDiagnosticCodes, consoleDiagnosticCodes, depDiagnosticCodes, envDiagnosticCodes, fieldDiagnosticCodes, homeDiagnosticCodes, hostDiagnosticCodes, hygieneDiagnosticCodes, licenseDiagnosticCodes, liveDiagnosticCodes, manifestDiagnosticCodes, networkDiagnosticCodes, packDiagnosticCodes, platformDiagnosticCodes, pluginDiagnosticCodes, publishDiagnosticCodes, regressionDiagnosticCodes, remoteDiagnosticCodes, runtimeDiagnosticCodes, secretDiagnosticCodes, shareDiagnosticCodes, smokeDiagnosticCodes, submitDiagnosticCodes, targetDiagnosticCodes, teamDiagnosticCodes, typeDiagnosticCodes, verifyDiagnosticCodes };
|
|
54
57
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/diagnostics/codes/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/diagnostics/codes/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAyEY,sBAER,wBACA,qBACA,uBACA,qBACA,uBACA,sBACA,oBACA,2BACA,sBACA,qBACA,wBACA,wBACA,qBACA,uBACA,qBACA,uBACA,wBACA,sBACA,uBACA,wBACA,oBACA,oBACA,uBACA,yBACA,wBACA,uBACA,sBACA,yBACA,qBACA,yBACA;;qBAGS,mBAAmB,SAAS,OAAO,qBAAqB;;iBAoCpD;;WAEN;;;;;;;;;;;;wBAaK,iBACd,MAAM,qBACN,SAAS,mBACT,UAAS,0BACR"}
|
|
@@ -11,10 +11,13 @@ import { fieldDiagnosticCodes, fieldDiagnostics } from "./field.js";
|
|
|
11
11
|
import { homeDiagnosticCodes, homeDiagnostics } from "./home.js";
|
|
12
12
|
import { hostDiagnosticCodes, hostDiagnostics } from "./host.js";
|
|
13
13
|
import { hygieneDiagnosticCodes, hygieneDiagnostics } from "./hygiene.js";
|
|
14
|
+
import { licenseDiagnosticCodes, licenseDiagnostics } from "./license.js";
|
|
14
15
|
import { liveDiagnosticCodes, liveDiagnostics } from "./live.js";
|
|
15
16
|
import { manifestDiagnosticCodes, manifestDiagnostics } from "./manifest.js";
|
|
16
17
|
import { networkDiagnosticCodes, networkDiagnostics } from "./network.js";
|
|
18
|
+
import { packDiagnosticCodes, packDiagnostics } from "./pack.js";
|
|
17
19
|
import { platformDiagnosticCodes, platformDiagnostics } from "./platform.js";
|
|
20
|
+
import { pluginDiagnosticCodes, pluginDiagnostics } from "./plugin.js";
|
|
18
21
|
import { publishDiagnosticCodes, publishDiagnostics } from "./publish.js";
|
|
19
22
|
import { regressionDiagnosticCodes, regressionDiagnostics } from "./regression.js";
|
|
20
23
|
import { remoteDiagnosticCodes, remoteDiagnostics } from "./remote.js";
|
|
@@ -30,6 +33,9 @@ import { verifyDiagnosticCodes, verifyDiagnostics } from "./verify.js";
|
|
|
30
33
|
//#region src/diagnostics/codes/index.ts
|
|
31
34
|
/** Every cataloged code with its severity, phase, title, default hint and docs text. */
|
|
32
35
|
const diagnosticCatalog = {
|
|
36
|
+
...licenseDiagnostics,
|
|
37
|
+
...packDiagnostics,
|
|
38
|
+
...pluginDiagnostics,
|
|
33
39
|
...teamDiagnostics,
|
|
34
40
|
...remoteDiagnostics,
|
|
35
41
|
...shareDiagnostics,
|
|
@@ -73,6 +79,6 @@ function createDiagnostic(code, details, options = {}) {
|
|
|
73
79
|
return buildDiagnostic(code, diagnosticCatalog[code], details, options.docsBase);
|
|
74
80
|
}
|
|
75
81
|
//#endregion
|
|
76
|
-
export { a11yDiagnosticCodes, actionDiagnosticCodes, artifactDiagnosticCodes, buildDiagnosticCodes, cliDiagnosticCodes, consoleDiagnosticCodes, createDiagnostic, depDiagnosticCodes, diagnosticCatalog, envDiagnosticCodes, fieldDiagnosticCodes, homeDiagnosticCodes, hostDiagnosticCodes, hygieneDiagnosticCodes, liveDiagnosticCodes, manifestDiagnosticCodes, networkDiagnosticCodes, platformDiagnosticCodes, publishDiagnosticCodes, regressionDiagnosticCodes, remoteDiagnosticCodes, runtimeDiagnosticCodes, secretDiagnosticCodes, shareDiagnosticCodes, smokeDiagnosticCodes, submitDiagnosticCodes, targetDiagnosticCodes, teamDiagnosticCodes, typeDiagnosticCodes, verifyDiagnosticCodes };
|
|
82
|
+
export { a11yDiagnosticCodes, actionDiagnosticCodes, artifactDiagnosticCodes, buildDiagnosticCodes, cliDiagnosticCodes, consoleDiagnosticCodes, createDiagnostic, depDiagnosticCodes, diagnosticCatalog, envDiagnosticCodes, fieldDiagnosticCodes, homeDiagnosticCodes, hostDiagnosticCodes, hygieneDiagnosticCodes, licenseDiagnosticCodes, liveDiagnosticCodes, manifestDiagnosticCodes, networkDiagnosticCodes, packDiagnosticCodes, platformDiagnosticCodes, pluginDiagnosticCodes, publishDiagnosticCodes, regressionDiagnosticCodes, remoteDiagnosticCodes, runtimeDiagnosticCodes, secretDiagnosticCodes, shareDiagnosticCodes, smokeDiagnosticCodes, submitDiagnosticCodes, targetDiagnosticCodes, teamDiagnosticCodes, typeDiagnosticCodes, verifyDiagnosticCodes };
|
|
77
83
|
|
|
78
84
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/diagnostics/codes/index.ts"],"sourcesContent":["/**\n * The diagnostic catalog, assembled from one source file per area. `pnpm gen diagnostic` keeps\n * the lists below in step with the area files; edit the area files, not these lists.\n */\nimport type { Diagnostic } from \"../diagnostic.ts\";\nimport { buildDiagnostic, type DiagnosticDetails, type DiagnosticSpec } from \"../spec.ts\";\nimport { type A11yDiagnosticCode, a11yDiagnostics } from \"./a11y.ts\";\nimport { type ActionDiagnosticCode, actionDiagnostics } from \"./action.ts\";\nimport { type ArtifactDiagnosticCode, artifactDiagnostics } from \"./artifact.ts\";\nimport { type BuildDiagnosticCode, buildDiagnostics } from \"./build.ts\";\nimport { type CliDiagnosticCode, cliDiagnostics } from \"./cli.ts\";\nimport { type ConsoleDiagnosticCode, consoleDiagnostics } from \"./console.ts\";\nimport { type DepDiagnosticCode, depDiagnostics } from \"./dep.ts\";\nimport { type EnvDiagnosticCode, envDiagnostics } from \"./env.ts\";\nimport { type FieldDiagnosticCode, fieldDiagnostics } from \"./field.ts\";\nimport { type HomeDiagnosticCode, homeDiagnostics } from \"./home.ts\";\nimport { type HostDiagnosticCode, hostDiagnostics } from \"./host.ts\";\nimport { type HygieneDiagnosticCode, hygieneDiagnostics } from \"./hygiene.ts\";\nimport { type LiveDiagnosticCode, liveDiagnostics } from \"./live.ts\";\nimport { type ManifestDiagnosticCode, manifestDiagnostics } from \"./manifest.ts\";\nimport { type NetworkDiagnosticCode, networkDiagnostics } from \"./network.ts\";\nimport { type PlatformDiagnosticCode, platformDiagnostics } from \"./platform.ts\";\nimport { type PublishDiagnosticCode, publishDiagnostics } from \"./publish.ts\";\nimport { type RegressionDiagnosticCode, regressionDiagnostics } from \"./regression.ts\";\nimport { type RemoteDiagnosticCode, remoteDiagnostics } from \"./remote.ts\";\nimport { type RuntimeDiagnosticCode, runtimeDiagnostics } from \"./runtime.ts\";\nimport { type SecretDiagnosticCode, secretDiagnostics } from \"./secret.ts\";\nimport { type ShareDiagnosticCode, shareDiagnostics } from \"./share.ts\";\nimport { type SmokeDiagnosticCode, smokeDiagnostics } from \"./smoke.ts\";\nimport { type SubmitDiagnosticCode, submitDiagnostics } from \"./submit.ts\";\nimport { type TargetDiagnosticCode, targetDiagnostics } from \"./target.ts\";\
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/diagnostics/codes/index.ts"],"sourcesContent":["/**\n * The diagnostic catalog, assembled from one source file per area. `pnpm gen diagnostic` keeps\n * the lists below in step with the area files; edit the area files, not these lists.\n */\nimport type { Diagnostic } from \"../diagnostic.ts\";\nimport { buildDiagnostic, type DiagnosticDetails, type DiagnosticSpec } from \"../spec.ts\";\nimport { type A11yDiagnosticCode, a11yDiagnostics } from \"./a11y.ts\";\nimport { type ActionDiagnosticCode, actionDiagnostics } from \"./action.ts\";\nimport { type ArtifactDiagnosticCode, artifactDiagnostics } from \"./artifact.ts\";\nimport { type BuildDiagnosticCode, buildDiagnostics } from \"./build.ts\";\nimport { type CliDiagnosticCode, cliDiagnostics } from \"./cli.ts\";\nimport { type ConsoleDiagnosticCode, consoleDiagnostics } from \"./console.ts\";\nimport { type DepDiagnosticCode, depDiagnostics } from \"./dep.ts\";\nimport { type EnvDiagnosticCode, envDiagnostics } from \"./env.ts\";\nimport { type FieldDiagnosticCode, fieldDiagnostics } from \"./field.ts\";\nimport { type HomeDiagnosticCode, homeDiagnostics } from \"./home.ts\";\nimport { type HostDiagnosticCode, hostDiagnostics } from \"./host.ts\";\nimport { type HygieneDiagnosticCode, hygieneDiagnostics } from \"./hygiene.ts\";\n// gen:area-imports\nimport { type LicenseDiagnosticCode, licenseDiagnostics } from \"./license.ts\";\nimport { type LiveDiagnosticCode, liveDiagnostics } from \"./live.ts\";\nimport { type ManifestDiagnosticCode, manifestDiagnostics } from \"./manifest.ts\";\nimport { type NetworkDiagnosticCode, networkDiagnostics } from \"./network.ts\";\nimport { type PackDiagnosticCode, packDiagnostics } from \"./pack.ts\";\nimport { type PlatformDiagnosticCode, platformDiagnostics } from \"./platform.ts\";\nimport { type PluginDiagnosticCode, pluginDiagnostics } from \"./plugin.ts\";\nimport { type PublishDiagnosticCode, publishDiagnostics } from \"./publish.ts\";\nimport { type RegressionDiagnosticCode, regressionDiagnostics } from \"./regression.ts\";\nimport { type RemoteDiagnosticCode, remoteDiagnostics } from \"./remote.ts\";\nimport { type RuntimeDiagnosticCode, runtimeDiagnostics } from \"./runtime.ts\";\nimport { type SecretDiagnosticCode, secretDiagnostics } from \"./secret.ts\";\nimport { type ShareDiagnosticCode, shareDiagnostics } from \"./share.ts\";\nimport { type SmokeDiagnosticCode, smokeDiagnostics } from \"./smoke.ts\";\nimport { type SubmitDiagnosticCode, submitDiagnostics } from \"./submit.ts\";\nimport { type TargetDiagnosticCode, targetDiagnostics } from \"./target.ts\";\nimport { type TeamDiagnosticCode, teamDiagnostics } from \"./team.ts\";\nimport { type TypeDiagnosticCode, typeDiagnostics } from \"./type.ts\";\nimport { type VerifyDiagnosticCode, verifyDiagnostics } from \"./verify.ts\";\n\nexport { type A11yDiagnosticCode, a11yDiagnosticCodes } from \"./a11y.ts\";\nexport { type ActionDiagnosticCode, actionDiagnosticCodes } from \"./action.ts\";\nexport { type ArtifactDiagnosticCode, artifactDiagnosticCodes } from \"./artifact.ts\";\nexport { type BuildDiagnosticCode, buildDiagnosticCodes } from \"./build.ts\";\nexport { type CliDiagnosticCode, cliDiagnosticCodes } from \"./cli.ts\";\nexport { type ConsoleDiagnosticCode, consoleDiagnosticCodes } from \"./console.ts\";\nexport { type DepDiagnosticCode, depDiagnosticCodes } from \"./dep.ts\";\nexport { type EnvDiagnosticCode, envDiagnosticCodes } from \"./env.ts\";\nexport { type FieldDiagnosticCode, fieldDiagnosticCodes } from \"./field.ts\";\nexport { type HomeDiagnosticCode, homeDiagnosticCodes } from \"./home.ts\";\nexport { type HostDiagnosticCode, hostDiagnosticCodes } from \"./host.ts\";\nexport { type HygieneDiagnosticCode, hygieneDiagnosticCodes } from \"./hygiene.ts\";\n// gen:area-exports\nexport { type LicenseDiagnosticCode, licenseDiagnosticCodes } from \"./license.ts\";\nexport { type LiveDiagnosticCode, liveDiagnosticCodes } from \"./live.ts\";\nexport { type ManifestDiagnosticCode, manifestDiagnosticCodes } from \"./manifest.ts\";\nexport { type NetworkDiagnosticCode, networkDiagnosticCodes } from \"./network.ts\";\nexport { type PackDiagnosticCode, packDiagnosticCodes } from \"./pack.ts\";\nexport { type PlatformDiagnosticCode, platformDiagnosticCodes } from \"./platform.ts\";\nexport { type PluginDiagnosticCode, pluginDiagnosticCodes } from \"./plugin.ts\";\nexport { type PublishDiagnosticCode, publishDiagnosticCodes } from \"./publish.ts\";\nexport { type RegressionDiagnosticCode, regressionDiagnosticCodes } from \"./regression.ts\";\nexport { type RemoteDiagnosticCode, remoteDiagnosticCodes } from \"./remote.ts\";\nexport { type RuntimeDiagnosticCode, runtimeDiagnosticCodes } from \"./runtime.ts\";\nexport { type SecretDiagnosticCode, secretDiagnosticCodes } from \"./secret.ts\";\nexport { type ShareDiagnosticCode, shareDiagnosticCodes } from \"./share.ts\";\nexport { type SmokeDiagnosticCode, smokeDiagnosticCodes } from \"./smoke.ts\";\nexport { type SubmitDiagnosticCode, submitDiagnosticCodes } from \"./submit.ts\";\nexport { type TargetDiagnosticCode, targetDiagnosticCodes } from \"./target.ts\";\nexport { type TeamDiagnosticCode, teamDiagnosticCodes } from \"./team.ts\";\nexport { type TypeDiagnosticCode, typeDiagnosticCodes } from \"./type.ts\";\nexport { type VerifyDiagnosticCode, verifyDiagnosticCodes } from \"./verify.ts\";\n\n/** Every code in the catalog. Codes are semver surface and are never removed (AX-03). */\nexport type KnownDiagnosticCode =\n // gen:area-codes\n | LicenseDiagnosticCode\n | PackDiagnosticCode\n | PluginDiagnosticCode\n | TeamDiagnosticCode\n | RemoteDiagnosticCode\n | ShareDiagnosticCode\n | CliDiagnosticCode\n | RegressionDiagnosticCode\n | SmokeDiagnosticCode\n | A11yDiagnosticCode\n | NetworkDiagnosticCode\n | ConsoleDiagnosticCode\n | TypeDiagnosticCode\n | VerifyDiagnosticCode\n | LiveDiagnosticCode\n | SecretDiagnosticCode\n | RuntimeDiagnosticCode\n | FieldDiagnosticCode\n | SubmitDiagnosticCode\n | HygieneDiagnosticCode\n | DepDiagnosticCode\n | EnvDiagnosticCode\n | TargetDiagnosticCode\n | ArtifactDiagnosticCode\n | PublishDiagnosticCode\n | ActionDiagnosticCode\n | BuildDiagnosticCode\n | ManifestDiagnosticCode\n | HomeDiagnosticCode\n | PlatformDiagnosticCode\n | HostDiagnosticCode;\n\n/** Every cataloged code with its severity, phase, title, default hint and docs text. */\nexport const diagnosticCatalog: Readonly<Record<KnownDiagnosticCode, DiagnosticSpec>> = {\n // gen:area-spreads\n ...licenseDiagnostics,\n ...packDiagnostics,\n ...pluginDiagnostics,\n ...teamDiagnostics,\n ...remoteDiagnostics,\n ...shareDiagnostics,\n ...cliDiagnostics,\n ...regressionDiagnostics,\n ...smokeDiagnostics,\n ...a11yDiagnostics,\n ...networkDiagnostics,\n ...consoleDiagnostics,\n ...typeDiagnostics,\n ...verifyDiagnostics,\n ...liveDiagnostics,\n ...secretDiagnostics,\n ...runtimeDiagnostics,\n ...fieldDiagnostics,\n ...submitDiagnostics,\n ...hygieneDiagnostics,\n ...depDiagnostics,\n ...envDiagnostics,\n ...targetDiagnostics,\n ...artifactDiagnostics,\n ...publishDiagnostics,\n ...actionDiagnostics,\n ...buildDiagnostics,\n ...manifestDiagnostics,\n ...homeDiagnostics,\n ...platformDiagnostics,\n ...hostDiagnostics,\n};\n\n/** Options for {@link createDiagnostic}. */\nexport interface CreateDiagnosticOptions {\n /** The docs site base URL. Defaults to `DEFAULT_DOCS_BASE`. */\n readonly docsBase?: string;\n}\n\n/**\n * Creates the diagnostic for one occurrence of a cataloged code. Severity, phase, the default hint\n * and the docs link come from the catalog.\n *\n * ```ts\n * createDiagnostic(\"MOSTRA_HOST_REVISION_UNSUPPORTED\", {\n * message: \"The client offered 2026-01-01; this instance supports 2026-10-10.\",\n * });\n * ```\n */\nexport function createDiagnostic(\n code: KnownDiagnosticCode,\n details: DiagnosticDetails,\n options: CreateDiagnosticOptions = {},\n): Diagnostic {\n return buildDiagnostic(code, diagnosticCatalog[code], details, options.docsBase);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4GA,MAAa,oBAA2E;CAEtF,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;AACL;;;;;;;;;;;AAkBA,SAAgB,iBACd,MACA,SACA,UAAmC,CAAC,GACxB;CACZ,OAAO,gBAAgB,MAAM,kBAAkB,OAAO,SAAS,QAAQ,QAAQ;AACjF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../spec.js";
|
|
2
|
+
//#region src/diagnostics/codes/license.d.ts
|
|
3
|
+
/** The codes of the LICENSE area, in the order they were added. */
|
|
4
|
+
export declare const licenseDiagnosticCodes: readonly ["MOSTRA_LICENSE_UNACCEPTED", "MOSTRA_LICENSE_UNDECLARED", "MOSTRA_LICENSE_MISMATCH", "MOSTRA_LICENSE_ACCEPT_INVALID"];
|
|
5
|
+
/** The codes of the LICENSE area. */
|
|
6
|
+
export type LicenseDiagnosticCode = (typeof licenseDiagnosticCodes)[number];
|
|
7
|
+
//#endregion
|
|
8
|
+
//# sourceMappingURL=license.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license.d.ts","names":[],"sources":["../../../src/diagnostics/codes/license.ts"],"mappings":";;;qBAMa;;YASD,gCAAgC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region src/diagnostics/codes/license.ts
|
|
2
|
+
/** The codes of the LICENSE area, in the order they were added. */
|
|
3
|
+
const licenseDiagnosticCodes = [
|
|
4
|
+
"MOSTRA_LICENSE_UNACCEPTED",
|
|
5
|
+
"MOSTRA_LICENSE_UNDECLARED",
|
|
6
|
+
"MOSTRA_LICENSE_MISMATCH",
|
|
7
|
+
"MOSTRA_LICENSE_ACCEPT_INVALID"
|
|
8
|
+
];
|
|
9
|
+
/** The LICENSE area's catalog entries. */
|
|
10
|
+
const licenseDiagnostics = {
|
|
11
|
+
MOSTRA_LICENSE_UNACCEPTED: {
|
|
12
|
+
severity: "error",
|
|
13
|
+
phase: "contract",
|
|
14
|
+
title: "License needs acknowledgment",
|
|
15
|
+
hint: "Read the license the message names, then run the command in this diagnostic's fix to accept it.",
|
|
16
|
+
docs: {
|
|
17
|
+
explanation: "The install brings a license that isn't OSI-approved and isn't a public-domain dedication or another free license: a source-available or proprietary license, or one Mostra can't read. Such a license is accepted once per artifact (or for the home), by `--accept-license <id>` or by the host's policy, and the lockfile records it (D31). This is disclosure, not a limit: anyone may accept, and nothing was installed or recorded before they do. The message names each license, its class and the packages under it.",
|
|
18
|
+
fix: "Read the license's terms (the message gives its summary and URL when the plugin declares them), then add the plugin again with `--accept-license <id>` for each ID, as the fix shows."
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
MOSTRA_LICENSE_UNDECLARED: {
|
|
22
|
+
severity: "warning",
|
|
23
|
+
phase: "manifest",
|
|
24
|
+
title: "Dependency license not declared",
|
|
25
|
+
hint: "Declare the license in the plugin manifest's bundledLicenses, with a summary and a URL.",
|
|
26
|
+
docs: {
|
|
27
|
+
explanation: "A package the plugin brings has a license that needs an acknowledgment, and the manifest's `bundledLicenses` doesn't declare it, so the person installing sees only the package's own license field. Mostra still finds and discloses it from the installed packages.",
|
|
28
|
+
fix: "Add `{ \"package\": \"<name>\", \"license\": \"<expression>\", \"summary\": \"…\", \"url\": \"…\" }` to `bundledLicenses`."
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
MOSTRA_LICENSE_MISMATCH: {
|
|
32
|
+
severity: "warning",
|
|
33
|
+
phase: "manifest",
|
|
34
|
+
title: "Declared license differs",
|
|
35
|
+
hint: "Make the manifest's declaration match the package's own license field.",
|
|
36
|
+
docs: {
|
|
37
|
+
explanation: "The manifest declares a license for a package (in `bundledLicenses`, or its own `license`) that differs from the license field the package itself carries. Mostra discloses the package's own field, which it can read, and uses a declaration only where the field can't be read.",
|
|
38
|
+
fix: "Correct the declaration, or the package's license field if the declaration is right."
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
MOSTRA_LICENSE_ACCEPT_INVALID: {
|
|
42
|
+
severity: "error",
|
|
43
|
+
phase: "host",
|
|
44
|
+
title: "Accepted license not understood",
|
|
45
|
+
hint: "Pass a license ID such as LicenseRef-Remotion, or * for every license.",
|
|
46
|
+
docs: {
|
|
47
|
+
explanation: "A value of `--accept-license` (or of the host's `licenses.accept`) is neither an SPDX license ID, nor a `LicenseRef-` reference, nor `*`.",
|
|
48
|
+
fix: "Copy the ID from the `MOSTRA_LICENSE_UNACCEPTED` diagnostic that asked for it."
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
export { licenseDiagnosticCodes, licenseDiagnostics };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=license.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license.js","names":[],"sources":["../../../src/diagnostics/codes/license.ts"],"sourcesContent":["/**\n * Diagnostic codes of the LICENSE area: the licenses plugins and packs bring, and their acknowledgment (D31, EX-04).\n */\nimport type { AreaCatalog } from \"../spec.ts\";\n\n/** The codes of the LICENSE area, in the order they were added. */\nexport const licenseDiagnosticCodes = [\n \"MOSTRA_LICENSE_UNACCEPTED\",\n \"MOSTRA_LICENSE_UNDECLARED\",\n \"MOSTRA_LICENSE_MISMATCH\",\n \"MOSTRA_LICENSE_ACCEPT_INVALID\",\n // gen:codes\n] as const;\n\n/** The codes of the LICENSE area. */\nexport type LicenseDiagnosticCode = (typeof licenseDiagnosticCodes)[number];\n\n/** The LICENSE area's catalog entries. */\nexport const licenseDiagnostics: AreaCatalog<LicenseDiagnosticCode> = {\n MOSTRA_LICENSE_UNACCEPTED: {\n severity: \"error\",\n phase: \"contract\",\n title: \"License needs acknowledgment\",\n hint: \"Read the license the message names, then run the command in this diagnostic's fix to accept it.\",\n docs: {\n explanation:\n \"The install brings a license that isn't OSI-approved and isn't a public-domain dedication or another free license: a source-available or proprietary license, or one Mostra can't read. Such a license is accepted once per artifact (or for the home), by `--accept-license <id>` or by the host's policy, and the lockfile records it (D31). This is disclosure, not a limit: anyone may accept, and nothing was installed or recorded before they do. The message names each license, its class and the packages under it.\",\n fix: \"Read the license's terms (the message gives its summary and URL when the plugin declares them), then add the plugin again with `--accept-license <id>` for each ID, as the fix shows.\",\n },\n },\n MOSTRA_LICENSE_UNDECLARED: {\n severity: \"warning\",\n phase: \"manifest\",\n title: \"Dependency license not declared\",\n hint: \"Declare the license in the plugin manifest's bundledLicenses, with a summary and a URL.\",\n docs: {\n explanation:\n \"A package the plugin brings has a license that needs an acknowledgment, and the manifest's `bundledLicenses` doesn't declare it, so the person installing sees only the package's own license field. Mostra still finds and discloses it from the installed packages.\",\n fix: 'Add `{ \"package\": \"<name>\", \"license\": \"<expression>\", \"summary\": \"\\u2026\", \"url\": \"\\u2026\" }` to `bundledLicenses`.',\n },\n },\n MOSTRA_LICENSE_MISMATCH: {\n severity: \"warning\",\n phase: \"manifest\",\n title: \"Declared license differs\",\n hint: \"Make the manifest's declaration match the package's own license field.\",\n docs: {\n explanation:\n \"The manifest declares a license for a package (in `bundledLicenses`, or its own `license`) that differs from the license field the package itself carries. Mostra discloses the package's own field, which it can read, and uses a declaration only where the field can't be read.\",\n fix: \"Correct the declaration, or the package's license field if the declaration is right.\",\n },\n },\n MOSTRA_LICENSE_ACCEPT_INVALID: {\n severity: \"error\",\n phase: \"host\",\n title: \"Accepted license not understood\",\n hint: \"Pass a license ID such as LicenseRef-Remotion, or * for every license.\",\n docs: {\n explanation:\n \"A value of `--accept-license` (or of the host's `licenses.accept`) is neither an SPDX license ID, nor a `LicenseRef-` reference, nor `*`.\",\n fix: \"Copy the ID from the `MOSTRA_LICENSE_UNACCEPTED` diagnostic that asked for it.\",\n },\n },\n // gen:entries\n};\n"],"mappings":";;AAMA,MAAa,yBAAyB;CACpC;CACA;CACA;CACA;AAEF;;AAMA,MAAa,qBAAyD;CACpE,2BAA2B;EACzB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,2BAA2B;EACzB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,yBAAyB;EACvB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,+BAA+B;EAC7B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;AAEF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../spec.js";
|
|
2
|
+
//#region src/diagnostics/codes/pack.d.ts
|
|
3
|
+
/** The codes of the PACK area, in the order they were added. */
|
|
4
|
+
export declare const packDiagnosticCodes: readonly ["MOSTRA_PACK_ADDRESS_INVALID", "MOSTRA_PACK_ITEM_NOT_FOUND", "MOSTRA_PACK_ITEM_INVALID", "MOSTRA_PACK_FETCH_FAILED", "MOSTRA_PACK_OFFLINE", "MOSTRA_PACK_TARGET_INVALID", "MOSTRA_PACK_FILE_EXISTS", "MOSTRA_PACK_CSS_UNIMPORTED", "MOSTRA_PACK_NOT_APPLIED"];
|
|
5
|
+
/** The codes of the PACK area. */
|
|
6
|
+
export type PackDiagnosticCode = (typeof packDiagnosticCodes)[number];
|
|
7
|
+
//#endregion
|
|
8
|
+
//# sourceMappingURL=pack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack.d.ts","names":[],"sources":["../../../src/diagnostics/codes/pack.ts"],"mappings":";;;qBAMa;;YAcD,6BAA6B"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
//#region src/diagnostics/codes/pack.ts
|
|
2
|
+
/** The codes of the PACK area, in the order they were added. */
|
|
3
|
+
const packDiagnosticCodes = [
|
|
4
|
+
"MOSTRA_PACK_ADDRESS_INVALID",
|
|
5
|
+
"MOSTRA_PACK_ITEM_NOT_FOUND",
|
|
6
|
+
"MOSTRA_PACK_ITEM_INVALID",
|
|
7
|
+
"MOSTRA_PACK_FETCH_FAILED",
|
|
8
|
+
"MOSTRA_PACK_OFFLINE",
|
|
9
|
+
"MOSTRA_PACK_TARGET_INVALID",
|
|
10
|
+
"MOSTRA_PACK_FILE_EXISTS",
|
|
11
|
+
"MOSTRA_PACK_CSS_UNIMPORTED",
|
|
12
|
+
"MOSTRA_PACK_NOT_APPLIED"
|
|
13
|
+
];
|
|
14
|
+
/** The PACK area's catalog entries. */
|
|
15
|
+
const packDiagnostics = {
|
|
16
|
+
MOSTRA_PACK_ADDRESS_INVALID: {
|
|
17
|
+
severity: "error",
|
|
18
|
+
phase: "host",
|
|
19
|
+
title: "Item address not understood",
|
|
20
|
+
hint: "Use an item URL, a local .json item, owner/repo/item for GitHub, or an @namespace/item your components.json registers.",
|
|
21
|
+
docs: {
|
|
22
|
+
explanation: "`mostra add` reads an item address in shadcn's forms: an `https:` URL of an item's JSON, a path to a local `.json` item, a GitHub item (`owner/repo/item[#ref]`), or `@namespace/item` resolved through the `registries` of the artifact's `components.json`. A bare name in an item's `registryDependencies` means shadcn's own registry. This address is none of those, or names a namespace the artifact doesn't register, or a plain `http:` URL to another machine.",
|
|
23
|
+
fix: "Correct the address, or add the namespace to `registries` in the artifact's `components.json` (`\"@acme\": \"https://registry.acme.com/r/{name}.json\"`)."
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
MOSTRA_PACK_ITEM_NOT_FOUND: {
|
|
27
|
+
severity: "error",
|
|
28
|
+
phase: "network",
|
|
29
|
+
title: "Registry item not found",
|
|
30
|
+
hint: "Check the address; for a GitHub item, check the repository's registry.json and the ref.",
|
|
31
|
+
docs: {
|
|
32
|
+
explanation: "The registry answered that the item doesn't exist (HTTP 404), the local file isn't there, or a GitHub repository's root `registry.json` has no item by that name. The message names the address and where Mostra looked.",
|
|
33
|
+
fix: "Correct the address. For a GitHub item, `owner/repo/item` names an item of the repository's root `registry.json`, at its default branch unless `#ref` says otherwise."
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
MOSTRA_PACK_ITEM_INVALID: {
|
|
37
|
+
severity: "error",
|
|
38
|
+
phase: "manifest",
|
|
39
|
+
title: "Registry item invalid",
|
|
40
|
+
hint: "Fix the field this diagnostic names in the item's JSON.",
|
|
41
|
+
docs: {
|
|
42
|
+
explanation: "The item isn't a shadcn registry item Mostra can install: it isn't JSON, misses `name` or `type`, a file has no `path`, a `registry:file` or `registry:page` has no `target`, a file has neither `content` nor a path its registry holds, or the `mostra` block has a wrong value. Every field shadcn's schema allows is accepted, and unknown keys are kept.",
|
|
43
|
+
fix: "Correct the item (its JSON Schema is `https://ui.shadcn.com/schema/registry-item.json`, plus the `mostra` block in `@mostra/protocol/schemas/plugin-manifest.schema.json`)."
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
MOSTRA_PACK_FETCH_FAILED: {
|
|
47
|
+
severity: "error",
|
|
48
|
+
phase: "network",
|
|
49
|
+
title: "Registry item couldn't be read",
|
|
50
|
+
hint: "Check the network and the registry, then run the command again.",
|
|
51
|
+
docs: {
|
|
52
|
+
explanation: "Reading the item failed: the registry couldn't be reached, answered an error other than 404, sent more than 8 MiB, took longer than 30 s, or redirected to an address Mostra doesn't follow. Nothing was written.",
|
|
53
|
+
fix: "Run the command again once the registry answers. Behind a proxy, set `HTTPS_PROXY` for the Mostra daemon."
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
MOSTRA_PACK_OFFLINE: {
|
|
57
|
+
severity: "error",
|
|
58
|
+
phase: "network",
|
|
59
|
+
title: "Registry item unavailable offline",
|
|
60
|
+
hint: "Connect to the network, or add the item from a local .json file.",
|
|
61
|
+
docs: {
|
|
62
|
+
explanation: "Mostra is offline (`MOSTRA_OFFLINE` is set, or no network interface is up), and the item, or one of its registry dependencies, is on a remote registry. Nothing was written.",
|
|
63
|
+
fix: "Run the command again with the network up, or download the item and add it from its file: `mostra add ./item.json --artifact <path>`."
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
MOSTRA_PACK_TARGET_INVALID: {
|
|
67
|
+
severity: "error",
|
|
68
|
+
phase: "host",
|
|
69
|
+
title: "Item file outside the artifact",
|
|
70
|
+
hint: "Ask the item's author to fix its target; Mostra writes an item's files only inside the artifact.",
|
|
71
|
+
docs: {
|
|
72
|
+
explanation: "A file of the item would land outside the artifact's directory (`../`, an absolute path), on a name not every system can hold (`<>:\"|?*`, a Windows device name, a trailing dot or space), on Mostra's own files, or on two names that differ only in case. Nothing was written.",
|
|
73
|
+
fix: "Use a corrected item, or copy the files you need into the artifact yourself."
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
MOSTRA_PACK_FILE_EXISTS: {
|
|
77
|
+
severity: "error",
|
|
78
|
+
phase: "host",
|
|
79
|
+
title: "File already exists",
|
|
80
|
+
hint: "Run the command again with `--overwrite` to replace the files the message lists, or move them first.",
|
|
81
|
+
docs: {
|
|
82
|
+
explanation: "The artifact already has files where the item writes, with other content. Mostra never replaces an artifact's file without being asked, as shadcn asks before it overwrites; nothing was written.",
|
|
83
|
+
fix: "Add `--overwrite` to replace them (`mostra add <item> --artifact <path> --overwrite`), or rename your files and add the item again."
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
MOSTRA_PACK_CSS_UNIMPORTED: {
|
|
87
|
+
severity: "warning",
|
|
88
|
+
phase: "compile",
|
|
89
|
+
title: "Item CSS not imported",
|
|
90
|
+
hint: "Import the stylesheet this diagnostic names from the artifact's entry.",
|
|
91
|
+
docs: {
|
|
92
|
+
explanation: "The item brings CSS variables or rules, which Mostra wrote into a stylesheet of the artifact, but the artifact's entry doesn't import that stylesheet, so the page doesn't load them yet. Mostra writes into the stylesheet the entry imports when there is one (or the one `components.json` names), and creates `styles.css` otherwise.",
|
|
93
|
+
fix: "Add `import \"./styles.css\";` (the path the message names) to the artifact's entry, after any other stylesheet."
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
MOSTRA_PACK_NOT_APPLIED: {
|
|
97
|
+
severity: "hint",
|
|
98
|
+
phase: "host",
|
|
99
|
+
title: "Item part not applied",
|
|
100
|
+
hint: "Read what the item asked for and apply it yourself if the artifact needs it.",
|
|
101
|
+
docs: {
|
|
102
|
+
explanation: "The item asks for something an artifact doesn't have: environment variables (`envVars`; server code reads secrets with `secret()`, set by `mostra secret set`), a Tailwind 3 configuration (`tailwind.config`; Tailwind 4 reads `cssVars.theme`), a font through `next/font`, or a design-system configuration (`registry:base`, `registry:style`). Mostra installs the rest and lists these.",
|
|
103
|
+
fix: "Set the secrets the item's server code needs with `mostra secret set NAME`, and move any Tailwind 3 theme into the item's `cssVars.theme` or your stylesheet's `@theme`."
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
//#endregion
|
|
108
|
+
export { packDiagnosticCodes, packDiagnostics };
|
|
109
|
+
|
|
110
|
+
//# sourceMappingURL=pack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack.js","names":[],"sources":["../../../src/diagnostics/codes/pack.ts"],"sourcesContent":["/**\n * Diagnostic codes of the PACK area: source packs, shadcn registry items copied into an artifact (D30, EX-03).\n */\nimport type { AreaCatalog } from \"../spec.ts\";\n\n/** The codes of the PACK area, in the order they were added. */\nexport const packDiagnosticCodes = [\n \"MOSTRA_PACK_ADDRESS_INVALID\",\n \"MOSTRA_PACK_ITEM_NOT_FOUND\",\n \"MOSTRA_PACK_ITEM_INVALID\",\n \"MOSTRA_PACK_FETCH_FAILED\",\n \"MOSTRA_PACK_OFFLINE\",\n \"MOSTRA_PACK_TARGET_INVALID\",\n \"MOSTRA_PACK_FILE_EXISTS\",\n \"MOSTRA_PACK_CSS_UNIMPORTED\",\n \"MOSTRA_PACK_NOT_APPLIED\",\n // gen:codes\n] as const;\n\n/** The codes of the PACK area. */\nexport type PackDiagnosticCode = (typeof packDiagnosticCodes)[number];\n\n/** The PACK area's catalog entries. */\nexport const packDiagnostics: AreaCatalog<PackDiagnosticCode> = {\n MOSTRA_PACK_ADDRESS_INVALID: {\n severity: \"error\",\n phase: \"host\",\n title: \"Item address not understood\",\n hint: \"Use an item URL, a local .json item, owner/repo/item for GitHub, or an @namespace/item your components.json registers.\",\n docs: {\n explanation:\n \"`mostra add` reads an item address in shadcn's forms: an `https:` URL of an item's JSON, a path to a local `.json` item, a GitHub item (`owner/repo/item[#ref]`), or `@namespace/item` resolved through the `registries` of the artifact's `components.json`. A bare name in an item's `registryDependencies` means shadcn's own registry. This address is none of those, or names a namespace the artifact doesn't register, or a plain `http:` URL to another machine.\",\n fix: 'Correct the address, or add the namespace to `registries` in the artifact\\'s `components.json` (`\"@acme\": \"https://registry.acme.com/r/{name}.json\"`).',\n },\n },\n MOSTRA_PACK_ITEM_NOT_FOUND: {\n severity: \"error\",\n phase: \"network\",\n title: \"Registry item not found\",\n hint: \"Check the address; for a GitHub item, check the repository's registry.json and the ref.\",\n docs: {\n explanation:\n \"The registry answered that the item doesn't exist (HTTP 404), the local file isn't there, or a GitHub repository's root `registry.json` has no item by that name. The message names the address and where Mostra looked.\",\n fix: \"Correct the address. For a GitHub item, `owner/repo/item` names an item of the repository's root `registry.json`, at its default branch unless `#ref` says otherwise.\",\n },\n },\n MOSTRA_PACK_ITEM_INVALID: {\n severity: \"error\",\n phase: \"manifest\",\n title: \"Registry item invalid\",\n hint: \"Fix the field this diagnostic names in the item's JSON.\",\n docs: {\n explanation:\n \"The item isn't a shadcn registry item Mostra can install: it isn't JSON, misses `name` or `type`, a file has no `path`, a `registry:file` or `registry:page` has no `target`, a file has neither `content` nor a path its registry holds, or the `mostra` block has a wrong value. Every field shadcn's schema allows is accepted, and unknown keys are kept.\",\n fix: \"Correct the item (its JSON Schema is `https://ui.shadcn.com/schema/registry-item.json`, plus the `mostra` block in `@mostra/protocol/schemas/plugin-manifest.schema.json`).\",\n },\n },\n MOSTRA_PACK_FETCH_FAILED: {\n severity: \"error\",\n phase: \"network\",\n title: \"Registry item couldn't be read\",\n hint: \"Check the network and the registry, then run the command again.\",\n docs: {\n explanation:\n \"Reading the item failed: the registry couldn't be reached, answered an error other than 404, sent more than 8 MiB, took longer than 30 s, or redirected to an address Mostra doesn't follow. Nothing was written.\",\n fix: \"Run the command again once the registry answers. Behind a proxy, set `HTTPS_PROXY` for the Mostra daemon.\",\n },\n },\n MOSTRA_PACK_OFFLINE: {\n severity: \"error\",\n phase: \"network\",\n title: \"Registry item unavailable offline\",\n hint: \"Connect to the network, or add the item from a local .json file.\",\n docs: {\n explanation:\n \"Mostra is offline (`MOSTRA_OFFLINE` is set, or no network interface is up), and the item, or one of its registry dependencies, is on a remote registry. Nothing was written.\",\n fix: \"Run the command again with the network up, or download the item and add it from its file: `mostra add ./item.json --artifact <path>`.\",\n },\n },\n MOSTRA_PACK_TARGET_INVALID: {\n severity: \"error\",\n phase: \"host\",\n title: \"Item file outside the artifact\",\n hint: \"Ask the item's author to fix its target; Mostra writes an item's files only inside the artifact.\",\n docs: {\n explanation:\n \"A file of the item would land outside the artifact's directory (`../`, an absolute path), on a name not every system can hold (`<>:\\\"|?*`, a Windows device name, a trailing dot or space), on Mostra's own files, or on two names that differ only in case. Nothing was written.\",\n fix: \"Use a corrected item, or copy the files you need into the artifact yourself.\",\n },\n },\n MOSTRA_PACK_FILE_EXISTS: {\n severity: \"error\",\n phase: \"host\",\n title: \"File already exists\",\n hint: \"Run the command again with `--overwrite` to replace the files the message lists, or move them first.\",\n docs: {\n explanation:\n \"The artifact already has files where the item writes, with other content. Mostra never replaces an artifact's file without being asked, as shadcn asks before it overwrites; nothing was written.\",\n fix: \"Add `--overwrite` to replace them (`mostra add <item> --artifact <path> --overwrite`), or rename your files and add the item again.\",\n },\n },\n MOSTRA_PACK_CSS_UNIMPORTED: {\n severity: \"warning\",\n phase: \"compile\",\n title: \"Item CSS not imported\",\n hint: \"Import the stylesheet this diagnostic names from the artifact's entry.\",\n docs: {\n explanation:\n \"The item brings CSS variables or rules, which Mostra wrote into a stylesheet of the artifact, but the artifact's entry doesn't import that stylesheet, so the page doesn't load them yet. Mostra writes into the stylesheet the entry imports when there is one (or the one `components.json` names), and creates `styles.css` otherwise.\",\n fix: 'Add `import \"./styles.css\";` (the path the message names) to the artifact\\'s entry, after any other stylesheet.',\n },\n },\n MOSTRA_PACK_NOT_APPLIED: {\n severity: \"hint\",\n phase: \"host\",\n title: \"Item part not applied\",\n hint: \"Read what the item asked for and apply it yourself if the artifact needs it.\",\n docs: {\n explanation:\n \"The item asks for something an artifact doesn't have: environment variables (`envVars`; server code reads secrets with `secret()`, set by `mostra secret set`), a Tailwind 3 configuration (`tailwind.config`; Tailwind 4 reads `cssVars.theme`), a font through `next/font`, or a design-system configuration (`registry:base`, `registry:style`). Mostra installs the rest and lists these.\",\n fix: \"Set the secrets the item's server code needs with `mostra secret set NAME`, and move any Tailwind 3 theme into the item's `cssVars.theme` or your stylesheet's `@theme`.\",\n },\n },\n // gen:entries\n};\n"],"mappings":";;AAMA,MAAa,sBAAsB;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAMA,MAAa,kBAAmD;CAC9D,6BAA6B;EAC3B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,4BAA4B;EAC1B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,0BAA0B;EACxB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,0BAA0B;EACxB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,qBAAqB;EACnB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,4BAA4B;EAC1B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,yBAAyB;EACvB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,4BAA4B;EAC1B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,yBAAyB;EACvB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;AAEF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../spec.js";
|
|
2
|
+
//#region src/diagnostics/codes/plugin.d.ts
|
|
3
|
+
/** The codes of the PLUGIN area, in the order they were added. */
|
|
4
|
+
export declare const pluginDiagnosticCodes: readonly ["MOSTRA_PLUGIN_MANIFEST_INVALID", "MOSTRA_PLUGIN_MANIFEST_WARNING", "MOSTRA_PLUGIN_NOT_A_PLUGIN", "MOSTRA_PLUGIN_CONTRACT_UNSUPPORTED", "MOSTRA_PLUGIN_CONFLICT", "MOSTRA_PLUGIN_ENTRY_INVALID", "MOSTRA_PLUGIN_SCOPE_INVALID", "MOSTRA_PLUGIN_NOT_INSTALLED", "MOSTRA_PLUGIN_PLATFORM_UNSUPPORTED", "MOSTRA_PLUGIN_EXPORTER_UNKNOWN", "MOSTRA_PLUGIN_FAILED", "MOSTRA_PLUGIN_OPTIONS_INVALID", "MOSTRA_PLUGIN_SHADOWED"];
|
|
5
|
+
/** The codes of the PLUGIN area. */
|
|
6
|
+
export type PluginDiagnosticCode = (typeof pluginDiagnosticCodes)[number];
|
|
7
|
+
//#endregion
|
|
8
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","names":[],"sources":["../../../src/diagnostics/codes/plugin.ts"],"mappings":";;;qBAMa;;YAkBD,+BAA+B"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
//#region src/diagnostics/codes/plugin.ts
|
|
2
|
+
/** The codes of the PLUGIN area, in the order they were added. */
|
|
3
|
+
const pluginDiagnosticCodes = [
|
|
4
|
+
"MOSTRA_PLUGIN_MANIFEST_INVALID",
|
|
5
|
+
"MOSTRA_PLUGIN_MANIFEST_WARNING",
|
|
6
|
+
"MOSTRA_PLUGIN_NOT_A_PLUGIN",
|
|
7
|
+
"MOSTRA_PLUGIN_CONTRACT_UNSUPPORTED",
|
|
8
|
+
"MOSTRA_PLUGIN_CONFLICT",
|
|
9
|
+
"MOSTRA_PLUGIN_ENTRY_INVALID",
|
|
10
|
+
"MOSTRA_PLUGIN_SCOPE_INVALID",
|
|
11
|
+
"MOSTRA_PLUGIN_NOT_INSTALLED",
|
|
12
|
+
"MOSTRA_PLUGIN_PLATFORM_UNSUPPORTED",
|
|
13
|
+
"MOSTRA_PLUGIN_EXPORTER_UNKNOWN",
|
|
14
|
+
"MOSTRA_PLUGIN_FAILED",
|
|
15
|
+
"MOSTRA_PLUGIN_OPTIONS_INVALID",
|
|
16
|
+
"MOSTRA_PLUGIN_SHADOWED"
|
|
17
|
+
];
|
|
18
|
+
/** The PLUGIN area's catalog entries. */
|
|
19
|
+
const pluginDiagnostics = {
|
|
20
|
+
MOSTRA_PLUGIN_MANIFEST_INVALID: {
|
|
21
|
+
severity: "error",
|
|
22
|
+
phase: "manifest",
|
|
23
|
+
title: "Plugin manifest invalid",
|
|
24
|
+
hint: "Fix the field this diagnostic names in the plugin's package.json, then run `mostra plugin validate` again.",
|
|
25
|
+
docs: {
|
|
26
|
+
explanation: "A field of the plugin's manifest, the `\"mostra\"` key of its `package.json`, isn't one Mostra can load: a required field is missing, a value has the wrong form, a contribution kind has no contract range, an ID is contributed twice, a command would take one of `mostra`'s own words, or a license isn't an SPDX expression. The location points at the field, and `mostra plugin validate` reports every one at once.",
|
|
27
|
+
fix: "Correct the field (the message says what it expects) and validate again. The manifest's shape is published as JSON Schema in `@mostra/protocol/schemas/plugin-manifest.schema.json`."
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
MOSTRA_PLUGIN_MANIFEST_WARNING: {
|
|
31
|
+
severity: "warning",
|
|
32
|
+
phase: "manifest",
|
|
33
|
+
title: "Plugin manifest questionable",
|
|
34
|
+
hint: "Check the field this diagnostic names; Mostra loads the plugin and ignores what it doesn't know.",
|
|
35
|
+
docs: {
|
|
36
|
+
explanation: "The plugin's manifest has something this Mostra release loads around: a key it doesn't know, an effect or a system it doesn't know, or a contract declared with nothing contributed to it. Manifests grow additively, so a newer plugin may carry keys an older Mostra skips; a misspelled key is skipped the same way, which can leave a contribution or a license undeclared.",
|
|
37
|
+
fix: "Correct the field if it is a mistake. If it is something a newer Mostra reads, nothing is needed."
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
MOSTRA_PLUGIN_NOT_A_PLUGIN: {
|
|
41
|
+
severity: "error",
|
|
42
|
+
phase: "manifest",
|
|
43
|
+
title: "Not a Mostra plugin",
|
|
44
|
+
hint: "Add the package with `mostra add` if it is an ordinary package, or give it a \"mostra\" manifest if it is a plugin.",
|
|
45
|
+
docs: {
|
|
46
|
+
explanation: "The package has no `\"mostra\"` key in its `package.json`, so it contributes nothing Mostra could load. `mostra plugin add` installs only plugins; ordinary npm packages go through `mostra add`.",
|
|
47
|
+
fix: "Run `mostra add <package> --artifact <path>` for an ordinary package. For a plugin you write, add the manifest (`mostra docs guide/plugins`) and run `mostra plugin validate`."
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
MOSTRA_PLUGIN_CONTRACT_UNSUPPORTED: {
|
|
51
|
+
severity: "error",
|
|
52
|
+
phase: "contract",
|
|
53
|
+
title: "Contract version not implemented",
|
|
54
|
+
hint: "Install a version of the plugin built for this Mostra's contracts, or update Mostra.",
|
|
55
|
+
docs: {
|
|
56
|
+
explanation: "The plugin declares a contract range, or carries a definition stamped with a contract version, that this Mostra release doesn't serve. Each extension contract is its own package with its own version (D30): within a line changes are additive, so Mostra serves stamps of its line up to the version it implements, and a range must admit that version. The message names the contract, the plugin's range or stamp, and the version this release implements. Mostra reports it when the plugin is added, and when `verify` or `publish` loads it, so an artifact whose plugin a newer runtime no longer serves is told before it is published.",
|
|
57
|
+
fix: "Add a release of the plugin whose range admits the version the message names (`mostra plugin add <package>@<version> --artifact <path>`), or run a Mostra release that implements the plugin's contract version, or remove the plugin with `mostra plugin remove`."
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
MOSTRA_PLUGIN_CONFLICT: {
|
|
61
|
+
severity: "error",
|
|
62
|
+
phase: "contract",
|
|
63
|
+
title: "Plugins contribute the same ID",
|
|
64
|
+
hint: "Remove one of the two plugins the message names, or use releases whose IDs differ.",
|
|
65
|
+
docs: {
|
|
66
|
+
explanation: "Two plugins of one artifact, or one of the artifact's and one of the home's, contribute the same ID to the same contract (two exporters `pdf`, two commands `term record`), or a plugin takes an ID Mostra builds in (the exporters `static`, `html`, `bundle` and `snapshot`). Nothing is overridden silently (ROUND-3 §6.4): the message names both sides.",
|
|
67
|
+
fix: "Remove one plugin with `mostra plugin remove <package> --artifact <path>` (or `--global`), then add the other again if needed."
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
MOSTRA_PLUGIN_ENTRY_INVALID: {
|
|
71
|
+
severity: "error",
|
|
72
|
+
phase: "contract",
|
|
73
|
+
title: "Plugin entry doesn't load",
|
|
74
|
+
hint: "Fix the module the message names so it exports the definition its contract's define function returns.",
|
|
75
|
+
docs: {
|
|
76
|
+
explanation: "A contribution's `entry` module is missing from the package, leaves it, failed to load, or doesn't export (at `export`, `default` when absent) a definition stamped by the contract's blueprint (`defineExporter`, `defineCliCommand` …) with the ID the manifest gives. Mostra reads the stamp from the loaded object itself, in a child process of the instance, so a manifest alone can't claim a contract. Contributions that run in the page (embed engines, anchor providers) are checked when the page uses them.",
|
|
77
|
+
fix: "Build the plugin so the module exists, export the value its `define*` function returns, and keep the manifest's ID equal to the definition's. Then run `mostra plugin validate <dir>`."
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
MOSTRA_PLUGIN_SCOPE_INVALID: {
|
|
81
|
+
severity: "error",
|
|
82
|
+
phase: "contract",
|
|
83
|
+
title: "Plugin can't be installed there",
|
|
84
|
+
hint: "Install the plugin for an artifact with `--artifact`, or pass exactly one of `--artifact` and `--global`.",
|
|
85
|
+
docs: {
|
|
86
|
+
explanation: "Plugins are installed for one artifact (recorded in its lockfile, part of its versions) or, when they contribute only exporters and CLI commands, for the whole home (ROUND-3 §6.4). This plugin contributes something that changes what an artifact's version is (an embed engine, a verify check, an anchor provider, a connector or a pack), so it can't be installed for the home; or the call named both scopes or neither.",
|
|
87
|
+
fix: "Run `mostra plugin add <package> --artifact <path>` for each artifact that uses it."
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
MOSTRA_PLUGIN_NOT_INSTALLED: {
|
|
91
|
+
severity: "error",
|
|
92
|
+
phase: "host",
|
|
93
|
+
title: "Plugin not installed",
|
|
94
|
+
hint: "Check the package name against `mostra plugin list`.",
|
|
95
|
+
docs: {
|
|
96
|
+
explanation: "The package isn't one of the plugins of the artifact (or of the home) the call names, so there is nothing to remove.",
|
|
97
|
+
fix: "List the scope's plugins with `mostra plugin list --artifact <path>` (or `--global`) and use a name from it."
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
MOSTRA_PLUGIN_PLATFORM_UNSUPPORTED: {
|
|
101
|
+
severity: "warning",
|
|
102
|
+
phase: "platform",
|
|
103
|
+
title: "Plugin doesn't name this system",
|
|
104
|
+
hint: "Expect the plugin's Node.js parts to fail here, or use a plugin that supports this system.",
|
|
105
|
+
docs: {
|
|
106
|
+
explanation: "The plugin's manifest lists the systems it runs on (`platforms`), and this one isn't among them. Mostra installs it anyway (it adds no capability limits), and says so, since its exporters, checks, connectors or commands may fail here.",
|
|
107
|
+
fix: "Use the plugin on a system it lists, or ask its author to support this one."
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
MOSTRA_PLUGIN_EXPORTER_UNKNOWN: {
|
|
111
|
+
severity: "error",
|
|
112
|
+
phase: "host",
|
|
113
|
+
title: "No such exporter",
|
|
114
|
+
hint: "Use one of the exporters the message lists, or add a plugin that contributes this one.",
|
|
115
|
+
docs: {
|
|
116
|
+
explanation: "`mostra export <artifact> --as <id> --out <path>` names an exporter that neither Mostra builds in nor any plugin of the artifact or the home contributes. The message lists every exporter available for the artifact.",
|
|
117
|
+
fix: "Pick an exporter from the list, or install a plugin that contributes it: `mostra plugin add <package> --artifact <path>`."
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
MOSTRA_PLUGIN_FAILED: {
|
|
121
|
+
severity: "error",
|
|
122
|
+
phase: "runtime",
|
|
123
|
+
title: "Plugin failed",
|
|
124
|
+
hint: "Read the plugin's error in the message and report it to the plugin's author if it isn't yours to fix.",
|
|
125
|
+
docs: {
|
|
126
|
+
explanation: "A plugin's contribution threw, returned something its contract doesn't allow (a file outside the export, a result that isn't JSON), or ran past its time limit while Mostra ran it. It runs in a child process of the instance, so the instance and other artifacts are unaffected; nothing it returned was kept.",
|
|
127
|
+
fix: "Fix the contribution if it is your plugin; otherwise update or remove it (`mostra plugin remove`)."
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
MOSTRA_PLUGIN_OPTIONS_INVALID: {
|
|
131
|
+
severity: "error",
|
|
132
|
+
phase: "contract",
|
|
133
|
+
title: "Exporter options invalid",
|
|
134
|
+
hint: "Give the options the exporter's schema asks for, each as `--option name=value`.",
|
|
135
|
+
docs: {
|
|
136
|
+
explanation: "The options given to a plugin's exporter don't fit the JSON Schema its definition declares (`options`), or it declares none and was given some. Mostra checks them in the plugin's child before the exporter runs, so nothing was exported.",
|
|
137
|
+
fix: "Read the exporter's options in its plugin's documentation (`mostra plugin list` names the plugin), and run `mostra export <artifact> --as <exporter> --out <path> --option name=value` with them. A value that reads as JSON (`3`, `true`, `[\"a\"]`) is passed as that value, anything else as text."
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
MOSTRA_PLUGIN_SHADOWED: {
|
|
141
|
+
severity: "warning",
|
|
142
|
+
phase: "contract",
|
|
143
|
+
title: "Plugin contribution shadowed",
|
|
144
|
+
hint: "Remove one of the two plugins if the artifact should use the other's contribution.",
|
|
145
|
+
docs: {
|
|
146
|
+
explanation: "An artifact's plugin and one of the home's (`--global`) contribute the same exporter or CLI command. Nothing is refused: in this artifact its own plugin's contribution is used, and the home's everywhere else. A home install never breaks an artifact that worked.",
|
|
147
|
+
fix: "Nothing is needed when the artifact's own contribution is the one it should use. Otherwise remove it from the artifact (`mostra plugin remove <package> --artifact <path>`), and the home's is used."
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
//#endregion
|
|
152
|
+
export { pluginDiagnosticCodes, pluginDiagnostics };
|
|
153
|
+
|
|
154
|
+
//# sourceMappingURL=plugin.js.map
|