Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

classifier config path ignores profile, PI_CONFIG_DIR, and XDG

已关闭
#9 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript
领域
tooling

调研方向

Start in index.ts at classifierConfigPath() and review PR #8 for the host lockfile resolver pattern. Inspect the referenced pi-utils directory and profile-resolution behavior, including the existing environment-variable override and related tests. Done means profile, PI_CONFIG_DIR, and XDG resolution no longer share one classifier file, while OMP_BASH_CLASSIFIER_CONFIG and the test suite continue to work.

由索引模型根据 Issue 内容生成。

描述

bug ready-for-agent

classifierConfigPath() hand-builds ~/.omp/omp-bash-classifier.json, so the plugin's own config is invisible under a profile, PI_CONFIG_DIR, or XDG.

index.ts:290:

return process.env.OMP_BASH_CLASSIFIER_CONFIG ?? path.join(os.homedir(), ".omp", "omp-bash-classifier.json");

Three env inputs move where the host would put that file: OMP_PROFILE/PI_PROFILE gives ~/.omp/profiles/<name>/, PI_CONFIG_DIR replaces the .omp segment, and on darwin and linux XDG_DATA_HOME applies when $XDG_DATA_HOME/omp exists. getConfigDirName() is process.env.PI_CONFIG_DIR || CONFIG_DIR_NAME (pi-utils src/dirs.ts), and the profile root sits under getProfileConfigRoot.

What that costs: run under --profile work and /classifier enabled false writes to a path resolved the same wrong way, so at least it round-trips. The break is that every profile shares one config file. Turn the classifier off in your work profile and it goes off everywhere, with no indication that happened.

PR #8 hit the identical bug for the host lockfile and fixed it by calling the host resolver:

import { getPluginsLockfile } from "@oh-my-pi/pi-utils";

That import is safe where import { settings } is not, which the header comment at the top of index.ts warns about. settings is a host-initialized singleton and a plugin-local copy throws. The dirs resolver derives from process.env at module load, and the host has populated it before a plugin binds.

There is no getBashClassifierConfig() to call, so this one needs the path composed from the resolver rather than a single function: something like path.join(dirs-resolved config root, "omp-bash-classifier.json"). Worth checking whether the file belongs beside the agent dir or under the config root before picking.

Keep OMP_BASH_CLASSIFIER_CONFIG as-is. The test suite depends on it to stay off the real file.

主要语言
TypeScript
星标
0
派生
1
平均合并
3 小时 21 分钟
30 天内合并 PR
49

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

STRML/omp-classifier 的其他 Issue

查看 STRML/omp-classifier 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。