Skip to content

TypeScript feature parity: relations, activities, graph traversal, utility tools#21

Merged
mgoldsborough merged 3 commits into
mainfrom
feat/ts-feature-parity
Apr 9, 2026
Merged

TypeScript feature parity: relations, activities, graph traversal, utility tools#21
mgoldsborough merged 3 commits into
mainfrom
feat/ts-feature-parity

Conversation

@mgoldsborough
Copy link
Copy Markdown
Contributor

Summary

Brings the TypeScript library to full feature parity with the Python library. Adds 6 missing subsystems:

  • Reverse relationship index (relations.ts): write-time index at _index/relations.json with atomic saves, auto-rebuild, and queryReverse
  • Activity tracking (activity.ts): built-in activity entity, logActivity/getActivities, opt-in via activities: true in manifest
  • Schema enhancements: hydrateDefaults (fill missing fields from defaults), validateSchemaChange (detect breaking changes), output schema builders
  • Graph traversal: queryByRelationship, getRelated (forward/reverse), getComposite (entity + all related in one call)
  • MCP server tools: 3 relationship tools per entity, 2 activity tools, 3 utility tools (seed_data, add_field, rebuild_index), output schemas on all tools, {entities, count} response envelopes
  • Entity callbacks: onRelationshipsChanged on create/update/delete, schema hydration on get/list/update

Breaking change

list_* and search_* MCP tools now return { entities: [...], count: N } envelopes instead of bare arrays. This aligns with the Python library behavior.

Files

  • New: relations.ts, activity.ts, activity.schema.json, relations.test.ts, graph.test.ts, activity.test.ts
  • Modified: schema.ts, entity.ts, app.ts, server.ts, paths.ts, index.ts + test updates

Test plan

  • 272 tests passing (was 233, +39 new)
  • make check clean (format + lint + typecheck + tests)
  • All existing tests updated for response envelope changes
  • E2E tests pass with real example manifests (CRM, Todo, Research)

…ility tools

Bring the TypeScript library to full feature parity with Python:

- Add reverse relationship index (relations.ts): load, save, update,
  remove, rebuild, queryReverse with atomic writes
- Add activity tracking (activity.ts): ACTIVITY_ENTITY_DEF, getActivitySchema,
  bundled activity.schema.json
- Add schema functions: hydrateDefaults, validateSchemaChange,
  buildEntityOutputSchema, buildListOutputSchema
- Add entity enhancements: schema hydration on get/list/update,
  onRelationshipsChanged callbacks on create/update/delete
- Add UpjackApp methods: queryByRelationship, getRelated, getComposite,
  logActivity, getActivities, reloadSchema, prefix resolution
- Add MCP server tools: 3 relationship tools per entity, log_activity,
  get_activities, seed_data, add_field, rebuild_index
- Add output schemas to all MCP tools
- Add response envelopes ({entities, count}) for list/search tools
- Add utility_tools manifest filter support
- Add indexDir/indexPath to paths module

272 tests passing (was 233), make check clean.
…d data

- Replace empty catch {} blocks in graph traversal with targeted error
  handling — only catch "Entity not found" and "Unknown prefix", re-throw
  unexpected errors
- Add Relationship interface to replace unsafe `as unknown as` type casts
  on entity relationships throughout entity.ts and app.ts
- Use destructuring to strip $schema/$id in buildEntityOutputSchema so
  keys are truly absent (not set to undefined)
- Atomic write for add_field tool (temp file + rename) to prevent
  corrupt schema files from concurrent calls
- Seed data now preserves relationships and tags (only strips metadata
  fields), matching Python lib behavior
- Add 8 server-level tests for add_field tool covering success path,
  field usability, and validation error cases
- Tighten buildEntityOutputSchema test to assert key absence
Match Python create_entity behavior: if data contains a valid prefixed
ID matching the entity prefix, use it instead of generating a new one.
This allows seed data with stable IDs and cross-references to work
correctly.
@mgoldsborough mgoldsborough added the qa-reviewed QA review completed with no critical issues label Apr 9, 2026
@mgoldsborough mgoldsborough merged commit bdc7faf into main Apr 9, 2026
4 checks passed
@mgoldsborough mgoldsborough deleted the feat/ts-feature-parity branch April 9, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

qa-reviewed QA review completed with no critical issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant