@dupecom/botcha-cli 0.1.0 → 0.2.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/README.md +21 -0
- package/dist/commands/discover.d.ts +7 -0
- package/dist/commands/discover.d.ts.map +1 -0
- package/dist/commands/discover.js +221 -0
- package/dist/commands/discover.js.map +1 -0
- package/dist/commands/tap.d.ts +51 -0
- package/dist/commands/tap.d.ts.map +1 -0
- package/dist/commands/tap.js +448 -0
- package/dist/commands/tap.js.map +1 -0
- package/dist/index.js +53 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -70,6 +70,27 @@ Options:
|
|
|
70
70
|
- `-v, --verbose` - Show all headers (not just BOTCHA)
|
|
71
71
|
- `-q, --quiet` - Minimal output
|
|
72
72
|
|
|
73
|
+
### Discover BOTCHA Endpoints
|
|
74
|
+
|
|
75
|
+
Find all BOTCHA discovery endpoints on a domain:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
botcha discover https://botcha.ai
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Checks for:
|
|
82
|
+
- `/robots.txt` - AI agent instructions
|
|
83
|
+
- `/ai.txt` - AI discovery file
|
|
84
|
+
- `/.well-known/ai-plugin.json` - AI plugin manifest
|
|
85
|
+
- `/openapi.json` - OpenAPI specification
|
|
86
|
+
- `/.well-known/botcha.json` - BOTCHA configuration
|
|
87
|
+
- Embedded challenge in HTML
|
|
88
|
+
|
|
89
|
+
Options:
|
|
90
|
+
- `--json` - Output as JSON
|
|
91
|
+
- `-v, --verbose` - Show recommendations for missing endpoints
|
|
92
|
+
- `-q, --quiet` - Minimal output
|
|
93
|
+
|
|
73
94
|
## Examples
|
|
74
95
|
|
|
75
96
|
### CI/CD Integration
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/commands/discover.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAyLD,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAoE1F"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discover command - Find all BOTCHA discovery endpoints
|
|
3
|
+
*/
|
|
4
|
+
import { Output, formatUrl } from '../lib/output.js';
|
|
5
|
+
const DISCOVERY_ENDPOINTS = [
|
|
6
|
+
{
|
|
7
|
+
path: '/robots.txt',
|
|
8
|
+
description: 'Robots.txt with BOTCHA instructions',
|
|
9
|
+
check: (content) => {
|
|
10
|
+
const hasBotcha = content.toLowerCase().includes('botcha') ||
|
|
11
|
+
content.includes('User-agent: AI') ||
|
|
12
|
+
content.includes('User-agent: *') && content.includes('Allow: /agent');
|
|
13
|
+
return {
|
|
14
|
+
found: hasBotcha,
|
|
15
|
+
details: hasBotcha ? 'Contains AI agent instructions' : undefined,
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
path: '/ai.txt',
|
|
21
|
+
description: 'AI agent discovery file',
|
|
22
|
+
check: (content) => ({
|
|
23
|
+
found: content.length > 0,
|
|
24
|
+
details: content.length > 0 ? 'AI discovery file present' : undefined,
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
path: '/.well-known/ai-plugin.json',
|
|
29
|
+
description: 'AI plugin manifest',
|
|
30
|
+
check: (content) => {
|
|
31
|
+
try {
|
|
32
|
+
const manifest = JSON.parse(content);
|
|
33
|
+
const hasBotcha = manifest.auth?.type === 'botcha' ||
|
|
34
|
+
JSON.stringify(manifest).toLowerCase().includes('botcha');
|
|
35
|
+
return {
|
|
36
|
+
found: true,
|
|
37
|
+
details: hasBotcha
|
|
38
|
+
? `Plugin: ${manifest.name_for_human || manifest.name || 'unknown'} (BOTCHA auth)`
|
|
39
|
+
: `Plugin: ${manifest.name_for_human || manifest.name || 'unknown'}`,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return { found: false };
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
path: '/openapi.json',
|
|
49
|
+
description: 'OpenAPI specification',
|
|
50
|
+
check: (content) => {
|
|
51
|
+
try {
|
|
52
|
+
const spec = JSON.parse(content);
|
|
53
|
+
const hasBotcha = JSON.stringify(spec).toLowerCase().includes('botcha');
|
|
54
|
+
return {
|
|
55
|
+
found: true,
|
|
56
|
+
details: hasBotcha
|
|
57
|
+
? `OpenAPI ${spec.openapi || spec.swagger || '?'} (BOTCHA documented)`
|
|
58
|
+
: `OpenAPI ${spec.openapi || spec.swagger || '?'}`,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return { found: false };
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
path: '/.well-known/botcha.json',
|
|
68
|
+
description: 'BOTCHA configuration',
|
|
69
|
+
check: (content) => {
|
|
70
|
+
try {
|
|
71
|
+
const config = JSON.parse(content);
|
|
72
|
+
return {
|
|
73
|
+
found: true,
|
|
74
|
+
details: `Version: ${config.version || '?'}, Methods: ${config.methods?.join(', ') || '?'}`,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return { found: false };
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
async function checkEndpoint(baseUrl, endpoint, output) {
|
|
84
|
+
const url = new URL(endpoint.path, baseUrl).toString();
|
|
85
|
+
output.debug(`Checking ${url}...`);
|
|
86
|
+
try {
|
|
87
|
+
const response = await fetch(url, {
|
|
88
|
+
headers: {
|
|
89
|
+
'User-Agent': 'BOTCHA-CLI/0.1.0',
|
|
90
|
+
'Accept': 'text/plain, application/json, */*',
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
if (!response.ok) {
|
|
94
|
+
return {
|
|
95
|
+
endpoint: url,
|
|
96
|
+
path: endpoint.path,
|
|
97
|
+
found: false,
|
|
98
|
+
description: endpoint.description,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const content = await response.text();
|
|
102
|
+
const result = endpoint.check(content);
|
|
103
|
+
return {
|
|
104
|
+
endpoint: url,
|
|
105
|
+
path: endpoint.path,
|
|
106
|
+
found: result.found,
|
|
107
|
+
description: endpoint.description,
|
|
108
|
+
details: result.details,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
output.debug(`Error checking ${url}: ${error instanceof Error ? error.message : String(error)}`);
|
|
113
|
+
return {
|
|
114
|
+
endpoint: url,
|
|
115
|
+
path: endpoint.path,
|
|
116
|
+
found: false,
|
|
117
|
+
description: endpoint.description,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async function checkEmbeddedChallenge(baseUrl, output) {
|
|
122
|
+
output.debug(`Checking ${baseUrl} for embedded challenge...`);
|
|
123
|
+
try {
|
|
124
|
+
const response = await fetch(baseUrl, {
|
|
125
|
+
headers: {
|
|
126
|
+
'User-Agent': 'BOTCHA-CLI/0.1.0',
|
|
127
|
+
'Accept': 'text/html, */*',
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
const html = await response.text();
|
|
131
|
+
// Check for embedded BOTCHA script
|
|
132
|
+
const hasEmbedded = html.includes('application/botcha+json') ||
|
|
133
|
+
html.includes('data-botcha') ||
|
|
134
|
+
html.includes('__BOTCHA__');
|
|
135
|
+
// Check for BOTCHA headers
|
|
136
|
+
const hasBotchaHeaders = Array.from(response.headers.keys())
|
|
137
|
+
.some(key => key.toLowerCase().startsWith('x-botcha-'));
|
|
138
|
+
const found = hasEmbedded || hasBotchaHeaders;
|
|
139
|
+
let details;
|
|
140
|
+
if (hasEmbedded) {
|
|
141
|
+
details = 'Embedded challenge script detected';
|
|
142
|
+
}
|
|
143
|
+
else if (hasBotchaHeaders) {
|
|
144
|
+
details = 'BOTCHA headers present';
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
endpoint: baseUrl,
|
|
148
|
+
path: '/',
|
|
149
|
+
found,
|
|
150
|
+
description: 'Embedded challenge in HTML',
|
|
151
|
+
details,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
output.debug(`Error checking embedded: ${error instanceof Error ? error.message : String(error)}`);
|
|
156
|
+
return {
|
|
157
|
+
endpoint: baseUrl,
|
|
158
|
+
path: '/',
|
|
159
|
+
found: false,
|
|
160
|
+
description: 'Embedded challenge in HTML',
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
export async function discoverCommand(url, options) {
|
|
165
|
+
const output = new Output(options);
|
|
166
|
+
// Ensure URL has a trailing slash for proper path resolution
|
|
167
|
+
const baseUrl = url.endsWith('/') ? url.slice(0, -1) : url;
|
|
168
|
+
output.header(`\n🔍 Discovering BOTCHA endpoints at ${formatUrl(baseUrl)}\n`);
|
|
169
|
+
const spinner = output.spinner('Checking discovery endpoints...');
|
|
170
|
+
// Check all endpoints in parallel
|
|
171
|
+
const results = await Promise.all([
|
|
172
|
+
...DISCOVERY_ENDPOINTS.map(endpoint => checkEndpoint(baseUrl, endpoint, output)),
|
|
173
|
+
checkEmbeddedChallenge(baseUrl, output),
|
|
174
|
+
]);
|
|
175
|
+
spinner.stop();
|
|
176
|
+
const foundCount = results.filter(r => r.found).length;
|
|
177
|
+
const totalCount = results.length;
|
|
178
|
+
if (options.json) {
|
|
179
|
+
output.json({
|
|
180
|
+
url: baseUrl,
|
|
181
|
+
results,
|
|
182
|
+
score: foundCount,
|
|
183
|
+
maxScore: totalCount,
|
|
184
|
+
hasProtection: foundCount > 0,
|
|
185
|
+
});
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
// Display results
|
|
189
|
+
console.log('Discovery Results:\n');
|
|
190
|
+
for (const result of results) {
|
|
191
|
+
const icon = result.found ? '✅' : '❌';
|
|
192
|
+
const status = result.found ? result.path : result.path;
|
|
193
|
+
console.log(`${icon} ${status} - ${result.description}`);
|
|
194
|
+
if (result.found && result.details) {
|
|
195
|
+
console.log(` ${result.details}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
console.log();
|
|
199
|
+
// Discovery score
|
|
200
|
+
const stars = foundCount >= 4 ? '⭐⭐⭐' :
|
|
201
|
+
foundCount >= 2 ? '⭐⭐' :
|
|
202
|
+
foundCount >= 1 ? '⭐' : '';
|
|
203
|
+
if (foundCount === 0) {
|
|
204
|
+
output.warn(`Discovery Score: ${foundCount}/${totalCount} - No BOTCHA endpoints found`);
|
|
205
|
+
}
|
|
206
|
+
else if (foundCount < 3) {
|
|
207
|
+
output.info(`Discovery Score: ${foundCount}/${totalCount} ${stars}`);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
output.success(`Discovery Score: ${foundCount}/${totalCount} ${stars}`);
|
|
211
|
+
}
|
|
212
|
+
// Recommendations
|
|
213
|
+
if (options.verbose && foundCount < totalCount) {
|
|
214
|
+
console.log('\nRecommendations:');
|
|
215
|
+
const missing = results.filter(r => !r.found);
|
|
216
|
+
for (const result of missing.slice(0, 3)) {
|
|
217
|
+
console.log(` • Add ${result.path} - ${result.description}`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=discover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../../src/commands/discover.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAgBrD,MAAM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AAoB,UAAU,IAAI,UAAU,8BAA8B,CAAC,CAAC;IAC1F,CAAC;SAAM,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC,oBAAoB,UAAU,IAAI,UAAU,IAAI,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,OAAO,CAAC,oBAAoB,UAAU,IAAI,UAAU,IAAI,KAAK,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,kBAAkB;IAClB,IAAI,OAAO,CAAC,OAAO,IAAI,UAAU,GAAG,UAAU,EAAE,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAElC,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9C,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACzC,OAAO,CAAC,GAAG,CAAC,WAAW,MAAM,CAAC,IAAI,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface TAPOptions {
|
|
2
|
+
url: string;
|
|
3
|
+
appId?: string;
|
|
4
|
+
json?: boolean;
|
|
5
|
+
verbose?: boolean;
|
|
6
|
+
quiet?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface RegisterOptions extends TAPOptions {
|
|
9
|
+
name: string;
|
|
10
|
+
operator?: string;
|
|
11
|
+
trustLevel?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface GetOptions extends TAPOptions {
|
|
14
|
+
agentId: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ListOptions extends TAPOptions {
|
|
17
|
+
tapOnly?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface SessionOptions extends TAPOptions {
|
|
20
|
+
agentId: string;
|
|
21
|
+
intent: string;
|
|
22
|
+
userContext?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Register a TAP agent
|
|
26
|
+
* POST /v1/agents/register/tap
|
|
27
|
+
*/
|
|
28
|
+
export declare function registerCommand(options: RegisterOptions): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Get TAP agent details
|
|
31
|
+
* GET /v1/agents/:id/tap
|
|
32
|
+
*/
|
|
33
|
+
export declare function getCommand(options: GetOptions): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* List TAP agents
|
|
36
|
+
* GET /v1/agents/tap
|
|
37
|
+
*/
|
|
38
|
+
export declare function listCommand(options: ListOptions): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Create TAP session
|
|
41
|
+
* POST /v1/sessions/tap
|
|
42
|
+
*/
|
|
43
|
+
export declare function sessionCommand(options: SessionOptions): Promise<void>;
|
|
44
|
+
declare const _default: {
|
|
45
|
+
register: typeof registerCommand;
|
|
46
|
+
get: typeof getCommand;
|
|
47
|
+
list: typeof listCommand;
|
|
48
|
+
session: typeof sessionCommand;
|
|
49
|
+
};
|
|
50
|
+
export default _default;
|
|
51
|
+
//# sourceMappingURL=tap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tap.d.ts","sourceRoot":"","sources":["../../src/commands/tap.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC5C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAWD;;;GAGG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAyG7E;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAyHnE;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA+GrE;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA2H3E;;;;;;;AAED,wBAKE"}
|
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TAP command - Trusted Agent Protocol commands
|
|
3
|
+
*/
|
|
4
|
+
import { Output } from '../lib/output.js';
|
|
5
|
+
/** Build an API URL with optional app_id query param */
|
|
6
|
+
function buildUrl(baseUrl, path, appId) {
|
|
7
|
+
const url = new URL(path, baseUrl);
|
|
8
|
+
if (appId) {
|
|
9
|
+
url.searchParams.set('app_id', appId);
|
|
10
|
+
}
|
|
11
|
+
return url.toString();
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Register a TAP agent
|
|
15
|
+
* POST /v1/agents/register/tap
|
|
16
|
+
*/
|
|
17
|
+
export async function registerCommand(options) {
|
|
18
|
+
const output = new Output(options);
|
|
19
|
+
const startTime = Date.now();
|
|
20
|
+
try {
|
|
21
|
+
// Validate required fields
|
|
22
|
+
if (!options.url) {
|
|
23
|
+
output.error('--url is required');
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
if (!options.name) {
|
|
27
|
+
output.error('--name is required');
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
output.debug('Registering TAP agent...');
|
|
31
|
+
const baseUrl = new URL(options.url).origin;
|
|
32
|
+
const endpoint = buildUrl(baseUrl, '/v1/agents/register/tap', options.appId);
|
|
33
|
+
// Build request body
|
|
34
|
+
const body = {
|
|
35
|
+
name: options.name,
|
|
36
|
+
};
|
|
37
|
+
if (options.operator) {
|
|
38
|
+
body.operator = options.operator;
|
|
39
|
+
}
|
|
40
|
+
if (options.trustLevel) {
|
|
41
|
+
body.trust_level = options.trustLevel;
|
|
42
|
+
}
|
|
43
|
+
output.debug(`Endpoint: ${endpoint}`);
|
|
44
|
+
output.debug(`Request body: ${JSON.stringify(body, null, 2)}`);
|
|
45
|
+
const response = await fetch(endpoint, {
|
|
46
|
+
method: 'POST',
|
|
47
|
+
headers: {
|
|
48
|
+
'Content-Type': 'application/json',
|
|
49
|
+
},
|
|
50
|
+
body: JSON.stringify(body),
|
|
51
|
+
});
|
|
52
|
+
const data = await response.json();
|
|
53
|
+
const responseTime = Date.now() - startTime;
|
|
54
|
+
if (!response.ok) {
|
|
55
|
+
if (options.json) {
|
|
56
|
+
output.json({
|
|
57
|
+
success: false,
|
|
58
|
+
error: data.error || 'REGISTRATION_FAILED',
|
|
59
|
+
message: data.message || response.statusText,
|
|
60
|
+
status: response.status,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
output.error(`Registration failed: ${data.message || response.statusText}`);
|
|
65
|
+
output.section('Status', response.status.toString());
|
|
66
|
+
output.section('Error', data.error || 'UNKNOWN');
|
|
67
|
+
}
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
if (options.json) {
|
|
71
|
+
output.json({
|
|
72
|
+
success: true,
|
|
73
|
+
...data,
|
|
74
|
+
responseTimeMs: responseTime,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
output.success(`Agent registered in ${responseTime}ms!`);
|
|
79
|
+
output.section('Agent ID', data.agent_id);
|
|
80
|
+
output.section('Name', data.name);
|
|
81
|
+
output.section('App ID', data.app_id);
|
|
82
|
+
if (data.operator) {
|
|
83
|
+
output.section('Operator', data.operator);
|
|
84
|
+
}
|
|
85
|
+
if (data.trust_level) {
|
|
86
|
+
output.section('Trust Level', data.trust_level);
|
|
87
|
+
}
|
|
88
|
+
if (data.tap_enabled) {
|
|
89
|
+
output.section('TAP Enabled', 'true');
|
|
90
|
+
}
|
|
91
|
+
if (options.verbose) {
|
|
92
|
+
console.log('\nFull Response:');
|
|
93
|
+
console.log(JSON.stringify(data, null, 2));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
if (options.json) {
|
|
99
|
+
output.json({
|
|
100
|
+
success: false,
|
|
101
|
+
error: error instanceof Error ? error.message : String(error),
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
output.error(`Registration failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
106
|
+
}
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get TAP agent details
|
|
112
|
+
* GET /v1/agents/:id/tap
|
|
113
|
+
*/
|
|
114
|
+
export async function getCommand(options) {
|
|
115
|
+
const output = new Output(options);
|
|
116
|
+
const startTime = Date.now();
|
|
117
|
+
try {
|
|
118
|
+
if (!options.url) {
|
|
119
|
+
output.error('--url is required');
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
if (!options.agentId) {
|
|
123
|
+
output.error('--agent-id is required');
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
output.debug(`Getting TAP agent ${options.agentId}...`);
|
|
127
|
+
const baseUrl = new URL(options.url).origin;
|
|
128
|
+
const endpoint = buildUrl(baseUrl, `/v1/agents/${encodeURIComponent(options.agentId)}/tap`);
|
|
129
|
+
output.debug(`Endpoint: ${endpoint}`);
|
|
130
|
+
const response = await fetch(endpoint, {
|
|
131
|
+
method: 'GET',
|
|
132
|
+
headers: {
|
|
133
|
+
'Accept': 'application/json',
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
const data = await response.json();
|
|
137
|
+
const responseTime = Date.now() - startTime;
|
|
138
|
+
if (!response.ok) {
|
|
139
|
+
if (options.json) {
|
|
140
|
+
output.json({
|
|
141
|
+
success: false,
|
|
142
|
+
error: data.error || 'GET_FAILED',
|
|
143
|
+
message: data.message || response.statusText,
|
|
144
|
+
status: response.status,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
output.error(`Get failed: ${data.message || response.statusText}`);
|
|
149
|
+
output.section('Status', response.status.toString());
|
|
150
|
+
output.section('Error', data.error || 'UNKNOWN');
|
|
151
|
+
}
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
154
|
+
if (options.json) {
|
|
155
|
+
output.json({
|
|
156
|
+
success: true,
|
|
157
|
+
...data,
|
|
158
|
+
responseTimeMs: responseTime,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
output.success(`Agent retrieved in ${responseTime}ms!`);
|
|
163
|
+
output.section('Agent ID', data.agent_id);
|
|
164
|
+
output.section('Name', data.name);
|
|
165
|
+
output.section('App ID', data.app_id);
|
|
166
|
+
if (data.operator) {
|
|
167
|
+
output.section('Operator', data.operator);
|
|
168
|
+
}
|
|
169
|
+
if (data.version) {
|
|
170
|
+
output.section('Version', data.version);
|
|
171
|
+
}
|
|
172
|
+
if (data.trust_level) {
|
|
173
|
+
output.section('Trust Level', data.trust_level);
|
|
174
|
+
}
|
|
175
|
+
if (data.tap_enabled !== undefined) {
|
|
176
|
+
output.section('TAP Enabled', data.tap_enabled ? 'true' : 'false');
|
|
177
|
+
}
|
|
178
|
+
if (data.signature_algorithm) {
|
|
179
|
+
output.section('Signature Algorithm', data.signature_algorithm);
|
|
180
|
+
}
|
|
181
|
+
if (data.has_public_key) {
|
|
182
|
+
output.section('Has Public Key', 'true');
|
|
183
|
+
if (data.key_fingerprint) {
|
|
184
|
+
output.section('Key Fingerprint', data.key_fingerprint);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (data.created_at) {
|
|
188
|
+
output.section('Created At', data.created_at);
|
|
189
|
+
}
|
|
190
|
+
if (data.capabilities && Array.isArray(data.capabilities)) {
|
|
191
|
+
output.section('Capabilities', data.capabilities.length.toString());
|
|
192
|
+
if (options.verbose && data.capabilities.length > 0) {
|
|
193
|
+
console.log('\nCapabilities:');
|
|
194
|
+
data.capabilities.forEach((cap, idx) => {
|
|
195
|
+
console.log(` ${idx + 1}. ${cap.action}${cap.resource ? ` on ${cap.resource}` : ''}`);
|
|
196
|
+
if (cap.constraints) {
|
|
197
|
+
console.log(` Constraints: ${JSON.stringify(cap.constraints)}`);
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (options.verbose) {
|
|
203
|
+
console.log('\nFull Response:');
|
|
204
|
+
console.log(JSON.stringify(data, null, 2));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
if (options.json) {
|
|
210
|
+
output.json({
|
|
211
|
+
success: false,
|
|
212
|
+
error: error instanceof Error ? error.message : String(error),
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
output.error(`Get failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
217
|
+
}
|
|
218
|
+
process.exit(1);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* List TAP agents
|
|
223
|
+
* GET /v1/agents/tap
|
|
224
|
+
*/
|
|
225
|
+
export async function listCommand(options) {
|
|
226
|
+
const output = new Output(options);
|
|
227
|
+
const startTime = Date.now();
|
|
228
|
+
try {
|
|
229
|
+
if (!options.url) {
|
|
230
|
+
output.error('--url is required');
|
|
231
|
+
process.exit(1);
|
|
232
|
+
}
|
|
233
|
+
output.debug('Listing TAP agents...');
|
|
234
|
+
const baseUrl = new URL(options.url).origin;
|
|
235
|
+
const endpoint = buildUrl(baseUrl, '/v1/agents/tap', options.appId);
|
|
236
|
+
const url = new URL(endpoint);
|
|
237
|
+
if (options.tapOnly) {
|
|
238
|
+
url.searchParams.set('tap_only', 'true');
|
|
239
|
+
}
|
|
240
|
+
output.debug(`Endpoint: ${url.toString()}`);
|
|
241
|
+
const response = await fetch(url.toString(), {
|
|
242
|
+
method: 'GET',
|
|
243
|
+
headers: {
|
|
244
|
+
'Accept': 'application/json',
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
const data = await response.json();
|
|
248
|
+
const responseTime = Date.now() - startTime;
|
|
249
|
+
if (!response.ok) {
|
|
250
|
+
if (options.json) {
|
|
251
|
+
output.json({
|
|
252
|
+
success: false,
|
|
253
|
+
error: data.error || 'LIST_FAILED',
|
|
254
|
+
message: data.message || response.statusText,
|
|
255
|
+
status: response.status,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
output.error(`List failed: ${data.message || response.statusText}`);
|
|
260
|
+
output.section('Status', response.status.toString());
|
|
261
|
+
output.section('Error', data.error || 'UNKNOWN');
|
|
262
|
+
}
|
|
263
|
+
process.exit(1);
|
|
264
|
+
}
|
|
265
|
+
if (options.json) {
|
|
266
|
+
output.json({
|
|
267
|
+
success: true,
|
|
268
|
+
...data,
|
|
269
|
+
responseTimeMs: responseTime,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
output.success(`Agents retrieved in ${responseTime}ms!`);
|
|
274
|
+
output.section('Total Count', data.count?.toString() || '0');
|
|
275
|
+
if (data.tap_enabled_count !== undefined) {
|
|
276
|
+
output.section('TAP Enabled', data.tap_enabled_count.toString());
|
|
277
|
+
}
|
|
278
|
+
if (data.agents && Array.isArray(data.agents) && data.agents.length > 0) {
|
|
279
|
+
console.log('\nAgents:\n');
|
|
280
|
+
// Display as table
|
|
281
|
+
const headers = ['Agent ID', 'Name', 'Operator', 'Trust Level', 'TAP'];
|
|
282
|
+
const rows = data.agents.map((agent) => [
|
|
283
|
+
agent.agent_id,
|
|
284
|
+
agent.name || '-',
|
|
285
|
+
agent.operator || '-',
|
|
286
|
+
agent.trust_level || '-',
|
|
287
|
+
agent.tap_enabled ? '✓' : '✗',
|
|
288
|
+
]);
|
|
289
|
+
output.table(headers, rows);
|
|
290
|
+
if (options.verbose) {
|
|
291
|
+
console.log('\nDetailed Information:');
|
|
292
|
+
data.agents.forEach((agent, idx) => {
|
|
293
|
+
console.log(`\n${idx + 1}. ${agent.name} (${agent.agent_id})`);
|
|
294
|
+
if (agent.version) {
|
|
295
|
+
console.log(` Version: ${agent.version}`);
|
|
296
|
+
}
|
|
297
|
+
if (agent.created_at) {
|
|
298
|
+
console.log(` Created: ${agent.created_at}`);
|
|
299
|
+
}
|
|
300
|
+
if (agent.capabilities && Array.isArray(agent.capabilities)) {
|
|
301
|
+
console.log(` Capabilities: ${agent.capabilities.length}`);
|
|
302
|
+
}
|
|
303
|
+
if (agent.last_verified_at) {
|
|
304
|
+
console.log(` Last Verified: ${agent.last_verified_at}`);
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
console.log('\nNo agents found.');
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
if (options.json) {
|
|
316
|
+
output.json({
|
|
317
|
+
success: false,
|
|
318
|
+
error: error instanceof Error ? error.message : String(error),
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
output.error(`List failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
323
|
+
}
|
|
324
|
+
process.exit(1);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Create TAP session
|
|
329
|
+
* POST /v1/sessions/tap
|
|
330
|
+
*/
|
|
331
|
+
export async function sessionCommand(options) {
|
|
332
|
+
const output = new Output(options);
|
|
333
|
+
const startTime = Date.now();
|
|
334
|
+
try {
|
|
335
|
+
if (!options.url) {
|
|
336
|
+
output.error('--url is required');
|
|
337
|
+
process.exit(1);
|
|
338
|
+
}
|
|
339
|
+
if (!options.agentId) {
|
|
340
|
+
output.error('--agent-id is required');
|
|
341
|
+
process.exit(1);
|
|
342
|
+
}
|
|
343
|
+
if (!options.intent) {
|
|
344
|
+
output.error('--intent is required');
|
|
345
|
+
process.exit(1);
|
|
346
|
+
}
|
|
347
|
+
output.debug('Creating TAP session...');
|
|
348
|
+
const baseUrl = new URL(options.url).origin;
|
|
349
|
+
const endpoint = buildUrl(baseUrl, '/v1/sessions/tap');
|
|
350
|
+
// Parse intent JSON
|
|
351
|
+
let intentObj;
|
|
352
|
+
try {
|
|
353
|
+
intentObj = JSON.parse(options.intent);
|
|
354
|
+
}
|
|
355
|
+
catch {
|
|
356
|
+
output.error('--intent must be valid JSON');
|
|
357
|
+
if (!options.json) {
|
|
358
|
+
console.log('\nExample:');
|
|
359
|
+
console.log(' --intent \'{"action":"read","resource":"documents"}\'');
|
|
360
|
+
}
|
|
361
|
+
process.exit(1);
|
|
362
|
+
}
|
|
363
|
+
// Build request body
|
|
364
|
+
const body = {
|
|
365
|
+
agent_id: options.agentId,
|
|
366
|
+
intent: intentObj,
|
|
367
|
+
user_context: options.userContext || crypto.randomUUID(),
|
|
368
|
+
};
|
|
369
|
+
output.debug(`Endpoint: ${endpoint}`);
|
|
370
|
+
output.debug(`Request body: ${JSON.stringify(body, null, 2)}`);
|
|
371
|
+
const response = await fetch(endpoint, {
|
|
372
|
+
method: 'POST',
|
|
373
|
+
headers: {
|
|
374
|
+
'Content-Type': 'application/json',
|
|
375
|
+
},
|
|
376
|
+
body: JSON.stringify(body),
|
|
377
|
+
});
|
|
378
|
+
const data = await response.json();
|
|
379
|
+
const responseTime = Date.now() - startTime;
|
|
380
|
+
if (!response.ok) {
|
|
381
|
+
if (options.json) {
|
|
382
|
+
output.json({
|
|
383
|
+
success: false,
|
|
384
|
+
error: data.error || 'SESSION_FAILED',
|
|
385
|
+
message: data.message || response.statusText,
|
|
386
|
+
status: response.status,
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
output.error(`Session creation failed: ${data.message || response.statusText}`);
|
|
391
|
+
output.section('Status', response.status.toString());
|
|
392
|
+
output.section('Error', data.error || 'UNKNOWN');
|
|
393
|
+
if (data.error === 'INSUFFICIENT_CAPABILITY') {
|
|
394
|
+
console.log('\nThe agent does not have the required capability for this action.');
|
|
395
|
+
console.log('Register the agent with appropriate capabilities first.');
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
process.exit(1);
|
|
399
|
+
}
|
|
400
|
+
if (options.json) {
|
|
401
|
+
output.json({
|
|
402
|
+
success: true,
|
|
403
|
+
...data,
|
|
404
|
+
responseTimeMs: responseTime,
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
output.success(`Session created in ${responseTime}ms!`);
|
|
409
|
+
output.section('Session ID', data.session_id);
|
|
410
|
+
output.section('Agent ID', data.agent_id);
|
|
411
|
+
if (data.expires_at) {
|
|
412
|
+
output.section('Expires At', data.expires_at);
|
|
413
|
+
}
|
|
414
|
+
if (data.capabilities && Array.isArray(data.capabilities)) {
|
|
415
|
+
output.section('Capabilities', data.capabilities.length.toString());
|
|
416
|
+
}
|
|
417
|
+
if (data.intent) {
|
|
418
|
+
output.section('Intent Action', data.intent.action);
|
|
419
|
+
if (data.intent.resource) {
|
|
420
|
+
output.section('Intent Resource', data.intent.resource);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
if (options.verbose) {
|
|
424
|
+
console.log('\nFull Response:');
|
|
425
|
+
console.log(JSON.stringify(data, null, 2));
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
catch (error) {
|
|
430
|
+
if (options.json) {
|
|
431
|
+
output.json({
|
|
432
|
+
success: false,
|
|
433
|
+
error: error instanceof Error ? error.message : String(error),
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
output.error(`Session creation failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
438
|
+
}
|
|
439
|
+
process.exit(1);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
export default {
|
|
443
|
+
register: registerCommand,
|
|
444
|
+
get: getCommand,
|
|
445
|
+
list: listCommand,
|
|
446
|
+
session: sessionCommand,
|
|
447
|
+
};
|
|
448
|
+
//# sourceMappingURL=tap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tap.js","sourceRoot":"","sources":["../../src/commands/tap.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AA8B1C,wDAAwD;AACxD,SAAS,QAAQ,CAAC,OAAe,EAAE,IAAY,EAAE,KAAc;IAC7D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnC,IAAI,KAAK,EAAE,CAAC;QACV,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAwB;IAC5D,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;IACnC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,IAAI,CAAC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AAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;IAEH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,CAAC,IAAI,CAAC;gBACV,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC9D,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,KAAK,CAAC,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACrG,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,eAAe;IACb,QAAQ,EAAE,eAAe;IACzB,GAAG,EAAE,UAAU;IACf,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,cAAc;CACxB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,11 +7,13 @@ import { testCommand } from './commands/test.js';
|
|
|
7
7
|
import { solveCommand } from './commands/solve.js';
|
|
8
8
|
import { benchmarkCommand } from './commands/benchmark.js';
|
|
9
9
|
import { headersCommand } from './commands/headers.js';
|
|
10
|
+
import { discoverCommand } from './commands/discover.js';
|
|
11
|
+
import tapCommand from './commands/tap.js';
|
|
10
12
|
const program = new Command();
|
|
11
13
|
program
|
|
12
14
|
.name('botcha')
|
|
13
15
|
.description('CLI tool for testing and debugging BOTCHA-protected endpoints')
|
|
14
|
-
.version('0.
|
|
16
|
+
.version('0.2.0');
|
|
15
17
|
// Test command
|
|
16
18
|
program
|
|
17
19
|
.command('test <url>')
|
|
@@ -51,6 +53,56 @@ program
|
|
|
51
53
|
.option('-v, --verbose', 'Show all headers')
|
|
52
54
|
.option('-q, --quiet', 'Minimal output')
|
|
53
55
|
.action(headersCommand);
|
|
56
|
+
// Discover command
|
|
57
|
+
program
|
|
58
|
+
.command('discover <url>')
|
|
59
|
+
.description('Find all BOTCHA discovery endpoints on a domain')
|
|
60
|
+
.option('--json', 'Output as JSON')
|
|
61
|
+
.option('-v, --verbose', 'Show recommendations')
|
|
62
|
+
.option('-q, --quiet', 'Minimal output')
|
|
63
|
+
.action(discoverCommand);
|
|
64
|
+
// TAP command (parent with subcommands)
|
|
65
|
+
const tap = program
|
|
66
|
+
.command('tap')
|
|
67
|
+
.description('Trusted Agent Protocol (TAP) commands');
|
|
68
|
+
tap.command('register')
|
|
69
|
+
.description('Register a TAP agent')
|
|
70
|
+
.requiredOption('--url <url>', 'BOTCHA service URL')
|
|
71
|
+
.requiredOption('--name <name>', 'Agent name')
|
|
72
|
+
.option('--app-id <id>', 'App ID for authentication')
|
|
73
|
+
.option('--operator <operator>', 'Agent operator/organization')
|
|
74
|
+
.option('--trust-level <level>', 'Trust level (basic, verified, enterprise)')
|
|
75
|
+
.option('--json', 'Output as JSON')
|
|
76
|
+
.option('-v, --verbose', 'Show detailed output')
|
|
77
|
+
.option('-q, --quiet', 'Minimal output')
|
|
78
|
+
.action(tapCommand.register);
|
|
79
|
+
tap.command('get')
|
|
80
|
+
.description('Get TAP agent details')
|
|
81
|
+
.requiredOption('--url <url>', 'BOTCHA service URL')
|
|
82
|
+
.requiredOption('--agent-id <id>', 'Agent ID')
|
|
83
|
+
.option('--json', 'Output as JSON')
|
|
84
|
+
.option('-v, --verbose', 'Show detailed output')
|
|
85
|
+
.option('-q, --quiet', 'Minimal output')
|
|
86
|
+
.action(tapCommand.get);
|
|
87
|
+
tap.command('list')
|
|
88
|
+
.description('List TAP agents')
|
|
89
|
+
.requiredOption('--url <url>', 'BOTCHA service URL')
|
|
90
|
+
.option('--app-id <id>', 'App ID for authentication')
|
|
91
|
+
.option('--tap-only', 'Only show TAP-enabled agents')
|
|
92
|
+
.option('--json', 'Output as JSON')
|
|
93
|
+
.option('-v, --verbose', 'Show detailed output')
|
|
94
|
+
.option('-q, --quiet', 'Minimal output')
|
|
95
|
+
.action(tapCommand.list);
|
|
96
|
+
tap.command('session')
|
|
97
|
+
.description('Create TAP session')
|
|
98
|
+
.requiredOption('--url <url>', 'BOTCHA service URL')
|
|
99
|
+
.requiredOption('--agent-id <id>', 'Agent ID')
|
|
100
|
+
.requiredOption('--intent <json>', 'Intent as JSON string')
|
|
101
|
+
.option('--user-context <hash>', 'User context hash')
|
|
102
|
+
.option('--json', 'Output as JSON')
|
|
103
|
+
.option('-v, --verbose', 'Show detailed output')
|
|
104
|
+
.option('-q, --quiet', 'Minimal output')
|
|
105
|
+
.action(tapCommand.session);
|
|
54
106
|
// Parse and execute
|
|
55
107
|
program.parse();
|
|
56
108
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB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C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dupecom/botcha-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "CLI tool for testing and debugging BOTCHA-protected endpoints",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "tsc",
|
|
18
18
|
"dev": "tsx src/index.ts",
|
|
19
|
-
"prepublishOnly": "
|
|
19
|
+
"prepublishOnly": "bun run build"
|
|
20
20
|
},
|
|
21
21
|
"keywords": [
|
|
22
22
|
"botcha",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
34
|
-
"url": "https://github.com/
|
|
34
|
+
"url": "https://github.com/dupe-com/botcha"
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://botcha.ai",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@dupecom/botcha": "^0.
|
|
38
|
+
"@dupecom/botcha": "^0.13.1",
|
|
39
39
|
"chalk": "^5.3.0",
|
|
40
40
|
"commander": "^12.1.0"
|
|
41
41
|
},
|