Claude/setup docs plan kh4 tm - #23
Merged
Merged
Conversation
…to run_once Two bugs surfaced by a code-and-capabilities audit: - JsonFindingStore._finding_from_dict dropped investigation_id and investigation_link_type on reload, silently severing persisted findings from their investigations. Now restored via .get() so legacy files without the keys still load. - SenseGNATService.run_once() serialized findings to STIX but never invoked the TAXII transport, despite docs describing a publish step. Added GNATConnector.push_objects() to push the already-serialized bundle (re-serializing via push_findings would mint new STIX IDs and break Grouping object_refs), and call it from run_once(). Record-only connectors skip with a warning; push errors never raise. Also removes the stale pythonpath known-issue note from CLAUDE.md (pyproject.toml already reads pythonpath = ["."]). 11 new tests; 333 passing total. https://claude.ai/code/session_014H2m5m7ULUn1Ujy1caErrq
…ation
- sensegnat/cli.py: `sensegnat run --config <yaml>` runs the pipeline
once and prints a STIX summary; --interval N loops; -v/-vv sets log
level; --version prints the package version
- sensegnat/ingestion/factory.py: build_adapter() constructs any of the
six adapters from a new AdapterSettings config section, with clear
ValueError on unknown types or missing required fields
- load_settings() now expands ${VAR} references from the environment in
YAML string values, so secrets stay out of config files; unset
variables raise naming the missing var
- example config gains an adapter: section and ${VAR} usage comments;
example script now configures logging instead of print
28 new tests (factory, interpolation, CLI smoke).
https://claude.ai/code/session_014H2m5m7ULUn1Ujy1caErrq
- bump to 0.2.0; sensegnat.__version__ single-sourced from package metadata; [project.scripts] wires the sensegnat console command - CHANGELOG.md back-fills 0.1.0 and 0.2.0 (Keep a Changelog format) - release.yml: on v* tags run tests, build sdist+wheel, attach to a GitHub Release - mypy now blocking in CI: [tool.mypy] ignores missing stubs for the optional yaml/splunklib/kafka imports, and the two real errors in service.py are fixed with union annotations on the store attributes https://claude.ai/code/session_014H2m5m7ULUn1Ujy1caErrq
- README quick start switches to the sensegnat CLI; capability list
gains the CLI entry; test count 333 -> 361
- docs/reference/configuration.md: AdapterSettings section with the
per-type required/optional field table, ${VAR} interpolation rules,
updated SenseGNATSettings root model
- CLAUDE.md: CLI usage, cli.py/factory in package layout, 0.2.0 items
- docs/index.md: CLI row in What's implemented
https://claude.ai/code/session_014H2m5m7ULUn1Ujy1caErrq
There was a problem hiding this comment.
Pull request overview
This PR expands SenseGNAT into a config-driven, releasable CLI application by adding a sensegnat command, an adapter factory backed by new adapter: settings, and environment-variable interpolation for secrets. It also changes the service to push the exact serialized STIX bundle (preserving IDs for Grouping object_refs) and fixes persisted finding reload behavior for investigation context.
Changes:
- Add
sensegnatCLI (sensegnat run --config ..., optional--interval,-v/-vv,--version) plus packaging entry point. - Add
adapter:configuration +build_adapter()factory, and${ENV_VAR}interpolation during settings load. - Push pre-serialized STIX objects from
run_once()and fixJsonFindingStorereload to preserve investigation fields.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_run_once_push.py | Adds tests ensuring run_once() pushes exactly the published STIX objects and preserves IDs. |
| tests/test_json_store.py | Adds coverage for investigation context persistence/legacy loading in JSON store. |
| tests/test_factory.py | Adds tests for build_adapter() behavior, validation, and error messages. |
| tests/test_env_interpolation.py | Adds tests for ${ENV_VAR} interpolation behavior and error cases. |
| tests/test_cli.py | Adds CLI tests for success paths and failure modes (missing config/adapter, bad type, version). |
| sensegnat/storage/json_store.py | Updates finding rehydration to include investigation fields. |
| sensegnat/ingestion/factory.py | Introduces adapter factory to construct ingestion adapters from settings. |
| sensegnat/connectors/gnat_connector.py | Adds push_objects() to push pre-serialized STIX bundles without re-serializing IDs. |
| sensegnat/config/settings.py | Adds AdapterSettings, adapter field, and recursive env-var interpolation in load_settings(). |
| sensegnat/cli.py | Implements argparse-based CLI command wiring and run loop. |
| sensegnat/api/service.py | Ensures run_once() pushes serialized STIX objects and updates store typing. |
| sensegnat/init.py | Adds __version__ sourced from package metadata with a source-tree fallback. |
| README.md | Updates quickstart and feature bullets to reflect CLI/config usage and new test count. |
| pyproject.toml | Bumps version, adds console script entry point, and adds mypy configuration. |
| examples/sensegnat.example.yaml | Adds adapter: section examples and env-var secret placeholders. |
| examples/run_phase_a.py | Switches example output to logging and sets a basic logging config. |
| docs/reference/configuration.md | Documents adapter settings and environment-variable interpolation. |
| docs/index.md | Updates docs index to include CLI and updated test count. |
| CLAUDE.md | Updates contributor instructions for CLI usage and notes new release/typecheck posture. |
| CHANGELOG.md | Adds 0.2.0 changelog describing the CLI, adapters, interpolation, pushing, and workflows. |
| .github/workflows/release.yml | Adds tagged-release workflow that runs tests and publishes sdist/wheel to GitHub Releases. |
| .github/workflows/python-typecheck.yml | Makes mypy check blocking (removes ` |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+33
to
35
| investigation_id=d.get("investigation_id"), | ||
| investigation_link_type=d.get("investigation_link_type"), | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.