kiriya 0.1.0 → 0.1.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
CHANGED
|
@@ -7,6 +7,25 @@ output shapes are kiriya's public API.
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.1] - 2026-09-24
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- A usage error inside a command that was found now points at that command's help, so
|
|
15
|
+
`Missing argument: sources` is followed by `Run kiriya files copy --help to see what it
|
|
16
|
+
takes.` A spelling suggestion, being the more useful hint, still takes precedence.
|
|
17
|
+
- `kiriya help <module>` lists each command's option names under it, so a module's whole
|
|
18
|
+
surface can be read at once instead of one command at a time. The short forms, the
|
|
19
|
+
values and the descriptions stay in the command's own help. The readme now shows the
|
|
20
|
+
three steps help goes through, which nothing pointed out before.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- The readme and the getting started page said kiriya was not on npm and walked people
|
|
25
|
+
through building it from source. Both now install it with `npm install --global kiriya`.
|
|
26
|
+
Since npm keeps the readme it was given at publish time, 0.1.0's page carried the wrong
|
|
27
|
+
instructions until this release replaced them.
|
|
28
|
+
|
|
10
29
|
## [0.1.0] - 2026-09-23
|
|
11
30
|
|
|
12
31
|
The first release.
|
package/README.md
CHANGED
|
@@ -10,36 +10,61 @@ show a plan first, deletions go to the trash, and nothing that cannot be undone
|
|
|
10
10
|
until you type a confirmation. AI agents can use the same commands over MCP, under the same
|
|
11
11
|
rules.
|
|
12
12
|
|
|
13
|
-
> **Status:** in development and not yet published to npm. Every module below is built and
|
|
14
|
-
> tested in CI on Windows, Linux and macOS, with Node.js 22, 24 and the current release.
|
|
15
|
-
|
|
16
13
|
## Install
|
|
17
14
|
|
|
18
|
-
kiriya needs [Node.js](https://nodejs.org/) 22.13 or later.
|
|
19
|
-
|
|
15
|
+
kiriya needs [Node.js](https://nodejs.org/) 22.13 or later.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install --global kiriya
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Then check what this machine gives it:
|
|
20
22
|
|
|
21
23
|
```bash
|
|
22
|
-
|
|
23
|
-
cd kiriya
|
|
24
|
-
npm ci
|
|
25
|
-
npm run build
|
|
26
|
-
npm link
|
|
24
|
+
kiriya doctor
|
|
27
25
|
```
|
|
28
26
|
|
|
29
|
-
[
|
|
27
|
+
Every release is published from CI with [provenance](https://docs.npmjs.com/generating-provenance-statements),
|
|
28
|
+
so `npm audit signatures` can show which workflow built the copy you installed. Every module
|
|
29
|
+
below is tested on Windows, Linux and macOS with Node.js 22, 24 and the current release.
|
|
30
|
+
|
|
31
|
+
[Getting started](docs/getting-started.md) takes it from there, and
|
|
32
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) covers building from source.
|
|
30
33
|
|
|
31
34
|
## Quick start
|
|
32
35
|
|
|
33
36
|
```bash
|
|
34
37
|
kiriya doctor # what this machine offers kiriya
|
|
35
|
-
kiriya --help # every module
|
|
36
|
-
kiriya help port # one module, with examples
|
|
37
38
|
kiriya port who 3000 # which process holds port 3000
|
|
38
39
|
kiriya files find --name "*.log" --older 30d # the same search in every shell
|
|
39
40
|
kiriya files delete dist --dry-run # the plan, before anything changes
|
|
40
41
|
kiriya git status ~/code --json # every repository under a folder, as JSON
|
|
41
42
|
```
|
|
42
43
|
|
|
44
|
+
## Finding your way
|
|
45
|
+
|
|
46
|
+
Help goes three steps deep, and each step names the next, so nothing has to be guessed.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
kiriya --help # the modules, and the options every command accepts
|
|
50
|
+
kiriya help files # one module: its commands, and what each one takes
|
|
51
|
+
kiriya help files delete # one command: its arguments, options and examples
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`kiriya files delete --help` says the same as that third line. The middle step lists each
|
|
55
|
+
command's option names underneath it, so a module's whole surface fits on one screen:
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
Commands
|
|
59
|
+
delete Send files and folders to the trash, or remove them for good with --permanent
|
|
60
|
+
--permanent --dry-run --yes --confirm --all
|
|
61
|
+
find Find files and folders by name, extension, type, size, age or emptiness
|
|
62
|
+
--name --ext --type --larger --smaller --newer --older --empty --all --limit
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Every module also has a guide below with a full reference: every command, argument and
|
|
66
|
+
option, what each does, and whether it can be undone.
|
|
67
|
+
|
|
43
68
|
## Modules
|
|
44
69
|
|
|
45
70
|
<!-- kiriya:modules -->
|
|
@@ -19,6 +19,24 @@ const EXIT_CODES = {
|
|
|
19
19
|
interrupted: 130,
|
|
20
20
|
};
|
|
21
21
|
const verbsOf = (module) => [...module.commands.keys()].filter((verb) => verb !== "");
|
|
22
|
+
/**
|
|
23
|
+
* A usage error raised inside a command that was found says what is wrong with the arguments
|
|
24
|
+
* but not what the command takes, so point at its help. An error that already carries a hint,
|
|
25
|
+
* such as a spelling suggestion, keeps the one it has.
|
|
26
|
+
*/
|
|
27
|
+
function withCommandHint(id, parse) {
|
|
28
|
+
try {
|
|
29
|
+
return parse();
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (!(error instanceof UsageError) || error.detail.params["hint"] !== undefined)
|
|
33
|
+
throw error;
|
|
34
|
+
throw new UsageError(error.detail.key, {
|
|
35
|
+
...error.detail.params,
|
|
36
|
+
hint: message("core.usage.see-help", { command: `kiriya ${id.split(".").join(" ")} --help` }),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
22
40
|
/** The command line: finds the command, runs it, prints its result, and maps errors to exit codes once. */
|
|
23
41
|
export class CliApplication {
|
|
24
42
|
deps;
|
|
@@ -61,7 +79,7 @@ export class CliApplication {
|
|
|
61
79
|
if (flags.help)
|
|
62
80
|
return this.print(this.deps.stdout, commandHelp(module, entry, help));
|
|
63
81
|
const { spec } = entry.command;
|
|
64
|
-
const input = spec.input.parse(parseCommandArguments(spec.input, args));
|
|
82
|
+
const input = withCommandHint(spec.id, () => spec.input.parse(parseCommandArguments(spec.input, args)));
|
|
65
83
|
const controller = new AbortController();
|
|
66
84
|
const interrupt = () => controller.abort();
|
|
67
85
|
process.once("SIGINT", interrupt);
|
|
@@ -30,6 +30,13 @@ function table(rows, options = {}) {
|
|
|
30
30
|
lines.push(` ${name}${padding} ${wrapped[0] ?? ""}`);
|
|
31
31
|
for (const line of wrapped.slice(1))
|
|
32
32
|
lines.push(`${" ".repeat(start)}${line}`);
|
|
33
|
+
const note = options.note?.(left);
|
|
34
|
+
if (note !== undefined && note !== "") {
|
|
35
|
+
const noteLines = options.width === undefined ? [note] : wrap(note, Math.max(20, options.width - start));
|
|
36
|
+
for (const line of noteLines) {
|
|
37
|
+
lines.push(`${" ".repeat(start)}${options.paintNote === undefined ? line : options.paintNote(line)}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
33
40
|
}
|
|
34
41
|
return lines;
|
|
35
42
|
}
|
|
@@ -161,12 +168,23 @@ export function moduleHelp(module, context) {
|
|
|
161
168
|
const commands = [...module.commands.values()]
|
|
162
169
|
.filter((entry) => entry.verb !== "")
|
|
163
170
|
.sort((a, b) => (a.verb < b.verb ? -1 : a.verb > b.verb ? 1 : 0));
|
|
171
|
+
// What each command takes, so its options can be seen here rather than one command at a time.
|
|
172
|
+
// Long forms only: the short ones, the values and the descriptions belong in the command's own help.
|
|
173
|
+
const options = new Map(commands.map((entry) => {
|
|
174
|
+
const names = Object.keys(entry.command.spec.input.options);
|
|
175
|
+
return [entry.verb, names.length === 0 ? undefined : names.map((name) => `--${name}`).join(" ")];
|
|
176
|
+
}));
|
|
164
177
|
return [
|
|
165
178
|
`${style.bold(`kiriya ${module.id}`)} — ${translator.text(message(module.summary))}`,
|
|
166
179
|
...aboutLines(module, context),
|
|
167
180
|
"",
|
|
168
181
|
style.bold(translator.text(message("core.help.commands"))),
|
|
169
|
-
...table(commands.map((entry) => [entry.verb, translator.text(message(entry.command.spec.summary))]), {
|
|
182
|
+
...table(commands.map((entry) => [entry.verb, translator.text(message(entry.command.spec.summary))]), {
|
|
183
|
+
width: context.width,
|
|
184
|
+
paint: (verb) => style.green(verb),
|
|
185
|
+
note: (verb) => options.get(verb),
|
|
186
|
+
paintNote: (line) => style.dim(line),
|
|
187
|
+
}),
|
|
170
188
|
...exampleLines(module.examples, context),
|
|
171
189
|
"",
|
|
172
190
|
...guideLines(module, context),
|
|
@@ -24,6 +24,7 @@ export const en = {
|
|
|
24
24
|
"core.usage.unknown-module": "Unknown module: {name}",
|
|
25
25
|
"core.usage.unknown-command": "Unknown command: {module} {name}",
|
|
26
26
|
"core.usage.did-you-mean": "Did you mean {suggestion}?",
|
|
27
|
+
"core.usage.see-help": "Run {command} to see what it takes.",
|
|
27
28
|
"core.usage.bad-arguments": "{detail}",
|
|
28
29
|
"core.usage.unknown-option": "Unknown option: {option}",
|
|
29
30
|
"core.usage.takes-no-value": "--{option} does not take a value",
|
package/package.json
CHANGED