Initialize CCPM in a new project
Sets up CCPM configuration for a new project by detecting context from git/package.json, prompting for Linear/Figma integrations, and creating `.ccpm.json`. Use this first to enable project-specific workflow automation.
/plugin marketplace add duongdev/ccpm/plugin install ccpm@duongdev-ccpm-marketplace[project-name]Sets up CCPM configuration for a new project or directory.
# Interactive setup
/ccpm:init
# With project name
/ccpm:init my-project
# In a subdirectory of a monorepo
/ccpm:init apps/web
Detects project context
Creates configuration
.ccpm.json in project rootSets up integrations
Configures hooks
// Get project info from git and package.json
const gitRemote = await Bash('git remote get-url origin 2>/dev/null || echo ""');
const packageJson = await Read('package.json').catch(() => null);
const cwd = process.cwd();
let projectName = args[0];
if (!projectName) {
// Try to detect from git remote
if (gitRemote.trim()) {
const match = gitRemote.match(/[\/:]([^\/]+?)(\.git)?$/);
projectName = match ? match[1].replace('.git', '') : null;
}
// Fallback to directory name
if (!projectName) {
projectName = path.basename(cwd);
}
}
console.log(`📁 Detected project: ${projectName}`);
AskUserQuestion({
questions: [
{
question: "Which Linear team should this project use?",
header: "Linear Team",
multiSelect: false,
options: [
{ label: "Personal", description: "Your personal workspace" },
{ label: "Engineering", description: "Main engineering team" },
{ label: "Product", description: "Product team" },
{ label: "Other", description: "I'll specify the team name" }
]
},
{
question: "Enable Figma integration?",
header: "Figma",
multiSelect: false,
options: [
{ label: "Yes", description: "Extract designs for pixel-perfect implementation" },
{ label: "No", description: "Skip Figma integration" }
]
},
{
question: "Branch naming convention?",
header: "Git Branches",
multiSelect: false,
options: [
{ label: "feature/{issue}-{slug}", description: "e.g., feature/PSN-29-add-auth (Recommended)" },
{ label: "{issue}/{slug}", description: "e.g., PSN-29/add-auth" },
{ label: "Custom", description: "I'll define my own pattern" }
]
}
]
});
const config = {
"$schema": "https://ccpm.dev/schemas/ccpm.json",
"version": "1.1",
"project": {
"name": projectName,
"root": cwd
},
"linear": {
"team": linearTeam,
"project": linearProject || null
},
"figma": figmaEnabled ? {
"enabled": true,
"server": "figma-${projectName}"
} : {
"enabled": false
},
"git": {
"branchPattern": branchPattern,
"protectedBranches": ["main", "master", "develop"]
},
"workflow": {
"requirePlanBeforeWork": true,
"autoSyncOnCommit": true,
"verifyBeforeDone": true
}
};
await Write('.ccpm.json', JSON.stringify(config, null, 2));
console.log('✅ Created .ccpm.json');
// Add project to ~/.config/ccpm/projects.json
const globalConfigPath = path.join(process.env.HOME, '.config/ccpm/projects.json');
let globalConfig = { projects: [] };
try {
globalConfig = JSON.parse(await Read(globalConfigPath));
} catch (e) {
// Create new config
}
// Add or update project
const existingIndex = globalConfig.projects.findIndex(p => p.name === projectName);
if (existingIndex >= 0) {
globalConfig.projects[existingIndex] = {
name: projectName,
path: cwd,
config: '.ccpm.json'
};
} else {
globalConfig.projects.push({
name: projectName,
path: cwd,
config: '.ccpm.json'
});
}
await Write(globalConfigPath, JSON.stringify(globalConfig, null, 2));
console.log('✅ Added to global CCPM config');
console.log('\n═══════════════════════════════════════');
console.log('🚀 CCPM Initialized');
console.log('═══════════════════════════════════════\n');
console.log(`📁 Project: ${projectName}`);
console.log(`📍 Location: ${cwd}`);
console.log(`🔗 Linear Team: ${linearTeam}`);
console.log(`🎨 Figma: ${figmaEnabled ? 'Enabled' : 'Disabled'}`);
console.log(`🌿 Branch Pattern: ${branchPattern}`);
console.log('\n📋 Configuration saved to .ccpm.json');
console.log('\n💡 Next steps:');
console.log(' 1. /ccpm:plan "Your first task"');
console.log(' 2. /ccpm:work');
console.log(' 3. /ccpm:sync');
console.log(' 4. /ccpm:done');
{
"$schema": "https://ccpm.dev/schemas/ccpm.json",
"version": "1.1",
"project": {
"name": "my-project",
"root": "/path/to/project"
},
"linear": {
"team": "Personal",
"project": null
},
"figma": {
"enabled": true,
"server": "figma-my-project"
},
"git": {
"branchPattern": "feature/{issue}-{slug}",
"protectedBranches": ["main", "master", "develop"]
},
"workflow": {
"requirePlanBeforeWork": true,
"autoSyncOnCommit": true,
"verifyBeforeDone": true
}
}
For monorepos, run /ccpm:init in each subdirectory:
# Root level
/ccpm:init monorepo
# Apps
cd apps/web && /ccpm:init apps/web
cd apps/api && /ccpm:init apps/api
# Packages
cd packages/ui && /ccpm:init packages/ui
Each subdirectory gets its own .ccpm.json with inherited defaults from root.