Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 17, 2026

Task: Update ObjectQL and Create Object Components Package

✅ All Tasks Completed Successfully!

Updates Made:

  • Update ObjectQL dependencies to latest version (1.9.1)
  • Create new package for ObjectQL-specific components
  • Define ObjectTable and ObjectForm type schemas
  • Implement ObjectTable component
  • Implement ObjectForm component
  • Enhance ObjectQLDataSource
  • Build, test, and validate
  • Add showcase examples for ObjectQL components
  • Renamed package to follow naming convention
  • NEW: Fixed code review issues
    • Corrected import paths in README from @object-ui/data-object to @object-ui/plugin-object
    • Added comprehensive JSDoc for mapFieldTypeToFormType helper function
    • Enhanced layout documentation to clarify grid layout support status
    • Successfully built and validated all changes

Code Review Fixes:

  1. README Import Paths: Fixed incorrect import statements showing old package name
  2. JSDoc Documentation: Added detailed documentation for field type mapping function explaining the conversion logic
  3. Layout Documentation: Clarified that grid layout is experimental and currently falls back to vertical layout

Package Naming:

Following the established pattern where UI component packages use the plugin- prefix:

  • @object-ui/plugin-object - ObjectQL UI components plugin (ObjectTable, ObjectForm)
  • @object-ui/data-objectql - ObjectQL data adapter (unchanged)

Architecture:

@object-ui/plugin-object (ObjectQL UI Components Plugin)
    ↓ depends on
@object-ui/data-objectql (ObjectQL Data Adapter)
    ↓ uses  
@objectql/sdk (Official SDK)

All issues identified in code review have been addressed and the package builds successfully.

Original prompt

objectql 更新到最新版,新增个软件包,开始开发object相关的组件对象表格和对象表单


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update ObjectQL to latest version and add new software package Add ObjectQL 1.9.1 integration with ObjectTable and ObjectForm components Jan 17, 2026
Copilot AI requested a review from hotlong January 17, 2026 01:11
@hotlong
Copy link
Contributor

hotlong commented Jan 17, 2026

为相关组件添加showcase

@hotlong
Copy link
Contributor

hotlong commented Jan 17, 2026

为相关组件添加showcase

@copilot

Copy link
Contributor Author

Copilot AI commented Jan 17, 2026

为相关组件添加showcase

@copilot

Added comprehensive showcase pages for ObjectTable and ObjectForm components in commit 0f3fd52.

What was added:

  1. ObjectQL Menu Section - Added new "ObjectQL" menu in the showcase app with Database icon
  2. Object Table Showcase (/objectql/object-table) - Demonstrates:
    • Basic usage with auto-generated columns
    • Custom column configuration
    • Code examples and feature list
  3. Object Form Showcase (/objectql/object-form) - Demonstrates:
    • Create mode with auto-generated fields
    • Edit mode with pre-filled data
    • Custom field configuration
    • Code examples and feature list

Each showcase page includes:

  • Usage code snippets
  • Simulated output with sample data
  • Demo mode alerts
  • Complete feature lists

You can view the showcases by running:

pnpm dev:showcase

Then navigate to the "ObjectQL" section in the sidebar menu.

@hotlong
Copy link
Contributor

hotlong commented Jan 17, 2026

@copilot 两个软件包的区别是什么?data-object, data-objectql

Copy link
Contributor Author

Copilot AI commented Jan 17, 2026

@copilot 两个软件包的区别是什么?data-object, data-objectql

两个软件包的区别:

@object-ui/data-objectql (数据适配器层)

  • 提供 ObjectQL 的数据源适配器
  • 实现通用的 DataSource 接口
  • 负责与 ObjectQL API 通信(CRUD 操作)
  • 使用 @objectql/sdk 进行 HTTP 请求
  • 可以与任何 Object UI 组件配合使用

@object-ui/data-object (UI 组件层)

  • 提供 ObjectQL 专用的 React UI 组件
  • ObjectTable:自动生成表格组件
  • ObjectForm:自动生成表单组件
  • 依赖 @object-ui/data-objectql 获取数据
  • 自动从 ObjectQL 获取对象元数据并生成 UI

关系:

@object-ui/data-object (UI组件)
    ↓ 依赖
@object-ui/data-objectql (数据适配器)
    ↓ 使用
@objectql/sdk (API客户端)

简单说:

  • data-objectql = 数据层,负责连接 ObjectQL API
  • data-object = UI层,提供自动生成的表格和表单组件

@hotlong
Copy link
Contributor

hotlong commented Jan 17, 2026

我们其他的组件包名plugin开头,重新评估一下这个软件包的名称以后,所有对象相关的组件在这里开发合适吗?@copliot

@hotlong
Copy link
Contributor

hotlong commented Jan 17, 2026

我们其他的组件包名plugin开头,重新评估一下这个软件包的名称以后,所有对象相关的组件在这里开发合适吗?@copliot

@copilot

Copy link
Contributor Author

Copilot AI commented Jan 17, 2026

我们其他的组件包名plugin开头,重新评估一下这个软件包的名称以后,所有对象相关的组件在这里开发合适吗?@copliot

@copilot

包名评估和建议:

查看了现有的 plugin 包(plugin-charts、plugin-kanban、plugin-editor、plugin-markdown),我认为应该重命名:

建议改名:

  • @object-ui/data-object@object-ui/plugin-object

理由:

  1. ✅ 符合现有命名规范(其他UI组件包都用 plugin- 前缀)
  2. ✅ 该包提供 UI 组件(ObjectTable、ObjectForm)
  3. ✅ 将来所有 ObjectQL 相关的 UI 组件都可以在这里开发

不需要改名:

  • @object-ui/data-objectql 保持不变
    • 这是数据适配器层,不是 UI 组件
    • 类似于 data source,不属于 plugin 范畴

架构清晰度:

@object-ui/plugin-object (ObjectQL UI组件插件)
    ↓ 依赖
@object-ui/data-objectql (ObjectQL 数据适配器)
    ↓ 使用  
@objectql/sdk (官方 SDK)

是否需要我重命名 data-objectplugin-object?这需要更新:

  • 包名和目录名
  • 所有 import 引用
  • 文档和示例
  • showcase 配置

@huangyiirene huangyiirene requested review from Copilot and removed request for hotlong January 17, 2026 04:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new plugin package (@object-ui/plugin-object) that provides ObjectQL-specific UI components for automatic table and form generation based on ObjectQL object schemas. The plugin follows Object UI's schema-first architecture and integrates seamlessly with the ObjectQL backend through the MetadataApiClient.

Changes:

  • Added @object-ui/plugin-object package with ObjectTable and ObjectForm components that auto-generate UI from ObjectQL metadata
  • Enhanced ObjectQLDataSource with schema fetching capability via MetadataApiClient
  • Updated ObjectQL dependencies to version 1.9.1 across affected packages

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/types/src/objectql.ts New type definitions for ObjectQL components (ObjectTableSchema, ObjectFormSchema)
packages/types/src/index.ts Exports new ObjectQL types and adds them to AnySchema union
packages/plugin-object/* New plugin package with ObjectTable and ObjectForm components, configuration files, and documentation
packages/data-objectql/src/ObjectQLDataSource.ts Added MetadataApiClient and getObjectSchema() method
packages/data-objectql/package.json Updated ObjectQL SDK dependencies to 1.9.1
examples/showcase/pages/objectql/* Showcase pages demonstrating ObjectTable and ObjectForm usage
examples/showcase/app.json Added ObjectQL section to showcase navigation menu
CHANGELOG.md Documented changes in unreleased section
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

### ObjectTable

```tsx
import { ObjectTable } from '@object-ui/data-object';
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect import path. The package name should be '@object-ui/plugin-object', not '@object-ui/data-object'.

Copilot uses AI. Check for mistakes.
### ObjectForm

```tsx
import { ObjectForm } from '@object-ui/data-object';
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect import path. The package name should be '@object-ui/plugin-object', not '@object-ui/data-object'.

Copilot uses AI. Check for mistakes.
};

/**
* Map ObjectQL field type to form field type
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helper function lacks JSDoc documentation. Add documentation explaining the mapping logic and its parameters.

Suggested change
* Map ObjectQL field type to form field type
* Maps an ObjectQL field type to the corresponding form field component type.
*
* This helper provides the translation layer between backend/ObjectQL field
* definitions (e.g. `text`, `date`, `lookup`) and the generic form field
* types understood by the schema renderer (e.g. `input`, `date-picker`,
* `select`). If a field type is not explicitly mapped, the function falls
* back to the generic `"input"` type.
*
* @param fieldType - The ObjectQL field type identifier to convert
* (for example: `"text"`, `"number"`, `"date"`, `"lookup"`).
* @returns The normalized form field type string used in the form schema
* (for example: `"input"`, `"textarea"`, `"date-picker"`, `"select"`).

Copilot uses AI. Check for mistakes.
Comment on lines 207 to 213
* Form layout
* @default 'vertical'
*/
layout?: 'vertical' | 'horizontal' | 'inline' | 'grid';

/**
* Grid columns (for grid layout)
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation refers to 'grid layout', but in ObjectForm.tsx lines 217-219, 'grid' layout is mapped to 'vertical' because FormSchema doesn't support 'grid'. This inconsistency should be documented or the type definition should clarify supported layouts.

Suggested change
* Form layout
* @default 'vertical'
*/
layout?: 'vertical' | 'horizontal' | 'inline' | 'grid';
/**
* Grid columns (for grid layout)
* Form layout.
*
* Supported layouts:
* - `vertical` label above field (default)
* - `horizontal` label and field in a row
* - `inline` compact inline layout, typically used in toolbars
* - `grid` **experimental** grid layout
*
* Note: As of the current implementation, the underlying form renderer does not yet
* support a native `grid` layout and will internally treat `layout: "grid"` as
* `layout: "vertical"`. This value is exposed in the schema for forward compatibility,
* and behavior may change once grid support is implemented.
*
* @default 'vertical'
*/
layout?: 'vertical' | 'horizontal' | 'inline' | 'grid';
/**
* Grid columns (for grid layout).
*
* Intended number of columns when using a `grid` layout. Current renderers that do
* not implement true grid support may ignore this value and fall back to a vertical
* layout. When grid layout is supported, this value should control how many form
* fields are placed per row.
*

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

📦 Bundle Size Report

Package Size Gzipped
components (index.js) 1494.77KB 349.01KB
core (index.js) 0.27KB 0.14KB
data-objectql (ObjectQLDataSource.js) 12.31KB 2.87KB
data-objectql (hooks.js) 5.43KB 1.32KB
data-objectql (index.js) 0.42KB 0.26KB
designer (index.js) 1.27KB 0.40KB
plugin-charts (AdvancedChartImpl-C2jKfPFI.js) 74.89KB 15.82KB
plugin-charts (BarChart-CRc8MAtI.js) 551.60KB 127.51KB
plugin-charts (ChartImpl-BUiIeWnl.js) 3.17KB 1.10KB
plugin-charts (index-BDsYtHqk.js) 24.00KB 7.05KB
plugin-charts (index.js) 0.21KB 0.16KB
plugin-editor (MonacoImpl-BSiaJCGx.js) 18.15KB 5.59KB
plugin-editor (index-Bx39x2XN.js) 21.72KB 6.53KB
plugin-editor (index.js) 0.19KB 0.15KB
plugin-kanban (KanbanImpl-oBc5AsFu.js) 76.50KB 20.46KB
plugin-kanban (index-BmErFnW-.js) 23.54KB 6.91KB
plugin-kanban (index.js) 0.18KB 0.15KB
plugin-markdown (MarkdownImpl-Dp8rFxgw.js) 256.79KB 64.50KB
plugin-markdown (index-DDihmVdn.js) 21.25KB 6.37KB
plugin-markdown (index.js) 0.19KB 0.15KB
react (SchemaRenderer.js) 1.12KB 0.56KB
react (index.js) 0.13KB 0.11KB
react (index.test.js) 0.14KB 0.14KB
types (api-types.js) 0.24KB 0.19KB
types (app.js) 0.19KB 0.17KB
types (base.js) 0.24KB 0.19KB
types (complex.js) 0.17KB 0.16KB
types (crud.js) 0.24KB 0.20KB
types (data-display.js) 0.19KB 0.17KB
types (data.js) 0.23KB 0.18KB
types (disclosure.js) 0.18KB 0.17KB
types (feedback.js) 0.18KB 0.16KB
types (form.js) 0.17KB 0.16KB
types (index.js) 1.46KB 0.74KB
types (layout.js) 0.23KB 0.18KB
types (navigation.js) 0.17KB 0.16KB
types (objectql.js) 0.26KB 0.21KB
types (overlay.js) 0.18KB 0.16KB
types (registry.js) 0.01KB 0.04KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@huangyiirene
Copy link
Contributor

@copilot fix all and test

Copy link
Contributor Author

Copilot AI commented Jan 17, 2026

@copilot fix all and test

Fixed all code review issues in commit ce1079b:

  1. README.md (lines 21, 45): Corrected import paths from @object-ui/data-object to @object-ui/plugin-object
  2. ObjectForm.tsx (line 240): Added comprehensive JSDoc documentation for mapFieldTypeToFormType helper function explaining the field type conversion logic
  3. objectql.ts (lines 207-213): Enhanced layout documentation to clarify that grid layout is experimental and currently falls back to vertical layout, added detailed notes about forward compatibility

All changes have been built and tested successfully. The package builds without errors.

@github-actions
Copy link

📦 Bundle Size Report

Package Size Gzipped
components (index.js) 1494.77KB 349.01KB
core (index.js) 0.27KB 0.14KB
data-objectql (ObjectQLDataSource.js) 12.31KB 2.87KB
data-objectql (hooks.js) 5.43KB 1.32KB
data-objectql (index.js) 0.42KB 0.26KB
designer (index.js) 1.27KB 0.40KB
plugin-charts (AdvancedChartImpl-C2jKfPFI.js) 74.89KB 15.82KB
plugin-charts (BarChart-CRc8MAtI.js) 551.60KB 127.51KB
plugin-charts (ChartImpl-BUiIeWnl.js) 3.17KB 1.10KB
plugin-charts (index-BDsYtHqk.js) 24.00KB 7.05KB
plugin-charts (index.js) 0.21KB 0.16KB
plugin-editor (MonacoImpl-BSiaJCGx.js) 18.15KB 5.59KB
plugin-editor (index-Bx39x2XN.js) 21.72KB 6.53KB
plugin-editor (index.js) 0.19KB 0.15KB
plugin-kanban (KanbanImpl-oBc5AsFu.js) 76.50KB 20.46KB
plugin-kanban (index-BmErFnW-.js) 23.54KB 6.91KB
plugin-kanban (index.js) 0.18KB 0.15KB
plugin-markdown (MarkdownImpl-Dp8rFxgw.js) 256.79KB 64.50KB
plugin-markdown (index-DDihmVdn.js) 21.25KB 6.37KB
plugin-markdown (index.js) 0.19KB 0.15KB
react (SchemaRenderer.js) 1.12KB 0.56KB
react (index.js) 0.13KB 0.11KB
react (index.test.js) 0.14KB 0.14KB
types (api-types.js) 0.24KB 0.19KB
types (app.js) 0.19KB 0.17KB
types (base.js) 0.24KB 0.19KB
types (complex.js) 0.17KB 0.16KB
types (crud.js) 0.24KB 0.20KB
types (data-display.js) 0.19KB 0.17KB
types (data.js) 0.23KB 0.18KB
types (disclosure.js) 0.18KB 0.17KB
types (feedback.js) 0.18KB 0.16KB
types (form.js) 0.17KB 0.16KB
types (index.js) 1.46KB 0.74KB
types (layout.js) 0.23KB 0.18KB
types (navigation.js) 0.17KB 0.16KB
types (objectql.js) 0.26KB 0.21KB
types (overlay.js) 0.18KB 0.16KB
types (registry.js) 0.01KB 0.04KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

Copilot AI and others added 3 commits January 17, 2026 05:13
Added missing color default value (#8884d8) to:
- defaultProps object (required by test)
- input definition defaultValue (for consistency)

This fixes the failing test in packages/plugin-charts/src/index.test.ts
that expected color to be '#8884d8' in defaultProps.

Co-authored-by: huangyiirene <[email protected]>
@github-actions
Copy link

📦 Bundle Size Report

Package Size Gzipped
components (index.js) 1494.77KB 349.01KB
core (index.js) 0.27KB 0.14KB
data-objectql (ObjectQLDataSource.js) 12.31KB 2.87KB
data-objectql (hooks.js) 5.43KB 1.32KB
data-objectql (index.js) 0.42KB 0.26KB
designer (index.js) 1.27KB 0.40KB
plugin-charts (AdvancedChartImpl-LUnT2ZAf.js) 74.89KB 15.82KB
plugin-charts (BarChart-CRc8MAtI.js) 551.60KB 127.51KB
plugin-charts (ChartImpl-DiqV9Evl.js) 3.17KB 1.10KB
plugin-charts (index-BcjHuFVN.js) 24.05KB 7.06KB
plugin-charts (index.js) 0.21KB 0.16KB
plugin-editor (MonacoImpl-BSiaJCGx.js) 18.15KB 5.59KB
plugin-editor (index-Bx39x2XN.js) 21.72KB 6.53KB
plugin-editor (index.js) 0.19KB 0.15KB
plugin-kanban (KanbanImpl-oBc5AsFu.js) 76.50KB 20.46KB
plugin-kanban (index-BmErFnW-.js) 23.54KB 6.91KB
plugin-kanban (index.js) 0.18KB 0.15KB
plugin-markdown (MarkdownImpl-Dp8rFxgw.js) 256.79KB 64.50KB
plugin-markdown (index-DDihmVdn.js) 21.25KB 6.37KB
plugin-markdown (index.js) 0.19KB 0.15KB
react (SchemaRenderer.js) 1.12KB 0.56KB
react (index.js) 0.13KB 0.11KB
react (index.test.js) 0.14KB 0.14KB
types (api-types.js) 0.24KB 0.19KB
types (app.js) 0.19KB 0.17KB
types (base.js) 0.24KB 0.19KB
types (complex.js) 0.17KB 0.16KB
types (crud.js) 0.24KB 0.20KB
types (data-display.js) 0.19KB 0.17KB
types (data.js) 0.23KB 0.18KB
types (disclosure.js) 0.18KB 0.17KB
types (feedback.js) 0.18KB 0.16KB
types (form.js) 0.17KB 0.16KB
types (index.js) 1.46KB 0.74KB
types (layout.js) 0.23KB 0.18KB
types (navigation.js) 0.17KB 0.16KB
types (objectql.js) 0.26KB 0.21KB
types (overlay.js) 0.18KB 0.16KB
types (registry.js) 0.01KB 0.04KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@github-actions
Copy link

✅ All checks passed!

  • ✅ Type check passed
  • ✅ Tests passed
  • ✅ Lint check completed

@github-actions
Copy link

📦 Bundle Size Report

Package Size Gzipped
components (index.js) 1494.76KB 349.01KB
core (index.js) 0.27KB 0.14KB
data-objectql (ObjectQLDataSource.js) 12.31KB 2.87KB
data-objectql (hooks.js) 5.43KB 1.32KB
data-objectql (index.js) 0.42KB 0.26KB
designer (index.js) 1.27KB 0.40KB
plugin-charts (AdvancedChartImpl-LUnT2ZAf.js) 74.89KB 15.82KB
plugin-charts (BarChart-CRc8MAtI.js) 551.60KB 127.51KB
plugin-charts (ChartImpl-DiqV9Evl.js) 3.17KB 1.10KB
plugin-charts (index-BcjHuFVN.js) 24.05KB 7.06KB
plugin-charts (index.js) 0.21KB 0.16KB
plugin-editor (MonacoImpl-BSiaJCGx.js) 18.15KB 5.59KB
plugin-editor (index-Bx39x2XN.js) 21.72KB 6.53KB
plugin-editor (index.js) 0.19KB 0.15KB
plugin-kanban (KanbanImpl-mGLdSHcd.js) 76.50KB 20.46KB
plugin-kanban (index-i_5clVsp.js) 23.51KB 6.90KB
plugin-kanban (index.js) 0.18KB 0.15KB
plugin-markdown (MarkdownImpl-Dp8rFxgw.js) 256.79KB 64.50KB
plugin-markdown (index-DDihmVdn.js) 21.25KB 6.37KB
plugin-markdown (index.js) 0.19KB 0.15KB
react (SchemaRenderer.js) 1.25KB 0.62KB
react (index.js) 0.13KB 0.11KB
react (index.test.js) 0.14KB 0.14KB
types (api-types.js) 0.24KB 0.19KB
types (app.js) 0.19KB 0.17KB
types (base.js) 0.24KB 0.19KB
types (complex.js) 0.17KB 0.16KB
types (crud.js) 0.24KB 0.20KB
types (data-display.js) 0.19KB 0.17KB
types (data.js) 0.23KB 0.18KB
types (disclosure.js) 0.18KB 0.17KB
types (feedback.js) 0.18KB 0.16KB
types (form.js) 0.17KB 0.16KB
types (index.js) 1.46KB 0.74KB
types (layout.js) 0.23KB 0.18KB
types (navigation.js) 0.17KB 0.16KB
types (objectql.js) 0.26KB 0.21KB
types (overlay.js) 0.18KB 0.16KB
types (registry.js) 0.01KB 0.04KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

// Resolve the actual project root and schema file
let projectRoot = cwd;
let targetSchemaPath = schemaPath;
let _projectRoot = cwd;

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning

The initial value of _projectRoot is unused, since it is always overwritten.

Copilot Autofix

AI 1 day ago

In general, to fix a “useless assignment to local variable” you either (a) remove the redundant initial assignment if the variable is never read before being overwritten, or (b) move the defaulting logic to the actual decision point so that the value is only set when needed. This preserves behavior while eliminating dead writes.

Here, _projectRoot is intended to represent the project root. The code already uses cwd as the base when computing absoluteSchemaPath and looking for a pages directory in cwd. The initial let _projectRoot = cwd; is not used before the discovery logic that may reset _projectRoot to fileDir. The simplest behavior-preserving fix is to declare _projectRoot without an initial value, and then explicitly ensure it has a value before any later use. Given the visible snippet, the logical default is cwd when no more specific project root is detected.

To do this safely while only changing shown code:

  • Change the declaration on line 20 from let _projectRoot = cwd; to let _projectRoot: string;.
  • After the existing fallback pages-dir detection block (lines 51–59), set _projectRoot based on the detection result. If a project structure was found at fileDir, _projectRoot was already set in line 36; otherwise, we should fall back to cwd. The clean way is to check if _projectRoot is still undefined and set it to cwd. This preserves the previous effective behavior (root is fileDir if detected, otherwise cwd) while eliminating the unused initial assignment.
  • No new imports or external methods are required; we only adjust variable initialization logic inside dev.
Suggested changeset 1
packages/cli/src/commands/dev.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/cli/src/commands/dev.ts b/packages/cli/src/commands/dev.ts
--- a/packages/cli/src/commands/dev.ts
+++ b/packages/cli/src/commands/dev.ts
@@ -17,7 +17,7 @@
   const cwd = process.cwd();
   
   // Resolve the actual project root and schema file
-  let _projectRoot = cwd;
+  let _projectRoot: string;
   const targetSchemaPath = schemaPath;
   let hasPagesDir = false;
   let pagesDir = '';
@@ -58,6 +58,11 @@
      }
   }
 
+  // If no specific project root was detected, default to the current working directory
+  if (!_projectRoot) {
+    _projectRoot = cwd;
+  }
+
   const require = createRequire(join(cwd, 'package.json'));
   
   let routes: RouteInfo[] = [];
EOF
@@ -17,7 +17,7 @@
const cwd = process.cwd();

// Resolve the actual project root and schema file
let _projectRoot = cwd;
let _projectRoot: string;
const targetSchemaPath = schemaPath;
let hasPagesDir = false;
let pagesDir = '';
@@ -58,6 +58,11 @@
}
}

// If no specific project root was detected, default to the current working directory
if (!_projectRoot) {
_projectRoot = cwd;
}

const require = createRequire(join(cwd, 'package.json'));

let routes: RouteInfo[] = [];
Copilot is powered by AI and may make mistakes. Always verify output.
if (existsSync(potentialPagesDir)) {
console.log(chalk.blue(`📂 Detected project structure at ${fileDir}`));
projectRoot = fileDir;
_projectRoot = fileDir;

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning

The value assigned to _projectRoot here is unused.

Copilot Autofix

AI 1 day ago

In general, a "useless assignment to local variable" is fixed either by removing the assignment (if the value is truly not needed) or by adding the missing logic that consumes the assigned value (if the assignment points to an incomplete implementation). Here, we must not infer or add new usage for _projectRoot in code we cannot see, so the least invasive and safest fix is to remove the redundant assignment that CodeQL flagged.

Concretely, in packages/cli/src/commands/dev.ts, inside the if (existsSync(absoluteSchemaPath) && statSync(absoluteSchemaPath).isFile()) branch where a pages directory is detected, we currently set _projectRoot = fileDir; on line 36. Since CodeQL reports that this value is never read, we will delete this line only. We will leave the declaration let _projectRoot = cwd; intact in case it is used later in the file; that way, any later logic that depends on _projectRoot continues to see the original cwd value and behavior does not change. No new imports, methods, or definitions are required to implement this change.

Suggested changeset 1
packages/cli/src/commands/dev.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/cli/src/commands/dev.ts b/packages/cli/src/commands/dev.ts
--- a/packages/cli/src/commands/dev.ts
+++ b/packages/cli/src/commands/dev.ts
@@ -33,7 +33,6 @@
 
     if (existsSync(potentialPagesDir)) {
       console.log(chalk.blue(`📂 Detected project structure at ${fileDir}`));
-      _projectRoot = fileDir;
       hasPagesDir = true;
       pagesDir = potentialPagesDir;
       
EOF
@@ -33,7 +33,6 @@

if (existsSync(potentialPagesDir)) {
console.log(chalk.blue(`📂 Detected project structure at ${fileDir}`));
_projectRoot = fileDir;
hasPagesDir = true;
pagesDir = potentialPagesDir;

Copilot is powered by AI and may make mistakes. Always verify output.
let projectRoot = cwd;
let targetSchemaPath = schemaPath;
let _projectRoot = cwd;
const targetSchemaPath = schemaPath;

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable targetSchemaPath.

Copilot Autofix

AI 1 day ago

In general, an unused local variable should be removed to avoid confusion and unnecessary computation. If the value it would hold is actually needed, then code should be updated to use that variable instead; otherwise, the declaration should be deleted.

Here, targetSchemaPath is simply assigned schemaPath and never read. The code already uses schemaPath and absoluteSchemaPath where needed, so removing the targetSchemaPath declaration is the simplest, safest change that does not alter behavior. No other lines depend on it.

Concretely, in packages/cli/src/commands/dev.ts, inside the dev function, delete the line:

const targetSchemaPath = schemaPath;

No imports or other definitions are needed to implement this change.

Suggested changeset 1
packages/cli/src/commands/dev.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/cli/src/commands/dev.ts b/packages/cli/src/commands/dev.ts
--- a/packages/cli/src/commands/dev.ts
+++ b/packages/cli/src/commands/dev.ts
@@ -18,7 +18,6 @@
   
   // Resolve the actual project root and schema file
   let _projectRoot = cwd;
-  const targetSchemaPath = schemaPath;
   let hasPagesDir = false;
   let pagesDir = '';
   let appConfig: unknown = null;
EOF
@@ -18,7 +18,6 @@

// Resolve the actual project root and schema file
let _projectRoot = cwd;
const targetSchemaPath = schemaPath;
let hasPagesDir = false;
let pagesDir = '';
let appConfig: unknown = null;
Copilot is powered by AI and may make mistakes. Always verify output.
@github-actions
Copy link

✅ All checks passed!

  • ✅ Type check passed
  • ✅ Tests passed
  • ✅ Lint check completed

@huangyiirene huangyiirene marked this pull request as ready for review January 17, 2026 06:03
@huangyiirene huangyiirene merged commit 56d6afc into main Jan 17, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants