uttrflow / uttrflow/uttrflow-swift
One-line sentences that start with an ordinary English word from the shell-command list are classified as code
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 277
Description
## What happens
`CodeShapes.isShellCommand` (`Sources/UttrflowClipboard/CodeShapes.swift:132-171`) calls a one-line clip code when any segment between `|`, `&` or `;` starts with a word in `commands` (`:173-180`). Several of those words are everyday English: `defaults`, `tar`, `cargo`, `bun`, `kill`, `node`, `swift`, `apt`, `pip`, `git`, `sudo`, `ps`, `cd`, `rm`. The match is case-sensitive, so a capitalised sentence escapes, but a lowercase one does not. Lowercase is how chat messages, notes and search queries are usually typed.
## Measured (headless, `ClipKindDetector.kind(of:)`)
| Clip | Kind |
|---|---|
| `defaults are fine by me` | **code** |
| `tar and feathers` | **code** |
| `cargo ship arrives Monday` | **code** |
| `bun with butter please` | **code** |
| `git gud` | **code** |
| `rm 204 is booked` | **code** |
| `Tom & Jerry; kill time` | **code** (the segment after `;`) |
| `pip install is slow today` | **code** |
| `Swift is my favourite language` / `Node is down again` | text |
Of 30 short invented prose lines in the audit set, 9 came out as code.
## Why it matters
A wrong `.code` puts prose under the Code tab, in a monospaced face with a code tile ("the two nobody may paste by accident", `QuickPanelRowAppearance.swift:63`), and offers it Re-indent. `Docs/performance.md` names `.text` as the answer that costs nothing when wrong, and this rule answers code on a single word.
## Acceptance criteria
- A command word that is also an ordinary English word counts only when the rest of the segment looks like a command: a flag (`-x`, `--x`), a path, `=`, a pipe or redirect, or a known subcommand (`git status`, `brew install`, `pip install x`).
- The unambiguous words (`kubectl`, `xcodebuild`, `launchctl`, `codesign` …) keep today's behaviour.
- The bold rows above become `.text`, and every case in `ClipKindDetectorTests`' "calls a one-line shell command code" still passes.
- The prose lines are added to `ClipKindDetectorTests.prose`.
Contributor guide
Research direction
Start in Sources/UttrflowClipboard/CodeShapes.swift:132-180, then read ClipKindDetectorTests, especially the one-line shell command cases and the prose set. Adjust the classification behavior to distinguish ordinary-word prose from command-like segments while preserving unambiguous commands. Run the detector tests; done means the bold examples classify as .text, existing command cases still pass, and the prose lines are covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- desktop, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100