Skip to content

feat(toolchain): Swift (SPM) + Flutter/Dart gate detection (F-e4159959)#218

Open
yuyu04 wants to merge 2 commits into
qwerfunch:developfrom
yuyu04:feature/swift-flutter-toolchain
Open

feat(toolchain): Swift (SPM) + Flutter/Dart gate detection (F-e4159959)#218
yuyu04 wants to merge 2 commits into
qwerfunch:developfrom
yuyu04:feature/swift-flutter-toolchain

Conversation

@yuyu04

@yuyu04 yuyu04 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

What

Swift and Flutter/Dart projects matched no manifest in the polyglot detection CHAIN, so detectToolchain returned 'unknown' and every command stage skipped — no type/lint/test/coverage/secret gating whatsoever. Adds first-class detection for both.

swift — Package.swift (SPM)

gate command
type swift build
lint swiftlint lint
test swift test
coverage swift test --enable-code-coverage
secret gitleaks detect --no-banner
arch — (SPM resolves module imports acyclically, like rust/go/kotlin)

Xcode-only apps (no Package.swift) override via .cladding/config.yaml::gate.commands — matching .xcodeproj here would wrongly point swift build at a project SPM can't drive, so detection stays SPM-honest.

dart — pubspec.yaml (Flutter and pure Dart)

A gates thunk reads pubspec.yaml to pick the toolchain:

  • Flutter (flutter: stanza or sdk: flutter): flutter analyze / flutter test / flutter test --coverage
  • pure Dart: dart analyze / dart test / dart test --coverage=coverage
  • both: lint = dart format --output=none --set-exit-if-changed ., secret = gitleaks, no arch

Type-safety

Adds 'swift' | 'dart' to the Language union. Partial<Record<Language,…>> (language-config) and all-optional ToolchainGates keep 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

  • Feature F-e4159959 (4 ACs, EARS-compliant), bound to detect.ts + types.ts.

Tests

  • 4 new cases in tests/stages/toolchain.test.ts, authored impl-blind in a separate context.
  • clad done F-e4159959strict pre-push gate GREEN (rebased onto develop, re-verified).

⚠️ Stacked on #217

This branch sits on top of #217 (jest/madge) — both touch the detect.ts CHAIN. 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

@yuyu04 yuyu04 force-pushed the feature/swift-flutter-toolchain branch from c4c4971 to 7cb215d Compare June 30, 2026 03:13
yuyu04 and others added 2 commits July 2, 2026 10:25
…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>
@yuyu04 yuyu04 force-pushed the feature/swift-flutter-toolchain branch from 7cb215d to 00a8423 Compare July 2, 2026 01:26
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