leglas 0.1.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.
Files changed (36) hide show
  1. package/README.md +395 -0
  2. package/dist/args.d.ts +69 -0
  3. package/dist/baseline.d.ts +14 -0
  4. package/dist/bin.d.ts +2 -0
  5. package/dist/bin.js +2226 -0
  6. package/dist/briefs.d.ts +32 -0
  7. package/dist/ignore.d.ts +11 -0
  8. package/dist/index.d.ts +17 -0
  9. package/dist/index.js +2086 -0
  10. package/dist/init.d.ts +13 -0
  11. package/dist/keep.d.ts +32 -0
  12. package/dist/new.d.ts +34 -0
  13. package/dist/run-classify.d.ts +14 -0
  14. package/dist/run-explore.d.ts +18 -0
  15. package/dist/run-init.d.ts +16 -0
  16. package/dist/run-keep.d.ts +12 -0
  17. package/dist/run-new.d.ts +23 -0
  18. package/dist/run-previews.d.ts +28 -0
  19. package/dist/run.d.ts +24 -0
  20. package/dist/shell/assets/Satoshi-Medium-ByP-Zb-9.woff2 +0 -0
  21. package/dist/shell/assets/Satoshi-Regular-CPM9dct4.woff2 +0 -0
  22. package/dist/shell/assets/index-D-nej-Uo.js +9 -0
  23. package/dist/shell/assets/index-DcVuoqfz.css +1 -0
  24. package/dist/shell/assets/manrope-cyrillic-wght-normal-Dvxsihut.woff2 +0 -0
  25. package/dist/shell/assets/manrope-greek-wght-normal-DL7QRZyv.woff2 +0 -0
  26. package/dist/shell/assets/manrope-latin-ext-wght-normal-Ch3YOpNY.woff2 +0 -0
  27. package/dist/shell/assets/manrope-latin-wght-normal-DHIcAJRg.woff2 +0 -0
  28. package/dist/shell/assets/manrope-vietnamese-wght-normal-usUDDRr7.woff2 +0 -0
  29. package/dist/shell/assets/outfit-latin-ext-wght-normal-DdQaqQDo.woff2 +0 -0
  30. package/dist/shell/assets/outfit-latin-wght-normal-Bc-8i84L.woff2 +0 -0
  31. package/dist/shell/assets/spline-sans-mono-latin-400-normal-739QRW1l.woff +0 -0
  32. package/dist/shell/assets/spline-sans-mono-latin-400-normal-mUpA6Mve.woff2 +0 -0
  33. package/dist/shell/assets/spline-sans-mono-latin-ext-400-normal-BfWvPoNT.woff2 +0 -0
  34. package/dist/shell/assets/spline-sans-mono-latin-ext-400-normal-BkT5i7fe.woff +0 -0
  35. package/dist/shell/index.html +14 -0
  36. package/package.json +35 -0
package/dist/init.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import type { Write } from "./new.js";
2
+ export declare const AGENTS_MARKER_START = "<!-- leglas:start -->";
3
+ export declare const AGENTS_MARKER_END = "<!-- leglas:end -->";
4
+ export type InitPlan = {
5
+ writes: Write[];
6
+ gitignore: string | null;
7
+ };
8
+ export declare function planInit(options: {
9
+ agents: string | null;
10
+ config: string | null;
11
+ gitignore: string | null;
12
+ force?: boolean;
13
+ }): InitPlan;
package/dist/keep.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ import { type Preview } from "@leglas/server";
2
+ export type KeepPlan = {
3
+ ok: true;
4
+ move: {
5
+ from: string;
6
+ to: string;
7
+ };
8
+ removeDir: string;
9
+ dropTitles: string[];
10
+ exportName: string;
11
+ instructions: string;
12
+ } | {
13
+ ok: false;
14
+ error: string;
15
+ };
16
+ /**
17
+ * Plan the end of an exploration.
18
+ *
19
+ * Exploring is only safe to start because finishing is cheap, and finishing
20
+ * means the winner leaves the ignored directory for real source while the
21
+ * alternatives disappear entirely. Leglas can do this only because it knows
22
+ * where it put those files; anything it did not generate is refused rather than
23
+ * guessed at.
24
+ *
25
+ * The one step left to the user is the import in their own component, for the
26
+ * same reason `leglas new` prints it rather than applying it.
27
+ */
28
+ export declare function planKeep(options: {
29
+ title: string;
30
+ previews: readonly Preview[];
31
+ to: string;
32
+ }): KeepPlan;
package/dist/new.d.ts ADDED
@@ -0,0 +1,34 @@
1
+ export type Framework = "next" | "react";
2
+ export type Write = {
3
+ path: string;
4
+ contents: string;
5
+ };
6
+ export type NewPlan = {
7
+ writes: Write[];
8
+ /** New .gitignore contents, or null when no change is needed. */
9
+ gitignore: string | null;
10
+ previews: {
11
+ title: string;
12
+ url: string;
13
+ }[];
14
+ instructions: string;
15
+ };
16
+ /**
17
+ * Which shape of param reading to generate. Only the distinction that changes
18
+ * the output is drawn: whether params arrive on the server as a prop, or are
19
+ * read from the URL in the browser. The browser form is the fallback because
20
+ * it works anywhere React does.
21
+ */
22
+ export declare function detectFramework(packageJson: string | null): Framework;
23
+ /** The surface name becomes a query param, so it has to survive a URL intact. */
24
+ export declare function surfaceSlug(surface: string): string;
25
+ export declare function planNew(options: {
26
+ surface: string;
27
+ packageJson: string | null;
28
+ gitignore: string | null;
29
+ /** An existing component to use as the baseline, instead of a placeholder. */
30
+ from?: {
31
+ path: string;
32
+ contents: string;
33
+ } | undefined;
34
+ }): NewPlan;
@@ -0,0 +1,14 @@
1
+ import type { ClassifyChange } from "./args.js";
2
+ import type { PreviewDeps, PreviewResult } from "./run-previews.js";
3
+ /**
4
+ * Answer where a direction should live, before it is written.
5
+ *
6
+ * Both answers are successes: the point is to be asked, so an agent about to
7
+ * change dependencies or rewrite a shared file learns the checkout route
8
+ * instead of quietly costing the property that makes flipping instant.
9
+ */
10
+ export declare function runClassify(options: {
11
+ changes: ClassifyChange[];
12
+ json: boolean;
13
+ cwd: string;
14
+ }, deps: PreviewDeps): Promise<PreviewResult>;
@@ -0,0 +1,18 @@
1
+ export type ExploreDeps = {
2
+ log(line: string): void;
3
+ };
4
+ /**
5
+ * Hand an agent several genuinely different angles at once.
6
+ *
7
+ * Leglas runs no model, so orchestration here means divergence pressure rather
8
+ * than inference: the value added over "give me six variants" is that the six
9
+ * are told to disagree, and told which obvious reading would make them
10
+ * converge.
11
+ */
12
+ export declare function runExplore(options: {
13
+ surface: string;
14
+ count: number;
15
+ json: boolean;
16
+ }, deps: ExploreDeps): {
17
+ exitCode: number;
18
+ };
@@ -0,0 +1,16 @@
1
+ export type InitDeps = {
2
+ log(line: string): void;
3
+ };
4
+ /**
5
+ * Prepare a project: an AGENTS.md section so any agent entering the repo knows
6
+ * how to author directions, a starter config, and the ignore entry. Adopting
7
+ * Leglas in a repository is what distributes the contract; nothing has to be
8
+ * installed per user.
9
+ */
10
+ export declare function runInit(options: {
11
+ cwd: string;
12
+ force: boolean;
13
+ json: boolean;
14
+ }, deps: InitDeps): Promise<{
15
+ exitCode: number;
16
+ }>;
@@ -0,0 +1,12 @@
1
+ export type KeepDeps = {
2
+ log(line: string): void;
3
+ error(line: string): void;
4
+ };
5
+ export declare function runKeep(options: {
6
+ title: string;
7
+ to: string;
8
+ json: boolean;
9
+ cwd: string;
10
+ }, deps: KeepDeps): Promise<{
11
+ exitCode: number;
12
+ }>;
@@ -0,0 +1,23 @@
1
+ export type NewDeps = {
2
+ log(line: string): void;
3
+ };
4
+ export type NewResult = {
5
+ exitCode: number;
6
+ written: string[];
7
+ };
8
+ /**
9
+ * Scaffold a branch point for a surface.
10
+ *
11
+ * Writes only into the gitignored directory and, at most, appends one line to
12
+ * .gitignore. The single change to the user's own source is printed rather
13
+ * than applied: rewriting somebody's component automatically is how a tool
14
+ * breaks a codebase it does not understand, and a wrong edit there costs far
15
+ * more than a line of copying.
16
+ */
17
+ export declare function runNew(options: {
18
+ surface: string;
19
+ print: boolean;
20
+ json: boolean;
21
+ from?: string | undefined;
22
+ cwd: string;
23
+ }, deps: NewDeps): Promise<NewResult>;
@@ -0,0 +1,28 @@
1
+ import type { AddPreview } from "./args.js";
2
+ export type PreviewDeps = {
3
+ log(line: string): void;
4
+ error(line: string): void;
5
+ };
6
+ export type PreviewResult = {
7
+ exitCode: number;
8
+ };
9
+ export declare function runAdd(options: {
10
+ preview: AddPreview;
11
+ json: boolean;
12
+ cwd: string;
13
+ }, deps: PreviewDeps): Promise<PreviewResult>;
14
+ export declare function runList(options: {
15
+ json: boolean;
16
+ cwd: string;
17
+ }, deps: PreviewDeps): Promise<PreviewResult>;
18
+ /**
19
+ * Hand pending requests to whoever asks. An agent polls this, acts on each
20
+ * prompt, and clears the queue. Leglas runs no model of its own: the user's
21
+ * agent already knows their conventions and design system, which is context
22
+ * no external worker can have.
23
+ */
24
+ export declare function runRequests(options: {
25
+ json: boolean;
26
+ clear: boolean;
27
+ cwd: string;
28
+ }, deps: PreviewDeps): Promise<PreviewResult>;
package/dist/run.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import type { RunOptions } from "./args.js";
2
+ export type RunDeps = {
3
+ open(url: string): Promise<void>;
4
+ log(line: string): void;
5
+ };
6
+ export type RunResult = {
7
+ exitCode: number;
8
+ /** Where the interface lives, which is what gets opened and reported. */
9
+ url: string;
10
+ devServer: string;
11
+ previewCount: number;
12
+ stop(): Promise<void>;
13
+ };
14
+ /**
15
+ * Boot Leglas: resolve config, start the server, open the interface.
16
+ *
17
+ * Nothing here is fatal except being unable to bind a port. A missing config,
18
+ * an invalid config, or a dev server that is not running are all reported and
19
+ * survivable, because the user is mid-setup and needs to be told what to fix,
20
+ * not handed a stack trace.
21
+ */
22
+ export declare function run(options: RunOptions & {
23
+ cwd: string;
24
+ }, deps: RunDeps): Promise<RunResult>;