ai-spec-dev 0.46.0 → 0.55.0
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.
- package/README.md +60 -30
- package/cli/commands/config.ts +129 -1
- package/cli/commands/create.ts +14 -0
- package/cli/commands/fix-history.ts +176 -0
- package/cli/commands/init.ts +36 -1
- package/cli/index.ts +2 -6
- package/cli/pipeline/helpers.ts +6 -0
- package/cli/pipeline/multi-repo.ts +291 -26
- package/cli/pipeline/single-repo.ts +103 -2
- package/cli/utils.ts +23 -0
- package/core/code-generator.ts +63 -14
- package/core/cross-stack-verifier.ts +395 -0
- package/core/fix-history.ts +333 -0
- package/core/import-fixer.ts +827 -0
- package/core/import-verifier.ts +569 -0
- package/core/knowledge-memory.ts +55 -6
- package/core/self-evaluator.ts +44 -7
- package/core/spec-generator.ts +3 -3
- package/core/types-generator.ts +2 -2
- package/dist/cli/index.js +3759 -2207
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +3747 -2195
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.d.mts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +249 -128
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +249 -128
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/tests/cross-stack-verifier.test.ts +301 -0
- package/tests/fix-history.test.ts +335 -0
- package/tests/import-fixer.test.ts +944 -0
- package/tests/import-verifier.test.ts +420 -0
- package/tests/knowledge-memory.test.ts +40 -0
- package/tests/self-evaluator.test.ts +97 -0
- package/cli/commands/model.ts +0 -152
- package/cli/commands/scan.ts +0 -99
- package/cli/commands/workspace.ts +0 -219
package/core/self-evaluator.ts
CHANGED
|
@@ -35,8 +35,8 @@ export interface SelfEvalResult {
|
|
|
35
35
|
|
|
36
36
|
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
37
37
|
|
|
38
|
-
/** File-path patterns that indicate an API / controller / route layer file. */
|
|
39
|
-
const
|
|
38
|
+
/** File-path patterns that indicate an API / controller / route layer file (backend). */
|
|
39
|
+
const BACKEND_ENDPOINT_LAYER_PATTERNS = [
|
|
40
40
|
/src\/api/,
|
|
41
41
|
/src\/routes?/,
|
|
42
42
|
/src\/controller/,
|
|
@@ -44,8 +44,8 @@ const ENDPOINT_LAYER_PATTERNS = [
|
|
|
44
44
|
/src\/endpoints?/,
|
|
45
45
|
];
|
|
46
46
|
|
|
47
|
-
/** File-path patterns that indicate a data / model / schema layer file. */
|
|
48
|
-
const
|
|
47
|
+
/** File-path patterns that indicate a data / model / schema layer file (backend). */
|
|
48
|
+
const BACKEND_MODEL_LAYER_PATTERNS = [
|
|
49
49
|
/src\/model/,
|
|
50
50
|
/src\/schema/,
|
|
51
51
|
/src\/entit/,
|
|
@@ -55,6 +55,33 @@ const MODEL_LAYER_PATTERNS = [
|
|
|
55
55
|
/src\/domain/,
|
|
56
56
|
];
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* File-path patterns that indicate a view / page / screen layer file (frontend/mobile).
|
|
60
|
+
* Covers React (pages/), Next.js (app/ or pages/), Vue (views/), React Native (screens/).
|
|
61
|
+
*/
|
|
62
|
+
const FRONTEND_ENDPOINT_LAYER_PATTERNS = [
|
|
63
|
+
/src\/pages/,
|
|
64
|
+
/src\/views/,
|
|
65
|
+
/src\/screens/, // React Native / mobile
|
|
66
|
+
/(?:^|\/)pages\//, // Next.js pages router (root-level pages/)
|
|
67
|
+
/(?:^|\/)app\//, // Next.js App Router
|
|
68
|
+
/src\/routes?/, // client-side routing files
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* File-path patterns that indicate a type / store / hook / service layer (frontend/mobile).
|
|
73
|
+
* These are the "model layer" equivalent on the client side.
|
|
74
|
+
*/
|
|
75
|
+
const FRONTEND_MODEL_LAYER_PATTERNS = [
|
|
76
|
+
/src\/types/,
|
|
77
|
+
/src\/store/,
|
|
78
|
+
/src\/stores/,
|
|
79
|
+
/src\/hooks/,
|
|
80
|
+
/src\/composables/, // Vue Composition API
|
|
81
|
+
/src\/services/,
|
|
82
|
+
/src\/api/, // frontend API client layer
|
|
83
|
+
];
|
|
84
|
+
|
|
58
85
|
/**
|
|
59
86
|
* Extract a numeric score from review text.
|
|
60
87
|
* Matches the same "Score: X/10" pattern as `reviewer.ts → extractScore()`.
|
|
@@ -128,21 +155,31 @@ export function runSelfEval(opts: {
|
|
|
128
155
|
reviewText: string;
|
|
129
156
|
promptHash: string;
|
|
130
157
|
logger: RunLogger;
|
|
158
|
+
/**
|
|
159
|
+
* Repo role — selects the appropriate layer-pattern set.
|
|
160
|
+
* 'frontend' and 'mobile' use page/view/hook/store patterns;
|
|
161
|
+
* 'backend' and 'shared' (default) use controller/model/schema patterns.
|
|
162
|
+
*/
|
|
163
|
+
repoType?: 'frontend' | 'backend' | 'mobile' | 'shared' | string;
|
|
131
164
|
}): SelfEvalResult {
|
|
132
165
|
const { dsl, generatedFiles, compilePassed, reviewText, promptHash, logger } = opts;
|
|
133
166
|
|
|
167
|
+
const isFrontend = opts.repoType === 'frontend' || opts.repoType === 'mobile';
|
|
168
|
+
const endpointLayerPatterns = isFrontend ? FRONTEND_ENDPOINT_LAYER_PATTERNS : BACKEND_ENDPOINT_LAYER_PATTERNS;
|
|
169
|
+
const modelLayerPatterns = isFrontend ? FRONTEND_MODEL_LAYER_PATTERNS : BACKEND_MODEL_LAYER_PATTERNS;
|
|
170
|
+
|
|
134
171
|
// ── DSL Coverage Score ────────────────────────────────────────────────────
|
|
135
172
|
const endpointsTotal = dsl?.endpoints?.length ?? 0;
|
|
136
173
|
const modelsTotal = dsl?.models?.length ?? 0;
|
|
137
174
|
|
|
138
175
|
const endpointLayerCovered = generatedFiles.some((f) =>
|
|
139
|
-
|
|
176
|
+
endpointLayerPatterns.some((p) => p.test(f))
|
|
140
177
|
);
|
|
141
178
|
const endpointLayerFiles = generatedFiles.filter((f) =>
|
|
142
|
-
|
|
179
|
+
endpointLayerPatterns.some((p) => p.test(f))
|
|
143
180
|
).length;
|
|
144
181
|
const modelLayerCovered = generatedFiles.some((f) =>
|
|
145
|
-
|
|
182
|
+
modelLayerPatterns.some((p) => p.test(f))
|
|
146
183
|
);
|
|
147
184
|
|
|
148
185
|
// ── Tier 2: Model name coverage ───────────────────────────────────────────
|
package/core/spec-generator.ts
CHANGED
|
@@ -117,10 +117,10 @@ export const PROVIDER_CATALOG: Record<string, ProviderMeta> = {
|
|
|
117
117
|
},
|
|
118
118
|
deepseek: {
|
|
119
119
|
displayName: "DeepSeek",
|
|
120
|
-
description: "DeepSeek
|
|
120
|
+
description: "DeepSeek V3.2 (chat) / R1 (reasoner) — alias auto-tracks latest stable",
|
|
121
121
|
models: [
|
|
122
|
-
"deepseek-chat", // DeepSeek
|
|
123
|
-
"deepseek-reasoner", //
|
|
122
|
+
"deepseek-chat", // V3.2 (alias auto-updates as DeepSeek releases new versions)
|
|
123
|
+
"deepseek-reasoner", // R1 (reasoning model)
|
|
124
124
|
],
|
|
125
125
|
envKey: "DEEPSEEK_API_KEY",
|
|
126
126
|
baseURL: "https://api.deepseek.com/v1",
|
package/core/types-generator.ts
CHANGED
|
@@ -23,7 +23,7 @@ const PRIMITIVE_MAP: Record<string, string> = {
|
|
|
23
23
|
any: "unknown",
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
function mapFieldType(raw: string): string {
|
|
26
|
+
export function mapFieldType(raw: string): string {
|
|
27
27
|
const trimmed = raw.trim();
|
|
28
28
|
// Array types: "String[]" or "User[]"
|
|
29
29
|
if (trimmed.endsWith("[]")) {
|
|
@@ -39,7 +39,7 @@ function mapFieldType(raw: string): string {
|
|
|
39
39
|
|
|
40
40
|
// ─── Model → Interface ────────────────────────────────────────────────────────
|
|
41
41
|
|
|
42
|
-
function renderModelInterface(
|
|
42
|
+
export function renderModelInterface(
|
|
43
43
|
name: string,
|
|
44
44
|
fields: ModelField[],
|
|
45
45
|
description?: string
|