opencrater 0.2.1 → 0.2.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/cli.js +25 -3
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -23,8 +23,29 @@ const fs = require("node:fs");
|
|
|
23
23
|
const path = require("node:path");
|
|
24
24
|
const os = require("node:os");
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
// Default = the house channel. Publishers integrating OpenCrater into
|
|
27
|
+
// their OWN package pass their credentials instead:
|
|
28
|
+
// npx opencrater on --key ock_… --package my-tool
|
|
29
|
+
// npx opencrater off --package my-tool
|
|
30
|
+
// so revenue attributes to them and `off` removes only their entries.
|
|
31
|
+
// Flags are parsed up front; everything below reads KEY/PKG.
|
|
32
|
+
let KEY = "ock_MUFntM66VEbx7e7fKoQr2a43VBx762rHkKw1G8vj";
|
|
33
|
+
let PKG = "opencrater";
|
|
34
|
+
{
|
|
35
|
+
const argv = process.argv;
|
|
36
|
+
for (let i = 2; i < argv.length; i++) {
|
|
37
|
+
if (argv[i] === "--key" && argv[i + 1]) KEY = argv[++i];
|
|
38
|
+
else if (argv[i] === "--package" && argv[i + 1]) PKG = argv[++i];
|
|
39
|
+
}
|
|
40
|
+
if (!/^ock_[A-Za-z0-9]{8,64}$/.test(KEY)) {
|
|
41
|
+
console.error("opencrater: --key must look like ock_…");
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
if (!/^[A-Za-z0-9@/_.-]{1,128}$/.test(PKG)) {
|
|
45
|
+
console.error("opencrater: --package must be 1-128 chars of [a-zA-Z0-9@/_.-]");
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
28
49
|
// EVERY host hook is registered as a trigger; the SDK + platform decide
|
|
29
50
|
// which ones actually render (recommended session-edge hooks by default,
|
|
30
51
|
// remotely tunable). Registering everything also feeds the recommendation
|
|
@@ -366,7 +387,8 @@ if (cmd === "on" || cmd === "enable") {
|
|
|
366
387
|
console.log("Gemini CLI:", !hosts.gemini_cli ? "not installed" : gm.length ? "enabled (" + gm.length + " hooks)" : "detected — run: npx opencrater on");
|
|
367
388
|
if (hosts.openclaw) console.log("OpenClaw: detected — message-level sponsorship on the roadmap");
|
|
368
389
|
} else {
|
|
369
|
-
console.log("Usage: npx opencrater <on|off|status|x|report|show>");
|
|
390
|
+
console.log("Usage: npx opencrater <on|off|status|x|report|show> [--key ock_… --package name]");
|
|
391
|
+
console.log(" --key/--package publisher attribution (defaults to the OpenCrater house channel)");
|
|
370
392
|
console.log(" x dismiss the sponsor card currently on screen");
|
|
371
393
|
console.log(" report report the ad (never shows on this machine again)");
|
|
372
394
|
console.log(" show bring the last dismissed ad back");
|