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
9 changes: 6 additions & 3 deletions src/commands/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ function isLocalPath(source: string): boolean {
source.startsWith('/') ||
source.startsWith('./') ||
source.startsWith('../') ||
source.startsWith('~/')
source.startsWith('~/') ||
source.startsWith('~\\') || // Windows home directory with backslash
/^[a-zA-Z]:[/\\]/.test(source) // Windows drive (C:/ or C:\)
);
}

Expand Down Expand Up @@ -56,10 +58,11 @@ function getRepoName(repoUrl: string): string | null {
}

/**
* Expand ~ to home directory
* Expand ~ to home directory and normalize path
*/
function expandPath(source: string): string {
if (source.startsWith('~/')) {
// Support both Unix (~/) and Windows (~\) tilde notation
if (source.startsWith('~/') || source.startsWith('~\\')) {
return join(homedir(), source.slice(2));
}
return resolve(source);
Expand Down
17 changes: 15 additions & 2 deletions src/commands/sync.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
import { dirname, basename } from 'path';
import { dirname, basename, resolve, join } from 'path';
import { homedir } from 'os';
import chalk from 'chalk';
import { checkbox } from '@inquirer/prompts';
import { ExitPromptError } from '@inquirer/core';
Expand All @@ -12,11 +13,23 @@ export interface SyncOptions {
output?: string;
}

/**
* Expand ~ to home directory and resolve path
*/
function expandPath(path: string): string {
// Support both Unix (~/) and Windows (~\) tilde notation
if (path.startsWith('~/') || path.startsWith('~\\')) {
return join(homedir(), path.slice(2));
}
return resolve(path);
}

/**
* Sync installed skills to a markdown file
*/
export async function syncAgentsMd(options: SyncOptions = {}): Promise<void> {
const outputPath = options.output || 'AGENTS.md';
const rawOutputPath = options.output || 'AGENTS.md';
const outputPath = expandPath(rawOutputPath);
const outputName = basename(outputPath);

// Validate output file is markdown
Expand Down