@hype/clod 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -43,6 +43,13 @@ clod
43
43
 
44
44
  ## Usage
45
45
 
46
+ `clod` takes no arguments. Running it launches the session browser. Two flags print and exit:
47
+
48
+ | Flag | Action |
49
+ |------|--------|
50
+ | `-h`, `--help` | Print usage |
51
+ | `-v`, `--version` | Print version |
52
+
46
53
  ### Keys
47
54
 
48
55
  | Key | Action |
package/dist/cli.js ADDED
@@ -0,0 +1,28 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { dirname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ // The linked bin runs from anywhere, so resolve relative to this module.
5
+ const PACKAGE_FILE = join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json');
6
+ export function parseArgs(argv) {
7
+ if (argv.includes('-h') || argv.includes('--help'))
8
+ return 'help';
9
+ if (argv.includes('-v') || argv.includes('--version'))
10
+ return 'version';
11
+ return 'launch';
12
+ }
13
+ export async function readPackage(file = PACKAGE_FILE) {
14
+ const pkg = JSON.parse(await readFile(file, 'utf8'));
15
+ return { version: pkg.version, description: pkg.description, homepage: pkg.homepage };
16
+ }
17
+ export function helpText(pkg) {
18
+ return `clod - ${pkg.description}
19
+
20
+ Usage: clod [options]
21
+
22
+ Options:
23
+ -h, --help Show help
24
+ -v, --version Show version
25
+
26
+ Run with no arguments to launch the session browser.
27
+ Keybindings and usage: ${pkg.homepage}`;
28
+ }
package/dist/index.js CHANGED
@@ -1,6 +1,16 @@
1
1
  #!/usr/bin/env node
2
- import { loadConfig } from "./config.js";
3
- import { listSessionFiles, parseSessions } from "./sessions.js";
2
+ import { helpText, parseArgs, readPackage } from './cli.js';
3
+ import { loadConfig } from './config.js';
4
+ import { listSessionFiles, parseSessions } from './sessions.js';
5
+ const action = parseArgs(process.argv.slice(2));
6
+ if (action === 'help') {
7
+ console.log(helpText(await readPackage()));
8
+ process.exit(0);
9
+ }
10
+ if (action === 'version') {
11
+ console.log((await readPackage()).version);
12
+ process.exit(0);
13
+ }
4
14
  // Parse enough newest sessions to fill a viewport; stream the rest in later.
5
15
  const FIRST_BATCH = 40;
6
16
  const files = await listSessionFiles();
@@ -14,7 +24,7 @@ const loadRest = files.length > FIRST_BATCH ? () => parseSessions(files.slice(FI
14
24
  const [{ default: React }, { render }, { default: App }, config] = await Promise.all([
15
25
  import('react'),
16
26
  import('ink'),
17
- import("./ui.js"),
27
+ import('./ui.js'),
18
28
  loadConfig()
19
29
  ]);
20
30
  // Object holder: TS narrows a reassigned `let` back to null after the closure,
package/dist/list.js CHANGED
@@ -1,4 +1,4 @@
1
- import { fmtTokens, relativeTime, shortPath } from "./sessions.js";
1
+ import { fmtTokens, relativeTime, shortPath } from './sessions.js';
2
2
  // items[i] is always a session here: callers skip headers before calling.
3
3
  const sessionIdAt = (items, i) => items[i].session.sessionId;
4
4
  // below these widths a column is hidden rather than truncated into noise
package/dist/sessions.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { appendFile, readdir, readFile, stat, writeFile } from 'node:fs/promises';
2
2
  import { homedir } from 'node:os';
3
3
  import { basename, join } from 'node:path';
4
- import { trashPaths } from "./trash.js";
4
+ import { trashPaths } from './trash.js';
5
5
  // Resolved lazily so tests can point $HOME at a fixture tree; os.homedir()
6
6
  // honors $HOME on posix, read afresh each call.
7
7
  const claudeDir = () => join(homedir(), '.claude');
package/dist/stats.js CHANGED
@@ -1,4 +1,4 @@
1
- import { throughputOf } from "./sessions.js";
1
+ import { throughputOf } from './sessions.js';
2
2
  const SPARK = ' ▁▂▃▄▅▆▇█';
3
3
  export function bar(value, max, width) {
4
4
  const n = max > 0 ? Math.round((value / max) * width) : 0;
package/dist/ui.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { Box, Text, useApp, useInput, useStdout } from 'ink';
2
2
  import React from 'react';
3
- import { saveConfig } from "./config.js";
4
- import { buildDisplayItems, computeNavigate, computePage, computeRowLayout, ctxStr, filterItems, findAdjacentSessionId, nextSortMode, pad, termSize, truncate, usedStr } from "./list.js";
5
- import { deleteSession, fmtTokens, getSessionMessages, MONTHS, relativeTime, renameSession, shortPath } from "./sessions.js";
6
- import { bar, computeStats, sparkline } from "./stats.js";
3
+ import { saveConfig } from './config.js';
4
+ import { buildDisplayItems, computeNavigate, computePage, computeRowLayout, ctxStr, filterItems, findAdjacentSessionId, nextSortMode, pad, termSize, truncate, usedStr } from './list.js';
5
+ import { deleteSession, fmtTokens, getSessionMessages, MONTHS, relativeTime, renameSession, shortPath } from './sessions.js';
6
+ import { bar, computeStats, sparkline } from './stats.js';
7
7
  const h = React.createElement;
8
8
  const { useState, useEffect, useMemo, memo } = React;
9
9
  const HINT_HEIGHT = 1;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hype/clod",
3
3
  "description": "Terminal UI for managing Claude Code sessions.",
4
- "version": "1.1.0",
4
+ "version": "1.2.0",
5
5
  "author": "Nate Goldman <ungoldman@gmail.com>",
6
6
  "bin": {
7
7
  "clod": "./dist/index.js"
@@ -17,7 +17,7 @@
17
17
  "@types/node": "^22.20.0",
18
18
  "@types/react": "^19.2.17",
19
19
  "ink-testing-library": "^4.0.0",
20
- "typescript": "^6.0.3"
20
+ "typescript": "^7.0.2"
21
21
  },
22
22
  "engines": {
23
23
  "node": ">=22"