@warren-dean/code-kit 0.22.1 → 0.23.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/hooks/session.mjs CHANGED
@@ -1,8 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  // SessionStart and SessionEnd (docs/specs/23-the-team.md): a session starting is recorded as a member
3
- // of the team, the lead session when no other live session leads (SESS-2); as it ends, it leads nothing
4
- // more, and the lanes its agents had claimed are free again (SCHED-1). Its task stays, stale (SESS-4).
3
+ // of the team, the lead session when no other live session leads (SESS-2), and the worktrees done with
4
+ // are pruned (docs/specs/20-lean-lead.md, LEAN-8); as it ends, it leads nothing more, and the lanes its
5
+ // agents had claimed are free again (SCHED-1). Its task stays, stale (SESS-4).
6
+ import { spawn } from 'node:child_process';
5
7
  import { readFileSync } from 'node:fs';
8
+ import { fileURLToPath } from 'node:url';
6
9
  import { loadConfig } from './lib/config.mjs';
7
10
  import { releaseSession } from './lib/laneclaims.mjs';
8
11
  import { endSession, startSession } from './lib/sessions.mjs';
@@ -17,7 +20,21 @@ try {
17
20
  const project = projectDir();
18
21
  const { config } = loadConfig(project);
19
22
  const session = input.session_id ?? null;
20
- if (config && session && process.argv[2] === 'start') startSession(project, session);
23
+ if (config && session && process.argv[2] === 'start') {
24
+ startSession(project, session);
25
+ // LEAN-8: the worktrees left done with since the last session go, in the background: a project with
26
+ // many of them never holds up a session's start.
27
+ spawn(
28
+ process.execPath,
29
+ [
30
+ fileURLToPath(new URL('../bin/code-kit.mjs', import.meta.url)),
31
+ 'worktrees',
32
+ 'prune',
33
+ '--quiet',
34
+ ],
35
+ { cwd: project, detached: true, stdio: 'ignore' },
36
+ ).unref();
37
+ }
21
38
  if (config && session && process.argv[2] === 'end') {
22
39
  endSession(project, session);
23
40
  releaseSession(project, session);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warren-dean/code-kit",
3
- "version": "0.22.1",
3
+ "version": "0.23.0",
4
4
  "description": "Keeps AI coding agents inside your project's rules: lanes, layer rules, protected paths and proof before finish, enforced by Claude Code hooks and in CI",
5
5
  "license": "MIT",
6
6
  "author": "Warren Langeveldt",