Conversation
Contributor
Reviewer's GuideRefactors 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 ...")
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Owner
Author
|
Bruh wrong way around |
Contributor
There was a problem hiding this comment.
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.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Introduce a reusable configuration discovery and loading utility for outline-sync and refresh synced documentation metadata and examples.
Enhancements:
Documentation: