@gonkagate/claude-code 0.1.0 → 0.1.3

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/CHANGELOG.md CHANGED
@@ -2,10 +2,44 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - Improved npm package metadata and README copy for better package-page clarity, discovery, and onboarding.
5
6
  - Added a curated model registry and model picker to the public installer flow.
6
7
  - Added `--model <model-key>` and `--model=<model-key>` support for curated non-secret model selection.
7
8
  - Kept the public Claude Code contract tight by limiting model selection to the curated GonkaGate registry only.
8
9
  - Updated docs and tests for model selection while preserving local git ignore protection and owner-only settings file permissions.
10
+ - Hardened local scope against symlinked `.claude` paths that could redirect secret writes outside the ignored settings path.
11
+ - Extended local git protection to ignore timestamped backup files for `.claude/settings.local.json`.
12
+ - Normalized backup permissions to owner-only mode so secret-bearing backups are not left world-readable.
13
+ - Hardened local scope so `.claude/settings.local.json` cannot keep tracking secrets in git before local setup proceeds.
14
+ - Replaced the tracked-local-settings hard stop with a recovery flow that can stop tracking the file or switch to user scope without rerunning setup.
15
+ - Hardened local scope against symlinked path components anywhere between the repo root and the target settings file.
16
+ - Pinned GitHub Actions workflows to immutable commit SHAs for release pipeline hardening.
17
+ - Restored automated npm publish dispatch after Release Please creates a new release tag.
18
+ - Made publish reruns skip versions that are already present on npm instead of failing with a duplicate-version error.
19
+
20
+ ## [0.1.3](https://github.com/GonkaGate/gonkagate-claude-code/compare/v0.1.2...v0.1.3) (2026-03-31)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * document release-please title requirements ([5fce744](https://github.com/GonkaGate/gonkagate-claude-code/commit/5fce7441dfd0c79d6f6ab43b4fa20737df879516))
26
+ * document release-please title requirements ([145f9f7](https://github.com/GonkaGate/gonkagate-claude-code/commit/145f9f72da19cf31f8f73e8250047988ee1eb9bf))
27
+
28
+ ## [0.1.2](https://github.com/GonkaGate/gonkagate-claude-code/compare/v0.1.1...v0.1.2) (2026-03-31)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * restore automated npm publishes ([42bde87](https://github.com/GonkaGate/gonkagate-claude-code/commit/42bde8795e264c8950017aa5acff0475b4fb0c8e))
34
+ * restore automated npm publishes ([52fcd8e](https://github.com/GonkaGate/gonkagate-claude-code/commit/52fcd8e428ccae967871aba800344dd786a048ce))
35
+
36
+ ## [0.1.1](https://github.com/GonkaGate/gonkagate-claude-code/compare/v0.1.0...v0.1.1) (2026-03-31)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * stop duplicate npm publishes ([1ac876a](https://github.com/GonkaGate/gonkagate-claude-code/commit/1ac876a4fb1c99bd1a1cc892e38ee2c7df3be799))
42
+ * stop duplicate npm publishes ([58d022f](https://github.com/GonkaGate/gonkagate-claude-code/commit/58d022ff2486fa6156badc791cb236f580b68a9c))
9
43
 
10
44
  ## 0.1.0
11
45
 
package/README.md CHANGED
@@ -1,10 +1,12 @@
1
- # gonkagate-claude-code
1
+ # @gonkagate/claude-code
2
2
 
3
- Set up Claude Code to use GonkaGate in one step.
3
+ Set up Claude Code to use GonkaGate in one `npx` command.
4
4
 
5
- This tool configures local `Claude Code` to use GonkaGate's Anthropic-compatible gateway at `https://api.gonkagate.com`.
5
+ This CLI installer is for developers who already have local `Claude Code` and want to use it with GonkaGate, the gateway to Gonka Network, without editing shell profiles, exporting long env var blocks, or writing `.env` files by hand.
6
6
 
7
- It does not install `Claude Code` itself. It sets up an existing local Claude Code install.
7
+ Under the hood it configures Claude Code to use GonkaGate's Anthropic-compatible endpoint at `https://api.gonkagate.com`.
8
+
9
+ It does not install `Claude Code` itself. It configures an existing local Claude Code install.
8
10
 
9
11
  ## Quick Start
10
12
 
@@ -12,18 +14,28 @@ It does not install `Claude Code` itself. It sets up an existing local Claude Co
12
14
  npx @gonkagate/claude-code
13
15
  ```
14
16
 
17
+ Need an API key first? [Create one on GonkaGate](https://gonkagate.com/en).
18
+
15
19
  You will be asked for:
16
20
 
17
- - your GonkaGate API key (`gp-...`)
21
+ - your GonkaGate API key (`gp-...`) in a hidden interactive prompt
18
22
  - a model from the supported GonkaGate list
19
23
  - setup scope: `user` or `local`
20
24
 
25
+ If you choose `local` scope and `.claude/settings.local.json` is already tracked by git, the installer offers to stop tracking that file and continue, or switch to `user` scope instead.
26
+
21
27
  You need:
22
28
 
23
29
  - local `Claude Code`
24
30
  - Node.js 18+
25
31
  - a GonkaGate API key
26
32
 
33
+ ## Supported Model
34
+
35
+ Current public Claude Code model in the curated registry:
36
+
37
+ - `qwen3-235b` -> `qwen/qwen3-235b-a22b-instruct-2507-fp8`
38
+
27
39
  ## What It Does
28
40
 
29
41
  The tool writes Claude Code settings so you can keep running `claude` normally afterward.
@@ -41,7 +53,10 @@ It also:
41
53
  - preserves unrelated Claude Code settings
42
54
  - creates a backup before overwriting an existing settings file
43
55
  - writes settings files with owner-only permissions
44
- - adds `.claude/settings.local.json` to `.git/info/exclude` for local setup inside a git repo
56
+ - writes backup files with owner-only permissions
57
+ - adds `.claude/settings.local.json` and local backup files to `.git/info/exclude` for local setup inside a git repo
58
+ - offers to stop tracking `.claude/settings.local.json` before local setup writes secrets into a file that was already tracked by git
59
+ - refuses local setup if the target path traverses a symlinked path component, or if `.claude` / the local settings file is a symlink
45
60
 
46
61
  ## Fixed GonkaGate Setup
47
62
 
@@ -53,12 +68,6 @@ These parts are intentionally fixed:
53
68
 
54
69
  This tool does not ask for a custom base URL and does not accept arbitrary custom model IDs.
55
70
 
56
- ## Supported Model
57
-
58
- Current public Claude Code model:
59
-
60
- - `qwen3-235b` -> `qwen/qwen3-235b-a22b-instruct-2507-fp8`
61
-
62
71
  The selected model is written into all Claude Code model env vars used by this setup flow.
63
72
 
64
73
  ## Verify
@@ -73,6 +82,7 @@ After setup:
73
82
  ## What This Tool Does Not Do
74
83
 
75
84
  - It does not configure `claude.ai`
85
+ - It does not install `Claude Code` itself
76
86
  - It does not edit `.zshrc`, `.bashrc`, PowerShell profiles, or other shell startup files
77
87
  - It does not write `.env` files
78
88
  - It does not support arbitrary custom model IDs
@@ -80,9 +90,9 @@ After setup:
80
90
 
81
91
  ## Need Help?
82
92
 
83
- - Troubleshooting: [docs/troubleshooting.md](docs/troubleshooting.md)
84
- - Security notes: [docs/security.md](docs/security.md)
85
- - Internal behavior: [docs/how-it-works.md](docs/how-it-works.md)
93
+ - Troubleshooting: [docs/troubleshooting.md](https://github.com/GonkaGate/gonkagate-claude-code/blob/main/docs/troubleshooting.md)
94
+ - Security notes: [docs/security.md](https://github.com/GonkaGate/gonkagate-claude-code/blob/main/docs/security.md)
95
+ - Internal behavior: [docs/how-it-works.md](https://github.com/GonkaGate/gonkagate-claude-code/blob/main/docs/how-it-works.md)
86
96
 
87
97
  ## Development
88
98
 
package/dist/cli.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import type { InstallScope } from "./types/settings.js";
1
+ import type { InstallScope, SettingsTarget } from "./types/settings.js";
2
2
  import type { SupportedModelKey } from "./constants/models.js";
3
+ import type { TrackedLocalSettingsAction } from "./install/prompts.js";
3
4
  interface CliOptions {
4
5
  help: boolean;
5
6
  version: boolean;
@@ -11,5 +12,6 @@ interface ProgramOutput {
11
12
  writeErr?: (str: string) => void;
12
13
  }
13
14
  export declare function parseCliOptions(argv: string[], output?: ProgramOutput): CliOptions;
15
+ export declare function resolveSettingsTarget(scope: InstallScope, cwd: string, chooseTrackedLocalSettingsAction?: (relativeTargetPath: string) => Promise<TrackedLocalSettingsAction>): Promise<SettingsTarget>;
14
16
  export declare function run(argv?: string[]): Promise<void>;
15
17
  export {};
package/dist/cli.js CHANGED
@@ -4,9 +4,9 @@ import { Command, CommanderError, Option } from "commander";
4
4
  import { DEFAULT_MODEL_KEY, SUPPORTED_MODELS, SUPPORTED_MODEL_KEYS, requireSupportedModel } from "./constants/models.js";
5
5
  import { createBackup } from "./install/backup.js";
6
6
  import { loadSettings } from "./install/load-settings.js";
7
- import { ensureLocalSettingsIgnored } from "./install/local-git-ignore.js";
7
+ import { ensureLocalSettingsIgnored, stopTrackingLocalSettings, TrackedLocalSettingsError } from "./install/local-git-ignore.js";
8
8
  import { mergeSettingsWithGonkaEnv } from "./install/merge-env.js";
9
- import { promptForApiKey, promptForModel, promptForScope } from "./install/prompts.js";
9
+ import { promptForApiKey, promptForModel, promptForScope, promptForTrackedLocalSettingsAction } from "./install/prompts.js";
10
10
  import { getSettingsTarget } from "./install/settings-paths.js";
11
11
  import { validateApiKey } from "./install/validate-api-key.js";
12
12
  import { writeSettings } from "./install/write-settings.js";
@@ -77,6 +77,32 @@ function printSuccess(targetPath, scope, selectedModel, backupPath) {
77
77
  console.log("Keep .claude/settings.local.json uncommitted.");
78
78
  }
79
79
  }
80
+ export async function resolveSettingsTarget(scope, cwd, chooseTrackedLocalSettingsAction = promptForTrackedLocalSettingsAction) {
81
+ const target = getSettingsTarget(scope, cwd);
82
+ if (scope !== "local") {
83
+ return target;
84
+ }
85
+ try {
86
+ await ensureLocalSettingsIgnored(target.path);
87
+ return target;
88
+ }
89
+ catch (error) {
90
+ if (!(error instanceof TrackedLocalSettingsError)) {
91
+ throw error;
92
+ }
93
+ const action = await chooseTrackedLocalSettingsAction(error.relativeTargetPath);
94
+ if (action === "user") {
95
+ console.log("\nSwitching to user scope so the repository stays unchanged.");
96
+ return getSettingsTarget("user", cwd);
97
+ }
98
+ if (action === "cancel") {
99
+ throw new Error("Installation cancelled.");
100
+ }
101
+ await stopTrackingLocalSettings(target.path);
102
+ console.log(`\nStopped tracking ${error.relativeTargetPath} in git and added a local exclude.`);
103
+ return target;
104
+ }
105
+ }
80
106
  export async function run(argv = process.argv.slice(2)) {
81
107
  const options = parseCliOptions(argv);
82
108
  printIntro();
@@ -84,16 +110,13 @@ export async function run(argv = process.argv.slice(2)) {
84
110
  const selectedModel = options.modelKey
85
111
  ? requireSupportedModel(options.modelKey)
86
112
  : await promptForModel(SUPPORTED_MODELS, DEFAULT_MODEL_KEY);
87
- const scope = options.scope ?? (await promptForScope("user"));
88
- const target = getSettingsTarget(scope, process.cwd());
89
- if (scope === "local") {
90
- await ensureLocalSettingsIgnored(target.path);
91
- }
113
+ const requestedScope = options.scope ?? (await promptForScope("user"));
114
+ const target = await resolveSettingsTarget(requestedScope, process.cwd());
92
115
  const loaded = await loadSettings(target.path);
93
116
  const mergedSettings = mergeSettingsWithGonkaEnv(loaded.settings, apiKey, selectedModel);
94
117
  const backupPath = loaded.exists ? await createBackup(target.path) : undefined;
95
118
  await writeSettings(target.path, mergedSettings);
96
- printSuccess(target.path, scope, selectedModel, backupPath);
119
+ printSuccess(target.path, target.scope, selectedModel, backupPath);
97
120
  }
98
121
  function handleCliError(error) {
99
122
  if (error instanceof CommanderError) {
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACzH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAqB5D,SAAS,gBAAgB,CAAC,IAAc;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{
3
3
  return timestamp.toISOString().replace(/[:.]/g, "-");
4
4
  }
5
5
  export async function createBackup(filePath) {
6
6
  const backupPath = `${filePath}.backup-${toBackupSuffix()}`;
7
7
  await copyFile(filePath, backupPath);
8
+ await chmod(backupPath, 0o600);
8
9
  return backupPath;
9
10
  }
10
11
  //# sourceMappingURL=backup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"backup.js","sourceRoot":"","sources":["../../src/install/backup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,SAAS,cAAc,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE;IAC5C,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB;IACjD,MAAM,UAAU,GAAG,GAAG,QAAQ,WAAW,cAAc,EAAE,EAAE,CAAC;IAC5D,MAAM,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACrC,OAAO,UAAU,CAAC;AACpB,CAAC"}
1
+ {"version":3,"file":"backup.js","sourceRoot":"","sources":["../../src/install/backup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEnD,SAAS,cAAc,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE;IAC5C,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB;IACjD,MAAM,UAAU,GAAG,GAAG,QAAQ,WAAW,cAAc,EAAE,EAAE,CAAC;IAC5D,MAAM,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACrC,MAAM,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC/B,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -1 +1,7 @@
1
+ export declare class TrackedLocalSettingsError extends Error {
2
+ readonly relativeTargetPath: string;
3
+ readonly repoRoot: string;
4
+ constructor(relativeTargetPath: string, repoRoot: string);
5
+ }
1
6
  export declare function ensureLocalSettingsIgnored(targetPath: string): Promise<void>;
7
+ export declare function stopTrackingLocalSettings(targetPath: string): Promise<void>;
@@ -1,31 +1,140 @@
1
- import { access, mkdir, readFile, stat, writeFile } from "node:fs/promises";
1
+ import { execFile } from "node:child_process";
2
+ import { access, lstat, mkdir, readFile, stat, writeFile } from "node:fs/promises";
2
3
  import path from "node:path";
4
+ import { promisify } from "node:util";
5
+ const execFileAsync = promisify(execFile);
6
+ export class TrackedLocalSettingsError extends Error {
7
+ relativeTargetPath;
8
+ repoRoot;
9
+ constructor(relativeTargetPath, repoRoot) {
10
+ super(`Refusing local install because ${relativeTargetPath} is already tracked by git. Remove it from the index before writing secrets.`);
11
+ this.name = "TrackedLocalSettingsError";
12
+ this.relativeTargetPath = relativeTargetPath;
13
+ this.repoRoot = repoRoot;
14
+ }
15
+ }
3
16
  export async function ensureLocalSettingsIgnored(targetPath) {
4
- const gitContext = await findGitContext(path.dirname(targetPath));
5
- if (!gitContext) {
17
+ const localSettingsContext = await getLocalSettingsGitContext(targetPath);
18
+ if (!localSettingsContext.gitContext || !localSettingsContext.relativeTargetPath) {
6
19
  return;
7
20
  }
8
- const relativeTargetPath = path.relative(gitContext.repoRoot, targetPath);
9
- if (relativeTargetPath.startsWith("..")) {
10
- throw new Error("Expected local Claude Code settings to stay inside the current git repository.");
21
+ const { gitContext, relativeTargetPath } = localSettingsContext;
22
+ await assertTargetIsNotTracked(relativeTargetPath, gitContext.repoRoot);
23
+ await ensureTargetIgnored(gitContext.gitDir, relativeTargetPath);
24
+ }
25
+ export async function stopTrackingLocalSettings(targetPath) {
26
+ const localSettingsContext = await getLocalSettingsGitContext(targetPath);
27
+ if (!localSettingsContext.gitContext || !localSettingsContext.relativeTargetPath) {
28
+ throw new Error("Git repository is required to stop tracking local Claude Code settings.");
29
+ }
30
+ const { gitContext, relativeTargetPath } = localSettingsContext;
31
+ await ensureTargetIgnored(gitContext.gitDir, relativeTargetPath);
32
+ await execFileAsync("git", ["-C", gitContext.repoRoot, "rm", "--cached", "--quiet", "--force", "--", relativeTargetPath], {
33
+ encoding: "utf8"
34
+ });
35
+ }
36
+ async function getLocalSettingsGitContext(targetPath) {
37
+ const gitContext = await findGitContext(path.dirname(targetPath));
38
+ await assertSafeLocalSettingsTarget(targetPath, gitContext?.repoRoot);
39
+ if (!gitContext) {
40
+ return {
41
+ gitContext: null
42
+ };
11
43
  }
44
+ return {
45
+ gitContext,
46
+ relativeTargetPath: requireRepoRelativePath(targetPath, gitContext.repoRoot)
47
+ };
48
+ }
49
+ async function ensureTargetIgnored(gitDir, relativeTargetPath) {
12
50
  const normalizedRelativePath = relativeTargetPath.split(path.sep).join("/");
13
- const ignoreEntry = `/${normalizedRelativePath}`;
14
- const excludePath = path.join(gitContext.gitDir, "info", "exclude");
51
+ const ignoreEntries = [
52
+ `/${normalizedRelativePath}`,
53
+ `/${normalizedRelativePath}.backup-*`
54
+ ];
55
+ const excludePath = path.join(gitDir, "info", "exclude");
15
56
  const existingContent = await readOptionalFile(excludePath);
16
57
  const existingEntries = new Set(existingContent
17
58
  .split(/\r?\n/)
18
59
  .map((line) => line.trim())
19
60
  .filter((line) => line.length > 0 && !line.startsWith("#")));
20
- if (existingEntries.has(ignoreEntry)) {
61
+ const missingEntries = ignoreEntries.filter((ignoreEntry) => !existingEntries.has(ignoreEntry));
62
+ if (missingEntries.length === 0) {
21
63
  return;
22
64
  }
23
65
  await mkdir(path.dirname(excludePath), { recursive: true });
24
66
  const nextContent = existingContent.length === 0
25
- ? `${ignoreEntry}\n`
26
- : `${existingContent}${existingContent.endsWith("\n") ? "" : "\n"}${ignoreEntry}\n`;
67
+ ? `${missingEntries.join("\n")}\n`
68
+ : `${existingContent}${existingContent.endsWith("\n") ? "" : "\n"}${missingEntries.join("\n")}\n`;
27
69
  await writeFile(excludePath, nextContent, "utf8");
28
70
  }
71
+ async function assertSafeLocalSettingsTarget(targetPath, repoRoot) {
72
+ const pathsToInspect = repoRoot
73
+ ? getPathsFromRepoRoot(repoRoot, targetPath)
74
+ : [path.dirname(targetPath), targetPath];
75
+ for (const currentPath of pathsToInspect) {
76
+ await assertPathIsNotSymlink(currentPath, getSymlinkErrorMessage(currentPath, targetPath, repoRoot));
77
+ }
78
+ }
79
+ async function assertPathIsNotSymlink(filePath, errorMessage) {
80
+ try {
81
+ const fileStats = await lstat(filePath);
82
+ if (fileStats.isSymbolicLink()) {
83
+ throw new Error(errorMessage);
84
+ }
85
+ }
86
+ catch (error) {
87
+ if (isMissingFileError(error)) {
88
+ return;
89
+ }
90
+ throw error;
91
+ }
92
+ }
93
+ function getPathsFromRepoRoot(repoRoot, targetPath) {
94
+ const relativeTargetPath = requireRepoRelativePath(targetPath, repoRoot);
95
+ const targetSegments = relativeTargetPath.split(path.sep).filter((segment) => segment.length > 0);
96
+ const paths = [repoRoot];
97
+ let currentPath = repoRoot;
98
+ for (const segment of targetSegments) {
99
+ currentPath = path.join(currentPath, segment);
100
+ paths.push(currentPath);
101
+ }
102
+ return paths;
103
+ }
104
+ function requireRepoRelativePath(targetPath, repoRoot) {
105
+ const relativeTargetPath = path.relative(repoRoot, targetPath);
106
+ if (relativeTargetPath.length === 0 || relativeTargetPath.startsWith("..") || path.isAbsolute(relativeTargetPath)) {
107
+ throw new Error("Expected local Claude Code settings to stay inside the current git repository.");
108
+ }
109
+ return relativeTargetPath;
110
+ }
111
+ function getSymlinkErrorMessage(currentPath, targetPath, repoRoot) {
112
+ if (currentPath === path.dirname(targetPath)) {
113
+ return 'Refusing to write local Claude Code settings into a symlinked ".claude" directory.';
114
+ }
115
+ if (currentPath === targetPath) {
116
+ return "Refusing to overwrite local Claude Code settings through a symlinked settings file.";
117
+ }
118
+ const label = repoRoot ? path.relative(repoRoot, currentPath) || path.basename(currentPath) : currentPath;
119
+ return `Refusing local Claude Code setup through a symlinked path component: ${label}.`;
120
+ }
121
+ async function assertTargetIsNotTracked(relativeTargetPath, repoRoot) {
122
+ try {
123
+ await execFileAsync("git", ["-C", repoRoot, "ls-files", "--error-unmatch", "--", relativeTargetPath], {
124
+ encoding: "utf8"
125
+ });
126
+ throw new TrackedLocalSettingsError(relativeTargetPath, repoRoot);
127
+ }
128
+ catch (error) {
129
+ if (isMissingGitBinaryError(error)) {
130
+ throw new Error("Git is required to verify that local Claude Code settings are not already tracked before writing secrets.");
131
+ }
132
+ if (isGitPathUnmatchedError(error)) {
133
+ return;
134
+ }
135
+ throw error;
136
+ }
137
+ }
29
138
  async function findGitContext(startDirectory) {
30
139
  let currentDirectory = path.resolve(startDirectory);
31
140
  for (;;) {
@@ -73,4 +182,13 @@ async function readOptionalFile(filePath) {
73
182
  return "";
74
183
  }
75
184
  }
185
+ function isMissingFileError(error) {
186
+ return error instanceof Error && "code" in error && error.code === "ENOENT";
187
+ }
188
+ function isMissingGitBinaryError(error) {
189
+ return error instanceof Error && "code" in error && error.code === "ENOENT";
190
+ }
191
+ function isGitPathUnmatchedError(error) {
192
+ return error instanceof Error && "code" in error && error.code === 1;
193
+ }
76
194
  //# sourceMappingURL=local-git-ignore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"local-git-ignore.js","sourceRoot":"","sources":["../../src/install/local-git-ignore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,IAAI,MAAM,WAAW,CAAC;AAO7B,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,UAAkB;IACjE,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IAElE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO;IACT,C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K,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC9E,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAc;IAC7C,OAAO,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC;AACvE,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { SupportedModel, SupportedModelKey } from "../constants/models.js";
2
2
  import type { InstallScope } from "../types/settings.js";
3
+ export type TrackedLocalSettingsAction = "untrack" | "user" | "cancel";
3
4
  export declare function promptForApiKey(): Promise<string>;
4
5
  interface SelectChoice<Value> {
5
6
  value: Value;
@@ -20,6 +21,8 @@ interface SelectPromptConfig<Value> {
20
21
  type SelectPrompt<Value> = (config: SelectPromptConfig<Value>) => Promise<Value>;
21
22
  export declare function buildScopePromptConfig(defaultScope: InstallScope): SelectPromptConfig<InstallScope>;
22
23
  export declare function promptForScope(defaultScope: InstallScope, selectPrompt?: SelectPrompt<InstallScope>): Promise<InstallScope>;
24
+ export declare function buildTrackedLocalSettingsPromptConfig(relativeTargetPath: string): SelectPromptConfig<TrackedLocalSettingsAction>;
25
+ export declare function promptForTrackedLocalSettingsAction(relativeTargetPath: string, selectPrompt?: SelectPrompt<TrackedLocalSettingsAction>): Promise<TrackedLocalSettingsAction>;
23
26
  export declare function buildModelPromptConfig(models: readonly SupportedModel[], defaultModelKey: SupportedModelKey): SelectPromptConfig<SupportedModelKey>;
24
27
  export declare function promptForModel(models: readonly SupportedModel[], defaultModelKey: SupportedModelKey, selectPrompt?: SelectPrompt<SupportedModelKey>): Promise<SupportedModel>;
25
28
  export {};
@@ -37,6 +37,39 @@ export function buildScopePromptConfig(defaultScope) {
37
37
  export async function promptForScope(defaultScope, selectPrompt = select) {
38
38
  return selectPrompt(buildScopePromptConfig(defaultScope)).catch(rethrowPromptExit);
39
39
  }
40
+ export function buildTrackedLocalSettingsPromptConfig(relativeTargetPath) {
41
+ return {
42
+ message: `${relativeTargetPath} is already tracked by git. How should setup continue?`,
43
+ default: "untrack",
44
+ choices: [
45
+ {
46
+ value: "untrack",
47
+ name: "Stop tracking and continue",
48
+ short: "untrack",
49
+ description: `Run git rm --cached for ${relativeTargetPath}, keep the file locally, and add a local git exclude.`
50
+ },
51
+ {
52
+ value: "user",
53
+ name: "Switch to user scope",
54
+ short: "user",
55
+ description: "Write ~/.claude/settings.json instead and leave the repository alone."
56
+ },
57
+ {
58
+ value: "cancel",
59
+ name: "Cancel installation",
60
+ short: "cancel",
61
+ description: "Stop now without changing Claude Code settings."
62
+ }
63
+ ],
64
+ loop: false,
65
+ theme: {
66
+ indexMode: "number"
67
+ }
68
+ };
69
+ }
70
+ export async function promptForTrackedLocalSettingsAction(relativeTargetPath, selectPrompt = select) {
71
+ return selectPrompt(buildTrackedLocalSettingsPromptConfig(relativeTargetPath)).catch(rethrowPromptExit);
72
+ }
40
73
  export function buildModelPromptConfig(models, defaultModelKey) {
41
74
  if (models.length === 0) {
42
75
  throw new Error("No supported GonkaGate models are configured.");
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/install/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAIrD,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;IAC9F,CAAC;IAED,OAAO,QAAQ,CAAC;QACd,OAAO,EAAE,mBAAmB;QAC5B,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,sBA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AC"}
@@ -29,7 +29,9 @@ The installer writes one Claude Code settings file:
29
29
 
30
30
  It does not touch any shell profile or other configuration file.
31
31
 
32
- For `local` scope inside a git repository, it also adds `.claude/settings.local.json` to `.git/info/exclude` before writing the file.
32
+ For `local` scope inside a git repository, it also adds `.claude/settings.local.json` and `.claude/settings.local.json.backup-*` to `.git/info/exclude` before writing the file.
33
+
34
+ For safety, local scope checks whether `.claude/settings.local.json` is already tracked by git. If it is, the installer offers to stop tracking that file and continue local setup, or switch to `user` scope instead. It also refuses any existing symlinked path component on the way to the target. That includes a symlinked `.claude` directory and a symlinked local settings file.
33
35
 
34
36
  ## Write behavior
35
37
 
@@ -37,7 +39,7 @@ When the target file already exists, the installer:
37
39
 
38
40
  1. Parses the existing JSON
39
41
  2. Refuses to continue if the JSON is invalid
40
- 3. Creates a timestamped backup
42
+ 3. Creates a timestamped backup with owner-only permissions
41
43
  4. Preserves unrelated settings
42
44
  5. Updates only the relevant `env` keys, including all Claude model env vars with the selected curated model id
43
45
  6. Adds Claude Code's JSON schema if `$schema` is missing
package/docs/security.md CHANGED
@@ -17,14 +17,20 @@ Claude Code reads environment variables from its settings files. That means the
17
17
  - `~/.claude/settings.json`
18
18
  - `.claude/settings.local.json`
19
19
 
20
- This repo does not write `.env` files and does not modify shell startup files. It also writes the target settings file with owner-only permissions.
20
+ This repo does not write `.env` files and does not modify shell startup files. It also writes the target settings file with owner-only permissions and locks backup files down to owner-only permissions too.
21
21
 
22
22
  ## Local scope hygiene
23
23
 
24
- If you choose `local` scope inside a git repository, the installer adds `.claude/settings.local.json` to the repo's `.git/info/exclude` before writing the file so the secret-bearing settings file is not immediately visible to git.
24
+ If you choose `local` scope inside a git repository, the installer first checks whether `.claude/settings.local.json` is already tracked by git. If it is already tracked, the installer offers to either stop tracking that file and continue local setup, or switch to `user` scope instead of writing a secret into a still-tracked file.
25
+
26
+ If you choose the stop-tracking recovery path, the installer runs `git rm --cached` for `.claude/settings.local.json`, keeps the file in your working tree, and adds local ignore rules before writing the secret-bearing settings file. That stages the file removal from version control, which is usually the right outcome for a repo-local secrets file.
27
+
28
+ For untracked local installs, the installer adds `.claude/settings.local.json` and its timestamped backup pattern to the repo's `.git/info/exclude` before writing the file so secret-bearing local settings do not immediately show up in git.
25
29
 
26
30
  If your team already manages ignores another way, that is still fine. The important rule is that `.claude/settings.local.json` must stay uncommitted.
27
31
 
32
+ The installer also refuses local setup through a symlinked path component on the way to `.claude/settings.local.json`, including a symlinked `.claude` directory or a symlinked local settings file. That prevents a repository from redirecting the secret-bearing write to some other tracked or non-local location.
33
+
28
34
  ## Backup behavior
29
35
 
30
36
  Before overwriting an existing target settings file, the installer creates a timestamped backup next to it. If something looks wrong afterward, restore from that backup and rerun the installer.
@@ -51,6 +51,32 @@ Restore from the timestamped backup next to the settings file, or fix the JSON m
51
51
 
52
52
  Rerun the installer and choose `local` scope. That writes `.claude/settings.local.json` in the current repository instead of editing your global `~/.claude/settings.json`.
53
53
 
54
+ ## `.claude/settings.local.json` is already tracked by git
55
+
56
+ For `local` scope, the installer now detects when `.claude/settings.local.json` is already a tracked file in the repository and offers a recovery choice.
57
+
58
+ The recommended option is to stop tracking that file and continue. The installer will:
59
+
60
+ - run `git rm --cached` for `.claude/settings.local.json`
61
+ - keep the file in your working tree
62
+ - add local exclude entries so the file stays uncommitted going forward
63
+
64
+ If that repository intentionally versions `.claude/settings.local.json`, choose `user` scope instead.
65
+
66
+ You can still do the stop-tracking step manually if you prefer:
67
+
68
+ ```bash
69
+ git rm --cached -- .claude/settings.local.json
70
+ ```
71
+
72
+ ## Local install refused because the target path uses a symlink
73
+
74
+ For `local` scope, the installer now rejects a symlinked path component anywhere on the way to `.claude/settings.local.json`, including a symlinked `.claude` directory or a symlinked `.claude/settings.local.json`.
75
+
76
+ That safety check prevents a repository from redirecting your API key into some other location that git might track.
77
+
78
+ Replace the symlink with a real `.claude` directory, then rerun the installer.
79
+
54
80
  ## Manual settings edits
55
81
 
56
82
  Manual edits to the Claude Code settings file are possible, but they are outside the supported public install flow for this repo.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@gonkagate/claude-code",
3
- "version": "0.1.0",
4
- "description": "Connect Claude Code to GonkaGate in one step.",
5
- "homepage": "https://github.com/GonkaGate/gonkagate-claude-code",
3
+ "version": "0.1.3",
4
+ "description": "CLI installer for using Claude Code with GonkaGate on Gonka Network.",
5
+ "homepage": "https://github.com/GonkaGate/gonkagate-claude-code#readme",
6
6
  "bugs": {
7
7
  "url": "https://github.com/GonkaGate/gonkagate-claude-code/issues"
8
8
  },
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "type": "module",
14
14
  "bin": {
15
- "gonkagate-claude-code": "./bin/gonkagate-claude-code.js"
15
+ "gonkagate-claude-code": "bin/gonkagate-claude-code.js"
16
16
  },
17
17
  "files": [
18
18
  "bin",
@@ -27,18 +27,22 @@
27
27
  "build": "tsc -p tsconfig.json",
28
28
  "dev": "tsx src/cli.ts",
29
29
  "prepack": "npm run build",
30
- "test": "tsx --test test/**/*.test.ts",
30
+ "test": "node scripts/run-tests.mjs",
31
31
  "ci": "npm test && npm run build"
32
32
  },
33
33
  "engines": {
34
34
  "node": ">=18"
35
35
  },
36
36
  "keywords": [
37
- "claude-code",
38
37
  "gonkagate",
39
- "anthropic",
40
- "installer",
41
- "cli"
38
+ "gonka",
39
+ "gonka ai",
40
+ "gonka-network",
41
+ "gonka blockchain",
42
+ "gonka-api",
43
+ "gonka gateway",
44
+ "claude-code",
45
+ "claude code"
42
46
  ],
43
47
  "license": "Apache-2.0",
44
48
  "packageManager": "npm@11.11.1",
@@ -0,0 +1,49 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { readdirSync } from 'node:fs';
3
+ import { dirname, join, resolve } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+
6
+ const scriptDir = dirname(fileURLToPath(import.meta.url));
7
+ const repoRoot = resolve(scriptDir, '..');
8
+ const testRoot = join(repoRoot, 'test');
9
+
10
+ function collectTestFiles(directory) {
11
+ const entries = readdirSync(directory, { withFileTypes: true }).sort((a, b) =>
12
+ a.name.localeCompare(b.name),
13
+ );
14
+ const files = [];
15
+
16
+ for (const entry of entries) {
17
+ const fullPath = join(directory, entry.name);
18
+
19
+ if (entry.isDirectory()) {
20
+ files.push(...collectTestFiles(fullPath));
21
+ continue;
22
+ }
23
+
24
+ if (entry.isFile() && entry.name.endsWith('.test.ts')) {
25
+ files.push(fullPath);
26
+ }
27
+ }
28
+
29
+ return files;
30
+ }
31
+
32
+ const testFiles = collectTestFiles(testRoot);
33
+
34
+ if (testFiles.length === 0) {
35
+ console.error('No test files found under test/.');
36
+ process.exit(1);
37
+ }
38
+
39
+ const tsxCliPath = join(repoRoot, 'node_modules', 'tsx', 'dist', 'cli.mjs');
40
+ const result = spawnSync(process.execPath, [tsxCliPath, '--test', ...testFiles], {
41
+ cwd: repoRoot,
42
+ stdio: 'inherit',
43
+ });
44
+
45
+ if (result.error) {
46
+ throw result.error;
47
+ }
48
+
49
+ process.exit(result.status ?? 1);