{"modulePath":"github.com/nimbu/cli","version":"v0.5.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package devproxy\n\n## Types\n\n```go\ntype CacheStatus struct {\n\tDirty               bool   `json:\"dirty\"`\n\tFallbackScanEnabled bool   `json:\"fallback_scan_enabled\"`\n\tFingerprint         string `json:\"fingerprint\"`\n\tLastBuildAt         string `json:\"last_build_at,omitempty\"`\n\tLastError           string `json:\"last_error,omitempty\"`\n\tOverlayCount        int    `json:\"overlay_count\"`\n\tRebuildCount        uint64 `json:\"rebuild_count\"`\n\tStaleServedCount    uint64 `json:\"stale_served_count\"`\n\tWatchEnabled        bool   `json:\"watch_enabled\"`\n\tWatchError          string `json:\"watch_error,omitempty\"`\n}\n```\nCacheStatus exposes runtime cache metadata for diagnostics.\n\n```go\ntype Config struct {\n\tAPIURL        string\n\tDebug         bool\n\tDevToken      string\n\tEventsJSON    bool\n\tExcludeRules  []string\n\tHost          string\n\tIncludeRules  []string\n\tMaxBodyBytes  int64\n\tPort          int\n\tQuietRequests bool\n\tSite          string\n\tTemplateRoot  string\n\t// UseColor colors request log lines. The caller decides it for the\n\t// RequestLog stream (stdout), honoring --color, NO_COLOR and TERM=dumb.\n\tUseColor  bool\n\tUserAgent string\n\t// RequestLog receives per-request log lines; nil means os.Stdout.\n\tRequestLog io.Writer\n\t// Diagnostics receives warnings and debug output; nil means os.Stderr.\n\tDiagnostics       io.Writer\n\tWatch             bool\n\tWatchScanInterval time.Duration\n}\n```\nConfig controls proxy server behavior.\n\n```go\ntype Logger struct {\n\tDebugEnabled bool\n\tEventsJSON   bool\n\tUseColor     bool\n\t// Out receives diagnostics; nil means os.Stderr.\n\tOut io.Writer\n\t// contains filtered or unexported fields\n}\n```\nLogger provides human and structured runtime output.\n\n```go\nfunc (l *Logger) Debug(message string, fields map[string]any)\n```\n\n```go\nfunc (l *Logger) Info(message string, fields map[string]any)\n```\n\n```go\nfunc (l *Logger) Warn(message string, fields map[string]any)\n```\n\n```go\ntype Matcher struct {\n\t// contains filtered or unexported fields\n}\n```\nMatcher decides whether a request should be handled by the simulator proxy.\n\n```go\nfunc NewMatcher(include []string, exclude []string) Matcher\n```\nNewMatcher builds a matcher from route rule strings.\n\n```go\nfunc (m Matcher) ShouldProxy(method string, path string, isWebsocket bool) bool\n```\nShouldProxy returns true when the request should be sent to simulator/render.\n\n```go\ntype PreviewInjector struct {\n\t// contains filtered or unexported fields\n}\n```\nPreviewInjector adds a draft preview token to matching local requests so the simulator sees ?preview=\\\u003ctoken\u003e even when the browser uses the normal URL.\n\n```go\nfunc NewPreviewInjector(tokens map[string]string) *PreviewInjector\n```\nNewPreviewInjector maps page fullpaths (with a leading slash) to preview tokens.\n\n```go\nfunc (p *PreviewInjector) Apply(req *http.Request)\n```\nApply injects preview=\\\u003ctoken\u003e when the request path is exactly a registered page fullpath, a translation fullpath, or a locale-prefixed default fullpath. Child paths such as /page/child are not matched.\n\n```go\ntype Server struct {\n\t// contains filtered or unexported fields\n}\n```\nServer hosts the local simulator proxy.\n\n```go\nfunc New(config Config, client SimulatorClient) (*Server, error)\n```\n\n```go\nfunc (s *Server) Close() error\n```\nClose stops the proxy at once, dropping in-flight requests. It is the forced-stop path; Stop is the graceful one.\n\n```go\nfunc (s *Server) Errors() \u003c-chan error\n```\n\n```go\nfunc (s *Server) SetPreview(preview *PreviewInjector)\n```\nSetPreview installs a draft preview token injector for matching page paths.\n\n```go\nfunc (s *Server) Start() error\n```\n\n```go\nfunc (s *Server) Stop(ctx context.Context) error\n```\n\n```go\nfunc (s *Server) URL() string\n```\n\n```go\ntype SimulatorClient interface {\n\tSimulatorRender(ctx context.Context, payload api.SimulatorPayload) (*api.SimulatorResponse, error)\n}\n```\nSimulatorClient is the API client dependency for simulator render calls.\n\n```go\ntype TemplateCache struct {\n\t// contains filtered or unexported fields\n}\n```\nTemplateCache caches compressed template payloads and invalidates on changes.\n\n```go\nfunc NewTemplateCache(root string, watchEnabled bool, scanInterval time.Duration, logger *Logger) *TemplateCache\n```\n\n```go\nfunc (c *TemplateCache) GetCompressed() (code string, stale bool, err error)\n```\nGetCompressed returns compressed template payload. stale=true indicates stale cache served due to rebuild error.\n\n```go\nfunc (c *TemplateCache) SetOverlays(overlays []TemplateOverlay) error\n```\n\n```go\nfunc (c *TemplateCache) Start() error\n```\n\n```go\nfunc (c *TemplateCache) Status() CacheStatus\n```\n\n```go\nfunc (c *TemplateCache) Stop() error\n```\n\n```go\ntype TemplateOverlay struct {\n\tContent string `json:\"content\"`\n\tPath    string `json:\"path\"`\n\tType    string `json:\"type\"`\n}\n```\nTemplateOverlay is an in-memory template replacement supplied by the local dev server.\n\n","path":"github.com/nimbu/cli/internal/devproxy","name":"devproxy","synopsis":"","isRedistributable":true}
