Documentation
¶
Index ¶
- func ClaudeDesktopConfigPathForTest(goos, home, appData string) string
- func DaemonChildHandshakeEnvForTest(stateDir string) ([]string, func(), error)
- func DaemonReadinessTimeout() time.Duration
- func ExtractPortFromAddress(addr string) string
- func IsDaemonStillStarting(err error) bool
- func ProcessStartTokenForTest(pid int) (string, bool)
- func PublicURLAddress(configuredListenAddr, resolvedListenAddr string) string
- func ServiceUnsupportedMessageForTest(goos string) string
- func WaitForConnectionReady(path string, childPid int, timeout time.Duration) (bool, error)
- func WritePIDRecordForTest(path string, pid int, startToken string) error
- type App
- func (a *App) RenderDaemonReadyForTest(ctx context.Context, cfg config.Config)
- func (a *App) RenderTranscriptCoverageSectionForTest(ctx context.Context, st interface{}, cfg config.Config) string
- func (a *App) ReportDaemonStillStartingForTest(pid int, logPath string)
- func (a *App) Run(args []string) int
- func (a *App) RunWithContext(ctx context.Context, args []string) int
- func (a *App) StartupExtractionCoverageForTest(ctx context.Context, st interface{}, cfg config.Config, jsonOutput, quiet bool, ...) []string
- func (a *App) StartupTranscriptCoverageForTest(ctx context.Context, st interface{}, cfg config.Config, jsonOutput, quiet bool, ...) int64
- type RuntimeHooks
- type SyncWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClaudeDesktopConfigPathForTest ¶ added in v0.11.2
ClaudeDesktopConfigPathForTest exposes claudeDesktopConfigPathFor to the external tests package. Test-only surface.
func DaemonChildHandshakeEnvForTest ¶ added in v0.10.0
DaemonChildHandshakeEnvForTest prepares a real parent-side handshake in stateDir and returns the environment entries a spawned child receives, plus a cleanup that removes the handshake file. It lets external tests reproduce the launch handshake exactly, rather than assert that a long-enough marker selects daemon-child mode. Test-only surface; not used by production code.
func DaemonReadinessTimeout ¶ added in v0.8.0
DaemonReadinessTimeout exposes the readiness window so external tests can assert it stays above the document-extractor probe ceiling (ingest.DoclingProbeTimeout). Read-only accessor.
func ExtractPortFromAddress ¶
ExtractPortFromAddress extracts a numeric trailing port token from a host:port address or malformed best-effort address string.
func IsDaemonStillStarting ¶ added in v0.8.0
IsDaemonStillStarting reports whether err indicates the daemon child was still alive but had not yet written connection.json when the readiness deadline expired (as opposed to having crashed). Exported so the readiness classification — still-starting vs crashed vs ready — can be unit-tested from the external tests package without exposing waitForConnectionFile.
func ProcessStartTokenForTest ¶ added in v0.10.0
ProcessStartTokenForTest exposes processStartToken so external lifecycle tests can tell whether pid-reuse protection is active on this platform (ok) and obtain a real token to build a deliberately-mismatching pid record. Test-only surface; not used by production code.
func PublicURLAddress ¶
PublicURLAddress derives the public-facing address using the configured listen host and the resolved runtime port.
func ServiceUnsupportedMessageForTest ¶ added in v0.11.2
ServiceUnsupportedMessageForTest exposes serviceUnsupportedMessage to the external tests package. Test-only surface.
func WaitForConnectionReady ¶ added in v0.8.0
WaitForConnectionReady is a thin exported wrapper over waitForConnectionFile so the readiness classification — ready vs still-starting vs crashed — can be exercised from the external tests package (waitForConnectionFile itself stays unexported). It returns whether the connection became ready and the classifying error; pair it with IsDaemonStillStarting to distinguish the healthy-but-slow case from a child that exited before binding.
func WritePIDRecordForTest ¶ added in v0.10.0
WritePIDRecordForTest writes a pid file carrying an arbitrary start-time token so external tests can simulate a recycled pid (a live pid whose recorded token no longer matches the live process). Test-only surface.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func NewAppWithIO ¶
NewAppWithIO constructs an App with the given output writers and the default ingestor/store constructors.
func NewAppWithIOAndHooks ¶
func NewAppWithIOAndHooks(stdout, stderr io.Writer, hooks RuntimeHooks) *App
NewAppWithIOAndHooks constructs an App with the given writers, overriding the default ingestor/store/retriever constructors with any non-nil hooks (used by tests to inject fakes).
func (*App) RenderDaemonReadyForTest ¶ added in v0.10.0
RenderDaemonReadyForTest renders the daemon PARENT's ready banner for cfg to the app's stdout, for the external tests package.
It drives printDaemonReady end to end rather than printDaemonCoverage alone, because the defect in #981 was not that the sections rendered wrongly: it was that nothing on the daemon path ever asked for them. A test over the renderer in isolation would keep passing with the call deleted again.
func (*App) RenderTranscriptCoverageSectionForTest ¶ added in v0.10.0
func (a *App) RenderTranscriptCoverageSectionForTest(ctx context.Context, st interface{}, cfg config.Config) string
RenderTranscriptCoverageSectionForTest runs the banner's ACTUAL path for the corpus behind st — compute the verdict, then render the section — and returns exactly what the banner would have written.
It exists because asserting the probe's count is not the same claim as asserting what the banner prints, and the README documents the latter. A test over the count alone would keep passing if the section started rendering for a verdict that is not partial.
func (*App) ReportDaemonStillStartingForTest ¶ added in v0.10.0
ReportDaemonStillStartingForTest exposes the still-starting notice to the external tests package, so the §7.7 pairing can assert that this path emits no coverage rather than leaving that to a comment.
func (*App) Run ¶
Run is the process entrypoint: it installs a signal-cancelled context, dispatches args, and maps a clean exit after interruption to the signal-interrupt exit code.
func (*App) RunWithContext ¶
RunWithContext parses global flags and dispatches the remaining command under ctx, printing usage when no command is given.
func (*App) StartupExtractionCoverageForTest ¶ added in v0.10.0
func (a *App) StartupExtractionCoverageForTest(ctx context.Context, st interface{}, cfg config.Config, jsonOutput, quiet bool, stderr io.Writer) []string
StartupExtractionCoverageForTest exposes the banner's coverage probe to the external `tests/cli` package, which cannot call an unexported method. It returns the uncovered extensions of the verdict; an empty result means the probe was skipped or found nothing. Whether the store was queried at all is observable on the caller's counter, which is the point for the daemon-child case (#949 review).
func (*App) StartupTranscriptCoverageForTest ¶ added in v0.10.0
func (a *App) StartupTranscriptCoverageForTest(ctx context.Context, st interface{}, cfg config.Config, jsonOutput, quiet bool, stderr io.Writer) int64
StartupTranscriptCoverageForTest exposes the banner's probe to the external `tests/cli` package, which cannot call an unexported method. It returns how many partial transcripts the verdict found; 0 means the probe was skipped or found nothing, and whether the store was queried at all is observable on the caller's counter.
type RuntimeHooks ¶
type RuntimeHooks struct {
NewIngestor func(config.Config, model.Store) (model.Ingestor, error)
NewStore func(config.Config) model.Store
NewRetriever func(config.Config, model.Store) model.Retriever
// NewIndex replaces the local index.backend dispatch, returning the index
// for one kind ("text" or "code") and the path it persists to. It exists so
// tests can inject an instrumented index (the concurrent startup load of
// issue #429 F6 is otherwise unobservable from outside the package, and
// AGENTS.md keeps new tests under tests/). When set it also bypasses the
// networked qdrant/pgvector branches. It is called once per kind, from two
// goroutines at once, so an implementation must be safe for concurrent use.
NewIndex func(config.Config, string) (model.Index, string)
}
type SyncWriter ¶ added in v0.10.0
type SyncWriter struct {
// contains filtered or unexported fields
}
SyncWriter serializes concurrent writes to an underlying io.Writer with a mutex. The server runs several long-lived goroutines (embed workers, the corpus writer, the watch worker) plus the main event loop, and they all log diagnostics to the same process stderr sink. A *log.Logger guards its own Output calls, but direct writef(stderr, ...) writes bypass that lock, so two goroutines writing to one unsynchronized sink (e.g. a bytes.Buffer in tests) is a data race (issue #419). Routing every concurrent-phase writer through a single SyncWriter gives them one shared lock.
It is exported (with NewSyncWriter) only so the concurrency regression guard can live in tests/ per AGENTS.md rather than as an internal *_test.go file; there is no external consumer (internal/cli is not importable outside the module).
func NewSyncWriter ¶ added in v0.10.0
func NewSyncWriter(w io.Writer) *SyncWriter
NewSyncWriter wraps w so concurrent Write calls are serialized. If w is already a *SyncWriter it is returned unchanged to avoid nesting locks.
Source Files
¶
- app.go
- ask.go
- bridge.go
- claude_cmd.go
- claude_code_cmd.go
- client_cmds.go
- config_cmd.go
- cursor_cmd.go
- daemon.go
- daemon_child.go
- daemon_unix.go
- down.go
- embed_worker.go
- export.go
- export_ttml.go
- extraction_coverage.go
- pididentity_linux.go
- process_unix.go
- registration_hint.go
- reindex.go
- remote_commands.go
- retry_embeddings.go
- routing_decision.go
- server_doctor.go
- service.go
- service_linux.go
- status.go
- style.go
- support_bundle.go
- support_bundle_redact.go
- syncwriter.go
- transcript_coverage.go
- up.go
- up_daemon.go
- up_distributed_embed.go
- up_shutdown.go