@intentius/chant-lexicon-forgejo 0.37.2 → 0.39.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/codegen/docs.d.ts.map +1 -1
- package/dist/config.d.ts +54 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/integrity.json +2 -2
- package/dist/manifest.json +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/codegen/docs.ts +3 -1
- package/src/config-augmentation.test.ts +55 -0
- package/src/config.ts +58 -0
- package/src/index.ts +6 -0
- package/src/plugin.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/codegen/docs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/codegen/docs.ts"],"names":[],"mappings":"AA4JA;;GAEG;AACH,wBAAsB,YAAY,CAAC,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BjF"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `forgejo` namespace in `chant.config.ts` (#1344).
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* import type { ChantConfig } from "@intentius/chant/config";
|
|
6
|
+
* import "@intentius/chant-lexicon-forgejo"; // brings the `forgejo` key into ChantConfig
|
|
7
|
+
*
|
|
8
|
+
* export default {
|
|
9
|
+
* lexicons: ["forgejo"],
|
|
10
|
+
* forgejo: {
|
|
11
|
+
* runnerLabels: { "ubuntu-latest": "docker" },
|
|
12
|
+
* actionsRoot: "https://code.forgejo.org",
|
|
13
|
+
* },
|
|
14
|
+
* } satisfies ChantConfig;
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* One schema, three consumers: core validates the namespace against it at load,
|
|
18
|
+
* the type below is derived from it, and that derived type is what augments
|
|
19
|
+
* `ChantConfig` — so an unknown key fails at build time and at compile time for
|
|
20
|
+
* the same reason, rather than being silently ignored at both.
|
|
21
|
+
*/
|
|
22
|
+
import { z } from "zod";
|
|
23
|
+
import type { ChantConfig } from "@intentius/chant/config";
|
|
24
|
+
/**
|
|
25
|
+
* `strictObject`, not `object`. Core applies `.strict()` to the top level of a
|
|
26
|
+
* declared namespace itself, but nested objects are the lexicon's own to make
|
|
27
|
+
* strict — and `runnerLabels` is exactly where a typo would otherwise land.
|
|
28
|
+
*/
|
|
29
|
+
export declare const forgejoConfigSchema: z.ZodObject<{
|
|
30
|
+
/**
|
|
31
|
+
* GitHub-hosted runner label → Forgejo label. A label with no mapping falls
|
|
32
|
+
* back to the default Forgejo label and is flagged by WFJ011.
|
|
33
|
+
*/
|
|
34
|
+
runnerLabels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
35
|
+
/** Root the common `actions/*` refs are rewritten under. */
|
|
36
|
+
actionsRoot: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
export type ForgejoConfig = z.infer<typeof forgejoConfigSchema>;
|
|
39
|
+
declare module "@intentius/chant/config" {
|
|
40
|
+
interface ChantConfig {
|
|
41
|
+
forgejo?: ForgejoConfig;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Compile-time proof that the augmentation above reaches `ChantConfig` (#1344).
|
|
46
|
+
*
|
|
47
|
+
* Without it this line is `Property 'forgejo' does not exist on type
|
|
48
|
+
* 'ChantConfig'` — which is exactly the error a user's `chant.config.ts` got.
|
|
49
|
+
* It lives here rather than in a test because the root tsconfig excludes test
|
|
50
|
+
* files from typechecking, so a compile-time claim asserted in one is checked
|
|
51
|
+
* by nothing.
|
|
52
|
+
*/
|
|
53
|
+
export type ForgejoConfigNamespace = NonNullable<ChantConfig["forgejo"]>;
|
|
54
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;IAC9B;;;OAGG;;IAEH,4DAA4D;;kBAE5D,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,OAAO,QAAQ,yBAAyB,CAAC;IACvC,UAAU,WAAW;QACnB,OAAO,CAAC,EAAE,aAAa,CAAC;KACzB;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,6 @@ export { transform, detectGitHubWorkflow, type MigrateOptions, type MigrationRes
|
|
|
5
5
|
export { analyzeForgejoSecurity, renderSecurityPosture, type SecurityFate, type SecurityRecord, } from "./migrate/from-github/security.js";
|
|
6
6
|
export { resolveActionRef, DEFAULT_ACTIONS_ROOT, KNOWN_ACTIONS, type ActionTarget, type ActionResolveOptions, type ActionResolveResult, } from "./actions.js";
|
|
7
7
|
export * from "@intentius/chant-lexicon-github";
|
|
8
|
+
export { forgejoConfigSchema } from "./config.js";
|
|
9
|
+
export type { ForgejoConfig } from "./config.js";
|
|
8
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE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M,WAAW,CAAC;AAInB,cAAc,iCAAiC,CAAC;AAKhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "05ae7449e80d9c4a6f85058e32c1e5f2a5631997279502de1e2690ad325493fc",
|
|
5
5
|
"meta.json": "44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
|
|
6
6
|
"types/index.d.ts": "66204549b2a864ab5489e3f02c1878e73ab4b3c9d938cfb480b66f71543a43de",
|
|
7
7
|
"rules/delegate-to-github.ts": "1060cda40f4b73d6cca3ba3fa13b80b4886147d4034c88584c2d80c5510dbe5e",
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"rules/wfj011.ts": "fcb8bf6685d744af20ad804ce929488257995c74b9a3353b2eacae3768d1c83e",
|
|
10
10
|
"skills/chant-forgejo.md": "a1a560429db736c187e0b34cf8dd9efc6ad771afefcbf6f802d160d3d5274257"
|
|
11
11
|
},
|
|
12
|
-
"composite": "
|
|
12
|
+
"composite": "187583ff073a5cefff3d5f009293904ec3397a411d6231c7aa5218fb80ce2768"
|
|
13
13
|
}
|
package/dist/manifest.json
CHANGED
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAoC,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAoC,MAAM,0BAA0B,CAAC;AAkBhG,eAAO,MAAM,aAAa,EAAE,aA8L3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-forgejo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"description": "Forgejo / Codeberg / Gitea Actions lexicon for chant — a thin GitHub Actions dialect",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -53,8 +53,9 @@
|
|
|
53
53
|
"typescript": "^5.9.3"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"
|
|
57
|
-
"@intentius/chant
|
|
56
|
+
"zod": "^4.3.6",
|
|
57
|
+
"@intentius/chant": "^0.39.0",
|
|
58
|
+
"@intentius/chant-lexicon-github": "^0.39.0"
|
|
58
59
|
},
|
|
59
60
|
"scripts": {
|
|
60
61
|
"generate": "tsx src/codegen/generate-cli.ts",
|
package/src/codegen/docs.ts
CHANGED
|
@@ -110,7 +110,9 @@ chant build src -o .forgejo/workflows/ci.yml
|
|
|
110
110
|
Override the runner-label map and the actions root in \`chant.config.ts\`:
|
|
111
111
|
|
|
112
112
|
\`\`\`ts
|
|
113
|
-
import type { ChantConfig } from "@intentius/chant";
|
|
113
|
+
import type { ChantConfig } from "@intentius/chant/config";
|
|
114
|
+
// Brings the \`forgejo\` key into ChantConfig (chant #1344).
|
|
115
|
+
import "@intentius/chant-lexicon-forgejo";
|
|
114
116
|
|
|
115
117
|
export default {
|
|
116
118
|
lexicons: ["forgejo"],
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The documented `chant.config.ts` example compiles (#1344).
|
|
3
|
+
*
|
|
4
|
+
* It did not: `ChantConfig` is a closed interface, so `satisfies ChantConfig`
|
|
5
|
+
* on a config carrying a `forgejo` key was `error TS2353: Object literal may
|
|
6
|
+
* only specify known properties`. The lexicon augments `ChantConfig` with the
|
|
7
|
+
* type derived from its own schema, so importing the package — which a project
|
|
8
|
+
* configuring forgejo does anyway — brings the key into the interface.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { describe, test, expect } from "vitest";
|
|
12
|
+
import type { ChantConfig } from "@intentius/chant/config";
|
|
13
|
+
import { forgejoConfigSchema, type ForgejoConfig } from "./config";
|
|
14
|
+
|
|
15
|
+
describe("the forgejo config namespace (#1344)", () => {
|
|
16
|
+
test("the documented example typechecks as a ChantConfig", () => {
|
|
17
|
+
// The compile-time assertion is the point; the runtime one keeps vitest happy.
|
|
18
|
+
const config = {
|
|
19
|
+
lexicons: ["forgejo"],
|
|
20
|
+
forgejo: {
|
|
21
|
+
runnerLabels: { "ubuntu-latest": "docker", "ubuntu-22.04": "ubuntu-lts" },
|
|
22
|
+
actionsRoot: "https://code.forgejo.org",
|
|
23
|
+
},
|
|
24
|
+
} satisfies ChantConfig;
|
|
25
|
+
expect(config.forgejo.actionsRoot).toBe("https://code.forgejo.org");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("an empty namespace is valid — every key is optional", () => {
|
|
29
|
+
expect(forgejoConfigSchema.safeParse({}).success).toBe(true);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test("the schema accepts the documented shape", () => {
|
|
33
|
+
const parsed = forgejoConfigSchema.safeParse({
|
|
34
|
+
runnerLabels: { "ubuntu-latest": "docker" },
|
|
35
|
+
actionsRoot: "https://code.forgejo.org",
|
|
36
|
+
});
|
|
37
|
+
expect(parsed.success).toBe(true);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("a typo is rejected rather than silently defaulted", () => {
|
|
41
|
+
// `runnerLabel` used to be accepted and ignored: the dialect fell back to
|
|
42
|
+
// its defaults and said nothing.
|
|
43
|
+
const parsed = forgejoConfigSchema.strict().safeParse({ runnerLabel: { a: "b" } });
|
|
44
|
+
expect(parsed.success).toBe(false);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("a wrong value type is rejected", () => {
|
|
48
|
+
expect(forgejoConfigSchema.safeParse({ actionsRoot: 42 }).success).toBe(false);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test("the exported type is derived from the schema, not written twice", () => {
|
|
52
|
+
const value: ForgejoConfig = { actionsRoot: "https://example.test" };
|
|
53
|
+
expect(forgejoConfigSchema.safeParse(value).success).toBe(true);
|
|
54
|
+
});
|
|
55
|
+
});
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `forgejo` namespace in `chant.config.ts` (#1344).
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* import type { ChantConfig } from "@intentius/chant/config";
|
|
6
|
+
* import "@intentius/chant-lexicon-forgejo"; // brings the `forgejo` key into ChantConfig
|
|
7
|
+
*
|
|
8
|
+
* export default {
|
|
9
|
+
* lexicons: ["forgejo"],
|
|
10
|
+
* forgejo: {
|
|
11
|
+
* runnerLabels: { "ubuntu-latest": "docker" },
|
|
12
|
+
* actionsRoot: "https://code.forgejo.org",
|
|
13
|
+
* },
|
|
14
|
+
* } satisfies ChantConfig;
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* One schema, three consumers: core validates the namespace against it at load,
|
|
18
|
+
* the type below is derived from it, and that derived type is what augments
|
|
19
|
+
* `ChantConfig` — so an unknown key fails at build time and at compile time for
|
|
20
|
+
* the same reason, rather than being silently ignored at both.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { z } from "zod";
|
|
24
|
+
import type { ChantConfig } from "@intentius/chant/config";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* `strictObject`, not `object`. Core applies `.strict()` to the top level of a
|
|
28
|
+
* declared namespace itself, but nested objects are the lexicon's own to make
|
|
29
|
+
* strict — and `runnerLabels` is exactly where a typo would otherwise land.
|
|
30
|
+
*/
|
|
31
|
+
export const forgejoConfigSchema = z.strictObject({
|
|
32
|
+
/**
|
|
33
|
+
* GitHub-hosted runner label → Forgejo label. A label with no mapping falls
|
|
34
|
+
* back to the default Forgejo label and is flagged by WFJ011.
|
|
35
|
+
*/
|
|
36
|
+
runnerLabels: z.record(z.string(), z.string()).optional(),
|
|
37
|
+
/** Root the common `actions/*` refs are rewritten under. */
|
|
38
|
+
actionsRoot: z.string().optional(),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export type ForgejoConfig = z.infer<typeof forgejoConfigSchema>;
|
|
42
|
+
|
|
43
|
+
declare module "@intentius/chant/config" {
|
|
44
|
+
interface ChantConfig {
|
|
45
|
+
forgejo?: ForgejoConfig;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Compile-time proof that the augmentation above reaches `ChantConfig` (#1344).
|
|
51
|
+
*
|
|
52
|
+
* Without it this line is `Property 'forgejo' does not exist on type
|
|
53
|
+
* 'ChantConfig'` — which is exactly the error a user's `chant.config.ts` got.
|
|
54
|
+
* It lives here rather than in a test because the root tsconfig excludes test
|
|
55
|
+
* files from typechecking, so a compile-time claim asserted in one is checked
|
|
56
|
+
* by nothing.
|
|
57
|
+
*/
|
|
58
|
+
export type ForgejoConfigNamespace = NonNullable<ChantConfig["forgejo"]>;
|
package/src/index.ts
CHANGED
|
@@ -48,3 +48,9 @@ export {
|
|
|
48
48
|
// Reuse the entire github authoring surface: generated entities, expression
|
|
49
49
|
// system, context variables, and composites.
|
|
50
50
|
export * from "@intentius/chant-lexicon-github";
|
|
51
|
+
|
|
52
|
+
// The `forgejo` chant.config namespace (#1344). Exported as a type and, by
|
|
53
|
+
// virtue of this module being part of the program, as the `ChantConfig`
|
|
54
|
+
// augmentation that makes `forgejo: { … }` typecheck in a project config.
|
|
55
|
+
export { forgejoConfigSchema } from "./config";
|
|
56
|
+
export type { ForgejoConfig } from "./config";
|
package/src/plugin.ts
CHANGED
|
@@ -21,12 +21,14 @@ import { generateForgejoPipeline } from "./components/generate-pipeline";
|
|
|
21
21
|
import { forgejoLintRules } from "./lint/rules/delegate-to-github";
|
|
22
22
|
import { forgejoCompletions } from "./lsp/completions";
|
|
23
23
|
import { forgejoHover } from "./lsp/hover";
|
|
24
|
+
import { forgejoConfigSchema } from "./config";
|
|
24
25
|
|
|
25
26
|
const reuseNote =
|
|
26
27
|
"forgejo reuses the github lexicon's entities — run `chant generate` in the github lexicon instead.";
|
|
27
28
|
|
|
28
29
|
export const forgejoPlugin: LexiconPlugin = {
|
|
29
30
|
name: "forgejo",
|
|
31
|
+
configSchema: forgejoConfigSchema,
|
|
30
32
|
auditCatalog: () => forgejoAuditCatalog,
|
|
31
33
|
serializer: forgejoSerializer,
|
|
32
34
|
|