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

137 lines
4.1 KiB
Go

package main
import (
"fmt"
"io"
"github.com/spf13/cobra"
"github.com/steveyegge/beads/internal/config"
"github.com/steveyegge/beads/internal/ui"
)
const copilotInstructionsContent = `# GitHub Copilot Instructions
## Issue Tracking
This project uses **bd (beads)** for issue tracking.
Run ` + "`bd prime`" + ` for workflow context, or install hooks (` + "`bd hooks install`" + `) for auto-injection.
**Quick reference:**
- ` + "`bd ready`" + ` - Find unblocked work
- ` + "`bd create \"Title\" --type task --priority 2`" + ` - Create issue
- ` + "`bd close <id>`" + ` - Complete work
- ` + "`bd dolt push`" + ` - Push beads to remote
For full workflow details: ` + "`bd prime`" + ``
const agentsContent = `## Issue Tracking
This project uses **bd (beads)** for issue tracking.
Run ` + "`bd prime`" + ` for workflow context, or install hooks (` + "`bd hooks install`" + `) for auto-injection.
**Quick reference:**
- ` + "`bd ready`" + ` - Find unblocked work
- ` + "`bd create \"Title\" --type task --priority 2`" + ` - Create issue
- ` + "`bd close <id>`" + ` - Complete work
- ` + "`bd dolt push`" + ` - Push beads to remote
For full workflow details: ` + "`bd prime`" + ``
func renderOnboardInstructions(w io.Writer) error {
writef := func(format string, args ...interface{}) error {
_, err := fmt.Fprintf(w, format, args...)
return err
}
writeln := func(text string) error {
_, err := fmt.Fprintln(w, text)
return err
}
writeBlank := func() error {
_, err := fmt.Fprintln(w)
return err
}
if err := writef("\n%s\n\n", ui.RenderBold("bd Onboarding")); err != nil {
return err
}
agentsFile := config.AgentsFile()
if err := writeln("Add this minimal snippet to " + agentsFile + " (or create it):"); err != nil {
return err
}
if err := writeBlank(); err != nil {
return err
}
if err := writef("%s\n", ui.RenderAccent("--- BEGIN AGENTS.MD CONTENT ---")); err != nil {
return err
}
if err := writeln(agentsContent); err != nil {
return err
}
if err := writef("%s\n\n", ui.RenderAccent("--- END AGENTS.MD CONTENT ---")); err != nil {
return err
}
if err := writef("%s\n", ui.RenderBold("For GitHub Copilot users:")); err != nil {
return err
}
if err := writeln("Add the same content to .github/copilot-instructions.md"); err != nil {
return err
}
if err := writeBlank(); err != nil {
return err
}
if err := writef("%s\n", ui.RenderBold("How it works:")); err != nil {
return err
}
if err := writef(" • %s provides dynamic workflow context (~80 lines)\n", ui.RenderAccent("bd prime")); err != nil {
return err
}
if err := writef(" • %s auto-injects bd prime at session start\n", ui.RenderAccent("bd hooks install")); err != nil {
return err
}
if err := writeln(" • " + agentsFile + " only needs this minimal pointer, not full instructions"); err != nil {
return err
}
if err := writeBlank(); err != nil {
return err
}
if err := writef("%s\n\n", ui.RenderPass("This keeps "+agentsFile+" lean while bd prime provides up-to-date workflow details.")); err != nil {
return err
}
return nil
}
var onboardCmd = &cobra.Command{
Use: "onboard",
GroupID: "setup",
Short: "Display minimal snippet for agent instructions file",
Long: `Display a minimal snippet to add to your agent instructions file for bd integration.
By default, the agent instructions file is AGENTS.md. Use 'bd init --agents-file'
to configure a different filename (e.g. BEADS.md).
This outputs a small (~10 line) snippet that points to 'bd prime' for full
workflow context. This is the same minimal profile that 'bd init' generates
by default. This approach:
• Keeps your agent file lean (doesn't bloat with instructions)
• bd prime provides dynamic, always-current workflow details
• Hooks auto-inject bd prime at session start
For agents or environments that do not auto-inject hook output, use
'bd init --agents-profile=full' to embed the complete command reference.`,
Run: func(cmd *cobra.Command, args []string) {
if err := renderOnboardInstructions(cmd.OutOrStdout()); err != nil {
_, _ = fmt.Fprintf(cmd.ErrOrStderr(), "Error: %v\n", err)
}
},
}
func init() {
rootCmd.AddCommand(onboardCmd)
}