@tomingtoming/kioq 0.8.0 → 0.8.2

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.
@@ -109,16 +109,20 @@ export class GitHubStorage {
109
109
  const gitDir = path.join(this.rootPath, ".git");
110
110
  try {
111
111
  const s = await fs.stat(gitDir);
112
- if (!s.isDirectory()) {
113
- throw new Error(`${this.rootPath} is not a git repository`);
112
+ if (s.isDirectory()) {
113
+ return;
114
114
  }
115
115
  }
116
+ catch {
117
+ // .git not found — auto-clone below
118
+ }
119
+ const cloneUrl = `https://x-access-token:${this.githubConfig.token}@github.com/${this.githubConfig.owner}/${this.githubConfig.repo}.git`;
120
+ try {
121
+ await fs.mkdir(path.dirname(this.rootPath), { recursive: true });
122
+ await this.execFileAsyncFn("git", ["clone", "--branch", this.branch, "--single-branch", cloneUrl, this.rootPath], { timeout: 120_000 });
123
+ }
116
124
  catch (error) {
117
- if (error instanceof Error && error.message.includes("is not a git repository")) {
118
- throw error;
119
- }
120
- throw new Error(`Local clone not found at ${this.rootPath}. `
121
- + `Clone the repository first: git clone https://github.com/${this.githubConfig.owner}/${this.githubConfig.repo}.git ${this.rootPath}`);
125
+ throw new Error(`Failed to clone ${cloneUrl} into ${this.rootPath}: ${this.normalizeExecError(error)}`);
122
126
  }
123
127
  }
124
128
  async validateSetup() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomingtoming/kioq",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "Japanese-first local markdown MCP server",
5
5
  "type": "module",
6
6
  "bin": {