vibedino 0.1.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/README.md +226 -0
- package/bin/vibedino.mjs +2 -0
- package/dist/cli.cjs +1365 -0
- package/dist/cli.d.cts +3 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +1338 -0
- package/dist/index.cjs +1156 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +1129 -0
- package/dist/main.cjs +1340 -0
- package/dist/main.d.cts +2 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +1338 -0
- package/dist/postinstall.cjs +99 -0
- package/dist/postinstall.d.cts +2 -0
- package/dist/postinstall.d.ts +2 -0
- package/dist/postinstall.js +97 -0
- package/integrations/claude-hook.json +11 -0
- package/integrations/copilot-plugin.json +12 -0
- package/package.json +62 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// src/postinstall.ts
|
|
4
|
+
var import_fs3 = require("fs");
|
|
5
|
+
var import_path3 = require("path");
|
|
6
|
+
var import_os2 = require("os");
|
|
7
|
+
|
|
8
|
+
// src/integrations/claudeCode.ts
|
|
9
|
+
var import_fs = require("fs");
|
|
10
|
+
var import_path = require("path");
|
|
11
|
+
var HOOK_ENTRY = {
|
|
12
|
+
matcher: "rate_limit|token_limit|quota_exceeded|overloaded",
|
|
13
|
+
command: 'npx vibedino --trigger claude --reason "Token limit reached"',
|
|
14
|
+
timeout: 3e5
|
|
15
|
+
};
|
|
16
|
+
function installClaudeHook(projectDir = process.cwd()) {
|
|
17
|
+
const claudeDir = (0, import_path.join)(projectDir, ".claude");
|
|
18
|
+
const settingsPath = (0, import_path.join)(claudeDir, "settings.json");
|
|
19
|
+
if (!(0, import_fs.existsSync)(claudeDir)) {
|
|
20
|
+
(0, import_fs.mkdirSync)(claudeDir, { recursive: true });
|
|
21
|
+
}
|
|
22
|
+
let settings = {};
|
|
23
|
+
if ((0, import_fs.existsSync)(settingsPath)) {
|
|
24
|
+
try {
|
|
25
|
+
settings = JSON.parse((0, import_fs.readFileSync)(settingsPath, "utf-8"));
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (!settings.hooks) {
|
|
30
|
+
settings.hooks = {};
|
|
31
|
+
}
|
|
32
|
+
const hooks = settings.hooks;
|
|
33
|
+
if (!hooks.PostToolUseFailure) {
|
|
34
|
+
hooks.PostToolUseFailure = [];
|
|
35
|
+
}
|
|
36
|
+
const existing = hooks.PostToolUseFailure;
|
|
37
|
+
if (!existing.some((h) => h.command?.includes("vibedino"))) {
|
|
38
|
+
existing.push(HOOK_ENTRY);
|
|
39
|
+
}
|
|
40
|
+
(0, import_fs.writeFileSync)(settingsPath, JSON.stringify(settings, null, 2), "utf-8");
|
|
41
|
+
console.log(` Installed VibeDino hook in ${settingsPath}`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/integrations/copilotCli.ts
|
|
45
|
+
var import_fs2 = require("fs");
|
|
46
|
+
var import_path2 = require("path");
|
|
47
|
+
var import_os = require("os");
|
|
48
|
+
var PLUGIN_DIR = (0, import_path2.join)((0, import_os.homedir)(), ".copilot", "plugins", "vibedino");
|
|
49
|
+
var MANIFEST_PATH = (0, import_path2.join)(PLUGIN_DIR, "plugin.json");
|
|
50
|
+
function generateCopilotPluginManifest() {
|
|
51
|
+
return {
|
|
52
|
+
name: "vibedino",
|
|
53
|
+
version: "0.1.0",
|
|
54
|
+
description: "Play dino runner when rate limited",
|
|
55
|
+
hooks: {
|
|
56
|
+
onError: {
|
|
57
|
+
match: ["rate_limit", "token_exhausted", "429"],
|
|
58
|
+
action: "exec",
|
|
59
|
+
command: 'npx vibedino --trigger copilot --reason "Rate limited"'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function installCopilotPlugin() {
|
|
65
|
+
if (!(0, import_fs2.existsSync)(PLUGIN_DIR)) {
|
|
66
|
+
(0, import_fs2.mkdirSync)(PLUGIN_DIR, { recursive: true });
|
|
67
|
+
}
|
|
68
|
+
const manifest = generateCopilotPluginManifest();
|
|
69
|
+
(0, import_fs2.writeFileSync)(MANIFEST_PATH, JSON.stringify(manifest, null, 2), "utf-8");
|
|
70
|
+
console.log(` Installed VibeDino Copilot plugin at ${MANIFEST_PATH}`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/postinstall.ts
|
|
74
|
+
var isGlobal = process.env.npm_config_global === "true" || process.argv.includes("--global") || !process.env.INIT_CWD?.includes("node_modules");
|
|
75
|
+
if (isGlobal) {
|
|
76
|
+
const home = (0, import_os2.homedir)();
|
|
77
|
+
let installed = false;
|
|
78
|
+
const claudeDir = (0, import_path3.join)(home, ".claude");
|
|
79
|
+
if ((0, import_fs3.existsSync)(claudeDir)) {
|
|
80
|
+
try {
|
|
81
|
+
installClaudeHook(home);
|
|
82
|
+
installed = true;
|
|
83
|
+
} catch {
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const copilotDir = (0, import_path3.join)(home, ".copilot");
|
|
87
|
+
if ((0, import_fs3.existsSync)(copilotDir)) {
|
|
88
|
+
try {
|
|
89
|
+
installCopilotPlugin();
|
|
90
|
+
installed = true;
|
|
91
|
+
} catch {
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (installed) {
|
|
95
|
+
console.log("\n \u{1F995} VibeDino hooks installed! Play when your AI hits a token limit.\n");
|
|
96
|
+
} else {
|
|
97
|
+
console.log("\n \u{1F995} VibeDino installed! Run: vibedino --install claude (or copilot)\n");
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// src/postinstall.ts
|
|
2
|
+
import { existsSync as existsSync3 } from "fs";
|
|
3
|
+
import { join as join3 } from "path";
|
|
4
|
+
import { homedir as homedir2 } from "os";
|
|
5
|
+
|
|
6
|
+
// src/integrations/claudeCode.ts
|
|
7
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
8
|
+
import { join } from "path";
|
|
9
|
+
var HOOK_ENTRY = {
|
|
10
|
+
matcher: "rate_limit|token_limit|quota_exceeded|overloaded",
|
|
11
|
+
command: 'npx vibedino --trigger claude --reason "Token limit reached"',
|
|
12
|
+
timeout: 3e5
|
|
13
|
+
};
|
|
14
|
+
function installClaudeHook(projectDir = process.cwd()) {
|
|
15
|
+
const claudeDir = join(projectDir, ".claude");
|
|
16
|
+
const settingsPath = join(claudeDir, "settings.json");
|
|
17
|
+
if (!existsSync(claudeDir)) {
|
|
18
|
+
mkdirSync(claudeDir, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
let settings = {};
|
|
21
|
+
if (existsSync(settingsPath)) {
|
|
22
|
+
try {
|
|
23
|
+
settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
24
|
+
} catch {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (!settings.hooks) {
|
|
28
|
+
settings.hooks = {};
|
|
29
|
+
}
|
|
30
|
+
const hooks = settings.hooks;
|
|
31
|
+
if (!hooks.PostToolUseFailure) {
|
|
32
|
+
hooks.PostToolUseFailure = [];
|
|
33
|
+
}
|
|
34
|
+
const existing = hooks.PostToolUseFailure;
|
|
35
|
+
if (!existing.some((h) => h.command?.includes("vibedino"))) {
|
|
36
|
+
existing.push(HOOK_ENTRY);
|
|
37
|
+
}
|
|
38
|
+
writeFileSync(settingsPath, JSON.stringify(settings, null, 2), "utf-8");
|
|
39
|
+
console.log(` Installed VibeDino hook in ${settingsPath}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// src/integrations/copilotCli.ts
|
|
43
|
+
import { writeFileSync as writeFileSync2, existsSync as existsSync2, mkdirSync as mkdirSync2, unlinkSync, rmdirSync } from "fs";
|
|
44
|
+
import { join as join2 } from "path";
|
|
45
|
+
import { homedir } from "os";
|
|
46
|
+
var PLUGIN_DIR = join2(homedir(), ".copilot", "plugins", "vibedino");
|
|
47
|
+
var MANIFEST_PATH = join2(PLUGIN_DIR, "plugin.json");
|
|
48
|
+
function generateCopilotPluginManifest() {
|
|
49
|
+
return {
|
|
50
|
+
name: "vibedino",
|
|
51
|
+
version: "0.1.0",
|
|
52
|
+
description: "Play dino runner when rate limited",
|
|
53
|
+
hooks: {
|
|
54
|
+
onError: {
|
|
55
|
+
match: ["rate_limit", "token_exhausted", "429"],
|
|
56
|
+
action: "exec",
|
|
57
|
+
command: 'npx vibedino --trigger copilot --reason "Rate limited"'
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function installCopilotPlugin() {
|
|
63
|
+
if (!existsSync2(PLUGIN_DIR)) {
|
|
64
|
+
mkdirSync2(PLUGIN_DIR, { recursive: true });
|
|
65
|
+
}
|
|
66
|
+
const manifest = generateCopilotPluginManifest();
|
|
67
|
+
writeFileSync2(MANIFEST_PATH, JSON.stringify(manifest, null, 2), "utf-8");
|
|
68
|
+
console.log(` Installed VibeDino Copilot plugin at ${MANIFEST_PATH}`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/postinstall.ts
|
|
72
|
+
var isGlobal = process.env.npm_config_global === "true" || process.argv.includes("--global") || !process.env.INIT_CWD?.includes("node_modules");
|
|
73
|
+
if (isGlobal) {
|
|
74
|
+
const home = homedir2();
|
|
75
|
+
let installed = false;
|
|
76
|
+
const claudeDir = join3(home, ".claude");
|
|
77
|
+
if (existsSync3(claudeDir)) {
|
|
78
|
+
try {
|
|
79
|
+
installClaudeHook(home);
|
|
80
|
+
installed = true;
|
|
81
|
+
} catch {
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const copilotDir = join3(home, ".copilot");
|
|
85
|
+
if (existsSync3(copilotDir)) {
|
|
86
|
+
try {
|
|
87
|
+
installCopilotPlugin();
|
|
88
|
+
installed = true;
|
|
89
|
+
} catch {
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (installed) {
|
|
93
|
+
console.log("\n \u{1F995} VibeDino hooks installed! Play when your AI hits a token limit.\n");
|
|
94
|
+
} else {
|
|
95
|
+
console.log("\n \u{1F995} VibeDino installed! Run: vibedino --install claude (or copilot)\n");
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vibedino",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Play dino runner when rate limited",
|
|
5
|
+
"hooks": {
|
|
6
|
+
"onError": {
|
|
7
|
+
"match": ["rate_limit", "token_exhausted", "429"],
|
|
8
|
+
"action": "exec",
|
|
9
|
+
"command": "npx vibedino --trigger copilot --reason \"Rate limited\""
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vibedino",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Terminal T-Rex runner game for when AI tools run out of tokens",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"vibedino": "./bin/vibedino.mjs"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"main": "./dist/index.cjs",
|
|
17
|
+
"module": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist/",
|
|
21
|
+
"bin/",
|
|
22
|
+
"integrations/",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsup",
|
|
27
|
+
"dev": "tsx src/main.ts",
|
|
28
|
+
"start": "node bin/vibedino.mjs",
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"test:watch": "vitest --watch",
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
32
|
+
"postinstall": "node dist/postinstall.js 2>/dev/null || true",
|
|
33
|
+
"prepublishOnly": "npm run build"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"game",
|
|
37
|
+
"terminal",
|
|
38
|
+
"cli",
|
|
39
|
+
"dino",
|
|
40
|
+
"ascii",
|
|
41
|
+
"claude",
|
|
42
|
+
"copilot",
|
|
43
|
+
"offline",
|
|
44
|
+
"fun"
|
|
45
|
+
],
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "https://github.com/annguyen209/VibeDino.git"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/annguyen209/VibeDino",
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=18.0.0"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/node": "^22.0.0",
|
|
57
|
+
"tsup": "^8.0.0",
|
|
58
|
+
"tsx": "^4.0.0",
|
|
59
|
+
"typescript": "^5.5.0",
|
|
60
|
+
"vitest": "^2.0.0"
|
|
61
|
+
}
|
|
62
|
+
}
|