@ayurak/aribot-cli 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/cli.js +11 -11
  2. package/package.json +1 -1
  3. package/src/cli.ts +11 -11
package/dist/cli.js CHANGED
@@ -23,12 +23,12 @@ const form_data_1 = __importDefault(require("form-data"));
23
23
  const fs_1 = __importDefault(require("fs"));
24
24
  const path_1 = __importDefault(require("path"));
25
25
  const config = new conf_1.default({ projectName: 'aribot-cli' });
26
- const API_BASE = 'https://api.aribot.ayurak.com';
26
+ const API_BASE = 'https://api.aribot.ayurak.com/aribot-api';
27
27
  const program = new commander_1.Command();
28
28
  program
29
29
  .name('aribot')
30
30
  .description('AI-powered threat modeling CLI by Ayurak')
31
- .version('1.0.0');
31
+ .version('1.0.2');
32
32
  // Helper to get auth headers
33
33
  function getHeaders() {
34
34
  const apiKey = config.get('apiKey');
@@ -67,7 +67,7 @@ program
67
67
  const spinner = (0, ora_1.default)('Validating API key...').start();
68
68
  try {
69
69
  const fetch = (await import('node-fetch')).default;
70
- const response = await fetch(`${API_BASE}/v2/auth/validate/`, {
70
+ const response = await fetch(`${API_BASE}/v1/users/me/`, {
71
71
  headers: { 'Authorization': `Bearer ${apiKey}` }
72
72
  });
73
73
  if (response.ok) {
@@ -100,7 +100,7 @@ program
100
100
  .action(async (options) => {
101
101
  const spinner = (0, ora_1.default)('Fetching diagrams...').start();
102
102
  try {
103
- const data = await apiRequest(`/v2/diagrams/?limit=${options.limit}`);
103
+ const data = await apiRequest(`/v2/threat-modeling/diagrams/?limit=${options.limit}`);
104
104
  spinner.stop();
105
105
  console.log(chalk_1.default.bold('\nYour Diagrams:\n'));
106
106
  if (!data.results?.length) {
@@ -137,7 +137,7 @@ program
137
137
  form.append('name', options.name || path_1.default.basename(file, path_1.default.extname(file)));
138
138
  form.append('auto_generate_threats', options.autoThreats ? 'true' : 'false');
139
139
  const apiKey = config.get('apiKey');
140
- const response = await fetch(`${API_BASE}/v2/diagrams/upload-analyze/`, {
140
+ const response = await fetch(`${API_BASE}/v2/threat-modeling/diagrams/upload-analyze/`, {
141
141
  method: 'POST',
142
142
  headers: { 'Authorization': `Bearer ${apiKey}` },
143
143
  body: form
@@ -157,7 +157,7 @@ program
157
157
  let attempts = 0;
158
158
  while (attempts < 30) {
159
159
  await new Promise(r => setTimeout(r, 2000));
160
- const status = await apiRequest(`/v2/diagrams/${data.id}/`);
160
+ const status = await apiRequest(`/v2/threat-modeling/diagrams/${data.id}/`);
161
161
  if (status.status === 'completed') {
162
162
  threatSpinner.succeed(`Generated ${status.threats_count} threats`);
163
163
  break;
@@ -180,7 +180,7 @@ program
180
180
  .action(async (diagramId, options) => {
181
181
  const spinner = (0, ora_1.default)('Fetching threats...').start();
182
182
  try {
183
- let url = `/v2/diagrams/${diagramId}/threats/`;
183
+ let url = `/v2/threat-modeling/diagrams/${diagramId}/threats/`;
184
184
  if (options.severity) {
185
185
  url += `?severity=${options.severity}`;
186
186
  }
@@ -217,7 +217,7 @@ program
217
217
  try {
218
218
  const fetch = (await import('node-fetch')).default;
219
219
  const apiKey = config.get('apiKey');
220
- const response = await fetch(`${API_BASE}/v2/diagrams/${diagramId}/export/?format=${options.format}`, { headers: { 'Authorization': `Bearer ${apiKey}` } });
220
+ const response = await fetch(`${API_BASE}/v2/threat-modeling/diagrams/${diagramId}/export/?format=${options.format}`, { headers: { 'Authorization': `Bearer ${apiKey}` } });
221
221
  if (!response.ok) {
222
222
  throw new Error(`Export failed: ${response.status}`);
223
223
  }
@@ -244,7 +244,7 @@ program
244
244
  .action(async (diagramId) => {
245
245
  const spinner = (0, ora_1.default)('Generating AI threats...').start();
246
246
  try {
247
- await apiRequest(`/v2/diagrams/${diagramId}/generate-threats/`, {
247
+ await apiRequest(`/v2/threat-modeling/diagrams/${diagramId}/generate-threats/`, {
248
248
  method: 'POST'
249
249
  });
250
250
  spinner.text = 'Processing...';
@@ -252,7 +252,7 @@ program
252
252
  let attempts = 0;
253
253
  while (attempts < 30) {
254
254
  await new Promise(r => setTimeout(r, 2000));
255
- const status = await apiRequest(`/v2/diagrams/${diagramId}/`);
255
+ const status = await apiRequest(`/v2/threat-modeling/diagrams/${diagramId}/`);
256
256
  if (status.ai_threats_generated) {
257
257
  spinner.succeed(`Generated ${status.threats_count} threats`);
258
258
  return;
@@ -278,7 +278,7 @@ program
278
278
  return;
279
279
  }
280
280
  try {
281
- const data = await apiRequest('/v2/auth/me/');
281
+ const data = await apiRequest('/v1/users/me/');
282
282
  console.log(chalk_1.default.green('Authenticated as:'));
283
283
  console.log(` Email: ${data.email}`);
284
284
  console.log(` Company: ${data.company || 'N/A'}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ayurak/aribot-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "AI-powered threat modeling CLI by Ayurak. Automatically analyze diagrams, generate STRIDE threats, and get security recommendations.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/src/cli.ts CHANGED
@@ -20,14 +20,14 @@ import fs from 'fs';
20
20
  import path from 'path';
21
21
 
22
22
  const config = new Conf({ projectName: 'aribot-cli' });
23
- const API_BASE = 'https://api.aribot.ayurak.com';
23
+ const API_BASE = 'https://api.aribot.ayurak.com/aribot-api';
24
24
 
25
25
  const program = new Command();
26
26
 
27
27
  program
28
28
  .name('aribot')
29
29
  .description('AI-powered threat modeling CLI by Ayurak')
30
- .version('1.0.0');
30
+ .version('1.0.2');
31
31
 
32
32
  // Helper to get auth headers
33
33
  function getHeaders(): Record<string, string> {
@@ -73,7 +73,7 @@ program
73
73
 
74
74
  try {
75
75
  const fetch = (await import('node-fetch')).default;
76
- const response = await fetch(`${API_BASE}/v2/auth/validate/`, {
76
+ const response = await fetch(`${API_BASE}/v1/users/me/`, {
77
77
  headers: { 'Authorization': `Bearer ${apiKey}` }
78
78
  });
79
79
 
@@ -108,7 +108,7 @@ program
108
108
  const spinner = ora('Fetching diagrams...').start();
109
109
 
110
110
  try {
111
- const data = await apiRequest(`/v2/diagrams/?limit=${options.limit}`);
111
+ const data = await apiRequest(`/v2/threat-modeling/diagrams/?limit=${options.limit}`);
112
112
  spinner.stop();
113
113
 
114
114
  console.log(chalk.bold('\nYour Diagrams:\n'));
@@ -152,7 +152,7 @@ program
152
152
  form.append('auto_generate_threats', options.autoThreats ? 'true' : 'false');
153
153
 
154
154
  const apiKey = config.get('apiKey') as string;
155
- const response = await fetch(`${API_BASE}/v2/diagrams/upload-analyze/`, {
155
+ const response = await fetch(`${API_BASE}/v2/threat-modeling/diagrams/upload-analyze/`, {
156
156
  method: 'POST',
157
157
  headers: { 'Authorization': `Bearer ${apiKey}` },
158
158
  body: form as any
@@ -177,7 +177,7 @@ program
177
177
  let attempts = 0;
178
178
  while (attempts < 30) {
179
179
  await new Promise(r => setTimeout(r, 2000));
180
- const status = await apiRequest(`/v2/diagrams/${data.id}/`);
180
+ const status = await apiRequest(`/v2/threat-modeling/diagrams/${data.id}/`);
181
181
 
182
182
  if (status.status === 'completed') {
183
183
  threatSpinner.succeed(`Generated ${status.threats_count} threats`);
@@ -203,7 +203,7 @@ program
203
203
  const spinner = ora('Fetching threats...').start();
204
204
 
205
205
  try {
206
- let url = `/v2/diagrams/${diagramId}/threats/`;
206
+ let url = `/v2/threat-modeling/diagrams/${diagramId}/threats/`;
207
207
  if (options.severity) {
208
208
  url += `?severity=${options.severity}`;
209
209
  }
@@ -248,7 +248,7 @@ program
248
248
  const apiKey = config.get('apiKey') as string;
249
249
 
250
250
  const response = await fetch(
251
- `${API_BASE}/v2/diagrams/${diagramId}/export/?format=${options.format}`,
251
+ `${API_BASE}/v2/threat-modeling/diagrams/${diagramId}/export/?format=${options.format}`,
252
252
  { headers: { 'Authorization': `Bearer ${apiKey}` } }
253
253
  );
254
254
 
@@ -281,7 +281,7 @@ program
281
281
  const spinner = ora('Generating AI threats...').start();
282
282
 
283
283
  try {
284
- await apiRequest(`/v2/diagrams/${diagramId}/generate-threats/`, {
284
+ await apiRequest(`/v2/threat-modeling/diagrams/${diagramId}/generate-threats/`, {
285
285
  method: 'POST'
286
286
  });
287
287
 
@@ -291,7 +291,7 @@ program
291
291
  let attempts = 0;
292
292
  while (attempts < 30) {
293
293
  await new Promise(r => setTimeout(r, 2000));
294
- const status = await apiRequest(`/v2/diagrams/${diagramId}/`);
294
+ const status = await apiRequest(`/v2/threat-modeling/diagrams/${diagramId}/`);
295
295
 
296
296
  if (status.ai_threats_generated) {
297
297
  spinner.succeed(`Generated ${status.threats_count} threats`);
@@ -321,7 +321,7 @@ program
321
321
  }
322
322
 
323
323
  try {
324
- const data = await apiRequest('/v2/auth/me/');
324
+ const data = await apiRequest('/v1/users/me/');
325
325
  console.log(chalk.green('Authenticated as:'));
326
326
  console.log(` Email: ${data.email}`);
327
327
  console.log(` Company: ${data.company || 'N/A'}`);