tokengolf 1.0.4 → 1.0.5
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.
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"name": "tokengolf",
|
|
12
12
|
"source": "./plugin",
|
|
13
13
|
"description": "Gamify your Claude Code sessions — track token efficiency, earn achievements, level up your prompting.",
|
|
14
|
-
"version": "1.0.
|
|
14
|
+
"version": "1.0.5",
|
|
15
15
|
"homepage": "https://josheche.github.io/tokengolf/",
|
|
16
16
|
"license": "MIT"
|
|
17
17
|
}
|
package/hooks/session-start.js
CHANGED
|
@@ -56,6 +56,23 @@ try {
|
|
|
56
56
|
}
|
|
57
57
|
} catch {}
|
|
58
58
|
|
|
59
|
+
// Auto-install statusLine if missing or stale
|
|
60
|
+
try {
|
|
61
|
+
const settingsPath = path.join(os.homedir(), '.claude', 'settings.json');
|
|
62
|
+
const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
|
|
63
|
+
const scriptDir = path.dirname(fs.realpathSync(process.argv[1]));
|
|
64
|
+
const statuslinePath = path.join(scriptDir, 'statusline.sh');
|
|
65
|
+
if (fs.existsSync(statuslinePath)) {
|
|
66
|
+
const current = settings.statusLine?.command || '';
|
|
67
|
+
const needsInstall = !current || current.includes('tokengolf');
|
|
68
|
+
const needsUpdate = needsInstall && current !== statuslinePath;
|
|
69
|
+
if (needsUpdate) {
|
|
70
|
+
settings.statusLine = { type: 'command', command: statuslinePath, padding: 1 };
|
|
71
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
} catch {}
|
|
75
|
+
|
|
59
76
|
function detectEffort() {
|
|
60
77
|
const fromEnv = process.env.CLAUDE_CODE_EFFORT_LEVEL;
|
|
61
78
|
if (fromEnv) return fromEnv;
|
package/package.json
CHANGED
|
@@ -56,6 +56,23 @@ try {
|
|
|
56
56
|
}
|
|
57
57
|
} catch {}
|
|
58
58
|
|
|
59
|
+
// Auto-install statusLine if missing or stale
|
|
60
|
+
try {
|
|
61
|
+
const settingsPath = path.join(os.homedir(), '.claude', 'settings.json');
|
|
62
|
+
const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
|
|
63
|
+
const scriptDir = path.dirname(fs.realpathSync(process.argv[1]));
|
|
64
|
+
const statuslinePath = path.join(scriptDir, 'statusline.sh');
|
|
65
|
+
if (fs.existsSync(statuslinePath)) {
|
|
66
|
+
const current = settings.statusLine?.command || '';
|
|
67
|
+
const needsInstall = !current || current.includes('tokengolf');
|
|
68
|
+
const needsUpdate = needsInstall && current !== statuslinePath;
|
|
69
|
+
if (needsUpdate) {
|
|
70
|
+
settings.statusLine = { type: 'command', command: statuslinePath, padding: 1 };
|
|
71
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
} catch {}
|
|
75
|
+
|
|
59
76
|
function detectEffort() {
|
|
60
77
|
const fromEnv = process.env.CLAUDE_CODE_EFFORT_LEVEL;
|
|
61
78
|
if (fromEnv) return fromEnv;
|