@codeshareme/codeshare-cli
v1.1.3
Published
Official CLI for codeshare.me — push, pull and version-control your code snippets
Maintainers
Readme
@codeshareme/codeshare-cli
Official CLI for codeshare.me — version-control your code snippets directly from the terminal.
Push, pull, diff and track the history of your CodeShare snippets just like you would with Git — without needing Git.
Table of Contents
- Installation
- Authentication
- Quick Start
- Commands
- File Filtering
- .csproject File
- Limits
- Supported Languages
- Requirements
Installation
npm install -g @codeshareme/codeshare-cliVerify:
cs --version
cs --helpAuthentication
- Log in to codeshare.me and go to Settings → Personal Access Tokens
- Enter a name (e.g.
my-laptop) and click Generate Token - Copy the token immediately — it is shown only once
- Run:
cs login --token <your-token>Your token is stored in ~/.codeshare/config.json with 600 permissions (readable only by you).
Quick Start
# Authenticate
cs login --token cs_xxxxxxxxxxxxxxxxxxxxxx
# Create a new snippet linked to this directory
cd my-project
cs init --title "My Awesome Project"
# Upload your files as version 1
cs push
# Make changes, then push again with a tag
cs push --tag "v1.1"
# See version history
cs log
# Diff version 1 vs 2
cs diff 1 2
# Check if local files are in sync with the latest push
cs status
# Open the snippet in your browser
cs openCommands
login
Save your personal access token locally.
cs login --token <token>
cs login --token <token> --host https://codeshare.me| Option | Description |
|---|---|
| --token <token> | Personal access token from codeshare.me/settings |
| --host <url> | Override API host (default: https://codeshare.me) |
logout
Remove the saved token from your machine.
cs logoutwhoami
Show who you are currently logged in as.
cs whoamiLogged in as johndoe
Host: https://codeshare.me
Token: cs_abc123...init
Create a new snippet on CodeShare and link the current directory to it. A .csproject file is written in the current folder.
cs init
cs init --title "React Auth Flow"
cs init --title "My API" --private
cs init --id <existing-snippet-id>| Option | Description |
|---|---|
| --title <title> | Snippet title (prompted if omitted) |
| --id <id> | Link to an existing snippet instead of creating a new one |
| --private | Create as private (default: public) |
| --description <desc> | Set description |
Running cs init also creates a .csignore template in the directory.
push
Scan the current directory, upload all files, and create a new version snapshot.
cs push
cs push --tag "v1.0"
cs push --dry-run
cs push --watch| Option | Description |
|---|---|
| -m, --message <msg> | Version message (default: "Update") |
| --tag <name> | Tag this version (e.g. v1.0, stable) |
| --dry-run | Show what would be uploaded without pushing |
| --watch | Watch for file changes and auto-push on save |
| --dir <dir> | Directory to push (default: current) |
| [snippetId] | Override the target snippet ID |
What gets uploaded:
- All text files in the directory (recursively)
- Respects
.gitignoreand.csignore - Skips:
node_modules,dist,build,.git,.env, lock files, binary files
Limits: max 500 files · 512 KB per file · 50 MB total per push
Each push creates a new immutable version. You can always roll back.
Dry run example:
Dry run — would push 5 file(s) to snippet 498197a7-...:
.csignore 0.3 KB
README.md 1.2 KB
package.json 0.8 KB
src/index.ts 4.1 KB [main]
src/utils.ts 2.0 KBpull
Download the latest files from your snippet into the current directory.
cs pull
cs pull <snippetId>
cs pull --dir ./target-dir| Option | Description |
|---|---|
| --dir <dir> | Target directory (default: current) |
Existing files are overwritten. Files not present in the snippet are left untouched.
clone
Clone any public or private (owned) snippet into a new directory.
cs clone <snippetId>
cs clone <snippetId> ./my-dirA .csproject file is written so you can cs push changes back (requires ownership).
status
Compare your local files against the latest pushed version.
cs status
cs status <snippetId>Changes since version 3 (2 file(s)):
~ modified src/index.ts
+ added src/utils.tsOr when clean:
✓ Clean — up to date with version 3log
Show the version history of the current snippet.
cs log
cs log <snippetId>Version history for 498197a7-...:
v3 [stable] — Mar 11, 2026, 3:42 PM
refactor: split into modules
v2 — Mar 10, 2026, 11:20 AM
add error handling
v1 — Mar 9, 2026, 9:05 AM
Updatediff
Show line-level changes between two versions (unified diff format).
cs diff <v1> <v2>
cs diff 1 3
cs diff 2 3 <snippetId>Index: src/index.ts
===================================================================
--- src/index.ts v1
+++ src/index.ts v2
@@ -6,4 +6,7 @@
res.send('Hello!');
});
+app.use(express.json());
+
app.listen(3000);
+++ src/utils.ts (added)checkout
Restore a specific version to your local directory.
cs checkout <version>
cs checkout <version> <snippetId>
cs checkout 2 --dir ./restore-here| Option | Description |
|---|---|
| --dir <dir> | Directory to write files into |
Warning: Local files will be overwritten. Run
cs pushafterwards to create a new version from the restored state.
list
Show all your snippets with file counts and URLs.
cs list
cs list --limit 20
cs list --page 2| Option | Description |
|---|---|
| --limit <n> | Results per page (default: 10) |
| --page <n> | Page number (default: 1) |
Your snippets (47 total):
public [project] My API Server · 12 files Mar 11, 2026
https://codeshare.me/c/498197a7-...
private [single] Auth Helper Mar 10, 2026
https://codeshare.me/c/3a7fe3ee-...
Run: cs list --page 2 for morerename
Rename a snippet.
cs rename "New Title"
cs rename "New Title" <snippetId>publish / unpublish
Toggle the visibility of a snippet.
cs publish # make public
cs unpublish # make private
cs publish <snippetId>delete
Permanently delete a snippet. Asks for confirmation unless --force is used.
cs delete
cs delete <snippetId>
cs delete --forceThis action is irreversible. All versions and files are deleted.
open
Open the snippet in your browser.
cs open
cs open <snippetId>File Filtering
The CLI automatically ignores common files. Add your own exclusions with a .csignore file (same syntax as .gitignore):
# .csignore
secrets/
coverage/
*.key
*.pem
data/*.csvAlways ignored by default:
| Category | Patterns |
|---|---|
| Version control | .git, .svn, .hg |
| Dependencies | node_modules, vendor/, .bundle/, __pycache__ |
| Build output | dist, build, .next, out, .nuxt, .cache |
| Environment | .env, .env.* (except .env.example) |
| Lock files | *.lock, package-lock.json, pnpm-lock.yaml |
| Logs | *.log |
| OS files | .DS_Store, Thumbs.db |
| Binary files | *.png, *.jpg, *.pdf, *.exe, *.zip, *.wasm, fonts, etc. |
| CLI config | .csproject |
Your .gitignore is also respected automatically.
.csproject File
When you run cs init or cs clone, a .csproject file is created:
{
"id": "a1b2c3d4-...",
"title": "My Project"
}This file links your local directory to a CodeShare snippet. It is safe to commit to Git.
Limits
| Limit | Value | |---|---| | Max files per push | 500 | | Max file size | 512 KB | | Max total push size | 50 MB | | Max push operations | 30 per minute | | Max active tokens | 10 per account |
Supported Languages
The CLI detects language from file extension automatically. 100+ types supported:
Web: TypeScript · JavaScript · TSX/JSX · HTML · CSS · SCSS · Sass · Less · Stylus · Vue · Svelte · Astro · MDX
Backend: Python · Go · Rust · Java · C# · C · C++ · PHP · Ruby · Swift · Kotlin · Dart · Groovy
Functional/FP: Haskell · Elixir · Erlang · Clojure · F# · OCaml · Scala · Elm · Racket · Scheme · Lisp
Scripting: Bash · Zsh · Fish · PowerShell · Batch/CMD · Lua · Perl · R · Julia · Nim · CoffeeScript
Low-level: Assembly · Objective-C · Zig · D · Crystal
Data/Config: JSON · YAML · TOML · XML · INI · .env · CSV · GraphQL · Protocol Buffers
Infra/DevOps: Terraform/HCL · Dockerfile · Makefile · Nix · Nginx config
DB/ORM: SQL · Prisma
Docs: Markdown · MDX · reStructuredText · LaTeX · AsciiDoc
Misc: Vim Script · Diff/Patch · Solidity
Auto-detected exact filenames:
Dockerfile · Makefile · Gemfile · Vagrantfile · Jenkinsfile · Brewfile · Procfile · Cargo.toml · go.mod · .gitignore · .editorconfig · .htaccess · package.json · tsconfig.json · requirements.txt
Requirements
- Node.js 18 or later
- A codeshare.me account
- A Personal Access Token (from Settings → Personal Access Tokens)
License
MIT © codeshare.me
