@lousy-agents/cli 1.0.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/LICENSE +21 -0
- package/README.md +148 -0
- package/dist/commands/copilot-setup.d.ts +5 -0
- package/dist/commands/copilot-setup.d.ts.map +1 -0
- package/dist/commands/copilot-setup.js +97 -0
- package/dist/commands/copilot-setup.js.map +1 -0
- package/dist/commands/init.d.ts +12 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +115 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/new.d.ts +11 -0
- package/dist/commands/new.d.ts.map +1 -0
- package/dist/commands/new.js +41 -0
- package/dist/commands/new.js.map +1 -0
- package/dist/entities/copilot-agent.d.ts +15 -0
- package/dist/entities/copilot-agent.d.ts.map +1 -0
- package/dist/entities/copilot-agent.js +53 -0
- package/dist/entities/copilot-agent.js.map +1 -0
- package/dist/entities/copilot-setup.d.ts +65 -0
- package/dist/entities/copilot-setup.d.ts.map +1 -0
- package/dist/entities/copilot-setup.js +6 -0
- package/dist/entities/copilot-setup.js.map +1 -0
- package/dist/entities/index.d.ts +6 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +6 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/gateways/action-version-gateway.d.ts +39 -0
- package/dist/gateways/action-version-gateway.d.ts.map +1 -0
- package/dist/gateways/action-version-gateway.js +47 -0
- package/dist/gateways/action-version-gateway.js.map +1 -0
- package/dist/gateways/agent-file-gateway.d.ts +50 -0
- package/dist/gateways/agent-file-gateway.d.ts.map +1 -0
- package/dist/gateways/agent-file-gateway.js +34 -0
- package/dist/gateways/agent-file-gateway.js.map +1 -0
- package/dist/gateways/environment-gateway.d.ts +30 -0
- package/dist/gateways/environment-gateway.d.ts.map +1 -0
- package/dist/gateways/environment-gateway.js +56 -0
- package/dist/gateways/environment-gateway.js.map +1 -0
- package/dist/gateways/file-system-utils.d.ts +8 -0
- package/dist/gateways/file-system-utils.d.ts.map +1 -0
- package/dist/gateways/file-system-utils.js +17 -0
- package/dist/gateways/file-system-utils.js.map +1 -0
- package/dist/gateways/file-system-workflow-gateway.d.ts +27 -0
- package/dist/gateways/file-system-workflow-gateway.d.ts.map +1 -0
- package/dist/gateways/file-system-workflow-gateway.js +99 -0
- package/dist/gateways/file-system-workflow-gateway.js.map +1 -0
- package/dist/gateways/index.d.ts +9 -0
- package/dist/gateways/index.d.ts.map +1 -0
- package/dist/gateways/index.js +9 -0
- package/dist/gateways/index.js.map +1 -0
- package/dist/gateways/workflow-gateway.d.ts +43 -0
- package/dist/gateways/workflow-gateway.d.ts.map +1 -0
- package/dist/gateways/workflow-gateway.js +6 -0
- package/dist/gateways/workflow-gateway.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/config.d.ts +27 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +226 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/copilot-setup-config.d.ts +79 -0
- package/dist/lib/copilot-setup-config.d.ts.map +1 -0
- package/dist/lib/copilot-setup-config.js +119 -0
- package/dist/lib/copilot-setup-config.js.map +1 -0
- package/dist/lib/filesystem-structure.d.ts +45 -0
- package/dist/lib/filesystem-structure.d.ts.map +1 -0
- package/dist/lib/filesystem-structure.js +69 -0
- package/dist/lib/filesystem-structure.js.map +1 -0
- package/dist/lib/mcp-test-client.d.ts +43 -0
- package/dist/lib/mcp-test-client.d.ts.map +1 -0
- package/dist/lib/mcp-test-client.js +167 -0
- package/dist/lib/mcp-test-client.js.map +1 -0
- package/dist/lib/project-name-validation.d.ts +43 -0
- package/dist/lib/project-name-validation.d.ts.map +1 -0
- package/dist/lib/project-name-validation.js +131 -0
- package/dist/lib/project-name-validation.js.map +1 -0
- package/dist/mcp/index.d.ts +5 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +5 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +15 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +120 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools/analyze-action-versions.d.ts +9 -0
- package/dist/mcp/tools/analyze-action-versions.d.ts.map +1 -0
- package/dist/mcp/tools/analyze-action-versions.js +81 -0
- package/dist/mcp/tools/analyze-action-versions.js.map +1 -0
- package/dist/mcp/tools/create-copilot-setup-workflow.d.ts +9 -0
- package/dist/mcp/tools/create-copilot-setup-workflow.d.ts.map +1 -0
- package/dist/mcp/tools/create-copilot-setup-workflow.js +121 -0
- package/dist/mcp/tools/create-copilot-setup-workflow.js.map +1 -0
- package/dist/mcp/tools/discover-environment.d.ts +9 -0
- package/dist/mcp/tools/discover-environment.d.ts.map +1 -0
- package/dist/mcp/tools/discover-environment.js +30 -0
- package/dist/mcp/tools/discover-environment.js.map +1 -0
- package/dist/mcp/tools/discover-workflow-setup-actions.d.ts +9 -0
- package/dist/mcp/tools/discover-workflow-setup-actions.d.ts.map +1 -0
- package/dist/mcp/tools/discover-workflow-setup-actions.js +37 -0
- package/dist/mcp/tools/discover-workflow-setup-actions.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +11 -0
- package/dist/mcp/tools/index.d.ts.map +1 -0
- package/dist/mcp/tools/index.js +11 -0
- package/dist/mcp/tools/index.js.map +1 -0
- package/dist/mcp/tools/read-copilot-setup-workflow.d.ts +9 -0
- package/dist/mcp/tools/read-copilot-setup-workflow.d.ts.map +1 -0
- package/dist/mcp/tools/read-copilot-setup-workflow.js +38 -0
- package/dist/mcp/tools/read-copilot-setup-workflow.js.map +1 -0
- package/dist/mcp/tools/resolve-action-versions.d.ts +10 -0
- package/dist/mcp/tools/resolve-action-versions.d.ts.map +1 -0
- package/dist/mcp/tools/resolve-action-versions.js +61 -0
- package/dist/mcp/tools/resolve-action-versions.js.map +1 -0
- package/dist/mcp/tools/types.d.ts +67 -0
- package/dist/mcp/tools/types.d.ts.map +1 -0
- package/dist/mcp/tools/types.js +24 -0
- package/dist/mcp/tools/types.js.map +1 -0
- package/dist/mcp-server.d.ts +7 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +17 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/use-cases/action-resolution.d.ts +66 -0
- package/dist/use-cases/action-resolution.d.ts.map +1 -0
- package/dist/use-cases/action-resolution.js +107 -0
- package/dist/use-cases/action-resolution.js.map +1 -0
- package/dist/use-cases/candidate-builder.d.ts +17 -0
- package/dist/use-cases/candidate-builder.d.ts.map +1 -0
- package/dist/use-cases/candidate-builder.js +67 -0
- package/dist/use-cases/candidate-builder.js.map +1 -0
- package/dist/use-cases/copilot-setup.d.ts +8 -0
- package/dist/use-cases/copilot-setup.d.ts.map +1 -0
- package/dist/use-cases/copilot-setup.js +10 -0
- package/dist/use-cases/copilot-setup.js.map +1 -0
- package/dist/use-cases/create-copilot-agent.d.ts +29 -0
- package/dist/use-cases/create-copilot-agent.d.ts.map +1 -0
- package/dist/use-cases/create-copilot-agent.js +73 -0
- package/dist/use-cases/create-copilot-agent.js.map +1 -0
- package/dist/use-cases/index.d.ts +9 -0
- package/dist/use-cases/index.d.ts.map +1 -0
- package/dist/use-cases/index.js +9 -0
- package/dist/use-cases/index.js.map +1 -0
- package/dist/use-cases/setup-step-discovery.d.ts +87 -0
- package/dist/use-cases/setup-step-discovery.d.ts.map +1 -0
- package/dist/use-cases/setup-step-discovery.js +202 -0
- package/dist/use-cases/setup-step-discovery.js.map +1 -0
- package/dist/use-cases/workflow-generator.d.ts +34 -0
- package/dist/use-cases/workflow-generator.d.ts.map +1 -0
- package/dist/use-cases/workflow-generator.js +195 -0
- package/dist/use-cases/workflow-generator.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { loadConfig } from "c12";
|
|
5
|
+
import { consola } from "consola";
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = dirname(__filename);
|
|
8
|
+
const PROJECT_ROOT = join(__dirname, "..", "..");
|
|
9
|
+
const WEBAPP_TEMPLATE_DIR = join(PROJECT_ROOT, "ui", "copilot-with-react");
|
|
10
|
+
/**
|
|
11
|
+
* Default CLI project filesystem structure
|
|
12
|
+
*/
|
|
13
|
+
const DEFAULT_CLI_STRUCTURE = {
|
|
14
|
+
nodes: [
|
|
15
|
+
{
|
|
16
|
+
type: "directory",
|
|
17
|
+
path: ".github/instructions",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: "file",
|
|
21
|
+
path: ".github/copilot-instructions.md",
|
|
22
|
+
content: "",
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Helper function to read template file content
|
|
28
|
+
* @throws Error if template file cannot be read
|
|
29
|
+
*/
|
|
30
|
+
function readTemplateFile(relativePath) {
|
|
31
|
+
try {
|
|
32
|
+
return readFileSync(join(WEBAPP_TEMPLATE_DIR, relativePath), "utf-8");
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
36
|
+
const errorMsg = `Failed to read template file ${relativePath}: ${message}`;
|
|
37
|
+
consola.error(errorMsg);
|
|
38
|
+
throw new Error(errorMsg);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Cached webapp structure - lazy-loaded on first access
|
|
43
|
+
*/
|
|
44
|
+
let cachedWebappStructure = null;
|
|
45
|
+
/**
|
|
46
|
+
* Builds the webapp project filesystem structure by reading template files
|
|
47
|
+
* This is called lazily only when webapp scaffolding is needed
|
|
48
|
+
*/
|
|
49
|
+
function buildWebappStructure() {
|
|
50
|
+
if (cachedWebappStructure) {
|
|
51
|
+
return cachedWebappStructure;
|
|
52
|
+
}
|
|
53
|
+
cachedWebappStructure = {
|
|
54
|
+
nodes: [
|
|
55
|
+
// Root configuration files
|
|
56
|
+
{
|
|
57
|
+
type: "file",
|
|
58
|
+
path: "package.json",
|
|
59
|
+
content: readTemplateFile("package.json"),
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: "file",
|
|
63
|
+
path: "tsconfig.json",
|
|
64
|
+
content: readTemplateFile("tsconfig.json"),
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: "file",
|
|
68
|
+
path: "next.config.ts",
|
|
69
|
+
content: readTemplateFile("next.config.ts"),
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: "file",
|
|
73
|
+
path: "vitest.config.ts",
|
|
74
|
+
content: readTemplateFile("vitest.config.ts"),
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: "file",
|
|
78
|
+
path: "vitest.setup.ts",
|
|
79
|
+
content: readTemplateFile("vitest.setup.ts"),
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
type: "file",
|
|
83
|
+
path: "biome.json",
|
|
84
|
+
content: readTemplateFile("biome.json"),
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
type: "file",
|
|
88
|
+
path: ".editorconfig",
|
|
89
|
+
content: readTemplateFile(".editorconfig"),
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
type: "file",
|
|
93
|
+
path: ".nvmrc",
|
|
94
|
+
content: readTemplateFile(".nvmrc"),
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: "file",
|
|
98
|
+
path: ".yamllint",
|
|
99
|
+
content: readTemplateFile(".yamllint"),
|
|
100
|
+
},
|
|
101
|
+
// GitHub copilot instructions
|
|
102
|
+
{
|
|
103
|
+
type: "directory",
|
|
104
|
+
path: ".github",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
type: "directory",
|
|
108
|
+
path: ".github/instructions",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: "file",
|
|
112
|
+
path: ".github/copilot-instructions.md",
|
|
113
|
+
content: readTemplateFile(".github/copilot-instructions.md"),
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
type: "file",
|
|
117
|
+
path: ".github/instructions/test.instructions.md",
|
|
118
|
+
content: readTemplateFile(".github/instructions/test.instructions.md"),
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: "file",
|
|
122
|
+
path: ".github/instructions/spec.instructions.md",
|
|
123
|
+
content: readTemplateFile(".github/instructions/spec.instructions.md"),
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: "file",
|
|
127
|
+
path: ".github/instructions/pipeline.instructions.md",
|
|
128
|
+
content: readTemplateFile(".github/instructions/pipeline.instructions.md"),
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
type: "file",
|
|
132
|
+
path: ".github/instructions/software-architecture.instructions.md",
|
|
133
|
+
content: readTemplateFile(".github/instructions/software-architecture.instructions.md"),
|
|
134
|
+
},
|
|
135
|
+
// GitHub Issue Templates
|
|
136
|
+
{
|
|
137
|
+
type: "directory",
|
|
138
|
+
path: ".github/ISSUE_TEMPLATE",
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
type: "file",
|
|
142
|
+
path: ".github/ISSUE_TEMPLATE/feature-to-spec.yml",
|
|
143
|
+
content: readTemplateFile(".github/ISSUE_TEMPLATE/feature-to-spec.yml"),
|
|
144
|
+
},
|
|
145
|
+
// GitHub Workflows
|
|
146
|
+
{
|
|
147
|
+
type: "directory",
|
|
148
|
+
path: ".github/workflows",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
type: "file",
|
|
152
|
+
path: ".github/workflows/assign-copilot.yml",
|
|
153
|
+
content: readTemplateFile(".github/workflows/assign-copilot.yml"),
|
|
154
|
+
},
|
|
155
|
+
// Specs directory
|
|
156
|
+
{
|
|
157
|
+
type: "directory",
|
|
158
|
+
path: ".github/specs",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
type: "file",
|
|
162
|
+
path: ".github/specs/README.md",
|
|
163
|
+
content: readTemplateFile(".github/specs/README.md"),
|
|
164
|
+
},
|
|
165
|
+
// VSCode configuration
|
|
166
|
+
{
|
|
167
|
+
type: "directory",
|
|
168
|
+
path: ".vscode",
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
type: "file",
|
|
172
|
+
path: ".vscode/extensions.json",
|
|
173
|
+
content: readTemplateFile(".vscode/extensions.json"),
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
type: "file",
|
|
177
|
+
path: ".vscode/launch.json",
|
|
178
|
+
content: readTemplateFile(".vscode/launch.json"),
|
|
179
|
+
},
|
|
180
|
+
// Devcontainer configuration
|
|
181
|
+
{
|
|
182
|
+
type: "directory",
|
|
183
|
+
path: ".devcontainer",
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
type: "file",
|
|
187
|
+
path: ".devcontainer/devcontainer.json",
|
|
188
|
+
content: readTemplateFile(".devcontainer/devcontainer.json"),
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
};
|
|
192
|
+
return cachedWebappStructure;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Loads the configuration for the init command
|
|
196
|
+
* Falls back to defaults if no configuration is found
|
|
197
|
+
* Note: webapp structure is lazy-loaded only when requested
|
|
198
|
+
*/
|
|
199
|
+
export async function loadInitConfig() {
|
|
200
|
+
const { config } = await loadConfig({
|
|
201
|
+
name: "lousy-agents",
|
|
202
|
+
defaults: {
|
|
203
|
+
structures: {
|
|
204
|
+
CLI: DEFAULT_CLI_STRUCTURE,
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
return (config || {
|
|
209
|
+
structures: {
|
|
210
|
+
CLI: DEFAULT_CLI_STRUCTURE,
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Gets the filesystem structure for a specific project type
|
|
216
|
+
* Lazy-loads webapp structure only when requested
|
|
217
|
+
*/
|
|
218
|
+
export async function getProjectStructure(projectType) {
|
|
219
|
+
const config = await loadInitConfig();
|
|
220
|
+
// Lazy-load webapp structure only when requested
|
|
221
|
+
if (projectType === "webapp") {
|
|
222
|
+
return config.structures?.webapp || buildWebappStructure();
|
|
223
|
+
}
|
|
224
|
+
return config.structures?.[projectType];
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACjD,MAAM,mBAAmB,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,oBAAoB,CAAC,CAAC;AAiB3E;;GAEG;AACH,MAAM,qBAAqB,GAAwB;IAC/C,KAAK,EAAE;QACH;YACI,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,sBAAsB;SAC/B;QACD;YACI,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,iCAAiC;YACvC,OAAO,EAAE,EAAE;SACd;KACJ;CACJ,CAAC;AAEF;;;GAGG;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AAC,CAAC;IAEH,OAAO,CACH,MAAM,IAAI;QACN,UAAU,EAAE;YACR,GAAG,EAAE,qBAAqB;SAC7B;KACJ,CACJ,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACrC,WAA0D;IAE1D,MAAM,MAAM,GAAG,MAAM,cAAc,EAAE,CAAC;IAEtC,iDAAiD;IACjD,IAAI,WAAW,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,MAAM,CAAC,UAAU,EAAE,MAAM,IAAI,oBAAoB,EAAE,CAAC;IAC/D,CAAC;IAED,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC,WAAW,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for the copilot-setup command.
|
|
3
|
+
* Uses c12 for configuration loading, allowing runtime customization.
|
|
4
|
+
*/
|
|
5
|
+
import type { VersionFileType } from "../entities/copilot-setup.js";
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for a version file mapping
|
|
8
|
+
*/
|
|
9
|
+
export interface VersionFileMapping {
|
|
10
|
+
/**
|
|
11
|
+
* The filename to detect (e.g., ".nvmrc")
|
|
12
|
+
*/
|
|
13
|
+
filename: string;
|
|
14
|
+
/**
|
|
15
|
+
* The version file type (e.g., "node")
|
|
16
|
+
*/
|
|
17
|
+
type: VersionFileType;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Configuration for a setup action
|
|
21
|
+
*/
|
|
22
|
+
export interface SetupActionConfig {
|
|
23
|
+
/**
|
|
24
|
+
* The action name (e.g., "actions/setup-node")
|
|
25
|
+
*/
|
|
26
|
+
action: string;
|
|
27
|
+
/**
|
|
28
|
+
* The version file type this action handles
|
|
29
|
+
*/
|
|
30
|
+
type: VersionFileType;
|
|
31
|
+
/**
|
|
32
|
+
* The "with" config key for version file (e.g., "node-version-file")
|
|
33
|
+
*/
|
|
34
|
+
versionFileKey: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Configuration for copilot-setup command
|
|
38
|
+
*/
|
|
39
|
+
export interface CopilotSetupConfig {
|
|
40
|
+
/**
|
|
41
|
+
* List of idiomatic version files to detect
|
|
42
|
+
*/
|
|
43
|
+
versionFiles: VersionFileMapping[];
|
|
44
|
+
/**
|
|
45
|
+
* List of setup actions and their configuration
|
|
46
|
+
*/
|
|
47
|
+
setupActions: SetupActionConfig[];
|
|
48
|
+
/**
|
|
49
|
+
* List of action patterns to detect in existing workflows
|
|
50
|
+
*/
|
|
51
|
+
setupActionPatterns: string[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Loads the copilot-setup configuration using c12
|
|
55
|
+
* Falls back to defaults if no configuration is found
|
|
56
|
+
*/
|
|
57
|
+
export declare function loadCopilotSetupConfig(): Promise<CopilotSetupConfig>;
|
|
58
|
+
/**
|
|
59
|
+
* Resets the cached configuration (useful for testing)
|
|
60
|
+
*
|
|
61
|
+
* This function is retained for backwards compatibility but is a no-op
|
|
62
|
+
* because configuration is no longer cached at module scope.
|
|
63
|
+
*/
|
|
64
|
+
export declare function resetCopilotSetupConfigCache(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Gets a version file type to action mapping from config
|
|
67
|
+
* Returns a partial record as not all types may be configured
|
|
68
|
+
*/
|
|
69
|
+
export declare function getVersionTypeToActionMap(config: CopilotSetupConfig): Partial<Record<VersionFileType, string>>;
|
|
70
|
+
/**
|
|
71
|
+
* Gets a version file type to config key mapping from config
|
|
72
|
+
* Returns a partial record as not all types may be configured
|
|
73
|
+
*/
|
|
74
|
+
export declare function getVersionFileConfigKeyMap(config: CopilotSetupConfig): Partial<Record<VersionFileType, string>>;
|
|
75
|
+
/**
|
|
76
|
+
* Gets a filename to version type mapping from config
|
|
77
|
+
*/
|
|
78
|
+
export declare function getVersionFilenameToTypeMap(config: CopilotSetupConfig): Record<string, VersionFileType>;
|
|
79
|
+
//# sourceMappingURL=copilot-setup-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-setup-config.d.ts","sourceRoot":"","sources":["../../src/lib/copilot-setup-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,IAAI,EAAE,eAAe,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,EAAE,eAAe,CAAC;IACtB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,YAAY,EAAE,kBAAkB,EAAE,CAAC;IACnC;;OAEG;IACH,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC;;OAEG;IACH,mBAAmB,EAAE,MAAM,EAAE,CAAC;CACjC;AAkED;;;GAGG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAQ1E;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,IAAI,IAAI,CAEnD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACrC,MAAM,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAM1C;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACtC,MAAM,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAM1C;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACvC,MAAM,EAAE,kBAAkB,GAC3B,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAMjC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for the copilot-setup command.
|
|
3
|
+
* Uses c12 for configuration loading, allowing runtime customization.
|
|
4
|
+
*/
|
|
5
|
+
import { loadConfig } from "c12";
|
|
6
|
+
/**
|
|
7
|
+
* Default version file mappings
|
|
8
|
+
*/
|
|
9
|
+
const DEFAULT_VERSION_FILES = [
|
|
10
|
+
{ filename: ".nvmrc", type: "node" },
|
|
11
|
+
{ filename: ".node-version", type: "node" },
|
|
12
|
+
{ filename: ".python-version", type: "python" },
|
|
13
|
+
{ filename: ".java-version", type: "java" },
|
|
14
|
+
{ filename: ".ruby-version", type: "ruby" },
|
|
15
|
+
{ filename: ".go-version", type: "go" },
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Default setup action configurations
|
|
19
|
+
*/
|
|
20
|
+
const DEFAULT_SETUP_ACTIONS = [
|
|
21
|
+
{
|
|
22
|
+
action: "actions/setup-node",
|
|
23
|
+
type: "node",
|
|
24
|
+
versionFileKey: "node-version-file",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
action: "actions/setup-python",
|
|
28
|
+
type: "python",
|
|
29
|
+
versionFileKey: "python-version-file",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
action: "actions/setup-java",
|
|
33
|
+
type: "java",
|
|
34
|
+
versionFileKey: "java-version-file",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
action: "actions/setup-ruby",
|
|
38
|
+
type: "ruby",
|
|
39
|
+
versionFileKey: "ruby-version-file",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
action: "actions/setup-go",
|
|
43
|
+
type: "go",
|
|
44
|
+
versionFileKey: "go-version-file",
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* Default setup action patterns to detect in workflows
|
|
49
|
+
*/
|
|
50
|
+
const DEFAULT_SETUP_ACTION_PATTERNS = [
|
|
51
|
+
"actions/setup-node",
|
|
52
|
+
"actions/setup-python",
|
|
53
|
+
"actions/setup-java",
|
|
54
|
+
"actions/setup-go",
|
|
55
|
+
"actions/setup-ruby",
|
|
56
|
+
"jdx/mise-action",
|
|
57
|
+
];
|
|
58
|
+
/**
|
|
59
|
+
* Default copilot-setup configuration
|
|
60
|
+
*/
|
|
61
|
+
const DEFAULT_CONFIG = {
|
|
62
|
+
versionFiles: DEFAULT_VERSION_FILES,
|
|
63
|
+
setupActions: DEFAULT_SETUP_ACTIONS,
|
|
64
|
+
setupActionPatterns: DEFAULT_SETUP_ACTION_PATTERNS,
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Loads the copilot-setup configuration using c12
|
|
68
|
+
* Falls back to defaults if no configuration is found
|
|
69
|
+
*/
|
|
70
|
+
export async function loadCopilotSetupConfig() {
|
|
71
|
+
const { config } = await loadConfig({
|
|
72
|
+
name: "lousy-agents",
|
|
73
|
+
defaults: DEFAULT_CONFIG,
|
|
74
|
+
packageJson: "copilotSetup",
|
|
75
|
+
});
|
|
76
|
+
return config || DEFAULT_CONFIG;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Resets the cached configuration (useful for testing)
|
|
80
|
+
*
|
|
81
|
+
* This function is retained for backwards compatibility but is a no-op
|
|
82
|
+
* because configuration is no longer cached at module scope.
|
|
83
|
+
*/
|
|
84
|
+
export function resetCopilotSetupConfigCache() {
|
|
85
|
+
// no in-memory cache to reset
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Gets a version file type to action mapping from config
|
|
89
|
+
* Returns a partial record as not all types may be configured
|
|
90
|
+
*/
|
|
91
|
+
export function getVersionTypeToActionMap(config) {
|
|
92
|
+
const map = {};
|
|
93
|
+
for (const action of config.setupActions) {
|
|
94
|
+
map[action.type] = action.action;
|
|
95
|
+
}
|
|
96
|
+
return map;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Gets a version file type to config key mapping from config
|
|
100
|
+
* Returns a partial record as not all types may be configured
|
|
101
|
+
*/
|
|
102
|
+
export function getVersionFileConfigKeyMap(config) {
|
|
103
|
+
const map = {};
|
|
104
|
+
for (const action of config.setupActions) {
|
|
105
|
+
map[action.type] = action.versionFileKey;
|
|
106
|
+
}
|
|
107
|
+
return map;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Gets a filename to version type mapping from config
|
|
111
|
+
*/
|
|
112
|
+
export function getVersionFilenameToTypeMap(config) {
|
|
113
|
+
const map = {};
|
|
114
|
+
for (const file of config.versionFiles) {
|
|
115
|
+
map[file.filename] = file.type;
|
|
116
|
+
}
|
|
117
|
+
return map;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=copilot-setup-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-setup-config.js","sourceRoot":"","sources":["../../src/lib/copilot-setup-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAqDjC;;GAEG;AACH,MAAM,qBAAqB,GAAyB;IAChD,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE;IACpC,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE;IAC3C,EAAE,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC/C,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE;IAC3C,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE;IAC3C,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE;CAC1C,CAAC;AAEF;;GAEG;AACH,MAAM,qBAAqB,GAAwB;IAC/C;QACI,MAAM,EAAE,oBAAoB;QAC5B,IAAI,EAAE,MAAM;QACZ,cAAc,EAAE,mBAAmB;KACtC;IACD;QACI,MAAM,EAAE,sBAAsB;QAC9B,IAAI,EAAE,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AAG,GAA6C,EAAE,CAAC;IACzD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACvC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC;IAC7C,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACvC,MAA0B;IAE1B,MAAM,GAAG,GAAoC,EAAE,CAAC;IAChD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACrC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;IACnC,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template context for processing template variables in file content
|
|
3
|
+
*/
|
|
4
|
+
export interface TemplateContext {
|
|
5
|
+
projectName: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Represents a file to be created in the filesystem
|
|
9
|
+
*/
|
|
10
|
+
export interface FileNode {
|
|
11
|
+
type: "file";
|
|
12
|
+
path: string;
|
|
13
|
+
content: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Represents a directory to be created in the filesystem
|
|
17
|
+
*/
|
|
18
|
+
export interface DirectoryNode {
|
|
19
|
+
type: "directory";
|
|
20
|
+
path: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Union type for filesystem nodes
|
|
24
|
+
*/
|
|
25
|
+
export type FilesystemNode = FileNode | DirectoryNode;
|
|
26
|
+
/**
|
|
27
|
+
* Declarative filesystem structure definition
|
|
28
|
+
*/
|
|
29
|
+
export interface FilesystemStructure {
|
|
30
|
+
nodes: FilesystemNode[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Checks if a file or directory exists
|
|
34
|
+
*/
|
|
35
|
+
export declare function fileExists(path: string): Promise<boolean>;
|
|
36
|
+
/**
|
|
37
|
+
* Creates the filesystem structure defined by the given structure definition
|
|
38
|
+
* Preserves existing files and directories without modification
|
|
39
|
+
* Automatically creates parent directories for files
|
|
40
|
+
* @param structure The declarative filesystem structure to create
|
|
41
|
+
* @param targetDir The base directory where the structure should be created
|
|
42
|
+
* @param templateContext Optional context for processing template variables in file content
|
|
43
|
+
*/
|
|
44
|
+
export declare function createFilesystemStructure(structure: FilesystemStructure, targetDir: string, templateContext?: TemplateContext): Promise<void>;
|
|
45
|
+
//# sourceMappingURL=filesystem-structure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem-structure.d.ts","sourceRoot":"","sources":["../../src/lib/filesystem-structure.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,WAAW,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,aAAa,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO/D;AAsBD;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAC3C,SAAS,EAAE,mBAAmB,EAC9B,SAAS,EAAE,MAAM,EACjB,eAAe,CAAC,EAAE,eAAe,GAClC,OAAO,CAAC,IAAI,CAAC,CA2Bf"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { access, mkdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { consola } from "consola";
|
|
4
|
+
import { Eta } from "eta";
|
|
5
|
+
/**
|
|
6
|
+
* Checks if a file or directory exists
|
|
7
|
+
*/
|
|
8
|
+
export async function fileExists(path) {
|
|
9
|
+
try {
|
|
10
|
+
await access(path);
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Singleton Eta instance for template processing
|
|
19
|
+
*/
|
|
20
|
+
const eta = new Eta();
|
|
21
|
+
/**
|
|
22
|
+
* Processes template content using Eta templating engine
|
|
23
|
+
* @param content The template content to process
|
|
24
|
+
* @param context The template context with values to substitute
|
|
25
|
+
* @returns The processed content with template variables replaced
|
|
26
|
+
*/
|
|
27
|
+
function processTemplate(content, context) {
|
|
28
|
+
try {
|
|
29
|
+
return eta.renderString(content, context);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
33
|
+
throw new Error(`Template processing failed: ${message}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Creates the filesystem structure defined by the given structure definition
|
|
38
|
+
* Preserves existing files and directories without modification
|
|
39
|
+
* Automatically creates parent directories for files
|
|
40
|
+
* @param structure The declarative filesystem structure to create
|
|
41
|
+
* @param targetDir The base directory where the structure should be created
|
|
42
|
+
* @param templateContext Optional context for processing template variables in file content
|
|
43
|
+
*/
|
|
44
|
+
export async function createFilesystemStructure(structure, targetDir, templateContext) {
|
|
45
|
+
for (const node of structure.nodes) {
|
|
46
|
+
const fullPath = join(targetDir, node.path);
|
|
47
|
+
// Skip if already exists to preserve existing files/directories
|
|
48
|
+
if (await fileExists(fullPath)) {
|
|
49
|
+
consola.debug(`Skipping existing: ${fullPath}`);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (node.type === "directory") {
|
|
53
|
+
await mkdir(fullPath, { recursive: true });
|
|
54
|
+
consola.debug(`Created directory: ${fullPath}`);
|
|
55
|
+
}
|
|
56
|
+
else if (node.type === "file") {
|
|
57
|
+
// Create parent directories if they don't exist
|
|
58
|
+
const dir = dirname(fullPath);
|
|
59
|
+
await mkdir(dir, { recursive: true });
|
|
60
|
+
// Process template if context is provided
|
|
61
|
+
const content = templateContext
|
|
62
|
+
? processTemplate(node.content, templateContext)
|
|
63
|
+
: node.content;
|
|
64
|
+
await writeFile(fullPath, content, "utf-8");
|
|
65
|
+
consola.debug(`Created file: ${fullPath}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=filesystem-structure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem-structure.js","sourceRoot":"","sources":["../../src/lib/filesystem-structure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAsC1B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY;IACzC,IAAI,CAAC;QACD,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;AAEtB;;;;;GAKG;AACH,SAAS,eAAe,CAAC,OAAe,EAAE,OAAwB;IAC9D,IAAI,CAAC;QACD,OAAO,GAAG,CAAC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,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;YAEnB,MAAM,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC5C,OAAO,CAAC,KAAK,CAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;QAC/C,CAAC;IACL,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP test client for integration testing.
|
|
3
|
+
*
|
|
4
|
+
* This client communicates with an MCP server process via stdio,
|
|
5
|
+
* sending JSON-RPC messages and receiving responses.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* MCP client for testing.
|
|
9
|
+
* Sends JSON-RPC messages to the MCP server and receives responses.
|
|
10
|
+
*/
|
|
11
|
+
export declare class McpTestClient {
|
|
12
|
+
private process;
|
|
13
|
+
private messageId;
|
|
14
|
+
private responseBuffer;
|
|
15
|
+
private pendingResponses;
|
|
16
|
+
private isStarted;
|
|
17
|
+
/**
|
|
18
|
+
* Starts the MCP server process.
|
|
19
|
+
*/
|
|
20
|
+
start(): Promise<void>;
|
|
21
|
+
private processResponses;
|
|
22
|
+
/**
|
|
23
|
+
* Sends a JSON-RPC request to the MCP server.
|
|
24
|
+
*/
|
|
25
|
+
sendRequest(method: string, params?: unknown): Promise<unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* Sends an initialize request to the MCP server.
|
|
28
|
+
*/
|
|
29
|
+
initialize(): Promise<unknown>;
|
|
30
|
+
/**
|
|
31
|
+
* Lists all available tools from the MCP server.
|
|
32
|
+
*/
|
|
33
|
+
listTools(): Promise<unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* Calls a tool on the MCP server.
|
|
36
|
+
*/
|
|
37
|
+
callTool(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
38
|
+
/**
|
|
39
|
+
* Stops the MCP server process.
|
|
40
|
+
*/
|
|
41
|
+
stop(): void;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=mcp-test-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-test-client.d.ts","sourceRoot":"","sources":["../../src/lib/mcp-test-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgBH;;;GAGG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,cAAc,CAAM;IAC5B,OAAO,CAAC,gBAAgB,CAGV;IACd,OAAO,CAAC,SAAS,CAAS;IAE1B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAwC5B,OAAO,CAAC,gBAAgB;IAkCxB;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IA2CrE;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAQpC;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAInC;;OAEG;IACG,QAAQ,CACV,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,OAAO,CAAC;IAInB;;OAEG;IACH,IAAI,IAAI,IAAI;CAYf"}
|