Skip to content

Add reusable outline-sync config loader and refresh docs - #36

Closed
Its4Nik wants to merge 5 commits into
devfrom
main
Closed

Add reusable outline-sync config loader and refresh docs#36
Its4Nik wants to merge 5 commits into
devfrom
main

Conversation

@Its4Nik

@Its4Nik Its4Nik commented Jan 1, 2026

Copy link
Copy Markdown
Owner

Summary by Sourcery

Introduce a reusable configuration discovery and loading utility for outline-sync and refresh synced documentation metadata and examples.

Enhancements:

  • Replace the outline-sync CLI entrypoint with a configuration discovery and loading module that supports multiple config file formats and locations.

Documentation:

  • Update DockStat and template-renderer documentation metadata and clean up example code formatting.

@Its4Nik Its4Nik self-assigned this Jan 1, 2026
@sourcery-ai

sourcery-ai Bot commented Jan 1, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Refactors the outline-sync entrypoint into a reusable configuration discovery/loader module that searches multiple config filename patterns and supports env overrides, while also updating generated docs metadata and minor README formatting.

Sequence diagram for configuration loading behavior (loadConfig)

sequenceDiagram
  participant Caller
  participant ConfigLoader as loadConfig
  participant Finder as findConfig
  participant FS as FileSystem
  participant Require as NodeRequire

  Caller->>ConfigLoader: loadConfig(startDir)
  ConfigLoader->>Finder: findConfig(startDir)
  Finder-->>ConfigLoader: configPath or null
  alt No configPath
    ConfigLoader-->>Caller: null
  else configPath found
    ConfigLoader->>FS: Inspect path (extname, basename)
    alt JS or CJS config
      ConfigLoader->>Require: require.resolve(configPath)
      Require-->>ConfigLoader: resolvedId
      ConfigLoader->>Require: delete require.cache[resolvedId]
      ConfigLoader->>Require: require(configPath)
      Require-->>ConfigLoader: mod
      alt mod.__esModule and mod.default
        ConfigLoader-->>Caller: mod.default
      else
        ConfigLoader-->>Caller: mod
      end
    else JSON or package.json
      ConfigLoader->>FS: readFile(configPath, utf8)
      FS-->>ConfigLoader: rawText
      ConfigLoader->>ConfigLoader: JSON.parse(rawText)
      alt basename is package.json
        ConfigLoader-->>Caller: parsed.outline or parsed
      else
        ConfigLoader-->>Caller: parsed
      end
    else Other extension
      ConfigLoader->>FS: readFile(configPath, utf8)
      FS-->>ConfigLoader: rawText
      ConfigLoader->>ConfigLoader: try JSON.parse(rawText)
      alt Parse succeeds
        ConfigLoader-->>Caller: parsed
      else Parse fails
        ConfigLoader-->>Caller: rawText
      end
    end
  end
  note over ConfigLoader: On any error, throw Error("Failed to load config at ...")
Loading

File-Level Changes

Change Details Files
Replace CLI-based outline-sync entrypoint with a config discovery and loading utility that supports multiple config file formats and locations.
  • Remove Commander-based CLI commands (sync, watch, ci, push, init, verify) and the OutlineSync wiring from the outline-sync package entrypoint.
  • Introduce CONFIG_FILENAMES and a findConfig(startDir) helper that searches upward from a directory (or cwd) and honors an OUTLINE_CONFIG environment override with readable-file checks.
  • Implement loadConfig(startDir) that uses findConfig, supports JS/CJS via require with cache-busting, parses JSON and package.json (preferring the outline key when present), and falls back to JSON-or-raw text with contextual error reporting.
  • Change the module to default-export loadConfig and expose findConfig as a named export for external consumers.
packages/outline-sync/src/index.ts
Tidy up documentation files with metadata timestamp updates and small formatting cleanups in code examples.
  • Update updatedAt timestamps across various DockStat docs and package READMEs, likely as part of a docs sync or regeneration step.
  • Remove superfluous blank lines in markdown code fences and simplify an inline code comment in the template-renderer README to keep examples minimal and clean.
packages/template-renderer/README.md
apps/docs/dockstat/README.md
apps/docs/dockstat/api-reference/README.md
apps/docs/dockstat/api-reference/frontend-plugin-api-(plugins-frontend)/README.md
apps/docs/dockstat/apps-overview/README.md
apps/docs/dockstat/architecture/README.md
apps/docs/dockstat/configuration/README.md
apps/docs/dockstat/integration-guide/README.md
apps/docs/dockstat/packages/@dockstat-db/README.md
apps/docs/dockstat/packages/@dockstat-docker-client/README.md
apps/docs/dockstat/packages/@dockstat-logger/README.md
apps/docs/dockstat/packages/@dockstat-plugin-handler/README.md
apps/docs/dockstat/packages/@dockstat-sqlite-wrapper/README.md
apps/docs/dockstat/packages/@dockstat-typings/README.md
apps/docs/dockstat/packages/@dockstat-ui/README.md
apps/docs/dockstat/packages/@dockstat-utils/README.md
apps/docs/dockstat/packages/README.md
apps/docs/dockstat/troubleshooting/README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot changed the title @sourcery-ai Add reusable outline-sync config loader and refresh docs Jan 1, 2026
@Its4Nik

Its4Nik commented Jan 1, 2026

Copy link
Copy Markdown
Owner Author

Bruh wrong way around

@Its4Nik Its4Nik closed this Jan 1, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • You list YAML/YML files as valid config filenames but never actually parse YAML (only JSON or raw text), which may surprise users expecting structured config; consider wiring in a YAML parser or dropping those extensions.
  • loadConfig returns any and mixes several possible shapes (JS module exports, JSON, package.json.outline, or raw string); it would be helpful to narrow this to a well-defined config type and normalize the shapes before returning.
  • findConfig silently falls back when OUTLINE_CONFIG points at a missing/unreadable file; if that env var is set, it might be better to fail fast or at least surface a clear warning so misconfigurations are obvious.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- You list YAML/YML files as valid config filenames but never actually parse YAML (only JSON or raw text), which may surprise users expecting structured config; consider wiring in a YAML parser or dropping those extensions.
- loadConfig returns any and mixes several possible shapes (JS module exports, JSON, package.json.outline, or raw string); it would be helpful to narrow this to a well-defined config type and normalize the shapes before returning.
- findConfig silently falls back when OUTLINE_CONFIG points at a missing/unreadable file; if that env var is set, it might be better to fail fast or at least surface a clear warning so misconfigurations are obvious.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant