Skip to content

Commit aa20dc1

Browse files
committed
feat(new tool): Explain Shell
Fix #293
1 parent 59edad8 commit aa20dc1

2 files changed

Lines changed: 80 additions & 0 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<script setup lang="ts">
2+
import { useITStorage, useQueryParam } from '@/composable/queryParams';
3+
4+
const command = useQueryParam({ tool: 'explainshell', name: 'command', defaultValue: '' });
5+
const explainshellUrl = useITStorage('explainchain:url', 'https://explainshell.com');
6+
7+
const iframeUrl = ref('');
8+
function openExplain() {
9+
const encoded = encodeURIComponent(command.value.trim());
10+
iframeUrl.value = `${explainshellUrl.value}/explain?cmd=${encoded}`;
11+
}
12+
</script>
13+
14+
<template>
15+
<div>
16+
<details mb-1>
17+
<summary>Explain Shell Configuration</summary>
18+
<n-card>
19+
<c-input-text
20+
v-model:value="explainshellUrl"
21+
label="Custom Explain Shell Url:"
22+
label-position="left"
23+
placeholder="Put your custom explainshell url here..."
24+
mb-1
25+
/>
26+
<n-p>
27+
You can self host Explain Shell, to get total privacy. See:
28+
<c-link href="https://github.com/idank/explainshell?tab=readme-ov-file#running-explainshell-locally" target="_blank">
29+
Local Explain Shell docker install
30+
</c-link>
31+
</n-p>
32+
</n-card>
33+
</details>
34+
<n-form-item label="Shell command:" label-placement="left">
35+
<n-input
36+
v-model:value="command"
37+
placeholder="Shell command to explain"
38+
clearable
39+
mr-1
40+
/>
41+
</n-form-item>
42+
43+
<n-space justify="center">
44+
<n-button
45+
type="primary"
46+
:disabled="!command"
47+
@click="openExplain"
48+
>
49+
Explain
50+
</n-button>
51+
</n-space>
52+
53+
<n-divider />
54+
55+
<div style="height: 70vh; border: 1px solid #ddd; border-radius: 6px; overflow: hidden;">
56+
<iframe
57+
v-if="iframeUrl"
58+
:src="iframeUrl"
59+
style="width: 100%; height: 100%; border: none;"
60+
/>
61+
<div v-else style="padding: 1rem; text-align: center; color: #888;">
62+
Enter a shell command to explain
63+
</div>
64+
</div>
65+
</div>
66+
</template>

src/tools/explainshell/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Terminal2 } from '@vicons/tabler';
2+
import { defineTool } from '../tool';
3+
4+
export const tool = defineTool({
5+
name: 'Explain Shell Command',
6+
path: '/explainshell',
7+
description: 'Use explainshell.com (or a self hosted) to explain a shell command',
8+
keywords: ['explain', 'shell'],
9+
component: () => import('./explainshell.vue'),
10+
icon: Terminal2,
11+
createdAt: new Date('2026-01-30'),
12+
category: 'Data',
13+
externAccessDescription: 'This tool calls https://explainshell.com (unless you self host it) this provided shell command.',
14+
});

0 commit comments

Comments
 (0)