@cogit/cli 0.17.2 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cogit",
3
3
  "displayName": "cogit",
4
- "version": "0.17.2",
4
+ "version": "0.19.0",
5
5
  "description": "Git remembers what changed. cogit remembers why.",
6
6
  "author": {
7
7
  "name": "Eren Sertkaya"
package/README.md CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  # cogit
4
4
 
5
- **Cogito, ergo commit.**
6
-
7
5
  Git remembers what changed. cogit remembers why.
8
6
 
9
- <p align="center"><img src="docs/images/cogit-descartes.jpg" width="360" alt="René Descartes with git branches running through his hair"><br><sub>After Frans Hals, <i>Portrait of René Descartes</i> (c. 1649).</sub></p>
7
+ <p align="center"><img src="docs/images/cogit-descartes.jpg" width="360" alt="René Descartes with git branches running through his hair"><br><i>Cogito, ergo commit.</i></p>
10
8
 
11
- ![The map: sessions, branches and the thoughts behind them](docs/images/map.png)
9
+ <picture>
10
+ <source media="(prefers-color-scheme: dark)" srcset="docs/images/map-dark.png">
11
+ <img src="docs/images/map-light.png" alt="The map: sessions, branches and the decision behind a message">
12
+ </picture>
12
13
 
13
14
  cogit records every message you send to an AI coding agent as a *thought commit*: what you
14
15
  asked, what came of it, and the message it answered. Your code commits point back to the
@@ -20875,11 +20875,42 @@ function hasGuard(settings) {
20875
20875
  const hooks = isObject2(settings.hooks) ? settings.hooks.UserPromptSubmit : void 0;
20876
20876
  return JSON.stringify(hooks ?? []).includes(GUARD_TAG);
20877
20877
  }
20878
+ function hasCurrentGuard(settings) {
20879
+ const hooks = isObject2(settings.hooks) ? settings.hooks.UserPromptSubmit : void 0;
20880
+ return JSON.stringify(hooks ?? []).includes(JSON.stringify(GUARD_COMMAND));
20881
+ }
20882
+ function withCurrentGuard(submit) {
20883
+ return [
20884
+ ...submit.filter((entry) => !JSON.stringify(entry).includes(GUARD_TAG)),
20885
+ { hooks: [{ type: "command", command: GUARD_COMMAND, timeout: 5 }] }
20886
+ ];
20887
+ }
20878
20888
  async function readProjectSetup(root) {
20879
20889
  const settings = await readSettings(projectSettingsPath(root));
20880
20890
  if (!settings) return void 0;
20881
20891
  const plugins = isObject2(settings.enabledPlugins) ? settings.enabledPlugins : {};
20882
- return plugins[PLUGIN_ID] === true && hasGuard(settings);
20892
+ return plugins[PLUGIN_ID] === true && hasCurrentGuard(settings);
20893
+ }
20894
+ async function refreshProjectSetup(root) {
20895
+ const file2 = projectSettingsPath(root);
20896
+ const settings = await readSettings(file2);
20897
+ if (!settings || !isObject2(settings.hooks)) return void 0;
20898
+ const submit = settings.hooks.UserPromptSubmit;
20899
+ const marketplaces = isObject2(settings.extraKnownMarketplaces) ? settings.extraKnownMarketplaces : void 0;
20900
+ const ours = marketplaces?.[MARKETPLACE];
20901
+ const staleGuard = Array.isArray(submit) && hasGuard(settings) && !hasCurrentGuard(settings);
20902
+ const staleMarketplace = isObject2(ours) && isObject2(ours.source) && ours.source.source === "github" && ours.source.repo !== MARKETPLACE_REPO;
20903
+ if (!staleGuard && !staleMarketplace) return void 0;
20904
+ const next = { ...settings };
20905
+ if (staleGuard)
20906
+ next.hooks = { ...settings.hooks, UserPromptSubmit: withCurrentGuard(submit) };
20907
+ if (staleMarketplace)
20908
+ next.extraKnownMarketplaces = {
20909
+ ...marketplaces,
20910
+ [MARKETPLACE]: { source: { source: "github", repo: MARKETPLACE_REPO } }
20911
+ };
20912
+ await atomicWriteJson(file2, next);
20913
+ return file2;
20883
20914
  }
20884
20915
  async function writeProjectSetup(root) {
20885
20916
  const file2 = projectSettingsPath(root);
@@ -20899,13 +20930,7 @@ async function writeProjectSetup(root) {
20899
20930
  ...settings.extraKnownMarketplaces,
20900
20931
  [MARKETPLACE]: { source: { source: "github", repo: MARKETPLACE_REPO } }
20901
20932
  },
20902
- hooks: hasGuard(settings) ? hooks : {
20903
- ...hooks,
20904
- UserPromptSubmit: [
20905
- ...submit,
20906
- { hooks: [{ type: "command", command: GUARD_COMMAND, timeout: 5 }] }
20907
- ]
20908
- }
20933
+ hooks: hasCurrentGuard(settings) ? hooks : { ...hooks, UserPromptSubmit: withCurrentGuard(submit) }
20909
20934
  };
20910
20935
  await mkdir3(join5(root, ".claude"), { recursive: true });
20911
20936
  await atomicWriteJson(file2, next);
@@ -21229,6 +21254,7 @@ var claude = {
21229
21254
  allowSkill,
21230
21255
  readProjectSetup,
21231
21256
  writeProjectSetup,
21257
+ refreshProjectSetup,
21232
21258
  markLive
21233
21259
  };
21234
21260