watchmen-cli 1.0.7

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 (4) hide show
  1. package/README.md +36 -0
  2. package/bin/wm +5 -0
  3. package/install.js +110 -0
  4. package/package.json +48 -0
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # watchmen-cli
2
+
3
+ Developer environment intelligence platform — 13 scanners, 24 MCP tools, zero dependencies.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g watchmen-cli
9
+ ```
10
+
11
+ Or use directly:
12
+
13
+ ```bash
14
+ npx watchmen-cli version
15
+ ```
16
+
17
+ ## What it does
18
+
19
+ WatchmenCLI scans your development environment across 13 dimensions (packages, runtimes, secrets, Docker, network, permissions, databases, and more), indexes 30+ document formats with OCR, and exposes everything as 24 MCP tools for AI coding assistants.
20
+
21
+ ## Usage
22
+
23
+ ```bash
24
+ wm scan # Full environment scan
25
+ wm health # Disk, memory, security score 0-100
26
+ wm secrets live # Show secret values (local only)
27
+ wm monitor # Real-time TUI dashboard
28
+ wm mcp # Start MCP server for Claude/Cursor
29
+ wm doctor # Self-diagnostic
30
+ ```
31
+
32
+ ## Links
33
+
34
+ - Website: https://trywatchmen.cloud
35
+ - GitHub: https://github.com/trywatchmen/watchmen-cli
36
+ - Docs: https://trywatchmen.cloud/docs
package/bin/wm ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ # Stub — replaced by install.js postinstall with the actual binary.
3
+ # If you see this message, run: npm rebuild watchmen-cli
4
+ echo "wm binary not installed. Run: npm rebuild watchmen-cli" >&2
5
+ exit 1
package/install.js ADDED
@@ -0,0 +1,110 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const https = require("https");
5
+ const http = require("http");
6
+ const fs = require("fs");
7
+ const path = require("path");
8
+ const { createHash } = require("crypto");
9
+ const { execSync } = require("child_process");
10
+
11
+ const VERSION = require("./package.json").version;
12
+ const REPO = "trywatchmen/watchmen-cli";
13
+
14
+ // Platform → artifact name mapping
15
+ const PLATFORMS = {
16
+ "darwin-arm64": "wm-community-macos-arm64",
17
+ "darwin-x64": "wm-community-macos-arm64", // Rosetta 2 fallback
18
+ "linux-x64": "wm-community-linux-x86_64",
19
+ "win32-x64": "wm-community-windows-x86_64.exe",
20
+ };
21
+
22
+ function getPlatformKey() {
23
+ return `${process.platform}-${process.arch}`;
24
+ }
25
+
26
+ function getArtifactName() {
27
+ const key = getPlatformKey();
28
+ const name = PLATFORMS[key];
29
+ if (!name) {
30
+ console.error(
31
+ `Unsupported platform: ${key}\nSupported: ${Object.keys(PLATFORMS).join(", ")}`
32
+ );
33
+ process.exit(1);
34
+ }
35
+ return name;
36
+ }
37
+
38
+ function download(url) {
39
+ return new Promise((resolve, reject) => {
40
+ const client = url.startsWith("https") ? https : http;
41
+ client
42
+ .get(url, { headers: { "User-Agent": "watchmen-cli-npm" } }, (res) => {
43
+ // Follow redirects (GitHub releases redirect to S3)
44
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
45
+ return download(res.headers.location).then(resolve).catch(reject);
46
+ }
47
+ if (res.statusCode !== 200) {
48
+ return reject(new Error(`HTTP ${res.statusCode} for ${url}`));
49
+ }
50
+ const chunks = [];
51
+ res.on("data", (chunk) => chunks.push(chunk));
52
+ res.on("end", () => resolve(Buffer.concat(chunks)));
53
+ res.on("error", reject);
54
+ })
55
+ .on("error", reject);
56
+ });
57
+ }
58
+
59
+ async function main() {
60
+ const artifact = getArtifactName();
61
+ const binDir = path.join(__dirname, "bin");
62
+ const binName = process.platform === "win32" ? "wm.exe" : "wm";
63
+ const binPath = path.join(binDir, binName);
64
+
65
+ // Skip if already installed at correct version
66
+ if (fs.existsSync(binPath)) {
67
+ try {
68
+ const installed = execSync(`"${binPath}" version`, { encoding: "utf8" });
69
+ if (installed.includes(VERSION)) {
70
+ console.log(`wm v${VERSION} already installed`);
71
+ return;
72
+ }
73
+ } catch {}
74
+ }
75
+
76
+ const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${artifact}`;
77
+ const shaUrl = `${url}.sha256`;
78
+
79
+ console.log(`Downloading wm v${VERSION} for ${getPlatformKey()}...`);
80
+ console.log(` ${url}`);
81
+
82
+ // Download binary + checksum in parallel
83
+ const [binary, shaData] = await Promise.all([
84
+ download(url),
85
+ download(shaUrl).catch(() => null), // SHA256 file may not exist yet
86
+ ]);
87
+
88
+ // Verify checksum if available
89
+ if (shaData) {
90
+ const expectedSha = shaData.toString("utf8").trim().split(/\s+/)[0];
91
+ const actualSha = createHash("sha256").update(binary).digest("hex");
92
+ if (actualSha !== expectedSha) {
93
+ console.error(`SHA256 mismatch!\n expected: ${expectedSha}\n actual: ${actualSha}`);
94
+ process.exit(1);
95
+ }
96
+ console.log(` SHA256 verified: ${actualSha.slice(0, 12)}...`);
97
+ }
98
+
99
+ // Write binary
100
+ fs.mkdirSync(binDir, { recursive: true });
101
+ fs.writeFileSync(binPath, binary);
102
+ fs.chmodSync(binPath, 0o755);
103
+
104
+ console.log(` Installed: ${binPath}`);
105
+ }
106
+
107
+ main().catch((err) => {
108
+ console.error(`Failed to install wm: ${err.message}`);
109
+ process.exit(1);
110
+ });
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "watchmen-cli",
3
+ "version": "1.0.7",
4
+ "description": "Developer environment intelligence platform — 13 scanners, 24 MCP tools, zero dependencies",
5
+ "main": "install.js",
6
+ "keywords": [
7
+ "cli",
8
+ "environment",
9
+ "scanner",
10
+ "security",
11
+ "mcp",
12
+ "devtools",
13
+ "watchmen"
14
+ ],
15
+ "homepage": "https://trywatchmen.cloud",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/trywatchmen/watchmen-cli.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/trywatchmen/watchmen-cli/issues"
22
+ },
23
+ "license": "MIT",
24
+ "author": "Cristiano Pereira da Silva Muniz, LLC",
25
+ "bin": {
26
+ "wm": "bin/wm"
27
+ },
28
+ "scripts": {
29
+ "postinstall": "node install.js"
30
+ },
31
+ "os": [
32
+ "darwin",
33
+ "linux",
34
+ "win32"
35
+ ],
36
+ "cpu": [
37
+ "arm64",
38
+ "x64"
39
+ ],
40
+ "engines": {
41
+ "node": ">=16"
42
+ },
43
+ "files": [
44
+ "install.js",
45
+ "README.md",
46
+ "bin/"
47
+ ]
48
+ }