sphereai-cli 1.0.20 → 1.0.23
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/index.js +1 -108
- package/package.json +4 -2
- package/dist/commands/auth.d.ts +0 -3
- package/dist/commands/auth.d.ts.map +0 -1
- package/dist/commands/auth.js +0 -193
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/debug.d.ts +0 -3
- package/dist/commands/debug.d.ts.map +0 -1
- package/dist/commands/debug.js +0 -49
- package/dist/commands/debug.js.map +0 -1
- package/dist/commands/execute.d.ts +0 -3
- package/dist/commands/execute.d.ts.map +0 -1
- package/dist/commands/execute.js +0 -189
- package/dist/commands/execute.js.map +0 -1
- package/dist/commands/files.d.ts +0 -3
- package/dist/commands/files.d.ts.map +0 -1
- package/dist/commands/files.js +0 -235
- package/dist/commands/files.js.map +0 -1
- package/dist/commands/init.d.ts +0 -3
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -71
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/prompts.d.ts +0 -3
- package/dist/commands/prompts.d.ts.map +0 -1
- package/dist/commands/prompts.js +0 -72
- package/dist/commands/prompts.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/services/api-client.d.ts +0 -15
- package/dist/services/api-client.d.ts.map +0 -1
- package/dist/services/api-client.js +0 -92
- package/dist/services/api-client.js.map +0 -1
- package/dist/services/auth-service.d.ts +0 -23
- package/dist/services/auth-service.d.ts.map +0 -1
- package/dist/services/auth-service.js +0 -166
- package/dist/services/auth-service.js.map +0 -1
- package/dist/services/cli-api-client.d.ts +0 -18
- package/dist/services/cli-api-client.d.ts.map +0 -1
- package/dist/services/cli-api-client.js +0 -57
- package/dist/services/cli-api-client.js.map +0 -1
- package/dist/services/config-service.d.ts +0 -46
- package/dist/services/config-service.d.ts.map +0 -1
- package/dist/services/config-service.js +0 -101
- package/dist/services/config-service.js.map +0 -1
- package/dist/services/file-tracking-service.d.ts +0 -62
- package/dist/services/file-tracking-service.d.ts.map +0 -1
- package/dist/services/file-tracking-service.js +0 -207
- package/dist/services/file-tracking-service.js.map +0 -1
- package/dist/types/api-types.d.ts +0 -83
- package/dist/types/api-types.d.ts.map +0 -1
- package/dist/types/api-types.js +0 -10
- package/dist/types/api-types.js.map +0 -1
- package/dist/utils/axios-debug.d.ts +0 -15
- package/dist/utils/axios-debug.d.ts.map +0 -1
- package/dist/utils/axios-debug.js +0 -53
- package/dist/utils/axios-debug.js.map +0 -1
- package/dist/utils/errors.d.ts +0 -38
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js +0 -115
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/formatters.d.ts +0 -35
- package/dist/utils/formatters.d.ts.map +0 -1
- package/dist/utils/formatters.js +0 -101
- package/dist/utils/formatters.js.map +0 -1
- package/dist/utils/sphereignore.d.ts +0 -34
- package/dist/utils/sphereignore.d.ts.map +0 -1
- package/dist/utils/sphereignore.js +0 -148
- package/dist/utils/sphereignore.js.map +0 -1
|
@@ -1,207 +0,0 @@
|
|
|
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.fileTrackingService = exports.FileTrackingService = void 0;
|
|
37
|
-
const fs = __importStar(require("fs"));
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
const config_service_1 = require("./config-service");
|
|
40
|
-
const sphereignore_1 = require("../utils/sphereignore");
|
|
41
|
-
/**
|
|
42
|
-
* Service to manage tracked files (similar to git staging)
|
|
43
|
-
*/
|
|
44
|
-
class FileTrackingService {
|
|
45
|
-
constructor() {
|
|
46
|
-
this.sphereIgnore = new sphereignore_1.SphereIgnore();
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Get all tracked files
|
|
50
|
-
*/
|
|
51
|
-
getTrackedFiles() {
|
|
52
|
-
return config_service_1.configService.getTrackedFiles();
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Add a single file to tracking
|
|
56
|
-
*/
|
|
57
|
-
addFile(filePath) {
|
|
58
|
-
const absolutePath = path.resolve(filePath);
|
|
59
|
-
const relativePath = path.relative(process.cwd(), absolutePath);
|
|
60
|
-
// Check if file exists
|
|
61
|
-
if (!fs.existsSync(absolutePath)) {
|
|
62
|
-
return { added: false, reason: `File does not exist: ${filePath}` };
|
|
63
|
-
}
|
|
64
|
-
// Check if it's a directory
|
|
65
|
-
const stats = fs.statSync(absolutePath);
|
|
66
|
-
if (stats.isDirectory()) {
|
|
67
|
-
return { added: false, reason: `Path is a directory, use 'sphere files add .' to add all files` };
|
|
68
|
-
}
|
|
69
|
-
// Check if file should be ignored
|
|
70
|
-
if (this.sphereIgnore.shouldIgnore(relativePath)) {
|
|
71
|
-
return { added: false, reason: `File is ignored by .sphereignore: ${relativePath}` };
|
|
72
|
-
}
|
|
73
|
-
// Get current tracked files
|
|
74
|
-
const tracked = this.getTrackedFiles();
|
|
75
|
-
// Check if already tracked
|
|
76
|
-
if (tracked.some(f => f.path === relativePath)) {
|
|
77
|
-
return { added: false, reason: `File already tracked: ${relativePath}` };
|
|
78
|
-
}
|
|
79
|
-
// Add file to tracking
|
|
80
|
-
tracked.push({
|
|
81
|
-
path: relativePath,
|
|
82
|
-
addedAt: new Date().toISOString(),
|
|
83
|
-
size: stats.size,
|
|
84
|
-
exists: true
|
|
85
|
-
});
|
|
86
|
-
config_service_1.configService.setTrackedFiles(tracked);
|
|
87
|
-
return { added: true };
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Add multiple files (recursively from a directory)
|
|
91
|
-
*/
|
|
92
|
-
addDirectory(dirPath = '.') {
|
|
93
|
-
const absolutePath = path.resolve(dirPath);
|
|
94
|
-
const result = {
|
|
95
|
-
added: [],
|
|
96
|
-
ignored: [],
|
|
97
|
-
errors: []
|
|
98
|
-
};
|
|
99
|
-
if (!fs.existsSync(absolutePath)) {
|
|
100
|
-
result.errors.push(`Directory does not exist: ${dirPath}`);
|
|
101
|
-
return result;
|
|
102
|
-
}
|
|
103
|
-
const files = this.walkDirectory(absolutePath);
|
|
104
|
-
for (const file of files) {
|
|
105
|
-
const relativePath = path.relative(process.cwd(), file);
|
|
106
|
-
if (this.sphereIgnore.shouldIgnore(relativePath)) {
|
|
107
|
-
result.ignored.push(relativePath);
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
const addResult = this.addFile(file);
|
|
111
|
-
if (addResult.added) {
|
|
112
|
-
result.added.push(relativePath);
|
|
113
|
-
}
|
|
114
|
-
else if (addResult.reason?.includes('already tracked')) {
|
|
115
|
-
// Skip silently if already tracked
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
else if (addResult.reason) {
|
|
119
|
-
result.errors.push(addResult.reason);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return result;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Recursively walk a directory and return all file paths
|
|
126
|
-
*/
|
|
127
|
-
walkDirectory(dir) {
|
|
128
|
-
const files = [];
|
|
129
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
130
|
-
for (const entry of entries) {
|
|
131
|
-
const fullPath = path.join(dir, entry.name);
|
|
132
|
-
const relativePath = path.relative(process.cwd(), fullPath);
|
|
133
|
-
// Check if should be ignored before recursing
|
|
134
|
-
if (this.sphereIgnore.shouldIgnore(relativePath)) {
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
if (entry.isDirectory()) {
|
|
138
|
-
files.push(...this.walkDirectory(fullPath));
|
|
139
|
-
}
|
|
140
|
-
else if (entry.isFile()) {
|
|
141
|
-
files.push(fullPath);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return files;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Remove a file from tracking
|
|
148
|
-
*/
|
|
149
|
-
removeFile(filePath) {
|
|
150
|
-
const relativePath = path.relative(process.cwd(), path.resolve(filePath));
|
|
151
|
-
const tracked = this.getTrackedFiles();
|
|
152
|
-
const index = tracked.findIndex(f => f.path === relativePath);
|
|
153
|
-
if (index === -1) {
|
|
154
|
-
return { removed: false, reason: `File not tracked: ${relativePath}` };
|
|
155
|
-
}
|
|
156
|
-
tracked.splice(index, 1);
|
|
157
|
-
config_service_1.configService.setTrackedFiles(tracked);
|
|
158
|
-
return { removed: true };
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Clear all tracked files
|
|
162
|
-
*/
|
|
163
|
-
clearAll() {
|
|
164
|
-
const tracked = this.getTrackedFiles();
|
|
165
|
-
const count = tracked.length;
|
|
166
|
-
config_service_1.configService.clearTrackedFiles();
|
|
167
|
-
return count;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Get status of tracked files
|
|
171
|
-
*/
|
|
172
|
-
getStatus() {
|
|
173
|
-
const tracked = this.getTrackedFiles();
|
|
174
|
-
const exists = [];
|
|
175
|
-
const missing = [];
|
|
176
|
-
for (const file of tracked) {
|
|
177
|
-
const absolutePath = path.resolve(file.path);
|
|
178
|
-
const fileExists = fs.existsSync(absolutePath);
|
|
179
|
-
const updatedFile = { ...file, exists: fileExists };
|
|
180
|
-
if (fileExists) {
|
|
181
|
-
// Update size if file exists
|
|
182
|
-
const stats = fs.statSync(absolutePath);
|
|
183
|
-
updatedFile.size = stats.size;
|
|
184
|
-
exists.push(updatedFile);
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
missing.push(updatedFile);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return { exists, missing, total: tracked.length };
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Get the SphereIgnore instance
|
|
194
|
-
*/
|
|
195
|
-
getSphereIgnore() {
|
|
196
|
-
return this.sphereIgnore;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Reload .sphereignore patterns
|
|
200
|
-
*/
|
|
201
|
-
reloadIgnorePatterns() {
|
|
202
|
-
this.sphereIgnore = new sphereignore_1.SphereIgnore();
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
exports.FileTrackingService = FileTrackingService;
|
|
206
|
-
exports.fileTrackingService = new FileTrackingService();
|
|
207
|
-
//# sourceMappingURL=file-tracking-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-tracking-service.js","sourceRoot":"","sources":["../../src/services/file-tracking-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,qDAA8D;AAC9D,wDAAqD;AAKrD;;GAEG;AACH,MAAa,mBAAmB;IAG9B;QACE,IAAI,CAAC,YAAY,GAAG,IAAI,2BAAY,EAAE,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,eAAe;QACpB,OAAO,8BAAa,CAAC,eAAe,EAAE,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,OAAO,CAAC,QAAgB;QAC7B,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC5C,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,YAAY,CAAC,CAAC;QAEhE,uBAAuB;QACvB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YACjC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,wBAAwB,QAAQ,EAAE,EAAE,CAAC;QACtE,CAAC;QAED,4BAA4B;QAC5B,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QACxC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,gEAAgE,EAAE,CAAC;QACpG,CAAC;QAED,kCAAkC;QAClC,IAAI,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,CAAC;YACjD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,qCAAqC,YAAY,EAAE,EAAE,CAAC;QACvF,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MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC7C,MAAM,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;YAE/C,MAAM,WAAW,GAAG,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;YAEpD,IAAI,UAAU,EAAE,CAAC;gBACf,6BAA6B;gBAC7B,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;gBACxC,WAAW,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;gBAC9B,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC3B,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;IACpD,CAAC;IAED;;OAEG;IACI,eAAe;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;OAEG;IACI,oBAAoB;QACzB,IAAI,CAAC,YAAY,GAAG,IAAI,2BAAY,EAAE,CAAC;IACzC,CAAC;CACF;AA/LD,kDA+LC;AAEY,QAAA,mBAAmB,GAAG,IAAI,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
export interface UserKeyRequest {
|
|
2
|
-
key: string;
|
|
3
|
-
}
|
|
4
|
-
export interface AuthResponse {
|
|
5
|
-
jwtToken: string;
|
|
6
|
-
tokenType: string;
|
|
7
|
-
expiresIn: number;
|
|
8
|
-
userId: number;
|
|
9
|
-
userName: string;
|
|
10
|
-
channelId: number;
|
|
11
|
-
channelName: string;
|
|
12
|
-
tokenExpiration: string;
|
|
13
|
-
}
|
|
14
|
-
export interface User {
|
|
15
|
-
id: number;
|
|
16
|
-
customerId: number;
|
|
17
|
-
customerName: string;
|
|
18
|
-
name: string | null;
|
|
19
|
-
email: string | null;
|
|
20
|
-
role: UserRole;
|
|
21
|
-
active: boolean;
|
|
22
|
-
createdAt: string;
|
|
23
|
-
updatedAt: string | null;
|
|
24
|
-
deletedAt: string | null;
|
|
25
|
-
}
|
|
26
|
-
export declare enum UserRole {
|
|
27
|
-
Admin = "Admin",
|
|
28
|
-
User = "User"
|
|
29
|
-
}
|
|
30
|
-
export interface PaginatedResponse<T> {
|
|
31
|
-
data: T[];
|
|
32
|
-
page: number;
|
|
33
|
-
size: number;
|
|
34
|
-
totalCount: number;
|
|
35
|
-
totalPages: number;
|
|
36
|
-
}
|
|
37
|
-
export interface ProblemDetails {
|
|
38
|
-
type?: string;
|
|
39
|
-
title?: string;
|
|
40
|
-
status?: number;
|
|
41
|
-
detail?: string;
|
|
42
|
-
instance?: string;
|
|
43
|
-
errors?: {
|
|
44
|
-
[key: string]: string[];
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
export interface ApiClientOptions {
|
|
48
|
-
baseURL?: string;
|
|
49
|
-
token?: string;
|
|
50
|
-
}
|
|
51
|
-
export interface ListQueryParams {
|
|
52
|
-
_page?: number;
|
|
53
|
-
_size?: number;
|
|
54
|
-
_order?: string;
|
|
55
|
-
[key: string]: any;
|
|
56
|
-
}
|
|
57
|
-
export interface PromptResponse {
|
|
58
|
-
id: number;
|
|
59
|
-
name: string | null;
|
|
60
|
-
shortDescription: string | null;
|
|
61
|
-
temperature: number;
|
|
62
|
-
customerId: number | null;
|
|
63
|
-
channelId: number;
|
|
64
|
-
createdAt: string;
|
|
65
|
-
updatedAt: string | null;
|
|
66
|
-
}
|
|
67
|
-
export interface CliFile {
|
|
68
|
-
path: string | null;
|
|
69
|
-
name: string | null;
|
|
70
|
-
code: string | null;
|
|
71
|
-
}
|
|
72
|
-
export interface ModelUserRequest {
|
|
73
|
-
promptId: number;
|
|
74
|
-
files: CliFile[] | null;
|
|
75
|
-
}
|
|
76
|
-
export interface ModelUserResponse {
|
|
77
|
-
shortAnswer: string | null;
|
|
78
|
-
detailedAnswer: string | null;
|
|
79
|
-
inputTokens: number;
|
|
80
|
-
outputTokens: number;
|
|
81
|
-
totalTokens: number;
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=api-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-types.d.ts","sourceRoot":"","sources":["../../src/types/api-types.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,oBAAY,QAAQ;IAClB,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAGD,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE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EAAE,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
package/dist/types/api-types.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Core API Response Types
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.UserRole = void 0;
|
|
5
|
-
var UserRole;
|
|
6
|
-
(function (UserRole) {
|
|
7
|
-
UserRole["Admin"] = "Admin";
|
|
8
|
-
UserRole["User"] = "User";
|
|
9
|
-
})(UserRole || (exports.UserRole = UserRole = {}));
|
|
10
|
-
//# sourceMappingURL=api-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-types.js","sourceRoot":"","sources":["../../src/types/api-types.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AA+B1B,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,2BAAe,CAAA;IACf,yBAAa,CAAA;AACf,CAAC,EAHW,QAAQ,wBAAR,QAAQ,QAGnB"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { InternalAxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
|
|
2
|
-
import { ProblemDetails } from '../types/api-types';
|
|
3
|
-
/**
|
|
4
|
-
* Debug request interceptor
|
|
5
|
-
*/
|
|
6
|
-
export declare const debugRequestInterceptor: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig<any>;
|
|
7
|
-
/**
|
|
8
|
-
* Debug response interceptor - success handler
|
|
9
|
-
*/
|
|
10
|
-
export declare const debugResponseInterceptor: (response: AxiosResponse) => AxiosResponse<any, any, {}>;
|
|
11
|
-
/**
|
|
12
|
-
* Debug response interceptor - error handler
|
|
13
|
-
*/
|
|
14
|
-
export declare const debugErrorInterceptor: (error: AxiosError<ProblemDetails>) => Promise<never>;
|
|
15
|
-
//# sourceMappingURL=axios-debug.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"axios-debug.d.ts","sourceRoot":"","sources":["../../src/utils/axios-debug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,QAAQ,0BAA0B,oCAYzE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,UAAU,aAAa,gCAU/D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,UAAU,CAAC,cAAc,CAAC,mBAUtE,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.debugErrorInterceptor = exports.debugResponseInterceptor = exports.debugRequestInterceptor = void 0;
|
|
4
|
-
const config_service_1 = require("../services/config-service");
|
|
5
|
-
const errors_1 = require("./errors");
|
|
6
|
-
/**
|
|
7
|
-
* Debug request interceptor
|
|
8
|
-
*/
|
|
9
|
-
const debugRequestInterceptor = (config) => {
|
|
10
|
-
if (config_service_1.configService.getDebugMode()) {
|
|
11
|
-
console.log('\n[DEBUG] API Request:');
|
|
12
|
-
console.log('URL:', `${config.baseURL}${config.url}`);
|
|
13
|
-
console.log('Method:', config.method?.toUpperCase());
|
|
14
|
-
console.log('Headers:', JSON.stringify(config.headers, null, 2));
|
|
15
|
-
if (config.data) {
|
|
16
|
-
console.log('Body:', JSON.stringify(config.data, null, 2));
|
|
17
|
-
}
|
|
18
|
-
console.log('---\n');
|
|
19
|
-
}
|
|
20
|
-
return config;
|
|
21
|
-
};
|
|
22
|
-
exports.debugRequestInterceptor = debugRequestInterceptor;
|
|
23
|
-
/**
|
|
24
|
-
* Debug response interceptor - success handler
|
|
25
|
-
*/
|
|
26
|
-
const debugResponseInterceptor = (response) => {
|
|
27
|
-
if (config_service_1.configService.getDebugMode()) {
|
|
28
|
-
console.log('\n[DEBUG] API Response:');
|
|
29
|
-
console.log('URL:', response.config.url);
|
|
30
|
-
console.log('Status:', response.status, response.statusText);
|
|
31
|
-
console.log('Headers:', JSON.stringify(response.headers, null, 2));
|
|
32
|
-
console.log('Data:', JSON.stringify(response.data, null, 2));
|
|
33
|
-
console.log('---\n');
|
|
34
|
-
}
|
|
35
|
-
return response;
|
|
36
|
-
};
|
|
37
|
-
exports.debugResponseInterceptor = debugResponseInterceptor;
|
|
38
|
-
/**
|
|
39
|
-
* Debug response interceptor - error handler
|
|
40
|
-
*/
|
|
41
|
-
const debugErrorInterceptor = (error) => {
|
|
42
|
-
if (config_service_1.configService.getDebugMode()) {
|
|
43
|
-
console.log('\n[DEBUG] API Error:');
|
|
44
|
-
console.log('URL:', error.config?.url);
|
|
45
|
-
console.log('Status:', error.response?.status);
|
|
46
|
-
console.log('Headers:', JSON.stringify(error.response?.headers, null, 2));
|
|
47
|
-
console.log('Data:', JSON.stringify(error.response?.data, null, 2));
|
|
48
|
-
console.log('---\n');
|
|
49
|
-
}
|
|
50
|
-
return Promise.reject((0, errors_1.handleError)(error));
|
|
51
|
-
};
|
|
52
|
-
exports.debugErrorInterceptor = debugErrorInterceptor;
|
|
53
|
-
//# sourceMappingURL=axios-debug.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"axios-debug.js","sourceRoot":"","sources":["../../src/utils/axios-debug.ts"],"names":[],"mappings":";;;AACA,+DAA2D;AAE3D,qCAAuC;AAEvC;;GAEG;AACI,MAAM,uBAAuB,GAAG,CAAC,MAAkC,EAAE,EAAE;IAC5E,IAAI,8BAAa,CAAC,YAAY,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C,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7D,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAVW,QAAA,wBAAwB,4BAUnC;AAEF;;GAEG;AACI,MAAM,qBAAqB,GAAG,CAAC,KAAiC,EAAE,EAAE;IACzE,IAAI,8BAAa,CAAC,YAAY,EAAE,EAAE,CAAC;QACjC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1E,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACpE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAA,oBAAW,EAAC,KAAK,CAAC,CAAC,CAAC;AAC5C,CAAC,CAAC;AAVW,QAAA,qBAAqB,yBAUhC"}
|
package/dist/utils/errors.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { AxiosError } from "axios";
|
|
2
|
-
import { ProblemDetails } from "../types/api-types";
|
|
3
|
-
/**
|
|
4
|
-
* Custom error class for CLI errors
|
|
5
|
-
*/
|
|
6
|
-
export declare class CLIError extends Error {
|
|
7
|
-
code?: string | undefined;
|
|
8
|
-
constructor(message: string, code?: string | undefined);
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Authentication error
|
|
12
|
-
*/
|
|
13
|
-
export declare class AuthenticationError extends CLIError {
|
|
14
|
-
constructor(message?: string);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Configuration error
|
|
18
|
-
*/
|
|
19
|
-
export declare class ConfigurationError extends CLIError {
|
|
20
|
-
constructor(message: string);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* API error
|
|
24
|
-
*/
|
|
25
|
-
export declare class APIError extends CLIError {
|
|
26
|
-
statusCode?: number | undefined;
|
|
27
|
-
constructor(message: string, statusCode?: number | undefined);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Handle and display errors
|
|
31
|
-
*/
|
|
32
|
-
export declare function handleError(err: unknown): void;
|
|
33
|
-
/**
|
|
34
|
-
* Require authentication and throw error if not authenticated
|
|
35
|
-
*/
|
|
36
|
-
export declare function requireAuth(token: string | undefined): asserts token is string;
|
|
37
|
-
export declare function handleAxiosError(error: AxiosError<ProblemDetails>): Error;
|
|
38
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACG,IAAI,CAAC,EAAE,MAAM;gBAArC,OAAO,EAAE,MAAM,EAAS,IAAI,CAAC,EAAE,MAAM,YAAA;CAKlD;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,QAAQ;gBAE7C,OAAO,GAAE,MAAuE;CAKnF;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,QAAQ;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,QAAQ;IACA,UAAU,CAAC,EAAE,MAAM;gBAA3C,OAAO,EAAE,MAAM,EAAS,UAAU,CAAC,EAAE,MAAM,YAAA;CAIxD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAkB9C;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,OAAO,CAAC,KAAK,IAAI,MAAM,CAIzB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,GAAG,KAAK,CAsCzE"}
|
package/dist/utils/errors.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.APIError = exports.ConfigurationError = exports.AuthenticationError = exports.CLIError = void 0;
|
|
4
|
-
exports.handleError = handleError;
|
|
5
|
-
exports.requireAuth = requireAuth;
|
|
6
|
-
exports.handleAxiosError = handleAxiosError;
|
|
7
|
-
const formatters_1 = require("./formatters");
|
|
8
|
-
/**
|
|
9
|
-
* Custom error class for CLI errors
|
|
10
|
-
*/
|
|
11
|
-
class CLIError extends Error {
|
|
12
|
-
constructor(message, code) {
|
|
13
|
-
super(message);
|
|
14
|
-
this.code = code;
|
|
15
|
-
this.name = "CLIError";
|
|
16
|
-
Object.setPrototypeOf(this, CLIError.prototype);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.CLIError = CLIError;
|
|
20
|
-
/**
|
|
21
|
-
* Authentication error
|
|
22
|
-
*/
|
|
23
|
-
class AuthenticationError extends CLIError {
|
|
24
|
-
constructor(message = 'Authentication required. Please login using "sphereai login"') {
|
|
25
|
-
super(message, "AUTH_REQUIRED");
|
|
26
|
-
this.name = "AuthenticationError";
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.AuthenticationError = AuthenticationError;
|
|
30
|
-
/**
|
|
31
|
-
* Configuration error
|
|
32
|
-
*/
|
|
33
|
-
class ConfigurationError extends CLIError {
|
|
34
|
-
constructor(message) {
|
|
35
|
-
super(message, "CONFIG_ERROR");
|
|
36
|
-
this.name = "ConfigurationError";
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.ConfigurationError = ConfigurationError;
|
|
40
|
-
/**
|
|
41
|
-
* API error
|
|
42
|
-
*/
|
|
43
|
-
class APIError extends CLIError {
|
|
44
|
-
constructor(message, statusCode) {
|
|
45
|
-
super(message, "API_ERROR");
|
|
46
|
-
this.statusCode = statusCode;
|
|
47
|
-
this.name = "APIError";
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.APIError = APIError;
|
|
51
|
-
/**
|
|
52
|
-
* Handle and display errors
|
|
53
|
-
*/
|
|
54
|
-
function handleError(err) {
|
|
55
|
-
if (err instanceof CLIError) {
|
|
56
|
-
(0, formatters_1.error)(err.message);
|
|
57
|
-
if (process.env.DEBUG) {
|
|
58
|
-
console.error("Stack trace:", err.stack);
|
|
59
|
-
}
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
else if (err instanceof Error) {
|
|
63
|
-
(0, formatters_1.error)(err.message);
|
|
64
|
-
if (process.env.DEBUG) {
|
|
65
|
-
console.error("Stack trace:", err.stack);
|
|
66
|
-
}
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
(0, formatters_1.error)("An unexpected error occurred");
|
|
71
|
-
console.error(err);
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Require authentication and throw error if not authenticated
|
|
77
|
-
*/
|
|
78
|
-
function requireAuth(token) {
|
|
79
|
-
if (!token) {
|
|
80
|
-
throw new AuthenticationError();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function handleAxiosError(error) {
|
|
84
|
-
if (error.response) {
|
|
85
|
-
const { status, data } = error.response;
|
|
86
|
-
// Handle specific status codes
|
|
87
|
-
switch (status) {
|
|
88
|
-
case 401:
|
|
89
|
-
return new Error('Authentication failed. Please login again using "sphereai login"');
|
|
90
|
-
case 403:
|
|
91
|
-
return new Error("Access denied. You do not have permission to perform this action.");
|
|
92
|
-
case 404:
|
|
93
|
-
return new Error(data?.detail || "Resource not found");
|
|
94
|
-
case 400:
|
|
95
|
-
if (data?.errors) {
|
|
96
|
-
const errorMessages = Object.entries(data.errors)
|
|
97
|
-
.map(([field, messages]) => `${field}: ${messages.join(", ")}`)
|
|
98
|
-
.join("\n");
|
|
99
|
-
return new Error(`Validation failed:\n${errorMessages}`);
|
|
100
|
-
}
|
|
101
|
-
return new Error(data?.detail || "Bad request");
|
|
102
|
-
case 500:
|
|
103
|
-
return new Error("Internal server error. Please try again later.");
|
|
104
|
-
default:
|
|
105
|
-
return new Error(data?.detail || `Request failed with status ${status}`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
else if (error.request) {
|
|
109
|
-
return new Error("No response from server. Please check your internet connection.");
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
return new Error(error.message || "An unexpected error occurred");
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/utils/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":";;;AAkDA,kCAkBC;AAKD,kCAMC;AAED,4CAsCC;AAtHD,6CAAqD;AAGrD;;GAEG;AACH,MAAa,QAAS,SAAQ,KAAK;IACjC,YAAY,OAAe,EAAS,IAAa;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAC;QADmB,SAAI,GAAJ,IAAI,CAAS;QAE/C,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,MAAM,CAAC,cAAc,C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AAO,IAAI,KAAK,CAAC,IAAI,EAAE,MAAM,IAAI,aAAa,CAAC,CAAC;YAClD,KAAK,GAAG;gBACN,OAAO,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;YACrE;gBACE,OAAO,IAAI,KAAK,CACd,IAAI,EAAE,MAAM,IAAI,8BAA8B,MAAM,EAAE,CACvD,CAAC;QACN,CAAC;IACH,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACzB,OAAO,IAAI,KAAK,CACd,iEAAiE,CAClE,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,IAAI,8BAA8B,CAAC,CAAC;IACpE,CAAC;AACH,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { User, PromptResponse } from '../types/api-types';
|
|
2
|
-
export type OutputFormat = 'json' | 'table';
|
|
3
|
-
/**
|
|
4
|
-
* Format output based on the specified format
|
|
5
|
-
*/
|
|
6
|
-
export declare function formatOutput(data: any, format: OutputFormat): string;
|
|
7
|
-
/**
|
|
8
|
-
* Format user information
|
|
9
|
-
*/
|
|
10
|
-
export declare function formatUser(user: User, format?: OutputFormat): string;
|
|
11
|
-
/**
|
|
12
|
-
* Display success message
|
|
13
|
-
*/
|
|
14
|
-
export declare function success(message: string): void;
|
|
15
|
-
/**
|
|
16
|
-
* Display error message
|
|
17
|
-
*/
|
|
18
|
-
export declare function error(message: string): void;
|
|
19
|
-
/**
|
|
20
|
-
* Display warning message
|
|
21
|
-
*/
|
|
22
|
-
export declare function warning(message: string): void;
|
|
23
|
-
/**
|
|
24
|
-
* Display info message
|
|
25
|
-
*/
|
|
26
|
-
export declare function info(message: string): void;
|
|
27
|
-
/**
|
|
28
|
-
* Format prompts list
|
|
29
|
-
*/
|
|
30
|
-
export declare function formatPrompts(prompts: PromptResponse[], format?: OutputFormat): string;
|
|
31
|
-
/**
|
|
32
|
-
* Format prompt details
|
|
33
|
-
*/
|
|
34
|
-
export declare function formatPromptDetails(prompt: PromptResponse, format?: OutputFormat): string;
|
|
35
|
-
//# sourceMappingURL=formatters.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/utils/formatters.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5C;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAKpE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,GAAE,YAAsB,GAAG,MAAM,CAsB7E;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,MAAM,GAAE,YAAsB,GAAG,MAAM,CAuB/F;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,GAAE,YAAsB,GAAG,MAAM,CAqBlG"}
|