CLI: add 'jss account delete' + refactor 'passwd' (#292)#293
Merged
melvincarvalho merged 1 commit intoApr 22, 2026
Merged
Conversation
…avaScriptSolidServer#292) Two related changes: 1. New `jss account delete <username>` subcommand. Calls accounts.deleteAccount() (the existing internal API) which already prunes the username/email/webId indexes and removes the account JSON. Adds a --yes flag (skip confirm prompt) and an opt-in --purge flag (also remove pod data at <dataRoot>/<username>/). Without --purge: account record removed, pod data preserved. With --purge: fully clean, username can be re-registered. The --purge flag is opt-in because account deletion revokes identity (recoverable), but pod data removal is destructive (irreversible). Operators choose the level of cleanup. 2. Refactor `jss passwd <username>` to use the same accounts.js wrappers (findByUsername + updatePassword) instead of duplicating the index lookup and bcrypt hashing inline. Same external behaviour, ~40 fewer lines, one source of truth for the hashing parameters. Manual smoke test against a fresh --idp server: register / delete / re-register works; --purge frees the username; plain delete preserves pod data; passwd still works post-refactor. Existing 398-test suite passes (CLI commands aren't unit-tested anywhere in the repo today). Fixes JavaScriptSolidServer#292
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #292.
Two related changes
1. `jss account delete ` (new)
Wraps the existing `accounts.deleteAccount(id)` (which already prunes the username/email/webId indexes and removes the account JSON) behind a CLI surface. Operators no longer need to hand-edit JSON to drop an account.
```
jss account delete melvin # confirm prompt, account record only
jss account delete melvin --yes # skip prompt
jss account delete melvin --yes --purge # also remove /melvin/
```
`--purge` is opt-in because the two destructive levels are genuinely different:
Default behaviour preserves pod data so you can re-bind a different account later or back it up before deletion. `--purge` is for the clean-slate case (which my smoke test confirmed lets you re-register the same username afterward).
2. `jss passwd` refactored to use the wrapper
Same external behaviour, but the body now calls `findByUsername` + `updatePassword` from `src/idp/accounts.js` instead of duplicating the index lookup and bcrypt hashing inline. ~40 fewer lines, single source of truth for the hashing parameters (`SALT_ROUNDS` lives in `accounts.js`; `passwd` no longer hard-codes `10`).
This brings `passwd` into the same shape as `invite` / `quota` / the new `account delete` — every CLI command consumes its corresponding `src/` module instead of re-implementing internals.
Files
Single file: `bin/jss.js` (+58, -31).
Test plan
Non-goals