@warpgogol/werkstatt-shared 0.8.13 → 0.11.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/package.json +5 -1
- package/src/plugin/plugin-contract.ts +112 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warpgogol/werkstatt-shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
"types": "./src/index.ts",
|
|
19
19
|
"default": "./src/index.ts"
|
|
20
20
|
},
|
|
21
|
+
"./plugin": {
|
|
22
|
+
"types": "./src/plugin/plugin-contract.ts",
|
|
23
|
+
"default": "./src/plugin/plugin-contract.ts"
|
|
24
|
+
},
|
|
21
25
|
"./checks": {
|
|
22
26
|
"types": "./src/checks/index.ts",
|
|
23
27
|
"default": "./src/checks/index.ts"
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Werkstatt plugin contract types (werkstatt/plugin@1). Defines the typed interface
|
|
4
|
+
that a stack plugin implements and registers with the engine (RFC-0770).
|
|
5
|
+
Moved from werkstatt-engine to werkstatt-shared by RFC-0942 extraction — plugin types
|
|
6
|
+
are shared infrastructure, not engine internals.</purpose>
|
|
7
|
+
<non-goals>
|
|
8
|
+
<item>Do not implement plugin logic — only type definitions.</item>
|
|
9
|
+
<item>Do not import from any @warpgogol/* package except werkstatt-engine/kernel/types for KernelModule/KernelPipelineStep.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-0770: initial plugin contract types — WerkstattPlugin, WerkstattPluginHooks, PluginHookContext, HookResult, StackPathConventions, StackInvariant, DeployAdapterFactory.</item>
|
|
14
|
+
<item>RFC-0942: moved from werkstatt-engine/src/plugin-contract.ts to werkstatt-shared/src/plugin/plugin-contract.ts.</item>
|
|
15
|
+
</CHANGE_SUMMARY>
|
|
16
|
+
*/
|
|
17
|
+
import type { KernelModule, KernelPipelineStep } from "@warpgogol/werkstatt-engine/kernel/types";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Placeholder type for deploy adapter factories.
|
|
21
|
+
* Exact shape re-homed by RFC-0772 when the engine package is filled.
|
|
22
|
+
*/
|
|
23
|
+
export type DeployAdapterFactory = unknown;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Context passed to plugin lifecycle hooks.
|
|
27
|
+
*/
|
|
28
|
+
export interface PluginHookContext {
|
|
29
|
+
workspaceRoot: string;
|
|
30
|
+
logger: {
|
|
31
|
+
info(message: string, details?: unknown): void;
|
|
32
|
+
warn(message: string, details?: unknown): void;
|
|
33
|
+
error(message: string, details?: unknown): void;
|
|
34
|
+
};
|
|
35
|
+
workpiecePath?: string;
|
|
36
|
+
missionId?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Result returned by plugin lifecycle hooks.
|
|
41
|
+
*/
|
|
42
|
+
export interface HookResult {
|
|
43
|
+
success: boolean;
|
|
44
|
+
errors?: string[];
|
|
45
|
+
warnings?: string[];
|
|
46
|
+
data?: unknown;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Path conventions for project workspaces.
|
|
51
|
+
*/
|
|
52
|
+
export interface StackPathConventions {
|
|
53
|
+
contentDir: string;
|
|
54
|
+
distDir: string;
|
|
55
|
+
entryPoints: string[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Stack invariants surfaced to agents (AGENTS.md generation, doctor checks).
|
|
60
|
+
*/
|
|
61
|
+
export interface StackInvariant {
|
|
62
|
+
id: string;
|
|
63
|
+
description: string;
|
|
64
|
+
check?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Lifecycle hooks the engine calls at fixed points.
|
|
69
|
+
* The hook list is closed at five hooks (RFC-0770).
|
|
70
|
+
* Adding a new hook requires a superseding RFC, not an amendment.
|
|
71
|
+
*/
|
|
72
|
+
export interface WerkstattPluginHooks {
|
|
73
|
+
/** mission.materialize: scaffold/regenerate the workpiece after authored data injection. */
|
|
74
|
+
materialize?: (ctx: PluginHookContext) => Promise<HookResult>;
|
|
75
|
+
/** Build the workpiece (replaces the hardcoded astro/pnpm build call). */
|
|
76
|
+
build?: (ctx: PluginHookContext) => Promise<HookResult>;
|
|
77
|
+
/** Quality gate after build (site: Axiom; game: engine-specific checks; video: render verify). */
|
|
78
|
+
checkGate?: (ctx: PluginHookContext & {
|
|
79
|
+
baseUrl?: string;
|
|
80
|
+
}) => Promise<HookResult>;
|
|
81
|
+
/** release.prepare: produce behavior snapshots / stack-specific release evidence. */
|
|
82
|
+
releaseEvidence?: (ctx: PluginHookContext) => Promise<HookResult>;
|
|
83
|
+
/** onboarding.scaffold: create a new project workspace of this stack. */
|
|
84
|
+
scaffoldProject?: (ctx: PluginHookContext & {
|
|
85
|
+
projectId: string;
|
|
86
|
+
}) => Promise<HookResult>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The plugin contract (werkstatt/plugin@1).
|
|
91
|
+
* A stack plugin implements this interface and registers it with the engine.
|
|
92
|
+
* One plugin per workshop — the engine refuses to start with zero or multiple.
|
|
93
|
+
*/
|
|
94
|
+
export interface WerkstattPlugin {
|
|
95
|
+
schema: "werkstatt/plugin@1";
|
|
96
|
+
/** Plugin id: "werkstatt-site" | "werkstatt-phaser-game" | "werkstatt-godot-game". */
|
|
97
|
+
id: string;
|
|
98
|
+
/** Forge stack profile id, e.g. "astro-typescript-turborepo". */
|
|
99
|
+
profileId: string;
|
|
100
|
+
/** Kernel modules the plugin contributes (validators, codegen, content, onboarding). */
|
|
101
|
+
moduleLoaders: Record<string, () => Promise<KernelModule>>;
|
|
102
|
+
/** Named pipelines the plugin owns or extends (e.g. build.prepare steps). */
|
|
103
|
+
pipelines?: Record<string, KernelPipelineStep[]>;
|
|
104
|
+
/** Deploy adapters keyed by adapter id (e.g. "cloudflare-workers", "github-pages", "local-render"). */
|
|
105
|
+
deployAdapters?: Record<string, DeployAdapterFactory>;
|
|
106
|
+
/** Lifecycle hooks the engine calls at fixed points. All optional; engine has neutral defaults. */
|
|
107
|
+
hooks?: WerkstattPluginHooks;
|
|
108
|
+
/** Path conventions for project workspaces (content dir, dist dir, entry points). */
|
|
109
|
+
paths: StackPathConventions;
|
|
110
|
+
/** Stack invariants surfaced to agents (AGENTS.md generation, doctor checks). */
|
|
111
|
+
invariants?: StackInvariant[];
|
|
112
|
+
}
|