promptlike 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/CHANGELOG.md +24 -0
- package/dist/commands/save.js +6 -4
- package/dist/commands/sync.js +23 -9
- package/dist/index.js +1 -1
- package/dist/lib/localStore.js +14 -1
- package/dist/lib/loopApi.js +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.1 — 2026-08-15
|
|
4
|
+
|
|
5
|
+
Data-integrity fix — **update recommended for every 0.4.0 install.**
|
|
6
|
+
|
|
7
|
+
- **Fixed: empty frontmatter fields swallowed the next line on read.** A prompt
|
|
8
|
+
saved without `-d`/`-t` (the most common form) read back with
|
|
9
|
+
`description: "tags:"` and a phantom tag like `created: <timestamp>`;
|
|
10
|
+
`--force` re-saves made the corruption permanent and `ple sync` could upload
|
|
11
|
+
the phantom tag to your account. Root cause: a `\s*` in the parser crossed
|
|
12
|
+
line endings. Files written by 0.4.0 are re-read correctly after this fix
|
|
13
|
+
unless they were re-saved with `--force` (open the file and delete the stray
|
|
14
|
+
text from `description:`/`tags:` lines if so).
|
|
15
|
+
- `ple sync` now reports partial success when a later batch hits the plan
|
|
16
|
+
limit, instead of dying with a bare error after silently uploading a batch.
|
|
17
|
+
The server also accounts for records dropped mid-loop by the limit trigger,
|
|
18
|
+
so uploaded + failed + skipped + truncated always adds up.
|
|
19
|
+
- Out-of-tokens (402) now says what it means: top up with a $3 MicroBoost or
|
|
20
|
+
wait for the monthly reset — instead of a generic "temporarily unavailable".
|
|
21
|
+
- Duplicate-slug error now shows the existing prompt's actual title (two
|
|
22
|
+
different titles can slugify to the same name).
|
|
23
|
+
- A single `--tag "a,b"` is stored as two tags instead of silently splitting
|
|
24
|
+
on the next read.
|
|
25
|
+
- `ple search --help` now says local mode also searches bodies and tags.
|
|
26
|
+
|
|
3
27
|
## 0.4.0 — 2026-08-10
|
|
4
28
|
|
|
5
29
|
The install is no longer a dead end.
|
package/dist/commands/save.js
CHANGED
|
@@ -118,10 +118,13 @@ async function saveCommand(title, options = {}) {
|
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
const slug = store.slugify(cleanTitle);
|
|
121
|
+
const previous = store.read(slug);
|
|
121
122
|
// Overwriting someone's prompt silently is the one unrecoverable thing this
|
|
122
|
-
// command could do — the local store keeps no versions.
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
// command could do — the local store keeps no versions. Farklı başlıklar
|
|
124
|
+
// aynı slug'a inebilir ("a/b" ve "a:b" → "ab"); mesaj bu yüzden mevcut
|
|
125
|
+
// kaydın GERÇEK başlığını söyler, kullanıcının hiç yazmadığı slug'ı değil.
|
|
126
|
+
if (previous && !options.force) {
|
|
127
|
+
console.error(format_1.c.error(`'${slug}' already exists (saved as "${previous.title}").`));
|
|
125
128
|
console.error(format_1.c.muted('Overwrite it with --force, or pick a different title.'));
|
|
126
129
|
process.exitCode = 1;
|
|
127
130
|
return;
|
|
@@ -129,7 +132,6 @@ async function saveCommand(title, options = {}) {
|
|
|
129
132
|
// On --force, fields the user did not re-specify are CARRIED OVER.
|
|
130
133
|
// Overwriting the body must not silently wipe tags and the description —
|
|
131
134
|
// the local store keeps no versions, so that loss is unrecoverable.
|
|
132
|
-
const previous = store.read(slug);
|
|
133
135
|
const tags = options.tag && options.tag.length > 0 ? options.tag : (previous?.tags ?? []);
|
|
134
136
|
const description = options.description?.trim() ?? previous?.description ?? '';
|
|
135
137
|
const saved = store.save({ slug, title: cleanTitle, description, tags, body });
|
package/dist/commands/sync.js
CHANGED
|
@@ -78,21 +78,35 @@ async function syncCommand(options = {}) {
|
|
|
78
78
|
let truncatedByQuota = 0;
|
|
79
79
|
let tagsApplied = 0;
|
|
80
80
|
let serverCarriesTags = true;
|
|
81
|
+
// Batch hatası (ör. 2. batch'te plan limiti → HTTP 429) yükseltilirse bile
|
|
82
|
+
// 1. batch'in SONUCU raporlanmak zorunda: "✗ limit" tek satırıyla susmak,
|
|
83
|
+
// yüklenmiş 50 prompt'u yok saymaktı (denetim bulgusu 2a).
|
|
84
|
+
let abortMessage = null;
|
|
81
85
|
for (let i = 0; i < payload.length; i += BATCH) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
try {
|
|
87
|
+
const res = await (0, api_client_1.importPrompts)(payload.slice(i, i + BATCH));
|
|
88
|
+
imported += res.imported;
|
|
89
|
+
failed += res.failed;
|
|
90
|
+
skippedInvalid += res.skippedInvalid;
|
|
91
|
+
truncatedByQuota += res.truncatedByQuota;
|
|
92
|
+
if (res.tagsApplied === undefined)
|
|
93
|
+
serverCarriesTags = false;
|
|
94
|
+
else
|
|
95
|
+
tagsApplied += res.tagsApplied;
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
abortMessage = err instanceof Error ? err.message : String(err);
|
|
99
|
+
truncatedByQuota += payload.length - i; // bu ve sonraki batch'ler gitmedi
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
91
102
|
}
|
|
92
103
|
const tagNote = serverCarriesTags && tagsApplied > 0 ? ` (+${tagsApplied} tag link${tagsApplied === 1 ? '' : 's'})` : '';
|
|
93
104
|
console.log(format_1.c.success(`✓ Uploaded ${imported} prompt${imported === 1 ? '' : 's'}${tagNote}`));
|
|
94
105
|
// Each shortfall gets its own line with its own fix — "12 of 20 synced"
|
|
95
106
|
// with no reason is the kind of message that sends people to support.
|
|
107
|
+
if (abortMessage) {
|
|
108
|
+
console.log(format_1.c.warn(`⚠ Stopped early: ${abortMessage}`));
|
|
109
|
+
}
|
|
96
110
|
if (truncatedByQuota > 0) {
|
|
97
111
|
console.log(format_1.c.warn(`⚠ ${truncatedByQuota} not uploaded — plan prompt limit reached.`));
|
|
98
112
|
console.log(format_1.c.muted(' Upgrade for unlimited prompts, then run `ple sync` again.'));
|
package/dist/index.js
CHANGED
|
@@ -102,6 +102,6 @@ program
|
|
|
102
102
|
.action(runWithErrorHandler(loop_1.loopCommand));
|
|
103
103
|
program
|
|
104
104
|
.command('search <keyword>')
|
|
105
|
-
.description('Search
|
|
105
|
+
.description('Search titles and descriptions (signed out: also local prompt bodies and tags)')
|
|
106
106
|
.action(runWithErrorHandler(search_1.searchCommand));
|
|
107
107
|
program.parseAsync(process.argv);
|
package/dist/lib/localStore.js
CHANGED
|
@@ -145,7 +145,12 @@ function parse(slug, raw) {
|
|
|
145
145
|
const header = raw.slice(3, end);
|
|
146
146
|
const body = raw.slice(end + 4).replace(/^\r?\n/, '');
|
|
147
147
|
const field = (name) => {
|
|
148
|
-
|
|
148
|
+
// [ \t]* — ASLA \s* değil: \s satır sonunu da eşler; alan boşken
|
|
149
|
+
// (`description:`) bir SONRAKİ frontmatter satırını yutuyordu. 0.4.0'da
|
|
150
|
+
// yayınlanan veri-bozma hatası buydu: bayraksız `ple save` sonrası
|
|
151
|
+
// description "tags:" oluyor, tags ["created: <ts>"] oluyor; --force
|
|
152
|
+
// taşıması çöpü dosyaya kalıcı yazıyor, sync hesaba sızdırıyordu.
|
|
153
|
+
const m = header.match(new RegExp(`^${name}:[ \\t]*(.*)$`, 'm'));
|
|
149
154
|
return m ? m[1].trim() : '';
|
|
150
155
|
};
|
|
151
156
|
const tags = field('tags')
|
|
@@ -177,8 +182,16 @@ function save(p) {
|
|
|
177
182
|
ensureDir();
|
|
178
183
|
const now = new Date().toISOString();
|
|
179
184
|
const previous = exists(p.slug) ? read(p.slug) : null;
|
|
185
|
+
// Etiketler virgülde bölünür: serialize ', ' ile birleştirip parse virgülden
|
|
186
|
+
// böldüğü için virgül içeren tek etiket zaten round-trip edemez — sessiz
|
|
187
|
+
// bölünme yerine kayıtta normalize edilir.
|
|
188
|
+
const tags = p.tags
|
|
189
|
+
.flatMap((t) => t.split(','))
|
|
190
|
+
.map((t) => t.trim())
|
|
191
|
+
.filter(Boolean);
|
|
180
192
|
const record = {
|
|
181
193
|
...p,
|
|
194
|
+
tags,
|
|
182
195
|
// Overwriting keeps the original creation time — the file has a history
|
|
183
196
|
// even though this store does not keep versions.
|
|
184
197
|
created: p.created || previous?.created || now,
|
package/dist/lib/loopApi.js
CHANGED
|
@@ -56,8 +56,9 @@ async function bearerPost(path, body) {
|
|
|
56
56
|
if (res.status === 403)
|
|
57
57
|
throw new Error(proMessage(parsed.error));
|
|
58
58
|
if (res.status === 402) {
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
// Satış anı, hata anı değil: MicroBoost adıyla ve fiyatıyla anılır.
|
|
60
|
+
const base = parsed.error?.trim() || "You've used this month's AI tokens";
|
|
61
|
+
throw new Error(`${base}\n Top up: $3 MicroBoost (600K tokens) → ${constants_1.API_BASE_URL}/dashboard/settings`);
|
|
61
62
|
}
|
|
62
63
|
if (res.status === 429) {
|
|
63
64
|
const retryAfter = res.headers.get('retry-after');
|
package/package.json
CHANGED