Research-Stack/5-Applications/plugins/debug/debug_edit_flow.py
allaun 475f6319ea chore(repo): push local 768-commit branch state onto clean remote baseline
This squashes all local history (768 commits) onto the scrubbed PR #90
baseline. Individual commits were lost during filter-repo corruption;
the working tree content is preserved intact.

Build: N/A (working tree state only)
2026-06-15 22:46:50 -05:00

104 lines
4.2 KiB
Python

import os
import sqlite3
import shutil
import asyncio
from playwright.async_api import async_playwright
def get_tokens():
db_path = "/run/user/1000/psd/allaun-firefox-tobv72sv.default-release/storage/default/https+++contextstream.io/ls/data.sqlite"
temp_db = "/home/allaun/.gemini/antigravity/scratch/ls_temp.sqlite"
shutil.copy(db_path, temp_db)
conn = sqlite3.connect(temp_db)
cursor = conn.cursor()
cursor.execute("SELECT key, value FROM data WHERE key IN ('auth_token', 'refresh_token');")
tokens = {}
for key, val in cursor.fetchall():
tokens[key] = val.decode('utf-8', errors='ignore')
conn.close()
return tokens
async def main():
tokens = get_tokens()
auth_token = tokens.get("auth_token")
refresh_token = tokens.get("refresh_token")
async with async_playwright() as p:
browser = await p.chromium.launch(headless=True)
context = await browser.new_context()
page = await context.new_page()
await page.goto("https://contextstream.io")
await page.wait_for_timeout(2000)
await page.evaluate("""([auth, refresh]) => {
localStorage.setItem('auth_token', auth);
localStorage.setItem('refresh_token', refresh);
}""", [auth_token, refresh_token])
await page.goto("https://contextstream.io/dashboard?stage=skills")
await page.wait_for_timeout(4000)
# Click the "Explorer" button to open the sidebar
print("Opening sidebar...")
await page.locator("button:has-text('Explorer')").first.click()
await page.wait_for_timeout(2000)
# Click the project combobox trigger (text='llm_wiki')
print("Clicking project trigger...")
await page.locator("button[role='combobox']:has-text('llm_wiki')").first.click()
await page.wait_for_timeout(2000)
print("Selecting 'Research-Stack' project...")
await page.locator("[role='option']:has-text('Research-Stack')").first.click()
await page.wait_for_timeout(4000)
# Click the "Skills" tab to load the skills dashboard
print("Clicking the 'Skills' tab...")
await page.locator("button:has-text('Skills')").first.click()
await page.wait_for_timeout(3000)
# Select "Workspace" filter on the Skills dashboard
print("Selecting 'Workspace' filter...")
await page.locator("button[role='combobox']:has-text('Account')").first.click()
await page.wait_for_timeout(1000)
await page.locator("[role='option']:has-text('Workspace'), [role='menuitem']:has-text('Workspace')").first.click()
await page.wait_for_timeout(3000)
title = "Lean Proof Skill"
print(f"Clicking skill '{title}'...")
await page.locator(f"text={title}").first.click()
await page.wait_for_timeout(3000)
print(f"URL on edit: {page.url}")
screenshot_path1 = "/home/allaun/.gemini/antigravity/scratch/edit_modal_open.png"
await page.screenshot(path=screenshot_path1)
print(f"Screenshot saved to {screenshot_path1}")
# Select "This project only" (which will be Research-Stack)
print("Selecting 'This project only' scope...")
await page.locator("text=This project only").first.click()
await page.wait_for_timeout(500)
# Click Save/Update button
print("Clicking save changes button...")
save_btn = page.locator("button:has-text('Save changes'), button:has-text('Save'), button:has-text('Update')").first
await save_btn.click()
# Let's wait and see where it goes
await page.wait_for_timeout(5000)
print(f"URL after save: {page.url}")
# Print first 500 chars of page text to see what page it loaded
text = await page.evaluate("() => document.body.innerText")
print("\nPage text content after save:")
print(text[:1000])
screenshot_path2 = "/home/allaun/.gemini/antigravity/scratch/after_save.png"
await page.screenshot(path=screenshot_path2)
print(f"Screenshot saved to {screenshot_path2}")
await browser.close()
if __name__ == "__main__":
asyncio.run(main())