@postplus/cli 0.1.38 → 0.1.40

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.
@@ -1,9 +1,15 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { homedir } from 'node:os';
3
+ import { join } from 'node:path';
1
4
  import { writeCurrentCliVersionToLocalConfig } from './client-compatibility.js';
2
5
  import { runCommand, runInteractiveCommand } from './command-runner.js';
3
6
  import { clearManagedSkillBaseline, readManagedSkillBaseline, writeManagedSkillBaseline, } from './local-state.js';
4
7
  import { POSTPLUS_SKILLS_AGENT_TARGETS, formatPostPlusSkillsInstallCommand, resolvePostPlusSkillsSource, loadPublicSkillCatalog, } from './skill-catalog.js';
5
8
  import { clearUpdateCheckCache } from './update-check.js';
6
9
  const NPX_SKILLS = ['-y', 'skills'];
10
+ const SKILLS_INSTALLER_GLOBAL_LOCK_PATH = ['.agents', '.skill-lock.json'];
11
+ const SKILLS_INSTALLER_PROJECT_LOCK_PATH = 'skills-lock.json';
12
+ const SKILLS_INSTALLER_POSTPLUS_SOURCE = 'postplusai/postplus-skills';
7
13
  const DEFAULT_SKILL_MUTATION_OPTIONS = {
8
14
  scope: 'global',
9
15
  };
@@ -12,8 +18,10 @@ export async function runPostPlusSkillUpdate(dependencies = {
12
18
  }, options = DEFAULT_SKILL_MUTATION_OPTIONS) {
13
19
  const catalog = await loadPublicSkillCatalog();
14
20
  const skillNames = catalog.skills.map((skill) => skill.skillId);
21
+ const releasedSkills = new Set(skillNames);
15
22
  const baseline = await readManagedSkillBaseline();
16
- const retiredSkillNames = baseline.skillNames.filter((skillName) => !skillNames.includes(skillName));
23
+ const lockedSkillNames = await readPostPlusInstallerLockedSkillEntries(options.scope).then((entries) => entries.map((entry) => entry.name));
24
+ const retiredSkillNames = mergeSkillNames(baseline.skillNames, lockedSkillNames).filter((skillName) => !releasedSkills.has(skillName));
17
25
  if (skillNames.length === 0) {
18
26
  throw new Error('PostPlus public skill catalog has no released skills.');
19
27
  }
@@ -45,7 +53,8 @@ export async function runPostPlusSkillUninstall(dependencies = {
45
53
  const catalog = await loadPublicSkillCatalog();
46
54
  const skillNames = catalog.skills.map((skill) => skill.skillId);
47
55
  const baseline = await readManagedSkillBaseline();
48
- const allKnownSkillNames = mergeSkillNames(skillNames, baseline.skillNames);
56
+ const lockedSkillNames = await readPostPlusInstallerLockedSkillEntries(options.scope).then((entries) => entries.map((entry) => entry.name));
57
+ const allKnownSkillNames = mergeSkillNames(mergeSkillNames(skillNames, baseline.skillNames), lockedSkillNames);
49
58
  if (allKnownSkillNames.length === 0) {
50
59
  throw new Error('PostPlus public skill catalog has no released skills.');
51
60
  }
@@ -96,9 +105,20 @@ async function inspectPostPlusSkillInstall(dependencies, options = {}) {
96
105
  const requiredSkillNames = catalog.skills.map((skill) => skill.skillId);
97
106
  const requiredSkills = new Set(requiredSkillNames);
98
107
  const baseline = await readManagedSkillBaseline();
99
- const retiredManagedSkills = baseline.skillNames.filter((skillName) => !requiredSkills.has(skillName));
108
+ const baselineRetiredManagedSkills = baseline.skillNames.filter((skillName) => !requiredSkills.has(skillName));
100
109
  try {
101
110
  const installed = await listInstalledSkills(dependencies);
111
+ const baselineRetiredSkills = new Set(baselineRetiredManagedSkills);
112
+ const lockedSkills = new Set((await readPostPlusInstallerLockedSkillEntries()).map((entry) => `${entry.scope}:${entry.name}`));
113
+ const installedRetiredManagedSkills = [
114
+ ...new Set(installed
115
+ .filter((skill) => baselineRetiredSkills.has(skill.name) ||
116
+ lockedSkills.has(`${skill.scope}:${skill.name}`))
117
+ .map((skill) => skill.name)),
118
+ ]
119
+ .filter((skillName) => !requiredSkills.has(skillName))
120
+ .sort((a, b) => a.localeCompare(b));
121
+ const retiredManagedSkills = mergeSkillNames(baselineRetiredManagedSkills, installedRetiredManagedSkills);
102
122
  const postPlusInstalled = installed.filter((skill) => requiredSkills.has(skill.name));
103
123
  const installedNames = new Set(postPlusInstalled.map((skill) => skill.name));
104
124
  const missingSkills = [...requiredSkills].filter((skill) => !installedNames.has(skill));
@@ -110,7 +130,8 @@ async function inspectPostPlusSkillInstall(dependencies, options = {}) {
110
130
  baseline,
111
131
  releaseId: catalog.releaseId,
112
132
  skillNames: requiredSkillNames,
113
- })) {
133
+ }) &&
134
+ installedRetiredManagedSkills.length === 0) {
114
135
  await writeManagedSkillBaseline({
115
136
  releaseId: catalog.releaseId,
116
137
  skillNames: requiredSkillNames,
@@ -128,7 +149,8 @@ async function inspectPostPlusSkillInstall(dependencies, options = {}) {
128
149
  return {
129
150
  catalog,
130
151
  report: {
131
- ok: missingSkills.length === 0,
152
+ ok: missingSkills.length === 0 &&
153
+ installedRetiredManagedSkills.length === 0,
132
154
  error: null,
133
155
  installCommand: formatPostPlusSkillsInstallCommand(catalog.source),
134
156
  installedCount: installedNames.size,
@@ -157,7 +179,7 @@ async function inspectPostPlusSkillInstall(dependencies, options = {}) {
157
179
  managedSkillsReleaseId: baseline.releaseId,
158
180
  missingSkills: [...requiredSkills],
159
181
  requiredCount: requiredSkills.size,
160
- retiredManagedSkills,
182
+ retiredManagedSkills: baselineRetiredManagedSkills,
161
183
  scopes: [],
162
184
  source: catalog.source,
163
185
  updateCommand: formatPostPlusSkillUpdateCommand(),
@@ -212,6 +234,9 @@ export function formatSkillBaselineVerifyReport(report) {
212
234
  else {
213
235
  lines.push(' Verified baseline: unchanged');
214
236
  }
237
+ if (report.retiredManagedSkills.length > 0) {
238
+ lines.push(` Retired managed skills: ${formatSkillList(report.retiredManagedSkills, 8)}`, ` Cleanup (global): ${report.updateCommand}`, ` Cleanup (current directory): ${formatPostPlusSkillUpdateCommand('current-directory')}`);
239
+ }
215
240
  if (report.missingSkills.length > 0) {
216
241
  lines.push(` Missing: ${formatSkillList(report.missingSkills, 8)}`, ` Fix (global): ${report.installCommand}`, ` Fix (current directory): ${formatPostPlusSkillsInstallCommand(report.source, 'current-directory')}`);
217
242
  }
@@ -274,6 +299,106 @@ function haveSameSkillNames(left, right) {
274
299
  return (normalizedLeft.length === normalizedRight.length &&
275
300
  normalizedLeft.every((value, index) => value === normalizedRight[index]));
276
301
  }
302
+ async function readPostPlusInstallerLockedSkillEntries(scope) {
303
+ const lockPaths = scope === 'global'
304
+ ? [{ path: getSkillsInstallerGlobalLockPath(), scope: 'global' }]
305
+ : scope === 'current-directory'
306
+ ? [
307
+ {
308
+ path: getSkillsInstallerProjectLockPath(),
309
+ scope: 'project',
310
+ },
311
+ ]
312
+ : [
313
+ {
314
+ path: getSkillsInstallerProjectLockPath(),
315
+ scope: 'project',
316
+ },
317
+ {
318
+ path: getSkillsInstallerGlobalLockPath(),
319
+ scope: 'global',
320
+ },
321
+ ];
322
+ const entries = await Promise.all(lockPaths.map((lock) => readPostPlusInstallerLockedSkillNamesFromPath(lock.path).then((skillNames) => skillNames.map((name) => ({
323
+ name,
324
+ scope: lock.scope,
325
+ })))));
326
+ return entries
327
+ .flat()
328
+ .sort((left, right) => left.scope.localeCompare(right.scope) ||
329
+ left.name.localeCompare(right.name));
330
+ }
331
+ async function readPostPlusInstallerLockedSkillNamesFromPath(lockPath) {
332
+ try {
333
+ const raw = await readFile(lockPath, 'utf8');
334
+ const payload = JSON.parse(raw);
335
+ if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
336
+ return [];
337
+ }
338
+ const record = payload;
339
+ if (typeof record.version !== 'number') {
340
+ return [];
341
+ }
342
+ if (!record.skills || typeof record.skills !== 'object') {
343
+ return [];
344
+ }
345
+ return Object.entries(record.skills)
346
+ .filter(([, entry]) => isPostPlusSkillsInstallerLockEntry(entry))
347
+ .map(([skillName]) => skillName.trim())
348
+ .filter(Boolean)
349
+ .sort((a, b) => a.localeCompare(b));
350
+ }
351
+ catch (error) {
352
+ const nodeError = error;
353
+ if (nodeError.code === 'ENOENT') {
354
+ return [];
355
+ }
356
+ throw error;
357
+ }
358
+ }
359
+ function isPostPlusSkillsInstallerLockEntry(entry) {
360
+ if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {
361
+ return false;
362
+ }
363
+ const record = entry;
364
+ const source = typeof record.source === 'string' ? record.source.trim() : '';
365
+ const sourceUrl = typeof record.sourceUrl === 'string' ? record.sourceUrl.trim() : '';
366
+ return (normalizeSkillsInstallerSource(source) ===
367
+ SKILLS_INSTALLER_POSTPLUS_SOURCE ||
368
+ normalizeSkillsInstallerSource(sourceUrl) ===
369
+ SKILLS_INSTALLER_POSTPLUS_SOURCE);
370
+ }
371
+ function normalizeSkillsInstallerSource(value) {
372
+ let normalized = value.trim().replace(/\\/g, '/');
373
+ if (normalized.length === 0) {
374
+ return '';
375
+ }
376
+ const sshMatch = normalized.match(/^git@[^:]+:(.+)$/);
377
+ if (sshMatch) {
378
+ normalized = sshMatch[1] ?? '';
379
+ }
380
+ else if (/^https?:\/\//i.test(normalized) || /^ssh:\/\//i.test(normalized)) {
381
+ try {
382
+ normalized = new URL(normalized).pathname.replace(/^\/+/, '');
383
+ }
384
+ catch {
385
+ return normalized.toLowerCase();
386
+ }
387
+ }
388
+ return normalized
389
+ .replace(/\.git$/i, '')
390
+ .replace(/\/+$/, '')
391
+ .toLowerCase();
392
+ }
393
+ function getSkillsInstallerGlobalLockPath() {
394
+ const xdgStateHome = process.env.XDG_STATE_HOME?.trim();
395
+ return xdgStateHome
396
+ ? join(xdgStateHome, 'skills', '.skill-lock.json')
397
+ : join(homedir(), ...SKILLS_INSTALLER_GLOBAL_LOCK_PATH);
398
+ }
399
+ function getSkillsInstallerProjectLockPath() {
400
+ return join(process.cwd(), SKILLS_INSTALLER_PROJECT_LOCK_PATH);
401
+ }
277
402
  async function listInstalledSkills(dependencies) {
278
403
  const project = await listInstalledSkillsForScope(dependencies, []);
279
404
  const global = await listInstalledSkillsForScope(dependencies, ['--global']);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postplus/cli",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
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.",
@@ -16,8 +16,9 @@
16
16
  "build/command-runner.js",
17
17
  "build/doctor.js",
18
18
  "build/hosted-domain-commands.js",
19
+ "build/generated/hosted-execution-manifest.generated.js",
20
+ "build/hosted-manifest-index.js",
19
21
  "build/hosted-release.js",
20
- "build/hosted-schema-catalog.js",
21
22
  "build/hosted-request-schemas.js",
22
23
  "build/index.js",
23
24
  "build/local-dependencies.js",
@@ -1,286 +0,0 @@
1
- // Generated from the PostPlus Cloud hosted catalog release gate.
2
- // Keep keys in sync with apps/web hosted capability and collection catalogs.
3
- export const RESEARCH_COLLECTION_HINTS = {
4
- 'google-trends-fast': {
5
- queries: ['portable blender'],
6
- },
7
- 'instagram-comments': {
8
- directUrls: ['https://www.instagram.com/p/example/'],
9
- resultsLimit: 5,
10
- },
11
- 'instagram-email-search': {
12
- Country: 'www',
13
- Email_Type: '0',
14
- Keyword: 'skincare creator',
15
- Limit: '10',
16
- social_network: 'instagram.com/',
17
- },
18
- 'instagram-hashtags': {
19
- hashtags: ['desksetup'],
20
- resultsLimit: 3,
21
- },
22
- 'instagram-posts': {
23
- resultsLimit: 3,
24
- username: ['openai'],
25
- },
26
- 'instagram-profiles': {
27
- resultsLimit: 3,
28
- usernames: ['instagram'],
29
- },
30
- 'instagram-search': {
31
- searchLimit: 3,
32
- searchTerms: ['skincare routine'],
33
- searchType: 'user',
34
- },
35
- 'tiktok-ads-top': {
36
- include_analytics: true,
37
- limit: 1,
38
- },
39
- 'tiktok-comments': {
40
- postURLs: ['https://www.tiktok.com/@example/video/1234567890'],
41
- resultsPerPage: 5,
42
- },
43
- 'tiktok-profiles': {
44
- usernames: ['tiktok'],
45
- },
46
- 'tiktok-related-videos': {
47
- maxItems: 3,
48
- postURLs: ['https://www.tiktok.com/@example/video/1234567890'],
49
- },
50
- 'tiktok-users': {
51
- maxItems: 5,
52
- searchQueries: ['skincare creator'],
53
- },
54
- 'tiktok-videos': {
55
- maxItems: 3,
56
- proxyCountryCode: 'US',
57
- queries: ['portable blender'],
58
- searchSection: '/video',
59
- },
60
- 'youtube-channel-summary': {
61
- channels: ['@Google'],
62
- includeChannelInfo: true,
63
- includeVideos: false,
64
- maxVideosPerChannel: 0,
65
- },
66
- 'youtube-comments': {
67
- maxComments: 10,
68
- startUrls: ['https://www.youtube.com/watch?v=dQw4w9WgXcQ'],
69
- },
70
- 'youtube-video-download': {
71
- urls: ['https://www.youtube.com/watch?v=dQw4w9WgXcQ'],
72
- },
73
- };
74
- export const PUBLIC_CONTENT_SOURCE_HINTS = {
75
- 'facebook-group-posts': [
76
- {
77
- url: 'https://www.facebook.com/groups/example',
78
- },
79
- ],
80
- 'facebook-post-by-url': [
81
- {
82
- url: 'https://www.facebook.com/openai/posts/example',
83
- },
84
- ],
85
- 'facebook-profile-posts': [
86
- {
87
- url: 'https://www.facebook.com/openai',
88
- },
89
- ],
90
- 'youtube-videos': [
91
- {
92
- url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
93
- },
94
- ],
95
- };
96
- export const PUBLIC_CONTENT_DISCOVERY_TOOL_HINTS = {
97
- 'web-search': {
98
- limit: 5,
99
- query: 'portable blender reviews',
100
- },
101
- };
102
- export const MEDIA_ENDPOINT_HINTS = {
103
- 'image-gpt-image-2-edit': {
104
- inputUrls: ['https://example.com/reference-image.png'],
105
- prompt: 'Edit the reference into a clean product-style vertical image.',
106
- quality: 'medium',
107
- size: '1024x1024',
108
- },
109
- 'image-gpt-image-2-text': {
110
- aspect_ratio: '9:16',
111
- prompt: 'A realistic vertical product image on a clean white desk.',
112
- quality: 'medium',
113
- size: '1024x1024',
114
- },
115
- 'image-nano-banana-2-edit': {
116
- inputUrls: ['https://example.com/reference-image.png'],
117
- prompt: 'Edit the reference into a clean product-style vertical image.',
118
- quality: 'medium',
119
- size: '1024x1024',
120
- },
121
- 'image-nano-banana-2-text': {
122
- aspect_ratio: '9:16',
123
- prompt: 'A realistic vertical product image on a clean white desk.',
124
- quality: 'medium',
125
- size: '1024x1024',
126
- },
127
- 'image-nano-banana-pro-edit-1k': {
128
- inputUrls: ['https://example.com/reference-image.png'],
129
- prompt: 'Edit the reference into a clean product-style vertical image.',
130
- resolution: '1k',
131
- },
132
- 'image-nano-banana-pro-edit-2k': {
133
- inputUrls: ['https://example.com/reference-image.png'],
134
- prompt: 'Edit the reference into a clean product-style vertical image.',
135
- resolution: '2k',
136
- },
137
- 'image-nano-banana-pro-edit-4k': {
138
- inputUrls: ['https://example.com/reference-image.png'],
139
- prompt: 'Edit the reference into a clean product-style vertical image.',
140
- resolution: '4k',
141
- },
142
- 'image-nano-banana-pro-text-1k': {
143
- aspect_ratio: '9:16',
144
- prompt: 'A realistic vertical product image on a clean white desk.',
145
- resolution: '1k',
146
- },
147
- 'image-nano-banana-pro-text-2k': {
148
- aspect_ratio: '9:16',
149
- prompt: 'A realistic vertical product image on a clean white desk.',
150
- resolution: '2k',
151
- },
152
- 'image-nano-banana-pro-text-4k': {
153
- aspect_ratio: '9:16',
154
- prompt: 'A realistic vertical product image on a clean white desk.',
155
- resolution: '4k',
156
- },
157
- 'image-seedream-v5-lite-edit': {
158
- inputUrls: ['https://example.com/reference-image.png'],
159
- prompt: 'Edit the reference into a clean product-style vertical image.',
160
- size: '1024x1024',
161
- },
162
- 'image-seedream-v5-lite-edit-sequential': {
163
- inputUrls: ['https://example.com/reference-image.png'],
164
- prompt: 'Create a coherent sequence of edited product reference images.',
165
- size: '1024x1024',
166
- },
167
- 'image-seedream-v5-lite-sequential': {
168
- aspect_ratio: '9:16',
169
- prompt: 'Create a coherent sequence of vertical product images.',
170
- size: '1024x1024',
171
- },
172
- 'image-seedream-v5-lite-text': {
173
- aspect_ratio: '9:16',
174
- prompt: 'A realistic vertical product image on a clean white desk.',
175
- size: '1024x1024',
176
- },
177
- 'transcription-whisper': {
178
- audio: 'https://example.com/input-audio.mp3',
179
- language: 'en',
180
- response_format: 'verbose_json',
181
- timestamp_granularities: ['segment'],
182
- },
183
- 'transcription-whisper-turbo': {
184
- audio: 'https://example.com/input-audio.mp3',
185
- language: 'en',
186
- response_format: 'verbose_json',
187
- timestamp_granularities: ['segment'],
188
- },
189
- 'transcription-whisper-with-video': {
190
- language: 'en',
191
- response_format: 'verbose_json',
192
- timestamp_granularities: ['segment'],
193
- video: 'https://example.com/input-video.mp4',
194
- },
195
- 'video-infinitetalk': {
196
- audio: 'https://example.com/voiceover.wav',
197
- image: 'https://example.com/persona.png',
198
- prompt: 'Talking-head delivery in a natural vertical social ad style.',
199
- },
200
- 'video-kling-v2-6-pro-motion-control': {
201
- character_orientation: 'image',
202
- image: 'https://example.com/subject.png',
203
- video: 'https://example.com/reference-motion.mp4',
204
- },
205
- 'video-kling-v3-0-pro-image': {
206
- duration: 5,
207
- image: 'https://example.com/start-frame.png',
208
- prompt: 'Animate the product in a clean realistic vertical scene.',
209
- sound: false,
210
- },
211
- 'video-kling-v3-0-pro-text': {
212
- aspect_ratio: '9:16',
213
- duration: 5,
214
- prompt: 'A realistic vertical short-form product reveal.',
215
- sound: false,
216
- },
217
- 'video-kling-v3-0-std-image': {
218
- duration: 5,
219
- image: 'https://example.com/start-frame.png',
220
- prompt: 'Animate the product in a clean realistic vertical scene.',
221
- sound: false,
222
- },
223
- 'video-kling-v3-0-std-text': {
224
- aspect_ratio: '9:16',
225
- duration: 5,
226
- prompt: 'A realistic vertical short-form product reveal.',
227
- sound: false,
228
- },
229
- 'video-wanx2-1-i2v-turbo': {
230
- aspect_ratio: '9:16',
231
- duration: 5,
232
- image: 'https://example.com/start-frame.png',
233
- prompt: 'A realistic vertical short-form product reveal.',
234
- resolution: '720p',
235
- },
236
- 'video-wanx2-1-t2v-turbo': {
237
- aspect_ratio: '9:16',
238
- duration: 5,
239
- prompt: 'A realistic vertical short-form product reveal.',
240
- resolution: '720p',
241
- },
242
- 'video-seedance-2-image': {
243
- duration: 5,
244
- image: 'https://example.com/start-frame.png',
245
- prompt: 'A realistic vertical short-form product reveal.',
246
- resolution: '720p',
247
- },
248
- 'video-seedance-2-image-turbo': {
249
- duration: 5,
250
- image: 'https://example.com/start-frame.png',
251
- prompt: 'A realistic vertical short-form product reveal.',
252
- resolution: '720p',
253
- },
254
- 'video-seedance-2-text': {
255
- duration: 5,
256
- prompt: 'A realistic vertical short-form product reveal.',
257
- resolution: '720p',
258
- },
259
- 'video-seedance-2-text-turbo': {
260
- duration: 5,
261
- prompt: 'A realistic vertical short-form product reveal.',
262
- resolution: '720p',
263
- },
264
- 'voice-qwen3-clone': {
265
- reference_audio: 'https://example.com/reference-voice.wav',
266
- text: 'Short voiceover line to synthesize.',
267
- },
268
- 'voice-qwen3-design': {
269
- language: 'en',
270
- text: 'Short voiceover line to synthesize.',
271
- voiceDescription: 'Warm, clear, natural creator voice.',
272
- },
273
- };
274
- export const VIDEO_ANALYSIS_MODEL_HINTS = {
275
- 'gemini-video-analysis': {
276
- contents: [
277
- {
278
- parts: [
279
- {
280
- text: 'Analyze this short video and return concise creative observations.',
281
- },
282
- ],
283
- },
284
- ],
285
- },
286
- };