@whenlabs/when 0.9.1 → 0.9.2
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/dist/index.js
CHANGED
|
@@ -596,7 +596,7 @@ function createWatchCommand() {
|
|
|
596
596
|
var program = new Command5();
|
|
597
597
|
program.name("when").version("0.1.0").description("The WhenLabs developer toolkit \u2014 6 tools, one install");
|
|
598
598
|
program.command("install").description("Install all WhenLabs tools globally (MCP server + CLAUDE.md instructions)").option("--cursor", "Install MCP servers into Cursor (~/.cursor/mcp.json)").option("--vscode", "Install MCP servers into VS Code (settings.json)").option("--windsurf", "Install MCP servers into Windsurf (~/.codeium/windsurf/mcp_config.json)").option("--all", "Install MCP servers into all supported editors").action(async (options) => {
|
|
599
|
-
const { install } = await import("./install-
|
|
599
|
+
const { install } = await import("./install-F46OPKIA.js");
|
|
600
600
|
await install(options);
|
|
601
601
|
});
|
|
602
602
|
program.command("uninstall").description("Remove all WhenLabs tools").option("--cursor", "Remove MCP servers from Cursor").option("--vscode", "Remove MCP servers from VS Code").option("--windsurf", "Remove MCP servers from Windsurf").option("--all", "Remove MCP servers from all supported editors").action(async (options) => {
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import { join } from "path";
|
|
13
13
|
import { homedir } from "os";
|
|
14
14
|
import { existsSync, readFileSync, writeFileSync, mkdirSync, chmodSync } from "fs";
|
|
15
|
+
import { execFileSync } from "child_process";
|
|
15
16
|
var CLAUDE_MD_PATH = join(homedir(), ".claude", "CLAUDE.md");
|
|
16
17
|
var SCRIPTS_DIR = join(homedir(), ".claude", "scripts");
|
|
17
18
|
var STATUSLINE_PATH = join(SCRIPTS_DIR, "statusline.py");
|
|
@@ -312,6 +313,24 @@ def run_scans(cwd):
|
|
|
312
313
|
run_bg(tool, args, cwd)
|
|
313
314
|
break
|
|
314
315
|
|
|
316
|
+
# Auto-sync aware when staleness detected
|
|
317
|
+
aware_cached = read_cache("aware", cwd)
|
|
318
|
+
if aware_cached:
|
|
319
|
+
out = aware_cached.get("output", "")
|
|
320
|
+
code = aware_cached.get("code", 0)
|
|
321
|
+
if code != 0 or "stale" in out.lower() or "outdated" in out.lower() or "drift" in out.lower() or "never synced" in out.lower():
|
|
322
|
+
sync_cache = cache_path("aware_sync", cwd)
|
|
323
|
+
sync_age = 0
|
|
324
|
+
if sync_cache.exists():
|
|
325
|
+
try:
|
|
326
|
+
sync_age = time.time() - json.loads(sync_cache.read_text()).get("timestamp", 0)
|
|
327
|
+
except Exception:
|
|
328
|
+
sync_age = 99999
|
|
329
|
+
else:
|
|
330
|
+
sync_age = 99999
|
|
331
|
+
if sync_age > 3600: # Only auto-sync once per hour
|
|
332
|
+
run_bg("aware_sync", ["npx", "--yes", "@whenlabs/aware", "sync"], cwd)
|
|
333
|
+
|
|
315
334
|
results = []
|
|
316
335
|
for tool, (_, parser) in scans.items():
|
|
317
336
|
cached = read_cache(tool, cwd)
|
|
@@ -430,6 +449,24 @@ async function install(options = {}) {
|
|
|
430
449
|
console.log(` \u2713 CLAUDE.md instructions written to ${CLAUDE_MD_PATH}`);
|
|
431
450
|
const slResult = installStatusLine();
|
|
432
451
|
console.log(slResult.installed ? ` \u2713 ${slResult.message}` : ` \u2717 ${slResult.message}`);
|
|
452
|
+
try {
|
|
453
|
+
const cwd = process.cwd();
|
|
454
|
+
execFileSync("npx", ["--yes", "@whenlabs/aware", "init", "--force"], {
|
|
455
|
+
cwd,
|
|
456
|
+
stdio: "pipe",
|
|
457
|
+
env: { ...process.env, FORCE_COLOR: "0", NO_COLOR: "1" },
|
|
458
|
+
timeout: 3e4
|
|
459
|
+
});
|
|
460
|
+
execFileSync("npx", ["--yes", "@whenlabs/aware", "sync"], {
|
|
461
|
+
cwd,
|
|
462
|
+
stdio: "pipe",
|
|
463
|
+
env: { ...process.env, FORCE_COLOR: "0", NO_COLOR: "1" },
|
|
464
|
+
timeout: 3e4
|
|
465
|
+
});
|
|
466
|
+
console.log(" \u2713 AI context files generated and synced (aware init + sync)");
|
|
467
|
+
} catch {
|
|
468
|
+
console.log(" - Skipped aware init (run `when aware init` in a project directory)");
|
|
469
|
+
}
|
|
433
470
|
if (hasOldBlock(CLAUDE_MD_PATH)) {
|
|
434
471
|
removeOldBlock(CLAUDE_MD_PATH);
|
|
435
472
|
console.log(" \u2713 Removed legacy velocity-mcp markers (migrated to whenlabs block)");
|