Skip to content

Commit

Permalink
cool
Browse files Browse the repository at this point in the history
  • Loading branch information
adnan wahab committed Oct 21, 2024
1 parent 7d4b60a commit 806140c
Show file tree
Hide file tree
Showing 116 changed files with 54 additions and 21,035 deletions.
139 changes: 8 additions & 131 deletions files.json

Large diffs are not rendered by default.

129 changes: 0 additions & 129 deletions web-ui/index.html

This file was deleted.

52 changes: 46 additions & 6 deletions web-ui/js/helpers/Kent_Beck_robusteness.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ async function findUnusedFiles(directory) {
// Agent 2: Comment Quality Evaluator
async function moveComments(filePath) {
const fileContent = fs.readFileSync(filePath, "utf-8");
console.log('acorn', filePath)
//install -g uglify-js
// const response = await ollama.generate({
// model: "codellama:13b",
// prompt: `Evaluate the following code comments and suggest improvements or removal of unnecessary ones:\n\n${fileContent}`,
Expand All @@ -49,7 +51,8 @@ async function moveComments(filePath) {
});

let newFileContent = acorn.generate(ast);
fs.writeFileSync(filePath, newFileContent);
console.log(newFileContent)
//fs.writeFileSync(filePath, newFileContent);
return { newFileContent, comments };
// Process the response and return suggestions
}
Expand Down Expand Up @@ -95,15 +98,17 @@ async function runAllAgents(directory) {
//const directorySuggestions = await suggestDirectorySimplifications(directory);
//saveSuggestions({ directory_suggestions: directorySuggestions }, "directory_suggestions.json");
let count = {
comments: {}
comments: {},
by_extension: {},

}

files.forEach(file => {
count[path.extname(file)] =(count[path.extname(file)] || 0) + fs.readFileSync(file, 'utf-8').length
count['comments'][file] = moveComments(file)
count[file] = fs.readFileSync(file, 'utf-8').length

if (path.extname(file) === '.js' || path.extname(file) === '.ts' || path.extname(file) === '.jsx' || path.extname(file) === '.tsx') {
count.by_extension[path.extname(file)] =(count.by_extension[path.extname(file)] || 0) + fs.readFileSync(file, 'utf-8').length
//count['comments'][file] = moveComments(file)
count[file] = fs.readFileSync(file, 'utf-8').length
}
});

//console.log(count)
Expand All @@ -113,6 +118,41 @@ async function runAllAgents(directory) {

//anthropci ---- 200k maximum
//gemini 2 million token context window


// Move all JSX and TSX files to a folder called 'views'
const moveFilesToViews = async () => {
const viewsDir = path.join(root_dir, 'views');
if (!fs.existsSync(viewsDir)) {
fs.mkdirSync(viewsDir);
}

files.filter(file => file.endsWith('.jsx') || file.endsWith('.tsx')).forEach(file => {
const newFilePath = path.join(viewsDir, path.basename(file));
fs.renameSync(file, newFilePath);
console.log(`Moved ${file} to ${newFilePath}`);
});
};

// Move all HTML files to a folder called 'views/archive'
const moveHtmlFilesToArchive = async () => {
const archiveDir = path.join(root_dir, 'views', 'archive');
if (!fs.existsSync(archiveDir)) {
fs.mkdirSync(archiveDir, { recursive: true });
}

files.filter(file => file.endsWith('.html')).forEach(file => {
const newFilePath = path.join(archiveDir, path.basename(file));
fs.renameSync(file, newFilePath);
console.log(`Moved ${file} to ${newFilePath}`);
});
};

await moveFilesToViews();
await moveHtmlFilesToArchive();



}

runAllAgents()
Empty file.
71 changes: 0 additions & 71 deletions web-ui/js/views/blag.html

This file was deleted.

Loading

0 comments on commit 806140c

Please sign in to comment.