@stupify/cli 0.0.1 → 0.0.3

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.
Files changed (63) hide show
  1. package/README.md +60 -0
  2. package/dist/analysis.d.ts +14 -0
  3. package/dist/analysis.js +276 -0
  4. package/dist/batcher.d.ts +3 -0
  5. package/dist/batcher.js +142 -0
  6. package/dist/cache.d.ts +2 -0
  7. package/dist/cache.js +59 -0
  8. package/dist/candidate-context.d.ts +2 -0
  9. package/dist/candidate-context.js +40 -0
  10. package/dist/checks.d.ts +3 -0
  11. package/dist/checks.js +131 -0
  12. package/dist/command.d.ts +2 -0
  13. package/dist/command.js +183 -0
  14. package/dist/constants.d.ts +4 -0
  15. package/dist/constants.js +53 -0
  16. package/dist/counter-scout.d.ts +14 -0
  17. package/dist/counter-scout.js +97 -0
  18. package/dist/diff.d.ts +1 -0
  19. package/dist/diff.js +10 -0
  20. package/dist/experiment.d.ts +1 -0
  21. package/dist/experiment.js +225 -0
  22. package/dist/git.d.ts +8 -0
  23. package/dist/git.js +219 -0
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.js +1 -0
  26. package/dist/model.d.ts +24 -0
  27. package/dist/model.js +281 -0
  28. package/dist/prompts.d.ts +5 -0
  29. package/dist/prompts.js +197 -0
  30. package/dist/render.d.ts +3 -0
  31. package/dist/render.js +101 -0
  32. package/dist/repomix-provider.d.ts +4 -0
  33. package/dist/repomix-provider.js +145 -0
  34. package/dist/sem-provider.d.ts +2 -0
  35. package/dist/sem-provider.js +221 -0
  36. package/dist/stupify.d.ts +2 -0
  37. package/dist/stupify.js +387 -0
  38. package/dist/trace.d.ts +29 -0
  39. package/dist/trace.js +64 -0
  40. package/dist/types.d.ts +236 -0
  41. package/dist/types.js +6 -0
  42. package/package.json +42 -5
  43. package/src/analysis.ts +408 -0
  44. package/src/batcher.ts +198 -0
  45. package/src/cache.ts +65 -0
  46. package/src/candidate-context.ts +43 -0
  47. package/src/checks.ts +132 -0
  48. package/src/command.ts +218 -0
  49. package/src/constants.ts +56 -0
  50. package/src/counter-scout.ts +119 -0
  51. package/src/diff.ts +9 -0
  52. package/src/experiment.ts +317 -0
  53. package/src/git.ts +228 -0
  54. package/src/index.ts +1 -0
  55. package/src/model.ts +360 -0
  56. package/src/prompts.ts +234 -0
  57. package/src/render.ts +107 -0
  58. package/src/repomix-provider.ts +163 -0
  59. package/src/sem-provider.ts +255 -0
  60. package/src/stupify.ts +598 -0
  61. package/src/trace.ts +103 -0
  62. package/src/types.ts +264 -0
  63. package/bin/stupify.mjs +0 -3
package/src/types.ts ADDED
@@ -0,0 +1,264 @@
1
+ declare const brand: unique symbol;
2
+
3
+ type Brand<Value, Name extends string> = Value & { readonly [brand]: Name };
4
+
5
+ export type SourceId = Brand<string, "SourceId">;
6
+ export type CheckId = Brand<string, "CheckId">;
7
+
8
+ export function sourceId(value: string): SourceId {
9
+ return value as SourceId;
10
+ }
11
+
12
+ export function checkId(value: string): CheckId {
13
+ return value as CheckId;
14
+ }
15
+
16
+ export type Engine = "raw-diff" | "sem";
17
+ export type ScoutMode = "llm" | "counter";
18
+ export type AuditContextMode = "none" | "repomix";
19
+ export type AuditPromptName = "strict" | "high_bar";
20
+
21
+ type AnalyzeOptions = Readonly<{
22
+ checkIds: readonly string[] | null;
23
+ json: boolean;
24
+ model: ModelId;
25
+ engine: Engine;
26
+ scout: ScoutMode;
27
+ auditContext: AuditContextMode;
28
+ auditPrompt: AuditPromptName;
29
+ debugSem: boolean;
30
+ debugTargets: boolean;
31
+ maxCandidates: number;
32
+ auditBatchSize: number;
33
+ maxAuditInputTokens: number;
34
+ auditConcurrency: number;
35
+ }>;
36
+
37
+ export type Command =
38
+ | Readonly<{ kind: "help" }>
39
+ | Readonly<{ kind: "experiment"; configPath: string }>
40
+ | (Readonly<{ kind: "since"; since: string }> & AnalyzeOptions)
41
+ | (Readonly<{ kind: "stdin" }> & AnalyzeOptions)
42
+ | (Readonly<{ kind: "commit"; commit: string }> & AnalyzeOptions)
43
+ | (Readonly<{ kind: "commits"; count: number }> & AnalyzeOptions);
44
+
45
+ type ControlCommand =
46
+ | Readonly<{ kind: "help" }>
47
+ | Readonly<{ kind: "experiment"; configPath: string }>;
48
+
49
+ export type AnalyzeCommand = Exclude<Command, ControlCommand>;
50
+
51
+ export type StupifyCheck = Readonly<{
52
+ id: CheckId;
53
+ name: string;
54
+ question: string;
55
+ lookFor: readonly string[];
56
+ ignoreWhen: readonly string[];
57
+ enabledByDefault?: boolean;
58
+ examples?: Readonly<{
59
+ match?: readonly string[];
60
+ noMatch?: readonly string[];
61
+ }>;
62
+ }>;
63
+
64
+ export type FindingCandidate = Readonly<{
65
+ checkId: string;
66
+ why: string;
67
+ proof: string;
68
+ }>;
69
+
70
+ export type Finding = Readonly<{
71
+ sourceId: SourceId;
72
+ checkId: CheckId;
73
+ why: string;
74
+ proof: string;
75
+ }>;
76
+
77
+ export type FindingsResult = Readonly<{
78
+ findings: readonly Finding[];
79
+ summary?: string;
80
+ }>;
81
+
82
+ export type AuditReviewStats = Readonly<{
83
+ totalTargets: number;
84
+ finding: number;
85
+ clean: number;
86
+ uncertain: number;
87
+ invalid: number;
88
+ }>;
89
+
90
+ export type AuditReviewResult = FindingsResult & Readonly<{
91
+ stats: AuditReviewStats;
92
+ }>;
93
+
94
+ export type NetDiffStats = Readonly<{
95
+ filesChanged: number;
96
+ additions: number;
97
+ deletions: number;
98
+ }>;
99
+
100
+ export type NetDiff = Readonly<{
101
+ id: SourceId;
102
+ label: string;
103
+ base: string;
104
+ target: string;
105
+ text: string;
106
+ stats: NetDiffStats;
107
+ }>;
108
+
109
+ export type SourceRange = Readonly<{
110
+ id: SourceId;
111
+ label: string;
112
+ base: string;
113
+ target: string;
114
+ stats: NetDiffStats;
115
+ }>;
116
+
117
+ export type DiffHunk = Readonly<{
118
+ pointer: string;
119
+ batchId: string;
120
+ fileId: string;
121
+ hunkId: string;
122
+ filePath: string;
123
+ lineCount: number;
124
+ text: string;
125
+ }>;
126
+
127
+ export type DiffBatch = Readonly<{
128
+ id: string;
129
+ hunks: readonly DiffHunk[];
130
+ text: string;
131
+ }>;
132
+
133
+ export type CandidateContext = Readonly<{
134
+ pointer: string;
135
+ text: string;
136
+ }>;
137
+
138
+ export type SemChange = Readonly<{
139
+ entityId: string;
140
+ entityName: string;
141
+ entityType: string;
142
+ filePath: string;
143
+ changeType: string;
144
+ beforeContent: string | null;
145
+ afterContent: string | null;
146
+ }>;
147
+
148
+ export type SemChangeSummary = Readonly<{
149
+ added: number;
150
+ deleted: number;
151
+ modified: number;
152
+ moved: number;
153
+ renamed: number;
154
+ fileCount: number;
155
+ total: number;
156
+ }>;
157
+
158
+ export type SemChangeSet = Readonly<{
159
+ id: SourceId;
160
+ label: string;
161
+ base: string;
162
+ target: string;
163
+ contextCwd: string;
164
+ cleanup: () => Promise<void>;
165
+ changes: readonly SemChange[];
166
+ summary: SemChangeSummary;
167
+ }>;
168
+
169
+ export type SemCandidate = Readonly<{
170
+ sourceId: SourceId;
171
+ targetId: string;
172
+ entityId: string;
173
+ checkId: CheckId;
174
+ reason: string;
175
+ }>;
176
+
177
+ export type SemContext = Readonly<{
178
+ targetId: string;
179
+ entityId: string;
180
+ entityName: string;
181
+ entityKind: string;
182
+ changeKind: string;
183
+ checkId: CheckId;
184
+ reason: string;
185
+ filePath?: string;
186
+ text: string;
187
+ }>;
188
+
189
+ export type DebugTarget = Readonly<{
190
+ targetId: string;
191
+ checkId: CheckId;
192
+ entityId: string;
193
+ entityKind?: string;
194
+ changeKind?: string;
195
+ scoutReason?: string;
196
+ sourceLabel?: string;
197
+ }>;
198
+
199
+ export type SemContextPack = Readonly<{
200
+ provider: "repomix";
201
+ filePaths: readonly string[];
202
+ totalCharacters: number;
203
+ totalTokens: number;
204
+ text: string;
205
+ }>;
206
+
207
+ export type AnalysisRun = Readonly<{
208
+ engine: Engine;
209
+ auditContext: AuditContextMode;
210
+ auditPrompt: AuditPromptName;
211
+ mode: AnalyzeCommand["kind"];
212
+ modelId: ModelId;
213
+ checkIds: readonly CheckId[];
214
+ sourceId: SourceId;
215
+ label: string;
216
+ stats: NetDiffStats;
217
+ batchesScanned: number;
218
+ candidateCount: number;
219
+ targetsByCheck?: Readonly<Record<string, number>>;
220
+ entitiesScanned: number;
221
+ auditedCandidateCount: number;
222
+ scoutModelCalls: number;
223
+ auditModelCalls: number;
224
+ timingsMs: Readonly<{
225
+ diff: number;
226
+ modelLoad: number;
227
+ search: number;
228
+ audit: number;
229
+ total: number;
230
+ }>;
231
+ warnings: readonly string[];
232
+ auditStats?: AuditReviewStats;
233
+ debugTargets?: readonly DebugTarget[];
234
+ traceEvents?: readonly TraceEvent[];
235
+ }>;
236
+
237
+ export type TraceEvent = Readonly<{
238
+ name: string;
239
+ ms: number;
240
+ count?: number;
241
+ detail?: string;
242
+ }>;
243
+
244
+ export type AnalysisReport = Readonly<{
245
+ run: AnalysisRun;
246
+ result: FindingsResult;
247
+ }>;
248
+
249
+ export type ModelId =
250
+ | "gemma-4-e2b"
251
+ | "gemma-4-e4b"
252
+ | "gemma-4-26b-a4b"
253
+ | "qwen3-4b-magicquant"
254
+ | "qwen2.5-coder-1.5b"
255
+ | "qwen2.5-coder-7b"
256
+ | "qwen2.5-coder-32b";
257
+
258
+ export type ModelConfig = Readonly<{
259
+ id: ModelId;
260
+ name: string;
261
+ size: string;
262
+ file: string;
263
+ url: string;
264
+ }>;
package/bin/stupify.mjs DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- console.log("hello world");