@the-17/agentsecrets 1.1.5 → 3.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/README.md CHANGED
@@ -58,7 +58,7 @@ pip install agentsecrets-cli
58
58
 
59
59
  **Go:**
60
60
  ```bash
61
- go install github.com/The-17/agentsecrets/cmd/agentsecrets@latest
61
+ go install github.com/The-17/agentsecrets/cmd/agentsecrets@v3.0.0
62
62
  ```
63
63
 
64
64
  ---
@@ -28,11 +28,12 @@ function getPlatformInfo() {
28
28
  return { os_name, arch_name };
29
29
  }
30
30
 
31
- async function downloadBinary(url, dest) {
31
+ async function downloadBinary(url, dest, isZip = false) {
32
32
  return new Promise((resolve, reject) => {
33
33
  https.get(url, (res) => {
34
34
  if (res.statusCode === 302 || res.statusCode === 301) {
35
- return downloadBinary(res.headers.location, dest).then(resolve).catch(reject);
35
+ const nextIsZip = isZip || url.split('?')[0].endsWith('.zip');
36
+ return downloadBinary(res.headers.location, dest, nextIsZip).then(resolve).catch(reject);
36
37
  }
37
38
  if (res.statusCode !== 200) {
38
39
  return reject(new Error(`Failed to download: ${res.statusCode}`));
@@ -41,16 +42,34 @@ async function downloadBinary(url, dest) {
41
42
  const tempDir = path.join(os.tmpdir(), `agentsecrets-${Date.now()}`);
42
43
  fs.mkdirSync(tempDir, { recursive: true });
43
44
 
44
- const isWin = url.endsWith('.zip');
45
-
45
+ const isWin = isZip || url.split('?')[0].endsWith('.zip');
46
46
  if (isWin) {
47
- // Note: we don't have a zip library in dependencies,
48
- // but GoReleaser can be configured to use tar.gz for all or
49
- // we could use a simple unzip if available.
50
- // For now, let's assume we use tar.gz for linux/darwin and
51
- // if windows users use npm, they might need a zip tool or we use tar.gz there too.
52
- // Actually, .goreleaser.yaml shows windows uses zip.
53
- return reject(new Error("Windows zip extraction not yet implemented in NPM wrapper. Please use 'brew install agentsecrets' or download manually."));
47
+ const zipPath = path.join(tempDir, 'archive.zip');
48
+ const fileStream = fs.createWriteStream(zipPath);
49
+ res.pipe(fileStream);
50
+ fileStream.on('finish', () => {
51
+ fileStream.close(() => {
52
+ const { execSync } = require('child_process');
53
+ try {
54
+ // Use ErrorActionPreference = Stop so PowerShell errors trigger execSync failure
55
+ execSync('powershell.exe -NoProfile -Command "$ErrorActionPreference = \'Stop\'; Expand-Archive -Path \'' + zipPath + '\' -DestinationPath \'' + tempDir + '\' -Force"', { stdio: 'pipe' });
56
+ const binaryName = 'agentsecrets.exe';
57
+ const src = path.join(tempDir, binaryName);
58
+ if (fs.existsSync(src)) {
59
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
60
+ fs.renameSync(src, dest);
61
+ resolve();
62
+ } else {
63
+ reject(new Error('Binary ' + binaryName + ' not found in zip archive'));
64
+ }
65
+ } catch (err) {
66
+ const stderr = err.stderr ? err.stderr.toString() : '';
67
+ reject(new Error('Failed to extract ZIP archive on Windows: ' + err.message + '\nPowerShell Error: ' + stderr));
68
+ }
69
+ });
70
+ });
71
+ fileStream.on('error', reject);
72
+ return;
54
73
  }
55
74
 
56
75
  res.pipe(tar.x({ C: tempDir }))
@@ -61,6 +80,19 @@ async function downloadBinary(url, dest) {
61
80
  fs.mkdirSync(path.dirname(dest), { recursive: true });
62
81
  fs.renameSync(src, dest);
63
82
  fs.chmodSync(dest, 0o755);
83
+
84
+ // Pre-register with keychain-auth if available. This eliminates
85
+ // the one-time setup spinner on the user's first command.
86
+ try {
87
+ const { execFileSync } = require('child_process');
88
+ execFileSync('keychain-auth', ['register', dest], {
89
+ timeout: 5000,
90
+ stdio: 'ignore',
91
+ });
92
+ } catch (_) {
93
+ // Silent — AutoSetup handles registration at runtime if needed
94
+ }
95
+
64
96
  resolve();
65
97
  } else {
66
98
  reject(new Error(`Binary ${binaryName} not found in archive`));
@@ -105,6 +137,7 @@ async function getBinaryPath() {
105
137
  let version = VERSION;
106
138
  try {
107
139
  version = await getLatestVersion();
140
+ console.log(`Latest AgentSecrets version: ${version}`);
108
141
  } catch (err) {
109
142
  console.error(`Failed to fetch latest version from GitHub: ${err.message}. Falling back to package version ${VERSION}.`);
110
143
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-17/agentsecrets",
3
- "version": "1.1.5",
3
+ "version": "3.0.0",
4
4
  "description": "AI-native zero-knowledge secrets manager (CLI wrapper)",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -18,7 +18,7 @@
18
18
  "cli",
19
19
  "ai-secrets-management"
20
20
  ],
21
- "author": "The Seventeen <hello@theseventeen.co>",
21
+ "author": "The Seventeen <engineering@theseventeen.co>",
22
22
  "license": "MIT",
23
23
  "repository": {
24
24
  "type": "git",