-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpackage.json
More file actions
328 lines (328 loc) · 13.6 KB
/
package.json
File metadata and controls
328 lines (328 loc) · 13.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
{
"name": "copilot-premium-usage-monitor",
"displayName": "Copilot Premium Usage Monitor",
"description": "Monitor usage and budget for Copilot Premium Request SKU from VS Code.",
"version": "0.8.1",
"publisher": "fail-safe",
"license": "MIT",
"icon": "media/icon.png",
"repository": {
"type": "git",
"url": "https://github.com/Fail-Safe/CopilotPremiumUsageMonitor"
},
"bugs": {
"url": "https://github.com/Fail-Safe/CopilotPremiumUsageMonitor/issues"
},
"homepage": "https://github.com/Fail-Safe/CopilotPremiumUsageMonitor#readme",
"keywords": [
"copilot",
"github",
"usage",
"budget",
"billing",
"monitor",
"statusbar",
"premium"
],
"extensionKind": [
"ui"
],
"galleryBanner": {
"color": "#1f2428",
"theme": "dark"
},
"engines": {
"vscode": "^1.104.0",
"node": ">=20.0.0"
},
"categories": [
"Other"
],
"main": "./out/extension.js",
"contributes": {
"commands": [
{
"command": "copilotPremiumUsageMonitor.openPanel",
"title": "Copilot Premium Usage Monitor: Open"
},
{
"command": "copilotPremiumUsageMonitor.signIn",
"title": "Copilot Premium Usage Monitor: Sign in to GitHub"
},
{
"command": "copilotPremiumUsageMonitor.configureOrg",
"title": "Copilot Premium Usage Monitor: Choose Organization"
},
{
"command": "copilotPremiumUsageMonitor.enableFirstRunNotice",
"title": "Copilot Premium Usage Monitor: Re-enable First-run Tip"
},
{
"command": "copilotPremiumUsageMonitor.manage",
"title": "Copilot Premium Usage Monitor: Manage"
},
{
"command": "copilotPremiumUsageMonitor.showLogs",
"title": "Copilot Premium Usage Monitor: Show Logs"
},
{
"command": "copilotPremiumUsageMonitor.migrateToken",
"title": "Copilot Premium Usage Monitor: Migrate Token to Secure Storage"
},
{
"command": "copilotPremiumUsageMonitor.setTokenSecure",
"title": "Copilot Premium Usage Monitor: Set / Update Token (Secure)"
},
{
"command": "copilotPremiumUsageMonitor.clearTokenSecure",
"title": "Copilot Premium Usage Monitor: Clear Stored Token"
},
{
"command": "copilotPremiumUsageMonitor.toggleSidebar",
"title": "Copilot Premium Usage Monitor: Toggle Sidebar"
},
{
"command": "copilotPremiumUsageMonitor.prepareScreenshotState",
"title": "Copilot Premium Usage Monitor: Prepare Screenshot State (Normal)"
},
{
"command": "copilotPremiumUsageMonitor.prepareScreenshotErrorState",
"title": "Copilot Premium Usage Monitor: Prepare Screenshot State (Error)"
}
],
"menus": {
"commandPalette": [
{
"command": "copilotPremiumUsageMonitor.prepareScreenshotState",
"when": "isDevelopment"
},
{
"command": "copilotPremiumUsageMonitor.prepareScreenshotErrorState",
"when": "isDevelopment"
}
]
},
"viewsContainers": {
"activitybar": [
{
"id": "copilot-premium-usage",
"title": "Copilot Premium Usage",
"icon": "$(dashboard)"
}
]
},
"views": {
"copilot-premium-usage": [
{
"type": "webview",
"id": "copilotPremiumUsage.sidebarView",
"name": "Usage Overview",
"icon": "$(graph)",
"when": "config.copilotPremiumUsageMonitor.showSidebar"
}
]
},
"configuration": {
"title": "Copilot Premium Usage Monitor",
"properties": {
"copilotPremiumUsageMonitor.warnAtPercent": {
"type": "number",
"default": 75,
"minimum": 0,
"maximum": 100,
"description": "Warn color threshold (percent used). Set to 0 to disable warning color."
},
"copilotPremiumUsageMonitor.dangerAtPercent": {
"type": "number",
"default": 90,
"minimum": 0,
"maximum": 100,
"description": "Danger color threshold (percent used). Set to 0 to disable danger color."
},
"copilotPremiumUsageMonitor.refreshIntervalMinutes": {
"type": "number",
"default": 15,
"minimum": 5,
"maximum": 1440,
"description": "Auto-refresh interval in minutes for personal usage. Minimum 5 minutes."
},
"copilotPremiumUsageMonitor.mode": {
"type": "string",
"enum": [
"auto",
"personal",
"org"
],
"default": "auto",
"description": "Data source mode: auto (Org if set, otherwise personal), personal (Enhanced Billing), or Org (Copilot metrics)."
},
"copilotPremiumUsageMonitor.budget": {
"type": "number",
"default": 10,
"description": "Monthly budget in USD for Copilot Premium Request SKU. (Find value here: https://github.com/settings/billing/budgets)",
"minimum": 0
},
"copilotPremiumUsageMonitor.org": {
"type": "string",
"default": "",
"description": "GitHub Organization login (optional). Leave blank for personal account."
},
"copilotPremiumUsageMonitor.token": {
"type": "string",
"default": "",
"markdownDescription": "GitHub Personal Access Token (classic or fine-grained) with `Plan: read-only` scope. Leave blank to sign in via the GitHub Authentication extension.",
"deprecationMessage": "Deprecated: Token is now stored in VS Code secret storage after migration. Use the command 'Copilot Premium Usage Monitor: Migrate Token to Secure Storage'.",
"scope": "machine-overridable"
},
"copilotPremiumUsageMonitor.disableFirstRunTips": {
"type": "boolean",
"default": false,
"description": "Permanently disable the first-run tip banner in the panel."
},
"copilotPremiumUsageMonitor.statusBarAlignment": {
"type": "string",
"enum": [
"left",
"right"
],
"default": "left",
"description": "Status bar item alignment: left (near editor info) or right (near GitHub/Copilot icons)."
},
"copilotPremiumUsageMonitor.showLogOnError": {
"type": "boolean",
"default": false,
"description": "Automatically open the extension log output channel the first time an error occurs in a session."
},
"copilotPremiumUsageMonitor.useThemeStatusColor": {
"type": "boolean",
"default": true,
"description": "Use the theme's default status bar text color for normal state (improves contrast). Color is only applied for warning / danger thresholds or errors. Disable to always colorize by usage percent."
},
"copilotPremiumUsageMonitor.statusBarIconOverride": {
"type": "string",
"default": "",
"markdownDescription": "Optional Codicon name (without $() ) to force a specific status bar icon when not in an error/stale state. Example: `graph`, `pulse`, `dashboard`, `repo`, `rocket`. Full list: https://microsoft.github.io/vscode-codicons/dist/codicon.html. Leave blank to use automatic account/organization and error icons.",
"description": "Override status bar icon (Codicon name) when normal. Blank = automatic."
},
"copilotPremiumUsageMonitor.includedPremiumRequests": {
"type": "number",
"default": 0,
"description": "Optional: Manually specify the number of included premium requests per month for your plan. Set to 0 to use a selected built-in plan or the estimated value.",
"minimum": 0
},
"copilotPremiumUsageMonitor.pricePerPremiumRequest": {
"type": "number",
"default": 0.04,
"description": "Optional: Override the additional per-premium-request price (USD). Used to compute estimated overage cost when shown.",
"minimum": 0
},
"copilotPremiumUsageMonitor.selectedPlanId": {
"type": "string",
"enum": [
"",
"copilot-free",
"copilot-pro",
"copilot-proplus",
"copilot-business",
"copilot-enterprise"
],
"default": "",
"description": "Optional: Selected built-in Copilot plan ID (populated from bundled plan data). Selecting a plan will populate included units and price settings.",
"enumDescriptions": [
"${cpum.plans.dropdown.placeholder}",
"${cpum.plans.copilot-free}",
"${cpum.plans.copilot-pro}",
"${cpum.plans.copilot-proplus}",
"${cpum.plans.copilot-business}",
"${cpum.plans.copilot-enterprise}"
]
},
"copilotPremiumUsageMonitor.showSidebar": {
"type": "boolean",
"default": true,
"description": "Show the usage overview sidebar in the activity bar. Requires restart to take effect."
},
"copilotPremiumUsageMonitor.enableExperimentalTrends": {
"type": "boolean",
"default": false,
"markdownDescription": "Experimental: Show Usage History & Trends (usage snapshots and projections) in the panel and sidebar. Off by default while the feature stabilizes.",
"description": "Enable experimental Usage History & Trends visuals in panel and sidebar."
}
}
}
},
"activationEvents": [
"onStartupFinished"
],
"scripts": {
"build:bundle": "tsc -p ./ && npm run bundle && npm run bundle:webview && npm run postbundle",
"build:dev": "tsc -p ./ && npm run bundle:webview",
"bundle": "esbuild src/extension.ts --bundle --platform=node --format=cjs --external:vscode --outfile=out/extension.js --minify",
"bundle:webview": "esbuild media/webview.js --minify --outfile=media/webview.min.js",
"clean:full": "bash scripts/clean-artifacts.sh && git clean -fdX || true",
"clean": "bash scripts/clean-artifacts.sh",
"compile": "tsc -watch -p ./",
"lint:md": "markdownlint \"**/*.md\"",
"lint": "eslint \"src/**/*.ts\" --cache --cache-location .eslintcache",
"package": "npm run build:bundle && npx @vscode/vsce package",
"postbundle": "find out -type f ! -name extension.js ! -path 'out/test/*' -delete",
"postversion": "git push --follow-tags",
"prepack": "npm run clean && npm run build:bundle",
"prepublishOnly": "npm run clean && npm run update-plan-data && npm run sync-plan-enums && npm run build:bundle",
"pretest:coverage": "npm run clean && npm run build:dev",
"preversion": "npm run clean",
"release": "npm run build:bundle && npx @vscode/vsce publish",
"screenshot:open": "npm run screenshot:prepare && code .",
"screenshot:prepare": "npm run build:bundle",
"sync-plan-enums": "node ./scripts/sync-plan-enums.mjs",
"test:activation": "npm run clean && npm run build:dev && nyc --reporter=text --reporter=lcov node ./out/test/runTests.js",
"test:coverage:full": "rimraf .node_coverage coverage out-instrumented && npm run clean && npm run build:dev && cp out/extension.js out/extension.js.bak && mkdir -p out-instrumented && npx nyc instrument out/extension.js out-instrumented && INSTR=$(find out-instrumented -type f -name extension.js | head -n1) && if [ -z \"$INSTR\" ]; then echo 'Instrumented extension.js not found under out-instrumented' >&2; exit 1; fi && cp \"$INSTR\" out/extension.js && TEST_FILES=\"$(find out/test/unit -maxdepth 1 -type f -name '*.test.js' 2>/dev/null | sort)\" && echo \"Discovered unit test files:\n$TEST_FILES\" && if [ -z \"$TEST_FILES\" ]; then echo 'No compiled unit test files found under out/test/unit' >&2; exit 1; fi && CPUM_COVERAGE_DIR=.node_coverage c8 --reporter=text --reporter=lcov node --test $TEST_FILES && CPUM_COVERAGE_DIR=.node_coverage node ./out/test/runTests.js; RC=$?; mv out/extension.js.bak out/extension.js; rimraf out-instrumented; if [ $RC -ne 0 ]; then exit $RC; fi; c8 report --reporter=text --reporter=lcov --coverage-dir .node_coverage && node scripts/merge-extension-coverage.mjs .node_coverage && node scripts/coverage-badge.mjs",
"test:coverage": "rimraf .nyc_output coverage && npm run clean && npm run build:dev && c8 --reporter=text --reporter=lcov node --test out/test/unit/**/*.test.js && node scripts/coverage-badge.mjs",
"test:unit": "npm run clean && npm run build:dev && node --test --test-reporter=spec out/test/unit/**/*.test.js",
"test": "npm run clean && npm run build:dev && node --test --test-reporter=spec out/test/unit/**/*.test.js && node ./out/test/runTests.js",
"update-plan-data": "node ./scripts/update-plan-data.mjs",
"vsce": "npx @vscode/vsce",
"vscode:prepublish": "npm run build:bundle"
},
"devDependencies": {
"@types/glob": "^9.0.0",
"@types/mocha": "^10.0.6",
"@types/node": "^24.3.3",
"@types/vscode": "^1.104.0",
"@typescript-eslint/eslint-plugin": "^8.46.2",
"@typescript-eslint/parser": "^8.40.0",
"@vscode/test-electron": "^2.3.9",
"@vscode/vsce": "^3.6.2",
"c8": "^10.1.3",
"esbuild": "^0.25.11",
"eslint": "^9.39.0",
"glob": "^11.0.3",
"markdownlint-cli": "^0.45.0",
"mocha": "^11.7.4",
"nyc": "^17.1.0",
"rimraf": "^6.1.0",
"typescript": "^5.9.3"
},
"dependencies": {
"@octokit/rest": "^22.0.1",
"vscode-nls": "^5.2.0"
},
"nyc": {
"all": true,
"extension": [
".ts"
],
"include": [
"src/**/*.ts"
],
"exclude": [
"**/test/**",
"out/**"
],
"check-coverage": true,
"branches": 95,
"lines": 95,
"functions": 95,
"statements": 95
}
}