feat: git credential backend for credential storage (#371)
## Problem
Credentials were stored as plaintext JSON in
`stdpath('data')/cp-nvim.json`, with no integration with system
credential managers.
## Solution
Replace file-based credential storage with `git credential
fill/approve/reject`, delegating to whatever credential helper the user
has configured (`cache`, `store`, `libsecret`, macOS Keychain, etc.).
- New `lua/cp/git_credential.lua` module wrapping the git credential
protocol
- All credential consumers (`credentials.lua`, `submit.lua`,
`scraper.lua`) use `git_credential` directly — `cache.lua` no longer
handles credentials
- CSES API token packed into the password field (`password<TAB>token`)
so it works with helpers that ignore the `path` field
- `has_helper()` guard on `:CP login`, `:CP logout`, and `:CP submit`
with an error message if no helper is configured
- Healthcheck split into `[required]`/`[optional]` sections; git version
and credential helper status shown
- `git` checked at startup in `check_required_runtime()`
- Cache version system (`CACHE_VERSION`, v1→v2 migration) removed — the
cache file is now a plain JSON blob
- `:CP` command gets `bar = true`
This commit is contained in:
parent
27d7a4e6b5
commit
da4e2ebeba
12 changed files with 283 additions and 150 deletions
60
README.md
60
README.md
|
|
@ -10,14 +10,15 @@ https://github.com/user-attachments/assets/e81d8dfb-578f-4a79-9989-210164fc0148
|
|||
## Features
|
||||
|
||||
- **Multi-platform support**: AtCoder, CodeChef, Codeforces, USACO, CSES, Kattis
|
||||
- **Automatic problem setup**: Scrape test cases and metadata in seconds
|
||||
- **Dual view modes**: Lightweight I/O view for quick feedback, full panel for
|
||||
detailed analysis
|
||||
- **Test case management**: Quickly view, edit, add, & remove test cases
|
||||
- **Rich test output**: 256 color ANSI support for compiler errors and program
|
||||
- **Online Judge Integration**: Submit problems and view contest standings
|
||||
- **Live Contest Support**: Participate in real-time contests
|
||||
- **Automatic setup**: Scrape test cases and metadata in seconds
|
||||
- **Streamlined Editing**: Configure coding view, edit test cases,
|
||||
stress-test solutions, run interactive problems, and more
|
||||
- **Rich output**: 256 color ANSI support for compiler errors and program
|
||||
output
|
||||
- **Language agnostic**: Works with any language
|
||||
- **Diff viewer**: Compare expected vs actual output with 3 diff modes
|
||||
- **Language agnosticism**: Configure with any language
|
||||
- **Security**: Passwords go untampered
|
||||
|
||||
## Installation
|
||||
|
||||
|
|
@ -37,30 +38,31 @@ luarocks install cp.nvim
|
|||
|
||||
## Quick Start
|
||||
|
||||
cp.nvim follows a simple principle: **solve locally, submit remotely**.
|
||||
1. Find a contest:
|
||||
|
||||
### Basic Usage
|
||||
```
|
||||
:CP pick
|
||||
```
|
||||
|
||||
1. Find a contest or problem
|
||||
2. Set up contests locally
|
||||
2. View the problem:
|
||||
|
||||
```
|
||||
:CP codeforces 1848
|
||||
```
|
||||
```
|
||||
:CP open
|
||||
```
|
||||
|
||||
3. Code and test
|
||||
|
||||
```
|
||||
:CP run
|
||||
```
|
||||
```
|
||||
:CP run
|
||||
```
|
||||
|
||||
4. Navigate between problems
|
||||
|
||||
```
|
||||
:CP next
|
||||
:CP prev
|
||||
:CP e1
|
||||
```
|
||||
```
|
||||
:CP next
|
||||
:CP prev
|
||||
:CP e1
|
||||
```
|
||||
|
||||
5. Debug and edit test cases
|
||||
|
||||
|
|
@ -69,7 +71,17 @@ cp.nvim follows a simple principle: **solve locally, submit remotely**.
|
|||
:CP panel --debug
|
||||
```
|
||||
|
||||
5. Submit on the original website
|
||||
6. Submit:
|
||||
|
||||
```
|
||||
:CP submit
|
||||
```
|
||||
|
||||
7. View contest standings:
|
||||
|
||||
```
|
||||
:CP open standings
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
|
|
@ -78,7 +90,7 @@ cp.nvim follows a simple principle: **solve locally, submit remotely**.
|
|||
```
|
||||
|
||||
See
|
||||
[my config](https://github.com/barrettruth/dots/blob/main/.config/nvim/lua/plugins/cp.lua)
|
||||
[my config](https://github.com/barrettruth/nix/blob/5d0ede3668eb7f5ad2b4475267fc0458f9fa4527/config/nvim/lua/plugins/dev.lua#L165)
|
||||
for the setup in the video shown above.
|
||||
|
||||
## Motivation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue