Compare commits

..
Author SHA1 Message Date
Alex Gleason 2ddfa66d9b release: v9.10.1 2026-04-02 20:26:03 -05:00
Alex Gleason 1566a67da4 Replace default Capacitor launcher icon with Shakespeare logo 2026-04-02 20:16:14 -05:00
Alex Gleason 6ff25096d4 Fix zapstore publish: remove --skip-metadata to upload app icon 2026-04-02 20:06:44 -05:00
Alex Gleason 222b27c8c8 Fix CI: add v* protected tag rule and strip sourcemaps before nsite deploy 2026-04-02 18:38:01 -05:00
Alex Gleason 43fec2a462 release: v9.10.0 2026-04-02 18:04:25 -05:00
Alex Gleason a9e3e81195 Add build-apk, deploy-nsite, and publish-zapstore CI jobs with zapstore.yaml 2026-04-02 17:29:11 -05:00
Alex Gleason b270651a9c Add Capacitor Android app setup with deep links, splash screen, and release signing 2026-04-02 03:56:35 -05:00
Alex Gleason 5b302cc40b Make mobile version number a clickable link to /changelog with date, matching desktop 2026-04-02 03:24:43 -05:00
Alex Gleason 3db9848497 Align current release padding with past release cards on changelog page 2026-04-02 03:21:00 -05:00
Alex Gleason b0e85aaa60 Update shakespeare product page in release skill 2026-04-02 03:14:21 -05:00
Alex Gleason 9390ae4152 release: v9.9.2 2026-04-02 03:08:22 -05:00
Alex Gleason 7ecab519ed Fix VersionCheck crash: move VersionCheck and Toaster inside BrowserRouter
VersionCheck uses <Link> which requires React Router context. It was
rendered in App.tsx outside BrowserRouter, causing a null destructuring
error at runtime. Moved VersionCheck and Toaster into AppRouter.tsx
inside BrowserRouter.

Also added null check and truncation for changelog excerpt items to
prevent undefined access and overly long toast descriptions.
2026-04-02 03:05:15 -05:00
Alex Gleason 85afb6828e Remove root site option from nsite deploy form, always use named sites 2026-04-02 02:55:12 -05:00
Alex Gleason d4d6ff0d89 Include nsite "a" tag in kind 31990 app events when deployment exists 2026-04-02 02:47:52 -05:00
Alex Gleason f29510ed00 Left-align changelog page content instead of centering 2026-04-02 02:40:31 -05:00
Alex Gleason 62f6bd439e Add release job to GitLab CI
Triggered by version tags (vX.Y.Z), extracts the changelog section
for the tagged version and creates a GitLab release with it.
2026-04-02 02:23:21 -05:00
Alex Gleason 37c19be7ee Fix versioning: start at 9.9.1, move changelog into app shell
Bump starting version from 9.9.0 to 9.9.1. Move the /changelog page
from a standalone layout into AppLayout so the project sidebar is
available. Remove it from the settings nav since it's its own page.
2026-04-02 02:19:50 -05:00
Alex Gleason b7ce705b2b Add versioning system, changelog page, and release skill
Replace calver (YYYY.MM.DD+sha) with marketing versioning (X.Y.Z),
starting at 9.9.0. Add changelog page at /changelog with Keep a
Changelog parsing, pre-release banner, and expandable entries linked
to GitLab releases. Add VersionCheck component that shows a "What's
new" toast when the app version changes. Add release skill for
managing versioned releases with changelog and git tagging.
2026-04-02 02:09:00 -05:00
Alex Gleason 380e6f3b84 Add shakespeare and template t-tags to kind 31990 app events 2026-04-02 01:51:11 -05:00
Alex Gleason ed55e600d4 Add NIP-89 kind 31990 app management for projects
- AppDialog with app preview card, Blossom icon upload, and collapsible advanced section
- AppTool for AI to view/update app with view-before-update guard
- Shared buildAppEvent utility for DRY event construction
- Auto-fill website from deployment URL, default name from project ID
- Add repo 'a' tag when origin is a nostr:// URI owned by the user
- Custom tool call rendering with AppWindow icon
- System prompt guidance for app publishing workflow and prerequisites
- Store app coordinate in .git/shakespeare/app.json via DotAI
2026-04-02 01:36:15 -05:00
Alex Gleason ed40469af4 Add agent rule: always commit after finishing a turn 2026-03-29 01:34:42 -05:00
Alex Gleason 049ad5bd04 Normalize GitHub/GitLab web URLs to .git clone URLs on submit 2026-03-29 01:34:24 -05:00
Alex Gleason 34bfbb971b Revert "Enable AI to see images when using the read tool"
This reverts commit 2641252c6a.
2026-03-28 22:21:17 -05:00
Alex Gleason 2641252c6a Enable AI to see images when using the read tool
Return JPG/PNG images as structured image content parts from ReadTool
instead of embedding base64 data URLs as plain text. Since OpenAI tool
messages only support text content, images are injected as a follow-up
user message with image_url parts that vision models can interpret.
2026-03-28 18:27:41 -05:00
Alex Gleason d6e8b9bc84 Merge branch 'nsite-source-tags' into 'main'
Include `source` tags in nsite deployments

See merge request soapbox-pub/shakespeare!105
2026-03-25 22:14:01 +00:00
hzrd149 113fc0a326 Include source tags in nsite deployments 2026-03-25 16:25:22 -05:00
Alex Gleason ee240cdfda Fix ESLint errors: remove unused NPool import, fix useEffect dependencies 2026-03-24 19:36:19 -05:00
Alex Gleason 9e29153a95 npm audit fix 2026-03-24 17:27:40 -05:00
Alex Gleason a8c19bd0ad Merge branch 'nsite-v2' into 'main'
Update nsite deployment

See merge request soapbox-pub/shakespeare!104
2026-03-24 22:26:26 +00:00
hzrd149 4f103d6ad4 Cleanup nsite deployment config 2026-03-24 17:21:07 -05:00
hzrd149 d51fee34e3 Update nsite deployment
Add support for named sites under users key
2026-03-24 17:03:39 -05:00
Alex Gleason c5ed881af0 Fix git sync nag showing immediately after cloning external projects
Store the HEAD commit OID as 'shakespeare.clonedAt' git config at clone
time, then use it to determine whether the user has actually altered the
project before showing the backup warning.
2026-03-18 01:24:10 -05:00
Alex Gleason 459311bd7b Add background parameter to GenerateImageTool for transparency support
The previous commit tried to enable transparency by allowing output_format: "png",
but transparency in the OpenAI Image API is controlled by a separate "background"
parameter, not the output format. Without it, the model was drawing checkerboard
patterns to visually represent transparency instead of producing actual alpha channels.

Add the background parameter ("transparent", "opaque", "auto") to the tool schema
and pass it through to the API. Update the system prompt to instruct the AI to use
both background: "transparent" and output_format: "png"/"webp" together.
2026-03-17 19:22:31 -05:00
Alex Gleason 119b28d0f5 Allow PNG output format in image generation for transparency support 2026-03-17 17:43:56 -05:00
Alex Gleason 3741782c62 Fix CI: remove unused toast import and fix indentation in App provider tree 2026-03-12 03:14:44 -05:00
Alex Gleason 50bc875423 Fix stale template cache by re-cloning when force-pull fails
Shallow clones (depth=1) cause isomorphic-git's fetch to fail when the
remote template has new commits. Instead of showing an error toast and
falling back to the stale cached template, delete the cache and re-clone
fresh to ensure users always get the latest template.
2026-03-11 19:14:31 -05:00
Alex Gleason 9c2984f69f Add Plausible Analytics variables to .env.example 2026-03-11 18:47:49 -05:00
Alex Gleason a5c293bcc9 Add Plausible Analytics settings to System Settings page 2026-03-11 18:47:09 -05:00
Alex Gleason 5a431ae5f2 Add Plausible Analytics integration with AppConfig support 2026-03-11 18:34:48 -05:00
Alex Gleason a6f0822700 Add blossom.ditto.pub as a Blossom upload server 2026-03-06 12:55:12 -06:00
Alex Gleason c2664fc6d2 Add blossom_upload AI tool for uploading VFS files to Blossom media hosting 2026-03-06 12:49:56 -06:00
Alex Gleason 556cc10f3a Add nostr_encode and nostr_decode AI tools for NIP-19 bech32 encoding/decoding 2026-03-06 12:16:56 -06:00
Alex Gleason 7a2873aefb Fix NostrPublishEventsTool tests by adding missing nip19 mock 2026-03-06 11:55:50 -06:00
Alex Gleason a063615e86 Support optional nsec in NostrPublishEventsTool for keypair reuse 2026-03-06 11:49:14 -06:00
Alex Gleason 43a3d46023 Update relays 2026-03-06 11:45:21 -06:00
Alex Gleason fd7674124e Remove nutstack as a default template (due to it being too outdated from mkstack) 2026-02-19 23:53:46 -06:00
Alex Gleason 0ffdc39b59 Merge branch 'evict-seen-images' into 'main'
Evict images from context after the model has seen them

See merge request soapbox-pub/shakespeare!103
2026-02-13 20:00:59 +00:00
Chad Curtis 10ff3e9196 Evict images from context after the model has seen them
Strip image_url parts from all user messages except the most recent one
before sending to the API. The model has already responded to earlier
images, so re-sending them on every turn wastes tokens. The VFS text
path is preserved so the model can still read the file if needed.

This is a send-time transformation only — session.messages stays
intact for the UI.
2026-02-13 01:51:22 -06:00
Alex Gleason bacac24ee3 npm audit fix 2026-02-12 12:22:40 -06:00
Alex Gleason b8a3571e10 Make NIP.md public if it exists 2026-02-05 23:46:25 -06:00
Alex Gleason 236eb0c16a Display a warning to users of iOS lockdown mode 2026-02-04 18:29:21 -06:00
Alex Gleason 1393a13df7 Improve tool descriptions for build_project and git_commit 2026-02-03 12:54:32 -06:00
140 changed files with 7066 additions and 1333 deletions

No files matched your search

+121
View File
@@ -0,0 +1,121 @@
---
name: plausible-analytics
description: Add Plausible Analytics tracking to the application, configured through AppConfig and environment variables.
---
# Plausible Analytics
Add privacy-friendly analytics with [Plausible](https://plausible.io/) using the `@plausible-analytics/tracker` npm package. Configuration lives in `AppConfig` so it can be set via `VITE_` environment variables.
## 1. Install the package
```bash
npm install @plausible-analytics/tracker
```
## 2. Add fields to `AppConfig`
In `src/contexts/AppContext.ts`, add two fields to the `AppConfig` interface:
```typescript
export interface AppConfig {
// ...existing fields...
/** Plausible Analytics domain (empty string = disabled). */
plausibleDomain: string;
/** Plausible Analytics API endpoint (empty string = use default). */
plausibleEndpoint: string;
}
```
## 3. Update the Zod schema in `AppProvider.tsx`
Add the new fields to the `AppConfigSchema`:
```typescript
const AppConfigSchema = z.object({
// ...existing fields...
plausibleDomain: z.string(),
plausibleEndpoint: z.string(),
}) satisfies z.ZodType<AppConfig>;
```
## 4. Create `PlausibleProvider`
Create `src/components/PlausibleProvider.tsx`:
```tsx
import { ReactNode, useEffect, useRef } from 'react';
import { useAppContext } from '@/hooks/useAppContext';
interface PlausibleProviderProps {
children: ReactNode;
}
/**
* Reactively initializes Plausible Analytics from AppConfig.
* Plausible's `init()` can only be called once, so we guard with a ref.
*/
export function PlausibleProvider({ children }: PlausibleProviderProps) {
const { config } = useAppContext();
const initializedRef = useRef(false);
useEffect(() => {
if (initializedRef.current || !config.plausibleDomain) return;
initializedRef.current = true;
import('@plausible-analytics/tracker').then(({ init }) => {
init({
domain: config.plausibleDomain,
...(config.plausibleEndpoint && { endpoint: config.plausibleEndpoint }),
});
}).catch(console.error);
}, [config.plausibleDomain, config.plausibleEndpoint]);
return <>{children}</>;
}
```
## 5. Wire into `App.tsx`
Import `PlausibleProvider` and add it inside `AppProvider` (it needs access to `useAppContext`):
```tsx
import { PlausibleProvider } from '@/components/PlausibleProvider';
// In the defaultConfig, add:
const defaultConfig: AppConfig = {
// ...existing fields...
plausibleDomain: import.meta.env.VITE_PLAUSIBLE_DOMAIN || '',
plausibleEndpoint: import.meta.env.VITE_PLAUSIBLE_ENDPOINT || '',
};
// In the JSX, wrap children of AppProvider:
<AppProvider storageKey="nostr:app-config" defaultConfig={defaultConfig}>
<PlausibleProvider>
{/* ...rest of providers... */}
</PlausibleProvider>
</AppProvider>
```
## 6. Update `TestApp.tsx`
Add the new fields to the test default config with empty strings (disabled):
```typescript
const defaultConfig: AppConfig = {
// ...existing fields...
plausibleDomain: '',
plausibleEndpoint: '',
};
```
## 7. Configure via environment variables
Create or update `.env`:
```
VITE_PLAUSIBLE_DOMAIN="example.com"
VITE_PLAUSIBLE_ENDPOINT="https://plausible.example.com/api/event"
```
`VITE_PLAUSIBLE_ENDPOINT` is optional -- it defaults to Plausible Cloud's endpoint if omitted. Set it when using a self-hosted Plausible instance.
+198
View File
@@ -0,0 +1,198 @@
---
name: release
description: Publish a new app release with versioning, changelog, and git tagging. Triggered by "publish a new release" or similar requests.
---
# Release Skill
This skill guides you through publishing a new release of the app. It handles version bumping, changelog generation, and git tagging/pushing.
## Overview
- **Version format**: Marketing version (X.Y.Z), starting from 9.9.1. **This is NOT semver.** Version numbers are chosen based on how the release looks to end users, not based on API compatibility or breaking changes. Think of it like an app store version -- the number reflects the perceived significance of the update to a regular user.
- **Version source of truth**: `package.json` `version` field
- **Changelog**: `CHANGELOG.md` in repo root, using [Keep a Changelog](https://keepachangelog.com/) format
- **Version bumping**:
- **Patch (Z)**: Most releases. Bug fixes, tweaks, internal improvements, anything a user wouldn't specifically notice or seek out.
- **Minor (Y)**: Releases with headline features -- things worth announcing. A user should be able to look at the minor bump and think "oh, something new happened."
- **Major (X)**: Only when the user explicitly requests it (milestones, rebrands, major redesigns)
- **CI trigger**: Pushing a version tag (`v9.9.0`) triggers the CI pipeline to build and create a GitLab release
## Release Procedure
Follow these steps in order. Do NOT skip any step.
### Step 1: Required Reading
Before writing any release notes, you MUST read these pages to understand the product context, voice, and values:
1. **https://soapbox.pub/** -- Soapbox company overview and product suite
2. **https://soapbox.pub/shakespeare/** -- Shakespeare product page
These pages define what Shakespeare is, how it's positioned, and the tone of voice to use. Changelog entries should reflect this identity: creative, empowering, user-focused, emphasizing building and self-expression. Avoid dry technical jargon -- write for people who use the app, not developers.
### Step 2: Pre-flight Checks
```bash
# Ensure working directory is clean
git status
# Ensure we're on main branch
git branch --show-current
# Run the full test suite
npm run test
```
- If the working directory has uncommitted changes, ask the user whether to commit them first or abort.
- If not on `main`, warn the user and ask whether to proceed.
- If tests fail, stop and fix the issues before continuing.
### Step 3: Determine What Changed
```bash
# Get the current version from package.json
node -p "require('./package.json').version"
# Get commits since the last version tag
git log v$(node -p "require('./package.json').version")..HEAD --oneline
```
- If there are no commits since the last tag, inform the user there is nothing to release and stop.
- Review the commit list to understand the scope of changes.
### Step 4: Decide the Version Bump
Analyze the commits from Step 3 and determine the appropriate bump level:
| Bump | When to use | Example |
|------|-------------|---------|
| **Patch** | Bug fixes, minor tweaks, dependency updates, small UI polish, internal tooling, developer-facing pages, CI/build changes, settings/admin screens | 9.9.0 -> 9.9.1 |
| **Minor** | Significant new product features that change how users interact with the app -- the kind of thing you'd highlight in an app store update or announce on social media (e.g., new template support, new AI features, new deployment options, major UI overhaul) | 9.9.1 -> 9.10.0 |
| **Major** | ONLY when the user explicitly instructs a major bump | 9.10.0 -> 10.0.0 |
**Default to patch** when in doubt. The bar for a minor bump is high -- ask yourself: "Would a regular user notice and care about this change?" If the answer is no, it's a patch. Internal pages (changelog, settings, about screens), infrastructure improvements, CI fixes, and developer tooling are always patch-level regardless of whether they technically add a new page or screen.
When bumping minor, reset patch to 0 (e.g., 9.9.3 -> 9.10.0).
When bumping major, reset minor and patch to 0 (e.g., 9.3.1 -> 10.0.0).
### Step 5: Write the Changelog Entry
Prepend a new section to `CHANGELOG.md` directly below the `# Changelog` heading.
**Format:**
```markdown
## [X.Y.Z] - YYYY-MM-DD
### Added
- Description of new features
### Changed
- Description of changes to existing features
### Fixed
- Description of bug fixes
### Removed
- Description of removed features
```
**Rules:**
- Only include categories that have entries (omit empty categories)
- Write **user-facing descriptions**, not raw commit messages
- Keep descriptions concise -- one line per change
- Group related commits into single entries where appropriate
- Use present tense ("Add dark mode toggle", not "Added dark mode toggle")
- Focus on what the user sees/experiences, not internal implementation details
- Use the current date in YYYY-MM-DD format
- **Collapse related work into one entry.** If a feature was added and then fixed/tweaked across multiple commits in the same release, present the finished result as a single "Added" entry. Never list something as "Added" and then also list fixes for that same thing -- the user sees the end product, not the development history.
- **Omit purely internal changes.** CI fixes, build pipeline tweaks, developer tooling, and infrastructure changes should be omitted from the changelog entirely unless they have a direct, visible impact on the user experience. The changelog is for users, not developers.
- **Compare the actual code between versions** to understand what really changed, rather than just reading commit messages. Commit messages may over- or under-represent the significance of changes.
### Step 6: Update Version in All Files
#### 6a. `package.json`
Update the `version` field:
```json
"version": "X.Y.Z"
```
### Step 7: Copy Changelog to Public Directory
The changelog is served at runtime by the app from the `public/` directory. After updating `CHANGELOG.md`, copy it:
```bash
cp CHANGELOG.md public/CHANGELOG.md
```
### Step 8: Pull Latest Changes
Before committing the release, pull the latest changes from the remote to ensure the release commit sits on top of the latest code. This **must** happen before committing and tagging.
```bash
git pull origin main
```
**CRITICAL**: Always use `git pull` (merge), NEVER `git pull --rebase`. Rebasing rewrites commit hashes, which would orphan any tag pointing to the original commit. Since version tags are often protected on the remote and cannot be deleted or updated, a broken tag cannot be easily fixed.
If there are merge conflicts with the pulled changes, resolve them before proceeding.
### Step 9: Commit the Release
```bash
git add package.json CHANGELOG.md public/CHANGELOG.md
git commit -m "release: vX.Y.Z"
```
### Step 10: Tag the Release
```bash
git tag vX.Y.Z
```
The tag format is `v` followed by the version with no suffix. Examples: `v9.9.0`, `v9.10.0`, `v10.0.0`.
### Step 11: Push
```bash
git push origin main vX.Y.Z
```
**CRITICAL**: Push only the specific tag being released. NEVER use `--tags` -- that pushes ALL local tags, including stale or deleted ones.
### Step 12: Confirm
After pushing, inform the user:
- The new version number
- A brief summary of what was released
- That CI will handle building and publishing the artifacts
## File Reference
| File | What to update | Notes |
|------|---------------|-------|
| `package.json` | `version` field | Source of truth for the version |
| `CHANGELOG.md` | Prepend new section | User-facing changelog |
| `public/CHANGELOG.md` | Copy from `CHANGELOG.md` | Served at runtime by the app |
## Troubleshooting
### "Nothing to release"
If `git log` shows no commits since the last tag, there genuinely is nothing to release.
### Tests fail
Fix the failing tests before proceeding. The release must not contain broken code.
### Wrong version bumped
If you tagged the wrong version and haven't pushed yet:
```bash
git tag -d vX.Y.Z # delete the local tag
git reset --soft HEAD~1 # undo the commit but keep changes staged
```
Then redo steps 4-10 with the correct version.
### Already pushed a bad release
This requires manual intervention. Inform the user and suggest they delete the tag and release from GitLab manually, then re-run the release process.
+4
View File
@@ -1,6 +1,10 @@
# Sentry # Sentry
VITE_SENTRY_DSN="https://********************************@*****************.example.com/****************" VITE_SENTRY_DSN="https://********************************@*****************.example.com/****************"
# Plausible Analytics
VITE_PLAUSIBLE_DOMAIN="example.com"
VITE_PLAUSIBLE_ENDPOINT="https://plausible.example.com/api/event"
# GitHub OAuth Configuration # GitHub OAuth Configuration
VITE_GITHUB_OAUTH_CLIENT_ID="********************" VITE_GITHUB_OAUTH_CLIENT_ID="********************"
VITE_GITHUB_OAUTH_CLIENT_SECRET="****************************************" VITE_GITHUB_OAUTH_CLIENT_SECRET="****************************************"
+212 -3
View File
@@ -3,13 +3,26 @@ image: node:25
default: default:
interruptible: true interruptible: true
timeout: 1 minute timeout: 1 minute
cache:
key:
files:
- package-lock.json
paths:
- node_modules/
stages: stages:
- test - test
- deploy - deploy
- build
- release
- publish
test: test:
stage: test stage: test
rules:
- if: $CI_COMMIT_TAG
when: never
- when: always
script: script:
- npm run typecheck - npm run typecheck
- npm run build - npm run build
@@ -17,6 +30,10 @@ test:
pages: pages:
stage: deploy stage: deploy
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
script: script:
- npm run build - npm run build
- rm -rf public - rm -rf public
@@ -24,6 +41,198 @@ pages:
artifacts: artifacts:
paths: paths:
- public - public
only:
variables: deploy-nsite:
- $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME stage: deploy
timeout: 10 minutes
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
variables:
NSYTE_VERSION: "v0.24.1"
script:
# Build the web app
- npm ci
- npm run build
- cp dist/index.html dist/404.html
# Remove sourcemaps to stay under nsite's 65KB manifest limit
- find dist -name '*.map' -delete
# Download nsyte binary
- curl -fsSL "https://github.com/sandwichfarm/nsyte/releases/download/${NSYTE_VERSION}/nsyte-linux" -o /usr/local/bin/nsyte
- chmod +x /usr/local/bin/nsyte
# Deploy to nsite via nsyte using the nbunksec credential
- >-
nsyte deploy ./dist
-i
--sec "$NSITE_NBUNKSEC"
--name shakespeare
--relays "wss://relay.ditto.pub,wss://relay.nsite.lol,wss://relay.dreamith.to,wss://relay.primal.net"
--servers "https://blossom.primal.net,https://blossom.ditto.pub,https://blossom.dreamith.to"
--fallback "/index.html"
--publish-server-list
--use-fallback-relays
--use-fallback-servers
build-apk:
stage: build
image: eclipse-temurin:21-jdk
timeout: 15 minutes
needs: []
rules:
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
variables:
ANDROID_SDK_ROOT: /opt/android-sdk
ANDROID_HOME: /opt/android-sdk
before_script:
# Install system dependencies
- apt-get update -qq
- apt-get install -y -qq curl unzip > /dev/null
# Install Node.js 22
- curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
- apt-get install -y -qq nodejs > /dev/null
- node --version
- npm --version
# Install Android SDK command-line tools
- mkdir -p $ANDROID_SDK_ROOT/cmdline-tools
- curl -fsSL https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -o cmdline-tools.zip
- unzip -q cmdline-tools.zip -d $ANDROID_SDK_ROOT/cmdline-tools
- mv $ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools $ANDROID_SDK_ROOT/cmdline-tools/latest
- export PATH="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools:$PATH"
# Accept licenses and install SDK components
- printf 'y\ny\ny\ny\ny\ny\ny\n' | sdkmanager --licenses > /dev/null 2>&1 || true
- sdkmanager --install "platforms;android-36" "build-tools;36.0.0" "platform-tools" > /dev/null
# Write local.properties for Gradle
- echo "sdk.dir=$ANDROID_SDK_ROOT" > android/local.properties
# Decode signing keystore and migrate JKS -> PKCS12 for Gradle compatibility
- echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > android/app/my-upload-key.jks
- keytool -importkeystore
-srckeystore android/app/my-upload-key.jks
-destkeystore android/app/my-upload-key.keystore
-deststoretype pkcs12
-srcstorepass "$KEYSTORE_PASSWORD"
-deststorepass "$KEYSTORE_PASSWORD"
-srcalias upload
-destalias upload
-noprompt
- rm android/app/my-upload-key.jks
# Write key.properties from CI/CD variables
- |
cat > android/key.properties << EOF
storePassword=$KEYSTORE_PASSWORD
keyPassword=$KEY_PASSWORD
keyAlias=upload
storeFile=my-upload-key.keystore
EOF
script:
# Extract semver version from git tag (e.g., v9.9.2 -> 9.9.2)
- TAG="${CI_COMMIT_TAG#v}"
- VERSION_NAME="${TAG}"
- VERSION_CODE="${CI_PIPELINE_IID}"
- echo "Building version $VERSION_NAME (code $VERSION_CODE) from tag $CI_COMMIT_TAG"
# Stamp version into build.gradle
- sed -i "s/versionCode [0-9]*/versionCode ${VERSION_CODE}/" android/app/build.gradle
- sed -i "s/versionName \"[^\"]*\"/versionName \"${VERSION_NAME}\"/" android/app/build.gradle
# Build web assets
- npm ci
- npx vite build -l error
- cp dist/index.html dist/404.html
# Sync web assets to Capacitor Android project
- npx cap sync android
# Build signed release APK
- cd android && chmod +x gradlew && ./gradlew assembleRelease bundleRelease && cd ..
# Copy APK to a predictable artifact path
- mkdir -p artifacts
- cp android/app/build/outputs/apk/release/app-release.apk "artifacts/Shakespeare.apk"
- cp android/app/build/outputs/bundle/release/app-release.aab "artifacts/Shakespeare.aab"
- ls -lh artifacts/
# Upload to Generic Packages registry for a stable public download URL
- |
curl --fail --header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
--upload-file "artifacts/Shakespeare.apk" \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/shakespeare/${CI_COMMIT_TAG}/Shakespeare-${CI_COMMIT_TAG}.apk"
- |
curl --fail --header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
--upload-file "artifacts/Shakespeare.aab" \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/shakespeare/${CI_COMMIT_TAG}/Shakespeare-${CI_COMMIT_TAG}.aab"
artifacts:
paths:
- artifacts/Shakespeare.apk
- artifacts/Shakespeare.aab
expire_in: 90 days
cache:
key: android-gradle
paths:
- android/.gradle/
- .gradle/
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- build-apk
rules:
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
script:
- echo "Creating release for $CI_COMMIT_TAG"
# Extract the latest changelog section for the release description.
# Reads from "## [version]" to the next "## [" or end of file.
- |
VERSION="${CI_COMMIT_TAG#v}"
RELEASE_NOTES=$(awk "/^## \\[${VERSION}\\]/{found=1; next} /^## \\[/{if(found) exit} found{print}" CHANGELOG.md)
if [ -z "$RELEASE_NOTES" ]; then
RELEASE_NOTES="Shakespeare ${CI_COMMIT_TAG}"
fi
- echo "$RELEASE_NOTES" > release-notes.md
release:
tag_name: $CI_COMMIT_TAG
name: $CI_COMMIT_TAG
description: './release-notes.md'
assets:
links:
- name: Shakespeare-${CI_COMMIT_TAG}.apk
url: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/shakespeare/${CI_COMMIT_TAG}/Shakespeare-${CI_COMMIT_TAG}.apk
link_type: package
- name: Shakespeare-${CI_COMMIT_TAG}.aab
url: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/shakespeare/${CI_COMMIT_TAG}/Shakespeare-${CI_COMMIT_TAG}.aab
link_type: package
publish-zapstore:
stage: publish
image: golang:1.24
needs:
- build-apk
rules:
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
variables:
SIGN_WITH: $ZAPSTORE_BUNKER_URL
script:
- go install github.com/zapstore/zsp@latest
# Restore the persistent NIP-46 client key so the bunker recognizes us across CI runs.
# zsp stores client keys at ~/.config/zsp/bunker-keys/<bunker-pubkey>.key
- BUNKER_PUBKEY=$(echo "$ZAPSTORE_BUNKER_URL" | sed 's|bunker://||;s|?.*||')
- mkdir -p ~/.config/zsp/bunker-keys
- echo "$ZAPSTORE_CLIENT_KEY" > ~/.config/zsp/bunker-keys/${BUNKER_PUBKEY}.key
- APK_PATH="artifacts/Shakespeare.apk"
- VERSION="${CI_COMMIT_TAG#v}"
- sed -i "2i release_source:\ ./${APK_PATH}" zapstore.yaml
- sed -i "2i version:\ ${VERSION}" zapstore.yaml
- zsp publish --quiet --skip-preview zapstore.yaml
+14 -260
View File
@@ -1,3 +1,7 @@
# Agent Rules
- ALWAYS commit after you finish your turn. No exceptions. Don't ask for permission, just do it.
# Shakespeare - AI-Powered App Builder # Shakespeare - AI-Powered App Builder
Shakespeare is a browser-based AI chat application that allows users to build custom web applications through natural language conversation. All operations including AI chat and Git operations are executed in client-side JavaScript, with API keys stored in browser storage. Simply describe what you want to build, and AI will help you create it. Shakespeare is a browser-based AI chat application that allows users to build custom web applications through natural language conversation. All operations including AI chat and Git operations are executed in client-side JavaScript, with API keys stored in browser storage. Simply describe what you want to build, and AI will help you create it.
@@ -50,6 +54,9 @@ Shakespeare provides AI agents with specialized tools for project development (n
- **NostrReadNipsIndexTool**: Read the full list of NIPs, kinds, and tags - **NostrReadNipsIndexTool**: Read the full list of NIPs, kinds, and tags
- **NostrFetchEventTool**: Fetch Nostr events using NIP-19 identifiers - **NostrFetchEventTool**: Fetch Nostr events using NIP-19 identifiers
- **NostrGenerateKindTool**: Generate unused Nostr event kind numbers - **NostrGenerateKindTool**: Generate unused Nostr event kind numbers
- **NostrEncodeTool**: Encode hex values into NIP-19 bech32 entities (npub, note, nprofile, nevent, naddr)
- **NostrDecodeTool**: Decode NIP-19 bech32 entities into hex and structured data
- **BlossomUploadTool**: Upload files from the project to Blossom media hosting, returns a public URL
- **ReadConsoleMessagesTool**: Read console messages from project preview with filtering capabilities - **ReadConsoleMessagesTool**: Read console messages from project preview with filtering capabilities
#### Shell Commands #### Shell Commands
@@ -1092,7 +1099,7 @@ const defaultConfig: AppConfig = {
relayMetadata: { relayMetadata: {
relays: [ relays: [
{ url: 'wss://relay.ditto.pub', read: true, write: true }, { url: 'wss://relay.ditto.pub', read: true, write: true },
{ url: 'wss://relay.nostr.band', read: true, write: true }, { url: 'wss://relay.primal.net', read: true, write: true },
], ],
updatedAt: 0, updatedAt: 0,
}, },
@@ -1180,243 +1187,26 @@ import { Link } from 'react-router-dom';
## CRITICAL Design Standards ## CRITICAL Design Standards
**Every project must look distinctive and professionally designed.** The goal is to create designs that feel bespoke—not like generic hackathon demos or AI-generated templates. - Create breathtaking, immersive designs that feel like bespoke masterpieces, rivaling the polish of Apple, Stripe, or luxury brands
- Designs must be production-ready, fully featured, with no placeholders unless explicitly requested, ensuring every element serves a functional and aesthetic purpose - Designs must be production-ready, fully featured, with no placeholders unless explicitly requested, ensuring every element serves a functional and aesthetic purpose
- Avoid generic or templated aesthetics at all costs; every design must have a unique, brand-specific visual signature that feels custom-crafted - Avoid generic or templated aesthetics at all costs; every design must have a unique, brand-specific visual signature that feels custom-crafted
- Headers must be dynamic, immersive, and storytelling-driven, using layered visuals, motion, and symbolic elements to reflect the brand's identity—never use simple "icon and text" combos - Headers must be dynamic, immersive, and storytelling-driven, using layered visuals, motion, and symbolic elements to reflect the brand’s identity—never use simple “icon and text” combos
- Incorporate purposeful, lightweight animations for scroll reveals, micro-interactions (e.g., hover, click, transitions), and section transitions to create a sense of delight and fluidity - Incorporate purposeful, lightweight animations for scroll reveals, micro-interactions (e.g., hover, click, transitions), and section transitions to create a sense of delight and fluidity
### Design Foundations
These principles apply to ALL projects regardless of category. They define what "good design" means.
#### Nielsen's 10 Usability Heuristics
1. **Visibility of system status** — Always show loading states, progress indicators, success/error feedback.
2. **Match between system and real world** — Use familiar language, not jargon. Follow real-world conventions.
3. **User control and freedom** — Provide undo, cancel, back buttons. Let users recover from mistakes.
4. **Consistency and standards** — Same actions = same results. Follow platform conventions.
5. **Error prevention** — Use confirmations for destructive actions, disable invalid options.
6. **Recognition rather than recall** — Show options visibly; use menus, suggestions, recent items.
7. **Flexibility and efficiency of use** — Support novices (clear UI) and experts (shortcuts).
8. **Aesthetic and minimalist design** — Every element serves a purpose. Remove the rest.
9. **Help users recognize, diagnose, and recover from errors** — Plain language errors with solutions.
10. **Help and documentation** — Searchable, task-focused, concise. Ideally unnecessary.
#### Dieter Rams' Principles of Good Design
- **Good design is innovative** — Don't copy; find new solutions to real problems
- **Good design makes a product useful** — Function first; every feature must serve users
- **Good design is aesthetic** — Well-executed products are pleasant to use
- **Good design makes a product understandable** — The design itself should explain how to use it
- **Good design is unobtrusive** — Tools, not decorations; don't impose on users
- **Good design is honest** — Don't manipulate, exaggerate capabilities, or deceive users
- **Good design is long-lasting** — Avoid trendy gimmicks that age poorly
- **Good design is thorough to the last detail** — Nothing is arbitrary; every element considered
- **Good design is as little design as possible** — Less is more; concentrate on essentials
#### Cognitive Principles
**Gestalt Principles** (how humans perceive visual groups):
- **Proximity** — Elements close together are perceived as related. Group related items; separate unrelated ones.
- **Similarity** — Elements that look alike are perceived as related. Use consistent styling for similar functions.
- **Closure** — People complete incomplete shapes mentally. You don't need to draw every line.
- **Continuity** — Eyes follow lines and curves. Use alignment to create visual flow.
- **Figure-ground** — People separate foreground from background. Use contrast to make important elements stand out.
**Key Laws**:
- **Hick's Law** — Decision time increases with the number of choices. Limit options; use progressive disclosure.
- **Fitts's Law** — Larger, closer targets are easier to click/tap. Make primary actions big and accessible.
- **Miller's Law** — Working memory holds ~7 items. Chunk information; don't overwhelm with long lists.
### Step 1: Identify Project Type
Before writing any code, classify the project into one of these categories. Each has fundamentally different design requirements:
#### Category A: Data-Heavy Applications (Dashboards, Admin Panels, Analytics)
**Characteristics**: Dense information, analytical users, repeated daily use, efficiency over beauty
**Design Approach**:
- Maximize information density while maintaining clarity
- Use a strict grid system for scannable layouts
- Neutral color palette with strategic accent colors for alerts/status
- Monospace or tabular numbers for data alignment
- Minimal decorative elements—let the data be the hero
**Typography**: IBM Plex Sans + IBM Plex Mono, or Inter + JetBrains Mono
**Layout Signature**: Card-based modules, data tables, sidebar navigation, status indicators
**Reference Aesthetic**: Bloomberg Terminal, Grafana, Linear, Notion databases
#### Category B: Consumer Social/Community Apps
**Characteristics**: Broad audience, engagement-focused, emotional connection, viral potential
**Design Approach**:
- Bold personality through color, motion, and playful elements
- Avatar-centric layouts emphasizing human connection
- Generous use of micro-interactions and feedback animations
- Progressive disclosure to avoid overwhelming new users
- Clear visual hierarchy guiding toward key actions (post, react, share)
**Typography**: Plus Jakarta Sans, DM Sans, or Nunito (friendly, approachable)
**Layout Signature**: Feed-based layouts, floating action buttons, bottom navigation on mobile, toast notifications, pull-to-refresh patterns
**Reference Aesthetic**: Twitter/X, Discord, Slack, Instagram
#### Category C: Marketing/Landing Pages (Small Business, Product Launch, Portfolio)
**Characteristics**: Conversion-focused, trust-building, one-time decision, storytelling
**Design Approach**:
- Hero-driven narrative with strong value proposition above the fold
- Social proof prominently displayed (testimonials, logos, stats)
- Clear CTA hierarchy (one primary, limited secondary)
- Sections that build a persuasive argument as you scroll
- Professional but approachable—inspire confidence
**Typography**: DM Serif Display + DM Sans, or Fraunces + Manrope (headline impact + readable body)
**Layout Signature**: Full-width hero sections, alternating content blocks, testimonial carousels, sticky CTA, footer with trust signals
**Reference Aesthetic**: Stripe, Linear marketing site, Vercel, premium Framer templates
#### Category D: Content/Editorial (Blogs, News, Documentation)
**Characteristics**: Reading-focused, long-form content, return visits, content is king
**Design Approach**:
- Typography IS the design—invest heavily in font selection and spacing
- Maximum readability: generous line-height (1.6-1.8), optimal line length (60-75 characters)
- Minimal UI chrome that disappears while reading
- Strong article hierarchy (headline, deck/subtitle, byline, body, pull quotes)
- Support for rich content (images, code blocks, embeds)
**Typography**: Literata + Source Sans Pro, or Lora + Inter (serif headlines enhance editorial feel)
**Layout Signature**: Single-column content, large typography, pull quotes, reading progress indicator, related content suggestions
**Reference Aesthetic**: Medium, Substack, The Verge, Stripe Press
#### Category E: Utility/Productivity Tools
**Characteristics**: Task-completion focused, power users, efficiency paramount, "learn once, use forever"
**Design Approach**:
- Function dictates form completely—every pixel earns its place
- Keyboard-first interactions with visible shortcuts
- Dense but organized UI with clear information hierarchy
- Consistent patterns that become muscle memory
- Speed and responsiveness over visual flourish
**Typography**: Inter, SF Pro, or Geist (clean, neutral, highly legible at small sizes)
**Layout Signature**: Command palette, sidebar + main content, keyboard shortcuts, batch operations, contextual toolbars
**Reference Aesthetic**: VS Code, Figma, Notion, Linear, Raycast
#### Category F: E-commerce/Marketplace
**Characteristics**: Product-focused, trust and conversion critical, browsing + buying flows
**Design Approach**:
- Product imagery is hero—high-quality, consistent photography style
- Clear pricing and availability, no surprises
- Trust signals throughout (reviews, ratings, security badges, return policy)
- Frictionless path to purchase
- Filtering and search that actually work
**Typography**: Outfit + Inter, or DM Sans (clean, doesn't compete with products)
**Layout Signature**: Product grid, image gallery with zoom, sticky add-to-cart, breadcrumb navigation, review sections
**Reference Aesthetic**: Apple Store, Shopify Dawn theme, SSENSE, minimal e-commerce
#### Category G: Creative/Portfolio/Experimental
**Characteristics**: Self-expression, memorable impression, showcasing work, breaking conventions intentionally
**Design Approach**:
- Rules are meant to be broken—but break them purposefully
- Let the work shine with minimal competing UI
- Surprise through unexpected interactions and transitions
- Full-bleed imagery, dramatic typography, bold color choices
- Personality over convention
**Typography**: Space Grotesk, Syne, or Bodoni Moda (distinctive, memorable)
**Layout Signature**: Case study layouts, hover reveals, unconventional navigation, scroll-triggered animations, full-screen sections
**Reference Aesthetic**: Awwwards winners, design agency portfolios, experimental web
#### Hybrid Projects
Many projects combine elements from multiple categories. When this happens:
1. **Identify the primary category** based on the core user action (reading? transacting? socializing? analyzing?)
2. **Borrow selectively** from secondary categories for specific sections
3. **Maintain consistency** — don't mix competing aesthetics (e.g., playful social fonts with dense dashboard layouts)
**Common hybrids**:
- **Finance apps**: Dashboard (data) + Consumer (engagement) — prioritize trust and clarity
- **Learning platforms**: Editorial (content) + Utility (tools) — prioritize readability
- **Health/Fitness**: Consumer (motivation) + Dashboard (tracking) — balance encouragement with data
- **Gaming/Entertainment**: Creative (personality) + Social (community) — prioritize engagement and delight
### Step 2: Establish Visual Hierarchy
Every screen must have a clear visual hierarchy. Users should instantly know:
1. **What is this page about?** (Primary headline/hero)
2. **What are my options?** (Navigation, key actions)
3. **What should I do next?** (Primary CTA)
4. **What else is here?** (Secondary content)
**Hierarchy Tools** (use in combination):
- **Size**: Larger = more important (headlines 2-3x body size minimum; use 18px+ for body text, 40px+ for headlines)
- **Weight**: Bolder = more important (but use sparingly—max 2-3 weights per page)
- **Color**: High contrast = more important; muted = secondary
- **Position**: Top-left and center draw attention first (F-pattern and Z-pattern reading)
- **Whitespace**: More space around an element = more importance
- **Depth**: Elevated elements (shadows, gradients, glows, rounded corners ~16px) demand attention
**Common Hierarchy Mistakes to Avoid**:
- ❌ Everything the same size (nothing stands out)
- ❌ Too many "primary" buttons (decision paralysis)
- ❌ Important actions buried below the fold
- ❌ Competing visual weights fighting for attention
- ❌ Headers that don't clearly describe the section
### Design Principles ### Design Principles
- Achieve Apple-level refinement with meticulous attention to detail, ensuring designs evoke strong emotions (e.g., wonder, inspiration, energy) through color, motion, and composition - Achieve Apple-level refinement with meticulous attention to detail, ensuring designs evoke strong emotions (e.g., wonder, inspiration, energy) through color, motion, and composition
- Deliver fully functional interactive components with intuitive feedback states, ensuring every element has a clear purpose and enhances user engagement - Deliver fully functional interactive components with intuitive feedback states, ensuring every element has a clear purpose and enhances user engagement
- Use custom illustrations, 3D elements, or symbolic visuals instead of generic stock imagery to create a unique brand narrative; stock imagery, when required, must be sourced exclusively from Pexels (NEVER Unsplash) and align with the design's emotional tone - Use custom illustrations, 3D elements, or symbolic visuals instead of generic stock imagery to create a unique brand narrative; stock imagery, when required, must be sourced exclusively from Pexels (NEVER Unsplash) and align with the design’s emotional tone
- Ensure designs feel alive and modern with dynamic elements like gradients, glows, or parallax effects, avoiding static or flat aesthetics - Ensure designs feel alive and modern with dynamic elements like gradients, glows, or parallax effects, avoiding static or flat aesthetics
- Before finalizing, ask: "Would this design make Apple or Stripe designers pause and take notice?" If not, iterate until it does - Before finalizing, ask: "Would this design make Apple or Stripe designers pause and take notice?" If not, iterate until it does
### Avoid Generic Design ### Avoid Generic Design
- No basic layouts (e.g., text-on-left, image-on-right) without significant custom polish, such as dynamic backgrounds, layered visuals, or interactive elements - No basic layouts (e.g., text-on-left, image-on-right) without significant custom polish, such as dynamic backgrounds, layered visuals, or interactive elements
- No simplistic headers; they must be immersive, animated, and reflective of the brand's core identity and mission - No simplistic headers; they must be immersive, animated, and reflective of the brand’s core identity and mission
- No designs that could be mistaken for free templates or overused patterns; every element must feel intentional and tailored - No designs that could be mistaken for free templates or overused patterns; every element must feel intentional and tailored
**The "AI Slop" Checklist** — If your design has 3+ of these, redesign:
- ❌ Purple-to-blue gradient backgrounds
- ❌ Generic "flat people" illustrations
- ❌ Card grids with identical sizing and spacing
- ❌ "Icon + text" headers with no visual interest
- ❌ Inter or system fonts with no personality
- ❌ Every element centered on the page
- ❌ Generic hero with "Welcome to [App Name]"
- ❌ Stock OR Generated photos that feel disconnected from content
- ❌ Overly rounded corners on everything (eg border-radius-3xl everywhere)
- ❌ No visual hierarchy—everything looks equally important
### Interaction Patterns ### Interaction Patterns
- Use progressive disclosure for complex forms or content to guide users intuitively and reduce cognitive load - Use progressive disclosure for complex forms or content to guide users intuitively and reduce cognitive load
@@ -1427,7 +1217,7 @@ Every screen must have a clear visual hierarchy. Users should instantly know:
### Technical Requirements ### Technical Requirements
- Curated color palette (3-5 evocative colors + neutrals) that aligns with the brand's emotional tone and creates a memorable impact - Curated color FRpalette (3-5 evocative colors + neutrals) that aligns with the brand’s emotional tone and creates a memorable impact
- Ensure a minimum 4.5:1 contrast ratio for all text and interactive elements to meet accessibility standards - Ensure a minimum 4.5:1 contrast ratio for all text and interactive elements to meet accessibility standards
- Use expressive, readable fonts (18px+ for body text, 40px+ for headlines) with a clear hierarchy; pair a modern sans-serif (e.g., Inter) with an elegant serif (e.g., Playfair Display) for personality - Use expressive, readable fonts (18px+ for body text, 40px+ for headlines) with a clear hierarchy; pair a modern sans-serif (e.g., Inter) with an elegant serif (e.g., Playfair Display) for personality
- Design for full responsiveness, ensuring flawless performance and aesthetics across all screen sizes (mobile, tablet, desktop) - Design for full responsiveness, ensuring flawless performance and aesthetics across all screen sizes (mobile, tablet, desktop)
@@ -1441,7 +1231,7 @@ Every screen must have a clear visual hierarchy. Users should instantly know:
- Design reusable, modular components with consistent styling, behavior, and feedback states (e.g., hover, active, focus, error) - Design reusable, modular components with consistent styling, behavior, and feedback states (e.g., hover, active, focus, error)
- Include purposeful animations (e.g., scale-up on hover, fade-in on scroll) to guide attention and enhance interactivity without distraction - Include purposeful animations (e.g., scale-up on hover, fade-in on scroll) to guide attention and enhance interactivity without distraction
- Ensure full accessibility support with keyboard navigation, ARIA labels, and visible focus states (e.g., a glowing outline in an accent color) - Ensure full accessibility support with keyboard navigation, ARIA labels, and visible focus states (e.g., a glowing outline in an accent color)
- Use custom icons or illustrations for components to reinforce the brand's visual identity - Use custom icons or illustrations for components to reinforce the brand’s visual identity
### Adding Fonts ### Adding Fonts
@@ -1508,42 +1298,6 @@ When users specify color schemes:
- Add hover and focus states for interactive elements - Add hover and focus states for interactive elements
- **Use `hover:bg-muted` for hover states on clickable cards/buttons** - provides subtle, accessible feedback without overpowering the design (avoid `hover:bg-accent` or `hover:bg-secondary` which can be too strong) - **Use `hover:bg-muted` for hover states on clickable cards/buttons** - provides subtle, accessible feedback without overpowering the design (avoid `hover:bg-accent` or `hover:bg-secondary` which can be too strong)
### Mandatory Design Review
**CRITICAL: After completing the initial build, you MUST perform a design review before considering the project done.**
**Design Review Checklist**:
1. **Screenshot Test**: Take a mental screenshot. Does it look like a designed product or a template?
2. **Category Alignment**: Does the design match its project category? A dashboard shouldn't look like a landing page.
3. **Visual Hierarchy**: Can you identify the #1 most important thing on each screen in under 2 seconds?
4. **Typography Check**:
- Is there clear size contrast between headlines and body?
- Are fonts appropriate for the project category?
- Is line-height comfortable for reading?
5. **Color Check**:
- Do text colors meet contrast requirements?
- Is the brand color used strategically (not everywhere)?
- Does the palette feel cohesive?
6. **Spacing Check**:
- Is spacing consistent throughout?
- Is there enough whitespace, or does it feel cramped?
- Do sections have clear boundaries?
7. **Interaction Check**:
- Do buttons have hover/active states?
- Do inputs have clear focus states?
- Is there loading/success/error feedback?
8. **The "Would I Use This?" Test**: If you encountered this product, would you trust it? Does it feel professional?
**If any check fails, iterate on the design before delivering.** Do not ship designs that feel generic or unpolished.
## Writing Tests vs Running Tests ## Writing Tests vs Running Tests
There is an important distinction between **writing new tests** and **running existing tests**: There is an important distinction between **writing new tests** and **running existing tests**:
+32
View File
@@ -0,0 +1,32 @@
# Changelog
## [9.10.1] - 2026-04-02
### Fixed
- Fix Android app showing default Capacitor icon instead of Shakespeare logo in app drawer
## [9.10.0] - 2026-04-02
### Added
- Android app powered by Capacitor with deep links, splash screen, and signed release builds
- CI pipeline for building APKs, publishing to GitLab releases, and distributing via Zapstore
- Nsite deployment for decentralized hosting via Nostr
### Changed
- Make version number on mobile settings a clickable link to the changelog with build date
## [9.9.2] - 2026-04-02
### Changed
- Simplify nsite deployment to always use named sites, removing the root site option
### Fixed
- Fix crash in "What's new" toast when used outside the router context
- Truncate long changelog excerpts in update notifications so they fit neatly in the toast
- Left-align changelog page content for better readability
## [9.9.1] - 2026-04-02
### Added
- Changelog page and versioning system with "What's new" toast notifications on updates
- Release skill for managing versioned releases with changelog generation and git tagging
+101
View File
@@ -0,0 +1,101 @@
# Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore
# Built application files
*.apk
*.aar
*.ap_
*.aab
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
# Uncomment the following line in case you need and you don't have the release build type files in your app
# release/
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# IntelliJ
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml
# Keystore files
*.jks
*.keystore
key.properties
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/
# Google Services (e.g. APIs or Firebase)
# google-services.json
# Freeline
freeline.py
freeline/
freeline_project_description.json
# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md
# Version control
vcs.xml
# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/
# Android Profiling
*.hprof
# Cordova plugins for Capacitor
capacitor-cordova-android-plugins
# Copied web assets
app/src/main/assets/public
# Generated Config files
app/src/main/assets/capacitor.config.json
app/src/main/assets/capacitor.plugins.json
app/src/main/res/xml/config.xml
+28
View File
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>android</name>
<comment>Project android created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1775119841750</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
@@ -0,0 +1,13 @@
arguments=--init-script /home/alex/.cache/opencode/bin/jdtls/config_linux/org.eclipse.osgi/58/0/.cp/gradle/init/init.gradle
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=/usr/lib/jvm/java-21-openjdk-amd64
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
+2
View File
@@ -0,0 +1,2 @@
/build/*
!/build/.npmkeep
+34
View File
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>app</name>
<comment>Project app created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1775119841776</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
@@ -0,0 +1,2 @@
connection.project.dir=..
eclipse.preferences.version=1
+73
View File
@@ -0,0 +1,73 @@
apply plugin: 'com.android.application'
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
namespace = "diy.shakespeare.app"
compileSdk = rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "diy.shakespeare.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "9.9.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern = '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
}
signingConfigs {
release {
if (keystorePropertiesFile.exists()) {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
repositories {
flatDir{
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
implementation project(':capacitor-android')
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation project(':capacitor-cordova-android-plugins')
}
apply from: 'capacitor.build.gradle'
try {
def servicesJSON = file('google-services.json')
if (servicesJSON.text) {
apply plugin: 'com.google.gms.google-services'
}
} catch(Exception e) {
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}
+20
View File
@@ -0,0 +1,20 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
}
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
implementation project(':capacitor-app')
implementation project(':capacitor-status-bar')
}
if (hasProperty('postBuildExtras')) {
postBuildExtras()
}
+28
View File
@@ -0,0 +1,28 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Keep Capacitor classes (WebView JS bridge)
-keep class com.getcapacitor.** { *; }
-keep class diy.shakespeare.app.** { *; }
# Keep WebView JS interfaces
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}
# Keep OkHttp (used by Capacitor)
-dontwarn okhttp3.**
-dontwarn okio.**
-keep class okhttp3.** { *; }
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
@@ -0,0 +1,26 @@
package com.getcapacitor.myapp;
import static org.junit.Assert.*;
import android.content.Context;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.getcapacitor.app", appContext.getPackageName());
}
}
+50
View File
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation|density"
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBarLaunch"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Deep links: open shakespeare.diy URLs in the app -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="shakespeare.diy" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"></meta-data>
</provider>
</application>
<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
@@ -0,0 +1,5 @@
package diy.shakespeare.app;
import com.getcapacitor.BridgeActivity;
public class MainActivity extends BridgeActivity {}
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

@@ -0,0 +1,53 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<!--
Shakespeare parrot logo from public/shakespeare.svg.
SVG viewBox is "0 0 128 128".
We scale to ~55% and center within the 108x108 viewport to fit
Android's adaptive icon safe zone (66% of 108dp).
Scale factor: 108 * 0.55 / 128 ≈ 0.464. Translate to center.
-->
<group
android:translateX="24.3"
android:translateY="15.5"
android:scaleX="0.464"
android:scaleY="0.464">
<!-- Beak right -->
<path
android:fillColor="#FFFFFF"
android:pathData="M110.28,61.32l2.63,8.84c0,0,7.24,-1.6,7.62,3.2c0.38,4.8,-6.77,8,-6.77,8l2.26,10.63 c0,0,7.9,-6.4,8,-15.61c0,0,0.66,-11.29,-6.11,-13.92C113.67,60.85,110.28,61.32,110.28,61.32z"/>
<!-- Tail feathers -->
<path
android:fillColor="#FFFFFF"
android:pathData="M68.71,94.99c0,0,-11.1,-4.7,-16.46,1.98c-0.75,0.94,-1.41,1.88,-2.16,2.82 c-0.56,0.75,-1.13,1.5,-1.69,2.16c-0.47,0.56,-1.03,1.13,-1.69,1.5c-0.66,0.38,-1.32,0.66,-2.07,0.85c-0.94,0.19,-1.88,0.19,-2.82,0.09 c-1.32,-0.09,-2.63,-0.38,-3.95,-0.66c-0.47,-0.09,-0.85,-0.19,-1.22,-0.28c-0.09,0,-0.19,-0.09,-0.28,-0.09 s-0.19,-0.09,-0.28,-0.09c-0.38,0.09,0.19,0.75,0.38,0.94c0.28,0.28,0.56,0.66,0.85,0.94c0.85,0.75,1.69,1.5,2.73,1.98 c1.32,0.66,2.73,1.03,4.14,1.13c0.09,0,0.38,0,0.47,0.09c0.19,0.19,-0.28,0.47,-0.47,0.56c-0.28,0.19,-0.47,0.28,-0.75,0.38 c-0.85,0.38,-1.79,0.56,-2.63,0.75c-0.85,0.19,-1.69,0.28,-2.45,0.28c-0.47,0,-0.85,0.09,-1.22,0.09c-0.28,0,-0.56,-0.09,-0.85,0 s0.09,0.47,0.28,0.56c0.38,0.19,0.75,0.47,1.13,0.66c1.13,0.56,2.26,1.03,3.39,1.32c1.5,0.38,3.1,0.56,4.61,0.38 c1.32,-0.19,2.63,-0.56,3.86,-1.03c6.77,-3.1,6.21,-9.59,12.42,-10.16c4.61,-0.38,11.1,2.07,11.1,2.07L68.71,94.99z"/>
<!-- Beak left -->
<path
android:fillColor="#FFFFFF"
android:pathData="M19.79,38.28c0,0,-12.13,1.98,-15.24,12.79C0.61,64.9,20.26,69.5,20.26,69.5l1.22,-9.41 c0,0,-13.07,-1.32,-12.32,-6.3c0.94,-6.21,11.85,-5.64,11.85,-5.64L19.79,38.28z"/>
<!-- Wing detail -->
<path
android:fillColor="#FFFFFF"
android:pathData="M20.73,70.92c0,0,-1.88,0.56,-4.61,2.54c-1.88,1.32,-4.42,3.01,-6.87,5.93 c-1.22,1.41,-2.16,3.1,-2.82,4.89c-0.47,1.22,-0.66,2.45,-0.66,3.76c0,0.28,0,0.56,0,0.85c0,0.09,0,0.85,0.28,0.66 c0.09,-0.09,0.19,-0.38,0.28,-0.47c0.19,-0.47,0.47,-0.85,0.75,-1.22c0.85,-1.13,1.88,-2.16,3.01,-3.01c0.38,-0.28,0.75,-0.47,1.13,-0.66 c0.28,-0.28,0.75,-0.66,0.94,-0.28c0.09,0.19,-0.09,0.47,-0.19,0.66c-0.09,0.28,-0.19,0.66,-0.19,0.94c-0.38,1.5,-0.56,3.01,-0.75,4.51 c-0.09,0.85,-0.09,1.69,0,2.45c0,0.38,0.09,0.85,0.09,1.22c0,0.19,0.09,0.38,0.09,0.56c0,0.19,0.19,0.47,0.38,0.19 c0.09,-0.09,0.09,-0.19,0.19,-0.38c0.19,-0.28,0.28,-0.66,0.47,-0.94c0.47,-0.85,0.94,-1.69,1.5,-2.63c0.66,-1.13,1.41,-2.16,2.16,-3.1 c0.85,-1.13,1.88,-2.26,2.92,-3.2c1.13,-1.03,2.35,-2.07,3.67,-2.92c0.75,-0.47,1.6,-0.94,2.45,-1.32L20.73,70.92z"/>
<!-- Body -->
<path
android:fillColor="#FFFFFF"
android:pathData="M116.4,79.29c-1.13,-5.55,-2.73,-11.01,-4.51,-16.46c-1.5,-4.61,-3.1,-9.31,-5.83,-13.36 c-1.22,-1.79,-3.01,-3.01,-5.27,-3.86c-4.33,-1.69,-9.97,-1.98,-13.73,-1.98c-5.64,0,-11.48,1.22,-16.74,3.67 c-1.88,5.64,-7.05,19.94,-14.86,26.34c0.47,2.63,1.03,5.36,1.79,8c1.32,4.61,3.01,9.22,4.61,13.83c1.5,4.42,3.29,8.84,6.58,12.23 c0.85,0.94,1.88,1.69,2.82,2.45c2.26,1.88,4.99,3.01,7.71,3.95c2.54,0.85,5.17,1.5,7.81,2.07c4.7,1.03,11.48,2.82,16.08,0.66 c2.54,-1.13,4.61,-2.92,6.3,-5.08c1.79,-2.26,3.2,-4.8,4.42,-7.43c1.88,-3.95,3.86,-8.37,4.14,-12.89 C117.99,87.38,117.24,83.24,116.4,79.29z"/>
<!-- Head -->
<path
android:fillColor="#FFFFFF"
android:pathData="M77.64,33.57c-0.28,-1.03,-1.03,-2.07,-1.6,-3.01c-6.3,-11.01,-20.04,-16.27,-32.26,-15.52 c-3.76,0.28,-9.31,0.85,-13.54,2.73c-2.07,0.94,-3.86,2.35,-4.99,4.14c-2.54,4.23,-3.76,8.94,-5.08,13.64 C18.67,41,17.35,46.55,16.5,52.2c-0.75,4.89,-1.41,10.25,-0.09,15.14c1.03,3.86,3.29,9.22,5.74,12.32 c2.73,3.39,6.58,7.34,10.72,8.84c0.75,0.28,1.6,0.47,2.45,0.66c1.6,0.28,3.29,0.47,4.89,0.19c0.94,-0.19,1.98,-0.28,2.92,-0.56 c1.88,-0.47,3.67,-1.13,5.46,-1.79c7.52,-3.01,13.64,-7.43,17.68,-14.58c1.69,-3.1,3.1,-6.4,4.42,-9.69c0.09,-0.19,0.19,-0.38,0.19,-0.56 c1.98,-5.46,3.29,-11.19,4.61,-16.84c0.66,-2.73,1.41,-5.55,1.79,-8.37C77.55,35.92,77.92,34.7,77.64,33.57z"/>
</group>
</vector>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillColor="#2b0037"
android:pathData="M0,0h108v108h-108z" />
</vector>
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

@@ -0,0 +1,53 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="240dp"
android:height="240dp"
android:viewportWidth="1200"
android:viewportHeight="1200">
<!--
Android 12 splash screen masks the icon to a circle at 2/3 of canvas (160dp of 240dp).
The Shakespeare logo SVG has viewBox="0 0 128 128".
We scale the 128x128 logo to fit ~800x800 in the center of 1200x1200,
leaving ~200px padding on each side for the circular safe zone.
Scale factor: 800/128 = 6.25. Translate: (200, 200) to shift origin.
-->
<group
android:translateX="200"
android:translateY="200"
android:scaleX="6.25"
android:scaleY="6.25">
<!-- Red beak right -->
<path
android:fillColor="#FFFFFF"
android:pathData="M110.28,61.32l2.63,8.84c0,0,7.24,-1.6,7.62,3.2c0.38,4.8,-6.77,8,-6.77,8l2.26,10.63 c0,0,7.9,-6.4,8,-15.61c0,0,0.66,-11.29,-6.11,-13.92C113.67,60.85,110.28,61.32,110.28,61.32z"/>
<!-- Red tail feathers -->
<path
android:fillColor="#FFFFFF"
android:pathData="M68.71,94.99c0,0,-11.1,-4.7,-16.46,1.98c-0.75,0.94,-1.41,1.88,-2.16,2.82 c-0.56,0.75,-1.13,1.5,-1.69,2.16c-0.47,0.56,-1.03,1.13,-1.69,1.5c-0.66,0.38,-1.32,0.66,-2.07,0.85c-0.94,0.19,-1.88,0.19,-2.82,0.09 c-1.32,-0.09,-2.63,-0.38,-3.95,-0.66c-0.47,-0.09,-0.85,-0.19,-1.22,-0.28c-0.09,0,-0.19,-0.09,-0.28,-0.09 s-0.19,-0.09,-0.28,-0.09c-0.38,0.09,0.19,0.75,0.38,0.94c0.28,0.28,0.56,0.66,0.85,0.94c0.85,0.75,1.69,1.5,2.73,1.98 c1.32,0.66,2.73,1.03,4.14,1.13c0.09,0,0.38,0,0.47,0.09c0.19,0.19,-0.28,0.47,-0.47,0.56c-0.28,0.19,-0.47,0.28,-0.75,0.38 c-0.85,0.38,-1.79,0.56,-2.63,0.75c-0.85,0.19,-1.69,0.28,-2.45,0.28c-0.47,0,-0.85,0.09,-1.22,0.09c-0.28,0,-0.56,-0.09,-0.85,0 s0.09,0.47,0.28,0.56c0.38,0.19,0.75,0.47,1.13,0.66c1.13,0.56,2.26,1.03,3.39,1.32c1.5,0.38,3.1,0.56,4.61,0.38 c1.32,-0.19,2.63,-0.56,3.86,-1.03c6.77,-3.1,6.21,-9.59,12.42,-10.16c4.61,-0.38,11.1,2.07,11.1,2.07L68.71,94.99z"/>
<!-- Red beak left -->
<path
android:fillColor="#FFFFFF"
android:pathData="M19.79,38.28c0,0,-12.13,1.98,-15.24,12.79C0.61,64.9,20.26,69.5,20.26,69.5l1.22,-9.41 c0,0,-13.07,-1.32,-12.32,-6.3c0.94,-6.21,11.85,-5.64,11.85,-5.64L19.79,38.28z"/>
<!-- Red wing detail -->
<path
android:fillColor="#FFFFFF"
android:pathData="M20.73,70.92c0,0,-1.88,0.56,-4.61,2.54c-1.88,1.32,-4.42,3.01,-6.87,5.93 c-1.22,1.41,-2.16,3.1,-2.82,4.89c-0.47,1.22,-0.66,2.45,-0.66,3.76c0,0.28,0,0.56,0,0.85c0,0.09,0,0.85,0.28,0.66 c0.09,-0.09,0.19,-0.38,0.28,-0.47c0.19,-0.47,0.47,-0.85,0.75,-1.22c0.85,-1.13,1.88,-2.16,3.01,-3.01c0.38,-0.28,0.75,-0.47,1.13,-0.66 c0.28,-0.28,0.75,-0.66,0.94,-0.28c0.09,0.19,-0.09,0.47,-0.19,0.66c-0.09,0.28,-0.19,0.66,-0.19,0.94c-0.38,1.5,-0.56,3.01,-0.75,4.51 c-0.09,0.85,-0.09,1.69,0,2.45c0,0.38,0.09,0.85,0.09,1.22c0,0.19,0.09,0.38,0.09,0.56c0,0.19,0.19,0.47,0.38,0.19 c0.09,-0.09,0.09,-0.19,0.19,-0.38c0.19,-0.28,0.28,-0.66,0.47,-0.94c0.47,-0.85,0.94,-1.69,1.5,-2.63c0.66,-1.13,1.41,-2.16,2.16,-3.1 c0.85,-1.13,1.88,-2.26,2.92,-3.2c1.13,-1.03,2.35,-2.07,3.67,-2.92c0.75,-0.47,1.6,-0.94,2.45,-1.32L20.73,70.92z"/>
<!-- Yellow body -->
<path
android:fillColor="#FFFFFF"
android:pathData="M116.4,79.29c-1.13,-5.55,-2.73,-11.01,-4.51,-16.46c-1.5,-4.61,-3.1,-9.31,-5.83,-13.36 c-1.22,-1.79,-3.01,-3.01,-5.27,-3.86c-4.33,-1.69,-9.97,-1.98,-13.73,-1.98c-5.64,0,-11.48,1.22,-16.74,3.67 c-1.88,5.64,-7.05,19.94,-14.86,26.34c0.47,2.63,1.03,5.36,1.79,8c1.32,4.61,3.01,9.22,4.61,13.83c1.5,4.42,3.29,8.84,6.58,12.23 c0.85,0.94,1.88,1.69,2.82,2.45c2.26,1.88,4.99,3.01,7.71,3.95c2.54,0.85,5.17,1.5,7.81,2.07c4.7,1.03,11.48,2.82,16.08,0.66 c2.54,-1.13,4.61,-2.92,6.3,-5.08c1.79,-2.26,3.2,-4.8,4.42,-7.43c1.88,-3.95,3.86,-8.37,4.14,-12.89 C117.99,87.38,117.24,83.24,116.4,79.29z"/>
<!-- Blue head -->
<path
android:fillColor="#FFFFFF"
android:pathData="M77.64,33.57c-0.28,-1.03,-1.03,-2.07,-1.6,-3.01c-6.3,-11.01,-20.04,-16.27,-32.26,-15.52 c-3.76,0.28,-9.31,0.85,-13.54,2.73c-2.07,0.94,-3.86,2.35,-4.99,4.14c-2.54,4.23,-3.76,8.94,-5.08,13.64 C18.67,41,17.35,46.55,16.5,52.2c-0.75,4.89,-1.41,10.25,-0.09,15.14c1.03,3.86,3.29,9.22,5.74,12.32 c2.73,3.39,6.58,7.34,10.72,8.84c0.75,0.28,1.6,0.47,2.45,0.66c1.6,0.28,3.29,0.47,4.89,0.19c0.94,-0.19,1.98,-0.28,2.92,-0.56 c1.88,-0.47,3.67,-1.13,5.46,-1.79c7.52,-3.01,13.64,-7.43,17.68,-14.58c1.69,-3.1,3.1,-6.4,4.42,-9.69c0.09,-0.19,0.19,-0.38,0.19,-0.56 c1.98,-5.46,3.29,-11.19,4.61,-16.84c0.66,-2.73,1.41,-5.55,1.79,-8.37C77.55,35.92,77.92,34.7,77.64,33.57z"/>
</group>
</vector>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#2b0037</color>
</resources>
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="app_name">Shakespeare</string>
<string name="title_activity_main">Shakespeare</string>
<string name="package_name">diy.shakespeare.app</string>
<string name="custom_url_scheme">diy.shakespeare.app</string>
</resources>
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:background">@null</item>
</style>
<style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">#2b0037</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon_vector</item>
<item name="postSplashScreenTheme">@style/AppTheme.NoActionBar</item>
</style>
</resources>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="my_images" path="." />
<cache-path name="my_cache_images" path="." />
</paths>
@@ -0,0 +1,18 @@
package com.getcapacitor.myapp;
import static org.junit.Assert.*;
import org.junit.Test;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
+29
View File
@@ -0,0 +1,29 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.13.0'
classpath 'com.google.gms:google-services:4.4.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
apply from: "variables.gradle"
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
+9
View File
@@ -0,0 +1,9 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
include ':capacitor-android'
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
include ':capacitor-app'
project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android')
include ':capacitor-status-bar'
project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android')
+22
View File
@@ -0,0 +1,22 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored Executable
+251
View File
@@ -0,0 +1,251 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
+94
View File
@@ -0,0 +1,94 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+5
View File
@@ -0,0 +1,5 @@
include ':app'
include ':capacitor-cordova-android-plugins'
project(':capacitor-cordova-android-plugins').projectDir = new File('./capacitor-cordova-android-plugins/')
apply from: 'capacitor.settings.gradle'
+16
View File
@@ -0,0 +1,16 @@
ext {
minSdkVersion = 24
compileSdkVersion = 36
targetSdkVersion = 36
androidxActivityVersion = '1.11.0'
androidxAppCompatVersion = '1.7.1'
androidxCoordinatorLayoutVersion = '1.3.0'
androidxCoreVersion = '1.17.0'
androidxFragmentVersion = '1.8.9'
coreSplashScreenVersion = '1.2.0'
androidxWebkitVersion = '1.14.0'
junitVersion = '4.13.2'
androidxJunitVersion = '1.3.0'
androidxEspressoCoreVersion = '3.7.0'
cordovaAndroidVersion = '14.0.1'
}
+25
View File
@@ -0,0 +1,25 @@
import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'diy.shakespeare.app',
appName: 'Shakespeare',
webDir: 'dist',
server: {
// Handle deep links from your domain
hostname: 'shakespeare.diy',
androidScheme: 'https',
iosScheme: 'https'
},
android: {
// Enable safe area handling for notches and navigation bars
allowMixedContent: false,
backgroundColor: '#2b0037'
},
ios: {
backgroundColor: '#2b0037',
contentInset: 'automatic',
scheme: 'Shakespeare'
}
};
export default config;
+1678 -662
View File
File diff suppressed because it is too large. Load diff
+10 -2
View File
@@ -3,7 +3,7 @@
"description": "Build custom apps with AI assistance using Shakespeare, an open-source development environment", "description": "Build custom apps with AI assistance using Shakespeare, an open-source development environment",
"homepage": "https://shakespeare.diy", "homepage": "https://shakespeare.diy",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"version": "0.0.0", "version": "9.10.1",
"type": "module", "type": "module",
"author": { "author": {
"name": "shakespeare.diy", "name": "shakespeare.diy",
@@ -17,9 +17,14 @@
"dev": "npm i --silent && vite", "dev": "npm i --silent && vite",
"build": "npm i --silent && vite build -l error && cp dist/index.html dist/404.html && echo 'Project built successfully!'", "build": "npm i --silent && vite build -l error && cp dist/index.html dist/404.html && echo 'Project built successfully!'",
"typecheck": "npm i --silent && tsc --noEmit", "typecheck": "npm i --silent && tsc --noEmit",
"test": "npm i --silent && eslint && vitest run --reporter=dot --silent && echo 'All tests passed!'" "test": "npm i --silent && eslint && vitest run --reporter=dot --silent && echo 'All tests passed!'",
"keygen": "keytool -genkey -v -keystore android/app/my-upload-key.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias upload",
"icons": "bash scripts/generate-icons.sh"
}, },
"dependencies": { "dependencies": {
"@capacitor/app": "^8.1.0",
"@capacitor/core": "^8.3.0",
"@capacitor/status-bar": "^8.0.2",
"@dnd-kit/core": "^6.3.1", "@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0", "@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2", "@dnd-kit/utilities": "^3.2.2",
@@ -32,6 +37,7 @@
"@nostrify/nostrify": "^0.49.2", "@nostrify/nostrify": "^0.49.2",
"@nostrify/react": "^0.2.24", "@nostrify/react": "^0.2.24",
"@opensecret/react": "^1.5.4", "@opensecret/react": "^1.5.4",
"@plausible-analytics/tracker": "^0.4.4",
"@radix-ui/react-accordion": "^1.2.0", "@radix-ui/react-accordion": "^1.2.0",
"@radix-ui/react-alert-dialog": "^1.1.1", "@radix-ui/react-alert-dialog": "^1.1.1",
"@radix-ui/react-aspect-ratio": "^1.1.0", "@radix-ui/react-aspect-ratio": "^1.1.0",
@@ -110,6 +116,8 @@
"zod": "^4.3.6" "zod": "^4.3.6"
}, },
"devDependencies": { "devDependencies": {
"@capacitor/android": "^8.3.0",
"@capacitor/cli": "^8.3.0",
"@eslint/js": "^9.9.0", "@eslint/js": "^9.9.0",
"@html-eslint/eslint-plugin": "^0.41.0", "@html-eslint/eslint-plugin": "^0.41.0",
"@html-eslint/parser": "^0.41.0", "@html-eslint/parser": "^0.41.0",
+32
View File
@@ -0,0 +1,32 @@
# Changelog
## [9.10.1] - 2026-04-02
### Fixed
- Fix Android app showing default Capacitor icon instead of Shakespeare logo in app drawer
## [9.10.0] - 2026-04-02
### Added
- Android app powered by Capacitor with deep links, splash screen, and signed release builds
- CI pipeline for building APKs, publishing to GitLab releases, and distributing via Zapstore
- Nsite deployment for decentralized hosting via Nostr
### Changed
- Make version number on mobile settings a clickable link to the changelog with build date
## [9.9.2] - 2026-04-02
### Changed
- Simplify nsite deployment to always use named sites, removing the root site option
### Fixed
- Fix crash in "What's new" toast when used outside the router context
- Truncate long changelog excerpts in update notifications so they fit neatly in the toast
- Left-align changelog page content for better readability
## [9.9.1] - 2026-04-02
### Added
- Changelog page and versioning system with "What's new" toast notifications on updates
- Release skill for managing versioned releases with changelog generation and git tagging
+170
View File
@@ -0,0 +1,170 @@
#!/bin/bash
set -e
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo -e "${GREEN}Generating app icons...${NC}\n"
# Check for inkscape (preferred) or rsvg-convert as fallback
if command -v inkscape &> /dev/null; then
SVG_RENDERER="inkscape"
elif command -v rsvg-convert &> /dev/null; then
SVG_RENDERER="rsvg"
else
echo -e "${YELLOW}Warning: neither inkscape nor rsvg-convert found. Install one to render SVG icons.${NC}"
echo "On Fedora/RHEL: sudo dnf install inkscape"
echo "On Ubuntu/Debian: sudo apt-get install inkscape"
exit 1
fi
# Check if ImageMagick is installed (needed for compositing).
# ImageMagick 7+ uses `magick`; ImageMagick 6 (Ubuntu/Debian) uses `convert`.
if command -v magick &> /dev/null; then
MAGICK="magick"
elif command -v convert &> /dev/null; then
MAGICK="convert"
else
echo -e "${YELLOW}Warning: ImageMagick not found. Please install it to generate icons.${NC}"
echo "On Fedora/RHEL: sudo dnf install ImageMagick"
echo "On Ubuntu/Debian: sudo apt-get install imagemagick"
exit 1
fi
# Source SVG logo
SOURCE_SVG="public/shakespeare.svg"
if [ ! -f "$SOURCE_SVG" ]; then
echo -e "${YELLOW}Error: Source logo not found at $SOURCE_SVG${NC}"
exit 1
fi
# Brand colors
BG_COLOR="#2b0037" # Shakespeare purple
TMPDIR=$(mktemp -d)
LOGO_WHITE_SVG="$TMPDIR/logo_white.svg"
LOGO_WHITE="$TMPDIR/logo_white.png"
# Recolor the SVG fills to white before rasterizing.
sed -E 's/fill:#[0-9A-Fa-f]{6}/fill:#ffffff/g' "$SOURCE_SVG" > "$LOGO_WHITE_SVG"
echo "Rendering white SVG at 512x512..."
if [ "$SVG_RENDERER" = "inkscape" ]; then
inkscape --export-type=png --export-filename="$LOGO_WHITE" -w 512 -h 512 "$LOGO_WHITE_SVG" 2>/dev/null
else
rsvg-convert -w 512 -h 512 "$LOGO_WHITE_SVG" -o "$LOGO_WHITE"
fi
# ── Adaptive icon foreground PNGs (transparent bg, white logo, safe-zone padding) ──
# Content at 47% of canvas to fit within Android's adaptive icon safe zone.
echo "Generating adaptive foreground PNGs..."
make_foreground() {
local size=$1
local content_size=$(echo "$size * 47 / 100" | bc)
local dest=$2
$MAGICK -size "${size}x${size}" "xc:none" \
\( "$LOGO_WHITE" -resize "${content_size}x${content_size}" \) \
-gravity center -compose over -composite \
"$dest"
}
make_foreground 48 android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
make_foreground 72 android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
make_foreground 96 android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
make_foreground 144 android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
make_foreground 192 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
# ── Legacy launcher icons (ic_launcher.png and ic_launcher_round.png) ──
# These are used on pre-API-26 devices and as fallback on some launchers.
# They must have the logo composited onto the purple background — NOT just
# a solid color fill.
echo "Generating legacy launcher icons (ic_launcher.png and ic_launcher_round.png)..."
# make_legacy_square: logo on flat purple square background
make_legacy_square() {
local size=$1
local content_size=$(echo "$size * 60 / 100" | bc)
local dest=$2
$MAGICK -size "${size}x${size}" "xc:${BG_COLOR}" \
\( "$LOGO_WHITE" -resize "${content_size}x${content_size}" \) \
-gravity center -compose over -composite \
"$dest"
}
# make_legacy_round: logo on circular purple background (alpha-masked circle)
make_legacy_round() {
local size=$1
local content_size=$(echo "$size * 60 / 100" | bc)
local dest=$2
local mask="$TMPDIR/circle_mask_${size}.png"
# Create a white circle mask
$MAGICK -size "${size}x${size}" "xc:none" \
-fill white -draw "circle $((size/2)),$((size/2)) $((size/2)),0" \
"$mask"
# Fill purple, apply circle mask, composite logo
$MAGICK -size "${size}x${size}" "xc:${BG_COLOR}" \
"$mask" -compose dst-in -composite \
\( "$LOGO_WHITE" -resize "${content_size}x${content_size}" \) \
-gravity center -compose over -composite \
"$dest"
}
make_legacy_square 48 android/app/src/main/res/mipmap-mdpi/ic_launcher.png
make_legacy_square 72 android/app/src/main/res/mipmap-hdpi/ic_launcher.png
make_legacy_square 96 android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
make_legacy_square 144 android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
make_legacy_square 192 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
make_legacy_round 48 android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
make_legacy_round 72 android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
make_legacy_round 96 android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
make_legacy_round 144 android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
make_legacy_round 192 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
# Update background color
BACKGROUND_COLOR_FILE="android/app/src/main/res/values/ic_launcher_background.xml"
mkdir -p android/app/src/main/res/values
cat > "$BACKGROUND_COLOR_FILE" << 'EOF'
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#2b0037</color>
</resources>
EOF
# ── iOS App Icon (1024x1024, white logo on purple background) ──
echo "Generating iOS app icon..."
IOS_ICON_DIR="ios/App/App/Assets.xcassets/AppIcon.appiconset"
if [ -d "$IOS_ICON_DIR" ]; then
IOS_ICON="$IOS_ICON_DIR/[email protected]"
# Logo at ~60% of canvas, centered on purple background (matches legacy Android style)
$MAGICK -size "1024x1024" "xc:${BG_COLOR}" \
\( "$LOGO_WHITE" -resize "614x614" \) \
-gravity center -compose over -composite \
"$IOS_ICON"
echo -e " ${GREEN}✓${NC} $IOS_ICON"
else
echo -e " ${YELLOW}Skipped: $IOS_ICON_DIR not found${NC}"
fi
# Cleanup temp files
rm -rf "$TMPDIR"
echo -e "\n${GREEN}App icons generated successfully!${NC}"
echo -e "Icon: white Shakespeare logo on ${GREEN}${BG_COLOR}${NC} (Shakespeare purple)"
echo -e "Generated:"
echo -e " Android:"
echo -e " - ic_launcher_foreground.png (adaptive, all densities)"
echo -e " - ic_launcher.png (legacy square, all densities)"
echo -e " - ic_launcher_round.png (legacy round, all densities)"
echo -e " iOS:"
echo -e " - [email protected] (1024x1024)"
-11
View File
@@ -1,11 +0,0 @@
import { render } from '@testing-library/react';
import { test, expect } from 'vitest';
import App from './App';
test('App', () => {
const { container } = render(<App />);
// Basic smoke test to ensure App renders without crashing
expect(container).toBeInTheDocument();
})
+39 -38
View File
@@ -8,13 +8,13 @@ import { Suspense, useEffect } from 'react';
import LightningFS from '@isomorphic-git/lightning-fs'; import LightningFS from '@isomorphic-git/lightning-fs';
import NostrProvider from '@/components/NostrProvider'; import NostrProvider from '@/components/NostrProvider';
import { NostrSync } from '@/components/NostrSync'; import { NostrSync } from '@/components/NostrSync';
import { Toaster } from "@/components/ui/toaster";
import { TooltipProvider } from "@/components/ui/tooltip"; import { TooltipProvider } from "@/components/ui/tooltip";
import { NostrLoginProvider } from '@nostrify/react/login'; import { NostrLoginProvider } from '@nostrify/react/login';
import { AppProvider } from '@/components/AppProvider'; import { AppProvider } from '@/components/AppProvider';
import { AppConfig } from '@/contexts/AppContext'; import { AppConfig } from '@/contexts/AppContext';
import { useAppContext } from '@/hooks/useAppContext'; import { useAppContext } from '@/hooks/useAppContext';
import { SentryProvider } from '@/components/SentryProvider'; import { SentryProvider } from '@/components/SentryProvider';
import { PlausibleProvider } from '@/components/PlausibleProvider';
import { AISettingsProvider } from '@/components/AISettingsProvider'; import { AISettingsProvider } from '@/components/AISettingsProvider';
import { GitSettingsProvider } from '@/components/GitSettingsProvider'; import { GitSettingsProvider } from '@/components/GitSettingsProvider';
import { DeploySettingsProvider } from '@/components/DeploySettingsProvider'; import { DeploySettingsProvider } from '@/components/DeploySettingsProvider';
@@ -28,6 +28,8 @@ import { DynamicFavicon } from '@/components/DynamicFavicon';
import { OfflineIndicator } from '@/components/OfflineIndicator'; import { OfflineIndicator } from '@/components/OfflineIndicator';
import { PWAUpdatePrompt } from '@/components/PWAUpdatePrompt'; import { PWAUpdatePrompt } from '@/components/PWAUpdatePrompt';
import { ErrorBoundary } from '@/components/ErrorBoundary'; import { ErrorBoundary } from '@/components/ErrorBoundary';
import { LockdownModeDetector } from '@/components/LockdownModeDetector';
import AppRouter from './AppRouter'; import AppRouter from './AppRouter';
@@ -52,7 +54,7 @@ const defaultConfig: AppConfig = {
relayMetadata: { relayMetadata: {
relays: [ relays: [
{ url: 'wss://relay.ditto.pub', read: true, write: true }, { url: 'wss://relay.ditto.pub', read: true, write: true },
{ url: 'wss://relay.nostr.band', read: true, write: true }, { url: 'wss://relay.damus.io', read: true, write: true },
{ url: 'wss://relay.primal.net', read: true, write: true }, { url: 'wss://relay.primal.net', read: true, write: true },
], ],
updatedAt: 0, updatedAt: 0,
@@ -70,11 +72,6 @@ const defaultConfig: AppConfig = {
description: "Build Nostr clients with React. This is the default template that you should choose in the majority of cases. It ships with complete Nostr integration out of the box, enabling a variety of use-cases from social media to blogging to AI-powered apps. If you're not sure which template to choose, choose this one.", description: "Build Nostr clients with React. This is the default template that you should choose in the majority of cases. It ships with complete Nostr integration out of the box, enabling a variety of use-cases from social media to blogging to AI-powered apps. If you're not sure which template to choose, choose this one.",
url: "https://gitlab.com/soapbox-pub/mkstack.git", url: "https://gitlab.com/soapbox-pub/mkstack.git",
}, },
{
name: "Nutstack",
description: "This is a variant of MKStack extended to support Cashu integration. Choose this template only if the user has indicated they require Cashu integration.",
url: "https://gitlab.com/lemonknowsall/nutstack.git",
},
], ],
esmUrl: "https://esm.sh", esmUrl: "https://esm.sh",
corsProxy: "https://proxy.shakespeare.diy/?url={href}", corsProxy: "https://proxy.shakespeare.diy/?url={href}",
@@ -91,6 +88,8 @@ const defaultConfig: AppConfig = {
fsPathTemplates: "/templates", fsPathTemplates: "/templates",
sentryDsn: import.meta.env.VITE_SENTRY_DSN || "", sentryDsn: import.meta.env.VITE_SENTRY_DSN || "",
sentryEnabled: true, sentryEnabled: true,
plausibleDomain: import.meta.env.VITE_PLAUSIBLE_DOMAIN || "",
plausibleEndpoint: import.meta.env.VITE_PLAUSIBLE_ENDPOINT || "",
}; };
// Initialize filesystem adapter // Initialize filesystem adapter
@@ -135,37 +134,39 @@ export function App() {
<UnheadProvider head={head}> <UnheadProvider head={head}>
<QueryClientProvider client={queryClient}> <QueryClientProvider client={queryClient}>
<AppProvider storageKey="nostr:app-config" defaultConfig={defaultConfig}> <AppProvider storageKey="nostr:app-config" defaultConfig={defaultConfig}>
<SentryProvider> <PlausibleProvider>
<FSProvider fs={fs}> <SentryProvider>
<ConsoleErrorProvider> <FSProvider fs={fs}>
<FSCleanupHandler /> <ConsoleErrorProvider>
<NostrLoginProvider storageKey='nostr:login'> <FSCleanupHandler />
<NostrProvider> <NostrLoginProvider storageKey='nostr:login'>
<NostrSync /> <NostrProvider>
<AISettingsProvider> <NostrSync />
<GitSettingsProvider> <AISettingsProvider>
<DeploySettingsProvider> <GitSettingsProvider>
<GitSyncProvider> <DeploySettingsProvider>
<SessionManagerProvider> <GitSyncProvider>
<TooltipProvider> <SessionManagerProvider>
<Toaster /> <TooltipProvider>
<DynamicFavicon /> <DynamicFavicon />
<OfflineIndicator /> <OfflineIndicator />
<PWAUpdatePrompt /> <PWAUpdatePrompt />
<Suspense> <LockdownModeDetector />
<AppRouter /> <Suspense>
</Suspense> <AppRouter />
</TooltipProvider> </Suspense>
</SessionManagerProvider> </TooltipProvider>
</GitSyncProvider> </SessionManagerProvider>
</DeploySettingsProvider> </GitSyncProvider>
</GitSettingsProvider> </DeploySettingsProvider>
</AISettingsProvider> </GitSettingsProvider>
</NostrProvider> </AISettingsProvider>
</NostrLoginProvider> </NostrProvider>
</ConsoleErrorProvider> </NostrLoginProvider>
</FSProvider> </ConsoleErrorProvider>
</SentryProvider> </FSProvider>
</SentryProvider>
</PlausibleProvider>
</AppProvider> </AppProvider>
</QueryClientProvider> </QueryClientProvider>
</UnheadProvider> </UnheadProvider>
+6
View File
@@ -1,7 +1,9 @@
import { BrowserRouter, Route, Routes } from "react-router-dom"; import { BrowserRouter, Route, Routes } from "react-router-dom";
import { Toaster } from "./components/ui/toaster";
import { ScrollToTop } from "./components/ScrollToTop"; import { ScrollToTop } from "./components/ScrollToTop";
import { SessionMonitor } from "./components/SessionMonitor"; import { SessionMonitor } from "./components/SessionMonitor";
import { URLFragmentHandler } from "./components/URLFragmentHandler"; import { URLFragmentHandler } from "./components/URLFragmentHandler";
import { VersionCheck } from "./components/VersionCheck";
import Index from "./pages/Index"; import Index from "./pages/Index";
import Clone from "./pages/Clone"; import Clone from "./pages/Clone";
@@ -23,10 +25,13 @@ import { NIP19Page } from "./pages/NIP19Page";
import NotFound from "./pages/NotFound"; import NotFound from "./pages/NotFound";
import { ProjectView } from "./pages/ProjectView"; import { ProjectView } from "./pages/ProjectView";
import { SettingsLayout } from "./components/SettingsLayout"; import { SettingsLayout } from "./components/SettingsLayout";
import { ChangelogPage } from "./pages/ChangelogPage";
export function AppRouter() { export function AppRouter() {
return ( return (
<BrowserRouter> <BrowserRouter>
<Toaster />
<VersionCheck />
<ScrollToTop /> <ScrollToTop />
<SessionMonitor /> <SessionMonitor />
<URLFragmentHandler /> <URLFragmentHandler />
@@ -49,6 +54,7 @@ export function AppRouter() {
<Route path="storage" element={<StorageSettings />} /> <Route path="storage" element={<StorageSettings />} />
<Route path="about" element={<AboutSettings />} /> <Route path="about" element={<AboutSettings />} />
</Route> </Route>
<Route path="/changelog" element={<ChangelogPage />} />
<Route path="/project/:projectId" element={<ProjectView />} /> <Route path="/project/:projectId" element={<ProjectView />} />
{/* NIP-19 route for npub1, note1, naddr1, nevent1, nprofile1 */} {/* NIP-19 route for npub1, note1, naddr1, nevent1, nprofile1 */}
<Route path="/:nip19" element={<NIP19Page />} /> <Route path="/:nip19" element={<NIP19Page />} />
+24 -31
View File
@@ -1,6 +1,7 @@
import { useState } from 'react'; import { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Check } from 'lucide-react'; import { Check } from 'lucide-react';
import { UrlListEditor } from '@/components/UrlListEditor';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input'; import { Input } from '@/components/ui/input';
import { PasswordInput } from '@/components/ui/password-input'; import { PasswordInput } from '@/components/ui/password-input';
@@ -63,8 +64,8 @@ export function AddCustomProviderDialog({
const [customHost, setCustomHost] = useState(''); const [customHost, setCustomHost] = useState('');
const [customProxy, setCustomProxy] = useState(false); const [customProxy, setCustomProxy] = useState(false);
const [customGateway, setCustomGateway] = useState(''); const [customGateway, setCustomGateway] = useState('');
const [customRelayUrls, setCustomRelayUrls] = useState(''); const [customRelayUrls, setCustomRelayUrls] = useState<string[]>([]);
const [customBlossomServers, setCustomBlossomServers] = useState(''); const [customBlossomServers, setCustomBlossomServers] = useState<string[]>([]);
const handleAdd = () => { const handleAdd = () => {
if (!customProviderType || !customName.trim()) return; if (!customProviderType || !customName.trim()) return;
@@ -84,12 +85,8 @@ export function AddCustomProviderDialog({
type: 'nsite', type: 'nsite',
name: customName.trim(), name: customName.trim(),
gateway: customGateway.trim() || 'nsite.lol', gateway: customGateway.trim() || 'nsite.lol',
relayUrls: customRelayUrls.trim() relayUrls: customRelayUrls.length > 0 ? customRelayUrls : ['wss://relay.ditto.pub'],
? customRelayUrls.split(',').map(s => s.trim()).filter(Boolean) blossomServers: customBlossomServers.length > 0 ? customBlossomServers : ['https://blossom.primal.net/'],
: ['wss://relay.nostr.band'],
blossomServers: customBlossomServers.trim()
? customBlossomServers.split(',').map(s => s.trim()).filter(Boolean)
: ['https://blossom.primal.net/'],
}; };
} else if (customProviderType === 'netlify') { } else if (customProviderType === 'netlify') {
if (!customApiKey.trim()) return; if (!customApiKey.trim()) return;
@@ -157,8 +154,8 @@ export function AddCustomProviderDialog({
setCustomHost(''); setCustomHost('');
setCustomProxy(false); setCustomProxy(false);
setCustomGateway(''); setCustomGateway('');
setCustomRelayUrls(''); setCustomRelayUrls([]);
setCustomBlossomServers(''); setCustomBlossomServers([]);
onOpenChange(false); onOpenChange(false);
}; };
@@ -198,8 +195,8 @@ export function AddCustomProviderDialog({
setCustomHost(''); setCustomHost('');
setCustomProxy(false); setCustomProxy(false);
setCustomGateway(''); setCustomGateway('');
setCustomRelayUrls(''); setCustomRelayUrls([]);
setCustomBlossomServers(''); setCustomBlossomServers([]);
}} }}
> >
<SelectTrigger> <SelectTrigger>
@@ -249,7 +246,7 @@ export function AddCustomProviderDialog({
) : customProviderType === 'nsite' ? ( ) : customProviderType === 'nsite' ? (
<> <>
<p className="text-sm text-muted-foreground"> <p className="text-sm text-muted-foreground">
Deploy to Nostr as a static website. Uses kind 34128 events and Blossom file storage. Deploy to Nostr as a static website. Uses a kind 15128 site manifest event and Blossom file storage.
</p> </p>
<div className="grid gap-2"> <div className="grid gap-2">
<Label htmlFor="custom-gateway">Gateway</Label> <Label htmlFor="custom-gateway">Gateway</Label>
@@ -260,24 +257,20 @@ export function AddCustomProviderDialog({
onChange={(e) => setCustomGateway(e.target.value)} onChange={(e) => setCustomGateway(e.target.value)}
/> />
</div> </div>
<div className="grid gap-2"> <UrlListEditor
<Label htmlFor="custom-relays">Relay URLs (comma-separated)</Label> label="Relay URLs"
<Input items={customRelayUrls}
id="custom-relays" onChange={setCustomRelayUrls}
placeholder="wss://relay.nostr.band, wss://relay.damus.io" protocol="wss"
value={customRelayUrls} placeholder="relay.ditto.pub"
onChange={(e) => setCustomRelayUrls(e.target.value)} />
/> <UrlListEditor
</div> label="Blossom Servers"
<div className="grid gap-2"> items={customBlossomServers}
<Label htmlFor="custom-blossom">Blossom Servers (comma-separated)</Label> onChange={setCustomBlossomServers}
<Input protocol="https"
id="custom-blossom" placeholder="blossom.primal.net"
placeholder="https://blossom.primal.net/" />
value={customBlossomServers}
onChange={(e) => setCustomBlossomServers(e.target.value)}
/>
</div>
</> </>
) : ( ) : (
<> <>
+567
View File
@@ -0,0 +1,567 @@
import { useState, useEffect, useCallback, useRef } from 'react';
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogDescription,
} from '@/components/ui/dialog';
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Textarea } from '@/components/ui/textarea';
import { Label } from '@/components/ui/label';
import { Skeleton } from '@/components/ui/skeleton';
import { Badge } from '@/components/ui/badge';
import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/avatar';
import { useToast } from '@/hooks/useToast';
import { useFS } from '@/hooks/useFS';
import { useFSPaths } from '@/hooks/useFSPaths';
import { useCurrentUser } from '@/hooks/useCurrentUser';
import { useNostrPublish } from '@/hooks/useNostrPublish';
import { useUploadFile } from '@/hooks/useUploadFile';
import { useAppEvent } from '@/hooks/useAppEvent';
import { useProjectDeploySettings } from '@/hooks/useProjectDeploySettings';
import { useQueryClient } from '@tanstack/react-query';
import { DotAI } from '@/lib/DotAI';
import { buildAppEvent } from '@/lib/appEvent';
import {
Loader2,
Save,
Plus,
X,
ExternalLink,
Pencil,
Upload,
ChevronDown,
CircleHelp,
} from 'lucide-react';
import type { NostrEvent } from '@nostrify/nostrify';
interface AppDialogProps {
projectId: string;
open: boolean;
onOpenChange: (open: boolean) => void;
}
interface AppFormData {
name: string;
about: string;
picture: string;
website: string;
dTag: string;
supportedKinds: string[];
webHandlers: Array<{ url: string; type: string }>;
}
/** Parse a kind 31990 event into form data */
function eventToFormData(event: NostrEvent): AppFormData {
let metadata: Record<string, string> = {};
try {
if (event.content) {
metadata = JSON.parse(event.content);
}
} catch {
// Invalid JSON content, use empty metadata
}
const dTag = event.tags.find(([t]) => t === 'd')?.[1] ?? '';
const supportedKinds = event.tags
.filter(([t]) => t === 'k')
.map(([, v]) => v)
.filter(Boolean);
const webHandlers = event.tags
.filter(([t]) => t === 'web')
.map(([, url, type]) => ({ url: url ?? '', type: type ?? '' }));
return {
name: metadata.name ?? '',
about: metadata.about ?? '',
picture: metadata.picture ?? '',
website: metadata.website ?? '',
dTag,
supportedKinds,
webHandlers,
};
}
/** Convert a slug like "my-cool-app" to title case like "My Cool App" */
function toTitleCase(slug: string): string {
return slug
.replace(/[-_]+/g, ' ')
.replace(/\b\w/g, (c) => c.toUpperCase())
.trim();
}
/** Create empty form data for a new app */
function emptyFormData(projectId: string): AppFormData {
return {
name: toTitleCase(projectId),
about: '',
picture: '',
website: '',
dTag: projectId,
supportedKinds: [],
webHandlers: [],
};
}
export function AppDialog({ projectId, open, onOpenChange }: AppDialogProps) {
const { fs } = useFS();
const { projectsPath } = useFSPaths();
const { user } = useCurrentUser();
const { toast } = useToast();
const queryClient = useQueryClient();
const { mutateAsync: publishEvent } = useNostrPublish();
const { mutateAsync: uploadFile, isPending: isUploading } = useUploadFile();
const cwd = `${projectsPath}/${projectId}`;
const { event, isLoading, aTag, hasApp, refetch } = useAppEvent({ cwd });
const { settings: deploySettings, isLoading: isDeployLoading } = useProjectDeploySettings(projectId);
const [formData, setFormData] = useState<AppFormData>(emptyFormData(projectId));
const [isSaving, setIsSaving] = useState(false);
const [newKind, setNewKind] = useState('');
const [newHandlerUrl, setNewHandlerUrl] = useState('');
const [newHandlerType, setNewHandlerType] = useState('');
const [advancedOpen, setAdvancedOpen] = useState(false);
const fileInputRef = useRef<HTMLInputElement>(null);
// Get the deployed URL from project deploy settings
const deployedUrl = (() => {
if (!deploySettings?.currentProvider || !deploySettings?.providers) return null;
const config = deploySettings.providers[deploySettings.currentProvider];
return config?.url ?? null;
})();
// Populate form when event loads
useEffect(() => {
if (event) {
setFormData(eventToFormData(event));
} else if (!isLoading && !hasApp) {
setFormData(emptyFormData(projectId));
}
}, [event, isLoading, hasApp, projectId]);
// Auto-fill website from deployment URL when creating a new app (not editing existing)
useEffect(() => {
if (!hasApp && !isDeployLoading && deployedUrl && !formData.website) {
setFormData(prev => ({ ...prev, website: deployedUrl }));
}
}, [hasApp, isDeployLoading, deployedUrl, formData.website]);
const updateField = useCallback(<K extends keyof AppFormData>(key: K, value: AppFormData[K]) => {
setFormData(prev => ({ ...prev, [key]: value }));
}, []);
const addKind = useCallback(() => {
const kind = newKind.trim();
if (kind && !formData.supportedKinds.includes(kind)) {
updateField('supportedKinds', [...formData.supportedKinds, kind]);
setNewKind('');
}
}, [newKind, formData.supportedKinds, updateField]);
const removeKind = useCallback((kind: string) => {
updateField('supportedKinds', formData.supportedKinds.filter(k => k !== kind));
}, [formData.supportedKinds, updateField]);
const addHandler = useCallback(() => {
const url = newHandlerUrl.trim();
if (url) {
updateField('webHandlers', [...formData.webHandlers, { url, type: newHandlerType.trim() }]);
setNewHandlerUrl('');
setNewHandlerType('');
}
}, [newHandlerUrl, newHandlerType, formData.webHandlers, updateField]);
const removeHandler = useCallback((index: number) => {
updateField('webHandlers', formData.webHandlers.filter((_, i) => i !== index));
}, [formData.webHandlers, updateField]);
const handleIconUpload = useCallback(async (e: React.ChangeEvent<HTMLInputElement>) => {
const file = e.target.files?.[0];
if (!file) return;
try {
const tags = await uploadFile(file);
const url = tags[0]?.[1];
if (url) {
updateField('picture', url);
toast({ title: 'Icon uploaded', description: 'Your app icon has been uploaded.' });
}
} catch (error) {
toast({
title: 'Upload failed',
description: error instanceof Error ? error.message : 'Failed to upload icon.',
variant: 'destructive',
});
} finally {
// Reset input so re-selecting the same file triggers onChange
if (fileInputRef.current) {
fileInputRef.current.value = '';
}
}
}, [uploadFile, updateField, toast]);
const handleSave = async () => {
if (!user) {
toast({
title: 'Not logged in',
description: 'You must be logged in with Nostr to publish an app.',
variant: 'destructive',
});
return;
}
if (!formData.name.trim()) {
toast({
title: 'Name required',
description: 'Please enter a name for your app.',
variant: 'destructive',
});
return;
}
if (!formData.dTag.trim()) {
toast({
title: 'Identifier required',
description: 'Please enter a unique identifier (d-tag) for your app.',
variant: 'destructive',
});
return;
}
setIsSaving(true);
try {
// Build event content and tags
const { content, tags } = await buildAppEvent(
{
name: formData.name,
about: formData.about,
picture: formData.picture,
website: formData.website,
dTag: formData.dTag,
supportedKinds: formData.supportedKinds,
webHandlers: formData.webHandlers,
},
{ fs, cwd, pubkey: user.pubkey },
);
// Publish the event
const published = await publishEvent({
kind: 31990,
content,
tags,
});
// Store the "a" coordinate in .git/shakespeare/app.json
const aValue = `31990:${published.pubkey}:${formData.dTag.trim()}`;
const dotAI = new DotAI(fs, cwd);
await dotAI.writeAppConfig({ a: aValue });
// Invalidate queries
await queryClient.invalidateQueries({ queryKey: ['app-event'] });
await refetch();
toast({
title: hasApp ? 'App updated' : 'App published',
description: `"${formData.name}" has been ${hasApp ? 'updated' : 'published'} to Nostr.`,
});
onOpenChange(false);
} catch (error) {
console.error('Failed to publish app:', error);
toast({
title: 'Failed to publish',
description: error instanceof Error ? error.message : 'An unexpected error occurred',
variant: 'destructive',
});
} finally {
setIsSaving(false);
}
};
if (!user) {
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-md">
<DialogHeader>
<DialogTitle>App</DialogTitle>
</DialogHeader>
<p className="text-sm text-muted-foreground">
You must be logged in with Nostr to manage your app.
</p>
</DialogContent>
</Dialog>
);
}
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-lg max-h-[85vh] overflow-y-auto">
<DialogHeader>
<DialogTitle>{hasApp ? 'Edit App' : 'Publish App'}</DialogTitle>
<DialogDescription>
{hasApp
? 'Update your app\'s listing on Nostr.'
: 'Publish your project as a Nostr app.'}
</DialogDescription>
</DialogHeader>
{isLoading ? (
<div className="space-y-4">
<div className="flex items-start gap-4">
<Skeleton className="h-20 w-20 rounded-2xl flex-shrink-0" />
<div className="flex-1 space-y-2 pt-1">
<Skeleton className="h-5 w-40" />
<Skeleton className="h-4 w-full" />
<Skeleton className="h-4 w-2/3" />
</div>
</div>
<Skeleton className="h-10 w-full" />
</div>
) : (
<div className="space-y-5">
{/* App Preview Card */}
<div className="flex items-start gap-4">
{/* Icon with upload */}
<div className="relative flex-shrink-0 group">
<input
ref={fileInputRef}
type="file"
accept="image/*"
onChange={handleIconUpload}
className="hidden"
disabled={isSaving || isUploading}
/>
<button
type="button"
onClick={() => fileInputRef.current?.click()}
disabled={isSaving || isUploading}
className="relative block rounded-2xl overflow-hidden focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none"
>
{formData.picture ? (
<>
<Avatar className="h-20 w-20 rounded-2xl">
<AvatarImage src={formData.picture} alt={formData.name || 'App icon'} className="object-cover" />
<AvatarFallback className="rounded-2xl bg-muted" />
</Avatar>
<div className="absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded-2xl">
{isUploading ? (
<Loader2 className="h-5 w-5 text-white animate-spin" />
) : (
<Pencil className="h-4 w-4 text-white" />
)}
</div>
</>
) : (
<div className="h-20 w-20 rounded-2xl bg-muted flex items-center justify-center transition-colors group-hover:bg-muted-foreground">
{isUploading ? (
<Loader2 className="h-6 w-6 text-muted-foreground animate-spin group-hover:text-background" />
) : (
<Upload className="h-6 w-6 text-muted-foreground transition-colors group-hover:text-background" />
)}
</div>
)}
</button>
</div>
{/* Name & Description inline */}
<div className="flex-1 min-w-0 space-y-2">
<Input
value={formData.name}
onChange={e => updateField('name', e.target.value)}
placeholder="App Name"
disabled={isSaving}
/>
<Textarea
value={formData.about}
onChange={e => updateField('about', e.target.value)}
placeholder="A short description of your app..."
rows={2}
disabled={isSaving}
className="resize-none"
/>
</div>
</div>
{/* Website */}
<div className="space-y-1.5">
<Label htmlFor="app-website" className="text-xs text-muted-foreground">Website</Label>
<Input
id="app-website"
value={formData.website}
onChange={e => updateField('website', e.target.value)}
placeholder={deployedUrl || 'https://myapp.example.com'}
disabled={isSaving}
/>
</div>
{/* Existing app coordinate info */}
{aTag && (
<div className="text-xs text-muted-foreground space-y-1">
<p className="font-medium">Nostr Coordinate</p>
<code className="block p-2 bg-muted rounded text-xs break-all select-all">{aTag}</code>
</div>
)}
{/* Advanced Section */}
<Collapsible open={advancedOpen} onOpenChange={setAdvancedOpen}>
<CollapsibleTrigger asChild>
<button
type="button"
className="flex items-center gap-2 w-full text-sm text-muted-foreground hover:text-foreground transition-colors py-2 border-t"
>
<ChevronDown className={`h-4 w-4 transition-transform ${advancedOpen ? 'rotate-180' : ''}`} />
<span>Advanced</span>
</button>
</CollapsibleTrigger>
<CollapsibleContent>
<div className="space-y-4 pt-2">
{/* Hint to use AI */}
<div className="flex items-start gap-2 text-xs text-muted-foreground bg-muted/50 rounded-lg p-3">
<CircleHelp className="h-3.5 w-3.5 mt-0.5 flex-shrink-0" />
<span>Not sure? Ask Shakespeare to update your app.</span>
</div>
{/* Identifier (d-tag) */}
<div className="space-y-1.5">
<Label htmlFor="app-dtag" className="text-xs">Identifier</Label>
<Input
id="app-dtag"
value={formData.dTag}
onChange={e => updateField('dTag', e.target.value)}
placeholder="my-app"
disabled={isSaving || hasApp}
/>
<p className="text-xs text-muted-foreground">
{hasApp ? 'Cannot be changed after publishing.' : 'Unique identifier for this app. Defaults to the project ID.'}
</p>
</div>
{/* Supported Kinds */}
<div className="space-y-1.5">
<Label className="text-xs">Supported Event Kinds</Label>
{formData.supportedKinds.length > 0 && (
<div className="flex flex-wrap gap-1">
{formData.supportedKinds.map(kind => (
<Badge key={kind} variant="secondary" className="gap-1">
{kind}
<button
onClick={() => removeKind(kind)}
disabled={isSaving}
className="hover:text-destructive"
>
<X className="h-3 w-3" />
</button>
</Badge>
))}
</div>
)}
<div className="flex gap-2">
<Input
value={newKind}
onChange={e => setNewKind(e.target.value)}
placeholder="Kind number (e.g. 1)"
disabled={isSaving}
onKeyDown={e => {
if (e.key === 'Enter') {
e.preventDefault();
addKind();
}
}}
className="flex-1"
/>
<Button
variant="outline"
size="sm"
onClick={addKind}
disabled={isSaving || !newKind.trim()}
className="h-9"
>
<Plus className="h-4 w-4" />
</Button>
</div>
</div>
{/* Web Handlers */}
<div className="space-y-1.5">
<Label className="text-xs">Web Handlers</Label>
{formData.webHandlers.length > 0 && (
<div className="space-y-1.5">
{formData.webHandlers.map((handler, index) => (
<div key={index} className="flex items-center gap-2 text-sm bg-muted/50 p-2 rounded-md">
<ExternalLink className="h-3 w-3 text-muted-foreground flex-shrink-0" />
<span className="truncate flex-1">{handler.url}</span>
{handler.type && (
<Badge variant="outline" className="text-xs flex-shrink-0">{handler.type}</Badge>
)}
<button
onClick={() => removeHandler(index)}
disabled={isSaving}
className="hover:text-destructive flex-shrink-0"
>
<X className="h-3 w-3" />
</button>
</div>
))}
</div>
)}
<div className="flex gap-2">
<Input
value={newHandlerUrl}
onChange={e => setNewHandlerUrl(e.target.value)}
placeholder="https://app.example.com/e/<bech32>"
disabled={isSaving}
className="flex-1"
/>
<Input
value={newHandlerType}
onChange={e => setNewHandlerType(e.target.value)}
placeholder="nevent"
disabled={isSaving}
className="w-24"
/>
<Button
variant="outline"
size="sm"
onClick={addHandler}
disabled={isSaving || !newHandlerUrl.trim()}
className="h-9"
>
<Plus className="h-4 w-4" />
</Button>
</div>
<p className="text-xs text-muted-foreground">
URL patterns where <code className="text-xs">{'<bech32>'}</code> will be replaced with the NIP-19 entity.
</p>
</div>
</div>
</CollapsibleContent>
</Collapsible>
{/* Save Button */}
<Button
onClick={handleSave}
disabled={isSaving || !formData.name.trim()}
className="w-full gap-2"
>
{isSaving ? (
<Loader2 className="h-4 w-4 animate-spin" />
) : (
<Save className="h-4 w-4" />
)}
{isSaving
? (hasApp ? 'Updating...' : 'Publishing...')
: (hasApp ? 'Update App' : 'Publish App')}
</Button>
</div>
)}
</DialogContent>
</Dialog>
);
}
+2
View File
@@ -60,6 +60,8 @@ const AppConfigSchema = z.object({
sentryDsn: z.string(), sentryDsn: z.string(),
sentryEnabled: z.boolean(), sentryEnabled: z.boolean(),
systemPrompt: z.string(), systemPrompt: z.string(),
plausibleDomain: z.string(),
plausibleEndpoint: z.string(),
}) satisfies z.ZodType<AppConfig>; }) satisfies z.ZodType<AppConfig>;
export function AppProvider(props: AppProviderProps) { export function AppProvider(props: AppProviderProps) {
+73
View File
@@ -0,0 +1,73 @@
import { useEffect, useState } from 'react';
import {
AlertDialog,
AlertDialogContent,
AlertDialogDescription,
AlertDialogHeader,
AlertDialogTitle,
} from '@/components/ui/alert-dialog';
/**
* Detects if IndexedDB is unavailable (which happens in iOS lockdown mode)
* and displays a blocking alert dialog informing the user.
*/
export function LockdownModeDetector() {
const [isLockdownMode, setIsLockdownMode] = useState(false);
useEffect(() => {
// Check if IndexedDB is available
const checkIndexedDB = async () => {
try {
// Check if IndexedDB exists
if (!window.indexedDB) {
setIsLockdownMode(true);
return;
}
// Try to open a test database to verify IndexedDB actually works
// In iOS lockdown mode, indexedDB exists but throws errors when used
const testDBName = '_shakespeare_lockdown_test';
const request = window.indexedDB.open(testDBName, 1);
request.onerror = () => {
setIsLockdownMode(true);
};
request.onsuccess = () => {
// IndexedDB is working, clean up test database
request.result.close();
window.indexedDB.deleteDatabase(testDBName);
};
} catch {
// Any error means IndexedDB is not available
setIsLockdownMode(true);
}
};
checkIndexedDB();
}, []);
return (
<AlertDialog open={isLockdownMode}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle className="text-left">🔒 Lockdown Mode Detected</AlertDialogTitle>
<AlertDialogDescription className="space-y-3 text-left">
<p>
Shakespeare requires IndexedDB to function, which is unavailable in iOS Lockdown Mode.
</p>
<p>
To use Shakespeare, please disable Lockdown Mode in your device settings:
</p>
<ol className="list-decimal list-inside space-y-1 text-left ml-4">
<li>Open Settings</li>
<li>Go to Privacy &amp; Security</li>
<li>Tap Lockdown Mode</li>
<li>Turn off Lockdown Mode</li>
</ol>
</AlertDialogDescription>
</AlertDialogHeader>
</AlertDialogContent>
</AlertDialog>
);
}
+29
View File
@@ -0,0 +1,29 @@
import { ReactNode, useEffect, useRef } from 'react';
import { useAppContext } from '@/hooks/useAppContext';
interface PlausibleProviderProps {
children: ReactNode;
}
/**
* Reactively initializes Plausible Analytics from AppConfig.
* Plausible's `init()` can only be called once, so we guard with a ref.
*/
export function PlausibleProvider({ children }: PlausibleProviderProps) {
const { config } = useAppContext();
const initializedRef = useRef(false);
useEffect(() => {
if (initializedRef.current || !config.plausibleDomain) return;
initializedRef.current = true;
import('@plausible-analytics/tracker').then(({ init }) => {
init({
domain: config.plausibleDomain,
...(config.plausibleEndpoint && { endpoint: config.plausibleEndpoint }),
});
}).catch(console.error);
}, [config.plausibleDomain, config.plausibleEndpoint]);
return <>{children}</>;
}
+12
View File
@@ -14,6 +14,7 @@ import {
ChevronDown, ChevronDown,
Trash2, Trash2,
Star, Star,
AppWindow,
} from 'lucide-react'; } from 'lucide-react';
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';
import { useLocalStorage } from '@/hooks/useLocalStorage'; import { useLocalStorage } from '@/hooks/useLocalStorage';
@@ -27,6 +28,7 @@ interface ProjectTitleMenuProps {
onDuplicate: () => void; onDuplicate: () => void;
onDelete: () => void; onDelete: () => void;
onProjectDetails: () => void; onProjectDetails: () => void;
onApp: () => void;
isAnyLoading: boolean; isAnyLoading: boolean;
className?: string; className?: string;
} }
@@ -39,6 +41,7 @@ export function ProjectTitleMenu({
onDuplicate, onDuplicate,
onDelete, onDelete,
onProjectDetails, onProjectDetails,
onApp,
isAnyLoading, isAnyLoading,
className = '', className = '',
}: ProjectTitleMenuProps) { }: ProjectTitleMenuProps) {
@@ -98,6 +101,15 @@ export function ProjectTitleMenu({
Project Details Project Details
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem
onClick={onApp}
disabled={isAnyLoading}
className="gap-2"
>
<AppWindow className="h-4 w-4" />
App
</DropdownMenuItem>
<DropdownMenuItem <DropdownMenuItem
onClick={onGitHistory} onClick={onGitHistory}
disabled={isAnyLoading} disabled={isAnyLoading}
+17 -28
View File
@@ -17,6 +17,7 @@ import {
import type { DeployProvider } from '@/contexts/DeploySettingsContext'; import type { DeployProvider } from '@/contexts/DeploySettingsContext';
import type { PresetDeployProvider } from '@/lib/deploy/types'; import type { PresetDeployProvider } from '@/lib/deploy/types';
import { ExternalFavicon } from '@/components/ExternalFavicon'; import { ExternalFavicon } from '@/components/ExternalFavicon';
import { UrlListEditor } from '@/components/UrlListEditor';
interface ProviderConfigDialogProps { interface ProviderConfigDialogProps {
open: boolean; open: boolean;
@@ -138,34 +139,22 @@ export function ProviderConfigDialog({
onChange={(e) => setLocalProvider({ ...localProvider, gateway: e.target.value })} onChange={(e) => setLocalProvider({ ...localProvider, gateway: e.target.value })}
/> />
</div> </div>
<div className="grid gap-2"> <UrlListEditor
<Label htmlFor="provider-relays"> label="Relay URLs"
Relay URLs (comma-separated) <span className="text-destructive">*</span> items={localProvider.relayUrls ?? []}
</Label> onChange={(urls) => setLocalProvider({ ...localProvider, relayUrls: urls })}
<Input protocol="wss"
id="provider-relays" placeholder="relay.ditto.pub"
placeholder="wss://relay.nostr.band, wss://relay.damus.io" required
value={localProvider.relayUrls?.join(', ') || ''} />
onChange={(e) => setLocalProvider({ <UrlListEditor
...localProvider, label="Blossom Servers"
relayUrls: e.target.value.split(',').map(s => s.trim()).filter(Boolean) items={localProvider.blossomServers ?? []}
})} onChange={(servers) => setLocalProvider({ ...localProvider, blossomServers: servers })}
/> protocol="https"
</div> placeholder="blossom.primal.net"
<div className="grid gap-2"> required
<Label htmlFor="provider-blossom"> />
Blossom Servers (comma-separated) <span className="text-destructive">*</span>
</Label>
<Input
id="provider-blossom"
placeholder="https://blossom.primal.net/"
value={localProvider.blossomServers?.join(', ') || ''}
onChange={(e) => setLocalProvider({
...localProvider,
blossomServers: e.target.value.split(',').map(s => s.trim()).filter(Boolean)
})}
/>
</div>
</> </>
) : ( ) : (
<> <>
+8
View File
@@ -45,6 +45,8 @@ describe('SentryProvider', () => {
fsPathTmp: '/tmp', fsPathTmp: '/tmp',
fsPathPlugins: '/plugins', fsPathPlugins: '/plugins',
fsPathTemplates: '/templates', fsPathTemplates: '/templates',
plausibleDomain: '',
plausibleEndpoint: '',
}; };
render( render(
@@ -87,6 +89,8 @@ describe('SentryProvider', () => {
fsPathTmp: '/tmp', fsPathTmp: '/tmp',
fsPathPlugins: '/plugins', fsPathPlugins: '/plugins',
fsPathTemplates: '/templates', fsPathTemplates: '/templates',
plausibleDomain: '',
plausibleEndpoint: '',
}; };
render( render(
@@ -130,6 +134,8 @@ describe('SentryProvider', () => {
fsPathTmp: '/tmp', fsPathTmp: '/tmp',
fsPathPlugins: '/plugins', fsPathPlugins: '/plugins',
fsPathTemplates: '/templates', fsPathTemplates: '/templates',
plausibleDomain: '',
plausibleEndpoint: '',
}; };
render( render(
@@ -176,6 +182,8 @@ describe('SentryProvider', () => {
fsPathTmp: '/tmp', fsPathTmp: '/tmp',
fsPathPlugins: '/plugins', fsPathPlugins: '/plugins',
fsPathTemplates: '/templates', fsPathTemplates: '/templates',
plausibleDomain: '',
plausibleEndpoint: '',
}; };
render( render(
+15 -1
View File
@@ -35,6 +35,9 @@ import { NostrReadProtocolTool } from '@/lib/tools/NostrReadProtocolTool';
import { NostrReadNipsIndexTool } from '@/lib/tools/NostrReadNipsIndexTool'; import { NostrReadNipsIndexTool } from '@/lib/tools/NostrReadNipsIndexTool';
import { NostrGenerateKindTool } from '@/lib/tools/NostrGenerateKindTool'; import { NostrGenerateKindTool } from '@/lib/tools/NostrGenerateKindTool';
import { NostrPublishEventsTool } from '@/lib/tools/NostrPublishEventsTool'; import { NostrPublishEventsTool } from '@/lib/tools/NostrPublishEventsTool';
import { NostrEncodeTool } from '@/lib/tools/NostrEncodeTool';
import { NostrDecodeTool } from '@/lib/tools/NostrDecodeTool';
import { BlossomUploadTool } from '@/lib/tools/BlossomUploadTool';
import { ShellTool } from '@/lib/tools/ShellTool'; import { ShellTool } from '@/lib/tools/ShellTool';
import { ReadConsoleMessagesTool } from '@/lib/tools/ReadConsoleMessagesTool'; import { ReadConsoleMessagesTool } from '@/lib/tools/ReadConsoleMessagesTool';
import { SkillTool } from '@/lib/tools/SkillTool'; import { SkillTool } from '@/lib/tools/SkillTool';
@@ -46,6 +49,7 @@ import { WebSearchTool } from '@/lib/tools/WebSearchTool';
import { createMCPTools } from '@/lib/tools/MCPTool'; import { createMCPTools } from '@/lib/tools/MCPTool';
import { TodoWriteTool } from '@/lib/tools/TodoWriteTool'; import { TodoWriteTool } from '@/lib/tools/TodoWriteTool';
import { TodoReadTool } from '@/lib/tools/TodoReadTool'; import { TodoReadTool } from '@/lib/tools/TodoReadTool';
import { AppTool } from '@/lib/tools/AppTool';
import { ProjectPreviewConsoleError } from '@/lib/consoleMessages'; import { ProjectPreviewConsoleError } from '@/lib/consoleMessages';
import { toolToOpenAI } from '@/lib/tools/openai-adapter'; import { toolToOpenAI } from '@/lib/tools/openai-adapter';
import { Tool } from '@/lib/tools/Tool'; import { Tool } from '@/lib/tools/Tool';
@@ -217,6 +221,9 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
nostr_read_nips_index: new NostrReadNipsIndexTool(), nostr_read_nips_index: new NostrReadNipsIndexTool(),
nostr_generate_kind: new NostrGenerateKindTool(), nostr_generate_kind: new NostrGenerateKindTool(),
nostr_publish_events: new NostrPublishEventsTool(), nostr_publish_events: new NostrPublishEventsTool(),
nostr_encode: new NostrEncodeTool(),
nostr_decode: new NostrDecodeTool(),
blossom_upload: new BlossomUploadTool(fs, cwd, user?.signer),
shell: new ShellTool(fs, cwd, git, config.corsProxy, user?.signer), shell: new ShellTool(fs, cwd, git, config.corsProxy, user?.signer),
read_console_messages: new ReadConsoleMessagesTool(), read_console_messages: new ReadConsoleMessagesTool(),
skill: new SkillTool(fs, availableSkills), skill: new SkillTool(fs, availableSkills),
@@ -224,6 +231,13 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
websearch: new WebSearchTool(), websearch: new WebSearchTool(),
todowrite: new TodoWriteTool(fs, projectId, { projectsPath }), todowrite: new TodoWriteTool(fs, projectId, { projectsPath }),
todoread: new TodoReadTool(fs, projectId, { projectsPath }), todoread: new TodoReadTool(fs, projectId, { projectsPath }),
app: new AppTool(
fs,
cwd,
user?.signer,
user?.pubkey,
config.relayMetadata.relays.filter(r => r.write).map(r => r.url),
),
}; };
// Add generate_image tool if imageModel is configured // Add generate_image tool if imageModel is configured
@@ -275,7 +289,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
} }
return tools; return tools;
}, [fs, git, cwd, user, projectsPath, tmpPath, config.corsProxy, settings, aiSettings, models, handleFileChanged, handleCommit, projectId, availableSkills]); }, [fs, git, cwd, user, projectsPath, tmpPath, config.corsProxy, config.relayMetadata, settings, aiSettings, models, handleFileChanged, handleCommit, projectId, availableSkills]);
// MCP tools wrapped for execution // MCP tools wrapped for execution
const mcpToolWrappers = useMemo(() => createMCPTools(mcpClients), [mcpClients]); const mcpToolWrappers = useMemo(() => createMCPTools(mcpClients), [mcpClients]);
+20
View File
@@ -28,6 +28,7 @@ import {
X, X,
Search, Search,
Clipboard, Clipboard,
AppWindow,
} from 'lucide-react'; } from 'lucide-react';
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';
import { VFSImage } from '@/components/VFSImage'; import { VFSImage } from '@/components/VFSImage';
@@ -412,6 +413,25 @@ function getToolInfo(toolName: string, args: Record<string, unknown>, projectId?
}; };
} }
case 'app': {
const action = args.action as string | undefined;
if (action === 'view_app') {
return {
icon: AppWindow,
title: 'Viewed app',
callingTitle: 'Viewing app',
errorTitle: 'Failed to view app',
};
}
const name = args.name ? String(args.name) : 'app';
return {
icon: AppWindow,
title: `Updated ${name}`,
callingTitle: `Updating ${name}`,
errorTitle: `Failed to update ${name}`,
};
}
default: { default: {
const formattedName = toolName.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase()); const formattedName = toolName.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
return { return {
+147
View File
@@ -0,0 +1,147 @@
import { useState, useRef, KeyboardEvent } from 'react';
import { X, Plus } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { ExternalFavicon } from '@/components/ExternalFavicon';
import { cn } from '@/lib/utils';
interface UrlListEditorProps {
/** Label shown above the list */
label: string;
/** Current array of full URLs */
items: string[];
/** Called when the list changes */
onChange: (items: string[]) => void;
/** Controls auto-prefix on bare domain entry */
protocol: 'wss' | 'https';
/** Placeholder shown in the add input */
placeholder?: string;
/** Whether to show the required asterisk */
required?: boolean;
/** Additional CSS classes for the root element */
className?: string;
}
/**
* Normalize a bare domain or partial URL to a fully-qualified URL.
* If the value already has any protocol it is returned as-is.
*/
function normalizeEntry(value: string, protocol: 'wss' | 'https'): string {
const trimmed = value.trim();
if (!trimmed) return '';
if (/^wss?:\/\//i.test(trimmed) || /^https?:\/\//i.test(trimmed)) return trimmed;
return `${protocol}://${trimmed}`;
}
/**
* Convert a URL to an https:// form suitable for favicon lookup.
* wss:// → https://, ws:// → http://
*/
function toHttpsUrl(url: string): string {
return url.replace(/^wss:\/\//i, 'https://').replace(/^ws:\/\//i, 'http://');
}
/** Strip the protocol prefix for compact display */
function displayLabel(url: string): string {
return url.replace(/^wss?:\/\//i, '').replace(/^https?:\/\//i, '');
}
export function UrlListEditor({
label,
items,
onChange,
protocol,
placeholder,
required,
className,
}: UrlListEditorProps) {
const [inputValue, setInputValue] = useState('');
const inputRef = useRef<HTMLInputElement>(null);
const handleAdd = () => {
const normalized = normalizeEntry(inputValue, protocol);
if (!normalized) return;
// Silently ignore duplicates
if (items.includes(normalized)) {
setInputValue('');
return;
}
onChange([...items, normalized]);
setInputValue('');
inputRef.current?.focus();
};
const handleRemove = (index: number) => {
onChange(items.filter((_, i) => i !== index));
};
const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {
if (e.key === 'Enter') {
e.preventDefault();
handleAdd();
}
};
return (
<div className={cn('grid gap-2', className)}>
<Label>
{label}
{required && <span className="text-destructive ml-1">*</span>}
</Label>
{/* Scrollable list of existing items */}
{items.length > 0 && (
<div className="rounded-md border overflow-y-auto max-h-48">
{items.map((item, index) => (
<div
key={index}
className="flex items-center gap-2 px-3 py-2 hover:bg-muted border-b last:border-b-0"
>
<ExternalFavicon
url={toHttpsUrl(item)}
size={14}
className="shrink-0 opacity-70"
/>
<span className="flex-1 text-sm font-mono truncate">
{displayLabel(item)}
</span>
<Button
type="button"
variant="ghost"
size="icon"
className="h-6 w-6 shrink-0 text-muted-foreground hover:text-destructive"
onClick={() => handleRemove(index)}
aria-label={`Remove ${item}`}
>
<X className="h-3 w-3" />
</Button>
</div>
))}
</div>
)}
{/* Add input */}
<div className="flex gap-2">
<Input
ref={inputRef}
value={inputValue}
onChange={(e) => setInputValue(e.target.value)}
onKeyDown={handleKeyDown}
placeholder={placeholder ?? (protocol === 'wss' ? 'relay.example.com' : 'server.example.com')}
className="font-mono text-sm"
/>
<Button
type="button"
variant="outline"
size="icon"
onClick={handleAdd}
disabled={!inputValue.trim()}
aria-label={`Add ${label}`}
>
<Plus className="h-4 w-4" />
</Button>
</div>
</div>
);
}
+70
View File
@@ -0,0 +1,70 @@
import { useEffect } from 'react';
import { Link } from 'react-router-dom';
import { toast } from '@/hooks/useToast';
import { ToastAction } from '@/components/ui/toast';
import { parseChangelog } from '@/lib/changelog';
const STORAGE_KEY = 'shakespeare:app-version';
/** Fetch the first changelog item for the given version (or the latest entry). */
async function fetchChangelogExcerpt(version: string): Promise<string | undefined> {
try {
const res = await fetch('/CHANGELOG.md');
if (!res.ok) return undefined;
const markdown = await res.text();
const entries = parseChangelog(markdown);
// Try to find the entry matching the current version, otherwise use the first entry.
const entry = entries.find((e) => e.version === version) ?? entries[0];
if (!entry) return undefined;
// Return a truncated first item from the first section.
const item = entry.sections[0]?.items[0];
if (!item) return undefined;
if (item.length <= 60) return item;
return item.slice(0, 60).trimEnd() + '…';
} catch {
return undefined;
}
}
/** Compares the running app version against localStorage and shows a toast when the version changes. */
export function VersionCheck() {
useEffect(() => {
const currentVersion = import.meta.env.VERSION;
if (!currentVersion) return;
const storedVersion = localStorage.getItem(STORAGE_KEY);
localStorage.setItem(STORAGE_KEY, currentVersion);
if (storedVersion && storedVersion !== currentVersion) {
// Show the toast immediately, then enrich it with a changelog excerpt.
const { update, id } = toast({
title: `What's new in v${currentVersion}`,
action: (
<ToastAction altText="View changelog" asChild>
<Link to="/changelog">See all</Link>
</ToastAction>
),
});
fetchChangelogExcerpt(currentVersion).then((excerpt) => {
if (excerpt) {
update({
id,
title: `What's new in v${currentVersion}`,
description: excerpt,
action: (
<ToastAction altText="View changelog" asChild>
<Link to="/changelog">See all</Link>
</ToastAction>
),
});
}
});
}
}, []);
return null;
}
+184 -16
View File
@@ -36,6 +36,9 @@ import { VercelAdapter } from '@/lib/deploy/VercelAdapter';
import { CloudflareAdapter } from '@/lib/deploy/CloudflareAdapter'; import { CloudflareAdapter } from '@/lib/deploy/CloudflareAdapter';
import { DenoDeployAdapter } from '@/lib/deploy/DenoDeployAdapter'; import { DenoDeployAdapter } from '@/lib/deploy/DenoDeployAdapter';
import { RailwayAdapter } from '@/lib/deploy/RailwayAdapter'; import { RailwayAdapter } from '@/lib/deploy/RailwayAdapter';
import { readNsiteVfsConfig, writeNsiteVfsConfig } from '@/lib/nsiteConfig';
import type { NsiteVfsConfig } from '@/lib/nsiteConfig';
import { projectNameToDTag } from '@/lib/utils/nsite';
/** /**
* Normalize a URL string to ensure it has a protocol * Normalize a URL string to ensure it has a protocol
@@ -47,6 +50,23 @@ function normalizeUrl(url: string): string {
return `https://${url}`; return `https://${url}`;
} }
async function resolveNsiteSourceUrl(remoteUrl: string | null): Promise<string | undefined> {
if (!remoteUrl) {
return undefined;
}
if (/^https?:\/\//i.test(remoteUrl)) {
return remoteUrl;
}
if (remoteUrl.startsWith('nostr://')) {
const nostrURI = await NostrURI.parse(remoteUrl);
return nostrURI.toString();
}
return undefined;
}
/** /**
* Render provider icon using favicon or fallback * Render provider icon using favicon or fallback
*/ */
@@ -85,7 +105,9 @@ interface ShakespeareFormData {
} }
interface NsiteFormData { interface NsiteFormData {
nsec: string; siteTitle: string;
siteDescription: string;
dTag: string;
} }
interface NetlifyFormData { interface NetlifyFormData {
@@ -132,12 +154,46 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
const [isShakespeareFormValid, setIsShakespeareFormValid] = useState(true); const [isShakespeareFormValid, setIsShakespeareFormValid] = useState(true);
// .nsite/config.json state — loaded once on mount, used to skip config form on re-deploy
const [nsiteVfsConfig, setNsiteVfsConfig] = useState<NsiteVfsConfig | null>(null);
const [nsiteVfsConfigLoading, setNsiteVfsConfigLoading] = useState(true);
// When a .nsite/config.json already exists, hide the full form and show a summary instead.
// The user can click "Edit" to expand it.
const [nsiteShowFullForm, setNsiteShowFullForm] = useState(false);
useEffect(() => {
if (!projectId) {
setNsiteVfsConfigLoading(false);
return;
}
const projectPath = `${projectsPath}/${projectId}`;
readNsiteVfsConfig(fs, projectPath)
.then((cfg) => {
setNsiteVfsConfig(cfg);
// If a config already exists, seed the form from it and stay in summary mode.
// If not, show the full form so the user can configure for the first time.
if (cfg) {
setNsiteForm({
siteTitle: cfg.title ?? '',
siteDescription: cfg.description ?? '',
dTag: (cfg.id != null && cfg.id !== '') ? cfg.id : '',
});
setNsiteShowFullForm(false);
} else {
setNsiteShowFullForm(true);
}
})
.finally(() => setNsiteVfsConfigLoading(false));
}, [fs, projectsPath, projectId]);
// Provider-specific form data // Provider-specific form data
const [shakespeareForm, setShakespeareForm] = useState<ShakespeareFormData>({ const [shakespeareForm, setShakespeareForm] = useState<ShakespeareFormData>({
subdomain: projectId, subdomain: projectId,
}); });
const [nsiteForm, setNsiteForm] = useState<NsiteFormData>({ const [nsiteForm, setNsiteForm] = useState<NsiteFormData>({
nsec: '', siteTitle: '',
siteDescription: '',
dTag: '',
}); });
const [netlifyForm, setNetlifyForm] = useState<NetlifyFormData>({ const [netlifyForm, setNetlifyForm] = useState<NetlifyFormData>({
siteId: '', siteId: '',
@@ -205,17 +261,25 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
} else if (selectedProvider.type === 'nsite') { } else if (selectedProvider.type === 'nsite') {
const nsiteProvider = selectedProvider; const nsiteProvider = selectedProvider;
if (!nsiteForm.nsec) { if (!user) {
throw new Error('Site private key (nsec) is required'); throw new Error('You must be logged in to deploy to nsite.');
} }
const sourceUrl = await resolveNsiteSourceUrl(
await git.getRemoteURL(projectPath, 'origin')
);
adapter = new NsiteAdapter({ adapter = new NsiteAdapter({
fs, fs,
nostr, nostr,
nsec: nsiteForm.nsec, signer: user.signer,
gateway: nsiteProvider.gateway, gateway: nsiteProvider.gateway,
relayUrls: nsiteProvider.relayUrls, relayUrls: nsiteProvider.relayUrls,
blossomServers: nsiteProvider.blossomServers, blossomServers: nsiteProvider.blossomServers,
siteTitle: nsiteForm.siteTitle || undefined,
siteDescription: nsiteForm.siteDescription || undefined,
sourceUrl,
siteIdentifier: nsiteForm.dTag || undefined,
}); });
} else if (selectedProvider.type === 'netlify') { } else if (selectedProvider.type === 'netlify') {
const netlifyProvider = selectedProvider; const netlifyProvider = selectedProvider;
@@ -324,9 +388,28 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
type: 'nsite', type: 'nsite',
url: result.url, url: result.url,
data: { data: {
nsec: nsiteForm.nsec, siteTitle: nsiteForm.siteTitle || undefined,
siteDescription: nsiteForm.siteDescription || undefined,
dTag: nsiteForm.dTag || undefined,
}, },
}); });
// Write .nsite/config.json for nsyte CLI interoperability.
// This file is safe to commit — it never contains the nsec.
const nsiteProvider = selectedProvider;
const newNsiteVfsConfig: NsiteVfsConfig = {
relays: nsiteProvider.relayUrls,
servers: nsiteProvider.blossomServers,
id: nsiteForm.dTag || undefined,
title: nsiteForm.siteTitle || undefined,
description: nsiteForm.siteDescription || undefined,
fallback: '/index.html',
gatewayHostnames: [nsiteProvider.gateway],
};
await writeNsiteVfsConfig(fs, projectPath, newNsiteVfsConfig);
// Update in-memory state so summary view reflects new values immediately
setNsiteVfsConfig(newNsiteVfsConfig);
setNsiteShowFullForm(false);
} else if (selectedProvider.type === 'netlify') { } else if (selectedProvider.type === 'netlify') {
await updateProjectSettings(selectedProviderId, { await updateProjectSettings(selectedProviderId, {
type: 'netlify', type: 'netlify',
@@ -434,12 +517,14 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
setError(null); setError(null);
// Reset forms // Reset forms
setShakespeareForm({ subdomain: projectId }); setShakespeareForm({ subdomain: projectId });
setNsiteForm({ nsec: '' }); setNsiteForm({ siteTitle: '', siteDescription: '', dTag: '' });
setNetlifyForm({ siteId: '', siteName: '' }); setNetlifyForm({ siteId: '', siteName: '' });
setVercelForm({ projectName: projectName || projectId, teamId: '' }); setVercelForm({ projectName: projectName || projectId, teamId: '' });
setCloudflareForm({ projectName: projectName || projectId }); setCloudflareForm({ projectName: projectName || projectId });
setDenoDeployForm({ projectName: projectName || projectId }); setDenoDeployForm({ projectName: projectName || projectId });
setRailwayForm({ workspaceId: '', projectId: '', environmentId: '', serviceId: '', projectName: projectName || projectId }); setRailwayForm({ workspaceId: '', projectId: '', environmentId: '', serviceId: '', projectName: projectName || projectId });
// Return to summary mode so next open shows the compact view (if config exists)
setNsiteShowFullForm(false);
onClose(); onClose();
}; };
@@ -451,8 +536,17 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
setIsShakespeareFormValid(isValid); setIsShakespeareFormValid(isValid);
}, []); }, []);
const handleNsiteNsecChange = useCallback((nsec: string) => { const handleNsiteSiteTitleChange = useCallback((siteTitle: string) => {
setNsiteForm({ nsec }); setNsiteForm(prev => ({ ...prev, siteTitle }));
// Derive the dTag from the title so the user never has to think about it.
// Falls back to projectName when the title is blank.
projectNameToDTag(siteTitle || projectName).then(dTag => {
setNsiteForm(prev => ({ ...prev, dTag }));
});
}, [projectName]);
const handleNsiteSiteDescriptionChange = useCallback((siteDescription: string) => {
setNsiteForm(prev => ({ ...prev, siteDescription }));
}, []); }, []);
const handleNetlifySiteChange = useCallback((siteId: string, siteName: string) => { const handleNetlifySiteChange = useCallback((siteId: string, siteName: string) => {
@@ -501,15 +595,72 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
} }
if (selectedProvider.type === 'nsite') { if (selectedProvider.type === 'nsite') {
// While the .nsite/config.json load is still in flight, render nothing to avoid flicker
if (nsiteVfsConfigLoading) return null;
// Summary view: shown when .nsite/config.json already exists and user hasn't clicked Edit
if (nsiteVfsConfig && !nsiteShowFullForm) {
const relayCount = nsiteVfsConfig.relays?.length ?? 0;
const serverCount = nsiteVfsConfig.servers?.length ?? 0;
return (
<div className="space-y-3">
<div className="rounded-md border bg-muted/30 p-3 space-y-2 text-sm">
{nsiteVfsConfig.title && (
<div className="flex justify-between">
<span className="text-muted-foreground">Title</span>
<span className="font-medium">{nsiteVfsConfig.title}</span>
</div>
)}
<div className="flex justify-between">
<span className="text-muted-foreground">Relays</span>
<span className="font-medium">{relayCount} configured</span>
</div>
<div className="flex justify-between">
<span className="text-muted-foreground">Blossom servers</span>
<span className="font-medium">{serverCount} configured</span>
</div>
</div>
<button
type="button"
className="text-xs text-muted-foreground underline hover:text-foreground transition-colors"
onClick={() => setNsiteShowFullForm(true)}
>
Edit site settings
</button>
</div>
);
}
// Full config form: shown on first deploy or when user clicks "Edit site settings"
const savedConfig = projectSettings.providers[selectedProviderId]; const savedConfig = projectSettings.providers[selectedProviderId];
const savedNsec = savedConfig?.type === 'nsite' ? savedConfig.data.nsec : undefined; const legacy = savedConfig?.type === 'nsite' ? savedConfig.data : undefined;
// .nsite/config.json wins; .git/shakespeare/deploy.json is the legacy fallback
const savedSiteTitle = nsiteVfsConfig?.title ?? legacy?.siteTitle;
const savedSiteDescription = nsiteVfsConfig?.description ?? legacy?.siteDescription;
return ( return (
<NsiteDeployForm <div className="space-y-3">
gateway={selectedProvider.gateway} <NsiteDeployForm
savedNsec={savedNsec} key={selectedProviderId}
onNsecChange={handleNsiteNsecChange} projectName={projectName || projectId}
/> savedNsec={legacy?.nsec}
savedSiteTitle={savedSiteTitle}
savedSiteDescription={savedSiteDescription}
onSiteTitleChange={handleNsiteSiteTitleChange}
onSiteDescriptionChange={handleNsiteSiteDescriptionChange}
/>
{nsiteVfsConfig && (
<button
type="button"
className="text-xs text-muted-foreground underline hover:text-foreground transition-colors"
onClick={() => setNsiteShowFullForm(false)}
>
Back to summary
</button>
)}
</div>
); );
} }
@@ -769,6 +920,22 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
</Alert> </Alert>
)} )}
{selectedProvider?.type === 'nsite' && !user && (
<Alert>
<AlertCircle className="h-4 w-4" />
<AlertDescription>
You must be logged in with Nostr to deploy to nsite.{' '}
<Link
to="/settings/nostr"
className="underline hover:no-underline"
onClick={handleClose}
>
Go to Nostr Settings
</Link>
</AlertDescription>
</Alert>
)}
{error && ( {error && (
<Alert variant="destructive"> <Alert variant="destructive">
<AlertCircle className="h-4 w-4" /> <AlertCircle className="h-4 w-4" />
@@ -783,7 +950,8 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
isDeploying || isDeploying ||
(selectedProvider.type === 'shakespeare' && !user) || (selectedProvider.type === 'shakespeare' && !user) ||
(selectedProvider.type === 'shakespeare' && !isShakespeareFormValid) || (selectedProvider.type === 'shakespeare' && !isShakespeareFormValid) ||
(selectedProvider.type === 'nsite' && !nsiteForm.nsec) || (selectedProvider.type === 'nsite' && !user) ||
(selectedProvider.type === 'nsite' && !nsiteForm.dTag) ||
(selectedProvider.type === 'netlify' && !netlifyForm.siteId && !netlifyForm.siteName) || (selectedProvider.type === 'netlify' && !netlifyForm.siteId && !netlifyForm.siteName) ||
(selectedProvider.type === 'cloudflare' && !cloudflareForm.projectName) || (selectedProvider.type === 'cloudflare' && !cloudflareForm.projectName) ||
(selectedProvider.type === 'deno' && !denoDeployForm.projectName) || (selectedProvider.type === 'deno' && !denoDeployForm.projectName) ||
+75 -79
View File
@@ -1,107 +1,103 @@
import { useState, useEffect, useRef } from 'react'; import { useState, useEffect, useRef, useCallback } from 'react';
import { generateSecretKey, getPublicKey } from 'nostr-tools/pure'; import { AlertCircle } from 'lucide-react';
import { nip19 } from 'nostr-tools';
import { Label } from '@/components/ui/label'; import { Label } from '@/components/ui/label';
import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input';
import { PasswordInput } from '@/components/ui/password-input'; import { Textarea } from '@/components/ui/textarea';
import { RefreshCw } from 'lucide-react'; import { Alert, AlertDescription } from '@/components/ui/alert';
interface NsiteDeployFormProps { interface NsiteDeployFormProps {
gateway: string; /** Human-readable project name — used to default the title */
projectName: string;
/** Persisted values from a previous deployment */
savedSiteTitle?: string;
savedSiteDescription?: string;
/** Present only when the project was previously deployed with a dedicated keypair (v1) */
savedNsec?: string; savedNsec?: string;
onNsecChange: (nsec: string) => void; onSiteTitleChange: (title: string) => void;
onSiteDescriptionChange: (description: string) => void;
} }
export function NsiteDeployForm({ export function NsiteDeployForm({
gateway, projectName,
savedSiteTitle,
savedSiteDescription,
savedNsec, savedNsec,
onNsecChange, onSiteTitleChange,
onSiteDescriptionChange,
}: NsiteDeployFormProps) { }: NsiteDeployFormProps) {
const [nsec, setNsec] = useState(savedNsec || ''); const [siteTitle, setSiteTitle] = useState(savedSiteTitle ?? projectName);
const [npub, setNpub] = useState(''); const [siteDescription, setSiteDescription] = useState(savedSiteDescription ?? '');
const initialized = useRef(false);
// On mount: sync all saved values to parent and set defaults.
// The component is keyed by selectedProviderId in DeploySteps, so this always
// runs with fresh props — no initialized guard needed.
const initializedRef = useRef(false);
const stableSyncToParent = useCallback(() => {
if (initializedRef.current) return;
initializedRef.current = true;
if (savedSiteDescription) onSiteDescriptionChange(savedSiteDescription);
const initialTitle = savedSiteTitle ?? projectName;
if (initialTitle !== siteTitle) setSiteTitle(initialTitle);
onSiteTitleChange(initialTitle);
}, [savedSiteDescription, savedSiteTitle, siteTitle, projectName, onSiteDescriptionChange, onSiteTitleChange]);
// Initialize nsec on mount
useEffect(() => { useEffect(() => {
if (!initialized.current) { stableSyncToParent();
initialized.current = true; }, [stableSyncToParent]);
if (savedNsec) {
// If we have a saved nsec, notify parent immediately
onNsecChange(savedNsec);
} else if (!nsec) {
// Generate a new nsec if none exists
const sk = generateSecretKey();
const newNsec = nip19.nsecEncode(sk);
setNsec(newNsec);
onNsecChange(newNsec);
}
}
}, [savedNsec, nsec, onNsecChange]);
// Update npub when nsec changes const handleSiteTitleChange = (value: string) => {
useEffect(() => { setSiteTitle(value);
if (nsec) { onSiteTitleChange(value);
try {
const decoded = nip19.decode(nsec);
if (decoded.type === 'nsec') {
const pk = getPublicKey(decoded.data);
const npubEncoded = nip19.npubEncode(pk);
setNpub(npubEncoded);
}
} catch {
setNpub('');
}
}
}, [nsec]);
const handleNsecChange = (value: string) => {
setNsec(value);
onNsecChange(value);
}; };
const handleGenerateNew = () => { const handleSiteDescriptionChange = (value: string) => {
const sk = generateSecretKey(); setSiteDescription(value);
const newNsec = nip19.nsecEncode(sk); onSiteDescriptionChange(value);
setNsec(newNsec);
onNsecChange(newNsec);
}; };
const fullDomain = npub ? `${npub}.${gateway}` : `npub1...${gateway}`;
return ( return (
<div className="space-y-4"> <div className="space-y-4">
{/* Migration notice */}
{savedNsec && (
<Alert>
<AlertCircle className="h-4 w-4" />
<AlertDescription>
<strong>Site identity is changing.</strong> This project was previously deployed with a
dedicated private key. Going forward, it will deploy under your Nostr identity. The old
site will remain at its original address until overwritten.
</AlertDescription>
</Alert>
)}
{/* Site title */}
<div className="space-y-2"> <div className="space-y-2">
<Label>Site URL</Label> <Label htmlFor="nsite-title">Site Title</Label>
<p className="text-sm font-mono bg-muted p-2 rounded-md break-all"> <Input
{fullDomain} id="nsite-title"
</p> value={siteTitle}
onChange={(e) => handleSiteTitleChange(e.target.value)}
placeholder="My Nostr Site"
/>
<p className="text-xs text-muted-foreground"> <p className="text-xs text-muted-foreground">
Each site has a unique Nostr keypair Shown by nsite gateways and directories. Included as a title tag in the manifest.
</p> </p>
</div> </div>
{/* Site description */}
<div className="space-y-2"> <div className="space-y-2">
<Label htmlFor="nsite-nsec">Site Private Key (nsec)</Label> <Label htmlFor="nsite-description">Description <span className="text-muted-foreground font-normal">(optional)</span></Label>
<div className="flex gap-2"> <Textarea
<PasswordInput id="nsite-description"
id="nsite-nsec" value={siteDescription}
value={nsec} onChange={(e) => handleSiteDescriptionChange(e.target.value)}
onChange={(e) => handleNsecChange(e.target.value)} placeholder="A short description of this site…"
placeholder="nsec1..." rows={3}
className="flex-1" />
/>
<Button
type="button"
variant="outline"
size="icon"
onClick={handleGenerateNew}
title="Generate new key"
>
<RefreshCw className="h-4 w-4" />
</Button>
</div>
<p className="text-xs text-muted-foreground"> <p className="text-xs text-muted-foreground">
Keep this private key secure. It's used to sign site metadata. Included as a description tag in the manifest.
</p> </p>
</div> </div>
</div> </div>
+19 -11
View File
@@ -54,19 +54,28 @@ export function GitSyncButton({ projectId, className }: GitSyncButtonProps) {
prevIsGitActionOccurring.current = isGitActionOccurring; prevIsGitActionOccurring.current = isGitActionOccurring;
}, [isGitActionOccurring, hasError]); }, [isGitActionOccurring, hasError]);
// Determine if the user has altered the project (made commits beyond the initial state).
// - Template projects (no clonedAtOid): altered when totalCommits > 1 (beyond the initial template commit)
// - Cloned projects (has clonedAtOid): altered when the latest commit differs from the clone point
const isProjectAltered = !isGitStatusLoading && gitStatus && (() => {
if (gitStatus.clonedAtOid) {
return gitStatus.latestCommit !== null && gitStatus.latestCommit.oid !== gitStatus.clonedAtOid;
}
return gitStatus.totalCommits > 1;
})();
// Check if we need to show the warning popover // Check if we need to show the warning popover
const needsRemote = !isGitStatusLoading && gitStatus && const needsRemote = isProjectAltered &&
!gitStatus.remotes.find(r => r.name === 'origin') && !gitStatus?.remotes.find(r => r.name === 'origin');
gitStatus.totalCommits > 1;
// Show warning popover when purple indicator is visible (only if not dismissed) // Show warning popover when purple indicator is visible (only if not dismissed)
useEffect(() => { useEffect(() => {
if (needsRemote && !warningDismissed.current && gitStatus.totalCommits > 1) { if (needsRemote && !warningDismissed.current) {
setShowWarningPopover(true); setShowWarningPopover(true);
} else { } else {
setShowWarningPopover(false); setShowWarningPopover(false);
} }
}, [gitStatus?.totalCommits, needsRemote]); }, [needsRemote]);
// Handle button click - dismiss warning popover permanently // Handle button click - dismiss warning popover permanently
const handleButtonClick = () => { const handleButtonClick = () => {
@@ -96,19 +105,18 @@ export function GitSyncButton({ projectId, className }: GitSyncButtonProps) {
if (isGitStatusLoading || !gitStatus) return null; if (isGitStatusLoading || !gitStatus) return null;
const originRemote = gitStatus.remotes.find(r => r.name === 'origin'); const hasOrigin = !!gitStatus.remotes.find(r => r.name === 'origin');
const hasRemote = !!originRemote;
const { remoteBranchExists, ahead, behind, totalCommits } = gitStatus; const { remoteBranchExists, ahead, behind } = gitStatus;
// Yellow indicator: unsynced changes (ahead or behind remote) - third priority // Yellow indicator: unsynced changes (ahead or behind remote) - third priority
const hasUnsyncedChanges = hasRemote && remoteBranchExists && (ahead > 0 || behind > 0); const hasUnsyncedChanges = hasOrigin && remoteBranchExists && (ahead > 0 || behind > 0);
if (hasUnsyncedChanges) { if (hasUnsyncedChanges) {
return <IndicatorDot color="yellow" />; return <IndicatorDot color="yellow" />;
} }
// Purple indicator: no remote configured, but has commits - lowest priority // Purple indicator: project altered but no origin remote configured - lowest priority
const needsRemote = !hasRemote && totalCommits > 1; const needsRemote = isProjectAltered && !hasOrigin;
if (needsRemote) { if (needsRemote) {
return <IndicatorDot color="primary" />; return <IndicatorDot color="primary" />;
} }
+4
View File
@@ -68,6 +68,10 @@ export interface AppConfig {
sentryEnabled: boolean; sentryEnabled: boolean;
/** System prompt EJS template */ /** System prompt EJS template */
systemPrompt?: string; systemPrompt?: string;
/** Plausible Analytics domain (empty string = disabled). */
plausibleDomain: string;
/** Plausible Analytics API endpoint (empty string = use default). */
plausibleEndpoint: string;
} }
export interface AppContextType { export interface AppContextType {
+104
View File
@@ -0,0 +1,104 @@
import { useNostr } from '@nostrify/react';
import { useQuery } from '@tanstack/react-query';
import { useEffect, useState } from 'react';
import type { NostrEvent } from '@nostrify/nostrify';
import { useFS } from '@/hooks/useFS';
import { useCurrentUser } from '@/hooks/useCurrentUser';
import { DotAI } from '@/lib/DotAI';
interface UseAppEventOptions {
/** Project working directory (e.g. /projects/<id>) */
cwd: string;
}
/**
* Hook to fetch the kind 31990 app event associated with this project.
* Reads the stored "a" coordinate from .git/shakespeare/app.json,
* then queries relays for the matching event.
*/
export function useAppEvent({ cwd }: UseAppEventOptions) {
const { nostr } = useNostr();
const { fs } = useFS();
const { user } = useCurrentUser();
const [aTag, setATag] = useState<string | null>(null);
const [isLoadingConfig, setIsLoadingConfig] = useState(true);
// Read the stored "a" coordinate on mount
useEffect(() => {
const loadConfig = async () => {
try {
const dotAI = new DotAI(fs, cwd);
const config = await dotAI.readAppConfig();
setATag(config?.a ?? null);
} catch {
setATag(null);
} finally {
setIsLoadingConfig(false);
}
};
loadConfig();
}, [fs, cwd]);
// Parse the "a" coordinate into filter components
const parsed = aTag ? parseATag(aTag) : null;
const query = useQuery<NostrEvent | null>({
queryKey: ['app-event', aTag],
queryFn: async ({ signal }) => {
if (!parsed) return null;
const events = await nostr.query(
[{
kinds: [parsed.kind],
authors: [parsed.pubkey],
'#d': [parsed.dTag],
limit: 1,
}],
{ signal: AbortSignal.any([signal, AbortSignal.timeout(5000)]) },
);
if (events.length === 0) return null;
// Return the most recent event
return events.reduce((latest, current) =>
current.created_at > latest.created_at ? current : latest,
);
},
enabled: !!parsed && !isLoadingConfig,
});
return {
/** The stored "a" coordinate (e.g. "31990:<pubkey>:<d-tag>") */
aTag,
/** Set the "a" coordinate (updates local state; caller must persist) */
setATag,
/** The fetched kind 31990 event, or null */
event: query.data ?? null,
/** Whether the config or event is still loading */
isLoading: isLoadingConfig || query.isLoading,
/** Whether there is an existing app event for this project */
hasApp: !!aTag,
/** The current user's pubkey */
userPubkey: user?.pubkey,
/** Refetch the event from relays */
refetch: query.refetch,
};
}
/** Parse a Nostr "a" coordinate string into its components */
function parseATag(a: string): { kind: number; pubkey: string; dTag: string } | null {
const parts = a.split(':');
if (parts.length < 3) return null;
const kind = parseInt(parts[0], 10);
if (isNaN(kind)) return null;
const pubkey = parts[1];
const dTag = parts.slice(2).join(':'); // d-tag may contain colons
if (!pubkey || dTag === undefined) return null;
return { kind, pubkey, dTag };
}
+4
View File
@@ -80,6 +80,8 @@ describe('useGenerateProjectInfo', () => {
fsPathTemplates: '/templates', fsPathTemplates: '/templates',
sentryDsn: '', sentryDsn: '',
sentryEnabled: false, sentryEnabled: false,
plausibleDomain: '',
plausibleEndpoint: '',
}; };
mockUseAppContext.mockReturnValue({ mockUseAppContext.mockReturnValue({
config, config,
@@ -242,6 +244,8 @@ describe('useGenerateProjectInfo', () => {
fsPathTemplates: '/templates', fsPathTemplates: '/templates',
sentryDsn: '', sentryDsn: '',
sentryEnabled: false, sentryEnabled: false,
plausibleDomain: '',
plausibleEndpoint: '',
}; };
mockUseAppContext.mockReturnValue({ mockUseAppContext.mockReturnValue({
config, config,
+2
View File
@@ -54,6 +54,8 @@ function createWrapper(corsProxy: string) {
fsPathTemplates: '/templates', fsPathTemplates: '/templates',
sentryDsn: '', sentryDsn: '',
sentryEnabled: false, sentryEnabled: false,
plausibleDomain: '',
plausibleEndpoint: '',
}; };
return createElement( return createElement(
+16
View File
@@ -39,6 +39,7 @@ interface GitStatus {
ahead: number; ahead: number;
behind: number; behind: number;
remoteBranchExists: boolean; remoteBranchExists: boolean;
clonedAtOid: string | null;
} }
export function useGitStatus(projectId: string | null) { export function useGitStatus(projectId: string | null) {
@@ -61,6 +62,7 @@ export function useGitStatus(projectId: string | null) {
ahead: 0, ahead: 0,
behind: 0, behind: 0,
remoteBranchExists: false, remoteBranchExists: false,
clonedAtOid: null,
}; };
} }
@@ -83,6 +85,7 @@ export function useGitStatus(projectId: string | null) {
ahead: 0, ahead: 0,
behind: 0, behind: 0,
remoteBranchExists: false, remoteBranchExists: false,
clonedAtOid: null,
}; };
} }
@@ -168,6 +171,17 @@ export function useGitStatus(projectId: string | null) {
console.warn('Could not get remotes:', error); console.warn('Could not get remotes:', error);
} }
// Get clonedAt OID (set when project was cloned from an external repo)
let clonedAtOid: string | null = null;
try {
const value = await git.getConfig({ dir: cwd, path: 'shakespeare.clonedAt' });
if (typeof value === 'string' && value.length > 0) {
clonedAtOid = value;
}
} catch {
// Config key doesn't exist, that's fine
}
// Get git status to see what files have changed // Get git status to see what files have changed
const statusMatrix = await git.statusMatrix({ const statusMatrix = await git.statusMatrix({
dir: cwd, dir: cwd,
@@ -274,6 +288,7 @@ export function useGitStatus(projectId: string | null) {
ahead, ahead,
behind, behind,
remoteBranchExists, remoteBranchExists,
clonedAtOid,
}; };
} catch (error) { } catch (error) {
console.error('Error checking git status:', error); console.error('Error checking git status:', error);
@@ -289,6 +304,7 @@ export function useGitStatus(projectId: string | null) {
ahead: 0, ahead: 0,
behind: 0, behind: 0,
remoteBranchExists: false, remoteBranchExists: false,
clonedAtOid: null,
}; };
} }
}, },
+8 -1
View File
@@ -15,7 +15,14 @@ const nsiteProjectConfigSchema = z.object({
type: z.literal('nsite'), type: z.literal('nsite'),
url: z.string(), url: z.string(),
data: z.object({ data: z.object({
nsec: z.string(), /** Kept optional — only present on configs created before the signer migration */
nsec: z.string().optional(),
siteTitle: z.string().optional(),
siteDescription: z.string().optional(),
/** Named-site dTag identifier (kind 35128). */
dTag: z.string().optional(),
/** @deprecated — Shakespeare always deploys named sites now. Kept for backward compat. */
siteType: z.enum(['named', 'root']).optional(),
}), }),
}); });
+1
View File
@@ -15,6 +15,7 @@ export function useUploadFile() {
const uploader = new BlossomUploader({ const uploader = new BlossomUploader({
servers: [ servers: [
'https://blossom.primal.net/', 'https://blossom.primal.net/',
'https://blossom.ditto.pub/',
], ],
signer: user.signer, signer: user.signer,
}); });
+1 -1
View File
@@ -200,7 +200,7 @@ export function useZaps(
const zapRequest = nip57.makeZapRequest({ const zapRequest = nip57.makeZapRequest({
event: actualTarget, event: actualTarget,
amount: zapAmount, amount: zapAmount,
relays: writeRelays.length > 0 ? writeRelays : ['wss://relay.nostr.band'], relays: writeRelays.length > 0 ? writeRelays : ['wss://relay.ditto.pub'],
comment comment
}); });
+43
View File
@@ -393,4 +393,47 @@ export class DotAI {
console.warn(`Failed to write .git/ai/FINISH_REASON file: ${error}`); console.warn(`Failed to write .git/ai/FINISH_REASON file: ${error}`);
} }
} }
/**
* Read app config from .git/shakespeare/app.json file.
* Stores the Nostr "a" coordinate for the project's kind 31990 app event.
* @returns App config object or null if not found or invalid
*/
async readAppConfig(): Promise<AppConfig | null> {
try {
const appPath = join(this.workingDir, ".git", "shakespeare", "app.json");
const content = await this.fs.readFile(appPath, "utf8");
const data = JSON.parse(content);
if (data && typeof data.a === 'string' && data.a.length > 0) {
return { a: data.a };
}
return null;
} catch {
return null;
}
}
/**
* Write app config to .git/shakespeare/app.json file.
* @param config App config with the Nostr "a" coordinate (e.g. "31990:<pubkey>:<d-tag>")
*/
async writeAppConfig(config: AppConfig): Promise<void> {
const shakespeareDir = join(this.workingDir, ".git", "shakespeare");
const appPath = join(shakespeareDir, "app.json");
try {
await this.fs.mkdir(shakespeareDir, { recursive: true });
await this.fs.writeFile(appPath, JSON.stringify(config, null, 2) + "\n");
} catch (error) {
console.warn(`Failed to write .git/shakespeare/app.json file: ${error}`);
}
}
}
/** App config stored in .git/shakespeare/app.json */
export interface AppConfig {
/** Nostr "a" coordinate for the kind 31990 event (e.g. "31990:<pubkey>:<d-tag>") */
a: string;
} }
+41 -27
View File
@@ -57,50 +57,52 @@ export class ProjectsManager {
* Returns the path to the cached template. * Returns the path to the cached template.
* *
* @param templateUrl - Git repository URL of the template * @param templateUrl - Git repository URL of the template
* @param onUpdateError - Optional callback when template update fails (non-critical)
* @returns Path to the cached template directory * @returns Path to the cached template directory
*/ */
async updateTemplate(templateUrl: string, onUpdateError?: (error: Error) => void): Promise<string> { async updateTemplate(templateUrl: string): Promise<string> {
// Generate a safe directory name from the template URL // Generate a safe directory name from the template URL
const templateName = this.getTemplateNameFromUrl(templateUrl); const templateName = this.getTemplateNameFromUrl(templateUrl);
const templatePath = `${this.templatesDir}/${templateName}`; const templatePath = `${this.templatesDir}/${templateName}`;
try { const templateExists = await this.fs.stat(templatePath).then(() => true, () => false);
// Check if template already exists
await this.fs.stat(templatePath);
if (templateExists) {
// Template exists, try to update it with force pull // Template exists, try to update it with force pull
try { try {
await this.forcePullTemplate(templatePath); await this.forcePullTemplate(templatePath);
return templatePath;
} catch (updateError) { } catch (updateError) {
// Update failed, but we can continue with the existing template // Force pull failed (common with shallow clones when remote has new commits).
console.warn(`Failed to update template at ${templatePath}:`, updateError); // Delete the stale cache and re-clone fresh below.
if (onUpdateError) { console.warn(`Force pull failed for template at ${templatePath}, re-cloning fresh:`, updateError);
onUpdateError(updateError instanceof Error ? updateError : new Error(String(updateError)));
}
}
} catch {
// Template doesn't exist, clone it shallowly
await this.fs.mkdir(templatePath, { recursive: true });
try {
await this.git.clone({
dir: templatePath,
url: templateUrl,
singleBranch: true,
depth: 1,
});
} catch (cloneError) {
// Clean up on clone failure
try { try {
await this.deleteDirectory(templatePath); await this.deleteDirectory(templatePath);
} catch { } catch {
// Ignore cleanup errors // Ignore cleanup errors
} }
throw cloneError;
} }
} }
// Template doesn't exist (or was deleted after failed update), clone it fresh
await this.fs.mkdir(templatePath, { recursive: true });
try {
await this.git.clone({
dir: templatePath,
url: templateUrl,
singleBranch: true,
depth: 1,
});
} catch (cloneError) {
// Clean up on clone failure
try {
await this.deleteDirectory(templatePath);
} catch {
// Ignore cleanup errors
}
throw cloneError;
}
return templatePath; return templatePath;
} }
@@ -224,7 +226,7 @@ export class ProjectsManager {
} }
} }
async createProject(name: string, templateUrl: string, customId?: string, onTemplateUpdateError?: (error: Error) => void, templateMetadata?: { name: string; description: string }): Promise<Project> { async createProject(name: string, templateUrl: string, customId?: string, templateMetadata?: { name: string; description: string }): Promise<Project> {
const id = customId || await this.generateUniqueProjectId(name); const id = customId || await this.generateUniqueProjectId(name);
// Check if project with this ID already exists when using custom ID // Check if project with this ID already exists when using custom ID
@@ -235,7 +237,7 @@ export class ProjectsManager {
const projectPath = `${this.dir}/${id}`; const projectPath = `${this.dir}/${id}`;
// Ensure template is cached and up-to-date // Ensure template is cached and up-to-date
const templatePath = await this.updateTemplate(templateUrl, onTemplateUpdateError); const templatePath = await this.updateTemplate(templateUrl);
// Create project directory // Create project directory
await this.fs.mkdir(projectPath, { recursive: true }); await this.fs.mkdir(projectPath, { recursive: true });
@@ -522,6 +524,18 @@ export class ProjectsManager {
remote: fork ? 'upstream' : undefined, // Use 'upstream' for forks, otherwise defaults to 'origin' remote: fork ? 'upstream' : undefined, // Use 'upstream' for forks, otherwise defaults to 'origin'
}); });
// Store the HEAD commit OID at clone time so we can detect user modifications later
try {
const headOid = await this.git.resolveRef({ dir: projectPath, ref: 'HEAD' });
await this.git.setConfig({
dir: projectPath,
path: 'shakespeare.clonedAt',
value: headOid,
});
} catch (error) {
console.warn('Failed to store clonedAt commit OID:', error);
}
if (!fork) { if (!fork) {
// Set up 'shakespeare.autosync' config for non-forked repositories // Set up 'shakespeare.autosync' config for non-forked repositories
await this.git.setConfig({ await this.git.setConfig({
+2
View File
@@ -58,6 +58,8 @@ const testConfig: AppConfig = {
fsPathTemplates: '/templates', fsPathTemplates: '/templates',
sentryDsn: '', sentryDsn: '',
sentryEnabled: false, sentryEnabled: false,
plausibleDomain: '',
plausibleEndpoint: '',
}; };
describe('SessionManager', () => { describe('SessionManager', () => {
+29
View File
@@ -319,6 +319,31 @@ export class SessionManager {
imageModel: settings.imageModel, imageModel: settings.imageModel,
}); });
// Strip image_url parts from all user messages except the last one.
// The model has already seen and responded to earlier images, so re-sending
// them on every turn just burns tokens. The VFS text path (e.g. "Added file: /tmp/…")
// is kept, so the model can `read` the file again if it needs to.
const evictSeenImages = (msgs: OpenAI.Chat.Completions.ChatCompletionMessageParam[]): OpenAI.Chat.Completions.ChatCompletionMessageParam[] => {
// Find the index of the last user message
let lastUserIdx = -1;
for (let i = msgs.length - 1; i >= 0; i--) {
if (msgs[i].role === 'user') {
lastUserIdx = i;
break;
}
}
return msgs.map((msg, idx) => {
if (idx === lastUserIdx) return msg; // keep the latest user message intact
if (msg.role !== 'user' || typeof msg.content === 'string' || !Array.isArray(msg.content)) return msg;
const filtered = msg.content.filter(part => part.type !== 'image_url');
if (filtered.length === msg.content.length) return msg; // no images to strip
return { ...msg, content: filtered.length > 0 ? filtered : '' };
});
};
// Helper function to filter out unsupported image formats (keep only JPG/JPEG/PNG) // Helper function to filter out unsupported image formats (keep only JPG/JPEG/PNG)
const filterSupportedImages = (msgs: OpenAI.Chat.Completions.ChatCompletionMessageParam[]): OpenAI.Chat.Completions.ChatCompletionMessageParam[] => { const filterSupportedImages = (msgs: OpenAI.Chat.Completions.ChatCompletionMessageParam[]): OpenAI.Chat.Completions.ChatCompletionMessageParam[] => {
return msgs.map(msg => { return msgs.map(msg => {
@@ -378,6 +403,10 @@ export class SessionManager {
? [{ role: 'system', content: systemPrompt }, ...session.messages] ? [{ role: 'system', content: systemPrompt }, ...session.messages]
: session.messages) as OpenAI.Chat.Completions.ChatCompletionMessageParam[]; : session.messages) as OpenAI.Chat.Completions.ChatCompletionMessageParam[];
// Evict images the model has already seen (all except the last user message).
// This is a send-time transformation only — session.messages stays intact for the UI.
messages = evictSeenImages(messages);
// Filter out unsupported image formats (keep only JPG/JPEG/PNG for API) // Filter out unsupported image formats (keep only JPG/JPEG/PNG for API)
// This ensures the UI shows all image types, but API only receives supported formats // This ensures the UI shows all image types, but API only receives supported formats
messages = filterSupportedImages(messages); messages = filterSupportedImages(messages);
Loaded 100 of 140 files, more files were not shown because too many files have changed in this diff. Show more