please-cli 0.1.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.md +21 -0
- package/README.md +125 -0
- package/dist/cli.js +23471 -0
- package/package.json +60 -0
- package/scripts/ask.ps1 +35 -0
- package/scripts/ask.sh +37 -0
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "please-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "AI-powered shell command assistant",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/cli.js",
|
|
7
|
+
"module": "dist/cli.js",
|
|
8
|
+
"bin": {
|
|
9
|
+
"pls": "dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"scripts",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE.md"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "bun run src/cli.ts",
|
|
19
|
+
"build": "bun build src/cli.ts --outdir=dist --target=bun",
|
|
20
|
+
"prepublishOnly": "bun run build"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"cli",
|
|
24
|
+
"ai",
|
|
25
|
+
"shell",
|
|
26
|
+
"terminal",
|
|
27
|
+
"assistant",
|
|
28
|
+
"command-line",
|
|
29
|
+
"natural-language",
|
|
30
|
+
"gemini",
|
|
31
|
+
"openai",
|
|
32
|
+
"ollama"
|
|
33
|
+
],
|
|
34
|
+
"author": "Umut Şen",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"engines": {
|
|
37
|
+
"bun": ">=1.0.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@ai-sdk/google": "^1.0.0",
|
|
41
|
+
"@ai-sdk/openai": "^1.0.0",
|
|
42
|
+
"@clack/prompts": "^0.9.0",
|
|
43
|
+
"@google/generative-ai": "^0.24.1",
|
|
44
|
+
"ai": "^4.0.0",
|
|
45
|
+
"marked": "^15.0.0",
|
|
46
|
+
"marked-terminal": "^7.0.0",
|
|
47
|
+
"ollama": "^0.6.3",
|
|
48
|
+
"openai": "^6.33.0",
|
|
49
|
+
"picocolors": "^1.1.0",
|
|
50
|
+
"wrap-ansi": "^10.0.0",
|
|
51
|
+
"zod": "^3.23.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "^22.0.0",
|
|
55
|
+
"bun-types": "latest"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"typescript": "^5.0.0"
|
|
59
|
+
}
|
|
60
|
+
}
|
package/scripts/ask.ps1
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# please-cli wrapper function for PowerShell
|
|
2
|
+
# Add this to your $PROFILE
|
|
3
|
+
|
|
4
|
+
function pls {
|
|
5
|
+
# Set environment variable to indicate running through wrapper
|
|
6
|
+
$env:ASK_CLI_WRAPPER = "1"
|
|
7
|
+
|
|
8
|
+
# Run the CLI with all arguments
|
|
9
|
+
& bun run "C:\Users\Umut\Projects\shell-helper\src\cli.ts" @args
|
|
10
|
+
|
|
11
|
+
# Check if a command was approved
|
|
12
|
+
$tempFile = Join-Path $HOME ".ai_cmd_temp"
|
|
13
|
+
if (Test-Path $tempFile) {
|
|
14
|
+
$cmd = Get-Content $tempFile -Raw
|
|
15
|
+
Remove-Item $tempFile
|
|
16
|
+
|
|
17
|
+
if ($cmd) {
|
|
18
|
+
# Add to PSReadLine history if available
|
|
19
|
+
if (Get-Command Add-History -ErrorAction SilentlyContinue) {
|
|
20
|
+
Add-History -CommandLine $cmd
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# Also try PSConsoleReadLine for better history integration
|
|
24
|
+
try {
|
|
25
|
+
[Microsoft.PowerShell.PSConsoleReadLine]::AddToHistory($cmd)
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
# PSReadLine not available or failed
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# Execute the command
|
|
32
|
+
Invoke-Expression $cmd
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
package/scripts/ask.sh
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# please-cli wrapper function for Bash/Zsh
|
|
3
|
+
# Add this to your ~/.bashrc or ~/.zshrc
|
|
4
|
+
|
|
5
|
+
pls() {
|
|
6
|
+
# Path to the please-cli binary
|
|
7
|
+
local PLEASE_CLI_PATH="$HOME/.config/please-cli/bin/please"
|
|
8
|
+
|
|
9
|
+
# If not installed globally, use local bun run
|
|
10
|
+
if [[ ! -f "$PLEASE_CLI_PATH" ]]; then
|
|
11
|
+
PLEASE_CLI_PATH="bun run /path/to/please-cli/src/index.ts"
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
# Run the CLI with all arguments
|
|
15
|
+
$PLEASE_CLI_PATH "$@"
|
|
16
|
+
|
|
17
|
+
# Check if a command was approved
|
|
18
|
+
if [[ -f ~/.ai_cmd_temp ]]; then
|
|
19
|
+
local cmd
|
|
20
|
+
cmd=$(cat ~/.ai_cmd_temp)
|
|
21
|
+
rm ~/.ai_cmd_temp
|
|
22
|
+
|
|
23
|
+
if [[ -n "$cmd" ]]; then
|
|
24
|
+
# Add to shell history
|
|
25
|
+
if [[ -n "$ZSH_VERSION" ]]; then
|
|
26
|
+
# Zsh
|
|
27
|
+
print -s "$cmd"
|
|
28
|
+
elif [[ -n "$BASH_VERSION" ]]; then
|
|
29
|
+
# Bash
|
|
30
|
+
history -s "$cmd"
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
# Execute the command
|
|
34
|
+
eval "$cmd"
|
|
35
|
+
fi
|
|
36
|
+
fi
|
|
37
|
+
}
|