Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
bit-pm
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
燕伟桐
bit-pm
Commits
52aebae9
Unverified
提交
52aebae9
authored
6月 25, 2025
作者:
Will Chen
提交者:
GitHub
6月 25, 2025
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix order of dyad tag processing (#495)
Fixes #493
上级
c7c92e4d
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
256 行增加
和
45 行删除
+256
-45
rename-edit.md
e2e-tests/fixtures/rename-edit.md
+6
-0
rename_edit.spec.ts
e2e-tests/rename_edit.spec.ts
+9
-0
rename_edit.spec.ts_rename-edit.txt
e2e-tests/snapshots/rename_edit.spec.ts_rename-edit.txt
+185
-0
playwright.config.ts
playwright.config.ts
+1
-2
response_processor.ts
src/ipc/processors/response_processor.ts
+55
-43
没有找到文件。
e2e-tests/fixtures/rename-edit.md
0 → 100644
浏览文件 @
52aebae9
<dyad-rename
from=
"src/App.tsx"
to=
"src/Renamed.tsx"
>
</dyad-rename>
<dyad-write
path=
"src/Renamed.tsx"
>
// newly added content to renamed file should exist
</dyad-write>
e2e-tests/rename_edit.spec.ts
0 → 100644
浏览文件 @
52aebae9
import
{
test
}
from
"./helpers/test_helper"
;
test
(
"rename then edit works"
,
async
({
po
})
=>
{
await
po
.
setUp
({
autoApprove
:
true
});
await
po
.
importApp
(
"minimal"
);
await
po
.
sendPrompt
(
"tc=rename-edit"
);
await
po
.
snapshotAppFiles
({
name
:
"rename-edit"
});
});
e2e-tests/snapshots/rename_edit.spec.ts_rename-edit.txt
0 → 100644
浏览文件 @
52aebae9
=== .gitignore ===
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
=== file1.txt ===
A file (2)
=== index.html ===
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>dyad-generated-app</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
=== package.json ===
{
"name": "vite_react_shadcn_ts",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"build:dev": "vite build --mode development",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/node": "^22.5.5",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react-swc": "^3.9.0",
"typescript": "^5.5.3",
"vite": "^6.3.4"
},
"packageManager": "<scrubbed>"
}
=== src/main.tsx ===
import { createRoot } from "react-dom/client";
import App from "./App.tsx";
createRoot(document.getElementById("root")!).render(<App />);
=== src/Renamed.tsx ===
// newly added content to renamed file should exist
=== src/vite-env.d.ts ===
/// <reference types="vite/client" />
=== tsconfig.app.json ===
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitAny": false,
"noFallthroughCasesInSwitch": false,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src"]
}
=== tsconfig.json ===
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"noImplicitAny": false,
"noUnusedParameters": false,
"skipLibCheck": true,
"allowJs": true,
"noUnusedLocals": false,
"strictNullChecks": false
}
}
=== tsconfig.node.json ===
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noFallthroughCasesInSwitch": true
},
"include": ["vite.config.ts"]
}
=== vite.config.ts ===
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";
export default defineConfig(() => ({
server: {
host: "::",
port: 8080,
},
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
}));
playwright.config.ts
浏览文件 @
52aebae9
...
...
@@ -3,8 +3,7 @@ import { PlaywrightTestConfig } from "@playwright/test";
const
config
:
PlaywrightTestConfig
=
{
testDir
:
"./e2e-tests"
,
workers
:
1
,
retries
:
process
.
env
.
CI
?
2
:
1
,
// maxFailures: 1,
retries
:
process
.
env
.
CI
?
2
:
0
,
timeout
:
process
.
env
.
CI
?
180
_000
:
30
_000
,
// Use a custom snapshot path template because Playwright's default
// is platform-specific which isn't necessary for Dyad e2e tests
...
...
src/ipc/processors/response_processor.ts
浏览文件 @
52aebae9
...
...
@@ -305,30 +305,55 @@ export async function processFullResponseActions(
}
}
// Process all file writes
for
(
const
tag
of
dyadWriteTags
)
{
const
filePath
=
tag
.
path
;
const
content
=
tag
.
content
;
//////////////////////
// File operations //
// Do it in this order:
// 1. Deletes
// 2. Renames
// 3. Writes
//
// Why?
// - Deleting first avoids path conflicts before the other operations.
// - LLMs like to rename and then edit the same file.
//////////////////////
// Process all file deletions
for
(
const
filePath
of
dyadDeletePaths
)
{
const
fullFilePath
=
path
.
join
(
appPath
,
filePath
);
// Ensure directory exists
const
dirPath
=
path
.
dirname
(
fullFilePath
);
fs
.
mkdirSync
(
dirPath
,
{
recursive
:
true
});
// Delete the file if it exists
if
(
fs
.
existsSync
(
fullFilePath
))
{
if
(
fs
.
lstatSync
(
fullFilePath
).
isDirectory
())
{
fs
.
rmdirSync
(
fullFilePath
,
{
recursive
:
true
});
}
else
{
fs
.
unlinkSync
(
fullFilePath
);
}
logger
.
log
(
`Successfully deleted file:
${
fullFilePath
}
`
);
deletedFiles
.
push
(
filePath
);
// Write file content
fs
.
writeFileSync
(
fullFilePath
,
content
);
logger
.
log
(
`Successfully wrote file:
${
fullFilePath
}
`
);
writtenFiles
.
push
(
filePath
);
// Remove the file from git
try
{
await
git
.
remove
({
fs
,
dir
:
appPath
,
filepath
:
filePath
,
});
}
catch
(
error
)
{
logger
.
warn
(
`Failed to git remove deleted file
${
filePath
}
:`
,
error
);
// Continue even if remove fails as the file was still deleted
}
}
else
{
logger
.
warn
(
`File to delete does not exist:
${
fullFilePath
}
`
);
}
if
(
isServerFunction
(
filePath
))
{
try
{
await
de
ploySupabaseFunctions
({
await
de
leteSupabaseFunction
({
supabaseProjectId
:
chatWithApp
.
app
.
supabaseProjectId
!
,
functionName
:
path
.
basename
(
path
.
dirname
(
filePath
)),
content
:
content
,
functionName
:
getFunctionNameFromPath
(
filePath
),
});
}
catch
(
error
)
{
errors
.
push
({
message
:
`Failed to de
ploy
Supabase function:
${
filePath
}
`
,
message
:
`Failed to de
lete
Supabase function:
${
filePath
}
`
,
error
:
error
,
});
}
...
...
@@ -398,43 +423,30 @@ export async function processFullResponseActions(
}
}
// Process all file deletions
for
(
const
filePath
of
dyadDeletePaths
)
{
// Process all file writes
for
(
const
tag
of
dyadWriteTags
)
{
const
filePath
=
tag
.
path
;
const
content
=
tag
.
content
;
const
fullFilePath
=
path
.
join
(
appPath
,
filePath
);
// Delete the file if it exists
if
(
fs
.
existsSync
(
fullFilePath
))
{
if
(
fs
.
lstatSync
(
fullFilePath
).
isDirectory
())
{
fs
.
rmdirSync
(
fullFilePath
,
{
recursive
:
true
});
}
else
{
fs
.
unlinkSync
(
fullFilePath
);
}
logger
.
log
(
`Successfully deleted file:
${
fullFilePath
}
`
);
deletedFiles
.
push
(
filePath
);
// Ensure directory exists
const
dirPath
=
path
.
dirname
(
fullFilePath
);
fs
.
mkdirSync
(
dirPath
,
{
recursive
:
true
});
// Remove the file from git
try
{
await
git
.
remove
({
fs
,
dir
:
appPath
,
filepath
:
filePath
,
});
}
catch
(
error
)
{
logger
.
warn
(
`Failed to git remove deleted file
${
filePath
}
:`
,
error
);
// Continue even if remove fails as the file was still deleted
}
}
else
{
logger
.
warn
(
`File to delete does not exist:
${
fullFilePath
}
`
);
}
// Write file content
fs
.
writeFileSync
(
fullFilePath
,
content
);
logger
.
log
(
`Successfully wrote file:
${
fullFilePath
}
`
);
writtenFiles
.
push
(
filePath
);
if
(
isServerFunction
(
filePath
))
{
try
{
await
de
leteSupabaseFunction
({
await
de
ploySupabaseFunctions
({
supabaseProjectId
:
chatWithApp
.
app
.
supabaseProjectId
!
,
functionName
:
getFunctionNameFromPath
(
filePath
),
functionName
:
path
.
basename
(
path
.
dirname
(
filePath
)),
content
:
content
,
});
}
catch
(
error
)
{
errors
.
push
({
message
:
`Failed to de
lete
Supabase function:
${
filePath
}
`
,
message
:
`Failed to de
ploy
Supabase function:
${
filePath
}
`
,
error
:
error
,
});
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论