UNPKG

@pimzino/claude-code-spec-workflow

Version:

Automated workflows for Claude Code. Includes spec-driven development (Requirements → Design → Tasks → Implementation) with intelligent orchestration, optional steering documents and streamlined bug fix workflow (Report → Analyze → Fix → Verify). We have

171 lines 7.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SpecWorkflowSetup = void 0; const fs_1 = require("fs"); const path_1 = require("path"); // CLAUDE.md generation removed - all workflow instructions now in individual commands // Script imports removed in v1.2.5 - task command generation now uses NPX command class SpecWorkflowSetup { constructor(projectRoot = process.cwd(), enableAgents = false) { this.projectRoot = projectRoot; this.claudeDir = (0, path_1.join)(projectRoot, '.claude'); this.commandsDir = (0, path_1.join)(this.claudeDir, 'commands'); this.specsDir = (0, path_1.join)(this.claudeDir, 'specs'); this.templatesDir = (0, path_1.join)(this.claudeDir, 'templates'); // scriptsDir initialization removed in v1.2.5 this.steeringDir = (0, path_1.join)(this.claudeDir, 'steering'); this.bugsDir = (0, path_1.join)(this.claudeDir, 'bugs'); this.agentsDir = (0, path_1.join)(this.claudeDir, 'agents'); this.createAgents = enableAgents; // Initialize source markdown directories this.markdownDir = (0, path_1.join)(__dirname, 'markdown'); this.markdownCommandsDir = (0, path_1.join)(this.markdownDir, 'commands'); this.markdownTemplatesDir = (0, path_1.join)(this.markdownDir, 'templates'); this.markdownAgentsDir = (0, path_1.join)(this.markdownDir, 'agents'); } async claudeDirectoryExists() { try { await fs_1.promises.access(this.claudeDir); return true; } catch { return false; } } async setupDirectories() { const directories = [ this.claudeDir, this.commandsDir, this.specsDir, this.templatesDir, // scriptsDir removed from directory creation this.steeringDir, this.bugsDir ]; // Only create agents directory if agents are enabled if (this.createAgents) { directories.push(this.agentsDir); } for (const dir of directories) { await fs_1.promises.mkdir(dir, { recursive: true }); } } async createSlashCommands() { const commandNames = [ 'spec-create', 'spec-execute', 'spec-orchestrate', 'spec-status', 'spec-list', 'spec-completion-review', 'spec-steering-setup', 'bug-create', 'bug-analyze', 'bug-fix', 'bug-verify', 'bug-status' ]; for (const commandName of commandNames) { const sourceFile = (0, path_1.join)(this.markdownCommandsDir, `${commandName}.md`); const destFile = (0, path_1.join)(this.commandsDir, `${commandName}.md`); try { const commandContent = await fs_1.promises.readFile(sourceFile, 'utf-8'); await fs_1.promises.writeFile(destFile, commandContent, 'utf-8'); } catch (error) { console.error(`Failed to copy command ${commandName}:`, error); throw error; } } } async createTemplates() { const templateNames = [ 'requirements-template.md', 'design-template.md', 'tasks-template.md', 'product-template.md', 'tech-template.md', 'structure-template.md', 'bug-report-template.md', 'bug-analysis-template.md', 'bug-verification-template.md' ]; for (const templateName of templateNames) { const sourceFile = (0, path_1.join)(this.markdownTemplatesDir, templateName); const destFile = (0, path_1.join)(this.templatesDir, templateName); try { const templateContent = await fs_1.promises.readFile(sourceFile, 'utf-8'); await fs_1.promises.writeFile(destFile, templateContent, 'utf-8'); } catch (error) { console.error(`Failed to copy template ${templateName}:`, error); throw error; } } } // NOTE: Script creation removed in v1.2.5 - task command generation now uses NPX command async setupAgents() { // Only create agents if enabled if (!this.createAgents) { return; } // List of available agent files (all 16 agents now extracted to markdown) const agentFiles = [ 'spec-requirements-validator.md', 'spec-design-validator.md', 'spec-design-web-researcher.md', 'spec-task-validator.md', 'spec-task-executor.md', 'spec-task-implementation-reviewer.md', 'spec-integration-tester.md', 'spec-completion-reviewer.md', 'bug-root-cause-analyzer.md', 'steering-document-updater.md', 'spec-dependency-analyzer.md', 'spec-test-generator.md', 'spec-documentation-generator.md', 'spec-performance-analyzer.md', 'spec-duplication-detector.md', 'spec-breaking-change-detector.md' ]; for (const agentFile of agentFiles) { const sourceFile = (0, path_1.join)(this.markdownAgentsDir, agentFile); const destFile = (0, path_1.join)(this.agentsDir, agentFile); try { const agentContent = await fs_1.promises.readFile(sourceFile, 'utf-8'); await fs_1.promises.writeFile(destFile, agentContent, 'utf-8'); } catch (error) { console.error(`Failed to copy agent ${agentFile}:`, error); throw error; } } } async createConfigFile() { const config = { spec_workflow: { version: '1.0.0', auto_create_directories: true, auto_reference_requirements: true, enforce_approval_workflow: true, default_feature_prefix: 'feature-', supported_formats: ['markdown', 'mermaid'], agents_enabled: this.createAgents } }; const configFile = (0, path_1.join)(this.claudeDir, 'spec-config.json'); await fs_1.promises.writeFile(configFile, JSON.stringify(config, null, 2), 'utf-8'); } // CLAUDE.md creation removed - all workflow instructions now in individual commands async runSetup() { await this.setupDirectories(); await this.createSlashCommands(); await this.createTemplates(); await this.setupAgents(); // Script creation removed in v1.2.5 - using NPX command instead await this.createConfigFile(); // CLAUDE.md creation removed - all workflow instructions now in individual commands } } exports.SpecWorkflowSetup = SpecWorkflowSetup; //# sourceMappingURL=setup.js.map