@postman/postman-plugin 0.1.0-rc.0 → 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.
- package/README.md +4 -2
- package/dist/cli.js +7 -1
- package/dist/hosts/kimi.js +5 -2
- package/dist/run.js +16 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,10 +21,12 @@ dependencies, ownership, runtime behavior, and the likely impact of a change.
|
|
|
21
21
|
Install Postman in every compatible coding agent detected on your machine:
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
npx
|
|
24
|
+
npx @postman/postman-plugin
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
One command configures **Claude Code, Cursor,
|
|
27
|
+
One command configures **Claude Code, Codex, Cursor, Kimi Code and OpenCode**.
|
|
28
|
+
Run it again to update, `status` to see what's installed, and `remove` to
|
|
29
|
+
uninstall; `--agent <id>` limits any of them to one agent.
|
|
28
30
|
|
|
29
31
|
You can also use the following commands to install individually:
|
|
30
32
|
|
package/dist/cli.js
CHANGED
|
@@ -20,7 +20,13 @@ Options:
|
|
|
20
20
|
-y, --yes Don't ask for confirmation (required when not in a terminal)
|
|
21
21
|
--dry-run Print what would change without changing anything
|
|
22
22
|
-h, --help Show this help
|
|
23
|
-
-v, --version Show the version
|
|
23
|
+
-v, --version Show the version
|
|
24
|
+
|
|
25
|
+
Exit codes:
|
|
26
|
+
0 Done, or nothing needed doing
|
|
27
|
+
1 Something failed or was blocked, you cancelled, or install found no agent
|
|
28
|
+
2 Bad usage, or confirmation needed but no terminal (use --yes)
|
|
29
|
+
3 Done, except a step only you can do (printed as "next:")`;
|
|
24
30
|
function version() {
|
|
25
31
|
const manifest = new URL('../package.json', import.meta.url);
|
|
26
32
|
return JSON.parse(fs.readFileSync(manifest, 'utf8')).version;
|
package/dist/hosts/kimi.js
CHANGED
|
@@ -46,10 +46,13 @@ export const kimi = {
|
|
|
46
46
|
if (!(await system.which('npx'))) {
|
|
47
47
|
blocked('npx is not on PATH');
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
// Only picks the verb: an unreadable store must not stop the install that could repair it.
|
|
50
|
+
const installed = await kimi.status(system).then((status) => status.installed, () => null);
|
|
51
|
+
// An explicit --package outranks the npm_config_package an outer `npx -p` exports to us.
|
|
52
|
+
await mustRun(system, 'npx', ['-y', `--package=${PLUGINS_CLI}`, 'plugins', 'add', REPO, '--target', 'kimi', '--yes'], {
|
|
50
53
|
env: { DISABLE_TELEMETRY: '1', DO_NOT_TRACK: '1' }
|
|
51
54
|
});
|
|
52
|
-
return result('done',
|
|
55
|
+
return result('done', `${installed ? 'updated' : 'installed'} ${PLUGIN_ID} in ${kimiHome(system)}`, NEXT);
|
|
53
56
|
});
|
|
54
57
|
},
|
|
55
58
|
async remove(system) {
|
package/dist/run.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export const EXIT = { ok: 0, failed: 1, usage: 2 };
|
|
2
|
-
|
|
3
|
-
const INCOMPLETE = ['failed', 'blocked', 'manual'];
|
|
1
|
+
export const EXIT = { ok: 0, failed: 1, usage: 2, manual: 3 };
|
|
2
|
+
const FAILED = ['failed', 'blocked'];
|
|
4
3
|
function padEnd(text, width) {
|
|
5
4
|
return text + ' '.repeat(Math.max(1, width - text.length));
|
|
6
5
|
}
|
|
@@ -76,11 +75,15 @@ export async function run(system, hosts, options) {
|
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
if (!targets.length) {
|
|
79
|
-
system.log(
|
|
78
|
+
system.log(options.agents.length ?
|
|
79
|
+
'None of the requested agents was found.' :
|
|
80
|
+
`No supported coding agent found. Supported: ${joinNames(requested)}.`);
|
|
80
81
|
reports.forEach((report) => system.log(` ${report.result.message}`));
|
|
81
|
-
|
|
82
|
+
// Nothing to remove is a clean remove; nothing to install into is not a successful install.
|
|
83
|
+
return options.command === 'install' || (options.command === 'remove' && reports.length) ? EXIT.failed : EXIT.ok;
|
|
82
84
|
}
|
|
83
|
-
|
|
85
|
+
// "Found:" over "not installed" read to agents as "not found"; the header says both things.
|
|
86
|
+
system.log(`Found ${targets.length} coding agent${targets.length === 1 ? '' : 's'}. Postman in each:`);
|
|
84
87
|
printStatuses(system, targets, width);
|
|
85
88
|
reports.forEach((report) => system.log(` ${padEnd(report.host.name, width)}${report.result.message}`));
|
|
86
89
|
if (options.command === 'status') {
|
|
@@ -90,12 +93,12 @@ export async function run(system, hosts, options) {
|
|
|
90
93
|
// remove also clears duplicates and half-finished installs that status doesn't count.
|
|
91
94
|
const command = options.command;
|
|
92
95
|
if (!options.yes && !system.dryRun) {
|
|
96
|
+
const verb = command === 'install' ? 'install or update Postman in' : 'remove Postman from', names = joinNames(targets.map((target) => target.host));
|
|
93
97
|
if (!options.isTTY) {
|
|
94
|
-
system.log(
|
|
98
|
+
system.log(`\nNothing changed: there is no terminal to confirm in. To ${verb} ${names}, re-run with --yes (add --agent <id> for only some).`);
|
|
95
99
|
return EXIT.usage;
|
|
96
100
|
}
|
|
97
|
-
|
|
98
|
-
if (!(await options.confirm(`\n${verb} ${joinNames(targets.map((target) => target.host))}? [Y/n] `))) {
|
|
101
|
+
if (!(await options.confirm(`\n${verb[0].toUpperCase()}${verb.slice(1)} ${names}? [Y/n] `))) {
|
|
99
102
|
system.log('Cancelled.');
|
|
100
103
|
return EXIT.failed;
|
|
101
104
|
}
|
|
@@ -110,5 +113,8 @@ export async function run(system, hosts, options) {
|
|
|
110
113
|
for (const { host, result } of reports) {
|
|
111
114
|
system.log(` ${padEnd(host.name, width)}${padEnd(result.outcome, 9)}${result.message.split('\n')[0]}`);
|
|
112
115
|
}
|
|
113
|
-
|
|
116
|
+
if (reports.some(({ result }) => FAILED.includes(result.outcome))) {
|
|
117
|
+
return EXIT.failed;
|
|
118
|
+
}
|
|
119
|
+
return reports.some(({ result }) => result.outcome === 'manual') ? EXIT.manual : EXIT.ok;
|
|
114
120
|
}
|