git-slot-machine 1.0.0 → 1.1.1
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 +35 -0
- package/README.md +15 -0
- package/dist/animation/slotMachine.d.ts +1 -1
- package/dist/animation/slotMachine.d.ts.map +1 -1
- package/dist/animation/slotMachine.js +15 -22
- package/dist/animation/slotMachine.js.map +1 -1
- package/dist/api.js +11 -19
- package/dist/api.js.map +1 -1
- package/dist/balance.js +7 -46
- package/dist/balance.js.map +1 -1
- package/dist/commands/auth.js +40 -48
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/balance.js +14 -20
- package/dist/commands/balance.js.map +1 -1
- package/dist/commands/config.js +19 -26
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +87 -90
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/play.js +31 -37
- package/dist/commands/play.js.map +1 -1
- package/dist/commands/spin.js +6 -9
- package/dist/commands/spin.js.map +1 -1
- package/dist/commands/sync.js +23 -29
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/test.js +3 -6
- package/dist/commands/test.js.map +1 -1
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +49 -52
- package/dist/config.js.map +1 -1
- package/dist/index.js +21 -23
- package/dist/index.js.map +1 -1
- package/dist/patterns.js +3 -7
- package/dist/patterns.js.map +1 -1
- package/dist/templates/post-commit.js +1 -4
- package/dist/templates/post-commit.js.map +1 -1
- package/dist/utils/git.js +7 -12
- package/dist/utils/git.js.map +1 -1
- package/package.json +2 -1
- package/src/animation/slotMachine.ts +1 -1
- package/src/api.ts +1 -1
- package/src/commands/auth.ts +2 -2
- package/src/commands/balance.ts +1 -1
- package/src/commands/config.ts +1 -1
- package/src/commands/init.ts +56 -17
- package/src/commands/play.ts +5 -5
- package/src/commands/spin.ts +2 -2
- package/src/commands/sync.ts +2 -2
- package/src/commands/test.ts +1 -1
- package/src/config.ts +22 -0
- package/src/index.ts +8 -8
- package/src/patterns.test.ts +1 -1
- package/tsconfig.json +2 -1
package/dist/commands/config.js
CHANGED
|
@@ -1,59 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.configGetCommand = configGetCommand;
|
|
7
|
-
exports.configSetCommand = configSetCommand;
|
|
8
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const config_1 = require("../config");
|
|
10
|
-
async function configGetCommand(key) {
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { getApiUrl, setApiUrl, isSyncEnabled, setSyncEnabled, getConfig } from '../config.js';
|
|
3
|
+
export async function configGetCommand(key) {
|
|
11
4
|
try {
|
|
12
|
-
const config =
|
|
5
|
+
const config = getConfig();
|
|
13
6
|
switch (key) {
|
|
14
7
|
case 'api-url':
|
|
15
|
-
console.log(
|
|
8
|
+
console.log(getApiUrl());
|
|
16
9
|
break;
|
|
17
10
|
case 'sync-enabled':
|
|
18
|
-
console.log(
|
|
11
|
+
console.log(isSyncEnabled());
|
|
19
12
|
break;
|
|
20
13
|
case 'all':
|
|
21
|
-
console.log(
|
|
22
|
-
console.log(` API URL: ${
|
|
23
|
-
console.log(` Sync Enabled: ${
|
|
24
|
-
console.log(` Has Token: ${
|
|
14
|
+
console.log(chalk.bold('Configuration:'));
|
|
15
|
+
console.log(` API URL: ${chalk.cyan(getApiUrl())}`);
|
|
16
|
+
console.log(` Sync Enabled: ${chalk.cyan(isSyncEnabled())}`);
|
|
17
|
+
console.log(` Has Token: ${chalk.cyan(config.apiToken ? 'yes' : 'no')}`);
|
|
25
18
|
break;
|
|
26
19
|
default:
|
|
27
|
-
console.error(
|
|
20
|
+
console.error(chalk.red(`Unknown config key: ${key}`));
|
|
28
21
|
console.log('Available keys: api-url, sync-enabled, all');
|
|
29
22
|
process.exit(1);
|
|
30
23
|
}
|
|
31
24
|
}
|
|
32
25
|
catch (error) {
|
|
33
|
-
console.error(
|
|
26
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
34
27
|
process.exit(1);
|
|
35
28
|
}
|
|
36
29
|
}
|
|
37
|
-
async function configSetCommand(key, value) {
|
|
30
|
+
export async function configSetCommand(key, value) {
|
|
38
31
|
try {
|
|
39
32
|
switch (key) {
|
|
40
33
|
case 'api-url':
|
|
41
|
-
|
|
42
|
-
console.log(
|
|
34
|
+
setApiUrl(value);
|
|
35
|
+
console.log(chalk.green(`API URL set to: ${value}`));
|
|
43
36
|
break;
|
|
44
37
|
case 'sync-enabled':
|
|
45
38
|
const enabled = value.toLowerCase() === 'true' || value === '1';
|
|
46
|
-
|
|
47
|
-
console.log(
|
|
39
|
+
setSyncEnabled(enabled);
|
|
40
|
+
console.log(chalk.green(`Sync ${enabled ? 'enabled' : 'disabled'}`));
|
|
48
41
|
break;
|
|
49
42
|
default:
|
|
50
|
-
console.error(
|
|
43
|
+
console.error(chalk.red(`Unknown config key: ${key}`));
|
|
51
44
|
console.log('Available keys: api-url, sync-enabled');
|
|
52
45
|
process.exit(1);
|
|
53
46
|
}
|
|
54
47
|
}
|
|
55
48
|
catch (error) {
|
|
56
|
-
console.error(
|
|
49
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
57
50
|
process.exit(1);
|
|
58
51
|
}
|
|
59
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,SAAS,EACT,SAAS,EACT,aAAa,EACb,cAAc,EACd,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,GAAW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,CAAC;QACH,QAAQ,GAAG,EAAE,CAAC;YACZ,KAAK,SAAS;gBACZ,SAAS,CAAC,KAAK,CAAC,CAAC;gBACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,mBAAmB,KAAK,EAAE,CAAC,CAAC,CAAC;gBACrD,MAAM;YACR,KAAK,cAAc;gBACjB,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,EAAE,KAAK,MAAM,IAAI,KAAK,KAAK,GAAG,CAAC;gBAChE,cAAc,CAAC,OAAO,CAAC,CAAC;gBACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;gBACrE,MAAM;YACR;gBACE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,uBAAuB,GAAG,EAAE,CAAC,CAAC,CAAC;gBACvD,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;gBACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,UAAW,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AA4CA,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAmHjD"}
|
package/dist/commands/init.js
CHANGED
|
@@ -1,48 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.initCommand = initCommand;
|
|
40
|
-
const fs = __importStar(require("fs"));
|
|
41
|
-
const path = __importStar(require("path"));
|
|
42
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
43
|
-
const git_1 = require("../utils/git");
|
|
44
|
-
const post_commit_1 = require("../templates/post-commit");
|
|
45
|
-
const config_1 = require("../config");
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as readline from 'readline';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { isGitRepo } from '../utils/git.js';
|
|
6
|
+
import { POST_COMMIT_HOOK } from '../templates/post-commit.js';
|
|
7
|
+
import { getRepoInfo, setGitHubUsername, getGitHubUsername, setPrivateRepo } from '../config.js';
|
|
46
8
|
async function isRepoPublic(owner, repo) {
|
|
47
9
|
try {
|
|
48
10
|
const response = await fetch(`https://api.github.com/repos/${owner}/${repo}`, {
|
|
@@ -63,86 +25,121 @@ async function isRepoPublic(owner, repo) {
|
|
|
63
25
|
return null;
|
|
64
26
|
}
|
|
65
27
|
}
|
|
66
|
-
|
|
28
|
+
function askQuestion(question) {
|
|
29
|
+
const rl = readline.createInterface({
|
|
30
|
+
input: process.stdin,
|
|
31
|
+
output: process.stdout
|
|
32
|
+
});
|
|
33
|
+
return new Promise((resolve) => {
|
|
34
|
+
rl.question(question, (answer) => {
|
|
35
|
+
rl.close();
|
|
36
|
+
resolve(answer.trim().toLowerCase());
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export async function initCommand() {
|
|
67
41
|
// Check if git repo
|
|
68
|
-
if (!
|
|
69
|
-
console.error(
|
|
70
|
-
console.log(
|
|
42
|
+
if (!isGitRepo()) {
|
|
43
|
+
console.error(chalk.red('Error: Not a git repository'));
|
|
44
|
+
console.log(chalk.dim('Run this command from the root of a git repository'));
|
|
71
45
|
process.exit(1);
|
|
72
46
|
}
|
|
73
47
|
// Extract and save GitHub username from remote URL (do this first)
|
|
74
|
-
const repoInfo =
|
|
48
|
+
const repoInfo = getRepoInfo();
|
|
75
49
|
if (!repoInfo) {
|
|
76
50
|
console.log();
|
|
77
|
-
console.error(
|
|
51
|
+
console.error(chalk.red('Error: No GitHub remote detected'));
|
|
78
52
|
console.log();
|
|
79
|
-
console.log(
|
|
53
|
+
console.log(chalk.yellow('Git Slot Machine requires a GitHub repository.'));
|
|
80
54
|
console.log();
|
|
81
|
-
console.log(
|
|
82
|
-
console.log(
|
|
55
|
+
console.log(chalk.dim('Add a GitHub remote to this repo:'));
|
|
56
|
+
console.log(chalk.cyan(' git remote add origin https://github.com/username/repo.git'));
|
|
83
57
|
console.log();
|
|
84
|
-
console.log(chalk_1.default.dim('This prevents farming points in private/local repos.'));
|
|
85
|
-
console.log(chalk_1.default.dim('Your commits must be publicly verifiable.'));
|
|
86
58
|
process.exit(1);
|
|
87
59
|
}
|
|
88
|
-
const existingUsername =
|
|
60
|
+
const existingUsername = getGitHubUsername();
|
|
89
61
|
if (!existingUsername) {
|
|
90
|
-
|
|
91
|
-
console.log(
|
|
62
|
+
setGitHubUsername(repoInfo.owner);
|
|
63
|
+
console.log(chalk.dim(`Detected GitHub username: ${repoInfo.owner}`));
|
|
92
64
|
}
|
|
93
65
|
// Check if repository is public
|
|
94
|
-
console.log(
|
|
66
|
+
console.log(chalk.dim('Checking repository visibility...'));
|
|
95
67
|
const isPublic = await isRepoPublic(repoInfo.owner, repoInfo.name);
|
|
68
|
+
let usePrivacyMode = false;
|
|
96
69
|
if (isPublic === false) {
|
|
70
|
+
console.log(chalk.yellow('⚠️ Private repository detected'));
|
|
97
71
|
console.log();
|
|
98
|
-
console.
|
|
72
|
+
console.log(chalk.cyan('Privacy Mode Available'));
|
|
73
|
+
console.log(chalk.dim('You can still use Git Slot Machine with privacy mode enabled.'));
|
|
99
74
|
console.log();
|
|
100
|
-
console.log(
|
|
75
|
+
console.log(chalk.yellow('What happens in privacy mode:'));
|
|
76
|
+
console.log(chalk.dim(' • Repository name/org are NOT stored on the server'));
|
|
77
|
+
console.log(chalk.dim(' • Sent as "private/private" to the API'));
|
|
78
|
+
console.log(chalk.dim(' • Displayed as "*******/*******" on leaderboard'));
|
|
79
|
+
console.log(chalk.dim(' • Your GitHub username is still public'));
|
|
80
|
+
console.log(chalk.dim(' • All private repos share one balance'));
|
|
101
81
|
console.log();
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
82
|
+
const answer = await askQuestion(chalk.green('Enable privacy mode? (y/n): '));
|
|
83
|
+
if (answer === 'y' || answer === 'yes') {
|
|
84
|
+
usePrivacyMode = true;
|
|
85
|
+
setPrivateRepo(true);
|
|
86
|
+
console.log(chalk.green('✓ Privacy mode enabled'));
|
|
87
|
+
console.log(chalk.dim('Repository details will never be sent to the server.'));
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
console.log();
|
|
91
|
+
console.log(chalk.red('Cannot proceed without privacy mode for private repos.'));
|
|
92
|
+
console.log(chalk.dim('Please make the repository public or enable privacy mode.'));
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
108
95
|
}
|
|
109
|
-
if (isPublic === null) {
|
|
110
|
-
console.log(
|
|
111
|
-
console.log(
|
|
96
|
+
else if (isPublic === null) {
|
|
97
|
+
console.log(chalk.yellow('⚠️ Could not verify repository visibility'));
|
|
98
|
+
console.log();
|
|
99
|
+
const answer = await askQuestion(chalk.green('Is this a private repository? (y/n): '));
|
|
100
|
+
if (answer === 'y' || answer === 'yes') {
|
|
101
|
+
usePrivacyMode = true;
|
|
102
|
+
setPrivateRepo(true);
|
|
103
|
+
console.log(chalk.green('✓ Privacy mode enabled'));
|
|
104
|
+
console.log(chalk.dim('Repository details will never be sent to the server.'));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
console.log(chalk.dim('Proceeding with public repository mode...'));
|
|
108
|
+
}
|
|
112
109
|
}
|
|
113
110
|
else {
|
|
114
|
-
console.log(
|
|
111
|
+
console.log(chalk.green('✓ Public repository confirmed'));
|
|
115
112
|
}
|
|
116
113
|
const hookPath = path.join(process.cwd(), '.git', 'hooks', 'post-commit');
|
|
117
114
|
// Check if hook already exists
|
|
118
115
|
if (fs.existsSync(hookPath)) {
|
|
119
|
-
console.log(
|
|
120
|
-
console.log(
|
|
116
|
+
console.log(chalk.yellow('Warning: post-commit hook already exists'));
|
|
117
|
+
console.log(chalk.dim(`Location: ${hookPath}`));
|
|
121
118
|
// TODO: Could add merge logic or backup existing hook
|
|
122
|
-
console.log(
|
|
123
|
-
console.log(
|
|
119
|
+
console.log(chalk.red('Aborting to avoid overwriting existing hook'));
|
|
120
|
+
console.log(chalk.dim('Manually add git-slot-machine to your existing hook'));
|
|
124
121
|
process.exit(1);
|
|
125
122
|
}
|
|
126
123
|
// Write the hook
|
|
127
|
-
fs.writeFileSync(hookPath,
|
|
128
|
-
console.log(
|
|
124
|
+
fs.writeFileSync(hookPath, POST_COMMIT_HOOK, { mode: 0o755 });
|
|
125
|
+
console.log(chalk.green('✓ Post-commit hook installed'));
|
|
129
126
|
console.log();
|
|
130
|
-
console.log(
|
|
131
|
-
console.log(
|
|
127
|
+
console.log(chalk.cyan('Git Slot Machine is ready!'));
|
|
128
|
+
console.log(chalk.dim('Every commit will now spin the slot machine.'));
|
|
132
129
|
console.log();
|
|
133
130
|
console.log('Try it out:');
|
|
134
|
-
console.log(
|
|
131
|
+
console.log(chalk.dim(' git commit --allow-empty -m "test"'));
|
|
135
132
|
console.log();
|
|
136
|
-
console.log(
|
|
137
|
-
console.log(
|
|
133
|
+
console.log(chalk.cyan('Optional: Sync with the API'));
|
|
134
|
+
console.log(chalk.dim(` git-slot-machine auth login ${repoInfo?.owner || 'your-github-username'}`));
|
|
138
135
|
console.log();
|
|
139
|
-
console.log(
|
|
140
|
-
console.log(
|
|
141
|
-
console.log(
|
|
142
|
-
console.log(
|
|
143
|
-
console.log(
|
|
136
|
+
console.log(chalk.yellow('What gets sent to the server:'));
|
|
137
|
+
console.log(chalk.dim(' • Commit hash (7 and 40 character versions)'));
|
|
138
|
+
console.log(chalk.dim(' • Repository URL, owner, and name'));
|
|
139
|
+
console.log(chalk.dim(' • GitHub username'));
|
|
140
|
+
console.log(chalk.dim(' • Pattern type, payout, and balance'));
|
|
144
141
|
console.log();
|
|
145
|
-
console.log(
|
|
146
|
-
console.log(
|
|
142
|
+
console.log(chalk.dim('You can disable API sync anytime:'));
|
|
143
|
+
console.log(chalk.dim(' git-slot-machine config set sync-enabled false'));
|
|
147
144
|
}
|
|
148
145
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEjG,KAAK,UAAU,YAAY,CAAC,KAAa,EAAE,IAAY;IACrD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,gCAAgC,KAAK,IAAI,IAAI,EAAE,EAAE;YAC5E,OAAO,EAAE;gBACP,QAAQ,EAAE,6BAA6B;gBACvC,sBAAsB,EAAE,YAAY;aACrC;SACF,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC;YAChB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAA0B,CAAC;YAC3D,OAAO,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC;QAChC,CAAC;QAED,0CAA0C;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mCAAmC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;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AC,mCAAmC,CAAC,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC,CAAC;AAC7E,CAAC"}
|
package/dist/commands/play.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const slotMachine_1 = require("../animation/slotMachine");
|
|
9
|
-
const balance_1 = require("../balance");
|
|
10
|
-
const api_1 = require("../api");
|
|
11
|
-
const config_1 = require("../config");
|
|
12
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
13
|
-
async function playCommand(hash, options) {
|
|
1
|
+
import { detectPattern } from '../patterns.js';
|
|
2
|
+
import { animateSlotMachine, animateSmallMode } from '../animation/slotMachine.js';
|
|
3
|
+
import { getBalance, updateBalance, setBalance } from '../balance.js';
|
|
4
|
+
import { sendPlayToAPI } from '../api.js';
|
|
5
|
+
import { getRepoInfo, getGitHubUsername } from '../config.js';
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
export async function playCommand(hash, options) {
|
|
14
8
|
try {
|
|
15
9
|
// Get balance before playing
|
|
16
|
-
const balanceBefore =
|
|
10
|
+
const balanceBefore = getBalance();
|
|
17
11
|
// Detect pattern
|
|
18
|
-
const result =
|
|
12
|
+
const result = detectPattern(hash);
|
|
19
13
|
// Animate based on mode
|
|
20
14
|
const config = {
|
|
21
15
|
finalHash: hash.toLowerCase(),
|
|
@@ -23,10 +17,10 @@ async function playCommand(hash, options) {
|
|
|
23
17
|
patternResult: result
|
|
24
18
|
};
|
|
25
19
|
if (options.small) {
|
|
26
|
-
await
|
|
20
|
+
await animateSmallMode(config);
|
|
27
21
|
}
|
|
28
22
|
else {
|
|
29
|
-
await
|
|
23
|
+
await animateSlotMachine(config);
|
|
30
24
|
}
|
|
31
25
|
// Show result
|
|
32
26
|
if (!options.small) {
|
|
@@ -36,37 +30,37 @@ async function playCommand(hash, options) {
|
|
|
36
30
|
if (result.payout > 0) {
|
|
37
31
|
const resultText = `${result.name}!`;
|
|
38
32
|
const resultPadding = Math.floor((boxWidth - resultText.length) / 2);
|
|
39
|
-
console.log(' '.repeat(resultPadding) +
|
|
33
|
+
console.log(' '.repeat(resultPadding) + chalk.cyan.bold(resultText));
|
|
40
34
|
const payoutText = `+${result.payout} points`;
|
|
41
35
|
const payoutPadding = Math.floor((boxWidth - payoutText.length) / 2);
|
|
42
|
-
console.log(' '.repeat(payoutPadding) +
|
|
36
|
+
console.log(' '.repeat(payoutPadding) + chalk.white.bold(payoutText));
|
|
43
37
|
}
|
|
44
38
|
else {
|
|
45
39
|
const noWinText = 'No win';
|
|
46
40
|
const noWinPadding = Math.floor((boxWidth - noWinText.length) / 2);
|
|
47
|
-
console.log(' '.repeat(noWinPadding) +
|
|
41
|
+
console.log(' '.repeat(noWinPadding) + chalk.red.bold(noWinText));
|
|
48
42
|
const lossText = '-10 points';
|
|
49
43
|
const lossPadding = Math.floor((boxWidth - lossText.length) / 2);
|
|
50
|
-
console.log(' '.repeat(lossPadding) +
|
|
44
|
+
console.log(' '.repeat(lossPadding) + chalk.white.bold(lossText));
|
|
51
45
|
}
|
|
52
46
|
console.log();
|
|
53
47
|
const descText = result.description;
|
|
54
48
|
const descPadding = Math.floor((boxWidth - descText.length) / 2);
|
|
55
|
-
console.log(' '.repeat(descPadding) +
|
|
49
|
+
console.log(' '.repeat(descPadding) + chalk.dim(descText));
|
|
56
50
|
}
|
|
57
51
|
// Validate GitHub remote for API sync
|
|
58
|
-
const repoInfo =
|
|
59
|
-
const githubUsername =
|
|
52
|
+
const repoInfo = getRepoInfo();
|
|
53
|
+
const githubUsername = getGitHubUsername();
|
|
60
54
|
if (!repoInfo && githubUsername) {
|
|
61
55
|
console.log();
|
|
62
|
-
console.log(
|
|
63
|
-
console.log(
|
|
64
|
-
console.log(
|
|
65
|
-
console.log(
|
|
56
|
+
console.log(chalk.yellow.bold('⚠ Warning: No GitHub remote detected'));
|
|
57
|
+
console.log(chalk.dim('This repo will not sync to the leaderboard.'));
|
|
58
|
+
console.log(chalk.dim('To sync, add a GitHub remote:'));
|
|
59
|
+
console.log(chalk.cyan(' git remote add origin https://github.com/username/repo.git'));
|
|
66
60
|
console.log();
|
|
67
61
|
}
|
|
68
62
|
// Update balance locally
|
|
69
|
-
let newBalance =
|
|
63
|
+
let newBalance = updateBalance(hash.toLowerCase(), result.payout);
|
|
70
64
|
// Send to API and sync balance with server
|
|
71
65
|
let shareUrl;
|
|
72
66
|
if (repoInfo && githubUsername) {
|
|
@@ -88,10 +82,10 @@ async function playCommand(hash, options) {
|
|
|
88
82
|
playData.commit_full_hash = options.fullHash;
|
|
89
83
|
}
|
|
90
84
|
try {
|
|
91
|
-
const apiResponse = await
|
|
85
|
+
const apiResponse = await sendPlayToAPI(playData);
|
|
92
86
|
// Sync local balance to match server's balance
|
|
93
87
|
if (apiResponse && apiResponse.balance !== undefined) {
|
|
94
|
-
|
|
88
|
+
setBalance(apiResponse.balance);
|
|
95
89
|
newBalance = apiResponse.balance;
|
|
96
90
|
shareUrl = apiResponse.share_url;
|
|
97
91
|
}
|
|
@@ -104,10 +98,10 @@ async function playCommand(hash, options) {
|
|
|
104
98
|
if (options.small) {
|
|
105
99
|
// Small mode - everything on one line (animateSmallMode already wrote the hash without newline)
|
|
106
100
|
if (result.payout > 0) {
|
|
107
|
-
console.log(
|
|
101
|
+
console.log(chalk.dim(' • ') + chalk.cyan.bold(`${result.name} +${result.payout}`) + chalk.dim(' • ') + chalk.white(`Balance: ${chalk.green.bold(newBalance)}`));
|
|
108
102
|
}
|
|
109
103
|
else {
|
|
110
|
-
console.log(
|
|
104
|
+
console.log(chalk.dim(' • ') + chalk.red('No win -10') + chalk.dim(' • ') + chalk.white(`Balance: ${newBalance >= 0 ? chalk.green.bold(newBalance) : chalk.red.bold(newBalance)}`));
|
|
111
105
|
}
|
|
112
106
|
}
|
|
113
107
|
else {
|
|
@@ -116,7 +110,7 @@ async function playCommand(hash, options) {
|
|
|
116
110
|
// Note: we can't measure the exact length with color codes, so estimate based on text content
|
|
117
111
|
const balanceText = `Balance: ${newBalance} points`;
|
|
118
112
|
const balancePadding = Math.floor((boxWidth - balanceText.length) / 2);
|
|
119
|
-
console.log(' '.repeat(balancePadding) +
|
|
113
|
+
console.log(' '.repeat(balancePadding) + chalk.white.bold(`Balance: ${newBalance >= 0 ? chalk.green.bold(newBalance) : chalk.red.bold(newBalance)} points`));
|
|
120
114
|
}
|
|
121
115
|
// Show share URL for wins
|
|
122
116
|
if (shareUrl && result.payout > 0 && !options.small) {
|
|
@@ -124,13 +118,13 @@ async function playCommand(hash, options) {
|
|
|
124
118
|
const boxWidth = 41;
|
|
125
119
|
const shareText = 'Share your win:';
|
|
126
120
|
const sharePadding = Math.floor((boxWidth - shareText.length) / 2);
|
|
127
|
-
console.log(' '.repeat(sharePadding) +
|
|
121
|
+
console.log(' '.repeat(sharePadding) + chalk.dim(shareText));
|
|
128
122
|
const urlPadding = Math.floor((boxWidth - shareUrl.length) / 2);
|
|
129
|
-
console.log(' '.repeat(urlPadding) +
|
|
123
|
+
console.log(' '.repeat(urlPadding) + chalk.green.underline(shareUrl));
|
|
130
124
|
}
|
|
131
125
|
}
|
|
132
126
|
catch (error) {
|
|
133
|
-
console.error(
|
|
127
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
134
128
|
process.exit(1);
|
|
135
129
|
}
|
|
136
130
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"play.js","sourceRoot":"","sources":["../../src/commands/play.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"play.js","sourceRoot":"","sources":["../../src/commands/play.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,UAAU,E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AU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAChE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxE,CAAC;IAEH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,UAAW,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/dist/commands/spin.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const git_1 = require("../utils/git");
|
|
5
|
-
const play_1 = require("./play");
|
|
6
|
-
async function spinCommand(options) {
|
|
1
|
+
import { getCurrentCommitHash, getCurrentCommitFullHash } from '../utils/git.js';
|
|
2
|
+
import { playCommand } from './play.js';
|
|
3
|
+
export async function spinCommand(options) {
|
|
7
4
|
try {
|
|
8
|
-
const hash =
|
|
9
|
-
const fullHash =
|
|
10
|
-
await
|
|
5
|
+
const hash = getCurrentCommitHash();
|
|
6
|
+
const fullHash = getCurrentCommitFullHash();
|
|
7
|
+
await playCommand(hash, { ...options, fullHash });
|
|
11
8
|
}
|
|
12
9
|
catch (error) {
|
|
13
10
|
console.error(`Error: ${error.message}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spin.js","sourceRoot":"","sources":["../../src/commands/spin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spin.js","sourceRoot":"","sources":["../../src/commands/spin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAMxC,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAoB;IACpD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,oBAAoB,EAAE,CAAC;QACpC,MAAM,QAAQ,GAAG,wBAAwB,EAAE,CAAC;QAC5C,MAAM,WAAW,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,UAAW,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|