Part of #212.
Scope
Extract and isolate the classification layer from stackbilt-web/src/lib/scaffold-core.ts into packages/scaffold-core/src/classify/.
Files to create
| File |
Source |
Responsibility |
patterns.ts |
PATTERNS array, PatternDef type |
9 pattern definitions with scoring functions and trait sets |
classifier.ts |
choosePattern(), keywordScore(), lineSeed() |
Pattern selection, confidence scoring |
enricher.ts |
extractEnrichedPrd(), injectPrdSections(), STACK_TOKENS, DOMAIN_ENTITY_PATTERNS, MANAGEMENT_PATTERNS |
Domain entity + stack token extraction from free-form intention |
bindings.ts |
inferBindings() |
Maps intention keywords to CF binding names (d1, kv, r2, do, ai) |
quality.ts |
QualityProfile, inferQualityProfile() |
Derives tenant/payments/streaming/storage/jwt/oauth/rate-limit profile |
index.ts |
— |
Re-exports classify(intention) → ClassifyResult |
Key invariant
classify/ has zero inbound deps within the package — pure functions, pure data. Must be importable standalone with no side effects.
Tests
Migrate stackbilt-web/src/lib/__tests__/scaffold-domain-fixtures.test.ts here.
Part of #212.
Scope
Extract and isolate the classification layer from
stackbilt-web/src/lib/scaffold-core.tsintopackages/scaffold-core/src/classify/.Files to create
patterns.tsPATTERNSarray,PatternDeftypeclassifier.tschoosePattern(),keywordScore(),lineSeed()enricher.tsextractEnrichedPrd(),injectPrdSections(),STACK_TOKENS,DOMAIN_ENTITY_PATTERNS,MANAGEMENT_PATTERNSbindings.tsinferBindings()quality.tsQualityProfile,inferQualityProfile()index.tsclassify(intention) → ClassifyResultKey invariant
classify/has zero inbound deps within the package — pure functions, pure data. Must be importable standalone with no side effects.Tests
Migrate
stackbilt-web/src/lib/__tests__/scaffold-domain-fixtures.test.tshere.