Metadata-Version: 2.4
Name: codestamp
Version: 0.1.9
Summary: CLI tool to manage copyright headers in source-code files
Author: Shardul Kulkarni
License: MIT
Project-URL: Homepage, https://github.com/Medhavee-Inc/codestamp
Project-URL: Issues, https://github.com/Medhavee-Inc/codestamp/issues
Keywords: copyright,license,header,cli,source-code
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Version Control
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: click>=8.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"

# codestamp

> A simple CLI tool to add, update, and manage copyright headers across your source-code files.

[![PyPI](https://img.shields.io/pypi/v/codestamp)](https://pypi.org/project/codestamp/)
[![Python](https://img.shields.io/pypi/pyversions/codestamp)](https://pypi.org/project/codestamp/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

---

## Installation

```bash
pip install codestamp
```

---

## Quick start

1. Create a `license.txt` in your project root whose **first line** is your copyright statement:

```
Copyright (c) 2026 Medhavee Inc All rights reserved. Proprietary and confidential.
```

2. Run from the project root:

```bash
# Add headers to files changed in the last git commit (CI-friendly default)
codestamp

# Add headers to ALL source files in the tree
codestamp --bulk

# Add headers to staged files only
codestamp --staged

# Preview without writing anything
codestamp --bulk --dry-run

# Update every file's copyright to a new statement
codestamp update "Copyright (c) 2026 Acme Inc. All rights reserved."
```

---

## Commands

| Command | Description |
|---|---|
| `codestamp` | Process files in the last git commit (default) |
| `codestamp --bulk` | Process all source files in the project |
| `codestamp --staged` | Process only git-staged files |
| `codestamp --dry-run` | Preview without writing |
| `codestamp update "<text>"` | Replace old copyright with new text |
| `codestamp list-types` | Show all supported file extensions |

### Common options

| Flag | Default | Description |
|---|---|---|
| `--license <path>` | `license.txt` | Custom path to your license file |
| `--dry-run` | off | Preview mode — no files written |

---

## Supported file types

| Style | Extensions |
|---|---|
| `# comment` | `.py` `.sh` `.bash` `.zsh` `.rb` `.pl` `.r` `.yaml` `.yml` `.toml` `.tf` |
| `// comment` | `.js` `.ts` `.jsx` `.tsx` `.java` `.go` `.swift` `.kt` `.rs` `.cs` `.cpp` `.c` `.h` `.dart` `.scala` `.php` |
| `/* comment */` | `.css` `.scss` `.less` |
| `<!-- comment -->` | `.html` `.svelte` `.vue` `.xml` `.svg` |

Run `codestamp list-types` to see the full list.

---

## Git integration

The default mode (`codestamp` with no flags) processes files from the **last commit**, making it ideal for a post-commit or CI workflow:

```yaml
# .github/workflows/copyright.yml
- name: Add copyright headers
  run: |
    pip install codestamp
    codestamp
    git diff --quiet || (git config user.email "bot@ci" && git config user.name "CI Bot" && git commit -am "chore: add copyright headers")
```

---

## How headers are inserted

- **Shebang lines** (`#!/usr/bin/env python3`) are respected — the header is inserted on line 2.
- If a file already contains the copyright text, it is **skipped**.
- `--update-all` replaces old copyright text in-place across all files and rewrites `license.txt`.

---

## Contributing

```bash
git clone https://github.com/Medhavee-Inc/codestamp
cd codestamp
pip install -e ".[dev]"
pytest
```

---

## License

MIT © Shardul Kulkarni
