Skip to content

Core

Core is located at packages/core/ and serves as the business-agnostic runtime of Harness.

What Core Is Responsible For

CapabilityDescriptionWhy It Belongs in Core
Configuration LoadingReads .fe-harness/project.yaml, parsing project, platform, tech stack, facts, and command mappingsAll workflows depend on the same configuration entry point
Runtime ValidationChecks whether product type, platform, stack, commands, and verify mode are supportedFail early to prevent Agents from continuing implementation on incorrect configurations
Command ResolutionMaps symbolic commands like unit_test and coverage_closure to actual shell commandsProjects own commands; Core only executes mappings
Verification ExecutionSupports fail-fast and audit-style continued executionDifferent scenarios require different feedback costs
DoctorChecks Node, pnpm, scripts, page registration, inputs, tokens, Agent workflows, etc.Diagnostics should be read-only and repeatable
Init PlanningGenerates create, unchanged, conflict, and other statuses for init / createMust preview and protect existing projects before writing files
ReportingWrites Markdown, JSON, and command logsHumans, CI, and Agents can all read the same results
Input AnalysisReads manifest, discovers unregistered inputs, extracts text facts and conflictsInput evidence is shared context before tasks begin
OpenAPI Generation ProtectionRecords generated hash, refuses to overwrite manually modified generated filesAuto-generated layer and business layer must be separated
UI/Token Check ProtocolChecks unique Token ground truth and UI System Adapter descriptionsCore only understands generic descriptions, does not import specific component libraries

What Core Is NOT Responsible For

Core does not contain:

  • Business pages.
  • Business state.
  • API endpoints.
  • Brand names.
  • Design Token values.
  • Specific UI component library implementations.

In other words, Core can know "the project declared an API snapshot," but not "this is a hotel search endpoint"; can know "a page registration is missing," but not "what cards the hotel list page should have"; can know "Token is not extracted," but not "what the brand primary color should be."

Why Core Must Be Restrained

Once Core understands business, implicit coupling emerges when extending profiles and platforms. Keeping Core focused on generic protocols enables future product forms beyond Consumer H5 to use the same Harness.

Relationship with Configuration

Core works through project configuration:

yaml
project:
  product_type: consumer_h5
platforms:
  - web_mobile
stack:
  adapter: uni_app
verify:
  feature:
    commands:
      - unit_test
      - coverage_closure

Projects choose capabilities; Core executes protocols.

Core Internal File Perspective

FilePrimary Responsibility
config.mjsProject configuration loading and validation
runner.mjsCommand execution, fail-fast, state normalization
doctor.mjsRead-only diagnostics
init.mjsInitialization and creation planning, safe writes
inputs.mjsInput inventory, discovery, and analysis
openapi.mjsOpenAPI operation checking, type and wrapper generation
design.mjsDesign Token inspect/discover/diff
ui-system.mjsUI System Adapter checking
history.mjsTask history and snapshots
report.mjsReports and log output

Business-neutral by design. Project-owned by default.