Repository navigation
refactor(app): share session state, screen and transcript reading in packages/core #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pumfleet
wants to merge
5
commits into
main
Choose a base branch
from
feat/core-package
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
63e510c
refactor(app): share session state, screen and transcript reading in …
pumfleet c1ec5e0
feat(mobile): add Shipyard for iPhone
pumfleet 96f6cf7
fix(mobile): keep the app starting when notifications or the keychain…
pumfleet 749ce02
feat(app): list the phones that get notifications in Settings → Phone
pumfleet 30ce5fa
Merge pull request #209 from cosscom/feat/ios-app
sean-brydon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { expect, mockOnly, test } from "./fixtures"; | ||
|
|
||
| // Settings › Phone › Phone apps: the Shipyard phone apps a box notifies | ||
| // through the push relay, and removing one. | ||
|
|
||
| test("a phone that gets notifications is listed with its box, and Remove stops them", async ({ app }) => { | ||
| mockOnly("turning phone access on writes to a box"); | ||
| await app.open(); | ||
| const phone = await app.openSettings("phone"); | ||
| const apps = phone.locator("section").filter({ has: app.page.getByRole("heading", { name: "Phone apps", exact: true }) }); | ||
| await expect(apps).toContainText("No phone gets notifications yet"); | ||
|
|
||
| await phone.getByRole("switch", { name: "Phone access on devl" }).click(); | ||
| await expect(apps).toContainText("Acme iPhone"); | ||
| await expect(apps).toContainText("devl · needs you"); | ||
|
|
||
| await apps.getByRole("button", { name: "Remove" }).click(); | ||
| await expect(apps).toContainText("No phone gets notifications yet"); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // Fails when packages/core reaches past itself: an import of a package, an | ||
| // alias (@/lib/…), a path without its .ts extension, or the DOM. | ||
| // | ||
| // The desktop app (Vite), the phone app (Metro) and node's test runner all | ||
| // load packages/core's files as they are, so each may import only its | ||
| // neighbours by a relative path with .ts, plus types from the plugin SDK. | ||
| // tsc -p ../packages/core (in check:core, after this) checks the rest: | ||
| // that lib has no DOM. | ||
| // | ||
| // node scripts/check-core.mjs | ||
| import { readdir, readFile } from "node:fs/promises"; | ||
| import { join, relative, resolve } from "node:path"; | ||
|
|
||
| const app = resolve(import.meta.dirname, ".."); | ||
| const core = resolve(app, "..", "packages", "core", "src"); | ||
| const SDK = "../../plugin-sdk/src/types.ts"; | ||
|
|
||
| const problems = []; | ||
| for (const name of (await readdir(core, { recursive: true })).filter((n) => n.endsWith(".ts"))) { | ||
| const file = join(core, name); | ||
| const test = name.endsWith(".test.ts"); | ||
| const src = await readFile(file, "utf8"); | ||
| for (const m of src.matchAll(/^\s*(import|export)\s+(type\s+)?[^;]*?\sfrom\s+"([^"]+)"/gms)) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Prompt for AI agents |
||
| const [, , type, spec] = m; | ||
| const line = src.slice(0, m.index).split("\n").length + (m[0].match(/^\s*/)[0].split("\n").length - 1); | ||
| const where = `${relative(resolve(app, ".."), file)}:${line}`; | ||
| if (test && spec.startsWith("node:")) continue; | ||
| if (spec === SDK) { | ||
| if (!type) problems.push(`${where}: import only types from the plugin SDK (import type …)`); | ||
| continue; | ||
| } | ||
| if (!spec.startsWith("./")) problems.push(`${where}: "${spec}" is outside packages/core; import a neighbour by ./name.ts`); | ||
| else if (!spec.endsWith(".ts")) problems.push(`${where}: "${spec}" needs its .ts extension`); | ||
| } | ||
| } | ||
|
|
||
| if (problems.length) { | ||
| console.error(`packages/core may only import its own files (./x.ts) and the plugin SDK's types:\n\n${problems.join("\n")}`); | ||
| process.exit(1); | ||
| } | ||
| console.log("check:core: packages/core imports only itself"); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: The
<name>.tsre-export rule doesn't match the code.conversationandpairinghave noapp/src/lib/<name>.tsshim, andstateis exposed asstate-model.ts. Name the exceptions or say that the shims exist only for some modules.Prompt for AI agents