promptlike 0.12.4 → 0.12.5
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/CHANGELOG.md +13 -0
- package/README.md +5 -3
- package/dist/commands/feedback.js +37 -14
- package/dist/program.js +8 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.12.5 — 2026-10-31
|
|
4
|
+
|
|
5
|
+
- **Fix: a passing outage no longer ends a login.** If refreshing an expired session met a server error or rate limit
|
|
6
|
+
(HTTP 5xx / 429), `ple feedback` filed the report as "login refused" and told a signed-in user to run `ple login`.
|
|
7
|
+
Now only a definitive rejection counts as refused; an outage is treated like being offline (the report is queued,
|
|
8
|
+
the saved login is kept and the text says so).
|
|
9
|
+
- **`ple feedback` names the reason also when it sends at once without an account** (`"anonymous_reason"` in `--json`,
|
|
10
|
+
a line in the text output), not only when it queues.
|
|
11
|
+
- **`--help` numbers come from the code** (queue size, retry interval, `list` default and maximum rows), and
|
|
12
|
+
`ple feedback list --help` / `close --help` now print their own exit-code table.
|
|
13
|
+
- **`ple feedback close` no longer says "Nothing was changed" after a timeout or a server error**: the request may
|
|
14
|
+
have been applied. It says so and points to `ple feedback list`; `list` still says nothing was changed.
|
|
15
|
+
|
|
3
16
|
## 0.12.4 — 2026-10-31
|
|
4
17
|
|
|
5
18
|
- **Fix: `ple improve` and `ple loop` crashed on Node 18** (`crypto is not defined`): the attempt id used the global
|
package/README.md
CHANGED
|
@@ -769,7 +769,7 @@ anonymous. Who wrote it is decided from `--agent`, else from `PLE_AGENT=<name>`,
|
|
|
769
769
|
| `1` | Something unexpected |
|
|
770
770
|
| `2` | Usage or validation error — nothing was sent (bad flag, empty or too long message, secret found, rejected by the server) |
|
|
771
771
|
| `3` | Rate limited — try again after the delay shown |
|
|
772
|
-
| `4` | Server or network problem — the report was saved to the local queue (with `PLE_FEEDBACK_QUEUE=off`: nothing was saved); `list
|
|
772
|
+
| `4` | Server or network problem — the report was saved to the local queue (with `PLE_FEEDBACK_QUEUE=off`: nothing was saved); `list`: nothing was changed; `close`: it may have been applied, check with `ple feedback list` |
|
|
773
773
|
|
|
774
774
|
**Offline queue.** A report that could not be delivered is saved to `~/.promptlike/feedback/queue.json` (at most 50;
|
|
775
775
|
the oldest is dropped when it is full; mode `0600`). After any other `ple` command it is sent silently, with a
|
|
@@ -777,7 +777,7 @@ the oldest is dropped when it is full; mode `0600`). After any other `ple` comma
|
|
|
777
777
|
`suggest`, `import`) and never when the command failed. A report written while you are signed in is sent with that
|
|
778
778
|
same account only, and only while that account is still signed in with a session that is not about to expire and
|
|
779
779
|
that the server accepts. In every other case it goes out anonymously: written signed out (or while the saved login
|
|
780
|
-
could not be checked, e.g. offline with an expired session), signed out by the time it is sent, another account
|
|
780
|
+
could not be checked, e.g. offline, or the server busy, with an expired session), signed out by the time it is sent, another account
|
|
781
781
|
signed in at sending time, or the session refused. Signing in later never attaches an older report to the new account. Turn it off with `PLE_FEEDBACK_QUEUE=off`: then nothing is written to disk and a report that cannot be
|
|
782
782
|
delivered is simply not sent (exit code 4, run `ple feedback` again when you are online).
|
|
783
783
|
|
|
@@ -794,7 +794,9 @@ ple feedback close <id> --commit <sha> [--status done|wontfix] [--json]
|
|
|
794
794
|
`list` prints what the server returns (with `--json`: `{"ok":true,"exit_code":0,"items":[…]}` exactly as sent, e-mail
|
|
795
795
|
addresses included). `close` marks an item `done` (default) or `wontfix` and records the commit that resolved it
|
|
796
796
|
(`--commit` is required for `done`). They use `0` ok · `1` not signed in or not allowed · `2` bad input · `3` rate limit ·
|
|
797
|
-
`4` server or network problem (nothing is queued for these two
|
|
797
|
+
`4` server or network problem (nothing is queued for these two; after a `close` that got no clean answer the change may
|
|
798
|
+
have been applied: check with `ple feedback list` before closing it again). `ple feedback list --help` and
|
|
799
|
+
`ple feedback close --help` print their own table.
|
|
798
800
|
|
|
799
801
|
### `ple config get [key]` · `ple config set <key> <value>`
|
|
800
802
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* one it is anonymous.
|
|
21
21
|
*/
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.FEEDBACK_EXIT_CODES_HELP = exports.EXIT_QUEUED = exports.EXIT_RATE_LIMITED = exports.EXIT_USAGE = exports.EXIT_UNEXPECTED = exports.EXIT_SENT = void 0;
|
|
23
|
+
exports.MAX_LIST_LIMIT = exports.DEFAULT_LIST_LIMIT = exports.FEEDBACK_CLOSE_EXIT_CODES_HELP = exports.FEEDBACK_LIST_EXIT_CODES_HELP = exports.FEEDBACK_EXIT_CODES_HELP = exports.EXIT_QUEUED = exports.EXIT_RATE_LIMITED = exports.EXIT_USAGE = exports.EXIT_UNEXPECTED = exports.EXIT_SENT = void 0;
|
|
24
24
|
exports.feedbackCommand = feedbackCommand;
|
|
25
25
|
exports.feedbackListCommand = feedbackListCommand;
|
|
26
26
|
exports.feedbackCloseCommand = feedbackCloseCommand;
|
|
@@ -43,7 +43,23 @@ exports.FEEDBACK_EXIT_CODES_HELP = [
|
|
|
43
43
|
'1 unexpected problem (list / close: also not signed in, or not allowed)',
|
|
44
44
|
'2 usage or validation error — nothing was sent',
|
|
45
45
|
'3 rate limited — try again after the delay shown',
|
|
46
|
-
'4 server or network problem — a report is saved to the local queue and sent by a later `ple` command (PLE_FEEDBACK_QUEUE=off: not saved); list
|
|
46
|
+
'4 server or network problem — a report is saved to the local queue and sent by a later `ple` command (PLE_FEEDBACK_QUEUE=off: not saved); list: nothing was changed; close: it may have been applied, check with `ple feedback list`',
|
|
47
|
+
];
|
|
48
|
+
/** `list --help`: the same codes, in the words that fit a read. */
|
|
49
|
+
exports.FEEDBACK_LIST_EXIT_CODES_HELP = [
|
|
50
|
+
'0 listed',
|
|
51
|
+
'1 not signed in, not the owner account, session not accepted, or an unexpected answer',
|
|
52
|
+
'2 bad --status / --limit',
|
|
53
|
+
'3 rate limited — try again after the delay shown',
|
|
54
|
+
'4 server or network problem — nothing was changed',
|
|
55
|
+
];
|
|
56
|
+
/** `close --help`: the same codes, in the words that fit a write. */
|
|
57
|
+
exports.FEEDBACK_CLOSE_EXIT_CODES_HELP = [
|
|
58
|
+
'0 closed',
|
|
59
|
+
'1 not signed in, not the owner account, session not accepted, or an unexpected answer',
|
|
60
|
+
'2 bad id, --commit or --status, or no feedback with that id',
|
|
61
|
+
'3 rate limited — try again after the delay shown',
|
|
62
|
+
'4 server or network problem — if the request was already sent the change may have been applied: check with `ple feedback list`, do not assume it failed',
|
|
47
63
|
];
|
|
48
64
|
// ---------------------------------------------------------------------------
|
|
49
65
|
// Output
|
|
@@ -78,7 +94,11 @@ async function defaultToken() {
|
|
|
78
94
|
// The server could not be reached to refresh the session: it cannot take the report either.
|
|
79
95
|
if (err instanceof api_client_1.NetworkError || err instanceof api_client_1.RequestTimeoutError)
|
|
80
96
|
return { unreachable: err.message };
|
|
81
|
-
|
|
97
|
+
// A passing outage of the refresh (503 / 429 / 5xx) says nothing about the login: it stays valid, and the
|
|
98
|
+
// report waits like an offline one instead of being filed as "refused".
|
|
99
|
+
if (err instanceof api_client_1.ApiError && (err.status === 429 || err.status >= 500))
|
|
100
|
+
return { unreachable: err.message };
|
|
101
|
+
return { dead: true }; // a definitively rejected session must not block a report: it goes out anonymously
|
|
82
102
|
}
|
|
83
103
|
}
|
|
84
104
|
async function feedbackCommand(messageParts, opts = {}, deps = {}) {
|
|
@@ -138,10 +158,10 @@ async function submit(message, opts, deps, json) {
|
|
|
138
158
|
case 'sent':
|
|
139
159
|
setExit(exports.EXIT_SENT);
|
|
140
160
|
if (json)
|
|
141
|
-
emitJson({ ok: true, ...(result.id ? { id: result.id } : {}), exit_code: exports.EXIT_SENT, ...base, account: attachedAccount });
|
|
161
|
+
emitJson({ ok: true, ...(result.id ? { id: result.id } : {}), exit_code: exports.EXIT_SENT, ...base, account: attachedAccount, ...(attachedAccount ? {} : { anonymous_reason: anonReason }) });
|
|
142
162
|
else {
|
|
143
163
|
console.log(format_1.c.success('✓ Feedback sent — thank you.') + (result.id ? format_1.c.muted(` (id ${result.id})`) : ''));
|
|
144
|
-
console.log(format_1.c.muted(attachedAccount ? ' Tied to your account.' :
|
|
164
|
+
console.log(format_1.c.muted(attachedAccount ? ' Tied to your account.' : ` Sent anonymously (${ANON_REASON_TEXT[anonReason]}).${anonReason === 'signed_out' ? ' Sign in with `ple login` to attach reports to your account.' : ''}`));
|
|
145
165
|
}
|
|
146
166
|
return;
|
|
147
167
|
case 'invalid':
|
|
@@ -162,7 +182,7 @@ async function submit(message, opts, deps, json) {
|
|
|
162
182
|
}
|
|
163
183
|
const ANON_REASON_TEXT = {
|
|
164
184
|
signed_out: 'no account was signed in',
|
|
165
|
-
unchecked: 'the saved login could not be checked
|
|
185
|
+
unchecked: 'the saved login could not be checked right now (offline or the server is busy); it is kept',
|
|
166
186
|
refused: 'the saved login is no longer valid or the server did not accept it',
|
|
167
187
|
};
|
|
168
188
|
function queueIt(payload, reason, json, env, deps, base, userId, anonReason) {
|
|
@@ -223,11 +243,13 @@ async function ownerAuth() {
|
|
|
223
243
|
return token ? { token } : { error: 'This command needs a session. Sign in first: ple login', code: exports.EXIT_UNEXPECTED };
|
|
224
244
|
}
|
|
225
245
|
/** The same status → exit code mapping for both owner commands. Returns null when the response is a success (2xx). */
|
|
226
|
-
function ownerFailure(out) {
|
|
246
|
+
function ownerFailure(out, writes = false) {
|
|
247
|
+
// A read changes nothing. A write that got no clean answer (timeout, 5xx) may or may not have been applied.
|
|
248
|
+
const unsure = 'It may have been applied: check with `ple feedback list` before closing it again.';
|
|
227
249
|
if (out.kind === 'config')
|
|
228
250
|
return { code: exports.EXIT_USAGE, error: out.message };
|
|
229
251
|
if (out.kind === 'unreachable')
|
|
230
|
-
return { code: exports.EXIT_QUEUED, error: `${out.message} Nothing was changed
|
|
252
|
+
return { code: exports.EXIT_QUEUED, error: `${out.message} ${writes ? unsure : 'Nothing was changed.'}` };
|
|
231
253
|
const { status, body } = out;
|
|
232
254
|
if (status >= 200 && status < 300)
|
|
233
255
|
return null;
|
|
@@ -248,10 +270,11 @@ function ownerFailure(out) {
|
|
|
248
270
|
return { code: exports.EXIT_USAGE, error: (0, feedbackApi_1.serverMessage)(body, fallback) + (details ? ` (${details})` : '') };
|
|
249
271
|
}
|
|
250
272
|
if (status >= 500 || status === 408)
|
|
251
|
-
return { code: exports.EXIT_QUEUED, error: `The server answered HTTP ${status}. Nothing was changed
|
|
273
|
+
return { code: exports.EXIT_QUEUED, error: `The server answered HTTP ${status}. ${writes ? unsure : 'Nothing was changed.'}` };
|
|
252
274
|
return { code: exports.EXIT_UNEXPECTED, error: (0, feedbackApi_1.serverMessage)(body, `The server answered HTTP ${status}.`) };
|
|
253
275
|
}
|
|
254
|
-
|
|
276
|
+
exports.DEFAULT_LIST_LIMIT = 50;
|
|
277
|
+
exports.MAX_LIST_LIMIT = 200;
|
|
255
278
|
async function feedbackListCommand(opts = {}, deps = {}) {
|
|
256
279
|
const json = opts.json === true;
|
|
257
280
|
try {
|
|
@@ -259,10 +282,10 @@ async function feedbackListCommand(opts = {}, deps = {}) {
|
|
|
259
282
|
if (status !== undefined && !feedbackApi_1.FEEDBACK_STATUSES.includes(status)) {
|
|
260
283
|
return fail(json, exports.EXIT_USAGE, `--status must be one of: ${feedbackApi_1.FEEDBACK_STATUSES.join(', ')}.`);
|
|
261
284
|
}
|
|
262
|
-
let limit =
|
|
285
|
+
let limit = exports.DEFAULT_LIST_LIMIT;
|
|
263
286
|
if (opts.limit !== undefined) {
|
|
264
|
-
if (!/^\d{1,4}$/.test(opts.limit.trim()) || Number(opts.limit) < 1 || Number(opts.limit) > MAX_LIST_LIMIT) {
|
|
265
|
-
return fail(json, exports.EXIT_USAGE, `--limit must be a whole number from 1 to ${MAX_LIST_LIMIT}.`);
|
|
287
|
+
if (!/^\d{1,4}$/.test(opts.limit.trim()) || Number(opts.limit) < 1 || Number(opts.limit) > exports.MAX_LIST_LIMIT) {
|
|
288
|
+
return fail(json, exports.EXIT_USAGE, `--limit must be a whole number from 1 to ${exports.MAX_LIST_LIMIT}.`);
|
|
266
289
|
}
|
|
267
290
|
limit = Number(opts.limit);
|
|
268
291
|
}
|
|
@@ -361,7 +384,7 @@ async function feedbackCloseCommand(id, opts = {}, deps = {}) {
|
|
|
361
384
|
timeoutMs: feedbackApi_1.OWNER_TIMEOUT_MS,
|
|
362
385
|
fetchImpl: deps.fetchImpl,
|
|
363
386
|
});
|
|
364
|
-
const failure = ownerFailure(out);
|
|
387
|
+
const failure = ownerFailure(out, true);
|
|
365
388
|
if (failure)
|
|
366
389
|
return fail(json, failure.code, failure.error, failure.extra);
|
|
367
390
|
setExit(exports.EXIT_SENT);
|
package/dist/program.js
CHANGED
|
@@ -36,6 +36,7 @@ const suggest_1 = require("./commands/suggest");
|
|
|
36
36
|
const config_1 = require("./commands/config");
|
|
37
37
|
const repo_1 = require("./commands/repo");
|
|
38
38
|
const feedback_1 = require("./commands/feedback");
|
|
39
|
+
const feedbackQueue_1 = require("./lib/feedbackQueue");
|
|
39
40
|
const feedbackApi_1 = require("./lib/feedbackApi");
|
|
40
41
|
const feedbackInput_1 = require("./lib/feedbackInput");
|
|
41
42
|
const feedbackHint_1 = require("./lib/feedbackHint");
|
|
@@ -332,10 +333,11 @@ function buildProgram() {
|
|
|
332
333
|
'account; signed out it is anonymous. Do not put secrets or personal data in the message: a message that',
|
|
333
334
|
'looks like a key or token is refused.',
|
|
334
335
|
'',
|
|
335
|
-
|
|
336
|
-
|
|
336
|
+
`If the server cannot be reached the report is saved to ~/.promptlike/feedback/queue.json (max ${feedbackQueue_1.QUEUE_MAX}) and`,
|
|
337
|
+
`sent by a later \`ple\` command (at most every ${feedbackQueue_1.RETRY_INTERVAL_MS / 60000} minutes). A report written while you are signed in goes`,
|
|
337
338
|
'out with that same account only; otherwise (signed out by then, another account, a session about to expire',
|
|
338
|
-
'or refused, or a login that could not be checked offline) it goes out
|
|
339
|
+
'or refused, or a login that could not be checked while offline or the server is busy) it goes out',
|
|
340
|
+
'anonymously. With',
|
|
339
341
|
'PLE_FEEDBACK_QUEUE=off nothing is saved or sent later.',
|
|
340
342
|
'',
|
|
341
343
|
'Exit codes:',
|
|
@@ -348,8 +350,9 @@ function buildProgram() {
|
|
|
348
350
|
.command('list')
|
|
349
351
|
.description('List the feedback people sent (owner)')
|
|
350
352
|
.addOption(new commander_1.Option('--status <status>', `Only this status: ${feedbackApi_1.FEEDBACK_STATUSES.join(' | ')}`))
|
|
351
|
-
.option('-l, --limit <n>',
|
|
353
|
+
.option('-l, --limit <n>', `Max rows (default ${feedback_1.DEFAULT_LIST_LIMIT}, at most ${feedback_1.MAX_LIST_LIMIT})`)
|
|
352
354
|
.option('--json', 'Print the items as JSON, exactly as the server returned them')
|
|
355
|
+
.addHelpText('after', ['', 'Exit codes:', ...feedback_1.FEEDBACK_LIST_EXIT_CODES_HELP.map((l) => ` ${l}`), ''].join('\n'))
|
|
353
356
|
.action(runWithErrorHandler(async (opts, cmd) => (0, feedback_1.feedbackListCommand)({ ...opts, json: opts.json ?? cmd.optsWithGlobals().json === true })));
|
|
354
357
|
feedback
|
|
355
358
|
.command('close <id>')
|
|
@@ -357,6 +360,7 @@ function buildProgram() {
|
|
|
357
360
|
.option('--commit <sha>', 'The commit that resolved it (required for done)')
|
|
358
361
|
.addOption(new commander_1.Option('--status <status>', 'done (default) or wontfix'))
|
|
359
362
|
.option('--json', 'Print the result as one JSON line')
|
|
363
|
+
.addHelpText('after', ['', 'Exit codes:', ...feedback_1.FEEDBACK_CLOSE_EXIT_CODES_HELP.map((l) => ` ${l}`), ''].join('\n'))
|
|
360
364
|
.action(runWithErrorHandler(async (id, opts, cmd) => (0, feedback_1.feedbackCloseCommand)(id, { ...opts, json: opts.json ?? cmd.optsWithGlobals().json === true })));
|
|
361
365
|
// ---- insights & settings ------------------------------------------------
|
|
362
366
|
program
|
package/package.json
CHANGED