@nerviq/cli 1.0.1 → 1.2.1
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/bin/cli.js +170 -73
- package/package.json +1 -1
- package/src/activity.js +20 -0
- package/src/aider/domain-packs.js +27 -2
- package/src/aider/mcp-packs.js +231 -0
- package/src/aider/techniques.js +3211 -1397
- package/src/audit.js +257 -2
- package/src/catalog.js +18 -2
- package/src/codex/domain-packs.js +23 -1
- package/src/codex/mcp-packs.js +254 -0
- package/src/codex/techniques.js +4738 -3257
- package/src/copilot/domain-packs.js +23 -1
- package/src/copilot/mcp-packs.js +254 -0
- package/src/copilot/techniques.js +3433 -1936
- package/src/cursor/domain-packs.js +23 -1
- package/src/cursor/mcp-packs.js +257 -0
- package/src/cursor/techniques.js +3698 -1869
- package/src/deprecation.js +98 -0
- package/src/domain-pack-expansion.js +571 -0
- package/src/domain-packs.js +25 -2
- package/src/formatters/otel.js +151 -0
- package/src/gemini/domain-packs.js +23 -1
- package/src/gemini/mcp-packs.js +257 -0
- package/src/gemini/techniques.js +3734 -2238
- package/src/integrations.js +194 -0
- package/src/mcp-packs.js +233 -0
- package/src/opencode/domain-packs.js +23 -1
- package/src/opencode/mcp-packs.js +231 -0
- package/src/opencode/techniques.js +3501 -1687
- package/src/org.js +68 -0
- package/src/source-urls.js +410 -260
- package/src/stack-checks.js +565 -0
- package/src/supplemental-checks.js +817 -0
- package/src/techniques.js +2929 -1449
- package/src/telemetry.js +160 -0
- package/src/windsurf/domain-packs.js +23 -1
- package/src/windsurf/mcp-packs.js +257 -0
- package/src/windsurf/techniques.js +3648 -1834
- package/src/workspace.js +233 -0
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
const { SOURCE_URLS } = require('./source-urls');
|
|
2
|
+
|
|
3
|
+
function files(ctx) {
|
|
4
|
+
return Array.isArray(ctx.files) ? ctx.files : [];
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function fileContent(ctx, filePath) {
|
|
8
|
+
return typeof ctx.fileContent === 'function' ? (ctx.fileContent(filePath) || '') : '';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function matchingFiles(ctx, pattern) {
|
|
12
|
+
return files(ctx).filter((file) => {
|
|
13
|
+
pattern.lastIndex = 0;
|
|
14
|
+
return pattern.test(file);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function hasMatchingFile(ctx, pattern) {
|
|
19
|
+
return matchingFiles(ctx, pattern).length > 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function readMatchingFiles(ctx, pattern) {
|
|
23
|
+
return matchingFiles(ctx, pattern)
|
|
24
|
+
.map((file) => fileContent(ctx, file))
|
|
25
|
+
.filter(Boolean)
|
|
26
|
+
.join('\n');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function docsText(ctx, docs) {
|
|
30
|
+
return String(docs ? docs(ctx) || '' : '');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function workflowText(ctx) {
|
|
34
|
+
return matchingFiles(ctx, /(^|[\\/])\.github[\\/]workflows[\\/].+\.ya?ml$/i)
|
|
35
|
+
.map((file) => fileContent(ctx, file))
|
|
36
|
+
.filter(Boolean)
|
|
37
|
+
.join('\n');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function projectText(ctx, docs) {
|
|
41
|
+
return [docsText(ctx, docs), workflowText(ctx)].filter(Boolean).join('\n');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function pubspecText(ctx) {
|
|
45
|
+
return readMatchingFiles(ctx, /(^|[\\/])pubspec\.yaml$/i);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function hasFlutterSurface(ctx) {
|
|
49
|
+
return hasMatchingFile(ctx, /(^|[\\/])pubspec\.yaml$/i);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function hasSwiftSurface(ctx) {
|
|
53
|
+
return hasMatchingFile(ctx, /(^|[\\/])Package\.swift$/i) ||
|
|
54
|
+
hasMatchingFile(ctx, /\.xcodeproj([\\/]|$)/i) ||
|
|
55
|
+
hasMatchingFile(ctx, /(^|[\\/])project\.pbxproj$/i);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function swiftConfigText(ctx) {
|
|
59
|
+
return [
|
|
60
|
+
readMatchingFiles(ctx, /(^|[\\/])Package\.swift$/i),
|
|
61
|
+
readMatchingFiles(ctx, /(^|[\\/])Podfile$/i),
|
|
62
|
+
readMatchingFiles(ctx, /(^|[\\/])project\.pbxproj$/i),
|
|
63
|
+
readMatchingFiles(ctx, /(^|[\\/])\.swift-version$/i),
|
|
64
|
+
].filter(Boolean).join('\n');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function hasAndroidKotlinSurface(ctx) {
|
|
68
|
+
const gradleFiles = matchingFiles(ctx, /(^|[\\/])build\.gradle\.kts$/i);
|
|
69
|
+
if (!gradleFiles.length) return false;
|
|
70
|
+
|
|
71
|
+
return gradleFiles.some((file) => {
|
|
72
|
+
const content = fileContent(ctx, file);
|
|
73
|
+
return /android\s*\{|com\.android\.(?:application|library)|id\(["']com\.android\.(?:application|library)["']\)/i.test(content);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function androidGradleText(ctx) {
|
|
78
|
+
return [
|
|
79
|
+
readMatchingFiles(ctx, /(^|[\\/])build\.gradle\.kts$/i),
|
|
80
|
+
readMatchingFiles(ctx, /(^|[\\/])settings\.gradle\.kts$/i),
|
|
81
|
+
readMatchingFiles(ctx, /(^|[\\/])gradle[\\/]libs\.versions\.toml$/i),
|
|
82
|
+
fileContent(ctx, 'gradle.properties'),
|
|
83
|
+
].filter(Boolean).join('\n');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function flutterStateManagementPresent(ctx) {
|
|
87
|
+
const pubspec = pubspecText(ctx);
|
|
88
|
+
return /flutter_riverpod|hooks_riverpod|riverpod|flutter_bloc|bloc|provider|getx|mobx|stacked/i.test(pubspec);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function flutterCodegenPresent(ctx) {
|
|
92
|
+
return /build_runner|freezed|json_serializable|injectable_generator|drift_dev/i.test(pubspecText(ctx)) ||
|
|
93
|
+
hasMatchingFile(ctx, /(^|[\\/]).+\.g\.dart$/i);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function flutterBackendIntegrationPresent(ctx) {
|
|
97
|
+
return /firebase_|cloud_firestore|firebase_core|supabase_flutter|supabase/i.test(pubspecText(ctx)) ||
|
|
98
|
+
hasMatchingFile(ctx, /(^|[\\/])google-services\.json$/i) ||
|
|
99
|
+
hasMatchingFile(ctx, /(^|[\\/])GoogleService-Info\.plist$/i) ||
|
|
100
|
+
hasMatchingFile(ctx, /(^|[\\/])firebase_options\.dart$/i);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function flutterPlatformSurface(ctx) {
|
|
104
|
+
return hasMatchingFile(ctx, /(^|[\\/])android([\\/]|$)/i) ||
|
|
105
|
+
hasMatchingFile(ctx, /(^|[\\/])ios([\\/]|$)/i);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function flutterCiSurface(ctx) {
|
|
109
|
+
return hasMatchingFile(ctx, /(^|[\\/])fastlane([\\/]|$)/i) ||
|
|
110
|
+
hasMatchingFile(ctx, /(^|[\\/])codemagic\.yaml$/i) ||
|
|
111
|
+
/fastlane|codemagic|flutter build (?:apk|appbundle|ipa|ios|android)|flutter test/i.test(workflowText(ctx));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function swiftUiSignals(ctx) {
|
|
115
|
+
return readMatchingFiles(ctx, /(^|[\\/]).+\.swift$/i);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function kotlinComposeSignals(ctx) {
|
|
119
|
+
return [
|
|
120
|
+
androidGradleText(ctx),
|
|
121
|
+
readMatchingFiles(ctx, /(^|[\\/]).+\.kt$/i),
|
|
122
|
+
].filter(Boolean).join('\n');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function makeCheck({ platform, id, name, category, impact, fix, check }) {
|
|
126
|
+
return {
|
|
127
|
+
id,
|
|
128
|
+
name,
|
|
129
|
+
check,
|
|
130
|
+
impact,
|
|
131
|
+
category,
|
|
132
|
+
fix,
|
|
133
|
+
sourceUrl: SOURCE_URLS[platform]?.byCategory?.[category] || SOURCE_URLS[platform]?.defaultUrl,
|
|
134
|
+
confidence: 0.7,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function buildStackChecks({ platform, objectPrefix, idPrefix, docs }) {
|
|
139
|
+
const makeId = (family, number) => `${idPrefix}-${family}${String(number).padStart(2, '0')}`;
|
|
140
|
+
const makeKey = (suffix) => `${objectPrefix}${suffix}`;
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
[makeKey('FlutterPubspecExists')]: makeCheck({
|
|
144
|
+
platform,
|
|
145
|
+
id: makeId('FL', 1),
|
|
146
|
+
name: 'pubspec.yaml exists',
|
|
147
|
+
category: 'flutter',
|
|
148
|
+
impact: 'high',
|
|
149
|
+
fix: 'Add a committed `pubspec.yaml` at the Flutter project root so tooling, dependencies, and instructions have a canonical manifest.',
|
|
150
|
+
check: (ctx) => hasFlutterSurface(ctx) ? true : null,
|
|
151
|
+
}),
|
|
152
|
+
[makeKey('FlutterPubspecLockCommitted')]: makeCheck({
|
|
153
|
+
platform,
|
|
154
|
+
id: makeId('FL', 2),
|
|
155
|
+
name: 'pubspec.lock committed',
|
|
156
|
+
category: 'flutter',
|
|
157
|
+
impact: 'medium',
|
|
158
|
+
fix: 'Commit `pubspec.lock` so Flutter package resolution stays reproducible for contributors and agents.',
|
|
159
|
+
check: (ctx) => hasFlutterSurface(ctx) ? hasMatchingFile(ctx, /(^|[\\/])pubspec\.lock$/i) : null,
|
|
160
|
+
}),
|
|
161
|
+
[makeKey('FlutterVersionSpecified')]: makeCheck({
|
|
162
|
+
platform,
|
|
163
|
+
id: makeId('FL', 3),
|
|
164
|
+
name: 'Flutter version specified (.fvmrc or pubspec)',
|
|
165
|
+
category: 'flutter',
|
|
166
|
+
impact: 'high',
|
|
167
|
+
fix: 'Specify the Flutter SDK version with `.fvmrc` or an explicit SDK constraint in `pubspec.yaml`.',
|
|
168
|
+
check: (ctx) => {
|
|
169
|
+
if (!hasFlutterSurface(ctx)) return null;
|
|
170
|
+
const pubspec = pubspecText(ctx);
|
|
171
|
+
return hasMatchingFile(ctx, /(^|[\\/])\.fvmrc$/i) ||
|
|
172
|
+
/environment:[\s\S]{0,300}(sdk|flutter)\s*:\s*["'][^"']+["']/i.test(pubspec);
|
|
173
|
+
},
|
|
174
|
+
}),
|
|
175
|
+
[makeKey('FlutterTestDocumented')]: makeCheck({
|
|
176
|
+
platform,
|
|
177
|
+
id: makeId('FL', 4),
|
|
178
|
+
name: 'flutter test documented',
|
|
179
|
+
category: 'flutter',
|
|
180
|
+
impact: 'high',
|
|
181
|
+
fix: 'Document `flutter test` in repo instructions or CI so contributors and agents have a shared verification command.',
|
|
182
|
+
check: (ctx) => hasFlutterSurface(ctx)
|
|
183
|
+
? /\bflutter test\b/i.test(projectText(ctx, docs))
|
|
184
|
+
: null,
|
|
185
|
+
}),
|
|
186
|
+
[makeKey('FlutterAnalyzeDocumented')]: makeCheck({
|
|
187
|
+
platform,
|
|
188
|
+
id: makeId('FL', 5),
|
|
189
|
+
name: 'flutter analyze documented',
|
|
190
|
+
category: 'flutter',
|
|
191
|
+
impact: 'high',
|
|
192
|
+
fix: 'Document `flutter analyze` in project instructions or automation so static analysis is part of the default loop.',
|
|
193
|
+
check: (ctx) => hasFlutterSurface(ctx)
|
|
194
|
+
? /\bflutter analyze\b/i.test(projectText(ctx, docs))
|
|
195
|
+
: null,
|
|
196
|
+
}),
|
|
197
|
+
[makeKey('FlutterAnalysisOptionsConfigured')]: makeCheck({
|
|
198
|
+
platform,
|
|
199
|
+
id: makeId('FL', 6),
|
|
200
|
+
name: 'analysis_options.yaml configured',
|
|
201
|
+
category: 'flutter',
|
|
202
|
+
impact: 'high',
|
|
203
|
+
fix: 'Add `analysis_options.yaml` to define lint rules and analyzer behavior for the Flutter codebase.',
|
|
204
|
+
check: (ctx) => hasFlutterSurface(ctx)
|
|
205
|
+
? hasMatchingFile(ctx, /(^|[\\/])analysis_options\.ya?ml$/i)
|
|
206
|
+
: null,
|
|
207
|
+
}),
|
|
208
|
+
[makeKey('FlutterBuildFlavorsDocumented')]: makeCheck({
|
|
209
|
+
platform,
|
|
210
|
+
id: makeId('FL', 7),
|
|
211
|
+
name: 'Build flavors documented (dev/staging/prod)',
|
|
212
|
+
category: 'flutter',
|
|
213
|
+
impact: 'medium',
|
|
214
|
+
fix: 'Document build flavors such as dev, staging, and prod so mobile builds and environment routing stay predictable.',
|
|
215
|
+
check: (ctx) => hasFlutterSurface(ctx)
|
|
216
|
+
? /flavor|flavours|dev|staging|prod|production/i.test(projectText(ctx, docs))
|
|
217
|
+
: null,
|
|
218
|
+
}),
|
|
219
|
+
[makeKey('FlutterPlatformCodeDocumented')]: makeCheck({
|
|
220
|
+
platform,
|
|
221
|
+
id: makeId('FL', 8),
|
|
222
|
+
name: 'Platform-specific code documented (android/ios)',
|
|
223
|
+
category: 'flutter',
|
|
224
|
+
impact: 'medium',
|
|
225
|
+
fix: 'Document Android and iOS specific code paths, native bridges, or platform setup in repo guidance.',
|
|
226
|
+
check: (ctx) => {
|
|
227
|
+
if (!hasFlutterSurface(ctx)) return null;
|
|
228
|
+
if (!flutterPlatformSurface(ctx)) return null;
|
|
229
|
+
return /android|ios|platform.?specific|method channel|native code/i.test(projectText(ctx, docs));
|
|
230
|
+
},
|
|
231
|
+
}),
|
|
232
|
+
[makeKey('FlutterStateManagementDocumented')]: makeCheck({
|
|
233
|
+
platform,
|
|
234
|
+
id: makeId('FL', 9),
|
|
235
|
+
name: 'State management documented (Riverpod/Bloc/Provider in deps)',
|
|
236
|
+
category: 'flutter',
|
|
237
|
+
impact: 'medium',
|
|
238
|
+
fix: 'Document the chosen Flutter state-management approach when Riverpod, Bloc, Provider, or similar packages are in use.',
|
|
239
|
+
check: (ctx) => {
|
|
240
|
+
if (!hasFlutterSurface(ctx)) return null;
|
|
241
|
+
if (!flutterStateManagementPresent(ctx)) return null;
|
|
242
|
+
return /riverpod|flutter_bloc|bloc|provider|getx|mobx|state management/i.test(projectText(ctx, docs));
|
|
243
|
+
},
|
|
244
|
+
}),
|
|
245
|
+
[makeKey('FlutterCodeGenerationDocumented')]: makeCheck({
|
|
246
|
+
platform,
|
|
247
|
+
id: makeId('FL', 10),
|
|
248
|
+
name: 'Code generation documented (build_runner in devDeps)',
|
|
249
|
+
category: 'flutter',
|
|
250
|
+
impact: 'medium',
|
|
251
|
+
fix: 'Document `build_runner` or the generated-code workflow when the app uses Dart code generation.',
|
|
252
|
+
check: (ctx) => {
|
|
253
|
+
if (!hasFlutterSurface(ctx)) return null;
|
|
254
|
+
if (!flutterCodegenPresent(ctx)) return null;
|
|
255
|
+
return /build_runner|codegen|generated code|freezed|json_serializable/i.test(projectText(ctx, docs));
|
|
256
|
+
},
|
|
257
|
+
}),
|
|
258
|
+
[makeKey('FlutterLocalizationConfigured')]: makeCheck({
|
|
259
|
+
platform,
|
|
260
|
+
id: makeId('FL', 11),
|
|
261
|
+
name: 'Localization configured (l10n.yaml)',
|
|
262
|
+
category: 'flutter',
|
|
263
|
+
impact: 'medium',
|
|
264
|
+
fix: 'Add `l10n.yaml` when the app uses Flutter localization so the i18n pipeline is explicit and reproducible.',
|
|
265
|
+
check: (ctx) => hasFlutterSurface(ctx)
|
|
266
|
+
? hasMatchingFile(ctx, /(^|[\\/])l10n\.ya?ml$/i)
|
|
267
|
+
: null,
|
|
268
|
+
}),
|
|
269
|
+
[makeKey('FlutterFirebaseOrSupabaseDocumented')]: makeCheck({
|
|
270
|
+
platform,
|
|
271
|
+
id: makeId('FL', 12),
|
|
272
|
+
name: 'Firebase/Supabase configuration documented',
|
|
273
|
+
category: 'flutter',
|
|
274
|
+
impact: 'high',
|
|
275
|
+
fix: 'Document Firebase or Supabase setup, environment binding, and client configuration when those services are present.',
|
|
276
|
+
check: (ctx) => {
|
|
277
|
+
if (!hasFlutterSurface(ctx)) return null;
|
|
278
|
+
if (!flutterBackendIntegrationPresent(ctx)) return null;
|
|
279
|
+
return /firebase|supabase|google-services|GoogleService-Info|firebase_options/i.test(projectText(ctx, docs));
|
|
280
|
+
},
|
|
281
|
+
}),
|
|
282
|
+
[makeKey('FlutterAppSigningDocumented')]: makeCheck({
|
|
283
|
+
platform,
|
|
284
|
+
id: makeId('FL', 13),
|
|
285
|
+
name: 'App signing documented',
|
|
286
|
+
category: 'flutter',
|
|
287
|
+
impact: 'high',
|
|
288
|
+
fix: 'Document Android keystores and iOS signing/provisioning so release builds do not depend on tribal knowledge.',
|
|
289
|
+
check: (ctx) => hasFlutterSurface(ctx)
|
|
290
|
+
? /signing|keystore|provisioning|certificate|bundle identifier|team id/i.test(projectText(ctx, docs))
|
|
291
|
+
: null,
|
|
292
|
+
}),
|
|
293
|
+
[makeKey('FlutterCiCdMobile')]: makeCheck({
|
|
294
|
+
platform,
|
|
295
|
+
id: makeId('FL', 14),
|
|
296
|
+
name: 'CI/CD for mobile (Fastlane/Codemagic)',
|
|
297
|
+
category: 'flutter',
|
|
298
|
+
impact: 'medium',
|
|
299
|
+
fix: 'Add Fastlane, Codemagic, or equivalent mobile CI/CD automation for repeatable Flutter delivery.',
|
|
300
|
+
check: (ctx) => hasFlutterSurface(ctx)
|
|
301
|
+
? flutterCiSurface(ctx)
|
|
302
|
+
: null,
|
|
303
|
+
}),
|
|
304
|
+
[makeKey('FlutterGitignore')]: makeCheck({
|
|
305
|
+
platform,
|
|
306
|
+
id: makeId('FL', 15),
|
|
307
|
+
name: 'Platform-specific .gitignore',
|
|
308
|
+
category: 'flutter',
|
|
309
|
+
impact: 'medium',
|
|
310
|
+
fix: 'Add Flutter-specific ignore rules such as `.dart_tool/`, `.flutter-plugins*`, and platform build outputs to `.gitignore`.',
|
|
311
|
+
check: (ctx) => {
|
|
312
|
+
if (!hasFlutterSurface(ctx)) return null;
|
|
313
|
+
const gitignore = fileContent(ctx, '.gitignore');
|
|
314
|
+
return /\.dart_tool\/|\.flutter-plugins|\.flutter-plugins-dependencies|android\/key\.properties|ios\/Flutter\/ephemeral|build\//i.test(gitignore);
|
|
315
|
+
},
|
|
316
|
+
}),
|
|
317
|
+
|
|
318
|
+
[makeKey('SwiftPackageOrXcodeprojExists')]: makeCheck({
|
|
319
|
+
platform,
|
|
320
|
+
id: makeId('SW', 1),
|
|
321
|
+
name: 'Package.swift or .xcodeproj exists',
|
|
322
|
+
category: 'swift',
|
|
323
|
+
impact: 'high',
|
|
324
|
+
fix: 'Commit `Package.swift` or the Xcode project so the Swift/iOS build surface is explicit and reproducible.',
|
|
325
|
+
check: (ctx) => hasSwiftSurface(ctx) ? true : null,
|
|
326
|
+
}),
|
|
327
|
+
[makeKey('SwiftVersionSpecified')]: makeCheck({
|
|
328
|
+
platform,
|
|
329
|
+
id: makeId('SW', 2),
|
|
330
|
+
name: 'Swift version specified (.swift-version)',
|
|
331
|
+
category: 'swift',
|
|
332
|
+
impact: 'high',
|
|
333
|
+
fix: 'Specify the Swift toolchain with `.swift-version` or a `swift-tools-version` declaration.',
|
|
334
|
+
check: (ctx) => {
|
|
335
|
+
if (!hasSwiftSurface(ctx)) return null;
|
|
336
|
+
return hasMatchingFile(ctx, /(^|[\\/])\.swift-version$/i) ||
|
|
337
|
+
/swift-tools-version:\s*\d+(?:\.\d+)+/i.test(swiftConfigText(ctx));
|
|
338
|
+
},
|
|
339
|
+
}),
|
|
340
|
+
[makeKey('SwiftLintConfigured')]: makeCheck({
|
|
341
|
+
platform,
|
|
342
|
+
id: makeId('SW', 3),
|
|
343
|
+
name: 'SwiftLint configured (.swiftlint.yml)',
|
|
344
|
+
category: 'swift',
|
|
345
|
+
impact: 'medium',
|
|
346
|
+
fix: 'Configure SwiftLint with `.swiftlint.yml` or equivalent build/CI integration for consistent Swift quality checks.',
|
|
347
|
+
check: (ctx) => {
|
|
348
|
+
if (!hasSwiftSurface(ctx)) return null;
|
|
349
|
+
return hasMatchingFile(ctx, /(^|[\\/])\.swiftlint\.ya?ml$/i) ||
|
|
350
|
+
/swiftlint/i.test(swiftConfigText(ctx) + '\n' + workflowText(ctx));
|
|
351
|
+
},
|
|
352
|
+
}),
|
|
353
|
+
[makeKey('SwiftXCTestDocumented')]: makeCheck({
|
|
354
|
+
platform,
|
|
355
|
+
id: makeId('SW', 4),
|
|
356
|
+
name: 'XCTest documented',
|
|
357
|
+
category: 'swift',
|
|
358
|
+
impact: 'high',
|
|
359
|
+
fix: 'Document the XCTest or `xcodebuild test` workflow so iOS verification is part of the default path.',
|
|
360
|
+
check: (ctx) => hasSwiftSurface(ctx)
|
|
361
|
+
? /xctest|swift test|xcodebuild test|test target/i.test(projectText(ctx, docs)) ||
|
|
362
|
+
hasMatchingFile(ctx, /(^|[\\/])Tests([\\/]|$)|XCTestCase/i)
|
|
363
|
+
: null,
|
|
364
|
+
}),
|
|
365
|
+
[makeKey('SwiftDependenciesManaged')]: makeCheck({
|
|
366
|
+
platform,
|
|
367
|
+
id: makeId('SW', 5),
|
|
368
|
+
name: 'CocoaPods/SPM dependencies managed (Podfile or Package.swift)',
|
|
369
|
+
category: 'swift',
|
|
370
|
+
impact: 'high',
|
|
371
|
+
fix: 'Use CocoaPods or Swift Package Manager with a committed `Podfile` or `Package.swift` for dependency management.',
|
|
372
|
+
check: (ctx) => hasSwiftSurface(ctx)
|
|
373
|
+
? hasMatchingFile(ctx, /(^|[\\/])Podfile$/i) || hasMatchingFile(ctx, /(^|[\\/])Package\.swift$/i)
|
|
374
|
+
: null,
|
|
375
|
+
}),
|
|
376
|
+
[makeKey('SwiftSchemeTargetDocumented')]: makeCheck({
|
|
377
|
+
platform,
|
|
378
|
+
id: makeId('SW', 6),
|
|
379
|
+
name: 'Scheme/target documentation',
|
|
380
|
+
category: 'swift',
|
|
381
|
+
impact: 'medium',
|
|
382
|
+
fix: 'Document Xcode schemes, targets, and the canonical build/test entry points for the repo.',
|
|
383
|
+
check: (ctx) => hasSwiftSurface(ctx)
|
|
384
|
+
? /scheme|target|workspace|xcodebuild -scheme/i.test(projectText(ctx, docs))
|
|
385
|
+
: null,
|
|
386
|
+
}),
|
|
387
|
+
[makeKey('SwiftSigningDocumented')]: makeCheck({
|
|
388
|
+
platform,
|
|
389
|
+
id: makeId('SW', 7),
|
|
390
|
+
name: 'Signing configuration documented',
|
|
391
|
+
category: 'swift',
|
|
392
|
+
impact: 'high',
|
|
393
|
+
fix: 'Document signing, provisioning profiles, certificates, and Team ID handling for iOS releases.',
|
|
394
|
+
check: (ctx) => hasSwiftSurface(ctx)
|
|
395
|
+
? /signing|provisioning|certificate|team id|bundle identifier/i.test(projectText(ctx, docs))
|
|
396
|
+
: null,
|
|
397
|
+
}),
|
|
398
|
+
[makeKey('SwiftUiApproachDocumented')]: makeCheck({
|
|
399
|
+
platform,
|
|
400
|
+
id: makeId('SW', 8),
|
|
401
|
+
name: 'SwiftUI vs UIKit approach documented',
|
|
402
|
+
category: 'swift',
|
|
403
|
+
impact: 'medium',
|
|
404
|
+
fix: 'Document whether the app uses SwiftUI, UIKit, or a hybrid approach so generated changes follow the right UI architecture.',
|
|
405
|
+
check: (ctx) => {
|
|
406
|
+
if (!hasSwiftSurface(ctx)) return null;
|
|
407
|
+
const source = swiftUiSignals(ctx);
|
|
408
|
+
if (!/SwiftUI|UIKit/i.test(source)) return null;
|
|
409
|
+
return /swiftui|uikit|hybrid ui/i.test(projectText(ctx, docs));
|
|
410
|
+
},
|
|
411
|
+
}),
|
|
412
|
+
[makeKey('SwiftDataPatternsDocumented')]: makeCheck({
|
|
413
|
+
platform,
|
|
414
|
+
id: makeId('SW', 9),
|
|
415
|
+
name: 'Core Data/SwiftData patterns documented',
|
|
416
|
+
category: 'swift',
|
|
417
|
+
impact: 'medium',
|
|
418
|
+
fix: 'Document Core Data or SwiftData usage patterns when the project persists data through Apple-native storage frameworks.',
|
|
419
|
+
check: (ctx) => {
|
|
420
|
+
if (!hasSwiftSurface(ctx)) return null;
|
|
421
|
+
const source = swiftUiSignals(ctx) + '\n' + swiftConfigText(ctx);
|
|
422
|
+
if (!/CoreData|SwiftData/i.test(source)) return null;
|
|
423
|
+
return /core data|swiftdata|modelcontext|persistentcontainer/i.test(projectText(ctx, docs));
|
|
424
|
+
},
|
|
425
|
+
}),
|
|
426
|
+
[makeKey('SwiftGitignore')]: makeCheck({
|
|
427
|
+
platform,
|
|
428
|
+
id: makeId('SW', 10),
|
|
429
|
+
name: 'Xcode-specific .gitignore',
|
|
430
|
+
category: 'swift',
|
|
431
|
+
impact: 'medium',
|
|
432
|
+
fix: 'Add Xcode ignore rules such as `DerivedData/`, `xcuserdata/`, and `.build/` to `.gitignore`.',
|
|
433
|
+
check: (ctx) => {
|
|
434
|
+
if (!hasSwiftSurface(ctx)) return null;
|
|
435
|
+
const gitignore = fileContent(ctx, '.gitignore');
|
|
436
|
+
return /DerivedData\/|xcuserdata\/|\.build\/|\*\.xcuserstate/i.test(gitignore);
|
|
437
|
+
},
|
|
438
|
+
}),
|
|
439
|
+
|
|
440
|
+
[makeKey('KotlinBuildGradleExists')]: makeCheck({
|
|
441
|
+
platform,
|
|
442
|
+
id: makeId('KT', 1),
|
|
443
|
+
name: 'build.gradle.kts exists',
|
|
444
|
+
category: 'kotlin',
|
|
445
|
+
impact: 'high',
|
|
446
|
+
fix: 'Commit `build.gradle.kts` for the Android/Kotlin project so build logic is explicit and reviewable.',
|
|
447
|
+
check: (ctx) => hasAndroidKotlinSurface(ctx) ? true : null,
|
|
448
|
+
}),
|
|
449
|
+
[makeKey('KotlinVersionSpecified')]: makeCheck({
|
|
450
|
+
platform,
|
|
451
|
+
id: makeId('KT', 2),
|
|
452
|
+
name: 'Kotlin version specified',
|
|
453
|
+
category: 'kotlin',
|
|
454
|
+
impact: 'high',
|
|
455
|
+
fix: 'Specify the Kotlin version in Gradle plugins, version catalogs, or build properties.',
|
|
456
|
+
check: (ctx) => {
|
|
457
|
+
if (!hasAndroidKotlinSurface(ctx)) return null;
|
|
458
|
+
return /kotlin(?:\(["'][^)]+["']\))?\s+version\s+["'][^"']+["']|org\.jetbrains\.kotlin\.[\w.-]+\s+version\s+["'][^"']+["']|kotlin\s*=\s*["'][^"']+["']/i.test(androidGradleText(ctx));
|
|
459
|
+
},
|
|
460
|
+
}),
|
|
461
|
+
[makeKey('KotlinLintConfigured')]: makeCheck({
|
|
462
|
+
platform,
|
|
463
|
+
id: makeId('KT', 3),
|
|
464
|
+
name: 'ktlint/detekt configured',
|
|
465
|
+
category: 'kotlin',
|
|
466
|
+
impact: 'medium',
|
|
467
|
+
fix: 'Configure ktlint or detekt in Gradle or CI so Kotlin style and static-analysis rules stay consistent.',
|
|
468
|
+
check: (ctx) => {
|
|
469
|
+
if (!hasAndroidKotlinSurface(ctx)) return null;
|
|
470
|
+
return hasMatchingFile(ctx, /(^|[\\/])\.?detekt\.ya?ml$/i) ||
|
|
471
|
+
/ktlint|detekt/i.test(androidGradleText(ctx) + '\n' + workflowText(ctx));
|
|
472
|
+
},
|
|
473
|
+
}),
|
|
474
|
+
[makeKey('KotlinAndroidTestsDocumented')]: makeCheck({
|
|
475
|
+
platform,
|
|
476
|
+
id: makeId('KT', 4),
|
|
477
|
+
name: 'Android test framework documented',
|
|
478
|
+
category: 'kotlin',
|
|
479
|
+
impact: 'high',
|
|
480
|
+
fix: 'Document the Android test stack such as JUnit, Espresso, Robolectric, or `connectedAndroidTest` in repo guidance.',
|
|
481
|
+
check: (ctx) => hasAndroidKotlinSurface(ctx)
|
|
482
|
+
? /androidtest|connectedandroidtest|espresso|robolectric|junit|gradlew test/i.test(projectText(ctx, docs))
|
|
483
|
+
: null,
|
|
484
|
+
}),
|
|
485
|
+
[makeKey('KotlinGradleWrapperCommitted')]: makeCheck({
|
|
486
|
+
platform,
|
|
487
|
+
id: makeId('KT', 5),
|
|
488
|
+
name: 'Gradle wrapper committed (gradlew)',
|
|
489
|
+
category: 'kotlin',
|
|
490
|
+
impact: 'high',
|
|
491
|
+
fix: 'Commit `gradlew` and the Gradle wrapper files so Android builds are reproducible across environments.',
|
|
492
|
+
check: (ctx) => hasAndroidKotlinSurface(ctx)
|
|
493
|
+
? hasMatchingFile(ctx, /(^|[\\/])gradlew(?:\.bat)?$/i)
|
|
494
|
+
: null,
|
|
495
|
+
}),
|
|
496
|
+
[makeKey('KotlinBuildVariantsDocumented')]: makeCheck({
|
|
497
|
+
platform,
|
|
498
|
+
id: makeId('KT', 6),
|
|
499
|
+
name: 'Build variants documented',
|
|
500
|
+
category: 'kotlin',
|
|
501
|
+
impact: 'medium',
|
|
502
|
+
fix: 'Document Android build types and product flavors so agents know how to target debug, release, and environment variants.',
|
|
503
|
+
check: (ctx) => hasAndroidKotlinSurface(ctx)
|
|
504
|
+
? /build variant|build type|productflavors|flavor|debug|release|staging/i.test(projectText(ctx, docs) + '\n' + androidGradleText(ctx))
|
|
505
|
+
: null,
|
|
506
|
+
}),
|
|
507
|
+
[makeKey('KotlinProguardConfigured')]: makeCheck({
|
|
508
|
+
platform,
|
|
509
|
+
id: makeId('KT', 7),
|
|
510
|
+
name: 'ProGuard/R8 configuration',
|
|
511
|
+
category: 'kotlin',
|
|
512
|
+
impact: 'medium',
|
|
513
|
+
fix: 'Add ProGuard or R8 configuration such as `proguard-rules.pro` and minification settings for release builds.',
|
|
514
|
+
check: (ctx) => {
|
|
515
|
+
if (!hasAndroidKotlinSurface(ctx)) return null;
|
|
516
|
+
return hasMatchingFile(ctx, /(^|[\\/])proguard-rules\.pro$/i) ||
|
|
517
|
+
/proguardFiles|minifyEnabled|isMinifyEnabled|shrinkResources|r8/i.test(androidGradleText(ctx));
|
|
518
|
+
},
|
|
519
|
+
}),
|
|
520
|
+
[makeKey('KotlinUiApproachDocumented')]: makeCheck({
|
|
521
|
+
platform,
|
|
522
|
+
id: makeId('KT', 8),
|
|
523
|
+
name: 'Compose vs XML approach documented',
|
|
524
|
+
category: 'kotlin',
|
|
525
|
+
impact: 'medium',
|
|
526
|
+
fix: 'Document whether the Android UI is Jetpack Compose, XML layouts, or hybrid so generated changes follow the right pattern.',
|
|
527
|
+
check: (ctx) => {
|
|
528
|
+
if (!hasAndroidKotlinSurface(ctx)) return null;
|
|
529
|
+
const signals = kotlinComposeSignals(ctx);
|
|
530
|
+
const hasCompose = /compose\s*=\s*true|@Composable|androidx\.compose/i.test(signals);
|
|
531
|
+
const hasXml = hasMatchingFile(ctx, /(^|[\\/])src[\\/].+[\\/]res[\\/]layout[\\/].+\.xml$/i);
|
|
532
|
+
if (!hasCompose && !hasXml) return null;
|
|
533
|
+
return /compose|xml|jetpack compose|layout xml|viewbinding/i.test(projectText(ctx, docs));
|
|
534
|
+
},
|
|
535
|
+
}),
|
|
536
|
+
[makeKey('KotlinSigningDocumented')]: makeCheck({
|
|
537
|
+
platform,
|
|
538
|
+
id: makeId('KT', 9),
|
|
539
|
+
name: 'Signing config documented',
|
|
540
|
+
category: 'kotlin',
|
|
541
|
+
impact: 'high',
|
|
542
|
+
fix: 'Document Android release signing, keystores, and environment variable expectations for mobile delivery.',
|
|
543
|
+
check: (ctx) => hasAndroidKotlinSurface(ctx)
|
|
544
|
+
? /signingconfig|keystore|release signing|upload key|signing/i.test(projectText(ctx, docs))
|
|
545
|
+
: null,
|
|
546
|
+
}),
|
|
547
|
+
[makeKey('KotlinGitignore')]: makeCheck({
|
|
548
|
+
platform,
|
|
549
|
+
id: makeId('KT', 10),
|
|
550
|
+
name: 'Android-specific .gitignore',
|
|
551
|
+
category: 'kotlin',
|
|
552
|
+
impact: 'medium',
|
|
553
|
+
fix: 'Add Android-specific ignore rules such as `.gradle/`, `local.properties`, and IDE build artifacts to `.gitignore`.',
|
|
554
|
+
check: (ctx) => {
|
|
555
|
+
if (!hasAndroidKotlinSurface(ctx)) return null;
|
|
556
|
+
const gitignore = fileContent(ctx, '.gitignore');
|
|
557
|
+
return /\.gradle\/|local\.properties|\*\.iml|captures\/|build_file_checksums\.ser/i.test(gitignore);
|
|
558
|
+
},
|
|
559
|
+
}),
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
module.exports = {
|
|
564
|
+
buildStackChecks,
|
|
565
|
+
};
|