diff --git a/skills/worklog/SKILL.md b/skills/worklog/SKILL.md index 285fdcc..f428998 100644 --- a/skills/worklog/SKILL.md +++ b/skills/worklog/SKILL.md @@ -116,7 +116,7 @@ ingest ingest calendar-end \ 業務時間外の活動の中で仕事に関連する着想が生まれたときは `--personal` フラグをつけて記録する。 ```bash -ingest note "〇〇の設計方針のヒントが浮かんだ" --personal --topic +ingest note "〇〇の設計方針のヒントが浮かんだ" --personal --topic ingest note "〇〇という概念が今の課題に使えるかも" --personal ``` diff --git a/src/cli/commands/blocker.ts b/src/cli/commands/blocker.ts index af7ea01..8c314a3 100644 --- a/src/cli/commands/blocker.ts +++ b/src/cli/commands/blocker.ts @@ -1,6 +1,7 @@ import { Command } from 'commander'; import { createEvent } from '../../core/eventService.js'; import { updateTaskStatus } from '../../core/taskService.js'; +import { findOrCreateTopic } from '../../core/topicService.js'; export function registerBlocker(program: Command): void { program @@ -8,15 +9,16 @@ export function registerBlocker(program: Command): void { .description('Record a blocker') .requiredOption('--summary ', 'Blocker summary (required)') .option('--task ', 'Task ID') - .option('--topic ', 'Topic ID') + .option('--topic ', 'Topic name') .option('--details ', 'Additional details') .option('--block-task', 'Update task status to blocked') .action(async (options) => { try { + const topicId = options.topic ? findOrCreateTopic(options.topic).id : undefined; const event = createEvent({ event_type: 'blocker_found', task_id: options.task, - topic_id: options.topic, + topic_id: topicId, actor: 'human', origin: 'manual', summary: options.summary, diff --git a/src/cli/commands/decision.ts b/src/cli/commands/decision.ts index ab2c6f1..e774dbc 100644 --- a/src/cli/commands/decision.ts +++ b/src/cli/commands/decision.ts @@ -1,5 +1,6 @@ import { Command } from 'commander'; import { createEvent } from '../../core/eventService.js'; +import { findOrCreateTopic } from '../../core/topicService.js'; export function registerDecision(program: Command): void { program @@ -8,14 +9,15 @@ export function registerDecision(program: Command): void { .requiredOption('--summary ', 'Decision summary (required)') .option('--importance ', 'Importance score (1-10)', parseFloat) .option('--task ', 'Task ID') - .option('--topic ', 'Topic ID') + .option('--topic ', 'Topic name') .option('--details ', 'Additional details') .action(async (options) => { try { + const topicId = options.topic ? findOrCreateTopic(options.topic).id : undefined; const event = createEvent({ event_type: 'decision_made', task_id: options.task, - topic_id: options.topic, + topic_id: topicId, actor: 'human', origin: 'manual', summary: options.summary, diff --git a/src/cli/commands/ingestArtifactUpdated.ts b/src/cli/commands/ingestArtifactUpdated.ts index b8093b9..c8a1d8d 100644 --- a/src/cli/commands/ingestArtifactUpdated.ts +++ b/src/cli/commands/ingestArtifactUpdated.ts @@ -1,5 +1,6 @@ import { Command } from 'commander'; import { createEvent } from '../../core/eventService.js'; +import { findOrCreateTopic } from '../../core/topicService.js'; export function registerIngestArtifactUpdated(program: Command): void { const ingest = program.commands.find(c => c.name() === 'ingest') ?? program.command('ingest').description('Ingest events from external sources'); @@ -10,15 +11,16 @@ export function registerIngestArtifactUpdated(program: Command): void { .requiredOption('--summary ', 'Summary of the artifact update (required)') .option('--file ', 'Path to the updated file/artifact') .option('--task ', 'Associated task ID') - .option('--topic ', 'Associated topic ID') + .option('--topic ', 'Associated topic name') .option('--project ', 'Associated project ID') .option('--occurred-at ', 'Update time (ISO 8601)') .action(async (options) => { try { + const topicId = options.topic ? findOrCreateTopic(options.topic).id : undefined; const event = createEvent({ event_type: 'artifact_updated', task_id: options.task, - topic_id: options.topic, + topic_id: topicId, project_id: options.project, actor: 'system', origin: 'watcher', diff --git a/src/cli/commands/ingestCalendarEnd.ts b/src/cli/commands/ingestCalendarEnd.ts index ecc4c20..f5f32cc 100644 --- a/src/cli/commands/ingestCalendarEnd.ts +++ b/src/cli/commands/ingestCalendarEnd.ts @@ -1,5 +1,6 @@ import { Command } from 'commander'; import { createEvent } from '../../core/eventService.js'; +import { findOrCreateTopic } from '../../core/topicService.js'; export function registerIngestCalendarEnd(program: Command): void { const ingest = program.commands.find(c => c.name() === 'ingest') ?? program.command('ingest').description('Ingest events from external sources'); @@ -10,15 +11,16 @@ export function registerIngestCalendarEnd(program: Command): void { .requiredOption('--summary ', 'Calendar event title/summary (required)') .option('--occurred-at ', 'Event end time (ISO 8601)') .option('--task ', 'Associated task ID') - .option('--topic ', 'Associated topic ID') + .option('--topic ', 'Associated topic name') .option('--project ', 'Associated project ID') .option('--source-ref ', 'Calendar event ID or reference') .action(async (options) => { try { + const topicId = options.topic ? findOrCreateTopic(options.topic).id : undefined; const event = createEvent({ event_type: 'calendar_event_ended', task_id: options.task, - topic_id: options.topic, + topic_id: topicId, project_id: options.project, actor: 'ai', origin: 'gcal', diff --git a/src/cli/commands/ingestCalendarStart.ts b/src/cli/commands/ingestCalendarStart.ts index 798ff5b..584de4c 100644 --- a/src/cli/commands/ingestCalendarStart.ts +++ b/src/cli/commands/ingestCalendarStart.ts @@ -1,5 +1,6 @@ import { Command } from 'commander'; import { createEvent } from '../../core/eventService.js'; +import { findOrCreateTopic } from '../../core/topicService.js'; export function registerIngestCalendarStart(program: Command): void { const ingest = program.commands.find(c => c.name() === 'ingest') ?? program.command('ingest').description('Ingest events from external sources'); @@ -10,15 +11,16 @@ export function registerIngestCalendarStart(program: Command): void { .requiredOption('--summary ', 'Calendar event title/summary (required)') .option('--occurred-at ', 'Event start time (ISO 8601)') .option('--task ', 'Associated task ID') - .option('--topic ', 'Associated topic ID') + .option('--topic ', 'Associated topic name') .option('--project ', 'Associated project ID') .option('--source-ref ', 'Calendar event ID or reference') .action(async (options) => { try { + const topicId = options.topic ? findOrCreateTopic(options.topic).id : undefined; const event = createEvent({ event_type: 'calendar_event_started', task_id: options.task, - topic_id: options.topic, + topic_id: topicId, project_id: options.project, actor: 'ai', origin: 'gcal', diff --git a/src/cli/commands/ingestGitCommit.ts b/src/cli/commands/ingestGitCommit.ts index 8f88ba9..2290bf5 100644 --- a/src/cli/commands/ingestGitCommit.ts +++ b/src/cli/commands/ingestGitCommit.ts @@ -1,5 +1,6 @@ import { Command } from 'commander'; import { createEvent } from '../../core/eventService.js'; +import { findOrCreateTopic } from '../../core/topicService.js'; export function registerIngestGitCommit(program: Command): void { const ingest = program.commands.find(c => c.name() === 'ingest') ?? program.command('ingest').description('Ingest events from external sources'); @@ -11,17 +12,18 @@ export function registerIngestGitCommit(program: Command): void { .requiredOption('--message ', 'Commit message (required)') .option('--files ', 'Comma-separated list of changed files') .option('--task ', 'Associated task ID') - .option('--topic ', 'Associated topic ID') + .option('--topic ', 'Associated topic name') .option('--project ', 'Associated project ID') .option('--occurred-at ', 'Commit time (ISO 8601)') .action(async (options) => { try { + const topicId = options.topic ? findOrCreateTopic(options.topic).id : undefined; const details = options.files ? `Changed files: ${options.files}` : undefined; const event = createEvent({ event_type: 'git_commit', task_id: options.task, - topic_id: options.topic, + topic_id: topicId, project_id: options.project, actor: 'system', origin: 'git', diff --git a/src/cli/commands/next.ts b/src/cli/commands/next.ts index 489a806..7b5235b 100644 --- a/src/cli/commands/next.ts +++ b/src/cli/commands/next.ts @@ -1,5 +1,6 @@ import { Command } from 'commander'; import { createEvent } from '../../core/eventService.js'; +import { findOrCreateTopic } from '../../core/topicService.js'; export function registerNext(program: Command): void { program @@ -7,14 +8,15 @@ export function registerNext(program: Command): void { .description('Define the next action') .requiredOption('--summary ', 'Next action summary (required)') .option('--task ', 'Task ID') - .option('--topic ', 'Topic ID') + .option('--topic ', 'Topic name') .option('--details ', 'Additional details') .action(async (options) => { try { + const topicId = options.topic ? findOrCreateTopic(options.topic).id : undefined; const event = createEvent({ event_type: 'next_action_defined', task_id: options.task, - topic_id: options.topic, + topic_id: topicId, actor: 'human', origin: 'manual', summary: options.summary, diff --git a/src/cli/commands/note.ts b/src/cli/commands/note.ts index a527605..939fd3a 100644 --- a/src/cli/commands/note.ts +++ b/src/cli/commands/note.ts @@ -1,5 +1,6 @@ import { Command } from 'commander'; import { createEvent } from '../../core/eventService.js'; +import { findOrCreateTopic } from '../../core/topicService.js'; export function registerNote(program: Command): void { program @@ -7,16 +8,17 @@ export function registerNote(program: Command): void { .description('Add a note') .requiredOption('--summary ', 'Note summary (required)') .option('--task ', 'Task ID') - .option('--topic ', 'Topic ID') + .option('--topic ', 'Topic name') .option('--details ', 'Additional details') .option('--personal', 'Mark as a personal note (e.g. from a walk, reading, etc.)') .action(async (options) => { try { + const topicId = options.topic ? findOrCreateTopic(options.topic).id : undefined; const origin = options.personal ? 'personal' : 'manual'; const event = createEvent({ event_type: 'note_added', task_id: options.task, - topic_id: options.topic, + topic_id: topicId, actor: 'human', origin, summary: options.summary,