@scheduler-systems/gal-cli 0.1.6 → 0.1.7

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/dist/index.cjs CHANGED
@@ -246,7 +246,7 @@ Removing files...`));let i=mr(r,!1);if(console.log(),i.removed.length>0){console
246
246
  \u2717 Failed to remove ${i.errors.length} item(s):`));for(let s of i.errors)console.log(a.dim(` - ${s}`))}console.log(a.blue(`
247
247
  \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(a.blue(" GAL has been uninstalled.")),console.log(a.blue(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
248
248
  `)),console.log(a.dim("To reinstall, run: gal sync --pull")),console.log(a.dim(`To completely remove the CLI: npm uninstall -g @scheduler-systems-ai/gal-cli
249
- `))}),t}var ht="0.1.6",j="https://api.gal.run",ft=(0,mt.join)((0,xn.homedir)(),".gal"),dt=(0,mt.join)(ft,"update-cache.json"),pr=24*60*60*1e3;function gr(t,e){let n=t.replace(/^v/,"").split(".").map(Number),o=e.replace(/^v/,"").split(".").map(Number);for(let r=0;r<3;r++){if((n[r]||0)<(o[r]||0))return-1;if((n[r]||0)>(o[r]||0))return 1}return 0}function Fr(){try{if((0,G.existsSync)(dt))return JSON.parse((0,G.readFileSync)(dt,"utf-8"))}catch{}return null}function Cr(t){try{(0,G.existsSync)(ft)||(0,G.mkdirSync)(ft,{recursive:!0}),(0,G.writeFileSync)(dt,JSON.stringify(t))}catch{}}function Er(t,e){let n=["",a.bgYellow.black(" UPDATE AVAILABLE "),"",` ${a.dim(t)} \u2192 ${a.green(e)}`,"",` Run: ${a.cyan("npm update -g @scheduler-systems/gal-cli")}`,""].join(`
249
+ `))}),t}var ht="0.1.7",j="https://api.gal.run",ft=(0,mt.join)((0,xn.homedir)(),".gal"),dt=(0,mt.join)(ft,"update-cache.json"),pr=24*60*60*1e3;function gr(t,e){let n=t.replace(/^v/,"").split(".").map(Number),o=e.replace(/^v/,"").split(".").map(Number);for(let r=0;r<3;r++){if((n[r]||0)<(o[r]||0))return-1;if((n[r]||0)>(o[r]||0))return 1}return 0}function Fr(){try{if((0,G.existsSync)(dt))return JSON.parse((0,G.readFileSync)(dt,"utf-8"))}catch{}return null}function Cr(t){try{(0,G.existsSync)(ft)||(0,G.mkdirSync)(ft,{recursive:!0}),(0,G.writeFileSync)(dt,JSON.stringify(t))}catch{}}function Er(t,e){let n=["",a.bgYellow.black(" UPDATE AVAILABLE "),"",` ${a.dim(t)} \u2192 ${a.green(e)}`,"",` Run: ${a.cyan("npm update -g @scheduler-systems/gal-cli")}`,""].join(`
250
250
  `),r=a.yellow("\u2500".repeat(50));console.log(`
251
251
  `+r),console.log(n),console.log(r+`
252
252
  `)}function _r(){let t=Fr(),e=!t||Date.now()-t.lastCheck>pr;if(t?.latestVersion&&gr(ht,t.latestVersion)<0&&process.on("exit",()=>{Er(ht,t.latestVersion)}),e){let n=wn.default.get("https://registry.npmjs.org/@scheduler-systems/gal-cli/latest",{timeout:3e3},o=>{let r="";o.on("data",i=>r+=i),o.on("end",()=>{try{let i=JSON.parse(r);Cr({lastCheck:Date.now(),latestVersion:i.version})}catch{}})});n.on("error",()=>{}),n.on("timeout",()=>n.destroy())}}_r();Bn.default.config();var Y=new I;Y.name("gal").description("GAL - Governance Agentic Layer CLI").version(ht);Y.addCommand(Fn());Y.addCommand(_n());Y.addCommand(yn());Y.addCommand(On());Y.parse();0&&(module.exports={DEFAULT_API_URL});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scheduler-systems/gal-cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "GAL CLI - Command-line tool for managing AI agent configurations across your organization",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -37,12 +37,22 @@ const GAL_CONFIG_FILE = path.join(os.homedir(), '.gal', 'config.json');
37
37
  const SESSION_FILE = path.join(os.tmpdir(), 'gal-hook-session.json');
38
38
  const CURRENT_VERSION = '${CLI_VERSION}';
39
39
 
40
- // Output a notification to the user (non-blocking)
41
- function notify(message) {
40
+ // Output a notification with context for Claude to act on
41
+ function notify(message, context) {
42
42
  // Output JSON to stdout - Claude Code will parse this
43
- process.stdout.write(JSON.stringify({
44
- systemMessage: message
45
- }));
43
+ const output = {
44
+ hookSpecificOutput: {
45
+ hookEventName: 'UserPromptSubmit',
46
+ systemMessage: message
47
+ }
48
+ };
49
+
50
+ // Add context for Claude to act on
51
+ if (context) {
52
+ output.hookSpecificOutput.additionalContext = context;
53
+ }
54
+
55
+ process.stdout.write(JSON.stringify(output));
46
56
  process.exit(0);
47
57
  }
48
58
 
@@ -160,7 +170,10 @@ function checkCachedUpdate() {
160
170
 
161
171
  if (cachedLatest && compareVersions(CURRENT_VERSION, cachedLatest) < 0) {
162
172
  if (shouldRemind('cli-update')) {
163
- notify(\`🆙 GAL CLI update: \${CURRENT_VERSION} → \${cachedLatest}. Run: npm update -g @scheduler-systems/gal-cli\`);
173
+ notify(
174
+ \`🆙 GAL CLI update: \${CURRENT_VERSION} → \${cachedLatest}\`,
175
+ \`GAL CLI update available. Run this command to update: npm update -g @scheduler-systems/gal-cli. After updating, tell the user to restart Claude Code.\`
176
+ );
164
177
  }
165
178
  }
166
179
 
@@ -208,7 +221,10 @@ const galConfig = readGalConfig();
208
221
  // Step 1: Check if authenticated
209
222
  if (!galConfig || !galConfig.authToken) {
210
223
  if (shouldRemind('auth-required')) {
211
- notify('🔐 GAL: Authentication required. Run: gal auth login');
224
+ notify(
225
+ '🔐 GAL: Authentication required',
226
+ 'GAL CLI needs authentication. Run: gal auth login. This will open a browser for GitHub OAuth. For help: gal --help'
227
+ );
212
228
  }
213
229
  process.exit(0);
214
230
  }
@@ -221,7 +237,10 @@ if (tokenPayload && tokenPayload.exp) {
221
237
 
222
238
  if (now > expiresAt) {
223
239
  if (shouldRemind('auth-expired')) {
224
- notify('🔐 GAL: Session expired. Run: gal auth login');
240
+ notify(
241
+ '🔐 GAL: Session expired',
242
+ 'GAL CLI session has expired. Run: gal auth login to re-authenticate.'
243
+ );
225
244
  }
226
245
  process.exit(0);
227
246
  }
@@ -230,7 +249,10 @@ if (tokenPayload && tokenPayload.exp) {
230
249
  const hoursUntilExpiry = (expiresAt - now) / (1000 * 60 * 60);
231
250
  if (hoursUntilExpiry < 24) {
232
251
  if (shouldRemind('auth-expiring')) {
233
- notify(\`⏰ GAL: Session expires in \${Math.round(hoursUntilExpiry)} hours. Run: gal auth login\`);
252
+ notify(
253
+ \`⏰ GAL: Session expires in \${Math.round(hoursUntilExpiry)} hours\`,
254
+ 'GAL CLI session expiring soon. Suggest running: gal auth login to refresh.'
255
+ );
234
256
  }
235
257
  // Don't exit - continue to check sync state
236
258
  }
@@ -251,7 +273,10 @@ const state = readSyncState();
251
273
  if (!state) {
252
274
  const orgName = galConfig.defaultOrg || 'your organization';
253
275
  if (shouldRemind('sync-required')) {
254
- notify(\`📥 GAL: Project not synced with \${orgName}. Run: gal sync --pull\`);
276
+ notify(
277
+ \`📥 GAL: Project not synced with \${orgName}\`,
278
+ 'Project config not synced with organization. Run: gal sync --pull to download org-approved config. Then restart Claude Code.'
279
+ );
255
280
  }
256
281
  process.exit(0);
257
282
  }
@@ -260,7 +285,10 @@ if (!state) {
260
285
  if (state.lastSyncHash !== state.approvedConfigHash) {
261
286
  const days = Math.floor((Date.now() - new Date(state.lastSyncTimestamp).getTime()) / (24 * 60 * 60 * 1000));
262
287
  if (shouldRemind('sync-outdated')) {
263
- notify(\`⚠️ GAL: Config \${days} day(s) behind \${state.organization}. Run: gal sync --pull\`);
288
+ notify(
289
+ \`⚠️ GAL: Config \${days} day(s) behind \${state.organization}\`,
290
+ 'Local config is outdated. Run: gal sync --pull to get latest org-approved config. Then restart Claude Code.'
291
+ );
264
292
  }
265
293
  process.exit(0);
266
294
  }
@@ -274,7 +302,10 @@ if (state.syncedFiles && state.syncedFiles.length > 0) {
274
302
 
275
303
  if (missingFiles.length > 0) {
276
304
  if (shouldRemind('sync-missing')) {
277
- notify('⚠️ GAL: Missing config files. Run: gal sync --pull');
305
+ notify(
306
+ '⚠️ GAL: Missing config files',
307
+ 'Some synced config files are missing. Run: gal sync --pull to restore them. Then restart Claude Code.'
308
+ );
278
309
  }
279
310
  process.exit(0);
280
311
  }