diff --git a/.opencode/plugin/example.ts b/.opencode/plugin/example.ts new file mode 100644 index 0000000..219947d --- /dev/null +++ b/.opencode/plugin/example.ts @@ -0,0 +1,20 @@ +import { tool, type Plugin } from "@opencode-ai/plugin" + +export const MyPlugin: Plugin = async ({ project, client, $, directory, worktree }) => { + console.log("Plugin initialized!") + + return { + // Hook implementations go here + tool: { + mytool: tool({ + description: "获取foo的问候语", + args: { + foo: tool.schema.string(), + }, + async execute(args, ctx) { + return `Hello ${args.foo}!` + }, + }), + } + } +} \ No newline at end of file diff --git a/.opencode/skill/pnpm-start/SKILL.md b/.opencode/skill/pnpm-start/SKILL.md new file mode 100644 index 0000000..bdc07f7 --- /dev/null +++ b/.opencode/skill/pnpm-start/SKILL.md @@ -0,0 +1,12 @@ +--- +name: '启动项目' +description: '使用 pnpm 启动项目' +tags: + - 'pnpm' +--- + +# 启动项目 + +在使用 pnpm 进行项目管理时,启动项目通常是通过运行定义在 `package.json` 文件中的脚本来完成的。以下是使用 pnpm 启动项目的基本步骤: + +pnpm dev \ No newline at end of file diff --git a/.opencode/tool/project.ts b/.opencode/tool/project.ts new file mode 100644 index 0000000..2a62437 --- /dev/null +++ b/.opencode/tool/project.ts @@ -0,0 +1,11 @@ +import { tool } from "@opencode-ai/plugin" + +export default tool({ + description: "获取当前会话信息", + args: {}, + async execute(args, context) { + // Access context information + const { agent, sessionID, messageID } = context + return `智能体: ${agent}, 会话ID: ${sessionID}, 消息ID: ${messageID}` + }, +}) \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..f1b9397 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,60 @@ +# 项目概览 + +## 项目名称 +next-simple-template + +## 包名/作用域 +@kevisual/next-simple-template + +## 项目描述 +Light Code - 一个直觉、高效的代码编辑器前端界面 + +## 技术栈 +- **框架**: Next.js 16.1.1 (App Router) +- **语言**: TypeScript 5 +- **UI库**: React 19.2.3 +- **样式**: Tailwind CSS 4 +- **组件库**: Radix UI (Dialog, Slot) +- **状态管理**: Zustand 5.0.9 +- **图标**: Lucide React +- **工具库**: + - class-variance-authority (组件变体) + - clsx + tailwind-merge (样式处理) + - react-toastify (通知) + +## 项目结构 +``` +src/ +├── app/ +│ ├── layout.tsx # 根布局,配置字体和元数据 +│ ├── page.tsx # 首页组件 +│ └── globals.css # 全局样式 +├── components/ +│ └── ui/ +│ ├── button.tsx # 按钮组件 (支持多种变体) +│ └── dialog.tsx # 对话框组件 +├── lib/ +│ └── utils.ts # 工具函数 (cn类名合并) +└── proxy.ts # 代理配置 +``` + +## 核心配置 +- **路径别名**: `@/*` 映射到 `./src/*` +- **构建输出**: + - 开发环境: 标准Next.js + - 生产环境: 静态导出到 `dist` 目录 +- **Base Path**: 生产环境使用 `basename` 路径 + +## 可用命令 +- `pnpm dev` - 启动开发服务器 +- `pnpm build` - 构建生产版本 +- `pnpm start` - 启动生产服务器 +- `pnpm pub` - 部署到远程 +- `pnpm ui` - 添加shadcn组件 + +## 特性 +- 深色模式支持 +- 响应式设计 +- TypeScript严格模式 +- 可访问性组件 (Radix UI) +- 静态导出支持 diff --git a/managed-settings.json b/managed-settings.json new file mode 100644 index 0000000..21a6f90 --- /dev/null +++ b/managed-settings.json @@ -0,0 +1,46 @@ +{ + "permissions": { + "allow": [ + "Read(*)", + "Write(*)", + "Edit(*)", + "Glob(*)", + "Grep(*)", + "Bash(node:*)", + "Bash(npm:*)", + "Bash(npx:*)", + "Bash(pnpm:*)", + "Bash(deno:*)", + "Bash(bun:*)", + "Bash(kubectl:*)", + "Bash(git:*)", + "Bash(git:*:*)", + "Bash(python:*)", + "Bash(pip:*)", + "Bash(mkdir:*)", + "Bash(rm:*)", + "Bash(cp:*)", + "Bash(mv:*)", + "Bash(ls:*)", + "Bash(cat:*)", + "Bash(rm:*)", + "Bash(du:*)", + "Bash(df:*)", + "Bash(pwd:*)", + "Bash(whoami:*)", + "Bash(test:*)", + "Bash(echo:*)", + "Bash(timeout:*:*)", + "Bash(touch:*)", + "Bash(file:*)", + "Bash(type:*)", + "Bash(ev:*)" + ], + "deny": [], + "ask": [ + "Bash(rm:-rf)", + "Bash(rm:-R)", + "Bash(rm:-r)" + ] + } +} \ No newline at end of file diff --git a/app/favicon.ico b/src/app/favicon.ico similarity index 100% rename from app/favicon.ico rename to src/app/favicon.ico diff --git a/app/globals.css b/src/app/globals.css similarity index 100% rename from app/globals.css rename to src/app/globals.css diff --git a/app/layout.tsx b/src/app/layout.tsx similarity index 100% rename from app/layout.tsx rename to src/app/layout.tsx diff --git a/app/page.tsx b/src/app/page.tsx similarity index 100% rename from app/page.tsx rename to src/app/page.tsx diff --git a/components/ui/button.tsx b/src/components/ui/button.tsx similarity index 100% rename from components/ui/button.tsx rename to src/components/ui/button.tsx diff --git a/components/ui/dialog.tsx b/src/components/ui/dialog.tsx similarity index 100% rename from components/ui/dialog.tsx rename to src/components/ui/dialog.tsx diff --git a/lib/utils.ts b/src/lib/utils.ts similarity index 100% rename from lib/utils.ts rename to src/lib/utils.ts diff --git a/proxy.ts b/src/proxy.ts similarity index 97% rename from proxy.ts rename to src/proxy.ts index ea54403..cb196bb 100644 --- a/proxy.ts +++ b/src/proxy.ts @@ -50,7 +50,7 @@ export async function proxy(request: NextRequest) { return proxyRequest(request, API_URL); } // 代理 /root/home 或 /root/home/ 请求 (第二个路径段后可以为空或以 / 结尾) - if (pathname.match(/^\/root\/\w+(\/)?$/)) { + if (pathname.startsWith('/root')) { return proxyRequest(request, API_URL); } diff --git a/tsconfig.json b/tsconfig.json index 0400cf0..f89c16c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,7 +24,7 @@ ], "paths": { "@/*": [ - "./*" + "./src/*" ] } },