Files
HomeAgent/.gitignore
JianFeeeee 12259ed4ec chore: 修 .gitignore 误伤源码目录(4 类,28 个已跟踪文件)
`git ls-files | xargs -n1 git check-ignore --no-index` 查出 49 个已跟踪
源码文件落在 ignore 规则下。它们现在能提交只是因为「已跟踪文件不受
.gitignore 影响」这条 git 规则在兜着——**新增文件会默默不入库**。

## 根因一:缺前导斜杠(28 个文件)

`knowledge/` / `memory/` / `scripts/` 不带前导斜杠,git 把它们当作
「任意层级的同名目录」:

    memory/     → 吞掉 internal/memory/         24 个文件
    knowledge/  → 吞掉 internal/knowledge/       3 个文件
                          assets/knowledge/
    scripts/    → 吞掉 deploy/scripts/           1 个文件

本意只是忽略根级运行时数据目录。旁边的 `/adapters/` 就写对了,
这三条是漏了斜杠。

修法:补 `/` 前缀。验证两侧行为:
  根级 knowledge/y.md memory/z.db scripts/tmp.sh   仍被忽略 ✓
  深层 internal/memory/new.go internal/knowledge/new.go
       deploy/scripts/new.sh                        可入库 ✓

## 根因二:internal/meta/ 整目录被忽略(1 个文件)

引入于 1f1233b(2026-07-12),同批还有 `.go/`、`.local/`、
`internal/plugins/openclaw/{manager,pysimulator}/`(后两个目录现已不存在)。
`internal/meta/meta.go` 是内核版本号与元数据的唯一数据源,本轮升 1.0.0 时
`git add` 报「paths are ignored」,就是这条。已跟踪所以改动能提交,
但新增 meta 文件会丢。直接删掉这条规则。

## 保留的 20 项不是缺陷

`third_party/homeagent-sdk/example/` 下 20 个已跟踪文件(plg.json +
plugin.go)仍在规则覆盖下,这是**有意的**:外部插件维护在独立 SDK 仓
(决策 sdk_repo_only),主仓只需要这 20 个源码文件参与构建,不要 SDK 仓的
main.go/go.mod/go.sum。删掉该规则会让 60+ 个文件涌进主仓——实测确认过。

已在两处 ignore 段落写明理由,避免后来人「修」错方向。

验证:修复后 check-ignore 扫描从 49 降到 20(全部是有意保留的 example/);
go build ./... 通过。
2026-09-03 08:39:23 +08:00

63 lines
1.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/homed
/waiter
*.exe
*.log
*.test
build/
*.so
*.db
data/
.tmp-plugins/
.go/
.local/
*.hmap
dev/
login.json
# GUI
cmd/gui/node_modules/
cmd/gui/dist/
.gopath/
# SDK 工具链 — 核心仓不追踪
#
# 外部插件与工具链维护在独立 SDK 仓(决策 sdk_repo_only
# 本仓经 go.mod 的 replace => ./third_party/homeagent-sdk 引用。
# example/ 下已跟踪的 20 个文件plg.json + plugin.go早于本规则
# 靠「已跟踪文件不受 .gitignore 影响」保留——这是有意的,不要「修」。
third_party/homeagent-sdk/bin/
third_party/homeagent-sdk/tools/
third_party/homeagent-sdk/package/
third_party/homeagent-sdk/.gitignore
third_party/homeagent-sdk/README*
third_party/homeagent-sdk/example/
.codegraph/
# codegraph 本地索引配置(含嵌套 SDK 仓放行,仅本地生效)
codegraph.json
# 运行时产物(不提交)
#
# ⚠️ 这些必须带前导斜杠。不带斜杠的模式(如 `memory/`)会匹配**任意层级**的
# 同名目录,把 internal/memory/、internal/knowledge/、deploy/scripts/ 一起吞掉
# ——24 + 3 + 1 个已跟踪源码文件曾因此落在 ignore 规则下,只靠「已跟踪
# 文件不受 .gitignore 影响」这条 git 规则兜着,新增文件会默默不入库。
/adapters/
/knowledge/
/memory/
/scripts/
terminal_locked_log.txt
dist/
.pi-glla/
.omo/
.pi/
# HarmonyOS 构建工具链缓存HVIGOR_USER_HOME / ohpm 生成,非源码)
.hvigor-home/
.npm-cache/
.ohpm/