From d9e4cdca4f3203c1f3cad5f6376c77987a7a118f Mon Sep 17 00:00:00 2001 From: nrslib <38722970+nrslib@users.noreply.github.com> Date: Mon, 26 Jan 2026 11:34:00 +0900 Subject: [PATCH] =?UTF-8?q?.gitignore=E3=82=92=E3=83=97=E3=83=AD=E3=82=B8?= =?UTF-8?q?=E3=82=A7=E3=82=AF=E3=83=88=E3=83=87=E3=82=A3=E3=83=AC=E3=82=AF?= =?UTF-8?q?=E3=83=88=E3=83=AA=E3=81=AB=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/project/.gitignore | 8 ++++++++ src/config/projectConfig.ts | 4 +++- src/resources/index.ts | 26 ++++++++++++++++++++++++-- 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 resources/project/.gitignore diff --git a/resources/project/.gitignore b/resources/project/.gitignore new file mode 100644 index 0000000..ff23787 --- /dev/null +++ b/resources/project/.gitignore @@ -0,0 +1,8 @@ +# Temporary files +logs/ +reports/ +completed/ +tasks/ +worktrees/ +agent_sessions.json +input_history diff --git a/src/config/projectConfig.ts b/src/config/projectConfig.ts index 36bb2d0..9dab002 100644 --- a/src/config/projectConfig.ts +++ b/src/config/projectConfig.ts @@ -7,6 +7,7 @@ import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs'; import { join, resolve } from 'node:path'; import { parse, stringify } from 'yaml'; +import { copyProjectResourcesToDir } from '../resources/index.js'; /** Permission mode for the project * - default: Uses Agent SDK's acceptEdits mode (auto-accepts file edits, minimal prompts) @@ -81,9 +82,10 @@ export function saveProjectConfig(projectDir: string, config: ProjectLocalConfig const configDir = getConfigDir(projectDir); const configPath = getConfigPath(projectDir); - // Ensure directory exists + // Ensure directory exists and copy project resources on first creation if (!existsSync(configDir)) { mkdirSync(configDir, { recursive: true }); + copyProjectResourcesToDir(configDir); } const content = stringify(config, { indent: 2 }); diff --git a/src/resources/index.ts b/src/resources/index.ts index 10ab4db..a0ee09f 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -30,6 +30,13 @@ export function getGlobalResourcesDir(): string { return join(getResourcesDir(), 'global'); } +/** + * Get the project resources directory path (resources/project/) + */ +export function getProjectResourcesDir(): string { + return join(getResourcesDir(), 'project'); +} + /** * Get the language-specific global resources directory path (resources/global/{lang}/) */ @@ -51,6 +58,18 @@ export function copyGlobalResourcesToDir(targetDir: string): void { copyDirRecursive(resourcesDir, targetDir, ['en', 'ja']); } +/** + * Copy project resources directory to .takt in project. + * Only copies files that don't exist in target (e.g., .gitignore). + */ +export function copyProjectResourcesToDir(targetDir: string): void { + const resourcesDir = getProjectResourcesDir(); + if (!existsSync(resourcesDir)) { + return; + } + copyDirRecursive(resourcesDir, targetDir); +} + /** * Copy language-specific resources (agents and workflows) to ~/.takt. * Copies from resources/global/{lang}/agents to ~/.takt/agents @@ -87,6 +106,9 @@ export function copyLanguageResourcesToDir(targetDir: string, lang: Language): v } } +/** Files to skip during resource copy (OS-generated files) */ +const SKIP_FILES = ['.DS_Store', 'Thumbs.db']; + /** * Recursively copy directory contents. * Skips files that already exist in target. @@ -98,8 +120,8 @@ function copyDirRecursive(srcDir: string, destDir: string, skipDirs: string[] = } for (const entry of readdirSync(srcDir)) { - // Skip .DS_Store and other hidden files - if (entry.startsWith('.')) continue; + // Skip OS-generated files + if (SKIP_FILES.includes(entry)) continue; // Skip specified directories if (skipDirs.includes(entry)) continue;