leglas 0.1.1 → 0.2.0

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.
@@ -0,0 +1,48 @@
1
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="22 369 1324 1324">
2
+ <style>
3
+ path { stroke-width: 38; stroke-linejoin: round; }
4
+ .ink { fill: #0B1839; stroke: #0B1839; }
5
+ path[fill="url(#Gradient6)"] { stroke: url(#Gradient6); }
6
+ path[fill="url(#Gradient5)"] { stroke: url(#Gradient5); }
7
+ path[fill="url(#Gradient4)"] { stroke: url(#Gradient4); }
8
+ path[fill="url(#Gradient3)"] { stroke: url(#Gradient3); }
9
+ #Gradient6 .g6a { stop-color: #081327; }
10
+ #Gradient6 .g6b { stop-color: #0F266A; }
11
+ #Gradient3 .g3a { stop-color: #0E2B85; }
12
+ #Gradient3 .g3b { stop-color: #3159CF; }
13
+ @media (prefers-color-scheme: dark) {
14
+ .ink { fill: #E8ECF7; stroke: #E8ECF7; }
15
+ #Gradient6 .g6a { stop-color: #E8ECF7; }
16
+ #Gradient6 .g6b { stop-color: #92A7E0; }
17
+ #Gradient3 .g3a { stop-color: #7E97DD; }
18
+ #Gradient3 .g3b { stop-color: #5F7FD8; }
19
+ }
20
+ </style>
21
+ <defs>
22
+ <linearGradient id="Gradient3" gradientUnits="userSpaceOnUse" x1="884.016" y1="1023.26" x2="182" y2="1023.26">
23
+ <stop class="g3a" offset="0" stop-opacity="1"/>
24
+ <stop class="g3b" offset="0.48" stop-opacity="1"/>
25
+ <stop class="stop2" offset="0.71" stop-opacity="1" stop-color="rgb(154,171,226)"/>
26
+ <stop class="stop3" offset="1" stop-opacity="1" stop-color="rgb(226,232,246)"/>
27
+ </linearGradient>
28
+ <linearGradient id="Gradient4" gradientUnits="userSpaceOnUse" x1="789.954" y1="1330.46" x2="210" y2="1035">
29
+ <stop class="stop0" offset="0" stop-opacity="1" stop-color="rgb(62,194,168)"/>
30
+ <stop class="stop1" offset="0.68" stop-opacity="1" stop-color="rgb(158,218,232)"/>
31
+ <stop class="stop2" offset="1" stop-opacity="1" stop-color="rgb(225,242,246)"/>
32
+ </linearGradient>
33
+ <linearGradient id="Gradient5" gradientUnits="userSpaceOnUse" x1="791.957" y1="723.095" x2="210" y2="1010">
34
+ <stop class="stop0" offset="0" stop-opacity="1" stop-color="rgb(124,56,232)"/>
35
+ <stop class="stop1" offset="0.68" stop-opacity="1" stop-color="rgb(205,182,241)"/>
36
+ <stop class="stop2" offset="1" stop-opacity="1" stop-color="rgb(233,224,250)"/>
37
+ </linearGradient>
38
+ <linearGradient id="Gradient6" gradientUnits="userSpaceOnUse" x1="1192" y1="1021.57" x2="874.81" y2="1024.91">
39
+ <stop class="g6a" offset="0" stop-opacity="1"/>
40
+ <stop class="g6b" offset="1" stop-opacity="1"/>
41
+ </linearGradient>
42
+ </defs>
43
+ <path transform="translate(0,0)" class="ink" d="M 671.122 381.199 C 708.12 378.001 733.579 414.981 702.643 437.984 C 705.64 430.245 708.163 423.315 705.553 415.028 C 700.981 400.516 684.107 396.94 671.252 401.81 C 662.713 405.098 655.849 411.671 652.193 420.059 C 645.933 434.059 649.404 447.111 654.599 460.446 C 665.665 467.718 660.114 472.463 666.664 480.695 C 694.852 516.12 737.817 543.026 774.246 568.848 C 841.225 616.324 905.267 670.31 939.022 747.101 C 953.651 782.815 964.144 815.411 953.49 854.107 C 944.702 886.028 889.413 910.644 901.624 945.63 C 905.247 956.01 926.305 965.294 936.684 957.439 C 947.74 949.072 949.919 942.473 953.06 929.336 C 967.974 962.891 939.504 987.655 907.14 982.376 C 893.109 980.134 880.552 972.384 872.258 960.847 C 839.018 914.253 888.968 876.15 898.307 834.712 C 902.782 814.853 894.952 783.534 888.142 764.672 C 860.48 688.068 798.139 632.327 735.838 583.312 C 700.284 555.045 669.551 529.466 642.632 492.392 C 627.896 510.927 608.893 531.804 593.068 550.006 L 506.523 649.582 L 278.039 912.109 C 245.455 949.199 213.059 986.454 180.851 1023.87 C 231.765 1079.46 283.65 1142.04 333.374 1199.45 L 642.829 1555.74 C 666.446 1520.75 700.163 1494.07 732.424 1467.5 C 795.117 1417.7 858.256 1363.37 887.261 1286.25 C 898.113 1256.93 906.911 1217.89 889.705 1189.06 C 873.478 1161.87 852.143 1132.56 865.539 1099.12 C 871.003 1085.24 881.904 1074.2 895.712 1068.56 C 930.406 1054.52 970.704 1079.86 953.232 1118.88 C 950.548 1106.58 948.459 1099.64 937.837 1091.37 C 926.133 1082.27 907.942 1089.57 901.99 1101.66 C 890.169 1127.27 924.549 1151.85 939.219 1169.81 C 966.471 1203.18 959.658 1245.71 945.71 1284.44 C 914.285 1371.69 840.069 1433.7 765.809 1484.61 C 733.647 1506.66 698.091 1531.58 672.306 1561.08 C 665.933 1568.59 659.014 1581.87 653.634 1590.29 C 648.506 1598.32 647.787 1615.38 650.833 1624.56 C 653.881 1633.77 660.579 1641.32 669.359 1645.45 C 681.85 1651.27 699.281 1649.12 705.041 1634.65 C 708.705 1625.45 705.419 1617.29 701.581 1608.8 L 702.848 1609.85 C 737.88 1638.68 697.51 1681.47 657.106 1662.8 C 643.389 1656.45 632.826 1644.83 627.824 1630.56 C 619.064 1605.85 626.824 1585.32 637.489 1563.26 C 610.659 1534.07 581.755 1498.91 555.456 1468.66 L 383.745 1271.03 L 242.504 1108.25 C 219.223 1081.36 191.596 1051.06 169.707 1023.52 C 181.894 1007.58 201.352 986.522 215.082 970.737 L 301.342 871.646 L 539.659 597.67 C 572.041 560.265 605.914 522.417 637.6 484.482 C 616.356 444.192 617.849 392.637 671.122 381.199 z"/>
44
+ <path transform="translate(0,0)" fill="url(#Gradient6)" d="M 1005.63 925.199 L 1121.78 984.34 C 1142.45 994.767 1179.5 1012.52 1198.4 1023.72 L 1070.98 1089.03 C 1051.67 1098.95 1023.69 1114.54 1004.93 1122.53 C 1013.61 1097.65 1022.5 1072.85 1031.59 1048.12 L 873.734 1045.08 C 876.225 1042.9 878.766 1040.79 881.356 1038.74 C 886.981 1021.89 882.15 1018.85 881.311 1004.34 L 884.044 1002.33 L 1030.81 999.036 C 1023.04 976.689 1012.03 947.529 1005.63 925.199 z"/>
45
+ <path transform="translate(0,0)" fill="url(#Gradient5)" d="M 791.002 712.436 C 791.99 712.378 791.355 712.338 792.831 712.983 C 791.837 718.407 719.488 841.546 710.03 858.509 C 707.23 840.677 702.304 817.013 698.274 799.446 C 555 895 360 995 182 1023 C 355 963 525 870 674.863 761.103 C 659.702 748.905 644.649 736.575 629.704 724.113 C 681.16 722.084 738.984 715.793 791.002 712.436 z"/>
46
+ <path transform="translate(0,0)" fill="url(#Gradient4)" d="M 182 1023 C 360 1051 555 1151 698.326 1248.65 C 702.16 1232.41 707.425 1206.32 709.871 1189.79 C 737.246 1238.39 766.184 1286.55 793.713 1335.16 C 739.167 1331.05 684.598 1327.24 630.009 1323.75 C 644.462 1311.53 659.652 1298.21 674.331 1286.42 C 525 1176 355 1083 182 1023 z"/>
47
+ <path transform="translate(0,0)" fill="url(#Gradient3)" d="M 182 1023.5 L 884.044 1002.33 L 881.311 1004.34 C 882.15 1018.85 886.981 1021.89 881.356 1038.74 C 878.766 1040.79 876.225 1042.9 873.734 1045.08 z"/>
48
+ </svg>
@@ -4,9 +4,10 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <meta name="robots" content="noindex" />
7
+ <link rel="icon" href="/leglas/favicon.svg" type="image/svg+xml" />
7
8
  <title>Leglas</title>
8
- <script type="module" crossorigin src="/leglas/assets/index-D-nej-Uo.js"></script>
9
- <link rel="stylesheet" crossorigin href="/leglas/assets/index-DcVuoqfz.css">
9
+ <script type="module" crossorigin src="/leglas/assets/index-r7sGM7WL.js"></script>
10
+ <link rel="stylesheet" crossorigin href="/leglas/assets/index-dMGYwlE1.css">
10
11
  </head>
11
12
  <body>
12
13
  <div id="root"></div>
package/dist/show.d.ts ADDED
@@ -0,0 +1,59 @@
1
+ import { type PendingRequest, type Preview } from "@leglas/server";
2
+ /**
3
+ * Everything Leglas holds about one direction, assembled for whoever was
4
+ * handed its reference block.
5
+ *
6
+ * The block is copied out of the rail and pasted somewhere else: a chat, an
7
+ * issue, an agent's prompt. It carries enough to read, and points here for the
8
+ * rest. What "the rest" means is deliberate:
9
+ *
10
+ * - the file behind the direction, which nothing else exposes. A URL like
11
+ * `/?v-hero=aurora` is the scaffold's convention for
12
+ * `.leglas/variants/hero/aurora.tsx`, and an agent that has to guess at that
13
+ * goes looking through the tree instead of opening the file.
14
+ * - the set it is being judged against. A direction described alone invites an
15
+ * agent to improve it straight out of the comparison, which is the one thing
16
+ * the product exists to prevent.
17
+ * - what is pending against it. Note the tense: requests are a queue that gets
18
+ * drained and cleared, so this is what has been asked and not yet done, not
19
+ * a history of everything ever asked.
20
+ */
21
+ export type ShowDirection = {
22
+ title: string;
23
+ url: string;
24
+ note: string | null;
25
+ tags: readonly string[];
26
+ basedOn: string | null;
27
+ branch: string | null;
28
+ file: string | null;
29
+ /** Registered on this machine only, rather than in the shared config. */
30
+ local: boolean;
31
+ /** The source file behind it, where the URL follows the scaffold's shape. */
32
+ target: string | null;
33
+ };
34
+ export type ShowPlan = {
35
+ ok: true;
36
+ direction: ShowDirection;
37
+ /** Directions that name this one as what they are a variant of. */
38
+ variants: ShowDirection[];
39
+ /** Every other direction's title: what this one is up against. */
40
+ comparedWith: string[];
41
+ requests: {
42
+ id: string;
43
+ intent: string;
44
+ target: string | null;
45
+ prompt: string;
46
+ status: PendingRequest["status"];
47
+ }[];
48
+ } | {
49
+ ok: false;
50
+ error: string;
51
+ };
52
+ export type ShowInput = {
53
+ title: string;
54
+ previews: readonly (Preview & {
55
+ local?: boolean;
56
+ })[];
57
+ requests: readonly PendingRequest[];
58
+ };
59
+ export declare function planShow({ title, previews, requests }: ShowInput): ShowPlan;
@@ -0,0 +1,45 @@
1
+ import type { PendingRequest } from "@leglas/server";
2
+ /** Where the agent command is remembered, beside the other machine-local state. */
3
+ export declare const WATCH_PATH = ".leglas/watch.json";
4
+ /** The one thing the template must contain, and the only thing substituted. */
5
+ export declare const PROMPT_TOKEN = "{prompt}";
6
+ export type WatchTemplate = {
7
+ command: string;
8
+ /** Still holds the placeholder; commandFor substitutes per request. */
9
+ args: readonly string[];
10
+ };
11
+ export type TemplateResult = {
12
+ ok: true;
13
+ template: WatchTemplate;
14
+ } | {
15
+ ok: false;
16
+ error: string;
17
+ };
18
+ /**
19
+ * Validate an agent command before anything is spawned or remembered.
20
+ *
21
+ * Every refusal is one line naming the fix, because this is the first thing a
22
+ * user types and the failure is always the same shape: the placeholder is
23
+ * missing, or it is glued to something else. Substituting a placeholder that
24
+ * is part of a larger token would build an argument the agent never asked for,
25
+ * so that case is refused rather than guessed at.
26
+ */
27
+ export declare function parseTemplate(raw: string): TemplateResult;
28
+ /**
29
+ * The argv for one request. The prompt is a single entry however many words,
30
+ * lines or quotes it contains, which is the whole reason the template names a
31
+ * placeholder instead of being pasted together as a string.
32
+ */
33
+ export declare function commandFor(template: WatchTemplate, prompt: string): {
34
+ command: string;
35
+ args: string[];
36
+ };
37
+ /**
38
+ * The request to hand over next, or nothing to do.
39
+ *
40
+ * Queue order, one at a time: two agents editing one tree at once produce a
41
+ * conflict the user has to untangle. Ids that already failed are skipped for
42
+ * the life of the process, since a prompt that broke the agent will break it
43
+ * again and retrying it is the user's tokens on fire.
44
+ */
45
+ export declare function nextRequest(requests: readonly PendingRequest[], failed: ReadonlySet<string>): PendingRequest | null;
package/package.json CHANGED
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "leglas",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Compare design directions inside your own running app.",
5
5
  "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/FredAmartey/leglas.git",
9
+ "directory": "packages/cli"
10
+ },
11
+ "homepage": "https://github.com/FredAmartey/leglas#readme",
6
12
  "type": "module",
7
13
  "keywords": [
8
14
  "design",
@@ -22,8 +28,8 @@
22
28
  "types": "./dist/index.d.ts",
23
29
  "devDependencies": {
24
30
  "tsup": "^8.5.0",
25
- "@leglas/shell": "0.0.0",
26
- "@leglas/server": "0.0.0"
31
+ "@leglas/server": "0.0.0",
32
+ "@leglas/shell": "0.0.0"
27
33
  },
28
34
  "engines": {
29
35
  "node": ">=24"
package/dist/briefs.d.ts DELETED
@@ -1,32 +0,0 @@
1
- export type Brief = {
2
- slug: string;
3
- name: string;
4
- brief: string;
5
- /**
6
- * Named because agents converge without it: the obvious reading of any angle
7
- * is a small tweak to what already exists.
8
- */
9
- avoid: string;
10
- };
11
- /**
12
- * Angles for exploring a surface.
13
- *
14
- * Left to itself an agent iterates narrowly around its first idea, so six
15
- * requests return six shades of one design. These exist to force real
16
- * divergence, and each varies several properties at once rather than turning a
17
- * single knob: composition, medium, density, motion, texture and palette
18
- * rather than colour alone.
19
- *
20
- * Ordered for spread, so asking for three still explores widely instead of
21
- * returning three neighbours.
22
- */
23
- export declare const ALL_BRIEFS: Brief[];
24
- export declare function briefsFor(count: number): Brief[];
25
- export declare function planBriefs(surface: string, count: number): {
26
- previews: {
27
- title: string;
28
- url: string;
29
- }[];
30
- commands: string[];
31
- instructions: string;
32
- };