feat(new tool): Docker Inspect to Docker Run

This commit is contained in:
ShareVB committed 2025-08-23 00:07:46 +02:00
1 parent 81bc96515b
commit e942fe4f04
5 files changed
+84

No files matched your search

+1
View File
@@ -265,6 +265,7 @@
"quicktype-core": "^23.1.3",
"randexp": "^0.5.3",
"regex": "^4.4.0",
"rekcod": "^3.0.0",
"riimut": "^0.9.1",
"roboto-base64": "^0.1.2",
"rtf-stream-parser": "^3.8.0",
+9
View File
@@ -683,6 +683,9 @@ dependencies:
regex:
specifier: ^4.4.0
version: 4.4.0
rekcod:
specifier: ^3.0.0
version: 3.0.0
riimut:
specifier: ^0.9.1
version: 0.9.1
@@ -16517,6 +16520,12 @@ packages:
jsesc: 3.0.2
dev: true
/rekcod@3.0.0:
resolution: {integrity: sha512-EjV3CooK3rakY5mnGxJNeKrMpUQLI5YnbP3POFkTlyK+MrPB3RrsHwCkA6JPrKIO1DAaQt7v2PvwIwDdZd+TPw==}
engines: {node: '>=10'}
hasBin: true
dev: false
/remove-trailing-separator@1.1.0:
resolution: {integrity: sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==}
dev: false
@@ -0,0 +1,58 @@
<script setup lang="ts">
import { parse } from 'rekcod';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const dockerInspect = ref('');
const conversionResult = computed(() => {
const inspects = dockerInspect.value.trim();
if (!inspects) {
return { commands: '', errors: [] };
}
try {
return { commands: parse(inspects).map(c => c.command).join('\n'), errors: [] };
}
catch (e: any) {
return { commands: '#see error messages', errors: e.toString().split('\n') };
}
});
const errors = computed(() => conversionResult.value.errors);
const dockerRunCommand = computed(() => conversionResult.value.commands);
const MONACO_EDITOR_OPTIONS = {
automaticLayout: true,
formatOnType: true,
formatOnPaste: true,
};
</script>
<template>
<div>
<c-label label="Paste your Docker Inspect JSON output:">
<div relative w-full>
<c-monaco-editor
v-model:value="dockerInspect"
theme="vs-dark"
language="json"
height="250px"
:options="MONACO_EDITOR_OPTIONS"
/>
</div>
</c-label>
<div v-if="errors.length > 0">
<n-alert title="The following errors occured:" type="error" mt-5>
<ul>
<li v-for="(message, index) of errors" :key="index">
{{ message }}
</li>
</ul>
</n-alert>
</div>
<n-divider />
<TextareaCopyable :value="dockerRunCommand" language="bash" copy-placement="outside" />
</div>
</template>
@@ -0,0 +1,13 @@
import { BrandDocker } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Docker inspect to Docker run',
path: '/docker-inspect-to-docker-run',
description: 'Convert docker inspect command json result back to Docker run command',
keywords: ['docker', 'inspect', 'run'],
component: () => import('./docker-inspect-to-docker-run.vue'),
icon: BrandDocker,
createdAt: new Date('2025-08-15'),
category: 'Docker',
});
+3
View File
@@ -0,0 +1,3 @@
declare module 'rekcod' {
export function parse(inspectJson: string): { command: string }[];
}