flash-context 0.1.0__tar.gz → 0.3.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 (25) hide show
  1. {flash_context-0.1.0 → flash_context-0.3.0}/.env.example +5 -1
  2. flash_context-0.3.0/CHANGELOG.md +65 -0
  3. {flash_context-0.1.0 → flash_context-0.3.0}/PKG-INFO +32 -6
  4. flash_context-0.3.0/README.md +84 -0
  5. {flash_context-0.1.0 → flash_context-0.3.0}/config.yaml.example +5 -1
  6. {flash_context-0.1.0 → flash_context-0.3.0}/pyproject.toml +5 -2
  7. {flash_context-0.1.0 → flash_context-0.3.0}/src/flash_context/agent.py +215 -101
  8. {flash_context-0.1.0 → flash_context-0.3.0}/src/flash_context/cli.py +15 -0
  9. {flash_context-0.1.0 → flash_context-0.3.0}/src/flash_context/config.py +93 -49
  10. flash_context-0.3.0/src/flash_context/logging.py +90 -0
  11. {flash_context-0.1.0 → flash_context-0.3.0}/src/flash_context/mcp_server.py +9 -16
  12. flash_context-0.3.0/src/flash_context/tools/glob.py +39 -0
  13. flash_context-0.3.0/src/flash_context/tools/grep.py +102 -0
  14. {flash_context-0.1.0 → flash_context-0.3.0}/src/flash_context/tools/read.py +44 -16
  15. {flash_context-0.1.0 → flash_context-0.3.0}/src/flash_context/tools/safety.py +107 -19
  16. {flash_context-0.1.0 → flash_context-0.3.0}/src/flash_context/types.py +5 -2
  17. flash_context-0.1.0/README.md +0 -59
  18. flash_context-0.1.0/src/flash_context/logging.py +0 -84
  19. flash_context-0.1.0/src/flash_context/tools/glob.py +0 -29
  20. flash_context-0.1.0/src/flash_context/tools/grep.py +0 -67
  21. {flash_context-0.1.0 → flash_context-0.3.0}/.gitignore +0 -0
  22. {flash_context-0.1.0 → flash_context-0.3.0}/LICENSE +0 -0
  23. {flash_context-0.1.0 → flash_context-0.3.0}/src/flash_context/__init__.py +0 -0
  24. {flash_context-0.1.0 → flash_context-0.3.0}/src/flash_context/llm.py +0 -0
  25. {flash_context-0.1.0 → flash_context-0.3.0}/src/flash_context/tools/__init__.py +0 -0
@@ -4,10 +4,14 @@ FLASH_CONTEXT_API_KEY=
4
4
  FLASH_CONTEXT_MAX_TURNS=6
5
5
  FLASH_CONTEXT_MAX_READ_BYTES=12000
6
6
  FLASH_CONTEXT_MAX_GREP_RESULTS=50
7
- FLASH_CONTEXT_TRAJ_DIR=.flash-context
7
+ FLASH_CONTEXT_TRAJ_DIR=
8
8
  FLASH_CONTEXT_TIMEOUT_SECONDS=120
9
9
  FLASH_CONTEXT_MAX_OBSERVATION_CHARS=6000
10
10
  FLASH_CONTEXT_MAX_READ_LINES=120
11
11
  FLASH_CONTEXT_MAX_COMPLETION_TOKENS=512
12
12
  FLASH_CONTEXT_TEMPERATURE=0
13
13
  FLASH_CONTEXT_MAX_PARALLEL_TOOLS=4
14
+ FLASH_CONTEXT_MAX_SCAN_BYTES=16777216
15
+ FLASH_CONTEXT_MAX_SCAN_ENTRIES=10000
16
+ FLASH_CONTEXT_TOOL_TIMEOUT_SECONDS=5
17
+ FLASH_CONTEXT_MAX_TOOL_CALLS_PER_TURN=16
@@ -0,0 +1,65 @@
1
+ # Changelog
2
+
3
+ User-visible changes and migration instructions for each release.
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.3.0] - 2026-11-01
8
+
9
+ ### Fixed
10
+
11
+ - Resolve bare file-path queries locally with bounded previews and find unique
12
+ Python definitions even when many references precede them.
13
+ - Keep literal and scoped searches from scanning unrelated directory trees while
14
+ preserving safety checks and existing resource limits.
15
+ - Surface scan failures from the initial file sample and CLI result warnings.
16
+ - Describe the MCP exploration tool during discovery and use tool-specific
17
+ trajectory counters instead of misleading empty read-content counts.
18
+
19
+ ### Migration
20
+
21
+ - Citation objects no longer include the unused `reason` field. Consumers should
22
+ read `path`, `start_line`, and `end_line` without expecting `reason: null`.
23
+ - The CLI now exits 6 for empty results after scan-budget exhaustion or a tool
24
+ processing timeout, retaining text/JSON on stdout and warnings on stderr.
25
+ Partial cited results and complete empty searches still exit 0.
26
+ - Trajectory tool entries now include only their relevant counter:
27
+ `content_length` (read), `hit_count` (grep), or `match_count` (glob).
28
+
29
+ ### Changed
30
+
31
+ - Prompt the explorer to prefer implementation source for coding questions and
32
+ the smallest supporting citation ranges. Validation checks safe line coverage;
33
+ precision and relevance remain model-dependent.
34
+ - Publish GitHub releases automatically after PyPI installation verification,
35
+ using this changelog and the same distribution artifacts uploaded to PyPI.
36
+ - Refresh package-index metadata during release installation retries.
37
+
38
+ ## [0.2.0] - 2026-11-01
39
+
40
+ ### Changed
41
+
42
+ - Enforce deny/ignore rules on requested and resolved paths, including environment
43
+ files, private-key names, and runtime histories. Prune denied directories.
44
+ - Bound scan bytes, directory entries, processing time, regex execution, tool
45
+ batches, and model observations; report incomplete coverage explicitly.
46
+ - Improve exact-lookup routing, read ranges, truncation metadata, and structured
47
+ endpoint/filesystem failures across CLI and MCP.
48
+ - Keep optional trajectory logs metadata-only and outside the inspected root.
49
+
50
+ ### Migration
51
+
52
+ - Move any trajectory directory inside the inspected repository outside it, or
53
+ disable logging with `FLASH_CONTEXT_TRAJ_DIR=`. Empty/null settings disable
54
+ inherited logging. Existing logs remain untouched.
55
+
56
+ ## [0.1.0] - 2026-11-01
57
+
58
+ ### Added
59
+
60
+ - Initial Python CLI and optional MCP adapter sharing a read-only explorer core.
61
+ - OpenAI-compatible tool-call loop with bounded Read/Glob/Grep repository tools,
62
+ root-scoped path validation, validated citations, and raw source snippets.
63
+ - Exact path/symbol lookup shortcuts, concurrent local tools, and configurable
64
+ endpoint settings and limits.
65
+ - Wheel/source packaging and tag-driven TestPyPI/PyPI publication and smoke checks.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: flash-context
3
- Version: 0.1.0
3
+ Version: 0.3.0
4
4
  Summary: Read-only context exploration and retrieval for AI agents, starting with codebases and repositories.
5
5
  Project-URL: Repository, https://github.com/zyf0717/flash-context
6
6
  Project-URL: Issues, https://github.com/zyf0717/flash-context/issues
@@ -16,20 +16,37 @@ Classifier: Topic :: Software Development
16
16
  Requires-Python: >=3.13
17
17
  Requires-Dist: httpx>=0.28.0
18
18
  Requires-Dist: pyyaml>=6.0.0
19
+ Requires-Dist: regex>=2026.9.29
19
20
  Provides-Extra: mcp
20
21
  Requires-Dist: mcp<2,>=1.13.0; extra == 'mcp'
21
22
  Description-Content-Type: text/markdown
22
23
 
23
24
  # flash-context
24
25
 
26
+ [![CI](https://github.com/zyf0717/flash-context/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/zyf0717/flash-context/actions/workflows/ci.yml)
27
+ [![PyPI version](https://img.shields.io/pypi/v/flash-context)](https://pypi.org/project/flash-context/)
28
+ [![Python versions](https://img.shields.io/pypi/pyversions/flash-context)](https://pypi.org/project/flash-context/)
29
+ [![License](https://img.shields.io/pypi/l/flash-context)](LICENSE)
30
+
25
31
  Read-only context exploration and retrieval for AI agents,
26
32
  available as a Python CLI and Model Context Protocol (MCP) server.
27
33
 
28
- Ask natural-language questions across source code, documentation, configuration,
29
- and other local text files, and get validated file-line citations and snippets.
30
- The current focus is codebases and repositories. Both interfaces share one
31
- exploration core, backed by an OpenAI-compatible FastContext-style endpoint.
32
- Local tools enforce read-only access, path safety, and resource limits.
34
+ Delegate recursive, repetitive file search and reading to a utility model
35
+ behind an OpenAI-compatible endpoint. The calling agent receives validated
36
+ file-line citations and source snippets to use in its main task.
37
+
38
+ Codebases and repositories are the current focus; the same tools explore
39
+ documentation, configuration, and other local text files. CLI and MCP share one
40
+ exploration core with read-only tools, path safety, and resource limits.
41
+ Scans and regex execution are bounded; partial results report truncation.
42
+ Citation validation checks safe paths and existing line coverage, not semantic
43
+ relevance or minimal ranges. Citation precision depends on the explorer model.
44
+ Optional metadata-only trajectory logs must stay outside the inspected repository.
45
+
46
+ Inspired by [FastContext](https://arxiv.org/abs/2606.14066), a now-withdrawn paper
47
+ on separating repository exploration from task solving, using specialized models
48
+ to return focused file-line evidence while reducing the coding agent's context
49
+ and token overhead.
33
50
 
34
51
  ## Quickstart
35
52
 
@@ -60,6 +77,14 @@ lookups can resolve locally without an endpoint. See the
60
77
  [CLI contract](specs/001-flash-context-explorer/contracts/cli.md) for options,
61
78
  output schemas, and exit codes.
62
79
 
80
+ For example, `--query 'httpx/_client.py'` returns a bounded file preview, while
81
+ `--query 'BaseTransport'` returns its definition if unique within a complete
82
+ Python source/stub scan. Local successes report `turns_used: 0` in JSON.
83
+
84
+ Warnings go to stderr in both output formats. An empty result after scan-budget
85
+ exhaustion exits **6** while preserving stdout; a complete empty search exits
86
+ **0**. For large repositories, see [scan-budget tuning](docs/configuration.md#large-repositories).
87
+
63
88
  ## MCP
64
89
 
65
90
  ```bash
@@ -74,6 +99,7 @@ See [MCP integration](docs/mcp.md) for editor configuration and source launches.
74
99
  - [Configuration](docs/configuration.md): endpoint settings, precedence, and limits.
75
100
  - [Architecture and scope](docs/architecture.md): design, status, specs, and references.
76
101
  - [Contributing](CONTRIBUTING.md): development setup, tests, and pull requests.
102
+ - [Changelog](CHANGELOG.md): release history and migration instructions.
77
103
  - [Releasing](docs/releasing.md): package checks and tag-driven TestPyPI/PyPI publishing.
78
104
 
79
105
  ## License
@@ -0,0 +1,84 @@
1
+ # flash-context
2
+
3
+ [![CI](https://github.com/zyf0717/flash-context/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/zyf0717/flash-context/actions/workflows/ci.yml)
4
+ [![PyPI version](https://img.shields.io/pypi/v/flash-context)](https://pypi.org/project/flash-context/)
5
+ [![Python versions](https://img.shields.io/pypi/pyversions/flash-context)](https://pypi.org/project/flash-context/)
6
+ [![License](https://img.shields.io/pypi/l/flash-context)](LICENSE)
7
+
8
+ Read-only context exploration and retrieval for AI agents,
9
+ available as a Python CLI and Model Context Protocol (MCP) server.
10
+
11
+ Delegate recursive, repetitive file search and reading to a utility model
12
+ behind an OpenAI-compatible endpoint. The calling agent receives validated
13
+ file-line citations and source snippets to use in its main task.
14
+
15
+ Codebases and repositories are the current focus; the same tools explore
16
+ documentation, configuration, and other local text files. CLI and MCP share one
17
+ exploration core with read-only tools, path safety, and resource limits.
18
+ Scans and regex execution are bounded; partial results report truncation.
19
+ Citation validation checks safe paths and existing line coverage, not semantic
20
+ relevance or minimal ranges. Citation precision depends on the explorer model.
21
+ Optional metadata-only trajectory logs must stay outside the inspected repository.
22
+
23
+ Inspired by [FastContext](https://arxiv.org/abs/2606.14066), a now-withdrawn paper
24
+ on separating repository exploration from task solving, using specialized models
25
+ to return focused file-line evidence while reducing the coding agent's context
26
+ and token overhead.
27
+
28
+ ## Quickstart
29
+
30
+ Requires Python 3.13+, `uv`, and an OpenAI-compatible model endpoint with tool
31
+ calling support.
32
+
33
+ ```bash
34
+ uv tool install flash-context
35
+ export FLASH_CONTEXT_BASE_URL=http://localhost:1234/v1
36
+ export FLASH_CONTEXT_MODEL=your-model
37
+
38
+ flash-context explore --repo . --query "Find the request validation logic"
39
+ ```
40
+
41
+ Replace the endpoint and model with your settings. Set `FLASH_CONTEXT_API_KEY`
42
+ if authentication is required. Installed commands use environment variables;
43
+ source checkouts also support project-root `config.yaml` and `.env`.
44
+
45
+ Default output is repository-relative citations:
46
+
47
+ ```text
48
+ src/api/validation.py:42-88
49
+ ```
50
+
51
+ Use `--format json` for structured results with source snippets, or
52
+ `--max-turns 6` to set the exploration limit. Exact path and unique symbol
53
+ lookups can resolve locally without an endpoint. See the
54
+ [CLI contract](specs/001-flash-context-explorer/contracts/cli.md) for options,
55
+ output schemas, and exit codes.
56
+
57
+ For example, `--query 'httpx/_client.py'` returns a bounded file preview, while
58
+ `--query 'BaseTransport'` returns its definition if unique within a complete
59
+ Python source/stub scan. Local successes report `turns_used: 0` in JSON.
60
+
61
+ Warnings go to stderr in both output formats. An empty result after scan-budget
62
+ exhaustion exits **6** while preserving stdout; a complete empty search exits
63
+ **0**. For large repositories, see [scan-budget tuning](docs/configuration.md#large-repositories).
64
+
65
+ ## MCP
66
+
67
+ ```bash
68
+ uvx --from 'flash-context[mcp]' flash-context mcp --transport stdio
69
+ ```
70
+
71
+ Exposes `explore_repository(query, repo_root?, max_turns?, citation?)`.
72
+ See [MCP integration](docs/mcp.md) for editor configuration and source launches.
73
+
74
+ ## Documentation
75
+
76
+ - [Configuration](docs/configuration.md): endpoint settings, precedence, and limits.
77
+ - [Architecture and scope](docs/architecture.md): design, status, specs, and references.
78
+ - [Contributing](CONTRIBUTING.md): development setup, tests, and pull requests.
79
+ - [Changelog](CHANGELOG.md): release history and migration instructions.
80
+ - [Releasing](docs/releasing.md): package checks and tag-driven TestPyPI/PyPI publishing.
81
+
82
+ ## License
83
+
84
+ [Apache License 2.0](LICENSE).
@@ -8,7 +8,7 @@ explorer:
8
8
  - "dist"
9
9
  - "build"
10
10
  # Relative paths resolve from the flash-context project root.
11
- traj_dir: ".flash-context"
11
+ traj_dir: null
12
12
 
13
13
  model:
14
14
  base_url: "http://100.105.153.85:1234/v1"
@@ -24,3 +24,7 @@ tools:
24
24
  max_observation_chars: 6000
25
25
  max_read_lines: 120
26
26
  max_parallel_tools: 4
27
+ max_scan_bytes: 16777216
28
+ max_scan_entries: 10000
29
+ tool_timeout_seconds: 5
30
+ max_tool_calls_per_turn: 16
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flash-context"
3
- version = "0.1.0"
3
+ version = "0.3.0"
4
4
  description = "Read-only context exploration and retrieval for AI agents, starting with codebases and repositories."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -18,6 +18,7 @@ classifiers = [
18
18
  dependencies = [
19
19
  "httpx>=0.28.0",
20
20
  "PyYAML>=6.0.0",
21
+ "regex>=2026.9.29",
21
22
  ]
22
23
 
23
24
  [project.urls]
@@ -36,6 +37,7 @@ dev = [
36
37
  "pytest>=8.3.0",
37
38
  "ruff>=0.9.0",
38
39
  "types-PyYAML>=6.0.12",
40
+ "types-regex>=2026.9.29.20261030",
39
41
  ]
40
42
 
41
43
  [build-system]
@@ -50,6 +52,7 @@ include = [
50
52
  "/src/flash_context",
51
53
  "/pyproject.toml",
52
54
  "/README.md",
55
+ "/CHANGELOG.md",
53
56
  "/LICENSE",
54
57
  "/config.yaml.example",
55
58
  "/.env.example",
@@ -72,5 +75,5 @@ select = ["E", "F", "I", "UP", "B", "SIM"]
72
75
  [tool.mypy]
73
76
  python_version = "3.13"
74
77
  strict = true
75
- files = ["src/flash_context", "tests/unit", "tests/contract"]
78
+ files = ["src/flash_context", "tests/unit", "tests/contract", "scripts"]
76
79
  exclude = ["tests/fixtures"]