@whenlabs/when 0.9.2 → 0.10.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/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  A single installable toolkit that brings six WhenLabs developer tools into your Claude Code / AI coding agent workflow. Once installed, all tools are available as MCP tools in every session — Claude uses them automatically when relevant.
6
6
 
7
+ Five tools (stale, envalid, berth, aware, vow) have CLI scan modes and run on a schedule. Velocity is the sixth tool — it is always-on and embedded (SQLite-backed), so it does not have a CLI scan mode and does not appear in `doctor`/`watch`/`init`/`ci` output.
8
+
7
9
  ## Install
8
10
 
9
11
  ```bash
@@ -49,18 +51,28 @@ These tools are available to Claude in every session after install:
49
51
  | `velocity_history` | Show task history |
50
52
  | `stale_scan` | Detect documentation drift |
51
53
  | `stale_fix` | Auto-fix documentation drift (wrong paths, dead links, phantom env vars) |
54
+ | `stale_auto_fix` | Scan + auto-fix drift in one call |
52
55
  | `envalid_validate` | Validate .env files against schemas |
53
56
  | `envalid_detect` | Find undocumented env vars in codebase |
54
57
  | `envalid_generate_schema` | Generate .env.schema from code analysis |
58
+ | `envalid_auto_fix` | Detect undocumented vars + auto-generate schema entries |
55
59
  | `berth_status` | Show active ports and conflicts |
56
60
  | `berth_check` | Scan project for port conflicts |
57
61
  | `berth_resolve` | Auto-resolve port conflicts (kill or reassign) |
62
+ | `berth_auto_resolve` | Check + auto-resolve conflicts in one call |
58
63
  | `aware_init` | Auto-detect stack, generate AI context files |
59
64
  | `aware_doctor` | Diagnose project health and config issues |
65
+ | `aware_auto_sync` | Diagnose + auto-sync stale AI context files |
60
66
  | `vow_scan` | Scan and summarize dependency licenses |
61
67
  | `vow_check` | Validate licenses against policy |
62
68
  | `vow_hook_install` | Install pre-commit license check hook |
63
69
 
70
+ > This table shows a highlights subset. Run `when <tool> --help` for all available commands per tool.
71
+
72
+ ### Cross-tool Intelligence
73
+
74
+ Tools automatically suggest follow-up actions when they detect issues relevant to other tools. For example, `aware_init` triggers a `stale_scan` when it generates new files, and `envalid_detect` suggests `berth_register` when it finds service URL env vars. These cascading suggestions surface as "Tip:" lines in tool output.
75
+
64
76
  ## Multi-Editor Support
65
77
 
66
78
  Install MCP servers into other editors alongside Claude Code:
@@ -79,7 +91,10 @@ Without flags, `install` targets Claude Code only.
79
91
  You can also run tools directly from the command line:
80
92
 
81
93
  ```bash
82
- when init # Onboard a project — detect stack, run all tools
94
+ when init # Onboard a project — bootstrap configs, run all tools, auto-fix
95
+ when config # Show unified .whenlabs.yml config
96
+ when config init # Generate .whenlabs.yml from existing tool configs
97
+ when config validate # Validate config structure
83
98
  when stale scan
84
99
  when stale fix # Auto-fix documentation drift
85
100
  when envalid validate
@@ -98,7 +113,15 @@ when ci # Run checks for CI (exits 1 on issues)
98
113
 
99
114
  ### `when init`
100
115
 
101
- One command to onboard any project. Auto-detects your stack, runs all 5 tools in parallel, generates AI context files if missing, and shows a summary with next steps.
116
+ One command to fully onboard any project:
117
+ 1. **Bootstrap** — creates `.env.schema`, `.vow.json`, `.stale.yml`, and registers berth ports based on your project
118
+ 2. **Scan** — runs all 5 CLI tools in parallel
119
+ 3. **Auto-fix** — automatically fixes stale drift if detected
120
+ 4. **Config** — generates a unified `.whenlabs.yml` from the bootstrapped configs
121
+
122
+ ### `when config`
123
+
124
+ Manage the unified `.whenlabs.yml` project config. All six tools read their settings from this single file instead of separate config files. Subcommands: `init` (generate from existing configs), `validate` (check structure).
102
125
 
103
126
  ### `when doctor`
104
127
 
@@ -106,7 +129,7 @@ Runs all 5 CLI tools against the current project and displays a unified health r
106
129
 
107
130
  ### `when watch`
108
131
 
109
- Background daemon that runs all 5 tools on intervals and writes results to `~/.whenlabs/status.json`. Powers the Claude Code status line integration. Use `--once` for a single scan or `--interval <seconds>` to customize the schedule.
132
+ Background daemon that runs all 5 CLI tools on intervals and writes results to `~/.whenlabs/status.json`. Powers the Claude Code status line integration. Use `--once` for a single scan or `--interval <seconds>` to customize the schedule.
110
133
 
111
134
  ### `when ci`
112
135
 
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/utils/find-bin.ts
4
+ import { resolve, dirname } from "path";
5
+ import { existsSync } from "fs";
6
+ import { fileURLToPath } from "url";
7
+ var __dirname = dirname(fileURLToPath(import.meta.url));
8
+ function findBin(name) {
9
+ const pkgRoot = resolve(__dirname, "../..");
10
+ const localBin = resolve(pkgRoot, "node_modules", ".bin", name);
11
+ if (existsSync(localBin)) return localBin;
12
+ const directCli = resolve(pkgRoot, "node_modules", "@whenlabs", name, "dist", "cli.js");
13
+ if (existsSync(directCli)) return directCli;
14
+ return name;
15
+ }
16
+
17
+ // src/config/whenlabs-config.ts
18
+ import { existsSync as existsSync2, readFileSync } from "fs";
19
+ import { resolve as resolve2 } from "path";
20
+ import { parse } from "yaml";
21
+ var CONFIG_FILENAME = ".whenlabs.yml";
22
+ function loadConfig(projectPath) {
23
+ const dir = projectPath ?? process.cwd();
24
+ const configPath = resolve2(dir, CONFIG_FILENAME);
25
+ if (!existsSync2(configPath)) return null;
26
+ try {
27
+ const raw = readFileSync(configPath, "utf-8");
28
+ const parsed = parse(raw);
29
+ if (!parsed || typeof parsed !== "object") return null;
30
+ return parsed;
31
+ } catch {
32
+ return null;
33
+ }
34
+ }
35
+
36
+ export {
37
+ findBin,
38
+ CONFIG_FILENAME,
39
+ loadConfig
40
+ };