@postplus/cli 0.1.23 → 0.1.24
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/build/client-compatibility.js +1 -1
- package/build/index.js +5 -1
- package/build/update-check.js +48 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ PostPlus has three public surfaces that work together:
|
|
|
31
31
|
Requires Node.js and npm.
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
npm install -g @postplus/cli
|
|
34
|
+
npm install -g @postplus/cli@latest
|
|
35
35
|
postplus auth login
|
|
36
36
|
npx -y skills add PostPlusAI/postplus-skills --global --full-depth --skill '*' --agent claude-code codex cursor github-copilot windsurf trae trae-cn --yes
|
|
37
37
|
```
|
|
@@ -51,7 +51,7 @@ export function formatPostPlusClientUpgradeError(payload) {
|
|
|
51
51
|
? payload
|
|
52
52
|
: {};
|
|
53
53
|
const cliCommand = record.compatibility?.upgrade?.cli?.command ??
|
|
54
|
-
'npm install -g @postplus/cli';
|
|
54
|
+
'npm install -g @postplus/cli@latest';
|
|
55
55
|
const skillsCommand = record.compatibility?.upgrade?.skills?.command ?? 'postplus update';
|
|
56
56
|
const restart = record.compatibility?.upgrade?.restartAgentSession
|
|
57
57
|
? ' Then restart your agent session.'
|
package/build/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { assertConfigFilePermissions } from './local-state.js';
|
|
|
9
9
|
import { POSTPLUS_SKILLS_INSTALL_COMMAND, loadPublicSkillCatalog, } from './skill-catalog.js';
|
|
10
10
|
import { runPostPlusSkillUninstall, runPostPlusSkillUpdate, } from './skill-management.js';
|
|
11
11
|
import { formatStatusReport, generateStatusReport } from './status.js';
|
|
12
|
-
import { refreshUpdateCheckCache } from './update-check.js';
|
|
12
|
+
import { refreshUpdateCheckCache, runCliSelfUpdateIfOutdated, } from './update-check.js';
|
|
13
13
|
function printAuthHelp() {
|
|
14
14
|
process.stdout.write(`PostPlus CLI — auth commands
|
|
15
15
|
|
|
@@ -103,6 +103,10 @@ async function runVersion() {
|
|
|
103
103
|
return 0;
|
|
104
104
|
}
|
|
105
105
|
async function runSkillUpdateCommand() {
|
|
106
|
+
const cliSelfUpdate = await runCliSelfUpdateIfOutdated();
|
|
107
|
+
if (cliSelfUpdate.updateAvailable) {
|
|
108
|
+
return cliSelfUpdate.exitCode ?? 1;
|
|
109
|
+
}
|
|
106
110
|
const exitCode = await runPostPlusSkillUpdate();
|
|
107
111
|
if (exitCode === 0) {
|
|
108
112
|
await refreshUpdateCheckCache().catch(() => { });
|
package/build/update-check.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
3
|
import { readCurrentCliVersion } from './client-compatibility.js';
|
|
4
|
+
import { runInteractiveCommand as runDefaultInteractiveCommand, } from './command-runner.js';
|
|
4
5
|
import { getPostPlusConfigDir, readManagedSkillBaseline, } from './local-state.js';
|
|
5
6
|
import { POSTPLUS_SKILLS_REPO, loadPublicSkillCatalog, } from './skill-catalog.js';
|
|
6
7
|
const UPDATE_CHECK_TTL_MS = 24 * 60 * 60 * 1000;
|
|
7
8
|
const UPDATE_CHECK_CACHE_FILE = 'update-check.json';
|
|
8
9
|
const NPM_PACKAGE_NAME = '@postplus/cli';
|
|
9
10
|
const NPM_LATEST_URL = `https://registry.npmjs.org/${encodeURIComponent(NPM_PACKAGE_NAME)}/latest`;
|
|
11
|
+
export const POSTPLUS_CLI_UPDATE_COMMAND = 'npm install -g @postplus/cli@latest';
|
|
12
|
+
const POSTPLUS_CLI_UPDATE_ARGS = ['install', '-g', '@postplus/cli@latest'];
|
|
10
13
|
export async function generateUpdateStatusReport(input = {}, dependencies = {
|
|
11
14
|
fetchFn: fetch,
|
|
12
15
|
}) {
|
|
@@ -68,7 +71,7 @@ export async function generateUpdateStatusReport(input = {}, dependencies = {
|
|
|
68
71
|
currentVersion,
|
|
69
72
|
latestVersion: null,
|
|
70
73
|
updateAvailable: false,
|
|
71
|
-
updateCommand:
|
|
74
|
+
updateCommand: POSTPLUS_CLI_UPDATE_COMMAND,
|
|
72
75
|
},
|
|
73
76
|
skills: {
|
|
74
77
|
currentReleaseId: managedSkillBaseline.releaseId,
|
|
@@ -85,6 +88,49 @@ export async function refreshUpdateCheckCache() {
|
|
|
85
88
|
force: true,
|
|
86
89
|
});
|
|
87
90
|
}
|
|
91
|
+
export async function runCliSelfUpdateIfOutdated(dependencies = {}) {
|
|
92
|
+
const fetchFn = dependencies.fetchFn ?? fetch;
|
|
93
|
+
const runInteractiveCommand = dependencies.runInteractiveCommand ?? runDefaultInteractiveCommand;
|
|
94
|
+
const writeOutput = dependencies.writeOutput ?? ((message) => process.stdout.write(message));
|
|
95
|
+
const currentVersion = await readCurrentCliVersion();
|
|
96
|
+
const latestVersion = await fetchLatestCliVersion(fetchFn);
|
|
97
|
+
if (compareVersions(latestVersion, currentVersion) <= 0) {
|
|
98
|
+
return {
|
|
99
|
+
command: POSTPLUS_CLI_UPDATE_COMMAND,
|
|
100
|
+
currentVersion,
|
|
101
|
+
exitCode: null,
|
|
102
|
+
latestVersion,
|
|
103
|
+
updateAvailable: false,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
writeOutput([
|
|
107
|
+
`PostPlus CLI ${currentVersion} is older than latest ${latestVersion}.`,
|
|
108
|
+
`Updating CLI: ${POSTPLUS_CLI_UPDATE_COMMAND}`,
|
|
109
|
+
'',
|
|
110
|
+
].join('\n'));
|
|
111
|
+
const exitCode = await runInteractiveCommand('npm', POSTPLUS_CLI_UPDATE_ARGS);
|
|
112
|
+
if (exitCode === 0) {
|
|
113
|
+
writeOutput([
|
|
114
|
+
`PostPlus CLI updated to ${latestVersion}.`,
|
|
115
|
+
'Re-run `postplus update` to update skills with the new CLI process.',
|
|
116
|
+
'',
|
|
117
|
+
].join('\n'));
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
writeOutput([
|
|
121
|
+
`PostPlus CLI update failed with exit code ${exitCode}.`,
|
|
122
|
+
`Fix the npm install error, then run: ${POSTPLUS_CLI_UPDATE_COMMAND}`,
|
|
123
|
+
'',
|
|
124
|
+
].join('\n'));
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
command: POSTPLUS_CLI_UPDATE_COMMAND,
|
|
128
|
+
currentVersion,
|
|
129
|
+
exitCode,
|
|
130
|
+
latestVersion,
|
|
131
|
+
updateAvailable: true,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
88
134
|
export function formatUpdateStatusReport(report) {
|
|
89
135
|
const lines = ['PostPlus update status', ''];
|
|
90
136
|
const cliMarker = report.cli.updateAvailable ? '[WARN]' : '[PASS]';
|
|
@@ -115,7 +161,7 @@ function buildUpdateReport(input) {
|
|
|
115
161
|
latestVersion: input.cache.cli.latestVersion,
|
|
116
162
|
updateAvailable: compareVersions(input.cache.cli.latestVersion, input.currentVersion) >
|
|
117
163
|
0,
|
|
118
|
-
updateCommand:
|
|
164
|
+
updateCommand: POSTPLUS_CLI_UPDATE_COMMAND,
|
|
119
165
|
},
|
|
120
166
|
skills: {
|
|
121
167
|
currentReleaseId: input.currentSkillsReleaseId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postplus/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"packageManager": "pnpm@10.30.3+sha512.c961d1e0a2d8e354ecaa5166b822516668b7f44cb5bd95122d590dd81922f606f5473b6d23ec4a5be05e7fcd18e8488d47d978bbe981872f1145d06e9a740017",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "PostPlus CLI for PostPlus Cloud auth, status, and diagnostics.",
|