omkit 0.8.1 → 0.8.2
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/CHANGELOG.md +14 -0
- package/dist/core/ExecutionTree.d.ts +8 -2
- package/dist/core/ExecutionTree.js +8 -2
- package/dist/foundation/ids.d.ts +12 -0
- package/dist/foundation/ids.js +22 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -46,6 +46,20 @@
|
|
|
46
46
|
|
|
47
47
|
### Fixed
|
|
48
48
|
|
|
49
|
+
- **`typescript` moved from `devDependencies` to `dependencies`.** Three shipped modules import
|
|
50
|
+
it at runtime, and one of them — discovery — runs on every command, so an install that did not
|
|
51
|
+
already happen to have TypeScript nearby failed with `ERR_MODULE_NOT_FOUND` on `omkit ls`. It
|
|
52
|
+
went unnoticed because a monorepo hoists it into place.
|
|
53
|
+
- **A node's log file no longer spells its name out as directories.** A node's id is
|
|
54
|
+
`<name>_<shortId>`, ids are joined with `/` into node paths, and those paths become log file
|
|
55
|
+
paths — so a name carrying its own separators was read as tree nesting. A `command` node is
|
|
56
|
+
named after its whole command line, and one watcher's log ended up nine directories deep, with
|
|
57
|
+
`docs`, `packages` and `tskb` as real folders inside the run. Names are now sanitised where the
|
|
58
|
+
id is made, which is the only place the two kinds of separator are still distinguishable, and
|
|
59
|
+
the name's contribution to an id is capped so a long command line cannot push a log path past
|
|
60
|
+
Windows' 260-character limit. Displayed names are untouched: nodes are shown by name, never by
|
|
61
|
+
id.
|
|
62
|
+
|
|
49
63
|
- **One project, one `logs/` tree.** A run's record now lands under the project that owns the
|
|
50
64
|
config, wherever the run was started from. It used to follow the working directory, and the
|
|
51
65
|
frontends chose different ones: `omkit run` set it to the om file's own directory, so a project
|
|
@@ -124,8 +124,14 @@ export declare class ExecutionTree {
|
|
|
124
124
|
private curatedArtifacts;
|
|
125
125
|
/**
|
|
126
126
|
* Absolute `.log` path for a node — root is `main.log`, children drop the `main/`
|
|
127
|
-
* prefix.
|
|
128
|
-
*
|
|
127
|
+
* prefix. One directory level per ancestor, mirroring the tree.
|
|
128
|
+
*
|
|
129
|
+
* Every `/` here is a level, and that holds only because ids are sanitised where they are
|
|
130
|
+
* made (see `makeId`): a name that carried its own separators would be split here into
|
|
131
|
+
* levels it never had, and the run folder would grow directories spelling out a command's
|
|
132
|
+
* arguments. `fsSafe` stays as the second line of defence for anything that reaches a
|
|
133
|
+
* segment by another route; it cannot be the first, since by this point a separator from a
|
|
134
|
+
* name and a separator from the tree are the same character.
|
|
129
135
|
*/
|
|
130
136
|
private logFile;
|
|
131
137
|
private rawStreamPath;
|
|
@@ -418,8 +418,14 @@ export class ExecutionTree {
|
|
|
418
418
|
}
|
|
419
419
|
/**
|
|
420
420
|
* Absolute `.log` path for a node — root is `main.log`, children drop the `main/`
|
|
421
|
-
* prefix.
|
|
422
|
-
*
|
|
421
|
+
* prefix. One directory level per ancestor, mirroring the tree.
|
|
422
|
+
*
|
|
423
|
+
* Every `/` here is a level, and that holds only because ids are sanitised where they are
|
|
424
|
+
* made (see `makeId`): a name that carried its own separators would be split here into
|
|
425
|
+
* levels it never had, and the run folder would grow directories spelling out a command's
|
|
426
|
+
* arguments. `fsSafe` stays as the second line of defence for anything that reaches a
|
|
427
|
+
* segment by another route; it cannot be the first, since by this point a separator from a
|
|
428
|
+
* name and a separator from the tree are the same character.
|
|
423
429
|
*/
|
|
424
430
|
logFile(nodePath) {
|
|
425
431
|
const rel = nodePath === "main" ? "main" : nodePath.slice("main/".length);
|
package/dist/foundation/ids.d.ts
CHANGED
|
@@ -5,6 +5,18 @@ export declare const shortId: (uuid: string) => string;
|
|
|
5
5
|
/**
|
|
6
6
|
* A node's id: `${name}_${shortId}` → `chromePage_9f3c`. The root passes its own
|
|
7
7
|
* plain name (`main`) and skips this.
|
|
8
|
+
*
|
|
9
|
+
* The name is sanitised **here**, at the point the id is made, because an id is a path
|
|
10
|
+
* segment everywhere it is used: node paths join ids with `/`, and log file names are those
|
|
11
|
+
* paths mapped onto directories. A name carrying its own separators — `command("npx tsk
|
|
12
|
+
* ./docs/**\/*.tsx …")` is an ordinary one — is then indistinguishable from tree nesting, and
|
|
13
|
+
* one action's log went nine directories deep, spelling out the command's path arguments as
|
|
14
|
+
* real folders. Sanitising downstream cannot fix that: by the time a joined path is split
|
|
15
|
+
* back into segments, the separator that came from a name and the one that came from the tree
|
|
16
|
+
* are the same character.
|
|
17
|
+
*
|
|
18
|
+
* Uniqueness never depended on the name — that is the uuid's job — so truncating is safe and
|
|
19
|
+
* the readable form survives anyway: nodes are displayed by their `name`, not by their id.
|
|
8
20
|
*/
|
|
9
21
|
export declare const makeId: (name: string, uuid: string) => string;
|
|
10
22
|
/**
|
package/dist/foundation/ids.js
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import { fsSafe } from "./fsSafe.js";
|
|
2
3
|
/** A fresh v4 uuid for a node. */
|
|
3
4
|
export const newUuid = () => randomUUID();
|
|
4
5
|
/** The short form used in ids/paths — first 8 hex of the uuid. */
|
|
5
6
|
export const shortId = (uuid) => uuid.slice(0, 8);
|
|
7
|
+
/**
|
|
8
|
+
* How much of a name an id keeps. A node's name is free text and can be long — a `command`
|
|
9
|
+
* node is named after its whole command line — while the id it seeds ends up inside a file
|
|
10
|
+
* path, where Windows still stops at 260 characters for the whole path.
|
|
11
|
+
*/
|
|
12
|
+
const MAX_NAME_IN_ID = 64;
|
|
6
13
|
/**
|
|
7
14
|
* A node's id: `${name}_${shortId}` → `chromePage_9f3c`. The root passes its own
|
|
8
15
|
* plain name (`main`) and skips this.
|
|
16
|
+
*
|
|
17
|
+
* The name is sanitised **here**, at the point the id is made, because an id is a path
|
|
18
|
+
* segment everywhere it is used: node paths join ids with `/`, and log file names are those
|
|
19
|
+
* paths mapped onto directories. A name carrying its own separators — `command("npx tsk
|
|
20
|
+
* ./docs/**\/*.tsx …")` is an ordinary one — is then indistinguishable from tree nesting, and
|
|
21
|
+
* one action's log went nine directories deep, spelling out the command's path arguments as
|
|
22
|
+
* real folders. Sanitising downstream cannot fix that: by the time a joined path is split
|
|
23
|
+
* back into segments, the separator that came from a name and the one that came from the tree
|
|
24
|
+
* are the same character.
|
|
25
|
+
*
|
|
26
|
+
* Uniqueness never depended on the name — that is the uuid's job — so truncating is safe and
|
|
27
|
+
* the readable form survives anyway: nodes are displayed by their `name`, not by their id.
|
|
9
28
|
*/
|
|
10
|
-
export const makeId = (name, uuid) => `${name}_${shortId(uuid)}`;
|
|
29
|
+
export const makeId = (name, uuid) => `${clip(fsSafe(name))}_${shortId(uuid)}`;
|
|
30
|
+
/** Trim to the cap, then drop any separator the cut left dangling. */
|
|
31
|
+
const clip = (name) => name.slice(0, MAX_NAME_IN_ID).replace(/[-_.]+$/, "");
|
|
11
32
|
/**
|
|
12
33
|
* A run's stable identity: first 8 hex of sha256 over the defining file's absolute
|
|
13
34
|
* path + the om name. Same file + name ⇒ same hash on every run; the same name
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omkit",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "A tiny runtime for developer workflows: typed actions that pass runtime capabilities and emit typed events, under one run and one shared log. The operational/runtime layer to tskb's knowledge layer.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"playwright-core": "^1.49.0",
|
|
60
60
|
"react": "^19.2.8",
|
|
61
61
|
"tsx": "4.23.1",
|
|
62
|
+
"typescript": "^5.9.3",
|
|
62
63
|
"zod": "^4.4.3",
|
|
63
64
|
"zx": "^8.8.5"
|
|
64
65
|
},
|
|
@@ -66,7 +67,6 @@
|
|
|
66
67
|
"@types/node": "^24",
|
|
67
68
|
"@types/react": "^19.2.17",
|
|
68
69
|
"ink-testing-library": "^4.0.0",
|
|
69
|
-
"rimraf": "^6.0.1"
|
|
70
|
-
"typescript": "^5.9.3"
|
|
70
|
+
"rimraf": "^6.0.1"
|
|
71
71
|
}
|
|
72
72
|
}
|