k0-board 0.1.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.
Files changed (67) hide show
  1. package/.claude/skills/k0-import/SKILL.md +83 -0
  2. package/CHANGELOG.md +57 -0
  3. package/LICENSE +21 -0
  4. package/README.md +688 -0
  5. package/bin/k0-board.js +456 -0
  6. package/bin/prompt.js +41 -0
  7. package/menubar/Info.plist +25 -0
  8. package/menubar/K0MenuBar.swift +561 -0
  9. package/menubar/build.sh +28 -0
  10. package/package.json +45 -0
  11. package/platform/contract.js +134 -0
  12. package/platform/darwin/extras.js +254 -0
  13. package/platform/darwin/index.js +24 -0
  14. package/platform/darwin/metrics.js +59 -0
  15. package/platform/darwin/power.js +133 -0
  16. package/platform/darwin/service.js +143 -0
  17. package/platform/darwin/shell.js +59 -0
  18. package/platform/darwin/terminal.js +324 -0
  19. package/platform/index.js +97 -0
  20. package/platform/linux/index.js +60 -0
  21. package/platform/linux/metrics.js +88 -0
  22. package/platform/linux/power.js +137 -0
  23. package/platform/linux/service.js +111 -0
  24. package/platform/linux/shell.js +97 -0
  25. package/platform/linux/tray.py +229 -0
  26. package/platform/shared/command.js +26 -0
  27. package/platform/shared/ps.js +40 -0
  28. package/platform/shared/run.js +99 -0
  29. package/platform/shared/tmux.js +242 -0
  30. package/platform/win32/index.js +53 -0
  31. package/platform/win32/metrics.js +72 -0
  32. package/platform/win32/power.js +109 -0
  33. package/platform/win32/powershell.js +44 -0
  34. package/platform/win32/service.js +111 -0
  35. package/platform/win32/shell.js +64 -0
  36. package/platform/win32/terminal.js +209 -0
  37. package/platform/win32/tray.ps1 +159 -0
  38. package/server/db.js +262 -0
  39. package/server/files.js +488 -0
  40. package/server/git.js +157 -0
  41. package/server/index.js +636 -0
  42. package/server/launcher.js +121 -0
  43. package/server/machine.js +213 -0
  44. package/server/mode.js +182 -0
  45. package/server/paths.js +67 -0
  46. package/server/pdf.js +110 -0
  47. package/server/projects.js +152 -0
  48. package/server/sessions.js +341 -0
  49. package/server/watcher.js +200 -0
  50. package/web/base.css +134 -0
  51. package/web/board.css +561 -0
  52. package/web/board.js +777 -0
  53. package/web/favicon.js +41 -0
  54. package/web/favicon.svg +8 -0
  55. package/web/files.css +535 -0
  56. package/web/files.html +63 -0
  57. package/web/files.js +877 -0
  58. package/web/fonts/caveat-latin-ext.woff2 +0 -0
  59. package/web/fonts/caveat-latin.woff2 +0 -0
  60. package/web/fuzzy.js +57 -0
  61. package/web/index.html +112 -0
  62. package/web/md.js +238 -0
  63. package/web/mentions.js +188 -0
  64. package/web/refs.js +176 -0
  65. package/web/title.js +26 -0
  66. package/web/units.js +33 -0
  67. package/web/view.js +248 -0
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: k0-import
3
+ description: Fills the k0 board with Claude Code sessions that have already happened, one card per session, working out a title and a description by reading the conversation. Takes at most the 10 most recent sessions per repository from the last 14 days, skips automated runs and anything already imported, and asks for the go-ahead before creating any cards. Use this skill when the user types "/k0-import" or says "import my sessions", "load my old sessions into k0", "fill the board with what I have already done", "pick up the sessions I opened outside k0". Do not use it to create a card for new work: that is what the + on the dashboard is for.
4
+ ---
5
+
6
+ # /k0-import [days] [max per repo]
7
+
8
+ Takes Claude Code sessions that have already happened — including the ones opened by hand,
9
+ outside k0 — and makes them appear on the board as yellow cards, one per session, with a title
10
+ and a description saying what it was about and where it got to.
11
+
12
+ - `[days]` — how far back to go. With no arguments: **14**.
13
+ - `[max per repo]` — at most how many sessions per repository. With no arguments: **10**.
14
+
15
+ ## Procedure
16
+
17
+ 1. **Ask the server what there is to import.**
18
+
19
+ ```bash
20
+ PORT="${K0_PORT:-4319}"
21
+ curl -sS --max-time 120 "http://127.0.0.1:$PORT/api/sessions/candidates?days=14&per_repo=10" \
22
+ -o "$SCRATCH/k0-candidates.json"
23
+ ```
24
+
25
+ `127.0.0.1`, not `k0.localhost`: browsers resolve that name by themselves, `curl` does not.
26
+ `$SCRATCH` is the session's scratch directory.
27
+
28
+ If `curl` cannot connect, the k0 server is not running: say so (`k0-board start`, or the
29
+ tray icon → *Restart*) and **stop**. The scan can take a few seconds: that is normal, it is
30
+ looking at the head of a thousand transcripts.
31
+
32
+ 2. **Read the file.** It is a list of candidates, most recent first. For each one you get:
33
+ `session_id`, `project_path`, `project_name`, `alive`, `started_at`, `ended_at`, `turns`,
34
+ `title_hint` (the name the session already has, if it has one), `first_prompt`,
35
+ `recent_prompts` (the last few exchanges) and `last_reply` (the last thing Claude said).
36
+
37
+ If the list is empty, say there is nothing new to import and **stop**.
38
+
39
+ 3. **Show what you found and wait for the go-ahead.** One line per repository with how many
40
+ sessions, and the total. Create nothing before the user has said yes.
41
+
42
+ 4. **Write a title and a description for each session**, by reading the digest — not by
43
+ copying the first prompt.
44
+
45
+ - `title` — 2 to 5 words, 60 characters at most, saying what it is about. Write it
46
+ readably ("Reply to the vendor"): the server normalises it into the shape k0 uses for
47
+ session names. If the digest is not enough to make sense of it, use `title_hint`.
48
+ - `description` — one or two lines: what the session was about and where it got to.
49
+ **In the language the session was held in**, which you can tell from the user's messages
50
+ in the digest. Do not translate.
51
+ - For a session that is still running (`alive: true`), write it in the present tense.
52
+
53
+ Work in batches of about 20 candidates, so the last one gets the same attention as the first.
54
+
55
+ 5. **Create the cards.**
56
+
57
+ ```bash
58
+ curl -sS -X POST "http://127.0.0.1:$PORT/api/sessions/import" \
59
+ -H 'content-type: application/json' -d @"$SCRATCH/k0-import.json"
60
+ ```
61
+
62
+ where `k0-import.json` is `{"items": [...]}` and every item has `session_id`,
63
+ `project_path`, `title`, `description`, `started_at`, `ended_at` — the last four copied
64
+ straight from the candidate. If there are many candidates, send several calls of about 30
65
+ items each.
66
+
67
+ The answer says `created` and `skipped` (with the reason for every one skipped).
68
+
69
+ 6. **Close the account.** How many cards were born, and that on the board they are yellow:
70
+ they are picked up again with **Resume**, which reopens the conversation where it left off,
71
+ and cleared away with **Done**.
72
+
73
+ ## Rules
74
+
75
+ - **Do not invent.** If the digest does not make it clear what happened, say so in the
76
+ description instead of filling it with guesses.
77
+ - **Do not touch cards that already exist.** This skill only creates: no `PATCH`, no `DELETE`.
78
+ Sessions already imported are skipped by the server itself.
79
+ - **No files outside the scratch directory.**
80
+ - Automated runs — `claude -p`, subagents, skills launched from a script — do not even reach
81
+ the candidate list: the server drops them. Do not try to recover them.
82
+ - If the user passes numbers (`/k0-import 30 5`), they are `days` and `per_repo`: put them in
83
+ the query in step 1.
package/CHANGELOG.md ADDED
@@ -0,0 +1,57 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the version numbers follow
5
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0]
10
+
11
+ The first public release. k0 existed for a while as one person's tool before this; what changed
12
+ here is everything that had to change for it to be somebody else's tool as well.
13
+
14
+ ### Added
15
+
16
+ - **Linux and Windows.** Everything that talks to the operating system now sits behind one small
17
+ contract (`platform/contract.js`), with an adapter per platform. Linux drives terminals through
18
+ tmux; Windows through PowerShell and Windows Terminal. Both are written but **untested by the
19
+ author**, who has neither machine — see the README.
20
+ - **`k0-board`, one command to install.** It replaces a 400-line shell script, runs on all three
21
+ platforms, and says everything it is about to change before it changes any of it.
22
+ - **`k0-board doctor`**, which prints what your machine can and cannot do, and why.
23
+ - **A capability report on the board.** Where a platform cannot do something — control the lid,
24
+ resize a terminal's font, read what is on its screen — k0 says so instead of offering a button
25
+ that quietly does nothing.
26
+ - **The first-run invitation to import.** The installer offers to fill the board from the Claude
27
+ Code sessions already on the machine, so it does not open empty.
28
+ - MIT licence, contributing guide, code of conduct, security policy, issue templates and
29
+ continuous integration on macOS, Linux and Windows.
30
+ - `CLAUDE.md`, the house rules: English everywhere, no dependencies, and what has to be written
31
+ down before a piece of work counts as finished.
32
+
33
+ ### Changed
34
+
35
+ - **Everything readable is in English**: the interface, the documentation, the messages, and the
36
+ comments in the code.
37
+ - **The database moved out of the project directory** into `~/.k0/` (`%LOCALAPPDATA%\k0` on
38
+ Windows), along with the logs and the cache. An existing database is moved there automatically
39
+ the first time the new version starts.
40
+ - The mode is called `mode` rather than `modo` throughout — the endpoint, the JSON, the
41
+ preference. An existing preference is migrated, so an upgraded k0 does not forget where it was.
42
+ - The handwriting font is bundled instead of being fetched from a font service on every load. k0
43
+ now makes no network requests at all.
44
+
45
+ ### Fixed
46
+
47
+ - **The API no longer answers web pages.** It used to send a wildcard CORS header on a route that
48
+ serves files from your repositories, which let any site on the internet read them. The header is
49
+ gone, and requests are now checked against the `Host` and `Origin` they arrive with.
50
+
51
+ ### Removed
52
+
53
+ - The personal fixtures k0 grew up on. `test/clean.test.mjs` now fails the build if any of them
54
+ come back.
55
+
56
+ [Unreleased]: https://github.com/alessio-ragni/k0-board/compare/v0.1.0...HEAD
57
+ [0.1.0]: https://github.com/alessio-ragni/k0-board/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alessio Ragni
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.