issy 0.1.9 → 0.2.0

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 (3) hide show
  1. package/bin/issy +49 -1
  2. package/dist/cli.js +3 -0
  3. package/package.json +3 -3
package/bin/issy CHANGED
@@ -1,10 +1,46 @@
1
1
  #!/usr/bin/env node
2
2
  import { dirname } from 'node:path'
3
- import { existsSync, mkdirSync, readdirSync, writeFileSync } from 'node:fs'
3
+ import { existsSync, mkdirSync, readdirSync, writeFileSync, readFileSync } from 'node:fs'
4
4
  import { join, resolve } from 'node:path'
5
5
  import { fileURLToPath } from 'node:url'
6
6
 
7
7
  const args = process.argv.slice(2)
8
+
9
+ /**
10
+ * Check for newer version on npm and warn if outdated.
11
+ * Runs async and doesn't block startup.
12
+ */
13
+ async function checkForUpdates() {
14
+ try {
15
+ const here = resolve(fileURLToPath(import.meta.url), '..')
16
+ const pkgPath = resolve(here, '..', 'package.json')
17
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))
18
+ const currentVersion = pkg.version
19
+
20
+ const controller = new AbortController()
21
+ const timeout = setTimeout(() => controller.abort(), 2000)
22
+
23
+ const res = await fetch('https://registry.npmjs.org/issy/latest', {
24
+ signal: controller.signal
25
+ })
26
+ clearTimeout(timeout)
27
+
28
+ if (!res.ok) return
29
+
30
+ const data = await res.json()
31
+ const latestVersion = data.version
32
+
33
+ if (currentVersion !== latestVersion) {
34
+ console.error(`\x1b[33m⚠ You're running issy v${currentVersion}, but v${latestVersion} is available.\x1b[0m`)
35
+ console.error(`\x1b[33m Run: npx issy@latest\x1b[0m\n`)
36
+ }
37
+ } catch {
38
+ // Silently ignore - network issues, timeouts, etc.
39
+ }
40
+ }
41
+
42
+ // Fire off update check (non-blocking)
43
+ const updateCheck = checkForUpdates()
8
44
  const cliCommands = new Set([
9
45
  'list',
10
46
  'search',
@@ -17,6 +53,16 @@ const cliCommands = new Set([
17
53
  '-h'
18
54
  ])
19
55
 
56
+ // Handle --version / -v flag
57
+ if (args[0] === '--version' || args[0] === '-v') {
58
+ const here = resolve(fileURLToPath(import.meta.url), '..')
59
+ const pkgPath = resolve(here, '..', 'package.json')
60
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))
61
+ console.log(`issy v${pkg.version}`)
62
+ await updateCheck
63
+ process.exit(0)
64
+ }
65
+
20
66
  /**
21
67
  * Find .issues directory by walking up from the given path.
22
68
  * Returns the path if found, or null if not found.
@@ -95,6 +141,7 @@ if (cliCommands.has(args[0] || '')) {
95
141
  process.argv = [process.argv[0], process.argv[1], ...args]
96
142
  const cli = await import(entry)
97
143
  await cli.ready // Wait for main() to complete before exiting
144
+ await updateCheck // Wait for version check to complete
98
145
  process.exit(0)
99
146
  }
100
147
 
@@ -135,6 +182,7 @@ if (shouldInitOnly) {
135
182
  }
136
183
 
137
184
  console.log(`Initialized ${issuesDir}`)
185
+ await updateCheck // Wait for version check to complete
138
186
  process.exit(0)
139
187
  }
140
188
 
package/dist/cli.js CHANGED
@@ -1778,6 +1778,9 @@ issy CLI
1778
1778
  Usage:
1779
1779
  issy <command> [options]
1780
1780
 
1781
+ Options:
1782
+ --version, -v Show version number
1783
+
1781
1784
  Commands:
1782
1785
  list List all open issues
1783
1786
  --all, -a Include closed issues
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "issy",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "description": "AI-native issue tracking. Markdown files in .issues/, managed by your coding assistant.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  "lint": "biome check src bin"
35
35
  },
36
36
  "dependencies": {
37
- "@miketromba/issy-app": "^0.1.9",
38
- "@miketromba/issy-core": "^0.1.9"
37
+ "@miketromba/issy-app": "^0.2.0",
38
+ "@miketromba/issy-core": "^0.2.0"
39
39
  }
40
40
  }