Skip to content

fix: detect configFiles in subdirectories with deep scan fallback#98

Open
vishalpatel1994 wants to merge 1 commit into
midudev:mainfrom
vishalpatel1994:fix/config-files-deep-detection
Open

fix: detect configFiles in subdirectories with deep scan fallback#98
vishalpatel1994 wants to merge 1 commit into
midudev:mainfrom
vishalpatel1994:fix/config-files-deep-detection

Conversation

@vishalpatel1994
Copy link
Copy Markdown
Contributor

What Changed

Added existsDeep() to lib.ts — a recursive directory scanner that serves as an automatic fallback when the root-level configFiles check misses.

Updated detectTechnologiesInDir() so that configFiles detection now:

  1. Checks the project root first (fast, existing behaviour)
  2. If missed, falls back to a deep scan up to 3 directory levels, skipping node_modules, .git, Pods, etc.

No changes to skills-map.ts entries or the public API — existing config just works.

Why This Change

configFiles detection previously called existsSync(join(dir, fileName)), which only checks the project root. This silently missed real-world Apple platform projects where Package.swift or Podfile live in a subdirectory:

Project type File location Before After
CocoaPods iOS (repo root = parent folder) ProjectName/Podfile ❌ not detected ✅ swiftui
React Native ios/Podfile ❌ not detected ✅ swiftui
SPM sub-package Packages/DesignSystem/Package.swift ❌ not detected ✅ swiftui
Standard SPM project Package.swift (root) ✅ works ✅ works

Testing Done

  • 343/343 tests pass (node --test 'tests/*.test.ts')
  • 11 new tests added: existsDeep unit tests + SwiftUI deep-detection integration tests
  • Verified against 2 real CocoaPods projects (SkillCare, Jumper) at all nesting depths
Path: /ProjectRoot              → Detected: [swiftui, ruby] ✅
Path: /ProjectRoot/ProjectName  → Detected: [swiftui, ruby] ✅
Path: /ProjectRoot/ProjectName/ProjectName (Podfile at root) → Detected: [swiftui, ruby] ✅

Type of Change

  • fix: Bug fix (non-breaking — no API or config changes)

Security & Quality Checklist

  • No secrets or API keys committed
  • Follows the project's coding standards
  • No sensitive data exposed in logs or output

Documentation

No documentation changes needed — this is an internal detection improvement with no public API changes.

@vishalpatel1994 vishalpatel1994 force-pushed the fix/config-files-deep-detection branch from 6ee833b to 1f975db Compare April 21, 2026 11:57
Previously, configFiles detection only checked the project root using
existsSync(join(dir, fileName)). This silently missed Apple platform
projects where Package.swift or Podfile live in a subdirectory (e.g.
ios/Podfile in React Native, or Packages/DesignSystem/Package.swift in
SPM-based projects).

Changes:
- Add existsDeep() helper that recursively scans subdirectories up to
  depth 3, skipping SCAN_SKIP_DIRS (node_modules, .git, Pods, etc.)
- Wire it into detectTechnologiesInDir() as an automatic fallback: root
  check runs first (fast), deep scan only runs if root check misses
- No API or config changes — existing skills-map.ts entries work as-is
- Add 11 new tests (existsDeep unit tests + SwiftUI deep-detection tests)

Verified against real CocoaPods projects (SkillCare, Jumper) at all
nesting depths — all correctly detected as swiftui without any changes
to the calling code.
@vishalpatel1994 vishalpatel1994 force-pushed the fix/config-files-deep-detection branch from 1f975db to 8d70f43 Compare April 22, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant