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
44 changes: 44 additions & 0 deletions bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { hideBin } from 'yargs/helpers';
import { VERSION } from './src/lib/version.js';

const WIZARD_VERSION = VERSION;

Check warning on line 9 in bin.ts

View workflow job for this annotation

GitHub Actions / Lint

Unsafe assignment of an `any` value

const NODE_VERSION_RANGE = '>=18.17.0';

Expand Down Expand Up @@ -267,7 +267,7 @@
const { startPlayground } = await import(
'./src/ui/tui/playground/start-playground.js'
);
(startPlayground as (version: string) => void)(WIZARD_VERSION);

Check warning on line 270 in bin.ts

View workflow job for this annotation

GitHub Actions / Lint

Unsafe argument of type `any` assigned to a parameter of type `string`
})();
} else if (options.skill) {
// Run a specific skill by ID
Expand Down Expand Up @@ -302,6 +302,50 @@
}
},
)
.command('skills <command>', 'Skills management commands', (yargs) => {
return yargs
.command(
'install',
'Fetch PostHog skills from GitHub Releases and install selected skills into .claude/skills/',
(yargs) => {
return yargs.options({
'install-dir': {
describe:
'Directory to install skills in (defaults to current directory).\nSkills are written to {dir}/.claude/skills/ and are scoped to that project.\nTo install globally across all projects, pass your home directory: --install-dir ~\nenv: POSTHOG_WIZARD_INSTALL_DIR',
type: 'string',
},
});
},
(argv) => {
const options = { ...argv };
void (async () => {
try {
const { startTUI } = await import('./src/ui/tui/start-tui.js');
const { buildSession } = await import(
'./src/lib/wizard-session.js'
);
const { Flow } = await import('./src/ui/tui/router.js');

const tui = startTUI(WIZARD_VERSION, Flow.SkillsInstall);

Check warning on line 329 in bin.ts

View workflow job for this annotation

GitHub Actions / Lint

Unsafe argument of type `any` assigned to a parameter of type `string`
const session = buildSession({
debug: options.debug as boolean | undefined,
installDir: options.installDir as string | undefined,
});
tui.store.session = session;
} catch {
setUI(new LoggingUI());
getUI().log.error(
'Skills install requires an interactive terminal (TTY).\n' +
'Please run this command in an interactive terminal.',
);
process.exit(1);
}
})();
},
)
.demandCommand(1, 'You must specify a subcommand (install)')
.help();
})
.command('mcp <command>', 'MCP server management commands', (yargs) => {
return yargs
.command(
Expand Down Expand Up @@ -347,7 +391,7 @@
);

const { Flow } = await import('./src/ui/tui/router.js');
const tui = startTUI(WIZARD_VERSION, Flow.McpAdd);

Check warning on line 394 in bin.ts

View workflow job for this annotation

GitHub Actions / Lint

Unsafe argument of type `any` assigned to a parameter of type `string`
const session = buildSession({
debug: options.debug,
localMcp: options.local,
Expand Down Expand Up @@ -393,7 +437,7 @@
);

const { Flow } = await import('./src/ui/tui/router.js');
const tui = startTUI(WIZARD_VERSION, Flow.McpRemove);

Check warning on line 440 in bin.ts

View workflow job for this annotation

GitHub Actions / Lint

Unsafe argument of type `any` assigned to a parameter of type `string`
const session = buildSession({
debug: options.debug,
localMcp: options.local,
Expand All @@ -419,7 +463,7 @@
// ── Skill-based workflow subcommands (derived from registry) ─────────
for (const wfConfig of getSubcommandWorkflows()) {
cli.command(
wfConfig.command!,

Check warning on line 466 in bin.ts

View workflow job for this annotation

GitHub Actions / Lint

Forbidden non-null assertion
wfConfig.description,
(y) => y.options(skillSubcommandOptions),
(argv) => {
Expand Down Expand Up @@ -457,7 +501,7 @@
const { buildSession } = await import('./src/lib/wizard-session.js');

// flowKey values match Flow enum values by convention
const tui = startTUI(WIZARD_VERSION, config.flowKey as any);

Check warning on line 504 in bin.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type

Check warning on line 504 in bin.ts

View workflow job for this annotation

GitHub Actions / Lint

Unsafe argument of type `any` assigned to a parameter of type `Flow`

Check warning on line 504 in bin.ts

View workflow job for this annotation

GitHub Actions / Lint

Unsafe argument of type `any` assigned to a parameter of type `string`

const session = buildSession({
debug: options.debug as boolean | undefined,
Expand All @@ -469,7 +513,7 @@
apiKey: options.apiKey as string | undefined,
projectId: options.projectId as string | undefined,
menu: options.menu as boolean | undefined,
integration: options.integration as any,

Check warning on line 516 in bin.ts

View workflow job for this annotation

GitHub Actions / Lint

Unsafe assignment of an `any` value
benchmark: options.benchmark as boolean | undefined,
yaraReport: options.yaraReport as boolean | undefined,
});
Expand Down
Loading
Loading