caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

98 lines
2.4 KiB
Go

package notion
import (
"github.com/steveyegge/beads/internal/tracker"
"github.com/steveyegge/beads/internal/types"
)
// FieldMapper implements tracker.FieldMapper for Notion.
type FieldMapper struct {
config *MappingConfig
}
// NewFieldMapper constructs a Notion field mapper with the default mapping when config is nil.
func NewFieldMapper(config *MappingConfig) *FieldMapper {
if config == nil {
config = DefaultMappingConfig()
}
return &FieldMapper{config: config}
}
func (m *FieldMapper) PriorityToBeads(trackerPriority interface{}) int {
value, ok := trackerPriority.(string)
if !ok {
return 2
}
return priorityToBeads(value, m.config)
}
func (m *FieldMapper) PriorityToTracker(beadsPriority int) interface{} {
return priorityToNotion(beadsPriority, m.config)
}
func (m *FieldMapper) StatusToBeads(trackerState interface{}) types.Status {
value, ok := trackerState.(string)
if !ok {
return types.StatusOpen
}
return statusToBeads(value, m.config)
}
func (m *FieldMapper) StatusToTracker(beadsStatus types.Status) interface{} {
return statusToNotion(beadsStatus, m.config)
}
func (m *FieldMapper) TypeToBeads(trackerType interface{}) types.IssueType {
value, ok := trackerType.(string)
if !ok {
return types.TypeTask
}
return typeToBeads(value, m.config)
}
func (m *FieldMapper) TypeToTracker(beadsType types.IssueType) interface{} {
return typeToNotion(beadsType, m.config)
}
func (m *FieldMapper) IssueToBeads(ti *tracker.TrackerIssue) *tracker.IssueConversion {
if ti == nil {
return nil
}
switch raw := ti.Raw.(type) {
case *PulledIssue:
issue, err := BeadsIssueFromPullIssue(*raw, m.config)
if err != nil {
return nil
}
return &tracker.IssueConversion{Issue: issue}
case PulledIssue:
issue, err := BeadsIssueFromPullIssue(raw, m.config)
if err != nil {
return nil
}
return &tracker.IssueConversion{Issue: issue}
default:
return nil
}
}
func (m *FieldMapper) IssueToTracker(issue *types.Issue) map[string]interface{} {
pushIssue, err := PushIssueFromIssue(issue, m.config)
if err != nil {
return map[string]interface{}{}
}
return map[string]interface{}{
"id": pushIssue.ID,
"title": pushIssue.Title,
"description": pushIssue.Description,
"status": pushIssue.Status,
"priority": pushIssue.Priority,
"issue_type": pushIssue.IssueType,
"assignee": pushIssue.Assignee,
"labels": pushIssue.Labels,
"external_ref": pushIssue.ExternalRef,
}
}