Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/skills
2 changes: 1 addition & 1 deletion .cursor/skills
21 changes: 11 additions & 10 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ Do not add these to v1 without revisiting the project docs:

Tooling-specific paths are symlinks:

- `.cursor/skills` -> `.agents`
- `.claude/skills` -> `.agents`
- `.cursor/skills` -> `.agents/skills`
- `.claude/skills` -> `.agents/skills`
- `CLAUDE.md` -> `AGENTS.md`

After cloning or when links are missing, run:
Expand All @@ -123,20 +123,21 @@ After cloning or when links are missing, run:
./scripts/sync-agent-links.sh
```

Add or edit skills only under `.agents/<skill-name>/SKILL.md`. Do not create
real directories at `.cursor/skills` or `.claude/skills`.
Add or edit skills only under `.agents/skills/<skill-name>/SKILL.md`. Do not
create real directories at `.cursor/skills` or `.claude/skills`.

## Skill Usage

Project skills live under `.agents/` so any agent tooling can discover them.
Project skills live under `.agents/skills/` so any agent tooling can discover
them.

- Use `.agents/design-system-component/SKILL.md` when adding or changing
- Use `.agents/skills/design-system-component/SKILL.md` when adding or changing
design-system tokens, typography, reusable components, component variants,
previews, or gallery entries.
- Use `.agents/synced-native-feature/SKILL.md` when planning or implementing a
feature that should exist in both native apps.
- Use `.agents/run-github-actions/SKILL.md` when triggering GitHub Actions,
checking workflow status, or troubleshooting failed CI runs.
- Use `.agents/skills/synced-native-feature/SKILL.md` when planning or
implementing a feature that should exist in both native apps.
- Use `.agents/skills/run-github-actions/SKILL.md` when triggering GitHub
Actions, checking workflow status, or troubleshooting failed CI runs.

## Documentation Rules

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This repository holds both app shells, shared product docs, design-system planni
| `android/` | Kotlin, Jetpack Compose, Material 3 app |
| `ios/OpenCode Mobile/` | SwiftUI app |
| `docs/` | Architecture, feasibility, design system, feature slices |
| `.agents/` | Shared agent skills (source of truth) |
| `.agents/` | Shared agent guidance and canonical skills under `.agents/skills/` |
| `scripts/` | Icon sync, OpenAPI fetch/generate, agent symlink setup |
| `AGENTS.md` | Agent and contributor guide |

Expand Down Expand Up @@ -84,13 +84,13 @@ After cloning, run `./scripts/sync-agent-links.sh` if agent symlinks are missing

## Agent skills

Skills live in `.agents/` and are symlinked for Cursor and Claude:
Skills live in `.agents/skills/` and are symlinked for Cursor and Claude:

```bash
./scripts/sync-agent-links.sh
```

`AGENTS.md` and `CLAUDE.md` share the same content. Edit skills under `.agents/<skill-name>/SKILL.md` only.
`AGENTS.md` and `CLAUDE.md` share the same content. Edit skills under `.agents/skills/<skill-name>/SKILL.md` only.

## V1 scope (summary)

Expand Down
3 changes: 3 additions & 0 deletions android/app/src/main/java/dev/opencode/mobile/Navigation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import dev.opencode.mobile.ui.componentgallery.components.ChoiceBadgeGalleryScre
import dev.opencode.mobile.ui.componentgallery.components.IconsGalleryScreen
import dev.opencode.mobile.ui.componentgallery.components.ListItemGalleryScreen
import dev.opencode.mobile.ui.componentgallery.components.OutgoingMessageGalleryScreen
import dev.opencode.mobile.ui.componentgallery.components.ProjectSessionSelectorGalleryScreen
import dev.opencode.mobile.ui.componentgallery.components.TopBarGalleryScreen
import dev.opencode.mobile.ui.componentgallery.foundation.ColorGalleryScreen
import dev.opencode.mobile.ui.componentgallery.foundation.TypographyGalleryScreen
Expand Down Expand Up @@ -132,6 +133,8 @@ fun MainNavigation() {
ComponentGalleryEntryId.ListItem -> ListItemGalleryScreen()
ComponentGalleryEntryId.ChoiceBadge -> ChoiceBadgeGalleryScreen()
ComponentGalleryEntryId.Button -> ButtonGalleryScreen()
ComponentGalleryEntryId.ProjectSessionSelector ->
ProjectSessionSelectorGalleryScreen()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import io.ktor.client.plugins.ResponseException
import io.ktor.serialization.JsonConvertException
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonPrimitive
import java.time.Instant
import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.util.Locale

class SessionDomainAdapter {
fun toSession(dto: SessionDto): Session =
Expand All @@ -23,7 +27,13 @@ class SessionDomainAdapter {
fun toSessionSummary(
session: Session,
statusLabel: String? = null,
): SessionSummary = SessionSummary(id = session.id, title = session.title, statusLabel = statusLabel)
): SessionSummary =
SessionSummary(
id = session.id,
title = session.title,
statusLabel = statusLabel,
updatedAtLabel = session.updatedAtEpochMs?.let(::updatedAtLabel),
)

fun toSessionStatus(
sessionId: String,
Expand Down Expand Up @@ -56,4 +66,16 @@ class SessionDomainAdapter {
is JsonConvertException -> SessionError.Decoding(throwable)
else -> SessionError.Transport(throwable)
}

private fun updatedAtLabel(epochMs: Long): String =
Instant
.ofEpochMilli(epochMs)
.atZone(ZoneId.systemDefault())
.format(updatedAtFormatter)

private companion object {
val updatedAtFormatter: DateTimeFormatter =
DateTimeFormatter
.ofPattern("MMM d • h:mm a", Locale.US)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ data class SessionSummary(
val id: String,
val title: String,
val statusLabel: String? = null,
val updatedAtLabel: String? = null,
)

data class SessionStatus(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ enum class ComponentGalleryEntryId {
ListItem,
ChoiceBadge,
Button,
ProjectSessionSelector,
}

data class ComponentGalleryEntry(
Expand Down Expand Up @@ -85,4 +86,10 @@ val ComponentGalleryEntries =
description = "Reusable action component with text and icon variants.",
category = ComponentGalleryCategory.Components,
),
ComponentGalleryEntry(
id = ComponentGalleryEntryId.ProjectSessionSelector,
title = "Project Session Selector",
description = "Project-scoped session picker with project tiles and session actions.",
category = ComponentGalleryCategory.Components,
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import dev.opencode.mobile.ui.components.OpenCodeButton
import dev.opencode.mobile.ui.components.OpenCodeButtonContrast
import dev.opencode.mobile.ui.components.OpenCodeButtonSize
import dev.opencode.mobile.ui.components.OpenCodeButtonVariant
import dev.opencode.mobile.ui.components.OpenCodeChoiceBadge
import dev.opencode.mobile.ui.icons.OpenCodeIcons
Expand All @@ -29,6 +30,7 @@ private enum class GalleryButtonVariant {
@Composable
fun ButtonGalleryScreen(modifier: Modifier = Modifier) {
var variantName by rememberSaveable { mutableStateOf(GalleryButtonVariant.FullWidthText.name) }
var sizeName by rememberSaveable { mutableStateOf(OpenCodeButtonSize.Medium.name) }
var contrastName by rememberSaveable { mutableStateOf(OpenCodeButtonContrast.High.name) }
var enabled by rememberSaveable { mutableStateOf(true) }

Expand All @@ -53,6 +55,13 @@ fun ButtonGalleryScreen(modifier: Modifier = Modifier) {
OpenCodeButtonContrast.High
}

val sizeSelection =
try {
OpenCodeButtonSize.valueOf(sizeName)
} catch (_: IllegalArgumentException) {
OpenCodeButtonSize.Large
}

Column(modifier = modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(16.dp)) {
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(text = "Button", style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.onSurface)
Expand Down Expand Up @@ -91,10 +100,25 @@ fun ButtonGalleryScreen(modifier: Modifier = Modifier) {
}
}

Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
OpenCodeButtonSize.entries.forEach { option ->
OpenCodeChoiceBadge(
label =
when (option) {
OpenCodeButtonSize.Large -> "Large"
OpenCodeButtonSize.Medium -> "Medium"
},
selected = option == sizeSelection,
onClick = { sizeName = option.name },
)
}
}

OpenCodeButton(
variant = variant,
enabled = enabled,
contrast = contrastSelection,
size = sizeSelection,
onClick = {},
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
package dev.opencode.mobile.ui.componentgallery.components

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import dev.opencode.mobile.theme.LetterAccent
import dev.opencode.mobile.ui.components.OpenCodeChoiceBadge
import dev.opencode.mobile.ui.components.ProjectSessionSelector
import dev.opencode.mobile.ui.components.ProjectSessionSelectorProject
import dev.opencode.mobile.ui.components.ProjectSessionSelectorSession

@Composable
fun ProjectSessionSelectorGalleryScreen(modifier: Modifier = Modifier) {
var scenario by rememberSaveable { mutableStateOf(ProjectSessionSelectorScenario.Normal.name) }
var selectedWorktree by rememberSaveable { mutableStateOf(projectSessionSelectorSampleProjects.first().worktree) }
val selectedScenario = ProjectSessionSelectorScenario.valueOf(scenario)
val projects = selectedScenario.projects

LaunchedEffect(scenario) {
if (projects.none { it.worktree == selectedWorktree }) {
selectedWorktree = projects.firstOrNull()?.worktree.orEmpty()
}
}

Column(modifier = modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(16.dp)) {
Text(text = "Scenario", style = MaterialTheme.typography.titleMedium)
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
ProjectSessionSelectorScenario.entries.chunked(2).forEach { row ->
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
row.forEach { option ->
OpenCodeChoiceBadge(
label = option.label,
selected = selectedScenario == option,
onClick = { scenario = option.name },
)
}
}
}
}

Text(text = "Selected project", style = MaterialTheme.typography.titleMedium)
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
projects.chunked(2).forEach { row ->
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
row.forEach { project ->
OpenCodeChoiceBadge(
label = project.displayName,
selected = selectedWorktree == project.worktree,
onClick = { selectedWorktree = project.worktree },
)
}
}
}
}

ProjectSessionSelector(
projects = projects,
selectedWorktree = selectedWorktree,
createError = if (selectedScenario == ProjectSessionSelectorScenario.CreateError) "Unable to create session" else null,
onProjectSelected = { selectedWorktree = it },
onBrowseProjects = {},
onSessionSelected = { _, _ -> },
onShowAllSessions = {},
onNewSession = {},
)
}
}

private enum class ProjectSessionSelectorScenario(
val label: String,
) {
Normal("Normal"),
Empty("Empty"),
LoadError("Load error"),
CreateError("Create error"),
;

val projects: List<ProjectSessionSelectorProject>
get() =
when (this) {
Normal, CreateError -> projectSessionSelectorSampleProjects
Empty -> listOf(projectSessionSelectorEmptyProject)
LoadError -> listOf(projectSessionSelectorLoadErrorProject)
}
}

private val projectSessionSelectorSampleSessions =
listOf(
ProjectSessionSelectorSession(id = "session-1", title = "Refactor Navigation", subtitle = "Oct 24 - 2:30 PM"),
ProjectSessionSelectorSession(id = "session-2", title = "Bug: Header Clipping", subtitle = "Oct 23 - 11:45 AM"),
ProjectSessionSelectorSession(id = "session-3", title = "Add Dark Mode Assets", subtitle = "Oct 22 - 4:15 PM"),
ProjectSessionSelectorSession(id = "session-4", title = "Review Session List", subtitle = "Idle"),
)

private val projectSessionSelectorSampleProjects =
listOf(
ProjectSessionSelectorProject(
worktree = "/Users/demo/opencode-mobile",
displayName = "opencode-mobile",
pathSubtitle = "/Users/demo/opencode-mobile",
letter = 'O',
letterAccent = LetterAccent.Violet,
previewSessions = projectSessionSelectorSampleSessions.take(3),
totalSessionCount = projectSessionSelectorSampleSessions.size,
),
ProjectSessionSelectorProject(
worktree = "/Users/demo/playground",
displayName = "playground",
pathSubtitle = "/Users/demo/playground",
letter = 'P',
letterAccent = LetterAccent.Amber,
previewSessions = emptyList(),
totalSessionCount = 0,
),
)

private val projectSessionSelectorEmptyProject =
ProjectSessionSelectorProject(
worktree = "/Users/demo/empty",
displayName = "empty",
pathSubtitle = "/Users/demo/empty",
letter = 'E',
letterAccent = LetterAccent.Teal,
previewSessions = emptyList(),
totalSessionCount = 0,
)

private val projectSessionSelectorLoadErrorProject =
ProjectSessionSelectorProject(
worktree = "/Users/demo/api-client",
displayName = "api-client",
pathSubtitle = "/Users/demo/api-client",
letter = 'A',
letterAccent = LetterAccent.Rose,
previewSessions = emptyList(),
totalSessionCount = 0,
loadError = "Unable to load sessions",
)
Loading