UNPKG

@pimzino/claude-code-spec-workflow

Version:

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

98 lines 4.22 kB
#!/usr/bin/env node "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSpecContext = getSpecContext; const path = __importStar(require("path")); const chalk_1 = __importDefault(require("chalk")); const file_cache_1 = require("./file-cache"); async function getSpecContext(specName, projectPath) { try { // Use provided project path or current working directory const workingDir = projectPath || process.cwd(); // Path to spec directory const specDir = path.join(workingDir, '.claude', 'specs', specName); // Check if spec directory exists if (!(0, file_cache_1.cachedFileExists)(specDir)) { console.log(`## Specification Context\n\nNo specification found for: ${specName}`); return; } const specFiles = [ { name: 'requirements.md', title: 'Requirements' }, { name: 'design.md', title: 'Design' }, { name: 'tasks.md', title: 'Tasks' } ]; const sections = []; let hasContent = false; for (const file of specFiles) { const filePath = path.join(specDir, file.name); if ((0, file_cache_1.cachedFileExists)(filePath)) { const content = (0, file_cache_1.getCachedFileContent)(filePath); if (content && content.trim()) { sections.push(`### ${file.title}\n${content.trim()}`); hasContent = true; } } } if (!hasContent) { console.log(`## Specification Context\n\nNo specification documents found for: ${specName}`); return; } // Output formatted spec context console.log(`## Specification Context (Pre-loaded): ${specName}`); console.log('\n' + sections.join('\n\n---\n\n')); console.log('\n**Note**: Specification documents have been pre-loaded. Do not use get-content to fetch them again.'); } catch (error) { console.error(chalk_1.default.red('Error loading specification context:'), error instanceof Error ? error.message : error); process.exit(1); } } // If this file is run directly (not imported) if (require.main === module) { const args = process.argv.slice(2); if (args.length === 0) { console.error(chalk_1.default.red('Error: Please provide a spec name')); console.log(chalk_1.default.gray('Usage: get-spec-context <spec-name> [project-path]')); process.exit(1); } const specName = args[0]; const projectPath = args[1]; // Optional project path argument getSpecContext(specName, projectPath); } //# sourceMappingURL=get-spec-context.js.map