@ywldan/kiro 0.3.0 → 0.3.1

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.
@@ -0,0 +1,96 @@
1
+ import { homedir } from 'node:os';
2
+ import path from 'node:path';
3
+ import { formatSessionTime } from '../sessions.js';
4
+ /** Rows the inline session picker reserves below the transcript. */
5
+ export const SESSION_INLINE_ROWS = 13;
6
+ export function sessionCounts(data) {
7
+ return {
8
+ current: data.current.length,
9
+ others: data.others.reduce((total, group) => total + group.sessions.length, 0),
10
+ };
11
+ }
12
+ export function sessionTabLabel(scope, counts) {
13
+ return scope === 'current'
14
+ ? `This directory (${counts.current})`
15
+ : `Other directories (${counts.others})`;
16
+ }
17
+ /** Home-relative path so other directories read short in the picker. */
18
+ export function shortCwd(cwd, currentCwd) {
19
+ const resolved = path.resolve(cwd);
20
+ if (resolved === path.resolve(currentCwd))
21
+ return '.';
22
+ const home = homedir();
23
+ if (resolved === home)
24
+ return '~';
25
+ if (resolved.startsWith(`${home}${path.sep}`))
26
+ return `~${resolved.slice(home.length)}`;
27
+ return resolved;
28
+ }
29
+ /** Case-insensitive multi-term search across title, id, and directory. */
30
+ export function filterSessions(sessions, query) {
31
+ const terms = query.toLowerCase().split(/\s+/).filter(Boolean);
32
+ if (terms.length === 0)
33
+ return sessions;
34
+ return sessions.filter((session) => {
35
+ const haystack = `${session.title} ${session.id} ${session.cwd} ${session.profile} ${session.model}`.toLowerCase();
36
+ return terms.every((term) => haystack.includes(term));
37
+ });
38
+ }
39
+ export function sessionRowText(session, active) {
40
+ const marker = active ? '*' : ' ';
41
+ const count = `${session.messageCount} msg${session.messageCount === 1 ? '' : 's'}`;
42
+ return `${marker} ${session.id.slice(0, 8)} ${formatSessionTime(session.updatedAt)} ${count} ${session.title}`;
43
+ }
44
+ /** Display rows for one tab; other directories get a header per cwd. */
45
+ export function buildSessionRows(data, scope, currentCwd, query = '') {
46
+ if (scope === 'current') {
47
+ return filterSessions(data.current, query).map((session) => ({
48
+ kind: 'session',
49
+ scope,
50
+ session,
51
+ }));
52
+ }
53
+ const rows = [];
54
+ for (const group of data.others) {
55
+ const sessions = filterSessions(group.sessions, query);
56
+ if (sessions.length === 0)
57
+ continue;
58
+ rows.push({
59
+ kind: 'header',
60
+ scope,
61
+ text: `${shortCwd(group.cwd, currentCwd)} (${sessions.length})`,
62
+ });
63
+ for (const session of sessions)
64
+ rows.push({ kind: 'session', scope, session });
65
+ }
66
+ return rows;
67
+ }
68
+ export function sessionRowLines(rows) {
69
+ return rows.flatMap((row, index) => (row.kind === 'session' ? [index] : []));
70
+ }
71
+ export function sessionRowItems(rows) {
72
+ return rows.flatMap((row) => (row.kind === 'session' ? [row.session] : []));
73
+ }
74
+ /** Same as profileRange, counting sessions while skipping directory headers. */
75
+ export function sessionRange(rows, start, end) {
76
+ const lines = sessionRowLines(rows);
77
+ const above = lines.filter((line) => line < start).length;
78
+ const visible = lines.filter((line) => line >= start && line < end).length;
79
+ return {
80
+ above,
81
+ below: lines.length - above - visible,
82
+ first: visible === 0 ? 0 : above + 1,
83
+ last: above + visible,
84
+ total: lines.length,
85
+ };
86
+ }
87
+ export function sessionEmptyText(scope, query, hasSessions) {
88
+ if (query.trim())
89
+ return `No sessions match "${query}". Backspace to edit, Esc to clear.`;
90
+ if (hasSessions)
91
+ return '';
92
+ return scope === 'current'
93
+ ? 'No saved sessions for this directory.'
94
+ : 'No sessions from other directories.';
95
+ }
96
+ //# sourceMappingURL=session-picker.js.map
package/package.json CHANGED
@@ -1,61 +1,61 @@
1
- {
2
- "name": "@ywldan/kiro",
3
- "version": "0.3.0",
4
- "description": "A small terminal coding agent with your own OpenAI-compatible endpoint",
5
- "keywords": [
6
- "ai",
7
- "agent",
8
- "cli",
9
- "coding-agent",
10
- "openai",
11
- "terminal",
12
- "tui"
13
- ],
14
- "license": "MIT",
15
- "author": "ywildan",
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/ywildan/kiro.git"
19
- },
20
- "homepage": "https://github.com/ywildan/kiro#readme",
21
- "bugs": {
22
- "url": "https://github.com/ywildan/kiro/issues"
23
- },
24
- "type": "module",
25
- "bin": {
26
- "kiro": "dist/index.js"
27
- },
28
- "main": "dist/index.js",
29
- "files": [
30
- "dist",
31
- "!dist/**/*.map",
32
- "README.md"
33
- ],
34
- "engines": {
35
- "node": ">=20"
36
- },
37
- "publishConfig": {
38
- "access": "public"
39
- },
40
- "scripts": {
41
- "build": "tsc -p tsconfig.json",
42
- "dev": "tsx src/index.tsx",
43
- "test": "tsx test/e2e.ts",
44
- "mock": "tsx test/mock-server.ts",
45
- "prepublishOnly": "npm run build"
46
- },
47
- "dependencies": {
48
- "diff": "^9.0.0",
49
- "ink": "^6.8.0",
50
- "react": "^19.3.1",
51
- "string-width": "^8.3.0",
52
- "wrap-ansi": "^10.0.2"
53
- },
54
- "devDependencies": {
55
- "@types/diff": "^8.0.0",
56
- "@types/node": "^24.10.0",
57
- "@types/react": "^19.3.0",
58
- "tsx": "^4.23.15",
59
- "typescript": "^5.9.3"
60
- }
61
- }
1
+ {
2
+ "name": "@ywldan/kiro",
3
+ "version": "0.3.1",
4
+ "description": "A small terminal coding agent with your own OpenAI-compatible endpoint",
5
+ "keywords": [
6
+ "ai",
7
+ "agent",
8
+ "cli",
9
+ "coding-agent",
10
+ "openai",
11
+ "terminal",
12
+ "tui"
13
+ ],
14
+ "license": "MIT",
15
+ "author": "ywildan",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/ywildan/kiro.git"
19
+ },
20
+ "homepage": "https://github.com/ywildan/kiro#readme",
21
+ "bugs": {
22
+ "url": "https://github.com/ywildan/kiro/issues"
23
+ },
24
+ "type": "module",
25
+ "bin": {
26
+ "kiro": "dist/index.js"
27
+ },
28
+ "main": "dist/index.js",
29
+ "files": [
30
+ "dist",
31
+ "!dist/**/*.map",
32
+ "README.md"
33
+ ],
34
+ "engines": {
35
+ "node": ">=20"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "scripts": {
41
+ "build": "tsc -p tsconfig.json",
42
+ "dev": "tsx src/index.tsx",
43
+ "test": "tsx test/e2e.ts",
44
+ "mock": "tsx test/mock-server.ts",
45
+ "prepublishOnly": "npm run build"
46
+ },
47
+ "dependencies": {
48
+ "diff": "^9.0.0",
49
+ "ink": "^6.8.0",
50
+ "react": "^19.3.1",
51
+ "string-width": "^8.3.0",
52
+ "wrap-ansi": "^10.0.2"
53
+ },
54
+ "devDependencies": {
55
+ "@types/diff": "^8.0.0",
56
+ "@types/node": "^24.10.0",
57
+ "@types/react": "^19.3.0",
58
+ "tsx": "^4.23.15",
59
+ "typescript": "^5.9.3"
60
+ }
61
+ }