even-keel 0.2.0 → 0.2.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 CHANGED
@@ -4,6 +4,18 @@ All notable changes to Even Keel are documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.2.1] - 2026-11-04
8
+
9
+ ### Fixed
10
+
11
+ - **Windows: git or an agent CLI installed while Even Keel runs is found after Restart in the tray**, instead of only after a reboot: the tray host and the Windows service start Even Keel with the system and user `PATH` read anew.
12
+ - The setup's Git step offers the install command of the package manager the machine has (winget, brew, apt and the like) and always the download link from git-scm.com, the link alone where none is found, instead of a winget command on a Windows without winget. On Windows it says what makes Even Keel see a git installed since, by how it was started: Restart in the tray, a restart of the Windows service, or a start from a new terminal.
13
+ - Windows: the README and the guide say to run `npx even-keel` and `even-keel` from cmd, or as `npx.cmd`/`even-keel.cmd` in PowerShell, whose default policy blocks npm's `.ps1` shims; the trust warning in the project wizard and the project's settings says to run its command in cmd.
14
+ - The guide says to run `npx even-keel` from any folder but a clone of Even Keel, where npx looks for the package in the clone itself.
15
+ - A very long line in an OpenCode account log no longer stalls Even Keel for seconds while it reads the log for errors.
16
+ - The keyboard focus ring of a notification's link is drawn whole, a few pixels above its buttons, instead of a clipped line under them.
17
+ - An install from npm with a Huly profile no longer crashes on every start while the Huly client is not installed yet (Huly in `.env` at the first start, or a client folder removed): the service comes up and installs the client.
18
+
7
19
  ## [0.2.0] - 2026-11-03
8
20
 
9
21
  0.2 brings two more agents (OpenCode and GitHub Copilot) and two more trackers (GitLab and Jira), an install with `npx even-keel` that updates from the page, a first-start setup wizard, and Protection and Standards to limit what sessions may do.
package/README.md CHANGED
@@ -77,7 +77,7 @@ Every feature in full: [docs/guide/features.md](docs/guide/features.md).
77
77
  npx even-keel
78
78
  ```
79
79
 
80
- This installs Even Keel globally with npm and sets it up as a service ([below](#as-a-service)). On Windows that is a start at your sign-in with an icon in the tray — no administrator, any terminal. To run it in a terminal instead: `npm install --global even-keel`, then `even-keel`. Its data — `.env`, the state and the logs — lives in `%LOCALAPPDATA%\even-keel`, `~/.local/share/even-keel` or `~/Library/Application Support/even-keel`.
80
+ This installs Even Keel globally with npm and sets it up as a service ([below](#as-a-service)). On Windows that is a start at your sign-in with an icon in the tray — no administrator. In Windows PowerShell or PowerShell 7 type `npx.cmd even-keel` (and `even-keel.cmd …`), or run it from cmd: PowerShell's default policy blocks npm's `.ps1` wrappers ([setup](docs/guide/setup.md#as-a-service)). To run it in a terminal instead: `npm install --global even-keel`, then `even-keel`. Its data — `.env`, the state and the logs — lives in `%LOCALAPPDATA%\even-keel`, `~/.local/share/even-keel` or `~/Library/Application Support/even-keel`.
81
81
 
82
82
  From a clone, which keeps its data in its own folder:
83
83
 
@@ -115,7 +115,7 @@ npm start
115
115
 
116
116
  The service starts by itself and restarts Even Keel if it fails. Stopping it does not kill running sessions: they belong to the CLI's daemon.
117
117
 
118
- **Windows.** As your own user, from any terminal:
118
+ **Windows.** As your own user, from cmd (in PowerShell: `even-keel.cmd install`):
119
119
 
120
120
  ```powershell
121
121
  even-keel install # installed with npm
@@ -1,7 +1,9 @@
1
- import { statSync } from 'node:fs';
1
+ import { lstatSync, statSync } from 'node:fs';
2
2
  import { homedir } from 'node:os';
3
3
  import { fail } from '../notice/notice.js';
4
+ import { findBinary } from '../paths.js';
4
5
  import { expandHome } from '../projects/folder.js';
6
+ import { windowsStart } from '../updates/control.js';
5
7
  import { runGit } from './run.js';
6
8
  const FIRST_COMMIT = 'Initial commit';
7
9
  /** Throws `git.missing` when git did not start at all: not installed, or gone from the service's PATH. */
@@ -10,11 +12,53 @@ export function requireStarted(result) {
10
12
  throw fail('git.missing', {});
11
13
  return result;
12
14
  }
13
- export async function readGitSetup(git, home) {
15
+ /** The package managers looked for on each platform, in order, and the command each installs git with. */
16
+ const INSTALLERS = {
17
+ win32: [['winget', 'winget install --id Git.Git -e']],
18
+ darwin: [['brew', 'brew install git']],
19
+ linux: [
20
+ ['apt-get', 'sudo apt install git'],
21
+ ['dnf', 'sudo dnf install git'],
22
+ ['pacman', 'sudo pacman -S git'],
23
+ ['zypper', 'sudo zypper install git'],
24
+ ['apk', 'sudo apk add git'],
25
+ ],
26
+ };
27
+ /**
28
+ * The command that installs git with the first package manager the service's machine has; `null` — none known, and
29
+ * the page shows only the download link. macOS always has `xcode-select`.
30
+ */
31
+ export function gitInstallCommand(platform, has) {
32
+ const found = INSTALLERS[platform]?.find(([bin]) => has(bin));
33
+ if (found !== undefined)
34
+ return found[1];
35
+ return platform === 'darwin' ? 'xcode-select --install' : null;
36
+ }
37
+ /**
38
+ * Whether a program is on the service's PATH, never started. `lstat`, not `existsSync`: winget is a Windows app alias,
39
+ * which `stat` refuses with EACCES.
40
+ */
41
+ export function onPath(bin, env = process.env, platform = process.platform) {
42
+ return findBinary(bin, env, platform, (path) => {
43
+ try {
44
+ lstatSync(path);
45
+ return true;
46
+ }
47
+ catch {
48
+ return false;
49
+ }
50
+ });
51
+ }
52
+ const installHere = () => gitInstallCommand(process.platform, (bin) => onPath(bin));
53
+ /** `install` and `start` — the command and the way Even Keel was started on Windows, for a machine without git, read only then. */
54
+ export async function readGitSetup(git, home, install = installHere, start = windowsStart) {
14
55
  const started = await git(home, ['--version']);
15
56
  const version = started.code === 0 ? (/(\d+(?:\.\d+)+)/.exec(started.out)?.[1] ?? started.out.trim()) : null;
16
- if (version === null)
17
- return { version: null, name: null, email: null };
57
+ if (version === null) {
58
+ const command = install();
59
+ const restart = await start();
60
+ return { version: null, name: null, email: null, ...(command === null ? {} : { install: command }), ...(restart === null ? {} : { restart }) };
61
+ }
18
62
  const [name, email] = await Promise.all(['user.name', 'user.email'].map((key) => configValue(git, home, key)));
19
63
  return { version, name: name ?? null, email: email ?? null };
20
64
  }
@@ -66,7 +66,8 @@ export function streamError(line, session, since) {
66
66
  }
67
67
  function parseLine(line) {
68
68
  const fields = new Map();
69
- for (const match of line.matchAll(/([\w.]+)=("(?:\\.|[^"\\])*"|[^\s]+)/g)) {
69
+ // A key only after whitespace: from every position of a long word the engine would retry `[\w.]+`, quadratic in its length.
70
+ for (const match of line.matchAll(/(?:^|\s)([\w.]+)=("(?:\\.|[^"\\])*"|[^\s]+)/g)) {
70
71
  try {
71
72
  fields.set(match[1], match[2].startsWith('"') ? JSON.parse(match[2]) : match[2]);
72
73
  }
@@ -158,7 +158,8 @@ const context = {
158
158
  get envOf() { return envOf; },
159
159
  get feedOf() { return feedOf; },
160
160
  get forwards() { return forwards; },
161
- get getState() { return getState; },
161
+ // Not a getter: a handler wired before `getState` is declared may pass it on during the start (EKR-52).
162
+ getState: () => getState(),
162
163
  get goOnWith() { return goOnWith; },
163
164
  get hasAccount() { return hasAccount; },
164
165
  get homeOf() { return homeOf; },
@@ -390,6 +391,11 @@ const vocabularies = new Vocabularies(async (project) => linkOf(project)?.run(as
390
391
  const profileStatuses = new KeptReads((id) => profileStatusesOf(ADAPTERS, profiles.current(), id));
391
392
  // The state goes to the page whole once, then by its changed parts, the sessions one by one (BTN-695).
392
393
  const hub = new EventHub({ state: { sessions: 'sessionId' } });
394
+ /**
395
+ * Sends the page the new state soon. `getState` is read only when the state is built: handlers wired above its
396
+ * declaration may fire while this module still starts — the Huly client's install does at once (EKR-52).
397
+ */
398
+ const stateChanged = () => hub.broadcastSoon('state', () => getState());
393
399
  const transcriptWatch = new TranscriptWatch((sessionId) => hub.signal('transcript', { sessionId }), (error) => console.error(`sessions: watching a transcript: ${error instanceof Error ? error.message : String(error)}`));
394
400
  const homes = await openAccountHomes(db, process.env);
395
401
  /** The shared pool's Claude entry: whose `.claude.json` and tools the Claude-only checks read. */
@@ -441,7 +447,7 @@ const trackers = trackersService.wireTrackers(context);
441
447
  * The remote's CI token from the project's explicit choice or the automatic profile of its forge and host.
442
448
  */
443
449
  const ciTokenOf = (project, target) => ciToken(target, profiles.current(), project, configStore.current.trackers[project], configStore.current.settings[project]?.remoteProfiles);
444
- const protectionAudit = new ProtectionAudit({ config: () => configStore.current, git: runGit, token: (project, target) => ciTokenOf(project, target)?.token ?? null, gitlabUrls: () => gitlabUrls(profiles.current().profiles), changed: () => hub.broadcastSoon('state', getState) });
450
+ const protectionAudit = new ProtectionAudit({ config: () => configStore.current, git: runGit, token: (project, target) => ciTokenOf(project, target)?.token ?? null, gitlabUrls: () => gitlabUrls(profiles.current().profiles), changed: stateChanged });
445
451
  /** The remotes whose CI takes the profile's token, shown or not. */
446
452
  const ciOn = (profileId, hidden) => ciWatches
447
453
  .places(hidden)
@@ -493,11 +499,11 @@ const updater = accountsService.wireUpdater(context);
493
499
  const cliVersions = accountsService.wireCliVersions(context);
494
500
  const cliChecks = cliCheckService.wireCliChecks(context, (await stateValue(db, 'cliCheck.history')) ?? {});
495
501
  const daemons = accountsService.wireDaemons(context);
496
- const cliCopies = copies(runtimes, (name, source) => configStore.saveCli(name, source), (name) => configStore.fallBackCli(name), () => { dispatcher.check(); hub.broadcastSoon('state', getState); void account.refresh(); }, async () => { await cliVersions.check(); await account.refresh(); });
502
+ const cliCopies = copies(runtimes, (name, source) => configStore.saveCli(name, source), (name) => configStore.fallBackCli(name), () => { dispatcher.check(); stateChanged(); void account.refresh(); }, async () => { await cliVersions.check(); await account.refresh(); });
497
503
  const secrets = accountsService.wireSecrets(context);
498
504
  const profiles = accountsService.wireProfiles(context);
499
- hulyClient.changed = () => hub.broadcastSoon('state', getState);
500
- gitSetup.changed = () => hub.broadcastSoon('state', getState);
505
+ hulyClient.changed = stateChanged;
506
+ gitSetup.changed = stateChanged;
501
507
  void gitSetup.check().catch((error) => console.error(`git: could not read its version and identity: ${englishOf(noticeOf(error))}`));
502
508
  installForProfiles(profiles.current().profiles);
503
509
  /** The tracker refused the credentials of the profile the project runs on: its chain waits (BTN-200). */
@@ -608,7 +614,7 @@ const { mailRelay, answerSession } = createChat({
608
614
  steering,
609
615
  steer,
610
616
  language: promptLanguage,
611
- changed: () => hub.broadcastSoon('state', getState),
617
+ changed: stateChanged,
612
618
  log: (line) => console.log(line),
613
619
  now: () => new Date(),
614
620
  });
@@ -657,7 +663,7 @@ setInterval(() => void cliChecks.check(), cliCheckService.CLI_CHECK_TICK_MS).unr
657
663
  setInterval(() => void dispatcher.pollReviews().catch((error) => console.error(`review: the poll failed: ${englishOf(noticeOf(error))}`)), 60_000).unref();
658
664
  const applyCi = () => void Promise.all([ciWatches.apply(configStore.current.projects), remotes.apply(configStore.current.projects)]).then(() => {
659
665
  dispatcher.check();
660
- hub.broadcastSoon('state', getState);
666
+ stateChanged();
661
667
  });
662
668
  applyCi();
663
669
  setInterval(() => {
@@ -679,7 +685,7 @@ setInterval(() => void Promise.all([ciWatches.refresh(), remotes.apply(configSto
679
685
  if (changed || moved)
680
686
  dispatcher.check();
681
687
  if (changed || moved)
682
- hub.broadcastSoon('state', getState);
688
+ stateChanged();
683
689
  }), CI_TARGETS_MS).unref();
684
690
  /**
685
691
  * The config's projects changed: removed ones let their chain go, the rest follows the config. The state names a
@@ -33,6 +33,25 @@ export function windowsServiceOf(csv) {
33
33
  const name = fields?.[2]?.slice(1, -1).split(',')[0]?.trim();
34
34
  return name === undefined || name === '' || name === 'N/A' ? null : name;
35
35
  }
36
+ /** What started this process, from `tasklist /svc /fo csv /nh` of the parent: a parent that is neither is a terminal. */
37
+ export function windowsStartOf(csv, env) {
38
+ if (launcherOf(csv, env) !== null)
39
+ return { by: 'tray' };
40
+ const name = windowsServiceOf(csv);
41
+ return name === null ? { by: 'console' } : { by: 'service', name };
42
+ }
43
+ /** `null` — not Windows, or the parent could not be read. */
44
+ export async function windowsStart() {
45
+ if (process.platform !== 'win32')
46
+ return null;
47
+ try {
48
+ const { stdout } = await promisify(execFile)('tasklist', ['/svc', '/fo', 'csv', '/nh', '/fi', `PID eq ${process.ppid}`], { windowsHide: true });
49
+ return windowsStartOf(stdout, process.env);
50
+ }
51
+ catch {
52
+ return null;
53
+ }
54
+ }
36
55
  /** The user unit of `/proc/self/cgroup`; a system unit or a terminal's scope is none: `install.sh` installs a user unit. */
37
56
  export function systemdUnitOf(cgroup) {
38
57
  for (const line of cgroup.split('\n')) {