This repository was archived by the owner on Mar 4, 2026. It is now read-only.
forked from coleam00/remote-agentic-coding-system
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-test-codebase.js
More file actions
51 lines (45 loc) · 1.37 KB
/
setup-test-codebase.js
File metadata and controls
51 lines (45 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const { Pool } = require('pg');
require('dotenv').config();
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
});
async function setup() {
try {
// Create or get codebase
let cbResult = await pool.query(`SELECT id FROM remote_agent_codebases WHERE name = $1`, [
'ai-for-print-success',
]);
let codebaseId;
if (cbResult.rows.length > 0) {
codebaseId = cbResult.rows[0].id;
console.log('Found existing codebase ID:', codebaseId);
} else {
cbResult = await pool.query(
`INSERT INTO remote_agent_codebases (name, repository_url, default_cwd, commands)
VALUES ($1, $2, $3, $4::jsonb)
RETURNING id`,
[
'ai-for-print-success',
'https://github.com/test/repo',
'/workspace/ai-for-print-success',
'{}',
]
);
codebaseId = cbResult.rows[0].id;
console.log('Created new codebase ID:', codebaseId);
}
// Update test conversation
await pool.query(
`UPDATE remote_agent_conversations
SET codebase_id = $1, cwd = $2
WHERE platform_conversation_id = $3`,
[codebaseId, '/workspace/ai-for-print-success', 'test-commands']
);
console.log('Test conversation updated with codebase!');
} catch (error) {
console.error('Error:', error.message);
} finally {
await pool.end();
}
}
setup();