prompt-language-shell 0.0.1 → 0.0.2
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 +12 -18
- package/dist/index.js +20 -6
- package/dist/parser.js +13 -0
- package/dist/ui/Please.js +5 -0
- package/dist/ui/Welcome.js +9 -0
- package/package.json +18 -5
package/LICENSE
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
ISC License
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2024 Aleksander
|
|
4
4
|
|
|
5
|
-
Permission
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { readFileSync } from 'fs';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { dirname, join } from 'path';
|
|
6
|
+
import { render } from 'ink';
|
|
7
|
+
import { Please } from './ui/Please.js';
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
// Get package info
|
|
11
|
+
const packageJsonPath = join(__dirname, '../package.json');
|
|
12
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
13
|
+
// Check if running from development (symlinked) or production
|
|
14
|
+
const isDev = process.argv[1]?.includes('/node_modules/.bin/') === false;
|
|
15
|
+
const appInfo = {
|
|
16
|
+
name: packageJson.name,
|
|
17
|
+
version: packageJson.version,
|
|
18
|
+
description: packageJson.description,
|
|
19
|
+
isDev,
|
|
20
|
+
};
|
|
21
|
+
render(_jsx(Please, { app: appInfo }));
|
package/dist/parser.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses a comma-separated list of tasks from command-line prompt
|
|
3
|
+
* Strips exclamation marks and periods from each task
|
|
4
|
+
*
|
|
5
|
+
* @param prompt - Raw command-line input string
|
|
6
|
+
* @returns Array of parsed task strings
|
|
7
|
+
*/
|
|
8
|
+
export function parseCommands(prompt) {
|
|
9
|
+
return prompt
|
|
10
|
+
.split(',')
|
|
11
|
+
.map((task) => task.trim().replace(/[!.]/g, '').trim())
|
|
12
|
+
.filter((task) => task.length > 0);
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text, Box } from 'ink';
|
|
3
|
+
export function Welcome({ info: app }) {
|
|
4
|
+
const descriptionLines = app.description
|
|
5
|
+
.split('. ')
|
|
6
|
+
.map((line) => line.replace(/\.$/, ''))
|
|
7
|
+
.filter(Boolean);
|
|
8
|
+
return (_jsx(Box, { alignSelf: "flex-start", marginTop: 1, children: _jsxs(Box, { borderStyle: "round", borderColor: "green", paddingX: 3, paddingY: 1, marginBottom: 1, flexDirection: "column", children: [_jsx(Box, { flexDirection: "column", children: _jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { bold: true, children: "Please... " }), _jsx(Text, { color: "grey", children: "( " }), _jsx(Text, { color: "greenBright", bold: true, children: "pls" }), _jsxs(Text, { children: [" v", app.version] }), app.isDev && _jsx(Text, { color: "yellowBright", children: " dev" }), _jsx(Text, { color: "grey", children: " )" })] }) }), _jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { color: "greenBright", children: "Prompt Language Shell " }), _jsx(Text, { children: "interface" })] }), descriptionLines.map((line, index) => (_jsx(Box, { children: _jsxs(Text, { dimColor: true, children: [line, "."] }) }, index)))] }) }));
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prompt-language-shell",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Your personal command-line concierge. Ask politely, and it gets things done.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,8 +11,15 @@
|
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "tsc",
|
|
15
|
-
"
|
|
14
|
+
"build": "tsc && chmod +x dist/index.js",
|
|
15
|
+
"dev": "tsc && chmod +x dist/index.js && tsc --watch",
|
|
16
|
+
"prepare": "npm run build",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"test:watch": "vitest",
|
|
19
|
+
"format": "prettier --write .",
|
|
20
|
+
"format:check": "prettier --check .",
|
|
21
|
+
"lint": "eslint .",
|
|
22
|
+
"lint:fix": "eslint --fix ."
|
|
16
23
|
},
|
|
17
24
|
"repository": {
|
|
18
25
|
"type": "git",
|
|
@@ -33,10 +40,16 @@
|
|
|
33
40
|
},
|
|
34
41
|
"homepage": "https://github.com/aswitalski/pls#readme",
|
|
35
42
|
"dependencies": {
|
|
36
|
-
"
|
|
43
|
+
"ink": "^6.4.0",
|
|
44
|
+
"react": "^19.2.0"
|
|
37
45
|
},
|
|
38
46
|
"devDependencies": {
|
|
47
|
+
"@types/node": "^20.10.6",
|
|
48
|
+
"@types/react": "^19.2.2",
|
|
49
|
+
"eslint": "^9.17.0",
|
|
50
|
+
"prettier": "^3.6.2",
|
|
39
51
|
"typescript": "^5.3.3",
|
|
40
|
-
"
|
|
52
|
+
"typescript-eslint": "^8.19.1",
|
|
53
|
+
"vitest": "^4.0.5"
|
|
41
54
|
}
|
|
42
55
|
}
|