.gitignoreをプロジェクトディレクトリに設定
This commit is contained in:
parent
613f124984
commit
d9e4cdca4f
8
resources/project/.gitignore
vendored
Normal file
8
resources/project/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Temporary files
|
||||||
|
logs/
|
||||||
|
reports/
|
||||||
|
completed/
|
||||||
|
tasks/
|
||||||
|
worktrees/
|
||||||
|
agent_sessions.json
|
||||||
|
input_history
|
||||||
@ -7,6 +7,7 @@
|
|||||||
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
||||||
import { join, resolve } from 'node:path';
|
import { join, resolve } from 'node:path';
|
||||||
import { parse, stringify } from 'yaml';
|
import { parse, stringify } from 'yaml';
|
||||||
|
import { copyProjectResourcesToDir } from '../resources/index.js';
|
||||||
|
|
||||||
/** Permission mode for the project
|
/** Permission mode for the project
|
||||||
* - default: Uses Agent SDK's acceptEdits mode (auto-accepts file edits, minimal prompts)
|
* - 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 configDir = getConfigDir(projectDir);
|
||||||
const configPath = getConfigPath(projectDir);
|
const configPath = getConfigPath(projectDir);
|
||||||
|
|
||||||
// Ensure directory exists
|
// Ensure directory exists and copy project resources on first creation
|
||||||
if (!existsSync(configDir)) {
|
if (!existsSync(configDir)) {
|
||||||
mkdirSync(configDir, { recursive: true });
|
mkdirSync(configDir, { recursive: true });
|
||||||
|
copyProjectResourcesToDir(configDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
const content = stringify(config, { indent: 2 });
|
const content = stringify(config, { indent: 2 });
|
||||||
|
|||||||
@ -30,6 +30,13 @@ export function getGlobalResourcesDir(): string {
|
|||||||
return join(getResourcesDir(), 'global');
|
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}/)
|
* 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']);
|
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.
|
* Copy language-specific resources (agents and workflows) to ~/.takt.
|
||||||
* Copies from resources/global/{lang}/agents to ~/.takt/agents
|
* 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.
|
* Recursively copy directory contents.
|
||||||
* Skips files that already exist in target.
|
* 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)) {
|
for (const entry of readdirSync(srcDir)) {
|
||||||
// Skip .DS_Store and other hidden files
|
// Skip OS-generated files
|
||||||
if (entry.startsWith('.')) continue;
|
if (SKIP_FILES.includes(entry)) continue;
|
||||||
|
|
||||||
// Skip specified directories
|
// Skip specified directories
|
||||||
if (skipDirs.includes(entry)) continue;
|
if (skipDirs.includes(entry)) continue;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user