newsline-cli 1.0.0 → 1.0.2

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 CHANGED
@@ -70,7 +70,7 @@ Re-run `newsline init`, or edit `~/.config/newsline/config.json`:
70
70
  | `count` | `15` | headlines in rotation |
71
71
  | `maxlen` | `120` | max characters (`max` = no cut) |
72
72
  | `icon` | `📰` | leading glyph (`none` to hide) |
73
- | `color` | `cyan` | headline color: `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
73
+ | `color` | `magenta` | headline color: `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
74
74
 
75
75
  Set one directly with `newsline color <name>` (e.g. `newsline color gray`), or run
76
76
  `newsline color` with no name to step to the next color (default → gray → white → cyan →
@@ -98,7 +98,13 @@ Claude Code plugin: run `/plugin marketplace update itdar`, then `/reload-plugin
98
98
  ## Uninstall
99
99
 
100
100
  ```sh
101
- newsline uninstall # restores your previous status line
101
+ newsline uninstall # restores your previous status line
102
+ newsline uninstall --purge # also removes the CLI binary + the PATH line install.sh added
102
103
  ```
103
104
 
104
105
  Needs `bash` + `python3` (macOS / Linux; Windows via WSL).
106
+
107
+ ## Contributing
108
+
109
+ Bug reports and PRs welcome — see [CONTRIBUTING.md](CONTRIBUTING.md) for local setup,
110
+ testing, and the release process.
package/install.sh CHANGED
@@ -34,6 +34,32 @@ ln -sf "$SHARE/newsline" "$BIN/newsline"
34
34
 
35
35
  echo "✔ installed: $BIN/newsline"
36
36
 
37
+ # Garbage-collect stale PATH lines from earlier installs whose prefix no longer
38
+ # exists (e.g. throwaway test prefixes), so rc files don't pile up dead newsline
39
+ # entries that shadow the current install. Only drops blocks whose dir is gone.
40
+ prune_stale_newsline_path() { # $1 = rc file
41
+ [ -f "$1" ] || return 0
42
+ awk '
43
+ /^# added by newsline installer$/ {
44
+ marker=$0
45
+ if ((getline pl) > 0) {
46
+ keep=1
47
+ if (match(pl, /\/[^ "]*\/bin/)) {
48
+ d=substr(pl, RSTART, RLENGTH)
49
+ if (system("[ -d \"" d "\" ]") != 0) keep=0
50
+ }
51
+ if (keep) { print marker; print pl }
52
+ next
53
+ }
54
+ print marker; next
55
+ }
56
+ { print }
57
+ ' "$1" > "$1.nltmp" 2>/dev/null && mv "$1.nltmp" "$1"
58
+ }
59
+ for rc in "$HOME/.zshrc" "$HOME/.bashrc" "$HOME/.profile" "$HOME/.config/fish/config.fish"; do
60
+ prune_stale_newsline_path "$rc"
61
+ done
62
+
37
63
  # Register $BIN on PATH for future shells (idempotent), by shell rc file.
38
64
  case ":$PATH:" in
39
65
  *":$BIN:"*)
package/newsline CHANGED
@@ -193,14 +193,14 @@ cmd_init() {
193
193
  fi
194
194
  local cur_color; cur_color=$(cfg_get color)
195
195
  echo "Select headline color (change anytime: newsline color):" >&2
196
- choose "${cur_color:-cyan}" \
196
+ choose "${cur_color:-magenta}" \
197
197
  default "Terminal default" cyan "Cyan" gray "Gray" white "White" \
198
198
  yellow "Yellow" green "Green" blue "Blue" magenta "Magenta" red "Red"
199
199
  color="$CHOICE"
200
200
  else
201
- # --yes: keep a color previously set via init/`newsline color`; cyan on first run
201
+ # --yes: keep a color previously set via init/`newsline color`; magenta on first run
202
202
  lang="${lang:-$detected}"; topic="${topic:-general}"
203
- color=$(cfg_get color); [ -n "$color" ] || color="cyan"
203
+ color=$(cfg_get color); [ -n "$color" ] || color="magenta"
204
204
  fi
205
205
 
206
206
  # Always KEEP an existing status line and show newsline below it (no prompt).
@@ -342,6 +342,8 @@ PY
342
342
  }
343
343
 
344
344
  cmd_uninstall() {
345
+ local purge=0 a
346
+ for a in "$@"; do case "$a" in --purge|-p) purge=1 ;; esac; done
345
347
  local base base_obj
346
348
  base=$(cfg_get base_statusline)
347
349
  base_obj=$(cfg_get_obj base_statusline_obj)
@@ -378,6 +380,48 @@ PY
378
380
  local cache="${NEWSLINE_CACHE:-$HOME/.cache/newsline}"
379
381
  rm -f "$CONFIG" "$cache/line" "$cache/feeds.resolved.json" "$cache/feeds.resolved.ok" "$cache/notice" 2>/dev/null
380
382
  echo "✔ newsline uninstalled."
383
+
384
+ [ "$purge" = "1" ] || return 0
385
+ # --purge: also remove the CLI binary + the PATH line install.sh added. Only for
386
+ # the install.sh layout ($PREFIX/share/newsline + $PREFIX/bin/newsline); a
387
+ # package-managed install (brew/npm) is left to its own package manager.
388
+ case "$HERE" in
389
+ */share/newsline)
390
+ local prefix bin rc
391
+ prefix="$(cd "$HERE/../.." 2>/dev/null && pwd)"; bin="$prefix/bin"
392
+ if [ -e "$bin/newsline" ]; then
393
+ rm -f "$bin/newsline"
394
+ rm -rf "$HERE" # $PREFIX/share/newsline (this script's dir)
395
+ for rc in "$HOME/.zshrc" "$HOME/.bashrc" "$HOME/.profile" "$HOME/.config/fish/config.fish"; do
396
+ [ -f "$rc" ] || continue
397
+ awk -v bin="$bin" '
398
+ function strip(p){ sub(/^\/private/, "", p); return p } # macOS /var == /private/var
399
+ /^# added by newsline installer$/ {
400
+ marker=$0
401
+ if ((getline pl) > 0) {
402
+ drop=0
403
+ if (match(pl, /\/[^ "]*\/bin/)) {
404
+ d=substr(pl, RSTART, RLENGTH)
405
+ if (strip(d) == strip(bin)) drop=1 # our block -> drop marker + path line
406
+ }
407
+ if (drop) next
408
+ print marker; print pl; next
409
+ }
410
+ print marker; next
411
+ }
412
+ { print }
413
+ ' "$rc" > "$rc.nltmp" 2>/dev/null && mv "$rc.nltmp" "$rc"
414
+ done
415
+ echo "✔ purged CLI: removed $bin/newsline and its PATH entry (open a new shell to refresh PATH)."
416
+ else
417
+ echo "ℹ nothing to purge (no $bin/newsline)."
418
+ fi
419
+ ;;
420
+ *)
421
+ echo "ℹ this CLI wasn't installed via install.sh (looks package-managed);"
422
+ echo " remove it with: brew uninstall newsline or npm uninstall -g newsline-cli"
423
+ ;;
424
+ esac
381
425
  }
382
426
 
383
427
  usage() {
@@ -390,7 +434,8 @@ newsline — local news status-line utility
390
434
  white → cyan → yellow → green → blue →
391
435
  magenta → red → back to default
392
436
  newsline colorlist list the available colors with a preview
393
- newsline uninstall remove & restore previous status line
437
+ newsline uninstall [--purge] remove & restore previous status line
438
+ (--purge also deletes the CLI + PATH line)
394
439
  EOF
395
440
  if [ "${1:-}" = "--all" ]; then
396
441
  cat <<'EOF'
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "newsline-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Locale-aware one-line news in your Claude Code status line — local, composes with your existing status line.",
5
5
  "bin": {
6
6
  "newsline": "newsline"
7
7
  },
8
+ "scripts": {
9
+ "sync-version": "bash scripts/sync-version.sh",
10
+ "version": "npm run --silent sync-version && git add package.json .claude-plugin/plugin.json .claude-plugin/marketplace.json refresh.sh"
11
+ },
8
12
  "files": [
9
13
  "newsline",
10
14
  "statusline.sh",
package/readme/de.md CHANGED
@@ -73,7 +73,7 @@ Führe `newsline init` erneut aus oder bearbeite `~/.config/newsline/config.json
73
73
  | `count` | `15` | Schlagzeilen im Wechsel |
74
74
  | `maxlen` | `120` | maximale Zeichen (`max` = kein Abschneiden) |
75
75
  | `icon` | `📰` | vorangestelltes Symbol (`none` zum Ausblenden) |
76
- | `color` | `cyan` | Farbe der Schlagzeile: `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
76
+ | `color` | `magenta` | Farbe der Schlagzeile: `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
77
77
 
78
78
  Eine direkt setzen mit `newsline color <name>` (z. B. `newsline color gray`), oder
79
79
  `newsline color` ohne Namen ausführen, um zur nächsten Farbe zu wechseln (default → gray →
package/readme/es.md CHANGED
@@ -72,7 +72,7 @@ Vuelve a ejecutar `newsline init` o edita `~/.config/newsline/config.json`:
72
72
  | `count` | `15` | titulares en rotación |
73
73
  | `maxlen` | `120` | caracteres máximos (`max` = sin recorte) |
74
74
  | `icon` | `📰` | icono inicial (`none` para ocultarlo) |
75
- | `color` | `cyan` | color del titular: `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
75
+ | `color` | `magenta` | color del titular: `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
76
76
 
77
77
  Fija uno directamente con `newsline color <nombre>` (p. ej. `newsline color gray`), o usa
78
78
  `newsline color` sin nombre para pasar al siguiente color (default → gray → white → cyan →
package/readme/fr.md CHANGED
@@ -73,7 +73,7 @@ Relancez `newsline init`, ou modifiez `~/.config/newsline/config.json` :
73
73
  | `count` | `15` | titres en rotation |
74
74
  | `maxlen` | `120` | caractères maximum (`max` = sans coupure) |
75
75
  | `icon` | `📰` | icône de tête (`none` pour masquer) |
76
- | `color` | `cyan` | couleur du titre : `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
76
+ | `color` | `magenta` | couleur du titre : `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
77
77
 
78
78
  Définissez-en une directement avec `newsline color <nom>` (p. ex. `newsline color gray`), ou
79
79
  utilisez `newsline color` sans nom pour passer à la couleur suivante (default → gray → white →
package/readme/ja.md CHANGED
@@ -71,7 +71,7 @@ npm i -g newsline-cli && newsline init
71
71
  | `count` | `15` | 切り替えるヘッドライン数 |
72
72
  | `maxlen` | `120` | 最大文字数(`max` = 無制限) |
73
73
  | `icon` | `📰` | 先頭アイコン(`none` で非表示) |
74
- | `color` | `cyan` | 見出しの文字色:`default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
74
+ | `color` | `magenta` | 見出しの文字色:`default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
75
75
 
76
76
  `newsline color <名前>` で色を直接指定でき(例:`newsline color gray`)、名前なしで
77
77
  `newsline color` を実行すると次の色へ進みます(default → gray → white → cyan → yellow →
package/readme/ko.md CHANGED
@@ -67,7 +67,7 @@ npm i -g newsline-cli && newsline init
67
67
  | `count` | `15` | 회전 헤드라인 수 |
68
68
  | `maxlen` | `120` | 최대 글자수 (`max`=무제한) |
69
69
  | `icon` | `📰` | 앞 아이콘 (`none`이면 제거) |
70
- | `color` | `cyan` | 뉴스 글자 색: `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
70
+ | `color` | `magenta` | 뉴스 글자 색: `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
71
71
 
72
72
  `newsline color <이름>`으로 색을 바로 지정하거나(예: `newsline color gray`), 이름 없이
73
73
  `newsline color`를 실행하면 다음 색으로 넘어갑니다 (default → gray → white → cyan →
package/readme/pt.md CHANGED
@@ -71,7 +71,7 @@ Execute `newsline init` novamente ou edite `~/.config/newsline/config.json`:
71
71
  | `count` | `15` | manchetes na rotação |
72
72
  | `maxlen` | `120` | máximo de caracteres (`max` = sem corte) |
73
73
  | `icon` | `📰` | ícone inicial (`none` para ocultar) |
74
- | `color` | `cyan` | cor da manchete: `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
74
+ | `color` | `magenta` | cor da manchete: `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
75
75
 
76
76
  Defina uma diretamente com `newsline color <nome>` (ex.: `newsline color gray`), ou use
77
77
  `newsline color` sem nome para avançar para a próxima cor (default → gray → white → cyan →
package/readme/zh.md CHANGED
@@ -65,7 +65,7 @@ npm i -g newsline-cli && newsline init
65
65
  | `count` | `15` | 轮播头条数量 |
66
66
  | `maxlen` | `120` | 最大字符数(`max` = 不截断) |
67
67
  | `icon` | `📰` | 前置图标(`none` 为隐藏) |
68
- | `color` | `cyan` | 新闻文字颜色:`default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
68
+ | `color` | `magenta` | 新闻文字颜色:`default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
69
69
 
70
70
  用 `newsline color <名称>` 直接设置颜色(如 `newsline color gray`),或不带名称运行
71
71
  `newsline color` 切换到下一种颜色(default → gray → white → cyan → yellow → green → blue →
package/refresh.sh CHANGED
@@ -23,7 +23,7 @@ case "$API" in off|OFF|none|local) API="" ;; esac
23
23
  COUNT="${NEWSLINE_COUNT:-15}" # how many headlines to cache for rotation
24
24
  # Client version, sent to /feed as ?v= for the server-side update nudge.
25
25
  # Bump together with package.json when tagging a release.
26
- export NEWSLINE_VERSION="${NEWSLINE_VERSION:-1.0.0}"
26
+ export NEWSLINE_VERSION="${NEWSLINE_VERSION:-1.0.2}"
27
27
  LOCK="$CACHE_DIR/refresh.lock"
28
28
  mkdir -p "$CACHE_DIR" 2>/dev/null
29
29