Skip to content

feat(cli): add folder CRUD commands (create/update/delete)#40

Merged
nocoo merged 4 commits into
mainfrom
feat/folder-crud-cli
May 15, 2026
Merged

feat(cli): add folder CRUD commands (create/update/delete)#40
nocoo merged 4 commits into
mainfrom
feat/folder-crud-cli

Conversation

@nocoo
Copy link
Copy Markdown
Owner

@nocoo nocoo commented May 15, 2026

Closes #38

Summary

Adds zhe folder create / update / delete so folders can be managed entirely from the CLI without the web UI.

zhe folder create <name> [--icon <emoji>]
zhe folder update <name|id> [--name <new>] [--icon <emoji>]
zhe folder delete <name|id> [--yes]

The plural zhe folders (list-only) is unchanged. <name|id> accepts either a folder name or a UUID via the existing resolveFolderName helper. delete refuses to run without --yes when stdin is not a TTY.

Changes

  • cli/src/api/types.tsFolderDetail, FolderResponse, CreateFolderRequest, UpdateFolderRequest. Single-folder responses use FolderDetail because the API only returns linkCount on the list endpoint.
  • cli/src/api/client.tscreateFolder, updateFolder, deleteFolder methods.
  • cli/src/commands/folder.ts — new folderCommand with three subcommands, mirroring the auth/error/confirm style of commands/idea.ts and commands/delete.ts.
  • cli/src/index.ts — register folder alongside existing folders.
  • cli/tests/api-client.test.ts — 8 new unit tests covering happy paths and 400/404 errors.

Verification

  • bun run typecheck
  • bun run build
  • bun run test ✅ (104 passed, 1 skipped — was 96)
  • node dist/index.js folder --help and per-subcommand --help render correctly.

Pre-commit hooks (typecheck + eslint + gitleaks) ran on each of the 3 atomic commits.

nocoo and others added 4 commits May 15, 2026 08:27
Add createFolder, updateFolder, deleteFolder methods on ApiClient
plus the supporting types (FolderDetail, FolderResponse,
CreateFolderRequest, UpdateFolderRequest) for the v1 /folders
endpoints. Single-folder responses use FolderDetail because the
API does not include linkCount on POST/PATCH/GET-by-id (only the
list endpoint computes it).

Refs: GH #38
New `zhe folder` subcommand with:

  zhe folder create <name> [--icon <emoji>]
  zhe folder update <name|id> [--name <new>] [--icon <emoji>]
  zhe folder delete <name|id> [--yes]

The plural `zhe folders` (list-only) is preserved unchanged. Each
new subcommand supports --json for machine-readable output and
mirrors the auth/error-handling style of the existing folders and
idea commands.

Folder references accept either a name or a UUID via the existing
resolveFolderName helper. delete refuses to run without --yes when
stdin is not a TTY, to prevent accidental scripted deletions.

Closes GH #38
Cover createFolder (with icon, without icon, 400 error),
updateFolder (full body, name-only, 404 error), and deleteFolder
(success, 404 error). 8 new tests, all passing alongside the
existing 96.

Refs: GH #38
Merge type imports, adjust confirm() call formatting per Biome rules.
@nocoo nocoo merged commit 8991945 into main May 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add folder CRUD commands (create/update/delete)

1 participant