7f4decee26
- Add `kb reindex` command with confirmation prompt and --yes flag - Add implicit note shorthand: `kb "my note"` submits a note directly - Rename `add` to `addfile`, remove --note/--title/--type flags - Add client-side file extension validation before upload - Add `kb examples` command for common usage patterns - Update README, SKILL.md, and main specs - Archive completed changes and sync delta specs BREAKING: `kb add` renamed to `kb addfile`, `kb add --note` replaced by `kb "text"` Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
44 lines
2.3 KiB
Markdown
44 lines
2.3 KiB
Markdown
## Context
|
|
|
|
The `add` command currently handles both file uploads and notes via a `--note` string flag. This creates confusing flag parsing and a muddled help screen. The engine already auto-detects file type from extension (`detector.py`) and rejects unsupported ones, so the client's `--type` flag is redundant.
|
|
|
|
## Goals / Non-Goals
|
|
|
|
**Goals:**
|
|
- `kb "my note"` as the sole note entry path (replaces `kb add --note`)
|
|
- `kb addfile <path>` as a file-only upload command (replaces `kb add`)
|
|
- Client-side extension validation before uploading
|
|
- Clean, unambiguous help text for both paths
|
|
|
|
**Non-Goals:**
|
|
- Engine changes — type detection stays server-side
|
|
- Backward compatibility shim for `kb add` — clean break
|
|
- Client-side MIME type detection — extension check is sufficient
|
|
|
|
## Decisions
|
|
|
|
### Rename add → addfile, strip note/type flags
|
|
|
|
Rename the cobra command from `add` to `addfile`. Remove `--note`, `--title`, and `--type` flags. Keep `--tags`, `--recursive`. The command becomes purely about file uploads.
|
|
|
|
**Why not keep `add` as an alias?** Clean break is simpler. The old form was confusing — better to force a quick migration than maintain two paths.
|
|
|
|
### Extension validation on single file uploads
|
|
|
|
The `supportedExts` map already gates recursive walks. Apply the same check to single file uploads — reject with a clear error listing supported extensions. This gives instant feedback instead of a round-trip to the engine.
|
|
|
|
### Root command RunE for note shorthand
|
|
|
|
Use cobra's `Args: cobra.ArbitraryArgs` and `RunE` on the root command. When args are present and no subcommand matched, join all args into a single note string and submit. `--tags` flag on root for tagging notes. No `--title` — keep it minimal.
|
|
|
|
**Why join all args?** `kb remember to update dns` (unquoted) should work the same as `kb "remember to update dns"`.
|
|
|
|
### Reuse note submission logic via shared helper
|
|
|
|
Extract `submitNote` from the current `runAdd` so both the root command and any future callers use the same POST + duplicate-handling + output logic.
|
|
|
|
## Risks / Trade-offs
|
|
|
|
- **Breaking change** → Anyone with `kb add` in scripts needs to update to `kb addfile`. Acceptable for a personal tool.
|
|
- **No `--type` override** → If a user ever needs to force a type, they'd have to go through the engine API directly. Low risk since the engine's auto-detection covers all supported formats.
|