@hop-top/kit 0.4.0-alpha.2 → 0.5.0-alpha.1
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 +22 -0
- package/README.md +4 -2
- package/dist/cli.js +69 -9
- package/dist/id/index.d.ts +1 -1
- package/dist/tui/index.js +69 -9
- package/package.json +48 -26
- package/src/id/index.ts +1 -1
- package/src/tui/parity.json +74 -0
- package/src/tui/parity.test.ts +53 -0
- package/src/tui/parity.ts +7 -12
- package/src/uri.ts +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,28 @@ All notable changes to `@hop-top/kit` are documented in this file.
|
|
|
4
4
|
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/);
|
|
5
5
|
versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.5.0-alpha.1](https://github.com/hop-top/poly-kit/compare/kit-ts/v0.5.0-alpha.0...kit-ts/v0.5.0-alpha.1) (2026-07-14)
|
|
8
|
+
|
|
9
|
+
The hop-top team is happy to announce Kit's TS SDK 0.5.0-alpha.1. This release includes maintenance release with bug fixes.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **ts:** ESM export conditions + self-contained parity data
|
|
15
|
+
|
|
16
|
+
Full diff: [kit-ts/v0.5.0-alpha.0...kit-ts/v0.5.0-alpha.1](https://github.com/hop-top/poly-kit/compare/kit-ts/v0.5.0-alpha.0...kit-ts/v0.5.0-alpha.1)
|
|
17
|
+
|
|
18
|
+
## [0.5.0-alpha.0](https://github.com/hop-top/poly-kit/compare/kit-ts/v0.4.0-alpha.2...kit-ts/v0.5.0-alpha.0) (2026-06-07)
|
|
19
|
+
|
|
20
|
+
The hop-top team is happy to announce Kit's TS SDK 0.5.0-alpha.0. This release includes miscellaneous improvements.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Refactored
|
|
24
|
+
|
|
25
|
+
* migrate uri+hdl to cite across Go/TS/Py/Rs/PHP
|
|
26
|
+
|
|
27
|
+
Full diff: [kit-ts/v0.4.0-alpha.2...kit-ts/v0.5.0-alpha.0](https://github.com/hop-top/poly-kit/compare/kit-ts/v0.4.0-alpha.2...kit-ts/v0.5.0-alpha.0)
|
|
28
|
+
|
|
7
29
|
## [0.4.0-alpha.2](https://github.com/hop-top/poly-kit/compare/kit-ts/v0.4.0-alpha.1...kit-ts/v0.4.0-alpha.2) (2026-06-03)
|
|
8
30
|
|
|
9
31
|
The hop-top team is happy to announce Kit's TS SDK 0.4.0-alpha.2. This release includes new features.
|
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@ render(process.stdout, JSON_FORMAT, { ok: true });
|
|
|
147
147
|
- `@hop-top/kit/upgrade` — semver upgrade detection.
|
|
148
148
|
- `@hop-top/kit/llm` / `routellm` — LLM client + routing helpers.
|
|
149
149
|
- `@hop-top/kit/alias` — alias resolution + completion.
|
|
150
|
-
- `@hop-top/kit/uri` — thin facade over `@hop-top/
|
|
150
|
+
- `@hop-top/kit/uri` — thin facade over `@hop-top/cite` for URI parsing,
|
|
151
151
|
action resolution, completions, registries, and OS handler metadata.
|
|
152
152
|
- `@hop-top/kit/tui` — TUI toolkit (parity, anim, prompts).
|
|
153
153
|
|
|
@@ -155,7 +155,7 @@ See package.json `exports` for the full list.
|
|
|
155
155
|
|
|
156
156
|
## URI facade
|
|
157
157
|
|
|
158
|
-
The URI module delegates to `@hop-top/
|
|
158
|
+
The URI module delegates to `@hop-top/cite`; it does not reimplement the URI
|
|
159
159
|
contract. It mirrors the kit Go URI command intent for SDK consumers:
|
|
160
160
|
|
|
161
161
|
```ts
|
|
@@ -280,3 +280,5 @@ landed; TS-side wiring is deferred until the directory exists.
|
|
|
280
280
|
## License
|
|
281
281
|
|
|
282
282
|
MIT.
|
|
283
|
+
|
|
284
|
+
<!-- release: track @hop-top/cite ^0.1.0 -->
|
package/dist/cli.js
CHANGED
|
@@ -51,16 +51,76 @@ __export(cli_exports, {
|
|
|
51
51
|
module.exports = __toCommonJS(cli_exports);
|
|
52
52
|
var import_commander = require("commander");
|
|
53
53
|
|
|
54
|
+
// src/tui/parity.json
|
|
55
|
+
var parity_default = {
|
|
56
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
57
|
+
$id: "https://hop.top/kit/go/console/tui/parity.json",
|
|
58
|
+
description: "Cross-language TUI parity constants. All language implementations MUST load values from here.",
|
|
59
|
+
status: {
|
|
60
|
+
description: "Prefix symbols for status lines. Mirrors Go's InfoType constants in tui/status.go.",
|
|
61
|
+
symbols: {
|
|
62
|
+
info: "\u2139",
|
|
63
|
+
success: "\u2713",
|
|
64
|
+
error: "\u25CF",
|
|
65
|
+
warn: "\u25B2"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
spinner: {
|
|
69
|
+
description: "Braille dot spinner frames and timing.",
|
|
70
|
+
frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"],
|
|
71
|
+
interval_ms: 80
|
|
72
|
+
},
|
|
73
|
+
anim: {
|
|
74
|
+
description: "Gradient character-scramble animation constants.",
|
|
75
|
+
runes: "0123456789abcdefABCDEF~!@#$%^&*()+=_",
|
|
76
|
+
interval_ms: 100,
|
|
77
|
+
default_width: 10
|
|
78
|
+
},
|
|
79
|
+
help: {
|
|
80
|
+
description: "Root --help layout contract. Fang is canonical; TS and Python mirror it.",
|
|
81
|
+
section_order: ["commands", "flags"],
|
|
82
|
+
sections: {
|
|
83
|
+
usage: { title: "USAGE" },
|
|
84
|
+
commands: { title: "COMMANDS" },
|
|
85
|
+
flags: { title: "FLAGS" },
|
|
86
|
+
"global flags": { title: "GLOBAL FLAGS" },
|
|
87
|
+
arguments: { title: "ARGUMENTS" },
|
|
88
|
+
aliases: { title: "ALIASES" },
|
|
89
|
+
examples: { title: "EXAMPLES" },
|
|
90
|
+
streams: { title: "STREAMS" }
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
verbosity: {
|
|
94
|
+
description: "Stackable -V flag maps count to log level. --quiet overrides to warn.",
|
|
95
|
+
flag: "-V",
|
|
96
|
+
levels: {
|
|
97
|
+
"0": "info",
|
|
98
|
+
"1": "debug",
|
|
99
|
+
"2": "trace"
|
|
100
|
+
},
|
|
101
|
+
quiet_override: "warn"
|
|
102
|
+
},
|
|
103
|
+
streams: {
|
|
104
|
+
description: "Per-command named output streams toggled via --stream flag.",
|
|
105
|
+
flag: "--stream",
|
|
106
|
+
label_format: "[{name}]",
|
|
107
|
+
output: "stderr"
|
|
108
|
+
},
|
|
109
|
+
table: {
|
|
110
|
+
description: "Styled-table contract for the output package. Plain tabwriter is the default; callers opt in to the lipgloss-backed renderer via WithTableStyle. The styled path is gated on writer-is-TTY so non-TTY writers (pipes, files, tests) always emit ANSI-free, diff-friendly output.",
|
|
111
|
+
render_option: "WithTableStyle",
|
|
112
|
+
tty_only: true,
|
|
113
|
+
row_emphasis_kinds: ["none", "primary", "secondary", "muted"],
|
|
114
|
+
row_emphasis_option: "RowEmphasis",
|
|
115
|
+
border_default: "normal"
|
|
116
|
+
},
|
|
117
|
+
extends: [
|
|
118
|
+
"scope-defaults.json"
|
|
119
|
+
]
|
|
120
|
+
};
|
|
121
|
+
|
|
54
122
|
// src/tui/parity.ts
|
|
55
|
-
var
|
|
56
|
-
var import_node_path = require("path");
|
|
57
|
-
var _candidates = [
|
|
58
|
-
(0, import_node_path.resolve)(__dirname, "..", "..", "..", "..", "contracts", "parity", "parity.json"),
|
|
59
|
-
(0, import_node_path.resolve)(__dirname, "..", "..", "..", "..", "..", "contracts", "parity", "parity.json"),
|
|
60
|
-
(0, import_node_path.resolve)(process.cwd(), "contracts", "parity", "parity.json")
|
|
61
|
-
];
|
|
62
|
-
var _path = _candidates.find((path) => (0, import_node_fs.existsSync)(path)) ?? _candidates[0];
|
|
63
|
-
var parity = JSON.parse((0, import_node_fs.readFileSync)(_path, "utf8"));
|
|
123
|
+
var parity = parity_default;
|
|
64
124
|
|
|
65
125
|
// src/output/registry.ts
|
|
66
126
|
var Registry = class {
|
package/dist/id/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { z } from 'zod';
|
|
|
13
13
|
* the runtime guarantees provided by `typeid-js`.
|
|
14
14
|
*
|
|
15
15
|
* URI composition (e.g. `tlc://task/task_…`) is NOT in this module —
|
|
16
|
-
* callers should use the `@hop-top/
|
|
16
|
+
* callers should use the `@hop-top/cite` package directly. This
|
|
17
17
|
* keeps `kit/id` free of any transitive dependency on the URI
|
|
18
18
|
* registry, per the ADR's scope boundary.
|
|
19
19
|
*/
|
package/dist/tui/index.js
CHANGED
|
@@ -52,16 +52,76 @@ function hexToRgb(hex) {
|
|
|
52
52
|
];
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
// src/tui/parity.json
|
|
56
|
+
var parity_default = {
|
|
57
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
58
|
+
$id: "https://hop.top/kit/go/console/tui/parity.json",
|
|
59
|
+
description: "Cross-language TUI parity constants. All language implementations MUST load values from here.",
|
|
60
|
+
status: {
|
|
61
|
+
description: "Prefix symbols for status lines. Mirrors Go's InfoType constants in tui/status.go.",
|
|
62
|
+
symbols: {
|
|
63
|
+
info: "\u2139",
|
|
64
|
+
success: "\u2713",
|
|
65
|
+
error: "\u25CF",
|
|
66
|
+
warn: "\u25B2"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
spinner: {
|
|
70
|
+
description: "Braille dot spinner frames and timing.",
|
|
71
|
+
frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"],
|
|
72
|
+
interval_ms: 80
|
|
73
|
+
},
|
|
74
|
+
anim: {
|
|
75
|
+
description: "Gradient character-scramble animation constants.",
|
|
76
|
+
runes: "0123456789abcdefABCDEF~!@#$%^&*()+=_",
|
|
77
|
+
interval_ms: 100,
|
|
78
|
+
default_width: 10
|
|
79
|
+
},
|
|
80
|
+
help: {
|
|
81
|
+
description: "Root --help layout contract. Fang is canonical; TS and Python mirror it.",
|
|
82
|
+
section_order: ["commands", "flags"],
|
|
83
|
+
sections: {
|
|
84
|
+
usage: { title: "USAGE" },
|
|
85
|
+
commands: { title: "COMMANDS" },
|
|
86
|
+
flags: { title: "FLAGS" },
|
|
87
|
+
"global flags": { title: "GLOBAL FLAGS" },
|
|
88
|
+
arguments: { title: "ARGUMENTS" },
|
|
89
|
+
aliases: { title: "ALIASES" },
|
|
90
|
+
examples: { title: "EXAMPLES" },
|
|
91
|
+
streams: { title: "STREAMS" }
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
verbosity: {
|
|
95
|
+
description: "Stackable -V flag maps count to log level. --quiet overrides to warn.",
|
|
96
|
+
flag: "-V",
|
|
97
|
+
levels: {
|
|
98
|
+
"0": "info",
|
|
99
|
+
"1": "debug",
|
|
100
|
+
"2": "trace"
|
|
101
|
+
},
|
|
102
|
+
quiet_override: "warn"
|
|
103
|
+
},
|
|
104
|
+
streams: {
|
|
105
|
+
description: "Per-command named output streams toggled via --stream flag.",
|
|
106
|
+
flag: "--stream",
|
|
107
|
+
label_format: "[{name}]",
|
|
108
|
+
output: "stderr"
|
|
109
|
+
},
|
|
110
|
+
table: {
|
|
111
|
+
description: "Styled-table contract for the output package. Plain tabwriter is the default; callers opt in to the lipgloss-backed renderer via WithTableStyle. The styled path is gated on writer-is-TTY so non-TTY writers (pipes, files, tests) always emit ANSI-free, diff-friendly output.",
|
|
112
|
+
render_option: "WithTableStyle",
|
|
113
|
+
tty_only: true,
|
|
114
|
+
row_emphasis_kinds: ["none", "primary", "secondary", "muted"],
|
|
115
|
+
row_emphasis_option: "RowEmphasis",
|
|
116
|
+
border_default: "normal"
|
|
117
|
+
},
|
|
118
|
+
extends: [
|
|
119
|
+
"scope-defaults.json"
|
|
120
|
+
]
|
|
121
|
+
};
|
|
122
|
+
|
|
55
123
|
// src/tui/parity.ts
|
|
56
|
-
var
|
|
57
|
-
var import_node_path = require("path");
|
|
58
|
-
var _candidates = [
|
|
59
|
-
(0, import_node_path.resolve)(__dirname, "..", "..", "..", "..", "contracts", "parity", "parity.json"),
|
|
60
|
-
(0, import_node_path.resolve)(__dirname, "..", "..", "..", "..", "..", "contracts", "parity", "parity.json"),
|
|
61
|
-
(0, import_node_path.resolve)(process.cwd(), "contracts", "parity", "parity.json")
|
|
62
|
-
];
|
|
63
|
-
var _path = _candidates.find((path) => (0, import_node_fs.existsSync)(path)) ?? _candidates[0];
|
|
64
|
-
var parity = JSON.parse((0, import_node_fs.readFileSync)(_path, "utf8"));
|
|
124
|
+
var parity = parity_default;
|
|
65
125
|
|
|
66
126
|
// src/tui/status.ts
|
|
67
127
|
var _symbols = parity.status.symbols;
|
package/package.json
CHANGED
|
@@ -1,102 +1,124 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hop-top/kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-alpha.1",
|
|
4
4
|
"description": "Shared CLI utilities for hop-top tools — TypeScript/CJS edition",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"require": "./dist/index.js"
|
|
12
12
|
},
|
|
13
13
|
"./cli": {
|
|
14
|
+
"types": "./dist/cli.d.ts",
|
|
14
15
|
"require": "./dist/cli.js",
|
|
15
|
-
"
|
|
16
|
+
"default": "./dist/cli.js"
|
|
16
17
|
},
|
|
17
18
|
"./output": {
|
|
19
|
+
"types": "./dist/output.d.ts",
|
|
18
20
|
"require": "./dist/output.js",
|
|
19
|
-
"
|
|
21
|
+
"default": "./dist/output.js"
|
|
20
22
|
},
|
|
21
23
|
"./xdg": {
|
|
24
|
+
"types": "./dist/xdg.d.ts",
|
|
22
25
|
"require": "./dist/xdg.js",
|
|
23
|
-
"
|
|
26
|
+
"default": "./dist/xdg.js"
|
|
24
27
|
},
|
|
25
28
|
"./config": {
|
|
29
|
+
"types": "./dist/config.d.ts",
|
|
26
30
|
"require": "./dist/config.js",
|
|
27
|
-
"
|
|
31
|
+
"default": "./dist/config.js"
|
|
28
32
|
},
|
|
29
33
|
"./sqlstore": {
|
|
34
|
+
"types": "./dist/sqlstore.d.ts",
|
|
30
35
|
"require": "./dist/sqlstore.js",
|
|
31
|
-
"
|
|
36
|
+
"default": "./dist/sqlstore.js"
|
|
32
37
|
},
|
|
33
38
|
"./upgrade": {
|
|
39
|
+
"types": "./dist/upgrade.d.ts",
|
|
34
40
|
"require": "./dist/upgrade.js",
|
|
35
|
-
"
|
|
41
|
+
"default": "./dist/upgrade.js"
|
|
36
42
|
},
|
|
37
43
|
"./llm": {
|
|
44
|
+
"types": "./dist/llm.d.ts",
|
|
38
45
|
"require": "./dist/llm.js",
|
|
39
|
-
"
|
|
46
|
+
"default": "./dist/llm.js"
|
|
40
47
|
},
|
|
41
48
|
"./routellm": {
|
|
49
|
+
"types": "./dist/routellm.d.ts",
|
|
42
50
|
"require": "./dist/routellm.js",
|
|
43
|
-
"
|
|
51
|
+
"default": "./dist/routellm.js"
|
|
44
52
|
},
|
|
45
53
|
"./alias": {
|
|
54
|
+
"types": "./dist/alias.d.ts",
|
|
46
55
|
"require": "./dist/alias.js",
|
|
47
|
-
"
|
|
56
|
+
"default": "./dist/alias.js"
|
|
48
57
|
},
|
|
49
58
|
"./tui": {
|
|
59
|
+
"types": "./dist/tui/index.d.ts",
|
|
50
60
|
"require": "./dist/tui/index.js",
|
|
51
|
-
"
|
|
61
|
+
"default": "./dist/tui/index.js"
|
|
52
62
|
},
|
|
53
63
|
"./errcorrect": {
|
|
64
|
+
"types": "./dist/errcorrect.d.ts",
|
|
54
65
|
"require": "./dist/errcorrect.js",
|
|
55
|
-
"
|
|
66
|
+
"default": "./dist/errcorrect.js"
|
|
56
67
|
},
|
|
57
68
|
"./safety": {
|
|
69
|
+
"types": "./dist/safety.d.ts",
|
|
58
70
|
"require": "./dist/safety.js",
|
|
59
|
-
"
|
|
71
|
+
"default": "./dist/safety.js"
|
|
60
72
|
},
|
|
61
73
|
"./provenance": {
|
|
74
|
+
"types": "./dist/provenance.d.ts",
|
|
62
75
|
"require": "./dist/provenance.js",
|
|
63
|
-
"
|
|
76
|
+
"default": "./dist/provenance.js"
|
|
64
77
|
},
|
|
65
78
|
"./stream": {
|
|
79
|
+
"types": "./dist/stream.d.ts",
|
|
66
80
|
"require": "./dist/stream.js",
|
|
67
|
-
"
|
|
81
|
+
"default": "./dist/stream.js"
|
|
68
82
|
},
|
|
69
83
|
"./progress": {
|
|
84
|
+
"types": "./dist/progress.d.ts",
|
|
70
85
|
"require": "./dist/progress.js",
|
|
71
|
-
"
|
|
86
|
+
"default": "./dist/progress.js"
|
|
72
87
|
},
|
|
73
88
|
"./auth": {
|
|
89
|
+
"types": "./dist/auth.d.ts",
|
|
74
90
|
"require": "./dist/auth.js",
|
|
75
|
-
"
|
|
91
|
+
"default": "./dist/auth.js"
|
|
76
92
|
},
|
|
77
93
|
"./api": {
|
|
94
|
+
"types": "./dist/api.d.ts",
|
|
78
95
|
"require": "./dist/api.js",
|
|
79
|
-
"
|
|
96
|
+
"default": "./dist/api.js"
|
|
80
97
|
},
|
|
81
98
|
"./rpc": {
|
|
99
|
+
"types": "./dist/rpc.d.ts",
|
|
82
100
|
"require": "./dist/rpc.js",
|
|
83
|
-
"
|
|
101
|
+
"default": "./dist/rpc.js"
|
|
84
102
|
},
|
|
85
103
|
"./aim": {
|
|
104
|
+
"types": "./dist/aim.d.ts",
|
|
86
105
|
"require": "./dist/aim.js",
|
|
87
|
-
"
|
|
106
|
+
"default": "./dist/aim.js"
|
|
88
107
|
},
|
|
89
108
|
"./scope": {
|
|
109
|
+
"types": "./dist/scope.d.ts",
|
|
90
110
|
"require": "./dist/scope.js",
|
|
91
|
-
"
|
|
111
|
+
"default": "./dist/scope.js"
|
|
92
112
|
},
|
|
93
113
|
"./telemetry": {
|
|
114
|
+
"types": "./dist/telemetry/index.d.ts",
|
|
94
115
|
"require": "./dist/telemetry/index.js",
|
|
95
|
-
"
|
|
116
|
+
"default": "./dist/telemetry/index.js"
|
|
96
117
|
},
|
|
97
118
|
"./id": {
|
|
119
|
+
"types": "./dist/id/index.d.ts",
|
|
98
120
|
"require": "./dist/id/index.js",
|
|
99
|
-
"
|
|
121
|
+
"default": "./dist/id/index.js"
|
|
100
122
|
}
|
|
101
123
|
},
|
|
102
124
|
"dependencies": {
|
|
@@ -104,7 +126,7 @@
|
|
|
104
126
|
"@clack/prompts": "^1.2.0",
|
|
105
127
|
"@connectrpc/connect": "^2.1.1",
|
|
106
128
|
"@connectrpc/connect-web": "^2.1.1",
|
|
107
|
-
"@hop-top/
|
|
129
|
+
"@hop-top/cite": "^0.1.0",
|
|
108
130
|
"better-sqlite3": "^12.8.0",
|
|
109
131
|
"commander": "^14.0.3",
|
|
110
132
|
"csv-stringify": "^6.7.0",
|
package/src/id/index.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* the runtime guarantees provided by `typeid-js`.
|
|
12
12
|
*
|
|
13
13
|
* URI composition (e.g. `tlc://task/task_…`) is NOT in this module —
|
|
14
|
-
* callers should use the `@hop-top/
|
|
14
|
+
* callers should use the `@hop-top/cite` package directly. This
|
|
15
15
|
* keeps `kit/id` free of any transitive dependency on the URI
|
|
16
16
|
* registry, per the ADR's scope boundary.
|
|
17
17
|
*/
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://hop.top/kit/go/console/tui/parity.json",
|
|
4
|
+
"description": "Cross-language TUI parity constants. All language implementations MUST load values from here.",
|
|
5
|
+
|
|
6
|
+
"status": {
|
|
7
|
+
"description": "Prefix symbols for status lines. Mirrors Go's InfoType constants in tui/status.go.",
|
|
8
|
+
"symbols": {
|
|
9
|
+
"info": "ℹ",
|
|
10
|
+
"success": "✓",
|
|
11
|
+
"error": "●",
|
|
12
|
+
"warn": "▲"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
"spinner": {
|
|
17
|
+
"description": "Braille dot spinner frames and timing.",
|
|
18
|
+
"frames": ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"],
|
|
19
|
+
"interval_ms": 80
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
"anim": {
|
|
23
|
+
"description": "Gradient character-scramble animation constants.",
|
|
24
|
+
"runes": "0123456789abcdefABCDEF~!@#$%^&*()+=_",
|
|
25
|
+
"interval_ms": 100,
|
|
26
|
+
"default_width": 10
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
"help": {
|
|
30
|
+
"description": "Root --help layout contract. Fang is canonical; TS and Python mirror it.",
|
|
31
|
+
"section_order": ["commands", "flags"],
|
|
32
|
+
"sections": {
|
|
33
|
+
"usage": { "title": "USAGE" },
|
|
34
|
+
"commands": { "title": "COMMANDS" },
|
|
35
|
+
"flags": { "title": "FLAGS" },
|
|
36
|
+
"global flags": { "title": "GLOBAL FLAGS" },
|
|
37
|
+
"arguments": { "title": "ARGUMENTS" },
|
|
38
|
+
"aliases": { "title": "ALIASES" },
|
|
39
|
+
"examples": { "title": "EXAMPLES" },
|
|
40
|
+
"streams": { "title": "STREAMS" }
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
"verbosity": {
|
|
45
|
+
"description": "Stackable -V flag maps count to log level. --quiet overrides to warn.",
|
|
46
|
+
"flag": "-V",
|
|
47
|
+
"levels": {
|
|
48
|
+
"0": "info",
|
|
49
|
+
"1": "debug",
|
|
50
|
+
"2": "trace"
|
|
51
|
+
},
|
|
52
|
+
"quiet_override": "warn"
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
"streams": {
|
|
56
|
+
"description": "Per-command named output streams toggled via --stream flag.",
|
|
57
|
+
"flag": "--stream",
|
|
58
|
+
"label_format": "[{name}]",
|
|
59
|
+
"output": "stderr"
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
"table": {
|
|
63
|
+
"description": "Styled-table contract for the output package. Plain tabwriter is the default; callers opt in to the lipgloss-backed renderer via WithTableStyle. The styled path is gated on writer-is-TTY so non-TTY writers (pipes, files, tests) always emit ANSI-free, diff-friendly output.",
|
|
64
|
+
"render_option": "WithTableStyle",
|
|
65
|
+
"tty_only": true,
|
|
66
|
+
"row_emphasis_kinds": ["none", "primary", "secondary", "muted"],
|
|
67
|
+
"row_emphasis_option": "RowEmphasis",
|
|
68
|
+
"border_default": "normal"
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
"extends": [
|
|
72
|
+
"scope-defaults.json"
|
|
73
|
+
]
|
|
74
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract-sync tests for tui/parity.
|
|
3
|
+
*
|
|
4
|
+
* - Compare the vendored sdk/ts/src/tui/parity.json against the canonical
|
|
5
|
+
* contracts/parity/parity.json. If they drift, the test fails — keeping
|
|
6
|
+
* the published package self-contained without losing the single source
|
|
7
|
+
* of truth.
|
|
8
|
+
* - Sanity-check the shape the loader exposes.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import * as fs from 'fs';
|
|
12
|
+
import * as path from 'path';
|
|
13
|
+
import { describe, expect, it } from 'vitest';
|
|
14
|
+
|
|
15
|
+
import { parity } from './parity.js';
|
|
16
|
+
|
|
17
|
+
// ─── Contract sync ───────────────────────────────────────────────────────────
|
|
18
|
+
|
|
19
|
+
describe('tui parity contract sync', () => {
|
|
20
|
+
it('local parity.json matches contracts/parity/parity.json', () => {
|
|
21
|
+
const local = JSON.parse(
|
|
22
|
+
fs.readFileSync(path.join(__dirname, 'parity.json'), 'utf8'),
|
|
23
|
+
);
|
|
24
|
+
const canonical = JSON.parse(
|
|
25
|
+
fs.readFileSync(
|
|
26
|
+
path.join(__dirname, '..', '..', '..', '..', 'contracts', 'parity', 'parity.json'),
|
|
27
|
+
'utf8',
|
|
28
|
+
),
|
|
29
|
+
);
|
|
30
|
+
expect(local).toEqual(canonical);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// ─── Loader shape ────────────────────────────────────────────────────────────
|
|
35
|
+
|
|
36
|
+
describe('parity loader', () => {
|
|
37
|
+
it('exposes status symbols', () => {
|
|
38
|
+
expect(parity.status.symbols.success).toBeTruthy();
|
|
39
|
+
expect(parity.status.symbols.error).toBeTruthy();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('exposes spinner frames and interval', () => {
|
|
43
|
+
expect(parity.spinner.frames.length).toBeGreaterThan(0);
|
|
44
|
+
expect(parity.spinner.interval_ms).toBeGreaterThan(0);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('exposes help section order and titles', () => {
|
|
48
|
+
expect(parity.help.section_order.length).toBeGreaterThan(0);
|
|
49
|
+
for (const section of parity.help.section_order) {
|
|
50
|
+
expect(parity.help.sections[section]).toBeDefined();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
package/src/tui/parity.ts
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
* @module tui/parity
|
|
3
3
|
* @package @hop-top/kit
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Cross-language parity constants SoT. The canonical file lives at
|
|
6
|
+
* `contracts/parity/parity.json`; a vendored copy ships next to this
|
|
7
|
+
* module so the published package is self-contained. A contract-sync
|
|
8
|
+
* test keeps the two in lockstep.
|
|
9
|
+
*
|
|
6
10
|
* All TUI modules should import constants from here, not hardcode them.
|
|
7
11
|
*/
|
|
8
12
|
|
|
9
|
-
import
|
|
10
|
-
import { resolve } from 'node:path';
|
|
13
|
+
import parityRaw from './parity.json';
|
|
11
14
|
|
|
12
15
|
interface ParityData {
|
|
13
16
|
status: {
|
|
@@ -30,12 +33,4 @@ interface ParityData {
|
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
const _candidates = [
|
|
35
|
-
resolve(__dirname, '..', '..', '..', '..', 'contracts', 'parity', 'parity.json'),
|
|
36
|
-
resolve(__dirname, '..', '..', '..', '..', '..', 'contracts', 'parity', 'parity.json'),
|
|
37
|
-
resolve(process.cwd(), 'contracts', 'parity', 'parity.json'),
|
|
38
|
-
];
|
|
39
|
-
const _path = _candidates.find((path) => existsSync(path)) ?? _candidates[0];
|
|
40
|
-
|
|
41
|
-
export const parity: ParityData = JSON.parse(readFileSync(_path, 'utf8'));
|
|
36
|
+
export const parity: ParityData = parityRaw;
|
package/src/uri.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Thin facade over @hop-top/
|
|
2
|
+
* Thin facade over @hop-top/cite for kit SDK consumers.
|
|
3
3
|
*
|
|
4
|
-
* The URI implementation lives in @hop-top/
|
|
4
|
+
* The URI implementation lives in @hop-top/cite; this module only adapts the
|
|
5
5
|
* kit-facing helper names used by the Go URI command group.
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -110,16 +110,16 @@ interface UriModule {
|
|
|
110
110
|
snippet(platform: string, spec: HandlerSpec): string;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
// @hop-top/
|
|
113
|
+
// @hop-top/cite is intentionally a runtime dependency of the facade. Keeping the
|
|
114
114
|
// import as require avoids duplicating its declarations in this package.
|
|
115
115
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
116
|
-
const uri = require('@hop-top/
|
|
116
|
+
const uri = require('@hop-top/cite') as UriModule;
|
|
117
117
|
|
|
118
118
|
export const defaultPolicy: Policy = uri.defaultPolicy;
|
|
119
119
|
export const DefaultPolicy: Policy = uri.DefaultPolicy ?? uri.defaultPolicy;
|
|
120
120
|
export const Registry: new (policy?: Policy) => Registry = uri.Registry;
|
|
121
121
|
|
|
122
|
-
/** Parse a custom URI using @hop-top/
|
|
122
|
+
/** Parse a custom URI using @hop-top/cite policy and parse options. */
|
|
123
123
|
export function parse(
|
|
124
124
|
input: string,
|
|
125
125
|
policy?: Policy,
|
|
@@ -156,7 +156,7 @@ export function completeVanity(
|
|
|
156
156
|
|
|
157
157
|
export const vanityCandidates = completeVanity;
|
|
158
158
|
|
|
159
|
-
/** Complete URI values using a @hop-top/
|
|
159
|
+
/** Complete URI values using a @hop-top/cite registry. */
|
|
160
160
|
export function complete(
|
|
161
161
|
registry: Registry,
|
|
162
162
|
typeName: string,
|
|
@@ -165,7 +165,7 @@ export function complete(
|
|
|
165
165
|
return uri.completeWithScheme(registry, typeName, input);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
/** Create a @hop-top/
|
|
168
|
+
/** Create a @hop-top/cite registry with an optional policy. */
|
|
169
169
|
export function newRegistry(policy?: Policy): Registry {
|
|
170
170
|
return uri.newRegistry(policy);
|
|
171
171
|
}
|