@intentius/chant-lexicon-forgejo 0.6.0 → 0.8.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/actions.d.ts +49 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/dialect.d.ts +57 -0
- package/dist/dialect.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lint/post-synth/index.d.ts +3 -0
- package/dist/lint/post-synth/index.d.ts.map +1 -0
- package/dist/lint/post-synth/wfj010.d.ts +12 -0
- package/dist/lint/post-synth/wfj010.d.ts.map +1 -0
- package/dist/lint/post-synth/wfj011.d.ts +11 -0
- package/dist/lint/post-synth/wfj011.d.ts.map +1 -0
- package/dist/mcp/context-tools.d.ts +23 -0
- package/dist/mcp/context-tools.d.ts.map +1 -0
- package/dist/migrate/from-github/index.d.ts +48 -0
- package/dist/migrate/from-github/index.d.ts.map +1 -0
- package/dist/migrate/from-github/security.d.ts +60 -0
- package/dist/migrate/from-github/security.d.ts.map +1 -0
- package/dist/plugin.d.ts +12 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/serializer.d.ts +20 -0
- package/dist/serializer.d.ts.map +1 -0
- package/package.json +22 -5
- package/src/lint/post-synth/index.ts +9 -0
- package/src/mcp/context-tools.ts +3 -5
- package/src/plugin.ts +2 -3
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forgejo `uses:` action-reference resolver.
|
|
3
|
+
*
|
|
4
|
+
* GitHub Actions resolves a bare `uses: actions/checkout@v4` against the GitHub
|
|
5
|
+
* Marketplace. Forgejo / Codeberg / Gitea runners have no Marketplace, so such a
|
|
6
|
+
* ref must be rewritten to a form their runner can fetch — a full repository URL,
|
|
7
|
+
* or a path under a configured actions root that mirrors the action.
|
|
8
|
+
*
|
|
9
|
+
* The resolver rewrites a built-in set of common actions and reports anything it
|
|
10
|
+
* can't place as a diagnostic (never dropping or silently passing it through).
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Default actions root. `code.forgejo.org` hosts the Forgejo `actions/*` mirror
|
|
14
|
+
* (checkout, setup-*, cache, upload/download-artifact, …). Override per project
|
|
15
|
+
* via `forgejo.actionsRoot` in `chant.config.ts`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const DEFAULT_ACTIONS_ROOT = "https://code.forgejo.org";
|
|
18
|
+
/**
|
|
19
|
+
* Where a known action resolves:
|
|
20
|
+
* - `mirror`: `<actionsRoot>/<repo>` — follows the configured actions root.
|
|
21
|
+
* - `url`: an absolute base URL — independent of the actions root (used for
|
|
22
|
+
* actions not carried by the Forgejo mirror, e.g. `docker/*`).
|
|
23
|
+
*/
|
|
24
|
+
export type ActionTarget = {
|
|
25
|
+
kind: "mirror";
|
|
26
|
+
repo: string;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "url";
|
|
29
|
+
url: string;
|
|
30
|
+
};
|
|
31
|
+
/** Built-in mapping of GitHub action `owner/repo` → Forgejo-resolvable target. */
|
|
32
|
+
export declare const KNOWN_ACTIONS: Record<string, ActionTarget>;
|
|
33
|
+
export interface ActionResolveOptions {
|
|
34
|
+
/** Base for `mirror` targets; defaults to {@link DEFAULT_ACTIONS_ROOT}. */
|
|
35
|
+
actionsRoot?: string;
|
|
36
|
+
/** Mapping table to use; defaults to {@link KNOWN_ACTIONS}. */
|
|
37
|
+
known?: Record<string, ActionTarget>;
|
|
38
|
+
}
|
|
39
|
+
export interface ActionResolveResult {
|
|
40
|
+
/** The rewritten (or unchanged) `uses:` ref. */
|
|
41
|
+
rewritten: string;
|
|
42
|
+
/** Set when the ref could not be resolved — surfaced as a build warning. */
|
|
43
|
+
warning?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Resolve a single `uses:` action ref to a Forgejo-resolvable form.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveActionRef(ref: string, options?: ActionResolveOptions): ActionResolveResult;
|
|
49
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,6BAA6B,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3F,kFAAkF;AAClF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAkBtD,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,mBAAmB;IAClC,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAaD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,mBAAmB,CA2BrG"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forgejo dialect transform.
|
|
3
|
+
*
|
|
4
|
+
* Forgejo Actions (the engine behind Codeberg, self-hosted Forgejo, and Gitea)
|
|
5
|
+
* runs GitHub-Actions-compatible YAML, so the github lexicon's serializer emits
|
|
6
|
+
* the right shape. The dialect differs in three small ways, all handled here as
|
|
7
|
+
* a pre-pass over the resolved entity graph before the github serializer runs:
|
|
8
|
+
*
|
|
9
|
+
* 1. `permissions` and `continue-on-error` are silently ignored by the Forgejo
|
|
10
|
+
* runner — we drop them from the output and warn per occurrence.
|
|
11
|
+
* 2. GitHub-hosted runner labels (`ubuntu-latest`, …) have no fixed meaning on
|
|
12
|
+
* Forgejo — we map them to a default Forgejo label, overridable per project.
|
|
13
|
+
* 3. Anything we can't place (an unmapped runner label) passes through with a
|
|
14
|
+
* warning rather than being dropped.
|
|
15
|
+
*
|
|
16
|
+
* Operating on the entity graph (rather than string-munging YAML) keeps the
|
|
17
|
+
* transform faithful: the github serializer still does the actual emission.
|
|
18
|
+
*/
|
|
19
|
+
import { type Declarable } from "@intentius/chant/declarable";
|
|
20
|
+
/**
|
|
21
|
+
* Default GitHub-hosted runner label → Forgejo label mapping. `docker` is the
|
|
22
|
+
* label a freshly-registered Forgejo `act_runner` exposes, and the one used
|
|
23
|
+
* throughout the Forgejo Actions docs, so it is the safest default target.
|
|
24
|
+
* Override per project via `forgejo.runnerLabels` in `chant.config.ts`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const DEFAULT_RUNNER_LABELS: Record<string, string>;
|
|
27
|
+
export interface ForgejoDialectOptions {
|
|
28
|
+
/** Project-supplied label overrides, merged over {@link DEFAULT_RUNNER_LABELS}. */
|
|
29
|
+
runnerLabels?: Record<string, string>;
|
|
30
|
+
/** Base for resolving mirrored `uses:` action refs (see ./actions). */
|
|
31
|
+
actionsRoot?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ForgejoDialectResult {
|
|
34
|
+
/** The transformed entity map (clones; originals are not mutated). */
|
|
35
|
+
entities: Map<string, Declarable>;
|
|
36
|
+
/** One warning per dropped key and per unmapped runner label. */
|
|
37
|
+
warnings: string[];
|
|
38
|
+
}
|
|
39
|
+
export interface TransformObjectResult {
|
|
40
|
+
/** The transformed plain value (clone; the input is not mutated). */
|
|
41
|
+
value: unknown;
|
|
42
|
+
/** One warning per dropped key, unmapped label, and unresolved action ref. */
|
|
43
|
+
warnings: string[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Apply the Forgejo dialect to a plain object — e.g. a parsed GitHub Actions
|
|
47
|
+
* workflow during migration, rather than the resolved entity graph. Same
|
|
48
|
+
* rules as {@link applyForgejoDialect}: drop ignored keys, remap runner
|
|
49
|
+
* labels, resolve `uses:` refs.
|
|
50
|
+
*/
|
|
51
|
+
export declare function transformWorkflowObject(obj: unknown, options?: ForgejoDialectOptions): TransformObjectResult;
|
|
52
|
+
/**
|
|
53
|
+
* Apply the Forgejo dialect to a resolved entity map. Returns transformed
|
|
54
|
+
* clones plus the diagnostics produced (dropped keys, unmapped labels).
|
|
55
|
+
*/
|
|
56
|
+
export declare function applyForgejoDialect(entities: Map<string, Declarable>, options?: ForgejoDialectOptions): ForgejoDialectResult;
|
|
57
|
+
//# sourceMappingURL=dialect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialect.d.ts","sourceRoot":"","sources":["../src/dialect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAgBjF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAKxD,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,mFAAmF;IACnF,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,sEAAsE;IACtE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAClC,iEAAiE;IACjE,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAuFD,MAAM,WAAW,qBAAqB;IACpC,qEAAqE;IACrE,KAAK,EAAE,OAAO,CAAC;IACf,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,OAAO,EACZ,OAAO,GAAE,qBAA0B,GAClC,qBAAqB,CAKvB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EACjC,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CAWtB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { forgejoSerializer } from "./serializer.js";
|
|
2
|
+
export { forgejoPlugin } from "./plugin.js";
|
|
3
|
+
export { applyForgejoDialect, transformWorkflowObject, DEFAULT_RUNNER_LABELS, type ForgejoDialectOptions, type ForgejoDialectResult, type TransformObjectResult, } from "./dialect.js";
|
|
4
|
+
export { transform, detectGitHubWorkflow, type MigrateOptions, type MigrationResult, } from "./migrate/from-github/index.js";
|
|
5
|
+
export { analyzeForgejoSecurity, renderSecurityPosture, type SecurityFate, type SecurityRecord, } from "./migrate/from-github/security.js";
|
|
6
|
+
export { resolveActionRef, DEFAULT_ACTIONS_ROOT, KNOWN_ACTIONS, type ActionTarget, type ActionResolveOptions, type ActionResolveResult, } from "./actions.js";
|
|
7
|
+
export * from "@intentius/chant-lexicon-github";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,GAC3B,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,WAAW,CAAC;AAInB,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAIvE,eAAO,MAAM,eAAe,EAAE,cAAc,EAG3C,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WFJ010: Unresolved action reference.
|
|
3
|
+
*
|
|
4
|
+
* After the forgejo dialect runs, every `uses:` should be a Forgejo-resolvable
|
|
5
|
+
* form (a full URL, a local `./` action, or `docker://`). A bare `owner/repo@ref`
|
|
6
|
+
* that survives into the output won't resolve — Forgejo has no GitHub
|
|
7
|
+
* Marketplace. Flags it so it's caught in `chant lint` / `forgejo:checks`, not
|
|
8
|
+
* only as a build-time warning.
|
|
9
|
+
*/
|
|
10
|
+
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
11
|
+
export declare const wfj010: PostSynthCheck;
|
|
12
|
+
//# sourceMappingURL=wfj010.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wfj010.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/wfj010.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAK9G,eAAO,MAAM,MAAM,EAAE,cAsBpB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WFJ011: GitHub-hosted runner label.
|
|
3
|
+
*
|
|
4
|
+
* `runs-on` labels like `macos-latest` / `windows-latest` name GitHub-hosted
|
|
5
|
+
* runners that don't exist on Forgejo, and `ubuntu-*` labels that the dialect
|
|
6
|
+
* didn't map (e.g. when mapping is overridden away) won't be advertised by a
|
|
7
|
+
* default Forgejo runner. Flags any such label that survives into the output.
|
|
8
|
+
*/
|
|
9
|
+
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
10
|
+
export declare const wfj011: PostSynthCheck;
|
|
11
|
+
//# sourceMappingURL=wfj011.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wfj011.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/wfj011.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAO9G,eAAO,MAAM,MAAM,EAAE,cAwBpB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only MCP tools for the forgejo lexicon.
|
|
3
|
+
*
|
|
4
|
+
* The forgejo counterpart to the github/gitlab context tools (#327): expose
|
|
5
|
+
* what `chant build` already computes about a Forgejo workflow — its triggers
|
|
6
|
+
* and jobs, what it pulls in from outside, its findings, where each job came
|
|
7
|
+
* from in source — plus `forgejo:compare`, the migration safety view. Because
|
|
8
|
+
* Forgejo emits GitHub-style YAML, the parsing reuses the github lexicon's
|
|
9
|
+
* yaml-helpers.
|
|
10
|
+
*
|
|
11
|
+
* Every tool builds from source and returns data. None touch a live forge,
|
|
12
|
+
* read run history, or write anything.
|
|
13
|
+
*/
|
|
14
|
+
import type { McpToolContribution } from "@intentius/chant/mcp/types";
|
|
15
|
+
/** Is a `uses:` ref pinned to a full commit SHA (the only immutable form)? */
|
|
16
|
+
export declare function actionPinned(ref: string): boolean;
|
|
17
|
+
/** The YAML job name a build entity serializes to (camelCase → kebab-case). */
|
|
18
|
+
export declare function jobNameOf(entityName: string): string;
|
|
19
|
+
/** Jobs that would re-run because they depend (transitively) on `job`. */
|
|
20
|
+
export declare function downstreamJobs(yaml: string, job: string): string[];
|
|
21
|
+
/** The read-only context tools for the forgejo lexicon. */
|
|
22
|
+
export declare function forgejoContextTools(): McpToolContribution[];
|
|
23
|
+
//# sourceMappingURL=context-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-tools.d.ts","sourceRoot":"","sources":["../../src/mcp/context-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AA6BtE,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGjD;AAED,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEpD;AAkBD,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAsBlE;AAkBD,2DAA2D;AAC3D,wBAAgB,mBAAmB,IAAI,mBAAmB,EAAE,CAgJ3D"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* github → forgejo migration entry point.
|
|
3
|
+
*
|
|
4
|
+
* Thin by design: Forgejo Actions YAML *is* GitHub Actions YAML, so the
|
|
5
|
+
* migration applies the same dialect as a `chant build` (drop ignored keys,
|
|
6
|
+
* resolve `uses:` refs, map runner labels) and emits the result. No stage
|
|
7
|
+
* inference, job→script rewrite, or `!reference` intrinsic like the gitlab
|
|
8
|
+
* migration needs. The differentiated value is the security-fate **compare**
|
|
9
|
+
* (see ./security).
|
|
10
|
+
*/
|
|
11
|
+
import type { LintDiagnostic } from "@intentius/chant/lint/rule";
|
|
12
|
+
import { type SecurityRecord } from "./security.js";
|
|
13
|
+
export interface MigrateOptions {
|
|
14
|
+
/** Output format. Defaults to "yaml". */
|
|
15
|
+
emit?: "yaml" | "ts";
|
|
16
|
+
/** Source file path (display only). */
|
|
17
|
+
sourceFile?: string;
|
|
18
|
+
/** Escalate needs-review/lost findings to errors. */
|
|
19
|
+
strict?: boolean;
|
|
20
|
+
/** Accepted for parity with the core MigrationSource contract; forgejo
|
|
21
|
+
* always runs the (cheap) security analysis. */
|
|
22
|
+
security?: boolean;
|
|
23
|
+
/** Accepted for parity; forgejo has no composite rewriter. */
|
|
24
|
+
useComposites?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface MigrationResult {
|
|
27
|
+
/** Rendered output (forgejo YAML by default, chant TS when emit: "ts"). */
|
|
28
|
+
output: string;
|
|
29
|
+
/** Per-property security-fate records. */
|
|
30
|
+
provenance: SecurityRecord[];
|
|
31
|
+
/** SARIF-shaped diagnostics derived from the records. */
|
|
32
|
+
diagnostics: LintDiagnostic[];
|
|
33
|
+
/** Markdown "Security posture" section. */
|
|
34
|
+
securityPosture: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Migrate a GitHub Actions workflow into a Forgejo workflow.
|
|
38
|
+
*
|
|
39
|
+
* @param content raw .github/workflows/*.yml content
|
|
40
|
+
* @param opts migration options
|
|
41
|
+
*/
|
|
42
|
+
export declare function transform(content: string, opts?: MigrateOptions): Promise<MigrationResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Lightweight detector: does this content look like a GitHub Actions workflow?
|
|
45
|
+
* Used by the plugin's `migrationSource("github")`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function detectGitHubWorkflow(content: string): boolean;
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrate/from-github/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;qDACiD;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,yDAAyD;IACzD,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,2CAA2C;IAC3C,eAAe,EAAE,MAAM,CAAC;CACzB;AAyBD;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,eAAe,CAAC,CAkBpG;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAG7D"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security-fate model for the github → forgejo migration edge.
|
|
3
|
+
*
|
|
4
|
+
* github → forgejo YAML is near-identical, so the migration itself is thin. The
|
|
5
|
+
* differentiated value is the **compare**: classifying what survives the move
|
|
6
|
+
* and what Forgejo silently drops. Most properties translate verbatim; the
|
|
7
|
+
* useful findings are the keys the Forgejo runner ignores (`permissions`,
|
|
8
|
+
* `continue-on-error` → `lost`) plus refs/labels that need attention
|
|
9
|
+
* (unresolved `uses:`, unmapped runner labels → `needs-review`).
|
|
10
|
+
*
|
|
11
|
+
* Mirrors the gitlab lexicon's fate model (translated / approximated /
|
|
12
|
+
* needs-review / lost) but for the Forgejo edge — kept local so the forgejo
|
|
13
|
+
* lexicon does not depend on the gitlab one.
|
|
14
|
+
*/
|
|
15
|
+
import type { LintDiagnostic } from "@intentius/chant/lint/rule";
|
|
16
|
+
export type SecurityFate = "translated" | "approximated" | "needs-review" | "lost";
|
|
17
|
+
export interface SecurityProvenance {
|
|
18
|
+
/** Human label for the property (e.g. "Least-privilege permissions"). */
|
|
19
|
+
property: string;
|
|
20
|
+
/** What happened to the property as it crossed the github → forgejo edge. */
|
|
21
|
+
fate: SecurityFate;
|
|
22
|
+
/** Diagnostic severity for this finding. */
|
|
23
|
+
severity: "error" | "warning" | "info";
|
|
24
|
+
/** How to re-establish the property on Forgejo, when it doesn't carry. */
|
|
25
|
+
reestablish?: string;
|
|
26
|
+
}
|
|
27
|
+
/** A migration provenance record carrying a security classification. */
|
|
28
|
+
export interface SecurityRecord {
|
|
29
|
+
/** YAML-ish path in the source (e.g. "jobs.build.steps[1].uses"). */
|
|
30
|
+
sourceKey: string;
|
|
31
|
+
/** Source file name (for diagnostics). */
|
|
32
|
+
sourceFile?: string;
|
|
33
|
+
/** Functional category (forgejo migration only emits security records). */
|
|
34
|
+
category: "needs-review" | "skipped" | "synthesis";
|
|
35
|
+
/** Rule ID (MIG-FJ-*). */
|
|
36
|
+
rule: string;
|
|
37
|
+
/** Human-readable explanation. */
|
|
38
|
+
note?: string;
|
|
39
|
+
/** Security classification. */
|
|
40
|
+
security: SecurityProvenance;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Classify the fate of security-relevant properties in a parsed GitHub Actions
|
|
44
|
+
* workflow as it migrates to Forgejo. Walks the source object so occurrence
|
|
45
|
+
* counts (and paths) are precise.
|
|
46
|
+
*/
|
|
47
|
+
export declare function analyzeForgejoSecurity(workflow: unknown, opts?: {
|
|
48
|
+
sourceFile?: string;
|
|
49
|
+
}): SecurityRecord[];
|
|
50
|
+
/**
|
|
51
|
+
* Convert security records into SARIF-shaped diagnostics. Security findings
|
|
52
|
+
* always emit a diagnostic at their severity, escalated to `error` under
|
|
53
|
+
* `--strict` when the property was lost or needs review.
|
|
54
|
+
*/
|
|
55
|
+
export declare function provenanceToDiagnostics(records: SecurityRecord[], opts?: {
|
|
56
|
+
strict?: boolean;
|
|
57
|
+
}): LintDiagnostic[];
|
|
58
|
+
/** Render a "Security posture" Markdown section from the security records. */
|
|
59
|
+
export declare function renderSecurityPosture(records: SecurityRecord[]): string;
|
|
60
|
+
//# sourceMappingURL=security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../../src/migrate/from-github/security.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAIjE,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,cAAc,GAAG,cAAc,GAAG,MAAM,CAAC;AAEnF,MAAM,WAAW,kBAAkB;IACjC,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,IAAI,EAAE,YAAY,CAAC;IACnB,4CAA4C;IAC5C,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACvC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wEAAwE;AACxE,MAAM,WAAW,cAAc;IAC7B,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,QAAQ,EAAE,cAAc,GAAG,SAAS,GAAG,WAAW,CAAC;IACnD,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,QAAQ,EAAE,kBAAkB,CAAC;CAC9B;AAMD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,OAAO,EACjB,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACjC,cAAc,EAAE,CA6ElB;AAQD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,cAAc,EAAE,EACzB,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAC9B,cAAc,EAAE,CAYlB;AASD,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,MAAM,CAmBvE"}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forgejo Actions lexicon plugin.
|
|
3
|
+
*
|
|
4
|
+
* Forgejo runs GitHub-Actions-compatible workflows, so this lexicon is a thin
|
|
5
|
+
* dialect of the github lexicon: it reuses github's generated entities and
|
|
6
|
+
* composites wholesale (re-exported from ./index) and overrides only the
|
|
7
|
+
* serializer. There is no own spec, so the codegen lifecycle methods are
|
|
8
|
+
* intentionally no-ops — they delegate the real work to the github lexicon.
|
|
9
|
+
*/
|
|
10
|
+
import type { LexiconPlugin } from "@intentius/chant/lexicon";
|
|
11
|
+
export declare const forgejoPlugin: LexiconPlugin;
|
|
12
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +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;AAWhG,eAAO,MAAM,aAAa,EAAE,aAsJ3B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forgejo Actions YAML serializer.
|
|
3
|
+
*
|
|
4
|
+
* A thin dialect of the github serializer: it applies the Forgejo dialect
|
|
5
|
+
* (see ./dialect) to the entity graph, then delegates emission to the github
|
|
6
|
+
* serializer, which already produces GitHub-Actions-compatible YAML — exactly
|
|
7
|
+
* what Forgejo / Codeberg / Gitea runners execute.
|
|
8
|
+
*
|
|
9
|
+
* The serializer's `name` is "github" on purpose: github-lexicon entities are
|
|
10
|
+
* tagged `lexicon: "github"`, and the build pipeline partitions and looks up
|
|
11
|
+
* serializers by that tag. A forgejo project loads only this serializer, so it
|
|
12
|
+
* claims that partition. The distinct `rulePrefix` ("WFJ") keeps Forgejo lint
|
|
13
|
+
* diagnostics namespaced apart from github's "GHA".
|
|
14
|
+
*/
|
|
15
|
+
import type { Serializer } from "@intentius/chant/serializer";
|
|
16
|
+
/**
|
|
17
|
+
* Forgejo Actions YAML serializer implementation.
|
|
18
|
+
*/
|
|
19
|
+
export declare const forgejoSerializer: Serializer;
|
|
20
|
+
//# sourceMappingURL=serializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAsC,MAAM,6BAA6B,CAAC;AAoBlG;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,UAsB/B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-forgejo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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",
|
|
@@ -31,8 +31,21 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"exports": {
|
|
34
|
-
".":
|
|
35
|
-
|
|
34
|
+
".": {
|
|
35
|
+
"development": "./src/index.ts",
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"default": "./src/index.ts"
|
|
38
|
+
},
|
|
39
|
+
"./*": {
|
|
40
|
+
"development": "./src/*.ts",
|
|
41
|
+
"types": "./dist/*.d.ts",
|
|
42
|
+
"default": "./src/*.ts"
|
|
43
|
+
},
|
|
44
|
+
"./lint/post-synth": {
|
|
45
|
+
"development": "./src/lint/post-synth/index.ts",
|
|
46
|
+
"types": "./dist/lint/post-synth/index.d.ts",
|
|
47
|
+
"default": "./src/lint/post-synth/index.ts"
|
|
48
|
+
}
|
|
36
49
|
},
|
|
37
50
|
"devDependencies": {
|
|
38
51
|
"@intentius/chant": "*",
|
|
@@ -40,7 +53,11 @@
|
|
|
40
53
|
"typescript": "^5.9.3"
|
|
41
54
|
},
|
|
42
55
|
"peerDependencies": {
|
|
43
|
-
"@intentius/chant": "^0.
|
|
44
|
-
"@intentius/chant-lexicon-github": "^0.
|
|
56
|
+
"@intentius/chant": "^0.8.0",
|
|
57
|
+
"@intentius/chant-lexicon-github": "^0.8.0"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && find dist -type f \\( -name \"*.js\" -o -name \"*.js.map\" \\) -delete",
|
|
61
|
+
"prepack": "npm run build"
|
|
45
62
|
}
|
|
46
63
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Code generated by chant generate. DO NOT EDIT.
|
|
2
|
+
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
3
|
+
import { wfj010 } from "./wfj010";
|
|
4
|
+
import { wfj011 } from "./wfj011";
|
|
5
|
+
|
|
6
|
+
export const postSynthChecks: PostSynthCheck[] = [
|
|
7
|
+
wfj010,
|
|
8
|
+
wfj011,
|
|
9
|
+
];
|
package/src/mcp/context-tools.ts
CHANGED
|
@@ -14,12 +14,11 @@
|
|
|
14
14
|
|
|
15
15
|
import { build, type BuildResult } from "@intentius/chant/build";
|
|
16
16
|
import { runPostSynthChecks, getPrimaryOutput } from "@intentius/chant/lint/post-synth";
|
|
17
|
-
import {
|
|
17
|
+
import { postSynthChecks } from "../lint/post-synth";
|
|
18
18
|
import { getProvenance } from "@intentius/chant/provenance";
|
|
19
19
|
import type { McpToolContribution } from "@intentius/chant/mcp/types";
|
|
20
|
-
import {
|
|
20
|
+
import { relative, isAbsolute, resolve } from "path";
|
|
21
21
|
import { readFile } from "fs/promises";
|
|
22
|
-
import { fileURLToPath } from "url";
|
|
23
22
|
import {
|
|
24
23
|
extractJobs,
|
|
25
24
|
extractActionRefs,
|
|
@@ -43,8 +42,7 @@ async function buildForgejo(path: string): Promise<{ yaml: string; result: Build
|
|
|
43
42
|
|
|
44
43
|
/** Discover the forgejo post-synth checks without depending on the plugin. */
|
|
45
44
|
function forgejoPostSynthChecks() {
|
|
46
|
-
|
|
47
|
-
return discoverPostSynthChecks(dir, import.meta.url);
|
|
45
|
+
return postSynthChecks;
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
/** Is a `uses:` ref pinned to a full commit SHA (the only immutable form)? */
|
package/src/plugin.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { LexiconPlugin, InitTemplateSet, MigrationSource } from "@intentius/chant/lexicon";
|
|
12
|
-
import {
|
|
12
|
+
import { postSynthChecks as postSynthCheckList } from "./lint/post-synth";
|
|
13
13
|
import { createSkillsLoader, createDiffTool } from "@intentius/chant/lexicon-plugin-helpers";
|
|
14
14
|
import { join, dirname } from "path";
|
|
15
15
|
import { fileURLToPath } from "url";
|
|
@@ -122,8 +122,7 @@ export const build = new Job({
|
|
|
122
122
|
},
|
|
123
123
|
|
|
124
124
|
postSynthChecks() {
|
|
125
|
-
|
|
126
|
-
return discoverPostSynthChecks(dir, import.meta.url);
|
|
125
|
+
return postSynthCheckList;
|
|
127
126
|
},
|
|
128
127
|
|
|
129
128
|
mcpTools() {
|