moesniper 0.7.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. moesniper-0.7.4/.github/CODEOWNERS +1 -0
  2. moesniper-0.7.4/.github/ISSUE_TEMPLATE/01_BUG_REPORT.md +31 -0
  3. moesniper-0.7.4/.github/ISSUE_TEMPLATE/02_FEATURE_REQUEST.md +13 -0
  4. moesniper-0.7.4/.github/ISSUE_TEMPLATE/03_CODEBASE_IMPROVEMENT.md +13 -0
  5. moesniper-0.7.4/.github/ISSUE_TEMPLATE/04_SUPPORT_QUESTION.md +10 -0
  6. moesniper-0.7.4/.github/ISSUE_TEMPLATE/config.yml +5 -0
  7. moesniper-0.7.4/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  8. moesniper-0.7.4/.github/workflows/build.yml +20 -0
  9. moesniper-0.7.4/.github/workflows/lint.yml +15 -0
  10. moesniper-0.7.4/.github/workflows/stale.yml +16 -0
  11. moesniper-0.7.4/.gitignore +63 -0
  12. moesniper-0.7.4/CHANGELOG.md +196 -0
  13. moesniper-0.7.4/Cargo.lock +1529 -0
  14. moesniper-0.7.4/Cargo.toml +67 -0
  15. moesniper-0.7.4/LICENSE +21 -0
  16. moesniper-0.7.4/PKG-INFO +71 -0
  17. moesniper-0.7.4/README.md +151 -0
  18. moesniper-0.7.4/benches/sniper_bench.rs +24 -0
  19. moesniper-0.7.4/clippy.toml +45 -0
  20. moesniper-0.7.4/docs/CODE_OF_CONDUCT.md +6 -0
  21. moesniper-0.7.4/docs/CONTRIBUTING.md +22 -0
  22. moesniper-0.7.4/docs/SECURITY.md +7 -0
  23. moesniper-0.7.4/proptest-regressions/main.txt +7 -0
  24. moesniper-0.7.4/pyproject.toml +90 -0
  25. moesniper-0.7.4/python/moesniper/__init__.py +102 -0
  26. moesniper-0.7.4/python/moesniper/_native.pyi +46 -0
  27. moesniper-0.7.4/python/moesniper/py.typed +0 -0
  28. moesniper-0.7.4/rust-toolchain.toml +3 -0
  29. moesniper-0.7.4/rustfmt.toml +6 -0
  30. moesniper-0.7.4/sniper-py/.pre-commit-config.yaml +15 -0
  31. moesniper-0.7.4/sniper-py/.python-version +1 -0
  32. moesniper-0.7.4/sniper-py/Cargo.toml +19 -0
  33. moesniper-0.7.4/sniper-py/README.md +48 -0
  34. moesniper-0.7.4/sniper-py/src/lib.rs +882 -0
  35. moesniper-0.7.4/sniper-py/tests/test_basic.py +490 -0
  36. moesniper-0.7.4/src/config.rs +226 -0
  37. moesniper-0.7.4/src/diff.rs +117 -0
  38. moesniper-0.7.4/src/help_text.rs +108 -0
  39. moesniper-0.7.4/src/indent.rs +943 -0
  40. moesniper-0.7.4/src/lib.rs +871 -0
  41. moesniper-0.7.4/src/main.rs +1387 -0
  42. moesniper-0.7.4/src/security.rs +220 -0
  43. moesniper-0.7.4/tests/README.md +48 -0
  44. moesniper-0.7.4/tests/boundary_tests.rs +742 -0
  45. moesniper-0.7.4/tests/enterprise_security.rs +503 -0
  46. moesniper-0.7.4/tests/integration.rs +233 -0
  47. moesniper-0.7.4/tests/property_invariants.proptest-regressions +7 -0
  48. moesniper-0.7.4/tests/property_invariants.rs +142 -0
  49. moesniper-0.7.4/tests/regression/golden/newline_preserved.txt +1 -0
  50. moesniper-0.7.4/tests/regression/golden/splice_basic.txt +3 -0
  51. moesniper-0.7.4/tests/regression/golden/undo_stack.txt +1 -0
  52. moesniper-0.7.4/tests/regression_golden.rs +286 -0
  53. moesniper-0.7.4/tests/smoke.rs +128 -0
  54. moesniper-0.7.4/tests/unit_edge_cases.rs +180 -0
@@ -0,0 +1 @@
1
+ * @moeshawky
@@ -0,0 +1,31 @@
1
+ # Bug Report
2
+
3
+ **Describe the bug**
4
+ A clear and concise description of what the bug is.
5
+
6
+ **To Reproduce**
7
+ Steps to reproduce the behavior:
8
+ 1. Go to '...'
9
+ 2. Click on '....'
10
+ 3. Scroll down to '....'
11
+ 4. See error
12
+
13
+ **Expected behavior**
14
+ A clear and concise description of what you expected to happen.
15
+
16
+ **Screenshots**
17
+ If applicable, add screenshots to help explain your problem.
18
+
19
+ **Desktop (please complete the following information):**
20
+ - OS: [e.g. iOS]
21
+ - Browser [e.g. chrome, safari]
22
+ - Version [e.g. 22]
23
+
24
+ **Smartphone (please complete the following information):**
25
+ - Device: [e.g. iPhone6]
26
+ - OS: [e.g. iOS8.1]
27
+ - Browser [e.g. stock browser, safari]
28
+ - Version [e.g. 22]
29
+
30
+ **Additional context**
31
+ Add any other context about the problem here.
@@ -0,0 +1,13 @@
1
+ # Feature Request
2
+
3
+ **Is your feature request related to a problem? Please describe.**
4
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
5
+
6
+ **Describe the solution you'd like**
7
+ A clear and concise description of what you want to happen.
8
+
9
+ **Describe alternatives you've considered**
10
+ A clear and concise description of any alternative solutions or features you've considered.
11
+
12
+ **Additional context**
13
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,13 @@
1
+ # Codebase Improvement
2
+
3
+ **Target Area**
4
+ Which part of the codebase is this improvement for?
5
+
6
+ **Description**
7
+ A clear and concise description of the improvement.
8
+
9
+ **Rationale**
10
+ Why is this improvement necessary? (Performance, readability, maintainability, etc.)
11
+
12
+ **Additional Context**
13
+ Any other information or examples.
@@ -0,0 +1,10 @@
1
+ # Support Question
2
+
3
+ **What are you trying to do?**
4
+ A clear and concise description of your goal.
5
+
6
+ **What have you tried?**
7
+ A list of things you've tried so far.
8
+
9
+ **Specific Question**
10
+ What exactly are you stuck on?
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: GitHub Discussions
4
+ url: https://github.com/moeshawky/moesniper/discussions
5
+ about: Please ask questions and share ideas here.
@@ -0,0 +1,22 @@
1
+ ## Description
2
+ Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
3
+
4
+ Fixes # (issue)
5
+
6
+ ## Type of change
7
+ - [ ] Bug fix (non-breaking change which fixes an issue)
8
+ - [ ] New feature (non-breaking change which adds functionality)
9
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
10
+ - [ ] This change requires a documentation update
11
+
12
+ ## How Has This Been Tested?
13
+ Please describe the tests that you ran to verify your changes.
14
+
15
+ ## Checklist:
16
+ - [ ] My code follows the style guidelines of this project
17
+ - [ ] I have performed a self-review of my own code
18
+ - [ ] I have commented my code, particularly in hard-to-understand areas
19
+ - [ ] I have made corresponding changes to the documentation
20
+ - [ ] My changes generate no new warnings
21
+ - [ ] I have added tests that prove my fix is effective or that my feature works
22
+ - [ ] New and existing unit tests pass locally with my changes
@@ -0,0 +1,20 @@
1
+ name: Rust Build
2
+
3
+ on:
4
+ push:
5
+ branches: [ "master" ]
6
+ pull_request:
7
+ branches: [ "master" ]
8
+
9
+ env:
10
+ CARGO_TERM_COLOR: always
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v3
17
+ - name: Build
18
+ run: cargo build --verbose
19
+ - name: Run tests
20
+ run: cargo test --verbose
@@ -0,0 +1,15 @@
1
+ name: Lint
2
+
3
+ on:
4
+ push:
5
+ branches: [ "master" ]
6
+ pull_request:
7
+ branches: [ "master" ]
8
+
9
+ jobs:
10
+ clippy:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ - name: Run clippy
15
+ run: cargo clippy -- -D warnings
@@ -0,0 +1,16 @@
1
+ name: "Close stale issues"
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "30 1 * * *"
6
+
7
+ jobs:
8
+ stale:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/stale@v4
12
+ with:
13
+ stale-issue-message: "This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days."
14
+ stale-pr-message: "This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days."
15
+ days-before-stale: 30
16
+ days-before-close: 5
@@ -0,0 +1,63 @@
1
+ # ── Build artifacts ───────────────────────────────────────────────────────────
2
+ target/
3
+ *.pdb
4
+
5
+ # ── Dependencies ──────────────────────────────────────────────────────────────
6
+ # Cargo.lock is committed for binary crates per Rust convention
7
+ # (ensures reproducible builds for published binaries).
8
+
9
+ # ── Rustfmt backups ───────────────────────────────────────────────────────────
10
+ **/*.rs.bk
11
+
12
+ # ── Agentic Dev Artifacts ──────────────────────────────────────────────────────
13
+ AGENTS.md
14
+ .agents/
15
+ references/
16
+ .cursor/
17
+ .claude/
18
+ .ad-*.md
19
+ .cam-*.md
20
+ .cbp-*.md
21
+ .clippy-fixes.md
22
+ extract.md
23
+
24
+ # ── IDE / Editor ──────────────────────────────────────────────────────────────
25
+ .idea/
26
+ .vscode/
27
+ *.swp
28
+ *.swo
29
+ *~
30
+ *.sublime-workspace
31
+ *.sublime-project
32
+
33
+ # ── OS ────────────────────────────────────────────────────────────────────────
34
+ .DS_Store
35
+ Thumbs.db
36
+ desktop.ini
37
+
38
+ # ── Project runtime ───────────────────────────────────────────────────────────
39
+ .ix/
40
+ .sniper/
41
+
42
+ # ── Proptest regressions ──────────────────────────────────────────────────────
43
+ # Keep these in repo for reproducibility.
44
+ # proptest-regressions/
45
+
46
+ # ── Secrets / environment ─────────────────────────────────────────────────────
47
+ .env
48
+ .env.*
49
+ *.key
50
+ *.pem
51
+ credentials.json
52
+
53
+ # ── Temporary / ephemeral ─────────────────────────────────────────────────────
54
+ *.tmp
55
+ *.bak
56
+ *.log
57
+ __pycache__/
58
+ *.py[cod]
59
+ *.egg-info/
60
+ *.egg
61
+
62
+ # ── Python native extensions (PyO3) ─────────────────────────────────────────
63
+ *.so
@@ -0,0 +1,196 @@
1
+ # Changelog
2
+
3
+ All notable changes to moesniper will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v0.0.0.html).
7
+
8
+ ## [0.7.4] - 2026-06-06
9
+
10
+ ### Added
11
+ - `.agents/` directory to `.gitignore` for agentic dev artifacts
12
+
13
+ ### Changed
14
+ - Version bumped for release
15
+
16
+ ---
17
+
18
+ ## [0.7.3] - 2026-06-04
19
+
20
+ ### Added
21
+ - Python parity bindings and CLI `--version` flag for `moesniper`
22
+ - `*.so` to `.gitignore` to prevent binary wheel commits
23
+
24
+ ### Fixed
25
+ - PyO3 manifest safety parity across all audit findings
26
+
27
+ ---
28
+
29
+ ## [0.7.2] - 2026-06-03
30
+
31
+ ### Added
32
+ - PID pacing configuration via `SNIPER_PID_BASE_MS`, `SNIPER_PID_ENTROPY_SCALE`, `SNIPER_PID_PRESSURE_SCALE` environment variables
33
+ - Workspace configuration including `sniper-py` Python bindings crate
34
+ - Risk telemetry and `recommended_action` now computed for both dry-run and real paths
35
+
36
+ ### Fixed
37
+ - Eliminated redundant `SniperConfig::from_env()` calls in write path — config now forwarded through call chain
38
+ - Removed redundant `ResourceGuard::auto(0.5)` in `write_atomic_impl` — caller's guard forwarded instead
39
+ - Help text updated with missing DAL and PID environment variables
40
+
41
+ ---
42
+
43
+ ## [0.7.1] - 2026-06-01
44
+
45
+ ### Added
46
+ - Insert-at-end now accepts start=end=N+1 for natural append expressions
47
+ - Bounds validation for `cmd_manifest_impl` to prevent splice panic on out-of-range manifests
48
+ - Insert-at-end exception for manifest bounds (parity with cmd_splice)
49
+ - 10+ regression tests: append-at-end (1/2/4-line), handle_backtrack_error, normalize_path
50
+
51
+ ### Fixed
52
+ - Append-at-end (line N+1) rejected when start equals end (documented contract violation)
53
+ - Original file permissions lost during atomic write — now copied to temp file before rename
54
+ - `find_latest_backup` O(N log N) memory usage reduced to O(N) O(1) via iterator max
55
+ - Stale thread handle test ("0.5.0") corrected for llmosafe 0.6.2
56
+ - `test_normalize_path_missing_parent` assertion corrected for intentional non-existent path behavior
57
+
58
+ ### Changed
59
+ - `write_atomic_impl` now uses `BufWriter` for buffered writes
60
+ - **llmosafe 0.6.2 → 0.7.1**: `ResourceGuard::for_testing()` available for deterministic test entropy/pressure. `PidInput` struct added (not used by sniper). `sift_observation_inner`, `GainSchedule`, `Setpoint` removed (zero impact). `DeadlineExceeded` (-7) remains a valid `KernelError` variant used in `check_blocking()` and C-ABI, but resource exhaustion now surfaces via `KernelError::ResourceExhaustion` from `ResourceGuard::check()` rather than OS-level IO error codes.
61
+
62
+ ## [0.7.0] - 2026-05-30
63
+
64
+ ### Added
65
+
66
+ - **Indentation engine** (`src/indent.rs`): Statistical step detection with 80% supermajority, raw frequency scoring, round-to-nearest, whitespace stripping, and smaller-is-step tiebreaker — robust against inconsistent LLM output. 40 adversarial tests covering tabs, spaces, mixed styles, blank lines, continuation lines, and brace openers.
67
+ - **Auto-indent** (`--auto-indent`): Detects expected indentation from surrounding context and automatically prepends missing leading whitespace.
68
+ - **Force-indent** (`--force-indent`): Bypasses indentation validation for deliberate refactoring.
69
+ - **PID-based file locks**: Lock content contains the process PID, enabling stale lock detection and auto-recovery via `/proc/{pid}` liveness check. Configurable timeout via `SNIPER_LOCK_TIMEOUT`.
70
+ - **Context verification** (`--context <hash>`): Verifies SHA-256 hash (first 16 hex chars) of 3 lines before and after the edit target. Rejects edits if surrounding code changed since line numbers were computed.
71
+ - **Manifest promotion detection**: Detects >=3 edits to the same file within the lock window and suggests batching with `--manifest` via `ai_hint` in JSON output.
72
+ - **Line shift tracking**: `line_shift` field in `CliResult` — positive means lines moved down, negative means up. Agents can mechanically adjust subsequent line targets.
73
+ - **Clipply configuration** (`clippy.toml`): msrv=1.87, cognitive-complexity-threshold=30. Lint policy in `Cargo.toml` denies `unreachable`, `todo`, `panic`; warns on `dbg_macro`, `cast_possible_truncation`, `cast_sign_loss`.
74
+ - **Crate-level lint enforcement**: `deny(clippy::unwrap_used, clippy::expect_used)` in `src/lib.rs` with `#[cfg_attr(test, allow(...))]`.
75
+ - **Secure temp files**: Nanosecond timestamp suffix (`{filepath}.sniper_tmp.{ts}`) prevents collision.
76
+ - **Atomic write integrity**: Trailing newline detection preserves original file format.
77
+ - **Path validation ordering**: `normalize_path` runs before `check_file_size`, closing a TOCTOU window.
78
+
79
+ ### Changed
80
+
81
+ - **Indentation validation now always-on**: Runs on every edit by default. Use `--force-indent` to bypass. Removed dead `--validate-indent` flag.
82
+ - **llmosafe 0.5.0 → 0.6.2**: `ResourceGuard::auto(0.5)` replaces hardcoded memory ceiling. `ResourceGuard::check()` called before atomic rename for proper `KernelError` propagation.
83
+ - **MSRV 1.70 → 1.87**: `is_multiple_of()` stabilized in Rust 1.87.
84
+ - **Documentation unified**: All 5 surfaces (main.rs doc, help text, README, Cargo.toml, tests/README) tell the same story. No dead flags, no missing features, no internal methodology jargon.
85
+ - **Help text expanded**: Added `--context`, `--force-indent`, env var reference, context-verified edit example. Encode subcommand documents all 3 modes.
86
+ - **Dead code removed**: Removed `use_os_locking` config field, `SNIPER_USE_OS_LOCKING` env var, `libc` dependency (zero imports).
87
+ - **Clippy clean**: 184 tests, zero warnings, zero panics.
88
+
89
+ ### Security
90
+
91
+ - Path traversal protection (`SecurityPolicy`, `normalize_path`).
92
+ - Symlink-safe operations (no `follow_symlinks` without validation).
93
+ - PID-based per-file locking with stale lock auto-recovery.
94
+ - Atomic writes with unique temp file names.
95
+ - Symlink traversal rejection within base directory.
96
+
97
+ ### Fixed
98
+
99
+ - **Boundary hardening**: Path validation before file ops, lock PID liveness check, temp file uniqueness, concurrent lock purge race detection.
100
+ - **Test quality**: Removed tautological assertions, added exact-match checks, corrected weak oracle patterns.
101
+
102
+ ---
103
+
104
+ ## [0.5.1] - 2026-05-14
105
+
106
+ ### Added
107
+ - Comprehensive test suite: 85+ tests (smoke, edge case, property-based, regression, security, integration).
108
+ - Test documentation (`tests/README.md`).
109
+
110
+ ### Changed
111
+ - Help text extracted to `src/help_text.rs` with improved organization.
112
+ - Documentation improvements.
113
+
114
+ ---
115
+
116
+ ## [0.5.0] - 2026-05-14
117
+
118
+ ### Added
119
+ - Enterprise-grade path security validation (`src/security.rs`).
120
+ - Auto-indent and validate-indent flags.
121
+ - Dry-run diff preview.
122
+ - Configuration via environment variables: `SNIPER_LOCK_TIMEOUT`, `SNIPER_MAX_FILE_SIZE`, `SNIPER_BACKUP_RETENTION_COUNT`, `SNIPER_BACKUP_MAX_AGE_DAYS`.
123
+ - AI hint system for verification guidance.
124
+ - JSON output mode (`--json` flag).
125
+
126
+ ### Changed
127
+ - Upgraded to llmosafe 0.5.0 with Backtrack Signal support.
128
+ - Improved trailing newline handling (PR #8).
129
+ - Optimized string handling with `split_inclusive`.
130
+ - Enhanced error messages with actionable hints.
131
+
132
+ ### Security
133
+ - Path traversal protection.
134
+ - Symlink attack mitigation.
135
+ - File locking with configurable timeout.
136
+ - Atomic file writes.
137
+
138
+ ---
139
+
140
+ ## [0.4.0] - 2025-04-22
141
+
142
+ ### Added
143
+ - Manifest batch operations.
144
+ - Multi-step undo stack.
145
+ - Hex encoding command (`sniper encode`).
146
+ - Backup retention policies.
147
+
148
+ ### Changed
149
+ - Improved line number parsing (1-indexed).
150
+ - Better error handling for out-of-bounds operations.
151
+
152
+ ---
153
+
154
+ ## [0.3.0] - 2025-04-21
155
+
156
+ ### Added
157
+ - Basic line splicing.
158
+ - Hex-encoded content support.
159
+ - Atomic file writes.
160
+ - Backup creation on every edit.
161
+
162
+ ---
163
+
164
+ ## [0.2.0] - 2025-04-20
165
+
166
+ ### Added
167
+ - Command-line interface.
168
+ - Line-range deletion.
169
+ - Basic error reporting.
170
+
171
+ ---
172
+
173
+ ## [0.1.0] - 2025-04-19
174
+
175
+ ### Added
176
+ - Initial release.
177
+ - Core splicing functionality.
178
+ - Hex decode/encode.
179
+
180
+ ---
181
+
182
+ ## Version History
183
+
184
+ | Version | Date | Key Feature |
185
+ |---------|------|-------------|
186
+ | 0.7.4 | 2026-06-06 | Release tooling, .agents/ gitignore |
187
+ | 0.7.3 | 2026-06-04 | Python bindings parity, PyO3 safety |
188
+ | 0.7.2 | 2026-06-03 | PID pacing, config forwarding, risk telemetry |
189
+ | 0.7.1 | 2026-06-01 | Append-at-end fix, manifest bounds, permission preservation, perf optimization |
190
+ | 0.7.0 | 2026-05-30 | Indent engine, PID locks, context verification, docs unification |
191
+ | 0.5.1 | 2026-05-14 | Test suite expansion, help text refactor |
192
+ | 0.5.0 | 2026-05-14 | Enterprise security, auto-indent, dry-run |
193
+ | 0.4.0 | 2025-04-22 | Manifest operations, multi-step undo |
194
+ | 0.3.0 | 2025-04-21 | Basic splicing, hex encoding |
195
+ | 0.2.0 | 2025-04-20 | CLI, deletion support |
196
+ | 0.1.0 | 2025-04-19 | Initial release |