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
30 changes: 27 additions & 3 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,33 @@ main() {
echo ""
success "Firecrawl CLI v${version} installed successfully!"
echo ""
echo " Run 'firecrawl --help' to get started."
echo " Run 'firecrawl login' to authenticate with your API key."
echo ""

# Resolve the binary path (may need updated PATH)
local firecrawl_bin="$install_dir/firecrawl"

# Offer to continue with setup (login, skills, integrations)
if [ -t 0 ] && [ -t 1 ]; then
# Interactive terminal — prompt
echo " Next: authenticate and install AI coding skills."
echo ""
printf " Continue with setup? [Y/n] "
read -r answer </dev/tty || answer=""
echo ""

case "$answer" in
[nN]*)
echo " Run 'firecrawl init --skip-install' later to set up."
echo ""
;;
*)
"$firecrawl_bin" init --skip-install
;;
esac
else
# Non-interactive (piped) — print instructions
echo " Run 'firecrawl init --skip-install' to authenticate and install skills."
echo ""
fi
}

main "$@"
77 changes: 50 additions & 27 deletions src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { isAuthenticated, browserLogin, interactiveLogin } from '../utils/auth';
import { saveCredentials } from '../utils/credentials';
import { updateConfig, getApiKey } from '../utils/config';
import { buildSkillsInstallArgs } from './skills-install';
import { hasNpx, installSkillsNative } from './skills-native';

export interface InitOptions {
global?: boolean;
Expand Down Expand Up @@ -215,19 +216,29 @@ async function stepIntegrations(options: InitOptions): Promise<void> {
switch (integration) {
case 'skills': {
console.log(`\n Setting up skills...`);
const args = buildSkillsInstallArgs({
agent: options.agent,
yes: options.yes || options.all,
global: true,
includeNpxYes: true,
});
try {
execSync(args.join(' '), { stdio: 'inherit' });
console.log(` ${green}✓${reset} Skills installed`);
} catch {
console.error(
' Failed to install skills. Run "firecrawl setup skills" later.'
);
if (hasNpx()) {
const args = buildSkillsInstallArgs({
agent: options.agent,
yes: options.yes || options.all,
global: true,
includeNpxYes: true,
});
try {
execSync(args.join(' '), { stdio: 'inherit' });
console.log(` ${green}✓${reset} Skills installed`);
} catch {
console.error(
' Failed to install skills. Run "firecrawl setup skills" later.'
);
}
} else {
try {
await installSkillsNative();
} catch {
console.error(
' Failed to install skills. Run "firecrawl setup skills" later.'
);
}
}
break;
}
Expand Down Expand Up @@ -616,20 +627,32 @@ async function runNonInteractive(options: InitOptions): Promise<void> {
console.log(
`${stepLabel()} Installing firecrawl skill for AI coding agents...`
);
const args = buildSkillsInstallArgs({
agent: options.agent,
yes: true,
global: true,
includeNpxYes: true,
});
try {
execSync(args.join(' '), { stdio: 'inherit' });
console.log(`${green}✓${reset} Skills installed\n`);
} catch {
console.error(
'\nFailed to install skills. You can retry with: firecrawl setup skills'
);
process.exit(1);
if (hasNpx()) {
const args = buildSkillsInstallArgs({
agent: options.agent,
yes: true,
global: true,
includeNpxYes: true,
});
try {
execSync(args.join(' '), { stdio: 'inherit' });
console.log(`${green}✓${reset} Skills installed\n`);
} catch {
console.error(
'\nFailed to install skills. You can retry with: firecrawl setup skills'
);
process.exit(1);
}
} else {
try {
await installSkillsNative();
console.log('');
} catch {
console.error(
'\nFailed to install skills. You can retry with: firecrawl setup skills'
);
process.exit(1);
}
}
}

Expand Down
33 changes: 24 additions & 9 deletions src/commands/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { execSync } from 'child_process';
import { getApiKey } from '../utils/config';
import { buildSkillsInstallArgs } from './skills-install';
import { hasNpx, installSkillsNative } from './skills-native';

export type SetupSubcommand = 'skills' | 'mcp';

Expand Down Expand Up @@ -40,18 +41,32 @@ export async function handleSetupCommand(
}

async function installSkills(options: SetupOptions): Promise<void> {
const args = buildSkillsInstallArgs({
agent: options.agent,
global: true,
includeNpxYes: true,
});
if (hasNpx()) {
const args = buildSkillsInstallArgs({
agent: options.agent,
global: true,
includeNpxYes: true,
});

const cmd = args.join(' ');
console.log(`Running: ${cmd}\n`);
const cmd = args.join(' ');
console.log(`Running: ${cmd}\n`);

try {
execSync(cmd, { stdio: 'inherit' });
return;
} catch {
process.exit(1);
}
}

// Fallback: native install (no npx/Node required)
try {
execSync(cmd, { stdio: 'inherit' });
} catch {
await installSkillsNative();
} catch (error) {
console.error(
'Failed to install skills:',
error instanceof Error ? error.message : 'Unknown error'
);
process.exit(1);
}
}
Expand Down
Loading