berg-pages 0.1.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/LICENSE +183 -0
  3. package/README.md +93 -0
  4. package/dist/adapters/local-deploy-execution-ports.d.ts +12 -0
  5. package/dist/adapters/local-deploy-execution-ports.js +81 -0
  6. package/dist/adapters/local-environment-probe.d.ts +5 -0
  7. package/dist/adapters/local-environment-probe.js +54 -0
  8. package/dist/adapters/local-init-apply-ports.d.ts +10 -0
  9. package/dist/adapters/local-init-apply-ports.js +47 -0
  10. package/dist/adapters/local-project-inspector.d.ts +4 -0
  11. package/dist/adapters/local-project-inspector.js +184 -0
  12. package/dist/application/contracts/plugins/deploy-mode-plugin.d.ts +20 -0
  13. package/dist/application/contracts/plugins/deploy-mode-plugin.js +1 -0
  14. package/dist/application/contracts/plugins/framework-plugin.d.ts +19 -0
  15. package/dist/application/contracts/plugins/framework-plugin.js +1 -0
  16. package/dist/application/contracts/ports/environment-probe-port.d.ts +4 -0
  17. package/dist/application/contracts/ports/environment-probe-port.js +1 -0
  18. package/dist/application/contracts/ports/project-inspector-port.d.ts +28 -0
  19. package/dist/application/contracts/ports/project-inspector-port.js +1 -0
  20. package/dist/application/contracts/project-context.d.ts +6 -0
  21. package/dist/application/contracts/project-context.js +1 -0
  22. package/dist/application/index.d.ts +11 -0
  23. package/dist/application/index.js +11 -0
  24. package/dist/application/usecases/apply-deploy-plan.d.ts +8 -0
  25. package/dist/application/usecases/apply-deploy-plan.js +100 -0
  26. package/dist/application/usecases/apply-init-plan.d.ts +13 -0
  27. package/dist/application/usecases/apply-init-plan.js +65 -0
  28. package/dist/application/usecases/build-deploy-plan.d.ts +9 -0
  29. package/dist/application/usecases/build-deploy-plan.js +177 -0
  30. package/dist/application/usecases/build-doctor-plan.d.ts +9 -0
  31. package/dist/application/usecases/build-doctor-plan.js +235 -0
  32. package/dist/application/usecases/build-init-plan.d.ts +9 -0
  33. package/dist/application/usecases/build-init-plan.js +140 -0
  34. package/dist/application/usecases/create-project-context.d.ts +8 -0
  35. package/dist/application/usecases/create-project-context.js +168 -0
  36. package/dist/application/usecases/workflow-diagnostics.d.ts +13 -0
  37. package/dist/application/usecases/workflow-diagnostics.js +137 -0
  38. package/dist/core/diagnostics/diagnostic.d.ts +11 -0
  39. package/dist/core/diagnostics/diagnostic.js +1 -0
  40. package/dist/core/entities/command.d.ts +1 -0
  41. package/dist/core/entities/command.js +1 -0
  42. package/dist/core/entities/deploy-mode.d.ts +6 -0
  43. package/dist/core/entities/deploy-mode.js +1 -0
  44. package/dist/core/entities/environment.d.ts +16 -0
  45. package/dist/core/entities/environment.js +1 -0
  46. package/dist/core/entities/framework.d.ts +8 -0
  47. package/dist/core/entities/framework.js +1 -0
  48. package/dist/core/entities/pages-target.d.ts +22 -0
  49. package/dist/core/entities/pages-target.js +1 -0
  50. package/dist/core/entities/project.d.ts +45 -0
  51. package/dist/core/entities/project.js +1 -0
  52. package/dist/core/index.d.ts +13 -0
  53. package/dist/core/index.js +13 -0
  54. package/dist/core/plans/assumption.d.ts +7 -0
  55. package/dist/core/plans/assumption.js +1 -0
  56. package/dist/core/plans/build-plan.d.ts +12 -0
  57. package/dist/core/plans/build-plan.js +1 -0
  58. package/dist/core/plans/command-plan.d.ts +27 -0
  59. package/dist/core/plans/command-plan.js +45 -0
  60. package/dist/core/plans/deploy-plan.d.ts +17 -0
  61. package/dist/core/plans/deploy-plan.js +1 -0
  62. package/dist/core/plans/plan-step.d.ts +59 -0
  63. package/dist/core/plans/plan-step.js +1 -0
  64. package/dist/core/plans/template-plan.d.ts +11 -0
  65. package/dist/core/plans/template-plan.js +1 -0
  66. package/dist/features/deployment-modes/git-pages-deploy-mode-plugin.d.ts +12 -0
  67. package/dist/features/deployment-modes/git-pages-deploy-mode-plugin.js +49 -0
  68. package/dist/features/frameworks/astro-framework-plugin.d.ts +36 -0
  69. package/dist/features/frameworks/astro-framework-plugin.js +97 -0
  70. package/dist/features/frameworks/static-html-framework-plugin.d.ts +36 -0
  71. package/dist/features/frameworks/static-html-framework-plugin.js +94 -0
  72. package/dist/features/frameworks/vite-framework-plugin.d.ts +36 -0
  73. package/dist/features/frameworks/vite-framework-plugin.js +97 -0
  74. package/dist/index.d.ts +2 -0
  75. package/dist/index.js +2 -0
  76. package/dist/interfaces/cli/main.d.ts +2 -0
  77. package/dist/interfaces/cli/main.js +157 -0
  78. package/dist/interfaces/cli/render-command-plan.d.ts +2 -0
  79. package/dist/interfaces/cli/render-command-plan.js +87 -0
  80. package/docs/CANARY.md +117 -0
  81. package/docs/COMPATIBILITY.md +88 -0
  82. package/docs/DEPLOY-SAFETY.md +113 -0
  83. package/package.json +83 -0
@@ -0,0 +1,59 @@
1
+ import type { DeployModeId } from "../entities/deploy-mode.js";
2
+ import type { PagesTarget } from "../entities/pages-target.js";
3
+ import type { AssumptionStatus } from "./assumption.js";
4
+ export interface PlanStepBase {
5
+ id: string;
6
+ title: string;
7
+ detail?: string;
8
+ }
9
+ export interface VerifyStep extends PlanStepBase {
10
+ kind: "verify";
11
+ subject: string;
12
+ status: AssumptionStatus;
13
+ expected?: string;
14
+ }
15
+ export interface EnsureDirectoryStep extends PlanStepBase {
16
+ kind: "ensure-directory";
17
+ path: string;
18
+ reason: string;
19
+ }
20
+ export interface WriteFileStep extends PlanStepBase {
21
+ kind: "write-file";
22
+ path: string;
23
+ content: string;
24
+ mode: "create" | "overwrite" | "merge";
25
+ reason: string;
26
+ }
27
+ export interface DeleteFileStep extends PlanStepBase {
28
+ kind: "delete-file";
29
+ path: string;
30
+ reason: string;
31
+ }
32
+ export interface RunCommandStep extends PlanStepBase {
33
+ kind: "run-command";
34
+ executable: string;
35
+ args: string[];
36
+ cwd?: string;
37
+ reason: string;
38
+ }
39
+ export interface PublishSiteStep extends PlanStepBase {
40
+ kind: "publish-site";
41
+ modeId: DeployModeId;
42
+ targetKind: PagesTarget["kind"];
43
+ outputDir: string;
44
+ sourcePath: string;
45
+ destination: string;
46
+ remote: string;
47
+ branch: string;
48
+ force: boolean;
49
+ operations: string[];
50
+ }
51
+ export interface NoteStep extends PlanStepBase {
52
+ kind: "note";
53
+ category: "framework" | "deployment" | "docs" | "setup";
54
+ message: string;
55
+ }
56
+ export type PlanStep = VerifyStep | EnsureDirectoryStep | WriteFileStep | DeleteFileStep | RunCommandStep | PublishSiteStep | NoteStep;
57
+ export type BuildPlanStep = RunCommandStep | VerifyStep | NoteStep;
58
+ export type DeployPlanStep = PublishSiteStep | RunCommandStep | VerifyStep | NoteStep;
59
+ export type TemplatePlanStep = EnsureDirectoryStep | WriteFileStep | DeleteFileStep;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ export type TemplatePlan = {
2
+ kind: "file";
3
+ path: string;
4
+ content: string;
5
+ mode: "create" | "overwrite" | "merge";
6
+ reason: string;
7
+ } | {
8
+ kind: "directory";
9
+ path: string;
10
+ reason: string;
11
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { DeployExecutionPorts, DeployModePlugin } from "../../application/contracts/plugins/deploy-mode-plugin.js";
2
+ import type { Diagnostic } from "../../core/diagnostics/diagnostic.js";
3
+ import type { PagesTarget } from "../../core/entities/pages-target.js";
4
+ import type { Project } from "../../core/entities/project.js";
5
+ import type { DeployPlan, DeployResult } from "../../core/plans/deploy-plan.js";
6
+ export declare class GitPagesDeployModePlugin implements DeployModePlugin {
7
+ readonly id = "git-pages";
8
+ supports(target: PagesTarget): boolean;
9
+ getDiagnostics(project: Project): Diagnostic[];
10
+ getDeployPlan(project: Project): DeployPlan;
11
+ execute(_plan: DeployPlan, _ports: DeployExecutionPorts): Promise<DeployResult>;
12
+ }
@@ -0,0 +1,49 @@
1
+ export class GitPagesDeployModePlugin {
2
+ id = "git-pages";
3
+ supports(target) {
4
+ return target.kind === "codeberg-project";
5
+ }
6
+ getDiagnostics(project) {
7
+ if (project.pages.target && !this.supports(project.pages.target)) {
8
+ return [
9
+ {
10
+ code: "deploy-mode.git-pages.unsupported-target",
11
+ severity: "warning",
12
+ summary: "The git-pages deployment mode only supports Codeberg project Pages in M2.",
13
+ detail: "This first slice is intentionally limited to one Codeberg project-site path.",
14
+ suggestions: [
15
+ "Use a Codeberg project Pages target for the M2 slice.",
16
+ "Delay broader target support until after init --apply and deploy exist."
17
+ ],
18
+ source: "deploy-mode-plugin"
19
+ }
20
+ ];
21
+ }
22
+ return [];
23
+ }
24
+ getDeployPlan(project) {
25
+ return {
26
+ modeId: this.id,
27
+ summary: "Publish the generated site through the planned git-pages workflow.",
28
+ ...(project.pages.target ? { target: project.pages.target } : {}),
29
+ assumptions: project.pages.target
30
+ ? [
31
+ {
32
+ code: "deploy.git-pages.target",
33
+ summary: "The git-pages deployment target is known.",
34
+ status: "confirmed",
35
+ detail: `Target URL: ${project.pages.target.url}`
36
+ }
37
+ ]
38
+ : [],
39
+ diagnostics: [],
40
+ steps: []
41
+ };
42
+ }
43
+ async execute(_plan, _ports) {
44
+ return {
45
+ appliedStepIds: [],
46
+ diagnostics: []
47
+ };
48
+ }
49
+ }
@@ -0,0 +1,36 @@
1
+ import type { FrameworkPlugin } from "../../application/contracts/plugins/framework-plugin.js";
2
+ import type { DetectionResult } from "../../application/contracts/plugins/framework-plugin.js";
3
+ import type { ProjectContext } from "../../application/contracts/project-context.js";
4
+ import type { Project } from "../../core/entities/project.js";
5
+ import type { Diagnostic } from "../../core/diagnostics/diagnostic.js";
6
+ export declare class AstroFrameworkPlugin implements FrameworkPlugin {
7
+ readonly id = "astro";
8
+ detect(context: ProjectContext): Promise<DetectionResult>;
9
+ getBuildPlan(project: Project): {
10
+ frameworkId: string;
11
+ summary: string;
12
+ outputDir: string;
13
+ assumptions: {
14
+ code: string;
15
+ summary: string;
16
+ status: "confirmed";
17
+ detail: string;
18
+ }[];
19
+ diagnostics: never[];
20
+ steps: never[];
21
+ };
22
+ getInitTemplates(project: Project): ({
23
+ kind: "directory";
24
+ path: string;
25
+ reason: string;
26
+ mode?: never;
27
+ content?: never;
28
+ } | {
29
+ kind: "file";
30
+ path: string;
31
+ mode: "create";
32
+ reason: string;
33
+ content: string;
34
+ })[];
35
+ getDiagnostics(project: Project): Diagnostic[];
36
+ }
@@ -0,0 +1,97 @@
1
+ export class AstroFrameworkPlugin {
2
+ id = "astro";
3
+ async detect(context) {
4
+ const detectedConfigFiles = context.project.paths.detectedConfigFiles ?? [];
5
+ const hasAstroConfig = detectedConfigFiles.some((file) => file.startsWith("astro.config."));
6
+ return {
7
+ matches: context.project.framework?.id === this.id || hasAstroConfig,
8
+ confidence: hasAstroConfig ? "high" : context.project.framework?.id === this.id ? "medium" : "low",
9
+ reasons: hasAstroConfig ? ["Detected Astro config file in the project root."] : [],
10
+ ...(context.project.framework?.id === this.id || hasAstroConfig
11
+ ? { detectedFrameworkId: this.id }
12
+ : {})
13
+ };
14
+ }
15
+ getBuildPlan(project) {
16
+ const outputDir = project.paths.buildOutputDir ?? "dist";
17
+ return {
18
+ frameworkId: this.id,
19
+ summary: "Build the site with Astro and publish the generated dist directory.",
20
+ outputDir,
21
+ assumptions: [
22
+ {
23
+ code: "framework.astro.output-dir",
24
+ summary: "Astro writes static builds to dist by default.",
25
+ status: "confirmed",
26
+ detail: `Expected output directory: ${outputDir}`
27
+ }
28
+ ],
29
+ diagnostics: [],
30
+ steps: []
31
+ };
32
+ }
33
+ getInitTemplates(project) {
34
+ const targetUrl = project.pages.target?.url ?? "https://example.codeberg.page/project/";
35
+ const basePath = project.pages.target?.kind === "codeberg-project"
36
+ ? project.pages.target.basePath
37
+ : `/${project.repository.name}/`;
38
+ return [
39
+ {
40
+ kind: "directory",
41
+ path: ".forgejo/workflows",
42
+ reason: "Forgejo workflow files are stored under .forgejo/workflows."
43
+ },
44
+ {
45
+ kind: "file",
46
+ path: ".forgejo/workflows/pages.yml",
47
+ mode: "create",
48
+ reason: "Add the planned git-pages workflow for an Astro project on Codeberg Pages.",
49
+ content: [
50
+ "name: pages",
51
+ "",
52
+ "on:",
53
+ " push:",
54
+ " branches:",
55
+ " - main",
56
+ "",
57
+ "jobs:",
58
+ " build:",
59
+ " runs-on: ubuntu-latest",
60
+ " steps:",
61
+ " - name: Checkout",
62
+ " uses: actions/checkout@v4",
63
+ " - name: Setup Node",
64
+ " uses: actions/setup-node@v4",
65
+ " with:",
66
+ " node-version: 20",
67
+ " - name: Install dependencies",
68
+ " run: npm ci",
69
+ " - name: Build site",
70
+ " run: npm run build",
71
+ " env:",
72
+ ` BERG_PAGES_BASE_PATH: ${basePath}`,
73
+ " - name: Publish preview",
74
+ ` run: echo \"Publish dist to ${targetUrl} via git-pages\"`,
75
+ ""
76
+ ].join("\n")
77
+ }
78
+ ];
79
+ }
80
+ getDiagnostics(project) {
81
+ const diagnostics = [];
82
+ if (project.framework?.id === this.id && !project.paths.detectedConfigFiles?.some((file) => file.startsWith("astro.config."))) {
83
+ diagnostics.push({
84
+ code: "framework.astro.config.missing",
85
+ severity: "warning",
86
+ summary: "The project is marked as Astro, but no Astro config file was detected.",
87
+ detail: "M11 can detect Astro from package signals, but an Astro config gives stronger confirmation.",
88
+ suggestions: [
89
+ "Check for an astro.config file.",
90
+ "Confirm package.json dependencies and scripts if the config is intentionally absent."
91
+ ],
92
+ source: "framework-plugin"
93
+ });
94
+ }
95
+ return diagnostics;
96
+ }
97
+ }
@@ -0,0 +1,36 @@
1
+ import type { FrameworkPlugin } from "../../application/contracts/plugins/framework-plugin.js";
2
+ import type { DetectionResult } from "../../application/contracts/plugins/framework-plugin.js";
3
+ import type { ProjectContext } from "../../application/contracts/project-context.js";
4
+ import type { Project } from "../../core/entities/project.js";
5
+ import type { Diagnostic } from "../../core/diagnostics/diagnostic.js";
6
+ export declare class StaticHtmlFrameworkPlugin implements FrameworkPlugin {
7
+ readonly id = "static-html";
8
+ detect(context: ProjectContext): Promise<DetectionResult>;
9
+ getBuildPlan(project: Project): {
10
+ frameworkId: string;
11
+ summary: string;
12
+ outputDir: string;
13
+ assumptions: {
14
+ code: string;
15
+ summary: string;
16
+ status: "confirmed" | "unverified";
17
+ detail: string;
18
+ }[];
19
+ diagnostics: never[];
20
+ steps: never[];
21
+ };
22
+ getInitTemplates(project: Project): ({
23
+ kind: "directory";
24
+ path: string;
25
+ reason: string;
26
+ mode?: never;
27
+ content?: never;
28
+ } | {
29
+ kind: "file";
30
+ path: string;
31
+ mode: "create";
32
+ reason: string;
33
+ content: string;
34
+ })[];
35
+ getDiagnostics(project: Project): Diagnostic[];
36
+ }
@@ -0,0 +1,94 @@
1
+ export class StaticHtmlFrameworkPlugin {
2
+ id = "static-html";
3
+ async detect(context) {
4
+ const outputDir = resolveStaticOutputDir(context.project);
5
+ return {
6
+ matches: context.project.framework?.id === this.id || outputDir !== undefined,
7
+ confidence: context.project.framework?.id === this.id ? "medium" : outputDir ? "medium" : "low",
8
+ reasons: outputDir ? [`Detected static publish directory: ${outputDir}.`] : [],
9
+ ...(context.project.framework?.id === this.id || outputDir
10
+ ? { detectedFrameworkId: this.id }
11
+ : {})
12
+ };
13
+ }
14
+ getBuildPlan(project) {
15
+ const outputDir = project.paths.buildOutputDir ?? resolveStaticOutputDir(project) ?? "public";
16
+ return {
17
+ frameworkId: this.id,
18
+ summary: "Publish an existing plain static HTML directory without running a build.",
19
+ outputDir,
20
+ assumptions: [
21
+ {
22
+ code: "framework.static-html.output-dir",
23
+ summary: "Plain static sites publish an existing output directory.",
24
+ status: project.paths.buildOutputDirExists === true ? "confirmed" : "unverified",
25
+ detail: `Expected static output directory: ${outputDir}`
26
+ }
27
+ ],
28
+ diagnostics: [],
29
+ steps: []
30
+ };
31
+ }
32
+ getInitTemplates(project) {
33
+ const outputDir = project.paths.buildOutputDir ?? resolveStaticOutputDir(project) ?? "public";
34
+ const targetUrl = project.pages.target?.url ?? "https://example.codeberg.page/project/";
35
+ return [
36
+ {
37
+ kind: "directory",
38
+ path: ".forgejo/workflows",
39
+ reason: "Forgejo workflow files are stored under .forgejo/workflows."
40
+ },
41
+ {
42
+ kind: "file",
43
+ path: ".forgejo/workflows/pages.yml",
44
+ mode: "create",
45
+ reason: "Add the planned git-pages workflow for a plain static site on Codeberg Pages.",
46
+ content: [
47
+ "name: pages",
48
+ "",
49
+ "on:",
50
+ " push:",
51
+ " branches:",
52
+ " - main",
53
+ "",
54
+ "jobs:",
55
+ " publish:",
56
+ " runs-on: ubuntu-latest",
57
+ " steps:",
58
+ " - name: Checkout",
59
+ " uses: actions/checkout@v4",
60
+ " - name: Publish static site",
61
+ ` run: echo \"Publish ${outputDir} to ${targetUrl} via git-pages\"`,
62
+ ""
63
+ ].join("\n")
64
+ }
65
+ ];
66
+ }
67
+ getDiagnostics(project) {
68
+ if (!project.paths.buildOutputDir) {
69
+ return [
70
+ {
71
+ code: "framework.static-html.output-dir.missing",
72
+ severity: "warning",
73
+ summary: "No plain static publish directory was detected.",
74
+ detail: "M10 static support expects a publishable dist or public directory.",
75
+ suggestions: [
76
+ "Create a public directory for hand-written static HTML.",
77
+ "Create a dist directory if the site is already built elsewhere."
78
+ ],
79
+ source: "framework-plugin"
80
+ }
81
+ ];
82
+ }
83
+ return [];
84
+ }
85
+ }
86
+ function resolveStaticOutputDir(project) {
87
+ if (project.paths.detectedBuildOutputDirs?.includes("dist")) {
88
+ return "dist";
89
+ }
90
+ if (project.paths.detectedBuildOutputDirs?.includes("public")) {
91
+ return "public";
92
+ }
93
+ return undefined;
94
+ }
@@ -0,0 +1,36 @@
1
+ import type { FrameworkPlugin } from "../../application/contracts/plugins/framework-plugin.js";
2
+ import type { ProjectContext } from "../../application/contracts/project-context.js";
3
+ import type { Project } from "../../core/entities/project.js";
4
+ import type { DetectionResult } from "../../application/contracts/plugins/framework-plugin.js";
5
+ import type { Diagnostic } from "../../core/diagnostics/diagnostic.js";
6
+ export declare class ViteFrameworkPlugin implements FrameworkPlugin {
7
+ readonly id = "vite";
8
+ detect(context: ProjectContext): Promise<DetectionResult>;
9
+ getBuildPlan(project: Project): {
10
+ frameworkId: string;
11
+ summary: string;
12
+ outputDir: string;
13
+ assumptions: {
14
+ code: string;
15
+ summary: string;
16
+ status: "confirmed";
17
+ detail: string;
18
+ }[];
19
+ diagnostics: never[];
20
+ steps: never[];
21
+ };
22
+ getInitTemplates(project: Project): ({
23
+ kind: "directory";
24
+ path: string;
25
+ reason: string;
26
+ mode?: never;
27
+ content?: never;
28
+ } | {
29
+ kind: "file";
30
+ path: string;
31
+ mode: "create";
32
+ reason: string;
33
+ content: string;
34
+ })[];
35
+ getDiagnostics(project: Project): Diagnostic[];
36
+ }
@@ -0,0 +1,97 @@
1
+ export class ViteFrameworkPlugin {
2
+ id = "vite";
3
+ async detect(context) {
4
+ const detectedConfigFiles = context.project.paths.detectedConfigFiles ?? [];
5
+ const hasViteConfig = detectedConfigFiles.some((file) => file.startsWith("vite.config."));
6
+ return {
7
+ matches: context.project.framework?.id === this.id || hasViteConfig,
8
+ confidence: hasViteConfig ? "high" : context.project.framework?.id === this.id ? "medium" : "low",
9
+ reasons: hasViteConfig ? ["Detected Vite config file in the project root."] : [],
10
+ ...(context.project.framework?.id === this.id || hasViteConfig
11
+ ? { detectedFrameworkId: this.id }
12
+ : {})
13
+ };
14
+ }
15
+ getBuildPlan(project) {
16
+ const outputDir = project.paths.buildOutputDir ?? "dist";
17
+ return {
18
+ frameworkId: this.id,
19
+ summary: "Build the site with Vite and publish the generated dist directory.",
20
+ outputDir,
21
+ assumptions: [
22
+ {
23
+ code: "framework.vite.output-dir",
24
+ summary: "Vite writes the built site to dist.",
25
+ status: "confirmed",
26
+ detail: `Expected output directory: ${outputDir}`
27
+ }
28
+ ],
29
+ diagnostics: [],
30
+ steps: []
31
+ };
32
+ }
33
+ getInitTemplates(project) {
34
+ const targetUrl = project.pages.target?.url ?? "https://example.codeberg.page/project/";
35
+ const basePath = project.pages.target?.kind === "codeberg-project"
36
+ ? project.pages.target.basePath
37
+ : `/${project.repository.name}/`;
38
+ return [
39
+ {
40
+ kind: "directory",
41
+ path: ".forgejo/workflows",
42
+ reason: "Forgejo workflow files are stored under .forgejo/workflows."
43
+ },
44
+ {
45
+ kind: "file",
46
+ path: ".forgejo/workflows/pages.yml",
47
+ mode: "create",
48
+ reason: "Add the planned git-pages workflow for a Vite project on Codeberg Pages.",
49
+ content: [
50
+ "name: pages",
51
+ "",
52
+ "on:",
53
+ " push:",
54
+ " branches:",
55
+ " - main",
56
+ "",
57
+ "jobs:",
58
+ " build:",
59
+ " runs-on: ubuntu-latest",
60
+ " steps:",
61
+ " - name: Checkout",
62
+ " uses: actions/checkout@v4",
63
+ " - name: Setup Node",
64
+ " uses: actions/setup-node@v4",
65
+ " with:",
66
+ " node-version: 20",
67
+ " - name: Install dependencies",
68
+ " run: npm ci",
69
+ " - name: Build site",
70
+ " run: npm run build",
71
+ " env:",
72
+ ` BERG_PAGES_BASE_PATH: ${basePath}`,
73
+ " - name: Publish preview",
74
+ ` run: echo \"Publish dist to ${targetUrl} via git-pages\"`,
75
+ ""
76
+ ].join("\n")
77
+ }
78
+ ];
79
+ }
80
+ getDiagnostics(project) {
81
+ const diagnostics = [];
82
+ if (project.framework?.id === this.id && !project.paths.detectedConfigFiles?.some((file) => file.startsWith("vite.config."))) {
83
+ diagnostics.push({
84
+ code: "framework.vite.config.missing",
85
+ severity: "warning",
86
+ summary: "The project is marked as Vite, but no Vite config file was detected.",
87
+ detail: "M2 currently expects a recognizable Vite project shape.",
88
+ suggestions: [
89
+ "Add a vite.config file or adjust framework detection.",
90
+ "Keep the first slice constrained to the supported Vite path."
91
+ ],
92
+ source: "framework-plugin"
93
+ });
94
+ }
95
+ return diagnostics;
96
+ }
97
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./application/index.js";
2
+ export * from "./core/index.js";
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./application/index.js";
2
+ export * from "./core/index.js";
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};