topotopo 0.4.0 → 0.5.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.
- package/NOTICE +10 -10
- package/README.md +460 -117
- package/dist/cli.js +323 -146
- package/dist/config.d.ts +48 -0
- package/dist/config.js +170 -0
- package/dist/core/bake.d.ts +14 -3
- package/dist/core/bake.js +153 -4
- package/dist/core/bevel.d.ts +3 -1
- package/dist/core/bevel.js +76 -3
- package/dist/core/decimate.d.ts +65 -0
- package/dist/core/decimate.js +409 -3
- package/dist/core/erosion.d.ts +37 -0
- package/dist/core/erosion.js +41 -1
- package/dist/core/geometry.d.ts +5 -1
- package/dist/core/geometry.js +203 -3
- package/dist/core/heightfield.d.ts +27 -4
- package/dist/core/heightfield.js +54 -16
- package/dist/core/intrinsics.d.ts +7 -0
- package/dist/core/intrinsics.js +94 -0
- package/dist/core/manifold.d.ts +12 -1
- package/dist/core/manifold.js +78 -6
- package/dist/core/materials.d.ts +7 -0
- package/dist/core/materials.js +45 -0
- package/dist/core/noise.d.ts +9 -0
- package/dist/core/noise.js +10 -1
- package/dist/core/polymerge.d.ts +21 -0
- package/dist/core/polymerge.js +327 -0
- package/dist/core/repair.d.ts +2 -0
- package/dist/core/repair.js +2 -0
- package/dist/core/report.d.ts +70 -0
- package/dist/core/report.js +275 -0
- package/dist/core/scene.js +2 -1
- package/dist/core/sha256.d.ts +4 -0
- package/dist/core/sha256.js +69 -0
- package/dist/core/shapes.d.ts +3 -0
- package/dist/core/shapes.js +34 -0
- package/dist/core/snippet-lib.d.ts +14 -1
- package/dist/core/snippet-lib.js +39 -13
- package/dist/core/tangents.d.ts +2 -0
- package/dist/core/tangents.js +5 -1
- package/dist/core/texnoise.d.ts +6 -1
- package/dist/core/texnoise.js +6 -2
- package/dist/core/texsdf.d.ts +131 -0
- package/dist/core/texsdf.js +637 -0
- package/dist/core/texture.d.ts +163 -9
- package/dist/core/texture.js +844 -20
- package/dist/core/topology.d.ts +10 -0
- package/dist/core/topology.js +168 -0
- package/dist/core/unwrap.d.ts +72 -0
- package/dist/core/unwrap.js +800 -0
- package/dist/core/usercode.d.ts +27 -0
- package/dist/core/usercode.js +87 -0
- package/dist/core/uv.d.ts +4 -18
- package/dist/core/uv.js +35 -188
- package/dist/core/uvislands.d.ts +62 -0
- package/dist/core/uvislands.js +574 -0
- package/dist/core/uvoverlap.d.ts +58 -0
- package/dist/core/uvoverlap.js +220 -0
- package/dist/core/uvpack.d.ts +64 -0
- package/dist/core/uvpack.js +628 -0
- package/dist/core/uvreport.d.ts +61 -0
- package/dist/core/uvreport.js +207 -143
- package/dist/core/wrangle.d.ts +6 -1
- package/dist/core/wrangle.js +27 -16
- package/dist/core/xatlas.d.ts +16 -1
- package/dist/core/xatlas.js +66 -62
- package/dist/engines.d.ts +63 -0
- package/dist/engines.js +180 -0
- package/dist/explain.d.ts +4 -3
- package/dist/explain.js +129 -12
- package/dist/graph/engine.d.ts +92 -29
- package/dist/graph/engine.js +298 -148
- package/dist/graph/expr.d.ts +6 -3
- package/dist/graph/expr.js +18 -8
- package/dist/graph/outputs.d.ts +23 -0
- package/dist/graph/outputs.js +41 -0
- package/dist/graph/packages.d.ts +72 -0
- package/dist/graph/packages.js +261 -0
- package/dist/graph/parallel.d.ts +3 -1
- package/dist/graph/parallel.js +4 -1
- package/dist/graph/params.d.ts +6 -0
- package/dist/graph/params.js +34 -7
- package/dist/graph/scope.d.ts +55 -0
- package/dist/graph/scope.js +14 -0
- package/dist/graph/types.d.ts +75 -12
- package/dist/graph/types.js +4 -2
- package/dist/graph/vars.d.ts +16 -0
- package/dist/graph/vars.js +80 -0
- package/dist/host/artifacts.d.ts +10 -1
- package/dist/host/artifacts.js +37 -6
- package/dist/host/cook.d.ts +241 -0
- package/dist/host/cook.js +844 -0
- package/dist/host/export-targets.d.ts +42 -5
- package/dist/host/export-targets.js +72 -13
- package/dist/host/godot-commands.d.ts +4 -0
- package/dist/host/godot-commands.js +21 -0
- package/dist/host/godot.d.ts +183 -0
- package/dist/host/godot.js +916 -0
- package/dist/host/node.d.ts +12 -7
- package/dist/host/node.js +27 -9
- package/dist/host/pool.js +51 -2
- package/dist/host/sidecars.d.ts +8 -0
- package/dist/host/sidecars.js +50 -0
- package/dist/host/types.d.ts +19 -6
- package/dist/host/version.d.ts +1 -0
- package/dist/host/version.js +3 -0
- package/dist/host/worker.js +5 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/inspect.d.ts +80 -2
- package/dist/inspect.js +265 -30
- package/dist/io/common.d.ts +25 -5
- package/dist/io/export.js +2 -1
- package/dist/io/files.d.ts +23 -4
- package/dist/io/files.js +60 -8
- package/dist/io/gltf.js +134 -47
- package/dist/io/heightmap.d.ts +3 -0
- package/dist/io/heightmap.js +1 -0
- package/dist/io/import.js +10 -0
- package/dist/io/inspect-scene.d.ts +55 -0
- package/dist/io/inspect-scene.js +155 -0
- package/dist/io/kinds.d.ts +81 -0
- package/dist/io/kinds.js +163 -0
- package/dist/io/points.d.ts +2 -1
- package/dist/io/points.js +3 -1
- package/dist/io/sidecars.d.ts +24 -0
- package/dist/io/sidecars.js +57 -0
- package/dist/io/source.d.ts +65 -0
- package/dist/io/source.js +112 -0
- package/dist/io/targets.d.ts +47 -3
- package/dist/io/targets.js +148 -13
- package/dist/io/textures.js +21 -1
- package/dist/io/unreal.js +5 -1
- package/dist/mcp/docs.d.ts +10 -1
- package/dist/mcp/docs.js +786 -143
- package/dist/mcp/inputs.d.ts +12 -5
- package/dist/mcp/inputs.js +50 -13
- package/dist/mcp/server.js +56 -27
- package/dist/mcp/tools.d.ts +14 -7
- package/dist/mcp/tools.js +196 -103
- package/dist/mcp/verify.d.ts +2 -2
- package/dist/mcp/verify.js +1 -1
- package/dist/mcp/workspace.d.ts +15 -0
- package/dist/mcp/workspace.js +349 -0
- package/dist/nodes/attributes.js +198 -1
- package/dist/nodes/bake.js +151 -47
- package/dist/nodes/beam.d.ts +1 -0
- package/dist/nodes/beam.js +201 -0
- package/dist/nodes/bevel.js +51 -3
- package/dist/nodes/cloth.js +2 -0
- package/dist/nodes/code.js +21 -9
- package/dist/nodes/curves.js +433 -93
- package/dist/nodes/flow.js +53 -33
- package/dist/nodes/generate.js +12 -38
- package/dist/nodes/heightfield.js +248 -77
- package/dist/nodes/imageops.js +16 -19
- package/dist/nodes/index.d.ts +1 -0
- package/dist/nodes/index.js +1 -0
- package/dist/nodes/material.js +89 -24
- package/dist/nodes/measure.js +43 -17
- package/dist/nodes/particles.js +2 -0
- package/dist/nodes/pcg.js +6 -5
- package/dist/nodes/procedural.js +4 -3
- package/dist/nodes/remesh.js +71 -15
- package/dist/nodes/scene.js +4 -2
- package/dist/nodes/sdf.js +10 -5
- package/dist/nodes/solid.js +20 -5
- package/dist/nodes/splines.d.ts +15 -1
- package/dist/nodes/splines.js +112 -105
- package/dist/nodes/texture.d.ts +21 -6
- package/dist/nodes/texture.js +1318 -185
- package/dist/nodes/topology.d.ts +7 -0
- package/dist/nodes/topology.js +133 -6
- package/dist/nodes/transform.js +6 -2
- package/dist/nodes/uv.js +192 -174
- package/dist/nodes/wasmcall.js +5 -1
- package/dist/open.d.ts +19 -0
- package/dist/open.js +12 -0
- package/dist/package.d.ts +288 -0
- package/dist/package.js +772 -0
- package/dist/packages/check.d.ts +32 -0
- package/dist/packages/check.js +169 -0
- package/dist/packages/commands.d.ts +57 -0
- package/dist/packages/commands.js +537 -0
- package/dist/packages/registry.d.ts +796 -0
- package/dist/packages/registry.js +2998 -0
- package/dist/packages/update.d.ts +124 -0
- package/dist/packages/update.js +476 -0
- package/dist/render/options.d.ts +2 -0
- package/dist/render/options.js +44 -5
- package/dist/render/preview.d.ts +15 -4
- package/dist/render/preview.js +6 -4
- package/dist/render/raster.d.ts +66 -5
- package/dist/render/raster.js +506 -138
- package/dist/render/texview.d.ts +6 -0
- package/dist/render/texview.js +27 -0
- package/dist/scan.d.ts +61 -0
- package/dist/scan.js +228 -0
- package/dist/session.d.ts +311 -0
- package/dist/session.js +849 -0
- package/dist/viewer/app/api.js +48 -6
- package/dist/viewer/app/cooking.js +78 -0
- package/dist/viewer/app/embed.js +27 -7
- package/dist/viewer/app/export-popover.js +118 -16
- package/dist/viewer/app/grid.js +5 -1
- package/dist/viewer/app/guides.js +122 -0
- package/dist/viewer/app/keymap.js +6 -3
- package/dist/viewer/app/layers.js +4 -4
- package/dist/viewer/app/main.js +185 -52
- package/dist/viewer/app/markers.js +60 -0
- package/dist/viewer/app/outliner.js +72 -27
- package/dist/viewer/app/output-info.js +45 -0
- package/dist/viewer/app/outputs.css +147 -8
- package/dist/viewer/app/outputs.js +168 -54
- package/dist/viewer/app/packages.js +614 -0
- package/dist/viewer/app/props.js +176 -52
- package/dist/viewer/app/scene.js +30 -5
- package/dist/viewer/app/select.js +4 -3
- package/dist/viewer/app/status.js +12 -15
- package/dist/viewer/app/style.css +65 -7
- package/dist/viewer/app/vars.js +47 -0
- package/dist/viewer/app/welcome.js +72 -0
- package/dist/viewer/graph-file.d.ts +62 -0
- package/dist/viewer/graph-file.js +175 -0
- package/dist/viewer/index.html +23 -10
- package/dist/viewer/json-edit.d.ts +13 -0
- package/dist/viewer/json-edit.js +274 -0
- package/dist/viewer/outputs.d.ts +49 -5
- package/dist/viewer/outputs.js +264 -56
- package/dist/viewer/packages.d.ts +121 -0
- package/dist/viewer/packages.js +584 -0
- package/dist/viewer/server.d.ts +14 -9
- package/dist/viewer/server.js +266 -28
- package/dist/web/app/web.css +419 -0
- package/dist/web/app/web.js +188 -0
- package/dist/{gallery → web}/bake.d.ts +4 -4
- package/dist/{gallery → web}/bake.js +24 -15
- package/dist/web/folder-page.d.ts +101 -0
- package/dist/web/folder-page.js +146 -0
- package/dist/web/folders.d.ts +280 -0
- package/dist/web/folders.js +970 -0
- package/dist/web/library.d.ts +91 -0
- package/dist/web/library.js +228 -0
- package/dist/web/markdown.d.ts +45 -0
- package/dist/web/markdown.js +677 -0
- package/dist/web/pages.d.ts +258 -0
- package/dist/web/pages.js +301 -0
- package/dist/web/server.d.ts +24 -0
- package/dist/web/server.js +1068 -0
- package/dist/workspace.d.ts +88 -118
- package/dist/workspace.js +358 -460
- package/integrations/godot/addons/topotopo/LICENSE +202 -0
- package/integrations/godot/addons/topotopo/README.md +57 -0
- package/integrations/godot/addons/topotopo/context_menu.gd +43 -0
- package/integrations/godot/addons/topotopo/dock.gd +266 -0
- package/integrations/godot/addons/topotopo/dock.tscn +72 -0
- package/integrations/godot/addons/topotopo/export_filter.gd +72 -0
- package/integrations/godot/addons/topotopo/gltf_instancing.gd +131 -0
- package/integrations/godot/addons/topotopo/icons/topotopo.svg +1 -0
- package/integrations/godot/addons/topotopo/inspector.gd +38 -0
- package/integrations/godot/addons/topotopo/instances_post_import.gd +111 -0
- package/integrations/godot/addons/topotopo/package.gd +23 -0
- package/integrations/godot/addons/topotopo/package_importer.gd +187 -0
- package/integrations/godot/addons/topotopo/plugin.cfg +7 -0
- package/integrations/godot/addons/topotopo/plugin.gd +970 -0
- package/integrations/godot/addons/topotopo/record.gd +435 -0
- package/integrations/godot/addons/topotopo/runner.gd +458 -0
- package/integrations/godot/addons/topotopo/tools/check.gd +42 -0
- package/integrations/godot/addons/topotopo/watcher.gd +199 -0
- package/kernels/pkg/README.md +2 -1
- package/kernels/pkg-simd/README.md +2 -1
- package/library/architecture/versions/1.0/architecture.topo +12 -0
- package/{shelf → library/architecture/versions/1.0/graphs}/arch.json +3 -3
- package/{shelf → library/architecture/versions/1.0/graphs}/beam_truss.json +6 -6
- package/{shelf → library/architecture/versions/1.0/graphs}/brick_wall.json +8 -8
- package/{shelf → library/architecture/versions/1.0/graphs}/door_frame.json +3 -3
- package/{shelf → library/architecture/versions/1.0/graphs}/hex_grid_floor.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/house.json +8 -8
- package/library/architecture/versions/1.0/graphs/lineup.json +42 -0
- package/{shelf → library/architecture/versions/1.0/graphs}/pillar.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/railing.json +5 -5
- package/{shelf → library/architecture/versions/1.0/graphs}/roof_gable.json +2 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/roof_hip.json +2 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/roof_skeleton.json +2 -1
- package/{shelf → library/architecture/versions/1.0/graphs}/scaffold.json +4 -4
- package/{shelf → library/architecture/versions/1.0/graphs}/spiral_stairs.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/stairs.json +6 -6
- package/{shelf → library/architecture/versions/1.0/graphs}/tile_floor.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/wall_segment.json +10 -10
- package/{shelf → library/architecture/versions/1.0/graphs}/window_frame.json +2 -2
- package/library/architecture/versions/1.0/version.json +1119 -0
- package/{shelf → library/nature/versions/1.0/graphs}/bush.json +2 -2
- package/{shelf → library/nature/versions/1.0/graphs}/cliff_block.json +4 -3
- package/{shelf → library/nature/versions/1.0/graphs}/forest_patch.json +5 -5
- package/{shelf → library/nature/versions/1.0/graphs}/grass_clumps.json +2 -2
- package/library/nature/versions/1.0/graphs/lineup.json +24 -0
- package/{shelf → library/nature/versions/1.0/graphs}/log.json +6 -6
- package/{shelf → library/nature/versions/1.0/graphs}/rock.json +5 -4
- package/{shelf → library/nature/versions/1.0/graphs}/scatter_rocks.json +5 -5
- package/{shelf → library/nature/versions/1.0/graphs}/tree_lowpoly.json +3 -2
- package/library/nature/versions/1.0/nature.topo +12 -0
- package/library/nature/versions/1.0/version.json +534 -0
- package/{shelf → library/props/versions/1.0/graphs}/barrel.json +5 -4
- package/{shelf → library/props/versions/1.0/graphs}/crate.json +3 -3
- package/library/props/versions/1.0/graphs/lineup.json +18 -0
- package/{shelf → library/props/versions/1.0/graphs}/pallet.json +4 -3
- package/{shelf → library/props/versions/1.0/graphs}/pipe_run.json +3 -3
- package/{shelf → library/props/versions/1.0/graphs}/sandbag_wall.json +5 -5
- package/library/props/versions/1.0/props.topo +12 -0
- package/library/props/versions/1.0/version.json +336 -0
- package/{shelf → library/street/versions/1.0/graphs}/bench.json +5 -5
- package/{shelf → library/street/versions/1.0/graphs}/bollard.json +2 -1
- package/{shelf → library/street/versions/1.0/graphs}/cable.json +4 -4
- package/{shelf → library/street/versions/1.0/graphs}/fence.json +7 -7
- package/{shelf → library/street/versions/1.0/graphs}/lamp_post.json +2 -2
- package/library/street/versions/1.0/graphs/lineup.json +22 -0
- package/{shelf → library/street/versions/1.0/graphs}/road_strip.json +2 -2
- package/{shelf → library/street/versions/1.0/graphs}/sign_post.json +1 -1
- package/library/street/versions/1.0/street.topo +12 -0
- package/library/street/versions/1.0/version.json +421 -0
- package/package.json +17 -8
- package/dist/gallery/app/gallery.css +0 -100
- package/dist/gallery/app/gallery.js +0 -80
- package/dist/gallery/cli.d.ts +0 -4
- package/dist/gallery/cli.js +0 -157
- package/dist/gallery/library.d.ts +0 -124
- package/dist/gallery/library.js +0 -366
- package/dist/gallery/pages.d.ts +0 -94
- package/dist/gallery/pages.js +0 -148
- package/dist/gallery/server.d.ts +0 -21
- package/dist/gallery/server.js +0 -391
- package/dist/graph/migrate.d.ts +0 -23
- package/dist/graph/migrate.js +0 -58
- package/dist/mcp/library.d.ts +0 -12
- package/dist/mcp/library.js +0 -159
- package/shelf/index.json +0 -190
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/** a package version: big.small, from 1.0 */
|
|
2
|
+
export declare const VERSION_RE: RegExp;
|
|
3
|
+
/**
|
|
4
|
+
* The command a person runs TopoTopo with, as hints name it: "topotopo" installed, "node src/cli.ts" from a clone. The
|
|
5
|
+
* CLI and the MCP server set it from how they were started.
|
|
6
|
+
*/
|
|
7
|
+
export declare const program: () => string;
|
|
8
|
+
export declare const setProgram: (p: string) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Rename a file or folder into place. On Windows a file watcher, an editor or a virus scanner holding a file in it
|
|
11
|
+
* makes the rename fail for a moment (EPERM, EBUSY, EACCES): it is tried again for about two seconds, and then fails
|
|
12
|
+
* with a plain message.
|
|
13
|
+
*/
|
|
14
|
+
export declare function renameInto(from: string, to: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* Run `f` holding the package's lock, .lock in the folder of its copies (copiesFor: packages/, or the workspace's
|
|
17
|
+
* topotopo-packages/ for a package that shares the workspace's copies), a file only one process can create at a time:
|
|
18
|
+
* the CLI, the MCP server and the viewer read, change and write the manifest, the uses and the lock under it, so that
|
|
19
|
+
* none loses another's change. Waits up to about ten seconds for another holder; a lock older than two minutes, or
|
|
20
|
+
* whose process has ended, is taken over. Held again by the same process (a nested call), it just runs `f`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function withPackageLock<T>(dir: string, f: () => T): T;
|
|
23
|
+
/** Run `f` holding the lock of a store of copies (withPackageLock). */
|
|
24
|
+
export declare function withStoreLock<T>(store: CopyStore, f: () => T): T;
|
|
25
|
+
/** Is the process `pid` running? (A process of another user counts as running.) */
|
|
26
|
+
export declare function processAlive(pid: number): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Take a lock file: a file only one process can create at a time, holding the taker's pid. Waits for its holder, up to
|
|
29
|
+
* `waitMs` (default about ten seconds), then throws with `held()`'s message. A lock whose process has ended, or that
|
|
30
|
+
* this process left, is taken over; one older than two minutes too, unless `pidOnly` (a cook can hold its lock for
|
|
31
|
+
* longer: only an ended process makes it stale). Returns the function that releases it.
|
|
32
|
+
*/
|
|
33
|
+
export declare function takeLock(file: string, o?: {
|
|
34
|
+
pidOnly?: boolean;
|
|
35
|
+
waitMs?: number;
|
|
36
|
+
held?: (pid: number) => string;
|
|
37
|
+
}): () => void;
|
|
38
|
+
export interface PackageLink {
|
|
39
|
+
label: string;
|
|
40
|
+
url: string;
|
|
41
|
+
}
|
|
42
|
+
/** A package's manifest, <id>.topo: the id is the file's name, not a field. */
|
|
43
|
+
export interface PackageManifest {
|
|
44
|
+
title: string;
|
|
45
|
+
description: string;
|
|
46
|
+
tags: string[];
|
|
47
|
+
/** the graph its page shows and bakes */
|
|
48
|
+
graph: string;
|
|
49
|
+
/** what to bake instead of the graph's output: another graph, a node, a frame (simulations settle after frame 1) */
|
|
50
|
+
bake: {
|
|
51
|
+
graph?: string;
|
|
52
|
+
node?: string;
|
|
53
|
+
frame?: number;
|
|
54
|
+
};
|
|
55
|
+
/** links back to the board, concept pages, tickets */
|
|
56
|
+
links: PackageLink[];
|
|
57
|
+
/** ISO date */
|
|
58
|
+
created: string;
|
|
59
|
+
/** the name the package publishes under, "owner/name": set by the author before the first publish, never derived */
|
|
60
|
+
name?: string;
|
|
61
|
+
/** the packages its graphs use, with the version in use: {"owner/name": "1.3"} (written by the tools) */
|
|
62
|
+
uses: Record<string, string>;
|
|
63
|
+
}
|
|
64
|
+
export declare const slugify: (s: string) => string;
|
|
65
|
+
/** "owner/name": a package name (no output). */
|
|
66
|
+
export declare const isPackageName: (s: string) => boolean;
|
|
67
|
+
/**
|
|
68
|
+
* A "uses" map checked ({"owner/name": "1.3"}), sorted by name; throws naming the entry that is wrong (`where`: the file
|
|
69
|
+
* it is in, when it is not the manifest).
|
|
70
|
+
*/
|
|
71
|
+
export declare function parseUses(v: unknown, where?: string): Record<string, string>;
|
|
72
|
+
/**
|
|
73
|
+
* A manifest checked and normalised; throws naming the problem. `id`: the package id, its file's name (the default
|
|
74
|
+
* title); `dir`: the package's folder, when the manifest is read from one (what a manifest that still lists
|
|
75
|
+
* "libraries" is told depends on where it is).
|
|
76
|
+
*/
|
|
77
|
+
export declare function parseManifest(raw: any, id: string, dir?: string): PackageManifest;
|
|
78
|
+
/**
|
|
79
|
+
* The manifest of the package whose folder is `dir`: its file and the package id, the file's name; null for a folder
|
|
80
|
+
* that holds no .topo file (one that holds project.json instead is none either: oldManifest says what to do). Throws
|
|
81
|
+
* for a folder with more than one, naming them, and for a file name that is no package id.
|
|
82
|
+
*/
|
|
83
|
+
export declare function manifestAt(dir: string): {
|
|
84
|
+
file: string;
|
|
85
|
+
id: string;
|
|
86
|
+
} | null;
|
|
87
|
+
/**
|
|
88
|
+
* What a folder that holds project.json and no .topo file is told: a package's manifest is <id>.topo, named after the
|
|
89
|
+
* id it had (else after the folder). null for any other folder.
|
|
90
|
+
*/
|
|
91
|
+
export declare function oldManifest(dir: string): string | null;
|
|
92
|
+
/** oldManifest for the nearest folder at or above `start` it speaks of, as the end of a message ("; …"); '' for none. */
|
|
93
|
+
export declare function oldManifestAbove(start: string): string;
|
|
94
|
+
/** A package folder's manifest file, <id>.topo; throws for a folder that is no package. */
|
|
95
|
+
export declare const manifestFile: (dir: string) => string;
|
|
96
|
+
/** A package folder's id, the name of its .topo file; throws for a folder that is no package. */
|
|
97
|
+
export declare const packageId: (dir: string) => string;
|
|
98
|
+
export declare function readManifest(dir: string): PackageManifest;
|
|
99
|
+
/** A manifest file read and checked (`id`: its name, the package id); throws naming the file. */
|
|
100
|
+
export declare function readManifestFile(file: string, id: string): PackageManifest;
|
|
101
|
+
/**
|
|
102
|
+
* Write a manifest (atomically), keeping keys of the file this version does not know: the folder's .topo file, or a new
|
|
103
|
+
* <id>.topo in a folder that holds none.
|
|
104
|
+
*/
|
|
105
|
+
export declare function writeManifest(dir: string, m: PackageManifest, id?: string): void;
|
|
106
|
+
/** Written as a dot-file next to the target and renamed, so readers never see half a file. */
|
|
107
|
+
export declare function writeAtomic(file: string, data: string | Uint8Array): void;
|
|
108
|
+
/**
|
|
109
|
+
* The package a folder belongs to: the folder itself, or the nearest one above, that holds a .topo file (manifestAt);
|
|
110
|
+
* null for none. Throws for a folder on the way that holds several.
|
|
111
|
+
*/
|
|
112
|
+
export declare function packageDirOf(start: string): string | null;
|
|
113
|
+
/** A package's .gitignore and .gitattributes, made or completed. */
|
|
114
|
+
export declare function packageRepoFiles(dir: string): void;
|
|
115
|
+
/** A workspace's .gitignore and .gitattributes, made or completed: its shared copies as a package's own are kept. */
|
|
116
|
+
export declare function workspaceRepoFiles(dir: string): void;
|
|
117
|
+
/**
|
|
118
|
+
* A package name a person gives their package ("owner/name"): checked, and the owner "topotopo", which TopoTopo's own
|
|
119
|
+
* packages have, refused.
|
|
120
|
+
*/
|
|
121
|
+
export declare function ownPackageName(pkg: string): string;
|
|
122
|
+
/**
|
|
123
|
+
* Make a folder a package (`topotopo init`), in a workspace, a library or anywhere: <id>.topo (the id and title from the
|
|
124
|
+
* folder's name, or from `title`; the graph it shows; and the name it publishes under, `name`, "owner/name"), graphs/
|
|
125
|
+
* with a starter graph when it holds none (so that
|
|
126
|
+
* the graph the manifest shows is there: graphs/main.json, a box), a .gitignore for the derived files and a
|
|
127
|
+
* .gitattributes that keeps its versions and package copies byte for byte (both completed when they exist). In a folder
|
|
128
|
+
* that is a package already, `name` sets the name it publishes under (when it has none yet); without it, that is an
|
|
129
|
+
* error. Fails for a folder inside another package, and for one that holds project.json (oldManifest).
|
|
130
|
+
*/
|
|
131
|
+
export declare function initPackage(dir: string, o?: {
|
|
132
|
+
name?: string;
|
|
133
|
+
title?: string;
|
|
134
|
+
}): {
|
|
135
|
+
dir: string;
|
|
136
|
+
id: string;
|
|
137
|
+
manifest: PackageManifest;
|
|
138
|
+
said: string;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* What a folder holds that TopoTopo does not make itself (its folders graphs/, assets/, exports/, inputs/), by name,
|
|
142
|
+
* a folder's with a slash: none for a folder that holds nothing else, nothing at all, or does not exist yet. Files an
|
|
143
|
+
* operating system leaves in folders do not count.
|
|
144
|
+
*/
|
|
145
|
+
export declare function notPackageFiles(dir: string): string[];
|
|
146
|
+
/** Where the MCP server works, and what it says about it (startPackage). */
|
|
147
|
+
export interface PackageStart {
|
|
148
|
+
/** the folder to work in: the one given, or the root of the package it lies in */
|
|
149
|
+
dir: string;
|
|
150
|
+
/** what happened, for the server's log */
|
|
151
|
+
log: string;
|
|
152
|
+
/** what its first tool reply tells the agent (null: nothing to tell) */
|
|
153
|
+
note: string | null;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The MCP server's rule for its folder when it starts, named or not (scripts/preview.ts applies it too). A folder in
|
|
157
|
+
* a package works in that package's root, which holds its graphs, assets and packages. A folder in no package that holds
|
|
158
|
+
* nothing but what TopoTopo makes itself (graphs/, assets/, exports/, inputs/), or nothing at all, becomes a package
|
|
159
|
+
* (initPackage; `title`: its title and id, else the folder's name), so that its graphs use packages, TopoTopo's own
|
|
160
|
+
* among them, as they come. A folder with anything else in it (a repository, a folder of the person's) stays as it is:
|
|
161
|
+
* workspace {action:"init"} makes it a package when the person says so.
|
|
162
|
+
*/
|
|
163
|
+
export declare function startPackage(dir: string, o?: {
|
|
164
|
+
title?: string;
|
|
165
|
+
}): PackageStart;
|
|
166
|
+
/** The file at a game's root that makes it a workspace: the libraries every package inside it looks in. */
|
|
167
|
+
export declare const WORKSPACE_FILE = "topotopo-workspace.json";
|
|
168
|
+
/** A library's own file: its name, the same whatever path or registered name reaches the library. */
|
|
169
|
+
export declare const LIBRARY_FILE = "library.json";
|
|
170
|
+
export interface Located {
|
|
171
|
+
/** the package the folder belongs to (itself or the nearest folder above with a .topo file) */
|
|
172
|
+
package: string | null;
|
|
173
|
+
/**
|
|
174
|
+
* the workspace around it: the nearest folder at or above the package (or the folder) with topotopo-workspace.json,
|
|
175
|
+
* when the workspace's scan reaches the package (src/scan.ts); else null
|
|
176
|
+
*/
|
|
177
|
+
workspace: string | null;
|
|
178
|
+
/** the workspace above whose scan does not reach the package (another engine project on the way, say), and why */
|
|
179
|
+
outside?: {
|
|
180
|
+
workspace: string;
|
|
181
|
+
why: string;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Where a folder sits: the package it belongs to and the workspace (the game) around it. A package is the workspace's
|
|
186
|
+
* when the workspace's scan finds it: one the scan never reaches (in another engine project inside the workspace, a dot
|
|
187
|
+
* folder, deeper than the scan looks) is in no workspace, and keeps its own copies.
|
|
188
|
+
*/
|
|
189
|
+
export declare function locate(start: string): Located;
|
|
190
|
+
/** A library's own name (library.json "name"), or null when it has none. */
|
|
191
|
+
export declare function libraryName(root: string): string | null;
|
|
192
|
+
/**
|
|
193
|
+
* A place a package finds packages in, besides TopoTopo's built-in library (librariesFor). `from`: "self", the workspace
|
|
194
|
+
* the package is in, or outside a workspace the library it is in (scanned from the package's own checkout); "listed",
|
|
195
|
+
* a shared library the workspace's file lists; "registered", outside a workspace, a library registered on this machine.
|
|
196
|
+
*/
|
|
197
|
+
export interface LibraryAt {
|
|
198
|
+
from: 'self' | 'listed' | 'registered';
|
|
199
|
+
/** what names it: the workspace file's entry, a registered name, or the workspace's or library's own name */
|
|
200
|
+
entry: string;
|
|
201
|
+
root: string;
|
|
202
|
+
/** the workspace's name, a registered name, a library's own name (library.json), else the entry */
|
|
203
|
+
name: string;
|
|
204
|
+
/** a workspace (from "self"), not a library */
|
|
205
|
+
workspace?: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* found by its folder (the workspace, a library.json above the package, a path in the workspace file), not by a
|
|
208
|
+
* registered name: the lock records it by its path from the folder of the copies
|
|
209
|
+
*/
|
|
210
|
+
byPath: boolean;
|
|
211
|
+
}
|
|
212
|
+
/** The places a package finds packages in, in order, and what is wrong with the entries that do not work (the others still do). */
|
|
213
|
+
export interface Libraries {
|
|
214
|
+
libs: LibraryAt[];
|
|
215
|
+
problems: string[];
|
|
216
|
+
/** the workspace around the folder, or null */
|
|
217
|
+
workspace: string | null;
|
|
218
|
+
/** the workspace, or the library the folder is in, when it is the first place */
|
|
219
|
+
self: LibraryAt | null;
|
|
220
|
+
}
|
|
221
|
+
/** A place as messages name it: the workspace "my-game", library "props". */
|
|
222
|
+
export declare const placeText: (l: Pick<LibraryAt, 'name' | 'workspace'>) => string;
|
|
223
|
+
/** TopoTopo's built-in library as messages name it. */
|
|
224
|
+
export declare const BUILTIN_TEXT = "TopoTopo's built-in library";
|
|
225
|
+
/** `inner` is `outer` or a folder inside it. */
|
|
226
|
+
export declare const within: (inner: string, outer: string) => boolean;
|
|
227
|
+
/**
|
|
228
|
+
* What a `workspace library` command a hint names needs to act on the workspace `ws`: " --workspace <folder>" (its path
|
|
229
|
+
* from `cwd`) when `cwd` is outside it, for the command acts on the workspace around the current folder; else ''.
|
|
230
|
+
*/
|
|
231
|
+
export declare function workspaceFlag(ws: string, cwd?: string): string;
|
|
232
|
+
/**
|
|
233
|
+
* What an entry of a workspace's "libraries" names: a registered library's name ("props"), or a path written from the
|
|
234
|
+
* workspace, "../shared/props" (a library in the same repository, so every checkout and worktree reads its own).
|
|
235
|
+
* Anything else says how to write it.
|
|
236
|
+
*/
|
|
237
|
+
export declare function libraryEntry(entry: string): {
|
|
238
|
+
path: string;
|
|
239
|
+
} | {
|
|
240
|
+
name: string;
|
|
241
|
+
} | {
|
|
242
|
+
error: string;
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* The places a folder's package finds packages in, in order (TopoTopo's built-in library comes after them, and only it
|
|
246
|
+
* has the packages named "topotopo/…"):
|
|
247
|
+
* in a workspace: the workspace itself (its scan), then the shared libraries its file lists, in order;
|
|
248
|
+
* outside a workspace, in a library (a registered library's root at or above the folder, or a library.json): that
|
|
249
|
+
* library, scanned from the package's own checkout so its siblings come from the same worktree, then every other
|
|
250
|
+
* registered library;
|
|
251
|
+
* outside both: every registered library.
|
|
252
|
+
* A workspace file that cannot be read is a problem, and only the built-in library is looked in until it is fixed.
|
|
253
|
+
*/
|
|
254
|
+
export declare function librariesFor(start: string): Libraries;
|
|
255
|
+
/**
|
|
256
|
+
* The shared libraries a workspace's file lists, in order, each once; what is wrong with an entry is a problem and the
|
|
257
|
+
* others still count: a name not registered on this machine, a folder that is not there, a package's folder, an entry
|
|
258
|
+
* of neither form, a library inside the workspace (its packages are found by themselves) or holding it. TopoTopo's
|
|
259
|
+
* built-in library is none of them (listing it changes nothing).
|
|
260
|
+
*/
|
|
261
|
+
export declare function resolveListed(ws: string, entries: string[]): {
|
|
262
|
+
libs: LibraryAt[];
|
|
263
|
+
problems: string[];
|
|
264
|
+
};
|
|
265
|
+
/** The folder beside topotopo-workspace.json that holds the workspace's one shared copy of each package version. */
|
|
266
|
+
export declare const WORKSPACE_PACKAGES = "topotopo-packages";
|
|
267
|
+
/** Where a package keeps the copies of the packages it uses, and the file whose "uses" names the versions in use. */
|
|
268
|
+
export interface CopyStore {
|
|
269
|
+
/** the folder the store belongs to: the package's, or the workspace's */
|
|
270
|
+
root: string;
|
|
271
|
+
/** the folder of the copies (<owner>/<name>/<version>/, flat) and their lock.json */
|
|
272
|
+
packages: string;
|
|
273
|
+
/** the file whose "uses" lists the versions in use: the package's manifest, or the workspace's file */
|
|
274
|
+
usesFile: string;
|
|
275
|
+
/** the workspace whose one shared copy this is, or null: the package's own copies */
|
|
276
|
+
workspace: string | null;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Where a package keeps the copies of the packages it uses: in a workspace, the workspace's one shared copy for every package in it
|
|
280
|
+
* (topotopo-packages/ beside topotopo-workspace.json, whose "uses" name one version of each package for the whole
|
|
281
|
+
* game); else, and for a package that publishes versions (its uses are published with it), its own packages/ beside its
|
|
282
|
+
* manifest.
|
|
283
|
+
*/
|
|
284
|
+
export declare function copiesFor(folder: string): CopyStore;
|
|
285
|
+
/** The versions the packages of a store use: the "uses" of the package's manifest, or of the workspace's file. */
|
|
286
|
+
export declare function readUses(store: CopyStore): Record<string, string>;
|
|
287
|
+
/** Write the uses of a store (hold its lock: withStoreLock). */
|
|
288
|
+
export declare function writeUses(store: CopyStore, uses: Record<string, string>): void;
|