hirify-cli 0.4.1 → 0.4.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.
package/README.md CHANGED
@@ -15,7 +15,8 @@ npx hirify-cli login
15
15
  ```
16
16
 
17
17
  Your browser opens, you confirm access on hirify.me, and the terminal continues on its own.
18
- Nothing to copy back.
18
+ Nothing to copy back. Running `hirify login` again keeps the current sign-in; use
19
+ `hirify login --force` only when you need to switch accounts or approve changed permissions.
19
20
 
20
21
  ```bash
21
22
  npx hirify-cli intro
package/bin/hirify.js CHANGED
@@ -66,7 +66,7 @@ const HELP = `hirify - job search for AI agents
66
66
 
67
67
  hirify intro what this can do, and in what order
68
68
 
69
- hirify login sign in through your browser
69
+ hirify login sign in through your browser [--force]
70
70
  hirify logout sign out on this computer
71
71
  hirify account show your plan and allowances
72
72
 
@@ -592,7 +592,14 @@ async function startCallbackServer() {
592
592
  })
593
593
  })
594
594
 
595
- return { port: server.address().port, received, close: () => server.close() }
595
+ return {
596
+ port: server.address().port,
597
+ received,
598
+ close: () => {
599
+ server.close()
600
+ server.closeIdleConnections?.()
601
+ },
602
+ }
596
603
  }
597
604
 
598
605
  /**
@@ -648,6 +655,19 @@ function openBrowser(url) {
648
655
 
649
656
  async function cmdLogin(args) {
650
657
  const noBrowser = args.includes('--no-browser')
658
+ const force = args.includes('--force')
659
+ const current = readSession()
660
+
661
+ if (!force && current?.kind === 'oauth') {
662
+ if (current.expires_at && current.expires_at - 60 <= now() && current.refresh_token) {
663
+ await refreshSession(current)
664
+ }
665
+ console.log('Already signed in. Use `hirify login --force` to sign in again.')
666
+ await cmdAccountShow()
667
+ console.log('\nRules for your agent: npx skills add hirifyme/hirify-cli')
668
+ return
669
+ }
670
+
651
671
  const endpoints = await discover()
652
672
 
653
673
  let listener
@@ -701,8 +721,12 @@ async function cmdLogin(args) {
701
721
  if (!opened) console.log(`\n${authUrl}\n`)
702
722
  else console.log(`If it did not open, use this link:\n${authUrl}`)
703
723
 
704
- const timeout = new Promise((resolve) => setTimeout(() => resolve({ timedOut: true }), LOGIN_TIMEOUT_MS))
724
+ let timeoutId
725
+ const timeout = new Promise((resolve) => {
726
+ timeoutId = setTimeout(() => resolve({ timedOut: true }), LOGIN_TIMEOUT_MS)
727
+ })
705
728
  const answer = await Promise.race([listener.received, timeout])
729
+ clearTimeout(timeoutId)
706
730
  listener.close()
707
731
 
708
732
  if (answer.timedOut) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hirify-cli",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Hirify CLI for AI agents: browser sign-in, job feeds, search, reading a vacancy in full, contacts to apply to, and applying on Hirify.",
5
5
  "bin": {
6
6
  "hirify": "bin/hirify.js"