| 105 | } |
| 106 | |
| 107 | export function registerExportCommand(parent: Command, deps?: Partial<ExportDeps>): void { |
| 108 | parent |
| 109 | .command('export') |
| 110 | .description('Export a session as a ZIP archive.') |
| 111 | .option('-o, --output <path>', 'Output ZIP path.') |
| 112 | .option('-y, --yes', 'Skip previous-session confirmation.') |
| 113 | .option( |
| 114 | '--no-include-global-log', |
| 115 | 'Skip bundling the active global diagnostic log (~/.kimi-code/logs/kimi-code.log, not rotated .1 files). By default the global log is included.', |
| 116 | ) |
| 117 | .argument('[sessionId]', 'Session id to export. Defaults to the most recent session.') |
| 118 | .action( |
| 119 | async ( |
| 120 | sessionId: string | undefined, |
| 121 | options: { output?: string; yes?: boolean; includeGlobalLog?: boolean }, |
| 122 | ) => { |
| 123 | await handleExport(createDefaultExportDeps(deps), sessionId, options.output, { |
| 124 | yes: options.yes === true, |
| 125 | includeGlobalLog: options.includeGlobalLog !== false, |
| 126 | }); |
| 127 | }, |
| 128 | ); |
| 129 | } |
| 130 | |
| 131 | function createDefaultExportDeps(overrides: Partial<ExportDeps> = {}): ExportDeps { |
| 132 | let harness: KimiHarness | undefined; |