style: apply prettier formatting
This commit is contained in:
@@ -44,9 +44,11 @@ describe('config/env loading', () => {
|
||||
it('preserves empty-string env values and still prefers process.env over .env', async () => {
|
||||
fs.writeFileSync(
|
||||
path.join(tempRoot, '.env'),
|
||||
['FROM_FILE=file-value', 'EMPTY_IN_FILE=', 'PROCESS_EMPTY=file-fallback'].join(
|
||||
'\n',
|
||||
),
|
||||
[
|
||||
'FROM_FILE=file-value',
|
||||
'EMPTY_IN_FILE=',
|
||||
'PROCESS_EMPTY=file-fallback',
|
||||
].join('\n'),
|
||||
);
|
||||
process.env.FROM_FILE = 'process-value';
|
||||
process.env.PROCESS_EMPTY = '';
|
||||
|
||||
@@ -121,7 +121,9 @@ export function loadConfig(): AppConfig {
|
||||
|
||||
const rawMaxRoundTrips = readText('PAIRED_MAX_ROUND_TRIPS');
|
||||
const maxRoundTrips =
|
||||
rawMaxRoundTrips === '0' ? Infinity : readInteger('PAIRED_MAX_ROUND_TRIPS', 1000);
|
||||
rawMaxRoundTrips === '0'
|
||||
? Infinity
|
||||
: readInteger('PAIRED_MAX_ROUND_TRIPS', 1000);
|
||||
|
||||
return {
|
||||
assistant: {
|
||||
@@ -157,8 +159,7 @@ export function loadConfig(): AppConfig {
|
||||
readNonEmptyText('EJCLAW_DATA_DIR') ?? path.join(projectRoot, 'data'),
|
||||
),
|
||||
cacheDir: path.resolve(
|
||||
readNonEmptyText('EJCLAW_CACHE_DIR') ??
|
||||
path.join(projectRoot, 'cache'),
|
||||
readNonEmptyText('EJCLAW_CACHE_DIR') ?? path.join(projectRoot, 'cache'),
|
||||
),
|
||||
},
|
||||
runtime: {
|
||||
@@ -216,9 +217,11 @@ export function loadConfig(): AppConfig {
|
||||
},
|
||||
sessionCommands: {
|
||||
allowedSenders: new Set(
|
||||
((readText('SESSION_COMMAND_ALLOWED_SENDERS') ??
|
||||
readText('SESSION_COMMAND_USER_IDS')) ??
|
||||
'')
|
||||
(
|
||||
readText('SESSION_COMMAND_ALLOWED_SENDERS') ??
|
||||
readText('SESSION_COMMAND_USER_IDS') ??
|
||||
''
|
||||
)
|
||||
.split(',')
|
||||
.map((value) => value.trim())
|
||||
.filter(Boolean),
|
||||
|
||||
@@ -1598,16 +1598,20 @@ describe('room assignment writes', () => {
|
||||
roomMode: 'tribunal',
|
||||
ownerAgentType: 'codex',
|
||||
});
|
||||
expect(getAllRegisteredGroups('claude-code')['dc:projection-room']).toMatchObject({
|
||||
expect(
|
||||
getAllRegisteredGroups('claude-code')['dc:projection-room'],
|
||||
).toMatchObject({
|
||||
name: 'Projection Room Renamed',
|
||||
folder: 'projection-room',
|
||||
agentType: 'claude-code',
|
||||
});
|
||||
expect(getAllRegisteredGroups('codex')['dc:projection-room']).toMatchObject({
|
||||
name: 'Projection Room Renamed',
|
||||
folder: 'projection-room',
|
||||
agentType: 'codex',
|
||||
});
|
||||
expect(getAllRegisteredGroups('codex')['dc:projection-room']).toMatchObject(
|
||||
{
|
||||
name: 'Projection Room Renamed',
|
||||
folder: 'projection-room',
|
||||
agentType: 'codex',
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
10
src/db.ts
10
src/db.ts
@@ -672,9 +672,7 @@ export function markWorkItemDeliveryRetry(id: number, error: string): void {
|
||||
markWorkItemDeliveryRetryInDatabase(db, id, error);
|
||||
}
|
||||
|
||||
export function createTask(
|
||||
task: CreateScheduledTaskInput,
|
||||
): void {
|
||||
export function createTask(task: CreateScheduledTaskInput): void {
|
||||
createTaskInDatabase(db, task);
|
||||
}
|
||||
|
||||
@@ -705,10 +703,7 @@ export function getAllTasks(agentType?: AgentType): ScheduledTask[] {
|
||||
return getAllTasksFromDatabase(db, agentType);
|
||||
}
|
||||
|
||||
export function updateTask(
|
||||
id: string,
|
||||
updates: ScheduledTaskUpdates,
|
||||
): void {
|
||||
export function updateTask(id: string, updates: ScheduledTaskUpdates): void {
|
||||
updateTaskInDatabase(db, id, updates);
|
||||
}
|
||||
|
||||
@@ -1200,7 +1195,6 @@ export function getEffectiveRuntimeRoomMode(chatJid: string): RoomMode {
|
||||
: 'single';
|
||||
}
|
||||
|
||||
|
||||
// --- Paired task/project/workspace state ---
|
||||
|
||||
export function upsertPairedProject(project: PairedProject): void {
|
||||
|
||||
@@ -78,7 +78,10 @@ export function migrateJsonStateFromFiles(
|
||||
}
|
||||
}
|
||||
|
||||
const sessions = migrateFile('sessions.json') as Record<string, string> | null;
|
||||
const sessions = migrateFile('sessions.json') as Record<
|
||||
string,
|
||||
string
|
||||
> | null;
|
||||
if (sessions) {
|
||||
for (const [folder, sessionId] of Object.entries(sessions)) {
|
||||
hooks.setSession(folder, sessionId);
|
||||
|
||||
@@ -339,29 +339,29 @@ export function backfillWorkItemServiceShadows(database: Database): void {
|
||||
WHERE id = ?`,
|
||||
);
|
||||
|
||||
const tx = database.transaction((workItemRows: WorkItemServiceShadowRow[]) => {
|
||||
for (const row of workItemRows) {
|
||||
const agentType = normalizeStoredAgentType(row.agent_type);
|
||||
if (!agentType) {
|
||||
continue;
|
||||
const tx = database.transaction(
|
||||
(workItemRows: WorkItemServiceShadowRow[]) => {
|
||||
for (const row of workItemRows) {
|
||||
const agentType = normalizeStoredAgentType(row.agent_type);
|
||||
if (!agentType) {
|
||||
continue;
|
||||
}
|
||||
const normalizedServiceId = resolveWorkItemServiceShadow(
|
||||
agentType,
|
||||
row.delivery_role,
|
||||
);
|
||||
if (normalizedServiceId === row.service_id) {
|
||||
continue;
|
||||
}
|
||||
update.run(normalizedServiceId, row.id);
|
||||
}
|
||||
const normalizedServiceId = resolveWorkItemServiceShadow(
|
||||
agentType,
|
||||
row.delivery_role,
|
||||
);
|
||||
if (normalizedServiceId === row.service_id) {
|
||||
continue;
|
||||
}
|
||||
update.run(normalizedServiceId, row.id);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
tx(rows);
|
||||
}
|
||||
|
||||
export function backfillServiceHandoffServiceShadows(
|
||||
database: Database,
|
||||
): void {
|
||||
export function backfillServiceHandoffServiceShadows(database: Database): void {
|
||||
const rows = database
|
||||
.prepare(
|
||||
`SELECT
|
||||
|
||||
@@ -145,7 +145,10 @@ function queryFtsRowOrder(
|
||||
}
|
||||
}
|
||||
|
||||
export function touchMemoriesInDatabase(database: Database, ids: number[]): void {
|
||||
export function touchMemoriesInDatabase(
|
||||
database: Database,
|
||||
ids: number[],
|
||||
): void {
|
||||
const uniqueIds = [
|
||||
...new Set(ids.filter((id) => Number.isInteger(id) && id > 0)),
|
||||
];
|
||||
|
||||
@@ -91,7 +91,10 @@ export function applySchemaMigrations(
|
||||
`ALTER TABLE room_settings ADD COLUMN mode_source TEXT NOT NULL DEFAULT 'explicit'`,
|
||||
);
|
||||
tryExecMigration(database, `ALTER TABLE room_settings ADD COLUMN name TEXT`);
|
||||
tryExecMigration(database, `ALTER TABLE room_settings ADD COLUMN folder TEXT`);
|
||||
tryExecMigration(
|
||||
database,
|
||||
`ALTER TABLE room_settings ADD COLUMN folder TEXT`,
|
||||
);
|
||||
tryExecMigration(
|
||||
database,
|
||||
`ALTER TABLE room_settings ADD COLUMN trigger_pattern TEXT`,
|
||||
|
||||
@@ -87,7 +87,9 @@ export function deleteAllSessionsForGroupFromDatabase(
|
||||
database: Database,
|
||||
groupFolder: string,
|
||||
): void {
|
||||
database.prepare('DELETE FROM sessions WHERE group_folder = ?').run(groupFolder);
|
||||
database
|
||||
.prepare('DELETE FROM sessions WHERE group_folder = ?')
|
||||
.run(groupFolder);
|
||||
}
|
||||
|
||||
export function getAllSessionsForAgentTypeFromDatabase(
|
||||
|
||||
@@ -73,9 +73,9 @@ export function getTaskByIdFromDatabase(
|
||||
database: Database,
|
||||
id: string,
|
||||
): ScheduledTask | undefined {
|
||||
return database.prepare('SELECT * FROM scheduled_tasks WHERE id = ?').get(id) as
|
||||
| ScheduledTask
|
||||
| undefined;
|
||||
return database
|
||||
.prepare('SELECT * FROM scheduled_tasks WHERE id = ?')
|
||||
.get(id) as ScheduledTask | undefined;
|
||||
}
|
||||
|
||||
export function findDuplicateCiWatcherInDatabase(
|
||||
|
||||
@@ -140,8 +140,9 @@ export function createProducedWorkItemInDatabase(
|
||||
database.prepare('SELECT last_insert_rowid() as id').get() as { id: number }
|
||||
).id;
|
||||
return hydrateWorkItemRow(
|
||||
database.prepare('SELECT * FROM work_items WHERE id = ?').get(lastId) as
|
||||
| StoredWorkItemRow,
|
||||
database
|
||||
.prepare('SELECT * FROM work_items WHERE id = ?')
|
||||
.get(lastId) as StoredWorkItemRow,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user