Skip to content

Commit c70a299

Browse files
authored
Merge pull request #244 from underctrl-io/devtools-ai-indicator
feat(devtools): add ai indicator to commands
2 parents 8cc5a19 + 53e7412 commit c70a299

File tree

4 files changed

+47
-17
lines changed

4 files changed

+47
-17
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@
5959
"http-proxy-middleware@>=1.3.0 <2.0.9": ">=2.0.9",
6060
"http-proxy-middleware@>=1.3.0 <2.0.8": ">=2.0.8",
6161
"undici@>=6.0.0 <6.21.2": ">=6.21.2",
62-
"webpack-dev-server@<=5.2.0": ">=5.2.1"
62+
"webpack-dev-server@<=5.2.0": ">=5.2.1",
63+
"brace-expansion@>=1.0.0 <=1.1.11": ">=1.1.12",
64+
"brace-expansion@>=2.0.0 <=2.0.1": ">=2.0.2"
6365
},
6466
"onlyBuiltDependencies": [
6567
"@swc/core",

packages/devtools-ui/src/routes/commands.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ interface CommandData {
2626
parentPath: string;
2727
relativePath: string;
2828
middlewares: string[];
29+
supportsAI: boolean;
30+
description?: string;
2931
}
3032

3133
interface MiddlewareData {
@@ -52,12 +54,25 @@ const CommandDetails = ({
5254
}) => {
5355
return (
5456
<Card className="p-4 mt-4 bg-muted/50 border-l-4 border-l-primary rounded-sm">
55-
<h3 className="text-lg font-bold mb-2">{command.name}</h3>
57+
<h3 className="text-lg font-bold mb-2">
58+
{command.name}
59+
{command.supportsAI && (
60+
<Badge variant="outline" className="ml-2">
61+
62+
</Badge>
63+
)}
64+
</h3>
5665
<div className="grid grid-cols-1 md:grid-cols-2 gap-2 text-sm">
5766
<div>
5867
<p className="text-muted-foreground">ID:</p>
5968
<p className="font-mono text-xs break-all">{command.id}</p>
6069
</div>
70+
{command.description && (
71+
<div>
72+
<p className="text-muted-foreground">Description:</p>
73+
<p className="italic">{command.description}</p>
74+
</div>
75+
)}
6176
<div>
6277
<p className="text-muted-foreground">Category:</p>
6378
<p>{command.category || 'Uncategorized'}</p>
@@ -106,13 +121,15 @@ const TreeNode = ({
106121
hasMiddleware = false,
107122
onClick,
108123
isSelected,
124+
supportsAI,
109125
}: {
110126
name: string;
111127
children?: React.ReactNode;
112128
isCommand?: boolean;
113129
hasMiddleware?: boolean;
114130
onClick?: () => void;
115131
isSelected?: boolean;
132+
supportsAI?: boolean;
116133
}) => {
117134
const [isOpen, setIsOpen] = useState(true);
118135
const hasChildren = Boolean(children);
@@ -159,6 +176,11 @@ const TreeNode = ({
159176
<Shield className="h-3 w-3 mr-1" />λ
160177
</Badge>
161178
)}
179+
{supportsAI && (
180+
<Badge variant="outline" className="ml-2 py-0 h-5">
181+
182+
</Badge>
183+
)}
162184
</div>
163185

164186
{hasChildren && isOpen && (
@@ -236,6 +258,7 @@ function CommandHierarchy() {
236258
key={command.id}
237259
name={command.name}
238260
isCommand={true}
261+
supportsAI={command.supportsAI}
239262
hasMiddleware={command.middlewares.length > 0}
240263
onClick={() => setSelectedCommand(command.id)}
241264
isSelected={selectedCommand === command.id}

packages/devtools/src/server/routes/commands.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ app.get('/', (req, res) => {
1414
{
1515
id: command.command.id,
1616
name: command.data.command.name,
17+
description: command.data.command.description,
1718
path: command.command.path,
1819
category: command.command.category,
1920
parentPath: command.command.parentPath,
2021
relativePath: command.command.relativePath,
2122
middlewares: command.command.middlewares,
23+
supportsAI: !!command.data.ai,
2224
},
2325
];
2426
});

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)