Recognize more shell commands as code

Aperta Adatta ai principianti
#11 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
shell, typescript
Ambito
tooling

Direzione di ricerca

Inizia da src/shared/classify.ts, dove l'espressione regolare SHELL_LINE, usata da looksLikeCode, riconosce il nome del comando all'inizio di una riga e assegna un bonus per i flag. Aggiungi gli strumenti elencati (cargo, grep, tar, ssh, gh, scp, rsync, sed, awk, uv, deno, terraform, ffmpeg) senza aggiungere parole inglesi ambigue come make, go, find o sort. Poi estendi i test di looksLikeCode in tests/classify.test.ts con casi positivi e una frase in prosa nel test "leaves prose alone", e conferma che pnpm test passa.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement good first issue

Code cards get a monospace font and a light syntax tint. One-line shell commands are recognized by how they start (git , npm , docker , kubectl …) plus a bonus point for flags, so docker ps -a is code. Lots of everyday tools aren't on the list, though, so these all land as plain text today:

cargo build --release
grep -rn foo .
tar -xzf file.tar.gz
ssh -i key.pem user@host
gh pr create --fill
Where to look
  • src/shared/classify.ts: the SHELL_LINE regex used by looksLikeCode
  • tests/classify.test.ts: the looksLikeCode tests
Done when
  • The commands above are detected as code. Other good candidates: scp, rsync, sed, awk, uv, deno, terraform, ffmpeg
  • Prose still isn't. Leave out commands that are also everyday English words, like make, go, find or sort: "make sure the app is closed" has to stay text. Add a sentence to the "leaves prose alone" test for anything borderline
  • pnpm test passes

Out of scope: commands without flags (git status) need more than one signal to count as code. That's deliberate, so leave it as it is.

Suggested pull request title: feat(classify): recognize more shell commands as code

New to OpenPaste? CONTRIBUTING.md covers setup, the code conventions and the checks to run before a pull request (pnpm typecheck, pnpm test, pnpm format, pnpm cleaner). Leave a comment if you're picking this up so nobody doubles up.


Generated by Claude Code

Lingua principale
TypeScript
Stelle
0
Fork
3
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di alexsilver8/openpaste

Tutte le issue di alexsilver8/openpaste

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.