@askance/cli 0.2.0 → 0.2.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.
Files changed (2) hide show
  1. package/dist/cli/index.js +29 -9
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -105,9 +105,13 @@ function initClaude() {
105
105
  const hookHandlerPath = path_1.default.join(pkgRoot, "dist", "hook-handler", "index.js").replace(/\\/g, "/");
106
106
  const stopHookPath = path_1.default.join(pkgRoot, "dist", "hook-handler", "stop-hook.js").replace(/\\/g, "/");
107
107
  const mcpServerPath = path_1.default.join(pkgRoot, "dist", "mcp-server", "index.js").replace(/\\/g, "/");
108
- const settings = fs_1.default.existsSync(settingsPath)
109
- ? JSON.parse(fs_1.default.readFileSync(settingsPath, "utf-8"))
110
- : {};
108
+ let settings = {};
109
+ if (fs_1.default.existsSync(settingsPath)) {
110
+ try {
111
+ settings = JSON.parse(fs_1.default.readFileSync(settingsPath, "utf-8"));
112
+ }
113
+ catch { }
114
+ }
111
115
  // Set hooks
112
116
  const hooks = (settings.hooks ?? {});
113
117
  hooks.PreToolUse = [
@@ -156,9 +160,13 @@ function initCursor() {
156
160
  const settingsPath = path_1.default.join(cursorDir, "settings.json");
157
161
  const hookHandlerPath = path_1.default.join(pkgRoot, "dist", "hook-handler", "index.js").replace(/\\/g, "/");
158
162
  const mcpServerPath = path_1.default.join(pkgRoot, "dist", "mcp-server", "index.js").replace(/\\/g, "/");
159
- const settings = fs_1.default.existsSync(settingsPath)
160
- ? JSON.parse(fs_1.default.readFileSync(settingsPath, "utf-8"))
161
- : {};
163
+ let settings = {};
164
+ if (fs_1.default.existsSync(settingsPath)) {
165
+ try {
166
+ settings = JSON.parse(fs_1.default.readFileSync(settingsPath, "utf-8"));
167
+ }
168
+ catch { }
169
+ }
162
170
  // Set Cursor hooks
163
171
  const cursorHooks = (settings["cursor.hooks"] ?? {});
164
172
  cursorHooks.preToolUse = {
@@ -190,9 +198,13 @@ function initCopilot() {
190
198
  }
191
199
  const configPath = path_1.default.join(githubDir, "copilot-config.json");
192
200
  const hookHandlerPath = path_1.default.join(pkgRoot, "dist", "hook-handler", "index.js").replace(/\\/g, "/");
193
- const config = fs_1.default.existsSync(configPath)
194
- ? JSON.parse(fs_1.default.readFileSync(configPath, "utf-8"))
195
- : {};
201
+ let config = {};
202
+ if (fs_1.default.existsSync(configPath)) {
203
+ try {
204
+ config = JSON.parse(fs_1.default.readFileSync(configPath, "utf-8"));
205
+ }
206
+ catch { }
207
+ }
196
208
  // Set Copilot agent hooks
197
209
  const copilotAgent = (config["copilot.agent"] ?? {});
198
210
  const hooks = (copilotAgent.hooks ?? {});
@@ -428,6 +440,14 @@ async function login() {
428
440
  }
429
441
  catch { }
430
442
  }
443
+ // Check if a project is linked — if not, set one up
444
+ if (!config.projectId) {
445
+ console.log("\n No project linked. Setting up project...");
446
+ await setupProject();
447
+ }
448
+ else {
449
+ console.log(` Project: ${config.projectId}`);
450
+ }
431
451
  console.log("\n To log in as a different user, delete .askance/credentials and run login again.");
432
452
  return;
433
453
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askance/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Askance CLI — Tool call interception & approval management for AI coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://askance.app",