feat(cli): deep integration with desktop client (#4896)
* feat(cli): deep integration with desktop client - Package CLI binary with desktop app via extraResource in Electron Forge - Sync desktop login session to ~/.folo/config.json automatically on login/logout - Add CliService IPC with install/uninstall methods supporting macOS (osascript), Linux (pkexec), Windows (.cmd wrapper) - Add CLI settings tab in desktop app for install status and management - Create prepare-cli build script to compile and bundle CLI before packaging - Add i18n strings for CLI UI (English and Chinese) The CLI now shares the desktop app's authentication session without requiring separate login. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> * fix(cli): fix CI failures in auth service and forge config - Pass `undefined` explicitly to syncSessionToCliConfig() to satisfy TS arity check - Make resources/cli conditional in extraResource so packaging doesn't fail when CLI bundle is absent Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(cli): make syncSessionToCliConfig token param optional Avoids TS2554 when called without arguments on signOut, while also satisfying the lint rule that strips explicit `undefined` arguments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(cli): address PR review feedback - Fix $@ shell expansion in privileged install path by writing to a temp file first, then using admin cp (Comment #1) - Check .cmd extension on Windows for install status and uninstall guard so the CLI is correctly detected and removed (Comment #2) - Wire prepare:cli into build:electron-vite instead of build:electron so all CI packaging paths (vite + forge) include CLI (Comment #3) - Add CLI i18n strings for ja, fr-FR, zh-TW locales (Comment #4) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
49f69f4d19
commit
df748a5f6a
@@ -29,6 +29,7 @@ buildServer.json
|
||||
**/**/generated-routes.ts
|
||||
|
||||
apps/desktop/build/appxmanifest.xml
|
||||
apps/desktop/resources/cli
|
||||
|
||||
.claude/settings.local.json
|
||||
.serena
|
||||
|
||||
@@ -102,7 +102,10 @@ const config: ForgeConfig = {
|
||||
buildVersion: process.env.BUILD_VERSION || undefined,
|
||||
appBundleId: "is.follow",
|
||||
icon: isStaging ? "resources/icon-staging" : "resources/icon",
|
||||
extraResource: ["./resources/app-update.yml"],
|
||||
extraResource: [
|
||||
"./resources/app-update.yml",
|
||||
...(fs.existsSync("./resources/cli") ? ["./resources/cli"] : []),
|
||||
],
|
||||
protocols: [
|
||||
{
|
||||
name: "Folo",
|
||||
|
||||
@@ -3,6 +3,7 @@ import { createServices } from "electron-ipc-decorator"
|
||||
|
||||
import { AppService } from "./services/app"
|
||||
import { AuthService } from "./services/auth"
|
||||
import { CliService } from "./services/cli"
|
||||
import { DebugService } from "./services/debug"
|
||||
import { DockService } from "./services/dock"
|
||||
import { IntegrationService } from "./services/integration"
|
||||
@@ -14,6 +15,7 @@ import { SettingService } from "./services/setting"
|
||||
const services = createServices([
|
||||
AppService,
|
||||
AuthService,
|
||||
CliService,
|
||||
DebugService,
|
||||
DockService,
|
||||
MenuService,
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import type { IpcContext } from "electron-ipc-decorator"
|
||||
import { IpcMethod, IpcService } from "electron-ipc-decorator"
|
||||
|
||||
import { getSessionTokenFromCookies, syncSessionToCliConfig } from "../../lib/cli-session-sync"
|
||||
import { deleteNotificationsToken, updateNotificationsToken } from "../../lib/user"
|
||||
import { logger } from "../../logger"
|
||||
|
||||
export class AuthService extends IpcService {
|
||||
static override readonly groupName = "auth"
|
||||
@@ -9,10 +11,21 @@ export class AuthService extends IpcService {
|
||||
@IpcMethod()
|
||||
async sessionChanged(_context: IpcContext): Promise<void> {
|
||||
await updateNotificationsToken()
|
||||
|
||||
// Sync session token to CLI config
|
||||
const token = await getSessionTokenFromCookies()
|
||||
await syncSessionToCliConfig(token).catch((err) => {
|
||||
logger.error("Failed to sync session to CLI config:", err)
|
||||
})
|
||||
}
|
||||
|
||||
@IpcMethod()
|
||||
async signOut(_context: IpcContext): Promise<void> {
|
||||
await deleteNotificationsToken()
|
||||
|
||||
// Clear CLI config token on sign out
|
||||
await syncSessionToCliConfig().catch((err) => {
|
||||
logger.error("Failed to clear CLI config token:", err)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
import { execSync } from "node:child_process"
|
||||
import { existsSync, lstatSync, readlinkSync } from "node:fs"
|
||||
import { unlink, writeFile } from "node:fs/promises"
|
||||
import { tmpdir } from "node:os"
|
||||
|
||||
import { app } from "electron"
|
||||
import type { IpcContext } from "electron-ipc-decorator"
|
||||
import { IpcMethod, IpcService } from "electron-ipc-decorator"
|
||||
import path from "pathe"
|
||||
|
||||
import { logger } from "../../logger"
|
||||
|
||||
const CLI_BINARY_NAME = "folo"
|
||||
|
||||
const getDefaultInstallDir = (): string => {
|
||||
switch (process.platform) {
|
||||
case "win32": {
|
||||
return path.join(process.env.LOCALAPPDATA || "", "Folo", "bin")
|
||||
}
|
||||
default: {
|
||||
return "/usr/local/bin"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getCliSourcePath = (): string => {
|
||||
if (app.isPackaged) {
|
||||
return path.join(process.resourcesPath, "cli", "index.js")
|
||||
}
|
||||
// In dev, read from the cli workspace directly
|
||||
return path.resolve(app.getAppPath(), "../../cli/dist/index.js")
|
||||
}
|
||||
|
||||
const getCliInstallPath = (): string => {
|
||||
return path.join(getDefaultInstallDir(), CLI_BINARY_NAME)
|
||||
}
|
||||
|
||||
/** Check whether the CLI is present at the given path (also checks .cmd on Windows). */
|
||||
const cliExistsAt = (installPath: string): boolean => {
|
||||
if (existsSync(installPath)) return true
|
||||
if (process.platform === "win32" && existsSync(`${installPath}.cmd`)) return true
|
||||
return false
|
||||
}
|
||||
|
||||
export interface CliInstallStatus {
|
||||
installed: boolean
|
||||
installPath: string | null
|
||||
cliSourceAvailable: boolean
|
||||
}
|
||||
|
||||
export class CliService extends IpcService {
|
||||
static override readonly groupName = "cli"
|
||||
|
||||
@IpcMethod()
|
||||
async getInstallStatus(_context: IpcContext): Promise<CliInstallStatus> {
|
||||
const installPath = getCliInstallPath()
|
||||
const cliSourcePath = getCliSourcePath()
|
||||
const cliSourceAvailable = existsSync(cliSourcePath)
|
||||
|
||||
try {
|
||||
if (!cliExistsAt(installPath)) {
|
||||
return { installed: false, installPath: null, cliSourceAvailable }
|
||||
}
|
||||
|
||||
if (existsSync(installPath)) {
|
||||
const stats = lstatSync(installPath)
|
||||
if (stats.isSymbolicLink()) {
|
||||
const target = readlinkSync(installPath)
|
||||
const isOurs = target.includes("Folo") || target.includes("cli/index.js")
|
||||
return { installed: isOurs, installPath, cliSourceAvailable }
|
||||
}
|
||||
}
|
||||
|
||||
// Exists as a regular file (wrapper script or .cmd on Windows)
|
||||
return { installed: true, installPath, cliSourceAvailable }
|
||||
} catch {
|
||||
return { installed: false, installPath: null, cliSourceAvailable }
|
||||
}
|
||||
}
|
||||
|
||||
@IpcMethod()
|
||||
async installCli(_context: IpcContext): Promise<{ success: boolean; error?: string }> {
|
||||
const cliSource = getCliSourcePath()
|
||||
if (!existsSync(cliSource)) {
|
||||
return { success: false, error: "CLI bundle not found in app resources" }
|
||||
}
|
||||
|
||||
const installPath = getCliInstallPath()
|
||||
const wrapperContent = `#!/bin/sh\nexec /usr/bin/env node "${cliSource}" "$@"\n`
|
||||
|
||||
if (process.platform === "win32") {
|
||||
return this.installCliWindows(cliSource, installPath)
|
||||
}
|
||||
|
||||
try {
|
||||
// Try without elevated permissions first
|
||||
await writeFile(installPath, wrapperContent, { mode: 0o755 })
|
||||
logger.info(`CLI installed at ${installPath}`)
|
||||
return { success: true }
|
||||
} catch {
|
||||
// Write to a temp file first, then use admin privileges to copy it.
|
||||
// This avoids shell-expansion issues with $@ in the wrapper content.
|
||||
const tmpFile = path.join(tmpdir(), `folo-cli-wrapper-${Date.now()}`)
|
||||
try {
|
||||
await writeFile(tmpFile, wrapperContent, { mode: 0o755 })
|
||||
|
||||
if (process.platform === "darwin") {
|
||||
execSync(
|
||||
`osascript -e 'do shell script "cp \\"${tmpFile}\\" \\"${installPath}\\" && chmod +x \\"${installPath}\\"" with administrator privileges'`,
|
||||
)
|
||||
} else {
|
||||
// Linux: use pkexec
|
||||
execSync(`pkexec sh -c 'cp "${tmpFile}" "${installPath}" && chmod +x "${installPath}"'`)
|
||||
}
|
||||
|
||||
logger.info(`CLI installed at ${installPath} (with elevated privileges)`)
|
||||
return { success: true }
|
||||
} catch (err) {
|
||||
logger.error("Failed to install CLI with elevated privileges:", err)
|
||||
return {
|
||||
success: false,
|
||||
error: err instanceof Error ? err.message : "Failed to install CLI",
|
||||
}
|
||||
} finally {
|
||||
await unlink(tmpFile).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@IpcMethod()
|
||||
async uninstallCli(_context: IpcContext): Promise<{ success: boolean; error?: string }> {
|
||||
const installPath = getCliInstallPath()
|
||||
|
||||
if (!cliExistsAt(installPath)) {
|
||||
return { success: true }
|
||||
}
|
||||
|
||||
if (process.platform === "win32") {
|
||||
return this.uninstallCliWindows(installPath)
|
||||
}
|
||||
|
||||
try {
|
||||
await unlink(installPath)
|
||||
logger.info(`CLI uninstalled from ${installPath}`)
|
||||
return { success: true }
|
||||
} catch {
|
||||
// Needs elevated permissions
|
||||
if (process.platform === "darwin") {
|
||||
try {
|
||||
execSync(
|
||||
`osascript -e 'do shell script "rm -f \\"${installPath}\\"" with administrator privileges'`,
|
||||
)
|
||||
logger.info(`CLI uninstalled from ${installPath} (with admin privileges)`)
|
||||
return { success: true }
|
||||
} catch (err) {
|
||||
logger.error("Failed to uninstall CLI with admin privileges:", err)
|
||||
return {
|
||||
success: false,
|
||||
error: err instanceof Error ? err.message : "Failed to uninstall CLI",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
execSync(`pkexec rm -f "${installPath}"`)
|
||||
logger.info(`CLI uninstalled from ${installPath} (with pkexec)`)
|
||||
return { success: true }
|
||||
} catch (err) {
|
||||
logger.error("Failed to uninstall CLI:", err)
|
||||
return {
|
||||
success: false,
|
||||
error: err instanceof Error ? err.message : "Failed to uninstall CLI",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async installCliWindows(
|
||||
cliSource: string,
|
||||
installPath: string,
|
||||
): Promise<{ success: boolean; error?: string }> {
|
||||
const installDir = path.dirname(installPath)
|
||||
const cmdContent = `@echo off\r\nnode "${cliSource}" %*\r\n`
|
||||
|
||||
try {
|
||||
const { mkdirSync, writeFileSync } = await import("node:fs")
|
||||
mkdirSync(installDir, { recursive: true })
|
||||
writeFileSync(`${installPath}.cmd`, cmdContent)
|
||||
logger.info(`CLI installed at ${installPath}.cmd`)
|
||||
return { success: true }
|
||||
} catch (err) {
|
||||
logger.error("Failed to install CLI on Windows:", err)
|
||||
return {
|
||||
success: false,
|
||||
error: err instanceof Error ? err.message : "Failed to install CLI",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async uninstallCliWindows(
|
||||
installPath: string,
|
||||
): Promise<{ success: boolean; error?: string }> {
|
||||
try {
|
||||
const { unlinkSync } = await import("node:fs")
|
||||
const cmdPath = `${installPath}.cmd`
|
||||
if (existsSync(cmdPath)) {
|
||||
unlinkSync(cmdPath)
|
||||
}
|
||||
if (existsSync(installPath)) {
|
||||
unlinkSync(installPath)
|
||||
}
|
||||
logger.info(`CLI uninstalled from ${installPath}`)
|
||||
return { success: true }
|
||||
} catch (err) {
|
||||
logger.error("Failed to uninstall CLI on Windows:", err)
|
||||
return {
|
||||
success: false,
|
||||
error: err instanceof Error ? err.message : "Failed to uninstall CLI",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import { mkdir, readFile, writeFile } from "node:fs/promises"
|
||||
import { homedir } from "node:os"
|
||||
|
||||
import { env } from "@follow/shared/env.desktop"
|
||||
import { join } from "pathe"
|
||||
|
||||
import { BETTER_AUTH_COOKIE_NAME_SESSION_TOKEN } from "~/constants/app"
|
||||
import { WindowManager } from "~/manager/window"
|
||||
|
||||
import { logger } from "../logger"
|
||||
|
||||
const CLI_CONFIG_DIR = join(homedir(), ".folo")
|
||||
const CLI_CONFIG_PATH = join(CLI_CONFIG_DIR, "config.json")
|
||||
|
||||
interface CliConfig {
|
||||
token?: string
|
||||
apiUrl?: string
|
||||
}
|
||||
|
||||
const readCliConfig = async (): Promise<CliConfig> => {
|
||||
try {
|
||||
const raw = await readFile(CLI_CONFIG_PATH, "utf8")
|
||||
return JSON.parse(raw) as CliConfig
|
||||
} catch {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
const writeCliConfig = async (config: CliConfig): Promise<void> => {
|
||||
await mkdir(CLI_CONFIG_DIR, { recursive: true })
|
||||
await writeFile(CLI_CONFIG_PATH, `${JSON.stringify(config, null, 2)}\n`, "utf8")
|
||||
}
|
||||
|
||||
export const getSessionTokenFromCookies = async (): Promise<string | undefined> => {
|
||||
const window = WindowManager.getMainWindow()
|
||||
if (!window) return undefined
|
||||
|
||||
const cookies = await window.webContents.session.cookies.get({
|
||||
domain: new URL(env.VITE_API_URL).hostname,
|
||||
})
|
||||
|
||||
const sessionCookie = cookies.find((cookie) =>
|
||||
cookie.name.includes(BETTER_AUTH_COOKIE_NAME_SESSION_TOKEN),
|
||||
)
|
||||
|
||||
return sessionCookie?.value
|
||||
}
|
||||
|
||||
export const syncSessionToCliConfig = async (token?: string): Promise<void> => {
|
||||
const config = await readCliConfig()
|
||||
|
||||
if (token) {
|
||||
config.token = token
|
||||
config.apiUrl = env.VITE_API_URL
|
||||
} else {
|
||||
delete config.token
|
||||
}
|
||||
|
||||
await writeCliConfig(config)
|
||||
logger.info(`CLI config synced (token ${token ? "set" : "cleared"})`)
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import { WindowManager } from "~/manager/window"
|
||||
import { getIconPath } from "../helper"
|
||||
import { initializeIpcServices } from "../ipc"
|
||||
import { checkAndCleanCodeCache, clearCacheCronJob } from "../lib/cleaner"
|
||||
import { getSessionTokenFromCookies, syncSessionToCliConfig } from "../lib/cli-session-sync"
|
||||
import { t } from "../lib/i18n"
|
||||
import { updateProxy } from "../lib/proxy"
|
||||
import { store } from "../lib/store"
|
||||
@@ -47,6 +48,18 @@ class AppManagerStatic {
|
||||
updateProxy()
|
||||
registerUpdater()
|
||||
registerAppTray()
|
||||
|
||||
// Sync session to CLI config after window and cookies are ready
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
const token = await getSessionTokenFromCookies()
|
||||
if (token) {
|
||||
await syncSessionToCliConfig(token)
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error("Failed to sync session to CLI on startup:", err)
|
||||
}
|
||||
}, 5000)
|
||||
}
|
||||
|
||||
private registerProtocols() {
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
import { Button } from "@follow/components/ui/button/index.js"
|
||||
import { IN_ELECTRON } from "@follow/shared/constants"
|
||||
import { useCallback, useEffect, useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { toast } from "sonner"
|
||||
|
||||
import { ipcServices } from "~/lib/client"
|
||||
|
||||
import { SettingSectionTitle } from "../section"
|
||||
|
||||
export const SettingCli = () => {
|
||||
interface CliInstallStatus {
|
||||
installed: boolean
|
||||
installPath: string | null
|
||||
cliSourceAvailable: boolean
|
||||
}
|
||||
const { t } = useTranslation("settings")
|
||||
const [status, setStatus] = useState<CliInstallStatus | null>(null)
|
||||
const [loading, setLoading] = useState(false)
|
||||
|
||||
const refreshStatus = useCallback(async () => {
|
||||
const result = await ipcServices?.cli.getInstallStatus()
|
||||
if (result) {
|
||||
setStatus(result)
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
refreshStatus()
|
||||
}, [refreshStatus])
|
||||
|
||||
const handleInstall = useCallback(async () => {
|
||||
setLoading(true)
|
||||
try {
|
||||
const result = await ipcServices?.cli.installCli()
|
||||
if (result?.success) {
|
||||
toast.success(t("cli.install_success"))
|
||||
} else {
|
||||
toast.error(result?.error || t("cli.install_failed"))
|
||||
}
|
||||
} catch {
|
||||
toast.error(t("cli.install_failed"))
|
||||
}
|
||||
await refreshStatus()
|
||||
setLoading(false)
|
||||
}, [t, refreshStatus])
|
||||
|
||||
const handleUninstall = useCallback(async () => {
|
||||
setLoading(true)
|
||||
try {
|
||||
const result = await ipcServices?.cli.uninstallCli()
|
||||
if (result?.success) {
|
||||
toast.success(t("cli.uninstall_success"))
|
||||
} else {
|
||||
toast.error(result?.error || t("cli.uninstall_failed"))
|
||||
}
|
||||
} catch {
|
||||
toast.error(t("cli.uninstall_failed"))
|
||||
}
|
||||
await refreshStatus()
|
||||
setLoading(false)
|
||||
}, [t, refreshStatus])
|
||||
|
||||
if (!IN_ELECTRON) return null
|
||||
|
||||
return (
|
||||
<div className="mt-4 space-y-6">
|
||||
<SettingSectionTitle title={t("cli.title")} />
|
||||
|
||||
<div className="space-y-4">
|
||||
<p className="text-sm text-text-secondary">{t("cli.description")}</p>
|
||||
|
||||
{status && (
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-sm font-medium">Status:</span>
|
||||
{status.installed ? (
|
||||
<span className="inline-flex items-center gap-1 rounded-full bg-green/10 px-2 py-0.5 text-xs text-green">
|
||||
<i className="i-mingcute-check-line" />
|
||||
{t("cli.installed")}
|
||||
</span>
|
||||
) : (
|
||||
<span className="inline-flex items-center gap-1 rounded-full bg-zinc-500/10 px-2 py-0.5 text-xs text-zinc-500">
|
||||
{t("cli.not_installed")}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{status.installed && status.installPath && (
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-sm font-medium">{t("cli.path")}:</span>
|
||||
<code className="rounded bg-fill-quaternary px-2 py-0.5 text-xs">
|
||||
{status.installPath}
|
||||
</code>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!status.cliSourceAvailable && (
|
||||
<p className="text-sm text-orange-500">{t("cli.not_available")}</p>
|
||||
)}
|
||||
|
||||
<div className="flex gap-2">
|
||||
{!status.installed ? (
|
||||
<Button
|
||||
onClick={handleInstall}
|
||||
disabled={loading || !status.cliSourceAvailable}
|
||||
isLoading={loading}
|
||||
>
|
||||
{t("cli.install")}
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={handleUninstall}
|
||||
disabled={loading}
|
||||
isLoading={loading}
|
||||
>
|
||||
{t("cli.uninstall")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { IN_ELECTRON } from "@follow/shared/constants"
|
||||
|
||||
import { SettingCli } from "~/modules/settings/tabs/cli"
|
||||
import { SettingsTitle } from "~/modules/settings/title"
|
||||
import { defineSettingPageData } from "~/modules/settings/utils"
|
||||
|
||||
const iconName = "i-mgc-terminal-cute-re"
|
||||
const priority = (1000 << 1) + 25
|
||||
|
||||
export const loader = defineSettingPageData({
|
||||
icon: iconName,
|
||||
name: "titles.cli",
|
||||
priority,
|
||||
hideIf: () => !IN_ELECTRON,
|
||||
})
|
||||
|
||||
export function Component() {
|
||||
return (
|
||||
<>
|
||||
<SettingsTitle />
|
||||
<SettingCli />
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -13,12 +13,12 @@
|
||||
"main": "./dist/main/index.js",
|
||||
"scripts": {
|
||||
"analyze:web": "cross-env analyzer=1 WEB_BUILD=1 vite build",
|
||||
"build:electron": "electron-vite build && electron-forge make",
|
||||
"build:electron": "pnpm run build:electron-vite && electron-forge make",
|
||||
"build:electron-forge": "electron-forge make",
|
||||
"build:electron-forge:macos": "electron-forge make --arch=x64 --platform=darwin && electron-forge make --arch=arm64 --platform=darwin && tsx scripts/merge-yml.ts",
|
||||
"build:electron-forge:mas": "electron-forge make --arch=universal --platform=mas",
|
||||
"build:electron-forge:ms": "tsx scripts/generate-appx-manifest.ts && electron-forge make --platform=win32 --ms=true",
|
||||
"build:electron-vite": "electron-vite build",
|
||||
"build:electron-vite": "pnpm run prepare:cli && electron-vite build",
|
||||
"build:render": "vite build -c vite.config.electron-render.ts",
|
||||
"build:web": "rm -rf out/web && cross-env WEB_BUILD=1 vite build",
|
||||
"bump": "vv --minor",
|
||||
@@ -30,6 +30,7 @@
|
||||
"dev:server": "pnpm run --filter=ssr dev",
|
||||
"dev:web": "cross-env WEB_BUILD=1 vite",
|
||||
"hotfix": "vv -c bump.hotfix.config.js --patch",
|
||||
"prepare:cli": "tsx scripts/prepare-cli.ts",
|
||||
"publish": "electron-vite build && electron-forge publish",
|
||||
"start": "electron-vite preview",
|
||||
"update:main-hash": "tsx plugins/vite/generate-main-hash.ts"
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { execSync } from "node:child_process"
|
||||
import { cpSync, existsSync, mkdirSync } from "node:fs"
|
||||
|
||||
import { resolve } from "pathe"
|
||||
|
||||
const rootDir = resolve(import.meta.dirname, "../../..")
|
||||
const cliDistDir = resolve(rootDir, "apps/cli/dist")
|
||||
const targetDir = resolve(rootDir, "apps/desktop/resources/cli")
|
||||
|
||||
// Build CLI
|
||||
console.info("Building CLI...")
|
||||
execSync("pnpm --filter @follow/cli build", {
|
||||
cwd: rootDir,
|
||||
stdio: "inherit",
|
||||
})
|
||||
|
||||
// Ensure CLI was built
|
||||
const cliEntry = resolve(cliDistDir, "index.js")
|
||||
if (!existsSync(cliEntry)) {
|
||||
throw new Error(`CLI build output not found at ${cliEntry}`)
|
||||
}
|
||||
|
||||
// Copy to desktop resources
|
||||
mkdirSync(targetDir, { recursive: true })
|
||||
cpSync(cliEntry, resolve(targetDir, "index.js"))
|
||||
|
||||
console.info("CLI prepared at", targetDir)
|
||||
@@ -214,6 +214,18 @@
|
||||
"appearance.use_pointer_cursor.description": "When the mouse hovers over any interactive element, the cursor appears as a hand.",
|
||||
"appearance.use_pointer_cursor.label": "Use Hand Cursor",
|
||||
"appearance.words.customize": "Customize",
|
||||
"cli.description": "Install the Folo CLI to manage your subscriptions and entries from the terminal. The CLI shares your desktop app login session automatically.",
|
||||
"cli.install": "Install CLI",
|
||||
"cli.install_failed": "Failed to install CLI",
|
||||
"cli.install_success": "CLI installed successfully",
|
||||
"cli.installed": "Installed",
|
||||
"cli.not_available": "CLI bundle is not available in this build",
|
||||
"cli.not_installed": "Not installed",
|
||||
"cli.path": "Install path",
|
||||
"cli.title": "Folo CLI",
|
||||
"cli.uninstall": "Uninstall CLI",
|
||||
"cli.uninstall_failed": "Failed to uninstall CLI",
|
||||
"cli.uninstall_success": "CLI uninstalled successfully",
|
||||
"common.give_star": "<HeartIcon />Love our product? <Link>Give us a star on GitHub!</Link>",
|
||||
"control.paid_badge.basic_or_higher": "This feature requires a Basic plan or higher to use",
|
||||
"control.paid_badge.free_limited": "This feature is limited for free plan",
|
||||
@@ -727,6 +739,7 @@
|
||||
"titles.actions": "Actions",
|
||||
"titles.ai": "AI",
|
||||
"titles.appearance": "Appearance",
|
||||
"titles.cli": "CLI",
|
||||
"titles.data_control": "Data Control",
|
||||
"titles.feeds": "Feeds",
|
||||
"titles.general": "General",
|
||||
|
||||
@@ -214,6 +214,18 @@
|
||||
"appearance.use_pointer_cursor.description": "Lorsque la souris survole un élément interactif, le curseur apparaît comme une main.",
|
||||
"appearance.use_pointer_cursor.label": "Utiliser le curseur main",
|
||||
"appearance.words.customize": "Personnaliser",
|
||||
"cli.description": "Installez Folo CLI pour gérer vos abonnements et entrées depuis le terminal. Le CLI partage automatiquement la session de connexion de l'application de bureau.",
|
||||
"cli.install": "Installer CLI",
|
||||
"cli.install_failed": "Échec de l'installation du CLI",
|
||||
"cli.install_success": "CLI installé avec succès",
|
||||
"cli.installed": "Installé",
|
||||
"cli.not_available": "Le CLI n'est pas disponible dans cette version",
|
||||
"cli.not_installed": "Non installé",
|
||||
"cli.path": "Chemin d'installation",
|
||||
"cli.title": "Folo CLI",
|
||||
"cli.uninstall": "Désinstaller CLI",
|
||||
"cli.uninstall_failed": "Échec de la désinstallation du CLI",
|
||||
"cli.uninstall_success": "CLI désinstallé avec succès",
|
||||
"common.give_star": "<HeartIcon />Vous aimez notre produit ? <Link>Donnez-nous une étoile sur GitHub !</Link>",
|
||||
"control.paid_badge.basic_or_higher": "Cette fonctionnalité nécessite un plan Basique ou supérieur",
|
||||
"control.paid_badge.free_limited": "Cette fonctionnalité est limitée pour le plan gratuit",
|
||||
@@ -727,6 +739,7 @@
|
||||
"titles.actions": "Actions",
|
||||
"titles.ai": "IA",
|
||||
"titles.appearance": "Apparence",
|
||||
"titles.cli": "CLI",
|
||||
"titles.data_control": "Contrôle des données",
|
||||
"titles.feeds": "Flux",
|
||||
"titles.general": "Général",
|
||||
|
||||
@@ -214,6 +214,18 @@
|
||||
"appearance.use_pointer_cursor.description": "マウスがインタラクティブな要素の上にあるとき、カーソルは手の形になります。",
|
||||
"appearance.use_pointer_cursor.label": "手の形のカーソルを使用する",
|
||||
"appearance.words.customize": "カスタマイズ",
|
||||
"cli.description": "Folo CLI をインストールして、ターミナルからサブスクリプションやエントリーを管理できます。CLI はデスクトップアプリのログイン状態を自動的に共有します。",
|
||||
"cli.install": "CLI をインストール",
|
||||
"cli.install_failed": "CLI のインストールに失敗しました",
|
||||
"cli.install_success": "CLI のインストールに成功しました",
|
||||
"cli.installed": "インストール済み",
|
||||
"cli.not_available": "このビルドには CLI が含まれていません",
|
||||
"cli.not_installed": "未インストール",
|
||||
"cli.path": "インストールパス",
|
||||
"cli.title": "Folo CLI",
|
||||
"cli.uninstall": "CLI をアンインストール",
|
||||
"cli.uninstall_failed": "CLI のアンインストールに失敗しました",
|
||||
"cli.uninstall_success": "CLI のアンインストールに成功しました",
|
||||
"common.give_star": "<HeartIcon />私たちの製品が好きですか?<Link>GitHub で Star を付けましょう!</Link>",
|
||||
"control.paid_badge.basic_or_higher": "この機能を利用するには Basic プラン以上が必要です",
|
||||
"control.paid_badge.free_limited": "この機能は無料プランでは制限されています",
|
||||
@@ -727,6 +739,7 @@
|
||||
"titles.actions": "アクション",
|
||||
"titles.ai": "AI",
|
||||
"titles.appearance": "外観",
|
||||
"titles.cli": "CLI",
|
||||
"titles.data_control": "データコントロール",
|
||||
"titles.feeds": "フィード",
|
||||
"titles.general": "一般設定",
|
||||
|
||||
@@ -214,6 +214,18 @@
|
||||
"appearance.use_pointer_cursor.description": "当鼠标悬停在任何可交互元素上时,光标会显示为手型光标。",
|
||||
"appearance.use_pointer_cursor.label": "使用手型光标",
|
||||
"appearance.words.customize": "自定义",
|
||||
"cli.description": "安装 Folo CLI 以便从终端管理你的订阅和条目。CLI 会自动共享桌面应用的登录状态。",
|
||||
"cli.install": "安装 CLI",
|
||||
"cli.install_failed": "CLI 安装失败",
|
||||
"cli.install_success": "CLI 安装成功",
|
||||
"cli.installed": "已安装",
|
||||
"cli.not_available": "当前版本不包含 CLI",
|
||||
"cli.not_installed": "未安装",
|
||||
"cli.path": "安装路径",
|
||||
"cli.title": "Folo CLI",
|
||||
"cli.uninstall": "卸载 CLI",
|
||||
"cli.uninstall_failed": "CLI 卸载失败",
|
||||
"cli.uninstall_success": "CLI 卸载成功",
|
||||
"common.give_star": "<HeartIcon />喜欢我们的产品吗? <Link>在 GitHub 上给我们「Star」吧!</Link>",
|
||||
"control.paid_badge.basic_or_higher": "此功能需要 Basic 计划或更高级别才能使用",
|
||||
"control.paid_badge.free_limited": "此功能在免费计划中有限制",
|
||||
@@ -727,6 +739,7 @@
|
||||
"titles.actions": "自动化",
|
||||
"titles.ai": "AI",
|
||||
"titles.appearance": "外观",
|
||||
"titles.cli": "CLI",
|
||||
"titles.data_control": "数据控制",
|
||||
"titles.feeds": "订阅源",
|
||||
"titles.general": "通用",
|
||||
|
||||
@@ -214,6 +214,18 @@
|
||||
"appearance.use_pointer_cursor.description": "當滑鼠懸停在任何互動元素上時,遊標會顯示為手型遊標。",
|
||||
"appearance.use_pointer_cursor.label": "使用手指遊標",
|
||||
"appearance.words.customize": "自訂",
|
||||
"cli.description": "安裝 Folo CLI 以便從終端機管理你的訂閱和條目。CLI 會自動共享桌面應用的登入狀態。",
|
||||
"cli.install": "安裝 CLI",
|
||||
"cli.install_failed": "CLI 安裝失敗",
|
||||
"cli.install_success": "CLI 安裝成功",
|
||||
"cli.installed": "已安裝",
|
||||
"cli.not_available": "目前版本不包含 CLI",
|
||||
"cli.not_installed": "未安裝",
|
||||
"cli.path": "安裝路徑",
|
||||
"cli.title": "Folo CLI",
|
||||
"cli.uninstall": "解除安裝 CLI",
|
||||
"cli.uninstall_failed": "CLI 解除安裝失敗",
|
||||
"cli.uninstall_success": "CLI 解除安裝成功",
|
||||
"common.give_star": "<HeartIcon />喜歡我們的產品嗎? <Link>在 GitHub 上給我們 Star 吧!</Link>",
|
||||
"control.paid_badge.basic_or_higher": "此功能需要 Basic 方案或更高級別才能使用",
|
||||
"control.paid_badge.free_limited": "此功能在免費方案中受限",
|
||||
@@ -727,6 +739,7 @@
|
||||
"titles.actions": "自動化操作",
|
||||
"titles.ai": "AI",
|
||||
"titles.appearance": "外觀",
|
||||
"titles.cli": "CLI",
|
||||
"titles.data_control": "資料管理",
|
||||
"titles.feeds": "RSS 摘要",
|
||||
"titles.general": "一般",
|
||||
|
||||
Reference in New Issue
Block a user