iT邦幫忙

2025 iThome 鐵人賽

DAY 24
0
生成式 AI

Before AI dominate the world, AI dominate my world系列 第 24

Less agent time, more refactoring need

  • 分享至 

  • xImage
  •  

由於Claude Code的Weekly Limit差不多快碰頂了,今天只能請其它的agent進行專案的重構。這就相當的花時間,雖然其它的agent也是用gpt-5 or claude soneet 4.5,但它們和原生的比較起來就是不太一樣。如同之前提及的Claude Code裡的Claude Sonnet 4.5相當的負責,不像其它的agent做一下就停下來,因此一但Claude Code的使用受到限制,真的很不方便,綁手綁腳的。

昨天開始進行的是大規模的重構。雖然地城的玩法沒有更深入的開展,但整個架構和專案結構到目前都實驗的差不多,因此,從現在開始要將這些實驗性質的架構慢慢地抽離出來,讓它可以在其它的專案裡被引用。也就是現有的Contract專案要被抽離出來,讓其它的案依其需求其實現這些Contract專案。這樣console app也好,Unity也好,都可以利用contract有統一的接口,但又有各自的實現的部份可以做特化。

而這次以console app展開,主要是想要避開unity專案自的複雜性,再加上agent目前對於unity專案的架構掌控不是很好,但純c#的console app則表現上還算是正常。因此此實驗性專案一開始是瞄準console app,經過這三個星期的變革來看,是可以進一步將部份的code提出,以利後續的開發。

另外,也因為claude code的使用時間大幅的縮短,正在找替代的方案,今天找到了OpenCode,看起來是想要成為只有cli版本的cursor或是windsurf。不過目前它只有提供Grok Code Fast 1和Code Supernova二個免費的ai model,其它的模型全部都要走api,不是很省錢的方案。但官方有提供近期會提供訂閱方案,到時在來看看是否可以代替claude code。

重構時將基礎的一些程式碼移到另一個git repo,這時,才發現agent的規則似乎需要重新在該git repo重新定義一遍。但不想要一直重複放入agent的規則,只好請教ai,看有沒有比較好的方法

  1. Shared Template Repository

  - Central repo with canonical versions of hooks + agent rules
  - Each project pulls/syncs via git submodule or subtree
  - Pros: Single source of truth, version controlled
  - Cons: Requires discipline to sync, submodule friction

  2. Symlinks to Shared Location

  - Pros: Zero duplication, instant updates across all repos
  - Cons: Breaks if shared location moves, not portable to other machines

  3. Git Hook Manager (like Husky/Lefthook)

  - Config file in each repo points to shared hook scripts
  - Manager handles hook installation/execution
  - Pros: Cross-platform, well-tested tooling
  - Cons: Additional dependency, may be overkill

  4. Homogeneous Wrapper + Central Logic

  - Thin wrapper hook in each repo's .git/hooks/
  - Wrapper calls centralized script with actual logic
  - Pros: Local hooks stay simple, easy to customize per-repo
  - Cons: Still need to install wrapper in each repo

  5. Global Git Hooks (Git 2.9+)

  git config --global core.hooksPath ~/.git-hooks
  - Pros: Zero per-repo setup, truly global
  - Cons: Same hook for ALL repos (may not want that)

第一個選項應該是最適合的,但以submodule or subtree放入到每一個repo裡,我倒是覺得沒有必要,明天來試試看。但我覺得agent rule和pre-commit hook應該是要分開來的。


上一篇
More limitation on agent usage
系列文
Before AI dominate the world, AI dominate my world24
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言