Skip to content

Commit 18b714e

Browse files
authored
Ai parsing (#17)
* chore: update dependencies and remove unused tool configuration - Updated @tanstack/react-router and related packages to version 1.124.0. - Upgraded oxlint from version 1.4.0 to 1.5.0. - Removed obsolete sample-tool.json file from tools collection. - Added new yt-dlp.json configuration for video downloading tool. - Refactored ToolCard component to enhance view transitions and improve accessibility. - Simplified ParameterList component by removing unused selectedParameter state. - Enhanced RuntimePreview component to display parameter flags alongside names. - Updated ToolEditor to improve display name handling with view transitions. - Configured router to enable default view transitions for smoother navigation. - Adjusted tools index route to include tool descriptions and improve data handling. - Disabled link crawling in Vite configuration for better performance. * Refactor tool editor UI and import functionality - Removed the generate.ts file and integrated its functionality into a new script for generating the JSON specification. - Simplified the ImportDialog component by removing unnecessary tabs and states, focusing solely on JSON import. - Consolidated dialog state management in tool-editor.store.ts to a single method for opening dialogs. - Updated tool-editor types to clarify the distinction between new tool types. - Enhanced the tools index page by cleaning up imports and removing unused components. - Deleted the tailwind.config.js file as it is no longer needed. - Adjusted tsconfig.json to include a specific file for type definitions. - Configured Vite to clear the output directory before building. - Added a new AIParsing component to handle AI-based help text parsing. - Created a NewToolDialog component that integrates manual tool creation and AI parsing. - Developed a prompt generation function for AI parsing to ensure structured output. * Enhance AIParsing component with model selection and improve command tree rendering logic * Refactor dialog state management to use a unified setDialogOpen action and remove unused subcommands from test data * Refactor AIParsing component to accept onParseCompleted prop and handle parsed tool; update NewToolDialog to integrate AI parsing results; enhance CommandTree with improved subcommand handling and state management; adjust tests to reflect new state structure and dialog states. * feat: add AI parsing and import functionality; refactor tool creation dialog and manual tool input; update dependencies * feat: enhance tool editor with new properties and validation; refactor AI parsing and import components for improved state management * feat: update README for enhanced AI parsing description; remove unused images; bump package dependencies; refactor tool editor types and utility functions; clean up test cases and setup * refactor: streamline JSON schemas and improve formatting; enhance tool editor state management; update prompt generation; adjust test cases for consistency * refactor: improve JSON schema formatting; enhance AIParsing component with API key handling and save option; update NewToolDialog for better navigation; adjust tool editor types for required fields; streamline tool route component interactions
1 parent f8c5f21 commit 18b714e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1607
-814
lines changed

README.md

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
1-
# Commandly
2-
3-
## Description
4-
5-
A user-friendly way to generate CLI commands using UI.
6-
7-
Main UI
8-
![Main UI Screenshot ](./docs/image.png)
9-
10-
Generated JSON
11-
![Json Output - UI Screenshot](image.png)
1+
<div align="center">
2+
<h1>Commandly</h1>
3+
<img src="public/apple-touch-icon.png" alt="commandly" width="200px">
4+
</div>
5+
6+
<h4 align="center">A user-friendly way to generate CLI commands using UI. Quickly turn help text from any CLI tool into UI using AI.</h4>
7+
8+
<p align="center">
9+
<a href="#features">Features</a> •
10+
<a href="#contributing">Contribute</a> •
11+
<a href="https://buymeacoffee.com/divyeshio" target="_blank">Sponsor</a> •
12+
<a href="#license">License</a> •
13+
</p>
1214

1315
## Features
1416

17+
<h1 align="center">
18+
<img src="public/images/ui.png" alt="commandly-ui" width="720px">
19+
<img src="public/images/tool-editor.png" alt="commandly-tool-editor" width="720px">
20+
<br>
21+
</h1>
22+
1523
- Commands and Subcommands
1624
- Parameters
1725
- Runtime Preview
@@ -22,21 +30,22 @@ Generated JSON
2230
- Saved Commands - using localstorage
2331
- Exclusion Groups
2432
- Json specification
33+
- AI Parsing - Quickly turn help text from any CLI tool into UI
2534

2635
## Todos
2736

28-
- Implement parsing help text into json structure using AI.
37+
- ~~Implement parsing help text into json structure using AI.~~
2938
- Explore MCP server
3039
- Test and Run commands from browser. Maybe using some container to securely run commands or locally using wasm.
3140
- More tests
3241
- Improve UI, validations.
33-
- Shadcn Registry (maybe?)
42+
- Shadcn Registry
3443

3544
## Motivation
3645

3746
When there are lots of commands and options in cli tools like [ffmpeg](https://github.com/FFmpeg/FFmpeg), I often find it it confusing and I'm lazy to figure it out all by myself (or just use ChatGPT).
3847

39-
We also know LLMs love structured inputs, what better than a clearly defined json specification with listing all commands and options that go into a cli tool.
48+
We also know LLMs love structured inputs, what better than a clearly defined json with listing all commands and options that go into a cli tool.
4049

4150
And lastly, MCPs. Goal is to expose all these tools via mcp and llms would be able to get all the details of commands and options whenever and wherever required.
4251

@@ -50,8 +59,6 @@ For adding new tools:
5059
2. Copy **Flat** Json Output
5160
3. Raise a PR, adding json file to public/tools-collection.
5261

53-
**Disclaimer**: Most of it is vibe-coded. 100% of the tests were written using vibe-coding and some of them are too basic. And I know there are bugs for sure, please file an issue. Contributions are Welcome.
54-
5562
## License
5663

5764
Licensed under the [MIT license](https://github.com/divyeshio/Commandly/blob/main/LICENSE.md).

bun.lock

Lines changed: 82 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/image.png

-213 KB
Binary file not shown.

image.png

-309 KB
Binary file not shown.

package.json

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"build:specification": "bun run ./specification/generate.ts"
1818
},
1919
"dependencies": {
20+
"@ai-sdk/openai": "^1.3.22",
2021
"@hookform/resolvers": "^4.1.3",
2122
"@radix-ui/react-hover-card": "^1.1.14",
2223
"@radix-ui/react-label": "^2.1.7",
@@ -25,11 +26,13 @@
2526
"@tailwindcss/postcss": "^4.1.11",
2627
"@tailwindcss/vite": "^4.1.11",
2728
"@tanstack/react-form": "^1.12.4",
29+
"@tanstack/react-pacer": "^0.8.0",
2830
"@tanstack/react-query": "^5.81.5",
29-
"@tanstack/react-router": "^1.123.0",
30-
"@tanstack/react-router-with-query": "^1.123.0",
31-
"@tanstack/react-start": "^1.123.0",
32-
"@tanstack/zod-adapter": "^1.123.0",
31+
"@tanstack/react-router": "^1.124.0",
32+
"@tanstack/react-router-with-query": "^1.124.0",
33+
"@tanstack/react-start": "^1.124.1",
34+
"@tanstack/zod-adapter": "^1.124.0",
35+
"ai": "^4.3.16",
3336
"class-variance-authority": "^0.7.1",
3437
"clsx": "^2.1.1",
3538
"cmdk": "^1.1.1",
@@ -45,12 +48,12 @@
4548
"tailwindcss-animate": "^1.0.7",
4649
"uuid": "^11.1.0",
4750
"vite": "^6.3.5",
48-
"zod": "^3.25.67"
51+
"zod": "^3.25.71"
4952
},
5053
"devDependencies": {
5154
"@tanstack/react-query-devtools": "^5.81.5",
52-
"@tanstack/react-router-devtools": "^1.123.0",
53-
"@tanstack/router-plugin": "^1.123.0",
55+
"@tanstack/react-router-devtools": "^1.124.0",
56+
"@tanstack/router-plugin": "^1.124.0",
5457
"@testing-library/jest-dom": "^6.6.3",
5558
"@testing-library/react": "^16.3.0",
5659
"@testing-library/user-event": "^14.6.1",
@@ -61,7 +64,7 @@
6164
"@vitejs/plugin-react": "^4.6.0",
6265
"@vitest/coverage-v8": "3.2.4",
6366
"jsdom": "^26.1.0",
64-
"oxlint": "^1.4.0",
67+
"oxlint": "^1.5.0",
6568
"typescript": "^5.8.3",
6669
"vite-tsconfig-paths": "^5.1.4",
6770
"vitest": "^3.2.4"
Lines changed: 82 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,55 @@
1717
"version": {
1818
"type": "string"
1919
},
20+
"category": {
21+
"type": "string"
22+
},
23+
"tags": {
24+
"type": "array",
25+
"items": {
26+
"type": "string"
27+
}
28+
},
29+
"url": {
30+
"type": "string",
31+
"format": "uri"
32+
},
2033
"commands": {
2134
"type": "array",
2235
"items": {
23-
"$ref": "#/$defs/__schema0"
36+
"type": "object",
37+
"properties": {
38+
"id": {
39+
"type": "string",
40+
"format": "uuid",
41+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
42+
},
43+
"parentCommandId": {
44+
"type": "string",
45+
"format": "uuid",
46+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
47+
},
48+
"name": {
49+
"type": "string"
50+
},
51+
"description": {
52+
"type": "string"
53+
},
54+
"isDefault": {
55+
"type": "boolean"
56+
},
57+
"sortOrder": {
58+
"type": "number"
59+
}
60+
},
61+
"required": [
62+
"id",
63+
"name",
64+
"description",
65+
"isDefault",
66+
"sortOrder"
67+
],
68+
"additionalProperties": false
2469
}
2570
},
2671
"parameters": {
@@ -56,11 +101,20 @@
56101
},
57102
"parameterType": {
58103
"type": "string",
59-
"enum": ["Flag", "Option", "Argument"]
104+
"enum": [
105+
"Flag",
106+
"Option",
107+
"Argument"
108+
]
60109
},
61110
"dataType": {
62111
"type": "string",
63-
"enum": ["String", "Number", "Boolean", "Enum"]
112+
"enum": [
113+
"String",
114+
"Number",
115+
"Boolean",
116+
"Enum"
117+
]
64118
},
65119
"isRequired": {
66120
"type": "boolean"
@@ -189,7 +243,10 @@
189243
},
190244
"dependencyType": {
191245
"type": "string",
192-
"enum": ["requires", "conflicts_with"]
246+
"enum": [
247+
"requires",
248+
"conflicts_with"
249+
]
193250
},
194251
"conditionValue": {
195252
"type": "string"
@@ -208,6 +265,7 @@
208265
"required": [
209266
"id",
210267
"name",
268+
"commandId",
211269
"description",
212270
"parameterType",
213271
"dataType",
@@ -236,7 +294,10 @@
236294
},
237295
"exclusionType": {
238296
"type": "string",
239-
"enum": ["mutual_exclusive", "required_one_of"]
297+
"enum": [
298+
"mutual_exclusive",
299+
"required_one_of"
300+
]
240301
},
241302
"parameterIds": {
242303
"type": "array",
@@ -245,22 +306,33 @@
245306
}
246307
}
247308
},
248-
"required": ["name", "exclusionType", "parameterIds"],
309+
"required": [
310+
"name",
311+
"exclusionType",
312+
"parameterIds"
313+
],
249314
"additionalProperties": false
250315
}
251316
},
252317
"supportedInput": {
253318
"type": "array",
254319
"items": {
255320
"type": "string",
256-
"enum": ["StandardInput", "Parameter"]
321+
"enum": [
322+
"StandardInput",
323+
"Parameter"
324+
]
257325
}
258326
},
259327
"supportedOutput": {
260328
"type": "array",
261329
"items": {
262330
"type": "string",
263-
"enum": ["StandardOutput", "File", "Directory"]
331+
"enum": [
332+
"StandardOutput",
333+
"File",
334+
"Directory"
335+
]
264336
}
265337
}
266338
},
@@ -273,42 +345,5 @@
273345
"supportedInput",
274346
"supportedOutput"
275347
],
276-
"additionalProperties": false,
277-
"$defs": {
278-
"__schema0": {
279-
"type": "object",
280-
"properties": {
281-
"id": {
282-
"type": "string",
283-
"format": "uuid",
284-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
285-
},
286-
"parentCommandId": {
287-
"type": "string",
288-
"format": "uuid",
289-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
290-
},
291-
"name": {
292-
"type": "string"
293-
},
294-
"description": {
295-
"type": "string"
296-
},
297-
"isDefault": {
298-
"type": "boolean"
299-
},
300-
"sortOrder": {
301-
"type": "number"
302-
},
303-
"subcommands": {
304-
"type": "array",
305-
"items": {
306-
"$ref": "#/$defs/__schema0"
307-
}
308-
}
309-
},
310-
"required": ["id", "name", "description", "isDefault", "sortOrder"],
311-
"additionalProperties": false
312-
}
313-
}
314-
}
348+
"additionalProperties": false
349+
}

public/tools-collection/sample-tool.json

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)