mapples 0.2.0-beta.5 → 0.2.0-beta.6

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.
Files changed (79) hide show
  1. package/README.md +42 -0
  2. package/dist/api/agent.d.ts +84 -0
  3. package/dist/api/agent.js +92 -0
  4. package/dist/api/agent.js.map +1 -0
  5. package/dist/api/client.d.ts +3 -0
  6. package/dist/api/client.js +2 -0
  7. package/dist/api/client.js.map +1 -1
  8. package/dist/api/commit.js +1 -0
  9. package/dist/api/commit.js.map +1 -1
  10. package/dist/api/objects.d.ts +12 -0
  11. package/dist/api/objects.js +2 -0
  12. package/dist/api/objects.js.map +1 -1
  13. package/dist/commands/agent.d.ts +2 -0
  14. package/dist/commands/agent.js +76 -0
  15. package/dist/commands/agent.js.map +1 -0
  16. package/dist/commands/create.js +1 -0
  17. package/dist/commands/create.js.map +1 -1
  18. package/dist/commands/impl/adoptImpl.js +3 -0
  19. package/dist/commands/impl/adoptImpl.js.map +1 -1
  20. package/dist/commands/impl/agentImpl.d.ts +10 -0
  21. package/dist/commands/impl/agentImpl.js +349 -0
  22. package/dist/commands/impl/agentImpl.js.map +1 -0
  23. package/dist/commands/impl/createImpl.js +19 -0
  24. package/dist/commands/impl/createImpl.js.map +1 -1
  25. package/dist/commands/impl/initImpl.js +19 -0
  26. package/dist/commands/impl/initImpl.js.map +1 -1
  27. package/dist/commands/impl/syncImpl.js +9 -3
  28. package/dist/commands/impl/syncImpl.js.map +1 -1
  29. package/dist/commands/init.js +1 -0
  30. package/dist/commands/init.js.map +1 -1
  31. package/dist/index.js +12 -1
  32. package/dist/index.js.map +1 -1
  33. package/dist/project/agentState.d.ts +24 -0
  34. package/dist/project/agentState.js +42 -0
  35. package/dist/project/agentState.js.map +1 -0
  36. package/dist/project/secret.d.ts +6 -2
  37. package/dist/project/secret.js +11 -5
  38. package/dist/project/secret.js.map +1 -1
  39. package/dist/services/agentInstall.d.ts +35 -0
  40. package/dist/services/agentInstall.js +180 -0
  41. package/dist/services/agentInstall.js.map +1 -0
  42. package/dist/services/agentLease.d.ts +2 -0
  43. package/dist/services/agentLease.js +32 -0
  44. package/dist/services/agentLease.js.map +1 -0
  45. package/dist/services/clientFactory.d.ts +2 -0
  46. package/dist/services/clientFactory.js +16 -1
  47. package/dist/services/clientFactory.js.map +1 -1
  48. package/dist/services/scaffold.js +4 -0
  49. package/dist/services/scaffold.js.map +1 -1
  50. package/dist/services/syncEngine.js +51 -18
  51. package/dist/services/syncEngine.js.map +1 -1
  52. package/dist/types.d.ts +2 -0
  53. package/dist/types.js.map +1 -1
  54. package/package.json +3 -3
  55. package/templates/claude/CLAUDE.md +7 -0
  56. package/templates/claude/mapples.md +118 -0
  57. package/templates/claude/mcp.json +11 -0
  58. package/templates/claude/skills/mapples-conventions/SKILL.md +136 -0
  59. package/templates/claude/skills/mapples-design/SKILL.md +218 -0
  60. package/templates/claude/skills/mapples-design/reference/component-library.md +128 -0
  61. package/templates/claude/skills/mapples-design/reference/design-tokens.md +132 -0
  62. package/templates/claude/skills/mapples-design/reference/layout-contract.md +227 -0
  63. package/templates/claude/skills/mapples-design/reference/lint-checklist.md +51 -0
  64. package/templates/claude/skills/mapples-design/reference/plan.md +95 -0
  65. package/templates/claude/skills/mapples-design/reference/playbooks/empty-states.md +14 -0
  66. package/templates/claude/skills/mapples-design/reference/playbooks/forms-and-auth.md +22 -0
  67. package/templates/claude/skills/mapples-design/reference/playbooks/home-dashboard.md +14 -0
  68. package/templates/claude/skills/mapples-design/reference/playbooks/list-and-detail.md +18 -0
  69. package/templates/claude/skills/mapples-design/reference/playbooks/microcopy.md +20 -0
  70. package/templates/claude/skills/mapples-design/reference/playbooks/navigation-chrome.md +21 -0
  71. package/templates/claude/skills/mapples-design/reference/playbooks/onboarding-flow.md +15 -0
  72. package/templates/claude/skills/mapples-design/reference/playbooks/screen-flow-wiring.md +37 -0
  73. package/templates/claude/skills/mapples-design/reference/playbooks/settings-profile.md +16 -0
  74. package/templates/claude/skills/mapples-design/reference/playbooks/stats-and-progress.md +17 -0
  75. package/templates/claude/skills/mapples-design/reference/playbooks/visual-hierarchy.md +18 -0
  76. package/templates/claude/skills/mapples-design/reference/style-guides.md +92 -0
  77. package/templates/claude/skills/mapples-sync/SKILL.md +92 -0
  78. package/templates/gitignore +2 -0
  79. package/templates/package.json +1 -0
@@ -0,0 +1,92 @@
1
+ <!-- GENERATED by Mapples __CLI_VERSION__ — re-run mapples agent install --force to refresh -->
2
+ # Style guides (phase 1)
3
+
4
+ Ported from the Creator's design setup (`service--mapples-ai` `design/generate.ts`): first art
5
+ directions, then one compact style guide per direction. The user picks one; the full token set
6
+ (phase 2) realizes exactly that guide.
7
+
8
+ ## 1. Art directions
9
+
10
+ Act as a creative director choosing art directions for this mobile app's design system.
11
+
12
+ Propose exactly **3** art directions FOR THIS PRODUCT — grounded in its domain, audience and
13
+ mood, never a generic template menu. Make them genuinely different from each other: vary palette
14
+ temperature, typography class (serif / geometric sans / humanist sans / rounded / mono accents),
15
+ shape language (sharp ↔ pill), and density (airy ↔ compact). Each direction: a short evocative
16
+ name (2–40 chars, e.g. "Neon Court") and one tight clause (≤ 25 words) of concrete visual moves:
17
+ palette temperature, typography class, shape language, density.
18
+
19
+ ## 2. Style guide per direction
20
+
21
+ Act as a senior product designer sketching a compact style guide for this mobile app, for ONE
22
+ direction at a time. Make it unmistakably different from the other directions and from a
23
+ default blue Material palette.
24
+
25
+ Rules:
26
+
27
+ - Colors are hex. The preview maps are BOTH light and dark; dark is a real dark design (dark
28
+ surfaces, lighter text), not an inversion. `text` must have ≥ 4.5:1 contrast against
29
+ `background`; `onPrimary` against `primary` likewise.
30
+ - Fonts come ONLY from the bundled library (family + weight). Pick pairings that fit the
31
+ direction; body fonts must be sans or a highly legible serif.
32
+ - `iconFamily` comes ONLY from the icon library. Pick the pack whose stroke weight and shape
33
+ language match the direction (thin strokes for airy directions, solid glyphs for bold ones).
34
+ - `instructions` are the seed for the FULL design system generated later: palette logic,
35
+ typography roles, shape language (including the elevation language — soft shadows vs flat
36
+ borders/contrasting surfaces, with flat a first-class choice — and radius feel), spacing feel,
37
+ component character, one explicit don't. Concrete, 60–100 words, no marketing language.
38
+
39
+ Shape of one guide (write it into `design.md` when chosen):
40
+
41
+ ```md
42
+ ### <Name> — <direction in a few words>
43
+ Rationale: <one sentence why it fits the product>
44
+ Preview light: background #… card #… text #… textMuted #… primary #… onPrimary #… accent #…
45
+ Preview dark: background #… card #… text #… textMuted #… primary #… onPrimary #… accent #…
46
+ Radius: <0–32> · Fonts: headline <Family Weight> / body <Family Weight> / button <Family Weight>
47
+ Icon family: <key>
48
+ Instructions: <60–100 words>
49
+ ```
50
+
51
+ ## Font library
52
+
53
+ `"<Family>-<Weight>"` is the registered React Native family name (`Manrope-SemiBold`). Weights:
54
+ Regular, Medium, SemiBold, Bold unless noted.
55
+
56
+ | Family | Category | Character | Pairs with |
57
+ | --- | --- | --- | --- |
58
+ | Inter | sans | neutral, highly legible UI sans | Playfair Display, Fraunces, IBM Plex Mono |
59
+ | Manrope | sans | modern geometric, friendly tech | Fraunces, Inter, IBM Plex Mono |
60
+ | DM Sans (`DMSans`) | sans | low-contrast geometric, calm product UI | Playfair Display, Fraunces |
61
+ | Plus Jakarta Sans (`PlusJakartaSans`) | sans | rounded geometric, startup/fintech | Inter, Fraunces |
62
+ | Poppins | sans | round geometric, playful consumer apps | Nunito, Inter |
63
+ | Nunito | sans | soft rounded terminals, approachable | Poppins, Outfit |
64
+ | Space Grotesk (`SpaceGrotesk`) | sans | quirky technical grotesk, dev tools | Inter, IBM Plex Mono |
65
+ | Sora | sans | wide geometric display sans, bold headlines | Inter, DM Sans |
66
+ | Outfit | sans | clean geometric display, fashion/lifestyle | DM Sans, Nunito |
67
+ | Playfair Display (`PlayfairDisplay`) | serif — Regular/SemiBold/Bold | high-contrast editorial serif for headlines | Inter, DM Sans |
68
+ | Fraunces | serif — Regular/SemiBold/Bold | soft wonky serif, warm and characterful | Manrope, Inter, DM Sans |
69
+ | IBM Plex Mono (`IBMPlexMono`) | mono — Regular/Medium | monospace for code, data and labels | Inter, Space Grotesk |
70
+
71
+ ## Icon library
72
+
73
+ | Key | Character |
74
+ | --- | --- |
75
+ | ionicons | iOS-flavored rounded glyphs with filled and -outline pairs; safe modern default |
76
+ | material-icons | Google Material: solid, geometric, compact |
77
+ | material-design-icons | community Material superset; huge coverage, filled and outline variants |
78
+ | feather | thin 2px stroke outlines; minimal and airy |
79
+ | lucide | Feather's successor; consistent strokes, wide coverage |
80
+ | ant-design | clean enterprise outlines; restrained and precise |
81
+ | entypo | thick rounded solid glyphs; friendly and bold |
82
+ | octicons | GitHub's set; crisp outlines tuned for small sizes |
83
+ | fontawesome5-solid | Font Awesome 5 solid: heavy filled, classic |
84
+ | fontawesome6-solid | Font Awesome 6 solid: heavy filled, modern |
85
+ | simple-line-icons | ultra-light elegant line icons |
86
+
87
+ The icon family is a project setting in Creator; from code, `Icon iconName="…"` uses the glyph
88
+ names of that family (ionicons names like `home-outline`, `search`, `chevron-forward` when in
89
+ doubt). An unknown name renders as a broken glyph — prefer a common name over a guessed one.
90
+
91
+ > Not ported (Creator-only): the streaming preview cards, the `repairViolations` pass and the
92
+ > four-guide generation count (three here, so the table fits a chat reply).
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: mapples-sync
3
+ description: Running `mapples sync` from an agent — the --yes --json invocation, the JSON report fields, exit codes 0/1/2/3/4, and what to do on conflicts, deprecated files, NON_LITERAL_PROP warnings, read-scoped keys and offline runs. Use before and after every sync in a Mapples-linked app.
4
+ ---
5
+ <!-- GENERATED by Mapples __CLI_VERSION__ — re-run mapples agent install --force to refresh -->
6
+ # mapples sync
7
+
8
+ `mapples sync` is the only way changes reach Creator. Run it from the app root as
9
+
10
+ ```bash
11
+ mapples sync --yes --json
12
+ ```
13
+
14
+ - `--yes` accepts every adoption proposal (new route files, pages, components) without a prompt —
15
+ required, because you have no TTY. Add `--no-adopt` to push edits to managed files only and
16
+ leave new files untouched (e.g. a helper you do not want on the canvas yet).
17
+ - `--json` prints one JSON report and nothing else. Always parse it; never rely on the exit
18
+ code alone.
19
+ - The CLI is on the app's `devDependencies`; use `npx mapples …` (or `yarn mapples …`) when the
20
+ bare command is not on the PATH.
21
+
22
+ ## What one run does
23
+
24
+ 1. Adopts new files (`--yes`): react-native primitives become `@mapples/ui` elements with
25
+ `styled` props; a new file under the routes dir joins the navigator of its directory (a new
26
+ `(group)/` with a generated-header `_layout.tsx` becomes its own navigator).
27
+ 2. Extracts every managed file; elements without `$sid` are tagged and the file is rewritten.
28
+ 3. Pulls Creator's changes since the last sync, 3-way merges per element and prop, writes remote
29
+ changes into your files surgically.
30
+ 4. Pushes your edits as JPATCH transactions (retrying on 409), updates `.mapples/head`,
31
+ `pages.json`, `components.json`, `base/`.
32
+
33
+ ## The report
34
+
35
+ ```json
36
+ {
37
+ "pulledOps": 0, "pushedOps": 42, "head": "b3:…", "offline": false, "exitCode": 0,
38
+ "files": [{ "file": "app/index.tsx", "action": "updated", "detail": "tagged 12 new element(s)" }],
39
+ "conflicts": [{ "file": "app/index.tsx", "sid": "nd_…", "reason": "same-prop", "props": ["text"], "deprecatedTo": "app/_depr_20260916120000_index.tsx.old", "detail": "…" }],
40
+ "warnings": [{ "file": "app/index.tsx", "kind": "NON_LITERAL_PROP", "sid": "nd_…", "prop": "text", "detail": "…" }],
41
+ "dropped": [{ "index": 3, "id": "nd_…", "reason": "…", "op": { "op": "update", "entity": "RenderNode" } }],
42
+ "serverWarnings": ["CHILDREN_REBASED …"],
43
+ "notes": ["navigation: app/(main)/ had no navigator — created tabs navigator “Main” on “Root” (kind read from its _layout.tsx)"]
44
+ }
45
+ ```
46
+
47
+ | Field | Read it as |
48
+ | --- | --- |
49
+ | `files[].action` | `created` / `updated` / `regenerated` (from Creator after a conflict) / `deprecated` (your version moved to `_depr_…`) |
50
+ | `conflicts[]` | both sides changed the same prop or one deleted what the other edited — the file was deprecated and regenerated |
51
+ | `warnings[]` | lossy steps: `NON_LITERAL_PROP` (an expression prop stays code-only), `UNKNOWN_ELEMENT_WITH_SID`, … |
52
+ | `dropped[]` | ops the server skipped (target gone) — the change did not land |
53
+ | `serverWarnings[]` | e.g. `CHILDREN_REBASED`: the server reordered children after a concurrent edit |
54
+ | `offline` | true = nothing reached the server; ops parked in `.mapples/outbox/` and drained next run |
55
+ | `notes[]` | navigator creation, agent-lease heartbeat misses, rebases |
56
+
57
+ ## Exit codes
58
+
59
+ | Code | Meaning | Do |
60
+ | --- | --- | --- |
61
+ | 0 | synced | read `pushedOps`, `files`, `warnings` |
62
+ | 1 | error (bad key, malformed file, server refusal) | read stderr; fix the cause; never retry blindly |
63
+ | 2 | synced **with conflicts** | for every `conflicts[]` entry: diff `deprecatedTo` against the regenerated file, re-apply your intent onto the new file, sync again |
64
+ | 3 | agent lease gone (from `mapples agent …`) | stop working, tell the user Creator disconnected the agent |
65
+ | 4 | project busy (from `mapples agent start`) | another agent session holds the project — ask before `--takeover` |
66
+
67
+ ## After a sync
68
+
69
+ - **Re-read every file the report lists** before editing it again — `$sid`s were added, Creator's
70
+ edits were written in, the marker may have moved.
71
+ - `NON_LITERAL_PROP` on something you meant to be a literal: replace the expression with the
72
+ literal value (`text={title}` → `text="Today"`), sync again.
73
+ - A `deprecated` file with no conflict entry means the CLI had to own that position (a layout
74
+ you wrote without the generated header): let the generated file stand.
75
+ - `pushedOps: 0` after you changed a managed file means the extraction saw nothing: check that
76
+ the elements are Mapples imports with literal props, and that the file has no syntax error
77
+ (the report lists `SYNTAX_ERROR` warnings).
78
+ - `offline: true`: run again once online; do not edit `.mapples/outbox/`.
79
+
80
+ ## Errors you may see
81
+
82
+ - `push rejected: API key is read-scoped …` — the `MAPPLES_SECRET` / `.mapples/secret` key can
83
+ only read. Ask the user for a read & write key (Creator → Project → Settings → API keys) and
84
+ to restart with `MAPPLES_SECRET=<key> claude`; do not edit `.mapples/secret` yourself.
85
+ - `no .mapples/config.json` — you are not in the app root, or the app is not linked; do not run
86
+ `mapples init` on your own — ask.
87
+ - `HEAD_MISMATCH … could not be committed after 5 rebases` — Creator is being edited at the same
88
+ time; wait a moment and sync again.
89
+
90
+ Never delete `.mapples/head`, `.mapples/base/`, `.mapples/pages.json` or `.mapples/components.json`
91
+ to "fix" a sync — that discards the merge base and turns the next run into a cold bootstrap that
92
+ can deprecate every file.
@@ -7,3 +7,5 @@ web-build/
7
7
  .mapples/outbox/
8
8
  # project API secret — never commit
9
9
  .mapples/secret
10
+ # agent-session lease state — local only
11
+ .mapples/agent.json
@@ -11,6 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@mapples/action": "^1.1.2",
14
+ "@mapples/components": "^1.2.1",
14
15
  "@mapples/form": "^1.2.0",
15
16
  "@mapples/inlang": "^1.2.0",
16
17
  "@mapples/render": "^1.2.0",