# Version Bumper

The Version Bumper updates the version number in the package.json file.

This should be added to your git pre-commit hooks.<br>

Execute it with `node scripts/update-version.js` .

Script file:

```javascript
import fs from 'node:fs';
import { execSync } from 'node:child_process';
import path from 'node:path';

const pkgPath = path.resolve('package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));

const versionParts = pkg.version.split('.').map(Number);
// Standard semver: major.minor.patch
// Incrementing patch by default
versionParts[2] += 1;

const newVersion = versionParts.join('.');
pkg.version = newVersion;

fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
console.log(`Version bumped to ${newVersion}`);

try {
    execSync(`git add ${pkgPath}`);
} catch (error) {
    console.error('Failed to stage package.json:', error.message);
    process.exit(1);
}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://space-cat-games.gitbook.io/space-cat-games-docs/scripts-and-tools/version-bumper.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
