kantban-cli 0.1.46 → 0.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/pipeline-init.ts"],"sourcesContent":["import { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nconst GATE_FILE = 'pipeline.gates.yaml';\n\ninterface ProjectDetection {\n type: string;\n testCommand: string;\n typecheckCommand: string;\n lintCommand: string;\n buildCommand: string;\n}\n\nfunction detectProjectType(cwd: string): ProjectDetection {\n if (existsSync(join(cwd, 'package.json'))) {\n const pkg = JSON.parse(readFileSync(join(cwd, 'package.json'), 'utf-8')) as {\n scripts?: Record<string, string>;\n };\n const scripts = pkg.scripts ?? {};\n const pm = existsSync(join(cwd, 'pnpm-lock.yaml')) ? 'pnpm'\n : existsSync(join(cwd, 'yarn.lock')) ? 'yarn' : 'npm';\n return {\n type: 'node',\n testCommand: scripts.test ? `${pm} test` : `${pm} vitest run`,\n typecheckCommand: scripts.typecheck ? `${pm} typecheck` : `${pm} tsc --noEmit`,\n lintCommand: scripts.lint ? `${pm} lint` : `${pm} eslint .`,\n buildCommand: scripts.build ? `${pm} build` : 'echo \"no build configured\"',\n };\n }\n if (existsSync(join(cwd, 'Cargo.toml'))) {\n return { type: 'rust', testCommand: 'cargo test', typecheckCommand: 'cargo check', lintCommand: 'cargo clippy', buildCommand: 'cargo build' };\n }\n if (existsSync(join(cwd, 'pyproject.toml')) || existsSync(join(cwd, 'setup.py'))) {\n return { type: 'python', testCommand: 'pytest', typecheckCommand: 'mypy .', lintCommand: 'ruff check .', buildCommand: 'echo \"no build configured\"' };\n }\n if (existsSync(join(cwd, 'go.mod'))) {\n return { type: 'go', testCommand: 'go test ./...', typecheckCommand: 'go vet ./...', lintCommand: 'golangci-lint run', buildCommand: 'go build ./...' };\n }\n return { type: 'unknown', testCommand: 'echo \"configure your test command\"', typecheckCommand: 'echo \"configure your typecheck command\"', lintCommand: 'echo \"configure your lint command\"', buildCommand: 'echo \"configure your build command\"' };\n}\n\n/** YAML-safe single-quoting: escapes internal single quotes by doubling them */\nfunction yamlQuote(s: string): string {\n return `'${s.replace(/'/g, \"''\")}'`;\n}\n\nfunction generateGateFile(detection: ProjectDetection): string {\n return `# pipeline.gates.yaml — Gate definitions for KantBan pipeline\n# Detected project type: ${detection.type}\n#\n# Gates are shell commands that produce pass/fail results.\n# Required gates block ticket movement. Advisory gates show output but don't block.\n\ndefault:\n - name: typecheck\n run: ${yamlQuote(detection.typecheckCommand)}\n required: true\n timeout: 60s\n\n - name: tests\n run: ${yamlQuote(detection.testCommand)}\n required: true\n timeout: 120s\n\n - name: lint\n run: ${yamlQuote(detection.lintCommand)}\n required: false # advisory — output shown but doesn't block\n\n# Column-specific overrides — matched by column name (case-insensitive)\n# columns:\n# implementation:\n# extend: true # inherit default gates, add more\n# gates:\n# - name: build\n# run: ${yamlQuote(detection.buildCommand)}\n# required: true\n# timeout: 120s\n#\n# qa:\n# extend: false # replace default gates entirely\n# gates:\n# - name: e2e\n# run: \"echo 'configure your e2e test command'\"\n# required: true\n# timeout: 300s\n\nsettings:\n # cwd: .\n env:\n CI: \"true\"\n total_timeout: 300s\n budget:\n max_input_tokens: 5000000\n max_output_tokens: 1500000\n warn_pct: 75\n`;\n}\n\nexport async function runPipelineInit(): Promise<void> {\n const cwd = process.cwd();\n const filePath = join(cwd, GATE_FILE);\n\n if (existsSync(filePath)) {\n console.error(`Error: ${GATE_FILE} already exists in ${cwd}`);\n console.error('Edit the existing file or delete it to regenerate.');\n process.exit(1);\n }\n\n const detection = detectProjectType(cwd);\n const content = generateGateFile(detection);\n writeFileSync(filePath, content);\n\n console.log(`Created ${GATE_FILE} (detected: ${detection.type} project)`);\n console.log(`\\nNext steps:`);\n console.log(` 1. Review and customize the gate file`);\n console.log(` 2. Run: kantban pipeline <board-id>`);\n}\n"],"mappings":";AAAA,SAAS,YAAY,cAAc,qBAAqB;A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