@keywaysh/cli 0.0.4 → 0.0.7

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 (2) hide show
  1. package/dist/cli.js +90 -73
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -65,8 +65,72 @@ var INTERNAL_API_URL = "https://api.keyway.sh";
65
65
  var INTERNAL_POSTHOG_KEY = "phc_duG0qqI5z8LeHrS9pNxR5KaD4djgD0nmzUxuD3zP0ov";
66
66
  var INTERNAL_POSTHOG_HOST = "https://eu.i.posthog.com";
67
67
 
68
+ // package.json with { type: 'json' }
69
+ var package_default = {
70
+ name: "@keywaysh/cli",
71
+ version: "0.0.7",
72
+ description: "One link to all your secrets",
73
+ type: "module",
74
+ bin: {
75
+ keyway: "./dist/cli.js"
76
+ },
77
+ main: "./dist/cli.js",
78
+ files: [
79
+ "dist"
80
+ ],
81
+ scripts: {
82
+ dev: "pnpm exec tsx src/cli.ts",
83
+ build: "pnpm exec tsup",
84
+ "build:watch": "pnpm exec tsup --watch",
85
+ prepublishOnly: "pnpm run build",
86
+ test: "pnpm exec vitest run",
87
+ "test:watch": "pnpm exec vitest",
88
+ release: "npm version patch && git push && git push --tags",
89
+ "release:minor": "npm version minor && git push && git push --tags",
90
+ "release:major": "npm version major && git push && git push --tags"
91
+ },
92
+ keywords: [
93
+ "secrets",
94
+ "env",
95
+ "keyway",
96
+ "cli",
97
+ "devops"
98
+ ],
99
+ author: "Nicolas Ritouet",
100
+ license: "MIT",
101
+ homepage: "https://keyway.sh",
102
+ repository: {
103
+ type: "git",
104
+ url: "https://github.com/keywaysh/cli.git"
105
+ },
106
+ bugs: {
107
+ url: "https://github.com/keywaysh/cli/issues"
108
+ },
109
+ packageManager: "pnpm@10.6.1",
110
+ engines: {
111
+ node: ">=18.0.0"
112
+ },
113
+ dependencies: {
114
+ chalk: "^4.1.2",
115
+ commander: "^14.0.0",
116
+ conf: "^15.0.2",
117
+ open: "^11.0.0",
118
+ "posthog-node": "^3.5.0",
119
+ prompts: "^2.4.2"
120
+ },
121
+ devDependencies: {
122
+ "@types/node": "^24.2.0",
123
+ "@types/prompts": "^2.4.9",
124
+ tsup: "^8.5.0",
125
+ tsx: "^4.20.3",
126
+ typescript: "^5.9.2",
127
+ vitest: "^3.2.4"
128
+ }
129
+ };
130
+
68
131
  // src/utils/api.ts
69
132
  var API_BASE_URL = process.env.KEYWAY_API_URL || INTERNAL_API_URL;
133
+ var USER_AGENT = `keyway-cli/${package_default.version}`;
70
134
  var APIError = class extends Error {
71
135
  constructor(statusCode, error, message) {
72
136
  super(message);
@@ -102,7 +166,10 @@ async function handleResponse(response) {
102
166
  }
103
167
  async function initVault(repoFullName, accessToken) {
104
168
  const body = { repoFullName };
105
- const headers = { "Content-Type": "application/json" };
169
+ const headers = {
170
+ "Content-Type": "application/json",
171
+ "User-Agent": USER_AGENT
172
+ };
106
173
  if (accessToken) {
107
174
  headers.Authorization = `Bearer ${accessToken}`;
108
175
  }
@@ -134,7 +201,10 @@ function parseEnvContent(content) {
134
201
  async function pushSecrets(repoFullName, environment, content, accessToken) {
135
202
  const secrets = parseEnvContent(content);
136
203
  const body = { repoFullName, environment, secrets };
137
- const headers = { "Content-Type": "application/json" };
204
+ const headers = {
205
+ "Content-Type": "application/json",
206
+ "User-Agent": USER_AGENT
207
+ };
138
208
  if (accessToken) {
139
209
  headers.Authorization = `Bearer ${accessToken}`;
140
210
  }
@@ -147,7 +217,10 @@ async function pushSecrets(repoFullName, environment, content, accessToken) {
147
217
  return result.data;
148
218
  }
149
219
  async function pullSecrets(repoFullName, environment, accessToken) {
150
- const headers = { "Content-Type": "application/json" };
220
+ const headers = {
221
+ "Content-Type": "application/json",
222
+ "User-Agent": USER_AGENT
223
+ };
151
224
  if (accessToken) {
152
225
  headers.Authorization = `Bearer ${accessToken}`;
153
226
  }
@@ -165,7 +238,10 @@ async function pullSecrets(repoFullName, environment, accessToken) {
165
238
  async function startDeviceLogin(repository) {
166
239
  const response = await fetch(`${API_BASE_URL}/v1/auth/device/start`, {
167
240
  method: "POST",
168
- headers: { "Content-Type": "application/json" },
241
+ headers: {
242
+ "Content-Type": "application/json",
243
+ "User-Agent": USER_AGENT
244
+ },
169
245
  body: JSON.stringify(repository ? { repository } : {})
170
246
  });
171
247
  return handleResponse(response);
@@ -173,7 +249,10 @@ async function startDeviceLogin(repository) {
173
249
  async function pollDeviceLogin(deviceCode) {
174
250
  const response = await fetch(`${API_BASE_URL}/v1/auth/device/poll`, {
175
251
  method: "POST",
176
- headers: { "Content-Type": "application/json" },
252
+ headers: {
253
+ "Content-Type": "application/json",
254
+ "User-Agent": USER_AGENT
255
+ },
177
256
  body: JSON.stringify({ deviceCode })
178
257
  });
179
258
  return handleResponse(response);
@@ -183,6 +262,7 @@ async function validateToken(token) {
183
262
  method: "POST",
184
263
  headers: {
185
264
  "Content-Type": "application/json",
265
+ "User-Agent": USER_AGENT,
186
266
  Authorization: `Bearer ${token}`
187
267
  },
188
268
  body: JSON.stringify({})
@@ -198,9 +278,9 @@ import os from "os";
198
278
  import fs from "fs";
199
279
 
200
280
  // package.json
201
- var package_default = {
281
+ var package_default2 = {
202
282
  name: "@keywaysh/cli",
203
- version: "0.0.4",
283
+ version: "0.0.7",
204
284
  description: "One link to all your secrets",
205
285
  type: "module",
206
286
  bin: {
@@ -317,7 +397,7 @@ function trackEvent(event, properties) {
317
397
  source: "cli",
318
398
  platform: process.platform,
319
399
  nodeVersion: process.version,
320
- version: package_default.version,
400
+ version: package_default2.version,
321
401
  ci: CI
322
402
  }
323
403
  });
@@ -562,7 +642,7 @@ function insertBadgeIntoReadme(readmeContent, badge) {
562
642
  return readmeContent;
563
643
  }
564
644
  const lines = readmeContent.split(/\r?\n/);
565
- const titleIndex = lines.findIndex((line) => /^#\s+/.test(line.trim()));
645
+ const titleIndex = lines.findIndex((line) => /^#(?!#)\s+/.test(line.trim()));
566
646
  if (titleIndex !== -1) {
567
647
  const before = lines.slice(0, titleIndex + 1);
568
648
  const after = lines.slice(titleIndex + 1);
@@ -1264,69 +1344,6 @@ Summary: ${formatSummary(results)}`);
1264
1344
  }
1265
1345
  }
1266
1346
 
1267
- // package.json with { type: 'json' }
1268
- var package_default2 = {
1269
- name: "@keywaysh/cli",
1270
- version: "0.0.4",
1271
- description: "One link to all your secrets",
1272
- type: "module",
1273
- bin: {
1274
- keyway: "./dist/cli.js"
1275
- },
1276
- main: "./dist/cli.js",
1277
- files: [
1278
- "dist"
1279
- ],
1280
- scripts: {
1281
- dev: "pnpm exec tsx src/cli.ts",
1282
- build: "pnpm exec tsup",
1283
- "build:watch": "pnpm exec tsup --watch",
1284
- prepublishOnly: "pnpm run build",
1285
- test: "pnpm exec vitest run",
1286
- "test:watch": "pnpm exec vitest",
1287
- release: "npm version patch && git push && git push --tags",
1288
- "release:minor": "npm version minor && git push && git push --tags",
1289
- "release:major": "npm version major && git push && git push --tags"
1290
- },
1291
- keywords: [
1292
- "secrets",
1293
- "env",
1294
- "keyway",
1295
- "cli",
1296
- "devops"
1297
- ],
1298
- author: "Nicolas Ritouet",
1299
- license: "MIT",
1300
- homepage: "https://keyway.sh",
1301
- repository: {
1302
- type: "git",
1303
- url: "https://github.com/keywaysh/cli.git"
1304
- },
1305
- bugs: {
1306
- url: "https://github.com/keywaysh/cli/issues"
1307
- },
1308
- packageManager: "pnpm@10.6.1",
1309
- engines: {
1310
- node: ">=18.0.0"
1311
- },
1312
- dependencies: {
1313
- chalk: "^4.1.2",
1314
- commander: "^14.0.0",
1315
- conf: "^15.0.2",
1316
- open: "^11.0.0",
1317
- "posthog-node": "^3.5.0",
1318
- prompts: "^2.4.2"
1319
- },
1320
- devDependencies: {
1321
- "@types/node": "^24.2.0",
1322
- "@types/prompts": "^2.4.9",
1323
- tsup: "^8.5.0",
1324
- tsx: "^4.20.3",
1325
- typescript: "^5.9.2",
1326
- vitest: "^3.2.4"
1327
- }
1328
- };
1329
-
1330
1347
  // src/cli.ts
1331
1348
  var program = new Command();
1332
1349
  var showBanner = () => {
@@ -1338,7 +1355,7 @@ ${subtitle}
1338
1355
  `);
1339
1356
  };
1340
1357
  showBanner();
1341
- program.name("keyway").description("GitHub-native secrets manager for dev teams").version(package_default2.version);
1358
+ program.name("keyway").description("GitHub-native secrets manager for dev teams").version(package_default.version);
1342
1359
  program.command("init").description("Initialize a vault for the current repository").option("--no-login-prompt", "Fail instead of prompting to login if unauthenticated").action(async (options) => {
1343
1360
  await initCommand(options);
1344
1361
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keywaysh/cli",
3
- "version": "0.0.4",
3
+ "version": "0.0.7",
4
4
  "description": "One link to all your secrets",
5
5
  "type": "module",
6
6
  "bin": {