copilot.tools 1.0.0
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.
- package/CHANGELOG.md +255 -0
- package/LICENSE +660 -0
- package/README.md +268 -0
- package/_extract_office.js +175 -0
- package/_list_sessions.js +206 -0
- package/package.json +24 -0
- package/skills/history/SKILL.md +46 -0
- package/skills/snapshot/SKILL.md +74 -0
- package/skills/teach-me/SKILL.md +1188 -0
- package/skills/tools/tools-skill/SKILL.md +38 -0
- package/tools-install.js +104 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: history
|
|
3
|
+
description: Lists all Copilot chat sessions with message count, tokens consumed, cost, and totals. Triggered when the user types `/history`.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Copyright (C) 2026 Celestial Consulting Ltd
|
|
8
|
+
|
|
9
|
+
This program is free software: you can redistribute it and/or modify
|
|
10
|
+
it under the terms of the GNU Affero General Public License as
|
|
11
|
+
published by the Free Software Foundation, either version 3 of the
|
|
12
|
+
License, or (at your option) any later version.
|
|
13
|
+
|
|
14
|
+
This program is distributed in the hope that it will be useful,
|
|
15
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
GNU Affero General Public License for more details.
|
|
18
|
+
|
|
19
|
+
You should have received a copy of the GNU Affero General Public License
|
|
20
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
21
|
+
|
|
22
|
+
# `/history` Command
|
|
23
|
+
|
|
24
|
+
When the user types `/history`, list all chat sessions from Copilot with their metadata and a total summary row.
|
|
25
|
+
|
|
26
|
+
## Behavior
|
|
27
|
+
|
|
28
|
+
1. Run `copilot-history` (installed globally via `npm install -g copilot.history`)
|
|
29
|
+
2. Extract session metadata from Copilot's SQLite database: timestamp, tokens consumed, estimated cost, model used
|
|
30
|
+
3. Present as a formatted table with columns: Date/Time, Title, Messages, Tokens, Cost, Model
|
|
31
|
+
4. Include a TOTAL row at the bottom summarizing all sessions
|
|
32
|
+
|
|
33
|
+
### Important: No-sessions handling
|
|
34
|
+
If no sessions exist in the database, that's **normal** for a fresh Copilot install. Simply report "No sessions found." and stop.
|
|
35
|
+
|
|
36
|
+
## Implementation Notes
|
|
37
|
+
- Uses `better-sqlite3` npm package to query the SQLite database (synchronous, performant)
|
|
38
|
+
- Works on Windows, macOS, and Linux (database location is platform-aware)
|
|
39
|
+
- The skill is installed globally — works in any workspace
|
|
40
|
+
- Session data persists across VS Code restarts
|
|
41
|
+
- Token counts and costs reflect actual Copilot usage from the session store
|
|
42
|
+
|
|
43
|
+
## Database Location
|
|
44
|
+
- **Windows**: `C:\Users\<username>\AppData\Roaming\Code\User\globalStorage\github.copilot-chat\session-store.db`
|
|
45
|
+
- **macOS**: `~/Library/Application Support/Code/User/globalStorage/github.copilot-chat/session-store.db`
|
|
46
|
+
- **Linux**: `~/.config/Code/User/globalStorage/github.copilot-chat/session-store.db`
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: snapshot
|
|
3
|
+
description: Toggle automatic pre-edit file snapshotting on or off. Triggered by /snapshot on and /snapshot off.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Copyright (C) 2026 Celestial Consulting Ltd
|
|
8
|
+
|
|
9
|
+
This program is free software: you can redistribute it and/or modify
|
|
10
|
+
it under the terms of the GNU Affero General Public License as
|
|
11
|
+
published by the Free Software Foundation, either version 3 of the
|
|
12
|
+
License, or (at your option) any later version.
|
|
13
|
+
|
|
14
|
+
This program is distributed in the hope that it will be useful,
|
|
15
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
GNU Affero General Public License for more details.
|
|
18
|
+
|
|
19
|
+
You should have received a copy of the GNU Affero General Public License
|
|
20
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
21
|
+
|
|
22
|
+
# `/snapshot` Command
|
|
23
|
+
|
|
24
|
+
When the user types `/snapshot on`, `/snapshot off`, or `/snapshot status`, manage automatic file backup before edits.
|
|
25
|
+
|
|
26
|
+
## Behavior
|
|
27
|
+
|
|
28
|
+
### `/snapshot on`
|
|
29
|
+
1. Detect the platform from the shell environment:
|
|
30
|
+
- **Windows**: `$env:OS` contains `Windows_NT`, shell is `powershell.exe`
|
|
31
|
+
- **macOS/Linux**: detect by the absence of `$env:OS`, shell is typically `bash` or `zsh`
|
|
32
|
+
2. Check if `.git` exists in the workspace root:
|
|
33
|
+
- **Windows**: `if (Test-Path .git) { ... }`
|
|
34
|
+
- **macOS/Linux**: `if [ -d .git ]; then ...`
|
|
35
|
+
3. **If Git repo exists**: reply "This workspace has a Git repo — snapshotting is not needed. Use `git restore <file>` to undo changes."
|
|
36
|
+
4. **If no Git repo**: create `_snapshots/` directory, write a note to persist `snapshot_enabled=true`, then confirm to the user.
|
|
37
|
+
5. From this point forward, before editing any **existing** file:
|
|
38
|
+
- **Ensure `_snapshots/` exists** — create it if missing (don't assume it still exists from init time)
|
|
39
|
+
**Windows**: `if (-not (Test-Path '_snapshots')) { New-Item -ItemType Directory -Path '_snapshots' -Force | Out-Null }`
|
|
40
|
+
**macOS/Linux**: `mkdir -p _snapshots`
|
|
41
|
+
- **Snapshot the file** using the appropriate command for the detected platform:
|
|
42
|
+
**Windows (PowerShell):**
|
|
43
|
+
```powershell
|
|
44
|
+
$ts = Get-Date -Format 'yyyy-MM-dd_HH-mm-ss'
|
|
45
|
+
$base = [System.IO.Path]::GetFileNameWithoutExtension('<file>')
|
|
46
|
+
$ext = [System.IO.Path]::GetExtension('<file>')
|
|
47
|
+
Copy-Item '<file>' "_snapshots/$base.$ts$ext"
|
|
48
|
+
```
|
|
49
|
+
**macOS/Linux (Bash):**
|
|
50
|
+
```bash
|
|
51
|
+
ts=$(date +%Y-%m-%d_%H-%M-%S)
|
|
52
|
+
base=$(basename "<file>" | sed 's/\.[^.]*$//')
|
|
53
|
+
ext=$(echo "<file>" | sed 's/.*\.//')
|
|
54
|
+
cp "<file>" "_snapshots/${base}.${ts}.${ext}"
|
|
55
|
+
```
|
|
56
|
+
- **Retry on failure**: if the copy command fails (non-zero exit), recreate `_snapshots/` and retry exactly once.
|
|
57
|
+
- **Final failure**: if the retry also fails, report the error to the user and **do NOT proceed with the edit** — this is a snapshot contract violation.
|
|
58
|
+
- Result example: `foo.py` → `_snapshots/foo.2026-06-20_11-30-00.py`
|
|
59
|
+
- Do NOT snapshot brand-new files being created for the first time
|
|
60
|
+
|
|
61
|
+
### `/snapshot off`
|
|
62
|
+
1. Write a note to persist `snapshot_enabled=false`.
|
|
63
|
+
2. Reply "Snapshotting is now off. Existing snapshots in `_snapshots/` have been preserved."
|
|
64
|
+
3. Stop snapshotting before future edits.
|
|
65
|
+
|
|
66
|
+
### `/snapshot status`
|
|
67
|
+
1. Read the snapshot-enabled note.
|
|
68
|
+
2. Count files in `_snapshots/` (if directory exists).
|
|
69
|
+
3. Report: whether snapshotting is on/off, the snapshot directory exists, and file count.
|
|
70
|
+
|
|
71
|
+
## Notes
|
|
72
|
+
- The skill is installed globally — works in any workspace
|
|
73
|
+
- Snapshot state is session-scoped — does not persist across different Copilot chat sessions
|
|
74
|
+
- Use `/snapshot off` before switching to a Git-tracked project to avoid redundant copies
|