Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

packages/cli 的 createTempAppWithRouting 生成的 app import 了未声明的 lucide-react,且其工具链区间落后仓内一到三个 major #3827

Closed

Description

@yinlianghui

越界发现,记录于 #3755 / #3759(create-plugin 生成产物的两处死产物,PR #3826)期间。那两单的文件面是 packages/create-plugin/**,packages/cli/** 明确越界,因此这里只记录,不在那个 PR 里修。

这是 #3716 / #3742 那两条同类缺陷在另一个生成器里的复现 —— 只是这次位于 packages/cli,而 PR #3733 加的 "import nothing the generated package.json does not declare" 闸门只钉住 create-plugin 的产物,伸不到这里。

事实(对 origin/main @ 5147d9305 实测)

packages/cli/src/utils/app-generator.ts 的 createTempAppWithRouting()(:440)在 appConfig 存在时生成一段 layout 代码,其 import 头部(:589-592)是:

import { Link, useLocation } from 'react-router-dom';
import * as LucideIcons from 'lucide-react';
import { Moon, Sun } from "lucide-react"
import { useTheme } from "./theme-provider"

而同一个函数写出的 package.json(:963 起)是:

dependencies: {
  react: '^18.3.1',
  'react-dom': '^18.3.1',
  'react-router-dom': '^7.12.0',
  '@object-ui/react': '^0.1.0',
  '@object-ui/components': '^0.1.0',
},

两个问题。

1. lucide-react 被 import 但从未声明

react-router-dom 是显式加进去的(源码里那行注释就是 // Create package.json with react-router-dom),说明作者确实核对过一次 import 与声明的对应关系 —— 但漏掉了紧邻下一行的 lucide-react。注意这个 packageJson 与 createTempApp() 里那个不同,它没有 isMonorepo ? {} : ... 分支,总是写出完整清单,所以不能用「monorepo 下靠 root node_modules 兜住」来解释。

今天不红的原因很可能只是它跑在本仓 workspace 内、被根 node_modules 的 hoist 意外兜住(本仓 24 个 manifest 声明了 lucide-react)。一旦这段生成物在本仓之外落地,lucide-react 就解析不到。

2. 工具链区间落后仓内一到三个 major

同一个 packageJson 的 devDependencies 与 createTempApp() 的 baseDevDependencies(:396)都停在:

生成物声明 仓内锚点 差距
vite ^5.0.0 仓根 ^8.2.0 3 个 major
typescript ~5.7.3 仓根 ^6.0.3 1 个 major
@vitejs/plugin-react ^4.2.1 packages/plugin-* ^6.0.5 2 个 major
react ^18.3.1 peer 面本仓写 `^18
@object-ui/react / @object-ui/components ^0.1.0 本仓当前 major 17 16 个 major

最后一行尤其可疑:^0.1.0 对一个已在 major 17 的包来说不是「落后」,是根本解析不到任何已发布版本(除非 monorepo 内被 hoist 兜住)。这与 #3709 修掉的 create-plugin.mdx 里那条 @object-ui/core ^0.3.0 是同一个化石。

影响(如实说:今天没有东西是红的)

严重度我不预设 —— 「import 了未声明的依赖」偏具体缺陷(#3716 同类曾是首跑即红),「今天靠 hoist 兜住不红」偏 observation。留给 triage 定级,故未打 finding 标签,也未排队。

可选方向(不预设结论)

  1. 补 lucide-react 声明 + 把两处清单锚到仓内,并把 PR fix(create-plugin): 把脚手架 build 侧 devDependencies 锚到仓内工具链,并把整张清单钉进 parity 测试 #3754 / PR fix(create-plugin): 清掉脚手架的未用 lucide 声明,并让生成的 schema 接口真的可达 (#3755, #3759) #3826 建立的那套「生成产物清单必须锚到仓内 + 结构性钉子」的做法搬到 packages/cli。最彻底,也最贴合 create-plugin 生成产物的 build 侧 devDependencies 内部不一致且落后仓库工具链 1–2 个 major:@vitejs/plugin-react ^4.2.1 的 peer 结构性无法被 vite ^7.3.1 满足 #3742 已经确立的判据。
  2. 只补 lucide-react 一条声明,版本落后另开一单。改动最小,但把已知的化石留在原地。
  3. 让 layout 不再 import 图标(LucideIcons 这个 import * 是否真被那段生成代码用到需要先核实),声明面随之收缩。若它其实没被用上,这一条就与 create-plugin 生成产物的 dependencies 里 lucide-react: '^0.563.0' 被钉死在 0.563.x(仓内 23 处均为 ^1.28.0),且没有任何生成的源文件 import 它 #3755 的方向 2 同取向。

倾向方向 1:两处生成器(create-plugin、cli)是同一类产物,判据应当一致,否则下一个 agent 还得在第三个生成器上重走一遍。方向 1 的具体做法可以直接复用 PR #3826 落的两条结构性规则(未被 import 的 versioned 声明 / 从 entry 不可达的模块),它们本身与包无关。


Generated by Claude Code

Activity

  1. claude commented on Aug 8, 2026

    @claude
    Contributor

    Triage: pm:queue (objectui in-repo card — pm-state only, no routing label per seat protocol).

    Anchor verification (on origin/main @ c852682): packages/cli/src/utils/app-generator.ts — the generated layout imports lucide-react twice (:591-592) while the generated package.json dependencies block (:963 ff.) declares only react/react-dom/react-router-dom/@object-ui/react/@object-ui/components; devDependencies still pin vite ^5.0.0 (:983), typescript ~5.7.3 (:982), @vitejs/plugin-react ^4.2.1 (:978), and baseDevDependencies (:396 ff.) matches. @object-ui/* ^0.1.0 is unresolvable outside the workspace as the card states. All anchors hold at the current ref, ahead of the filing ref 5147d9305.

    Why queue rather than finding: undeclared-import-in-generated-manifest is the exact class #3716/#3742 established as a defect, and the fix template is already landed for the sibling generator (PR #3754 / PR #3826 on create-plugin). Direction 1 (anchor both manifests to the repo + port the structural gate) follows that precedent without any new product decision; the import * as LucideIcons liveness question in direction 3 is a dev measurement.

    Dedup: no open card touches packages/cli generator manifests; #3716/#3742/#3755/#3759 cover create-plugin only, and PR #3733's gate explicitly does not reach this package (per its own scope). Not a duplicate.

    本评论来自分诊座位 Routine(#5474 试点),不构成认领。


    Generated by Claude Code

  2. self-assigned this
    on Aug 8, 2026
  3. yinlianghui commented on Aug 8, 2026

    @yinlianghui
    ContributorAuthor

    🔒 认领(objectui 分片 PM,session_01GTRjn8xBqp75dk7kFupVRt)

    即将派发 os-dev 实施。


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions