herdr-secret 0.0.0-stage → 0.1.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +23 -2
  3. package/cli.js +93 -0
  4. package/package.json +12 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 mazemaker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,24 @@
1
- # Temporary Holding Version
1
+ # herdr-secret
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Installer and command for [herdr-secret](https://github.com/mazemaker/herdr-secret), a
4
+ [herdr](https://herdr.dev) plugin that lets coding agents ask you for credentials in a popup
5
+ form instead of having you paste them into the chat. Values go straight to the OS credential
6
+ store (macOS Keychain, Windows Credential Manager, Linux Secret Service); the agent only learns
7
+ whether you answered.
8
+
9
+ ```sh
10
+ npx herdr-secret@latest
11
+ ```
12
+
13
+ This installs the plugin from GitHub through `herdr plugin install` (herdr shows what it will
14
+ run and asks first), then walks you through setup: it checks the credential store, puts the
15
+ `herdr-secret` command on your PATH, and offers to teach the agents it finds (Claude Code,
16
+ Codex, OpenCode, Gemini CLI) to use it.
17
+
18
+ ```sh
19
+ npx herdr-secret uninstall # undo setup, optionally remove the plugin
20
+ ```
21
+
22
+ Requires herdr 0.9.5 or newer, Python 3.8 or newer, and Node 18 or newer for this installer.
23
+ See the [full README](https://github.com/mazemaker/herdr-secret#readme) for how it works and
24
+ what it does and doesn't protect.
package/cli.js ADDED
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/env node
2
+ // herdr-secret from npm.
3
+ // npx herdr-secret@latest install (or update) the herdr plugin, then run its setup
4
+ // npx herdr-secret uninstall undo setup and optionally remove the plugin
5
+ // npx herdr-secret ask|get|list|rm the plugin's own command, once it is installed
6
+ // The plugin itself comes from GitHub through `herdr plugin install`, so herdr shows what it
7
+ // will run before anything does. This file only finds herdr and Python and hands over.
8
+ 'use strict';
9
+ const { spawnSync } = require('child_process');
10
+ const path = require('path');
11
+
12
+ const REPO = 'mazemaker/herdr-secret';
13
+ const ID = 'mazemaker.secret';
14
+ const isWin = process.platform === 'win32';
15
+
16
+ // The wizard and the form handle Ctrl-C themselves; don't let Node exit underneath them.
17
+ process.on('SIGINT', () => {});
18
+
19
+ function fail(msg) {
20
+ console.error(`herdr-secret: ${msg}`);
21
+ process.exit(1);
22
+ }
23
+
24
+ function capture(cmd, args) {
25
+ const r = spawnSync(cmd, args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
26
+ return r.status === 0 ? r.stdout : null;
27
+ }
28
+
29
+ function run(cmd, args) {
30
+ const r = spawnSync(cmd, args, { stdio: 'inherit' });
31
+ if (r.error) fail(`could not run ${cmd}: ${r.error.message}`);
32
+ return r.status === null ? 1 : r.status;
33
+ }
34
+
35
+ function findPython() {
36
+ const candidates = isWin ? [['py', '-3'], ['python']] : [['python3']];
37
+ for (const [cmd, ...pre] of candidates) {
38
+ const ok = capture(cmd, [...pre, '-c', 'import sys; print(sys.version_info >= (3, 8))']);
39
+ if (ok && ok.trim() === 'True') return [cmd, ...pre];
40
+ }
41
+ fail(isWin ? 'Python 3.8 or newer is required (python.org installer, which adds the py launcher)'
42
+ : 'Python 3.8 or newer is required (python3 on PATH)');
43
+ }
44
+
45
+ function plugin() {
46
+ const out = capture('herdr', ['plugin', 'list', '--json']);
47
+ if (!out) return null;
48
+ try {
49
+ const plugins = (JSON.parse(out).result || {}).plugins || [];
50
+ return plugins.find((p) => p.plugin_id === ID) || null;
51
+ } catch {
52
+ return null;
53
+ }
54
+ }
55
+
56
+ const USAGE = `herdr-secret (npm)
57
+
58
+ npx herdr-secret@latest install or update the herdr plugin, then run setup
59
+ npx herdr-secret setup [--yes] run setup again
60
+ npx herdr-secret uninstall undo setup, optionally remove the plugin
61
+ npx herdr-secret ask|get|list|rm the plugin's own command (see herdr-secret help)
62
+
63
+ https://github.com/mazemaker/herdr-secret`;
64
+
65
+ function main(argv) {
66
+ if (['-h', '--help', 'help'].includes(argv[0])) {
67
+ console.log(USAGE);
68
+ return 0;
69
+ }
70
+ if (!capture('herdr', ['--version'])) fail('herdr is required: https://herdr.dev');
71
+ const py = findPython();
72
+ const [cmd, ...rest] = argv;
73
+ let p = plugin();
74
+
75
+ if (!cmd || cmd === 'install' || cmd === 'setup') {
76
+ const flags = cmd ? rest : argv;
77
+ if (!p) {
78
+ const code = run('herdr', ['plugin', 'install', REPO]);
79
+ if (code !== 0) process.exit(code);
80
+ } else if ((p.source || {}).kind !== 'local') {
81
+ console.log('herdr-secret is already installed; updating it.');
82
+ run('herdr', ['plugin', 'update', ID]);
83
+ }
84
+ p = plugin();
85
+ if (!p || !p.plugin_root) fail(`herdr did not report the plugin folder; run: herdr plugin action invoke ${ID}.setup`);
86
+ return run(py[0], [...py.slice(1), '-I', path.join(p.plugin_root, 'bin', 'herdr_secret.py'), 'setup', ...flags]);
87
+ }
88
+
89
+ if (!p || !p.plugin_root) fail('the herdr plugin is not installed yet. Run: npx herdr-secret@latest');
90
+ return run(py[0], [...py.slice(1), '-I', path.join(p.plugin_root, 'bin', 'herdr_secret.py'), ...argv]);
91
+ }
92
+
93
+ process.exit(main(process.argv.slice(2)));
package/package.json CHANGED
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "name": "herdr-secret",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Installer and command for herdr-secret: a herdr popup form where coding agents ask you for credentials.",
5
+ "license": "MIT",
6
+ "author": "mazemaker",
7
+ "homepage": "https://github.com/mazemaker/herdr-secret#readme",
8
+ "repository": { "type": "git", "url": "git+https://github.com/mazemaker/herdr-secret.git", "directory": "npm" },
9
+ "bugs": { "url": "https://github.com/mazemaker/herdr-secret/issues" },
10
+ "keywords": ["herdr", "herdr-plugin", "credentials", "secrets", "keychain", "ai-agents", "coding-agents"],
11
+ "bin": { "herdr-secret": "cli.js" },
12
+ "files": ["cli.js"],
13
+ "engines": { "node": ">=18" }
14
+ }