open source is social v-it.org
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

login: validate sessions via restoreAgent, rename --reset to --force

Instead of checking session file existence, login now calls restoreAgent()
to validate the token against the auth server. Invalid/expired sessions
fall through to the OAuth flow automatically. The --reset flag is renamed
to --force for consistency.

Changed files:
- src/cmd/login.js
- test/login.test.js
- README.md
- skills/vit/COMMANDS.md
- skills/vit/SKILL.md

+14 -12
+1 -1
README.md
··· 72 72 ### options 73 73 74 74 - `-v, --verbose` - show discovery and protocol details 75 - - `--reset` - force re-login even if credentials are valid 75 + - `--force` - force re-login, skip session validation 76 76 77 77 ## firehose 78 78
+2 -2
skills/vit/COMMANDS.md
··· 216 216 217 217 Options: 218 218 - `-v, --verbose` - Show discovery details 219 - - `--reset` - Force re-authentication 219 + - `--force` - Force re-login, skip session validation 220 220 221 221 Output format: 222 222 - Text prompts and login status (`DID`, `Logged in`). ··· 230 230 - Requires browser OAuth interaction. 231 231 232 232 Example: 233 - - `vit login alice.bsky.social --reset` 233 + - `vit login alice.bsky.social --force` 234 234 235 235 ### `vit adopt <beacon> [name]` 236 236 Usage: `vit adopt <beacon> [name]`
+1 -1
skills/vit/SKILL.md
··· 122 122 | `no DID configured` | User hasn't logged in | Tell user to run `vit login <handle>` | 123 123 | `no beacon set` | `.vit/` not initialized or no beacon | Run `vit init` | 124 124 | `no followings` / empty skim results | No accounts followed | Run `vit follow <handle>` | 125 - | Session errors (deleted/expired) | OAuth session invalid | Tell user to run `vit login <handle> --reset` | 125 + | Session errors (deleted/expired) | OAuth session invalid | Tell user to run `vit login <handle>` | 126 126 | Invalid ref format | Ref doesn't match `^[a-z]+-[a-z]+-[a-z]+$` | Use three lowercase words joined by hyphens | 127 127 128 128 ## 7. Data Files
+8 -6
src/cmd/login.js
··· 5 5 import { spawn } from 'node:child_process'; 6 6 import { createInterface } from 'node:readline'; 7 7 import { loadConfig, saveConfig } from '../lib/config.js'; 8 - import { createOAuthClient, createSessionStore, createStore } from '../lib/oauth.js'; 8 + import { createOAuthClient, createSessionStore, createStore, restoreAgent } from '../lib/oauth.js'; 9 9 10 10 export default function register(program) { 11 11 program ··· 13 13 .description('Log in to Bluesky via browser-based OAuth') 14 14 .argument('<handle>', 'Bluesky handle (e.g. alice.bsky.social)') 15 15 .option('-v, --verbose', 'Show discovery details') 16 - .option('--reset', 'Force re-login even if credentials are valid') 16 + .option('--force', 'Force re-login, skip session validation') 17 17 .option('--remote', 'Skip browser launch; prompt to paste callback URL (auto-detected over SSH)') 18 18 .option('--browser <command>', 'Browser command to use (e.g. firefox)') 19 19 .action(async (handle, opts) => { 20 - const { verbose, reset, remote, browser } = opts; 20 + const { verbose, force, remote, browser } = opts; 21 21 const isRemote = remote || !!(process.env.SSH_CONNECTION || process.env.SSH_TTY || process.env.SSH_CLIENT); 22 22 handle = handle.replace(/^@/, ''); 23 23 24 - if (!reset) { 24 + if (!force) { 25 25 const existing = loadConfig(); 26 26 if (existing.did) { 27 - const session = await createSessionStore().get(existing.did); 28 - if (session) { 27 + try { 28 + await restoreAgent(existing.did); 29 29 console.log(`Already logged in as ${existing.did}`); 30 30 return; 31 + } catch { 32 + // session invalid - fall through to OAuth 31 33 } 32 34 } 33 35 }
+2 -2
test/login.test.js
··· 12 12 expect(stdout).toContain('--browser'); 13 13 }); 14 14 15 - test('--help shows --reset option', () => { 15 + test('--help shows --force option', () => { 16 16 const { stdout, exitCode } = run('login --help'); 17 17 expect(exitCode).toBe(0); 18 - expect(stdout).toContain('--reset'); 18 + expect(stdout).toContain('--force'); 19 19 }); 20 20 21 21 test('requires handle argument', () => {