feat(toolchain): Swift (SPM) + Flutter/Dart gate detection (F-e4159959)#218
Open
yuyu04 wants to merge 2 commits into
Open
feat(toolchain): Swift (SPM) + Flutter/Dart gate detection (F-e4159959)#218yuyu04 wants to merge 2 commits into
yuyu04 wants to merge 2 commits into
Conversation
c4c4971 to
7cb215d
Compare
…for JS/TS (F-47b8bee5)
React/JS-family projects resolve to language 'typescript' but the toolchain
defaulted the test gate to vitest unconditionally and scanned only .ts in the
arch (madge) gate. Two silent footguns for React/RN/CRA repos:
- Jest projects hit `npx --no-install vitest`, found nothing, and SILENTLY
skipped stage_2.1 (unit) / stage_2.2 (coverage). Now `resolveTsGates`
detects a jest.config.{js,ts,mjs,cjs,json} file or a `jest` key in
package.json (mirroring resolveTsLint's presence-based detection) and gates
with jest / jest --coverage. No jest config → vitest default unchanged.
- madge `--extensions ts` missed .tsx/.jsx/.js, so circular-dependency
detection was blind to React/JSX component trees. Widened to ts,tsx,js,jsx
(node_modules is excluded by madge default, so no dependency-tree blowup).
Tests authored impl-blind in a separate context (11 new cases in
tests/stages/toolchain.test.ts). strict pre-push gate GREEN.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Swift and Flutter/Dart projects previously matched no manifest in the polyglot CHAIN, so detectToolchain returned 'unknown' and every command stage skipped — no type/lint/test/coverage/secret gating at all. Add two CHAIN entries: - swift: Package.swift (SPM) → swift build / swiftlint lint / swift test / swift test --enable-code-coverage, secret=gitleaks, no arch (SPM resolves module imports acyclically). Xcode-only apps override via gate.commands. - dart: pubspec.yaml → a gates thunk reads the pubspec to pick the flutter wrapper (flutter analyze/test/test --coverage) vs the bare dart CLI (dart analyze/test/test --coverage=coverage). lint = dart format check, secret=gitleaks, no arch. Adds 'swift' | 'dart' to the Language union (Partial<Record<Language>> and all-optional ToolchainGates keep every existing consumer sound). Detector source-layout (language-config.ts) keeps the TS baseline for both, same as rust/go/python today — a noted follow-up, not a regression. Tests authored impl-blind in a separate context (4 new cases). strict pre-push gate GREEN. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
7cb215d to
00a8423
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Swift and Flutter/Dart projects matched no manifest in the polyglot detection CHAIN, so
detectToolchainreturned'unknown'and every command stage skipped — no type/lint/test/coverage/secret gating whatsoever. Adds first-class detection for both.swift— Package.swift (SPM)swift buildswiftlint lintswift testswift test --enable-code-coveragegitleaks detect --no-bannerXcode-only apps (no
Package.swift) override via.cladding/config.yaml::gate.commands— matching.xcodeprojhere would wrongly pointswift buildat a project SPM can't drive, so detection stays SPM-honest.dart— pubspec.yaml (Flutter and pure Dart)A gates thunk reads
pubspec.yamlto pick the toolchain:flutter:stanza orsdk: flutter):flutter analyze/flutter test/flutter test --coveragedart analyze/dart test/dart test --coverage=coveragedart format --output=none --set-exit-if-changed ., secret = gitleaks, no archType-safety
Adds
'swift' | 'dart'to theLanguageunion.Partial<Record<Language,…>>(language-config) and all-optionalToolchainGateskeep every existing consumer sound — no exhaustive switch breaks.Scope note
Detector source-layout (
language-config.ts) keeps the TS baseline for swift/dart, exactly as rust/go/python do today — a noted follow-up (test globs / import matchers for richer ARCHITECTURE_FROM_SPEC + coverage parsing), not a regression.Spec
F-e4159959(4 ACs, EARS-compliant), bound todetect.ts+types.ts.Tests
tests/stages/toolchain.test.ts, authored impl-blind in a separate context.clad done F-e4159959→ strict pre-push gate GREEN (rebased onto develop, re-verified).This branch sits on top of #217 (jest/madge) — both touch the
detect.tsCHAIN. Until #217 merges, this PR's diff shows both commits. Merge #217 first, then this diff reduces to just the Swift/Dart commit.🤖 Generated with Claude Code