Skip to content

Commit b29bf7f

Browse files
committed
Merge branch 'feature/233-implement-openrouter' of https://github.com/landamessenger/git-board-flow into feature/233-implement-openrouter
2 parents ea413ce + 82e80a1 commit b29bf7f

File tree

5 files changed

+68
-15
lines changed

5 files changed

+68
-15
lines changed

dist/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135662,6 +135662,7 @@ class VectorActionUseCase {
135662135662
this.CODE_INSTRUCTION_LINE = "Represent each line of code for retrieval";
135663135663
}
135664135664
async invoke(param) {
135665+
(0, logger_1.logInfo)(`Executing ${this.taskId}.`);
135665135666
const results = [];
135666135667
try {
135667135668
if (!param.supabaseConfig) {
@@ -135709,11 +135710,11 @@ class VectorActionUseCase {
135709135710
}
135710135711
if (remoteChunkedFiles.length > 0 && remoteChunkedFiles.length === chunkedFile.chunks.length) {
135711135712
processedChunkedFiles.push(chunkedFile);
135712-
(0, logger_1.logDebugInfo)(`📦 ✅ Chunk ${chunkedFile.path} already exists in Supabase`, true);
135713+
(0, logger_1.logDebugInfo)(`📦 ✅ Chunk already exists in Supabase: [${chunkedFile.path}] [${chunkedFile.index}]`, true);
135713135714
continue;
135714135715
}
135715135716
else if (remoteChunkedFiles.length > 0 && remoteChunkedFiles.length !== chunkedFile.chunks.length) {
135716-
(0, logger_1.logDebugInfo)(`📦 ❌ Chunk ${chunkedFile.path} has a different number of chunks in Supabase`, true);
135717+
(0, logger_1.logDebugInfo)(`📦 ❌ Chunk has a different number of chunks in Supabase: [${chunkedFile.path}] [${chunkedFile.index}]`, true);
135717135718
}
135718135719
(0, logger_1.logSingleLine)(`🟡 ${i + 1}/${totalFiles} (${progress.toFixed(1)}%) - Estimated time remaining: ${Math.ceil(remainingTime)} seconds | Vectorizing [${chunkedFile.path}]`);
135719135720
const embeddings = await this.dockerRepository.getEmbedding(param, chunkedFile.chunks.map(chunk => [chunkedFile.type === 'block' ? this.CODE_INSTRUCTION_BLOCK : this.CODE_INSTRUCTION_LINE, chunk]));
@@ -135723,7 +135724,7 @@ class VectorActionUseCase {
135723135724
processedChunkedFiles.push(chunkedFile);
135724135725
}
135725135726
const totalDurationSeconds = (Date.now() - startTime) / 1000;
135726-
(0, logger_1.logDebugInfo)(`All chunked files stored ${param.owner}/${param.repo}/${param.commit.branch}. Total duration: ${Math.ceil(totalDurationSeconds)} seconds`, true);
135727+
(0, logger_1.logDebugInfo)(`📦 🚀 All chunked files stored ${param.owner}/${param.repo}/${param.commit.branch}. Total duration: ${Math.ceil(totalDurationSeconds)} seconds`, true);
135727135728
results.push(new result_1.Result({
135728135729
id: this.taskId,
135729135730
success: true,
@@ -135761,7 +135762,7 @@ exports.VectorActionUseCase = VectorActionUseCase;
135761135762
"use strict";
135762135763

135763135764
Object.defineProperty(exports, "__esModule", ({ value: true }));
135764-
exports.INPUT_KEYS = exports.DEFAULT_IMAGE_CONFIG = void 0;
135765+
exports.ERRORS = exports.INPUT_KEYS = exports.DEFAULT_IMAGE_CONFIG = void 0;
135765135766
exports.DEFAULT_IMAGE_CONFIG = {
135766135767
issue: {
135767135768
automatic: [
@@ -136079,6 +136080,9 @@ exports.INPUT_KEYS = {
136079136080
SUPABASE_URL: 'supabase-url',
136080136081
SUPABASE_KEY: 'supabase-key'
136081136082
};
136083+
exports.ERRORS = {
136084+
GIT_REPOSITORY_NOT_FOUND: '❌ Git repository not found'
136085+
};
136082136086

136083136087

136084136088
/***/ }),

dist/src/cli.js

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,41 +33,83 @@ var __importStar = (this && this.__importStar) || (function () {
3333
return result;
3434
};
3535
})();
36+
var __importDefault = (this && this.__importDefault) || function (mod) {
37+
return (mod && mod.__esModule) ? mod : { "default": mod };
38+
};
3639
Object.defineProperty(exports, "__esModule", { value: true });
3740
const commander_1 = require("commander");
3841
const constants_1 = require("./utils/constants");
3942
const local_action_1 = require("./actions/local_action");
4043
const dotenv = __importStar(require("dotenv"));
44+
const child_process_1 = require("child_process");
45+
const boxen_1 = __importDefault(require("boxen"));
46+
const chalk_1 = __importDefault(require("chalk"));
47+
const logger_1 = require("./utils/logger");
4148
// Load environment variables from .env file
4249
dotenv.config();
4350
const program = new commander_1.Command();
51+
// Function to get git repository info
52+
function getGitInfo() {
53+
try {
54+
const remoteUrl = (0, child_process_1.execSync)('git config --get remote.origin.url').toString().trim();
55+
const match = remoteUrl.match(/github\.com[/:]([^/]+)\/([^/]+)(?:\.git)?$/);
56+
if (!match) {
57+
return { error: constants_1.ERRORS.GIT_REPOSITORY_NOT_FOUND };
58+
}
59+
return {
60+
owner: match[1],
61+
repo: match[2].replace('.git', '')
62+
};
63+
}
64+
catch (error) {
65+
return { error: constants_1.ERRORS.GIT_REPOSITORY_NOT_FOUND };
66+
}
67+
}
4468
program
4569
.name('git-board-flow')
4670
.description('CLI tool for Git Board Flow')
4771
.version('1.0.0');
4872
program
4973
.command('build-ai')
5074
.description('Build AI')
51-
.action(() => {
75+
.option('-i, --issue <number>', 'Issue number to process', '1')
76+
.option('-b, --branch <name>', 'Branch name', 'master')
77+
.option('-d, --debug', 'Debug mode', false)
78+
.option('-t, --token <token>', 'Personal access token', process.env.PERSONAL_ACCESS_TOKEN)
79+
.action((options) => {
80+
const gitInfo = getGitInfo();
81+
if ('error' in gitInfo) {
82+
console.log(gitInfo.error);
83+
return;
84+
}
5285
const params = {
53-
[constants_1.INPUT_KEYS.DEBUG]: 'true',
86+
[constants_1.INPUT_KEYS.DEBUG]: options.debug.toString(),
5487
[constants_1.INPUT_KEYS.SINGLE_ACTION]: 'vector_action',
55-
[constants_1.INPUT_KEYS.SINGLE_ACTION_ISSUE]: '1',
88+
[constants_1.INPUT_KEYS.SINGLE_ACTION_ISSUE]: options.issue,
5689
[constants_1.INPUT_KEYS.SUPABASE_URL]: process.env.SUPABASE_URL,
5790
[constants_1.INPUT_KEYS.SUPABASE_KEY]: process.env.SUPABASE_KEY,
5891
[constants_1.INPUT_KEYS.TOKEN]: process.env.PERSONAL_ACCESS_TOKEN,
5992
[constants_1.INPUT_KEYS.AI_IGNORE_FILES]: 'dist/*,bin/*',
6093
repo: {
61-
owner: 'landamessenger',
62-
repo: 'git-board-flow',
94+
owner: gitInfo.owner,
95+
repo: gitInfo.repo,
6396
},
6497
commits: {
65-
ref: 'refs/heads/master',
98+
ref: `refs/heads/${options.branch}`,
6699
},
67100
issue: {
68-
number: 1,
101+
number: parseInt(options.issue),
69102
},
70103
};
104+
(0, logger_1.logInfo)((0, boxen_1.default)(chalk_1.default.cyan('🚀 Vectorization started\n') +
105+
chalk_1.default.gray(`Processing code blocks on ${gitInfo.owner}/${gitInfo.repo}/${options.branch}...`), {
106+
padding: 1,
107+
margin: 1,
108+
borderStyle: 'round',
109+
borderColor: 'cyan',
110+
title: 'Git Board Flow',
111+
titleAlignment: 'center'
112+
}));
71113
(0, local_action_1.runLocalAction)(params);
72114
});
73115
program.parse(process.argv);

dist/src/usecase/vector_action_use_case.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class VectorActionUseCase {
1515
this.CODE_INSTRUCTION_LINE = "Represent each line of code for retrieval";
1616
}
1717
async invoke(param) {
18+
(0, logger_1.logInfo)(`Executing ${this.taskId}.`);
1819
const results = [];
1920
try {
2021
if (!param.supabaseConfig) {
@@ -62,11 +63,11 @@ class VectorActionUseCase {
6263
}
6364
if (remoteChunkedFiles.length > 0 && remoteChunkedFiles.length === chunkedFile.chunks.length) {
6465
processedChunkedFiles.push(chunkedFile);
65-
(0, logger_1.logDebugInfo)(`📦 ✅ Chunk ${chunkedFile.path} already exists in Supabase`, true);
66+
(0, logger_1.logDebugInfo)(`📦 ✅ Chunk already exists in Supabase: [${chunkedFile.path}] [${chunkedFile.index}]`, true);
6667
continue;
6768
}
6869
else if (remoteChunkedFiles.length > 0 && remoteChunkedFiles.length !== chunkedFile.chunks.length) {
69-
(0, logger_1.logDebugInfo)(`📦 ❌ Chunk ${chunkedFile.path} has a different number of chunks in Supabase`, true);
70+
(0, logger_1.logDebugInfo)(`📦 ❌ Chunk has a different number of chunks in Supabase: [${chunkedFile.path}] [${chunkedFile.index}]`, true);
7071
}
7172
(0, logger_1.logSingleLine)(`🟡 ${i + 1}/${totalFiles} (${progress.toFixed(1)}%) - Estimated time remaining: ${Math.ceil(remainingTime)} seconds | Vectorizing [${chunkedFile.path}]`);
7273
const embeddings = await this.dockerRepository.getEmbedding(param, chunkedFile.chunks.map(chunk => [chunkedFile.type === 'block' ? this.CODE_INSTRUCTION_BLOCK : this.CODE_INSTRUCTION_LINE, chunk]));
@@ -76,7 +77,7 @@ class VectorActionUseCase {
7677
processedChunkedFiles.push(chunkedFile);
7778
}
7879
const totalDurationSeconds = (Date.now() - startTime) / 1000;
79-
(0, logger_1.logDebugInfo)(`All chunked files stored ${param.owner}/${param.repo}/${param.commit.branch}. Total duration: ${Math.ceil(totalDurationSeconds)} seconds`, true);
80+
(0, logger_1.logDebugInfo)(`📦 🚀 All chunked files stored ${param.owner}/${param.repo}/${param.commit.branch}. Total duration: ${Math.ceil(totalDurationSeconds)} seconds`, true);
8081
results.push(new result_1.Result({
8182
id: this.taskId,
8283
success: true,

dist/src/utils/constants.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,6 @@ export declare const INPUT_KEYS: {
152152
readonly SUPABASE_URL: "supabase-url";
153153
readonly SUPABASE_KEY: "supabase-key";
154154
};
155+
export declare const ERRORS: {
156+
readonly GIT_REPOSITORY_NOT_FOUND: "❌ Git repository not found";
157+
};

dist/src/utils/constants.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.INPUT_KEYS = exports.DEFAULT_IMAGE_CONFIG = void 0;
3+
exports.ERRORS = exports.INPUT_KEYS = exports.DEFAULT_IMAGE_CONFIG = void 0;
44
exports.DEFAULT_IMAGE_CONFIG = {
55
issue: {
66
automatic: [
@@ -318,3 +318,6 @@ exports.INPUT_KEYS = {
318318
SUPABASE_URL: 'supabase-url',
319319
SUPABASE_KEY: 'supabase-key'
320320
};
321+
exports.ERRORS = {
322+
GIT_REPOSITORY_NOT_FOUND: '❌ Git repository not found'
323+
};

0 commit comments

Comments
 (0)