routie dev init since i didn't adhere to any proper guidance up until now
This commit is contained in:
+136
@@ -0,0 +1,136 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.run = run;
|
||||
const yargs_1 = __importDefault(require("yargs"));
|
||||
const helpers_1 = require("yargs/helpers");
|
||||
const handlers_1 = require("./handlers");
|
||||
const index_1 = require("../agents/index");
|
||||
/**
|
||||
* Sets up and parses CLI commands.
|
||||
*/
|
||||
function run() {
|
||||
(0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
||||
.scriptName('ruler')
|
||||
.usage('$0 <command> [options]')
|
||||
.command('apply', 'Apply ruler configurations to supported AI agents', (y) => {
|
||||
return y
|
||||
.option('project-root', {
|
||||
type: 'string',
|
||||
description: 'Project root directory',
|
||||
default: process.cwd(),
|
||||
})
|
||||
.option('agents', {
|
||||
type: 'string',
|
||||
description: `Comma-separated list of agent identifiers: ${(0, index_1.getAgentIdentifiersForCliHelp)()}`,
|
||||
})
|
||||
.option('config', {
|
||||
type: 'string',
|
||||
description: 'Path to TOML configuration file',
|
||||
})
|
||||
.option('mcp', {
|
||||
type: 'boolean',
|
||||
description: 'Enable or disable applying MCP server config',
|
||||
default: true,
|
||||
})
|
||||
.alias('mcp', 'with-mcp')
|
||||
.option('mcp-overwrite', {
|
||||
type: 'boolean',
|
||||
description: 'Replace (not merge) the native MCP config(s)',
|
||||
default: false,
|
||||
})
|
||||
.option('gitignore', {
|
||||
type: 'boolean',
|
||||
description: 'Enable/disable automatic .gitignore updates (default: enabled)',
|
||||
})
|
||||
.option('gitignore-local', {
|
||||
type: 'boolean',
|
||||
description: 'Write generated ignore entries to .git/info/exclude instead of .gitignore',
|
||||
})
|
||||
.option('verbose', {
|
||||
type: 'boolean',
|
||||
description: 'Enable verbose logging',
|
||||
default: false,
|
||||
})
|
||||
.alias('verbose', 'v')
|
||||
.option('dry-run', {
|
||||
type: 'boolean',
|
||||
description: 'Preview changes without writing files',
|
||||
default: false,
|
||||
})
|
||||
.option('local-only', {
|
||||
type: 'boolean',
|
||||
description: 'Only search for local .ruler directories, ignore global config',
|
||||
default: false,
|
||||
})
|
||||
.option('nested', {
|
||||
type: 'boolean',
|
||||
description: 'Enable nested rule loading from nested .ruler directories (default: from config or disabled)',
|
||||
})
|
||||
.option('backup', {
|
||||
type: 'boolean',
|
||||
description: 'Enable/disable creation of .bak backup files (default: enabled)',
|
||||
default: true,
|
||||
})
|
||||
.option('skills', {
|
||||
type: 'boolean',
|
||||
description: 'Enable/disable skills support (experimental, default: enabled)',
|
||||
});
|
||||
}, handlers_1.applyHandler)
|
||||
.command('init', 'Scaffold a .ruler directory with default files', (y) => {
|
||||
return y
|
||||
.option('project-root', {
|
||||
type: 'string',
|
||||
description: 'Project root directory',
|
||||
default: process.cwd(),
|
||||
})
|
||||
.option('global', {
|
||||
type: 'boolean',
|
||||
description: 'Initialize in global config directory (XDG_CONFIG_HOME/ruler)',
|
||||
default: false,
|
||||
});
|
||||
}, handlers_1.initHandler)
|
||||
.command('revert', 'Revert ruler configurations from supported AI agents', (y) => {
|
||||
return y
|
||||
.option('project-root', {
|
||||
type: 'string',
|
||||
description: 'Project root directory',
|
||||
default: process.cwd(),
|
||||
})
|
||||
.option('agents', {
|
||||
type: 'string',
|
||||
description: `Comma-separated list of agent identifiers: ${(0, index_1.getAgentIdentifiersForCliHelp)()}`,
|
||||
})
|
||||
.option('config', {
|
||||
type: 'string',
|
||||
description: 'Path to TOML configuration file',
|
||||
})
|
||||
.option('keep-backups', {
|
||||
type: 'boolean',
|
||||
description: 'Keep backup files after revert',
|
||||
default: false,
|
||||
})
|
||||
.option('verbose', {
|
||||
type: 'boolean',
|
||||
description: 'Enable verbose logging',
|
||||
default: false,
|
||||
})
|
||||
.alias('verbose', 'v')
|
||||
.option('dry-run', {
|
||||
type: 'boolean',
|
||||
description: 'Preview changes without writing files',
|
||||
default: false,
|
||||
})
|
||||
.option('local-only', {
|
||||
type: 'boolean',
|
||||
description: 'Only search for local .ruler directories, ignore global config',
|
||||
default: false,
|
||||
});
|
||||
}, handlers_1.revertHandler)
|
||||
.demandCommand(1, 'You need to specify a command')
|
||||
.help()
|
||||
.strict()
|
||||
.parse();
|
||||
}
|
||||
Reference in New Issue
Block a user