@adelin-io/cli 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,8 @@ export const PENDING = '.adelin-workspace.pending.json';
9
9
  export const SAVE_PENDING = '.adelin-save.pending.json';
10
10
  export const SAVE_REQUEST = '.adelin-save.request.json';
11
11
  export const SAVE_OUTCOME = '.adelin-save.outcome.json';
12
+ /** Hashes of the images this workspace saved from its root `assets/` folder. */
13
+ export const ASSET_STATE = '.adelin-assets.json';
12
14
  export const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
13
15
  const NAME = '[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*';
14
16
  /** A translation catalog: `locales/<tag>.ts` with a BCP 47 language tag such as `en`, `pt-BR` or `zh-Hant-TW`. */
@@ -93,7 +95,7 @@ export function assertNoSymlinkAncestors(path) {
93
95
 
94
96
  export function assertSafeTarget(root, relativePath) {
95
97
  if (!SOURCE_PATH.test(relativePath) && !DECLARATION_PATH.test(relativePath) &&
96
- !['tsconfig.json', MANIFEST, PENDING, SAVE_PENDING, SAVE_REQUEST, SAVE_OUTCOME].includes(relativePath))
98
+ !['tsconfig.json', MANIFEST, PENDING, SAVE_PENDING, SAVE_REQUEST, SAVE_OUTCOME, ASSET_STATE].includes(relativePath))
97
99
  refuse('Unsafe checkout path.');
98
100
  const target = join(root, relativePath);
99
101
  assertNoSymlinkAncestors(target);
package/skill/SKILL.md CHANGED
@@ -51,7 +51,7 @@ These rules describe authored app code. Hosted HTML/CSS design artifacts follow
51
51
  5. **Every page is a stack screen.** Register each page as a `Stack.Screen` and reach it through
52
52
  navigation; never switch pages with state. See [app-structure.md](authoring/app-structure.md).
53
53
  6. **Every change must pass the platform's typecheck and build.** Treat its diagnostics as the
54
- source of truth, not memory.
54
+ source of truth, not memory. Passing is the entry bar, not proof the change works (rule 9).
55
55
  7. **Design from the builder's content.** Follow the Home composition in the
56
56
  [design guide](design/design-guide.md) and use the authoring guides for mechanics.
57
57
  8. **Use design guidance for every visual change.** The
@@ -61,6 +61,14 @@ These rules describe authored app code. Hosted HTML/CSS design artifacts follow
61
61
  another design skill is available, use one relevant source for ideas or critique, then apply
62
62
  its useful principles through this runtime's components and rules. Inspect the rendered
63
63
  result before calling a screen visually finished.
64
+ 9. **Done means seen working.** Before telling the builder a change is done, open every screen it
65
+ touches in the preview, including every screen that uses a changed shared component, at a
66
+ phone and a desktop or TV target, and look at the captured image. Tap through the changed
67
+ paths. A blank, black or failed capture is a failed check, not a pass: read `preview_logs`,
68
+ retry, and if it stays blank tell the builder which checks are still pending instead of saying
69
+ done. Look for leftovers too: tiles without artwork, taps that lead nowhere, dates or copy
70
+ carried over from a template or source site, and labels that do not fit the content. See
71
+ [visual review](design/visual-review.md#before-saying-done).
64
72
 
65
73
  ## Where to find what
66
74
 
@@ -75,7 +75,7 @@ for the file you are writing, using the table above.
75
75
 
76
76
  ## Storage limits
77
77
 
78
- If saving returns `ASSET_STORAGE_CAPACITY_EXCEEDED`, stop new uploads and explain that the
78
+ If saving returns `STORAGE_FULL`, stop new uploads and explain that the
79
79
  organization has reached its storage limit. The builder can free storage or choose a larger
80
80
  plan. Keep existing image references until the replacement has saved successfully.
81
81
 
@@ -90,7 +90,30 @@ version to bypass the hold, and do not report the change as saved until it is co
90
90
 
91
91
  ## Images from your own files
92
92
 
93
- When you work on a local copy of the app and the image is a file on disk:
93
+ With the local `adelin` MCP connection from the Adelin CLI, an image file in the
94
+ workspace's root `assets/` folder is saved by the next build:
95
+
96
+ 1. Copy the file to `assets/<name>`, using a valid asset name whose extension matches the
97
+ image type. Keep files in `assets/` itself, not in subfolders.
98
+ 2. Import it with the path from the table above, for example
99
+ `import wall from "../assets/sign-in-wall.jpg";` from `screens/SignIn.tsx`.
100
+ 3. Call `build_app`. Before it sends any source, it saves each image that the app does not
101
+ have yet, or that changed since this workspace saved it, and returns them under
102
+ `assets.saved`. `check_app` lists under `assets.pending` the images the next build will
103
+ save, and under `assets.problems` the files it would refuse.
104
+
105
+ The build replaces an image that this workspace saved earlier once its file changes. If
106
+ the app already has an image with that name that this workspace did not save, the build
107
+ refuses it with `ASSET_NAME_TAKEN`. Rename the file, or call
108
+ `build_app({replace_assets: ["<name>"]})` only when the builder asked to replace that
109
+ image. Deleting a local file never deletes the saved asset.
110
+
111
+ When the build refuses or fails to save an image, it returns `assets_not_saved` with the
112
+ problem for each file and sends no source; fix the files and build again. A build saves
113
+ at most 10 images and returns `assets_pending` when more are waiting; build again to save
114
+ the rest. A storage-full refusal follows [Storage limits](#storage-limits).
115
+
116
+ Without the CLI, upload an image file on disk yourself:
94
117
 
95
118
  1. Call `create_asset_upload` with the file name, content type and size in bytes.
96
119
  2. Run the returned `curl` command on the file. It uploads the bytes directly.
@@ -108,7 +131,7 @@ Do not save an image as an asset to change the icon or the splash screen.
108
131
 
109
132
  The import names an image that is not saved in the root `assets/` folder, or the path does
110
133
  not reach that folder. Check the name with `list_assets`, save the image first if it is
111
- missing, and write the path relative to the file, for example `../../assets/logo.png` from a
134
+ missing (in a CLI workspace, put the file in `assets/` and build again), and write the path relative to the file, for example `../../assets/logo.png` from a
112
135
  screen in `screens/portrait/`.
113
136
 
114
137
  After an image is deleted or renamed, the next build names every file that still imports the
@@ -65,7 +65,7 @@ In a local workspace, shared screens use `screens/Name.tsx`; distinct landscape
65
65
  To publish HTML/CSS design concepts as hosted artifacts, follow
66
66
  [publishing from a local agent](../design/design-guide.md#publishing-from-a-local-agent) before editing app code.
67
67
 
68
- Edit authored files in the workspace. Call `check_app` for an advisory TypeScript check. It does not compile descriptors, save, or prove a server build. The installed CLI also offers `adelin check <workspace> <app-id>` for a terminal check.
68
+ Edit authored files in the workspace. Call `check_app` for an advisory TypeScript check. It does not compile descriptors, save, or prove a server build. Images go in the workspace's root `assets/` folder; `build_app` saves new and changed ones as app assets before it sends source, and `list_assets(app_id)` lists the saved ones, as [assets.md](assets.md#images-from-your-own-files) describes. The installed CLI also offers `adelin check <workspace> <app-id>` for a terminal check.
69
69
 
70
70
  Call `build_app` with no file arguments when the builder wants to save and preview. The CLI reads the app-bound manifest and sends Adelin only file hashes and sizes. It then uploads the changed authored files once to short-lived private storage named by the server, and the server queues the build for the next free compiler. It returns bounded outcomes and diagnostics. Upload URLs and credentials are handled by the CLI; never show them, ask the builder or agent to copy them, or reuse them. Every build client goes through the shared server queue, and source never enters the queue. If capacity is unavailable, the build returns rejected/not-saved outcomes with a retry hint; preserve local edits and wait before an explicit retry. Local checks are advisory and cannot prove that compilation will pass. A build accepts 1–50 changed files, up to 300000 characters per file and 1 MiB total source. A successful build activates the committed app preview directly; there is no separate file approval or rejection step. Its result includes `previewUrl`, the app's always-on preview address: it shows the latest working draft to people the builder has given access and updates in place after each build. Share that address with the builder rather than building one yourself. Publishing snapshots that committed preview. A persisted file advances its local base only after verified activation; the local file keeps your text as written, and a fresh checkout on another machine shows the compiler's printed form of the same source. Saved shared screens keep the same relative imports and workspace path as checkout. Rejected, stale, or locally changed files keep prior bases and local bytes.
71
71
 
@@ -87,7 +87,7 @@ After a build that saved files, the `preview_*` tools work at once on the browse
87
87
 
88
88
  The preview browser runs headless on the builder's computer from `open_app` until `close_app`; it never opens a window. When the builder wants to see or steer the preview, call `show_agent_view`. If App Creator is open on this computer, the builder already watches that same browser there and nothing new opens. Otherwise it opens a local page in the builder's default browser. That page's link grants full control, so the tool never returns it; if no page opened, tell the builder the link is in the Adelin MCP server's log. Their own clicks, scrolls and typing pause your next preview action, and Alt/Option-clicks reach you as "The builder pointed at:" lines; handle both as the [visual review guide](../design/visual-review.md#when-the-builder-shares-the-preview) says.
89
89
 
90
- `request_device` is only for a check on a real cloud TV or phone. You can ask at any point in the session, before or without a build, for example to debug how the app already behaves on a device. Call `request_device(platform)` with `tv` or `phone` and an optional one-line reason. The builder answers in the dashboard and can choose a cloud TV, a cloud phone or not now; cloud devices use their preview minutes. The call waits up to 45 seconds for an answer, then until the started device responds. If it returns `waiting` or `starting`, call `wait_for_device` with its `request_id`; `ended` means the builder turned the device off. Ask once per round of fixes, not before every build. When the answer is `ready`, the `preview_*` tools run on that device until it ends. A device action refused with "No device is running" means the builder ended the device test or it ran out of minutes; continue on the browser preview and do not ask for a device again in the same round.
90
+ `request_device` is only for a check on a real cloud TV or phone. You can ask at any point in the session, before or without a build, for example to debug how the app already behaves on a device. Call `request_device(platform)` with an optional one-line reason. Pass `tv` or `phone` to let the builder pick the platform, or an exact one when the check depends on it: `tvos` (Apple TV), `android-tv`, `ios` (iPhone) or `android`. The builder answers in the dashboard, where the platform you asked for comes first, and can start that or another cloud TV or phone, or say not now; cloud devices use their preview minutes. The call waits up to 45 seconds for an answer, then until the started device responds. If it returns `waiting` or `starting`, call `wait_for_device` with its `request_id`; `ended` means the builder turned the device off. Ask once per round of fixes, not before every build. When the answer is `ready`, its `platform` names the device the builder started, and the `preview_*` tools run on it until it ends. A device action refused with "No device is running" means the builder ended the device test or it ran out of minutes; continue on the browser preview and do not ask for a device again in the same round.
91
91
 
92
92
  The builder can stop the session from the dashboard, or take the app back in App Creator. Either ends the lease, so the next heartbeat reports `lease_lost` and later builds are refused. Keep local edits, stop working on the app, and ask in the terminal before reopening it.
93
93
 
@@ -146,5 +146,24 @@ and tell the builder in plain words what you did check (for example, that the bu
146
146
  screen compiled) and which visual checks remain pending. Do not call the visual review complete
147
147
  until an actual capture has been inspected, and do not treat a successful build as visual acceptance.
148
148
 
149
+ ## Before saying done
150
+
151
+ Treat every request as unfinished until you have seen it work. A build that passes, a typecheck
152
+ that passes and TSX that reads correctly are not evidence of what a viewer sees.
153
+
154
+ - List the screens the change touches. A change to a shared component (header, tab bar, card,
155
+ rail, player controls) touches every screen that renders it; walk all of them.
156
+ - Capture each one at `web_phone` and `web_desktop`, plus a TV vendor target when the app ships
157
+ to TV. Scroll to the end of long screens; check the first viewport and the scrolled state.
158
+ - Tap the controls the change added or moved and confirm where each one lands.
159
+ - A capture that comes back blank, black or empty is a broken check. Read `preview_logs`, wait
160
+ briefly and capture again. If it still fails, say so plainly to the builder, list the screens
161
+ you could not see, and do not describe the work as done or verified.
162
+ - While you are there, report or fix what a viewer would notice even if it predates your change:
163
+ empty or missing artwork, actions with no destination, stale dates, copy from a template or the
164
+ builder's old site, and states (signed out, empty, loading) that look broken.
165
+
166
+ Tell the builder what you saw and on which sizes, and what remains unchecked.
167
+
149
168
  The preview must use the same global font and layout reset as the shipped web runtime. A
150
169
  beautiful source file viewed through a broken preview shell is not visual proof.
@@ -220,7 +220,8 @@ function validatedTerminal(value, journal) {
220
220
  return value;
221
221
  }
222
222
 
223
- function writeAtomic(root, name, content) {
223
+ /** Replaces one allowed workspace file through a synced temporary file. */
224
+ export function writeAtomic(root, name, content) {
224
225
  const target = assertSafeTarget(root, name);
225
226
  const stage = join(root, `.${randomUUID()}.tmp`);
226
227
  try {
@@ -9,6 +9,8 @@ export const PENDING = '.adelin-workspace.pending.json';
9
9
  export const SAVE_PENDING = '.adelin-save.pending.json';
10
10
  export const SAVE_REQUEST = '.adelin-save.request.json';
11
11
  export const SAVE_OUTCOME = '.adelin-save.outcome.json';
12
+ /** Hashes of the images this workspace saved from its root `assets/` folder. */
13
+ export const ASSET_STATE = '.adelin-assets.json';
12
14
  export const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
13
15
  const NAME = '[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*';
14
16
  /** A translation catalog: `locales/<tag>.ts` with a BCP 47 language tag such as `en`, `pt-BR` or `zh-Hant-TW`. */
@@ -93,7 +95,7 @@ export function assertNoSymlinkAncestors(path) {
93
95
 
94
96
  export function assertSafeTarget(root, relativePath) {
95
97
  if (!SOURCE_PATH.test(relativePath) && !DECLARATION_PATH.test(relativePath) &&
96
- !['tsconfig.json', MANIFEST, PENDING, SAVE_PENDING, SAVE_REQUEST, SAVE_OUTCOME].includes(relativePath))
98
+ !['tsconfig.json', MANIFEST, PENDING, SAVE_PENDING, SAVE_REQUEST, SAVE_OUTCOME, ASSET_STATE].includes(relativePath))
97
99
  refuse('Unsafe checkout path.');
98
100
  const target = join(root, relativePath);
99
101
  assertNoSymlinkAncestors(target);