From cf393312a25ea0cb5f301ac05e1fb7fe3d399f58 Mon Sep 17 00:00:00 2001 From: nrslib <38722970+nrslib@users.noreply.github.com> Date: Sun, 1 Feb 2026 08:40:18 +0900 Subject: [PATCH] Add --pipeline flag and improve log file naming - Add --pipeline flag for explicit pipeline/non-interactive mode - Change log file naming from base36 to YYYYMMDD-HHmmss-random format - Update --task description to clarify it's an alternative to --issue - Add tests for new timestamp-based session ID format Resolves #28 --- package-lock.json | 4 ++-- package.json | 2 +- resources/global/en/workflows/default.yaml | 2 +- resources/global/ja/workflows/default.yaml | 2 +- src/__tests__/utils.test.ts | 5 +++++ src/cli.ts | 18 +++++++++++++----- src/utils/session.ts | 6 ++++-- 7 files changed, 27 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0f491cb..5e7e875 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "takt", - "version": "0.3.6", + "version": "0.3.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "takt", - "version": "0.3.6", + "version": "0.3.7", "license": "MIT", "dependencies": { "@anthropic-ai/claude-agent-sdk": "^0.2.19", diff --git a/package.json b/package.json index a9f3bb7..e1e1a9a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "takt", - "version": "0.3.6", + "version": "0.3.7", "description": "TAKT: Task Agent Koordination Tool - AI Agent Workflow Orchestration", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/resources/global/en/workflows/default.yaml b/resources/global/en/workflows/default.yaml index 601a6d6..8082563 100644 --- a/resources/global/en/workflows/default.yaml +++ b/resources/global/en/workflows/default.yaml @@ -208,7 +208,7 @@ steps: permission_mode: acceptEdits rules: - condition: AI issues fixed - next: reviewers + next: ai_review - condition: Cannot proceed, insufficient info next: plan instruction_template: | diff --git a/resources/global/ja/workflows/default.yaml b/resources/global/ja/workflows/default.yaml index fea5604..2fed1fb 100644 --- a/resources/global/ja/workflows/default.yaml +++ b/resources/global/ja/workflows/default.yaml @@ -204,7 +204,7 @@ steps: permission_mode: acceptEdits rules: - condition: AI問題の修正完了 - next: reviewers + next: ai_review - condition: 判断できない、情報不足 next: plan instruction_template: | diff --git a/src/__tests__/utils.test.ts b/src/__tests__/utils.test.ts index d5b344e..cb0077d 100644 --- a/src/__tests__/utils.test.ts +++ b/src/__tests__/utils.test.ts @@ -52,6 +52,11 @@ describe('generateSessionId', () => { expect(typeof id).toBe('string'); expect(id.length).toBeGreaterThan(0); }); + + it('should follow the new timestamp format', () => { + const id = generateSessionId(); + expect(id).toMatch(/^\d{8}-\d{6}-[a-z0-9]{6}$/); + }); }); describe('createSessionLog', () => { diff --git a/src/cli.ts b/src/cli.ts index 885b05b..c31e504 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -260,7 +260,8 @@ program .option('--repo ', 'Repository (defaults to current)') .option('--provider ', 'Override agent provider (claude|codex|mock)') .option('--model ', 'Override agent model') - .option('-t, --task ', 'Task content (triggers pipeline/non-interactive mode)') + .option('-t, --task ', 'Task content (as alternative to GitHub issue)') + .option('--pipeline', 'Pipeline mode: non-interactive, no worktree, direct branch creation') .option('--skip-git', 'Skip branch creation, commit, and push (pipeline mode)') .option('--create-worktree ', 'Skip the worktree prompt by explicitly specifying yes or no'); @@ -268,9 +269,9 @@ program program.hook('preAction', async () => { resolvedCwd = resolve(process.cwd()); - // Pipeline mode: triggered by --task (non-interactive) + // Pipeline mode: triggered by --pipeline flag const rootOpts = program.opts(); - pipelineMode = rootOpts.task !== undefined; + pipelineMode = rootOpts.pipeline === true; await initGlobalDirs({ nonInteractive: pipelineMode }); initProjectDirs(resolvedCwd); @@ -390,11 +391,11 @@ program createWorktree: createWorktreeOverride, }; - // --- Pipeline mode (non-interactive): triggered by --task --- + // --- Pipeline mode (non-interactive): triggered by --pipeline --- if (pipelineMode) { const exitCode = await executePipeline({ issueNumber: opts.issue as number | undefined, - task: opts.task as string, + task: opts.task as string | undefined, workflow: (opts.workflow as string | undefined) ?? DEFAULT_WORKFLOW_NAME, branch: opts.branch as string | undefined, autoPr: opts.autoPr === true, @@ -413,6 +414,13 @@ program // --- Normal (interactive) mode --- + // Resolve --task option to task text + const taskFromOption = opts.task as string | undefined; + if (taskFromOption) { + await selectAndExecuteTask(resolvedCwd, taskFromOption, selectOptions, agentOverrides); + return; + } + // Resolve --issue N to task text (same as #N) const issueFromOption = opts.issue as number | undefined; if (issueFromOption) { diff --git a/src/utils/session.ts b/src/utils/session.ts index e7c1826..98f555e 100644 --- a/src/utils/session.ts +++ b/src/utils/session.ts @@ -195,7 +195,10 @@ export function loadNdjsonLog(filepath: string): SessionLog | null { /** Generate a session ID */ export function generateSessionId(): string { - const timestamp = Date.now().toString(36); + const now = new Date(); + const timestamp = `${now.getFullYear()}${String(now.getMonth() + 1).padStart(2, '0')}${String(now.getDate()).padStart(2, '0')}-${String( + now.getHours(), + ).padStart(2, '0')}${String(now.getMinutes()).padStart(2, '0')}${String(now.getSeconds()).padStart(2, '0')}`; const random = Math.random().toString(36).slice(2, 8); return `${timestamp}-${random}`; } @@ -333,4 +336,3 @@ export function updateLatestPointer( writeFileAtomic(latestPath, JSON.stringify(pointer, null, 2)); } -