@kodus/cli 0.0.12 → 0.1.5
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 +380 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +23 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/auth/index.d.ts +3 -0
- package/dist/commands/auth/index.d.ts.map +1 -0
- package/dist/commands/auth/index.js +36 -0
- package/dist/commands/auth/index.js.map +1 -0
- package/dist/commands/auth/login.d.ts +7 -0
- package/dist/commands/auth/login.d.ts.map +1 -0
- package/dist/commands/auth/login.js +80 -0
- package/dist/commands/auth/login.js.map +1 -0
- package/dist/commands/auth/logout.d.ts +2 -0
- package/dist/commands/auth/logout.d.ts.map +1 -0
- package/dist/commands/auth/logout.js +24 -0
- package/dist/commands/auth/logout.js.map +1 -0
- package/dist/commands/auth/signup.d.ts +2 -0
- package/dist/commands/auth/signup.d.ts.map +1 -0
- package/dist/commands/auth/signup.js +59 -0
- package/dist/commands/auth/signup.js.map +1 -0
- package/dist/commands/auth/status.d.ts +2 -0
- package/dist/commands/auth/status.d.ts.map +1 -0
- package/dist/commands/auth/status.js +91 -0
- package/dist/commands/auth/status.js.map +1 -0
- package/dist/commands/auth/team-key.d.ts +5 -0
- package/dist/commands/auth/team-key.d.ts.map +1 -0
- package/dist/commands/auth/team-key.js +59 -0
- package/dist/commands/auth/team-key.js.map +1 -0
- package/dist/commands/auth/token.d.ts +2 -0
- package/dist/commands/auth/token.d.ts.map +1 -0
- package/dist/commands/auth/token.js +31 -0
- package/dist/commands/auth/token.js.map +1 -0
- package/dist/commands/pr.d.ts +3 -0
- package/dist/commands/pr.d.ts.map +1 -0
- package/dist/commands/pr.js +75 -0
- package/dist/commands/pr.js.map +1 -0
- package/dist/commands/review.d.ts +3 -0
- package/dist/commands/review.d.ts.map +1 -0
- package/dist/commands/review.js +164 -0
- package/dist/commands/review.js.map +1 -0
- package/dist/commands/upgrade.d.ts +3 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +35 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/constants.d.ts +3 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +3 -0
- package/dist/constants.js.map +1 -0
- package/dist/formatters/json.d.ts +7 -0
- package/dist/formatters/json.d.ts.map +1 -0
- package/dist/formatters/json.js +7 -0
- package/dist/formatters/json.js.map +1 -0
- package/dist/formatters/markdown.d.ts +7 -0
- package/dist/formatters/markdown.d.ts.map +1 -0
- package/dist/formatters/markdown.js +93 -0
- package/dist/formatters/markdown.js.map +1 -0
- package/dist/formatters/prompt.d.ts +12 -0
- package/dist/formatters/prompt.d.ts.map +1 -0
- package/dist/formatters/prompt.js +90 -0
- package/dist/formatters/prompt.js.map +1 -0
- package/dist/formatters/terminal.d.ts +7 -0
- package/dist/formatters/terminal.d.ts.map +1 -0
- package/dist/formatters/terminal.js +127 -0
- package/dist/formatters/terminal.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/services/api/api.interface.d.ts +42 -0
- package/dist/services/api/api.interface.d.ts.map +1 -0
- package/dist/services/api/api.interface.js +2 -0
- package/dist/services/api/api.interface.js.map +1 -0
- package/dist/services/api/api.real.d.ts +7 -0
- package/dist/services/api/api.real.d.ts.map +1 -0
- package/dist/services/api/api.real.js +252 -0
- package/dist/services/api/api.real.js.map +1 -0
- package/dist/services/api/index.d.ts +4 -0
- package/dist/services/api/index.d.ts.map +1 -0
- package/dist/services/api/index.js +3 -0
- package/dist/services/api/index.js.map +1 -0
- package/dist/services/auth.service.d.ts +19 -0
- package/dist/services/auth.service.d.ts.map +1 -0
- package/dist/services/auth.service.js +90 -0
- package/dist/services/auth.service.js.map +1 -0
- package/dist/services/context.service.d.ts +22 -0
- package/dist/services/context.service.d.ts.map +1 -0
- package/dist/services/context.service.js +104 -0
- package/dist/services/context.service.js.map +1 -0
- package/dist/services/fix.service.d.ts +31 -0
- package/dist/services/fix.service.d.ts.map +1 -0
- package/dist/services/fix.service.js +120 -0
- package/dist/services/fix.service.js.map +1 -0
- package/dist/services/git.service.d.ts +32 -0
- package/dist/services/git.service.d.ts.map +1 -0
- package/dist/services/git.service.js +261 -0
- package/dist/services/git.service.js.map +1 -0
- package/dist/services/review.service.d.ts +28 -0
- package/dist/services/review.service.d.ts.map +1 -0
- package/dist/services/review.service.js +111 -0
- package/dist/services/review.service.js.map +1 -0
- package/dist/types/index.d.ts +161 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +15 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/interactive.d.ts +26 -0
- package/dist/ui/interactive.d.ts.map +1 -0
- package/dist/ui/interactive.js +371 -0
- package/dist/ui/interactive.js.map +1 -0
- package/dist/utils/config.d.ts +10 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +54 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/credentials.d.ts +6 -0
- package/dist/utils/credentials.d.ts.map +1 -0
- package/dist/utils/credentials.js +54 -0
- package/dist/utils/credentials.js.map +1 -0
- package/dist/utils/rate-limit.d.ts +5 -0
- package/dist/utils/rate-limit.d.ts.map +1 -0
- package/dist/utils/rate-limit.js +47 -0
- package/dist/utils/rate-limit.js.map +1 -0
- package/package.json +41 -33
- package/index.js +0 -15
- package/license.md +0 -21
- package/readme.md +0 -128
- package/scripts/setup-db.sh +0 -77
- package/src/commands/install.js +0 -357
- package/src/config/default.js +0 -66
- package/src/utils/helpers.js +0 -128
- package/templates/.env.example +0 -142
- package/templates/docker-compose.yml +0 -139
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
const CONFIG_DIR = path.join(os.homedir(), '.kodus');
|
|
5
|
+
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
|
|
6
|
+
async function ensureConfigDir() {
|
|
7
|
+
try {
|
|
8
|
+
await fs.mkdir(CONFIG_DIR, { recursive: true, mode: 0o700 });
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
if (error.code !== 'EEXIST') {
|
|
12
|
+
throw error;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export async function saveConfig(config) {
|
|
17
|
+
await ensureConfigDir();
|
|
18
|
+
await fs.writeFile(CONFIG_FILE, JSON.stringify(config, null, 2), {
|
|
19
|
+
encoding: 'utf-8',
|
|
20
|
+
mode: 0o600,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export async function loadConfig() {
|
|
24
|
+
try {
|
|
25
|
+
const content = await fs.readFile(CONFIG_FILE, 'utf-8');
|
|
26
|
+
return JSON.parse(content);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (error.code === 'ENOENT') {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export async function clearConfig() {
|
|
36
|
+
try {
|
|
37
|
+
await fs.unlink(CONFIG_FILE);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error.code !== 'ENOENT') {
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export async function configExists() {
|
|
46
|
+
try {
|
|
47
|
+
await fs.access(CONFIG_FILE);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CA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UAAU,WAAW;IAC/B,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { StoredCredentials } from '../types/index.js';
|
|
2
|
+
export declare function loadCredentials(): Promise<StoredCredentials | null>;
|
|
3
|
+
export declare function saveCredentials(credentials: StoredCredentials): Promise<void>;
|
|
4
|
+
export declare function clearCredentials(): Promise<void>;
|
|
5
|
+
export declare function credentialsExist(): Promise<boolean>;
|
|
6
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/utils/credentials.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAyB,MAAM,mBAAmB,CAAC;AAelF,wBAAsB,eAAe,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAUzE;AAED,wBAAsB,eAAe,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAMnF;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAQtD;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAOzD"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
const KODUS_DIR = path.join(os.homedir(), '.kodus');
|
|
5
|
+
const CREDENTIALS_FILE = path.join(KODUS_DIR, 'credentials.json');
|
|
6
|
+
async function ensureKodusDir() {
|
|
7
|
+
try {
|
|
8
|
+
await fs.mkdir(KODUS_DIR, { recursive: true, mode: 0o700 });
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
if (error.code !== 'EEXIST') {
|
|
12
|
+
throw error;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export async function loadCredentials() {
|
|
17
|
+
try {
|
|
18
|
+
const content = await fs.readFile(CREDENTIALS_FILE, 'utf-8');
|
|
19
|
+
return JSON.parse(content);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
if (error.code === 'ENOENT') {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export async function saveCredentials(credentials) {
|
|
29
|
+
await ensureKodusDir();
|
|
30
|
+
await fs.writeFile(CREDENTIALS_FILE, JSON.stringify(credentials, null, 2), {
|
|
31
|
+
encoding: 'utf-8',
|
|
32
|
+
mode: 0o600,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export async function clearCredentials() {
|
|
36
|
+
try {
|
|
37
|
+
await fs.unlink(CREDENTIALS_FILE);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error.code !== 'ENOENT') {
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export async function credentialsExist() {
|
|
46
|
+
try {
|
|
47
|
+
await fs.access(CREDENTIALS_FILE);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=credentials.js.map
|
|
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EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;QACzE,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,KAAK;KACZ,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TrialStatus } from '../types/index.js';
|
|
2
|
+
export declare function getTrialIdentifier(): Promise<string>;
|
|
3
|
+
export declare function checkTrialStatus(): Promise<TrialStatus>;
|
|
4
|
+
export declare function showTrialLimitPrompt(status: TrialStatus): void;
|
|
5
|
+
//# sourceMappingURL=rate-limit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limit.d.ts","sourceRoot":"","sources":["../../src/utils/rate-limit.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CAkB1D;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,WAAW,CAAC,CAG7D;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAgB9D"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import machineId from 'node-machine-id';
|
|
2
|
+
import crypto from 'crypto';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { api } from '../services/api/index.js';
|
|
6
|
+
import { gitService } from '../services/git.service.js';
|
|
7
|
+
const { machineIdSync } = machineId;
|
|
8
|
+
export async function getTrialIdentifier() {
|
|
9
|
+
try {
|
|
10
|
+
const machineId = machineIdSync();
|
|
11
|
+
const username = os.userInfo().username;
|
|
12
|
+
let repoPath = '';
|
|
13
|
+
try {
|
|
14
|
+
repoPath = await gitService.getGitRoot();
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
repoPath = process.cwd();
|
|
18
|
+
}
|
|
19
|
+
const raw = `${machineId}:${username}:${repoPath}`;
|
|
20
|
+
return crypto.createHash('sha256').update(raw).digest('hex').substring(0, 32);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
const fallback = `${os.hostname()}:${os.userInfo().username}:${Date.now()}`;
|
|
24
|
+
return crypto.createHash('sha256').update(fallback).digest('hex').substring(0, 32);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export async function checkTrialStatus() {
|
|
28
|
+
const fingerprint = await getTrialIdentifier();
|
|
29
|
+
return api.trial.getStatus(fingerprint);
|
|
30
|
+
}
|
|
31
|
+
export function showTrialLimitPrompt(status) {
|
|
32
|
+
const box = `
|
|
33
|
+
${chalk.yellow('╭──────────────────────────────────────────────────────────╮')}
|
|
34
|
+
${chalk.yellow('│')} ${chalk.bold.yellow('⚡ Daily limit reached')} (${status.reviewsUsed}/${status.reviewsLimit} reviews)${' '.repeat(16)}${chalk.yellow('│')}
|
|
35
|
+
${chalk.yellow('│')} ${chalk.yellow('│')}
|
|
36
|
+
${chalk.yellow('│')} Sign up for free to unlock: ${chalk.yellow('│')}
|
|
37
|
+
${chalk.yellow('│')} ${chalk.green('✓')} Unlimited reviews ${chalk.yellow('│')}
|
|
38
|
+
${chalk.yellow('│')} ${chalk.green('✓')} Custom configurations ${chalk.yellow('│')}
|
|
39
|
+
${chalk.yellow('│')} ${chalk.green('✓')} Review history ${chalk.yellow('│')}
|
|
40
|
+
${chalk.yellow('│')} ${chalk.green('✓')} Team integration ${chalk.yellow('│')}
|
|
41
|
+
${chalk.yellow('│')} ${chalk.yellow('│')}
|
|
42
|
+
${chalk.yellow('│')} ${chalk.dim('→')} ${chalk.cyan('kodus auth signup')} ${chalk.yellow('│')}
|
|
43
|
+
${chalk.yellow('╰──────────────────────────────────────────────────────────╯')}
|
|
44
|
+
`;
|
|
45
|
+
console.log(box);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=rate-limit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limit.js","sourceRoot":"","sources":["../../src/utils/rate-limit.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGxD,MAAM,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;AAEpC,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;QAExC,IAAI,QAAQ,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC;YACH,QAAQ,GAAG,MAAM,UAAU,CAAC,UAAU,EAAE,CAAC;QAC3C,CAAC;QAAC,MAAM,CAAC;YACP,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAC3B,CAAC;QAED,MAAM,GAAG,GAAG,GAAG,SAAS,IAAI,QAAQ,IAAI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AC,MAAM,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,yDAAyD,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;EAChH,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,yDAAyD,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;EAChH,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,yDAAyD,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;EAChH,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,yDAAyD,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;EAChH,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,6DAA6D,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;EAC/F,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,uCAAuC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;EAC/H,KAAK,CAAC,MAAM,CAAC,8DAA8D,CAAC;CAC7E,CAAC;IAEA,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,48 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kodus/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "CLI
|
|
5
|
-
"main": "index.js",
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "Kodus CLI - AI-powered code review from your terminal",
|
|
6
5
|
"type": "module",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./index.js",
|
|
9
|
-
"./src/*": "./src/*.js"
|
|
10
|
-
},
|
|
11
|
-
"preferGlobal": true,
|
|
12
6
|
"bin": {
|
|
13
|
-
"kodus": "./index.js"
|
|
7
|
+
"kodus": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/kodustech/cli.git"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://kodus.io",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/kodustech/cli/issues"
|
|
14
17
|
},
|
|
15
|
-
"files": [
|
|
16
|
-
"index.js",
|
|
17
|
-
"src/**/*.js",
|
|
18
|
-
"templates/**/*",
|
|
19
|
-
"scripts/**/*.sh"
|
|
20
|
-
],
|
|
21
18
|
"scripts": {
|
|
22
|
-
"
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"dev": "tsc --watch",
|
|
21
|
+
"start": "node dist/index.js",
|
|
22
|
+
"start:local": "KODUS_API_URL=http://localhost:3001 node dist/index.js",
|
|
23
|
+
"start:qa": "KODUS_API_URL=https://qa.api.kodus.io node dist/index.js",
|
|
24
|
+
"lint": "eslint src --ext .ts",
|
|
25
|
+
"clean": "rm -rf dist",
|
|
26
|
+
"prepublishOnly": "npm run build"
|
|
23
27
|
},
|
|
24
28
|
"keywords": [
|
|
25
29
|
"kodus",
|
|
30
|
+
"code-review",
|
|
31
|
+
"ai",
|
|
26
32
|
"cli",
|
|
27
|
-
"
|
|
28
|
-
"deployment"
|
|
33
|
+
"git"
|
|
29
34
|
],
|
|
30
35
|
"author": "Kodus",
|
|
31
|
-
"license": "
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"chalk": "^5.3.0",
|
|
39
|
+
"commander": "^12.1.0",
|
|
40
|
+
"inquirer": "^9.2.23",
|
|
41
|
+
"node-machine-id": "^1.1.12",
|
|
42
|
+
"ora": "^8.0.1",
|
|
43
|
+
"simple-git": "^3.25.0"
|
|
35
44
|
},
|
|
36
|
-
"
|
|
37
|
-
"
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/inquirer": "^9.0.7",
|
|
47
|
+
"@types/node": "^20.14.9",
|
|
48
|
+
"typescript": "^5.5.3"
|
|
38
49
|
},
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
"inquirer": "^8.2.6",
|
|
46
|
-
"ora": "^5.4.1"
|
|
47
|
-
}
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=18.0.0"
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"dist"
|
|
55
|
+
]
|
|
48
56
|
}
|
package/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { program } from "commander";
|
|
4
|
-
import { setupEnvironment } from "./src/commands/install.js";
|
|
5
|
-
|
|
6
|
-
// CLI version
|
|
7
|
-
program.version("0.0.12");
|
|
8
|
-
|
|
9
|
-
// Install command
|
|
10
|
-
program
|
|
11
|
-
.command("install")
|
|
12
|
-
.description("Install and configure Kodus")
|
|
13
|
-
.action(setupEnvironment);
|
|
14
|
-
|
|
15
|
-
program.parse(process.argv);
|
package/license.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Kodus CLI
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/readme.md
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<img src="https://kodus.io/wp-content/uploads/2025/04/koduscli.png" alt="Kodus CLI Banner" />
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
**Deploy and manage Kodus AI Code Review Agents in your infrastructure**
|
|
8
|
-
|
|
9
|
-
[](https://github.com/yourusername/kodus-cli/blob/main/LICENSE)
|
|
10
|
-
[](https://www.npmjs.com/package/@kodus/cli)
|
|
11
|
-
[](https://www.npmjs.com/package/@kodus/cli)
|
|
12
|
-
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
## 🌟 Overview
|
|
16
|
-
|
|
17
|
-
Kodus CLI is your gateway to running Kodus AI Code Review Agents in your own infrastructure. With a single command, deploy and manage your code review automation system, keeping your code quality high while maintaining full control over your data and infrastructure.
|
|
18
|
-
|
|
19
|
-
## ✨ Features
|
|
20
|
-
|
|
21
|
-
- 🔥 **One-Command Deployment**: Deploy your entire Kodus infrastructure in minutes
|
|
22
|
-
- 🔒 **Self-Hosted**: Keep your code and data within your infrastructure
|
|
23
|
-
- 🤖 **AI-Powered Reviews**: Leverage advanced AI models for code review automation
|
|
24
|
-
- 🔄 **Git Integration**: Seamless integration with GitHub, GitLab, and Bitbucket
|
|
25
|
-
- 📊 **Monitoring & Analytics**: Built-in Grafana dashboards for insights
|
|
26
|
-
- 🐳 **Docker-Powered**: Containerized for consistency and easy management
|
|
27
|
-
- 🔐 **Secure by Default**: Enterprise-grade security with auto-generated credentials
|
|
28
|
-
|
|
29
|
-
## 🚀 Quick Start
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
# Install globally
|
|
33
|
-
npm install -g @kodus/cli
|
|
34
|
-
|
|
35
|
-
# Deploy Kodus in your infrastructure
|
|
36
|
-
kodus install
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## 📖 Documentation
|
|
40
|
-
|
|
41
|
-
### Basic Usage
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
# Deploy Kodus
|
|
45
|
-
kodus install
|
|
46
|
-
|
|
47
|
-
# Follow the interactive prompts to configure:
|
|
48
|
-
# - Environment type (local/external)
|
|
49
|
-
# - Git service integration
|
|
50
|
-
# - AI provider settings
|
|
51
|
-
# - Infrastructure preferences
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Environment Types
|
|
55
|
-
|
|
56
|
-
- **Local Development**
|
|
57
|
-
|
|
58
|
-
- Perfect for testing and development
|
|
59
|
-
- Runs everything on localhost
|
|
60
|
-
- Ideal for small teams and individual developers
|
|
61
|
-
|
|
62
|
-
- **External Deployment**
|
|
63
|
-
- Production-ready setup
|
|
64
|
-
- Configurable for any domain
|
|
65
|
-
- Suitable for enterprise environments
|
|
66
|
-
|
|
67
|
-
### Supported Git Services
|
|
68
|
-
|
|
69
|
-
| Service | Features |
|
|
70
|
-
| --------- | ------------------------------------------- |
|
|
71
|
-
| GitHub | Pull Request Reviews, Issue Analysis |
|
|
72
|
-
| GitLab | Merge Request Reviews, Pipeline Integration |
|
|
73
|
-
| Bitbucket | Pull Request Reviews, Repository Analysis |
|
|
74
|
-
|
|
75
|
-
### AI Integration
|
|
76
|
-
|
|
77
|
-
Kodus supports multiple AI providers for code review:
|
|
78
|
-
|
|
79
|
-
- OpenAI (GPT-4)
|
|
80
|
-
- Google AI
|
|
81
|
-
- Anthropic (Claude)
|
|
82
|
-
- Novita AI
|
|
83
|
-
- Vertex AI
|
|
84
|
-
|
|
85
|
-
## 🔒 Security
|
|
86
|
-
|
|
87
|
-
- All data stays within your infrastructure
|
|
88
|
-
- No code or sensitive information is sent to external servers
|
|
89
|
-
- Enterprise-grade encryption for all communications
|
|
90
|
-
- Role-based access control
|
|
91
|
-
- Audit logging for all operations
|
|
92
|
-
|
|
93
|
-
## 🤝 Contributing
|
|
94
|
-
|
|
95
|
-
We welcome contributions!
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
# Clone the repository
|
|
99
|
-
git clone https://github.com/yourusername/kodus-cli.git
|
|
100
|
-
|
|
101
|
-
# Install dependencies
|
|
102
|
-
npm install
|
|
103
|
-
|
|
104
|
-
# Run tests
|
|
105
|
-
npm test
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## 📜 License
|
|
109
|
-
|
|
110
|
-
MIT © Kodus
|
|
111
|
-
|
|
112
|
-
## 🌟 Star History
|
|
113
|
-
|
|
114
|
-
[](https://star-history.com/#yourusername/kodus-cli&Date)
|
|
115
|
-
|
|
116
|
-
## 🙏 Acknowledgments
|
|
117
|
-
|
|
118
|
-
Special thanks to all our contributors and the amazing open-source community.
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
<div align="center">
|
|
123
|
-
|
|
124
|
-
**[Website](https://kodus.ios)** • **[Documentation](https://docs.kodus.io)** • **[Twitter](https://twitter.com/kodustech)** • **[Discord](https://discord.gg/VkbfjbZr)**
|
|
125
|
-
|
|
126
|
-
Made with ❤️ by the Kodus Team
|
|
127
|
-
|
|
128
|
-
</div>
|
package/scripts/setup-db.sh
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# scripts/setup-db.sh
|
|
3
|
-
|
|
4
|
-
echo "Setting up database..."
|
|
5
|
-
|
|
6
|
-
# Criar arquivo de configuração dentro do container
|
|
7
|
-
docker-compose exec -T kodus-orchestrator bash -c 'cat > /usr/src/app/datasource.js << EOL
|
|
8
|
-
const MainSeeder = require("./dist/config/database/typeorm/seed/main.seeder").default;
|
|
9
|
-
const { DataSource } = require("typeorm");
|
|
10
|
-
module.exports = new DataSource({
|
|
11
|
-
type: "postgres",
|
|
12
|
-
host: process.env.API_PG_DB_HOST,
|
|
13
|
-
port: 5432,
|
|
14
|
-
username: process.env.API_PG_DB_USERNAME,
|
|
15
|
-
password: process.env.API_PG_DB_PASSWORD,
|
|
16
|
-
database: process.env.API_PG_DB_DATABASE,
|
|
17
|
-
ssl: false,
|
|
18
|
-
entities: ["./dist/core/infrastructure/adapters/repositories/typeorm/schema/*.model.js",],
|
|
19
|
-
migrations: ["./dist/config/database/typeorm/migrations/*.js"],
|
|
20
|
-
seeds: [MainSeeder]
|
|
21
|
-
});
|
|
22
|
-
EOL'
|
|
23
|
-
|
|
24
|
-
# Criar arquivo de configuração temporário para o seed
|
|
25
|
-
docker-compose exec -T kodus-orchestrator bash -c 'cat > /usr/src/app/seed-datasource.js << EOL
|
|
26
|
-
const MainSeeder = require("./dist/config/database/typeorm/seed/main.seeder").default;
|
|
27
|
-
const { DataSource } = require("typeorm");
|
|
28
|
-
const dataSourceInstance = new DataSource({
|
|
29
|
-
type: "postgres",
|
|
30
|
-
host: process.env.API_PG_DB_HOST,
|
|
31
|
-
port: 5432,
|
|
32
|
-
username: process.env.API_PG_DB_USERNAME,
|
|
33
|
-
password: process.env.API_PG_DB_PASSWORD,
|
|
34
|
-
database: process.env.API_PG_DB_DATABASE,
|
|
35
|
-
ssl: false,
|
|
36
|
-
entities: ["./dist/core/infrastructure/adapters/repositories/typeorm/schema/*.model.js",],
|
|
37
|
-
seeds: [MainSeeder]
|
|
38
|
-
});
|
|
39
|
-
module.exports = { dataSourceInstance };
|
|
40
|
-
EOL'
|
|
41
|
-
|
|
42
|
-
# Criar extensão vector no banco de dados
|
|
43
|
-
echo "Creating vector extension..."
|
|
44
|
-
docker-compose exec -T kodus-orchestrator bash -c 'cd /usr/src/app && yarn typeorm query "CREATE EXTENSION IF NOT EXISTS vector;" -d datasource.js'
|
|
45
|
-
|
|
46
|
-
# Verificar se a extensão foi criada com sucesso
|
|
47
|
-
echo "Verifying vector extension..."
|
|
48
|
-
docker-compose exec -T kodus-orchestrator bash -c 'cd /usr/src/app && yarn typeorm query "SELECT extname, extversion FROM pg_extension WHERE extname = '\''vector'\'';" -d datasource.js'
|
|
49
|
-
|
|
50
|
-
# Rodar migrations dentro do container
|
|
51
|
-
echo "Running migrations..."
|
|
52
|
-
docker-compose exec -T kodus-orchestrator bash -c 'cd /usr/src/app && yarn typeorm migration:run -d datasource.js'
|
|
53
|
-
|
|
54
|
-
# Rodar seeds dentro do container com o novo arquivo de configuração
|
|
55
|
-
echo "Running seeds..."
|
|
56
|
-
docker-compose exec -T kodus-orchestrator bash -c '
|
|
57
|
-
cd /usr/src/app &&
|
|
58
|
-
export NODE_PATH=/usr/src/app/dist &&
|
|
59
|
-
node -e "
|
|
60
|
-
const { runSeeders } = require('\''typeorm-extension'\'');
|
|
61
|
-
const { dataSourceInstance } = require('\''./seed-datasource.js'\'');
|
|
62
|
-
|
|
63
|
-
async function runSeeds() {
|
|
64
|
-
try {
|
|
65
|
-
await dataSourceInstance.initialize();
|
|
66
|
-
await runSeeders(dataSourceInstance);
|
|
67
|
-
process.exit(0);
|
|
68
|
-
} catch (error) {
|
|
69
|
-
console.error('\''Error running seeds:'\'', error);
|
|
70
|
-
process.exit(1);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
runSeeds();
|
|
75
|
-
"'
|
|
76
|
-
|
|
77
|
-
echo "Database setup completed!"
|