mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-06 14:00:09 +02:00
## Summary Adds per-user `profile_description` so coding agents have cheap, durable context about who is asking. v1 per the brief Xeon locked in on [MUL-2406](mention://issue/63a7247c-4f6a-42cf-90d1-7c746e77158a): - **DB** — `user.profile_description TEXT NOT NULL DEFAULT ''` (migration 096). 2000-rune cap enforced server-side. No nullable / privacy state to manage. - **API** — `PATCH /api/me` accepts the field; `UserResponse` always emits it. Client wraps `updateMe` in a lenient `UserSchema` + `EMPTY_USER` fallback per CLAUDE.md API Response Compatibility. - **UI** — Settings → Account gains an "About you" textarea with live `n/2000` counter, `maxLength` guard, and a localized too-long error (EN + zh-Hans). - **CLI** — `multica user profile get` / `multica user profile update` with `--description / --description-stdin / --description-file / --clear`, mirroring the existing `issue comment add` input-mode menu. - **Daemon injection** — claim handler resolves the runtime owner and stamps `requesting_user_name` + `requesting_user_profile_description` on the task. `buildMetaSkillContent` emits `## Requesting User` between `## Agent Identity` and `## Available Commands`, blockquoted and framed as background context. The block is omitted entirely when the description is empty (no token cost when unused). Brief is written **once per task** via `CLAUDE.md` / `AGENTS.md`, not the per-turn prompt — same path the agent already reads for identity, so no extra per-turn cost. ## Test plan - [x] `go build ./...`, `go vet ./...`, `go test ./internal/cli/ ./internal/daemon/ ./internal/daemon/execenv/ ./cmd/multica/` - [x] New brief tests: `TestBuildMetaSkillContentEmitsRequestingUser`, `TestBuildMetaSkillContentOmitsRequestingUserWhenEmpty` - [x] `pnpm typecheck`, `pnpm lint`, `pnpm test` (74 files, 644 tests pass) - [ ] Handler DB tests (`TestUpdateMe*`) require a migrated test DB — not runnable in this sandbox - [ ] Manual: open Settings → Account, set a description, confirm the next daemon-run agent's `CLAUDE.md` shows `## Requesting User`
60 lines
1.7 KiB
SQL
60 lines
1.7 KiB
SQL
-- name: GetUser :one
|
|
SELECT * FROM "user"
|
|
WHERE id = $1;
|
|
|
|
-- name: GetUserByEmail :one
|
|
SELECT * FROM "user"
|
|
WHERE email = $1;
|
|
|
|
-- name: CreateUser :one
|
|
INSERT INTO "user" (name, email, avatar_url)
|
|
VALUES ($1, $2, $3)
|
|
RETURNING *;
|
|
|
|
-- name: UpdateUser :one
|
|
UPDATE "user" SET
|
|
name = COALESCE($2, name),
|
|
avatar_url = COALESCE($3, avatar_url),
|
|
language = COALESCE($4, language),
|
|
profile_description = COALESCE(sqlc.narg('profile_description'), profile_description),
|
|
updated_at = now()
|
|
WHERE id = $1
|
|
RETURNING *;
|
|
|
|
-- name: MarkUserOnboarded :one
|
|
UPDATE "user" SET
|
|
onboarded_at = COALESCE(onboarded_at, now()),
|
|
updated_at = now()
|
|
WHERE id = $1
|
|
RETURNING *;
|
|
|
|
-- name: PatchUserOnboarding :one
|
|
UPDATE "user" SET
|
|
onboarding_questionnaire = COALESCE(sqlc.narg('questionnaire'), onboarding_questionnaire),
|
|
updated_at = now()
|
|
WHERE id = sqlc.arg('id')
|
|
RETURNING *;
|
|
|
|
-- name: JoinCloudWaitlist :one
|
|
-- Records interest in cloud runtimes. Does NOT mark onboarding
|
|
-- complete — the user still has to pick a real path (CLI / Skip)
|
|
-- in Step 3. Repeating the call overwrites email + reason.
|
|
UPDATE "user" SET
|
|
cloud_waitlist_email = $2,
|
|
cloud_waitlist_reason = $3,
|
|
updated_at = now()
|
|
WHERE id = $1
|
|
RETURNING *;
|
|
|
|
-- name: SetStarterContentState :one
|
|
-- Atomically transition starter_content_state. The handler is
|
|
-- responsible for checking the current value first (to decide between
|
|
-- "transition NULL -> imported and run the seeding" vs "already
|
|
-- decided, short-circuit"). Using COALESCE here would swallow the
|
|
-- transition, so this is a straight assignment.
|
|
UPDATE "user" SET
|
|
starter_content_state = $2,
|
|
updated_at = now()
|
|
WHERE id = $1
|
|
RETURNING *;
|