From 7a35cddd0088bddd8269bf8e1e877f4f23ad2b4e Mon Sep 17 00:00:00 2001 From: nethris Date: Thu, 23 Oct 2025 13:29:29 +0200 Subject: [PATCH 1/3] fix: prevent commands dir from being categorized --- .../harmonix/src/runtime/internal/module.ts | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/harmonix/src/runtime/internal/module.ts b/packages/harmonix/src/runtime/internal/module.ts index 59adae8..108a868 100644 --- a/packages/harmonix/src/runtime/internal/module.ts +++ b/packages/harmonix/src/runtime/internal/module.ts @@ -27,10 +27,9 @@ export const loadModule = async ( module.type === ModuleType.Command && harmonixOptions.categorization.inferFromPath ) { - const category = filename(dirname(path))! + const inferred = inferCategoryFromPath(filePath, harmonixOptions) - module.category ??= - harmonixOptions.categorization.categories[category] ?? category + module.category ??= inferred } if (module.type === ModuleType.Event) { @@ -98,3 +97,18 @@ export const disposeModule = async (harmonix: Harmonix, path: string) => { } } } + +const inferCategoryFromPath = ( + filePath: string, + harmonixOptions: HarmonixOptions +) => { + const parentDir = dirname(filePath) + + if (parentDir === harmonixOptions.dirs.commands) { + return undefined + } + + const category = filename(parentDir)! + + return harmonixOptions.categorization.categories[category] ?? category +} From 5aa3744680fb782606912c2d40cd6a880510ac09 Mon Sep 17 00:00:00 2001 From: nethris Date: Thu, 23 Oct 2025 13:30:39 +0200 Subject: [PATCH 2/3] fix: hmr event message --- packages/harmonix/src/module.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/harmonix/src/module.ts b/packages/harmonix/src/module.ts index 0af5631..1ee0b56 100644 --- a/packages/harmonix/src/module.ts +++ b/packages/harmonix/src/module.ts @@ -31,7 +31,7 @@ const handleChanges = debounce(async (harmonix: Harmonix, events: Event[]) => { for (const event of events) { const path = resolve(event.path) harmonix.logger.info( - `\u001B[38;2;75;67;238mhmr update\u001B[0m ${colors.dim(relative(harmonix.options.srcDir, path))}` + `\u001B[38;2;75;67;238mhmr ${event.type}\u001B[0m ${colors.dim(relative(harmonix.options.srcDir, path))}` ) if (event.type === 'delete') { From e2b16da05c1061f3e9f58bae1b27302a838f5278 Mon Sep 17 00:00:00 2001 From: nethris Date: Thu, 23 Oct 2025 18:17:08 +0200 Subject: [PATCH 3/3] chore: add changeset --- .changeset/clean-peas-wonder.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/clean-peas-wonder.md diff --git a/.changeset/clean-peas-wonder.md b/.changeset/clean-peas-wonder.md new file mode 100644 index 0000000..6805d1b --- /dev/null +++ b/.changeset/clean-peas-wonder.md @@ -0,0 +1,5 @@ +--- +'harmonix': patch +--- + +Prevent commands root dir from being categorized