@moonwatch/js 0.1.8 → 0.1.9
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 +1 -1
- package/dist/index.mjs +1 -1
- package/dist/init.js +71 -7
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -348,7 +348,7 @@ var LEVEL_ORDER = {
|
|
|
348
348
|
FATAL: 4
|
|
349
349
|
};
|
|
350
350
|
var SDK_VERSION = "0.1.4";
|
|
351
|
-
var DEFAULT_BASE_URL = "https://
|
|
351
|
+
var DEFAULT_BASE_URL = "https://moonwatch.dev";
|
|
352
352
|
var BATCH_SIZE = 50;
|
|
353
353
|
var MAX_BUFFER_SIZE = 1e3;
|
|
354
354
|
var FLUSH_INTERVAL_MS = 1e3;
|
package/dist/index.mjs
CHANGED
|
@@ -319,7 +319,7 @@ var LEVEL_ORDER = {
|
|
|
319
319
|
FATAL: 4
|
|
320
320
|
};
|
|
321
321
|
var SDK_VERSION = "0.1.4";
|
|
322
|
-
var DEFAULT_BASE_URL = "https://
|
|
322
|
+
var DEFAULT_BASE_URL = "https://moonwatch.dev";
|
|
323
323
|
var BATCH_SIZE = 50;
|
|
324
324
|
var MAX_BUFFER_SIZE = 1e3;
|
|
325
325
|
var FLUSH_INTERVAL_MS = 1e3;
|
package/dist/init.js
CHANGED
|
@@ -4,10 +4,20 @@
|
|
|
4
4
|
// src/init.ts
|
|
5
5
|
var import_fs = require("fs");
|
|
6
6
|
var import_path = require("path");
|
|
7
|
+
var import_readline = require("readline");
|
|
7
8
|
var CLAUDE_MD = "CLAUDE.md";
|
|
8
9
|
var CURSORRULES = ".cursorrules";
|
|
9
10
|
var SKILL_REF = "> See node_modules/@moonwatch/js/SKILL.md for the @moonwatch/js logging workflow.";
|
|
10
11
|
var cwd = process.cwd();
|
|
12
|
+
function prompt(question) {
|
|
13
|
+
const rl = (0, import_readline.createInterface)({ input: process.stdin, output: process.stdout });
|
|
14
|
+
return new Promise((resolve2) => {
|
|
15
|
+
rl.question(question, (answer) => {
|
|
16
|
+
rl.close();
|
|
17
|
+
resolve2(answer.trim());
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
11
21
|
function appendIfMissing(filename) {
|
|
12
22
|
const filepath = (0, import_path.resolve)(cwd, filename);
|
|
13
23
|
const marker = "node_modules/@moonwatch/js/SKILL.md";
|
|
@@ -24,11 +34,65 @@ function appendIfMissing(filename) {
|
|
|
24
34
|
console.log(` ${filename}: ${content.length > 0 ? "updated" : "created"}`);
|
|
25
35
|
return true;
|
|
26
36
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
function setupClaudeApiKey(apiKey) {
|
|
38
|
+
const claudeDir = (0, import_path.join)(cwd, ".claude");
|
|
39
|
+
const settingsPath = (0, import_path.join)(claudeDir, "settings.local.json");
|
|
40
|
+
let settings = {};
|
|
41
|
+
if ((0, import_fs.existsSync)(settingsPath)) {
|
|
42
|
+
try {
|
|
43
|
+
settings = JSON.parse((0, import_fs.readFileSync)(settingsPath, "utf-8"));
|
|
44
|
+
} catch {
|
|
45
|
+
}
|
|
46
|
+
if (settings.env?.MOONWATCH_API_KEY) {
|
|
47
|
+
const existing = settings.env.MOONWATCH_API_KEY;
|
|
48
|
+
const masked = existing.slice(0, 6) + "..." + existing.slice(-4);
|
|
49
|
+
console.log(` .claude/settings.local.json: API key already set (${masked}), overwriting`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (!(0, import_fs.existsSync)(claudeDir)) {
|
|
53
|
+
(0, import_fs.mkdirSync)(claudeDir, { recursive: true });
|
|
54
|
+
}
|
|
55
|
+
settings.env = settings.env || {};
|
|
56
|
+
settings.env.MOONWATCH_API_KEY = apiKey;
|
|
57
|
+
(0, import_fs.writeFileSync)(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf-8");
|
|
58
|
+
console.log(` .claude/settings.local.json: API key saved`);
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
async function main() {
|
|
62
|
+
console.log("\n@moonwatch/js init\n");
|
|
63
|
+
console.log("Setting up AI assistant integration...");
|
|
64
|
+
const claudeUpdated = appendIfMissing(CLAUDE_MD);
|
|
65
|
+
const cursorUpdated = appendIfMissing(CURSORRULES);
|
|
66
|
+
if (!claudeUpdated && !cursorUpdated) {
|
|
67
|
+
console.log(" Already set up.\n");
|
|
68
|
+
} else {
|
|
69
|
+
console.log("");
|
|
70
|
+
}
|
|
71
|
+
console.log("Setting up Claude Code MCP connection...");
|
|
72
|
+
const existingSettings = (0, import_path.join)(cwd, ".claude", "settings.local.json");
|
|
73
|
+
let hasKey = false;
|
|
74
|
+
if ((0, import_fs.existsSync)(existingSettings)) {
|
|
75
|
+
try {
|
|
76
|
+
const s = JSON.parse((0, import_fs.readFileSync)(existingSettings, "utf-8"));
|
|
77
|
+
hasKey = !!s.env?.MOONWATCH_API_KEY;
|
|
78
|
+
} catch {
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (hasKey) {
|
|
82
|
+
const overwrite = await prompt(" API key already configured. Overwrite? (y/N) ");
|
|
83
|
+
if (overwrite.toLowerCase() !== "y") {
|
|
84
|
+
console.log(" Skipping.\n");
|
|
85
|
+
console.log("Done.\n");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const apiKey = await prompt(" Enter your Moonwatch API key: ");
|
|
90
|
+
if (!apiKey) {
|
|
91
|
+
console.log(" No key provided, skipping.\n");
|
|
92
|
+
} else {
|
|
93
|
+
setupClaudeApiKey(apiKey);
|
|
94
|
+
console.log("");
|
|
95
|
+
}
|
|
96
|
+
console.log("Done. Your AI assistant now has access to the Moonwatch workflow guide.\n");
|
|
34
97
|
}
|
|
98
|
+
main();
|
package/dist/vite.js
CHANGED
|
@@ -27,7 +27,7 @@ var import_crypto = require("crypto");
|
|
|
27
27
|
var import_fs = require("fs");
|
|
28
28
|
var import_path = require("path");
|
|
29
29
|
var import_os = require("os");
|
|
30
|
-
var DEFAULT_ENDPOINT = "https://
|
|
30
|
+
var DEFAULT_ENDPOINT = "https://moonwatch.dev";
|
|
31
31
|
var RELEASE_FILE = (0, import_path.join)((0, import_os.tmpdir)(), ".moonwatch-release");
|
|
32
32
|
var RELEASE_FILE_MAX_AGE_MS = 5 * 60 * 1e3;
|
|
33
33
|
function collectMapFiles(dir) {
|
package/dist/vite.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { randomUUID } from "crypto";
|
|
|
5
5
|
import { existsSync, readdirSync, readFileSync, statSync, writeFileSync } from "fs";
|
|
6
6
|
import { join, relative } from "path";
|
|
7
7
|
import { tmpdir } from "os";
|
|
8
|
-
var DEFAULT_ENDPOINT = "https://
|
|
8
|
+
var DEFAULT_ENDPOINT = "https://moonwatch.dev";
|
|
9
9
|
var RELEASE_FILE = join(tmpdir(), ".moonwatch-release");
|
|
10
10
|
var RELEASE_FILE_MAX_AGE_MS = 5 * 60 * 1e3;
|
|
11
11
|
function collectMapFiles(dir) {
|