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
2 changes: 1 addition & 1 deletion src/lib/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class AuthError extends CLIError {

export class ProjectNotLinkedError extends CLIError {
constructor() {
super('No project linked. Run `insforge projects link` first.', 3, 'PROJECT_NOT_LINKED');
super('No project linked. Run `insforge link` first.', 3, 'PROJECT_NOT_LINKED');
}
}

Expand Down
36 changes: 36 additions & 0 deletions src/lib/skills.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
import { exec } from 'node:child_process';
import { existsSync, readFileSync, appendFileSync } from 'node:fs';
import { join } from 'node:path';
import { promisify } from 'node:util';
import * as clack from '@clack/prompts';

const execAsync = promisify(exec);

const GITIGNORE_ENTRIES = [
'.insforge',
'.agent',
'.agents',
'.augment',
'.claude',
'.cline',
'.github/copilot*',
'.kilocode',
'.qoder',
'.qwen',
'.roo',
'.trae',
'.windsurf',
];

function updateGitignore(): void {
const gitignorePath = join(process.cwd(), '.gitignore');
const existing = existsSync(gitignorePath) ? readFileSync(gitignorePath, 'utf-8') : '';
const lines = new Set(existing.split('\n').map((l) => l.trim()));

const missing = GITIGNORE_ENTRIES.filter((entry) => !lines.has(entry));
if (!missing.length) return;

const block = `\n# InsForge & AI agent skills\n${missing.join('\n')}\n`;
appendFileSync(gitignorePath, block);
}

export async function installSkills(json: boolean): Promise<void> {
try {
if (!json) clack.log.info('Installing InsForge agent skills...');
Expand All @@ -15,4 +45,10 @@ export async function installSkills(json: boolean): Promise<void> {
} catch {
if (!json) clack.log.warn('Failed to install agent skills. You can run manually: npx skills add insforge/agent-skills');
}

try {
updateGitignore();
} catch {
// non-critical, silently ignore
}
}
Loading