"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.windowsCursorAgentLine = windowsCursorAgentLine;
exports.helpCommand = helpCommand;
const chalk_1 = __importDefault(require("chalk"));
const github_1 = require("../github");
const git_1 = require("../git");
const platform_1 = require("../platform");
const b = chalk_1.default.bold;
const c = chalk_1.default.cyan;
const d = chalk_1.default.dim;
const g = chalk_1.default.green;
const y = chalk_1.default.yellow;
function ghStatusLine() {
    const remote = (0, git_1.detectRemote)() || 'origin';
    if (!(0, github_1.isGitHubRemote)(remote))
        return '';
    if (!(0, github_1.isGhInstalled)()) {
        return `\n${b('GITHUB CLI')}\n` +
            `  ${chalk_1.default.yellow('!')} Install ${c('gh')} to auto-create PRs: ${c('https://cli.github.com/')}\n`;
    }
    if (!(0, github_1.isGhAuthenticated)()) {
        return `\n${b('GITHUB CLI')}\n` +
            `  ${chalk_1.default.yellow('!')} ${c('gh')} found but not authenticated — run ${c('gh auth login')}\n`;
    }
    return `\n${b('GITHUB CLI')}\n` +
        `  ${g('✓')} ${c('gh')} authenticated — PRs will be created automatically after push\n`;
}
/**
 * Returns the Windows Cursor Agent CLI line for help output.
 * Exported for tests; call with no args to use real platform.
 */
function windowsCursorAgentLine(opts) {
    const win = opts?.isWindows ?? platform_1.isWindows;
    const exists = opts?.agentExists ?? (0, platform_1.commandExists)('agent');
    if (!win)
        return '';
    if (exists) {
        return `\n${b('CURSOR (WINDOWS)')}\n` +
            `  ${g('✓')} ${c('agent')} CLI found — Cursor runner is available\n`;
    }
    return `\n${b('CURSOR (WINDOWS)')}\n` +
        `  ${y('!')} Cursor runner needs the Agent CLI. Install: ${c("irm 'https://cursor.com/install?win32=true' | iex")}\n`;
}
function helpCommand() {
    console.log(`
${b('aidev')} ${d('v0.1.0')} — AI-powered task executor

${b('USAGE')}
  ${c('aidev')} ${d('[command]')}

${b('COMMANDS')}
  ${c('init')}                        Interactive setup — create ${d('.env.aidev')}
  ${c('run')}                         Process all open + pending-with-replies tasks
  ${c('run open')}                    Only open (non-pending) tasks
  ${c('run pending')}                 Only pending tasks — check for human replies
  ${c('run tasks')}                   Publish queued ${d('aidev.tasks.json')} entries and exit
  ${c('tasks add')}                   Queue a new task in ${d('aidev.tasks.json')} (interactive)
  ${c('tasks ls')}                    List queued tasks
  ${c('tasks update')} ${d('[id]')}           Edit a queued task
  ${c('tasks remove')} ${d('[id]')}           Delete a queued task
  ${c('tasks push')}                  Publish all queued tasks now (same as ${c('run tasks')})
  ${c('schedule set')} ${d('<cron>')}         Set cron schedule for this directory
  ${c('schedule get')}                Show current cron schedule
  ${c('help')}                        Show this help message

${b('TRIGGER WORD')}
  When a task is skipped (branch exists or pending with no reply), post a comment
  containing the trigger word ${d('(default: aidev-continue)')} to re-trigger processing.
  The existing branch will be reused. Set ${c('AIDEV_TRIGGER_WORD')} to customise.

${b('HOOKS')}
  Set ${c('AIDEV_HOOKS_PATH')} to a ${d('.ts')} or ${d('.js')} file to run optional async hooks
  ${d('(beforeRun, beforeEachTask, beforeResolveConflicts, …)')}. ${c('aidev init')} creates
  ${d('.aidev/aidev.hooks.ts')} and points this variable at it. Throw from a hook to abort that step.

${b('LOCAL PROVIDER')}
  Set ${c('PROVIDER=local')} in ${d('.env.aidev')} to use file-based task management.
  Tasks live in ${d('.aidev/tasks/')} under status folders: ${c('open')}, ${c('pending')},
  ${c('progress')}, ${c('review')}, ${c('done')}.

  Each task is a markdown file with YAML frontmatter (title, priority, tags, etc.)
  and a description body. Comments are stored in a ${d('.session.md')} companion file.
  To add a comment, append a ${d('## your-name')} section to the session file.
  Add ${c('type: non-code')} to frontmatter for tasks that skip git branching.
  Run ${c('aidev init')} with provider ${c('local')} to create the folder structure.

${b('LOCAL TASKS FILE')}
  ${d('aidev.tasks.json')} queues tasks to publish to your remote provider. Each entry
  has a title, description, type (${c('code')} | ${c('non-code')}), optional priority, tags, and cron.
  Every ${c('aidev run')} publishes pending entries; one-shot entries are removed after
  publishing, cron entries stay and re-publish on schedule. Manage with ${c('aidev tasks')}
  ${d('(add / ls / update / remove / push)')} or edit the JSON file directly.

${b('NON-CODE TASKS')}
  Tasks tagged with the ${c('NON_CODE_TAG')} are executed without git branching —
  no checkout, commit, push, or PR creation. The AI agent runs the task directly
  in the current working directory. Useful for research, documentation, or tasks
  that don't produce code changes requiring review.
  Optionally use a different ClickUp team (${c('NON_CODE_CLICKUP_TEAM_ID')}) or
  Jira project (${c('NON_CODE_JIRA_PROJECT')}) for non-code tasks.
  If ${c('NON_CODE_TAG')} is not set, it defaults to ${d('<folder-name>-other')}.

${b('EXAMPLES')}
  ${d('$')} ${g('aidev init')}
  ${d('$')} ${g('aidev run')}
  ${d('$')} ${g('aidev run open')}
  ${d('$')} ${g('aidev schedule set "*/30 * * * *"')}
  ${d('$')} ${g('aidev schedule get')}

${b('CONFIG')}  ${d('.env.aidev in your project directory')}
  ${d('PROVIDER')}             ${c('clickup')} ${d('(default) | jira | linear | local | monday | notion | trello')}
  ${d('CLICKUP_API_KEY')}      ClickUp personal API token
  ${d('CLICKUP_TEAM_ID')}      Workspace / team ID
  ${d('CLICKUP_TAG')}          Tag used to filter tasks ${d('(default: folder name)')}
  ${d('AGENTS')}               Agent order: ${c('claude,cursor')} ${d('| antigravity | cursor | windsurf | …')}
  ${d('DEV_NOTES_MODE')}       ${c('smart')} ${d('(default) | always')}
  ${d('AIDEV_TRIGGER_WORD')}   Trigger word to re-process a skipped task ${d('(default: aidev-continue)')}
  ${d('AIDEV_HOOKS_PATH')}     Optional hooks module ${d('(default from init: .aidev/aidev.hooks.ts)')}
  ${d('NON_CODE_TAG')}         Tag for non-code tasks ${d('(default: <folder-name>-other)')}
  ${d('GIT_REMOTE')}           Remote name ${d('(auto-detected if unset)')}
  ${d('GITHUB_BASE_BRANCH')}   Base branch ${d('(default: main)')}
  ${d('GITHUB_REPO')}          ${d('owner/repo')} for PR links
${ghStatusLine()}${windowsCursorAgentLine()}
  Run ${c('aidev init')} to configure interactively.
`);
}
//# sourceMappingURL=help.js.map