skedyul 0.1.8 → 0.1.10
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/dist/cli/commands/diff.d.ts +1 -0
- package/dist/cli/commands/diff.js +295 -0
- package/dist/cli/commands/invoke.d.ts +1 -0
- package/dist/cli/commands/invoke.js +222 -0
- package/dist/cli/commands/serve.d.ts +1 -0
- package/dist/cli/commands/serve.js +123 -0
- package/dist/cli/commands/tools.d.ts +1 -0
- package/dist/cli/commands/tools.js +148 -0
- package/dist/cli/commands/validate.d.ts +1 -0
- package/dist/cli/commands/validate.js +269 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +94 -0
- package/dist/cli/utils.d.ts +25 -0
- package/dist/cli/utils.js +186 -0
- package/dist/config.d.ts +116 -0
- package/dist/config.js +233 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -1
- package/dist/server.js +21 -3
- package/package.json +4 -1
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.toolsCommand = toolsCommand;
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
38
|
+
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
39
|
+
const utils_1 = require("../utils");
|
|
40
|
+
// Cast for Zod v4 compatibility
|
|
41
|
+
const zodToJsonSchemaLoose = zod_to_json_schema_1.zodToJsonSchema;
|
|
42
|
+
function printHelp() {
|
|
43
|
+
console.log(`
|
|
44
|
+
skedyul dev tools - List all tools in the registry
|
|
45
|
+
|
|
46
|
+
Usage:
|
|
47
|
+
skedyul dev tools [options]
|
|
48
|
+
|
|
49
|
+
Options:
|
|
50
|
+
--registry, -r Path to the registry file (default: ./dist/registry.js)
|
|
51
|
+
--json Output as JSON (for programmatic use)
|
|
52
|
+
--verbose, -v Show full input/output schemas
|
|
53
|
+
--help, -h Show this help message
|
|
54
|
+
|
|
55
|
+
Examples:
|
|
56
|
+
# List all tools
|
|
57
|
+
skedyul dev tools --registry ./dist/registry.js
|
|
58
|
+
|
|
59
|
+
# Output as JSON
|
|
60
|
+
skedyul dev tools --registry ./dist/registry.js --json
|
|
61
|
+
|
|
62
|
+
# Show full schemas
|
|
63
|
+
skedyul dev tools --registry ./dist/registry.js --verbose
|
|
64
|
+
`);
|
|
65
|
+
}
|
|
66
|
+
function getZodSchema(schema) {
|
|
67
|
+
if (!schema)
|
|
68
|
+
return undefined;
|
|
69
|
+
if (schema instanceof z.ZodType) {
|
|
70
|
+
return schema;
|
|
71
|
+
}
|
|
72
|
+
if (typeof schema === 'object' && schema !== null && 'zod' in schema) {
|
|
73
|
+
const schemaWithZod = schema;
|
|
74
|
+
if (schemaWithZod.zod instanceof z.ZodType) {
|
|
75
|
+
return schemaWithZod.zod;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
function toJsonSchema(schema) {
|
|
81
|
+
if (!schema)
|
|
82
|
+
return undefined;
|
|
83
|
+
try {
|
|
84
|
+
return zodToJsonSchemaLoose(schema, {
|
|
85
|
+
target: 'jsonSchema7',
|
|
86
|
+
$refStrategy: 'none',
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async function toolsCommand(args) {
|
|
94
|
+
const { flags } = (0, utils_1.parseArgs)(args);
|
|
95
|
+
if (flags.help || flags.h) {
|
|
96
|
+
printHelp();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
// Get registry path
|
|
100
|
+
const registryPath = (flags.registry || flags.r || './dist/registry.js');
|
|
101
|
+
const jsonOutput = Boolean(flags.json);
|
|
102
|
+
const verbose = Boolean(flags.verbose || flags.v);
|
|
103
|
+
// Load registry
|
|
104
|
+
let registry;
|
|
105
|
+
try {
|
|
106
|
+
registry = await (0, utils_1.loadRegistry)(registryPath);
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
const tools = [];
|
|
113
|
+
for (const [key, tool] of Object.entries(registry)) {
|
|
114
|
+
const inputZod = getZodSchema(tool.inputs);
|
|
115
|
+
const outputZod = getZodSchema(tool.outputSchema);
|
|
116
|
+
tools.push({
|
|
117
|
+
name: tool.name || key,
|
|
118
|
+
description: tool.description || '',
|
|
119
|
+
inputSchema: verbose ? toJsonSchema(inputZod) : undefined,
|
|
120
|
+
outputSchema: verbose ? toJsonSchema(outputZod) : undefined,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if (jsonOutput) {
|
|
124
|
+
console.log((0, utils_1.formatJson)(tools));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
// Human-readable output
|
|
128
|
+
console.log(`\nFound ${tools.length} tool(s) in registry:\n`);
|
|
129
|
+
for (const tool of tools) {
|
|
130
|
+
console.log(` ${tool.name}`);
|
|
131
|
+
if (tool.description) {
|
|
132
|
+
console.log(` ${tool.description}`);
|
|
133
|
+
}
|
|
134
|
+
if (verbose && tool.inputSchema) {
|
|
135
|
+
console.log('\n Input Schema:');
|
|
136
|
+
const schemaStr = (0, utils_1.formatJson)(tool.inputSchema);
|
|
137
|
+
const indented = schemaStr.split('\n').map(line => ` ${line}`).join('\n');
|
|
138
|
+
console.log(indented);
|
|
139
|
+
}
|
|
140
|
+
if (verbose && tool.outputSchema) {
|
|
141
|
+
console.log('\n Output Schema:');
|
|
142
|
+
const schemaStr = (0, utils_1.formatJson)(tool.outputSchema);
|
|
143
|
+
const indented = schemaStr.split('\n').map(line => ` ${line}`).join('\n');
|
|
144
|
+
console.log(indented);
|
|
145
|
+
}
|
|
146
|
+
console.log('');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function validateCommand(args: string[]): Promise<void>;
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.validateCommand = validateCommand;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const utils_1 = require("../utils");
|
|
40
|
+
const config_1 = require("../../config");
|
|
41
|
+
function printHelp() {
|
|
42
|
+
console.log(`
|
|
43
|
+
skedyul dev validate - Validate skedyul.config.ts
|
|
44
|
+
|
|
45
|
+
Usage:
|
|
46
|
+
skedyul dev validate [options]
|
|
47
|
+
|
|
48
|
+
Options:
|
|
49
|
+
--config, -c Path to config file (default: auto-detect skedyul.config.ts)
|
|
50
|
+
--verbose, -v Show detailed validation output
|
|
51
|
+
--json Output as JSON
|
|
52
|
+
--help, -h Show this help message
|
|
53
|
+
|
|
54
|
+
Examples:
|
|
55
|
+
# Validate config in current directory
|
|
56
|
+
skedyul dev validate
|
|
57
|
+
|
|
58
|
+
# Validate specific config file
|
|
59
|
+
skedyul dev validate --config ./skedyul.config.ts
|
|
60
|
+
|
|
61
|
+
# Verbose output
|
|
62
|
+
skedyul dev validate --verbose
|
|
63
|
+
`);
|
|
64
|
+
}
|
|
65
|
+
function findConfigFile(startDir) {
|
|
66
|
+
for (const fileName of config_1.CONFIG_FILE_NAMES) {
|
|
67
|
+
const filePath = path.join(startDir, fileName);
|
|
68
|
+
if (fs.existsSync(filePath)) {
|
|
69
|
+
return filePath;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
async function validateCommand(args) {
|
|
75
|
+
const { flags } = (0, utils_1.parseArgs)(args);
|
|
76
|
+
if (flags.help || flags.h) {
|
|
77
|
+
printHelp();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const verbose = Boolean(flags.verbose || flags.v);
|
|
81
|
+
const jsonOutput = Boolean(flags.json);
|
|
82
|
+
// Find config file
|
|
83
|
+
let configPath = (flags.config || flags.c);
|
|
84
|
+
if (!configPath) {
|
|
85
|
+
const foundConfig = findConfigFile(process.cwd());
|
|
86
|
+
if (!foundConfig) {
|
|
87
|
+
const result = {
|
|
88
|
+
valid: false,
|
|
89
|
+
configPath: '',
|
|
90
|
+
errors: [`No config file found. Create one of: ${config_1.CONFIG_FILE_NAMES.join(', ')}`],
|
|
91
|
+
warnings: [],
|
|
92
|
+
};
|
|
93
|
+
if (jsonOutput) {
|
|
94
|
+
console.log(JSON.stringify(result, null, 2));
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
console.error('❌ No config file found');
|
|
98
|
+
console.error(` Create one of: ${config_1.CONFIG_FILE_NAMES.join(', ')}`);
|
|
99
|
+
}
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
configPath = foundConfig;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
configPath = path.resolve(process.cwd(), configPath);
|
|
106
|
+
}
|
|
107
|
+
if (!fs.existsSync(configPath)) {
|
|
108
|
+
const result = {
|
|
109
|
+
valid: false,
|
|
110
|
+
configPath,
|
|
111
|
+
errors: [`Config file not found: ${configPath}`],
|
|
112
|
+
warnings: [],
|
|
113
|
+
};
|
|
114
|
+
if (jsonOutput) {
|
|
115
|
+
console.log(JSON.stringify(result, null, 2));
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
console.error(`❌ Config file not found: ${configPath}`);
|
|
119
|
+
}
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
// Load and validate config
|
|
123
|
+
const warnings = [];
|
|
124
|
+
let config;
|
|
125
|
+
try {
|
|
126
|
+
config = await (0, config_1.loadConfig)(configPath);
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
const result = {
|
|
130
|
+
valid: false,
|
|
131
|
+
configPath,
|
|
132
|
+
errors: [error instanceof Error ? error.message : String(error)],
|
|
133
|
+
warnings: [],
|
|
134
|
+
};
|
|
135
|
+
if (jsonOutput) {
|
|
136
|
+
console.log(JSON.stringify(result, null, 2));
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
console.error(`❌ Failed to load config: ${result.errors[0]}`);
|
|
140
|
+
}
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
// Validate schema
|
|
144
|
+
const validation = (0, config_1.validateConfig)(config);
|
|
145
|
+
// Check for common issues (warnings)
|
|
146
|
+
if (!config.computeLayer) {
|
|
147
|
+
warnings.push('No computeLayer specified. Will default to "dedicated".');
|
|
148
|
+
}
|
|
149
|
+
if (!config.tools) {
|
|
150
|
+
warnings.push('No tools path specified. Will default to "./src/registry.ts".');
|
|
151
|
+
}
|
|
152
|
+
if (!config.workflows) {
|
|
153
|
+
warnings.push('No workflows path specified. Will default to "./workflows".');
|
|
154
|
+
}
|
|
155
|
+
// Check if tools file exists
|
|
156
|
+
const toolsPath = config.tools || './src/registry.ts';
|
|
157
|
+
const absoluteToolsPath = path.resolve(path.dirname(configPath), toolsPath);
|
|
158
|
+
if (!fs.existsSync(absoluteToolsPath)) {
|
|
159
|
+
// Check for .js variant
|
|
160
|
+
const jsToolsPath = absoluteToolsPath.replace(/\.ts$/, '.js');
|
|
161
|
+
if (!fs.existsSync(jsToolsPath)) {
|
|
162
|
+
warnings.push(`Tools file not found: ${toolsPath}`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// Check if workflows directory exists
|
|
166
|
+
const workflowsPath = config.workflows || './workflows';
|
|
167
|
+
const absoluteWorkflowsPath = path.resolve(path.dirname(configPath), workflowsPath);
|
|
168
|
+
if (!fs.existsSync(absoluteWorkflowsPath)) {
|
|
169
|
+
warnings.push(`Workflows directory not found: ${workflowsPath}`);
|
|
170
|
+
}
|
|
171
|
+
const envKeys = (0, config_1.getAllEnvKeys)(config);
|
|
172
|
+
const requiredInstallKeys = (0, config_1.getRequiredInstallEnvKeys)(config);
|
|
173
|
+
const result = {
|
|
174
|
+
valid: validation.valid,
|
|
175
|
+
configPath,
|
|
176
|
+
config: {
|
|
177
|
+
name: config.name,
|
|
178
|
+
version: config.version,
|
|
179
|
+
computeLayer: config.computeLayer,
|
|
180
|
+
runtime: config.runtime,
|
|
181
|
+
tools: config.tools,
|
|
182
|
+
workflows: config.workflows,
|
|
183
|
+
globalEnvKeys: envKeys.global,
|
|
184
|
+
installEnvKeys: envKeys.install,
|
|
185
|
+
requiredInstallEnvKeys: requiredInstallKeys,
|
|
186
|
+
appModels: config.install?.appModels?.map((m) => m.entityHandle) || [],
|
|
187
|
+
},
|
|
188
|
+
errors: validation.errors,
|
|
189
|
+
warnings,
|
|
190
|
+
};
|
|
191
|
+
if (jsonOutput) {
|
|
192
|
+
console.log(JSON.stringify(result, null, 2));
|
|
193
|
+
process.exit(validation.valid ? 0 : 1);
|
|
194
|
+
}
|
|
195
|
+
// Human-readable output
|
|
196
|
+
console.log('');
|
|
197
|
+
console.log(`📦 ${config.name}${config.version ? ` v${config.version}` : ''}`);
|
|
198
|
+
console.log(` ${configPath}`);
|
|
199
|
+
console.log('');
|
|
200
|
+
if (verbose) {
|
|
201
|
+
console.log('Configuration:');
|
|
202
|
+
console.log(` Compute Layer: ${config.computeLayer || 'dedicated (default)'}`);
|
|
203
|
+
console.log(` Runtime: ${config.runtime || 'node-22 (default)'}`);
|
|
204
|
+
console.log(` Tools: ${config.tools || './src/registry.ts (default)'}`);
|
|
205
|
+
console.log(` Workflows: ${config.workflows || './workflows (default)'}`);
|
|
206
|
+
console.log('');
|
|
207
|
+
if (envKeys.global.length > 0) {
|
|
208
|
+
console.log('Global Environment Variables:');
|
|
209
|
+
for (const key of envKeys.global) {
|
|
210
|
+
const def = config.env?.[key];
|
|
211
|
+
const required = def?.required ? ' (required)' : '';
|
|
212
|
+
const visibility = def?.visibility === 'encrypted' ? ' 🔒' : '';
|
|
213
|
+
console.log(` ${key}${required}${visibility}`);
|
|
214
|
+
if (def?.label)
|
|
215
|
+
console.log(` └─ ${def.label}`);
|
|
216
|
+
}
|
|
217
|
+
console.log('');
|
|
218
|
+
}
|
|
219
|
+
if (envKeys.install.length > 0) {
|
|
220
|
+
console.log('Install Environment Variables:');
|
|
221
|
+
for (const key of envKeys.install) {
|
|
222
|
+
const def = config.install?.env?.[key];
|
|
223
|
+
const required = def?.required ? ' (required)' : '';
|
|
224
|
+
const visibility = def?.visibility === 'encrypted' ? ' 🔒' : '';
|
|
225
|
+
console.log(` ${key}${required}${visibility}`);
|
|
226
|
+
if (def?.label)
|
|
227
|
+
console.log(` └─ ${def.label}`);
|
|
228
|
+
}
|
|
229
|
+
console.log('');
|
|
230
|
+
}
|
|
231
|
+
if (config.install?.appModels && config.install.appModels.length > 0) {
|
|
232
|
+
console.log('App Models:');
|
|
233
|
+
for (const model of config.install.appModels) {
|
|
234
|
+
console.log(` ${model.entityHandle}: ${model.label}`);
|
|
235
|
+
}
|
|
236
|
+
console.log('');
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
// Show errors
|
|
240
|
+
if (validation.errors.length > 0) {
|
|
241
|
+
console.log('❌ Validation Errors:');
|
|
242
|
+
for (const error of validation.errors) {
|
|
243
|
+
console.log(` • ${error}`);
|
|
244
|
+
}
|
|
245
|
+
console.log('');
|
|
246
|
+
}
|
|
247
|
+
// Show warnings
|
|
248
|
+
if (warnings.length > 0) {
|
|
249
|
+
console.log('⚠️ Warnings:');
|
|
250
|
+
for (const warning of warnings) {
|
|
251
|
+
console.log(` • ${warning}`);
|
|
252
|
+
}
|
|
253
|
+
console.log('');
|
|
254
|
+
}
|
|
255
|
+
// Final status
|
|
256
|
+
if (validation.valid) {
|
|
257
|
+
console.log('✅ Config is valid');
|
|
258
|
+
if (!verbose) {
|
|
259
|
+
console.log(` ${envKeys.global.length} global env vars, ${envKeys.install.length} install env vars`);
|
|
260
|
+
if (requiredInstallKeys.length > 0) {
|
|
261
|
+
console.log(` ${requiredInstallKeys.length} required install vars: ${requiredInstallKeys.join(', ')}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
console.log('❌ Config has errors');
|
|
267
|
+
process.exit(1);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const invoke_1 = require("./commands/invoke");
|
|
5
|
+
const tools_1 = require("./commands/tools");
|
|
6
|
+
const serve_1 = require("./commands/serve");
|
|
7
|
+
const validate_1 = require("./commands/validate");
|
|
8
|
+
const diff_1 = require("./commands/diff");
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
function printUsage() {
|
|
11
|
+
console.log(`
|
|
12
|
+
skedyul - Skedyul SDK CLI
|
|
13
|
+
|
|
14
|
+
Usage:
|
|
15
|
+
skedyul dev <command> [options]
|
|
16
|
+
|
|
17
|
+
Commands:
|
|
18
|
+
dev invoke <tool> Invoke a tool from the registry
|
|
19
|
+
dev tools List all tools in the registry
|
|
20
|
+
dev serve Start a local MCP server
|
|
21
|
+
dev validate Validate skedyul.config.ts
|
|
22
|
+
dev diff Show what would change on deploy
|
|
23
|
+
|
|
24
|
+
Run 'skedyul dev <command> --help' for more information on a command.
|
|
25
|
+
`);
|
|
26
|
+
}
|
|
27
|
+
function printDevUsage() {
|
|
28
|
+
console.log(`
|
|
29
|
+
skedyul dev - Development tools for testing MCP servers locally
|
|
30
|
+
|
|
31
|
+
Usage:
|
|
32
|
+
skedyul dev <command> [options]
|
|
33
|
+
|
|
34
|
+
Commands:
|
|
35
|
+
invoke <tool> Invoke a tool from the registry
|
|
36
|
+
tools List all tools in the registry
|
|
37
|
+
serve Start a local MCP server
|
|
38
|
+
validate Validate skedyul.config.ts
|
|
39
|
+
diff Show what would change on deploy
|
|
40
|
+
|
|
41
|
+
Examples:
|
|
42
|
+
skedyul dev invoke my_tool --registry ./dist/registry.js --args '{"key": "value"}'
|
|
43
|
+
skedyul dev tools --registry ./dist/registry.js
|
|
44
|
+
skedyul dev serve --registry ./dist/registry.js --port 3001
|
|
45
|
+
skedyul dev validate
|
|
46
|
+
skedyul dev diff
|
|
47
|
+
|
|
48
|
+
Options:
|
|
49
|
+
--help, -h Show help for a command
|
|
50
|
+
`);
|
|
51
|
+
}
|
|
52
|
+
async function main() {
|
|
53
|
+
if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
|
|
54
|
+
printUsage();
|
|
55
|
+
process.exit(0);
|
|
56
|
+
}
|
|
57
|
+
const command = args[0];
|
|
58
|
+
if (command !== 'dev') {
|
|
59
|
+
console.error(`Unknown command: ${command}`);
|
|
60
|
+
console.error(`Run 'skedyul --help' for usage information.`);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
const subCommand = args[1];
|
|
64
|
+
if (!subCommand || subCommand === '--help' || subCommand === '-h') {
|
|
65
|
+
printDevUsage();
|
|
66
|
+
process.exit(0);
|
|
67
|
+
}
|
|
68
|
+
const subArgs = args.slice(2);
|
|
69
|
+
switch (subCommand) {
|
|
70
|
+
case 'invoke':
|
|
71
|
+
await (0, invoke_1.invokeCommand)(subArgs);
|
|
72
|
+
break;
|
|
73
|
+
case 'tools':
|
|
74
|
+
await (0, tools_1.toolsCommand)(subArgs);
|
|
75
|
+
break;
|
|
76
|
+
case 'serve':
|
|
77
|
+
await (0, serve_1.serveCommand)(subArgs);
|
|
78
|
+
break;
|
|
79
|
+
case 'validate':
|
|
80
|
+
await (0, validate_1.validateCommand)(subArgs);
|
|
81
|
+
break;
|
|
82
|
+
case 'diff':
|
|
83
|
+
await (0, diff_1.diffCommand)(subArgs);
|
|
84
|
+
break;
|
|
85
|
+
default:
|
|
86
|
+
console.error(`Unknown dev command: ${subCommand}`);
|
|
87
|
+
console.error(`Run 'skedyul dev --help' for usage information.`);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
main().catch((error) => {
|
|
92
|
+
console.error('Error:', error instanceof Error ? error.message : String(error));
|
|
93
|
+
process.exit(1);
|
|
94
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ToolRegistry } from '../types';
|
|
2
|
+
export interface ParsedArgs {
|
|
3
|
+
flags: Record<string, string | boolean>;
|
|
4
|
+
positional: string[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Parse command line arguments into flags and positional args
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseArgs(args: string[]): ParsedArgs;
|
|
10
|
+
/**
|
|
11
|
+
* Parse multiple --env flags into a record
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseEnvFlags(args: string[]): Record<string, string>;
|
|
14
|
+
/**
|
|
15
|
+
* Load environment variables from a .env file
|
|
16
|
+
*/
|
|
17
|
+
export declare function loadEnvFile(filePath: string): Record<string, string>;
|
|
18
|
+
/**
|
|
19
|
+
* Load a registry from a JS/TS file
|
|
20
|
+
*/
|
|
21
|
+
export declare function loadRegistry(registryPath: string): Promise<ToolRegistry>;
|
|
22
|
+
/**
|
|
23
|
+
* Format JSON for console output with optional color
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatJson(data: unknown, pretty?: boolean): string;
|