@workflow-cannon/workspace-kit 0.3.0 → 0.4.1
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/README.md +3 -3
- package/dist/cli.js +115 -3
- package/dist/contracts/index.d.ts +1 -1
- package/dist/contracts/module-contract.d.ts +14 -0
- package/dist/core/config-cli.d.ts +6 -0
- package/dist/core/config-cli.js +479 -0
- package/dist/core/config-metadata.d.ts +35 -0
- package/dist/core/config-metadata.js +162 -0
- package/dist/core/config-mutations.d.ts +18 -0
- package/dist/core/config-mutations.js +32 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.js +5 -0
- package/dist/core/policy.d.ts +34 -0
- package/dist/core/policy.js +135 -0
- package/dist/core/workspace-kit-config.d.ts +57 -0
- package/dist/core/workspace-kit-config.js +266 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/modules/task-engine/index.js +15 -3
- package/dist/modules/workspace-config/index.d.ts +2 -0
- package/dist/modules/workspace-config/index.js +100 -0
- package/package.json +1 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { explainConfigPath, normalizeConfigForExport, resolveWorkspaceConfigWithLayers } from "../../core/workspace-kit-config.js";
|
|
2
|
+
async function handleExplainConfig(args, ctx) {
|
|
3
|
+
const pathArg = typeof args.path === "string" ? args.path.trim() : "";
|
|
4
|
+
if (!pathArg) {
|
|
5
|
+
return {
|
|
6
|
+
ok: false,
|
|
7
|
+
code: "invalid-config-path",
|
|
8
|
+
message: "explain-config requires string 'path' (dot-separated, e.g. tasks.storeRelativePath)"
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const invocationConfig = typeof args.config === "object" && args.config !== null && !Array.isArray(args.config)
|
|
12
|
+
? args.config
|
|
13
|
+
: {};
|
|
14
|
+
const { layers } = await resolveWorkspaceConfigWithLayers({
|
|
15
|
+
workspacePath: ctx.workspacePath,
|
|
16
|
+
registry: ctx.registry,
|
|
17
|
+
invocationConfig
|
|
18
|
+
});
|
|
19
|
+
const explained = explainConfigPath(pathArg, layers);
|
|
20
|
+
return {
|
|
21
|
+
ok: true,
|
|
22
|
+
code: "config-explained",
|
|
23
|
+
data: explained
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
async function handleResolveConfig(args, ctx) {
|
|
27
|
+
const invocationConfig = typeof args.config === "object" && args.config !== null && !Array.isArray(args.config)
|
|
28
|
+
? args.config
|
|
29
|
+
: {};
|
|
30
|
+
const { effective, layers } = await resolveWorkspaceConfigWithLayers({
|
|
31
|
+
workspacePath: ctx.workspacePath,
|
|
32
|
+
registry: ctx.registry,
|
|
33
|
+
invocationConfig
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
ok: true,
|
|
37
|
+
code: "config-resolved",
|
|
38
|
+
data: {
|
|
39
|
+
effective: normalizeConfigForExport(effective),
|
|
40
|
+
layers: layers.map((l) => ({ id: l.id }))
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export const workspaceConfigModule = {
|
|
45
|
+
registration: {
|
|
46
|
+
id: "workspace-config",
|
|
47
|
+
version: "0.4.0",
|
|
48
|
+
contractVersion: "1",
|
|
49
|
+
capabilities: ["diagnostics"],
|
|
50
|
+
dependsOn: [],
|
|
51
|
+
enabledByDefault: true,
|
|
52
|
+
config: {
|
|
53
|
+
path: "src/modules/workspace-config/config.md",
|
|
54
|
+
format: "md",
|
|
55
|
+
description: "Workspace config registry and explain surface."
|
|
56
|
+
},
|
|
57
|
+
state: {
|
|
58
|
+
path: "src/modules/workspace-config/state.md",
|
|
59
|
+
format: "md",
|
|
60
|
+
description: "Workspace config module runtime state (none)."
|
|
61
|
+
},
|
|
62
|
+
instructions: {
|
|
63
|
+
directory: "src/modules/workspace-config/instructions",
|
|
64
|
+
entries: [
|
|
65
|
+
{
|
|
66
|
+
name: "explain-config",
|
|
67
|
+
file: "explain-config.md",
|
|
68
|
+
description: "Agent-first JSON: effective config value and winning layer for a dotted path."
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "resolve-config",
|
|
72
|
+
file: "resolve-config.md",
|
|
73
|
+
description: "Agent-first JSON: full effective config (sorted) and merge layer ids."
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
async onCommand(command, ctx) {
|
|
79
|
+
const reg = ctx.moduleRegistry;
|
|
80
|
+
if (!reg) {
|
|
81
|
+
return {
|
|
82
|
+
ok: false,
|
|
83
|
+
code: "internal-error",
|
|
84
|
+
message: "workspace-config requires moduleRegistry on context (CLI wiring)"
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const baseCtx = { workspacePath: ctx.workspacePath, registry: reg };
|
|
88
|
+
if (command.name === "explain-config") {
|
|
89
|
+
return handleExplainConfig(command.args ?? {}, baseCtx);
|
|
90
|
+
}
|
|
91
|
+
if (command.name === "resolve-config") {
|
|
92
|
+
return handleResolveConfig(command.args ?? {}, baseCtx);
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
ok: false,
|
|
96
|
+
code: "unknown-command",
|
|
97
|
+
message: `workspace-config: unknown command '${command.name}'`
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
};
|