pgpm 4.27.0 → 4.28.1
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/commands/init/index.js +40 -3
- package/esm/commands/init/index.js +41 -4
- package/package.json +5 -5
package/commands/init/index.js
CHANGED
|
@@ -36,6 +36,7 @@ Options:
|
|
|
36
36
|
--template, -t <path> Full template path (e.g., pnpm/module) - combines dir and fromPath
|
|
37
37
|
--boilerplate Prompt to select from available boilerplates
|
|
38
38
|
--create-workspace, -w Create a workspace first, then create the module inside it
|
|
39
|
+
--use-skills Use npx skills CLI for skill installation (slower, writes skills-lock.json)
|
|
39
40
|
|
|
40
41
|
Examples:
|
|
41
42
|
${binaryName} init Initialize new module (default)
|
|
@@ -65,6 +66,7 @@ async function handleInit(argv, prompter) {
|
|
|
65
66
|
const noTty = Boolean(argv.noTty || argv['no-tty'] || argv.tty === false || process.env.CI === 'true');
|
|
66
67
|
const useBoilerplatePrompt = Boolean(argv.boilerplate);
|
|
67
68
|
const createWorkspace = Boolean(argv.createWorkspace || argv['create-workspace'] || argv.w);
|
|
69
|
+
const useNpxSkills = Boolean(argv.useSkills || argv['use-skills']);
|
|
68
70
|
// Get fromPath from first positional arg
|
|
69
71
|
const positionalFromPath = argv._?.[0];
|
|
70
72
|
// Handle --template flag: parses "dir/fromPath" format and extracts both components
|
|
@@ -93,6 +95,7 @@ async function handleInit(argv, prompter) {
|
|
|
93
95
|
dir,
|
|
94
96
|
noTty,
|
|
95
97
|
cwd,
|
|
98
|
+
useNpxSkills,
|
|
96
99
|
});
|
|
97
100
|
}
|
|
98
101
|
// Regular init path: --template takes precedence, then positional arg, then default to 'module'
|
|
@@ -118,6 +121,7 @@ async function handleInit(argv, prompter) {
|
|
|
118
121
|
dir,
|
|
119
122
|
noTty,
|
|
120
123
|
cwd,
|
|
124
|
+
useNpxSkills,
|
|
121
125
|
});
|
|
122
126
|
}
|
|
123
127
|
// Default to module init (for 'module' type, 'generic' type, or unknown types)
|
|
@@ -130,6 +134,7 @@ async function handleInit(argv, prompter) {
|
|
|
130
134
|
cwd,
|
|
131
135
|
requiresWorkspace: inspection.config?.requiresWorkspace,
|
|
132
136
|
createWorkspace,
|
|
137
|
+
useNpxSkills,
|
|
133
138
|
}, wasExplicitModuleRequest);
|
|
134
139
|
}
|
|
135
140
|
async function handleBoilerplateInit(argv, prompter, ctx) {
|
|
@@ -195,6 +200,7 @@ async function handleBoilerplateInit(argv, prompter, ctx) {
|
|
|
195
200
|
dir: ctx.dir,
|
|
196
201
|
noTty: ctx.noTty,
|
|
197
202
|
cwd: ctx.cwd,
|
|
203
|
+
useNpxSkills: ctx.useNpxSkills,
|
|
198
204
|
});
|
|
199
205
|
}
|
|
200
206
|
// Default to module init (for 'module' type, 'generic' type, or unknown types)
|
|
@@ -207,9 +213,40 @@ async function handleBoilerplateInit(argv, prompter, ctx) {
|
|
|
207
213
|
noTty: ctx.noTty,
|
|
208
214
|
cwd: ctx.cwd,
|
|
209
215
|
requiresWorkspace: inspection.config?.requiresWorkspace,
|
|
216
|
+
useNpxSkills: ctx.useNpxSkills,
|
|
210
217
|
}, true);
|
|
211
218
|
}
|
|
212
|
-
function installSkills(skills, cwd) {
|
|
219
|
+
function installSkills(skills, cwd, useNpxSkills) {
|
|
220
|
+
if (process.env.PGPM_SKIP_SKILL_INSTALL)
|
|
221
|
+
return;
|
|
222
|
+
if (useNpxSkills) {
|
|
223
|
+
installSkillsViaNpx(skills, cwd);
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
installSkillsBuiltin(skills, cwd);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function installSkillsBuiltin(skills, cwd) {
|
|
230
|
+
const installer = new core_1.SkillInstaller({ toolName: core_1.DEFAULT_TEMPLATE_TOOL_NAME });
|
|
231
|
+
const result = installer.install(skills, cwd);
|
|
232
|
+
if (result.installed.length > 0) {
|
|
233
|
+
for (const name of result.installed) {
|
|
234
|
+
process.stdout.write(` installed ${name}\n`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (result.failed.length > 0) {
|
|
238
|
+
process.stdout.write('\n⚠️ Some skills could not be installed automatically.\n');
|
|
239
|
+
process.stdout.write('Run the following commands manually:\n\n');
|
|
240
|
+
for (const f of result.failed) {
|
|
241
|
+
const source = f.source.includes('://')
|
|
242
|
+
? f.source
|
|
243
|
+
: `https://github.com/${f.source}`;
|
|
244
|
+
process.stdout.write(` npx skills add ${source} --skill ${f.skill}\n`);
|
|
245
|
+
}
|
|
246
|
+
process.stdout.write('\n');
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function installSkillsViaNpx(skills, cwd) {
|
|
213
250
|
const failed = [];
|
|
214
251
|
for (const entry of skills) {
|
|
215
252
|
const source = entry.source.includes('://')
|
|
@@ -294,7 +331,7 @@ async function handleWorkspaceInit(argv, prompter, ctx) {
|
|
|
294
331
|
});
|
|
295
332
|
if (templateInfo.config?.skills?.length) {
|
|
296
333
|
process.stdout.write('\n📦 Installing skills...\n\n');
|
|
297
|
-
installSkills(templateInfo.config.skills, targetPath);
|
|
334
|
+
installSkills(templateInfo.config.skills, targetPath, Boolean(ctx.useNpxSkills));
|
|
298
335
|
}
|
|
299
336
|
const relPath = path_1.default.relative(process.cwd(), targetPath);
|
|
300
337
|
process.stdout.write(`\n✨ Enjoy!\n\ncd ./${relPath}\n`);
|
|
@@ -555,7 +592,7 @@ async function handleModuleInit(argv, prompter, ctx, wasExplicitModuleRequest =
|
|
|
555
592
|
if (moduleTemplateInfo.config?.skills?.length) {
|
|
556
593
|
const skillsCwd = project.workspacePath || modulePath;
|
|
557
594
|
process.stdout.write('\n📦 Installing skills...\n\n');
|
|
558
|
-
installSkills(moduleTemplateInfo.config.skills, skillsCwd);
|
|
595
|
+
installSkills(moduleTemplateInfo.config.skills, skillsCwd, Boolean(ctx.useNpxSkills));
|
|
559
596
|
}
|
|
560
597
|
const relPath = path_1.default.relative(process.cwd(), modulePath);
|
|
561
598
|
process.stdout.write(`\n✨ Enjoy!\n\ncd ./${relPath}\n`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { execSync } from 'child_process';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
import { DEFAULT_TEMPLATE_REPO, DEFAULT_TEMPLATE_TOOL_NAME, inspectTemplate, PgpmPackage, resolveBoilerplateBaseDir, scaffoldTemplate, scanBoilerplates, sluggify, } from '@pgpmjs/core';
|
|
4
|
+
import { DEFAULT_TEMPLATE_REPO, DEFAULT_TEMPLATE_TOOL_NAME, inspectTemplate, PgpmPackage, resolveBoilerplateBaseDir, scaffoldTemplate, scanBoilerplates, SkillInstaller, sluggify, } from '@pgpmjs/core';
|
|
5
5
|
import { resolveWorkspaceByType } from '@pgpmjs/env';
|
|
6
6
|
import { errors } from '@pgpmjs/types';
|
|
7
7
|
import { registerDefaultResolver } from 'inquirerer';
|
|
@@ -30,6 +30,7 @@ Options:
|
|
|
30
30
|
--template, -t <path> Full template path (e.g., pnpm/module) - combines dir and fromPath
|
|
31
31
|
--boilerplate Prompt to select from available boilerplates
|
|
32
32
|
--create-workspace, -w Create a workspace first, then create the module inside it
|
|
33
|
+
--use-skills Use npx skills CLI for skill installation (slower, writes skills-lock.json)
|
|
33
34
|
|
|
34
35
|
Examples:
|
|
35
36
|
${binaryName} init Initialize new module (default)
|
|
@@ -58,6 +59,7 @@ async function handleInit(argv, prompter) {
|
|
|
58
59
|
const noTty = Boolean(argv.noTty || argv['no-tty'] || argv.tty === false || process.env.CI === 'true');
|
|
59
60
|
const useBoilerplatePrompt = Boolean(argv.boilerplate);
|
|
60
61
|
const createWorkspace = Boolean(argv.createWorkspace || argv['create-workspace'] || argv.w);
|
|
62
|
+
const useNpxSkills = Boolean(argv.useSkills || argv['use-skills']);
|
|
61
63
|
// Get fromPath from first positional arg
|
|
62
64
|
const positionalFromPath = argv._?.[0];
|
|
63
65
|
// Handle --template flag: parses "dir/fromPath" format and extracts both components
|
|
@@ -86,6 +88,7 @@ async function handleInit(argv, prompter) {
|
|
|
86
88
|
dir,
|
|
87
89
|
noTty,
|
|
88
90
|
cwd,
|
|
91
|
+
useNpxSkills,
|
|
89
92
|
});
|
|
90
93
|
}
|
|
91
94
|
// Regular init path: --template takes precedence, then positional arg, then default to 'module'
|
|
@@ -111,6 +114,7 @@ async function handleInit(argv, prompter) {
|
|
|
111
114
|
dir,
|
|
112
115
|
noTty,
|
|
113
116
|
cwd,
|
|
117
|
+
useNpxSkills,
|
|
114
118
|
});
|
|
115
119
|
}
|
|
116
120
|
// Default to module init (for 'module' type, 'generic' type, or unknown types)
|
|
@@ -123,6 +127,7 @@ async function handleInit(argv, prompter) {
|
|
|
123
127
|
cwd,
|
|
124
128
|
requiresWorkspace: inspection.config?.requiresWorkspace,
|
|
125
129
|
createWorkspace,
|
|
130
|
+
useNpxSkills,
|
|
126
131
|
}, wasExplicitModuleRequest);
|
|
127
132
|
}
|
|
128
133
|
async function handleBoilerplateInit(argv, prompter, ctx) {
|
|
@@ -188,6 +193,7 @@ async function handleBoilerplateInit(argv, prompter, ctx) {
|
|
|
188
193
|
dir: ctx.dir,
|
|
189
194
|
noTty: ctx.noTty,
|
|
190
195
|
cwd: ctx.cwd,
|
|
196
|
+
useNpxSkills: ctx.useNpxSkills,
|
|
191
197
|
});
|
|
192
198
|
}
|
|
193
199
|
// Default to module init (for 'module' type, 'generic' type, or unknown types)
|
|
@@ -200,9 +206,40 @@ async function handleBoilerplateInit(argv, prompter, ctx) {
|
|
|
200
206
|
noTty: ctx.noTty,
|
|
201
207
|
cwd: ctx.cwd,
|
|
202
208
|
requiresWorkspace: inspection.config?.requiresWorkspace,
|
|
209
|
+
useNpxSkills: ctx.useNpxSkills,
|
|
203
210
|
}, true);
|
|
204
211
|
}
|
|
205
|
-
function installSkills(skills, cwd) {
|
|
212
|
+
function installSkills(skills, cwd, useNpxSkills) {
|
|
213
|
+
if (process.env.PGPM_SKIP_SKILL_INSTALL)
|
|
214
|
+
return;
|
|
215
|
+
if (useNpxSkills) {
|
|
216
|
+
installSkillsViaNpx(skills, cwd);
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
installSkillsBuiltin(skills, cwd);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function installSkillsBuiltin(skills, cwd) {
|
|
223
|
+
const installer = new SkillInstaller({ toolName: DEFAULT_TEMPLATE_TOOL_NAME });
|
|
224
|
+
const result = installer.install(skills, cwd);
|
|
225
|
+
if (result.installed.length > 0) {
|
|
226
|
+
for (const name of result.installed) {
|
|
227
|
+
process.stdout.write(` installed ${name}\n`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (result.failed.length > 0) {
|
|
231
|
+
process.stdout.write('\n⚠️ Some skills could not be installed automatically.\n');
|
|
232
|
+
process.stdout.write('Run the following commands manually:\n\n');
|
|
233
|
+
for (const f of result.failed) {
|
|
234
|
+
const source = f.source.includes('://')
|
|
235
|
+
? f.source
|
|
236
|
+
: `https://github.com/${f.source}`;
|
|
237
|
+
process.stdout.write(` npx skills add ${source} --skill ${f.skill}\n`);
|
|
238
|
+
}
|
|
239
|
+
process.stdout.write('\n');
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function installSkillsViaNpx(skills, cwd) {
|
|
206
243
|
const failed = [];
|
|
207
244
|
for (const entry of skills) {
|
|
208
245
|
const source = entry.source.includes('://')
|
|
@@ -287,7 +324,7 @@ async function handleWorkspaceInit(argv, prompter, ctx) {
|
|
|
287
324
|
});
|
|
288
325
|
if (templateInfo.config?.skills?.length) {
|
|
289
326
|
process.stdout.write('\n📦 Installing skills...\n\n');
|
|
290
|
-
installSkills(templateInfo.config.skills, targetPath);
|
|
327
|
+
installSkills(templateInfo.config.skills, targetPath, Boolean(ctx.useNpxSkills));
|
|
291
328
|
}
|
|
292
329
|
const relPath = path.relative(process.cwd(), targetPath);
|
|
293
330
|
process.stdout.write(`\n✨ Enjoy!\n\ncd ./${relPath}\n`);
|
|
@@ -548,7 +585,7 @@ async function handleModuleInit(argv, prompter, ctx, wasExplicitModuleRequest =
|
|
|
548
585
|
if (moduleTemplateInfo.config?.skills?.length) {
|
|
549
586
|
const skillsCwd = project.workspacePath || modulePath;
|
|
550
587
|
process.stdout.write('\n📦 Installing skills...\n\n');
|
|
551
|
-
installSkills(moduleTemplateInfo.config.skills, skillsCwd);
|
|
588
|
+
installSkills(moduleTemplateInfo.config.skills, skillsCwd, Boolean(ctx.useNpxSkills));
|
|
552
589
|
}
|
|
553
590
|
const relPath = path.relative(process.cwd(), modulePath);
|
|
554
591
|
process.stdout.write(`\n✨ Enjoy!\n\ncd ./${relPath}\n`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pgpm",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.28.1",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "PostgreSQL Package Manager - Database migration and package management CLI",
|
|
6
6
|
"main": "index.js",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@inquirerer/utils": "^3.3.7",
|
|
49
|
-
"@pgpmjs/core": "^6.
|
|
49
|
+
"@pgpmjs/core": "^6.24.0",
|
|
50
50
|
"@pgpmjs/env": "^2.25.0",
|
|
51
|
-
"@pgpmjs/export": "^0.21.
|
|
51
|
+
"@pgpmjs/export": "^0.21.4",
|
|
52
52
|
"@pgpmjs/logger": "^2.12.0",
|
|
53
53
|
"@pgpmjs/types": "^2.29.0",
|
|
54
54
|
"@pgsql/quotes": "^17.1.0",
|
|
55
55
|
"appstash": "^0.7.0",
|
|
56
56
|
"find-and-require-package-json": "^0.9.1",
|
|
57
|
-
"genomic": "^5.
|
|
57
|
+
"genomic": "^5.6.0",
|
|
58
58
|
"inquirerer": "^4.8.1",
|
|
59
59
|
"js-yaml": "^4.1.0",
|
|
60
60
|
"pg-cache": "^3.12.0",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"pg",
|
|
77
77
|
"pgsql"
|
|
78
78
|
],
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "6d810d1b800a6e70ef25749415b69de17b066e50"
|
|
80
80
|
}
|