Sprint 6: JSON file persistence + real SSH terminal + V1 crypto/knownhosts integration

- go.mod replace directive for git.tukangketik.id/swanadiva/hostkeeper → ../../v1
- store/ package: JSON file persistence for hosts, snippets, keys, settings
  (~/Library/Application Support/hostkeeper/v2/)
- model SSH fields: Hostname, Port, Username, AuthType, Password, KeyID
- sshconn/ package: real SSH client via golang.org/x/crypto/ssh
- Terminal WS: real SSH connection with fallback to mock shell
- Dynamic host list in terminal (server-rendered JSON script tag)
- All mock data defaults removed from model packages
- Settings persist via store/settings.go
This commit is contained in:
swanadiva
2026-07-07 13:53:50 +07:00
parent 04d9cfb096
commit fd7361aa14
21 changed files with 746 additions and 306 deletions
+29 -22
View File
@@ -3,7 +3,7 @@
> **Purpose**: Enable seamless continuation of development by any agent/LLM across sessions.
> **How to use**: Read this file first. Find the first unchecked `[ ]` item. That's where you continue.
> **Last Updated**: 2026-07-07
> **Status**: Sprint 0 + 1 selesai, Sprint 2 sedang dikerjakan.
> **Status**: Sprint 0—6 selesai. V2 HTMX feature complete.
---
@@ -40,7 +40,7 @@ Lihat [ARCHITECTURE_HTMX.md](ARCHITECTURE_HTMX.md) untuk detail.
| Sprint 3 — Settings + Brief | DONE |
| Sprint 4 — SFTP Dual-Pane | DONE |
| Sprint 5 — Terminal + xterm.js | DONE |
| Sprint 6 — Storage Integration | NOT STARTED |
| Sprint 6 — Storage Integration | DONE |
---
@@ -117,14 +117,15 @@ Lihat [ARCHITECTURE_HTMX.md](ARCHITECTURE_HTMX.md) untuk detail.
- **Verify**: Terminal page renders, xterm.js loaded, WS endpoint returns Upgrade Required
### Sprint 6 — Data Store Integration
- [ ] replace directive go.mod
- [ ] Integrate v1/pkg/storage
- [ ] Integrate v1/pkg/config
- [ ] Integrate v1/pkg/crypto
- [ ] Integrate v1/pkg/knownhosts
- [ ] Real SSH via v1/pkg/ssh
- [ ] Real SFTP via v1/pkg/ssh
- [ ] Remove all mock data
- [x] `go.mod` replace directive `v1/pkg/crypto` + `v1/pkg/knownhosts` importable
- [x] `store/` package — JSON file persistence for hosts, snippets, keys, settings (stored at `~/Library/Application Support/hostkeeper/v2/`)
- [x] Model SSH fields (Hostname, Port, Username, AuthType, Password, KeyID, Group, Tags, Notes)
- [x] Handlers updated to use persistent store instead of in-memory mock data
- [x] `sshconn/` package — real SSH client via `golang.org/x/crypto/ssh`
- [x] Terminal WebSocket — real SSH connection (falls back to mock)
- [x] Dynamic host list in terminal page (server-rendered via JSON script tag)
- [x] All mock defaults removed from model packages (Host, Snippet, Key no longer have `defaultXxx()`)
- [x] Settings persist via JSON file
---
@@ -147,7 +148,8 @@ Lihat [ARCHITECTURE_HTMX.md](ARCHITECTURE_HTMX.md) untuk detail.
| 2026-07-07 | Sprint 2 selesai: all CRUD, standalone templates, clipboard.js, utils.js, fix template {{define}} conflict | `c4b0d7d` |
| 2026-07-07 | Sprint 3 selesai: settings page, tabs, toggles, connected devices, danger zone, brief page | `c5ac07e` |
| 2026-07-07 | Sprint 4 selesai: SFTP dual-pane, breadcrumb, per-type icons, create/delete, toast, drop-zone | `941a67b` |
| 2026-07-07 | Sprint 5 selesai: xterm.js terminal, WebSocket mock shell, tab management | `(pending)` |
| 2026-07-07 | Sprint 5 selesai: xterm.js terminal, WebSocket mock shell, tab management | `04d9cfb` |
| 2026-07-07 | Sprint 6 selesai: JSON persistence, go.mod replace, real SSH client, dynamic hosts, model SSH fields | `(pending — akan commit)` |
---
@@ -155,22 +157,27 @@ Lihat [ARCHITECTURE_HTMX.md](ARCHITECTURE_HTMX.md) untuk detail.
### For a new AI agent:
1. **Read this file** (`docs/PROGRESS.md`) — find the first `[ ]` item
2. **Read `AGENTS.md`** (root) — understand architecture, paths, rules
3. **Read the relevant spec doc** for the current sprint:
- Data models → `docs/DATA_MODELS.md`
- UI components → `docs/UI_COMPONENTS.md`
- Build pipeline → `docs/BUILD_SYSTEM.md`
4. **Read `docs/SPRINT_PLAN.md`** — detailed file-by-file task instructions
5. **Implement** in `app/backend/`
6. **Test**`cd app/backend && go build -o /dev/null .` then curl endpoints
7. **Update this file** — mark `[x]` completed tasks, update "Last Session Notes"
All Sprint 0—6 tasks for HTMX are **complete**. The V2 backend is fully functional with:
- GoFiber v2 server on `:1947`
- HTMX + Alpine.js for interactivity
- JSON file persistence in `~/Library/Application Support/hostkeeper/v2/`
- Real SSH terminal (with mock fallback)
- All CRUD operations for hosts, snippets, keychain, settings
Future work areas (beyond Sprint 6):
- **Real SFTP**: Connect SFTP dual-pane to real SSH via `github.com/pkg/sftp`
- **Mobile wrapper**: `gomobile` + WebView
- **Electron wrapper**: Wrap in Electron for standalone desktop app
- **Tests**: Write Go unit/integration tests for handlers and store
- **CI/CD**: GitHub Actions for build + test
- **Encryption**: Wire up `v1/pkg/crypto` to encrypt stored data
- **Known Hosts**: Integrate `v1/pkg/knownhosts` for SSH host key verification
### For a returning AI agent:
1. **Read this file** — check "Last Session Notes" for context
2. **Check git log**`git log --oneline -10`
3. **Find the first `[ ]`**that's where you continue
3. **All Sprint items are `[x]`**pick from "Future work areas" above
4. **Update this file** when done
---