@agentmanifest/cli 0.1.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/CHANGELOG.md +62 -0
- package/LICENSE +21 -0
- package/PROJECT_STRUCTURE.md +290 -0
- package/QUICK_START.md +188 -0
- package/README.md +477 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +453 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/publish.d.ts +6 -0
- package/dist/commands/publish.d.ts.map +1 -0
- package/dist/commands/publish.js +190 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/validate.d.ts +6 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +124 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/constants.d.ts +34 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +41 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +93 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.initCommand = initCommand;
|
|
7
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
8
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const constants_1 = require("../constants");
|
|
12
|
+
async function initCommand() {
|
|
13
|
+
console.log(chalk_1.default.cyan.bold('\nš Agent Manifest Protocol - Interactive Setup\n'));
|
|
14
|
+
console.log(chalk_1.default.gray('This wizard will help you create a valid agent-manifest.json file.\n'));
|
|
15
|
+
try {
|
|
16
|
+
// Check if file already exists
|
|
17
|
+
const outputPath = path_1.default.join(process.cwd(), 'agent-manifest.json');
|
|
18
|
+
try {
|
|
19
|
+
await promises_1.default.access(outputPath);
|
|
20
|
+
const { overwrite } = await inquirer_1.default.prompt([
|
|
21
|
+
{
|
|
22
|
+
type: 'confirm',
|
|
23
|
+
name: 'overwrite',
|
|
24
|
+
message: 'agent-manifest.json already exists. Overwrite?',
|
|
25
|
+
default: false,
|
|
26
|
+
},
|
|
27
|
+
]);
|
|
28
|
+
if (!overwrite) {
|
|
29
|
+
console.log(chalk_1.default.yellow('Aborted.'));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// File doesn't exist, continue
|
|
35
|
+
}
|
|
36
|
+
// Basic Information
|
|
37
|
+
console.log(chalk_1.default.bold('\nš Basic Information'));
|
|
38
|
+
const basicInfo = await inquirer_1.default.prompt([
|
|
39
|
+
{
|
|
40
|
+
type: 'input',
|
|
41
|
+
name: 'name',
|
|
42
|
+
message: 'API name:',
|
|
43
|
+
validate: (input) => input.trim().length > 0 || 'Name is required',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: 'input',
|
|
47
|
+
name: 'version',
|
|
48
|
+
message: 'Version (semantic versioning):',
|
|
49
|
+
default: '1.0.0',
|
|
50
|
+
validate: (input) => {
|
|
51
|
+
const semverRegex = /^\d+\.\d+\.\d+$/;
|
|
52
|
+
return semverRegex.test(input) || 'Must be valid semantic version (e.g., 1.0.0)';
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: 'input',
|
|
57
|
+
name: 'description',
|
|
58
|
+
message: 'Description (min 100 characters):',
|
|
59
|
+
validate: (input) => input.trim().length >= 100 || `Description must be at least 100 characters (currently ${input.trim().length})`,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: 'input',
|
|
63
|
+
name: 'homepage',
|
|
64
|
+
message: 'Homepage URL (optional):',
|
|
65
|
+
validate: (input) => {
|
|
66
|
+
if (!input)
|
|
67
|
+
return true;
|
|
68
|
+
try {
|
|
69
|
+
new URL(input);
|
|
70
|
+
return input.startsWith('https://') || 'Must be HTTPS URL';
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return 'Must be a valid URL';
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: 'input',
|
|
79
|
+
name: 'documentation',
|
|
80
|
+
message: 'Documentation URL (optional):',
|
|
81
|
+
validate: (input) => {
|
|
82
|
+
if (!input)
|
|
83
|
+
return true;
|
|
84
|
+
try {
|
|
85
|
+
new URL(input);
|
|
86
|
+
return input.startsWith('https://') || 'Must be HTTPS URL';
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return 'Must be a valid URL';
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
]);
|
|
94
|
+
// Categories
|
|
95
|
+
console.log(chalk_1.default.bold('\nš·ļø Categories'));
|
|
96
|
+
const categoryInfo = await inquirer_1.default.prompt([
|
|
97
|
+
{
|
|
98
|
+
type: 'checkbox',
|
|
99
|
+
name: 'categories',
|
|
100
|
+
message: 'Select categories (must select at least one):',
|
|
101
|
+
choices: constants_1.STANDARD_CATEGORIES,
|
|
102
|
+
validate: (input) => input.length > 0 || 'Must select at least one category',
|
|
103
|
+
},
|
|
104
|
+
]);
|
|
105
|
+
const { primary_category } = await inquirer_1.default.prompt([
|
|
106
|
+
{
|
|
107
|
+
type: 'list',
|
|
108
|
+
name: 'primary_category',
|
|
109
|
+
message: 'Select primary category:',
|
|
110
|
+
choices: categoryInfo.categories,
|
|
111
|
+
},
|
|
112
|
+
]);
|
|
113
|
+
// Endpoints
|
|
114
|
+
console.log(chalk_1.default.bold('\nš Endpoints'));
|
|
115
|
+
const endpoints = [];
|
|
116
|
+
let addMore = true;
|
|
117
|
+
while (addMore) {
|
|
118
|
+
const endpointInfo = await inquirer_1.default.prompt([
|
|
119
|
+
{
|
|
120
|
+
type: 'input',
|
|
121
|
+
name: 'path',
|
|
122
|
+
message: 'Endpoint path (e.g., /api/v1/data):',
|
|
123
|
+
validate: (input) => input.trim().startsWith('/') || 'Path must start with /',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: 'list',
|
|
127
|
+
name: 'method',
|
|
128
|
+
message: 'HTTP method:',
|
|
129
|
+
choices: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
|
|
130
|
+
default: 'GET',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
type: 'input',
|
|
134
|
+
name: 'description',
|
|
135
|
+
message: 'Endpoint description:',
|
|
136
|
+
validate: (input) => input.trim().length > 0 || 'Description is required',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
type: 'input',
|
|
140
|
+
name: 'response_description',
|
|
141
|
+
message: 'Response description:',
|
|
142
|
+
validate: (input) => input.trim().length > 0 || 'Response description is required',
|
|
143
|
+
},
|
|
144
|
+
]);
|
|
145
|
+
// Ask about parameters
|
|
146
|
+
const { hasParams } = await inquirer_1.default.prompt([
|
|
147
|
+
{
|
|
148
|
+
type: 'confirm',
|
|
149
|
+
name: 'hasParams',
|
|
150
|
+
message: 'Add parameters to this endpoint?',
|
|
151
|
+
default: false,
|
|
152
|
+
},
|
|
153
|
+
]);
|
|
154
|
+
const parameters = {};
|
|
155
|
+
if (hasParams) {
|
|
156
|
+
const { paramLocation } = await inquirer_1.default.prompt([
|
|
157
|
+
{
|
|
158
|
+
type: 'list',
|
|
159
|
+
name: 'paramLocation',
|
|
160
|
+
message: 'Parameter location:',
|
|
161
|
+
choices: ['query', 'body'],
|
|
162
|
+
},
|
|
163
|
+
]);
|
|
164
|
+
const params = {};
|
|
165
|
+
let addMoreParams = true;
|
|
166
|
+
while (addMoreParams) {
|
|
167
|
+
const paramInfo = await inquirer_1.default.prompt([
|
|
168
|
+
{
|
|
169
|
+
type: 'input',
|
|
170
|
+
name: 'name',
|
|
171
|
+
message: 'Parameter name:',
|
|
172
|
+
validate: (input) => input.trim().length > 0 || 'Name is required',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
type: 'list',
|
|
176
|
+
name: 'type',
|
|
177
|
+
message: 'Parameter type:',
|
|
178
|
+
choices: ['string', 'number', 'boolean', 'array', 'object'],
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
type: 'confirm',
|
|
182
|
+
name: 'required',
|
|
183
|
+
message: 'Is this parameter required?',
|
|
184
|
+
default: false,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
type: 'input',
|
|
188
|
+
name: 'description',
|
|
189
|
+
message: 'Parameter description:',
|
|
190
|
+
validate: (input) => input.trim().length > 0 || 'Description is required',
|
|
191
|
+
},
|
|
192
|
+
]);
|
|
193
|
+
params[paramInfo.name] = {
|
|
194
|
+
type: paramInfo.type,
|
|
195
|
+
required: paramInfo.required,
|
|
196
|
+
description: paramInfo.description,
|
|
197
|
+
};
|
|
198
|
+
const { continueParams } = await inquirer_1.default.prompt([
|
|
199
|
+
{
|
|
200
|
+
type: 'confirm',
|
|
201
|
+
name: 'continueParams',
|
|
202
|
+
message: 'Add another parameter?',
|
|
203
|
+
default: false,
|
|
204
|
+
},
|
|
205
|
+
]);
|
|
206
|
+
addMoreParams = continueParams;
|
|
207
|
+
}
|
|
208
|
+
parameters[paramLocation] = params;
|
|
209
|
+
}
|
|
210
|
+
endpoints.push({
|
|
211
|
+
path: endpointInfo.path,
|
|
212
|
+
method: endpointInfo.method,
|
|
213
|
+
description: endpointInfo.description,
|
|
214
|
+
parameters: Object.keys(parameters).length > 0 ? parameters : undefined,
|
|
215
|
+
response: {
|
|
216
|
+
type: 'object',
|
|
217
|
+
description: endpointInfo.response_description,
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
const { continueEndpoints } = await inquirer_1.default.prompt([
|
|
221
|
+
{
|
|
222
|
+
type: 'confirm',
|
|
223
|
+
name: 'continueEndpoints',
|
|
224
|
+
message: 'Add another endpoint?',
|
|
225
|
+
default: false,
|
|
226
|
+
},
|
|
227
|
+
]);
|
|
228
|
+
addMore = continueEndpoints;
|
|
229
|
+
}
|
|
230
|
+
// Pricing
|
|
231
|
+
console.log(chalk_1.default.bold('\nš° Pricing'));
|
|
232
|
+
const pricingInfo = await inquirer_1.default.prompt([
|
|
233
|
+
{
|
|
234
|
+
type: 'list',
|
|
235
|
+
name: 'model',
|
|
236
|
+
message: 'Pricing model:',
|
|
237
|
+
choices: constants_1.PRICING_MODELS,
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
type: 'input',
|
|
241
|
+
name: 'details',
|
|
242
|
+
message: 'Pricing details (optional, e.g., "First 1000 requests free"):',
|
|
243
|
+
},
|
|
244
|
+
]);
|
|
245
|
+
// Authentication
|
|
246
|
+
console.log(chalk_1.default.bold('\nš Authentication'));
|
|
247
|
+
const authInfo = await inquirer_1.default.prompt([
|
|
248
|
+
{
|
|
249
|
+
type: 'list',
|
|
250
|
+
name: 'type',
|
|
251
|
+
message: 'Authentication type:',
|
|
252
|
+
choices: constants_1.AUTH_TYPES,
|
|
253
|
+
},
|
|
254
|
+
]);
|
|
255
|
+
let authConfig = {};
|
|
256
|
+
if (authInfo.type !== 'none') {
|
|
257
|
+
const configInfo = await inquirer_1.default.prompt([
|
|
258
|
+
{
|
|
259
|
+
type: 'input',
|
|
260
|
+
name: 'header',
|
|
261
|
+
message: 'Header name (e.g., X-API-Key, Authorization):',
|
|
262
|
+
when: authInfo.type === 'api_key' || authInfo.type === 'bearer',
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
type: 'input',
|
|
266
|
+
name: 'signup_url',
|
|
267
|
+
message: 'Signup URL for obtaining credentials:',
|
|
268
|
+
validate: (input) => {
|
|
269
|
+
if (!input)
|
|
270
|
+
return true;
|
|
271
|
+
try {
|
|
272
|
+
new URL(input);
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
return 'Must be a valid URL';
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
]);
|
|
281
|
+
authConfig = configInfo;
|
|
282
|
+
}
|
|
283
|
+
// Rate Limits (optional)
|
|
284
|
+
console.log(chalk_1.default.bold('\nā±ļø Rate Limits (optional)'));
|
|
285
|
+
const { addRateLimits } = await inquirer_1.default.prompt([
|
|
286
|
+
{
|
|
287
|
+
type: 'confirm',
|
|
288
|
+
name: 'addRateLimits',
|
|
289
|
+
message: 'Add rate limit information?',
|
|
290
|
+
default: false,
|
|
291
|
+
},
|
|
292
|
+
]);
|
|
293
|
+
let rateLimits;
|
|
294
|
+
if (addRateLimits) {
|
|
295
|
+
rateLimits = await inquirer_1.default.prompt([
|
|
296
|
+
{
|
|
297
|
+
type: 'number',
|
|
298
|
+
name: 'requests_per_minute',
|
|
299
|
+
message: 'Requests per minute:',
|
|
300
|
+
default: 60,
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
type: 'number',
|
|
304
|
+
name: 'requests_per_day',
|
|
305
|
+
message: 'Requests per day:',
|
|
306
|
+
default: 10000,
|
|
307
|
+
},
|
|
308
|
+
]);
|
|
309
|
+
}
|
|
310
|
+
// Reliability Metrics (optional)
|
|
311
|
+
console.log(chalk_1.default.bold('\nš Reliability Metrics (optional)'));
|
|
312
|
+
const { addReliability } = await inquirer_1.default.prompt([
|
|
313
|
+
{
|
|
314
|
+
type: 'confirm',
|
|
315
|
+
name: 'addReliability',
|
|
316
|
+
message: 'Add reliability metrics?',
|
|
317
|
+
default: false,
|
|
318
|
+
},
|
|
319
|
+
]);
|
|
320
|
+
let reliabilityMetrics;
|
|
321
|
+
if (addReliability) {
|
|
322
|
+
reliabilityMetrics = await inquirer_1.default.prompt([
|
|
323
|
+
{
|
|
324
|
+
type: 'number',
|
|
325
|
+
name: 'uptime_percentage',
|
|
326
|
+
message: 'Uptime percentage (e.g., 99.9):',
|
|
327
|
+
default: 99.9,
|
|
328
|
+
validate: (input) => (input >= 0 && input <= 100) || 'Must be between 0 and 100',
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
type: 'number',
|
|
332
|
+
name: 'avg_response_time_ms',
|
|
333
|
+
message: 'Average response time (ms):',
|
|
334
|
+
default: 150,
|
|
335
|
+
},
|
|
336
|
+
]);
|
|
337
|
+
}
|
|
338
|
+
// Contact Information
|
|
339
|
+
console.log(chalk_1.default.bold('\nš§ Contact Information'));
|
|
340
|
+
const contactInfo = await inquirer_1.default.prompt([
|
|
341
|
+
{
|
|
342
|
+
type: 'input',
|
|
343
|
+
name: 'email',
|
|
344
|
+
message: 'Support email:',
|
|
345
|
+
validate: (input) => {
|
|
346
|
+
if (!input)
|
|
347
|
+
return true;
|
|
348
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
349
|
+
return emailRegex.test(input) || 'Must be a valid email';
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
type: 'input',
|
|
354
|
+
name: 'support_url',
|
|
355
|
+
message: 'Support URL (optional):',
|
|
356
|
+
validate: (input) => {
|
|
357
|
+
if (!input)
|
|
358
|
+
return true;
|
|
359
|
+
try {
|
|
360
|
+
new URL(input);
|
|
361
|
+
return true;
|
|
362
|
+
}
|
|
363
|
+
catch {
|
|
364
|
+
return 'Must be a valid URL';
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
type: 'input',
|
|
370
|
+
name: 'github',
|
|
371
|
+
message: 'GitHub URL (optional):',
|
|
372
|
+
validate: (input) => {
|
|
373
|
+
if (!input)
|
|
374
|
+
return true;
|
|
375
|
+
try {
|
|
376
|
+
new URL(input);
|
|
377
|
+
return input.includes('github.com') || 'Should be a GitHub URL';
|
|
378
|
+
}
|
|
379
|
+
catch {
|
|
380
|
+
return 'Must be a valid URL';
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
]);
|
|
385
|
+
// Agent Notes
|
|
386
|
+
console.log(chalk_1.default.bold('\nš¤ Agent Guidance'));
|
|
387
|
+
const { agent_notes } = await inquirer_1.default.prompt([
|
|
388
|
+
{
|
|
389
|
+
type: 'input',
|
|
390
|
+
name: 'agent_notes',
|
|
391
|
+
message: 'Implementation guidance for AI agents (min 50 characters):',
|
|
392
|
+
validate: (input) => input.trim().length >= 50 ||
|
|
393
|
+
`Agent notes must be at least 50 characters (currently ${input.trim().length})`,
|
|
394
|
+
},
|
|
395
|
+
]);
|
|
396
|
+
// Registry Listing
|
|
397
|
+
console.log(chalk_1.default.bold('\nš Registry'));
|
|
398
|
+
const { listing_requested } = await inquirer_1.default.prompt([
|
|
399
|
+
{
|
|
400
|
+
type: 'confirm',
|
|
401
|
+
name: 'listing_requested',
|
|
402
|
+
message: 'Request listing in public AMP registry?',
|
|
403
|
+
default: true,
|
|
404
|
+
},
|
|
405
|
+
]);
|
|
406
|
+
// Build the manifest
|
|
407
|
+
const manifest = {
|
|
408
|
+
spec_version: 'agentmanifest-0.1',
|
|
409
|
+
name: basicInfo.name,
|
|
410
|
+
version: basicInfo.version,
|
|
411
|
+
description: basicInfo.description,
|
|
412
|
+
...(basicInfo.homepage && { homepage: basicInfo.homepage }),
|
|
413
|
+
...(basicInfo.documentation && { documentation: basicInfo.documentation }),
|
|
414
|
+
categories: categoryInfo.categories,
|
|
415
|
+
primary_category,
|
|
416
|
+
endpoints,
|
|
417
|
+
pricing: {
|
|
418
|
+
model: pricingInfo.model,
|
|
419
|
+
...(pricingInfo.details && { details: pricingInfo.details }),
|
|
420
|
+
},
|
|
421
|
+
authentication: {
|
|
422
|
+
type: authInfo.type,
|
|
423
|
+
...(authInfo.type !== 'none' && Object.keys(authConfig).length > 0 && { config: authConfig }),
|
|
424
|
+
},
|
|
425
|
+
...(rateLimits && { rate_limits: rateLimits }),
|
|
426
|
+
...(reliabilityMetrics && { reliability_metrics: reliabilityMetrics }),
|
|
427
|
+
...(Object.keys(contactInfo).some((k) => contactInfo[k]) && {
|
|
428
|
+
contact: Object.fromEntries(Object.entries(contactInfo).filter(([_, v]) => v)),
|
|
429
|
+
}),
|
|
430
|
+
agent_notes,
|
|
431
|
+
listing_requested,
|
|
432
|
+
last_updated: new Date().toISOString(),
|
|
433
|
+
};
|
|
434
|
+
// Write to file
|
|
435
|
+
await promises_1.default.writeFile(outputPath, JSON.stringify(manifest, null, 2));
|
|
436
|
+
console.log(chalk_1.default.green.bold('\nā
Success!'));
|
|
437
|
+
console.log(chalk_1.default.gray(`\nManifest created at: ${outputPath}`));
|
|
438
|
+
console.log(chalk_1.default.gray('\nNext steps:'));
|
|
439
|
+
console.log(chalk_1.default.cyan(' 1. Review the generated manifest'));
|
|
440
|
+
console.log(chalk_1.default.cyan(' 2. Run "amp validate" to check compliance'));
|
|
441
|
+
console.log(chalk_1.default.cyan(' 3. Run "amp publish" to submit to registry'));
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
if (error.isTtyError) {
|
|
445
|
+
console.error(chalk_1.default.red('Prompt could not be rendered in the current environment'));
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
console.error(chalk_1.default.red('Error:'), error.message);
|
|
449
|
+
}
|
|
450
|
+
process.exit(1);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":";;;;;AAOA,kCA6cC;AApdD,wDAAgC;AAChC,2DAA6B;AAC7B,gDAAwB;AACxB,kDAA0B;AAC1B,4CAA+E;AAGxE,KAAK,UAAU,WAAW;IAC/B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAA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C;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AASA,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAiBD,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,iBAkM3D"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.publishCommand = publishCommand;
|
|
7
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const axios_1 = __importDefault(require("axios"));
|
|
11
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
12
|
+
const VALIDATOR_URL = 'https://validator.agent-manifest.com/validate';
|
|
13
|
+
const REGISTRY_URL = 'https://agent-manifest.com/listings/submit';
|
|
14
|
+
async function publishCommand(options) {
|
|
15
|
+
const filePath = path_1.default.resolve(process.cwd(), options.file || './agent-manifest.json');
|
|
16
|
+
console.log(chalk_1.default.cyan.bold('\nš¤ Publishing Agent Manifest\n'));
|
|
17
|
+
console.log(chalk_1.default.gray(`File: ${filePath}\n`));
|
|
18
|
+
try {
|
|
19
|
+
// Read the manifest file
|
|
20
|
+
const fileContent = await promises_1.default.readFile(filePath, 'utf-8');
|
|
21
|
+
let manifest;
|
|
22
|
+
try {
|
|
23
|
+
manifest = JSON.parse(fileContent);
|
|
24
|
+
}
|
|
25
|
+
catch (parseError) {
|
|
26
|
+
console.error(chalk_1.default.red('ā Invalid JSON'));
|
|
27
|
+
console.error(chalk_1.default.gray('The manifest file contains invalid JSON syntax.'));
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
// Ensure manifest has a homepage URL for the submission
|
|
31
|
+
if (!manifest.homepage) {
|
|
32
|
+
console.log(chalk_1.default.yellow('\nā ļø Missing Homepage URL'));
|
|
33
|
+
console.log(chalk_1.default.gray('The registry needs your API base URL to fetch the manifest.\n'));
|
|
34
|
+
const { homepage } = await inquirer_1.default.prompt([
|
|
35
|
+
{
|
|
36
|
+
type: 'input',
|
|
37
|
+
name: 'homepage',
|
|
38
|
+
message: 'Enter your API base URL (where /.well-known/agent-manifest.json is hosted):',
|
|
39
|
+
validate: (input) => {
|
|
40
|
+
if (!input)
|
|
41
|
+
return 'Homepage URL is required for publishing';
|
|
42
|
+
try {
|
|
43
|
+
new URL(input);
|
|
44
|
+
return input.startsWith('https://') || 'Must be HTTPS URL';
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return 'Must be a valid URL';
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
]);
|
|
52
|
+
manifest.homepage = homepage;
|
|
53
|
+
// Update the file with the homepage
|
|
54
|
+
await promises_1.default.writeFile(filePath, JSON.stringify(manifest, null, 2));
|
|
55
|
+
console.log(chalk_1.default.gray(`Updated manifest with homepage: ${homepage}\n`));
|
|
56
|
+
}
|
|
57
|
+
// Step 1: Validate
|
|
58
|
+
console.log(chalk_1.default.gray('Step 1/2: Validating manifest...'));
|
|
59
|
+
try {
|
|
60
|
+
const validateResponse = await axios_1.default.post(VALIDATOR_URL, { manifest }, {
|
|
61
|
+
headers: {
|
|
62
|
+
'Content-Type': 'application/json',
|
|
63
|
+
},
|
|
64
|
+
timeout: 10000,
|
|
65
|
+
});
|
|
66
|
+
if (!validateResponse.data.valid) {
|
|
67
|
+
console.log(chalk_1.default.red.bold('ā Validation Failed'));
|
|
68
|
+
if (validateResponse.data.errors && validateResponse.data.errors.length > 0) {
|
|
69
|
+
console.log(chalk_1.default.red.bold('\nErrors:'));
|
|
70
|
+
validateResponse.data.errors.forEach((error, index) => {
|
|
71
|
+
console.log(chalk_1.default.red(` ${index + 1}. ${error.field}: ${error.message}`));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
console.log(chalk_1.default.gray('\nPlease fix the errors and try again.'));
|
|
75
|
+
console.log(chalk_1.default.cyan('Run "amp validate" for detailed validation output.'));
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
console.log(chalk_1.default.green('ā Validation passed'));
|
|
79
|
+
}
|
|
80
|
+
catch (validationError) {
|
|
81
|
+
console.error(chalk_1.default.red('ā Validation Failed'));
|
|
82
|
+
if (axios_1.default.isAxiosError(validationError) && validationError.response) {
|
|
83
|
+
const errorData = validationError.response.data;
|
|
84
|
+
if (errorData.errors && Array.isArray(errorData.errors)) {
|
|
85
|
+
console.log(chalk_1.default.red.bold('\nErrors:'));
|
|
86
|
+
errorData.errors.forEach((error, index) => {
|
|
87
|
+
const field = error.field || error.path || 'unknown';
|
|
88
|
+
const message = error.message || error.msg || 'Unknown error';
|
|
89
|
+
console.log(chalk_1.default.red(` ${index + 1}. ${field}: ${message}`));
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
console.error(chalk_1.default.gray(`\n${validationError.message}`));
|
|
95
|
+
}
|
|
96
|
+
console.log(chalk_1.default.gray('\nPlease fix the errors and try again.'));
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
// Step 2: Publish
|
|
100
|
+
console.log(chalk_1.default.gray('Step 2/2: Submitting to registry...'));
|
|
101
|
+
try {
|
|
102
|
+
const publishResponse = await axios_1.default.post(REGISTRY_URL, {
|
|
103
|
+
url: manifest.homepage,
|
|
104
|
+
manifest,
|
|
105
|
+
}, {
|
|
106
|
+
headers: {
|
|
107
|
+
'Content-Type': 'application/json',
|
|
108
|
+
},
|
|
109
|
+
timeout: 15000,
|
|
110
|
+
});
|
|
111
|
+
const result = publishResponse.data;
|
|
112
|
+
if (result.success) {
|
|
113
|
+
console.log(chalk_1.default.green.bold('\nā
Successfully Published!'));
|
|
114
|
+
if (result.listing_id) {
|
|
115
|
+
console.log(chalk_1.default.gray(`\nListing ID: ${result.listing_id}`));
|
|
116
|
+
}
|
|
117
|
+
if (result.url) {
|
|
118
|
+
console.log(chalk_1.default.gray(`View at: ${result.url}`));
|
|
119
|
+
}
|
|
120
|
+
if (result.message) {
|
|
121
|
+
console.log(chalk_1.default.cyan(`\n${result.message}`));
|
|
122
|
+
}
|
|
123
|
+
console.log(chalk_1.default.gray('\nYour API is now discoverable in the AMP registry!'));
|
|
124
|
+
console.log(chalk_1.default.gray('AI agents can find and use your API through:'));
|
|
125
|
+
console.log(chalk_1.default.cyan(` ${manifest.homepage}/.well-known/agent-manifest.json`));
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
console.log(chalk_1.default.red.bold('ā Publication Failed'));
|
|
129
|
+
if (result.message) {
|
|
130
|
+
console.log(chalk_1.default.red(`\n${result.message}`));
|
|
131
|
+
}
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch (publishError) {
|
|
136
|
+
if (axios_1.default.isAxiosError(publishError)) {
|
|
137
|
+
if (publishError.response) {
|
|
138
|
+
console.error(chalk_1.default.red('ā Publication Failed'));
|
|
139
|
+
console.error(chalk_1.default.gray(`\nRegistry Error: ${publishError.response.status} ${publishError.response.statusText}`));
|
|
140
|
+
if (publishError.response.data) {
|
|
141
|
+
const errorData = publishError.response.data;
|
|
142
|
+
if (errorData.message) {
|
|
143
|
+
console.log(chalk_1.default.red(`\n${errorData.message}`));
|
|
144
|
+
}
|
|
145
|
+
else if (errorData.error) {
|
|
146
|
+
console.log(chalk_1.default.red(`\n${errorData.error}`));
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
console.log(chalk_1.default.red(`\n${JSON.stringify(errorData, null, 2)}`));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
console.log(chalk_1.default.gray('\nPossible reasons:'));
|
|
153
|
+
console.log(chalk_1.default.gray(' - Manifest not accessible at the specified URL'));
|
|
154
|
+
console.log(chalk_1.default.gray(' - API already registered'));
|
|
155
|
+
console.log(chalk_1.default.gray(' - Registry service temporarily unavailable'));
|
|
156
|
+
}
|
|
157
|
+
else if (publishError.request) {
|
|
158
|
+
console.error(chalk_1.default.red('ā Connection Error'));
|
|
159
|
+
console.error(chalk_1.default.gray('\nCould not connect to registry.'));
|
|
160
|
+
console.error(chalk_1.default.gray('Please check your internet connection and try again.'));
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
console.error(chalk_1.default.red('ā Request Error'));
|
|
164
|
+
console.error(chalk_1.default.gray(`\n${publishError.message}`));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
throw publishError;
|
|
169
|
+
}
|
|
170
|
+
process.exit(1);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
if (error.code === 'ENOENT') {
|
|
175
|
+
console.error(chalk_1.default.red('ā File Not Found'));
|
|
176
|
+
console.error(chalk_1.default.gray(`\nCould not find manifest file at: ${filePath}`));
|
|
177
|
+
console.error(chalk_1.default.gray('\nRun "amp init" to create a new manifest.'));
|
|
178
|
+
}
|
|
179
|
+
else if (error.code === 'EACCES') {
|
|
180
|
+
console.error(chalk_1.default.red('ā Permission Denied'));
|
|
181
|
+
console.error(chalk_1.default.gray(`\nCannot read file: ${filePath}`));
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
console.error(chalk_1.default.red('ā Unexpected Error'));
|
|
185
|
+
console.error(chalk_1.default.gray(`\n${error.message}`));
|
|
186
|
+
}
|
|
187
|
+
process.exit(1);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=publish.js.map
|