@myk794/adly 1.0.0 → 1.1.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 +70 -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,26 @@ 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
+ // Kazanç rozeti: fx açıksa yeşil nabız.
223
+ let bal = "";
224
+ if (st.balance) {
225
+ const raw = `${S.sep} ${S.lira}${st.balance}`;
226
+ bal = fx ? ` ${badge(raw, frame)}` : ` ${raw}`;
227
+ }
228
+ process.stdout.write(`${icon} ${line}${bal}`);
208
229
  }
209
230
 
210
231
  // OSC 8 tıklanabilir link: env ADLY_LINKS → config.links → varsayılan KAPALI.
@@ -217,6 +238,49 @@ function useLinks() {
217
238
  return c.links === true;
218
239
  }
219
240
 
241
+ // ---------- statusLine animasyonu (fx) ----------
242
+ // Claude Code statusLine komutunu periyodik yeniden çağırır; her çağrı tek
243
+ // kare basar. Kareyi Date.now()'dan türeterek ardışık çağrılar arasında
244
+ // hareket (kayan parıltı, nabız) elde ederiz. ANSI truecolor; renkler ASCII
245
+ // modunda da çalışır (emoji glyph derdi yok). env ADLY_FX → config.fx → varsayılan AÇIK.
246
+ function useFx() {
247
+ const env = process.env.ADLY_FX;
248
+ if (env === "1" || env === "true") return true;
249
+ if (env === "0" || env === "false") return false;
250
+ const c = readJSON(CONFIG_PATH, {});
251
+ if (typeof c.fx === "boolean") return c.fx;
252
+ return true;
253
+ }
254
+ const RST = "\x1b[0m";
255
+ const BOLD = "\x1b[1m";
256
+ function rgb(r, g, b) { return `\x1b[38;2;${r | 0};${g | 0};${b | 0}m`; }
257
+ 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]; }
258
+ // Metni soldan sağa kayan ember parıltısıyla boya (sönük gri zemin, sıcak hale).
259
+ function shimmer(text, frame) {
260
+ const base = [150, 147, 158], hot = [255, 178, 66];
261
+ const chars = [...text], n = chars.length;
262
+ const head = (frame % (n + 14)) - 7; // hale dışarıdan girip çıkar
263
+ let out = BOLD;
264
+ for (let i = 0; i < n; i++) {
265
+ const t = Math.max(0, 1 - Math.abs(i - head) / 5);
266
+ const [r, g, b] = mix(base, hot, t);
267
+ out += rgb(r, g, b) + chars[i];
268
+ }
269
+ return out + RST;
270
+ }
271
+ // Nabız atan ikon (parlaklık sinüsü).
272
+ function pulse(s, frame) {
273
+ const t = (Math.sin(frame / 3) + 1) / 2;
274
+ const [r, g, b] = mix([130, 74, 22], [255, 184, 74], t);
275
+ return BOLD + rgb(r, g, b) + s + RST;
276
+ }
277
+ // Yeşil kazanç rozeti (hafif nabız).
278
+ function badge(s, frame) {
279
+ const t = (Math.sin(frame / 3 + 1) + 1) / 2;
280
+ const [r, g, b] = mix([88, 170, 110], [150, 235, 170], t);
281
+ return rgb(r, g, b) + s + RST;
282
+ }
283
+
220
284
  // En son gösterilen reklamı tarayıcıda aç → tıklamayı kaydeder (50× kazanç), reklamverene yönlendirir.
221
285
  async function cmdOpen() {
222
286
  const cfg = loadConfig();
@@ -311,6 +375,7 @@ const [cmd, ...rest] = process.argv.slice(2);
311
375
  console.log(" adly config --api <url> backend URL (varsayılan: prod)");
312
376
  console.log(" adly config --ascii on|off|auto emoji yerine ASCII (Windows varsayılan: on)");
313
377
  console.log(" adly config --links on|off reklamı tıklanabilir yap (OSC 8, varsayılan: off)");
378
+ console.log(" adly config --fx on|off|auto statusLine animasyonu (varsayılan: on)");
314
379
  console.log(" adly status bakiye/istatistik");
315
380
  console.log(" adly open son reklamı tarayıcıda aç (tıklama = 50× kazanç)");
316
381
  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.1.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
+ }