@postman/postman-plugin 0.1.0 → 0.1.1-rc.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 +1 -1
- package/dist/cli.js +1 -7
- package/dist/hosts/kimi.js +2 -5
- package/dist/run.js +10 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ 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 @postman/postman-plugin
|
|
24
|
+
npx @postman/postman-plugin@next
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
One command configures **Claude Code, Codex, Cursor, Kimi Code and OpenCode**.
|
package/dist/cli.js
CHANGED
|
@@ -20,13 +20,7 @@ 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
|
|
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:")`;
|
|
23
|
+
-v, --version Show the version`;
|
|
30
24
|
function version() {
|
|
31
25
|
const manifest = new URL('../package.json', import.meta.url);
|
|
32
26
|
return JSON.parse(fs.readFileSync(manifest, 'utf8')).version;
|
package/dist/hosts/kimi.js
CHANGED
|
@@ -46,13 +46,10 @@ export const kimi = {
|
|
|
46
46
|
if (!(await system.which('npx'))) {
|
|
47
47
|
blocked('npx is not on PATH');
|
|
48
48
|
}
|
|
49
|
-
|
|
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'], {
|
|
49
|
+
await mustRun(system, 'npx', ['-y', PLUGINS_CLI, 'add', REPO, '--target', 'kimi', '--yes'], {
|
|
53
50
|
env: { DISABLE_TELEMETRY: '1', DO_NOT_TRACK: '1' }
|
|
54
51
|
});
|
|
55
|
-
return result('done',
|
|
52
|
+
return result('done', `installed ${PLUGIN_ID} into ${kimiHome(system)}`, NEXT);
|
|
56
53
|
});
|
|
57
54
|
},
|
|
58
55
|
async remove(system) {
|
package/dist/run.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export const EXIT = { ok: 0, failed: 1, usage: 2
|
|
2
|
-
|
|
1
|
+
export const EXIT = { ok: 0, failed: 1, usage: 2 };
|
|
2
|
+
// `manual` counts: the command did not finish, and a script needs to know the user has a step left.
|
|
3
|
+
const INCOMPLETE = ['failed', 'blocked', 'manual'];
|
|
3
4
|
function padEnd(text, width) {
|
|
4
5
|
return text + ' '.repeat(Math.max(1, width - text.length));
|
|
5
6
|
}
|
|
@@ -75,15 +76,11 @@ export async function run(system, hosts, options) {
|
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
if (!targets.length) {
|
|
78
|
-
system.log(
|
|
79
|
-
'None of the requested agents was found.' :
|
|
80
|
-
`No supported coding agent found. Supported: ${joinNames(requested)}.`);
|
|
79
|
+
system.log(`No supported coding agent found. Supported: ${joinNames(requested)}.`);
|
|
81
80
|
reports.forEach((report) => system.log(` ${report.result.message}`));
|
|
82
|
-
|
|
83
|
-
return options.command === 'install' || (options.command === 'remove' && reports.length) ? EXIT.failed : EXIT.ok;
|
|
81
|
+
return reports.length && options.command !== 'status' ? EXIT.failed : EXIT.ok;
|
|
84
82
|
}
|
|
85
|
-
|
|
86
|
-
system.log(`Found ${targets.length} coding agent${targets.length === 1 ? '' : 's'}. Postman in each:`);
|
|
83
|
+
system.log('Found:');
|
|
87
84
|
printStatuses(system, targets, width);
|
|
88
85
|
reports.forEach((report) => system.log(` ${padEnd(report.host.name, width)}${report.result.message}`));
|
|
89
86
|
if (options.command === 'status') {
|
|
@@ -93,12 +90,12 @@ export async function run(system, hosts, options) {
|
|
|
93
90
|
// remove also clears duplicates and half-finished installs that status doesn't count.
|
|
94
91
|
const command = options.command;
|
|
95
92
|
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));
|
|
97
93
|
if (!options.isTTY) {
|
|
98
|
-
system.log(
|
|
94
|
+
system.log('\nNot running in a terminal, so there is no one to confirm. Re-run with --yes.');
|
|
99
95
|
return EXIT.usage;
|
|
100
96
|
}
|
|
101
|
-
|
|
97
|
+
const verb = command === 'install' ? 'Install or update Postman in' : 'Remove Postman from';
|
|
98
|
+
if (!(await options.confirm(`\n${verb} ${joinNames(targets.map((target) => target.host))}? [Y/n] `))) {
|
|
102
99
|
system.log('Cancelled.');
|
|
103
100
|
return EXIT.failed;
|
|
104
101
|
}
|
|
@@ -113,8 +110,5 @@ export async function run(system, hosts, options) {
|
|
|
113
110
|
for (const { host, result } of reports) {
|
|
114
111
|
system.log(` ${padEnd(host.name, width)}${padEnd(result.outcome, 9)}${result.message.split('\n')[0]}`);
|
|
115
112
|
}
|
|
116
|
-
|
|
117
|
-
return EXIT.failed;
|
|
118
|
-
}
|
|
119
|
-
return reports.some(({ result }) => result.outcome === 'manual') ? EXIT.manual : EXIT.ok;
|
|
113
|
+
return reports.some(({ result }) => INCOMPLETE.includes(result.outcome)) ? EXIT.failed : EXIT.ok;
|
|
120
114
|
}
|