@promptscript/cli 1.0.0-alpha.5 → 1.0.0-alpha.7
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 +29 -0
- package/README.md +36 -0
- package/index.js +1682 -119
- package/package.json +1 -1
- 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/output/console.d.ts +4 -0
- package/src/output/console.d.ts.map +1 -1
- package/src/templates/migrate-skill.d.ts +9 -0
- package/src/templates/migrate-skill.d.ts.map +1 -0
- package/src/types.d.ts +2 -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
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/output/console.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/output/console.ts"],"names":[],"mappings":"AACA,OAAY,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAEpC;;GAEG;AACH,oBAAY,QAAQ;IAClB,wCAAwC;IACxC,KAAK,IAAI;IACT,8BAA8B;IAC9B,MAAM,IAAI;IACV,6CAA6C;IAC7C,OAAO,IAAI;IACX,wCAAwC;IACxC,KAAK,IAAI;CACV;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,wBAAwB;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,iCAAiC;IACjC,MAAM,EAAE,OAAO,CAAC;CACjB;AAUD;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAE7D;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,UAAU,CAEvC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;GAEG;AACH,wBAAgB,OAAO,IAAI,OAAO,CAEjC;AAED;;GAEG;AACH,wBAAgB,OAAO,IAAI,OAAO,CAEjC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAQ/C;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;;OAGG;mBACY,MAAM,GAAG,IAAI;IAI5B;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;OAEG;kBACW,MAAM,GAAG,IAAI;IAK3B;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;OAEG;kBACW,MAAM,GAAG,IAAI;IAK3B;;OAEG;mBACY,MAAM,GAAG,IAAI;IAK5B;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;OAEG;mBACY,MAAM,GAAG,IAAI;IAK5B;;OAEG;oBACa,MAAM,GAAG,IAAI;IAK7B;;OAEG;eACQ,IAAI;IAKf;;OAEG;oBACa,MAAM,GAAG,IAAI;IAK7B;;OAEG;mBACY,MAAM,GAAG,IAAI;IAK5B;;OAEG;qBACc,MAAM,GAAG,MAAM;IAIhC;;OAEG;yBACkB,MAAM,SAAS,MAAM,WAAW,MAAM,GAAG,MAAM;CAUrE,CAAC"}
|
|
1
|
+
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/output/console.ts"],"names":[],"mappings":"AACA,OAAY,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAEpC;;GAEG;AACH,oBAAY,QAAQ;IAClB,wCAAwC;IACxC,KAAK,IAAI;IACT,8BAA8B;IAC9B,MAAM,IAAI;IACV,6CAA6C;IAC7C,OAAO,IAAI;IACX,wCAAwC;IACxC,KAAK,IAAI;CACV;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,wBAAwB;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,iCAAiC;IACjC,MAAM,EAAE,OAAO,CAAC;CACjB;AAUD;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAE7D;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,UAAU,CAEvC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;GAEG;AACH,wBAAgB,OAAO,IAAI,OAAO,CAEjC;AAED;;GAEG;AACH,wBAAgB,OAAO,IAAI,OAAO,CAEjC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAQ/C;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;;OAGG;mBACY,MAAM,GAAG,IAAI;IAI5B;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;OAEG;kBACW,MAAM,GAAG,IAAI;IAK3B;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;OAEG;uBACgB,MAAM,GAAG,IAAI;IAKhC;;OAEG;kBACW,MAAM,GAAG,IAAI;IAK3B;;OAEG;mBACY,MAAM,GAAG,IAAI;IAK5B;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;OAEG;mBACY,MAAM,GAAG,IAAI;IAK5B;;OAEG;oBACa,MAAM,GAAG,IAAI;IAK7B;;OAEG;eACQ,IAAI;IAKf;;OAEG;oBACa,MAAM,GAAG,IAAI;IAK7B;;OAEG;mBACY,MAAM,GAAG,IAAI;IAK5B;;OAEG;qBACc,MAAM,GAAG,MAAM;IAIhC;;OAEG;yBACkB,MAAM,SAAS,MAAM,WAAW,MAAM,GAAG,MAAM;CAUrE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration skill template for AI-assisted migration.
|
|
3
|
+
* This skill is installed when using `prs init --migrate`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const MIGRATE_SKILL_CLAUDE = "---\nname: 'migrate-to-promptscript'\ndescription: 'Migrate existing AI instruction files to PromptScript format'\nallowed-tools:\n - Read\n - Write\n - Glob\n - Grep\n - Bash\nuser-invocable: true\n---\n\n# Migrate to PromptScript\n\n## Overview\n\nThis skill guides you through migrating existing AI instruction files\nto PromptScript format, creating a unified source of truth for all\nAI coding assistants.\n\n## Step 1: Discovery\n\nSearch for existing instruction files using these patterns:\n\nClaude Code:\n\n- CLAUDE.md, claude.md, CLAUDE.local.md\n\nCursor:\n\n- .cursorrules\n- .cursor/rules/\\*.md\n- .cursor/rules/\\*.mdc\n\nGitHub Copilot:\n\n- .github/copilot-instructions.md\n- .github/instructions/\\*.md\n\nOther:\n\n- AGENTS.md\n- AI_INSTRUCTIONS.md\n- AI.md\n- .ai/instructions.md\n\nUse Glob tool to find these files.\n\n## Step 2: Read and Analyze\n\nFor each discovered file:\n\n1. Read the full content using the Read tool\n2. Identify sections by headers (##, ###) and patterns\n3. Classify content type using the mapping table below\n4. Note any tool-specific content that may need special handling\n\n## Step 3: Content Mapping\n\nMap source content to PromptScript blocks:\n\n| Source Pattern | PromptScript Block |\n| ------------------------------------ | ------------------ |\n| You are, persona, identity, role | @identity |\n| Tech stack, languages, frameworks | @context |\n| Coding standards, conventions, rules | @standards |\n| Don't, Never, restrictions | @restrictions |\n| Commands, shortcuts | @shortcuts |\n| API docs, references, knowledge base | @knowledge |\n| Parameters, config values | @params |\n| File patterns, globs, applyTo | @guards |\n| Skills, capabilities | @skills |\n| Agents, subagents | @agents |\n| Local-only settings | @local |\n\n## Step 4: Generate PromptScript\n\n### Required: @meta block\n\nEvery PromptScript file needs metadata with id and syntax fields.\n\n### Identity (persona)\n\nConvert persona descriptions to @identity block with triple-quote string.\n\n### Context (project info)\n\nConvert tech stack to @context block with structured properties\nlike project, languages, frameworks.\n\n### Standards (conventions)\n\nConvert coding standards to @standards block organized by category:\ncode, naming, commits, etc.\n\n### Restrictions (don'ts)\n\nConvert restrictions to @restrictions block using dash prefix for each item.\n\n### Shortcuts (commands)\n\nConvert custom commands to @shortcuts block. Simple shortcuts use\nkey-value format. Complex shortcuts use object format with\nprompt, description, and content fields.\n\n### Knowledge (references)\n\nConvert API docs and reference material to @knowledge block\nusing triple-quote string for rich content.\n\n### Guards (file patterns)\n\nConvert file-specific rules to @guards block with globs array\nspecifying file patterns.\n\n### Params (configuration)\n\nConvert configuration parameters to @params block with type annotations:\nrange(), enum(), boolean.\n\n### Skills (capabilities)\n\nConvert skill definitions to @skills block with description,\ntrigger, and content fields.\n\n### Agents (subagents)\n\nConvert agent definitions to @agents block with description,\ntools, model, and content fields.\n\n## Step 5: File Organization\n\nSimple Projects - single file structure:\n\n- .promptscript/project.prs\n- promptscript.yaml\n\nComplex Projects - modular file structure:\n\n- .promptscript/project.prs (main with @use imports)\n- .promptscript/context.prs\n- .promptscript/standards.prs\n- .promptscript/restrictions.prs\n- .promptscript/commands.prs\n- promptscript.yaml\n\n## Step 6: Configuration\n\nCreate promptscript.yaml with:\n\n- version: '1'\n- project.id\n- input.entry pointing to main .prs file\n- targets for github, claude, cursor\n\n## Step 7: Validation\n\nAfter generating PromptScript files:\n\n1. Validate syntax: prs validate\n2. Test compilation: prs compile --dry-run\n3. Compare output with original files\n4. Iterate if content is missing or incorrect\n\n## Common Patterns\n\n### Merging Multiple Sources\n\nWhen instructions exist in multiple files:\n\n1. Identity: Take from most detailed source\n2. Standards: Merge all, deduplicate\n3. Restrictions: Combine all (union)\n4. Commands: Merge, resolve conflicts\n\n### Tool-Specific Content\n\nHandle tool-specific content:\n\n- GitHub prompts: Use @shortcuts with prompt: true\n- Claude agents: Use @agents block\n- Cursor rules: Map to @standards\n- Local content: Use @local block\n\n### Preserving Formatting\n\nUse triple-quote multiline strings for:\n\n- Rich markdown content\n- Code examples\n- Complex instructions\n\n## Syntax Rules\n\nQuick reference for PromptScript syntax:\n\n- Strings: quoted or identifier\n- Multi-line: triple quotes\n- Arrays: [item1, item2] or - item prefix\n- Objects: { key: value }\n- Comments: # comment\n- Required @meta fields: id, syntax\n\n## Quality Checklist\n\nBefore completing migration:\n\n- @meta block has id and syntax\n- Identity is clear and specific\n- Standards are organized by category\n- Restrictions use dash prefix (-)\n- Shortcuts work in target tools\n- prs validate passes\n- prs compile produces correct output\n- No duplicate content across blocks\n\n## Troubleshooting\n\n### Missing @meta Error\nAdd required metadata block at the start.\n\n### Multiline String in Object Error\nAssign multiline strings to named keys, don't leave them loose\ninside objects.\n\n### Content Not Appearing in Output\nCheck block names match expected patterns and\nverify syntax with prs validate --verbose.\n";
|
|
6
|
+
export declare const MIGRATE_SKILL_CURSOR = "# Migrate to PromptScript\n\nUse this command to migrate existing AI instruction files to PromptScript format.\n\n## Step 1: Discovery\n\nSearch for existing instruction files:\n\n- CLAUDE.md, claude.md, CLAUDE.local.md\n- .cursorrules, .cursor/rules/*.mdc\n- .github/copilot-instructions.md\n- AGENTS.md, AI_INSTRUCTIONS.md\n\n## Step 2: Content Mapping\n\nMap source content to PromptScript blocks:\n\n| Source Pattern | PromptScript Block |\n| ------------------------------------ | ------------------ |\n| You are, persona, identity, role | @identity |\n| Tech stack, languages, frameworks | @context |\n| Coding standards, conventions, rules | @standards |\n| Don't, Never, restrictions | @restrictions |\n| Commands, shortcuts | @shortcuts |\n| API docs, references | @knowledge |\n\n## Step 3: Generate PromptScript\n\nCreate `.promptscript/project.prs` with:\n\n1. **@meta** block with id and syntax fields (required)\n2. **@identity** for persona/role descriptions\n3. **@context** for tech stack info\n4. **@standards** organized by category\n5. **@restrictions** with dash prefix for each item\n6. **@shortcuts** for commands\n\n## Step 4: Validation\n\nAfter generating:\n\n1. Run `prs validate`\n2. Run `prs compile --dry-run`\n3. Compare output with original files\n\n## Syntax Quick Reference\n\n- Strings: quoted or identifier\n- Multi-line: triple quotes (`\"\"\"`)\n- Arrays: `[item1, item2]`\n- Objects: `{ key: value }`\n- Comments: `# comment`\n\n## Quality Checklist\n\n- @meta block has id and syntax\n- Standards organized by category\n- Restrictions use dash prefix (-)\n- prs validate passes\n";
|
|
7
|
+
export declare const MIGRATE_SKILL_ANTIGRAVITY = "# Migrate to PromptScript\n\nThis rule provides guidance for migrating existing AI instruction files to PromptScript format.\n\n## Overview\n\nPromptScript creates a unified source of truth for all AI coding assistants,\ncompiling to native formats for Claude, GitHub Copilot, Cursor, and Antigravity.\n\n## Step 1: Discovery\n\nSearch for existing instruction files:\n\n- CLAUDE.md, claude.md, CLAUDE.local.md\n- .cursorrules, .cursor/rules/*.mdc\n- .github/copilot-instructions.md\n- .agent/rules/*.md\n- AGENTS.md, AI_INSTRUCTIONS.md\n\n## Step 2: Content Mapping\n\nMap source content to PromptScript blocks:\n\n| Source Pattern | PromptScript Block |\n| ------------------------------------ | ------------------ |\n| You are, persona, identity, role | @identity |\n| Tech stack, languages, frameworks | @context |\n| Coding standards, conventions, rules | @standards |\n| Don't, Never, restrictions | @restrictions |\n| Commands, shortcuts | @shortcuts |\n| API docs, references | @knowledge |\n\n## Step 3: Generate PromptScript\n\nCreate `.promptscript/project.prs` with required blocks:\n\n1. **@meta** - id and syntax fields (required)\n2. **@identity** - persona/role descriptions\n3. **@context** - tech stack info\n4. **@standards** - coding rules organized by category\n5. **@restrictions** - things to avoid (dash prefix)\n6. **@shortcuts** - commands\n\n## Step 4: Validation\n\nAfter generating PromptScript files:\n\n1. Run `prs validate` to check syntax\n2. Run `prs compile --dry-run` to preview output\n3. Compare compiled output with original files\n\n## Syntax Reference\n\n- Strings: quoted or identifier\n- Multi-line: triple quotes\n- Arrays: [item1, item2]\n- Objects: { key: value }\n- Comments: # comment\n";
|
|
8
|
+
export declare const MIGRATE_SKILL_GITHUB = "---\nname: 'migrate-to-promptscript'\ndescription: 'Migrate existing AI instruction files to PromptScript format'\nallowed-tools:\n - read\n - write\n - glob\n - grep\n - execute\nuser-invocable: true\n---\n\n# Migrate to PromptScript\n\n## Overview\n\nThis skill guides you through migrating existing AI instruction files\nto PromptScript format, creating a unified source of truth for all\nAI coding assistants.\n\n## Step 1: Discovery\n\nSearch for existing instruction files using these patterns:\n\nClaude Code:\n\n- CLAUDE.md, claude.md, CLAUDE.local.md\n\nCursor:\n\n- .cursorrules\n- .cursor/rules/\\*.md\n- .cursor/rules/\\*.mdc\n\nGitHub Copilot:\n\n- .github/copilot-instructions.md\n- .github/instructions/\\*.md\n\nOther:\n\n- AGENTS.md\n- AI_INSTRUCTIONS.md\n- AI.md\n- .ai/instructions.md\n\n## Step 2: Read and Analyze\n\nFor each discovered file:\n\n1. Read the full content\n2. Identify sections by headers (##, ###) and patterns\n3. Classify content type using the mapping table below\n4. Note any tool-specific content that may need special handling\n\n## Step 3: Content Mapping\n\nMap source content to PromptScript blocks:\n\n| Source Pattern | PromptScript Block |\n| ------------------------------------ | ------------------ |\n| You are, persona, identity, role | @identity |\n| Tech stack, languages, frameworks | @context |\n| Coding standards, conventions, rules | @standards |\n| Don't, Never, restrictions | @restrictions |\n| Commands, shortcuts | @shortcuts |\n| API docs, references, knowledge base | @knowledge |\n| Parameters, config values | @params |\n| File patterns, globs, applyTo | @guards |\n| Skills, capabilities | @skills |\n| Agents, subagents | @agents |\n| Local-only settings | @local |\n\n## Step 4: Generate PromptScript\n\n### Required: @meta block\n\nEvery PromptScript file needs metadata with id and syntax fields.\n\n### Identity (persona)\n\nConvert persona descriptions to @identity block with triple-quote string.\n\n### Context (project info)\n\nConvert tech stack to @context block with structured properties\nlike project, languages, frameworks.\n\n### Standards (conventions)\n\nConvert coding standards to @standards block organized by category:\ncode, naming, commits, etc.\n\n### Restrictions (don'ts)\n\nConvert restrictions to @restrictions block using dash prefix for each item.\n\n### Shortcuts (commands)\n\nConvert custom commands to @shortcuts block. Simple shortcuts use\nkey-value format. Complex shortcuts use object format with\nprompt, description, and content fields.\n\n## Step 5: File Organization\n\nSimple Projects - single file structure:\n\n- .promptscript/project.prs\n- promptscript.yaml\n\nComplex Projects - modular file structure:\n\n- .promptscript/project.prs (main with @use imports)\n- .promptscript/context.prs\n- .promptscript/standards.prs\n- .promptscript/restrictions.prs\n- .promptscript/commands.prs\n- promptscript.yaml\n\n## Step 6: Configuration\n\nCreate promptscript.yaml with:\n\n- version: '1'\n- project.id\n- input.entry pointing to main .prs file\n- targets for github, claude, cursor\n\n## Step 7: Validation\n\nAfter generating PromptScript files:\n\n1. Validate syntax: prs validate\n2. Test compilation: prs compile --dry-run\n3. Compare output with original files\n4. Iterate if content is missing or incorrect\n\n## Quality Checklist\n\nBefore completing migration:\n\n- @meta block has id and syntax\n- Identity is clear and specific\n- Standards are organized by category\n- Restrictions use dash prefix (-)\n- Shortcuts work in target tools\n- prs validate passes\n- prs compile produces correct output\n- No duplicate content across blocks\n";
|
|
9
|
+
//# sourceMappingURL=migrate-skill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-skill.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/templates/migrate-skill.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,oBAAoB,+rLAoOhC,CAAC;AAEF,eAAO,MAAM,oBAAoB,gtDA2DhC,CAAC;AAEF,eAAO,MAAM,yBAAyB,m0DA0DrC,CAAC;AAEF,eAAO,MAAM,oBAAoB,+zHAqJhC,CAAC"}
|
package/src/types.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export interface InitOptions {
|
|
|
18
18
|
yes?: boolean;
|
|
19
19
|
/** Force reinitialize even if already initialized */
|
|
20
20
|
force?: boolean;
|
|
21
|
+
/** Install migration skill for AI-assisted migration */
|
|
22
|
+
migrate?: boolean;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* Options for the compile command.
|
|
@@ -87,7 +89,5 @@ export interface DiffOptions {
|
|
|
87
89
|
* Options for the check command.
|
|
88
90
|
*/
|
|
89
91
|
export interface CheckOptions {
|
|
90
|
-
/** Attempt to fix issues automatically */
|
|
91
|
-
fix?: boolean;
|
|
92
92
|
}
|
|
93
93
|
//# sourceMappingURL=types.d.ts.map
|
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,CAAC;IAClB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,iDAAiD;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iCAAiC;IACjC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,CAAC;
|
|
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,CAAC;IAClB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,iDAAiD;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iCAAiC;IACjC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,wDAAwD;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,4CAA4C;IAC5C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,uBAAuB;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,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":"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"}
|
|
@@ -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"}
|