@daileyos/mcp-server 1.21.2 → 1.21.9

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 (164) hide show
  1. package/dist/api.d.ts +7 -0
  2. package/dist/api.d.ts.map +1 -1
  3. package/dist/api.js +23 -2
  4. package/dist/api.js.map +1 -1
  5. package/dist/index.js +24 -17
  6. package/dist/index.js.map +1 -1
  7. package/dist/tools/accounts.d.ts.map +1 -1
  8. package/dist/tools/accounts.js +3 -2
  9. package/dist/tools/accounts.js.map +1 -1
  10. package/dist/tools/ai.d.ts.map +1 -1
  11. package/dist/tools/ai.js +7 -1
  12. package/dist/tools/ai.js.map +1 -1
  13. package/dist/tools/auth.d.ts.map +1 -1
  14. package/dist/tools/auth.js +25 -6
  15. package/dist/tools/auth.js.map +1 -1
  16. package/dist/tools/backups.d.ts.map +1 -1
  17. package/dist/tools/backups.js +3 -1
  18. package/dist/tools/backups.js.map +1 -1
  19. package/dist/tools/build-logs.d.ts.map +1 -1
  20. package/dist/tools/build-logs.js +3 -1
  21. package/dist/tools/build-logs.js.map +1 -1
  22. package/dist/tools/credentials-reveal.d.ts.map +1 -1
  23. package/dist/tools/credentials-reveal.js +3 -1
  24. package/dist/tools/credentials-reveal.js.map +1 -1
  25. package/dist/tools/dailey-images.js +3 -3
  26. package/dist/tools/dailey-images.js.map +1 -1
  27. package/dist/tools/db-migrate.js +5 -5
  28. package/dist/tools/db-migrate.js.map +1 -1
  29. package/dist/tools/db.d.ts.map +1 -1
  30. package/dist/tools/db.js +17 -1
  31. package/dist/tools/db.js.map +1 -1
  32. package/dist/tools/deploy-status.d.ts.map +1 -1
  33. package/dist/tools/deploy-status.js +3 -1
  34. package/dist/tools/deploy-status.js.map +1 -1
  35. package/dist/tools/deploy.d.ts.map +1 -1
  36. package/dist/tools/deploy.js +9 -1
  37. package/dist/tools/deploy.js.map +1 -1
  38. package/dist/tools/domains.d.ts.map +1 -1
  39. package/dist/tools/domains.js +3 -1
  40. package/dist/tools/domains.js.map +1 -1
  41. package/dist/tools/email.d.ts.map +1 -1
  42. package/dist/tools/email.js +8 -2
  43. package/dist/tools/email.js.map +1 -1
  44. package/dist/tools/env.d.ts.map +1 -1
  45. package/dist/tools/env.js +5 -1
  46. package/dist/tools/env.js.map +1 -1
  47. package/dist/tools/environments.js +3 -3
  48. package/dist/tools/environments.js.map +1 -1
  49. package/dist/tools/exec-run.d.ts.map +1 -1
  50. package/dist/tools/exec-run.js +7 -1
  51. package/dist/tools/exec-run.js.map +1 -1
  52. package/dist/tools/images.d.ts.map +1 -1
  53. package/dist/tools/images.js +5 -1
  54. package/dist/tools/images.js.map +1 -1
  55. package/dist/tools/lifecycle.d.ts.map +1 -1
  56. package/dist/tools/lifecycle.js +5 -1
  57. package/dist/tools/lifecycle.js.map +1 -1
  58. package/dist/tools/links.d.ts.map +1 -1
  59. package/dist/tools/links.js +3 -1
  60. package/dist/tools/links.js.map +1 -1
  61. package/dist/tools/platform.d.ts.map +1 -1
  62. package/dist/tools/platform.js +5 -3
  63. package/dist/tools/platform.js.map +1 -1
  64. package/dist/tools/processes.d.ts.map +1 -1
  65. package/dist/tools/processes.js +11 -1
  66. package/dist/tools/processes.js.map +1 -1
  67. package/dist/tools/projects.d.ts.map +1 -1
  68. package/dist/tools/projects.js +36 -12
  69. package/dist/tools/projects.js.map +1 -1
  70. package/dist/tools/resource-config.d.ts.map +1 -1
  71. package/dist/tools/resource-config.js +3 -1
  72. package/dist/tools/resource-config.js.map +1 -1
  73. package/dist/tools/scale.d.ts.map +1 -1
  74. package/dist/tools/scale.js +3 -1
  75. package/dist/tools/scale.js.map +1 -1
  76. package/dist/tools/storage.d.ts.map +1 -1
  77. package/dist/tools/storage.js +11 -1
  78. package/dist/tools/storage.js.map +1 -1
  79. package/dist/tools/support.d.ts.map +1 -1
  80. package/dist/tools/support.js +3 -1
  81. package/dist/tools/support.js.map +1 -1
  82. package/dist/tools/usage.d.ts.map +1 -1
  83. package/dist/tools/usage.js +3 -1
  84. package/dist/tools/usage.js.map +1 -1
  85. package/dist/tools/wordpress-import.d.ts.map +1 -1
  86. package/dist/tools/wordpress-import.js +3 -1
  87. package/dist/tools/wordpress-import.js.map +1 -1
  88. package/dist/tools/wordpress-migrate.d.ts.map +1 -1
  89. package/dist/tools/wordpress-migrate.js +3 -1
  90. package/dist/tools/wordpress-migrate.js.map +1 -1
  91. package/dist/tools/wordpress-snapshot.d.ts.map +1 -1
  92. package/dist/tools/wordpress-snapshot.js +9 -1
  93. package/dist/tools/wordpress-snapshot.js.map +1 -1
  94. package/package.json +10 -2
  95. package/.dockerignore +0 -6
  96. package/.github/workflows/publish.yml +0 -120
  97. package/Dockerfile +0 -19
  98. package/claude-config.json +0 -13
  99. package/docs/superpowers/plans/2026-08-09-remote-mcp-endpoint.md +0 -663
  100. package/docs/superpowers/specs/2026-08-09-remote-mcp-endpoint-design.md +0 -66
  101. package/src/api.ts +0 -263
  102. package/src/context.ts +0 -12
  103. package/src/http.ts +0 -160
  104. package/src/index.ts +0 -94
  105. package/src/server.ts +0 -188
  106. package/src/tools/accounts.ts +0 -119
  107. package/src/tools/addons.ts +0 -124
  108. package/src/tools/admin.ts +0 -42
  109. package/src/tools/ai.ts +0 -83
  110. package/src/tools/analyze.ts +0 -108
  111. package/src/tools/auth.ts +0 -177
  112. package/src/tools/backups.ts +0 -84
  113. package/src/tools/billing.ts +0 -34
  114. package/src/tools/build-logs.ts +0 -65
  115. package/src/tools/bundle.ts +0 -129
  116. package/src/tools/cli.ts +0 -76
  117. package/src/tools/credentials-reveal.ts +0 -64
  118. package/src/tools/credits.ts +0 -97
  119. package/src/tools/dailey-images.ts +0 -151
  120. package/src/tools/db-migrate.ts +0 -211
  121. package/src/tools/db.ts +0 -391
  122. package/src/tools/deploy-status.ts +0 -247
  123. package/src/tools/deploy.ts +0 -101
  124. package/src/tools/diagnose.ts +0 -567
  125. package/src/tools/domains.ts +0 -156
  126. package/src/tools/email.ts +0 -101
  127. package/src/tools/env.ts +0 -205
  128. package/src/tools/environments.ts +0 -138
  129. package/src/tools/exec-run.ts +0 -91
  130. package/src/tools/images.ts +0 -221
  131. package/src/tools/lifecycle.ts +0 -75
  132. package/src/tools/links.ts +0 -69
  133. package/src/tools/platform.ts +0 -209
  134. package/src/tools/processes.ts +0 -182
  135. package/src/tools/project-transfer.ts +0 -129
  136. package/src/tools/projects.ts +0 -287
  137. package/src/tools/resource-config.ts +0 -84
  138. package/src/tools/scale.ts +0 -33
  139. package/src/tools/storage.ts +0 -281
  140. package/src/tools/support.ts +0 -42
  141. package/src/tools/usage.ts +0 -128
  142. package/src/tools/wordpress-import.ts +0 -174
  143. package/src/tools/wordpress-live-edit.ts +0 -250
  144. package/src/tools/wordpress-migrate.ts +0 -104
  145. package/src/tools/wordpress-snapshot.ts +0 -225
  146. package/src/tools/wordpress-targeting.ts +0 -188
  147. package/src/upload.ts +0 -35
  148. package/src/version.ts +0 -70
  149. package/test/context.test.ts +0 -36
  150. package/test/http.test.ts +0 -103
  151. package/test/server-surface.test.ts +0 -36
  152. package/test/use-account-sticky.test.ts +0 -28
  153. package/test/wordpress-import.test.ts +0 -223
  154. package/test/wordpress-live-edit.test.ts +0 -159
  155. package/test/wordpress-targeting.test.ts +0 -162
  156. package/tests/dailey-images.test.mjs +0 -156
  157. package/tests/environments.test.mjs +0 -230
  158. package/tests/mcp-protocol-smoke.mjs +0 -149
  159. package/tests/new-tools-smoke.mjs +0 -217
  160. package/tests/pack1-mcp-preflight.test.mjs +0 -184
  161. package/tests/pack6-smoke.mjs +0 -222
  162. package/tests/wp-snapshot-labels.test.mjs +0 -21
  163. package/tests/wp-snapshot.test.mjs +0 -261
  164. package/tsconfig.json +0 -19
@@ -1,156 +0,0 @@
1
- /**
2
- * Dailey Images (AI generation) MCP tools — two-layer test.
3
- *
4
- * Layer 1 (protocol smoke): spawns dist/index.js, does the MCP handshake,
5
- * calls tools/list, and asserts dailey_images_generate / dailey_images_enable /
6
- * dailey_images_info appear with correct input schemas. No credentials needed.
7
- *
8
- * Layer 2 (in-process registration checks): imports the compiled module,
9
- * stubs McpServer.tool(), and verifies names, schemas, and descriptions.
10
- *
11
- * Run:
12
- * node --test tests/dailey-images.test.mjs
13
- */
14
-
15
- import { test, describe } from 'node:test';
16
- import assert from 'node:assert/strict';
17
- import { spawn } from 'node:child_process';
18
- import { join, dirname } from 'node:path';
19
- import { fileURLToPath } from 'node:url';
20
-
21
- const __dirname = dirname(fileURLToPath(import.meta.url));
22
- const BINARY = join(__dirname, '..', 'dist', 'index.js');
23
-
24
- // ── Layer 1: protocol smoke (tools/list) ───────────────────────────────────
25
-
26
- describe('dailey images MCP tools — protocol smoke', { concurrency: false }, () => {
27
- test('generate/enable/info appear in tools/list with input schemas', async () => {
28
- const child = spawn('node', [BINARY], {
29
- env: {
30
- ...process.env,
31
- DAILEY_EMAIL: process.env.DAILEY_EMAIL || 'smoke@example.com',
32
- DAILEY_PASSWORD: process.env.DAILEY_PASSWORD || 'smoke-password',
33
- DAILEY_API_TOKEN: process.env.DAILEY_API_TOKEN || '',
34
- DAILEY_API_URL: process.env.DAILEY_API_URL || 'https://os.dailey.cloud/api',
35
- },
36
- stdio: ['pipe', 'pipe', 'pipe'],
37
- });
38
-
39
- let buffer = '';
40
- let nextId = 1;
41
- const pending = new Map();
42
-
43
- child.stdout.on('data', (chunk) => {
44
- buffer += chunk.toString();
45
- const lines = buffer.split('\n');
46
- buffer = lines.pop();
47
- for (const line of lines) {
48
- if (!line.trim()) continue;
49
- try {
50
- const msg = JSON.parse(line);
51
- if (msg.id != null && pending.has(msg.id)) {
52
- const { resolve } = pending.get(msg.id);
53
- pending.delete(msg.id);
54
- resolve(msg);
55
- }
56
- } catch { /* ignore non-JSON lines */ }
57
- }
58
- });
59
-
60
- child.stderr.on('data', (_chunk) => { /* suppress */ });
61
-
62
- function send(method, params, timeoutMs = 10000) {
63
- return new Promise((resolve, reject) => {
64
- const id = nextId++;
65
- const timer = setTimeout(() => {
66
- if (pending.has(id)) {
67
- pending.delete(id);
68
- reject(new Error(`Timeout waiting for ${method}`));
69
- }
70
- }, timeoutMs);
71
- pending.set(id, {
72
- resolve: (v) => { clearTimeout(timer); resolve(v); },
73
- reject,
74
- });
75
- child.stdin.write(JSON.stringify({ jsonrpc: '2.0', id, method, params }) + '\n');
76
- });
77
- }
78
-
79
- try {
80
- await send('initialize', {
81
- protocolVersion: '2024-11-05',
82
- capabilities: {},
83
- clientInfo: { name: 'dailey-images-smoke', version: '1.0.0' },
84
- });
85
- child.stdin.write(JSON.stringify({ jsonrpc: '2.0', method: 'notifications/initialized' }) + '\n');
86
-
87
- const toolsMsg = await send('tools/list', {});
88
- const tools = toolsMsg.result?.tools ?? [];
89
- const toolMap = Object.fromEntries(tools.map((t) => [t.name, t]));
90
-
91
- for (const name of ['dailey_images_generate', 'dailey_images_enable', 'dailey_images_info']) {
92
- assert.ok(toolMap[name], `Expected tool "${name}" in tools/list`);
93
- assert.ok(toolMap[name].inputSchema?.properties, `${name} must have inputSchema.properties`);
94
- assert.ok('project' in toolMap[name].inputSchema.properties, `${name} must have project param`);
95
- }
96
-
97
- // generate: prompt required; model enum; n optional
98
- const gen = toolMap['dailey_images_generate'];
99
- assert.ok('prompt' in gen.inputSchema.properties, 'generate must have prompt param');
100
- assert.ok('model' in gen.inputSchema.properties, 'generate must have model param');
101
- assert.ok('n' in gen.inputSchema.properties, 'generate must have n param');
102
- const genRequired = gen.inputSchema.required ?? [];
103
- assert.ok(genRequired.includes('project'), 'project must be required');
104
- assert.ok(genRequired.includes('prompt'), 'prompt must be required');
105
- assert.ok(!genRequired.includes('model'), 'model must be optional');
106
- assert.ok(!genRequired.includes('n'), 'n must be optional');
107
- // model is an enum with the two tiers
108
- const modelEnum = gen.inputSchema.properties.model.enum;
109
- assert.deepEqual(modelEnum, ['dailey-fast', 'dailey-pro'], 'model enum must be the two tiers');
110
- } finally {
111
- child.kill();
112
- }
113
- });
114
- });
115
-
116
- // ── Layer 2: in-process registration checks ────────────────────────────────
117
-
118
- describe('dailey images tools — registration', { concurrency: false }, () => {
119
- test('registers all three tools with the right shapes', async () => {
120
- const registrations = [];
121
- const stubServer = {
122
- tool(name, description, schema, handler) {
123
- registrations.push({ name, description, schema, handler });
124
- },
125
- };
126
-
127
- const mod = await import(join(__dirname, '..', 'dist', 'tools', 'dailey-images.js'));
128
- mod.registerDaileyImagesTools(stubServer);
129
-
130
- const byName = Object.fromEntries(registrations.map((r) => [r.name, r]));
131
-
132
- const gen = byName['dailey_images_generate'];
133
- assert.ok(gen, 'dailey_images_generate must be registered');
134
- assert.ok(typeof gen.handler === 'function', 'generate handler must be a function');
135
- assert.ok(gen.schema?.project && gen.schema?.prompt, 'generate must have project + prompt');
136
- // metered cost is called out in the description
137
- assert.match(gen.description, /2¢/, 'generate description must mention 2¢ (fast)');
138
- assert.match(gen.description, /10¢/, 'generate description must mention 10¢ (pro)');
139
- assert.match(gen.description, /prepaid credits/i, 'generate description must mention prepaid credits');
140
- // prompt required, model optional
141
- const promptOptional = gen.schema.prompt?._def?.typeName === 'ZodOptional'
142
- || (typeof gen.schema.prompt?.isOptional === 'function' && gen.schema.prompt.isOptional());
143
- assert.ok(!promptOptional, 'prompt must NOT be optional');
144
- const modelOptional = gen.schema.model?._def?.typeName === 'ZodOptional'
145
- || (typeof gen.schema.model?.isOptional === 'function' && gen.schema.model.isOptional());
146
- assert.ok(modelOptional, 'model must be optional');
147
-
148
- const enable = byName['dailey_images_enable'];
149
- assert.ok(enable, 'dailey_images_enable must be registered');
150
- assert.ok(enable.schema?.project, 'enable must have project param');
151
-
152
- const info = byName['dailey_images_info'];
153
- assert.ok(info, 'dailey_images_info must be registered');
154
- assert.ok(info.schema?.project, 'info must have project param');
155
- });
156
- });
@@ -1,230 +0,0 @@
1
- /**
2
- * environments + dailey_wp_clone MCP tools — two-layer test.
3
- *
4
- * Layer 1 (protocol smoke): spawns dist/index.js, does the MCP handshake,
5
- * calls tools/list, and asserts dailey_environments and dailey_wp_clone appear
6
- * with correct input schemas. No real credentials needed.
7
- *
8
- * Layer 2 (in-process schema/logic checks): imports the compiled module,
9
- * stubs McpServer.tool(), and verifies descriptions, schemas, and confirm-gate
10
- * logic via source inspection.
11
- *
12
- * Run:
13
- * node --test tests/environments.test.mjs
14
- */
15
-
16
- import { test, describe } from 'node:test';
17
- import assert from 'node:assert/strict';
18
- import { spawn } from 'node:child_process';
19
- import { join, dirname } from 'node:path';
20
- import { fileURLToPath } from 'node:url';
21
- import { readFileSync } from 'node:fs';
22
-
23
- const __dirname = dirname(fileURLToPath(import.meta.url));
24
- const BINARY = join(__dirname, '..', 'dist', 'index.js');
25
-
26
- // ── Layer 1: protocol smoke (tools/list) ───────────────────────────────────
27
-
28
- describe('environments MCP tools — protocol smoke', { concurrency: false }, () => {
29
- test('dailey_environments and dailey_wp_clone appear in tools/list with input schemas', async () => {
30
- const child = spawn('node', [BINARY], {
31
- env: {
32
- ...process.env,
33
- DAILEY_EMAIL: process.env.DAILEY_EMAIL || 'smoke@example.com',
34
- DAILEY_PASSWORD: process.env.DAILEY_PASSWORD || 'smoke-password',
35
- DAILEY_API_TOKEN: process.env.DAILEY_API_TOKEN || '',
36
- DAILEY_API_URL: process.env.DAILEY_API_URL || 'https://os.dailey.cloud/api',
37
- },
38
- stdio: ['pipe', 'pipe', 'pipe'],
39
- });
40
-
41
- let buffer = '';
42
- let nextId = 1;
43
- const pending = new Map();
44
-
45
- child.stdout.on('data', (chunk) => {
46
- buffer += chunk.toString();
47
- const lines = buffer.split('\n');
48
- buffer = lines.pop();
49
- for (const line of lines) {
50
- if (!line.trim()) continue;
51
- try {
52
- const msg = JSON.parse(line);
53
- if (msg.id != null && pending.has(msg.id)) {
54
- const { resolve } = pending.get(msg.id);
55
- pending.delete(msg.id);
56
- resolve(msg);
57
- }
58
- } catch { /* ignore non-JSON lines */ }
59
- }
60
- });
61
-
62
- child.stderr.on('data', (_chunk) => { /* suppress */ });
63
-
64
- function send(method, params, timeoutMs = 10000) {
65
- return new Promise((resolve, reject) => {
66
- const id = nextId++;
67
- const timer = setTimeout(() => {
68
- if (pending.has(id)) {
69
- pending.delete(id);
70
- reject(new Error(`Timeout waiting for ${method}`));
71
- }
72
- }, timeoutMs);
73
- pending.set(id, {
74
- resolve: (v) => { clearTimeout(timer); resolve(v); },
75
- reject,
76
- });
77
- child.stdin.write(JSON.stringify({ jsonrpc: '2.0', id, method, params }) + '\n');
78
- });
79
- }
80
-
81
- try {
82
- // MCP handshake
83
- await send('initialize', {
84
- protocolVersion: '2024-11-05',
85
- capabilities: {},
86
- clientInfo: { name: 'environments-smoke', version: '1.0.0' },
87
- });
88
- child.stdin.write(JSON.stringify({ jsonrpc: '2.0', method: 'notifications/initialized' }) + '\n');
89
-
90
- // List tools
91
- const toolsMsg = await send('tools/list', {});
92
- const tools = toolsMsg.result?.tools ?? [];
93
- const names = new Set(tools.map((t) => t.name));
94
-
95
- const expected = ['dailey_environments', 'dailey_wp_clone'];
96
-
97
- for (const name of expected) {
98
- assert.ok(names.has(name), `Expected tool "${name}" in tools/list`);
99
- }
100
-
101
- const toolMap = Object.fromEntries(tools.map((t) => [t.name, t]));
102
-
103
- // dailey_environments: must have 'project' param
104
- const envTool = toolMap['dailey_environments'];
105
- assert.ok(envTool.inputSchema?.properties, 'dailey_environments must have inputSchema.properties');
106
- assert.ok('project' in envTool.inputSchema.properties, 'dailey_environments must have project param');
107
-
108
- // dailey_wp_clone: must have 'project' (required) + optional 'confirm_token'
109
- const cloneTool = toolMap['dailey_wp_clone'];
110
- assert.ok(cloneTool.inputSchema?.properties, 'dailey_wp_clone must have inputSchema.properties');
111
- assert.ok('project' in cloneTool.inputSchema.properties, 'dailey_wp_clone must have project param');
112
- assert.ok('confirm_token' in cloneTool.inputSchema.properties, 'dailey_wp_clone must have confirm_token param');
113
-
114
- // confirm_token must be optional (not in required[])
115
- const required = cloneTool.inputSchema.required ?? [];
116
- assert.ok(!required.includes('confirm_token'), 'confirm_token must not be in required[]');
117
- assert.ok(required.includes('project'), 'project must be in required[]');
118
-
119
- } finally {
120
- child.kill();
121
- }
122
- });
123
- });
124
-
125
- // ── Layer 2: in-process registration checks ────────────────────────────────
126
-
127
- describe('dailey_environments — registration', { concurrency: false }, () => {
128
- test('registers with correct name and has project param', async () => {
129
- const registrations = [];
130
- const stubServer = {
131
- tool(name, description, schema, handler) {
132
- registrations.push({ name, description, schema, handler });
133
- },
134
- };
135
-
136
- const mod = await import(join(__dirname, '..', 'dist', 'tools', 'environments.js'));
137
- mod.registerEnvironmentTools(stubServer);
138
-
139
- const env = registrations.find((r) => r.name === 'dailey_environments');
140
- assert.ok(env, 'dailey_environments must be registered');
141
- assert.ok(env.schema?.project, 'dailey_environments must have project in schema');
142
- assert.ok(typeof env.handler === 'function', 'dailey_environments handler must be a function');
143
- });
144
- });
145
-
146
- describe('dailey_wp_clone — confirm-gate logic', { concurrency: false }, () => {
147
- test('confirm_token is optional in schema', async () => {
148
- const registrations = [];
149
- const stubServer = {
150
- tool(name, description, schema, handler) {
151
- registrations.push({ name, description, schema, handler });
152
- },
153
- };
154
-
155
- const mod = await import(join(__dirname, '..', 'dist', 'tools', 'environments.js'));
156
- mod.registerEnvironmentTools(stubServer);
157
-
158
- const clone = registrations.find((r) => r.name === 'dailey_wp_clone');
159
- assert.ok(clone, 'dailey_wp_clone must be registered');
160
-
161
- // Description mentions DESTRUCTIVE and two-phase
162
- assert.match(clone.description, /DESTRUCTIVE/i, 'Description must mention DESTRUCTIVE');
163
- assert.match(clone.description, /two-phase|two phase/i, 'Description must mention two-phase');
164
- assert.match(clone.description, /confirm_token/, 'Description must mention confirm_token');
165
-
166
- // confirm_token must be ZodOptional
167
- const confirmField = clone.schema?.confirm_token;
168
- assert.ok(confirmField, 'confirm_token must be in schema');
169
- const isOptional =
170
- confirmField?._def?.typeName === 'ZodOptional' ||
171
- (typeof confirmField?.isOptional === 'function' && confirmField.isOptional());
172
- assert.ok(isOptional, 'confirm_token must be ZodOptional (.optional())');
173
-
174
- // project is required (ZodString, not ZodOptional)
175
- const projectField = clone.schema?.project;
176
- assert.ok(projectField, 'project must be in schema');
177
- const projectIsOptional =
178
- projectField?._def?.typeName === 'ZodOptional' ||
179
- (typeof projectField?.isOptional === 'function' && projectField.isOptional());
180
- assert.ok(!projectIsOptional, 'project must NOT be optional');
181
- });
182
-
183
- test('compiled source: preview route before execute route, confirm_token guard present', async () => {
184
- const src = readFileSync(join(__dirname, '..', 'dist', 'tools', 'environments.js'), 'utf8');
185
-
186
- // confirm_token guard exists
187
- assert.ok(
188
- src.includes('if (!confirm_token)'),
189
- 'Compiled output must contain `if (!confirm_token)` branch guard',
190
- );
191
-
192
- // preview route referenced
193
- assert.ok(
194
- src.includes('/wp/clone/preview'),
195
- 'Compiled output must reference /wp/clone/preview',
196
- );
197
-
198
- // execute route referenced
199
- assert.ok(
200
- src.includes('/wp/clone'),
201
- 'Compiled output must reference /wp/clone execute route',
202
- );
203
-
204
- // preview appears before execute in file (branch ordering)
205
- const previewIdx = src.indexOf('/wp/clone/preview');
206
- // execute route: find the non-preview occurrence
207
- let searchFrom = 0;
208
- let executeIdx = -1;
209
- while (true) {
210
- const idx = src.indexOf('/wp/clone', searchFrom);
211
- if (idx === -1) break;
212
- if (!src.slice(idx).startsWith('/wp/clone/preview')) {
213
- executeIdx = idx;
214
- break;
215
- }
216
- searchFrom = idx + 1;
217
- }
218
- assert.ok(executeIdx !== -1, 'Must find /wp/clone execute route in compiled output');
219
- assert.ok(
220
- previewIdx < executeIdx,
221
- `Preview route (idx ${previewIdx}) must appear before execute route (idx ${executeIdx})`,
222
- );
223
-
224
- // confirmation: 'CLONE' is in the execute path
225
- assert.ok(
226
- src.includes("confirmation: 'CLONE'") || src.includes('confirmation:"CLONE"'),
227
- "Execute path must pass confirmation: 'CLONE'",
228
- );
229
- });
230
- });
@@ -1,149 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * End-to-end MCP-protocol smoke test.
4
- *
5
- * Spawns the compiled MCP server, speaks the JSON-RPC stdio protocol, lists
6
- * all tools, and calls a representative read-only tool. This exercises the
7
- * actual MCP surface LLMs see.
8
- */
9
- import { spawn } from 'node:child_process';
10
- import path from 'node:path';
11
-
12
- const binary = path.resolve(new URL('.', import.meta.url).pathname, '..', 'dist/index.js');
13
-
14
- const env = {
15
- ...process.env,
16
- DAILEY_API_URL: process.env.DAILEY_API_URL || 'https://os.dailey.cloud/api',
17
- DAILEY_EMAIL: process.env.DAILEY_EMAIL,
18
- DAILEY_PASSWORD: process.env.DAILEY_PASSWORD,
19
- };
20
-
21
- if (!env.DAILEY_EMAIL || !env.DAILEY_PASSWORD) {
22
- console.error('DAILEY_EMAIL and DAILEY_PASSWORD must be set');
23
- process.exit(1);
24
- }
25
-
26
- const child = spawn('node', [binary], { env, stdio: ['pipe', 'pipe', 'pipe'] });
27
-
28
- let nextId = 1;
29
- const pending = new Map();
30
- let buffer = '';
31
-
32
- child.stdout.on('data', (chunk) => {
33
- buffer += chunk.toString();
34
- const lines = buffer.split('\n');
35
- buffer = lines.pop();
36
- for (const line of lines) {
37
- if (!line.trim()) continue;
38
- try {
39
- const msg = JSON.parse(line);
40
- if (msg.id && pending.has(msg.id)) {
41
- const { resolve } = pending.get(msg.id);
42
- pending.delete(msg.id);
43
- resolve(msg);
44
- }
45
- } catch { /* ignore */ }
46
- }
47
- });
48
-
49
- child.stderr.on('data', (chunk) => {
50
- process.stderr.write(`[mcp-server] ${chunk}`);
51
- });
52
-
53
- function send(method, params) {
54
- return new Promise((resolve, reject) => {
55
- const id = nextId++;
56
- pending.set(id, { resolve, reject });
57
- child.stdin.write(JSON.stringify({ jsonrpc: '2.0', id, method, params }) + '\n');
58
- setTimeout(() => {
59
- if (pending.has(id)) {
60
- pending.delete(id);
61
- reject(new Error(`Timeout waiting for ${method}`));
62
- }
63
- }, 15000);
64
- });
65
- }
66
-
67
- async function main() {
68
- console.log('Spawning MCP server...');
69
-
70
- // MCP handshake
71
- const init = await send('initialize', {
72
- protocolVersion: '2024-11-05',
73
- capabilities: {},
74
- clientInfo: { name: 'smoke-test', version: '1.0.0' },
75
- });
76
- console.log(`✓ initialized (server: ${init.result?.serverInfo?.name} v${init.result?.serverInfo?.version})`);
77
-
78
- // Notify initialized (required by some clients)
79
- child.stdin.write(JSON.stringify({ jsonrpc: '2.0', method: 'notifications/initialized' }) + '\n');
80
-
81
- // List tools
82
- const toolsMsg = await send('tools/list', {});
83
- const tools = toolsMsg.result?.tools || [];
84
- console.log(`✓ tools/list returned ${tools.length} tools`);
85
-
86
- const expected = [
87
- 'dailey_whoami',
88
- 'dailey_list_projects',
89
- 'dailey_project_info',
90
- 'dailey_deploy_status',
91
- 'dailey_build_logs',
92
- 'dailey_processes',
93
- 'dailey_process_logs',
94
- 'dailey_process_restart',
95
- 'dailey_process_metrics',
96
- 'dailey_process_resources',
97
- 'dailey_pause',
98
- 'dailey_resume',
99
- 'dailey_backups',
100
- 'dailey_resource_config',
101
- 'dailey_service_links',
102
- 'dailey_reveal_credential',
103
- 'dailey_analyze_repo',
104
- 'dailey_db_validate',
105
- 'dailey_db_tunnel',
106
- 'dailey_scale',
107
- 'dailey_domains',
108
- ];
109
-
110
- const names = new Set(tools.map((t) => t.name));
111
- const missing = expected.filter((n) => !names.has(n));
112
- if (missing.length) {
113
- console.log(`✗ missing tools: ${missing.join(', ')}`);
114
- process.exit(1);
115
- }
116
- console.log(`✓ all expected new tools registered`);
117
-
118
- // Call a real tool — dailey_whoami — to verify end-to-end flow.
119
- const whoamiMsg = await send('tools/call', { name: 'dailey_whoami', arguments: {} });
120
- const text = whoamiMsg.result?.content?.[0]?.text || '';
121
- if (!text.includes('@') && !text.toLowerCase().includes('email')) {
122
- console.log(`✗ dailey_whoami returned unexpected output: ${text.slice(0, 100)}`);
123
- process.exit(1);
124
- }
125
- console.log(`✓ dailey_whoami call succeeded (${text.split('\n')[0]})`);
126
-
127
- // Call a new tool — dailey_analyze_repo on nginx:alpine.
128
- const analyzeMsg = await send('tools/call', {
129
- name: 'dailey_analyze_repo',
130
- arguments: { repo_url: 'nginx:alpine' },
131
- });
132
- const analyzeText = analyzeMsg.result?.content?.[0]?.text || '';
133
- if (!analyzeText.includes('Analysis') || !analyzeText.includes('nginx:alpine')) {
134
- console.log(`✗ dailey_analyze_repo returned unexpected output: ${analyzeText.slice(0, 200)}`);
135
- process.exit(1);
136
- }
137
- console.log(`✓ dailey_analyze_repo call succeeded`);
138
-
139
- child.kill();
140
- console.log('');
141
- console.log(`All checks passed. ${tools.length} tools registered, new tools callable.`);
142
- process.exit(0);
143
- }
144
-
145
- main().catch((err) => {
146
- console.error('TEST CRASH:', err);
147
- child.kill();
148
- process.exit(2);
149
- });