gitgram/aitimemachine/beads/cmd/bd/tips_example_test.go
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

100 lines
3.1 KiB
Go

package main
import (
"testing"
"time"
)
// This file demonstrates example tip definitions for documentation purposes
func TestExampleTipDefinitions(t *testing.T) {
// Example 1: High priority, high probability tip
// Shows frequently when condition is met
highPriorityTip := Tip{
ID: "example_high_priority",
Condition: func() bool { return true },
Message: "This is an important tip that shows often",
Frequency: 24 * time.Hour, // Show at most once per day
Priority: 100, // Highest priority
Probability: 0.8, // 80% chance when eligible
}
// Example 2: Medium priority, medium probability tip
// General feature discovery
mediumPriorityTip := Tip{
ID: "example_medium_priority",
Condition: func() bool { return true },
Message: "Try using 'bd ready' to see available work",
Frequency: 7 * 24 * time.Hour, // Show at most once per week
Priority: 50, // Medium priority
Probability: 0.5, // 50% chance when eligible
}
// Example 3: Low priority, low probability tip
// Nice-to-know information
lowPriorityTip := Tip{
ID: "example_low_priority",
Condition: func() bool { return true },
Message: "You can filter issues by label with --label flag",
Frequency: 30 * 24 * time.Hour, // Show at most once per month
Priority: 10, // Low priority
Probability: 0.2, // 20% chance when eligible
}
// Example 4: Conditional tip
// Only shows when specific condition is true
conditionalTip := Tip{
ID: "example_conditional",
Condition: func() bool {
// Example: Only show if some condition is met
// In real usage, this might check for specific state
return false // Disabled for this example
},
Message: "This tip only shows when condition is met",
Frequency: 24 * time.Hour,
Priority: 80,
Probability: 0.6,
}
// Verify tips are properly structured (basic validation)
tips := []Tip{highPriorityTip, mediumPriorityTip, lowPriorityTip, conditionalTip}
for _, tip := range tips {
if tip.ID == "" {
t.Error("Tip ID should not be empty")
}
if tip.Message == "" {
t.Error("Tip message should not be empty")
}
if tip.Condition == nil {
t.Error("Tip condition function should not be nil")
}
if tip.Frequency < 0 {
t.Error("Tip frequency should not be negative")
}
if tip.Probability < 0 || tip.Probability > 1 {
t.Errorf("Tip probability should be between 0 and 1, got %f", tip.Probability)
}
}
}
// Example showing probability guidelines
func TestProbabilityGuidelines(t *testing.T) {
examples := []struct {
name string
probability float64
useCase string
}{
{"Critical", 1.0, "Security alerts, breaking changes"},
{"High", 0.8, "Important updates, major features"},
{"Medium", 0.5, "General tips, workflow improvements"},
{"Low", 0.2, "Nice-to-know, advanced features"},
}
for _, ex := range examples {
if ex.probability < 0 || ex.probability > 1 {
t.Errorf("%s: probability %f out of range", ex.name, ex.probability)
}
}
}