Skip to content

Conversation

Copy link

Copilot AI commented Dec 5, 2025

HumanLiker 1.0 Implementation Plan

Backend - Core Modules (backend/src/core/)

  • Create DateTimeHumanizer.js with humanize(date, now) function
  • Create TimeSpanHumanizer.js with humanize(milliseconds, precision) function
  • Create NumberToWords.js with convert(number, addAnd) and convertToOrdinal functions
  • Create Ordinalize.js with convert and getOrdinalSuffix functions
  • Create RomanNumeral.js with toRoman and fromRoman functions
  • Create MetricNumeral.js with toMetric and fromMetric functions
  • Create ByteSize.js with ByteSize class (fromBytes/fromKilobytes etc & humanize)
  • Create CollectionHumanizer.js with humanize(array, separator) function

Backend - API Routes

  • Add POST /api/number/towords route
  • Add POST /api/number/ordinalize route
  • Add POST /api/datetime/humanize route
  • Add POST /api/duration/humanize route
  • Add POST /api/bytesize/humanize route
  • Add POST /api/collection/humanize route
  • Update server.js to register new routes

Frontend Updates

  • Update or create index.html with tabs for new features
  • Update or create css/styles.css for UI
  • Update or create js/app.js for main application logic
  • Create js/modules/apiClient.js for API calls
  • Create js/ui/tabManager.js for tab switching
  • Add UI components for Number, DateTime, ByteSize, Collection features

Package & Dependencies

  • Update package.json with jest for testing
  • Ensure all required dependencies are present

Testing

  • Create tests/core/numberToWords.test.js
  • Create tests/core/datetime.test.js
  • Create tests/core/bytesize.test.js
  • Create tests/core/collection.test.js
  • Create tests/core/ordinalize.test.js
  • Create tests/core/romanNumeral.test.js
  • Create tests/core/metricNumeral.test.js
  • Create tests/core/timespan.test.js

Documentation

  • Update README.md with new features and usage examples
  • Add API documentation for new endpoints

Quality & Review

  • Run all tests to ensure functionality
  • Code review
  • Security check with CodeQL
Original prompt

目标:在分支 Copilot-GPT5-mini-dev 基础上创建一个 PR,完成 HumanLiker 1.0 计划中尚未实现的模块与交付物,形成可合并的完整功能分支。不要包含任何对已合并 PR 的回退。

范围(逐项可交付):

  1. 后端 - core 模块(新增文件位于 backend/core/)

    • DateTimeHumanizer.js: 实现 DateTimeHumanizer.humanize(date, now)
    • TimeSpanHumanizer.js: 实现 TimeSpanHumanizer.humanize(milliseconds, precision)
    • NumberToWords.js: 实现 NumberToWords.convert(number, addAnd) 与 convertToOrdinal
    • Ordinalize.js: 实现 Ordinalize.convert 和 getOrdinalSuffix
    • RomanNumeral.js: toRoman 和 fromRoman
    • MetricNumeral.js: toMetric 和 fromMetric
    • ByteSize.js: ByteSize 类(fromBytes/fromKilobytes 等 & humanize)
    • CollectionHumanizer.js: CollectionHumanizer.humanize(array, separator)

    要求:每个文件导出类/函数并包含基本参数校验与单元测试钩子(module.exports 或 export),与现有 StringHumanizer/Inflector 风格一致。

  2. 后端 - API 路由(更新或新增 backend/server.js 或 backend/routes/*.js)

    • 新增或更新路由:
      • POST /api/number/towords -> NumberToWords.convert
      • POST /api/number/ordinalize -> Ordinalize.convert
      • POST /api/datetime/humanize -> DateTimeHumanizer.humanize
      • POST /api/duration/humanize -> TimeSpanHumanizer.humanize
      • POST /api/bytesize/humanize -> ByteSize.humanize
      • POST /api/collection/humanize -> CollectionHumanizer.humanize
    • 要求:对输入进行基本校验并返回 { success: true, output } 或 { success: false, error }
  3. 前端 - 静态页面与脚本(位于 frontend/)

    • frontend/index.html: 主页面(带 tabs 占位)
    • frontend/css/styles.css: 视觉样式(可基于提供的样式)
    • frontend/js/app.js: 主应用逻辑(加载模块、调用 API)
    • frontend/js/modules/apiClient.js: 简单封装 fetch 的 post(url, body)
    • frontend/js/ui/tabManager.js: 标签切换基础
    • 在 UI 中为 Number、DateTime、ByteSize、Collection 提供最小交互模板(输入 + 处理按钮 + 输出区域)
  4. package.json & scripts

    • 确认 package.json 包含 start/dev/test 脚本(如果已有则更新),确保依赖 express/cors/nodemon/jest 存在
  5. 测试与文档

    • 新增 tests/ 下的基本 Jest 测试文件(示例: tests/numberToWords.test.js, tests/datetime.test.js, tests/bytesize.test.js)包含若干断言
    • 更新 README.md 增补使用示例:如何启动、如何调用新 API
  6. 代码质量

    • 保持代码风格与仓库中现有 StringHumanizer 和 Inflector 文件一致
    • 在可能的位置添加注释,便于代码审查
  7. PR 描述

    • 在 PR 描述中列出新增文件与改动清单、如何本地运行与测试、后续 TODO(语言本地化、更多测试、性能测试)

约束与假设:

  • 使用现有分支 Copilot-GPT5-mini-dev 作为变更基础。若需要另起 feature 分支,请在 PR 描述中说明。
  • 不会删除或回退已合并的 PR。只新增/修改文件以完成剩余计划。

请创建一个合并请求(Pull Request),标题使用上方 problem_title,正文包含上述范围摘要和变更文件清单(如果可能,列出每个新增文件的路径)。

This pull request was created as a result of the following prompt from Copilot chat.

目标:在分支 Copilot-GPT5-mini-dev 基础上创建一个 PR,完成 HumanLiker 1.0 计划中尚未实现的模块与交付物,形成可合并的完整功能分支。不要包含任何对已合并 PR 的回退。

范围(逐项可交付):

  1. 后端 - core 模块(新增文件位于 backend/core/)

    • DateTimeHumanizer.js: 实现 DateTimeHumanizer.humanize(date, now)
    • TimeSpanHumanizer.js: 实现 TimeSpanHumanizer.humanize(milliseconds, precision)
    • NumberToWords.js: 实现 NumberToWords.convert(number, addAnd) 与 convertToOrdinal
    • Ordinalize.js: 实现 Ordinalize.convert 和 getOrdinalSuffix
    • RomanNumeral.js: toRoman 和 fromRoman
    • MetricNumeral.js: toMetric 和 fromMetric
    • ByteSize.js: ByteSize 类(fromBytes/fromKilobytes 等 & humanize)
    • CollectionHumanizer.js: CollectionHumanizer.humanize(array, separator)

    要求:每个文件导出类/函数并包含基本参数校验与单元测试钩子(module.exports 或 export),与现有 StringHumanizer/Inflector 风格一致。

  2. 后端 - API 路由(更新或新增 backend/server.js 或 backend/routes/*.js)

    • 新增或更新路由:
      • POST /api/number/towords -> NumberToWords.convert
      • POST /api/number/ordinalize -> Ordinalize.convert
      • POST /api/datetime/humanize -> DateTimeHumanizer.humanize
      • POST /api/duration/humanize -> TimeSpanHumanizer.humanize
      • POST /api/bytesize/humanize -> ByteSize.humanize
      • POST /api/collection/humanize -> CollectionHumanizer.humanize
    • 要求:对输入进行基本校验并返回 { success: true, output } 或 { success: false, error }
  3. 前端 - 静态页面与脚本(位于 frontend/)

    • frontend/index.html: 主页面(带 tabs 占位)
    • frontend/css/styles.css: 视觉样式(可基于提供的样式)
    • frontend/js/app.js: 主应用逻辑(加载模块、调用 API)
    • frontend/js/modules/apiClient.js: 简单封装 fetch 的 post(url, body)
    • frontend/js/ui/tabManager.js: 标签切换基础
    • 在 UI 中为 Number、DateTime、ByteSize、Collection 提供最小交互模板(输入 + 处理按钮 + 输出区域)
  4. package.json & scripts

    • 确认 package.json 包含 start/dev/test 脚本(如果已有则更新),确保依赖 express/cors/nodemon/jest 存在
  5. 测试与文档

    • 新增 tests/ 下的基本 Jest 测试文件(示例: tests/numberToWords.test.js, tests/datetime.test.js, tests/bytesize.test.js)包含若干断言
    • 更新 README.md 增补使用示例:如何启动、如何调用新 API
  6. 代码质量

    • 保持代码风格与仓库中现有 StringHumanizer 和 Inflector 文件一致
    • 在可能的位置添加注释,便于代码审查
  7. PR 描述

    • 在 PR 描述中列出新增文件与改动清单、如何本地运行与测试、后续 TODO(语言本地化、更多测试、性能测试)

约束与假设:

  • 使用现有分支 Copilot-GPT5-mini-dev 作为变更基础。若需要另起 feature 分支,请在 PR 描述中说明。
  • 不会删除或回退已合并的 PR。只新增/修改文件以完成剩余计划。

请创建一个合并请求(Pull Request),标题使用上方 problem_title,正文包含上述范围摘要和变更文件清单(如果可能,列出每个新增文件的路径)。


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link

vercel bot commented Dec 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
human-liker-a-software-to-humanzie-text Ready Ready Preview Comment Dec 5, 2025 1:43am

Co-authored-by: MaxonT <173550318+MaxonT@users.noreply.github.com>
Co-authored-by: MaxonT <173550318+MaxonT@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants