Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce bot modules, move TCCPP-specific components into tccpp module #136

Merged
merged 2 commits into from
Mar 27, 2025

Conversation

michael-kenzel
Copy link
Contributor

@michael-kenzel michael-kenzel commented Mar 21, 2025

Take a first step in untying Wheatley from TCCPP by introducing bot modules and moving TCCPP stuff into a tccpp module. Also introduces an excludes config option to skip loading certain components, and replaces our custom walk_dir() with the glob package.

.gitmodules Outdated
[submodule "wheatley-private"]
path = src/wheatley-private
[submodule "src/components/tccpp/private"]
path = src/components/tccpp/private
Copy link
Member

Choose a reason for hiding this comment

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

I had forgotten that wheatley-private isn't just components, it's

algorithm/
components/
services/
test/

Thoughts on keeping this top-level? Maybe moving src/components/tccpp to src/tccpp/components? Not sure what's best.

Copy link
Contributor Author

@michael-kenzel michael-kenzel Mar 23, 2025

Choose a reason for hiding this comment

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

We could have bot modules—libraries of related components and their infrastructure—that can be installed in src/modules. And then we just load components from src/**/components/*.ts.

@michael-kenzel michael-kenzel marked this pull request as draft March 24, 2025 18:25
@michael-kenzel michael-kenzel force-pushed the restructuring branch 4 times, most recently from 0e82bba to 31a93d8 Compare March 25, 2025 14:34
@michael-kenzel michael-kenzel changed the title Move TCCPP-specific components to their own subdirectory Introduce modules, move TCCPP-specific components into tccpp module Mar 26, 2025
@michael-kenzel michael-kenzel changed the title Introduce modules, move TCCPP-specific components into tccpp module Introduce bot modules, move TCCPP-specific components into tccpp module Mar 26, 2025
@michael-kenzel michael-kenzel marked this pull request as ready for review March 26, 2025 11:23
const name = path.basename(file_path, path.extname(file_path));
const content = await fs.promises.readFile(file_path, { encoding: "utf-8" });
for await (const file_path of globIterate("wiki/articles/**/*.md", { withFileTypes: true })) {
const name = file_path.name.slice(0, -3);
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer this to remain in terms of path operations if possible, it’s a lot clearer than a splice

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would actually suggest just using the file name here, it seems to only be used as an internal identifier anyways, everything seems to work fine with just file_path.name instead.

@@ -395,25 +395,16 @@ export class Wheatley {
})().catch(this.critical_error.bind(this));
});

for await (const file of walk_dir("src/components")) {
const default_export = (await import(`../${file.replace(".ts", ".js")}`)).default;
for await (const file of globIterate("**/components/*.js", {
Copy link
Member

Choose a reason for hiding this comment

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

I’m a bit concerned about globbing every js file in any components/ folder here. Would be better to make sure this is in the dist folder or whatnot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The cwd: import.meta.dirname should constrain it to only take .js files from components subdirectories of the src/ directory.

}
const name = path.basename(file_path, path.extname(file_path));
for (const file_path of globSync("wiki/articles/**/*.md", { withFileTypes: true })) {
const name = file_path.name.slice(0, -3);
Copy link
Member

Choose a reason for hiding this comment

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

Ditto here re splicing

Copy link
Member

@jeremy-rifkin jeremy-rifkin left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM!

@jeremy-rifkin jeremy-rifkin merged commit d04e750 into TCCPP:main Mar 27, 2025
6 checks passed
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.

2 participants