@stupify/cli 0.0.7 → 0.0.8

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/dist/analysis.js CHANGED
@@ -71,10 +71,14 @@ function uncheckedSearchMatches(value, contexts) {
71
71
  targetId,
72
72
  patternId: context.checkId,
73
73
  reason: match.reason ?? "",
74
- proof: match.proof ?? "",
74
+ proof: sourcePointer(context),
75
75
  }];
76
76
  });
77
77
  }
78
+ function sourcePointer(context) {
79
+ const file = context.filePath ?? "(unknown)";
80
+ return `${file}::${context.entityKind || "entity"}::${context.entityName || context.entityId}`;
81
+ }
78
82
  async function runJsonPrompt(model, prompt, schema, temperature) {
79
83
  return cachedJson("model-json", fingerprint({
80
84
  version: 1,
package/dist/checks.js CHANGED
@@ -4,6 +4,7 @@ export const defaultChecks = [
4
4
  id: checkId("duplicated_schema"),
5
5
  name: "Duplicated schema",
6
6
  question: "Did the change duplicate an existing type, schema, payload, or DTO shape?",
7
+ why: "Duplicated shapes make it easier for AI-assisted changes to drift away from the real source of truth.",
7
8
  lookFor: [
8
9
  "local shape mirrors existing fields and maps them one-for-one",
9
10
  "new response, payload, schema, or DTO adds no filtering, renaming, validation, or versioning",
@@ -28,6 +29,7 @@ export const defaultChecks = [
28
29
  id: checkId("unnecessary_complexity"),
29
30
  name: "Unnecessary complexity",
30
31
  question: "Did the change add structure without buying clarity?",
32
+ why: "Extra indirection can hide simple decisions and make the code feel more designed than understood.",
31
33
  lookFor: [
32
34
  "helper, wrapper, service, layer, or extra file around simple logic without reuse",
33
35
  ],
@@ -68,6 +70,7 @@ Prefer no match over a weak match.`,
68
70
  id: checkId("fake_precision_windowing"),
69
71
  name: "Fake precision windowing",
70
72
  question: "Did the change add fake precision around model context?",
73
+ why: "Precise-looking bookkeeping can create confidence without improving the actual behavior.",
71
74
  lookFor: [
72
75
  "precise-looking counts, budgets, ratios, reports, or batching fields without useful behavior",
73
76
  ],
@@ -80,6 +83,7 @@ Prefer no match over a weak match.`,
80
83
  id: checkId("coauthored_slop"),
81
84
  name: "Coauthored slop",
82
85
  question: "Does author metadata contain co-author text?",
86
+ why: "Careless metadata is a cheap signal that the change may not have been reviewed with intent.",
83
87
  lookFor: [
84
88
  "author signal contains coauhtoried, coauthored, or co-authored text",
85
89
  ],
@@ -91,6 +95,7 @@ Prefer no match over a weak match.`,
91
95
  id: checkId("mega_file"),
92
96
  name: "Mega file",
93
97
  question: "Is a touched non-config file over 1000 LOC?",
98
+ why: "Large files make judgment harder by concentrating unrelated decisions in one place.",
94
99
  lookFor: [
95
100
  "touched non-config source file over 1000 LOC",
96
101
  ],
@@ -102,6 +107,7 @@ Prefer no match over a weak match.`,
102
107
  id: checkId("over_commenting"),
103
108
  name: "Over commenting",
104
109
  question: "Did the change add noisy comments?",
110
+ why: "Narrative comments can make routine code look deliberate without clarifying the underlying tradeoff.",
105
111
  lookFor: [
106
112
  "comments restate obvious code or narrate simple logic",
107
113
  ],
@@ -129,6 +135,7 @@ Prefer no match over a weak match.`,
129
135
  id: checkId("lint_bypass"),
130
136
  name: "Lint bypass",
131
137
  question: "Did the change bypass lint or type rules?",
138
+ why: "Unexplained suppressions remove useful feedback exactly where a change needs more scrutiny.",
132
139
  lookFor: [
133
140
  "adds suppressions, any, broad casts, or weakens lint/typecheck config",
134
141
  ],
@@ -152,6 +159,7 @@ Prefer no match over a weak match.`,
152
159
  id: checkId("inconsistent_patterns"),
153
160
  name: "Inconsistent patterns",
154
161
  question: "Does the change clash with nearby patterns?",
162
+ why: "Pattern drift can signal that a change followed generic suggestions instead of local codebase judgment.",
155
163
  lookFor: [
156
164
  "same job uses different naming, errors, state, imports, or layout than nearby files",
157
165
  ],
@@ -164,6 +172,7 @@ Prefer no match over a weak match.`,
164
172
  id: checkId("reinvented_utils"),
165
173
  name: "Reinvented utils",
166
174
  question: "Did the change recreate an existing utility?",
175
+ why: "Generic helper reinvention can be a sign that the change optimized for plausible code over local reuse.",
167
176
  lookFor: [
168
177
  "new helper duplicates local utility or standard library behavior",
169
178
  ],
@@ -188,6 +197,7 @@ Prefer no match over a weak match.`,
188
197
  id: checkId("operator_style_mismatch"),
189
198
  name: "Operator style mismatch",
190
199
  question: "Does the change read unlike the surrounding code?",
200
+ why: "Style mismatch can reveal generic generated code that was not reconciled with nearby conventions.",
191
201
  lookFor: [
192
202
  "generic or template-like names, abstractions, comments, or control flow clash with local style",
193
203
  ],
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "0.0.7";
1
+ export declare const VERSION = "0.0.8";
2
2
  import type { ModelConfig, ModelId } from "./types.ts";
3
3
  export declare const DEFAULT_MODEL_ID: ModelId;
4
4
  export declare const MODEL_REGISTRY: Record<ModelId, ModelConfig>;
package/dist/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- export const VERSION = "0.0.7";
1
+ export const VERSION = "0.0.8";
2
2
  export const DEFAULT_MODEL_ID = "gemma-4-e2b";
3
3
  export const MODEL_REGISTRY = {
4
4
  "gemma-4-e2b": {
package/dist/prompts.js CHANGED
@@ -55,6 +55,7 @@ ${input.pack.text || "(none)"}`;
55
55
  }
56
56
  function formatSearchPattern(check) {
57
57
  return `Pattern: ${check.id} (${check.name})
58
+ Why this matters: ${check.why}
58
59
  Question: ${check.searchPrompt ?? check.question}
59
60
  Look for:
60
61
  ${check.lookFor.map((signal) => `- ${signal}`).join("\n")}
@@ -81,6 +82,7 @@ function patternForContext(context, patterns) {
81
82
  id: context.checkId,
82
83
  name: context.checkId,
83
84
  question: `Does this target match ${context.checkId}?`,
85
+ why: "This pattern may indicate judgment-offload.",
84
86
  lookFor: [],
85
87
  ignoreWhen: [],
86
88
  };
package/dist/render.js CHANGED
@@ -29,7 +29,8 @@ No judgment-offload signals found.`;
29
29
  return `🧙 stupify 🪄
30
30
  Possible judgment-offload detected:
31
31
  ${run.matches.map((match, index) => `${index + 1}. ${match.patternId}
32
- ${match.reason}
32
+ Why: ${match.checkWhy ?? "This pattern may indicate judgment-offload."}
33
+ Match: ${match.reason}
33
34
  Proof: ${match.proof}`).join("\n")}
34
35
  Search mode is warn-only.`;
35
36
  }
package/dist/stupify.js CHANGED
@@ -198,7 +198,7 @@ export async function runSearchCommand(command, startedAt) {
198
198
  }
199
199
  const { value } = await t.trace("search.model", () => runSearch(model, batch.request), { count: (v) => v.length });
200
200
  modelCalls += 1;
201
- matches.push(...value);
201
+ matches.push(...withCheckWhy(value, checks));
202
202
  }
203
203
  const uniqueMatches = dedupeMatches(matches);
204
204
  return {
@@ -242,6 +242,13 @@ function dedupeMatches(matches) {
242
242
  return true;
243
243
  });
244
244
  }
245
+ function withCheckWhy(matches, checks) {
246
+ const checksById = new Map(checks.map((check) => [check.id, check]));
247
+ return matches.map((match) => ({
248
+ ...match,
249
+ checkWhy: checksById.get(match.patternId)?.why,
250
+ }));
251
+ }
245
252
  async function buildSearchBatches(input) {
246
253
  const first = makeSearchBatch(input, input.contexts, input.initialPack);
247
254
  if (first.estimatedInputTokens <= input.maxSearchInputTokens) {
package/dist/types.d.ts CHANGED
@@ -68,6 +68,7 @@ export type StupifyCheck = Readonly<{
68
68
  id: CheckId;
69
69
  name: string;
70
70
  question: string;
71
+ why: string;
71
72
  lookFor: readonly string[];
72
73
  ignoreWhen: readonly string[];
73
74
  enabledByDefault?: boolean;
@@ -194,6 +195,7 @@ export type SearchProfile = Readonly<{
194
195
  export type SearchMatch = Readonly<{
195
196
  targetId: string;
196
197
  patternId: CheckId;
198
+ checkWhy?: string;
197
199
  reason: string;
198
200
  proof: string;
199
201
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stupify/cli",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "Local-only diagnostic CLI for checking whether AI is making you dumber.",
5
5
  "private": false,
6
6
  "type": "module",
package/src/analysis.ts CHANGED
@@ -104,11 +104,16 @@ function uncheckedSearchMatches(value: unknown, contexts: readonly SemContext[])
104
104
  targetId,
105
105
  patternId: context.checkId,
106
106
  reason: match.reason ?? "",
107
- proof: match.proof ?? "",
107
+ proof: sourcePointer(context),
108
108
  }];
109
109
  });
110
110
  }
111
111
 
112
+ function sourcePointer(context: SemContext): string {
113
+ const file = context.filePath ?? "(unknown)";
114
+ return `${file}::${context.entityKind || "entity"}::${context.entityName || context.entityId}`;
115
+ }
116
+
112
117
  async function runJsonPrompt(
113
118
  model: LocalModel,
114
119
  prompt: string,
package/src/checks.ts CHANGED
@@ -5,6 +5,7 @@ export const defaultChecks: readonly StupifyCheck[] = [
5
5
  id: checkId("duplicated_schema"),
6
6
  name: "Duplicated schema",
7
7
  question: "Did the change duplicate an existing type, schema, payload, or DTO shape?",
8
+ why: "Duplicated shapes make it easier for AI-assisted changes to drift away from the real source of truth.",
8
9
  lookFor: [
9
10
  "local shape mirrors existing fields and maps them one-for-one",
10
11
  "new response, payload, schema, or DTO adds no filtering, renaming, validation, or versioning",
@@ -29,6 +30,7 @@ export const defaultChecks: readonly StupifyCheck[] = [
29
30
  id: checkId("unnecessary_complexity"),
30
31
  name: "Unnecessary complexity",
31
32
  question: "Did the change add structure without buying clarity?",
33
+ why: "Extra indirection can hide simple decisions and make the code feel more designed than understood.",
32
34
  lookFor: [
33
35
  "helper, wrapper, service, layer, or extra file around simple logic without reuse",
34
36
  ],
@@ -69,6 +71,7 @@ Prefer no match over a weak match.`,
69
71
  id: checkId("fake_precision_windowing"),
70
72
  name: "Fake precision windowing",
71
73
  question: "Did the change add fake precision around model context?",
74
+ why: "Precise-looking bookkeeping can create confidence without improving the actual behavior.",
72
75
  lookFor: [
73
76
  "precise-looking counts, budgets, ratios, reports, or batching fields without useful behavior",
74
77
  ],
@@ -81,6 +84,7 @@ Prefer no match over a weak match.`,
81
84
  id: checkId("coauthored_slop"),
82
85
  name: "Coauthored slop",
83
86
  question: "Does author metadata contain co-author text?",
87
+ why: "Careless metadata is a cheap signal that the change may not have been reviewed with intent.",
84
88
  lookFor: [
85
89
  "author signal contains coauhtoried, coauthored, or co-authored text",
86
90
  ],
@@ -92,6 +96,7 @@ Prefer no match over a weak match.`,
92
96
  id: checkId("mega_file"),
93
97
  name: "Mega file",
94
98
  question: "Is a touched non-config file over 1000 LOC?",
99
+ why: "Large files make judgment harder by concentrating unrelated decisions in one place.",
95
100
  lookFor: [
96
101
  "touched non-config source file over 1000 LOC",
97
102
  ],
@@ -103,6 +108,7 @@ Prefer no match over a weak match.`,
103
108
  id: checkId("over_commenting"),
104
109
  name: "Over commenting",
105
110
  question: "Did the change add noisy comments?",
111
+ why: "Narrative comments can make routine code look deliberate without clarifying the underlying tradeoff.",
106
112
  lookFor: [
107
113
  "comments restate obvious code or narrate simple logic",
108
114
  ],
@@ -130,6 +136,7 @@ Prefer no match over a weak match.`,
130
136
  id: checkId("lint_bypass"),
131
137
  name: "Lint bypass",
132
138
  question: "Did the change bypass lint or type rules?",
139
+ why: "Unexplained suppressions remove useful feedback exactly where a change needs more scrutiny.",
133
140
  lookFor: [
134
141
  "adds suppressions, any, broad casts, or weakens lint/typecheck config",
135
142
  ],
@@ -153,6 +160,7 @@ Prefer no match over a weak match.`,
153
160
  id: checkId("inconsistent_patterns"),
154
161
  name: "Inconsistent patterns",
155
162
  question: "Does the change clash with nearby patterns?",
163
+ why: "Pattern drift can signal that a change followed generic suggestions instead of local codebase judgment.",
156
164
  lookFor: [
157
165
  "same job uses different naming, errors, state, imports, or layout than nearby files",
158
166
  ],
@@ -165,6 +173,7 @@ Prefer no match over a weak match.`,
165
173
  id: checkId("reinvented_utils"),
166
174
  name: "Reinvented utils",
167
175
  question: "Did the change recreate an existing utility?",
176
+ why: "Generic helper reinvention can be a sign that the change optimized for plausible code over local reuse.",
168
177
  lookFor: [
169
178
  "new helper duplicates local utility or standard library behavior",
170
179
  ],
@@ -189,6 +198,7 @@ Prefer no match over a weak match.`,
189
198
  id: checkId("operator_style_mismatch"),
190
199
  name: "Operator style mismatch",
191
200
  question: "Does the change read unlike the surrounding code?",
201
+ why: "Style mismatch can reveal generic generated code that was not reconciled with nearby conventions.",
192
202
  lookFor: [
193
203
  "generic or template-like names, abstractions, comments, or control flow clash with local style",
194
204
  ],
package/src/constants.ts CHANGED
@@ -1,4 +1,4 @@
1
- export const VERSION = "0.0.7";
1
+ export const VERSION = "0.0.8";
2
2
  import type { ModelConfig, ModelId } from "./types.ts";
3
3
 
4
4
  export const DEFAULT_MODEL_ID: ModelId = "gemma-4-e2b";
package/src/prompts.ts CHANGED
@@ -64,6 +64,7 @@ ${input.pack.text || "(none)"}`;
64
64
 
65
65
  function formatSearchPattern(check: StupifyCheck): string {
66
66
  return `Pattern: ${check.id} (${check.name})
67
+ Why this matters: ${check.why}
67
68
  Question: ${check.searchPrompt ?? check.question}
68
69
  Look for:
69
70
  ${check.lookFor.map((signal) => `- ${signal}`).join("\n")}
@@ -92,6 +93,7 @@ function patternForContext(context: SemContext, patterns: readonly StupifyCheck[
92
93
  id: context.checkId,
93
94
  name: context.checkId,
94
95
  question: `Does this target match ${context.checkId}?`,
96
+ why: "This pattern may indicate judgment-offload.",
95
97
  lookFor: [],
96
98
  ignoreWhen: [],
97
99
  };
package/src/render.ts CHANGED
@@ -34,7 +34,8 @@ No judgment-offload signals found.`;
34
34
  return `🧙 stupify 🪄
35
35
  Possible judgment-offload detected:
36
36
  ${run.matches.map((match, index) => `${index + 1}. ${match.patternId}
37
- ${match.reason}
37
+ Why: ${match.checkWhy ?? "This pattern may indicate judgment-offload."}
38
+ Match: ${match.reason}
38
39
  Proof: ${match.proof}`).join("\n")}
39
40
  Search mode is warn-only.`;
40
41
  }
package/src/stupify.ts CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  } from "./search-profile.ts";
21
21
  import { semChangeSetForCommand } from "./sem-provider.ts";
22
22
  import { createTracer } from "./trace.ts";
23
- import type { SearchCommand, SearchProfile, SearchRunJson, SemContext, SemContextPack, StupifyCheck } from "./types.ts";
23
+ import type { SearchCommand, SearchMatch, SearchProfile, SearchRunJson, SemContext, SemContextPack, StupifyCheck } from "./types.ts";
24
24
 
25
25
  export async function main(argv = process.argv.slice(2)): Promise<number> {
26
26
  const startedAt = Date.now();
@@ -225,7 +225,7 @@ export async function runSearchCommand(command: SearchCommand, startedAt: number
225
225
  { count: (v) => v.length },
226
226
  );
227
227
  modelCalls += 1;
228
- matches.push(...value);
228
+ matches.push(...withCheckWhy(value, checks));
229
229
  }
230
230
  const uniqueMatches = dedupeMatches(matches);
231
231
 
@@ -270,6 +270,14 @@ function dedupeMatches<T extends { targetId: string; patternId: string; proof: s
270
270
  });
271
271
  }
272
272
 
273
+ function withCheckWhy(matches: readonly SearchMatch[], checks: readonly StupifyCheck[]): readonly SearchMatch[] {
274
+ const checksById = new Map(checks.map((check) => [check.id, check]));
275
+ return matches.map((match) => ({
276
+ ...match,
277
+ checkWhy: checksById.get(match.patternId)?.why,
278
+ }));
279
+ }
280
+
273
281
  type SearchBatch = Readonly<{
274
282
  contexts: readonly SemContext[];
275
283
  pack: SemContextPack;
package/src/types.ts CHANGED
@@ -51,6 +51,7 @@ export type StupifyCheck = Readonly<{
51
51
  id: CheckId;
52
52
  name: string;
53
53
  question: string;
54
+ why: string;
54
55
  lookFor: readonly string[];
55
56
  ignoreWhen: readonly string[];
56
57
  enabledByDefault?: boolean;
@@ -192,6 +193,7 @@ export type SearchProfile = Readonly<{
192
193
  export type SearchMatch = Readonly<{
193
194
  targetId: string;
194
195
  patternId: CheckId;
196
+ checkWhy?: string;
195
197
  reason: string;
196
198
  proof: string;
197
199
  }>;