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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Enable swarm mode (via `tengu_brass_pebble`) (#414) - @mike1858
- Add a `--restore`/`--revert` flag to undo patches and restore original CC installation (#431) - @bl-ue
- Redesign `--apply` output (#433) - @bl-ue
- Remove interactive apply in favor of more detailed `--apply` (#434) - @bl-ue

## [v3.4.0](https://github.com/Piebald-AI/tweakcc/releases/tag/v3.4.0) - 2026-01-18

Expand Down
45 changes: 43 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,39 @@ import {
} from './installationBackup';
import { clearAllAppliedHashes } from './systemPromptHashIndex';

// =============================================================================
// Invocation Command Detection
// =============================================================================

/**
* Detects how the user invoked tweakcc to show the correct --apply command.
* Handles: tweakcc, npx tweakcc, pnpm dlx tweakcc, yarn dlx tweakcc, etc.
*/
function getInvocationCommand(): string {
const args = process.argv;

// args[0] is the node executable, args[1] is the script path
// For npx/pnpm/yarn, the script path often contains clues
const scriptPath = args[1] || '';

// Check for package manager dlx/npx patterns in the path
if (scriptPath.includes('npx') || scriptPath.includes('.npm/_npx')) {
return 'npx tweakcc';
}
if (scriptPath.includes('pnpm') || scriptPath.includes('.pnpm')) {
return 'pnpm dlx tweakcc';
}
if (scriptPath.includes('yarn')) {
return 'yarn dlx tweakcc';
}
if (scriptPath.includes('bun')) {
return 'bunx tweakcc';
}

// Default to just 'tweakcc' (globally installed or via PATH)
return 'tweakcc';
}

// =============================================================================
// Patch Results Display
// =============================================================================
Expand Down Expand Up @@ -57,7 +90,9 @@ function printPatchResults(results: PatchResult[]): void {
}
}

console.log('\nPatches applied:');
console.log(
'\nPatches applied (run with --show-unchanged to show all patches):'
);

for (const group of groupOrder) {
const groupResults = byGroup.get(group)!;
Expand Down Expand Up @@ -383,8 +418,14 @@ async function startApp(
);
}

const invocationCommand = getInvocationCommand();

render(
<App startupCheckInfo={startupCheckInfo} configMigrated={configMigrated} />
<App
startupCheckInfo={startupCheckInfo}
configMigrated={configMigrated}
invocationCommand={invocationCommand}
/>
);
}

Expand Down
1 change: 0 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ export interface StartupCheckInfo {
}

export enum MainMenuItem {
APPLY_CHANGES = '*Apply customizations',
THEMES = 'Themes',
THINKING_VERBS = 'Thinking verbs',
THINKING_STYLE = 'Thinking style',
Expand Down
22 changes: 4 additions & 18 deletions src/ui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
updateConfigFile,
} from '../config';
import { openInExplorer, revealFileInExplorer } from '../utils';
import { applyCustomization, ApplyCustomizationResult } from '../patches/index';
import { DEFAULT_SETTINGS } from '../defaultSettings';
import {
restoreNativeBinaryFromBackup,
Expand All @@ -40,9 +39,11 @@ export const SettingsContext = createContext({
export default function App({
startupCheckInfo,
configMigrated,
invocationCommand,
}: {
startupCheckInfo: StartupCheckInfo;
configMigrated: boolean;
invocationCommand: string;
}) {
const [config, setConfig] = useState<TweakccConfig>({
settings: DEFAULT_SETTINGS,
Expand Down Expand Up @@ -131,23 +132,6 @@ Please reapply your changes below.`,
const handleMainSubmit = (item: MainMenuItem) => {
setNotification(null);
switch (item) {
case MainMenuItem.APPLY_CHANGES:
if (startupCheckInfo.ccInstInfo) {
setNotification({
message: 'Applying patches...',
type: 'info',
});
applyCustomization(config, startupCheckInfo.ccInstInfo).then(
(result: ApplyCustomizationResult) => {
setConfig(result.config);
setNotification({
message: 'Customization patches applied successfully!',
type: 'success',
});
}
);
}
break;
case MainMenuItem.THEMES:
case MainMenuItem.THINKING_VERBS:
case MainMenuItem.THINKING_STYLE:
Expand Down Expand Up @@ -211,6 +195,8 @@ Please reapply your changes below.`,
notification={notification}
configMigrated={configMigrated}
showPiebaldAnnouncement={showPiebaldAnnouncement}
changesApplied={config.changesApplied}
invocationCommand={invocationCommand}
/>
) : currentView === MainMenuItem.THEMES ? (
<ThemesView onBack={handleBack} />
Expand Down
21 changes: 2 additions & 19 deletions src/ui/components/MainMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { CONFIG_FILE } from '@/config';
import { MainMenuItem } from '@/types';
import { useContext, useState } from 'react';
import { SettingsContext } from '../App';
import { useState } from 'react';
import { SelectInput, SelectItem } from './SelectInput';

const baseMenuItems: SelectItem[] = [
Expand Down Expand Up @@ -63,23 +62,7 @@ const systemMenuItems: SelectItem[] = [
];

const MainMenu = ({ onSubmit }: { onSubmit: (item: MainMenuItem) => void }) => {
const settings = useContext(SettingsContext);

const menuItems: SelectItem[] = [
...(settings.changesApplied
? []
: [
{
name: MainMenuItem.APPLY_CHANGES,
desc: 'Required: Updates Claude Code in-place with your changes',
selectedStyles: {
color: 'green',
},
},
]),
...baseMenuItems,
...systemMenuItems,
];
const menuItems: SelectItem[] = [...baseMenuItems, ...systemMenuItems];

const [selectedIndex, setSelectedIndex] = useState(0);

Expand Down
13 changes: 13 additions & 0 deletions src/ui/components/MainView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,17 @@ interface MainViewProps {
} | null;
configMigrated: boolean;
showPiebaldAnnouncement: boolean;
changesApplied: boolean;
invocationCommand: string;
}

export const MainView = ({
onSubmit,
notification,
configMigrated,
showPiebaldAnnouncement,
changesApplied,
invocationCommand,
}: MainViewProps) => (
<Box flexDirection="column" gap={1}>
{configMigrated && (
Expand Down Expand Up @@ -119,6 +123,15 @@ export const MainView = ({

{notification && <NotificationBanner notification={notification} />}

{!changesApplied && !notification && (
<NotificationBanner
notification={{
message: `Your changes are configured but not applied.\nRun \`${invocationCommand} --apply\` to apply your customizations!`,
type: 'info',
}}
/>
)}

<MainMenu onSubmit={onSubmit} />
</Box>
);