know-cli 0.3.7__tar.gz → 0.3.9__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.
- {know_cli-0.3.7 → know_cli-0.3.9}/PKG-INFO +1 -1
- {know_cli-0.3.7 → know_cli-0.3.9}/pyproject.toml +1 -1
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/scanner.py +7 -4
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/semantic_search.py +22 -13
- {know_cli-0.3.7 → know_cli-0.3.9}/.github/actions/know-cli/action.yml +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/.github/workflows/example-advanced.yml +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/.github/workflows/example-basic.yml +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/.gitignore +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/AGENTS.md +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/KNOW_SKILL.md +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/README.md +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/docs/IMPLEMENTATION_PLAN.md +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/docs/IMPROVEMENTS.md +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/docs/STRATEGIC_AUDIT.md +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/docs/arc.md +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/docs/architecture-diff.md +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/docs/architecture.md +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/docs/dependencies.md +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/docs/digest-compact.md +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/docs/digest-llm.md +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/docs/onboarding-new-devs.md +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/docs/onboarding-new_devs.md +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/__init__.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/ai.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/cli.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/config.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/context_engine.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/cost.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/diff.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/exceptions.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/generator.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/git_hooks.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/history.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/import_graph.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/index.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/knowledge_base.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/lexical_index.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/logger.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/mcp_server.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/models.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/parsers.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/quality.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/state.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/stats.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/token_counter.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/tools.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/src/know/watcher.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/tests/README.md +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/tests/conftest.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/tests/mcp_stub/mcp/__init__.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/tests/mcp_stub/mcp/server/__init__.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/tests/mcp_stub/mcp/server/fastmcp.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/tests/test_efficiency.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/tests/test_history_cost.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/tests/test_know.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/tests/test_search_hybrid.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/tests/test_state.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/tests/test_unit.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/tests/test_week2.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/tests/test_week3.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/tests/test_week4.py +0 -0
- {know_cli-0.3.7 → know_cli-0.3.9}/tests/test_week6_tools.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: know-cli
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.9
|
|
4
4
|
Summary: Context Intelligence for AI Coding Agents — smart, token-budgeted code context
|
|
5
5
|
Project-URL: Homepage, https://github.com/vic/know-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/vic/know-cli
|
|
@@ -43,8 +43,10 @@ LANGUAGE_EXTENSIONS = {
|
|
|
43
43
|
".go": "go",
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
# Maximum TypeScript files to scan (for performance)
|
|
47
|
-
|
|
46
|
+
# Maximum TypeScript files to scan (for performance).
|
|
47
|
+
# Default is effectively unlimited for modern repos; can be overridden with
|
|
48
|
+
# KNOW_MAX_TS_FILES env var (set to 0 for unlimited).
|
|
49
|
+
MAX_TS_FILES = int(os.getenv("KNOW_MAX_TS_FILES", "0"))
|
|
48
50
|
|
|
49
51
|
# Timeout for parsing individual files (seconds)
|
|
50
52
|
FILE_PARSE_TIMEOUT = 30
|
|
@@ -192,7 +194,7 @@ class CodebaseScanner:
|
|
|
192
194
|
continue
|
|
193
195
|
|
|
194
196
|
if language == "typescript":
|
|
195
|
-
if ts_count < MAX_TS_FILES:
|
|
197
|
+
if MAX_TS_FILES <= 0 or ts_count < MAX_TS_FILES:
|
|
196
198
|
ts_files.append((path, language))
|
|
197
199
|
ts_count += 1
|
|
198
200
|
continue
|
|
@@ -205,7 +207,8 @@ class CodebaseScanner:
|
|
|
205
207
|
"spec" in str(x[0]).lower(),
|
|
206
208
|
"__tests__" in str(x[0]).lower()
|
|
207
209
|
))
|
|
208
|
-
|
|
210
|
+
selected = ts_files if MAX_TS_FILES <= 0 else ts_files[:MAX_TS_FILES]
|
|
211
|
+
for path, lang in selected:
|
|
209
212
|
yield path, lang
|
|
210
213
|
|
|
211
214
|
def scan(self, max_workers: Optional[int] = None, progress_callback=None) -> Dict[str, int]:
|
|
@@ -708,24 +708,33 @@ class SemanticSearcher:
|
|
|
708
708
|
continue
|
|
709
709
|
|
|
710
710
|
text_l = text.lower()
|
|
711
|
-
|
|
711
|
+
rel_l = rel.lower()
|
|
712
|
+
|
|
713
|
+
# Prefer exact phrase in content.
|
|
712
714
|
idx = text_l.find(q)
|
|
713
|
-
if idx < 0 and q_tokens:
|
|
714
|
-
token_positions = [text_l.find(tok) for tok in q_tokens]
|
|
715
|
-
token_positions = [pos for pos in token_positions if pos >= 0]
|
|
716
|
-
if not token_positions:
|
|
717
|
-
continue
|
|
718
|
-
idx = min(token_positions)
|
|
719
715
|
|
|
720
|
-
|
|
716
|
+
# Token fallback: allow path OR content match.
|
|
717
|
+
content_positions = []
|
|
718
|
+
path_hits = 0
|
|
719
|
+
if q_tokens:
|
|
720
|
+
content_positions = [text_l.find(tok) for tok in q_tokens]
|
|
721
|
+
content_positions = [pos for pos in content_positions if pos >= 0]
|
|
722
|
+
path_hits = sum(1 for tok in q_tokens if tok in rel_l)
|
|
723
|
+
|
|
724
|
+
if idx < 0 and content_positions:
|
|
725
|
+
idx = min(content_positions)
|
|
726
|
+
|
|
727
|
+
# No phrase/content token hit and no path hit => skip.
|
|
728
|
+
if idx < 0 and path_hits == 0:
|
|
721
729
|
continue
|
|
722
730
|
|
|
723
|
-
|
|
731
|
+
# If only filename/path matched, still return file with top-of-file snippet.
|
|
732
|
+
line_no = text[:idx].count("\n") + 1 if idx >= 0 else 1
|
|
724
733
|
snippet = _format_snippet(p, line_no, line_no, context=2, include_line_numbers=include_line_numbers)
|
|
725
|
-
|
|
726
|
-
coverage
|
|
727
|
-
if q_tokens
|
|
728
|
-
|
|
734
|
+
|
|
735
|
+
# crude relevance: token coverage in text + filename/path
|
|
736
|
+
coverage_text = sum(1 for tok in q_tokens if tok in text_l) if q_tokens else 0
|
|
737
|
+
coverage = coverage_text + path_hits
|
|
729
738
|
fallback.append((coverage, rel, line_no, snippet))
|
|
730
739
|
|
|
731
740
|
fallback.sort(key=lambda x: (-x[0], x[1]))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|