cmdscope 0.1.0__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 (75) hide show
  1. cmdscope-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +58 -0
  2. cmdscope-0.1.0/.github/workflows/release.yml +60 -0
  3. cmdscope-0.1.0/.github/workflows/tests.yml +92 -0
  4. cmdscope-0.1.0/CHANGELOG.md +47 -0
  5. cmdscope-0.1.0/CONTRIBUTING.md +97 -0
  6. cmdscope-0.1.0/LICENSE +21 -0
  7. cmdscope-0.1.0/MANIFEST.in +11 -0
  8. cmdscope-0.1.0/PKG-INFO +353 -0
  9. cmdscope-0.1.0/README.md +312 -0
  10. cmdscope-0.1.0/SECURITY.md +38 -0
  11. cmdscope-0.1.0/docs/architecture.md +141 -0
  12. cmdscope-0.1.0/docs/collectors.md +117 -0
  13. cmdscope-0.1.0/docs/configuration.md +114 -0
  14. cmdscope-0.1.0/docs/privacy.md +93 -0
  15. cmdscope-0.1.0/examples/README.md +34 -0
  16. cmdscope-0.1.0/examples/demo_session.py +27 -0
  17. cmdscope-0.1.0/examples/listener_session.py +13 -0
  18. cmdscope-0.1.0/pyproject.toml +109 -0
  19. cmdscope-0.1.0/setup.cfg +4 -0
  20. cmdscope-0.1.0/src/cmdscope/__init__.py +12 -0
  21. cmdscope-0.1.0/src/cmdscope/__main__.py +8 -0
  22. cmdscope-0.1.0/src/cmdscope/analysis/__init__.py +1 -0
  23. cmdscope-0.1.0/src/cmdscope/analysis/comparison.py +134 -0
  24. cmdscope-0.1.0/src/cmdscope/analysis/summary.py +37 -0
  25. cmdscope-0.1.0/src/cmdscope/cli.py +555 -0
  26. cmdscope-0.1.0/src/cmdscope/collectors/__init__.py +1 -0
  27. cmdscope-0.1.0/src/cmdscope/collectors/filesystem.py +370 -0
  28. cmdscope-0.1.0/src/cmdscope/collectors/network.py +196 -0
  29. cmdscope-0.1.0/src/cmdscope/collectors/processes.py +365 -0
  30. cmdscope-0.1.0/src/cmdscope/config.py +461 -0
  31. cmdscope-0.1.0/src/cmdscope/core/__init__.py +1 -0
  32. cmdscope-0.1.0/src/cmdscope/core/collector.py +48 -0
  33. cmdscope-0.1.0/src/cmdscope/core/engine.py +514 -0
  34. cmdscope-0.1.0/src/cmdscope/core/events.py +113 -0
  35. cmdscope-0.1.0/src/cmdscope/core/ignore.py +56 -0
  36. cmdscope-0.1.0/src/cmdscope/core/registry.py +33 -0
  37. cmdscope-0.1.0/src/cmdscope/core/session.py +81 -0
  38. cmdscope-0.1.0/src/cmdscope/diagnostics.py +183 -0
  39. cmdscope-0.1.0/src/cmdscope/errors.py +36 -0
  40. cmdscope-0.1.0/src/cmdscope/platforms/__init__.py +57 -0
  41. cmdscope-0.1.0/src/cmdscope/platforms/base.py +140 -0
  42. cmdscope-0.1.0/src/cmdscope/platforms/linux.py +28 -0
  43. cmdscope-0.1.0/src/cmdscope/platforms/macos.py +26 -0
  44. cmdscope-0.1.0/src/cmdscope/platforms/windows.py +28 -0
  45. cmdscope-0.1.0/src/cmdscope/privacy.py +143 -0
  46. cmdscope-0.1.0/src/cmdscope/py.typed +0 -0
  47. cmdscope-0.1.0/src/cmdscope/reports/__init__.py +1 -0
  48. cmdscope-0.1.0/src/cmdscope/reports/html.py +279 -0
  49. cmdscope-0.1.0/src/cmdscope/reports/json_report.py +133 -0
  50. cmdscope-0.1.0/src/cmdscope/reports/terminal.py +429 -0
  51. cmdscope-0.1.0/src/cmdscope/storage/__init__.py +6 -0
  52. cmdscope-0.1.0/src/cmdscope/storage/sqlite.py +469 -0
  53. cmdscope-0.1.0/src/cmdscope/storage/writer.py +105 -0
  54. cmdscope-0.1.0/src/cmdscope.egg-info/PKG-INFO +353 -0
  55. cmdscope-0.1.0/src/cmdscope.egg-info/SOURCES.txt +73 -0
  56. cmdscope-0.1.0/src/cmdscope.egg-info/dependency_links.txt +1 -0
  57. cmdscope-0.1.0/src/cmdscope.egg-info/entry_points.txt +2 -0
  58. cmdscope-0.1.0/src/cmdscope.egg-info/requires.txt +10 -0
  59. cmdscope-0.1.0/src/cmdscope.egg-info/top_level.txt +1 -0
  60. cmdscope-0.1.0/tests/__init__.py +0 -0
  61. cmdscope-0.1.0/tests/conftest.py +41 -0
  62. cmdscope-0.1.0/tests/integration/__init__.py +0 -0
  63. cmdscope-0.1.0/tests/integration/test_cli.py +242 -0
  64. cmdscope-0.1.0/tests/integration/test_engine.py +225 -0
  65. cmdscope-0.1.0/tests/support.py +46 -0
  66. cmdscope-0.1.0/tests/unit/__init__.py +0 -0
  67. cmdscope-0.1.0/tests/unit/test_analysis.py +110 -0
  68. cmdscope-0.1.0/tests/unit/test_config.py +153 -0
  69. cmdscope-0.1.0/tests/unit/test_filesystem_collector.py +100 -0
  70. cmdscope-0.1.0/tests/unit/test_network_collector.py +115 -0
  71. cmdscope-0.1.0/tests/unit/test_platform.py +95 -0
  72. cmdscope-0.1.0/tests/unit/test_privacy.py +83 -0
  73. cmdscope-0.1.0/tests/unit/test_process_collector.py +62 -0
  74. cmdscope-0.1.0/tests/unit/test_reports.py +191 -0
  75. cmdscope-0.1.0/tests/unit/test_sqlite.py +194 -0
@@ -0,0 +1,58 @@
1
+ name: Bug report
2
+ description: Report a problem with CmdScope
3
+ labels: [bug]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thanks for reporting a bug. CmdScope never uploads data, so everything below
9
+ stays in this issue.
10
+ - type: input
11
+ id: version
12
+ attributes:
13
+ label: CmdScope version
14
+ description: Output of `cmdscope --version`
15
+ placeholder: cmdscope 0.1.0
16
+ validations:
17
+ required: true
18
+ - type: input
19
+ id: os
20
+ attributes:
21
+ label: Operating system
22
+ placeholder: Windows 11 / Ubuntu 24.04 / macOS 15
23
+ validations:
24
+ required: true
25
+ - type: input
26
+ id: python
27
+ attributes:
28
+ label: Python version
29
+ placeholder: 3.13.1
30
+ validations:
31
+ required: true
32
+ - type: textarea
33
+ id: command
34
+ attributes:
35
+ label: What did you run?
36
+ description: The exact CmdScope command, with secrets removed.
37
+ placeholder: cmdscope run -- npm install
38
+ validations:
39
+ required: true
40
+ - type: textarea
41
+ id: expected
42
+ attributes:
43
+ label: Expected behaviour
44
+ validations:
45
+ required: true
46
+ - type: textarea
47
+ id: observed
48
+ attributes:
49
+ label: Observed behaviour
50
+ description: Include the report output if it is safe to share.
51
+ validations:
52
+ required: true
53
+ - type: textarea
54
+ id: doctor
55
+ attributes:
56
+ label: Output of `cmdscope doctor`
57
+ description: This contains no personal data and helps a lot.
58
+ render: shell
@@ -0,0 +1,60 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ name: build distributions
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.12"
20
+ cache: pip
21
+ - name: Install build tools
22
+ run: |
23
+ python -m pip install --upgrade pip
24
+ python -m pip install build twine
25
+ - name: Build
26
+ run: python -m build
27
+ - name: Verify metadata
28
+ run: twine check dist/*
29
+ - name: Install wheel in a clean environment
30
+ run: |
31
+ python -m venv .venv-wheel
32
+ .venv-wheel/bin/python -m pip install dist/*.whl
33
+ .venv-wheel/bin/cmdscope --version
34
+ - uses: actions/upload-artifact@v4
35
+ with:
36
+ name: distributions
37
+ path: dist/
38
+
39
+ publish:
40
+ name: publish to PyPI
41
+ needs: build
42
+ runs-on: ubuntu-latest
43
+ environment:
44
+ name: pypi
45
+ url: https://pypi.org/p/cmdscope
46
+ permissions:
47
+ contents: read
48
+ steps:
49
+ - uses: actions/download-artifact@v4
50
+ with:
51
+ name: distributions
52
+ path: dist
53
+ - name: Publish to PyPI with an API token
54
+ uses: pypa/gh-action-pypi-publish@release/v1
55
+ with:
56
+ # The token is a PyPI API token with scope "Entire project" for cmdscope,
57
+ # stored as the repository secret PYPI_API_TOKEN.
58
+ # Repository settings -> Secrets and variables -> Actions -> New secret.
59
+ # Name it exactly PYPI_API_TOKEN and paste the "pypi-..." token as the value.
60
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,92 @@
1
+ name: tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: tests-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ lint:
18
+ name: lint and type check
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - uses: actions/setup-python@v5
23
+ with:
24
+ python-version: "3.12"
25
+ cache: pip
26
+ - name: Install dependencies
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ python -m pip install -e ".[dev]"
30
+ - name: Ruff lint
31
+ run: ruff check src tests
32
+ - name: Ruff format
33
+ run: ruff format --check src tests
34
+ - name: Mypy
35
+ run: mypy src/cmdscope
36
+
37
+ test:
38
+ name: test ${{ matrix.os }} / python ${{ matrix.python }}
39
+ runs-on: ${{ matrix.os }}
40
+ strategy:
41
+ fail-fast: false
42
+ matrix:
43
+ os: [ubuntu-latest, windows-latest, macos-latest]
44
+ python: ["3.11", "3.12", "3.13"]
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+ - uses: actions/setup-python@v5
48
+ with:
49
+ python-version: ${{ matrix.python }}
50
+ cache: pip
51
+ - name: Install dependencies
52
+ run: |
53
+ python -m pip install --upgrade pip
54
+ python -m pip install -e ".[dev]"
55
+ - name: Run tests
56
+ run: pytest --cov=cmdscope --cov-report=term-missing
57
+ - name: Upload coverage
58
+ if: matrix.os == 'ubuntu-latest' && matrix.python == '3.12'
59
+ uses: actions/upload-artifact@v4
60
+ with:
61
+ name: coverage-${{ matrix.python }}
62
+ path: .coverage
63
+ if-no-files-found: ignore
64
+
65
+ build:
66
+ name: build and install
67
+ runs-on: ubuntu-latest
68
+ steps:
69
+ - uses: actions/checkout@v4
70
+ - uses: actions/setup-python@v5
71
+ with:
72
+ python-version: "3.12"
73
+ cache: pip
74
+ - name: Install build tools
75
+ run: |
76
+ python -m pip install --upgrade pip
77
+ python -m pip install build twine
78
+ - name: Build distributions
79
+ run: python -m build
80
+ - name: Check metadata
81
+ run: twine check dist/*
82
+ - name: Install wheel in a clean environment
83
+ run: |
84
+ python -m venv .venv-wheel
85
+ .venv-wheel/bin/python -m pip install dist/*.whl
86
+ .venv-wheel/bin/cmdscope --version
87
+ .venv-wheel/bin/cmdscope doctor --json > doctor.json
88
+ - name: Upload distributions
89
+ uses: actions/upload-artifact@v4
90
+ with:
91
+ name: distributions
92
+ path: dist/
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres to
5
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ Nothing yet.
10
+
11
+ ## [0.1.0] - 2026-11-08
12
+
13
+ Initial public release.
14
+
15
+ ### Added
16
+
17
+ - `cmdscope run` — run a command inside an observation session and print a report.
18
+ - Filesystem collector: baseline snapshot, native OS events (Windows, Linux, macOS),
19
+ polling fallback, and final reconciliation. Reports created, modified, and deleted
20
+ entries with metadata only.
21
+ - Process collector: psutil-based discovery of the root process and its descendants,
22
+ with redacted command lines and explicit "still running" reporting.
23
+ - Network collector: TCP/UDP endpoint sampling attributed to the processes of the
24
+ session, with no payload inspection and no DNS lookups.
25
+ - Local SQLite session storage with schema versioning, cascading deletes, event limits,
26
+ and optional pruning of old sessions.
27
+ - `cmdscope sessions`, `cmdscope show`, `cmdscope report` (terminal, JSON, HTML), and
28
+ `cmdscope compare`.
29
+ - `cmdscope doctor` for read-only capability diagnostics and `cmdscope config` for
30
+ inspecting or initializing the TOML configuration.
31
+ - Privacy layer that redacts sensitive flags, environment variables, URL credentials, and
32
+ authorization headers before anything is stored.
33
+ - TOML configuration with per-collector settings, watch roots, ignore patterns, storage
34
+ limits, and report options.
35
+ - Documentation: README, architecture guide, collector guide, configuration reference,
36
+ privacy model, contribution guide with the engineering rules.
37
+
38
+ ### Known limitations
39
+
40
+ - Observation is limited to the configured watch roots; CmdScope is not a syscall tracer.
41
+ - Processes and sockets are sampled and very short-lived ones can be missed.
42
+ - Runtime environment mutations are not observable.
43
+ - Windows is the only platform validated manually in this release; Linux and macOS are
44
+ exercised by CI.
45
+
46
+ [Unreleased]: https://github.com/SouzaF19/cmdscope/compare/v0.1.0...HEAD
47
+ [0.1.0]: https://github.com/SouzaF19/cmdscope/releases/tag/v0.1.0
@@ -0,0 +1,97 @@
1
+ # Contributing to CmdScope
2
+
3
+ Thanks for considering a contribution. CmdScope is young, so there is room to shape the
4
+ design — but the project has non-negotiable rules about honesty, privacy, and safety.
5
+
6
+ Read the "Ground rules" and "Architecture invariants" sections of this guide first: they
7
+ contain the engineering rules for this repository and are enforced in review.
8
+
9
+ ## Development setup
10
+
11
+ ```console
12
+ $ git clone https://github.com/SouzaF19/cmdscope.git
13
+ $ cd cmdscope
14
+ $ python -m venv .venv
15
+ $ .venv\Scripts\activate # Windows
16
+ $ source .venv/bin/activate # Linux/macOS
17
+ $ python -m pip install -e ".[dev]"
18
+ ```
19
+
20
+ ## Quality gates
21
+
22
+ Run all of them before opening a pull request:
23
+
24
+ ```console
25
+ $ ruff check src tests
26
+ $ ruff format --check src tests
27
+ $ mypy src/cmdscope
28
+ $ pytest
29
+ $ pytest --cov=cmdscope --cov-report=term-missing
30
+ ```
31
+
32
+ CI runs the same checks on Windows, Ubuntu, and macOS for Python 3.11, 3.12, and 3.13.
33
+
34
+ ## Ground rules
35
+
36
+ - **No fabricated events.** Every reported value must come from an observation. When a
37
+ collector cannot observe something, say so.
38
+ - **No file contents, no telemetry, no uploads.**
39
+ - **Never elevate privileges** and never install privileged components.
40
+ - **Never hide failures.** A degraded collector must be visible in the report.
41
+ - **Tests must run.** Do not skip tests to make a pipeline green.
42
+ - **Keep the dependency list small.** A new dependency needs a justification in the pull
43
+ request description.
44
+
45
+ ## Adding a collector
46
+
47
+ See [docs/collectors.md](docs/collectors.md#writing-a-new-collector). In short: implement
48
+ the `Collector` protocol, emit typed events, report an honest status, document the blind
49
+ spots, and add tests.
50
+
51
+ ## Pull requests
52
+
53
+ 1. Create a focused branch: `feature/short-description`.
54
+ 2. Keep the change small enough to review. Separate refactors from behaviour changes.
55
+ 3. Update `CHANGELOG.md` under "Unreleased" for user-visible changes.
56
+ 4. Update the README and `docs/` when behaviour or limitations change.
57
+ 5. Describe in the pull request what you validated and on which platform.
58
+
59
+ ## Commit messages
60
+
61
+ Use short, imperative summaries, for example:
62
+
63
+ ```text
64
+ Add network collector status for access-denied environments
65
+ ```
66
+
67
+ ## Reporting bugs
68
+
69
+ Open an issue with:
70
+
71
+ - the CmdScope version (`cmdscope --version`), Python version, and operating system;
72
+ - the exact command you ran and the expected versus observed behaviour;
73
+ - the output of `cmdscope doctor` (it contains no personal data);
74
+ - a minimal reproduction if possible.
75
+
76
+ Never paste secrets into an issue — CmdScope redacts its own reports, but your shell
77
+ history might not.
78
+
79
+ ## License
80
+
81
+ Contributions are accepted under the MIT license.
82
+
83
+ ## Releasing (maintainers)
84
+
85
+ 1. Merge the release PR and confirm that CI is green on `main`.
86
+ 2. Update `CHANGELOG.md` (move "Unreleased" entries into a dated version section).
87
+ 3. Bump `version` in `pyproject.toml`.
88
+ 4. Tag and push: `git tag v0.1.0 && git push origin v0.1.0`.
89
+ 5. The `release` workflow builds the wheel and sdist, checks them, smoke-installs the
90
+ wheel, and publishes both to PyPI.
91
+
92
+ Publishing uses the PyPI API token stored as the repository secret `PYPI_API_TOKEN`
93
+ (`Repository settings → Secrets and variables → Actions`). Rotate the token after every
94
+ release. To switch to trusted publishing instead, remove the `password:` input and add
95
+ `id-token: write` to the publish job permissions after configuring the publisher on
96
+ PyPI. Publishing is never triggered from a pull request.
97
+
cmdscope-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CmdScope contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,11 @@
1
+ include LICENSE
2
+ include README.md
3
+ include CHANGELOG.md
4
+ include CONTRIBUTING.md
5
+ include SECURITY.md
6
+ recursive-include docs *.md
7
+ recursive-include examples *.py *.md
8
+ recursive-include tests *.py
9
+ recursive-include .github *.yml *.yaml *.md
10
+ global-exclude __pycache__
11
+ global-exclude *.py[cod]