genshin-mods 4.1.2 → 4.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genshin-mods",
3
- "version": "4.1.2",
3
+ "version": "4.2.0",
4
4
  "description": "A Claude Code plugin of mods: five under one band above the prompt (the next steps, the cache and usage with a one-click handoff, recording mode, a goal's task list and a question before editing a file another session just changed) a delegation guard that nudges a run of lookups toward a haiku agent, a disk-scan guard that refuses a Bash scan from a root or a home folder, and a whole-index guard that refuses a git command over the whole index while another session shares the checkout.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -38,5 +38,5 @@
38
38
  "test": "vitest",
39
39
  "validate": "claude plugin validate ."
40
40
  },
41
- "gitHead": "144e3f98570b015e3181bfbc6cb70d346ce826b5"
41
+ "gitHead": "fef4971cf6a621a2c1850f32fcec19ee4ec0de99"
42
42
  }
@@ -0,0 +1,9 @@
1
+ import type { EngineInterface } from "claude-code";
2
+
3
+ import type { WardRecord } from "../../../types";
4
+
5
+ import { parseRecords } from "./parseRecords";
6
+
7
+ // The records as the file holds them, none when it does not yet exist
8
+ export const readRecords = async ($: EngineInterface, path: string): Promise<Record<string, WardRecord>> =>
9
+ (await $.fs.exists(path)) ? parseRecords(await $.fs.read(path)) : {};
@@ -2,26 +2,16 @@ import type { EngineInterface, On, ToolCallResult } from "claude-code";
2
2
 
3
3
  import { atom, read } from "claude-code";
4
4
 
5
- import type { WardRecord } from "../../../types";
6
-
7
5
  import { WardAnswer, WardAnswers } from "../../models/WardAnswer";
8
6
  import { InitialState } from "../InitialState";
9
7
  import { getCollidingRecord } from "./getCollidingRecord";
10
- import { getRecordsPath } from "./getRecordsPath";
11
8
  import { getRecordsWithEdit } from "./getRecordsWithEdit";
12
- import { parseRecords } from "./parseRecords";
9
+ import { readRecords } from "./readRecords";
10
+ import { resolveRecordsPath } from "./resolveRecordsPath";
13
11
 
14
12
  const enabledModsAtom = atom({ key: "enabledMods", plugin: "genshin-mods" } as const, InitialState.enabledMods);
15
13
  const AGE_FORMATTER = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
16
14
 
17
- // The records file under the person's home folder, the home read from this file's own environment lookup
18
- const resolveRecordsPath = async ($: EngineInterface): Promise<string> =>
19
- getRecordsPath((await $.env.get("HOME")) ?? (await $.env.get("USERPROFILE")) ?? "");
20
-
21
- // The records as the file holds them, none when it does not yet exist
22
- const readRecords = async ($: EngineInterface, path: string): Promise<Record<string, WardRecord>> =>
23
- (await $.fs.exists(path)) ? parseRecords(await $.fs.read(path)) : {};
24
-
25
15
  // Before the edit: the question, when another session's record calls for one. After it: the edit recorded
26
16
  const ward = async (
27
17
  $: EngineInterface,
@@ -2,26 +2,16 @@ import type { EngineInterface, On, ToolCallResult } from "claude-code";
2
2
 
3
3
  import { atom, read } from "claude-code";
4
4
 
5
- import type { WardRecord } from "../../../types";
6
-
7
5
  import { InitialState } from "../InitialState";
8
6
  import { joinDirectory } from "../shell/joinDirectory";
9
7
  import { getCheckoutPeer } from "./getCheckoutPeer";
10
8
  import { getParentFolder } from "./getParentFolder";
11
- import { getRecordsPath } from "./getRecordsPath";
12
9
  import { getWholeIndexDenyReason, getWholeIndexRefusal } from "./getWholeIndexRefusal";
13
- import { parseRecords } from "./parseRecords";
10
+ import { readRecords } from "./readRecords";
11
+ import { resolveRecordsPath } from "./resolveRecordsPath";
14
12
 
15
13
  const enabledModsAtom = atom({ key: "enabledMods", plugin: "genshin-mods" } as const, InitialState.enabledMods);
16
14
 
17
- // The records file under the person's home folder, the home read from this file's own environment lookup
18
- const resolveRecordsPath = async ($: EngineInterface): Promise<string> =>
19
- getRecordsPath((await $.env.get("HOME")) ?? (await $.env.get("USERPROFILE")) ?? "");
20
-
21
- // The records as the file holds them, none when it does not yet exist
22
- const readRecords = async ($: EngineInterface, path: string): Promise<Record<string, WardRecord>> =>
23
- (await $.fs.exists(path)) ? parseRecords(await $.fs.read(path)) : {};
24
-
25
15
  // The nearest folder at or above `folder` holding a `.git`, a worktree's file included, undefined when none does
26
16
  const findCheckoutRoot = async ($: EngineInterface, folder: string): Promise<string | undefined> => {
27
17
  if (await $.fs.exists(`${folder}/.git`)) return folder;
@@ -0,0 +1,7 @@
1
+ import type { EngineInterface } from "claude-code";
2
+
3
+ import { getRecordsPath } from "./getRecordsPath";
4
+
5
+ // The records file under the person's home folder, the home read from the engine's environment lookup
6
+ export const resolveRecordsPath = async ($: EngineInterface): Promise<string> =>
7
+ getRecordsPath((await $.env.get("HOME")) ?? (await $.env.get("USERPROFILE")) ?? "");