copilot-metrics 0.1.2 → 0.1.3
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 +6 -0
- package/README.md +24 -24
- package/package.json +1 -1
- package/src/setup.js +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.3 - 2026-05-31
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Hook install now avoids embedding transient `npx` cache shims, which can break when their shebang points at a removed Node install. Generated hooks use a stable `npx -y copilot-metrics@<version>` package invocation for those cache paths.
|
|
8
|
+
|
|
3
9
|
## 0.1.2 - 2026-05-31
|
|
4
10
|
|
|
5
11
|
### Fixed
|
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@ Costs are estimates, not official billing records. GitHub billing remains the so
|
|
|
9
9
|
From npm:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npx copilot-metrics@0.1.
|
|
13
|
-
npx copilot-metrics@0.1.
|
|
12
|
+
npx copilot-metrics@0.1.3 --help
|
|
13
|
+
npx copilot-metrics@0.1.3 init
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
From this checkout:
|
|
@@ -38,8 +38,8 @@ export COPILOT_METRICS_HOME=/path/to/copilot-metrics-data
|
|
|
38
38
|
Useful commands:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
npx copilot-metrics@0.1.
|
|
42
|
-
npx copilot-metrics@0.1.
|
|
41
|
+
npx copilot-metrics@0.1.3 init
|
|
42
|
+
npx copilot-metrics@0.1.3 paths --json
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
## Configure Telemetry
|
|
@@ -49,13 +49,13 @@ For Copilot CLI, `init` plus hooks are enough for local token reporting. Reports
|
|
|
49
49
|
Print VS Code Insiders Copilot Chat OpenTelemetry settings:
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
|
-
npx copilot-metrics@0.1.
|
|
52
|
+
npx copilot-metrics@0.1.3 setup vscode
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
Print Copilot CLI OpenTelemetry environment exports:
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
|
-
npx copilot-metrics@0.1.
|
|
58
|
+
npx copilot-metrics@0.1.3 setup copilot-cli
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
This is optional. Use it only when you also want Copilot CLI OTel JSONL output.
|
|
@@ -67,14 +67,14 @@ Content capture is disabled by default. Do not enable richer prompt capture unle
|
|
|
67
67
|
Preview repo-local hook config. The default `--surface both` emits the Copilot CLI lower camel case hook format:
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
|
-
npx copilot-metrics@0.1.
|
|
70
|
+
npx copilot-metrics@0.1.3 hooks preview --scope local --surface both
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
Install repo-local or user-global hook config:
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
npx copilot-metrics@0.1.
|
|
77
|
-
npx copilot-metrics@0.1.
|
|
76
|
+
npx copilot-metrics@0.1.3 hooks install --scope local --surface both
|
|
77
|
+
npx copilot-metrics@0.1.3 hooks install --scope global --surface both
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
Local install writes `.github/hooks/copilot-metrics.json`. Global install updates `~/.copilot/settings.json` idempotently, replacing prior `copilot-metrics` hook entries while preserving other settings and hooks. Use `--surface vscode` for VS Code-only PascalCase events or `--surface copilot-cli` for CLI-native lower camel case events. The hook logger writes redacted JSONL metadata to the central data directory. It extracts Jira-style labels such as `DEMO-12345` from safe metadata and does not store full prompt text by default.
|
|
@@ -84,11 +84,11 @@ Local install writes `.github/hooks/copilot-metrics.json`. Global install update
|
|
|
84
84
|
Initialize the local SQLite store and import JSONL files manually:
|
|
85
85
|
|
|
86
86
|
```bash
|
|
87
|
-
npx copilot-metrics@0.1.
|
|
88
|
-
npx copilot-metrics@0.1.
|
|
89
|
-
npx copilot-metrics@0.1.
|
|
90
|
-
npx copilot-metrics@0.1.
|
|
91
|
-
npx copilot-metrics@0.1.
|
|
87
|
+
npx copilot-metrics@0.1.3 store init
|
|
88
|
+
npx copilot-metrics@0.1.3 import --source vscode --file ~/.local/share/copilot-metrics/telemetry/vscode-copilot-otel.jsonl
|
|
89
|
+
npx copilot-metrics@0.1.3 import --source copilot-cli --file ~/.local/share/copilot-metrics/telemetry/copilot-cli-otel.jsonl
|
|
90
|
+
npx copilot-metrics@0.1.3 import --source copilot-session --file ~/.copilot/session-state/<session-id>/events.jsonl
|
|
91
|
+
npx copilot-metrics@0.1.3 import --source hooks --file ~/.local/share/copilot-metrics/hooks/copilot-hooks.jsonl
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
Imports persist raw records, normalized LLM usage records, hook events, label evidence, and import warnings. Re-importing the same JSONL rows is idempotent. For Copilot session-state files, only shutdown usage rows are persisted; prompt-bearing session events are used in memory for label extraction and context and are not stored as raw records.
|
|
@@ -98,18 +98,18 @@ Imports persist raw records, normalized LLM usage records, hook events, label ev
|
|
|
98
98
|
Run local reports from the SQLite store:
|
|
99
99
|
|
|
100
100
|
```bash
|
|
101
|
-
npx copilot-metrics@0.1.
|
|
102
|
-
npx copilot-metrics@0.1.
|
|
103
|
-
npx copilot-metrics@0.1.
|
|
104
|
-
npx copilot-metrics@0.1.
|
|
105
|
-
npx copilot-metrics@0.1.
|
|
106
|
-
npx copilot-metrics@0.1.
|
|
101
|
+
npx copilot-metrics@0.1.3 report labels
|
|
102
|
+
npx copilot-metrics@0.1.3 report label DEMO-12345
|
|
103
|
+
npx copilot-metrics@0.1.3 report label DEMO-12345 --detail
|
|
104
|
+
npx copilot-metrics@0.1.3 report models
|
|
105
|
+
npx copilot-metrics@0.1.3 report repos
|
|
106
|
+
npx copilot-metrics@0.1.3 report unattributed
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
Every report supports `--json`:
|
|
110
110
|
|
|
111
111
|
```bash
|
|
112
|
-
npx copilot-metrics@0.1.
|
|
112
|
+
npx copilot-metrics@0.1.3 report labels --json
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
Report commands automatically import newly appended configured VS Code OTel, optional Copilot CLI OTel, Copilot CLI session-state, and hook JSONL files before querying. Label reports include input, output, cache read, cache creation, and reasoning token totals. Labels seen only in hooks remain visible as hook-only evidence with zero usage records, so attribution hints do not imply token-bearing usage.
|
|
@@ -175,7 +175,7 @@ The manual prompt performs one harmless tool call so Copilot CLI hook execution
|
|
|
175
175
|
## Current Limits
|
|
176
176
|
|
|
177
177
|
- Costs are estimates, not official billing records.
|
|
178
|
-
- Official GitHub usage report reconciliation is not included in `0.1.
|
|
179
|
-
- Local OTLP collector mode is not included in `0.1.
|
|
180
|
-
- Richer prompt/content capture and redaction controls are not included in `0.1.
|
|
178
|
+
- Official GitHub usage report reconciliation is not included in `0.1.3`.
|
|
179
|
+
- Local OTLP collector mode is not included in `0.1.3`.
|
|
180
|
+
- Richer prompt/content capture and redaction controls are not included in `0.1.3`.
|
|
181
181
|
- Dashboard views are deferred until the CLI/query model proves useful.
|
package/package.json
CHANGED
package/src/setup.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const fs = require('node:fs');
|
|
4
4
|
const path = require('node:path');
|
|
5
5
|
const { resolvePaths } = require('./paths');
|
|
6
|
+
const { version: PACKAGE_VERSION } = require('../package.json');
|
|
6
7
|
|
|
7
8
|
const HOOK_SURFACES = ['both', 'copilot-cli', 'vscode'];
|
|
8
9
|
|
|
@@ -96,10 +97,18 @@ function packageBinCommand(cwd) {
|
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
function commandInvocation(command) {
|
|
100
|
+
if (isEphemeralPackageShim(command)) {
|
|
101
|
+
return `npx -y copilot-metrics@${PACKAGE_VERSION}`;
|
|
102
|
+
}
|
|
99
103
|
const quoted = shellQuote(command);
|
|
100
104
|
return command.endsWith('.js') ? `node ${quoted}` : quoted;
|
|
101
105
|
}
|
|
102
106
|
|
|
107
|
+
function isEphemeralPackageShim(command) {
|
|
108
|
+
const normalized = String(command || '').replace(/\\/g, '/');
|
|
109
|
+
return normalized.includes('/.npm/_npx/') || normalized.endsWith('/node_modules/.bin/copilot-metrics');
|
|
110
|
+
}
|
|
111
|
+
|
|
103
112
|
function hookEventsForSurface(surface) {
|
|
104
113
|
if (surface === 'copilot-cli' || surface === 'both') return COPILOT_CLI_HOOK_EVENTS;
|
|
105
114
|
if (surface === 'vscode') return VSCODE_HOOK_EVENTS;
|