create-byan-agent 2.12.0 → 2.13.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/_byan/mcp/byan-mcp-server/LICENSE +21 -0
- package/_byan/mcp/byan-mcp-server/README.md +56 -0
- package/_byan/mcp/byan-mcp-server/lib/cli.js +108 -0
- package/_byan/mcp/byan-mcp-server/lib/copilot.js +148 -0
- package/_byan/mcp/byan-mcp-server/lib/dispatch.js +23 -0
- package/_byan/mcp/byan-mcp-server/lib/fd-state.js +163 -0
- package/_byan/mcp/byan-mcp-server/lib/kanban.js +226 -0
- package/_byan/mcp/byan-mcp-server/lib/peer-review.js +187 -0
- package/_byan/mcp/byan-mcp-server/lib/soul.js +64 -0
- package/_byan/mcp/byan-mcp-server/lib/workflow-edges.js +105 -0
- package/_byan/mcp/byan-mcp-server/lib/workflow-nodes.js +93 -0
- package/_byan/mcp/byan-mcp-server/lib/workflow-scripts.js +156 -0
- package/_byan/mcp/byan-mcp-server/package.json +43 -0
- package/_byan/mcp/byan-mcp-server/server.js +1277 -0
- package/install/bin/create-byan-agent-v2.js +30 -3
- package/package.json +7 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow node scripts — thin wrapper over byan_web REST endpoints.
|
|
3
|
+
*
|
|
4
|
+
* Wraps :
|
|
5
|
+
* GET /api/workflow-nodes/:nodeId/scripts
|
|
6
|
+
* GET /api/scripts/:id
|
|
7
|
+
* POST /api/workflow-nodes/:nodeId/scripts
|
|
8
|
+
* PATCH /api/scripts/:id
|
|
9
|
+
* DELETE /api/scripts/:id
|
|
10
|
+
* GET /api/scripts/:id/history
|
|
11
|
+
* POST /api/scripts/:id/rollback
|
|
12
|
+
* POST /api/workflow-nodes/:nodeId/scripts/import
|
|
13
|
+
* POST /api/scripts/validate
|
|
14
|
+
*
|
|
15
|
+
* `apiRequest` is injected so tests can pass a mock without an HTTP round-trip.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export const ALLOWED_LANGUAGES = ['bash', 'python', 'javascript', 'typescript'];
|
|
19
|
+
export const ALLOWED_EXEC_MODES = ['context', 'local'];
|
|
20
|
+
|
|
21
|
+
function encodeId(id) {
|
|
22
|
+
if (!id || typeof id !== 'string') throw new Error('id must be a non-empty string');
|
|
23
|
+
return encodeURIComponent(id);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function unwrap(body) {
|
|
27
|
+
if (body && typeof body === 'object' && 'data' in body) return body.data;
|
|
28
|
+
return body;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export async function listScripts({ apiRequest, nodeId }) {
|
|
32
|
+
if (!nodeId) throw new Error('nodeId is required');
|
|
33
|
+
const body = await apiRequest(`/api/workflow-nodes/${encodeId(nodeId)}/scripts`);
|
|
34
|
+
return { data: body.data || [], total: body.total ?? (body.data || []).length };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export async function getScript({ apiRequest, id }) {
|
|
38
|
+
const body = await apiRequest(`/api/scripts/${encodeId(id)}`);
|
|
39
|
+
return unwrap(body);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function createScript({
|
|
43
|
+
apiRequest,
|
|
44
|
+
nodeId,
|
|
45
|
+
name,
|
|
46
|
+
language,
|
|
47
|
+
content,
|
|
48
|
+
execution_mode,
|
|
49
|
+
order_idx,
|
|
50
|
+
bypassValidation,
|
|
51
|
+
}) {
|
|
52
|
+
if (!nodeId) throw new Error('nodeId is required');
|
|
53
|
+
if (!name) throw new Error('name is required');
|
|
54
|
+
if (!ALLOWED_LANGUAGES.includes(language)) {
|
|
55
|
+
throw new Error(`language must be one of ${ALLOWED_LANGUAGES.join(', ')}, got ${language}`);
|
|
56
|
+
}
|
|
57
|
+
if (typeof content !== 'string') throw new Error('content (string) is required');
|
|
58
|
+
|
|
59
|
+
const payload = { name, language, content };
|
|
60
|
+
if (execution_mode !== undefined) payload.execution_mode = execution_mode;
|
|
61
|
+
if (order_idx !== undefined) payload.order_idx = order_idx;
|
|
62
|
+
if (bypassValidation === true) payload.bypassValidation = true;
|
|
63
|
+
|
|
64
|
+
const body = await apiRequest(`/api/workflow-nodes/${encodeId(nodeId)}/scripts`, {
|
|
65
|
+
method: 'POST',
|
|
66
|
+
body: JSON.stringify(payload),
|
|
67
|
+
});
|
|
68
|
+
return unwrap(body);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export async function updateScript({
|
|
72
|
+
apiRequest,
|
|
73
|
+
id,
|
|
74
|
+
expected_version,
|
|
75
|
+
name,
|
|
76
|
+
language,
|
|
77
|
+
content,
|
|
78
|
+
execution_mode,
|
|
79
|
+
order_idx,
|
|
80
|
+
bypassValidation,
|
|
81
|
+
}) {
|
|
82
|
+
const payload = {};
|
|
83
|
+
if (expected_version !== undefined) payload.expected_version = expected_version;
|
|
84
|
+
if (name !== undefined) payload.name = name;
|
|
85
|
+
if (language !== undefined) {
|
|
86
|
+
if (!ALLOWED_LANGUAGES.includes(language)) {
|
|
87
|
+
throw new Error(`language must be one of ${ALLOWED_LANGUAGES.join(', ')}, got ${language}`);
|
|
88
|
+
}
|
|
89
|
+
payload.language = language;
|
|
90
|
+
}
|
|
91
|
+
if (content !== undefined) payload.content = content;
|
|
92
|
+
if (execution_mode !== undefined) payload.execution_mode = execution_mode;
|
|
93
|
+
if (order_idx !== undefined) payload.order_idx = order_idx;
|
|
94
|
+
if (bypassValidation === true) payload.bypassValidation = true;
|
|
95
|
+
|
|
96
|
+
const body = await apiRequest(`/api/scripts/${encodeId(id)}`, {
|
|
97
|
+
method: 'PATCH',
|
|
98
|
+
body: JSON.stringify(payload),
|
|
99
|
+
});
|
|
100
|
+
return unwrap(body);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export async function deleteScript({ apiRequest, id }) {
|
|
104
|
+
const body = await apiRequest(`/api/scripts/${encodeId(id)}`, { method: 'DELETE' });
|
|
105
|
+
return unwrap(body);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export async function getScriptHistory({ apiRequest, id }) {
|
|
109
|
+
const body = await apiRequest(`/api/scripts/${encodeId(id)}/history`);
|
|
110
|
+
return { data: body.data || [], total: body.total ?? (body.data || []).length };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export async function rollbackScript({ apiRequest, id, version }) {
|
|
114
|
+
if (!Number.isInteger(version) || version < 1) {
|
|
115
|
+
throw new Error('version must be a positive integer');
|
|
116
|
+
}
|
|
117
|
+
const body = await apiRequest(`/api/scripts/${encodeId(id)}/rollback`, {
|
|
118
|
+
method: 'POST',
|
|
119
|
+
body: JSON.stringify({ version }),
|
|
120
|
+
});
|
|
121
|
+
return unwrap(body);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export async function importScript({
|
|
125
|
+
apiRequest,
|
|
126
|
+
nodeId,
|
|
127
|
+
url,
|
|
128
|
+
name,
|
|
129
|
+
language,
|
|
130
|
+
execution_mode,
|
|
131
|
+
}) {
|
|
132
|
+
if (!nodeId) throw new Error('nodeId is required');
|
|
133
|
+
if (!url) throw new Error('url is required');
|
|
134
|
+
const payload = { url };
|
|
135
|
+
if (name !== undefined) payload.name = name;
|
|
136
|
+
if (language !== undefined) payload.language = language;
|
|
137
|
+
if (execution_mode !== undefined) payload.execution_mode = execution_mode;
|
|
138
|
+
|
|
139
|
+
const body = await apiRequest(`/api/workflow-nodes/${encodeId(nodeId)}/scripts/import`, {
|
|
140
|
+
method: 'POST',
|
|
141
|
+
body: JSON.stringify(payload),
|
|
142
|
+
});
|
|
143
|
+
return unwrap(body);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export async function validateScriptSyntax({ apiRequest, language, content }) {
|
|
147
|
+
if (!ALLOWED_LANGUAGES.includes(language)) {
|
|
148
|
+
throw new Error(`language must be one of ${ALLOWED_LANGUAGES.join(', ')}, got ${language}`);
|
|
149
|
+
}
|
|
150
|
+
if (typeof content !== 'string') throw new Error('content (string) is required');
|
|
151
|
+
const body = await apiRequest('/api/scripts/validate', {
|
|
152
|
+
method: 'POST',
|
|
153
|
+
body: JSON.stringify({ language, content }),
|
|
154
|
+
});
|
|
155
|
+
return unwrap(body);
|
|
156
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "byan-mcp-server",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "BYAN MCP server — exposes byan_web REST API (projects, FD lifecycle, kanban, ELO, fact-check, workflow-node-scripts, peer-review) as Claude Code tools.",
|
|
5
|
+
"main": "server.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"byan-mcp": "./server.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"server.js",
|
|
12
|
+
"lib/",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"start": "node server.js",
|
|
18
|
+
"test": "node --test test/*.test.js"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.29.0"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18.0.0"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"mcp",
|
|
28
|
+
"byan",
|
|
29
|
+
"claude-code",
|
|
30
|
+
"workflow",
|
|
31
|
+
"fd-lifecycle",
|
|
32
|
+
"kanban",
|
|
33
|
+
"elo-trust",
|
|
34
|
+
"fact-check"
|
|
35
|
+
],
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/Les-fous-du-bus/byan_web.git",
|
|
39
|
+
"directory": "_byan/mcp/byan-mcp-server"
|
|
40
|
+
},
|
|
41
|
+
"author": "Yan Acadenice",
|
|
42
|
+
"license": "MIT"
|
|
43
|
+
}
|