opencode-sesh 2.1.0 → 2.1.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.
- package/CHANGELOG.md +7 -0
- package/README.md +11 -1
- package/bin/sesh-costs.sh +0 -1
- package/bin/sesh-delete.sh +4 -12
- package/bin/sesh-list.sh +37 -25
- package/bin/sesh-pins.sh +12 -9
- package/bin/sesh-prune.sh +8 -5
- package/bin/sesh-refresh-worker.sh +4 -1
- package/bin/sesh-waiting.sh +1 -2
- package/bin/sesh.sh +3 -3
- package/dist/tui.js +695 -682
- package/install.sh +24 -19
- package/package.json +4 -4
- package/plugins/sesh-list.ts +2 -2
- package/tui-plugins/sesh-panel/tui.tsx +139 -136
package/install.sh
CHANGED
|
@@ -28,7 +28,7 @@ PLUGIN_VERSION_FALLBACK="2.0.25"
|
|
|
28
28
|
# Peer line the panel was developed and typechecked against. A checkout's
|
|
29
29
|
# package.json overrides these, so dependency bumps cannot drift the installed
|
|
30
30
|
# config out of sync (solid-js moves with OpenTUI via @opentui/keymap's peer).
|
|
31
|
-
OPENTUI_RANGE="^0.5
|
|
31
|
+
OPENTUI_RANGE="^0.6.5"
|
|
32
32
|
SOLID_VERSION="1.9.15"
|
|
33
33
|
if [ -f "$SOURCE_DIR/package.json" ] && command -v jq >/dev/null 2>&1; then
|
|
34
34
|
opentui_range=$(jq -r '.devDependencies["@opentui/solid"] // empty' "$SOURCE_DIR/package.json" 2>/dev/null || true)
|
|
@@ -111,22 +111,28 @@ remove_opencode_entry() {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
# The launcher is a symlink we create. Treat it as ours only when it resolves to
|
|
114
|
-
#
|
|
115
|
-
# on uninstall. Recognized by the exact source path, a `.../bin/sesh` target, or
|
|
116
|
-
# the marker in the target file (covers npm upgrades and a moved checkout).
|
|
114
|
+
# our source or an opencode-sesh package, including relative npm symlinks.
|
|
117
115
|
launcher_is_ours() {
|
|
118
|
-
local link=$1 target
|
|
116
|
+
local link=$1 target hops=0 package directory
|
|
119
117
|
[ -L "$link" ] || return 1
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
118
|
+
while [ -L "$link" ]; do
|
|
119
|
+
hops=$((hops + 1))
|
|
120
|
+
[ "$hops" -le 40 ] || return 1
|
|
121
|
+
target=$(readlink "$link" 2>/dev/null) || return 1
|
|
122
|
+
[ -n "$target" ] || return 1
|
|
123
|
+
case "$target" in
|
|
124
|
+
/*) link=$target ;;
|
|
125
|
+
*) link="$(dirname "$link")/$target" ;;
|
|
126
|
+
esac
|
|
127
|
+
done
|
|
128
|
+
directory=$(cd "$(dirname "$link")" 2>/dev/null && pwd -P) || return 1
|
|
129
|
+
target="$directory/$(basename "$link")"
|
|
130
|
+
[ "$target" = "$SOURCE_DIR/bin/sesh" ] && return 0
|
|
131
|
+
[ -f "$target" ] || return 1
|
|
132
|
+
case "$target" in */bin/sesh) ;; *) return 1 ;; esac
|
|
133
|
+
package="${target%/bin/sesh}/package.json"
|
|
134
|
+
command -v jq >/dev/null 2>&1 && [ -f "$package" ] &&
|
|
135
|
+
jq -e '.name == "opencode-sesh" and .bin.sesh == "bin/sesh"' "$package" >/dev/null 2>&1
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
install_file() {
|
|
@@ -152,10 +158,9 @@ install_tui_panel() {
|
|
|
152
158
|
fi
|
|
153
159
|
plugin_version="${opencode_version:-$PLUGIN_VERSION_FALLBACK}"
|
|
154
160
|
|
|
155
|
-
local
|
|
161
|
+
local opencode_tmp=''
|
|
156
162
|
if [ ! -f "$OPENCODE_JSON" ]; then
|
|
157
163
|
printf '{\n "$schema": "https://opencode.ai/config.json",\n "plugins": []\n}\n' > "$OPENCODE_JSON"
|
|
158
|
-
opencode_created=1
|
|
159
164
|
note "created $OPENCODE_JSON"
|
|
160
165
|
fi
|
|
161
166
|
opencode_tmp=$(mktemp "${TMPDIR:-/tmp}/sesh-opencode.XXXXXX")
|
|
@@ -181,10 +186,9 @@ install_tui_panel() {
|
|
|
181
186
|
# Local plugins resolve their imports from the config directory, and opencode
|
|
182
187
|
# runs `bun install` there at startup. Keep the required packages declared
|
|
183
188
|
# without clobbering versions the user already pinned.
|
|
184
|
-
local
|
|
189
|
+
local pkg_tmp=''
|
|
185
190
|
if [ ! -f "$PACKAGE_JSON" ]; then
|
|
186
191
|
printf '{\n "dependencies": {}\n}\n' > "$PACKAGE_JSON"
|
|
187
|
-
pkg_created=1
|
|
188
192
|
note "created $PACKAGE_JSON"
|
|
189
193
|
fi
|
|
190
194
|
pkg_tmp=$(mktemp "${TMPDIR:-/tmp}/sesh-pkg.XXXXXX")
|
|
@@ -267,6 +271,7 @@ if [ "$SYNC_PANEL" = 1 ]; then
|
|
|
267
271
|
# touching the launcher or requiring fzf/sqlite. No-op when the panel is
|
|
268
272
|
# absent, so `npm install` never adds a TUI panel on its own.
|
|
269
273
|
[ -f "$PANEL_DST" ] || { note "sesh sidebar panel is not installed; nothing to sync."; exit 0; }
|
|
274
|
+
command -v jq >/dev/null 2>&1 || fail "required tool 'jq' is unavailable; install jq and rerun bash install.sh --sync-panel."
|
|
270
275
|
umask 077
|
|
271
276
|
install_tui_panel
|
|
272
277
|
note_restart
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-sesh",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "OpenCode session browser: search, preview, and resume every session across every project from the terminal or TUI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"prepare": "husky",
|
|
57
57
|
"build": "node scripts/build-tui.mjs",
|
|
58
58
|
"prepack": "node scripts/build-tui.mjs",
|
|
59
|
-
"test": "
|
|
60
|
-
"test:unit": "node scripts/build-tui.mjs && bash tests/sesh.sh",
|
|
59
|
+
"test": "bun run test:unit && bash tests/changelog.sh",
|
|
60
|
+
"test:unit": "node scripts/build-tui.mjs && bash tests/sesh.sh && bash tests/install.sh",
|
|
61
61
|
"test:changelog": "bash tests/changelog.sh",
|
|
62
62
|
"test:picker": "python3 tests/picker.py",
|
|
63
63
|
"typecheck": "tsc --noEmit",
|
|
64
64
|
"lint:sh": "for script in bin/*.sh bin/sesh install.sh tests/*.sh scripts/*.sh; do bash -n \"$script\" || exit; done",
|
|
65
|
-
"postinstall": "bash install.sh --sync-panel ||
|
|
65
|
+
"postinstall": "bash install.sh --sync-panel || printf '%s\\n' 'sesh postinstall: panel sync failed; run bash install.sh --sync-panel after resolving the error above.' >&2",
|
|
66
66
|
"prepublishOnly": "bun run test && bun run typecheck"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
package/plugins/sesh-list.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { join } from "node:path"
|
|
|
6
6
|
|
|
7
7
|
function dbPath(): string {
|
|
8
8
|
if (process.env.SESH_DB) return process.env.SESH_DB
|
|
9
|
-
const xdgPath = join(process.env.XDG_DATA_HOME
|
|
9
|
+
const xdgPath = join(process.env.XDG_DATA_HOME || join(homedir(), ".local", "share"), "opencode", "opencode.db")
|
|
10
10
|
if (existsSync(xdgPath)) return xdgPath
|
|
11
11
|
try {
|
|
12
12
|
const result = spawnSync(process.env.SESH_OPENCODE ?? "opencode", ["debug", "paths"], { encoding: "utf8" })
|
|
@@ -59,7 +59,7 @@ export default Plugin.define({
|
|
|
59
59
|
const scoped = typeof args.directory === "string" && args.directory.length > 0
|
|
60
60
|
const query = `SELECT id, title, directory, time_updated AS updated, time_created AS created
|
|
61
61
|
FROM session_v2
|
|
62
|
-
WHERE parent_id
|
|
62
|
+
WHERE COALESCE(parent_id, '') = '' AND COALESCE(time_archived, 0) = 0${scoped ? " AND directory = ?" : ""}
|
|
63
63
|
ORDER BY time_updated DESC, id DESC
|
|
64
64
|
LIMIT ${limit}`
|
|
65
65
|
const rows = scoped ? db.query(query).all(args.directory) : db.query(query).all()
|