Sitelet https://github.com/objectstack-ai/objectstack/pull/14
Skip to content

feat: Comprehensive CRM example demonstrating all ObjectStack protocol features - #14

Merged
huangyiirene merged 9 commits into
mainfrom
copilot/add-crm-functionality-example
Jan 19, 2026
Merged

feat: Comprehensive CRM example demonstrating all ObjectStack protocol features#14
huangyiirene merged 9 commits into
mainfrom
copilot/add-crm-functionality-example

Conversation

Copilot AI commented Jan 19, 2026

Copy link
Copy Markdown
Contributor

Created production-grade CRM example (~2,900 LOC) showcasing complete protocol surface area. Previous example only covered 3 basic objects with minimal features.

Objects Added

New:

  • Lead - conversion tracking, status workflows
  • Case - SLA management, escalation automation
  • Task - polymorphic relations, recurrence patterns

Enhanced (Account, Contact, Opportunity):

  • All 24 field types: autonumber, formula, currency, select with colors, master-detail, etc.
  • Multiple view types: grid, kanban, calendar, gantt
  • Validation: script, uniqueness, state machines
  • Workflow automation: field updates, email alerts, state transitions

UI Components

  • Actions (10): Lead conversion, record cloning, bulk updates with parameters
  • Dashboards (3): 35+ widgets across sales/service/executive views (metrics, charts, tables)
  • Reports (8): Tabular, summary, matrix with embedded visualizations

Example

// Opportunity with state machine validation and automated probability updates
export const Opportunity = ObjectSchema.create({
  name: 'opportunity',
  fields: {
    stage: Field.select(['prospecting', 'qualification', 'proposal', 'negotiation', 
                         'closed_won', 'closed_lost']),
    probability: Field.percent(),
    amount: Field.currency(),
    expected_revenue: Field.currency({ readonly: true }),
  },
  validations: [{
    type: 'state_machine',
    field: 'stage',
    transitions: {
      'prospecting': ['qualification', 'closed_lost'],
      'qualification': ['needs_analysis', 'closed_lost'],
      // ... enforces valid stage progressions
    }
  }],
  workflows: [{
    triggerType: 'on_create_or_update',
    criteria: 'ISCHANGED(stage)',
    actions: [
      { type: 'field_update', field: 'probability', 
        value: 'CASE(stage, "prospecting", 10, "closed_won", 100, ...)' },
      { type: 'field_update', field: 'expected_revenue', 
        value: 'amount * (probability / 100)' }
    ]
  }]
});

Protocol Coverage

Area Before After
Field Types 5 24
View Types 1 (grid) 4 (grid, kanban, calendar, gantt)
Validations 0 4 types
Workflows 1 Multiple per object
UI Components 0 21 (actions, dashboards, reports)

Bilingual documentation (EN/中文) with learning resources and architecture patterns.

Original prompt

给我一个能体现协议各项功能的crm例子


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel

vercel Bot commented Jan 19, 2026

Copy link
Copy Markdown

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

Project Deployment Review Updated (UTC)
spec Ready Ready Preview, Comment Jan 19, 2026 0:17am

Request Review

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI and others added 3 commits January 19, 2026 11:51
- Add phone field type helper to Field factory
- Update Field.select/multiselect to support both array and object signatures
- Add factory methods (Action.create, Dashboard.create, Report.create)
- Use z.input and parse for factory methods to support default values

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
- Add tests for Field.phone() helper
- Add tests for Field.select() backward compatibility (old and new API)
- Add tests for Field.multiselect() backward compatibility
- Add tests for Action.create() with default value handling
- Add tests for Dashboard.create() with default value handling
- All 279 tests passing

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Copilot AI changed the title [WIP] Add example of CRM functionality for protocol feat: Comprehensive CRM example demonstrating all ObjectStack protocol features Jan 19, 2026
Copilot AI requested a review from hotlong January 19, 2026 12:04
Copilot AI and others added 3 commits January 19, 2026 12:05
Document backward-compatible API with examples for both old and new signatures

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
- Extract options from config object to avoid confusion
- Change spread order to options first, then finalConfig
- Ensures processed options always take precedence

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
os-steve pushed a commit that referenced this pull request Aug 26, 2026
Make the commit-ordering rule trigger on the STEP, not on waiting: push a
WIP commit before a build, a full test run, a gate sweep or an ablation,
because that is the moment the worktree stops being the only copy. The
"commit before you wait" framing never fires for an agent that is not
waiting — it is working — which is precisely the population that
accumulates the largest uncommitted surface.

Placed at the head of Build & Test, immediately under the command block
that lists the minutes-long steps themselves, so the rule is read at the
moment of use.

Paid for in place against a zero-headroom ceiling (1158/1158), no raise:
  - Documentation Guardrails: the three named-example rows (concepts/,
    getting-started/, protocol/) deleted (-3). Surviving home: the
    generic `content/docs/<tree>/` row directly above them, which covers
    every tree except references/ and releases/ and whose own text called
    them "named examples, not the whole set" (that dangling sentence is
    dropped with them).
  - Skills: the governed-surface paragraph compressed 4 lines -> 2 (-2).
    Surviving home: Prime Directive #14, which carries every clause —
    human-merge only, never merge/queue/arm/flip-draft, the retired
    per-PR approval check, and the post-merge audit.

Net 0 lines; check-skill-line-ratchet green at 1158/1158, widest table
row unchanged at 1081 bytes (pin 1081).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JANH3y7qe3MD8aLaLXci8N
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