diff --git a/src/components/dashboard/PublishModal.tsx b/src/components/dashboard/PublishModal.tsx index 9f65df6..4fc049f 100644 --- a/src/components/dashboard/PublishModal.tsx +++ b/src/components/dashboard/PublishModal.tsx @@ -93,8 +93,8 @@ export function PublishModal({ project, onClose }: Props) { if (needGitignore) steps.push({ label: "生成 .gitignore", status: "pending" }); steps.push({ label: "在 GitHub 创建远端仓库", status: "pending" }); - if (needInit || scan.has_changes) { - steps.push({ label: `提交本地代码(${commitMsg})`, status: "pending" }); + if (needInit) { + steps.push({ label: `初始化并提交代码(${commitMsg})`, status: "pending" }); } steps.push({ label: "配置 origin remote", status: "pending" }); steps.push({ label: `推送到 GitHub (${branch})`, status: "pending" }); @@ -133,8 +133,8 @@ export function PublishModal({ project, onClose }: Props) { cloneUrl = await githubCreateRepo(repoName, repoDesc, isPrivate); updateLog(logIdx++, "ok", cloneUrl); - // 3. 提交本地代码(需要 init 或有改动) - const needCommit = !scan.has_git || !scan.has_commits || scan.has_changes; + // 3. 全新项目:git init + 提交所有文件 + const needCommit = !scan.has_git || !scan.has_commits; if (needCommit) { updateLog(logIdx, "pending", "git add & commit…"); await gitInitAndCommit(localPath, commitMsg); @@ -304,46 +304,48 @@ export function PublishModal({ project, onClose }: Props) { )} - {/* 改动文件预览 */} - {(() => { - const needCommit = !scan.has_git || !scan.has_commits || scan.has_changes; - if (!needCommit) return null; - return ( -
待提交文件({scan.changed_files.length} 个)
-…还有 {scan.changed_files.length - 50} 个文件
- )} -- {!scan.has_git ? "全新项目,将执行 git init 并提交所有文件" : "无历史提交,将提交当前所有文件"} -
+ {/* 未提交内容:阻断发布 */} + {scan.has_changes && ( ++ ⚠ 存在 {scan.changed_files.length} 个未提交文件,请先提交后再发布 +
+…还有 {scan.changed_files.length - 50} 个文件
)} -+ 请在 VSCode 或 Claude 中完成提交,然后重新扫描。 +
++ {!scan.has_git ? "全新项目:将自动执行 git init 并提交所有文件" : "尚无提交记录:将自动提交当前所有文件"} +
+