mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-23 08:45:50 +00:00
feat(artifact): add /artifacts slash command entry
Co-Authored-By: glm-5.2 <zai-org@claude-code-best.win>
This commit is contained in:
11
src/commands/artifacts/artifacts.tsx
Normal file
11
src/commands/artifacts/artifacts.tsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import type { LocalJSXCommandOnDone } from 'src/types/command.js';
|
||||||
|
import type { ToolUseContext } from 'src/Tool.js';
|
||||||
|
import { ArtifactsMenu } from './ArtifactsMenu.js';
|
||||||
|
import { extractArtifacts } from './scanner.js';
|
||||||
|
|
||||||
|
export async function call(onDone: LocalJSXCommandOnDone, context: ToolUseContext): Promise<React.ReactNode> {
|
||||||
|
const messages = context.messages ?? [];
|
||||||
|
const artifacts = extractArtifacts(messages);
|
||||||
|
return <ArtifactsMenu artifacts={artifacts} onExit={onDone} />;
|
||||||
|
}
|
||||||
13
src/commands/artifacts/index.ts
Normal file
13
src/commands/artifacts/index.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import type { Command } from '../../commands.js'
|
||||||
|
|
||||||
|
const artifacts = {
|
||||||
|
type: 'local-jsx',
|
||||||
|
name: 'artifacts',
|
||||||
|
description:
|
||||||
|
'List HTML artifacts uploaded to cloud-artifacts in this session',
|
||||||
|
isEnabled: () => true,
|
||||||
|
userFacingName: () => 'Artifacts',
|
||||||
|
load: () => import('./artifacts.js'),
|
||||||
|
} satisfies Command
|
||||||
|
|
||||||
|
export default artifacts
|
||||||
Reference in New Issue
Block a user