@myk794/adly 1.0.0 → 1.2.0

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.
Files changed (2) hide show
  1. package/adly.js +92 -5
  2. package/package.json +34 -34
package/adly.js CHANGED
@@ -114,8 +114,17 @@ function cmdConfig(args) {
114
114
  else return fail("kullanım: adly config --links <on|off>");
115
115
  writeJSON(CONFIG_PATH, next);
116
116
  console.log(`${sym().ok} Tıklanabilir link (OSC 8): ${useLinks() ? "AÇIK" : "KAPALI"}`);
117
+ } else if (args.indexOf("--fx") !== -1 && args[args.indexOf("--fx") + 1]) {
118
+ const v = args[args.indexOf("--fx") + 1].toLowerCase();
119
+ const next = { ...readJSON(CONFIG_PATH, {}) };
120
+ if (v === "on" || v === "1" || v === "true") next.fx = true;
121
+ else if (v === "off" || v === "0" || v === "false") next.fx = false;
122
+ else if (v === "auto") delete next.fx; // varsayılana dön (AÇIK)
123
+ else return fail("kullanım: adly config --fx <on|off|auto>");
124
+ writeJSON(CONFIG_PATH, next);
125
+ console.log(`${sym().ok} statusLine animasyonu (fx): ${useFx() ? "AÇIK" : "KAPALI"}`);
117
126
  } else {
118
- console.log(JSON.stringify({ ...loadConfig(), ascii: useAscii(), links: useLinks() }, null, 2));
127
+ console.log(JSON.stringify({ ...loadConfig(), ascii: useAscii(), links: useLinks(), fx: useFx() }, null, 2));
119
128
  }
120
129
  }
121
130
 
@@ -197,14 +206,29 @@ async function cmdLine() {
197
206
  // Ağ hatası: son bilinen satırı bas, çökme yok.
198
207
  }
199
208
 
200
- const bal = st.balance ? ` ${S.sep} ${S.lira}${st.balance}` : "";
201
- // İstenirse reklam metnini OSC 8 ile tıklanabilir yap (Ctrl/Cmd+click → tıklama 50× + reklamveren).
202
- let line = st.line || S.bolt + " Adly";
209
+ const adText = st.line || S.bolt + " Adly";
210
+ const fx = useFx();
211
+ const frame = Math.floor(Date.now() / 130); // ~7-8 fps; statusLine yenilemesi arası kare ilerler
212
+
213
+ // Reklam metni: fx açıksa kayan parıltı, kapalıysa düz.
214
+ let line = fx ? shimmer(adText, frame) : adText;
215
+ // İstenirse OSC 8 ile tıklanabilir yap (parıltı SGR kodları anchor içinde kalır).
203
216
  if (useLinks() && st.clickPath && st.line) {
204
217
  const url = loadConfig().api + st.clickPath;
205
218
  line = `\x1b]8;;${url}\x07${line}\x1b]8;;\x07`; // OSC 8: ESC ]8;;URL BEL metin ESC ]8;;BEL
206
219
  }
207
- process.stdout.write(`${S.money} ${line}${bal}`);
220
+ // İkon: fx açıksa nabız atar.
221
+ const icon = fx ? pulse(S.money, frame) : S.money;
222
+ // Baş tarafta dönen spinner, reklamdan sonra parıldayan yıldız (yalnız fx + gerçek reklam).
223
+ const lead = fx ? pulse(spinSym(frame), frame) + " " : "";
224
+ const tw = fx && st.line ? " " + star(twinkleSym(frame), frame) : "";
225
+ // Kazanç rozeti: fx açıksa yeşil nabız.
226
+ let bal = "";
227
+ if (st.balance) {
228
+ const raw = `${S.sep} ${S.lira}${st.balance}`;
229
+ bal = fx ? ` ${badge(raw, frame)}` : ` ${raw}`;
230
+ }
231
+ process.stdout.write(`${lead}${icon} ${line}${tw}${bal}`);
208
232
  }
209
233
 
210
234
  // OSC 8 tıklanabilir link: env ADLY_LINKS → config.links → varsayılan KAPALI.
@@ -217,6 +241,68 @@ function useLinks() {
217
241
  return c.links === true;
218
242
  }
219
243
 
244
+ // ---------- statusLine animasyonu (fx) ----------
245
+ // Claude Code statusLine komutunu periyodik yeniden çağırır; her çağrı tek
246
+ // kare basar. Kareyi Date.now()'dan türeterek ardışık çağrılar arasında
247
+ // hareket (kayan parıltı, nabız) elde ederiz. ANSI truecolor; renkler ASCII
248
+ // modunda da çalışır (emoji glyph derdi yok). env ADLY_FX → config.fx → varsayılan AÇIK.
249
+ function useFx() {
250
+ const env = process.env.ADLY_FX;
251
+ if (env === "1" || env === "true") return true;
252
+ if (env === "0" || env === "false") return false;
253
+ const c = readJSON(CONFIG_PATH, {});
254
+ if (typeof c.fx === "boolean") return c.fx;
255
+ return true;
256
+ }
257
+ const RST = "\x1b[0m";
258
+ const BOLD = "\x1b[1m";
259
+ function rgb(r, g, b) { return `\x1b[38;2;${r | 0};${g | 0};${b | 0}m`; }
260
+ function mix(a, b, t) { return [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t]; }
261
+ // Metni soldan sağa kayan ember parıltısıyla boya (sönük gri zemin, sıcak hale).
262
+ function shimmer(text, frame) {
263
+ const base = [150, 147, 158], hot = [255, 178, 66];
264
+ const chars = [...text], n = chars.length;
265
+ const head = (frame % (n + 14)) - 7; // hale dışarıdan girip çıkar
266
+ let out = BOLD;
267
+ for (let i = 0; i < n; i++) {
268
+ const t = Math.max(0, 1 - Math.abs(i - head) / 5);
269
+ const [r, g, b] = mix(base, hot, t);
270
+ out += rgb(r, g, b) + chars[i];
271
+ }
272
+ return out + RST;
273
+ }
274
+ // Nabız atan ikon (parlaklık sinüsü).
275
+ function pulse(s, frame) {
276
+ const t = (Math.sin(frame / 3) + 1) / 2;
277
+ const [r, g, b] = mix([130, 74, 22], [255, 184, 74], t);
278
+ return BOLD + rgb(r, g, b) + s + RST;
279
+ }
280
+ // Yeşil kazanç rozeti (hafif nabız).
281
+ function badge(s, frame) {
282
+ const t = (Math.sin(frame / 3 + 1) + 1) / 2;
283
+ const [r, g, b] = mix([88, 170, 110], [150, 235, 170], t);
284
+ return rgb(r, g, b) + s + RST;
285
+ }
286
+ // Kareli animasyon sembolleri. ASCII modunda da çalışan alternatifler var
287
+ // (Windows'ta emoji/unicode yıldız glyph'i olmayabilir → sade işaretler).
288
+ function frameOf(frame, arr) { return arr[((frame % arr.length) + arr.length) % arr.length]; }
289
+ function spinSym(frame) {
290
+ return useAscii()
291
+ ? frameOf(frame, ["|", "/", "-", "\\"])
292
+ : frameOf(frame, ["◜", "◠", "◝", "◞", "◡", "◟"]);
293
+ }
294
+ function twinkleSym(frame) {
295
+ return useAscii()
296
+ ? frameOf(frame, [".", "o", "O", "o"])
297
+ : frameOf(frame, ["✦", "✶", "✦", "·"]);
298
+ }
299
+ // Parlayan yıldız (beyaz→ember nabız).
300
+ function star(s, frame) {
301
+ const t = (Math.sin(frame / 2) + 1) / 2;
302
+ const [r, g, b] = mix([176, 150, 96], [255, 236, 184], t);
303
+ return BOLD + rgb(r, g, b) + s + RST;
304
+ }
305
+
220
306
  // En son gösterilen reklamı tarayıcıda aç → tıklamayı kaydeder (50× kazanç), reklamverene yönlendirir.
221
307
  async function cmdOpen() {
222
308
  const cfg = loadConfig();
@@ -311,6 +397,7 @@ const [cmd, ...rest] = process.argv.slice(2);
311
397
  console.log(" adly config --api <url> backend URL (varsayılan: prod)");
312
398
  console.log(" adly config --ascii on|off|auto emoji yerine ASCII (Windows varsayılan: on)");
313
399
  console.log(" adly config --links on|off reklamı tıklanabilir yap (OSC 8, varsayılan: off)");
400
+ console.log(" adly config --fx on|off|auto statusLine animasyonu (varsayılan: on)");
314
401
  console.log(" adly status bakiye/istatistik");
315
402
  console.log(" adly open son reklamı tarayıcıda aç (tıklama = 50× kazanç)");
316
403
  console.log(" adly watch canlı demo (terminal)");
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
- {
2
- "name": "@myk794/adly",
3
- "version": "1.0.0",
4
- "description": "Adly CLI — Claude Code statusLine'ını sponsorlu satıra çevirir; izledikçe kazanırsın.",
5
- "bin": {
6
- "adly": "adly.js"
7
- },
8
- "files": [
9
- "adly.js"
10
- ],
11
- "keywords": [
12
- "adly",
13
- "claude-code",
14
- "statusline",
15
- "cli",
16
- "ads"
17
- ],
18
- "engines": {
19
- "node": ">=20"
20
- },
21
- "license": "MIT",
22
- "homepage": "https://github.com/myk794/Adly#readme",
23
- "bugs": {
24
- "url": "https://github.com/myk794/Adly/issues"
25
- },
26
- "repository": {
27
- "type": "git",
28
- "url": "git+https://github.com/myk794/Adly.git",
29
- "directory": "cli"
30
- },
31
- "publishConfig": {
32
- "access": "public"
33
- }
34
- }
1
+ {
2
+ "name": "@myk794/adly",
3
+ "version": "1.2.0",
4
+ "description": "Adly CLI — Claude Code statusLine'ını sponsorlu satıra çevirir; izledikçe kazanırsın.",
5
+ "bin": {
6
+ "adly": "adly.js"
7
+ },
8
+ "files": [
9
+ "adly.js"
10
+ ],
11
+ "keywords": [
12
+ "adly",
13
+ "claude-code",
14
+ "statusline",
15
+ "cli",
16
+ "ads"
17
+ ],
18
+ "engines": {
19
+ "node": ">=20"
20
+ },
21
+ "license": "MIT",
22
+ "homepage": "https://github.com/myk794/Adly#readme",
23
+ "bugs": {
24
+ "url": "https://github.com/myk794/Adly/issues"
25
+ },
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/myk794/Adly.git",
29
+ "directory": "cli"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ }
34
+ }