Skip to content

Add HR/HCM Module: 16 Objects for Complete Employee Lifecycle Management - #84

Merged
hotlong merged 4 commits into
mainfrom
copilot/add-hr-hcm-module
Feb 2, 2026
Merged

hotlong merged 4 commits into
mainfrom
copilot/add-hr-hcm-module

Conversation

Copilot AI commented Feb 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Implements Phase 2 HR/HCM module (packages/hr) with 16 business objects covering organizational structure, talent acquisition, performance management, learning & development, and compensation. All objects follow @objectstack/spec v0.8.1+ protocol with snake_case naming convention.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • CI/CD update

Changes Made

Organizational Structure (3 objects)

  • department.object.ts - Nested hierarchy, cost centers (13 fields, 3 relationships)
  • position.object.ts - Job roles, headcount planning, salary ranges (14 fields, 2 relationships)
  • employee.object.ts - Master data, employment status, emergency contacts (30 fields, 8 relationships)

Talent Acquisition Pipeline (6 objects)

  • recruitment.object.ts - Job requisitions with priority tracking (16 fields)
  • candidate.object.ts - Applicant profiles, skills, education (23 fields)
  • application.object.ts - Pipeline stage management, referral tracking (13 fields)
  • interview.object.ts - Multi-round scheduling, panel feedback, ratings (20 fields)
  • offer.object.ts - Compensation packages, equity, expiry tracking (21 fields)
  • onboarding.object.ts - Task completion, buddy system, probation (19 fields)

Performance & Development (4 objects)

  • performance_review.object.ts - 360° reviews, multi-dimensional ratings (23 fields)
  • goal.object.ts - OKR tracking with progress monitoring (20 fields)
  • training.object.ts - Course management, completion tracking, certification (23 fields)
  • certification.object.ts - Expiry tracking, renewal workflows (18 fields)

Time & Compensation (3 objects)

  • time_off.object.ts - Multi-type leave, approval workflows (19 fields)
  • attendance.object.ts - GPS check-in/out, overtime, location tracking (15 fields)
  • payroll.object.ts - Detailed income/deduction breakdown, multiple payment methods (25 fields)

Plugin Architecture

  • plugin.ts - 4-group navigation structure (Organization, Talent Acquisition, Performance & Development, Time & Payroll)
  • index.ts - Module exports with TypeScript declarations

Statistics: 311 fields, 25 relationships, 59 list views, 14 validation rules across 16 objects

Testing

  • Unit tests pass (npm test)
  • Linting passes (npm run lint)
  • Build succeeds (npm run build)
  • Manual testing completed
  • New tests added (if applicable)

Validation Results:

  • Protocol compliance: All 16 objects pass @objectstack/spec v0.8.1+ validation
  • TypeScript compilation: Clean build with type definitions generated
  • CodeQL security scan: 0 alerts
  • Code review: Validation formula corrections applied (7 objects updated)

Screenshots

N/A - Metadata-only objects without UI implementation

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

AI Enhancement Ready: Objects designed for future AI features including resume parsing (Candidate), interview question generation (Interview), performance prediction (PerformanceReview), skill gap analysis (Training), and succession planning (Employee relationships).

Field Naming Convention: All fields use lowercase/snake_case per @objectstack/spec v0.7.2+ protocol (e.g., employee_id, start_date, base_salary).

Validation Fixes: Corrected 7 date comparison formulas post-code review to properly trigger on invalid conditions rather than valid ones (training, time_off, performance_review, payroll, goal, offer, position).

Original prompt

Phase 2: Missing Core Modules (Weeks 5-12)

2.1 Human Capital Management (HR/HCM) Module 👥

Business Value: Enable customers to manage entire employee lifecycle

Objects to Create:

packages/hr/src/
├── employee.object.ts # Employee master data
├── position.object.ts # Job positions and org chart
├── department.object.ts # Organizational units
├── recruitment.object.ts # Hiring pipeline
├── candidate.object.ts # Job applicants
├── application.object.ts # Job applications
├── interview.object.ts # Interview scheduling
├── offer.object.ts # Job offers
├── onboarding.object.ts # Employee onboarding
├── performance_review.object.ts # Performance management
├── goal.object.ts # OKRs and goals
├── training.object.ts # Learning & development
├── certification.object.ts # Professional certifications
├── time_off.object.ts # Leave management
├── attendance.object.ts # Time tracking
└── payroll.object.ts # Compensation tracking
Key Features:

📊 Organizational chart visualization
🎯 Talent acquisition pipeline
📈 Performance management & OKRs
🎓 Learning management system
📅 Time & attendance tracking
💰 Compensation management
AI Enhancements:

Resume parsing and candidate matching
Interview question generation
Performance prediction
Skill gap analysis
Succession planning recommendations


💡 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

vercel Bot commented Feb 2, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
hotcrm Ready Ready Preview, Comment Feb 2, 2026 4:48am

Request Review

Copilot AI and others added 3 commits February 2, 2026 04:43
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Human Capital Management module for employee lifecycle Add HR/HCM Module: 16 Objects for Complete Employee Lifecycle Management Feb 2, 2026
Copilot AI requested a review from hotlong February 2, 2026 04:50
@hotlong
hotlong marked this pull request as ready for review February 2, 2026 05:09
Copilot AI review requested due to automatic review settings February 2, 2026 05:09
@hotlong
hotlong merged commit a2eca8a into main Feb 2, 2026
7 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

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 the new @hotcrm/hr Human Capital Management module, defining 16 HR/HCM business objects plus a plugin and exports to cover the full employee lifecycle within HotCRM. It wires the new package into the monorepo tooling (TypeScript, ESLint, lockfile) and adds documentation for usage and capabilities.

Changes:

  • Adds the packages/hr package with its own package.json, tsconfig.json, and README describing the HR module.
  • Implements 16 HR-related object metadata files (employee, department, position, recruitment pipeline, performance, L&D, time & attendance, payroll) plus an HRPlugin and central index.ts exports.
  • Updates pnpm-lock.yaml to register the new packages/hr importer and its dependencies.

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pnpm-lock.yaml Registers packages/hr as a workspace importer with @hotcrm/core, @objectstack/spec, TypeScript, and ESLint dependencies, aligning it with other packages in the monorepo.
packages/hr/tsconfig.json Configures TypeScript build output and root directory for the HR package, hooking it into the shared base.tsconfig.json.
packages/hr/src/training.object.ts Defines the training object (fields, relationships to certifications, list views, validation rules, and layout) for tracking employee training and learning activities.
packages/hr/src/time_off.object.ts Defines the time_off object covering leave requests, approval workflow fields, list views, and a date-range validation rule.
packages/hr/src/recruitment.object.ts Adds the recruitment object for job requisitions, including headcount, priority, salary range, relationships to applications/interviews, and a salary-range validation rule.
packages/hr/src/position.object.ts Implements the position object to model job roles, levels, salary bands, and relationships to employees and recruitments, with a salary-range validation rule.
packages/hr/src/plugin.ts Introduces HRPlugin, registering all 16 HR objects and defining the navigation groups (Organization, Talent Acquisition, Performance & Development, Time & Payroll).
packages/hr/src/performance_review.object.ts Adds the performance_review object for 360° evaluations, scores/ratings, relationships to goals, list views, and validation for review period and score range.
packages/hr/src/payroll.object.ts Defines the payroll object to represent payroll runs with detailed earnings/deductions, status, payment method, list views, and a pay period validation rule.
packages/hr/src/onboarding.object.ts Implements the onboarding object for new hire onboarding flows, including mentor/manager links, task completion flags, and timeline fields.
packages/hr/src/offer.object.ts Defines the offer object tying candidate, application, recruitment, and position data together with compensation details, expiry logic, onboarding relationship, list views, and validation rules.
packages/hr/src/interview.object.ts Adds the interview object for scheduling and tracking interviews (types, panel, ratings, outcomes) with list views for upcoming, completed, and “my” interviews.
packages/hr/src/index.ts Central export barrel for all HR objects and HRPlugin, providing the public TypeScript surface for @hotcrm/hr.
packages/hr/src/goal.object.ts Implements the goal object for OKRs/personal goals with progress tracking, performance review linkage, validations, and multiple list views.
packages/hr/src/employee.object.ts Defines the core employee master-data object (identity, contact, employment, address, emergency contacts), relationships across HR artifacts, list views, and employment/termination validations.
packages/hr/src/department.object.ts Adds the department object modeling org units, hierarchy, manager, cost center, and relationships to employees, positions, and sub-departments.
packages/hr/src/certification.object.ts Defines the certification object to track employee certifications, linkage to training, expiry/renewal, cost, and a date validation rule.
packages/hr/src/candidate.object.ts Implements the candidate object for applicant information, education, experience, skills (tags), status, relationships to applications/interviews/offers, and list views.
packages/hr/src/attendance.object.ts Adds the attendance object capturing daily check-in/out, work and overtime hours, status, GPS locations, approvals, and list views (today, my attendance, late, absent, overtime).
packages/hr/src/application.object.ts Defines the application object linking candidates to recruitments with pipeline status/stage, referrer info, relationships to interviews, and list views.
packages/hr/package.json Creates the npm manifest for @hotcrm/hr (build/lint scripts, runtime and dev dependencies, metadata), aligning structure with other core packages.
packages/hr/README.md Documents the HR module’s scope, supported objects, and AI enhancement ideas, and shows a basic usage example importing HRPlugin.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

validationRules: [
{
name: 'ValidDates',
errorMessage: '结束时间必须在开始时间之后',

Copilot AI Feb 2, 2026

Copy link

Choose a reason for hiding this comment

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

The validation rule message says that the end time must be after the start time, but the formula only flags cases where end_date is earlier than start_date, allowing equal start/end times. To avoid confusion, either tighten the formula to also treat equal timestamps as invalid or adjust the error message to reflect the actual behavior ("不能早于" rather than "必须在…之后").

Suggested change
errorMessage: '结束时间必须在开始时间之后',
errorMessage: '结束时间不能早于开始时间',

Copilot uses AI. Check for mistakes.
validationRules: [
{
name: 'ValidReviewPeriod',
errorMessage: '结束日期必须在开始日期之后',

Copilot AI Feb 2, 2026

Copy link

Choose a reason for hiding this comment

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

The ValidReviewPeriod error message states that the end date must be after the start date, but the formula only rejects cases where end_date is strictly earlier than start_date, so equal dates pass validation. Consider aligning the message and logic by either treating equal dates as invalid in the formula or relaxing the message to say the end date cannot be earlier than the start date.

Suggested change
errorMessage: '结束日期必须在开始日期之后',
errorMessage: '结束日期不能早于开始日期',

Copilot uses AI. Check for mistakes.
Comment on lines +196 to +201
formula: 'AND(NOT(ISBLANK(expiry_date)), expiry_date < offer_date)'
},
{
name: 'ValidStartDate',
errorMessage: '入职日期必须在Offer日期之后',
formula: 'start_date < offer_date'

Copilot AI Feb 2, 2026

Copy link

Choose a reason for hiding this comment

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

The expiry-date validation message says the deadline must be after the offer date, but the formula only rejects values where expiry_date is earlier than offer_date, allowing the same date even though it technically isn�t "after". It would be clearer to either tighten the formula to also reject equal dates or rephrase the message to say the expiry date cannot be earlier than the offer date.

Suggested change
formula: 'AND(NOT(ISBLANK(expiry_date)), expiry_date < offer_date)'
},
{
name: 'ValidStartDate',
errorMessage: '入职日期必须在Offer日期之后',
formula: 'start_date < offer_date'
formula: 'AND(NOT(ISBLANK(expiry_date)), expiry_date <= offer_date)'
},
{
name: 'ValidStartDate',
errorMessage: '入职日期必须在Offer日期之后',
formula: 'start_date <= offer_date'

Copilot uses AI. Check for mistakes.
Comment on lines +195 to +200
errorMessage: '截止日期必须在Offer日期之后',
formula: 'AND(NOT(ISBLANK(expiry_date)), expiry_date < offer_date)'
},
{
name: 'ValidStartDate',
errorMessage: '入职日期必须在Offer日期之后',

Copilot AI Feb 2, 2026

Copy link

Choose a reason for hiding this comment

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

Similarly, for ValidStartDate, the error message says the start date must be after the offer date, but the formula only flags cases where start_date is earlier than offer_date, so a same-day start is allowed. Please align the wording and condition so users aren�t misled about whether equal dates are permitted.

Suggested change
errorMessage: '截止日期必须在Offer日期之后',
formula: 'AND(NOT(ISBLANK(expiry_date)), expiry_date < offer_date)'
},
{
name: 'ValidStartDate',
errorMessage: '入职日期必须在Offer日期之后',
errorMessage: '截止日期不得早于Offer日期',
formula: 'AND(NOT(ISBLANK(expiry_date)), expiry_date < offer_date)'
},
{
name: 'ValidStartDate',
errorMessage: '入职日期不得早于Offer日期',

Copilot uses AI. Check for mistakes.
validationRules: [
{
name: 'ValidTerminationDate',
errorMessage: '离职日期必须在入职日期之后',

Copilot AI Feb 2, 2026

Copy link

Choose a reason for hiding this comment

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

The ValidTerminationDate rule's message says the termination date must be after the hire date, but the formula only rejects values where termination_date is earlier than hire_date, accepting equal dates despite the wording. To avoid confusion, either treat equal dates as invalid in the formula or change the message to say the termination date cannot be earlier than the hire date.

Suggested change
errorMessage: '离职日期必须在入职日期之后',
errorMessage: '离职日期不能早于入职日期',

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +3
const Employee = {
name: 'employee',

Copilot AI Feb 2, 2026

Copy link

Choose a reason for hiding this comment

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

This new HR module adds multiple object schemas and a plugin, but there are currently no schema/unit tests for these objects even though similar CRM objects (for example account.object.ts) have dedicated tests as described in packages/TESTING.md. To maintain consistent coverage and catch metadata regressions, please add HR object tests (e.g., validating required fields, relationships, and validation rules) under a packages/hr/__tests__/unit/objects folder.

Copilot uses AI. Check for mistakes.

This branch was successfully deployed

1 active deployment
Preview — e625056a Deployed Feb 2, 2026 by vercel[bot]
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.

3 participants