copilot-session-tools 0.18.0__tar.gz → 0.19.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.
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/CHANGELOG.md +14 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/PKG-INFO +29 -2
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/README.md +28 -1
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/pyproject.toml +1 -1
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/pyproject.toml.orig +1 -1
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/__init__.py +1 -1
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/cli.py +142 -4
- copilot_session_tools-0.19.0/src/copilot_session_tools/database.py +1303 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/db_retrieval.py +46 -5
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/db_schema.py +4 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/db_search.py +4 -3
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/db_storage.py +151 -28
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/markdown_exporter.py +2 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/refresh.py +140 -84
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/scanner/models.py +3 -0
- copilot_session_tools-0.19.0/src/copilot_session_tools/sources.py +96 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/web/templates/index.html +19 -13
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/web/templates/session.html +6 -0
- copilot_session_tools-0.19.0/src/copilot_session_tools/web/templates/sources.html +82 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/web/webapp.py +172 -11
- copilot_session_tools-0.18.0/src/copilot_session_tools/database.py +0 -676
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/LICENSE +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/content_types.py +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/html_exporter.py +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/py.typed +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/scanner/__init__.py +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/scanner/cli.py +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/scanner/content.py +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/scanner/diff.py +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/scanner/discovery.py +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/scanner/git.py +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/scanner/shared.py +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/scanner/vscode.py +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/transcript_cleanup.py +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/utils.py +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/version_check.py +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/web/__init__.py +0 -0
- {copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/web/templates/error.html +0 -0
|
@@ -7,6 +7,20 @@ All notable changes to this project will be documented in this file.
|
|
|
7
7
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
8
8
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
9
9
|
|
|
10
|
+
## [Unreleased]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Named CLI sources**: A single archive can persist multiple uniquely named Copilot CLI application roots and manage them from both the CLI and web viewer.
|
|
15
|
+
- **Scout preset**: `scout` is offered as an explicit source preset when its local `.scout/copilot` directory is detected.
|
|
16
|
+
- **Source filtering and provenance**: Session lists, search, detail pages, Markdown, HTML, and JSON exports identify the originating CLI application.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **Database**: Schema v15 adds a durable source registry while preserving native session UUIDs as global identities. Source identifiers are case-insensitive, stored and rendered lowercase, and rejected when reserved. Identical copies from multiple applications collapse to one session; conflicting data under the same UUID now raises an explicit integrity error.
|
|
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
|
+
- **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
|
+
|
|
10
24
|
## [0.17.1] - 2026-06-30
|
|
11
25
|
|
|
12
26
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: copilot-session-tools
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.19.0
|
|
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
|
|
@@ -124,6 +124,27 @@ If new turns arrive after enrichment (e.g., you continued a conversation), the w
|
|
|
124
124
|
|
|
125
125
|
**VS Code sessions** (Stable and Insiders) are imported during `scan` from workspace storage. They're always enriched on import since there's no built-in tier for VS Code.
|
|
126
126
|
|
|
127
|
+
### Additional Copilot CLI application sources
|
|
128
|
+
|
|
129
|
+
One archive can include sessions from multiple applications that embed Copilot CLI. Each named source points to that application's Copilot base directory, which contains its read-only `session-store.db` and session event files.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# See locally detected presets. scout is shown only when ~/.scout/copilot exists.
|
|
133
|
+
copilot-session-tools sources presets
|
|
134
|
+
|
|
135
|
+
# Register a detected Scout installation explicitly, or provide any compatible base directory.
|
|
136
|
+
copilot-session-tools sources add --preset scout --name scout
|
|
137
|
+
copilot-session-tools sources add --name another-app --base-dir /path/to/copilot
|
|
138
|
+
|
|
139
|
+
# Manage the per-archive registry shared by the CLI and web viewer.
|
|
140
|
+
copilot-session-tools sources list
|
|
141
|
+
copilot-session-tools sources rename another-app --name renamed-app
|
|
142
|
+
copilot-session-tools sources disable renamed-app
|
|
143
|
+
copilot-session-tools sources enable renamed-app
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Source identifiers are case-insensitive, stored and rendered in lowercase, and cannot use reserved identifiers such as `cli`, `stable`, `insider`, or `custom`. A session UUID is its global identity across applications, so identical copies collapse to one session and keep the same URL. If different session data is found under the same UUID, the operation fails with an identity-conflict error instead of silently choosing one copy. Disabling a source stops live reads and enrichment while retaining content already stored in the archive.
|
|
147
|
+
|
|
127
148
|
## Searching
|
|
128
149
|
|
|
129
150
|
```bash
|
|
@@ -133,6 +154,7 @@ copilot-session-tools search "React hooks" --full
|
|
|
133
154
|
# Filter by role, workspace, edition, date
|
|
134
155
|
copilot-session-tools search "role:user workspace:my-project error" --full
|
|
135
156
|
copilot-session-tools search "edition:cli start_date:2026-01-01 deploy" --full
|
|
157
|
+
copilot-session-tools search "deploy" --source scout --full
|
|
136
158
|
|
|
137
159
|
# Search only tool invocations or file changes
|
|
138
160
|
copilot-session-tools search "git" --tools-only
|
|
@@ -159,6 +181,10 @@ copilot-session-tools scan --full
|
|
|
159
181
|
|
|
160
182
|
# Enrich a single CLI session
|
|
161
183
|
copilot-session-tools enrich <session-id>
|
|
184
|
+
copilot-session-tools enrich <native-session-id> --source scout
|
|
185
|
+
|
|
186
|
+
# Scan only one named CLI source (skips VS Code for this invocation)
|
|
187
|
+
copilot-session-tools scan --source scout
|
|
162
188
|
```
|
|
163
189
|
|
|
164
190
|
The web viewer's **Scan Now** button on unenriched sessions triggers single-session enrichment without a full scan.
|
|
@@ -194,7 +220,8 @@ copilot-session-tools web --db custom.db # custom database
|
|
|
194
220
|
|
|
195
221
|
Features:
|
|
196
222
|
- **Full-text search** with keyword highlighting
|
|
197
|
-
- **
|
|
223
|
+
- **Application filters** with separate counts for `cli`, each named source such as `scout`, and VS Code editions
|
|
224
|
+
- **Named CLI sources** managed from the Sources page, including a conditional `scout` preset
|
|
198
225
|
- **Repository and workspace filtering**
|
|
199
226
|
- **Enrichment status** — see which sessions have full detail vs. basic turns
|
|
200
227
|
- **Copy Markdown** toolbar — select message range, include/exclude diffs, tool inputs, thinking
|
|
@@ -90,6 +90,27 @@ If new turns arrive after enrichment (e.g., you continued a conversation), the w
|
|
|
90
90
|
|
|
91
91
|
**VS Code sessions** (Stable and Insiders) are imported during `scan` from workspace storage. They're always enriched on import since there's no built-in tier for VS Code.
|
|
92
92
|
|
|
93
|
+
### Additional Copilot CLI application sources
|
|
94
|
+
|
|
95
|
+
One archive can include sessions from multiple applications that embed Copilot CLI. Each named source points to that application's Copilot base directory, which contains its read-only `session-store.db` and session event files.
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# See locally detected presets. scout is shown only when ~/.scout/copilot exists.
|
|
99
|
+
copilot-session-tools sources presets
|
|
100
|
+
|
|
101
|
+
# Register a detected Scout installation explicitly, or provide any compatible base directory.
|
|
102
|
+
copilot-session-tools sources add --preset scout --name scout
|
|
103
|
+
copilot-session-tools sources add --name another-app --base-dir /path/to/copilot
|
|
104
|
+
|
|
105
|
+
# Manage the per-archive registry shared by the CLI and web viewer.
|
|
106
|
+
copilot-session-tools sources list
|
|
107
|
+
copilot-session-tools sources rename another-app --name renamed-app
|
|
108
|
+
copilot-session-tools sources disable renamed-app
|
|
109
|
+
copilot-session-tools sources enable renamed-app
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Source identifiers are case-insensitive, stored and rendered in lowercase, and cannot use reserved identifiers such as `cli`, `stable`, `insider`, or `custom`. A session UUID is its global identity across applications, so identical copies collapse to one session and keep the same URL. If different session data is found under the same UUID, the operation fails with an identity-conflict error instead of silently choosing one copy. Disabling a source stops live reads and enrichment while retaining content already stored in the archive.
|
|
113
|
+
|
|
93
114
|
## Searching
|
|
94
115
|
|
|
95
116
|
```bash
|
|
@@ -99,6 +120,7 @@ copilot-session-tools search "React hooks" --full
|
|
|
99
120
|
# Filter by role, workspace, edition, date
|
|
100
121
|
copilot-session-tools search "role:user workspace:my-project error" --full
|
|
101
122
|
copilot-session-tools search "edition:cli start_date:2026-01-01 deploy" --full
|
|
123
|
+
copilot-session-tools search "deploy" --source scout --full
|
|
102
124
|
|
|
103
125
|
# Search only tool invocations or file changes
|
|
104
126
|
copilot-session-tools search "git" --tools-only
|
|
@@ -125,6 +147,10 @@ copilot-session-tools scan --full
|
|
|
125
147
|
|
|
126
148
|
# Enrich a single CLI session
|
|
127
149
|
copilot-session-tools enrich <session-id>
|
|
150
|
+
copilot-session-tools enrich <native-session-id> --source scout
|
|
151
|
+
|
|
152
|
+
# Scan only one named CLI source (skips VS Code for this invocation)
|
|
153
|
+
copilot-session-tools scan --source scout
|
|
128
154
|
```
|
|
129
155
|
|
|
130
156
|
The web viewer's **Scan Now** button on unenriched sessions triggers single-session enrichment without a full scan.
|
|
@@ -160,7 +186,8 @@ copilot-session-tools web --db custom.db # custom database
|
|
|
160
186
|
|
|
161
187
|
Features:
|
|
162
188
|
- **Full-text search** with keyword highlighting
|
|
163
|
-
- **
|
|
189
|
+
- **Application filters** with separate counts for `cli`, each named source such as `scout`, and VS Code editions
|
|
190
|
+
- **Named CLI sources** managed from the Sources page, including a conditional `scout` preset
|
|
164
191
|
- **Repository and workspace filtering**
|
|
165
192
|
- **Enrichment status** — see which sessions have full detail vs. basic turns
|
|
166
193
|
- **Copy Markdown** toolbar — select message range, include/exclude diffs, tool inputs, thinking
|
{copilot_session_tools-0.18.0 → copilot_session_tools-0.19.0}/src/copilot_session_tools/cli.py
RENAMED
|
@@ -35,6 +35,7 @@ from copilot_session_tools.refresh import (
|
|
|
35
35
|
run_enrichment,
|
|
36
36
|
run_refresh,
|
|
37
37
|
)
|
|
38
|
+
from copilot_session_tools.sources import DEFAULT_SOURCE_ID, discover_source_presets
|
|
38
39
|
|
|
39
40
|
# On Windows, reconfigure stdout/stderr to UTF-8 when piped to prevent
|
|
40
41
|
# Rich from falling back to cp1252 which can't handle Unicode output
|
|
@@ -86,6 +87,8 @@ app = typer.Typer(
|
|
|
86
87
|
help="Create a searchable archive of VS Code GitHub Copilot chats.",
|
|
87
88
|
no_args_is_help=True,
|
|
88
89
|
)
|
|
90
|
+
sources_app = typer.Typer(help="Manage named Copilot CLI application sources.")
|
|
91
|
+
app.add_typer(sources_app, name="sources")
|
|
89
92
|
console = Console()
|
|
90
93
|
|
|
91
94
|
# Module-level state set by the app callback
|
|
@@ -241,6 +244,13 @@ def scan(
|
|
|
241
244
|
min=1,
|
|
242
245
|
),
|
|
243
246
|
] = None,
|
|
247
|
+
source: Annotated[
|
|
248
|
+
str | None,
|
|
249
|
+
typer.Option(
|
|
250
|
+
"--source",
|
|
251
|
+
help="Scan one named Copilot CLI source and skip VS Code scanning.",
|
|
252
|
+
),
|
|
253
|
+
] = None,
|
|
244
254
|
):
|
|
245
255
|
"""Scan for and import Copilot chat sessions, enriching them into the built-in store.
|
|
246
256
|
|
|
@@ -264,8 +274,20 @@ def scan(
|
|
|
264
274
|
db.parent.mkdir(parents=True, exist_ok=True)
|
|
265
275
|
database = _make_database(db)
|
|
266
276
|
|
|
267
|
-
|
|
268
|
-
if
|
|
277
|
+
selected_source = None
|
|
278
|
+
if source:
|
|
279
|
+
if storage_path or edition != "both":
|
|
280
|
+
console.print("[red]Error: --source cannot be combined with --storage-path or --edition.[/red]")
|
|
281
|
+
raise typer.Exit(1)
|
|
282
|
+
selected_source = database.get_source(source)
|
|
283
|
+
if selected_source is None:
|
|
284
|
+
console.print(f"[red]Error: Source not found: {source}[/red]")
|
|
285
|
+
raise typer.Exit(1)
|
|
286
|
+
if not selected_source.enabled:
|
|
287
|
+
console.print(f"[red]Error: Source is disabled: {selected_source.name}[/red]")
|
|
288
|
+
raise typer.Exit(1)
|
|
289
|
+
paths = []
|
|
290
|
+
elif storage_path:
|
|
269
291
|
paths = [(str(p), "custom") for p in storage_path]
|
|
270
292
|
else:
|
|
271
293
|
all_paths = get_vscode_storage_paths()
|
|
@@ -318,7 +340,12 @@ def scan(
|
|
|
318
340
|
|
|
319
341
|
# --- CLI session enrichment from Chronicle's built-in session store ---
|
|
320
342
|
console.print("\n[cyan]Enriching CLI sessions...[/cyan]")
|
|
321
|
-
enrich_result = run_enrichment(
|
|
343
|
+
enrich_result = run_enrichment(
|
|
344
|
+
database,
|
|
345
|
+
on_progress=progress_cb,
|
|
346
|
+
workers=n_workers,
|
|
347
|
+
sources=[selected_source] if selected_source else None,
|
|
348
|
+
)
|
|
322
349
|
|
|
323
350
|
console.print(f" Enriched: {enrich_result.enriched} sessions")
|
|
324
351
|
if enrich_result.reparsed:
|
|
@@ -348,6 +375,10 @@ def enrich(
|
|
|
348
375
|
help="Path to SQLite database file.",
|
|
349
376
|
),
|
|
350
377
|
] = _DEFAULT_DB,
|
|
378
|
+
source: Annotated[
|
|
379
|
+
str | None,
|
|
380
|
+
typer.Option("--source", help="Named Copilot CLI source for a native session ID."),
|
|
381
|
+
] = None,
|
|
351
382
|
):
|
|
352
383
|
"""Enrich a single CLI session from its events.jsonl file.
|
|
353
384
|
|
|
@@ -357,8 +388,12 @@ def enrich(
|
|
|
357
388
|
"""
|
|
358
389
|
_ensure_db_exists(db)
|
|
359
390
|
database = _make_database(db)
|
|
391
|
+
selected_source = database.get_source(source) if source else database.get_source(DEFAULT_SOURCE_ID)
|
|
392
|
+
if source and selected_source is None:
|
|
393
|
+
console.print(f"[red]Error: Source not found: {source}[/red]")
|
|
394
|
+
raise typer.Exit(1)
|
|
360
395
|
|
|
361
|
-
error = enrich_single_session(database, session_id)
|
|
396
|
+
error = enrich_single_session(database, session_id, source=selected_source)
|
|
362
397
|
if error:
|
|
363
398
|
console.print(f"[red]Error: {error}[/red]")
|
|
364
399
|
raise typer.Exit(1)
|
|
@@ -366,6 +401,101 @@ def enrich(
|
|
|
366
401
|
console.print(f"[green]Successfully enriched session {session_id}[/green]")
|
|
367
402
|
|
|
368
403
|
|
|
404
|
+
@sources_app.command("list")
|
|
405
|
+
def list_sources(
|
|
406
|
+
db: Annotated[Path, typer.Option("--db", "-d", help="Path to SQLite database file.")] = _DEFAULT_DB,
|
|
407
|
+
):
|
|
408
|
+
"""List named Copilot CLI sources for an archive."""
|
|
409
|
+
database = _make_database_for_command(db, allow_create=True)
|
|
410
|
+
for source in database.list_sources():
|
|
411
|
+
state = "enabled" if source.enabled else "disabled"
|
|
412
|
+
console.print(f"{source.name}\t{state}\t{source.base_dir}")
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
@sources_app.command("presets")
|
|
416
|
+
def list_source_presets():
|
|
417
|
+
"""List application presets detected on this machine."""
|
|
418
|
+
presets = discover_source_presets()
|
|
419
|
+
if not presets:
|
|
420
|
+
console.print("No source presets detected.")
|
|
421
|
+
return
|
|
422
|
+
for preset in presets:
|
|
423
|
+
console.print(f"{preset.preset_id}\t{preset.name}\t{preset.base_dir}")
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
@sources_app.command("add")
|
|
427
|
+
def add_source(
|
|
428
|
+
name: Annotated[str, typer.Option("--name", help="Unique case-insensitive identifier.")],
|
|
429
|
+
base_dir: Annotated[Path | None, typer.Option("--base-dir", help="Application Copilot base directory.")] = None,
|
|
430
|
+
preset: Annotated[str | None, typer.Option("--preset", help="Detected preset ID, such as scout.")] = None,
|
|
431
|
+
db: Annotated[Path, typer.Option("--db", "-d", help="Path to SQLite database file.")] = _DEFAULT_DB,
|
|
432
|
+
):
|
|
433
|
+
"""Register a named Copilot CLI source."""
|
|
434
|
+
if (base_dir is None) == (preset is None):
|
|
435
|
+
console.print("[red]Error: specify exactly one of --base-dir or --preset.[/red]")
|
|
436
|
+
raise typer.Exit(1)
|
|
437
|
+
if preset:
|
|
438
|
+
detected = {item.preset_id: item for item in discover_source_presets()}
|
|
439
|
+
selected = detected.get(preset.casefold())
|
|
440
|
+
if selected is None:
|
|
441
|
+
console.print(f"[red]Error: Source preset is not available: {preset}[/red]")
|
|
442
|
+
raise typer.Exit(1)
|
|
443
|
+
base_dir = selected.base_dir
|
|
444
|
+
database = _make_database_for_command(db, allow_create=True)
|
|
445
|
+
try:
|
|
446
|
+
if base_dir is None:
|
|
447
|
+
raise RuntimeError("Source base directory was not resolved.")
|
|
448
|
+
source = database.add_source(name, base_dir)
|
|
449
|
+
except ValueError as exc:
|
|
450
|
+
console.print(f"[red]Error: {exc}[/red]")
|
|
451
|
+
raise typer.Exit(1) from exc
|
|
452
|
+
console.print(f"[green]Added source {source.name}: {source.base_dir}[/green]")
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
@sources_app.command("rename")
|
|
456
|
+
def rename_source(
|
|
457
|
+
source: Annotated[str, typer.Argument(help="Existing source name or ID.")],
|
|
458
|
+
name: Annotated[str, typer.Option("--name", help="New unique case-insensitive identifier.")],
|
|
459
|
+
db: Annotated[Path, typer.Option("--db", "-d", help="Path to SQLite database file.")] = _DEFAULT_DB,
|
|
460
|
+
):
|
|
461
|
+
"""Rename a source while preserving session identities."""
|
|
462
|
+
database = _make_database_for_command(db)
|
|
463
|
+
try:
|
|
464
|
+
renamed = database.rename_source(source, name)
|
|
465
|
+
except ValueError as exc:
|
|
466
|
+
console.print(f"[red]Error: {exc}[/red]")
|
|
467
|
+
raise typer.Exit(1) from exc
|
|
468
|
+
console.print(f"[green]Renamed source to {renamed.name}[/green]")
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
def _set_source_state(source: str, db: Path, *, enabled: bool) -> None:
|
|
472
|
+
database = _make_database_for_command(db)
|
|
473
|
+
try:
|
|
474
|
+
updated = database.set_source_enabled(source, enabled=enabled)
|
|
475
|
+
except ValueError as exc:
|
|
476
|
+
console.print(f"[red]Error: {exc}[/red]")
|
|
477
|
+
raise typer.Exit(1) from exc
|
|
478
|
+
console.print(f"[green]{'Enabled' if enabled else 'Disabled'} source {updated.name}[/green]")
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
@sources_app.command("disable")
|
|
482
|
+
def disable_source(
|
|
483
|
+
source: Annotated[str, typer.Argument(help="Source name or ID.")],
|
|
484
|
+
db: Annotated[Path, typer.Option("--db", "-d", help="Path to SQLite database file.")] = _DEFAULT_DB,
|
|
485
|
+
):
|
|
486
|
+
"""Disable live reads and refresh for a source."""
|
|
487
|
+
_set_source_state(source, db, enabled=False)
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
@sources_app.command("enable")
|
|
491
|
+
def enable_source(
|
|
492
|
+
source: Annotated[str, typer.Argument(help="Source name or ID.")],
|
|
493
|
+
db: Annotated[Path, typer.Option("--db", "-d", help="Path to SQLite database file.")] = _DEFAULT_DB,
|
|
494
|
+
):
|
|
495
|
+
"""Re-enable live reads and refresh for a source."""
|
|
496
|
+
_set_source_state(source, db, enabled=True)
|
|
497
|
+
|
|
498
|
+
|
|
369
499
|
_CONTENT_TYPES_HELP = "Available types: " + ", ".join(sorted(CONTENT_TYPES))
|
|
370
500
|
_SEARCH_CONTENT_TYPES_HELP = "Available types: " + ", ".join(sorted(SEARCH_CONTENT_TYPES))
|
|
371
501
|
|
|
@@ -405,6 +535,10 @@ def search(
|
|
|
405
535
|
help="Filter by message role (user or assistant).",
|
|
406
536
|
),
|
|
407
537
|
] = None,
|
|
538
|
+
source: Annotated[
|
|
539
|
+
str | None,
|
|
540
|
+
typer.Option("--source", help="Filter results to one named Copilot CLI source."),
|
|
541
|
+
] = None,
|
|
408
542
|
title_filter: Annotated[
|
|
409
543
|
str | None,
|
|
410
544
|
typer.Option(
|
|
@@ -514,6 +648,9 @@ def search(
|
|
|
514
648
|
search_content_set = resolve_search_content_set(include, exclude)
|
|
515
649
|
|
|
516
650
|
database = _prepare_database_for_command(db, rescan_session_id=rescan_session)
|
|
651
|
+
if source and database.get_source(source) is None:
|
|
652
|
+
console.print(f"[red]Error: Source not found: {source}[/red]")
|
|
653
|
+
raise typer.Exit(1)
|
|
517
654
|
results = database.search(
|
|
518
655
|
query,
|
|
519
656
|
limit=limit,
|
|
@@ -523,6 +660,7 @@ def search(
|
|
|
523
660
|
session_title=title_filter,
|
|
524
661
|
sort_by=sort_by,
|
|
525
662
|
repository=repository_filter,
|
|
663
|
+
source_name=source,
|
|
526
664
|
)
|
|
527
665
|
|
|
528
666
|
if json_output:
|