Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

Expand All @@ -47,7 +47,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

Expand All @@ -69,7 +69,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

Expand All @@ -91,7 +91,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

Expand Down Expand Up @@ -182,7 +182,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

Expand Down
76 changes: 0 additions & 76 deletions .github/workflows/publish.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

Expand Down
79 changes: 71 additions & 8 deletions src/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
formatFramework,
formatLanguage,
getVersion,
mapFormatter,
parseArgs,
promptNewProject,
showBanner,
Expand Down Expand Up @@ -350,21 +351,83 @@ describe("formatFramework", () => {
});

// Swift/iOS frameworks
it("formats swiftui correctly", () => {
expect(formatFramework("swiftui")).toBe("swiftui");
it("formats SwiftUI correctly", () => {
expect(formatFramework("swiftui")).toBe("SwiftUI");
});

it("formats uikit correctly", () => {
expect(formatFramework("uikit")).toBe("uikit");
it("formats UIKit correctly", () => {
expect(formatFramework("uikit")).toBe("UIKit");
});

it("formats Vapor correctly", () => {
expect(formatFramework("vapor")).toBe("Vapor");
});

it("formats SwiftData correctly", () => {
expect(formatFramework("swiftdata")).toBe("SwiftData");
});

it("formats Combine correctly", () => {
expect(formatFramework("combine")).toBe("Combine");
});

// Android frameworks
it("formats jetpack-compose correctly", () => {
expect(formatFramework("jetpack-compose")).toBe("jetpack-compose");
it("formats Jetpack Compose correctly", () => {
expect(formatFramework("jetpack-compose")).toBe("Jetpack Compose");
});

it("formats Android Views correctly", () => {
expect(formatFramework("android-views")).toBe("Android Views");
});

it("formats Room correctly", () => {
expect(formatFramework("room")).toBe("Room");
});

it("formats Hilt correctly", () => {
expect(formatFramework("hilt")).toBe("Hilt");
});

it("formats Ktor correctly", () => {
expect(formatFramework("ktor-android")).toBe("Ktor");
});
});

// ============================================================================
// mapFormatter Tests
// ============================================================================

describe("mapFormatter", () => {
it("maps eslint to prettier", () => {
expect(mapFormatter("eslint")).toBe("prettier");
});

it("maps biome to biome", () => {
expect(mapFormatter("biome")).toBe("biome");
});

it("maps ruff to ruff", () => {
expect(mapFormatter("ruff")).toBe("ruff");
});

it("maps flake8 to black", () => {
expect(mapFormatter("flake8")).toBe("black");
});

it("maps clippy to rustfmt", () => {
expect(mapFormatter("clippy")).toBe("rustfmt");
});

it("maps rubocop to rubocop", () => {
expect(mapFormatter("rubocop")).toBe("rubocop");
});

it("maps golangci-lint to gofmt", () => {
expect(mapFormatter("golangci-lint")).toBe("gofmt");
});

it("formats android-views correctly", () => {
expect(formatFramework("android-views")).toBe("android-views");
it("maps null to null", () => {
expect(mapFormatter(null)).toBeNull();
});
});

Expand Down
44 changes: 40 additions & 4 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ import prompts from "prompts";
import { analyzeRepository, summarizeTechStack } from "./analyzer.js";
import { ensureDirectories, writeSettings } from "./generator.js";
import { getAnalysisPrompt } from "./prompt.js";
import type { Args, Framework, Language, NewProjectPreferences, ProjectInfo } from "./types.js";
import type {
Args,
Formatter,
Framework,
Language,
Linter,
NewProjectPreferences,
ProjectInfo,
} from "./types.js";

// ============================================================================
// Constants
Expand Down Expand Up @@ -330,7 +338,7 @@ export async function promptNewProject(args: Args): Promise<NewProjectPreference
packageManager: pmResponse.packageManager || null,
testingFramework: testResponse.testingFramework || null,
linter: lintResponse.linter || null,
formatter: lintResponse.linter || null, // Use same as linter for simplicity
formatter: mapFormatter(lintResponse.linter || null),
projectType: typeResponse.projectType || "Other",
};
}
Expand Down Expand Up @@ -450,6 +458,21 @@ function getLinterFormatterChoices(lang: string) {
return [{ title: "None", value: null }];
}

export function mapFormatter(linter: Linter | null): Formatter | null {
if (!linter) return null;
const mapping: Partial<Record<Linter, Formatter>> = {
eslint: "prettier",
biome: "biome",
ruff: "ruff",
flake8: "black",
pylint: "black",
"golangci-lint": "gofmt",
clippy: "rustfmt",
rubocop: "rubocop",
};
return mapping[linter] ?? null;
}

export function createTaskFile(
projectInfo: ProjectInfo,
preferences: NewProjectPreferences | null
Expand Down Expand Up @@ -535,7 +558,7 @@ export function formatLanguage(lang: Language): string {
}

export function formatFramework(fw: Framework): string {
const names: Record<string, string> = {
const names: Partial<Record<Framework, string>> = {
nextjs: "Next.js",
react: "React",
vue: "Vue.js",
Expand Down Expand Up @@ -567,10 +590,24 @@ export function formatFramework(fw: Framework): string {
sinatra: "Sinatra",
spring: "Spring",
quarkus: "Quarkus",
// Swift/iOS
swiftui: "SwiftUI",
uikit: "UIKit",
vapor: "Vapor",
swiftdata: "SwiftData",
combine: "Combine",
// Android
"jetpack-compose": "Jetpack Compose",
"android-views": "Android Views",
room: "Room",
hilt: "Hilt",
"ktor-android": "Ktor",
// CSS/UI
tailwind: "Tailwind CSS",
shadcn: "shadcn/ui",
chakra: "Chakra UI",
mui: "Material UI",
// Database/ORM
prisma: "Prisma",
drizzle: "Drizzle",
typeorm: "TypeORM",
Expand Down Expand Up @@ -615,7 +652,6 @@ export function runClaudeAnalysis(projectDir: string, projectInfo: ProjectInfo):
"claude",
[
"-p",
"--dangerously-skip-permissions",
"--allowedTools",
"Read",
"--allowedTools",
Expand Down
Loading