@pupt/cli 0.0.1 → 2.3.0
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/LICENSE +21 -0
- package/README.md +54 -29
- package/dist/annotations/annotation-analyzer.d.ts +17 -0
- package/dist/annotations/annotation-analyzer.d.ts.map +1 -0
- package/dist/annotations/annotation-analyzer.js +145 -0
- package/dist/annotations/annotation-analyzer.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +435 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/add.d.ts +5 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +164 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/annotate.d.ts +2 -0
- package/dist/commands/annotate.d.ts.map +1 -0
- package/dist/commands/annotate.js +99 -0
- package/dist/commands/annotate.js.map +1 -0
- package/dist/commands/base-command.d.ts +23 -0
- package/dist/commands/base-command.d.ts.map +1 -0
- package/dist/commands/base-command.js +41 -0
- package/dist/commands/base-command.js.map +1 -0
- 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 +8 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +93 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/edit.d.ts +2 -0
- package/dist/commands/edit.d.ts.map +1 -0
- package/dist/commands/edit.js +35 -0
- package/dist/commands/edit.js.map +1 -0
- package/dist/commands/help.d.ts +2 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +26 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/history.d.ts +12 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +317 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +137 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/install.d.ts +16 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +263 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/review.d.ts +3 -0
- package/dist/commands/review.d.ts.map +1 -0
- package/dist/commands/review.js +160 -0
- package/dist/commands/review.js.map +1 -0
- package/dist/commands/run.d.ts +32 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +367 -0
- package/dist/commands/run.js.map +1 -0
- 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 +19 -0
- package/dist/config/config-manager.d.ts.map +1 -0
- package/dist/config/config-manager.js +221 -0
- package/dist/config/config-manager.js.map +1 -0
- 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 +12 -0
- package/dist/config/migration.d.ts.map +1 -0
- package/dist/config/migration.js +270 -0
- package/dist/config/migration.js.map +1 -0
- package/dist/history/enhanced-history-manager.d.ts +27 -0
- package/dist/history/enhanced-history-manager.d.ts.map +1 -0
- package/dist/history/enhanced-history-manager.js +116 -0
- package/dist/history/enhanced-history-manager.js.map +1 -0
- package/dist/history/history-manager.d.ts +43 -0
- package/dist/history/history-manager.d.ts.map +1 -0
- package/dist/history/history-manager.js +229 -0
- package/dist/history/history-manager.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/input-types/file-search-prompt.d.ts +11 -0
- package/dist/prompts/input-types/file-search-prompt.d.ts.map +1 -0
- package/dist/prompts/input-types/file-search-prompt.js +53 -0
- package/dist/prompts/input-types/file-search-prompt.js.map +1 -0
- package/dist/prompts/input-types/review-file-prompt.d.ts +3 -0
- package/dist/prompts/input-types/review-file-prompt.d.ts.map +1 -0
- package/dist/prompts/input-types/review-file-prompt.js +9 -0
- package/dist/prompts/input-types/review-file-prompt.js.map +1 -0
- package/dist/schemas/config-schema.d.ts +1637 -0
- package/dist/schemas/config-schema.d.ts.map +1 -0
- package/dist/schemas/config-schema.js +136 -0
- package/dist/schemas/config-schema.js.map +1 -0
- package/dist/search/search-engine.d.ts +8 -0
- package/dist/search/search-engine.d.ts.map +1 -0
- package/dist/search/search-engine.js +53 -0
- package/dist/search/search-engine.js.map +1 -0
- package/dist/services/git-service.d.ts +28 -0
- package/dist/services/git-service.d.ts.map +1 -0
- package/dist/services/git-service.js +157 -0
- package/dist/services/git-service.js.map +1 -0
- package/dist/services/input-collector.d.ts +9 -0
- package/dist/services/input-collector.d.ts.map +1 -0
- package/dist/services/input-collector.js +162 -0
- package/dist/services/input-collector.js.map +1 -0
- package/dist/services/logging-service.d.ts +49 -0
- package/dist/services/logging-service.d.ts.map +1 -0
- package/dist/services/logging-service.js +203 -0
- package/dist/services/logging-service.js.map +1 -0
- 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 +71 -0
- package/dist/services/module-entry-builder.js.map +1 -0
- package/dist/services/output-capture-service.d.ts +28 -0
- package/dist/services/output-capture-service.d.ts.map +1 -0
- package/dist/services/output-capture-service.js +348 -0
- package/dist/services/output-capture-service.js.map +1 -0
- 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/pattern-detector.d.ts +15 -0
- package/dist/services/pattern-detector.d.ts.map +1 -0
- package/dist/services/pattern-detector.js +228 -0
- package/dist/services/pattern-detector.js.map +1 -0
- package/dist/services/prompt-resolver.d.ts +32 -0
- package/dist/services/prompt-resolver.d.ts.map +1 -0
- package/dist/services/prompt-resolver.js +73 -0
- package/dist/services/prompt-resolver.js.map +1 -0
- 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 +74 -0
- package/dist/services/pupt-prompt-source.js.map +1 -0
- package/dist/services/pupt-service.d.ts +33 -0
- package/dist/services/pupt-service.d.ts.map +1 -0
- package/dist/services/pupt-service.js +119 -0
- package/dist/services/pupt-service.js.map +1 -0
- package/dist/services/review-data-builder.d.ts +25 -0
- package/dist/services/review-data-builder.d.ts.map +1 -0
- package/dist/services/review-data-builder.js +333 -0
- package/dist/services/review-data-builder.js.map +1 -0
- package/dist/services/suggestion-generator.d.ts +11 -0
- package/dist/services/suggestion-generator.d.ts.map +1 -0
- package/dist/services/suggestion-generator.js +158 -0
- package/dist/services/suggestion-generator.js.map +1 -0
- package/dist/services/ui-service.d.ts +49 -0
- package/dist/services/ui-service.d.ts.map +1 -0
- package/dist/services/ui-service.js +196 -0
- package/dist/services/ui-service.js.map +1 -0
- package/dist/types/annotations.d.ts +50 -0
- package/dist/types/annotations.d.ts.map +1 -0
- package/dist/types/annotations.js +2 -0
- package/dist/types/annotations.js.map +1 -0
- package/dist/types/config.d.ts +110 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +12 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/history.d.ts +36 -0
- package/dist/types/history.d.ts.map +1 -0
- package/dist/types/history.js +2 -0
- package/dist/types/history.js.map +1 -0
- package/dist/types/patterns.d.ts +25 -0
- package/dist/types/patterns.d.ts.map +1 -0
- package/dist/types/patterns.js +2 -0
- package/dist/types/patterns.js.map +1 -0
- package/dist/types/prompt.d.ts +29 -0
- package/dist/types/prompt.d.ts.map +1 -0
- package/dist/types/prompt.js +24 -0
- package/dist/types/prompt.js.map +1 -0
- package/dist/types/review.d.ts +81 -0
- package/dist/types/review.d.ts.map +1 -0
- package/dist/types/review.js +2 -0
- package/dist/types/review.js.map +1 -0
- package/dist/ui/console-ui.d.ts +30 -0
- package/dist/ui/console-ui.d.ts.map +1 -0
- package/dist/ui/console-ui.js +88 -0
- package/dist/ui/console-ui.js.map +1 -0
- package/dist/ui/interactive-search.d.ts +8 -0
- package/dist/ui/interactive-search.d.ts.map +1 -0
- package/dist/ui/interactive-search.js +29 -0
- package/dist/ui/interactive-search.js.map +1 -0
- package/dist/utils/annotation-migration.d.ts +12 -0
- package/dist/utils/annotation-migration.d.ts.map +1 -0
- package/dist/utils/annotation-migration.js +88 -0
- package/dist/utils/annotation-migration.js.map +1 -0
- package/dist/utils/date-formatter.d.ts +10 -0
- package/dist/utils/date-formatter.d.ts.map +1 -0
- package/dist/utils/date-formatter.js +46 -0
- package/dist/utils/date-formatter.js.map +1 -0
- package/dist/utils/editor.d.ts +14 -0
- package/dist/utils/editor.d.ts.map +1 -0
- package/dist/utils/editor.js +52 -0
- package/dist/utils/editor.js.map +1 -0
- package/dist/utils/errors.d.ts +58 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +275 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/git-info.d.ts +10 -0
- package/dist/utils/git-info.d.ts.map +1 -0
- package/dist/utils/git-info.js +44 -0
- package/dist/utils/git-info.js.map +1 -0
- package/dist/utils/gitignore.d.ts +10 -0
- package/dist/utils/gitignore.d.ts.map +1 -0
- package/dist/utils/gitignore.js +72 -0
- package/dist/utils/gitignore.js.map +1 -0
- package/dist/utils/logger.d.ts +39 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +143 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/platform.d.ts +9 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +45 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/utils/project-root.d.ts +22 -0
- package/dist/utils/project-root.d.ts.map +1 -0
- package/dist/utils/project-root.js +226 -0
- package/dist/utils/project-root.js.map +1 -0
- 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 +25 -0
- package/dist/utils/prompt-dir-resolver.js.map +1 -0
- package/dist/utils/security.d.ts +5 -0
- package/dist/utils/security.d.ts.map +1 -0
- package/dist/utils/security.js +57 -0
- package/dist/utils/security.js.map +1 -0
- package/dist/utils/tool-detection.d.ts +14 -0
- package/dist/utils/tool-detection.d.ts.map +1 -0
- package/dist/utils/tool-detection.js +43 -0
- package/dist/utils/tool-detection.js.map +1 -0
- package/package.json +79 -7
- package/prompts/prompts/ad-hoc-long.prompt +60 -0
- package/prompts/prompts/ad-hoc.prompt +29 -0
- package/prompts/prompts/code-review.prompt +99 -0
- package/prompts/prompts/debugging-error-message.prompt +81 -0
- package/prompts/prompts/fix-github-actions.prompt +62 -0
- package/prompts/prompts/fix-test-errors.prompt +73 -0
- package/prompts/prompts/git-commit-comment.prompt +61 -0
- package/prompts/prompts/implementation-phase.prompt +53 -0
- package/prompts/prompts/implementation-plan.prompt +101 -0
- package/prompts/prompts/new-feature.prompt +89 -0
- package/prompts/prompts/new-project.prompt +9 -0
- package/prompts/prompts/one-shot-change.prompt +79 -0
- package/prompts/prompts/pupt-prompt-improvement.prompt +270 -0
- package/prompts/prompts/simple-test.prompt +8 -0
- package/prompts/prompts/update-design.prompt +71 -0
- package/prompts/prompts/update-documentation.prompt +6 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
export function getHomePath() {
|
|
4
|
+
return os.homedir();
|
|
5
|
+
}
|
|
6
|
+
export function getConfigPaths() {
|
|
7
|
+
const platform = getPlatform();
|
|
8
|
+
const paths = [process.cwd()];
|
|
9
|
+
switch (platform) {
|
|
10
|
+
case 'win32':
|
|
11
|
+
if (process.env.APPDATA) {
|
|
12
|
+
paths.push(path.join(process.env.APPDATA, 'pupt'));
|
|
13
|
+
}
|
|
14
|
+
break;
|
|
15
|
+
case 'darwin':
|
|
16
|
+
paths.push(path.join(getHomePath(), 'Library', 'Application Support', 'pupt'), path.join(getHomePath(), '.config', 'pupt'));
|
|
17
|
+
break;
|
|
18
|
+
case 'linux':
|
|
19
|
+
default: {
|
|
20
|
+
const configHome = process.env.XDG_CONFIG_HOME || path.join(getHomePath(), '.config');
|
|
21
|
+
paths.push(path.join(configHome, 'pupt'));
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return paths;
|
|
26
|
+
}
|
|
27
|
+
export function getPlatform() {
|
|
28
|
+
return process.platform;
|
|
29
|
+
}
|
|
30
|
+
export function isWindows() {
|
|
31
|
+
return getPlatform() === 'win32';
|
|
32
|
+
}
|
|
33
|
+
export function isMacOS() {
|
|
34
|
+
return getPlatform() === 'darwin';
|
|
35
|
+
}
|
|
36
|
+
export function isLinux() {
|
|
37
|
+
return getPlatform() === 'linux';
|
|
38
|
+
}
|
|
39
|
+
export function normalizeLineEndings(text) {
|
|
40
|
+
return text.replace(/\r\n|\r|\n/g, '\n');
|
|
41
|
+
}
|
|
42
|
+
export function getUsername() {
|
|
43
|
+
return os.userInfo().username;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/utils/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,WAAW;IACzB,OAAO,EAAE,CAAC,O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E,KAAK,OAAO,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project markers used to detect project root directories.
|
|
3
|
+
* Listed roughly in order of specificity/reliability.
|
|
4
|
+
* Note: '.git' is handled specially to support worktrees.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PROJECT_MARKERS: readonly [".hg", ".svn", "package.json", "deno.json", "deno.jsonc", "pyproject.toml", "setup.py", "Pipfile", "setup.cfg", "poetry.lock", "Cargo.toml", "go.mod", "pom.xml", "build.gradle", "build.gradle.kts", "build.sbt", "project.clj", "Gemfile", "composer.json", "nuget.config", "packages.config", "mix.exs", "rebar.config", "Package.swift", "stack.yaml", "cabal.project", "build.sc", "Makefile", "CMakeLists.txt", "meson.build", "BUILD", "BUILD.bazel", "WORKSPACE", "WORKSPACE.bazel", "Justfile", "Taskfile.yml", "Taskfile.yaml", "Dockerfile", "docker-compose.yml", "docker-compose.yaml", ".editorconfig", ".prettierrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.cjs", "tsconfig.json", "jsconfig.json"];
|
|
7
|
+
/**
|
|
8
|
+
* Find the project root by searching upward from startDir for project markers.
|
|
9
|
+
* Stops at the home directory or filesystem root.
|
|
10
|
+
*
|
|
11
|
+
* For git repositories with worktrees, this returns the MAIN worktree root,
|
|
12
|
+
* allowing all worktrees to share the same project root.
|
|
13
|
+
*
|
|
14
|
+
* @param startDir - Directory to start searching from
|
|
15
|
+
* @returns The project root directory path, or null if not found
|
|
16
|
+
*/
|
|
17
|
+
export declare function findProjectRoot(startDir: string): string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Clear the project root cache. Useful for testing.
|
|
20
|
+
*/
|
|
21
|
+
export declare function clearProjectRootCache(): void;
|
|
22
|
+
//# sourceMappingURL=project-root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-root.d.ts","sourceRoot":"","sources":["../../src/utils/project-root.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,eAAe,qsBA8ElB,CAAC;AA+GX;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA+C/D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
/**
|
|
5
|
+
* Project markers used to detect project root directories.
|
|
6
|
+
* Listed roughly in order of specificity/reliability.
|
|
7
|
+
* Note: '.git' is handled specially to support worktrees.
|
|
8
|
+
*/
|
|
9
|
+
export const PROJECT_MARKERS = [
|
|
10
|
+
// Version Control (most reliable indicators)
|
|
11
|
+
// '.git' is handled specially - see resolveGitWorktreeRoot()
|
|
12
|
+
'.hg',
|
|
13
|
+
'.svn',
|
|
14
|
+
// JavaScript/TypeScript
|
|
15
|
+
'package.json',
|
|
16
|
+
'deno.json',
|
|
17
|
+
'deno.jsonc',
|
|
18
|
+
// Python
|
|
19
|
+
'pyproject.toml',
|
|
20
|
+
'setup.py',
|
|
21
|
+
'Pipfile',
|
|
22
|
+
'setup.cfg',
|
|
23
|
+
'poetry.lock',
|
|
24
|
+
// Rust
|
|
25
|
+
'Cargo.toml',
|
|
26
|
+
// Go
|
|
27
|
+
'go.mod',
|
|
28
|
+
// Java/JVM
|
|
29
|
+
'pom.xml',
|
|
30
|
+
'build.gradle',
|
|
31
|
+
'build.gradle.kts',
|
|
32
|
+
'build.sbt',
|
|
33
|
+
'project.clj', // Clojure/Leiningen
|
|
34
|
+
// Ruby
|
|
35
|
+
'Gemfile',
|
|
36
|
+
// PHP
|
|
37
|
+
'composer.json',
|
|
38
|
+
// .NET (exact files, not globs)
|
|
39
|
+
'nuget.config',
|
|
40
|
+
'packages.config',
|
|
41
|
+
// Elixir/Erlang
|
|
42
|
+
'mix.exs',
|
|
43
|
+
'rebar.config',
|
|
44
|
+
// Swift/iOS/macOS
|
|
45
|
+
'Package.swift',
|
|
46
|
+
// Haskell
|
|
47
|
+
'stack.yaml',
|
|
48
|
+
'cabal.project',
|
|
49
|
+
// Scala
|
|
50
|
+
'build.sc', // Mill
|
|
51
|
+
// Build systems
|
|
52
|
+
'Makefile',
|
|
53
|
+
'CMakeLists.txt',
|
|
54
|
+
'meson.build',
|
|
55
|
+
'BUILD',
|
|
56
|
+
'BUILD.bazel',
|
|
57
|
+
'WORKSPACE',
|
|
58
|
+
'WORKSPACE.bazel',
|
|
59
|
+
'Justfile',
|
|
60
|
+
'Taskfile.yml',
|
|
61
|
+
'Taskfile.yaml',
|
|
62
|
+
// Other common project indicators
|
|
63
|
+
'Dockerfile',
|
|
64
|
+
'docker-compose.yml',
|
|
65
|
+
'docker-compose.yaml',
|
|
66
|
+
'.editorconfig',
|
|
67
|
+
'.prettierrc',
|
|
68
|
+
'.eslintrc.json',
|
|
69
|
+
'.eslintrc.js',
|
|
70
|
+
'.eslintrc.cjs',
|
|
71
|
+
'tsconfig.json',
|
|
72
|
+
'jsconfig.json',
|
|
73
|
+
];
|
|
74
|
+
/**
|
|
75
|
+
* Glob-style patterns for .NET projects.
|
|
76
|
+
* These require directory scanning rather than exact file checks.
|
|
77
|
+
*/
|
|
78
|
+
const PROJECT_GLOB_PATTERNS = [
|
|
79
|
+
'*.csproj',
|
|
80
|
+
'*.fsproj',
|
|
81
|
+
'*.vbproj',
|
|
82
|
+
'*.sln',
|
|
83
|
+
];
|
|
84
|
+
// Cache for project root lookups to avoid repeated filesystem traversal
|
|
85
|
+
const projectRootCache = new Map();
|
|
86
|
+
/**
|
|
87
|
+
* Resolve the main worktree root from a git directory.
|
|
88
|
+
*
|
|
89
|
+
* In a standard git repo, .git is a directory.
|
|
90
|
+
* In a linked worktree, .git is a file containing "gitdir: /path/to/main/.git/worktrees/<name>"
|
|
91
|
+
*
|
|
92
|
+
* This function returns the root of the MAIN worktree, not the linked one.
|
|
93
|
+
*
|
|
94
|
+
* @param dir - Directory that may contain .git
|
|
95
|
+
* @returns The main worktree root, or null if not a git repo
|
|
96
|
+
*/
|
|
97
|
+
function resolveGitWorktreeRoot(dir) {
|
|
98
|
+
const gitPath = path.join(dir, '.git');
|
|
99
|
+
try {
|
|
100
|
+
const stat = fs.statSync(gitPath);
|
|
101
|
+
if (stat.isDirectory()) {
|
|
102
|
+
// Standard git repo - this is the main worktree
|
|
103
|
+
return dir;
|
|
104
|
+
}
|
|
105
|
+
if (stat.isFile()) {
|
|
106
|
+
// This is a linked worktree - .git is a file with gitdir pointer
|
|
107
|
+
const content = fs.readFileSync(gitPath, 'utf-8').trim();
|
|
108
|
+
// Parse "gitdir: /path/to/main/.git/worktrees/<worktree-name>"
|
|
109
|
+
const match = content.match(/^gitdir:\s*(.+)$/);
|
|
110
|
+
if (match) {
|
|
111
|
+
const gitdir = match[1];
|
|
112
|
+
// The gitdir points to .git/worktrees/<name> in the main repo
|
|
113
|
+
// We need to go up to find the main repo root
|
|
114
|
+
// e.g., /path/to/main/.git/worktrees/feature -> /path/to/main
|
|
115
|
+
if (gitdir.includes('/worktrees/') || gitdir.includes('\\worktrees\\')) {
|
|
116
|
+
// Go up from .git/worktrees/<name> to the main repo root
|
|
117
|
+
// .git/worktrees/<name> -> .git -> repo root
|
|
118
|
+
const mainGitDir = path.dirname(path.dirname(gitdir));
|
|
119
|
+
const mainRoot = path.dirname(mainGitDir);
|
|
120
|
+
// Verify this is actually a git directory
|
|
121
|
+
if (fs.existsSync(mainGitDir) && fs.statSync(mainGitDir).isDirectory()) {
|
|
122
|
+
return mainRoot;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
// .git doesn't exist or not readable
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Check if a directory contains any files matching glob-style patterns.
|
|
135
|
+
* Only handles simple *.ext patterns, not full glob syntax.
|
|
136
|
+
*/
|
|
137
|
+
function hasMatchingFiles(dir, patterns) {
|
|
138
|
+
try {
|
|
139
|
+
const files = fs.readdirSync(dir);
|
|
140
|
+
for (const pattern of patterns) {
|
|
141
|
+
if (pattern.startsWith('*.')) {
|
|
142
|
+
const ext = pattern.slice(1); // Get ".ext"
|
|
143
|
+
if (files.some(f => f.endsWith(ext))) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
// Directory not readable
|
|
151
|
+
}
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Check if a directory contains any project marker.
|
|
156
|
+
*/
|
|
157
|
+
function hasProjectMarker(dir) {
|
|
158
|
+
// Check exact file/directory markers
|
|
159
|
+
for (const marker of PROJECT_MARKERS) {
|
|
160
|
+
const markerPath = path.join(dir, marker);
|
|
161
|
+
if (fs.existsSync(markerPath)) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// Check glob patterns for .NET projects
|
|
166
|
+
if (hasMatchingFiles(dir, PROJECT_GLOB_PATTERNS)) {
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Find the project root by searching upward from startDir for project markers.
|
|
173
|
+
* Stops at the home directory or filesystem root.
|
|
174
|
+
*
|
|
175
|
+
* For git repositories with worktrees, this returns the MAIN worktree root,
|
|
176
|
+
* allowing all worktrees to share the same project root.
|
|
177
|
+
*
|
|
178
|
+
* @param startDir - Directory to start searching from
|
|
179
|
+
* @returns The project root directory path, or null if not found
|
|
180
|
+
*/
|
|
181
|
+
export function findProjectRoot(startDir) {
|
|
182
|
+
// Normalize the start directory
|
|
183
|
+
const normalizedStart = path.resolve(startDir);
|
|
184
|
+
// Check cache first
|
|
185
|
+
const cached = projectRootCache.get(normalizedStart);
|
|
186
|
+
if (cached !== undefined) {
|
|
187
|
+
return cached;
|
|
188
|
+
}
|
|
189
|
+
const homeDir = os.homedir();
|
|
190
|
+
let currentDir = normalizedStart;
|
|
191
|
+
while (true) {
|
|
192
|
+
// First, check for git (with worktree support)
|
|
193
|
+
// This takes priority to ensure worktrees resolve to main repo
|
|
194
|
+
const gitRoot = resolveGitWorktreeRoot(currentDir);
|
|
195
|
+
if (gitRoot !== null) {
|
|
196
|
+
projectRootCache.set(normalizedStart, gitRoot);
|
|
197
|
+
return gitRoot;
|
|
198
|
+
}
|
|
199
|
+
// Check other project markers
|
|
200
|
+
if (hasProjectMarker(currentDir)) {
|
|
201
|
+
projectRootCache.set(normalizedStart, currentDir);
|
|
202
|
+
return currentDir;
|
|
203
|
+
}
|
|
204
|
+
// Stop at home directory
|
|
205
|
+
if (currentDir === homeDir) {
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
// Move to parent directory
|
|
209
|
+
const parentDir = path.dirname(currentDir);
|
|
210
|
+
// Stop at filesystem root
|
|
211
|
+
if (parentDir === currentDir) {
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
currentDir = parentDir;
|
|
215
|
+
}
|
|
216
|
+
// No project root found
|
|
217
|
+
projectRootCache.set(normalizedStart, null);
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Clear the project root cache. Useful for testing.
|
|
222
|
+
*/
|
|
223
|
+
export function clearProjectRootCache() {
|
|
224
|
+
projectRootCache.clear();
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=project-root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-root.js","sourceRoot":"","sources":["../../src/utils/project-root.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,6CAA6C;IAC7C,6DAA6D;IAC7D,KAAK;IACL,MAAM;IAEN,wBAAwB;IACxB,cAAc;IACd,WAAW;IACX,YAAY;IAEZ,SAAS;IACT,gBAAgB;IAChB,UAAU;IACV,SAAS;IACT,WAAW;IACX,aAAa;IAEb,OAAO;IACP,YAAY;IAEZ,KAAK;IACL,QAAQ;IAER,WAAW;IACX,SAAS;IACT,cAAc;IACd,kBAAkB;IAClB,WAAW;IACX,aAAa,EAAE,oBAAoB;IAEnC,OAAO;IACP,SAAS;IAET,MAAM;IACN,eAAe;IAEf,gCAAgC;IAChC,cAAc;IACd,iBAAiB;IAEjB,gBAAgB;IAChB,SAAS;IACT,cAAc;IAEd,kBAAkB;IAClB,eAAe;IAEf,UAAU;IACV,YAAY;IACZ,eAAe;IAEf,QAAQ;IACR,UAAU,EAAE,OAAO;IAEnB,gBAAgB;IAChB,UAAU;IACV,gBAAgB;IAChB,aAAa;IACb,OAAO;IACP,aAAa;IACb,WAAW;IACX,iBAAiB;IACjB,UAAU;IACV,cAAc;IACd,eAAe;IAEf,kCAAkC;IAClC,YAAY;IACZ,oBAAoB;IACpB,qBAAqB;IACrB,eAAe;IACf,aAAa;IACb,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,eAAe;IACf,eAAe;CACP,CAAC;AAEX;;;GAGG;AACH,MAAM,qBAAqB,GAAG;IAC5B,UAAU;IACV,UAAU;IACV,UAAU;IACV,OAAO;CACC,CAAC;AAEX,wEAAwE;AACxE,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAyB,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ompt-dir-resolver.d.ts","sourceRoot":"","sources":["../../src/utils/prompt-dir-resolver.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAc7E"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { findProjectRoot } from './project-root.js';
|
|
4
|
+
const LOCAL_PROMPTS_DIR = '.prompts';
|
|
5
|
+
/**
|
|
6
|
+
* Find the local .prompts/ directory at the project root, if it exists.
|
|
7
|
+
*/
|
|
8
|
+
export function findLocalPromptsDir(startDir) {
|
|
9
|
+
const root = findProjectRoot(startDir ?? process.cwd());
|
|
10
|
+
if (!root) {
|
|
11
|
+
return Promise.resolve(null);
|
|
12
|
+
}
|
|
13
|
+
const localDir = path.join(root, LOCAL_PROMPTS_DIR);
|
|
14
|
+
try {
|
|
15
|
+
const stat = fs.statSync(localDir);
|
|
16
|
+
if (stat.isDirectory()) {
|
|
17
|
+
return Promise.resolve(localDir);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
// .prompts/ doesn't exist
|
|
22
|
+
}
|
|
23
|
+
return Promise.resolve(null);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=prompt-dir-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-dir-resolver.js","sourceRoot":"","sources":["../../src/utils/prompt-dir-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAErC;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAiB;IACnD,MAAM,IAAI,GAAG,eAAe,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACxD,IAAI,CAAC,IAAI,EAAE,CAAC;QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAAA,CAAC;IAE1C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IACpD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACvB,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,0BAA0B;IAC5B,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const SENSITIVE_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
2
|
+
export declare function isSensitiveKey(key: string): boolean;
|
|
3
|
+
export declare function maskSensitiveValue(key: string, value: unknown): unknown;
|
|
4
|
+
export declare function sanitizeObject<T extends Record<string, unknown>>(obj: T): T;
|
|
5
|
+
//# sourceMappingURL=security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/utils/security.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,2EASrB,CAAC;AAEX,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAqBvE;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9D,GAAG,EAAE,CAAC,GACL,CAAC,CAqBH"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export const SENSITIVE_PATTERNS = [
|
|
2
|
+
/api[_-]?key/i,
|
|
3
|
+
/password/i,
|
|
4
|
+
/secret/i,
|
|
5
|
+
/token/i,
|
|
6
|
+
/credential/i,
|
|
7
|
+
/private[_-]?key/i,
|
|
8
|
+
/auth/i,
|
|
9
|
+
/bearer/i
|
|
10
|
+
];
|
|
11
|
+
export function isSensitiveKey(key) {
|
|
12
|
+
return SENSITIVE_PATTERNS.some(pattern => pattern.test(key));
|
|
13
|
+
}
|
|
14
|
+
export function maskSensitiveValue(key, value) {
|
|
15
|
+
if (!isSensitiveKey(key)) {
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
if (typeof value === 'string') {
|
|
19
|
+
return '***';
|
|
20
|
+
}
|
|
21
|
+
if (Array.isArray(value)) {
|
|
22
|
+
return value.map(() => '***');
|
|
23
|
+
}
|
|
24
|
+
if (typeof value === 'object' && value !== null) {
|
|
25
|
+
return Object.keys(value).reduce((masked, k) => ({
|
|
26
|
+
...masked,
|
|
27
|
+
[k]: maskSensitiveValue(k, value[k])
|
|
28
|
+
}), {});
|
|
29
|
+
}
|
|
30
|
+
return '***';
|
|
31
|
+
}
|
|
32
|
+
export function sanitizeObject(obj) {
|
|
33
|
+
return Object.entries(obj).reduce((sanitized, [key, value]) => {
|
|
34
|
+
// Always check if the key itself is sensitive first
|
|
35
|
+
if (isSensitiveKey(key)) {
|
|
36
|
+
sanitized[key] = maskSensitiveValue(key, value);
|
|
37
|
+
}
|
|
38
|
+
else if (Array.isArray(value)) {
|
|
39
|
+
// Handle arrays - check if it's an array of objects
|
|
40
|
+
sanitized[key] = value.map(item => {
|
|
41
|
+
if (typeof item === 'object' && item !== null) {
|
|
42
|
+
return sanitizeObject(item);
|
|
43
|
+
}
|
|
44
|
+
return item;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
else if (typeof value === 'object' && value !== null) {
|
|
48
|
+
// Recursively sanitize nested objects
|
|
49
|
+
sanitized[key] = sanitizeObject(value);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
sanitized[key] = value;
|
|
53
|
+
}
|
|
54
|
+
return sanitized;
|
|
55
|
+
}, {});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=security.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.js","sourceRoot":"","sources":["../../src/utils/security.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,cAAc;IACd,WAAW;IACX,SAAS;IACT,QAAQ;IACR,aAAa;IACb,kBAAkB;IAClB,OAAO;IACP,SAAS;CACD,CAAC;AAEX,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAO,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,GAAW,EAAE,KAAc;IAC5D,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YAC/C,GAAG,MAAM;YACT,CAAC,CAAC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command: string;
|
|
5
|
+
defaultArgs: string[];
|
|
6
|
+
defaultOptions: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
export declare const SUPPORTED_TOOLS: ToolConfig[];
|
|
9
|
+
export declare function detectInstalledTools(): ToolConfig[];
|
|
10
|
+
export declare function getToolByName(name: string): ToolConfig | undefined;
|
|
11
|
+
export declare function getToolByCommand(command: string): ToolConfig | undefined;
|
|
12
|
+
export declare function isInteractiveTUI(tool: string): boolean;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=tool-detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-detection.d.ts","sourceRoot":"","sources":["../../src/utils/tool-detection.ts"],"names":[],"mappings":"AAEA,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,eAAe,EAAE,UAAU,EAiBvC,CAAC;AAEF,wBAAgB,oBAAoB,IAAI,UAAU,EAAE,CAUnD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAElE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAExE;AAQD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { sync as commandExistsSync } from 'command-exists';
|
|
2
|
+
export const SUPPORTED_TOOLS = [
|
|
3
|
+
{
|
|
4
|
+
name: 'claude',
|
|
5
|
+
displayName: 'Claude',
|
|
6
|
+
command: 'claude',
|
|
7
|
+
defaultArgs: ['--permission-mode', 'acceptEdits'],
|
|
8
|
+
defaultOptions: {
|
|
9
|
+
'Continue with last context?': '--continue'
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'kiro',
|
|
14
|
+
displayName: 'Kiro',
|
|
15
|
+
command: 'kiro-cli',
|
|
16
|
+
defaultArgs: ['chat'],
|
|
17
|
+
defaultOptions: {}
|
|
18
|
+
}
|
|
19
|
+
];
|
|
20
|
+
export function detectInstalledTools() {
|
|
21
|
+
const installedTools = [];
|
|
22
|
+
for (const tool of SUPPORTED_TOOLS) {
|
|
23
|
+
if (commandExistsSync(tool.command)) {
|
|
24
|
+
installedTools.push(tool);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return installedTools;
|
|
28
|
+
}
|
|
29
|
+
export function getToolByName(name) {
|
|
30
|
+
return SUPPORTED_TOOLS.find(tool => tool.name === name);
|
|
31
|
+
}
|
|
32
|
+
export function getToolByCommand(command) {
|
|
33
|
+
return SUPPORTED_TOOLS.find(tool => tool.command === command);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Tools that are interactive TUIs requiring TTY access.
|
|
37
|
+
* These receive prompts as positional arguments instead of stdin.
|
|
38
|
+
*/
|
|
39
|
+
const INTERACTIVE_TUI_TOOLS = ['claude', 'kiro-cli'];
|
|
40
|
+
export function isInteractiveTUI(tool) {
|
|
41
|
+
return INTERACTIVE_TUI_TOOLS.includes(tool);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=tool-detection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-detection.js","sourceRoot":"","sources":["../../src/utils/tool-detection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAU3D,MAAM,CAAC,MAAM,eAAe,GAAiB;IAC3C;QACE,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,QAAQ;QACrB,OAAO,EAAE,QAAQ;QACjB,WAAW,EAAE,CAAC,mBAAmB,EAAE,aAAa,CAAC;QACjD,cAAc,EAAE;YACd,6BAA6B,EAAE,YAAY;SAC5C;KACF;IACD;QACE,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,MAAM;QACnB,OAAO,EAAE,UAAU;QACnB,WAAW,EAAE,CAAC,MAAM,CAAC;QACrB,cAAc,EAAE,EAAE;KACnB;CACF,CAAC;AAEF,MAAM,UAAU,oBAAoB;IAClC,MAAM,cAAc,GAAiB,EAAE,CAAC;IAExC,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;QACnC,IAAI,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACpC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC;AAChE,CAAC;AAED;;;GAGG;AACH,MAAM,qBAAqB,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAErD,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,82 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pupt/cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.3.0",
|
|
4
|
+
"description": "Powerful Universal Prompt Tool - your faithful prompt companion",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"pt": "./dist/cli.js"
|
|
9
|
+
},
|
|
5
10
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
"cli",
|
|
12
|
+
"claude",
|
|
13
|
+
"claude code",
|
|
14
|
+
"prompt",
|
|
15
|
+
"ai",
|
|
16
|
+
"template",
|
|
17
|
+
"handlebars"
|
|
18
|
+
],
|
|
19
|
+
"author": "Adam Powers <apowers@ato.ms>",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/apowers313/pupt-monorepo.git",
|
|
24
|
+
"directory": "pupt"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public",
|
|
28
|
+
"provenance": true
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"prompts",
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/command-exists": "^1.2.3",
|
|
38
|
+
"@types/fs-extra": "^11.0.4",
|
|
39
|
+
"@types/js-yaml": "^4.0.9",
|
|
40
|
+
"@types/node": "^24.2.1",
|
|
41
|
+
"@vitest/ui": "3.1.4",
|
|
42
|
+
"vitepress": "^1.6.4"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@homebridge/node-pty-prebuilt-multiarch": "^0.11.14",
|
|
46
|
+
"@inquirer/core": "^10.1.15",
|
|
47
|
+
"@inquirer/prompts": "^7.8.1",
|
|
48
|
+
"@inquirer/type": "^3.0.8",
|
|
49
|
+
"@types/uuid": "^10.0.0",
|
|
50
|
+
"boxen": "^8.0.1",
|
|
51
|
+
"chalk": "^5.5.0",
|
|
52
|
+
"command-exists": "^1.2.9",
|
|
53
|
+
"commander": "^14.0.0",
|
|
54
|
+
"cosmiconfig": "^9.0.0",
|
|
55
|
+
"env-paths": "^4.0.0",
|
|
56
|
+
"execa": "^9.6.0",
|
|
57
|
+
"fs-extra": "^11.3.1",
|
|
58
|
+
"minisearch": "^7.1.2",
|
|
59
|
+
"ora": "^8.2.0",
|
|
60
|
+
"pino": "^9.9.0",
|
|
61
|
+
"pino-pretty": "^13.1.1",
|
|
62
|
+
"simple-git": "^3.28.0",
|
|
63
|
+
"strip-ansi": "^7.1.0",
|
|
64
|
+
"uuid": "^11.1.0",
|
|
65
|
+
"zod": "^3.23.8",
|
|
66
|
+
"@pupt/lib": "1.6.0"
|
|
67
|
+
},
|
|
68
|
+
"scripts": {
|
|
69
|
+
"build": "tsc",
|
|
70
|
+
"dev": "tsc --watch",
|
|
71
|
+
"test": "vitest run --no-coverage",
|
|
72
|
+
"test:verbose": "vitest run --no-coverage --reporter=verbose",
|
|
73
|
+
"test:ci": "vitest run --no-coverage --passWithNoTests",
|
|
74
|
+
"test:watch": "vitest",
|
|
75
|
+
"test:ui": "vitest --ui",
|
|
76
|
+
"test:coverage": "vitest run --coverage",
|
|
77
|
+
"lint": "eslint src test && tsc --noEmit",
|
|
78
|
+
"docs:dev": "vitepress dev docs",
|
|
79
|
+
"docs:build": "vitepress build docs",
|
|
80
|
+
"docs:preview": "npm run docs:build && vitepress preview docs --port 9010"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{/* Converted from ad-hoc-long.md */}
|
|
2
|
+
<Prompt name="ad-hoc-long" description="Ad Hoc (Long)" tags={[]}>
|
|
3
|
+
|
|
4
|
+
<Role>
|
|
5
|
+
You are a versatile expert assistant capable of handling complex, multi-part requests that require detailed analysis, planning, or implementation.
|
|
6
|
+
</Role>
|
|
7
|
+
|
|
8
|
+
<Task>
|
|
9
|
+
Address the comprehensive request below with appropriate depth and thoroughness.
|
|
10
|
+
</Task>
|
|
11
|
+
|
|
12
|
+
<Constraint>
|
|
13
|
+
- Read the entire request before beginning response
|
|
14
|
+
- Identify all sub-tasks and requirements
|
|
15
|
+
- Create a prioritized task list focusing on the MAIN objective
|
|
16
|
+
- For debugging tasks:
|
|
17
|
+
- Stay focused on the specific issue reported
|
|
18
|
+
- Follow a systematic process without getting sidetracked
|
|
19
|
+
- Fix the reported issue FIRST before exploring related problems
|
|
20
|
+
- Verify the fix resolves the original issue
|
|
21
|
+
- Organize response to address each part clearly
|
|
22
|
+
- Use appropriate formatting and structure
|
|
23
|
+
- Provide comprehensive solutions
|
|
24
|
+
</Constraint>
|
|
25
|
+
|
|
26
|
+
<Format>
|
|
27
|
+
Organize response based on request type:
|
|
28
|
+
- For multi-part questions: Address each part with clear sections
|
|
29
|
+
- For analysis tasks: Use structured findings and recommendations
|
|
30
|
+
- For implementation tasks: Provide step-by-step approach
|
|
31
|
+
- For debugging:
|
|
32
|
+
1. State the specific issue to be fixed
|
|
33
|
+
2. Reproduce the issue exactly as described
|
|
34
|
+
3. Identify root cause through systematic investigation
|
|
35
|
+
4. Apply targeted fix for that specific issue
|
|
36
|
+
5. Verify the original issue is resolved
|
|
37
|
+
6. Only then address related issues if requested
|
|
38
|
+
|
|
39
|
+
**Complex Request**:
|
|
40
|
+
<Ask.Editor name="prompt" label="Prompt (press enter to open editor):" />
|
|
41
|
+
</Format>
|
|
42
|
+
|
|
43
|
+
<Section>
|
|
44
|
+
N/A (varies by request type)
|
|
45
|
+
</Section>
|
|
46
|
+
|
|
47
|
+
<Constraint>
|
|
48
|
+
- Maintain focus on the specific request
|
|
49
|
+
- Balance thoroughness with clarity
|
|
50
|
+
- Use examples and code samples where helpful
|
|
51
|
+
- Flag any assumptions or uncertainties
|
|
52
|
+
</Constraint>
|
|
53
|
+
|
|
54
|
+
<SuccessCriteria>
|
|
55
|
+
<Criterion>All parts of the request are addressed</Criterion>
|
|
56
|
+
<Criterion>Response is well-organized and easy to follow</Criterion>
|
|
57
|
+
<Criterion>Solutions are practical and implementable</Criterion>
|
|
58
|
+
<Criterion>Any edge cases or considerations are noted</Criterion>
|
|
59
|
+
</SuccessCriteria>
|
|
60
|
+
</Prompt>
|