adapters

package
v2.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package adapters installs aitk into AI coding tools (docs/spec/integrations.md): instructions, MCP registration, and session hooks. Project files are committed with the repository; global files change only with --global and are backed up first.

Index

Constants

View Source
const GlobalBegin, GlobalEnd = "<!-- aitk:global:begin -->", "<!-- aitk:global:end -->"

GlobalBegin and GlobalEnd delimit aitk's block in a tool's user-level instructions.

View Source
const GlobalText = `## aitk (applies in any repository that has aitk.toml at its root)

A repository with ` + "`aitk.toml`" + ` is managed by aitk. In such a repository, without being asked:
1. Start every session with ` + "`aitk brief`" + ` (or the aitk MCP tool ` + "`brief`" + `) and follow what it says.
2. Take work with ` + "`aitk task next --start`" + ` or continue the active task; run ` + "`aitk check`" + ` until it passes;
   run ` + "`aitk impact`" + ` before finishing.
3. Finish the task yourself: mark each satisfied criterion with ` + "`aitk task update <id> --ac-done N`" + `, then run
   ` + "`aitk close --summary \"…\" --knowledge \"…|none\"`" + `. That is how work becomes done; you do not need to ask first.
   If close refuses, do what its fix line says.
4. aitk's rules take precedence over older ai-toolkit instructions (ai-start, ai-close, editing docs/ai/*.md by hand).
5. Never edit task status or evidence by hand and never accept user acceptance (UAT) for the user; when stuck,
   ` + "`aitk close --status blocked`" + ` and stop.
In a repository without aitk.toml, ignore this section.
`

GlobalText tells an agent, in any repository on this machine, how to recognise an aitk project and what to do there. It is deliberately short: the repository's AGENTS.md has the details.

View Source
const Pointer = "This repository uses aitk. Follow the \"Working in this repository (aitk)\" section of AGENTS.md:\n" +
	"run `aitk brief` first, take a task with `aitk task next --start` (or continue the active one), run `aitk check`\n" +
	"until it passes, then `aitk close --summary \"…\" --knowledge \"…|none\"`. If the aitk MCP tools are available, they do the same.\n"

Pointer is the short instruction every tool-specific rule file carries: it sends the agent to AGENTS.md, where the full aitk block lives, so there is one source of truth.

Variables

This section is empty.

Functions

func Apply

func Apply(cs []Change, backupDir string) error

Apply writes the changes. Global files are backed up to backupDir first. A command that fails (a tool's own CLI) does not stop the rest; its failures are returned together at the end.

func Configured added in v2.1.0

func Configured(e Env) []string

Configured lists tools whose project files already contain aitk entries.

func Diff

func Diff(c Change) string

Diff renders a short before/after summary for dry runs.

func Names

func Names() []string

Names lists supported tools.

func Notes added in v2.6.0

func Notes() []string

Notes returns the informational skips of the last plan: files of the user's that carry a name aitk would use. They are left alone on purpose and are not pending changes.

Types

type Change

type Change struct {
	Tool   string   `json:"tool"`
	Path   string   `json:"path"` // absolute
	Rel    string   `json:"file"` // display path (repo-relative or ~/...)
	What   string   `json:"what"`
	Global bool     `json:"global"`
	Delete bool     `json:"delete,omitempty"` // remove the file (aitk-owned files only)
	Run    []string `json:"run,omitempty"`    // a tool's own CLI to run instead of writing a file
	// contains filtered or unexported fields
}

Change is one file write an adapter wants.

func Plan

func Plan(e Env, tools []string, global bool) ([]Change, error)

Plan computes the changes needed. Unchanged files are omitted. A problem with one tool's files (a JSONC config, an unreadable file, unbalanced markers) is an error when that one tool was asked for, and otherwise skips that change and is reported by PlanSkipping.

func PlanSkipping added in v2.5.0

func PlanSkipping(e Env, tools []string, global bool) ([]Change, []string, error)

PlanSkipping is Plan that keeps going past problems and lists them.

type Env

type Env struct {
	Root     string // project root
	Home     string
	LookPath func(string) (string, error)
}

Env abstracts the machine for tests.

func DefaultEnv

func DefaultEnv(root string) Env

DefaultEnv uses the real machine.

type SetupResult added in v2.5.0

type SetupResult struct {
	Changes []Change `json:"changes"`
	Skipped []string `json:"skipped,omitempty"` // targets that could not be edited safely, with why
}

SetupResult reports a setup run.

func Setup added in v2.5.0

func Setup(e Env, tools []string, remove bool) (*SetupResult, error)

Setup computes the user-level changes that make every AI tool on this machine recognise aitk projects without being told: a marked block in each tool's own user instructions, the Agent Skill for Claude Code, and the MCP server where the tool has a user-level MCP config. With remove, it computes the changes that take all of that out again. Tools that are not installed are left alone, unless named in tools.

type Status

type Status struct {
	Tool      string   `json:"tool"`
	Installed bool     `json:"installed"`
	Current   bool     `json:"current"`
	Pending   []string `json:"pending,omitempty"`
}

Status of an adapter in doctor output.

func Doctor

func Doctor(e Env, global bool) []Status

Doctor reports per-tool state without writing.

Jump to

Keyboard shortcuts

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