Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: #1459, #1495, onboarding showing up again, check in dev ran bun run build before publish, bump search and rewind version new release

Louis Beaumont35e7bf6be426
diff --git a/pipes/rewind/package.json b/pipes/rewind/package.json
index 15dfa9eee..4a5bcfe86 100644
--- a/pipes/rewind/package.json
+++ b/pipes/rewind/package.json
@@ -1,6 +1,6 @@
{
"name": "rewind",
- "version": "0.1.11",
+ "version": "0.1.12",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
diff --git a/pipes/search/package.json b/pipes/search/package.json
index 9dc7794e6..69faa8a52 100644
--- a/pipes/search/package.json
+++ b/pipes/search/package.json
@@ -1,6 +1,6 @@
{
"name": "search",
- "version": "0.1.17",
+ "version": "0.1.18",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
diff --git a/screenpipe-app-tauri/app/providers.tsx b/screenpipe-app-tauri/app/providers.tsx
index 1954cbe49..7153c1188 100644
--- a/screenpipe-app-tauri/app/providers.tsx
+++ b/screenpipe-app-tauri/app/providers.tsx
@@ -3,7 +3,6 @@
import posthog from "posthog-js";
import { PostHogProvider } from "posthog-js/react";
import { useEffect } from "react";
-import { OnboardingProvider } from "@/lib/hooks/use-onboarding";
import { ChangelogDialogProvider } from "@/lib/hooks/use-changelog-dialog";
import { forwardRef } from "react";
import { store as SettingsStore, useSettings } from "@/lib/hooks/use-settings";
@@ -28,11 +27,9 @@ export const Providers = forwardRef<
return (
<SettingsStore.Provider>
<ProfilesStore.Provider>
- <OnboardingProvider>
- <ChangelogDialogProvider>
- <PostHogProvider client={posthog}>{children}</PostHogProvider>
- </ChangelogDialogProvider>
- </OnboardingProvider>
+ <ChangelogDialogProvider>
+ <PostHogProvider client={posthog}>{children}</PostHogProvider>
+ </ChangelogDialogProvider>
</ProfilesStore.Provider>
</SettingsStore.Provider>
);
diff --git a/screenpipe-app-tauri/components/onboarding.tsx b/screenpipe-app-tauri/components/onboarding.tsx
index f95201f85..82ca2096b 100644
--- a/screenpipe-app-tauri/components/onboarding.tsx
+++ b/screenpipe-app-tauri/components/onboarding.tsx
@@ -266,8 +266,6 @@ const Onboarding: React.FC = () => {
});
setShowOnboarding(false);
- localforage.setItem("showOnboarding", false);
-
};
return (
diff --git a/screenpipe-app-tauri/lib/hooks/use-onboarding.tsx b/screenpipe-app-tauri/lib/hooks/use-onboarding.tsx
index d289782c3..bf051c55b 100644
--- a/screenpipe-app-tauri/lib/hooks/use-onboarding.tsx
+++ b/screenpipe-app-tauri/lib/hooks/use-onboarding.tsx
@@ -1,46 +1,59 @@
-import React, { createContext, useState, useContext, useEffect } from "react";
import { useSettings } from "./use-settings";
import localforage from "localforage";
+import { create } from "zustand";
+import { useEffect } from "react";
-interface OnboardingContextType {
+// Define the store state type
+interface OnboardingState {
showOnboarding: boolean;
setShowOnboarding: (show: boolean) => void;
+ initialized: boolean;
}
-const OnboardingContext = createContext<OnboardingContextType | undefined>(
- undefined
-);
+// Create the Zustand store
+export const useOnboardingStore = create<OnboardingState>((set) => ({
+ showOnboarding: false,
+ initialized: false,
+ setShowOnboarding: (show: boolean) => {
+ set({ showOnboarding: show });
+ localforage.setItem("showOnboarding", show);
+ },
+}));
-export const OnboardingProvider: React.FC<{ children: React.ReactNode }> = ({
- children,
-}) => {
- const [showOnboarding, setShowOnboarding] = useState(false);
+// Initialize the store with persisted data
+const initializeOnboarding = async () => {
+ // Only initialize once
+ if (useOnboardingStore.getState().initialized) {
+ return;
+ }
+
+ const persistedValue = await localforage.getItem("showOnboarding");
+
+ if (persistedValue === null || persistedValue === undefined) {
+ // First time user, show onboarding
+ useOnboardingStore.setState({
+ showOnboarding: true,
+ initialized: true,
+ });
+ } else {
+ // Returning user, respect the stored value
+ useOnboardingStore.setState({
+ showOnboarding: persistedValue === true,
+ initialized: true,
+ });
+ }
+};
+
+// Custom hook that combines store with initialization logic
+export const useOnboarding = () => {
+ const { showOnboarding, setShowOnboarding } = useOnboardingStore();
const { settings } = useSettings();
+
useEffect(() => {
- const checkFirstTimeUser = async () => {
- // settings unreliable here ... race condition
- const showOnboarding = await localforage.getItem("showOnboarding");
- if (showOnboarding === null || showOnboarding === undefined || showOnboarding === true) {
- setShowOnboarding(true);
- localforage.setItem("showOnboarding", false);
- }
- };
- checkFirstTimeUser();
+ initializeOnboarding();
}, [settings]);
- useEffect(() => {
- localforage.setItem("showOnboarding", showOnboarding);
- }, [showOnboarding]);
- return (
- <OnboardingContext.Provider value={{ showOnboarding, setShowOnboarding }}>
- {children}
- </OnboardingContext.Provider>
- );
-};
-export const useOnboarding = () => {
- const context = useContext(OnboardingContext);
- if (context === undefined) {
- throw new Error("useOnboarding must be used within an OnboardingProvider");
- }
- return context;
+ return { showOnboarding, setShowOnboarding };
};
+
+// No longer need the OnboardingProvider component
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index 4712aecc3..8c577c8d5 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -5289,7 +5289,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "0.38.0"
+version = "0.38.3"
dependencies = [
"anyhow",
"async-stream",
diff --git a/screenpipe-js/cli/dist/index.js b/screenpipe-js/cli/dist/index.js
index 863ac5e57..0653e47ca 100755
--- a/screenpipe-js/cli/dist/index.js
+++ b/screenpipe-js/cli/dist/index.js
@@ -58123,6 +58123,7 @@ import path2 from "path";
var import_archiver = __toESM(require_archiver(), 1);
var import_ignore = __toESM(require_ignore2(), 1);
import crypto2 from "crypto";
+import { execSync } from "child_process";
var NEXTJS_FILES = {
required: ["package.json", ".next"],
optional: [
@@ -58178,7 +58179,37 @@ async function retryFetch(url2, options, maxRetries = 3, baseDelay = 1000) {
}
throw new Error("Retry failed");
}
-var publishCommand = new Command("publish").description("publish or update a pipe to the store").requiredOption("-n, --name <name>", "name of the pipe").option("-v, --verbose", "enable verbose logging", false).action(async (opts) => {
+function isProjectBuilt() {
+ if (fs3.existsSync("next.config.js") || fs3.existsSync("next.config.mjs") || fs3.existsSync("next.config.ts")) {
+ return fs3.existsSync(".next") && fs3.existsSync(".next/server");
+ }
+ return fs3.existsSync("dist") || fs3.existsSync("build") || fs3.existsSync("out");
+}
+function runBuildCommand() {
+ logger.info(colors8.info(`
+${symbols.info} Project needs to be built. Running build command...`));
+ try {
+ const packageJson = JSON.parse(fs3.readFileSync("package.json", "utf-8"));
+ if (packageJson.scripts && packageJson.scripts.build) {
+ try {
+ logger.log(colors8.dim(`${symbols.arrow} Executing: bun run build`));
+ execSync("bun run build", { stdio: "inherit" });
+ } catch (error) {
+ logger.log(colors8.dim(`${symbols.arrow} Bun not available, trying npm instead`));
+ execSync("npm run build", { stdio: "inherit" });
+ }
+ logger.success(`${symbols.success} Build completed successfully`);
+ } else {
+ throw new Error("No build script found in package.json");
+ }
+ } catch (error) {
+ if (error instanceof Error) {
+ throw new Error(`Failed to build project: ${error.message}`);
+ }
+ throw new Error("Failed to build project");
+ }
+}
+var publishCommand = new Command("publish").description("publish or update a pipe to the store").requiredOption("-n, --name <name>", "name of the pipe").option("-v, --verbose", "enable verbose logging", false).option("--skip-build-check", "skip checking if the project has been built", false).option("--build", "automatically run the build command if needed", false).action(async (opts) => {
try {
if (opts.verbose) {
console.log(colors8.dim(`${symbols.arrow} starting publish command...`));
@@ -58254,8 +58285,16 @@ ${symbols.info} publishing ${colors8.highlight(packageJson.name)} v${packageJson
if (opts.verbose) {
console.log(colors8.dim(`${symbols.arrow} calculating file hash...`));
}
+ if (!opts.skipBuildCheck && !isProjectBuilt()) {
+ if (opts.build) {
+ runBuildCommand();
+ } else {
+ console.error(colors8.error(`${symbols.error} Project has not been built. Run ${colors8.highlight("bun run build")} or ${colors8.highlight("npm run build")} first, or use ${colors8.highlight("--build")} flag to build automatically.`));
+ process.exit(1);
+ }
+ }
try {
- console.log(colors8.dim(`${symbols.arrow} Getting upload URL...`));
+ console.log(colors8.dim(`${symbols.arrow} getting upload URL...`));
const urlResponse = await fetch(`${API_BASE_URL}/api/plugins/publish`, {
method: "POST",
headers: {
diff --git a/screenpipe-js/cli/package.json b/screenpipe-js/cli/package.json
index 2ba89d68a..332666766 100644
--- a/screenpipe-js/cli/package.json
+++ b/screenpipe-js/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@screenpipe/dev",
- "version": "1.1.14",
+ "version": "1.1.15",
"description": "screenpipe development CLI",
"type": "module",
"main": "dist/index.js",
diff --git a/screenpipe-js/cli/src/commands/pipe/publish.ts b/screenpipe-js/cli/src/commands/pipe/publish.ts
index dd3119449..b55677b68 100644
--- a/screenpipe-js/cli/src/commands/pipe/publish.ts
+++ b/screenpipe-js/cli/src/commands/pipe/publish.ts
@@ -8,6 +8,7 @@ import ignore from "ignore";
import { colors, symbols } from "../../utils/colors";
import { Command } from "commander";
import { logger } from "../components/commands/add/utils/logger";
+import { execSync } from "child_process";
interface ProjectFiles {
required: string[];
@@ -97,10 +98,67 @@ async function retryFetch(
throw new Error("Retry failed"); // Fallback error
}
-export const publishCommand = new Command('publish')
- .description('publish or update a pipe to the store')
- .requiredOption('-n, --name <name>', 'name of the pipe')
- .option('-v, --verbose', 'enable verbose logging', false)
+function isProjectBuilt(): boolean {
+ // For Next.js projects
+ if (
+ fs.existsSync("next.config.js") ||
+ fs.existsSync("next.config.mjs") ||
+ fs.existsSync("next.config.ts")
+ ) {
+ return fs.existsSync(".next") && fs.existsSync(".next/server");
+ }
+
+ // For other projects - check common build directories
+ return (
+ fs.existsSync("dist") || fs.existsSync("build") || fs.existsSync("out")
+ );
+}
+
+function runBuildCommand(): void {
+ logger.info(
+ colors.info(
+ `\n${symbols.info} Project needs to be built. Running build command...`
+ )
+ );
+
+ try {
+ // Check if package.json has a build script
+ const packageJson = JSON.parse(fs.readFileSync("package.json", "utf-8"));
+
+ if (packageJson.scripts && packageJson.scripts.build) {
+ // Try bun first, fall back to npm
+ try {
+ logger.log(colors.dim(`${symbols.arrow} Executing: bun run build`));
+ execSync("bun run build", { stdio: "inherit" });
+ } catch (error) {
+ logger.log(
+ colors.dim(`${symbols.arrow} Bun not available, trying npm instead`)
+ );
+ execSync("npm run build", { stdio: "inherit" });
+ }
+
+ logger.success(`${symbols.success} Build completed successfully`);
+ } else {
+ throw new Error("No build script found in package.json");
+ }
+ } catch (error) {
+ if (error instanceof Error) {
+ throw new Error(`Failed to build project: ${error.message}`);
+ }
+ throw new Error("Failed to build project");
+ }
+}
+
+export const publishCommand = new Command("publish")
+ .description("publish or update a pipe to the store")
+ .requiredOption("-n, --name <name>", "name of the pipe")
+ .option("-v, --verbose", "enable verbose logging", false)
+ .option(
+ "--skip-build-check",
+ "skip checking if the project has been built",
+ false
+ )
+ .option("--build", "automatically run the build command if needed", false)
.action(async (opts) => {
try {
if (opts.verbose) {
@@ -246,10 +304,33 @@ export const publishCommand = new Command('publish')
console.log(colors.dim(`${symbols.arrow} calculating file hash...`));
}
+ // Check if project is built (unless explicitly skipped)
+ if (!opts.skipBuildCheck && !isProjectBuilt()) {
+ if (opts.build) {
+ // Run build if --build flag is provided
+ runBuildCommand();
+ } else {
+ console.error(
+ colors.error(
+ `${
+ symbols.error
+ } Project has not been built. Run ${colors.highlight(
+ "bun run build"
+ )} or ${colors.highlight(
+ "npm run build"
+ )} first, or use ${colors.highlight(
+ "--build"
+ )} flag to build automatically.`
+ )
+ );
+ process.exit(1);
+ }
+ }
+
// Replace the upload section with this:
try {
// First get the signed URL
- console.log(colors.dim(`${symbols.arrow} Getting upload URL...`));
+ console.log(colors.dim(`${symbols.arrow} getting upload URL...`));
const urlResponse = await fetch(`${API_BASE_URL}/api/plugins/publish`, {
method: "POST",
@@ -318,8 +399,8 @@ export const publishCommand = new Command('publish')
const data = await finalizeResponse.json();
// Success messages
- logger.success(`\n${symbols.success} successfully published plugin!`)
-
+ logger.success(`\n${symbols.success} successfully published plugin!`);
+
console.log(
colors.listItem(`${colors.label("name")} ${packageJson.name}`)
);
@@ -377,4 +458,4 @@ export const publishCommand = new Command('publish')
}
process.exit(1);
}
- })
+ });