Skip to content

Commit c73d4e6

Browse files
Kurt Overmierclaude
andcommitted
fix: --output flag no longer leaks into description + branding fixes
- Flag values excluded from positional arg parsing - Manifest branding: "Generated by Stackbilt scaffold engine" - Bumped to 0.9.2 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d27c903 commit c73d4e6

11 files changed

Lines changed: 31 additions & 25 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@
4343
"vitest": "^4.0.18",
4444
"zod": "^3.24.1"
4545
},
46-
"version": "0.9.1"
46+
"version": "0.9.2"
4747
}

packages/adf/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stackbilt/adf",
33
"sideEffects": false,
4-
"version": "0.9.1",
4+
"version": "0.9.2",
55
"description": "ADF (Attention-Directed Format) — AST-backed context format for AI agents",
66
"main": "./dist/index.js",
77
"types": "./dist/index.d.ts",

packages/ci/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stackbilt/ci",
33
"sideEffects": false,
4-
"version": "0.9.1",
4+
"version": "0.9.2",
55
"description": "GitHub Actions adapter for Charter governance checks",
66
"main": "./dist/index.js",
77
"types": "./dist/index.d.ts",

packages/classify/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stackbilt/classify",
33
"sideEffects": false,
4-
"version": "0.9.1",
4+
"version": "0.9.2",
55
"description": "Heuristic change classification (SURFACE/LOCAL/CROSS_CUTTING)",
66
"main": "./dist/index.js",
77
"types": "./dist/index.d.ts",

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stackbilt/cli",
33
"sideEffects": false,
4-
"version": "0.9.1",
4+
"version": "0.9.2",
55
"description": "Charter CLI — repo-level governance checks + architecture scaffolding",
66
"bin": {
77
"charter": "./dist/bin.js",

packages/cli/src/commands/run.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,19 @@ function phaseDetail(label: string, result: ScaffoldResult): string {
6969
// ─── Command ────────────────────────────────────────────────
7070

7171
export async function runCommand(options: CLIOptions, args: string[]): Promise<number> {
72-
// Parse description
72+
// Parse flags first (getFlag consumes flag + value from args)
7373
const filePath = getFlag(args, '--file');
74-
const positional = args.filter(a => !a.startsWith('-') && a !== filePath);
74+
const outputDir = getFlag(args, '--output');
75+
const seedStr = getFlag(args, '--seed');
76+
const urlOverride = getFlag(args, '--url');
77+
const fwOverride = getFlag(args, '--framework');
78+
const dbOverride = getFlag(args, '--database');
79+
80+
// Collect flag values to exclude from positional args
81+
const flagValues = new Set([filePath, outputDir, seedStr, urlOverride, fwOverride, dbOverride].filter(Boolean));
82+
83+
// Parse description from remaining positional args
84+
const positional = args.filter(a => !a.startsWith('-') && !flagValues.has(a));
7585
let description: string;
7686

7787
if (filePath) {
@@ -85,14 +95,12 @@ export async function runCommand(options: CLIOptions, args: string[]): Promise<n
8595

8696
if (!description) throw new CLIError('Empty description.');
8797

88-
// Parse flags
89-
const seedStr = getFlag(args, '--seed');
90-
const outputDir = getFlag(args, '--output') ?? `./${slugify(description)}`;
98+
const resolvedOutput = outputDir ?? `./${slugify(description)}`;
9199
const dryRun = args.includes('--dry-run');
92100

93101
// Engine client
94102
const creds = loadCredentials();
95-
const baseUrl = getFlag(args, '--url');
103+
const baseUrl = urlOverride;
96104
const client = new EngineClient({ baseUrl: baseUrl ?? creds?.baseUrl, apiKey: creds?.apiKey });
97105

98106
// Determine path: gateway (with API key) or engine fallback
@@ -112,10 +120,8 @@ export async function runCommand(options: CLIOptions, args: string[]): Promise<n
112120
// Engine fallback — basic scaffold
113121
const request: BuildRequest = { description, constraints: {} };
114122
if (args.includes('--cloudflare-only')) request.constraints!.cloudflareOnly = true;
115-
const fw = getFlag(args, '--framework');
116-
if (fw) request.constraints!.framework = fw;
117-
const db = getFlag(args, '--database');
118-
if (db) request.constraints!.database = db;
123+
if (fwOverride) request.constraints!.framework = fwOverride;
124+
if (dbOverride) request.constraints!.database = dbOverride;
119125
if (seedStr) request.seed = parseInt(seedStr, 10);
120126

121127
scaffoldPromise = client.build(request).then(r => ({
@@ -130,9 +136,9 @@ export async function runCommand(options: CLIOptions, args: string[]): Promise<n
130136
// JSON mode — no animation
131137
if (options.format === 'json') {
132138
const result = await scaffoldPromise;
133-
console.log(JSON.stringify({ ...result, outputDir, dryRun }, null, 2));
139+
console.log(JSON.stringify({ ...result, outputDir: resolvedOutput, dryRun }, null, 2));
134140
if (!dryRun) {
135-
writeFiles(outputDir, result.files);
141+
writeFiles(resolvedOutput, result.files);
136142
}
137143
return EXIT_CODE.SUCCESS;
138144
}
@@ -188,15 +194,15 @@ export async function runCommand(options: CLIOptions, args: string[]): Promise<n
188194

189195
console.log('');
190196
if (dryRun) {
191-
console.log(` → ${result.files.length} files would be scaffolded to ${outputDir}/`);
197+
console.log(` → ${result.files.length} files would be scaffolded to ${resolvedOutput}/`);
192198
for (const f of result.files) {
193199
console.log(` ${f.path}`);
194200
}
195201
console.log('');
196202
console.log(' (dry run — no files written)');
197203
} else {
198-
writeFiles(outputDir, result.files);
199-
console.log(` → ${result.files.length} files scaffolded to ${outputDir}/`);
204+
writeFiles(resolvedOutput, result.files);
205+
console.log(` → ${result.files.length} files scaffolded to ${resolvedOutput}/`);
200206
console.log(` → Architecture governed · seed: ${result.seed ?? 'deterministic'}`);
201207
if (result.nextSteps && result.nextSteps.length > 0) {
202208
console.log('');

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stackbilt/core",
33
"sideEffects": false,
4-
"version": "0.9.1",
4+
"version": "0.9.2",
55
"description": "Core schemas, sanitization, and error handling for Charter Kit",
66
"main": "./dist/index.js",
77
"types": "./dist/index.d.ts",

packages/drift/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stackbilt/drift",
33
"sideEffects": false,
4-
"version": "0.9.1",
4+
"version": "0.9.2",
55
"description": "Drift scanner — detects codebase divergence from governance patterns",
66
"main": "./dist/index.js",
77
"types": "./dist/index.d.ts",

packages/git/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stackbilt/git",
33
"sideEffects": false,
4-
"version": "0.9.1",
4+
"version": "0.9.2",
55
"description": "Git trailer parsing, commit risk scoring, and PR validation",
66
"main": "./dist/index.js",
77
"types": "./dist/index.d.ts",

packages/types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stackbilt/types",
33
"sideEffects": false,
4-
"version": "0.9.1",
4+
"version": "0.9.2",
55
"description": "Shared type definitions for the Charter Kit",
66
"main": "./dist/index.js",
77
"types": "./dist/index.d.ts",

0 commit comments

Comments
 (0)