fix(cli): handle missing status, clean imports, record delegated agent

This commit is contained in:
chahinebrini 2026-06-24 23:57:22 +02:00
parent 8dc9c96606
commit 37ddaae043
6 changed files with 11 additions and 7 deletions

View File

@ -2,7 +2,7 @@ import { input } from '@inquirer/prompts';
import { join } from 'path';
import { getEntityDir } from '../../core/paths.js';
import { getNextId } from '../../core/counter.js';
import { readEntity, writeEntity, listEntities } from '../../core/files.js';
import { readEntity, writeEntity } from '../../core/files.js';
import { DecisionSchema, type Decision } from '../../core/schema.js';
import { Index } from '../../core/index.js';

View File

@ -2,7 +2,7 @@ import { input, select } from '@inquirer/prompts';
import { join } from 'path';
import { getEntityDir } from '../../core/paths.js';
import { getNextId } from '../../core/counter.js';
import { readEntity, writeEntity, listEntities } from '../../core/files.js';
import { readEntity, writeEntity } from '../../core/files.js';
import { HandoffSchema, type Handoff } from '../../core/schema.js';
import { Index } from '../../core/index.js';
@ -20,6 +20,8 @@ export async function handoffCreate(cwd: string, options: Partial<Handoff> = {})
id: getNextId(cwd, 'handoff'),
fromRole,
toRole,
fromAgent: options.fromAgent,
toAgent: options.toAgent,
taskId: taskId || undefined,
summary,
context,

View File

@ -1,7 +1,7 @@
import { input, select } from '@inquirer/prompts';
import { join } from 'path';
import { getEntityDir } from '../../core/paths.js';
import { readEntity, writeEntity, listEntities } from '../../core/files.js';
import { writeEntity } from '../../core/files.js';
import { MemorySchema, type Memory } from '../../core/schema.js';
import { Index } from '../../core/index.js';

View File

@ -1,12 +1,14 @@
import { existsSync } from 'fs';
import { generateStatus } from '../../core/status.js';
import { readEntity } from '../../core/files.js';
import { getStatusPath } from '../../core/paths.js';
export function status(cwd: string, options: { update?: boolean } = {}): void {
if (options.update) {
const statusPath = getStatusPath(cwd);
if (options.update || !existsSync(statusPath)) {
generateStatus(cwd);
}
const { body } = readEntity(getStatusPath(cwd));
const { body } = readEntity(statusPath);
console.log(body);
}

View File

@ -2,7 +2,7 @@ import { input, select } from '@inquirer/prompts';
import { join } from 'path';
import { getEntityDir } from '../../core/paths.js';
import { getNextId } from '../../core/counter.js';
import { readEntity, writeEntity, listEntities } from '../../core/files.js';
import { readEntity, writeEntity } from '../../core/files.js';
import { TaskSchema, type Task } from '../../core/schema.js';
import { Index } from '../../core/index.js';

View File

@ -15,7 +15,7 @@ describe('e2e', () => {
rmSync(cwd, { recursive: true, force: true });
});
it('initializes and creates a task', () => {
it('initializes a project', () => {
const bin = join(process.cwd(), 'bin', 'agenthub.js');
execSync(`node ${bin} init --yes --project-name e2e-test`, { cwd });
expect(existsSync(join(cwd, '.agenthub', 'agenthub.config.json'))).toBe(true);