@braingrid/cli 0.2.0 → 0.2.1
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 +32 -0
- package/README.md +54 -38
- package/dist/chunk-KNVWIF3L.js +401 -0
- package/dist/chunk-KNVWIF3L.js.map +1 -0
- package/dist/cli.js +6236 -245
- package/dist/cli.js.map +1 -1
- package/dist/gh-installer-B65ZOOC4.js +13 -0
- package/dist/gh-installer-B65ZOOC4.js.map +1 -0
- package/package.json +19 -11
- package/dist/build-config.d.ts +0 -26
- package/dist/build-config.d.ts.map +0 -1
- package/dist/build-config.js +0 -45
- package/dist/build-config.js.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/handlers/auth.handlers.d.ts +0 -13
- package/dist/handlers/auth.handlers.d.ts.map +0 -1
- package/dist/handlers/auth.handlers.js +0 -111
- package/dist/handlers/auth.handlers.js.map +0 -1
- package/dist/handlers/index.d.ts +0 -13
- package/dist/handlers/index.d.ts.map +0 -1
- package/dist/handlers/index.js +0 -13
- package/dist/handlers/index.js.map +0 -1
- package/dist/handlers/init.handlers.d.ts +0 -10
- package/dist/handlers/init.handlers.d.ts.map +0 -1
- package/dist/handlers/init.handlers.js +0 -638
- package/dist/handlers/init.handlers.js.map +0 -1
- package/dist/handlers/project.handlers.d.ts +0 -36
- package/dist/handlers/project.handlers.d.ts.map +0 -1
- package/dist/handlers/project.handlers.js +0 -309
- package/dist/handlers/project.handlers.js.map +0 -1
- package/dist/handlers/requirement.handlers.d.ts +0 -32
- package/dist/handlers/requirement.handlers.d.ts.map +0 -1
- package/dist/handlers/requirement.handlers.js +0 -264
- package/dist/handlers/requirement.handlers.js.map +0 -1
- package/dist/handlers/status.handlers.d.ts +0 -12
- package/dist/handlers/status.handlers.d.ts.map +0 -1
- package/dist/handlers/status.handlers.js +0 -212
- package/dist/handlers/status.handlers.js.map +0 -1
- package/dist/handlers/task.handlers.d.ts +0 -29
- package/dist/handlers/task.handlers.d.ts.map +0 -1
- package/dist/handlers/task.handlers.js +0 -326
- package/dist/handlers/task.handlers.js.map +0 -1
- package/dist/handlers/types.d.ts +0 -10
- package/dist/handlers/types.d.ts.map +0 -1
- package/dist/handlers/types.js +0 -5
- package/dist/handlers/types.js.map +0 -1
- package/dist/handlers/update.handlers.d.ts +0 -16
- package/dist/handlers/update.handlers.d.ts.map +0 -1
- package/dist/handlers/update.handlers.js +0 -119
- package/dist/handlers/update.handlers.js.map +0 -1
- package/dist/services/auth.d.ts +0 -59
- package/dist/services/auth.d.ts.map +0 -1
- package/dist/services/auth.js +0 -549
- package/dist/services/auth.js.map +0 -1
- package/dist/services/claude.d.ts +0 -18
- package/dist/services/claude.d.ts.map +0 -1
- package/dist/services/claude.js +0 -164
- package/dist/services/claude.js.map +0 -1
- package/dist/services/credential-store.d.ts +0 -47
- package/dist/services/credential-store.d.ts.map +0 -1
- package/dist/services/credential-store.js +0 -89
- package/dist/services/credential-store.js.map +0 -1
- package/dist/services/internal/github-service.d.ts +0 -67
- package/dist/services/internal/github-service.d.ts.map +0 -1
- package/dist/services/internal/github-service.js +0 -81
- package/dist/services/internal/github-service.js.map +0 -1
- package/dist/services/internal/repository-service.d.ts +0 -79
- package/dist/services/internal/repository-service.d.ts.map +0 -1
- package/dist/services/internal/repository-service.js +0 -88
- package/dist/services/internal/repository-service.js.map +0 -1
- package/dist/services/oauth2-auth.d.ts +0 -76
- package/dist/services/oauth2-auth.d.ts.map +0 -1
- package/dist/services/oauth2-auth.js +0 -451
- package/dist/services/oauth2-auth.js.map +0 -1
- package/dist/services/project-service.d.ts +0 -24
- package/dist/services/project-service.d.ts.map +0 -1
- package/dist/services/project-service.js +0 -60
- package/dist/services/project-service.js.map +0 -1
- package/dist/services/requirement-service.d.ts +0 -32
- package/dist/services/requirement-service.d.ts.map +0 -1
- package/dist/services/requirement-service.js +0 -91
- package/dist/services/requirement-service.js.map +0 -1
- package/dist/services/task-service.d.ts +0 -22
- package/dist/services/task-service.d.ts.map +0 -1
- package/dist/services/task-service.js +0 -52
- package/dist/services/task-service.js.map +0 -1
- package/dist/types/api.d.ts +0 -16
- package/dist/types/api.d.ts.map +0 -1
- package/dist/types/api.js +0 -5
- package/dist/types/api.js.map +0 -1
- package/dist/types/auth.d.ts +0 -73
- package/dist/types/auth.d.ts.map +0 -1
- package/dist/types/auth.js +0 -2
- package/dist/types/auth.js.map +0 -1
- package/dist/types/claude.d.ts +0 -22
- package/dist/types/claude.d.ts.map +0 -1
- package/dist/types/claude.js +0 -2
- package/dist/types/claude.js.map +0 -1
- package/dist/types/github.d.ts +0 -105
- package/dist/types/github.d.ts.map +0 -1
- package/dist/types/github.js +0 -6
- package/dist/types/github.js.map +0 -1
- package/dist/types/local-project.d.ts +0 -30
- package/dist/types/local-project.d.ts.map +0 -1
- package/dist/types/local-project.js +0 -24
- package/dist/types/local-project.js.map +0 -1
- package/dist/types/project.d.ts +0 -56
- package/dist/types/project.d.ts.map +0 -1
- package/dist/types/project.js +0 -5
- package/dist/types/project.js.map +0 -1
- package/dist/types/requirement.d.ts +0 -69
- package/dist/types/requirement.d.ts.map +0 -1
- package/dist/types/requirement.js +0 -5
- package/dist/types/requirement.js.map +0 -1
- package/dist/types/task.d.ts +0 -44
- package/dist/types/task.d.ts.map +0 -1
- package/dist/types/task.js +0 -5
- package/dist/types/task.js.map +0 -1
- package/dist/utils/axios-retry.d.ts +0 -25
- package/dist/utils/axios-retry.d.ts.map +0 -1
- package/dist/utils/axios-retry.js +0 -174
- package/dist/utils/axios-retry.js.map +0 -1
- package/dist/utils/axios-with-auth.d.ts +0 -10
- package/dist/utils/axios-with-auth.d.ts.map +0 -1
- package/dist/utils/axios-with-auth.js +0 -118
- package/dist/utils/axios-with-auth.js.map +0 -1
- package/dist/utils/cli-tools.d.ts +0 -30
- package/dist/utils/cli-tools.d.ts.map +0 -1
- package/dist/utils/cli-tools.js +0 -199
- package/dist/utils/cli-tools.js.map +0 -1
- package/dist/utils/command-execution.d.ts +0 -30
- package/dist/utils/command-execution.d.ts.map +0 -1
- package/dist/utils/command-execution.js +0 -264
- package/dist/utils/command-execution.js.map +0 -1
- package/dist/utils/command-parser.d.ts +0 -85
- package/dist/utils/command-parser.d.ts.map +0 -1
- package/dist/utils/command-parser.js +0 -287
- package/dist/utils/command-parser.js.map +0 -1
- package/dist/utils/config.d.ts +0 -10
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js +0 -77
- package/dist/utils/config.js.map +0 -1
- package/dist/utils/error-formatter.d.ts +0 -17
- package/dist/utils/error-formatter.d.ts.map +0 -1
- package/dist/utils/error-formatter.js +0 -115
- package/dist/utils/error-formatter.js.map +0 -1
- package/dist/utils/formatting.d.ts +0 -10
- package/dist/utils/formatting.d.ts.map +0 -1
- package/dist/utils/formatting.js +0 -122
- package/dist/utils/formatting.js.map +0 -1
- package/dist/utils/gh-installer.d.ts +0 -31
- package/dist/utils/gh-installer.d.ts.map +0 -1
- package/dist/utils/gh-installer.js +0 -296
- package/dist/utils/gh-installer.js.map +0 -1
- package/dist/utils/git-installer.d.ts +0 -31
- package/dist/utils/git-installer.d.ts.map +0 -1
- package/dist/utils/git-installer.js +0 -290
- package/dist/utils/git-installer.js.map +0 -1
- package/dist/utils/git.d.ts +0 -60
- package/dist/utils/git.d.ts.map +0 -1
- package/dist/utils/git.js +0 -144
- package/dist/utils/git.js.map +0 -1
- package/dist/utils/github-repo.d.ts +0 -43
- package/dist/utils/github-repo.d.ts.map +0 -1
- package/dist/utils/github-repo.js +0 -113
- package/dist/utils/github-repo.js.map +0 -1
- package/dist/utils/id-normalization.d.ts +0 -26
- package/dist/utils/id-normalization.d.ts.map +0 -1
- package/dist/utils/id-normalization.js +0 -45
- package/dist/utils/id-normalization.js.map +0 -1
- package/dist/utils/jwt.d.ts +0 -45
- package/dist/utils/jwt.d.ts.map +0 -1
- package/dist/utils/jwt.js +0 -64
- package/dist/utils/jwt.js.map +0 -1
- package/dist/utils/local-store.d.ts +0 -36
- package/dist/utils/local-store.d.ts.map +0 -1
- package/dist/utils/local-store.js +0 -94
- package/dist/utils/local-store.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -36
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -176
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/package-manager-installer.d.ts +0 -36
- package/dist/utils/package-manager-installer.d.ts.map +0 -1
- package/dist/utils/package-manager-installer.js +0 -106
- package/dist/utils/package-manager-installer.js.map +0 -1
- package/dist/utils/package-manager.d.ts +0 -31
- package/dist/utils/package-manager.d.ts.map +0 -1
- package/dist/utils/package-manager.js +0 -133
- package/dist/utils/package-manager.js.map +0 -1
- package/dist/utils/projects.d.ts +0 -23
- package/dist/utils/projects.d.ts.map +0 -1
- package/dist/utils/projects.js +0 -36
- package/dist/utils/projects.js.map +0 -1
- package/dist/utils/repository-access.d.ts +0 -89
- package/dist/utils/repository-access.d.ts.map +0 -1
- package/dist/utils/repository-access.js +0 -132
- package/dist/utils/repository-access.js.map +0 -1
- package/dist/utils/requirements.d.ts +0 -43
- package/dist/utils/requirements.d.ts.map +0 -1
- package/dist/utils/requirements.js +0 -79
- package/dist/utils/requirements.js.map +0 -1
- package/dist/utils/spinner.d.ts +0 -47
- package/dist/utils/spinner.d.ts.map +0 -1
- package/dist/utils/spinner.js +0 -101
- package/dist/utils/spinner.js.map +0 -1
- package/dist/utils/status-parser.d.ts +0 -95
- package/dist/utils/status-parser.d.ts.map +0 -1
- package/dist/utils/status-parser.js +0 -205
- package/dist/utils/status-parser.js.map +0 -1
- package/dist/utils/tasks.d.ts +0 -21
- package/dist/utils/tasks.d.ts.map +0 -1
- package/dist/utils/tasks.js +0 -63
- package/dist/utils/tasks.js.map +0 -1
- package/dist/utils/workspace-manager.d.ts +0 -65
- package/dist/utils/workspace-manager.d.ts.map +0 -1
- package/dist/utils/workspace-manager.js +0 -98
- package/dist/utils/workspace-manager.js.map +0 -1
package/dist/services/claude.js
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'child_process';
|
|
2
|
-
export class ClaudeWrapper {
|
|
3
|
-
constructor(execPath = 'claude') {
|
|
4
|
-
this.executablePath = execPath;
|
|
5
|
-
this.workingDir = process.cwd();
|
|
6
|
-
this.verbose = false;
|
|
7
|
-
this.timeout = 5 * 60 * 1000; // 5 minutes
|
|
8
|
-
}
|
|
9
|
-
setVerbose(verbose) {
|
|
10
|
-
this.verbose = verbose;
|
|
11
|
-
}
|
|
12
|
-
setWorkingDir(dir) {
|
|
13
|
-
this.workingDir = dir;
|
|
14
|
-
}
|
|
15
|
-
setTimeout(timeout) {
|
|
16
|
-
this.timeout = timeout;
|
|
17
|
-
}
|
|
18
|
-
async execute(args) {
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
const startTime = Date.now();
|
|
21
|
-
let stdout = '';
|
|
22
|
-
let stderr = '';
|
|
23
|
-
if (this.verbose) {
|
|
24
|
-
console.log(`[DEBUG] Executing: ${this.executablePath} ${args.join(' ')}`);
|
|
25
|
-
}
|
|
26
|
-
const child = spawn(this.executablePath, args, {
|
|
27
|
-
cwd: this.workingDir,
|
|
28
|
-
shell: true,
|
|
29
|
-
});
|
|
30
|
-
const timeoutId = setTimeout(() => {
|
|
31
|
-
child.kill('SIGTERM');
|
|
32
|
-
reject(new Error(`Command timed out after ${this.timeout}ms`));
|
|
33
|
-
}, this.timeout);
|
|
34
|
-
child.stdout?.on('data', data => {
|
|
35
|
-
stdout += data.toString();
|
|
36
|
-
});
|
|
37
|
-
child.stderr?.on('data', data => {
|
|
38
|
-
stderr += data.toString();
|
|
39
|
-
});
|
|
40
|
-
child.on('close', code => {
|
|
41
|
-
clearTimeout(timeoutId);
|
|
42
|
-
const duration = Date.now() - startTime;
|
|
43
|
-
const output = {
|
|
44
|
-
stdout,
|
|
45
|
-
stderr,
|
|
46
|
-
exit_code: code || 0,
|
|
47
|
-
duration,
|
|
48
|
-
command: `${this.executablePath} ${args.join(' ')}`,
|
|
49
|
-
timestamp: new Date(),
|
|
50
|
-
};
|
|
51
|
-
if (code === 0) {
|
|
52
|
-
resolve(output);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
reject(new Error(`Command failed with exit code ${code}: ${stderr}`));
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
child.on('error', error => {
|
|
59
|
-
clearTimeout(timeoutId);
|
|
60
|
-
reject(new Error(`Failed to execute command: ${error.message}`));
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
async executeTask(task) {
|
|
65
|
-
const args = this.buildTaskArgs(task);
|
|
66
|
-
if (this.verbose) {
|
|
67
|
-
console.log(`[DEBUG] Executing task: ${task.type}`);
|
|
68
|
-
console.log(`[DEBUG] Description: ${task.description}`);
|
|
69
|
-
}
|
|
70
|
-
// For most tasks, use print mode
|
|
71
|
-
args.push('-p', task.description);
|
|
72
|
-
return this.execute(args);
|
|
73
|
-
}
|
|
74
|
-
async streamOutput(args, onOutput) {
|
|
75
|
-
return new Promise((resolve, reject) => {
|
|
76
|
-
if (this.verbose) {
|
|
77
|
-
console.log(`[DEBUG] Starting stream: ${this.executablePath} ${args.join(' ')}`);
|
|
78
|
-
}
|
|
79
|
-
const child = spawn(this.executablePath, args, {
|
|
80
|
-
cwd: this.workingDir,
|
|
81
|
-
shell: true,
|
|
82
|
-
});
|
|
83
|
-
child.stdout?.on('data', data => {
|
|
84
|
-
const lines = data.toString().split('\n');
|
|
85
|
-
lines.forEach((line) => {
|
|
86
|
-
if (line.trim()) {
|
|
87
|
-
onOutput(line);
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
child.stderr?.on('data', data => {
|
|
92
|
-
const lines = data.toString().split('\n');
|
|
93
|
-
lines.forEach((line) => {
|
|
94
|
-
if (line.trim()) {
|
|
95
|
-
onOutput(`[ERROR] ${line}`);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
child.on('close', code => {
|
|
100
|
-
if (code === 0) {
|
|
101
|
-
resolve();
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
reject(new Error(`Command failed with exit code ${code}`));
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
child.on('error', error => {
|
|
108
|
-
reject(new Error(`Failed to execute command: ${error.message}`));
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
async checkInstallation() {
|
|
113
|
-
try {
|
|
114
|
-
await this.execute(['--version']);
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
catch {
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
async getVersion() {
|
|
122
|
-
try {
|
|
123
|
-
const output = await this.execute(['--version']);
|
|
124
|
-
return output.stdout.trim() || output.stderr.trim();
|
|
125
|
-
}
|
|
126
|
-
catch (error) {
|
|
127
|
-
throw new Error(`Failed to get version: ${error}`);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
buildTaskArgs(task) {
|
|
131
|
-
const args = [];
|
|
132
|
-
// Add model if specified
|
|
133
|
-
if (task.options.model) {
|
|
134
|
-
args.push('--model', task.options.model);
|
|
135
|
-
}
|
|
136
|
-
// Add max turns if specified
|
|
137
|
-
if (task.options.max_turns) {
|
|
138
|
-
args.push('--max-turns', task.options.max_turns.toString());
|
|
139
|
-
}
|
|
140
|
-
// Add output format if specified
|
|
141
|
-
if (task.options.output_type) {
|
|
142
|
-
args.push('--output-format', task.options.output_type);
|
|
143
|
-
}
|
|
144
|
-
// Add working directories for files
|
|
145
|
-
if (task.files.length > 0) {
|
|
146
|
-
const dirs = new Set();
|
|
147
|
-
task.files.forEach(file => {
|
|
148
|
-
const dir = file.split('/').slice(0, -1).join('/');
|
|
149
|
-
if (dir && dir !== '.' && dir !== '/') {
|
|
150
|
-
dirs.add(dir);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
dirs.forEach(dir => {
|
|
154
|
-
args.push('--add-dir', dir);
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
// Add verbose flag if enabled
|
|
158
|
-
if (this.verbose) {
|
|
159
|
-
args.push('--verbose');
|
|
160
|
-
}
|
|
161
|
-
return args;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
//# sourceMappingURL=claude.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/services/claude.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,MAAM,OAAO,aAAa;IAMzB,YAAY,WAAmB,QAAQ;QACtC,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;IAC3C,CAAC;IAED,UAAU,CAAC,OAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IAED,aAAa,CAAC,GAAW;QACxB,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;IACvB,CAAC;IAED,UAAU,CAAC,OAAe;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAc;QAC3B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAC7B,IAAI,MAAM,GAAG,EAAE,CAAC;YAChB,IAAI,MAAM,GAAG,EAAE,CAAC;YAEhB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClB,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,CAAC,cAA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AAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACzB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACnD,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;oBACvC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACf,CAAC;YACF,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBAClB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;QACJ,CAAC;QAED,8BAA8B;QAC9B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACxB,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;CACD"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Credential Store - Encrypted credential storage using conf
|
|
3
|
-
*
|
|
4
|
-
* Provides a keytar-compatible API for storing credentials securely
|
|
5
|
-
* using file-based encrypted storage.
|
|
6
|
-
*
|
|
7
|
-
* Storage locations:
|
|
8
|
-
* - macOS: ~/Library/Preferences/BrainGrid/config.json
|
|
9
|
-
* - Linux: ~/.config/BrainGrid/config.json
|
|
10
|
-
* - Windows: %APPDATA%\BrainGrid\config.json
|
|
11
|
-
*
|
|
12
|
-
* Security:
|
|
13
|
-
* - Encrypted using AES-256-CBC
|
|
14
|
-
* - Encryption key derived from machine ID + app salt
|
|
15
|
-
* - File permissions automatically set to 0600 on Unix systems
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Credential store with keytar-compatible API
|
|
19
|
-
*/
|
|
20
|
-
export declare const credentialStore: {
|
|
21
|
-
/**
|
|
22
|
-
* Get a stored password/credential
|
|
23
|
-
* @param service Service name (e.g., 'braingrid-cli')
|
|
24
|
-
* @param account Account name (e.g., 'session', 'refresh-token')
|
|
25
|
-
* @returns The stored credential or null if not found
|
|
26
|
-
*/
|
|
27
|
-
getPassword(service: string, account: string): Promise<string | null>;
|
|
28
|
-
/**
|
|
29
|
-
* Store a password/credential
|
|
30
|
-
* @param service Service name
|
|
31
|
-
* @param account Account name
|
|
32
|
-
* @param password The credential to store
|
|
33
|
-
*/
|
|
34
|
-
setPassword(service: string, account: string, password: string): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Delete a stored password/credential
|
|
37
|
-
* @param service Service name
|
|
38
|
-
* @param account Account name
|
|
39
|
-
*/
|
|
40
|
-
deletePassword(service: string, account: string): Promise<void>;
|
|
41
|
-
/**
|
|
42
|
-
* Get the path to the encrypted config file
|
|
43
|
-
* Useful for informing users where credentials are stored
|
|
44
|
-
*/
|
|
45
|
-
getStoragePath(): string;
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=credential-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credential-store.d.ts","sourceRoot":"","sources":["../../src/services/credential-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAmCH;;GAEG;AACH,eAAO,MAAM,eAAe;IAC3B;;;;;OAKG;yBACwB,MAAM,WAAW,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAM3E;;;;;OAKG;yBACwB,MAAM,WAAW,MAAM,YAAY,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKpF;;;;OAIG;4BAC2B,MAAM,WAAW,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrE;;;OAGG;sBACe,MAAM;CAGxB,CAAC"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Credential Store - Encrypted credential storage using conf
|
|
3
|
-
*
|
|
4
|
-
* Provides a keytar-compatible API for storing credentials securely
|
|
5
|
-
* using file-based encrypted storage.
|
|
6
|
-
*
|
|
7
|
-
* Storage locations:
|
|
8
|
-
* - macOS: ~/Library/Preferences/BrainGrid/config.json
|
|
9
|
-
* - Linux: ~/.config/BrainGrid/config.json
|
|
10
|
-
* - Windows: %APPDATA%\BrainGrid\config.json
|
|
11
|
-
*
|
|
12
|
-
* Security:
|
|
13
|
-
* - Encrypted using AES-256-CBC
|
|
14
|
-
* - Encryption key derived from machine ID + app salt
|
|
15
|
-
* - File permissions automatically set to 0600 on Unix systems
|
|
16
|
-
*/
|
|
17
|
-
import Conf from 'conf';
|
|
18
|
-
import machineId from 'node-machine-id';
|
|
19
|
-
import crypto from 'crypto';
|
|
20
|
-
// App-specific salt for key derivation
|
|
21
|
-
const APP_SALT = 'braingrid-cli-v1-credentials';
|
|
22
|
-
// Derive encryption key from machine ID + salt
|
|
23
|
-
// This makes the encryption key machine-specific
|
|
24
|
-
function deriveEncryptionKey() {
|
|
25
|
-
try {
|
|
26
|
-
const id = machineId.machineIdSync();
|
|
27
|
-
return crypto
|
|
28
|
-
.createHash('sha256')
|
|
29
|
-
.update(id + APP_SALT)
|
|
30
|
-
.digest('hex')
|
|
31
|
-
.substring(0, 32); // 32 bytes for AES-256
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
// Fallback if machine ID fails (unlikely)
|
|
35
|
-
// This is still better than plain text
|
|
36
|
-
console.warn('⚠️ Could not derive machine-specific encryption key, using fallback');
|
|
37
|
-
return crypto.createHash('sha256').update(APP_SALT).digest('hex').substring(0, 32);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// Initialize encrypted configuration store
|
|
41
|
-
const store = new Conf({
|
|
42
|
-
projectName: 'BrainGrid',
|
|
43
|
-
projectSuffix: '', // Override default 'nodejs' suffix for cleaner directory name
|
|
44
|
-
encryptionKey: deriveEncryptionKey(),
|
|
45
|
-
clearInvalidConfig: true, // Clear config if decryption fails
|
|
46
|
-
});
|
|
47
|
-
/**
|
|
48
|
-
* Credential store with keytar-compatible API
|
|
49
|
-
*/
|
|
50
|
-
export const credentialStore = {
|
|
51
|
-
/**
|
|
52
|
-
* Get a stored password/credential
|
|
53
|
-
* @param service Service name (e.g., 'braingrid-cli')
|
|
54
|
-
* @param account Account name (e.g., 'session', 'refresh-token')
|
|
55
|
-
* @returns The stored credential or null if not found
|
|
56
|
-
*/
|
|
57
|
-
async getPassword(service, account) {
|
|
58
|
-
const key = `${service}.${account}`;
|
|
59
|
-
const value = store.get(key);
|
|
60
|
-
return value !== undefined ? String(value) : null;
|
|
61
|
-
},
|
|
62
|
-
/**
|
|
63
|
-
* Store a password/credential
|
|
64
|
-
* @param service Service name
|
|
65
|
-
* @param account Account name
|
|
66
|
-
* @param password The credential to store
|
|
67
|
-
*/
|
|
68
|
-
async setPassword(service, account, password) {
|
|
69
|
-
const key = `${service}.${account}`;
|
|
70
|
-
store.set(key, password);
|
|
71
|
-
},
|
|
72
|
-
/**
|
|
73
|
-
* Delete a stored password/credential
|
|
74
|
-
* @param service Service name
|
|
75
|
-
* @param account Account name
|
|
76
|
-
*/
|
|
77
|
-
async deletePassword(service, account) {
|
|
78
|
-
const key = `${service}.${account}`;
|
|
79
|
-
store.delete(key);
|
|
80
|
-
},
|
|
81
|
-
/**
|
|
82
|
-
* Get the path to the encrypted config file
|
|
83
|
-
* Useful for informing users where credentials are stored
|
|
84
|
-
*/
|
|
85
|
-
getStoragePath() {
|
|
86
|
-
return store.path;
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
//# sourceMappingURL=credential-store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credential-store.js","sourceRoot":"","sources":["../../src/services/credential-store.ts"],"names":[],"mappings":"AAAA;;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C,CAAC;QAC7B,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CAAC,OAAe,EAAE,OAAe,EAAE,QAAgB;QACnE,MAAM,GAAG,GAAG,GAAG,OAAO,IAAI,OAAO,EAAE,CAAC;QACpC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,cAAc,CAAC,OAAe,EAAE,OAAe;QACpD,MAAM,GAAG,GAAG,GAAG,OAAO,IAAI,OAAO,EAAE,CAAC;QACpC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,cAAc;QACb,OAAO,KAAK,CAAC,IAAI,CAAC;IACnB,CAAC;CACD,CAAC"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal GitHub Service
|
|
3
|
-
*
|
|
4
|
-
* For internal use only - not exposed as CLI commands.
|
|
5
|
-
* Handles API interactions with BrainGrid v1 GitHub endpoints.
|
|
6
|
-
*
|
|
7
|
-
* This service provides methods to:
|
|
8
|
-
* - List GitHub installations for the authenticated organization
|
|
9
|
-
* - Get detailed information about specific installations
|
|
10
|
-
*
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
import { BraingridAuth } from '../auth.js';
|
|
14
|
-
import { GitHubInstallationDetail, ListGitHubInstallationsResponse } from '../../types/github.js';
|
|
15
|
-
/**
|
|
16
|
-
* Internal service for GitHub API operations
|
|
17
|
-
*/
|
|
18
|
-
export declare class GitHubService {
|
|
19
|
-
private baseUrl;
|
|
20
|
-
private auth;
|
|
21
|
-
private axios;
|
|
22
|
-
constructor(baseUrl: string, auth: BraingridAuth);
|
|
23
|
-
private getHeaders;
|
|
24
|
-
/**
|
|
25
|
-
* List GitHub installations for the authenticated organization
|
|
26
|
-
*
|
|
27
|
-
* @param params - Optional pagination parameters
|
|
28
|
-
* @param params.page - Page number (default: 1, min: 1)
|
|
29
|
-
* @param params.limit - Number of installations per page (default: 20, min: 1, max: 100)
|
|
30
|
-
* @returns List of GitHub installations with pagination
|
|
31
|
-
* @throws {Error} On API errors (401, 404, 422, 500)
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```typescript
|
|
35
|
-
* const result = await githubService.listInstallations({ page: 1, limit: 20 });
|
|
36
|
-
* console.log(result.installations);
|
|
37
|
-
* console.log(result.pagination);
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
listInstallations(params?: {
|
|
41
|
-
page?: number;
|
|
42
|
-
limit?: number;
|
|
43
|
-
}): Promise<ListGitHubInstallationsResponse>;
|
|
44
|
-
/**
|
|
45
|
-
* Get detailed information about a specific GitHub installation
|
|
46
|
-
*
|
|
47
|
-
* Supports both UUID and short ID formats (e.g., "GITHUB-1").
|
|
48
|
-
* Returns installation details including all associated repositories.
|
|
49
|
-
*
|
|
50
|
-
* @param installationId - Installation UUID or short ID (e.g., "GITHUB-1")
|
|
51
|
-
* @returns Detailed installation information with repositories
|
|
52
|
-
* @throws {Error} On API errors (401, 404, 422, 500)
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```typescript
|
|
56
|
-
* // Using short ID
|
|
57
|
-
* const installation = await githubService.getInstallation('GITHUB-1');
|
|
58
|
-
*
|
|
59
|
-
* // Using UUID
|
|
60
|
-
* const installation = await githubService.getInstallation('550e8400-e29b-41d4-a716-446655440000');
|
|
61
|
-
*
|
|
62
|
-
* console.log(installation.repositories);
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
getInstallation(installationId: string): Promise<GitHubInstallationDetail>;
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=github-service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"github-service.d.ts","sourceRoot":"","sources":["../../../src/services/internal/github-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAElG;;GAEG;AACH,qBAAa,aAAa;IACzB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,IAAI,CAAgB;IAC5B,OAAO,CAAC,KAAK,CAAgB;gBAEjB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa;IAMhD,OAAO,CAAC,UAAU;IAMlB;;;;;;;;;;;;;;;OAeG;IACG,iBAAiB,CAAC,MAAM,CAAC,EAAE;QAChC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,+BAA+B,CAAC;IAW5C;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAOhF"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal GitHub Service
|
|
3
|
-
*
|
|
4
|
-
* For internal use only - not exposed as CLI commands.
|
|
5
|
-
* Handles API interactions with BrainGrid v1 GitHub endpoints.
|
|
6
|
-
*
|
|
7
|
-
* This service provides methods to:
|
|
8
|
-
* - List GitHub installations for the authenticated organization
|
|
9
|
-
* - Get detailed information about specific installations
|
|
10
|
-
*
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
import { createAuthenticatedAxios } from '../../utils/axios-with-auth.js';
|
|
14
|
-
/**
|
|
15
|
-
* Internal service for GitHub API operations
|
|
16
|
-
*/
|
|
17
|
-
export class GitHubService {
|
|
18
|
-
constructor(baseUrl, auth) {
|
|
19
|
-
this.baseUrl = baseUrl;
|
|
20
|
-
this.auth = auth;
|
|
21
|
-
this.axios = createAuthenticatedAxios(auth);
|
|
22
|
-
}
|
|
23
|
-
getHeaders() {
|
|
24
|
-
return {
|
|
25
|
-
'Content-Type': 'application/json',
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* List GitHub installations for the authenticated organization
|
|
30
|
-
*
|
|
31
|
-
* @param params - Optional pagination parameters
|
|
32
|
-
* @param params.page - Page number (default: 1, min: 1)
|
|
33
|
-
* @param params.limit - Number of installations per page (default: 20, min: 1, max: 100)
|
|
34
|
-
* @returns List of GitHub installations with pagination
|
|
35
|
-
* @throws {Error} On API errors (401, 404, 422, 500)
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```typescript
|
|
39
|
-
* const result = await githubService.listInstallations({ page: 1, limit: 20 });
|
|
40
|
-
* console.log(result.installations);
|
|
41
|
-
* console.log(result.pagination);
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
async listInstallations(params) {
|
|
45
|
-
const url = `${this.baseUrl}/api/v1/github/installations`;
|
|
46
|
-
const headers = this.getHeaders();
|
|
47
|
-
const response = await this.axios.get(url, {
|
|
48
|
-
headers,
|
|
49
|
-
params,
|
|
50
|
-
});
|
|
51
|
-
return response.data;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Get detailed information about a specific GitHub installation
|
|
55
|
-
*
|
|
56
|
-
* Supports both UUID and short ID formats (e.g., "GITHUB-1").
|
|
57
|
-
* Returns installation details including all associated repositories.
|
|
58
|
-
*
|
|
59
|
-
* @param installationId - Installation UUID or short ID (e.g., "GITHUB-1")
|
|
60
|
-
* @returns Detailed installation information with repositories
|
|
61
|
-
* @throws {Error} On API errors (401, 404, 422, 500)
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```typescript
|
|
65
|
-
* // Using short ID
|
|
66
|
-
* const installation = await githubService.getInstallation('GITHUB-1');
|
|
67
|
-
*
|
|
68
|
-
* // Using UUID
|
|
69
|
-
* const installation = await githubService.getInstallation('550e8400-e29b-41d4-a716-446655440000');
|
|
70
|
-
*
|
|
71
|
-
* console.log(installation.repositories);
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
async getInstallation(installationId) {
|
|
75
|
-
const url = `${this.baseUrl}/api/v1/github/installations/${installationId}`;
|
|
76
|
-
const headers = this.getHeaders();
|
|
77
|
-
const response = await this.axios.get(url, { headers });
|
|
78
|
-
return response.data;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=github-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"github-service.js","sourceRoot":"","sources":["../../../src/services/internal/github-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAG1E;;GAEG;AACH,MAAM,OAAO,aAAa;IAKzB,YAAY,OAAe,EAAE,IAAmB;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAEO,UAAU;QACjB,OAAO;YACN,cAAc,EAAE,kBAAkB;SAClC,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,iBAAiB,CAAC,MAGvB;QACA,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,8BAA8B,CAAC;QAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAElC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAkC,GAAG,EAAE;YAC3E,OAAO;YACP,MAAM;SACN,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,CAAC,eAAe,CAAC,cAAsB;QAC3C,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,gCAAgC,cAAc,EAAE,CAAC;QAC5E,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAElC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAA2B,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAClF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;CACD"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal Repository Service
|
|
3
|
-
*
|
|
4
|
-
* For internal use only - not exposed as CLI commands.
|
|
5
|
-
* Handles API interactions with BrainGrid v1 Repository endpoints.
|
|
6
|
-
*
|
|
7
|
-
* This service provides methods to:
|
|
8
|
-
* - List repositories with filtering and pagination
|
|
9
|
-
* - Get detailed information about specific repositories
|
|
10
|
-
*
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
import { BraingridAuth } from '../auth.js';
|
|
14
|
-
import { Repository, ListRepositoriesResponse } from '../../types/github.js';
|
|
15
|
-
/**
|
|
16
|
-
* Internal service for Repository API operations
|
|
17
|
-
*/
|
|
18
|
-
export declare class RepositoryService {
|
|
19
|
-
private baseUrl;
|
|
20
|
-
private auth;
|
|
21
|
-
private axios;
|
|
22
|
-
constructor(baseUrl: string, auth: BraingridAuth);
|
|
23
|
-
private getHeaders;
|
|
24
|
-
/**
|
|
25
|
-
* List repositories for the authenticated organization
|
|
26
|
-
*
|
|
27
|
-
* @param params - Optional filtering and pagination parameters
|
|
28
|
-
* @param params.page - Page number (default: 1, min: 1)
|
|
29
|
-
* @param params.limit - Number of repositories per page (default: 10, min: 1, max: 100)
|
|
30
|
-
* @param params.owner - Filter repositories by owner name
|
|
31
|
-
* @param params.name - Filter repositories by name (requires owner parameter)
|
|
32
|
-
* @returns List of repositories with pagination
|
|
33
|
-
* @throws {Error} On API errors (401, 404, 422, 500)
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```typescript
|
|
37
|
-
* // List all repositories with pagination
|
|
38
|
-
* const result = await repositoryService.listRepositories({ page: 1, limit: 10 });
|
|
39
|
-
* console.log(result.repositories);
|
|
40
|
-
* console.log(result.pagination);
|
|
41
|
-
*
|
|
42
|
-
* // Filter by owner
|
|
43
|
-
* const microsoftRepos = await repositoryService.listRepositories({ owner: 'microsoft' });
|
|
44
|
-
*
|
|
45
|
-
* // Filter by owner and name
|
|
46
|
-
* const tsRepo = await repositoryService.listRepositories({ owner: 'microsoft', name: 'typescript' });
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
listRepositories(params?: {
|
|
50
|
-
page?: number;
|
|
51
|
-
limit?: number;
|
|
52
|
-
owner?: string;
|
|
53
|
-
name?: string;
|
|
54
|
-
}): Promise<ListRepositoriesResponse>;
|
|
55
|
-
/**
|
|
56
|
-
* Get detailed information about a specific repository
|
|
57
|
-
*
|
|
58
|
-
* Supports both UUID and short ID formats (e.g., "REPO-1").
|
|
59
|
-
* Returns repository details including metadata and sync status.
|
|
60
|
-
*
|
|
61
|
-
* @param repositoryId - Repository UUID or short ID (e.g., "REPO-1")
|
|
62
|
-
* @returns Detailed repository information
|
|
63
|
-
* @throws {Error} On API errors (401, 404, 422, 500)
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```typescript
|
|
67
|
-
* // Using short ID
|
|
68
|
-
* const repo = await repositoryService.getRepository('REPO-1');
|
|
69
|
-
*
|
|
70
|
-
* // Using UUID
|
|
71
|
-
* const repo = await repositoryService.getRepository('550e8400-e29b-41d4-a716-446655440000');
|
|
72
|
-
*
|
|
73
|
-
* console.log(repo.full_name);
|
|
74
|
-
* console.log(repo.last_synced_at);
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
getRepository(repositoryId: string): Promise<Repository>;
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=repository-service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repository-service.d.ts","sourceRoot":"","sources":["../../../src/services/internal/repository-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAE7E;;GAEG;AACH,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,IAAI,CAAgB;IAC5B,OAAO,CAAC,KAAK,CAAgB;gBAEjB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa;IAMhD,OAAO,CAAC,UAAU;IAMlB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,gBAAgB,CAAC,MAAM,CAAC,EAAE;QAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAQrC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAO9D"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal Repository Service
|
|
3
|
-
*
|
|
4
|
-
* For internal use only - not exposed as CLI commands.
|
|
5
|
-
* Handles API interactions with BrainGrid v1 Repository endpoints.
|
|
6
|
-
*
|
|
7
|
-
* This service provides methods to:
|
|
8
|
-
* - List repositories with filtering and pagination
|
|
9
|
-
* - Get detailed information about specific repositories
|
|
10
|
-
*
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
import { createAuthenticatedAxios } from '../../utils/axios-with-auth.js';
|
|
14
|
-
/**
|
|
15
|
-
* Internal service for Repository API operations
|
|
16
|
-
*/
|
|
17
|
-
export class RepositoryService {
|
|
18
|
-
constructor(baseUrl, auth) {
|
|
19
|
-
this.baseUrl = baseUrl;
|
|
20
|
-
this.auth = auth;
|
|
21
|
-
this.axios = createAuthenticatedAxios(auth);
|
|
22
|
-
}
|
|
23
|
-
getHeaders() {
|
|
24
|
-
return {
|
|
25
|
-
'Content-Type': 'application/json',
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* List repositories for the authenticated organization
|
|
30
|
-
*
|
|
31
|
-
* @param params - Optional filtering and pagination parameters
|
|
32
|
-
* @param params.page - Page number (default: 1, min: 1)
|
|
33
|
-
* @param params.limit - Number of repositories per page (default: 10, min: 1, max: 100)
|
|
34
|
-
* @param params.owner - Filter repositories by owner name
|
|
35
|
-
* @param params.name - Filter repositories by name (requires owner parameter)
|
|
36
|
-
* @returns List of repositories with pagination
|
|
37
|
-
* @throws {Error} On API errors (401, 404, 422, 500)
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```typescript
|
|
41
|
-
* // List all repositories with pagination
|
|
42
|
-
* const result = await repositoryService.listRepositories({ page: 1, limit: 10 });
|
|
43
|
-
* console.log(result.repositories);
|
|
44
|
-
* console.log(result.pagination);
|
|
45
|
-
*
|
|
46
|
-
* // Filter by owner
|
|
47
|
-
* const microsoftRepos = await repositoryService.listRepositories({ owner: 'microsoft' });
|
|
48
|
-
*
|
|
49
|
-
* // Filter by owner and name
|
|
50
|
-
* const tsRepo = await repositoryService.listRepositories({ owner: 'microsoft', name: 'typescript' });
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
async listRepositories(params) {
|
|
54
|
-
const url = `${this.baseUrl}/api/v1/repositories`;
|
|
55
|
-
const headers = this.getHeaders();
|
|
56
|
-
const response = await this.axios.get(url, { headers, params });
|
|
57
|
-
return response.data;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Get detailed information about a specific repository
|
|
61
|
-
*
|
|
62
|
-
* Supports both UUID and short ID formats (e.g., "REPO-1").
|
|
63
|
-
* Returns repository details including metadata and sync status.
|
|
64
|
-
*
|
|
65
|
-
* @param repositoryId - Repository UUID or short ID (e.g., "REPO-1")
|
|
66
|
-
* @returns Detailed repository information
|
|
67
|
-
* @throws {Error} On API errors (401, 404, 422, 500)
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```typescript
|
|
71
|
-
* // Using short ID
|
|
72
|
-
* const repo = await repositoryService.getRepository('REPO-1');
|
|
73
|
-
*
|
|
74
|
-
* // Using UUID
|
|
75
|
-
* const repo = await repositoryService.getRepository('550e8400-e29b-41d4-a716-446655440000');
|
|
76
|
-
*
|
|
77
|
-
* console.log(repo.full_name);
|
|
78
|
-
* console.log(repo.last_synced_at);
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
async getRepository(repositoryId) {
|
|
82
|
-
const url = `${this.baseUrl}/api/v1/repositories/${repositoryId}`;
|
|
83
|
-
const headers = this.getHeaders();
|
|
84
|
-
const response = await this.axios.get(url, { headers });
|
|
85
|
-
return response.data;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=repository-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repository-service.js","sourceRoot":"","sources":["../../../src/services/internal/repository-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAG1E;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAK7B,YAAY,OAAe,EAAE,IAAmB;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAEO,UAAU;QACjB,OAAO;YACN,cAAc,EAAE,kBAAkB;SAClC,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,KAAK,CAAC,gBAAgB,CAAC,MAKtB;QACA,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,sBAAsB,CAAC;QAClD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAElC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAA2B,GAAG,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QAC1F,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,CAAC,aAAa,CAAC,YAAoB;QACvC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,wBAAwB,YAAY,EAAE,CAAC;QAClE,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAElC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAa,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACpE,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;CACD"}
|