Compare commits

..

10 commits

Author SHA1 Message Date
Paweł Orzech
28b03893bc
Merge pull request #2 from pawelorzech/codex/agents1
Add AGENTS instructions for FastMemos project
2026-02-04 13:52:57 +01:00
Paweł Orzech
9662343184
Add AGENTS build instructions 2026-02-04 13:52:14 +01:00
Paweł Orzech
0301b98160
Merge pull request #1 from pawelorzech/add-claude-github-actions-1770208704492
Add Claude Code GitHub Workflow
2026-02-04 13:38:48 +01:00
Paweł Orzech
bb697c3e58 "Claude Code Review workflow" 2026-02-04 13:38:27 +01:00
Paweł Orzech
96f0a951fd "Claude PR Assistant workflow" 2026-02-04 13:38:25 +01:00
Paweł Orzech
524f3790c9
build: bump marketing version to 1.0.3 2026-01-18 21:59:18 +00:00
Paweł Orzech
d3252d8599
chore: remove release artifact from repo 2026-01-18 03:31:41 +00:00
Paweł Orzech
84f413fdcf
build: bump marketing version to 1.0.2 2026-01-18 03:29:55 +00:00
Paweł Orzech
bf916bf636
feat: Implement custom text view with placeholder, disable focus rings, and add Cmd+W to close the note window. 2026-01-18 03:27:30 +00:00
Paweł Orzech
3d710b8eeb
chore: release v1.0.1 with CLAUDE.md documentation
Update release artifact to 1.0.1 and add Claude Code guidance file.
2026-01-18 03:05:16 +00:00
13 changed files with 459 additions and 67 deletions

View file

@ -0,0 +1,44 @@
name: Claude Code Review
on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
# Optional: Only run on specific file changes
# paths:
# - "src/**/*.ts"
# - "src/**/*.tsx"
# - "src/**/*.js"
# - "src/**/*.jsx"
jobs:
claude-review:
# Optional: Filter by PR author
# if: |
# github.event.pull_request.user.login == 'external-contributor' ||
# github.event.pull_request.user.login == 'new-developer' ||
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
plugins: 'code-review@claude-code-plugins'
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options

50
.github/workflows/claude.yml vendored Normal file
View file

@ -0,0 +1,50 @@
name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
actions: read # Required for Claude to read CI results on PRs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
# prompt: 'Update the pull request description to include a summary of changes.'
# Optional: Add claude_args to customize behavior and configuration
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
# claude_args: '--allowed-tools Bash(gh pr:*)'

22
AGENTS.md Normal file
View file

@ -0,0 +1,22 @@
# AGENTS
## Requirements
- macOS 13.0+ (Ventura)
- Xcode 15+
- Access to a self-hosted Memos instance for runtime testing
## Build
- Open `FastMemos.xcodeproj` in Xcode and build with `⌘B`
- CLI build:
```bash
xcodebuild -project FastMemos.xcodeproj -scheme FastMemos -configuration Debug build
```
## Run
```bash
xcodebuild -project FastMemos.xcodeproj -scheme FastMemos -configuration Debug build
open ./build/Debug/FastMemos.app
```
## TODO
- Document any additional workflows or scripts not covered in README/CLAUDE.

65
CLAUDE.md Normal file
View file

@ -0,0 +1,65 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Build & Development
This is a native macOS SwiftUI app. Open `FastMemos.xcodeproj` in Xcode and build with `⌘B`.
From the command line:
```bash
xcodebuild -project FastMemos.xcodeproj -scheme FastMemos -configuration Debug build
```
To run:
```bash
xcodebuild -project FastMemos.xcodeproj -scheme FastMemos -configuration Debug build
open ./build/Debug/FastMemos.app
```
**Requirements:** macOS 13.0+ (Ventura), Xcode 15+
## Architecture
FastMemos is a menubar-only macOS app for quickly capturing notes to a self-hosted [Memos](https://github.com/usememos/memos) server.
### Key Components
**Entry Point (`FastMemosApp.swift`):**
- `AppDelegate` sets up the menubar status item and popover
- App runs as `.accessory` (no dock icon)
- Global hotkey (⌘⇧M) triggers `showNoteWindow()`
- `NotePanel` is a floating `NSPanel` for the note capture UI
**State Management:**
- `AppState` (in `ViewModels/`) is the single source of truth, passed to all views
- Publishes: `isLoggedIn`, `serverURL`, `defaultVisibility`, `isLoading`, `lastError`, `launchAtLogin`
- Handles authentication flow and memo creation
**Services (in `Services/`):**
- `MemosAPIService` - Communicates with Memos v1 API (`/api/v1/memos`, `/api/v1/auth/status`)
- `KeychainService` - Stores access tokens securely in macOS Keychain (service: `me.orzech.FastMemos`)
- `ShortcutService` - Registers global hotkey using Carbon Events API
**Views (in `Views/`):**
- `MenuBarView` - Main popover shown from menubar icon
- `NoteWindowView` - Floating note capture panel with visibility picker
- `LoginView` - Access token authentication flow
- `SettingsView` - App preferences (visibility, launch at login)
**Models (in `Models/`):**
- `Memo`, `CreateMemoRequest` - API request/response structures
- `MemoVisibility` - Enum: `.private`, `.protected`, `.public`
### Data Flow
1. User triggers hotkey → `AppDelegate.showNoteWindow()``NotePanel` appears
2. User writes note, selects visibility, presses ⌘Enter
3. `NoteWindowView.submitMemo()``AppState.createMemo()``MemosAPIService.createMemo()`
4. Token from `KeychainService` is used for Bearer auth
### Settings Storage
- `UserDefaults`: `serverURL`, `defaultVisibility`, `shortcutKeyCode`, `shortcutModifiers`
- Keychain: `accessToken`, `username`
- `SMAppService.mainApp` for launch at login

Binary file not shown.

View file

@ -10,6 +10,8 @@
<string>FastMemos</string> <string>FastMemos</string>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string>AppIcon</string> <string>AppIcon</string>
<key>CFBundleIconName</key>
<string>AppIcon</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>me.orzech.FastMemos</string> <string>me.orzech.FastMemos</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
@ -19,7 +21,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0.0</string> <string>1.0.1</string>
<key>CFBundleSupportedPlatforms</key> <key>CFBundleSupportedPlatforms</key>
<array> <array>
<string>MacOSX</string> <string>MacOSX</string>

Binary file not shown.

View file

@ -4,18 +4,29 @@
<dict> <dict>
<key>files</key> <key>files</key>
<dict> <dict>
<key>Resources/AppIcon.icns</key>
<data>
ORGbkp1S899rWbEjZ/tNkVVLdro=
</data>
<key>Resources/Assets.car</key> <key>Resources/Assets.car</key>
<data> <data>
CsD7XkAT/ARWQWJ99BetayOzLlE= cksUAC98EafZIfKsBaoS+aP805o=
</data> </data>
</dict> </dict>
<key>files2</key> <key>files2</key>
<dict> <dict>
<key>Resources/AppIcon.icns</key>
<dict>
<key>hash2</key>
<data>
ME58VQGz3AD9X5q7Xj654HeiGHgQ4D2k8mSLplwLvc4=
</data>
</dict>
<key>Resources/Assets.car</key> <key>Resources/Assets.car</key>
<dict> <dict>
<key>hash2</key> <key>hash2</key>
<data> <data>
k+rxT6Xd2FCQLfhgNlPCgS1IiDV1Klw0FQfNaCX1A3s= m3hT/zd8OdcdoapvIxDo+aPRvDvSej90Wfiy+aU6GlE=
</data> </data>
</dict> </dict>
</dict> </dict>

View file

@ -343,7 +343,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MARKETING_VERSION = 1.0.1; MARKETING_VERSION = 1.0.3;
PRODUCT_BUNDLE_IDENTIFIER = me.orzech.FastMemos; PRODUCT_BUNDLE_IDENTIFIER = me.orzech.FastMemos;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
@ -372,7 +372,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MARKETING_VERSION = 1.0.1; MARKETING_VERSION = 1.0.3;
PRODUCT_BUNDLE_IDENTIFIER = me.orzech.FastMemos; PRODUCT_BUNDLE_IDENTIFIER = me.orzech.FastMemos;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;

View file

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0.0</string> <string>1.0.2</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1</string> <string>1</string>
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>

View file

@ -1,9 +1,40 @@
import SwiftUI import SwiftUI
import AppKit import AppKit
/// Custom NSHostingView that never draws focus ring
class NoFocusRingHostingView<Content: View>: NSHostingView<Content> {
override var focusRingType: NSFocusRingType {
get { .none }
set { }
}
override func drawFocusRingMask() {
// Don't draw focus ring
}
override var focusRingMaskBounds: NSRect {
.zero
}
override func viewDidMoveToWindow() {
super.viewDidMoveToWindow()
// Disable focus ring on all subviews after view hierarchy is set up
DispatchQueue.main.async {
self.disableFocusRingsRecursively(in: self)
}
}
private func disableFocusRingsRecursively(in view: NSView) {
view.focusRingType = .none
for subview in view.subviews {
disableFocusRingsRecursively(in: subview)
}
}
}
/// Floating panel for quick note capture /// Floating panel for quick note capture
class NotePanel: NSPanel { class NotePanel: NSPanel {
private var hostingView: NSHostingView<NoteWindowView>? private var hostingView: NoFocusRingHostingView<NoteWindowView>?
private let appState: AppState private let appState: AppState
override var canBecomeKey: Bool { true } override var canBecomeKey: Bool { true }
@ -30,7 +61,7 @@ class NotePanel: NSPanel {
self.backgroundColor = .clear self.backgroundColor = .clear
self.isOpaque = false self.isOpaque = false
self.hasShadow = true self.hasShadow = true
self.autorecalculatesKeyViewLoop = false
// Set minimum size // Set minimum size
self.minSize = NSSize(width: 400, height: 200) self.minSize = NSSize(width: 400, height: 200)
@ -43,7 +74,7 @@ class NotePanel: NSPanel {
self?.orderOut(nil) self?.orderOut(nil)
}) })
hostingView = NSHostingView(rootView: contentView) hostingView = NoFocusRingHostingView(rootView: contentView)
self.contentView = hostingView self.contentView = hostingView
} }
@ -57,6 +88,176 @@ class NotePanel: NSPanel {
self.center() self.center()
self.makeKeyAndOrderFront(nil) self.makeKeyAndOrderFront(nil)
NSApp.activate(ignoringOtherApps: true) NSApp.activate(ignoringOtherApps: true)
// Disable focus rings on all subviews
DispatchQueue.main.async { [weak self] in
if let contentView = self?.contentView {
Self.disableFocusRingsRecursively(in: contentView)
}
}
}
private static func disableFocusRingsRecursively(in view: NSView) {
view.focusRingType = .none
for subview in view.subviews {
disableFocusRingsRecursively(in: subview)
}
}
}
/// Custom NSTextView with placeholder support and no focus ring
struct PlaceholderTextView: NSViewRepresentable {
@Binding var text: String
let placeholder: String
let font: NSFont
var onSubmit: (() -> Void)?
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
func makeNSView(context: Context) -> NSScrollView {
let scrollView = NoFocusRingScrollView()
scrollView.hasVerticalScroller = true
scrollView.hasHorizontalScroller = false
scrollView.autohidesScrollers = true
scrollView.borderType = .noBorder
scrollView.drawsBackground = false
scrollView.focusRingType = .none
scrollView.contentView.focusRingType = .none
let textView = PlaceholderNSTextView()
textView.delegate = context.coordinator
textView.isRichText = false
textView.allowsUndo = true
textView.font = font
textView.backgroundColor = .clear
textView.drawsBackground = false
textView.isEditable = true
textView.isSelectable = true
textView.focusRingType = .none
textView.textContainerInset = NSSize(width: 0, height: 0)
textView.textContainer?.lineFragmentPadding = 0
// Placeholder setup
textView.placeholderString = placeholder
textView.placeholderFont = font
textView.placeholderColor = NSColor.secondaryLabelColor
// Auto-resize
textView.isVerticallyResizable = true
textView.isHorizontallyResizable = false
textView.autoresizingMask = [.width]
textView.textContainer?.containerSize = NSSize(width: scrollView.contentSize.width, height: .greatestFiniteMagnitude)
textView.textContainer?.widthTracksTextView = true
scrollView.documentView = textView
// Focus the text view and disable focus rings in hierarchy
DispatchQueue.main.async {
textView.window?.makeFirstResponder(textView)
Self.disableFocusRingsRecursively(in: scrollView)
}
return scrollView
}
private static func disableFocusRingsRecursively(in view: NSView) {
view.focusRingType = .none
for subview in view.subviews {
disableFocusRingsRecursively(in: subview)
}
}
func updateNSView(_ scrollView: NSScrollView, context: Context) {
guard let textView = scrollView.documentView as? PlaceholderNSTextView else { return }
if textView.string != text {
textView.string = text
}
textView.needsDisplay = true
}
class Coordinator: NSObject, NSTextViewDelegate {
var parent: PlaceholderTextView
init(_ parent: PlaceholderTextView) {
self.parent = parent
}
func textDidChange(_ notification: Notification) {
guard let textView = notification.object as? NSTextView else { return }
parent.text = textView.string
}
func textView(_ textView: NSTextView, doCommandBy commandSelector: Selector) -> Bool {
// Handle Cmd+Enter for submit
if commandSelector == #selector(NSResponder.insertNewline(_:)) {
if NSEvent.modifierFlags.contains(.command) {
parent.onSubmit?()
return true
}
}
return false
}
}
}
/// Custom NSScrollView that never draws focus ring
class NoFocusRingScrollView: NSScrollView {
override var focusRingType: NSFocusRingType {
get { .none }
set { }
}
override func drawFocusRingMask() {
// Don't draw focus ring
}
override var focusRingMaskBounds: NSRect {
.zero
}
}
/// Custom NSTextView that draws placeholder text
class PlaceholderNSTextView: NSTextView {
var placeholderString: String = ""
var placeholderFont: NSFont = NSFont.systemFont(ofSize: 15)
var placeholderColor: NSColor = NSColor.secondaryLabelColor
override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)
// Draw placeholder if text is empty
if string.isEmpty {
let attributes: [NSAttributedString.Key: Any] = [
.font: placeholderFont,
.foregroundColor: placeholderColor
]
let placeholderRect = NSRect(
x: textContainerInset.width + (textContainer?.lineFragmentPadding ?? 0),
y: textContainerInset.height,
width: bounds.width - textContainerInset.width * 2,
height: bounds.height - textContainerInset.height * 2
)
placeholderString.draw(in: placeholderRect, withAttributes: attributes)
}
}
override var needsPanelToBecomeKey: Bool { true }
override var acceptsFirstResponder: Bool { true }
override var focusRingType: NSFocusRingType {
get { .none }
set { }
}
override func drawFocusRingMask() {
// Don't draw focus ring
}
override var focusRingMaskBounds: NSRect {
.zero
} }
} }
@ -71,31 +272,18 @@ struct NoteWindowView: View {
@State private var showSuccess = false @State private var showSuccess = false
@State private var errorMessage: String? @State private var errorMessage: String?
@FocusState private var isTextEditorFocused: Bool
private let placeholder = "What's on your mind?" private let placeholder = "What's on your mind?"
var body: some View { var body: some View {
VStack(spacing: 0) { VStack(spacing: 0) {
// Main text area // Main text area
ZStack(alignment: .topLeading) { PlaceholderTextView(
// Placeholder text: $content,
if content.isEmpty { placeholder: placeholder,
Text(placeholder) font: NSFont.systemFont(ofSize: 15),
.foregroundColor(.secondary) onSubmit: submitMemo
.padding(.horizontal, 5) )
.padding(.vertical, 8)
.allowsHitTesting(false)
}
// Text editor
TextEditor(text: $content)
.font(.system(size: 15))
.focused($isTextEditorFocused)
.scrollContentBackground(.hidden)
.background(Color.clear)
.frame(minHeight: 150) .frame(minHeight: 150)
}
.padding(16) .padding(16)
// Bottom bar // Bottom bar
@ -182,15 +370,25 @@ struct NoteWindowView: View {
.padding(.vertical, 12) .padding(.vertical, 12)
} }
.padding(4) .padding(4)
.glassEffect(.regular, in: .rect(cornerRadius: 20)) .background(
RoundedRectangle(cornerRadius: 20)
.fill(.ultraThinMaterial)
)
.clipShape(RoundedRectangle(cornerRadius: 20))
.focusable(false)
.focusEffectDisabled()
.frame(minWidth: 400, minHeight: 200) .frame(minWidth: 400, minHeight: 200)
.onAppear { .onAppear {
visibility = appState.defaultVisibility visibility = appState.defaultVisibility
isTextEditorFocused = true
} }
.onExitCommand { .onExitCommand {
closeWindow() closeWindow()
} }
.background(
Button("") { closeWindow() }
.keyboardShortcut("w", modifiers: .command)
.hidden()
)
.animation(Animation.easeInOut(duration: 0.2), value: showSuccess) .animation(Animation.easeInOut(duration: 0.2), value: showSuccess)
.animation(Animation.easeInOut(duration: 0.2), value: errorMessage) .animation(Animation.easeInOut(duration: 0.2), value: errorMessage)
} }