@gonkagate/claude-code-setup 0.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/LICENSE +201 -0
  3. package/README.md +120 -0
  4. package/bin/gonkagate-claude-code.js +15 -0
  5. package/dist/cli.d.ts +17 -0
  6. package/dist/cli.js +143 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/constants/gateway.d.ts +2 -0
  9. package/dist/constants/gateway.js +3 -0
  10. package/dist/constants/gateway.js.map +1 -0
  11. package/dist/constants/models.d.ts +27 -0
  12. package/dist/constants/models.js +28 -0
  13. package/dist/constants/models.js.map +1 -0
  14. package/dist/install/backup.d.ts +1 -0
  15. package/dist/install/backup.js +11 -0
  16. package/dist/install/backup.js.map +1 -0
  17. package/dist/install/load-settings.d.ts +6 -0
  18. package/dist/install/load-settings.js +32 -0
  19. package/dist/install/load-settings.js.map +1 -0
  20. package/dist/install/local-git-ignore.d.ts +7 -0
  21. package/dist/install/local-git-ignore.js +194 -0
  22. package/dist/install/local-git-ignore.js.map +1 -0
  23. package/dist/install/merge-env.d.ts +4 -0
  24. package/dist/install/merge-env.js +35 -0
  25. package/dist/install/merge-env.js.map +1 -0
  26. package/dist/install/object-utils.d.ts +1 -0
  27. package/dist/install/object-utils.js +4 -0
  28. package/dist/install/object-utils.js.map +1 -0
  29. package/dist/install/prompts.d.ts +28 -0
  30. package/dist/install/prompts.js +111 -0
  31. package/dist/install/prompts.js.map +1 -0
  32. package/dist/install/settings-paths.d.ts +2 -0
  33. package/dist/install/settings-paths.js +15 -0
  34. package/dist/install/settings-paths.js.map +1 -0
  35. package/dist/install/validate-api-key.d.ts +1 -0
  36. package/dist/install/validate-api-key.js +15 -0
  37. package/dist/install/validate-api-key.js.map +1 -0
  38. package/dist/install/write-settings.d.ts +2 -0
  39. package/dist/install/write-settings.js +25 -0
  40. package/dist/install/write-settings.js.map +1 -0
  41. package/dist/types/settings.d.ts +10 -0
  42. package/dist/types/settings.js +2 -0
  43. package/dist/types/settings.js.map +1 -0
  44. package/docs/how-it-works.md +50 -0
  45. package/docs/security.md +38 -0
  46. package/docs/show-and-tell-discussion.md +80 -0
  47. package/docs/troubleshooting.md +106 -0
  48. package/package.json +47 -0
@@ -0,0 +1,38 @@
1
+ # Security Notes
2
+
3
+ ## Secret entry
4
+
5
+ The recommended install flow is interactive:
6
+
7
+ ```bash
8
+ npx @gonkagate/claude-code
9
+ ```
10
+
11
+ The setup-style alias `npx @gonkagate/claude-code-setup` runs the same interactive installer.
12
+
13
+ The installer asks for the API key through a hidden prompt. It intentionally rejects `--api-key ...` arguments so secrets do not end up in shell history or process lists.
14
+
15
+ ## Where the key is stored
16
+
17
+ Claude Code reads environment variables from its settings files. That means the GonkaGate API key is stored in the Claude Code settings file you choose:
18
+
19
+ - `~/.claude/settings.json`
20
+ - `.claude/settings.local.json`
21
+
22
+ 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.
23
+
24
+ ## Local scope hygiene
25
+
26
+ 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.
27
+
28
+ 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.
29
+
30
+ 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.
31
+
32
+ If your team already manages ignores another way, that is still fine. The important rule is that `.claude/settings.local.json` must stay uncommitted.
33
+
34
+ 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.
35
+
36
+ ## Backup behavior
37
+
38
+ 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.
@@ -0,0 +1,80 @@
1
+ Hi everyone,
2
+
3
+ ## What we built
4
+
5
+ We made `@gonkagate/claude-code`, a small open source installer for people who want to use Claude Code with Gonka through GonkaGate.
6
+
7
+ It solves a boring problem on purpose. Most people do not want to export env vars by hand, edit shell profiles, or create a `.env` file just to get Claude Code talking to a gateway.
8
+
9
+ So we kept the flow short. You run one command, enter a `gp-...` API key in a hidden prompt, choose a model, choose a scope, and then Claude Code is ready to use.
10
+
11
+ - Repo: https://github.com/GonkaGate/gonkagate-claude-code
12
+ - Website: https://gonkagate.com/en
13
+
14
+ ## Why we built it
15
+
16
+ The gateway setup itself is not especially hard. The annoying part is first-time setup in Claude Code.
17
+
18
+ That is the part people still end up wiring by hand more often than they should. If someone already has a `gp-...` API key, getting to a normal `claude` workflow should not involve touching shell config.
19
+
20
+ ## Quick start
21
+
22
+ ```bash
23
+ npx @gonkagate/claude-code
24
+ ```
25
+
26
+ ## What the installer does
27
+
28
+ - Asks for a hidden `gp-...` API key
29
+ - Lets you choose a supported model from the curated list
30
+ - Writes Claude Code settings in `user` or `local` scope
31
+ - Leaves unrelated Claude Code settings alone
32
+ - Creates a backup before replacing an existing settings file
33
+ - Does not touch shell profiles or create `.env` files
34
+ - Helps keep local secret-bearing settings out of git during project-local setup
35
+
36
+ ## Gateway host and transport
37
+
38
+ Under the hood, the installer points Claude Code at the GonkaGate gateway host:
39
+
40
+ `https://api.gonkagate.com`
41
+
42
+ For Claude Code, that means the Anthropic-compatible endpoint on that host.
43
+
44
+ The same GonkaGate host also serves OpenAI-compatible `/v1/*` routes for OpenAI-style clients, but this installer is specifically for Claude Code. It sets up the Claude-side Anthropic flow and leaves the OpenAI path alone.
45
+
46
+ ## Models right now
47
+
48
+ We are keeping the public Claude Code model list small for now, but one detail is worth making explicit.
49
+
50
+ GonkaGate does not decide which models exist on Gonka Network. As an OpenAI-compatible provider and an Anthropic-compatible provider, we serve what is actually available in the network.
51
+
52
+ So the model list in this installer is not a custom catalog we fully control. It is a curated list of network-available models that we have patched into this Claude Code flow.
53
+
54
+ Right now there is one supported option: `qwen3-235b`.
55
+
56
+ As new models show up in Gonka Network, we will patch the utility and add them here.
57
+
58
+ ## Demo
59
+
60
+ [![See the installer in action](https://raw.githubusercontent.com/GonkaGate/gonkagate-claude-code/main/.github/assets/gonkagate-claude-code-demo.gif)](https://raw.githubusercontent.com/GonkaGate/gonkagate-claude-code/main/.github/assets/gonkagate-claude-code-demo.mp4)
61
+
62
+ ## More links
63
+
64
+ - npm package: https://www.npmjs.com/package/@gonkagate/claude-code
65
+ - README: https://github.com/GonkaGate/gonkagate-claude-code#readme
66
+ - Troubleshooting: https://github.com/GonkaGate/gonkagate-claude-code/blob/main/docs/troubleshooting.md
67
+ - Security notes: https://github.com/GonkaGate/gonkagate-claude-code/blob/main/docs/security.md
68
+ - How it works: https://github.com/GonkaGate/gonkagate-claude-code/blob/main/docs/how-it-works.md
69
+ - Changelog: https://github.com/GonkaGate/gonkagate-claude-code/blob/main/CHANGELOG.md
70
+ - Issues and feedback: https://github.com/GonkaGate/gonkagate-claude-code/issues
71
+
72
+ ## Feedback
73
+
74
+ If you are using Gonka with local coding tools, the feedback we would care about most is:
75
+
76
+ - Which developer tools we should support next
77
+ - Where the onboarding still feels rough or confusing
78
+ - Which models you would actually want to use in this Claude Code flow as they appear on Gonka Network
79
+
80
+ If anything in the setup still feels awkward in practice, that is what we want to hear about. We will keep adjusting it based on what people actually run into.
@@ -0,0 +1,106 @@
1
+ # Troubleshooting
2
+
3
+ ## `/status` still shows Anthropic
4
+
5
+ If Claude Code still shows direct Anthropic auth or the wrong upstream after install:
6
+
7
+ 1. Run `claude auth logout`
8
+ 2. Restart `claude`
9
+ 3. Run `/status` again
10
+
11
+ The installer writes Claude Code settings, but an existing direct login can still be what you are seeing until you log out once.
12
+
13
+ ## Model unavailable
14
+
15
+ This installer writes the selected model from its curated GonkaGate-supported registry.
16
+
17
+ Today that curated list contains one option:
18
+
19
+ - `qwen3-235b` -> `qwen/qwen3-235b-a22b-instruct-2507-fp8`
20
+
21
+ If that model is unavailable, the likely cause is a backend deployment or model availability mismatch. This installer does not expose custom base URL or arbitrary custom model overrides, so the right next step is GonkaGate support or the backend troubleshooting docs in `gonka-proxy`.
22
+
23
+ ## Model removed from the curated list later
24
+
25
+ If a model disappears from the curated list in a future release of this installer:
26
+
27
+ 1. Rerun the installer
28
+ 2. Choose from the current curated list, or pass a current key with `--model <model-key>`
29
+
30
+ Manual edits to force an old or unsupported model id are outside the supported setup flow.
31
+
32
+ ## Want to switch models
33
+
34
+ Rerun the installer and choose a different curated model when prompted.
35
+
36
+ You can also skip the interactive model prompt with:
37
+
38
+ ```bash
39
+ npx @gonkagate/claude-code --model <model-key>
40
+ ```
41
+
42
+ The setup-style alias accepts the same options:
43
+
44
+ ```bash
45
+ npx @gonkagate/claude-code-setup --model <model-key>
46
+ ```
47
+
48
+ Only current curated keys are accepted.
49
+
50
+ ## Corrupted settings file
51
+
52
+ If the target settings file contains invalid JSON, the installer stops without overwriting it.
53
+
54
+ Restore from the timestamped backup next to the settings file, or fix the JSON manually, then rerun the installer.
55
+
56
+ ## Want repo-only setup
57
+
58
+ 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`.
59
+
60
+ ## `.claude/settings.local.json` is already tracked by git
61
+
62
+ 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.
63
+
64
+ The recommended option is to stop tracking that file and continue. The installer will:
65
+
66
+ - run `git rm --cached` for `.claude/settings.local.json`
67
+ - keep the file in your working tree
68
+ - add local exclude entries so the file stays uncommitted going forward
69
+
70
+ If that repository intentionally versions `.claude/settings.local.json`, choose `user` scope instead.
71
+
72
+ You can still do the stop-tracking step manually if you prefer:
73
+
74
+ ```bash
75
+ git rm --cached -- .claude/settings.local.json
76
+ ```
77
+
78
+ ## Local install refused because the target path uses a symlink
79
+
80
+ 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`.
81
+
82
+ That safety check prevents a repository from redirecting your API key into some other location that git might track.
83
+
84
+ Replace the symlink with a real `.claude` directory, then rerun the installer.
85
+
86
+ ## Manual settings edits
87
+
88
+ Manual edits to the Claude Code settings file are possible, but they are outside the supported public install flow for this repo.
89
+
90
+ If you want to get back to a supported state, rerun the installer instead of hand-editing model ids or gateway values.
91
+
92
+ ## Want to undo the install
93
+
94
+ You have two safe options:
95
+
96
+ 1. Restore the backup created by the installer.
97
+ 2. Remove the GonkaGate-managed keys from the target settings file:
98
+ - `ANTHROPIC_BASE_URL`
99
+ - `ANTHROPIC_AUTH_TOKEN`
100
+ - `ANTHROPIC_MODEL`
101
+ - `ANTHROPIC_DEFAULT_OPUS_MODEL`
102
+ - `ANTHROPIC_DEFAULT_SONNET_MODEL`
103
+ - `ANTHROPIC_DEFAULT_HAIKU_MODEL`
104
+ - `CLAUDE_CODE_SUBAGENT_MODEL`
105
+
106
+ If you previously removed `ANTHROPIC_API_KEY`, add back whatever auth method you actually want before relaunching Claude Code.
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@gonkagate/claude-code-setup",
3
+ "version": "0.2.0",
4
+ "description": "Setup-style alias for the GonkaGate Claude Code installer.",
5
+ "homepage": "https://github.com/GonkaGate/gonkagate-claude-code#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/GonkaGate/gonkagate-claude-code/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/GonkaGate/gonkagate-claude-code.git"
12
+ },
13
+ "type": "module",
14
+ "bin": {
15
+ "claude-code-setup": "bin/gonkagate-claude-code.js"
16
+ },
17
+ "files": [
18
+ "bin",
19
+ "dist",
20
+ "docs",
21
+ "README.md",
22
+ "CHANGELOG.md",
23
+ "LICENSE"
24
+ ],
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
28
+ "keywords": [
29
+ "gonkagate",
30
+ "gonka",
31
+ "gonka ai",
32
+ "gonka-network",
33
+ "gonka blockchain",
34
+ "gonka-api",
35
+ "gonka gateway",
36
+ "claude-code",
37
+ "claude code",
38
+ "claude-code-setup",
39
+ "setup"
40
+ ],
41
+ "license": "Apache-2.0",
42
+ "dependencies": {
43
+ "@inquirer/prompts": "^7.10.1",
44
+ "commander": "^13.1.0",
45
+ "write-file-atomic": "^5.0.1"
46
+ }
47
+ }