copilot-session-tools 0.19.1__tar.gz → 0.19.2__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 (37) hide show
  1. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/CHANGELOG.md +4 -0
  2. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/PKG-INFO +1 -1
  3. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/pyproject.toml +1 -1
  4. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/pyproject.toml.orig +1 -1
  5. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/__init__.py +1 -1
  6. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/db_search.py +36 -26
  7. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/LICENSE +0 -0
  8. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/README.md +0 -0
  9. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/cli.py +0 -0
  10. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/content_types.py +0 -0
  11. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/database.py +0 -0
  12. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/db_retrieval.py +0 -0
  13. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/db_schema.py +0 -0
  14. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/db_storage.py +0 -0
  15. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/html_exporter.py +0 -0
  16. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/markdown_exporter.py +0 -0
  17. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/py.typed +0 -0
  18. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/refresh.py +0 -0
  19. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/scanner/__init__.py +0 -0
  20. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/scanner/cli.py +0 -0
  21. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/scanner/content.py +0 -0
  22. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/scanner/diff.py +0 -0
  23. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/scanner/discovery.py +0 -0
  24. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/scanner/git.py +0 -0
  25. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/scanner/models.py +0 -0
  26. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/scanner/shared.py +0 -0
  27. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/scanner/vscode.py +0 -0
  28. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/sources.py +0 -0
  29. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/transcript_cleanup.py +0 -0
  30. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/utils.py +0 -0
  31. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/version_check.py +0 -0
  32. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/web/__init__.py +0 -0
  33. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/web/templates/error.html +0 -0
  34. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/web/templates/index.html +0 -0
  35. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/web/templates/session.html +0 -0
  36. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/web/templates/sources.html +0 -0
  37. {copilot_session_tools-0.19.1 → copilot_session_tools-0.19.2}/src/copilot_session_tools/web/webapp.py +0 -0
@@ -21,6 +21,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
21
21
  - **Refresh and fallback**: Chronicle discovery, JSONL enrichment, staleness checks, targeted enrichment, and orphan cleanup now operate per source. Disabled or unavailable sources retain archived content.
22
22
  - **Application filters**: The `cli` button now includes only the built-in Copilot CLI source. Every added source gets its own lowercase button, such as `scout`, while VS Code editions remain separate.
23
23
 
24
+ ### Fixed
25
+
26
+ - **Search**: Queries containing punctuation such as `.`, `/`, `@`, `,`, `+`, or `'` (e.g. `db_search.py`) no longer fail with `fts5: syntax error`. Any non-bareword token is now quoted, while `^` and trailing `*` operators are preserved. Tool, file, command, and thinking searches now match the raw search text instead of the FTS5-escaped string.
27
+
24
28
  ## [0.17.1] - 2026-06-30
25
29
 
26
30
  ### Fixed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: copilot-session-tools
3
- Version: 0.19.1
3
+ Version: 0.19.2
4
4
  Summary: A collection of tools for VS Code GitHub Copilot chat history
5
5
  Keywords: copilot,github,vscode,chat,archive,history
6
6
  Author: Arithmomaniac
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "copilot-session-tools"
7
- version = "0.19.1"
7
+ version = "0.19.2"
8
8
  description = "A collection of tools for VS Code GitHub Copilot chat history"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "copilot-session-tools"
7
- version = "0.19.1"
7
+ version = "0.19.2"
8
8
  description = "A collection of tools for VS Code GitHub Copilot chat history"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -12,7 +12,7 @@ This project borrows patterns from several open-source projects:
12
12
  - tad-hq/universal-session-viewer: FTS5 full-text search design
13
13
  """
14
14
 
15
- __version__ = "0.19.1"
15
+ __version__ = "0.19.2"
16
16
 
17
17
  from .content_types import (
18
18
  CONTENT_TYPES,
@@ -18,6 +18,7 @@ class ParsedQuery:
18
18
  """Represents a parsed search query with extracted field filters."""
19
19
 
20
20
  fts_query: str # The FTS5 query string for content search
21
+ text_query: str = "" # Unescaped search text (field prefixes removed) for LIKE matching
21
22
  role: str | None = None # Extracted role filter (user/assistant)
22
23
  workspace: str | None = None # Extracted workspace filter
23
24
  workspaces: list[str] | None = None # All extracted workspace filters
@@ -53,16 +54,21 @@ def _validate_date_format(date_str: str) -> str | None:
53
54
  return None
54
55
 
55
56
 
57
+ # FTS5 bareword characters: ASCII alphanumerics, underscore, non-ASCII, and \x1a
58
+ _FTS5_BAREWORD_RE = re.compile("[A-Za-z0-9_\x1a\u0080-\U0010ffff]+")
59
+
60
+
56
61
  def _escape_fts5_token(token: str) -> str:
57
62
  """Escape a single FTS5 token to prevent syntax errors.
58
63
 
59
- FTS5 has special operators like:
60
- - Dash (-) which means NOT
61
- - Colon (:) for column specification
62
- - Parentheses, brackets for grouping
64
+ FTS5 only accepts unquoted "barewords" made of ASCII letters, digits,
65
+ underscores, and non-ASCII characters. Any other character (``.``, ``/``,
66
+ ``-``, ``:``, ``@``, ``,``, ``+``, ``'``, parentheses, ...) is a syntax
67
+ error unless the token is quoted as a string.
63
68
 
64
- If a token is already quoted, leave it as-is.
65
- Otherwise, wrap it in quotes if it contains special characters.
69
+ If a token is already quoted, leave it as-is. Otherwise, wrap it in quotes
70
+ if it is not a bareword. A leading ``^`` (first-token) and trailing ``*``
71
+ (prefix match) are preserved as operators.
66
72
 
67
73
  Args:
68
74
  token: A single search token (word or phrase).
@@ -74,23 +80,25 @@ def _escape_fts5_token(token: str) -> str:
74
80
  return token
75
81
 
76
82
  # If already quoted, leave as-is
77
- if token.startswith('"') and token.endswith('"'):
83
+ if len(token) >= 2 and token.startswith('"') and token.endswith('"'):
78
84
  return token
79
85
 
80
- # FTS5 special characters that need escaping:
81
- # - (dash/NOT operator), : (column spec), (, ), [, ]
82
- # Note: We don't need to escape * (prefix match) or ^ (first token)
83
- # as these are useful operators users might want to use
84
- special_chars = ["-", ":", "(", ")", "[", "]"]
86
+ prefix = "^" if token.startswith("^") else ""
87
+ core = token[len(prefix) :]
88
+ suffix = "*" if core.endswith("*") else ""
89
+ if suffix:
90
+ core = core[:-1]
85
91
 
86
- # Check if token contains any special characters
87
- if any(char in token for char in special_chars):
88
- # Escape internal quotes by doubling them (FTS5 convention)
89
- escaped = token.replace('"', '""')
90
- # Wrap in quotes
91
- return f'"{escaped}"'
92
+ if not core:
93
+ # Lone operator characters (e.g. "*" or "^") are searched literally
94
+ return '"' + token.replace('"', '""') + '"'
95
+
96
+ if _FTS5_BAREWORD_RE.fullmatch(core):
97
+ return token
92
98
 
93
- return token
99
+ # Escape internal quotes by doubling them (FTS5 convention)
100
+ escaped = core.replace('"', '""')
101
+ return f'{prefix}"{escaped}"{suffix}'
94
102
 
95
103
 
96
104
  def parse_search_query(query: str) -> ParsedQuery:
@@ -161,6 +169,7 @@ def parse_search_query(query: str) -> ParsedQuery:
161
169
  # 1. Quoted phrases (keep as-is)
162
170
  # 2. Unquoted words (escape special chars and join with spaces for implicit AND)
163
171
 
172
+ raw_tokens: list[str] = []
164
173
  if not remaining_query:
165
174
  fts_query = ""
166
175
  else:
@@ -169,13 +178,13 @@ def parse_search_query(query: str) -> ParsedQuery:
169
178
  # Pattern to match quoted strings or individual words
170
179
  token_pattern = r'"[^"]*"|[^\s"]+'
171
180
 
172
- for match in re.finditer(token_pattern, remaining_query):
173
- token = match.group(0)
174
- # Clean up any empty quotes
175
- if token == '""':
176
- continue
181
+ query_tokens = [token for token in re.findall(token_pattern, remaining_query) if token != '""']
182
+ for index, token in enumerate(query_tokens):
183
+ raw_tokens.append(token[1:-1] if len(token) >= 2 and token.startswith('"') and token.endswith('"') else token)
177
184
  # Escape FTS5 special characters in the token
178
- escaped_token = _escape_fts5_token(token)
185
+ # Quoted phrases and whitespace can separate operators from their operands.
186
+ is_operator = (token == "^" and index + 1 < len(query_tokens)) or (token == "*" and index > 0)
187
+ escaped_token = token if is_operator else _escape_fts5_token(token)
179
188
  tokens.append(escaped_token)
180
189
 
181
190
  # Join tokens with space (FTS5 uses implicit AND)
@@ -183,6 +192,7 @@ def parse_search_query(query: str) -> ParsedQuery:
183
192
 
184
193
  return ParsedQuery(
185
194
  fts_query=fts_query,
195
+ text_query=" ".join(raw_tokens),
186
196
  role=role,
187
197
  workspace=workspaces[0] if workspaces else None,
188
198
  workspaces=workspaces or None,
@@ -915,7 +925,7 @@ def execute_search(
915
925
  )
916
926
 
917
927
  # For tool/file/command/thinking searches, use LIKE matching
918
- search_terms = fts_query if fts_query else query
928
+ search_terms = parsed.text_query if fts_query else query
919
929
  like_pattern = f"%{search_terms}%"
920
930
 
921
931
  if include_tools and len(results) < limit and search_terms: