Skip to content
Open
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
2 changes: 2 additions & 0 deletions run.vbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Set shell = CreateObject("WScript.Shell")
shell.Run "wsl bash -c ""cd /mnt/f/claudia/claudia/src-tauri/target/release && ./claudia""", 0, False
5 changes: 4 additions & 1 deletion scripts/build-executables.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ const PLATFORMS = {
async function runCommand(command, args) {
return new Promise((resolve, reject) => {
console.log(`Running: ${command} ${args.join(' ')}`);
const child = spawn(command, args, { stdio: 'inherit' });
const child = spawn(command, args, {
stdio: 'inherit',
shell: process.platform === 'win32'
});

child.on('error', reject);
child.on('exit', (code) => {
Expand Down
2,584 changes: 2,584 additions & 0 deletions scripts/cli.js

Large diffs are not rendered by default.

98 changes: 73 additions & 25 deletions scripts/fetch-and-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,41 @@
*/

import { spawn } from 'child_process';
import { mkdir, rm, readdir, copyFile, access } from 'fs/promises';
import { mkdir, rm, readdir, copyFile, access, stat } from 'fs/promises';
import { existsSync } from 'fs';
import { join, resolve } from 'path';

/**
* Cross-platform recursive directory copy function
* @param {string} src - Source directory path
* @param {string} dest - Destination directory path
*/
async function copyDirectory(src, dest) {
try {
// Create destination directory
await mkdir(dest, { recursive: true });

// Read the source directory
const entries = await readdir(src, { withFileTypes: true });

// Copy each entry
for (const entry of entries) {
const srcPath = join(src, entry.name);
const destPath = join(dest, entry.name);

if (entry.isDirectory()) {
// Recursively copy subdirectory
await copyDirectory(srcPath, destPath);
} else {
// Copy file
await copyFile(srcPath, destPath);
}
}
} catch (error) {
throw new Error(`Failed to copy directory from ${src} to ${dest}: ${error.message}`);
}
}

/**
* Execute a shell command and return a promise
* @param {string} command - The command to execute
Expand Down Expand Up @@ -55,7 +86,7 @@ async function runCommand(command, args = [], options = {}) {
}

/**
* Check if a file or directory exists
* Check if a path exists
* @param {string} path - Path to check
* @returns {Promise<boolean>}
*/
Expand All @@ -69,42 +100,61 @@ async function pathExists(path) {
}

/**
* Parse command line arguments to extract version and platform
* Parse command line arguments
* @param {string[]} args - Command line arguments
* @returns {object} - Parsed arguments with platform and version
* @returns {object} - Parsed arguments
*/
function parseArguments(args) {
let platform = 'all';
let version = null;
const platform = args.find(arg => !arg.startsWith('--')) || 'all';

for (const arg of args) {
if (arg.startsWith('--version=')) {
version = arg.split('=')[1];
} else if (!arg.startsWith('--')) {
platform = arg;
}
}
// Extract version from --version=X.X.X format
const versionArg = args.find(arg => arg.startsWith('--version='));
const version = versionArg ? versionArg.split('=')[1] : null;

return { platform, version };
}

/**
* Determine the Claude Code version to use
* @param {string|null} cliVersion - Version from CLI argument
* @returns {string} - The version to use
* @param {string|null} cliVersion - Version specified via CLI
* @returns {string} - Version to use
*/
function determineClaudeCodeVersion(cliVersion) {
const defaultVersion = '1.0.41';

if (cliVersion) {
console.log(`\n🔍 Using Claude Code version from CLI argument: ${cliVersion}`);
console.log(`Using CLI-specified version: ${cliVersion}`);
return cliVersion;
}

console.log(`\n🔍 Using default Claude Code version: ${defaultVersion}`);
// Default version
const defaultVersion = '1.0.41';
console.log(`Using default version: ${defaultVersion}`);
return defaultVersion;
}

/**
* Cross-platform tar extraction using Node.js
* @param {string} tarballPath - Path to the tarball
* @param {string} extractDir - Directory to extract to
*/
async function extractTarball(tarballPath, extractDir) {
if (process.platform === 'win32') {
// On Windows, try to use tar if available (Windows 10+ has built-in tar)
try {
await runCommand('tar', ['-xzf', tarballPath], { cwd: extractDir });
} catch (error) {
// If tar fails, try using PowerShell
console.log('Built-in tar failed, trying PowerShell...');
await runCommand('powershell', [
'-Command',
`Expand-Archive -Path "${tarballPath}" -DestinationPath "${extractDir}" -Force`
]);
}
} else {
// On Unix/Linux/macOS, use tar
await runCommand('tar', ['-xzf', tarballPath], { cwd: extractDir });
}
}

/**
* Download and extract the Claude Code package from npm
* @param {string} version - The version of the Claude Code package to download
Expand Down Expand Up @@ -142,11 +192,9 @@ async function fetchClaudeCodePackage(version) {

console.log(`Found tarball: ${tarball}`);

// Extract the tarball
// Extract the tarball using cross-platform method
console.log('Extracting package...');
await runCommand('tar', ['-xzf', tarball], {
cwd: tempDir
});
await extractTarball(join(tempDir, tarball), tempDir);

// Verify extraction
if (!(await pathExists(packageDir))) {
Expand Down Expand Up @@ -207,8 +255,8 @@ async function copyRequiredFiles(packageDir) {
await rm(destPath, { recursive: true, force: true });
}

// Copy directory recursively using cp command
await runCommand('cp', ['-r', srcPath, destPath]);
// Copy directory recursively using cross-platform function
await copyDirectory(srcPath, destPath);
} else {
console.warn(`Warning: ${dir}/ directory not found in package`);
}
Expand Down
150 changes: 150 additions & 0 deletions scripts/generate-icons-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# PowerShell script to generate Windows ICO files from PNG source
# This script creates a proper ICO file that works with Windows Resource Compiler

param(
[Parameter(Mandatory=$true)]
[string]$InputPng,

[Parameter(Mandatory=$true)]
[string]$OutputIco
)

# Load System.Drawing assembly
Add-Type -AssemblyName System.Drawing

function Create-MultiSizeIcon {
param(
[string]$SourcePath,
[string]$OutputPath
)

try {
# Load the source image
$sourceImage = [System.Drawing.Image]::FromFile($SourcePath)

# Create various sizes for the ICO file
$sizes = @(16, 24, 32, 48, 64, 128, 256)
$iconImages = @()

foreach ($size in $sizes) {
# Create a bitmap for this size
$bitmap = New-Object System.Drawing.Bitmap($size, $size)
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)

# Set high quality rendering
$graphics.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
$graphics.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::HighQuality
$graphics.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::HighQuality

# Draw the scaled image
$graphics.DrawImage($sourceImage, 0, 0, $size, $size)

# Convert to icon
$hIcon = $bitmap.GetHicon()
$icon = [System.Drawing.Icon]::FromHandle($hIcon)

# Save this size
$iconImages += $icon

# Cleanup
$graphics.Dispose()
$bitmap.Dispose()
}

# Create the final ICO file with multiple sizes
$fileStream = [System.IO.FileStream]::new($OutputPath, [System.IO.FileMode]::Create)

# ICO file header
$iconHeader = New-Object byte[] 6
$iconHeader[0] = 0 # Reserved
$iconHeader[1] = 0 # Reserved
$iconHeader[2] = 1 # ICO file type
$iconHeader[3] = 0 # ICO file type
$iconHeader[4] = [byte]$iconImages.Count # Number of images
$iconHeader[5] = 0 # Number of images (high byte)

$fileStream.Write($iconHeader, 0, 6)

# Calculate offset for image data
$imageOffset = 6 + ($iconImages.Count * 16) # Header + directory entries

# Write directory entries
for ($i = 0; $i -lt $iconImages.Count; $i++) {
$icon = $iconImages[$i]
$size = $sizes[$i]

# Get icon data
$iconStream = New-Object System.IO.MemoryStream
$icon.Save($iconStream)
$iconData = $iconStream.ToArray()
$iconStream.Close()

# Directory entry
$dirEntry = New-Object byte[] 16
$dirEntry[0] = if ($size -eq 256) { 0 } else { [byte]$size } # Width
$dirEntry[1] = if ($size -eq 256) { 0 } else { [byte]$size } # Height
$dirEntry[2] = 0 # Color palette
$dirEntry[3] = 0 # Reserved
$dirEntry[4] = 1 # Color planes
$dirEntry[5] = 0 # Color planes (high byte)
$dirEntry[6] = 32 # Bits per pixel
$dirEntry[7] = 0 # Bits per pixel (high byte)

# Size of image data
$dataSize = $iconData.Length
$dirEntry[8] = [byte]($dataSize -band 0xFF)
$dirEntry[9] = [byte](($dataSize -shr 8) -band 0xFF)
$dirEntry[10] = [byte](($dataSize -shr 16) -band 0xFF)
$dirEntry[11] = [byte](($dataSize -shr 24) -band 0xFF)

# Offset to image data
$dirEntry[12] = [byte]($imageOffset -band 0xFF)
$dirEntry[13] = [byte](($imageOffset -shr 8) -band 0xFF)
$dirEntry[14] = [byte](($imageOffset -shr 16) -band 0xFF)
$dirEntry[15] = [byte](($imageOffset -shr 24) -band 0xFF)

$fileStream.Write($dirEntry, 0, 16)
$imageOffset += $dataSize
}

# Write image data
foreach ($icon in $iconImages) {
$iconStream = New-Object System.IO.MemoryStream
$icon.Save($iconStream)
$iconData = $iconStream.ToArray()
$fileStream.Write($iconData, 0, $iconData.Length)
$iconStream.Close()
}

$fileStream.Close()

# Cleanup
$sourceImage.Dispose()
foreach ($icon in $iconImages) {
$icon.Dispose()
}

Write-Host "✓ Successfully created ICO file: $OutputPath"
return $true

} catch {
Write-Error "Failed to create ICO file: $($_.Exception.Message)"
return $false
}
}

# Main execution
if (-not (Test-Path $InputPng)) {
Write-Error "Input PNG file not found: $InputPng"
exit 1
}

$result = Create-MultiSizeIcon -SourcePath $InputPng -OutputPath $OutputIco

if ($result) {
Write-Host "ICO file generated successfully!"
exit 0
} else {
Write-Error "Failed to generate ICO file"
exit 1
}
Binary file not shown.
1 change: 1 addition & 0 deletions scripts/temp-claude-package/package/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
© Anthropic PBC. All rights reserved. Use is subject to Anthropic's [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms).
41 changes: 41 additions & 0 deletions scripts/temp-claude-package/package/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Claude Code

![](https://img.shields.io/badge/Node.js-18%2B-brightgreen?style=flat-square) [![npm]](https://www.npmjs.com/package/@anthropic-ai/claude-code)

[npm]: https://img.shields.io/npm/v/@anthropic-ai/claude-code.svg?style=flat-square

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows -- all through natural language commands. Use it in your terminal, IDE, or tag @claude on Github.

**Learn more in the [official documentation](https://docs.anthropic.com/en/docs/claude-code/overview)**.

<img src="https://github.com/anthropics/claude-code/blob/main/demo.gif?raw=1" />

## Get started

1. Install Claude Code:

```sh
npm install -g @anthropic-ai/claude-code
```

2. Navigate to your project directory and run `claude`.

## Reporting Bugs

We welcome feedback during this beta period. Use the `/bug` command to report issues directly within Claude Code, or file a [GitHub issue](https://github.com/anthropics/claude-code/issues).

## Data collection, usage, and retention

When you use Claude Code, we collect feedback, which includes usage data (such as code acceptance or rejections), associated conversation data, and user feedback submitted via the `/bug` command.

### How we use your data

We may use feedback to improve our products and services, but we will not train generative models using your feedback from Claude Code. Given their potentially sensitive nature, we store user feedback transcripts for only 30 days.

If you choose to send us feedback about Claude Code, such as transcripts of your usage, Anthropic may use that feedback to debug related issues and improve Claude Code's functionality (e.g., to reduce the risk of similar bugs occurring in the future).

### Privacy safeguards

We have implemented several safeguards to protect your data, including limited retention periods for sensitive information, restricted access to user session data, and clear policies against using feedback for model training.

For full details, please review our [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms) and [Privacy Policy](https://www.anthropic.com/legal/privacy).
Loading