@promptai.credit/cli 0.4.0 → 0.4.1
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/README.md +4 -2
- package/dist/index.js +21 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,13 +49,13 @@ promptai install claude # Claude Code hooks
|
|
|
49
49
|
promptai install cursor # Cursor Agents Window / classic IDE hooks
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
`promptai install` then asks for your email and payout wallet
|
|
52
|
+
`promptai install` then asks for your email and payout wallet. Ads dock on the **right** by default. Enter accepts a detected email.
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
55
|
promptai status # device, balance, banked ad watches, recent prompts
|
|
56
56
|
promptai watch # open a rewarded ad now (banks a credit for later)
|
|
57
57
|
promptai claim # USDC on Base
|
|
58
|
-
promptai
|
|
58
|
+
promptai off # toggle ads off (`promptai on` to turn them back on)
|
|
59
59
|
promptai set side left # or `default` for a normal browser tab
|
|
60
60
|
```
|
|
61
61
|
|
|
@@ -77,6 +77,8 @@ Developing from the repo instead: `pnpm --filter @promptai.credit/cli build`, th
|
|
|
77
77
|
as the default during `promptai install`. Auto-detected emails link without
|
|
78
78
|
verification; typing a different address (or `promptai set email`) sends a
|
|
79
79
|
6-digit code to prove ownership.
|
|
80
|
+
- Ads dock on the right by default. Toggle them anytime with `promptai on` /
|
|
81
|
+
`promptai off`.
|
|
80
82
|
- Headless environments (CI, ssh without a display) never get browser tabs and
|
|
81
83
|
simply skip crediting.
|
|
82
84
|
- Uninstall with `promptai uninstall claude`; other hooks in your settings are
|
package/dist/index.js
CHANGED
|
@@ -941,17 +941,6 @@ async function linkEmailInteractive(config, email, source) {
|
|
|
941
941
|
return false;
|
|
942
942
|
}
|
|
943
943
|
}
|
|
944
|
-
function parseYes(raw, defaultYes) {
|
|
945
|
-
const v = raw.trim().toLowerCase();
|
|
946
|
-
if (!v) return defaultYes;
|
|
947
|
-
return v === "y" || v === "yes";
|
|
948
|
-
}
|
|
949
|
-
function parseSide(raw) {
|
|
950
|
-
const v = raw.trim().toLowerCase();
|
|
951
|
-
if (v === "left" || v === "l") return "left";
|
|
952
|
-
if (v === "default" || v === "browser" || v === "n" || v === "no") return "default";
|
|
953
|
-
return "right";
|
|
954
|
-
}
|
|
955
944
|
async function onboard(config) {
|
|
956
945
|
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
957
946
|
if (!config.adSide) config.adSide = "right";
|
|
@@ -990,11 +979,7 @@ async function onboard(config) {
|
|
|
990
979
|
} else {
|
|
991
980
|
console.log("Skipped wallet. Set it later: promptai set wallet 0x...");
|
|
992
981
|
}
|
|
993
|
-
|
|
994
|
-
config.adSide = parseYes(sideRaw, true) ? "right" : parseSide(sideRaw);
|
|
995
|
-
console.log(
|
|
996
|
-
config.adSide === "right" ? "Ads will open on the right." : config.adSide === "left" ? "Ads will open on the left." : "Ads will open in your default browser."
|
|
997
|
-
);
|
|
982
|
+
config.adSide = config.adSide || "right";
|
|
998
983
|
saveConfig(config);
|
|
999
984
|
console.log("");
|
|
1000
985
|
}
|
|
@@ -1012,7 +997,7 @@ Usage:
|
|
|
1012
997
|
promptai set wallet 0x... Set the payout wallet
|
|
1013
998
|
promptai set email <email> Link your email (required for USDC claims; groups devices)
|
|
1014
999
|
promptai set server <url> Point at a different API server
|
|
1015
|
-
promptai
|
|
1000
|
+
promptai on | off Toggle rewarded ads
|
|
1016
1001
|
promptai set side right|left|default Where the ad window docks (default: right)
|
|
1017
1002
|
promptai hook (internal) invoked by agent hooks, JSON on stdin
|
|
1018
1003
|
`;
|
|
@@ -1145,15 +1130,13 @@ async function cmdSet(key, value) {
|
|
|
1145
1130
|
config.wallet = value;
|
|
1146
1131
|
} else if (key === "server" && value && /^https?:\/\//.test(value)) {
|
|
1147
1132
|
config.serverUrl = value.replace(/\/$/, "");
|
|
1148
|
-
} else if (key === "ads" && (value === "on" || value === "off")) {
|
|
1149
|
-
config.adsOptIn = value === "on";
|
|
1150
1133
|
} else if (key === "side" && (value === "right" || value === "left" || value === "default")) {
|
|
1151
1134
|
config.adSide = value;
|
|
1152
1135
|
} else if (key === "email" && value && /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(value)) {
|
|
1153
1136
|
config.email = value.trim().toLowerCase();
|
|
1154
1137
|
} else {
|
|
1155
1138
|
console.error(
|
|
1156
|
-
"Usage: promptai set wallet 0x... | set server <url> | set
|
|
1139
|
+
"Usage: promptai set wallet 0x... | set server <url> | set side right|left|default | set email you@example.com"
|
|
1157
1140
|
);
|
|
1158
1141
|
process.exitCode = 1;
|
|
1159
1142
|
return;
|
|
@@ -1172,6 +1155,16 @@ async function cmdSet(key, value) {
|
|
|
1172
1155
|
saveConfig(config);
|
|
1173
1156
|
console.log(`${key} updated.`);
|
|
1174
1157
|
}
|
|
1158
|
+
function cmdAds(on) {
|
|
1159
|
+
const config = loadConfig();
|
|
1160
|
+
config.adsOptIn = on;
|
|
1161
|
+
saveConfig(config);
|
|
1162
|
+
console.log(on ? "Ads on." : "Ads off.");
|
|
1163
|
+
}
|
|
1164
|
+
function printInstallNext() {
|
|
1165
|
+
console.log("You can toggle ads with promptai on / promptai off.");
|
|
1166
|
+
console.log("Try: promptai watch, then run a prompt.");
|
|
1167
|
+
}
|
|
1175
1168
|
async function cmdInstall(agent) {
|
|
1176
1169
|
if (agent === "claude" || agent === "claude-code") {
|
|
1177
1170
|
const { changed, settingsPath } = installClaudeHooks();
|
|
@@ -1180,7 +1173,7 @@ async function cmdInstall(agent) {
|
|
|
1180
1173
|
);
|
|
1181
1174
|
console.log("Claude Code picks them up on its next session.");
|
|
1182
1175
|
await onboard(loadConfig());
|
|
1183
|
-
|
|
1176
|
+
printInstallNext();
|
|
1184
1177
|
return;
|
|
1185
1178
|
}
|
|
1186
1179
|
if (agent === "cursor" || agent === "cursor-agents") {
|
|
@@ -1192,7 +1185,7 @@ async function cmdInstall(agent) {
|
|
|
1192
1185
|
"Works in the Agents Window and the classic IDE (the CLI stands down when the promptai extension is running). Cursor hot-reloads hooks.json."
|
|
1193
1186
|
);
|
|
1194
1187
|
await onboard(loadConfig());
|
|
1195
|
-
|
|
1188
|
+
printInstallNext();
|
|
1196
1189
|
return;
|
|
1197
1190
|
}
|
|
1198
1191
|
console.error("Supported agents: claude, cursor (Codex CLI coming next). Usage: promptai install <agent>");
|
|
@@ -1236,6 +1229,12 @@ try {
|
|
|
1236
1229
|
case "set":
|
|
1237
1230
|
await cmdSet(args[0], args[1]);
|
|
1238
1231
|
break;
|
|
1232
|
+
case "on":
|
|
1233
|
+
cmdAds(true);
|
|
1234
|
+
break;
|
|
1235
|
+
case "off":
|
|
1236
|
+
cmdAds(false);
|
|
1237
|
+
break;
|
|
1239
1238
|
default:
|
|
1240
1239
|
console.log(HELP);
|
|
1241
1240
|
if (command && command !== "help" && command !== "--help") process.exitCode = 1;
|