@promptscript/cli 1.0.0-alpha.6 → 1.0.0-alpha.8
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/CHANGELOG.md +19 -0
- package/README.md +36 -0
- package/index.js +1528 -540
- package/package.json +2 -2
- package/src/cli.d.ts.map +1 -1
- package/src/commands/compile.d.ts.map +1 -1
- package/src/commands/diff.d.ts.map +1 -1
- package/src/commands/init.d.ts.map +1 -1
- package/src/commands/update-check.d.ts +6 -0
- package/src/commands/update-check.d.ts.map +1 -0
- package/src/commands/validate.d.ts.map +1 -1
- package/src/index.d.ts +3 -0
- package/src/index.d.ts.map +1 -1
- package/src/types.d.ts +0 -2
- package/src/types.d.ts.map +1 -1
- package/src/utils/manifest-loader.d.ts +157 -0
- package/src/utils/manifest-loader.d.ts.map +1 -0
- package/src/utils/registry-resolver.d.ts +41 -0
- package/src/utils/registry-resolver.d.ts.map +1 -0
- package/src/utils/suggestion-engine.d.ts +56 -0
- package/src/utils/suggestion-engine.d.ts.map +1 -0
- package/src/utils/version-check.d.ts +48 -0
- package/src/utils/version-check.d.ts.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptscript/cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.8",
|
|
4
4
|
"description": "CLI for PromptScript - standardize AI instructions across GitHub Copilot, Claude, Cursor and other AI tools",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"chalk": "^5.6.2",
|
|
45
45
|
"chokidar": "^5.0.0",
|
|
46
46
|
"commander": "^14.0.2",
|
|
47
|
-
"ora": "^9.
|
|
47
|
+
"ora": "^9.1.0",
|
|
48
48
|
"yaml": "^2.8.2",
|
|
49
49
|
"simple-git": "^3.22.0"
|
|
50
50
|
}
|
package/src/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../../packages/cli/src/cli.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../../packages/cli/src/cli.ts"],"names":[],"mappings":";AA6HA;;;GAGG;AACH,wBAAgB,GAAG,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,IAAI,CAEvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/compile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQlD,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/compile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQlD,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AA8RzE;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,cAAc,EACvB,QAAQ,GAAE,WAAqC,GAC9C,OAAO,CAAC,IAAI,CAAC,CA+Ff"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/diff.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/diff.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAmG/C;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA8ErE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/init.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAKzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/init.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAKzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA6D/C;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,QAAQ,GAAE,WAAqC,GAC9C,OAAO,CAAC,IAAI,CAAC,CA+Kf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-check.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/update-check.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAsBxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/validate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/validate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA2InD;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAiD7E"}
|
package/src/index.d.ts
CHANGED
|
@@ -13,8 +13,11 @@ export { validateCommand } from './commands/validate.js';
|
|
|
13
13
|
export { pullCommand } from './commands/pull.js';
|
|
14
14
|
export { diffCommand } from './commands/diff.js';
|
|
15
15
|
export { checkCommand } from './commands/check.js';
|
|
16
|
+
export { updateCheckCommand } from './commands/update-check.js';
|
|
16
17
|
export { loadConfig, findConfigFile, CONFIG_FILES } from './config/loader.js';
|
|
17
18
|
export { ConsoleOutput, createSpinner, LogLevel, setContext, getContext, isVerbose, isQuiet, } from './output/console.js';
|
|
18
19
|
export type { CLIContext } from './output/console.js';
|
|
20
|
+
export { checkForUpdates, forceCheckForUpdates, fetchLatestVersion, getCacheDir, getCachePath, printUpdateNotification, } from './utils/version-check.js';
|
|
21
|
+
export type { UpdateInfo } from './utils/version-check.js';
|
|
19
22
|
export type { InitOptions, CompileOptions, ValidateOptions, PullOptions, DiffOptions, CheckOptions, } from './types.js';
|
|
20
23
|
//# sourceMappingURL=index.d.ts.map
|
package/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/cli/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAG/B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/cli/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAG/B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAG9E,OAAO,EACL,aAAa,EACb,aAAa,EACb,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,EACT,OAAO,GACR,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAG3D,YAAY,EACV,WAAW,EACX,cAAc,EACd,eAAe,EACf,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,YAAY,CAAC"}
|
package/src/types.d.ts
CHANGED
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../packages/cli/src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAA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ChB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,+BAA+B;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,kCAAkC;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,wCAAwC;IACxC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0CAA0C;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AAEH,MAAM,WAAW,YAAY;CAAG"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { RegistryManifest, CatalogEntry, NamespaceDefinition } from '@promptscript/core';
|
|
2
|
+
import type { CliServices } from '../services.js';
|
|
3
|
+
/**
|
|
4
|
+
* Official PromptScript Registry configuration.
|
|
5
|
+
*/
|
|
6
|
+
export declare const OFFICIAL_REGISTRY: {
|
|
7
|
+
readonly name: "PromptScript Official Registry";
|
|
8
|
+
readonly url: "https://github.com/mrwogu/promptscript-registry.git";
|
|
9
|
+
readonly branch: "main";
|
|
10
|
+
readonly manifestUrl: "https://raw.githubusercontent.com/mrwogu/promptscript-registry/main/registry-manifest.yaml";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Error thrown when manifest loading fails.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ManifestLoadError extends Error {
|
|
16
|
+
readonly originalCause?: Error;
|
|
17
|
+
constructor(message: string, cause?: Error);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Options for loading the manifest.
|
|
21
|
+
*/
|
|
22
|
+
export interface ManifestLoadOptions {
|
|
23
|
+
/** Registry path (local directory or git URL) */
|
|
24
|
+
registryPath?: string;
|
|
25
|
+
/** Cache the manifest in memory */
|
|
26
|
+
useCache?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Manifest loader result.
|
|
30
|
+
*/
|
|
31
|
+
export interface LoadedManifest {
|
|
32
|
+
/** The parsed manifest */
|
|
33
|
+
manifest: RegistryManifest;
|
|
34
|
+
/** Path to the manifest file */
|
|
35
|
+
path: string;
|
|
36
|
+
/** Whether it was loaded from cache */
|
|
37
|
+
cached: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Default manifest file name.
|
|
41
|
+
*/
|
|
42
|
+
export declare const MANIFEST_FILENAME = "registry-manifest.yaml";
|
|
43
|
+
/**
|
|
44
|
+
* Load the registry manifest from a registry path.
|
|
45
|
+
*
|
|
46
|
+
* @param options - Loading options
|
|
47
|
+
* @param services - CLI services for file operations
|
|
48
|
+
* @returns The loaded manifest with metadata
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const { manifest } = await loadManifest({
|
|
53
|
+
* registryPath: '../promptscript-registry'
|
|
54
|
+
* });
|
|
55
|
+
* console.log(manifest.meta.name);
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function loadManifest(options?: ManifestLoadOptions, services?: CliServices): Promise<LoadedManifest>;
|
|
59
|
+
/**
|
|
60
|
+
* Clear the manifest cache.
|
|
61
|
+
*/
|
|
62
|
+
export declare function clearManifestCache(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Get a catalog entry by ID.
|
|
65
|
+
*/
|
|
66
|
+
export declare function getCatalogEntry(manifest: RegistryManifest, id: string): CatalogEntry | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Get all catalog entries in a namespace.
|
|
69
|
+
*/
|
|
70
|
+
export declare function getCatalogEntriesByNamespace(manifest: RegistryManifest, namespace: string): CatalogEntry[];
|
|
71
|
+
/**
|
|
72
|
+
* Get all catalog entries with a specific tag.
|
|
73
|
+
*/
|
|
74
|
+
export declare function getCatalogEntriesByTag(manifest: RegistryManifest, tag: string): CatalogEntry[];
|
|
75
|
+
/**
|
|
76
|
+
* Get namespace definition.
|
|
77
|
+
*/
|
|
78
|
+
export declare function getNamespace(manifest: RegistryManifest, namespace: string): NamespaceDefinition | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Get all namespaces sorted by priority.
|
|
81
|
+
*/
|
|
82
|
+
export declare function getNamespacesSortedByPriority(manifest: RegistryManifest): Array<{
|
|
83
|
+
name: string;
|
|
84
|
+
definition: NamespaceDefinition;
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Search catalog entries by text.
|
|
88
|
+
*/
|
|
89
|
+
export declare function searchCatalog(manifest: RegistryManifest, query: string): CatalogEntry[];
|
|
90
|
+
/**
|
|
91
|
+
* Get the base directory of the registry from the manifest path.
|
|
92
|
+
*/
|
|
93
|
+
export declare function getRegistryBaseDir(manifestPath: string): string;
|
|
94
|
+
/**
|
|
95
|
+
* Resolve a catalog entry path to a full file path.
|
|
96
|
+
*/
|
|
97
|
+
export declare function resolveCatalogEntryPath(manifestPath: string, entry: CatalogEntry): string;
|
|
98
|
+
/**
|
|
99
|
+
* Remote manifest loader result.
|
|
100
|
+
*/
|
|
101
|
+
export interface RemoteLoadedManifest {
|
|
102
|
+
/** The parsed manifest */
|
|
103
|
+
manifest: RegistryManifest;
|
|
104
|
+
/** URL the manifest was loaded from */
|
|
105
|
+
url: string;
|
|
106
|
+
/** Whether it was loaded from cache */
|
|
107
|
+
cached: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Load manifest from a remote URL.
|
|
111
|
+
*
|
|
112
|
+
* @param url - URL to fetch manifest from (defaults to official registry)
|
|
113
|
+
* @param useCache - Whether to use in-memory cache
|
|
114
|
+
* @returns The loaded manifest with metadata
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* // Load from official registry
|
|
119
|
+
* const { manifest } = await loadManifestFromUrl();
|
|
120
|
+
*
|
|
121
|
+
* // Load from custom URL
|
|
122
|
+
* const { manifest } = await loadManifestFromUrl('https://example.com/registry-manifest.yaml');
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export declare function loadManifestFromUrl(url?: string, useCache?: boolean): Promise<RemoteLoadedManifest>;
|
|
126
|
+
/**
|
|
127
|
+
* Convert a GitHub repository URL to a raw manifest URL.
|
|
128
|
+
*
|
|
129
|
+
* @param repoUrl - GitHub repository URL
|
|
130
|
+
* @param branch - Branch name (default: main)
|
|
131
|
+
* @returns Raw URL for the manifest file
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* const url = githubRepoToManifestUrl('https://github.com/user/registry.git');
|
|
136
|
+
* // Returns: https://raw.githubusercontent.com/user/registry/main/registry-manifest.yaml
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
export declare function githubRepoToManifestUrl(repoUrl: string, branch?: string): string;
|
|
140
|
+
/**
|
|
141
|
+
* Check if a URL points to a remote resource.
|
|
142
|
+
*/
|
|
143
|
+
export declare function isRemoteUrl(path: string): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Validate that a URL hostname matches one of the known Git hosting providers.
|
|
146
|
+
* Uses proper URL parsing to prevent hostname spoofing attacks.
|
|
147
|
+
*/
|
|
148
|
+
export declare function isValidGitHostUrl(url: string): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Validate that a URL is a valid Git repository URL.
|
|
151
|
+
* Optionally restricts to a list of allowed hosts for security.
|
|
152
|
+
*
|
|
153
|
+
* @param url - The URL to validate
|
|
154
|
+
* @param allowedHosts - Optional list of allowed hostnames. If not provided, any valid URL is accepted.
|
|
155
|
+
*/
|
|
156
|
+
export declare function isValidGitUrl(url: string, allowedHosts?: string[]): boolean;
|
|
157
|
+
//# sourceMappingURL=manifest-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-loader.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/utils/manifest-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;CAMpB,CAAC;AAEX;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,SAAgB,aAAa,CAAC,EAAE,KAAK,CAAC;gBAE1B,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAK3C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,0BAA0B;IAC1B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,gCAAgC;IAChC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;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,0BAA0B;IAC1B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,GAAE,MAAsC,EAC3C,QAAQ,GAAE,OAAc,GACvB,OAAO,CAAC,oBAAoB,CAAC,CAiD/B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,MAAe,GAAG,MAAM,CASxF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAWjD;AAOD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAiC3E"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry resolver utility for CLI commands.
|
|
3
|
+
*
|
|
4
|
+
* Handles resolving registry configuration to a local path that the compiler can use.
|
|
5
|
+
* For git registries, this ensures the repository is cloned/updated in the cache.
|
|
6
|
+
*/
|
|
7
|
+
import type { PromptScriptConfig } from '@promptscript/core';
|
|
8
|
+
/**
|
|
9
|
+
* Result of resolving the registry path.
|
|
10
|
+
*/
|
|
11
|
+
export interface ResolvedRegistry {
|
|
12
|
+
/** Path to the registry root (for use with compiler) */
|
|
13
|
+
path: string;
|
|
14
|
+
/** Whether the registry was fetched from a remote source */
|
|
15
|
+
isRemote: boolean;
|
|
16
|
+
/** Source type of the registry */
|
|
17
|
+
source: 'local' | 'git' | 'http';
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the registry configuration to a local path.
|
|
21
|
+
*
|
|
22
|
+
* For git registries, this ensures the repository is cloned to the cache
|
|
23
|
+
* and returns the cache path. For local registries, returns the configured path.
|
|
24
|
+
*
|
|
25
|
+
* @param config - The PromptScript configuration
|
|
26
|
+
* @returns Resolved registry information with local path
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveRegistryPath(config: PromptScriptConfig): Promise<ResolvedRegistry>;
|
|
29
|
+
/**
|
|
30
|
+
* Get the git cache path for a URL and ref without cloning.
|
|
31
|
+
* Useful for checking if a cache exists.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getGitCachePath(url: string, ref?: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Check if the registry is configured and accessible.
|
|
36
|
+
* Accepts any config object with an optional registry field.
|
|
37
|
+
*/
|
|
38
|
+
export declare function hasRegistryConfig(config: {
|
|
39
|
+
registry?: PromptScriptConfig['registry'];
|
|
40
|
+
}): boolean;
|
|
41
|
+
//# sourceMappingURL=registry-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-resolver.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/utils/registry-resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAQ7D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,QAAQ,EAAE,OAAO,CAAC;IAClB,kCAAkC;IAClC,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;CAClC;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAwF/F;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAAe,GAAG,MAAM,CAKzE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAA;CAAE,GAAG,OAAO,CAEhG"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { RegistryManifest, SuggestionResult, ProjectContext, CatalogEntry } from '@promptscript/core';
|
|
2
|
+
import type { ProjectInfo } from './project-detector.js';
|
|
3
|
+
import type { CliServices } from '../services.js';
|
|
4
|
+
/**
|
|
5
|
+
* Build project context from detected project info.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildProjectContext(projectInfo: ProjectInfo, services?: CliServices): Promise<ProjectContext>;
|
|
8
|
+
/**
|
|
9
|
+
* Calculate suggestions based on project context and manifest rules.
|
|
10
|
+
*
|
|
11
|
+
* @param manifest - The registry manifest with suggestion rules
|
|
12
|
+
* @param context - Project context with detected features
|
|
13
|
+
* @returns Suggestions with reasoning
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const suggestions = calculateSuggestions(manifest, {
|
|
18
|
+
* files: ['package.json', 'tsconfig.json'],
|
|
19
|
+
* dependencies: ['react', 'typescript'],
|
|
20
|
+
* languages: ['typescript'],
|
|
21
|
+
* frameworks: ['react']
|
|
22
|
+
* });
|
|
23
|
+
* // suggestions.inherit = '@stacks/react'
|
|
24
|
+
* // suggestions.use = ['@fragments/testing', '@fragments/typescript']
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function calculateSuggestions(manifest: RegistryManifest, context: ProjectContext): SuggestionResult;
|
|
28
|
+
/**
|
|
29
|
+
* Get catalog entries that match detection hints for a project context.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getMatchingCatalogEntries(manifest: RegistryManifest, context: ProjectContext): Array<{
|
|
32
|
+
entry: CatalogEntry;
|
|
33
|
+
reason: string;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Format suggestion result for display.
|
|
37
|
+
*/
|
|
38
|
+
export declare function formatSuggestionResult(result: SuggestionResult): string[];
|
|
39
|
+
/**
|
|
40
|
+
* Create interactive choices from suggestions.
|
|
41
|
+
*/
|
|
42
|
+
export declare function createSuggestionChoices(manifest: RegistryManifest, result: SuggestionResult): Array<{
|
|
43
|
+
name: string;
|
|
44
|
+
value: string;
|
|
45
|
+
checked: boolean;
|
|
46
|
+
description?: string;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Parse selected choices back into a suggestion result.
|
|
50
|
+
*/
|
|
51
|
+
export declare function parseSelectedChoices(selected: string[]): {
|
|
52
|
+
inherit?: string;
|
|
53
|
+
use: string[];
|
|
54
|
+
skills: string[];
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=suggestion-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggestion-engine.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/utils/suggestion-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEhB,gBAAgB,EAEhB,cAAc,EACd,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,WAAW,EACxB,QAAQ,GAAE,WAAqC,GAC9C,OAAO,CAAC,cAAc,CAAC,CAUzB;AA+DD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,cAAc,GACtB,gBAAgB,CAgElB;AAwFD;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,cAAc,GACtB,KAAK,CAAC;IAAE,KAAK,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAoDhD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAwBzE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,gBAAgB,GACvB,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAsChF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAiBA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result of a version check.
|
|
3
|
+
*/
|
|
4
|
+
export interface UpdateInfo {
|
|
5
|
+
currentVersion: string;
|
|
6
|
+
latestVersion: string;
|
|
7
|
+
updateAvailable: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get the cache directory path.
|
|
11
|
+
* Uses ~/.promptscript/.cache/ for consistency with Git registry cache.
|
|
12
|
+
*
|
|
13
|
+
* - All platforms: ~/.promptscript/.cache/
|
|
14
|
+
*/
|
|
15
|
+
export declare function getCacheDir(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Get the full path to the version cache file.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getCachePath(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Fetch the latest version from npm registry.
|
|
22
|
+
* Returns null on any network error.
|
|
23
|
+
*/
|
|
24
|
+
export declare function fetchLatestVersion(): Promise<string | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Check for updates automatically (respects cache).
|
|
27
|
+
* Called from preAction hook.
|
|
28
|
+
*
|
|
29
|
+
* @param currentVersion - The current CLI version
|
|
30
|
+
* @returns Update info if a newer version is available, null otherwise
|
|
31
|
+
*/
|
|
32
|
+
export declare function checkForUpdates(currentVersion: string): Promise<UpdateInfo | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Force check for updates (ignores cache).
|
|
35
|
+
* Used by the update-check command.
|
|
36
|
+
*
|
|
37
|
+
* @param currentVersion - The current CLI version
|
|
38
|
+
* @returns Update info with check result
|
|
39
|
+
*/
|
|
40
|
+
export declare function forceCheckForUpdates(currentVersion: string): Promise<{
|
|
41
|
+
info: UpdateInfo | null;
|
|
42
|
+
error: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Print the update notification message.
|
|
46
|
+
*/
|
|
47
|
+
export declare function printUpdateNotification(info: UpdateInfo): void;
|
|
48
|
+
//# sourceMappingURL=version-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-check.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/utils/version-check.ts"],"names":[],"mappings":"AAkBA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AA+CD;;;GAGG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA+BjE;AAoCD;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAgDxF;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC;IAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,CAwBtD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAI9D"}
|