Skip to content

Commit 3ca7baf

Browse files
stackbilt-adminKurt Overmier
andauthored
fix(cli): vendor scaffold-response types, drop file: dep on @stackbilt/contracts (#93)
@stackbilt/cli had a file:../../../contracts dep pointing to a sibling repo that is not published to npm. Packing the tarball preserved the file: specifier in the resulting package.json, which would cause every downstream `npm install @stackbilt/cli` to fail with ENOENT. Root cause: http-client.ts imported three type-only symbols (ScaffoldFileType, GovernanceDocsType, PromptContextType) from @stackbilt/contracts/dist/scaffold-response. The import was erased at compile time, but the declared dep was still resolved at install time on the consumer side. Fix: vendor the three interfaces inline at packages/cli/src/types/scaffold-contract-types.ts and re-point the type-only import. The contracts dep is then removed from package.json entirely. Verified via `npm pack` tarball inspection — no more file: specifier in the published package.json. When @stackbilt/contracts is properly published to npm, the vendored file can be deleted and http-client.ts re-imports from the real package. Validation: - pnpm run typecheck: clean - pnpm run build: clean - pnpm run test: 345/345 passing (no change) - npm pack tarball: dependencies block has only workspace:^ refs (no file:) This unblocks publishing @stackbilt/cli@0.10.0 and the full 0.10.0 release. Co-authored-by: Kurt Overmier <kurt@stackbilt.dev>
1 parent 6448c12 commit 3ca7baf

4 files changed

Lines changed: 101 additions & 13 deletions

File tree

packages/cli/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"@stackbilt/adf": "workspace:^",
4444
"@stackbilt/blast": "workspace:^",
4545
"@stackbilt/classify": "workspace:^",
46-
"@stackbilt/contracts": "file:../../../contracts",
4746
"@stackbilt/core": "workspace:^",
4847
"@stackbilt/drift": "workspace:^",
4948
"@stackbilt/git": "workspace:^",

packages/cli/src/http-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {
88
ScaffoldFileType,
99
GovernanceDocsType,
1010
PromptContextType,
11-
} from '@stackbilt/contracts/dist/scaffold-response';
11+
} from './types/scaffold-contract-types';
1212

1313
const DEFAULT_BASE_URL = process.env.STACKBILT_ENGINE_URL ?? 'https://api.stackbilt.dev/engine';
1414
const GATEWAY_BASE_URL = 'https://mcp.stackbilt.dev';
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/**
2+
* Vendored type definitions for the Stackbilt scaffold-response contract.
3+
*
4+
* These types are structurally copied from @stackbilt/contracts to avoid
5+
* a file: workspace dependency on an unpublished sibling repo. They are
6+
* type-only (erased at compile time, zero runtime cost) and are used
7+
* internally by http-client.ts — they are NOT re-exported from the public
8+
* CLI surface in src/index.ts.
9+
*
10+
* When @stackbilt/contracts is properly published to npm, this file can be
11+
* deleted and http-client.ts can re-import from the real package.
12+
*
13+
* Upstream source (as of @stackbilt/contracts@0.1.0):
14+
* contracts/dist/scaffold-response/scaffold-response.contract.d.ts
15+
*
16+
* Type aliases follow the upstream naming convention with the `Type` suffix
17+
* (e.g. `ScaffoldFile` → `ScaffoldFileType`), matching the re-exports in
18+
* contracts/dist/scaffold-response/index.d.ts.
19+
*/
20+
21+
export type FileRoleType = 'config' | 'scaffold' | 'governance' | 'test' | 'doc';
22+
23+
export interface ScaffoldFileType {
24+
path: string;
25+
content: string;
26+
role: FileRoleType;
27+
}
28+
29+
export interface GovernanceDocsType {
30+
threat_model: string;
31+
adr: string;
32+
test_plan: string;
33+
}
34+
35+
export interface PromptContextMetaType {
36+
project_type: string;
37+
complexity: string;
38+
confidence: string;
39+
seed: number;
40+
}
41+
42+
export interface PromptContextRequirementType {
43+
name: string;
44+
priority: string;
45+
effort: string;
46+
acceptance: string;
47+
}
48+
49+
export interface PromptContextInterfaceType {
50+
name: string;
51+
layout: string;
52+
components: string;
53+
}
54+
55+
export interface PromptContextThreatType {
56+
name: string;
57+
owasp: string;
58+
likelihood: string;
59+
impact: string;
60+
mitigation: string;
61+
detection: string;
62+
response_time: string;
63+
}
64+
65+
export interface PromptContextRuntimeType {
66+
name: string;
67+
tier: string;
68+
traits: string;
69+
}
70+
71+
export interface PromptContextTestPlanType {
72+
name: string;
73+
framework: string;
74+
ci_stage: string;
75+
coverage: string;
76+
setup: string;
77+
assertion_style: string;
78+
}
79+
80+
export interface PromptContextFirstTaskType {
81+
name: string;
82+
estimate: string;
83+
complexity: string;
84+
deliverable: string;
85+
adr: string;
86+
}
87+
88+
export interface PromptContextType {
89+
intention: string;
90+
pattern: string;
91+
meta: PromptContextMetaType;
92+
requirement: PromptContextRequirementType;
93+
interface: PromptContextInterfaceType;
94+
threat: PromptContextThreatType;
95+
runtime: PromptContextRuntimeType;
96+
test_plan: PromptContextTestPlanType;
97+
first_task: PromptContextFirstTaskType;
98+
governance: GovernanceDocsType;
99+
files: ScaffoldFileType[];
100+
}

pnpm-lock.yaml

Lines changed: 0 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)