@luzzle/cli 0.0.142 → 0.0.144
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/README.md +72 -5
- package/dist/src/lib/commands/command/attach.d.ts +8 -0
- package/dist/src/lib/commands/command/attach.js +44 -0
- package/dist/src/lib/commands/command/attach.js.map +1 -0
- package/dist/src/version.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +5 -5
- package/dist/src/lib/cli.test.d.ts +0 -1
- package/dist/src/lib/cli.test.js +0 -197
- package/dist/src/lib/cli.test.js.map +0 -1
- package/dist/src/lib/commands/command/assistant.test.d.ts +0 -1
- package/dist/src/lib/commands/command/assistant.test.js +0 -161
- package/dist/src/lib/commands/command/assistant.test.js.map +0 -1
- package/dist/src/lib/commands/command/config.test.d.ts +0 -1
- package/dist/src/lib/commands/command/config.test.js +0 -113
- package/dist/src/lib/commands/command/config.test.js.map +0 -1
- package/dist/src/lib/commands/command/create.test.d.ts +0 -1
- package/dist/src/lib/commands/command/create.test.js +0 -126
- package/dist/src/lib/commands/command/create.test.js.map +0 -1
- package/dist/src/lib/commands/command/field.test.d.ts +0 -1
- package/dist/src/lib/commands/command/field.test.js +0 -449
- package/dist/src/lib/commands/command/field.test.js.map +0 -1
- package/dist/src/lib/commands/command/init.test.d.ts +0 -1
- package/dist/src/lib/commands/command/init.test.js +0 -84
- package/dist/src/lib/commands/command/init.test.js.map +0 -1
- package/dist/src/lib/commands/command/sync.test.d.ts +0 -1
- package/dist/src/lib/commands/command/sync.test.js +0 -117
- package/dist/src/lib/commands/command/sync.test.js.map +0 -1
- package/dist/src/lib/commands/command/validate.test.d.ts +0 -1
- package/dist/src/lib/commands/command/validate.test.js +0 -59
- package/dist/src/lib/commands/command/validate.test.js.map +0 -1
- package/dist/src/lib/commands/index.test.d.ts +0 -1
- package/dist/src/lib/commands/index.test.js +0 -31
- package/dist/src/lib/commands/index.test.js.map +0 -1
- package/dist/src/lib/commands/utils/pieces.test.d.ts +0 -1
- package/dist/src/lib/commands/utils/pieces.test.js +0 -97
- package/dist/src/lib/commands/utils/pieces.test.js.map +0 -1
- package/dist/src/lib/config.test.d.ts +0 -1
- package/dist/src/lib/config.test.js +0 -110
- package/dist/src/lib/config.test.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -1,9 +1,76 @@
|
|
|
1
1
|
# @luzzle/cli 💻
|
|
2
2
|
|
|
3
|
-
A terminal companion for the human side of Luzzle.
|
|
3
|
+
A terminal companion for the human side of Luzzle. The CLI offers commands to
|
|
4
|
+
manage, validate, and query your piece archive directly from your terminal.
|
|
4
5
|
|
|
5
|
-
##
|
|
6
|
+
## Installation 🚀
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
Install the CLI globally:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install -g @luzzle/cli
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Configuration ⚙️
|
|
15
|
+
|
|
16
|
+
The CLI is configured via a YAML file. By default, it reads from the OS-specific
|
|
17
|
+
standard user config path. You can customize settings like storage paths, SQLite
|
|
18
|
+
database locations, and Gemini API keys.
|
|
19
|
+
|
|
20
|
+
For detailed options, see the [CLI Configuration Reference](./docs/config.md).
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Commands Reference 🛠️
|
|
25
|
+
|
|
26
|
+
All commands support a `--dry-run` flag to run without making permanent changes
|
|
27
|
+
to your disk or database, and a `--verbose` flag for detailed logs.
|
|
28
|
+
|
|
29
|
+
### 1. `init <dir>`
|
|
30
|
+
|
|
31
|
+
Initializes a new Luzzle repository inside the specified directory. This sets up
|
|
32
|
+
the database client and runs Kysely schema migrations.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
luzzle init ./my-archive
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2. `sync`
|
|
39
|
+
|
|
40
|
+
Scans your archive directory, parses new or updated piece files, and updates the local SQLite cache index.
|
|
41
|
+
|
|
42
|
+
- **`--force`** (`-f`): Force updates on all items, ignoring file modification times.
|
|
43
|
+
- **`--prune`** (`-p`): Delete orphaned assets from disk that are no longer referenced by any piece.
|
|
44
|
+
|
|
45
|
+
### 3. `create <title> [fields]`
|
|
46
|
+
|
|
47
|
+
Creates a new piece file with the proper extension and schema layout.
|
|
48
|
+
|
|
49
|
+
- **`--piece`** (`-p`): Piece type name (e.g. `books`, `films`). (Required)
|
|
50
|
+
- **`--directory`** (`-d`): Directory path where the piece should be created. (Required)
|
|
51
|
+
- **`--input`** (`-i`): Input format of the `[fields]` argument (`yaml` or `json`). Defaults to `yaml`.
|
|
52
|
+
|
|
53
|
+
### 4. `field <piece-path> [field] [value]`
|
|
54
|
+
|
|
55
|
+
Gets, edits, or removes a frontmatter field for a specific piece file.
|
|
56
|
+
|
|
57
|
+
- **`--remove`** (`-r`): Remove the specified field from the piece.
|
|
58
|
+
|
|
59
|
+
### 5. `validate <piece-path>`
|
|
60
|
+
|
|
61
|
+
Validates a specific piece file's YAML frontmatter against its registered JSON schema.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
luzzle validate ./archive/books/dune.books.md
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 6. `assistant`
|
|
68
|
+
|
|
69
|
+
Prompts the Gemini AI assistant to generate or update piece metadata based on a natural language prompt or attached files.
|
|
70
|
+
|
|
71
|
+
- **`--prompt`**: A sentence describing the piece or where to find info. (Required)
|
|
72
|
+
- **`--piece`** (`-p`): Target piece type. (Required)
|
|
73
|
+
- **`--update`** (`-u`): Path to an existing piece to modify.
|
|
74
|
+
- **`--directory`** (`-d`): Folder to write a new piece file.
|
|
75
|
+
- **`--title`**: Title of the new piece.
|
|
76
|
+
- **`--file`**: Path to reference documents/images (can be specified multiple times).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import log from '../../../lib/log.js';
|
|
2
|
+
import { savePieceAsset } from '@luzzle/core';
|
|
3
|
+
import { PiecePositional, makePiecePathPositional, parsePiecePathPositionalArgv, } from '../utils/pieces.js';
|
|
4
|
+
const command = {
|
|
5
|
+
name: 'attach',
|
|
6
|
+
command: `attach ${PiecePositional} <file>`,
|
|
7
|
+
describe: 'attach a local file to a piece',
|
|
8
|
+
builder: (yargs) => {
|
|
9
|
+
return makePiecePathPositional(yargs)
|
|
10
|
+
.positional('file', {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'path to the local file or URL to attach',
|
|
13
|
+
demandOption: 'file path or URL is required',
|
|
14
|
+
})
|
|
15
|
+
.option('name', {
|
|
16
|
+
alias: 'n',
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'custom filename for the attachment (optional)',
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
run: async function (ctx, args) {
|
|
22
|
+
const { file, name } = args;
|
|
23
|
+
const { markdown } = await parsePiecePathPositionalArgv(ctx, args);
|
|
24
|
+
if (ctx.flags.dryRun) {
|
|
25
|
+
const isUrl = /https?:\/\//i.test(file);
|
|
26
|
+
if (isUrl) {
|
|
27
|
+
log.info(`[dry-run] would download and attach ${file} to ${markdown.filePath}`);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
log.info(`[dry-run] would attach ${file} to ${markdown.filePath}`);
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
const relativePath = await savePieceAsset(markdown.filePath, file, ctx.storage, { name });
|
|
36
|
+
console.log(relativePath);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
log.error(`failed to attach file: ${error.message}`);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
export default command;
|
|
44
|
+
//# sourceMappingURL=attach.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attach.js","sourceRoot":"","sources":["../../../../../src/lib/commands/command/attach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