commandmate 0.1.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.
Files changed (44) hide show
  1. package/.env.example +64 -0
  2. package/LICENSE +21 -0
  3. package/README.md +148 -0
  4. package/bin/commandmate.js +7 -0
  5. package/dist/cli/commands/init.d.ts +11 -0
  6. package/dist/cli/commands/init.d.ts.map +1 -0
  7. package/dist/cli/commands/init.js +126 -0
  8. package/dist/cli/commands/start.d.ts +11 -0
  9. package/dist/cli/commands/start.d.ts.map +1 -0
  10. package/dist/cli/commands/start.js +117 -0
  11. package/dist/cli/commands/status.d.ts +10 -0
  12. package/dist/cli/commands/status.d.ts.map +1 -0
  13. package/dist/cli/commands/status.js +55 -0
  14. package/dist/cli/commands/stop.d.ts +11 -0
  15. package/dist/cli/commands/stop.d.ts.map +1 -0
  16. package/dist/cli/commands/stop.js +82 -0
  17. package/dist/cli/config/cli-dependencies.d.ts +23 -0
  18. package/dist/cli/config/cli-dependencies.d.ts.map +1 -0
  19. package/dist/cli/config/cli-dependencies.js +65 -0
  20. package/dist/cli/index.d.ts +6 -0
  21. package/dist/cli/index.d.ts.map +1 -0
  22. package/dist/cli/index.js +64 -0
  23. package/dist/cli/types/index.d.ts +124 -0
  24. package/dist/cli/types/index.d.ts.map +1 -0
  25. package/dist/cli/types/index.js +20 -0
  26. package/dist/cli/utils/daemon.d.ts +39 -0
  27. package/dist/cli/utils/daemon.d.ts.map +1 -0
  28. package/dist/cli/utils/daemon.js +141 -0
  29. package/dist/cli/utils/env-setup.d.ts +62 -0
  30. package/dist/cli/utils/env-setup.d.ts.map +1 -0
  31. package/dist/cli/utils/env-setup.js +157 -0
  32. package/dist/cli/utils/logger.d.ts +48 -0
  33. package/dist/cli/utils/logger.d.ts.map +1 -0
  34. package/dist/cli/utils/logger.js +99 -0
  35. package/dist/cli/utils/pid-manager.d.ts +42 -0
  36. package/dist/cli/utils/pid-manager.d.ts.map +1 -0
  37. package/dist/cli/utils/pid-manager.js +111 -0
  38. package/dist/cli/utils/preflight.d.ts +34 -0
  39. package/dist/cli/utils/preflight.d.ts.map +1 -0
  40. package/dist/cli/utils/preflight.js +129 -0
  41. package/dist/cli/utils/security-logger.d.ts +29 -0
  42. package/dist/cli/utils/security-logger.d.ts.map +1 -0
  43. package/dist/cli/utils/security-logger.js +53 -0
  44. package/package.json +78 -0
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /**
3
+ * Security Event Logger
4
+ * Issue #96: npm install CLI support
5
+ * SF-SEC-2: Security event logging for CLI commands
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.logSecurityEvent = logSecurityEvent;
9
+ exports.maskSensitiveData = maskSensitiveData;
10
+ const fs_1 = require("fs");
11
+ const path_1 = require("path");
12
+ const os_1 = require("os");
13
+ /**
14
+ * Get security log file path
15
+ */
16
+ function getLogPath() {
17
+ const logDir = process.env.CM_LOG_DIR;
18
+ if (logDir) {
19
+ return (0, path_1.join)(logDir, 'security.log');
20
+ }
21
+ return (0, path_1.join)((0, os_1.homedir)(), '.commandmate-security.log');
22
+ }
23
+ /**
24
+ * Log a security event
25
+ * Silently fails if file operations fail (non-critical)
26
+ */
27
+ function logSecurityEvent(event) {
28
+ try {
29
+ const logPath = getLogPath();
30
+ const maskedDetails = maskSensitiveData(event.details);
31
+ const logLine = `${event.timestamp} [${event.action.toUpperCase()}] ${event.command}: ${maskedDetails || ''}\n`;
32
+ (0, fs_1.appendFileSync)(logPath, logLine, { mode: 0o600 });
33
+ }
34
+ catch {
35
+ // Silently ignore logging failures - they should not affect CLI operation
36
+ }
37
+ }
38
+ /**
39
+ * Mask sensitive data in log messages
40
+ * SF-SEC-2: Mask authentication tokens in logs
41
+ */
42
+ function maskSensitiveData(input) {
43
+ if (!input) {
44
+ return input;
45
+ }
46
+ // Mask CM_AUTH_TOKEN values
47
+ let result = input.replace(/CM_AUTH_TOKEN=\S+/g, 'CM_AUTH_TOKEN=***masked***');
48
+ // Mask any token-like strings (12+ hex/alphanumeric characters after "token:")
49
+ result = result.replace(/(?:token|Token)[:\s]+([a-zA-Z0-9]{12,})/gi, (_match, token) => {
50
+ return _match.replace(token, '***');
51
+ });
52
+ return result;
53
+ }
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "commandmate",
3
+ "version": "0.1.0",
4
+ "description": "Git worktree management with Claude CLI and tmux sessions",
5
+ "bin": {
6
+ "commandmate": "./bin/commandmate.js"
7
+ },
8
+ "files": [
9
+ "bin/",
10
+ "dist/",
11
+ ".env.example"
12
+ ],
13
+ "scripts": {
14
+ "dev": "tsx server.ts",
15
+ "build": "next build",
16
+ "build:cli": "tsc --project tsconfig.cli.json",
17
+ "build:all": "npm run build && npm run build:cli",
18
+ "prepublishOnly": "npm run build:cli",
19
+ "start": "NODE_ENV=production tsx server.ts",
20
+ "lint": "next lint",
21
+ "test": "vitest",
22
+ "test:ui": "vitest --ui",
23
+ "test:coverage": "vitest --coverage",
24
+ "test:unit": "vitest run tests/unit",
25
+ "test:integration": "vitest run tests/integration",
26
+ "test:e2e": "playwright test",
27
+ "test:watch": "vitest --watch",
28
+ "db:init": "tsx scripts/init-db.ts",
29
+ "db:reset": "rm -f db.sqlite && npm run db:init"
30
+ },
31
+ "dependencies": {
32
+ "ansi-to-html": "^0.7.2",
33
+ "autoprefixer": "^10.4.22",
34
+ "better-sqlite3": "^12.4.1",
35
+ "commander": "^14.0.2",
36
+ "date-fns": "^4.1.0",
37
+ "gray-matter": "^4.0.3",
38
+ "http-proxy": "^1.18.1",
39
+ "isomorphic-dompurify": "^2.35.0",
40
+ "lucide-react": "^0.554.0",
41
+ "mermaid": "^11.12.2",
42
+ "next": "^14.2.0",
43
+ "postcss": "^8.5.6",
44
+ "react": "^18.3.0",
45
+ "react-dom": "^18.3.0",
46
+ "react-markdown": "^10.1.0",
47
+ "rehype-highlight": "^7.0.2",
48
+ "rehype-sanitize": "^6.0.0",
49
+ "remark-gfm": "^4.0.1",
50
+ "uuid": "^13.0.0",
51
+ "ws": "^8.18.3",
52
+ "xterm": "^5.3.0",
53
+ "xterm-addon-fit": "^0.8.0",
54
+ "xterm-addon-web-links": "^0.9.0"
55
+ },
56
+ "devDependencies": {
57
+ "@playwright/test": "^1.56.1",
58
+ "@tailwindcss/typography": "^0.5.19",
59
+ "@testing-library/jest-dom": "^6.9.1",
60
+ "@testing-library/react": "^16.3.0",
61
+ "@types/better-sqlite3": "^7.6.13",
62
+ "@types/http-proxy": "^1.17.17",
63
+ "@types/node": "^20.0.0",
64
+ "@types/react": "^18.3.0",
65
+ "@types/react-dom": "^18.3.0",
66
+ "@types/uuid": "^10.0.0",
67
+ "@types/ws": "^8.18.1",
68
+ "@vitejs/plugin-react": "^5.1.1",
69
+ "@vitest/coverage-v8": "^4.0.16",
70
+ "@vitest/ui": "^4.0.9",
71
+ "eslint": "^8.57.0",
72
+ "eslint-config-next": "^14.2.0",
73
+ "tailwindcss": "^3.4.18",
74
+ "tsx": "^4.20.6",
75
+ "typescript": "^5.5.0",
76
+ "vitest": "^4.0.9"
77
+ }
78
+ }