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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ kiro-history -p 3000

# Don't open browser automatically
kiro-history --no-open

# Listen on all interfaces (accessible from other devices on your network)
kiro-history --host 0.0.0.0
```

### Source Selection
Expand Down Expand Up @@ -96,6 +99,7 @@ kiro-history --source ide ~/path/to/kiro.kiroagent
| `path` | Custom path to database file (CLI) or sessions directory (IDE) | Auto-detected |
| `-s, --source <type>` | Source type: `cli`, `ide`, or `auto` | `auto` |
| `-p, --port <number>` | Port to run the server on | Random available port |
| `--host <address>` | Host address to bind to | `127.0.0.1` |
| `--no-open` | Don't open browser automatically | Opens browser |
| `-V, --version` | Show version number | - |
| `-h, --help` | Show help | - |
Expand Down
4 changes: 3 additions & 1 deletion server/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ export async function main(): Promise<void> {
.argument('[path]', 'Custom path to the database file (CLI) or sessions directory (IDE)')
.option('-p, --port <number>', 'Port to run the server on (default: auto)')
.option('-s, --source <type>', 'Source type: cli, ide, or auto (default: auto)', 'auto')
.option('--host <address>', 'Host address to bind to (default: 127.0.0.1)', '127.0.0.1')
.option('--no-open', 'Do not open browser automatically')
.action(async (userPath?: string, options?: { port?: string; open?: boolean; source?: string }) => {
.action(async (userPath?: string, options?: { port?: string; open?: boolean; source?: string; host?: string }) => {
const sourceOption = (options?.source || 'auto') as SourceType;
const source = sourceOption === 'auto' ? detectSource() : sourceOption as 'cli' | 'ide';

Expand Down Expand Up @@ -162,6 +163,7 @@ export async function main(): Promise<void> {
const { port, close: closeServer } = await startServer({
reader,
port: requestedPort,
hostname: options?.host,
sourceType: source,
alternateReader,
alternateSourceType,
Expand Down
4 changes: 3 additions & 1 deletion server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,16 @@ export function createApp(options: ServerOptions): Hono {
}

export async function startServer(
options: ServerOptions & { port?: number }
options: ServerOptions & { port?: number; hostname?: string }
): Promise<{ port: number; close: () => void }> {
const app = createApp(options);
const hostname = options.hostname || '127.0.0.1';

return new Promise((resolve) => {
const server = serve({
fetch: app.fetch,
port: options.port || 0, // Use specified port or let OS assign
hostname,
}, (info) => {
resolve({
port: info.port,
Expand Down