onboard

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package onboard provides the command to generate a comprehensive context artifact for initializing an AI session. It aggregates system rules, project status, and codebase state into a single file.

Index

Constants

This section is empty.

Variables

View Source
var OnboardCmd = &cobra.Command{
	Use:   "onboard",
	Short: "Generates a complete 'Session Initialization Artifact' for AI onboarding.",
	RunE: func(cmd *cobra.Command, _ []string) error {
		presenter := ui.NewPresenter(cmd.OutOrStdout(), cmd.ErrOrStderr())
		ctx := cmd.Context()

		presenter.Summary("Generating AI Session Onboarding Artifact")

		var finalBuffer bytes.Buffer

		fmt.Fprintf(&finalBuffer, "# AI Session Initialization\n")
		fmt.Fprintf(&finalBuffer, "Generated: %s\n\n", time.Now().Format(time.RFC3339))

		fmt.Fprintf(&finalBuffer, "> **User Instruction:** I am initializing a new development session. Below is my System Persona (THEA), the current Project Status (Summary), and the Codebase Snapshot (Describe). Ingest this context, acknowledge you are ready, and await my instructions.\n\n")

		presenter.Step("Layer 1: Loading System Persona...")
		systemPrompt, err := os.ReadFile(defaultSystemPromptPath)
		if err != nil {
			presenter.Warning("Could not read system prompt at %s: %v", defaultSystemPromptPath, err)

			fmt.Fprintf(&finalBuffer, "## 1. System Persona & Rules\n\n(System prompt file not found at %s)\n\n", defaultSystemPromptPath)
		} else {
			fmt.Fprintf(&finalBuffer, "## 1. System Persona & Rules\n\n%s\n\n", string(systemPrompt))
		}

		presenter.Step("Layer 2: Fetching Project Summary...")
		summaryContent, err := generateSummary(ctx)
		if err != nil {
			presenter.Warning("Failed to generate summary: %v", err)
			fmt.Fprintf(&finalBuffer, "## 2. Project Status (Morning Briefing)\n\n(Failed to fetch data)\n\n")
		} else {
			fmt.Fprintf(&finalBuffer, "## 2. Project Status (Morning Briefing)\n\n%s\n\n", summaryContent)
		}

		presenter.Step("Layer 3: Snapshotting Codebase...")
		describeContent, err := generateDescribe(ctx)
		if err != nil {
			return fmt.Errorf("failed to generate codebase snapshot: %w", err)
		}
		fmt.Fprintf(&finalBuffer, "## 3. Technical Context\n\n%s\n\n", describeContent)

		err = tools.WriteBufferToFile(outputFlag, &finalBuffer)
		if err != nil {
			return fmt.Errorf("failed to write output file: %w", err)
		}

		presenter.Success("Onboarding artifact generated: %s", outputFlag)
		presenter.Info("Upload this file to your AI to start the session.")

		return nil
	},
}

OnboardCmd represents the project onboard command.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL