pupt 2.2.1 → 2.3.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/dist/cli.js +94 -58
- package/dist/cli.js.map +1 -1
- package/dist/commands/add.d.ts +4 -1
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +60 -11
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/cache.d.ts +9 -0
- package/dist/commands/cache.d.ts.map +1 -0
- package/dist/commands/cache.js +31 -0
- package/dist/commands/cache.js.map +1 -0
- package/dist/commands/config.d.ts +1 -2
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +30 -57
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/edit.d.ts.map +1 -1
- package/dist/commands/edit.js +5 -2
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/init-refactored.d.ts.map +1 -1
- package/dist/commands/init-refactored.js +0 -3
- package/dist/commands/init-refactored.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +59 -68
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.d.ts +9 -9
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +76 -178
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/review.d.ts.map +1 -1
- package/dist/commands/review.js +3 -1
- package/dist/commands/review.js.map +1 -1
- package/dist/commands/run.d.ts +2 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +13 -9
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/uninstall.d.ts +2 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +45 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +113 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/config/config-manager.d.ts +3 -10
- package/dist/config/config-manager.d.ts.map +1 -1
- package/dist/config/config-manager.js +23 -140
- package/dist/config/config-manager.js.map +1 -1
- package/dist/config/global-paths.d.ts +5 -0
- package/dist/config/global-paths.d.ts.map +1 -0
- package/dist/config/global-paths.js +16 -0
- package/dist/config/global-paths.js.map +1 -0
- package/dist/config/migration.d.ts.map +1 -1
- package/dist/config/migration.js +69 -1
- package/dist/config/migration.js.map +1 -1
- package/dist/schemas/config-schema.d.ts +863 -196
- package/dist/schemas/config-schema.d.ts.map +1 -1
- package/dist/schemas/config-schema.js +51 -27
- package/dist/schemas/config-schema.js.map +1 -1
- package/dist/services/input-collector.d.ts.map +1 -1
- package/dist/services/input-collector.js +7 -1
- package/dist/services/input-collector.js.map +1 -1
- package/dist/services/module-cache.d.ts +42 -0
- package/dist/services/module-cache.d.ts.map +1 -0
- package/dist/services/module-cache.js +205 -0
- package/dist/services/module-cache.js.map +1 -0
- package/dist/services/module-entry-builder.d.ts +20 -0
- package/dist/services/module-entry-builder.d.ts.map +1 -0
- package/dist/services/module-entry-builder.js +67 -0
- package/dist/services/module-entry-builder.js.map +1 -0
- package/dist/services/output-capture-service.d.ts.map +1 -1
- package/dist/services/output-capture-service.js +2 -1
- package/dist/services/output-capture-service.js.map +1 -1
- package/dist/services/package-manager.d.ts +18 -0
- package/dist/services/package-manager.d.ts.map +1 -0
- package/dist/services/package-manager.js +141 -0
- package/dist/services/package-manager.js.map +1 -0
- package/dist/services/prompt-resolver.d.ts +2 -2
- package/dist/services/prompt-resolver.d.ts.map +1 -1
- package/dist/services/prompt-resolver.js +9 -10
- package/dist/services/prompt-resolver.js.map +1 -1
- package/dist/services/pupt-prompt-source.d.ts +16 -0
- package/dist/services/pupt-prompt-source.d.ts.map +1 -0
- package/dist/services/pupt-prompt-source.js +73 -0
- package/dist/services/pupt-prompt-source.js.map +1 -0
- package/dist/services/pupt-service.d.ts +11 -25
- package/dist/services/pupt-service.d.ts.map +1 -1
- package/dist/services/pupt-service.js +31 -179
- package/dist/services/pupt-service.js.map +1 -1
- package/dist/services/review-data-builder.d.ts +4 -1
- package/dist/services/review-data-builder.d.ts.map +1 -1
- package/dist/services/review-data-builder.js +4 -2
- package/dist/services/review-data-builder.js.map +1 -1
- package/dist/types/config.d.ts +35 -19
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +3 -4
- package/dist/types/config.js.map +1 -1
- package/dist/utils/prompt-dir-resolver.d.ts +5 -0
- package/dist/utils/prompt-dir-resolver.d.ts.map +1 -0
- package/dist/utils/prompt-dir-resolver.js +24 -0
- package/dist/utils/prompt-dir-resolver.js.map +1 -0
- package/package.json +3 -2
- package/dist/utils/path-utils.d.ts +0 -42
- package/dist/utils/path-utils.d.ts.map +0 -1
- package/dist/utils/path-utils.js +0 -139
- package/dist/utils/path-utils.js.map +0 -1
- package/dist/utils/prompt-format.d.ts +0 -27
- package/dist/utils/prompt-format.d.ts.map +0 -1
- package/dist/utils/prompt-format.js +0 -28
- package/dist/utils/prompt-format.js.map +0 -1
package/dist/utils/path-utils.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utilities for converting paths to portable format for config files.
|
|
3
|
-
*
|
|
4
|
-
* When saving configs, absolute paths should be converted to portable formats:
|
|
5
|
-
* - Paths under project root → ${projectRoot}/...
|
|
6
|
-
* - Paths under home directory → ~/...
|
|
7
|
-
* - Already relative paths → kept as-is
|
|
8
|
-
* - Other absolute paths → kept as-is with warning
|
|
9
|
-
*/
|
|
10
|
-
import path from 'node:path';
|
|
11
|
-
import fs from 'node:fs';
|
|
12
|
-
import os from 'node:os';
|
|
13
|
-
import { findProjectRoot } from './project-root.js';
|
|
14
|
-
import { logger } from './logger.js';
|
|
15
|
-
/**
|
|
16
|
-
* Resolve symlinks in a path, even if the leaf segments don't exist.
|
|
17
|
-
* Walks up to the nearest existing ancestor, resolves it, then re-appends
|
|
18
|
-
* the non-existent tail. This handles macOS /var -> /private/var symlink
|
|
19
|
-
* differences when the target path (e.g. a prompt directory) hasn't been
|
|
20
|
-
* created yet.
|
|
21
|
-
*/
|
|
22
|
-
function safeRealpath(p) {
|
|
23
|
-
try {
|
|
24
|
-
return fs.realpathSync(p);
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
const parent = path.dirname(p);
|
|
28
|
-
if (parent === p) {
|
|
29
|
-
// Reached filesystem root — nothing more to resolve
|
|
30
|
-
return p;
|
|
31
|
-
}
|
|
32
|
-
return path.join(safeRealpath(parent), path.basename(p));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Contract a single path to a portable format.
|
|
37
|
-
*
|
|
38
|
-
* Priority:
|
|
39
|
-
* 1. Already relative paths → keep as-is
|
|
40
|
-
* 2. Paths under project root → ${projectRoot}/...
|
|
41
|
-
* 3. Paths under home directory → ~/...
|
|
42
|
-
* 4. Other absolute paths → keep as-is (with optional warning)
|
|
43
|
-
*/
|
|
44
|
-
export function contractPath(filepath, options = {}) {
|
|
45
|
-
const { configDir = process.cwd(), warnOnAbsolute = true } = options;
|
|
46
|
-
// Already relative path - keep as-is
|
|
47
|
-
if (!path.isAbsolute(filepath)) {
|
|
48
|
-
return { path: filepath, warned: false };
|
|
49
|
-
}
|
|
50
|
-
// Already uses ${projectRoot} or ~ - keep as-is
|
|
51
|
-
if (filepath.includes('${projectRoot}') || filepath.startsWith('~/')) {
|
|
52
|
-
return { path: filepath, warned: false };
|
|
53
|
-
}
|
|
54
|
-
const homeDir = os.homedir();
|
|
55
|
-
const projectRoot = findProjectRoot(configDir);
|
|
56
|
-
// Resolve symlinks for comparison (handles macOS /var -> /private/var)
|
|
57
|
-
const resolvedPath = safeRealpath(filepath);
|
|
58
|
-
// Check if path is under project root (prefer this over home)
|
|
59
|
-
if (projectRoot) {
|
|
60
|
-
const resolvedProjectRoot = safeRealpath(projectRoot);
|
|
61
|
-
if (resolvedPath.startsWith(resolvedProjectRoot + path.sep) || resolvedPath === resolvedProjectRoot) {
|
|
62
|
-
const relativePath = path.relative(resolvedProjectRoot, resolvedPath);
|
|
63
|
-
// Use forward slashes for cross-platform compatibility in config
|
|
64
|
-
const portablePath = relativePath.split(path.sep).join('/');
|
|
65
|
-
return {
|
|
66
|
-
path: portablePath ? `\${projectRoot}/${portablePath}` : '${projectRoot}',
|
|
67
|
-
warned: false
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// Check if path is under home directory
|
|
72
|
-
const resolvedHomeDir = safeRealpath(homeDir);
|
|
73
|
-
if (resolvedPath.startsWith(resolvedHomeDir + path.sep) || resolvedPath === resolvedHomeDir) {
|
|
74
|
-
const relativePath = path.relative(resolvedHomeDir, resolvedPath);
|
|
75
|
-
// Use forward slashes for cross-platform compatibility
|
|
76
|
-
const portablePath = relativePath.split(path.sep).join('/');
|
|
77
|
-
return {
|
|
78
|
-
path: portablePath ? `~/${portablePath}` : '~',
|
|
79
|
-
warned: false
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
// Absolute path outside project and home - keep as-is but warn
|
|
83
|
-
if (warnOnAbsolute) {
|
|
84
|
-
logger.warn(`Path "${filepath}" is absolute and outside the project root. ` +
|
|
85
|
-
`This path will not be portable across machines. ` +
|
|
86
|
-
`Consider using a relative path, ~/..., or \${projectRoot}/...`);
|
|
87
|
-
}
|
|
88
|
-
return { path: filepath, warned: true };
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Check if a path is absolute and could be made portable.
|
|
92
|
-
* Used for warning users on config load.
|
|
93
|
-
*/
|
|
94
|
-
export function isNonPortableAbsolutePath(filepath, configDir) {
|
|
95
|
-
// Not absolute - it's fine
|
|
96
|
-
if (!path.isAbsolute(filepath)) {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
// Uses portable variables - it's fine
|
|
100
|
-
if (filepath.includes('${projectRoot}') || filepath.startsWith('~/')) {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
const homeDir = os.homedir();
|
|
104
|
-
const projectRoot = findProjectRoot(configDir || process.cwd());
|
|
105
|
-
const resolvedPath = safeRealpath(filepath);
|
|
106
|
-
// Check if it could be made portable
|
|
107
|
-
if (projectRoot) {
|
|
108
|
-
const resolvedProjectRoot = safeRealpath(projectRoot);
|
|
109
|
-
if (resolvedPath.startsWith(resolvedProjectRoot + path.sep)) {
|
|
110
|
-
return true; // Could use ${projectRoot}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
const resolvedHomeDir = safeRealpath(homeDir);
|
|
114
|
-
if (resolvedPath.startsWith(resolvedHomeDir + path.sep)) {
|
|
115
|
-
return true; // Could use ~/
|
|
116
|
-
}
|
|
117
|
-
// Absolute but can't be made portable - still flag it
|
|
118
|
-
return true;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Warn about non-portable paths in a config.
|
|
122
|
-
* Call this when loading a config to alert users.
|
|
123
|
-
*/
|
|
124
|
-
export function warnAboutNonPortablePaths(paths, configFilePath) {
|
|
125
|
-
const configDir = configFilePath ? path.dirname(configFilePath) : process.cwd();
|
|
126
|
-
const nonPortable = [];
|
|
127
|
-
for (const p of paths) {
|
|
128
|
-
if (p && isNonPortableAbsolutePath(p, configDir)) {
|
|
129
|
-
nonPortable.push(p);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (nonPortable.length > 0) {
|
|
133
|
-
logger.warn(`Your config contains absolute paths that may not be portable:\n` +
|
|
134
|
-
nonPortable.map(p => ` - ${p}`).join('\n') + '\n' +
|
|
135
|
-
`These will be converted to portable format next time the config is saved.\n` +
|
|
136
|
-
`To fix manually, use relative paths, ~/..., or \${projectRoot}/...`);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
//# sourceMappingURL=path-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path-utils.js","sourceRoot":"","sources":["../../src/utils/path-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,E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AACd,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAA6B,EAC7B,cAAuB;IAEvB,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;IAChF,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,IAAI,yBAAyB,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC;YACjD,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IAED,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,CAAC,IAAI,CACT,iEAAiE;YACjE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI;YAClD,6EAA6E;YAC7E,oEAAoE,CACrE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prompt format types supported by pupt.
|
|
3
|
-
*
|
|
4
|
-
* - `jsx`: Build-time JSX, imported as ES modules (.tsx/.jsx files)
|
|
5
|
-
* - `jsx-runtime`: Runtime-parsed JSX via createPromptFromSource (.prompt files)
|
|
6
|
-
*/
|
|
7
|
-
export type PromptFormat = 'jsx' | 'jsx-runtime';
|
|
8
|
-
/**
|
|
9
|
-
* File extensions recognized as pupt-lib JSX prompt formats.
|
|
10
|
-
*/
|
|
11
|
-
export declare const PUPT_LIB_EXTENSIONS: string[];
|
|
12
|
-
/**
|
|
13
|
-
* All file extensions recognized as prompt files.
|
|
14
|
-
*/
|
|
15
|
-
export declare const ALL_PROMPT_EXTENSIONS: string[];
|
|
16
|
-
/**
|
|
17
|
-
* Detect the prompt format based on file extension.
|
|
18
|
-
*
|
|
19
|
-
* @param filePath - Path or filename to check
|
|
20
|
-
* @returns The detected prompt format
|
|
21
|
-
*/
|
|
22
|
-
export declare function detectPromptFormat(filePath: string): PromptFormat;
|
|
23
|
-
/**
|
|
24
|
-
* Check if a file is a pupt-lib prompt format.
|
|
25
|
-
*/
|
|
26
|
-
export declare function isPuptLibFormat(filePath: string): boolean;
|
|
27
|
-
//# sourceMappingURL=prompt-format.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-format.d.ts","sourceRoot":"","sources":["../../src/utils/prompt-format.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,aAAa,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,mBAAmB,UAA8B,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,qBAAqB,UAA2B,CAAC;AAE9D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAKjE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGzD"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File extensions recognized as pupt-lib JSX prompt formats.
|
|
3
|
-
*/
|
|
4
|
-
export const PUPT_LIB_EXTENSIONS = ['.tsx', '.jsx', '.prompt'];
|
|
5
|
-
/**
|
|
6
|
-
* All file extensions recognized as prompt files.
|
|
7
|
-
*/
|
|
8
|
-
export const ALL_PROMPT_EXTENSIONS = [...PUPT_LIB_EXTENSIONS];
|
|
9
|
-
/**
|
|
10
|
-
* Detect the prompt format based on file extension.
|
|
11
|
-
*
|
|
12
|
-
* @param filePath - Path or filename to check
|
|
13
|
-
* @returns The detected prompt format
|
|
14
|
-
*/
|
|
15
|
-
export function detectPromptFormat(filePath) {
|
|
16
|
-
if (filePath.endsWith('.tsx') || filePath.endsWith('.jsx')) {
|
|
17
|
-
return 'jsx';
|
|
18
|
-
}
|
|
19
|
-
return 'jsx-runtime';
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Check if a file is a pupt-lib prompt format.
|
|
23
|
-
*/
|
|
24
|
-
export function isPuptLibFormat(filePath) {
|
|
25
|
-
const format = detectPromptFormat(filePath);
|
|
26
|
-
return format === 'jsx' || format === 'jsx-runtime';
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=prompt-format.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-format.js","sourceRoot":"","sources":["../../src/utils/prompt-format.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AAE/D;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,GAAG,mBAAmB,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,MAAM,MAAM,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC5C,OAAO,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,aAAa,CAAC;AACtD,CAAC"}
|