π¬ A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots π
TypeScript browser-extensionchrome-extensiondocumentationfirefox-extensionguide-generatorlocal-firstmanifest-v3privacy-firstproductivityreactscreenshotstep-by-step-guidetutorialtypescriptworkflowwxt
fix(extension): number a new step from the steps that exist, so a deleted one leaves no gap
Luis Ortiz02a50e7018d3
diff --git a/src/entrypoints/background/step-pipeline.ts b/src/entrypoints/background/step-pipeline.tsindex 1854b0c..3a37bf4 100644--- a/src/entrypoints/background/step-pipeline.ts+++ b/src/entrypoints/background/step-pipeline.ts@@ -9,6 +9,7 @@ import {clearStepAiPending,createStep,getStep,+ getStepsForGuide,saveScreenshot,updateStepCapture,updateStepDescription,@@ -59,6 +60,14 @@ function isRecordingOrPaused(): boolean {return getActor().getSnapshot().value !== CaptureState.IDLE;}+let stepWrites: Promise<unknown> = Promise.resolve();++function writeInOrder(write: () => Promise<void>): Promise<void> {+ const next = stepWrites.then(write, write);+ stepWrites = next.catch(() => undefined);+ return next;+}+async function tryAIDescription(stepId: string, domContext: DOMContext) {if (!resolveAiCredentials(await localStorage.get([...AI_CREDENTIAL_SETTINGS]))) return;try {@@ -73,7 +82,6 @@ export async function handleCaptureStep(data: CaptureStepData): Promise<CaptureSconst snap = getActor().getSnapshot();if (snap.value !== CaptureState.RECORDING) return { ignored: true };- const stepIndex = snap.context.stepCount;getActor().send({ type: 'USER_ACTION' });const guideId = snap.context.currentGuideId!;@@ -91,20 +99,22 @@ export async function handleCaptureStep(data: CaptureStepData): Promise<CaptureS});const timestamp = Date.now();- await createStep({- id: stepId,- guideId,- index: stepIndex,- description: buildFallbackDescription(data.action, data.elementMeta),- action: data.action,- url: snap.context.currentUrl,- timestamp,- screenshotId,- elementMeta: data.elementMeta,- descriptionSource: 'heuristic',- aiPending: willUseAI || narrationCapturing,+ await writeInOrder(async () => {+ await createStep({+ id: stepId,+ guideId,+ index: (await getStepsForGuide(guideId)).length,+ description: buildFallbackDescription(data.action, data.elementMeta),+ action: data.action,+ url: snap.context.currentUrl,+ timestamp,+ screenshotId,+ elementMeta: data.elementMeta,+ descriptionSource: 'heuristic',+ aiPending: willUseAI || narrationCapturing,+ });+ await addStepToGuide(guideId, stepId);});- await addStepToGuide(guideId, stepId);const domContext = data.domContext;if (data.action !== 'input' && domContext) {