Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 45 additions & 36 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,51 +52,43 @@ ai-coding-project-boilerplate/

## 🚀 使い方

### 1. ボイラープレートの導入
### 1. 新しいプロジェクトの作成(推奨)

```bash
# ボイラープレートをクローンして新しいプロジェクトを作成
git clone https://github.com/shinpr/ai-coding-project-boilerplate.git my-project
# npxを使用して新しいプロジェクトを作成
npx github:shinpr/ai-coding-project-boilerplate my-project --lang=ja

# プロジェクトに移動
cd my-project

# 依存関係のインストール
# 依存関係をインストール
npm install

# 使用する言語を設定(日本語版のプロジェクトとして設定)
npm run lang:ja # 日本語版として設定
# npm run lang:en # 英語版として設定する場合

# Git履歴をリセットして新しいプロジェクトとして開始
rm -rf .git
git init
git add .
git commit -m "feat: initial commit from AI Coding Project Boilerplate"
# 開発を開始!
npm run dev
```

## 🌐 多言語化機能
オプション:
- `--lang=ja` - 日本語プロジェクトとして設定
- `--lang=en` - 英語プロジェクトとして設定(デフォルト)

このボイラープレートは日本語と英語の両方をサポートしています。
### 別の方法: このリポジトリをカスタマイズする場合

### 言語切り替えコマンド
ボイラープレート自体をカスタマイズしたい場合:

```bash
# 日本語に切り替え
npm run lang:ja
# リポジトリをクローン
git clone https://github.com/shinpr/ai-coding-project-boilerplate.git
cd ai-coding-project-boilerplate

# 英語に切り替え
npm run lang:en
# 依存関係をインストール
npm install

# 現在の言語設定を確認
npm run lang:status
# 使用する言語を設定
npm run lang:ja # 日本語版として設定
# npm run lang:en # 英語版として設定する場合
```

言語を切り替えると、以下のファイルが自動的に更新されます:
- `CLAUDE.md` - Claude Code設定ファイル
- `docs/rules/` - 開発ルールディレクトリ
- `docs/guides/sub-agents.md` - Sub-agentsガイド
- `.claude/commands/` - スラッシュコマンド
- `.claude/agents/` - Sub-agent定義

### 2. プロジェクト固有の設定

1. **基本情報の更新**
Expand Down Expand Up @@ -138,6 +130,30 @@ npm run lang:status
- **説明文**: "TypeScript project boilerplate specifically designed for Claude Code. Features a comprehensive rule system and sub-agent architecture for generating high quality code efficiently."
- **トピックス**: `claude-code`, `typescript`, `boilerplate`, `ai-development`, `subagents`, `code-quality`, `multilingual`

## 🌐 多言語化機能

このボイラープレートは日本語と英語の両方をサポートしています。

### 言語切り替えコマンド

```bash
# 日本語に切り替え
npm run lang:ja

# 英語に切り替え
npm run lang:en

# 現在の言語設定を確認
npm run lang:status
```

言語を切り替えると、以下のファイルが自動的に更新されます:
- `CLAUDE.md` - Claude Code設定ファイル
- `docs/rules/` - 開発ルールディレクトリ
- `docs/guides/sub-agents.md` - Sub-agentsガイド
- `.claude/commands/` - スラッシュコマンド
- `.claude/agents/` - Sub-agent定義

## 💻 開発コマンド

### 基本コマンド
Expand All @@ -156,13 +172,6 @@ npm run format # コードフォーマット
npm run check:deps # 循環依存チェック
```

### 多言語化
```bash
npm run lang:ja # 日本語に切り替え
npm run lang:en # 英語に切り替え
npm run lang:status # 現在の言語設定確認
```

### その他のコマンド
```bash
npm run test:coverage # カバレッジレポート生成
Expand Down
43 changes: 26 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,25 +75,41 @@ When you switch languages, the following files are automatically updated:

## 🚀 Getting Started

### 1. Setting Up the Boilerplate
### 1. Setting Up a New Project (Recommended)

```bash
# Clone the boilerplate to create a new project
git clone https://github.com/shinpr/ai-coding-project-boilerplate.git my-project
# Create a new project using npx
npx github:shinpr/ai-coding-project-boilerplate my-project

# Navigate to your project
cd my-project

# Install dependencies
npm install

# Set up your project language (configure as English project)
# Start developing!
npm run dev
```

Options:
- `--lang=en` - Set up as English project (default)
- `--lang=ja` - Set up as Japanese project

### Alternative: Customizing This Repository

If you want to customize the boilerplate itself:

```bash
# Clone the repository
git clone https://github.com/shinpr/ai-coding-project-boilerplate.git
cd ai-coding-project-boilerplate

# Install dependencies
npm install

# Set your preferred language
npm run lang:en # Set up as English project
# npm run lang:ja # Set up as Japanese project if preferred

# Reset Git history and start as a new project
rm -rf .git
git init
git add .
git commit -m "feat: initial commit from AI Coding Project Boilerplate"
```

### 2. Project-Specific Configuration
Expand Down Expand Up @@ -155,13 +171,6 @@ npm run format # Code formatting
npm run check:deps # Circular dependency check
```

### Language Switching
```bash
npm run lang:ja # Switch to Japanese
npm run lang:en # Switch to English
npm run lang:status # Check current language setting
```

### Additional Commands
```bash
npm run test:coverage # Generate coverage report
Expand Down
85 changes: 85 additions & 0 deletions bin/create-project.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/usr/bin/env node

const { spawn } = require('child_process');
const path = require('path');
const fs = require('fs');

// Parse command line arguments
const args = process.argv.slice(2);

if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
console.log(`
🚀 AI Coding Project Boilerplate

Usage:
npx ai-coding-project-boilerplate <project-name> [options]

Options:
--lang=<language> Set the project language (ja or en, default: en)
--help, -h Show this help message

Examples:
npx ai-coding-project-boilerplate my-project
npx ai-coding-project-boilerplate my-project --lang=ja
`);
process.exit(0);
}

const projectName = args[0];
const options = args.slice(1);

// Parse language option
let language = 'en'; // default
for (const opt of options) {
if (opt.startsWith('--lang=')) {
language = opt.split('=')[1];
if (!['ja', 'en'].includes(language)) {
console.error(`❌ Invalid language: ${language}. Supported languages are: ja, en`);
process.exit(1);
}
}
}

// Validate project name
const validNamePattern = /^[a-z0-9-._]+$/;
if (!validNamePattern.test(projectName)) {
console.error(`❌ Invalid project name: ${projectName}`);
console.error(' Project name must contain only lowercase letters, numbers, hyphens, dots, and underscores.');
process.exit(1);
}

// Check if directory already exists
const projectPath = path.resolve(process.cwd(), projectName);
if (fs.existsSync(projectPath)) {
console.error(`❌ Directory already exists: ${projectPath}`);
process.exit(1);
}

console.log(`\n🎉 Creating new AI coding project: ${projectName}`);
console.log(`📍 Location: ${projectPath}`);
console.log(`🌐 Language: ${language}\n`);

// Run setup script
const setupScript = path.join(__dirname, '..', 'scripts', 'setup-project.js');
const setupProcess = spawn('node', [setupScript, projectName, language], {
stdio: 'inherit',
cwd: process.cwd() // 現在の作業ディレクトリを使用
});

setupProcess.on('close', (code) => {
if (code !== 0) {
console.error(`\n❌ Setup failed with exit code ${code}`);
process.exit(code);
}

console.log(`\n✅ Project created successfully!`);
console.log(`\n📖 Next steps:`);
console.log(` cd ${projectName}`);
console.log(` npm install`);
console.log(` npm run dev\n`);
});

setupProcess.on('error', (err) => {
console.error(`\n❌ Failed to execute setup script: ${err.message}`);
process.exit(1);
});
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ai-coding-project-boilerplate",
"version": "1.4.1",
"version": "1.4.2",
"description": "TypeScript project boilerplate optimized for Claude Code development with comprehensive development rules, architecture patterns, and quality assurance tools",
"main": "dist/index.js",
"keywords": [
Expand All @@ -19,6 +19,9 @@
"type": "git",
"url": "https://github.com/shinpr/ai-coding-project-boilerplate.git"
},
"bin": {
"ai-coding-project-boilerplate": "./bin/create-project.js"
},
"scripts": {
"build": "tsc && tsc-alias",
"dev": "tsx src/index.ts",
Expand Down
109 changes: 109 additions & 0 deletions scripts/post-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#!/usr/bin/env node

const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');

/**
* Initialize git repository
*/
function initGit() {
try {
console.log('🔧 Initializing git repository...');
execSync('git init', { stdio: 'inherit' });

console.log('📝 Creating initial commit...');
execSync('git add -A', { stdio: 'inherit' });
execSync('git commit -m "Initial commit from AI Coding Project Boilerplate"', { stdio: 'inherit' });

return true;
} catch (error) {
console.warn('⚠️ Git initialization skipped (git might not be installed)');
return false;
}
}

/**
* Clean up files that shouldn't be in the user's project
*/
function cleanupFiles() {
console.log('🧹 Cleaning up setup files...');

const filesToRemove = [
'bin/create-project.js',
'templates/.gitignore.template',
'scripts/post-setup.js'
];

const dirsToRemove = [
'bin',
'templates'
];

// Remove files
for (const file of filesToRemove) {
const filePath = path.join(process.cwd(), file);
if (fs.existsSync(filePath)) {
fs.unlinkSync(filePath);
}
}

// Remove empty directories
for (const dir of dirsToRemove) {
const dirPath = path.join(process.cwd(), dir);
if (fs.existsSync(dirPath)) {
try {
fs.rmdirSync(dirPath);
} catch (e) {
// Directory might not be empty, ignore
}
}
}
}

/**
* Show next steps to the user
*/
function showNextSteps() {
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const projectName = packageJson.name;

console.log('\n🎉 Project setup completed successfully!\n');
console.log('📋 Next steps:\n');
console.log(` cd ${projectName}`);
console.log(' npm install');
console.log(' npm run dev\n');
console.log('🌐 Language switching:\n');
console.log(' npm run lang:ja # Switch to Japanese');
console.log(' npm run lang:en # Switch to English\n');
console.log('📖 Available commands:\n');
console.log(' npm run dev # Start development');
console.log(' npm run build # Build for production');
console.log(' npm run test # Run tests');
console.log(' npm run check:all # Run all quality checks\n');
console.log('Happy coding! 🚀\n');
}

/**
* Main post-setup process
*/
function main() {
try {
// Initialize git repository
initGit();

// Clean up setup-specific files
cleanupFiles();

// Show next steps
showNextSteps();
} catch (error) {
console.error(`❌ Post-setup failed: ${error.message}`);
process.exit(1);
}
}

// Run post-setup
if (require.main === module) {
main();
}
Loading