@game_ryo/lsji 0.1.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.
Files changed (61) hide show
  1. package/.github/workflows/node.yml +46 -0
  2. package/AGENTS.md +143 -0
  3. package/LICENSE +185 -0
  4. package/PROPOSAL.md +18 -0
  5. package/README.md +102 -0
  6. package/bin/lsji.js +8 -0
  7. package/docs/README.md +43 -0
  8. package/docs/blog/2019-05-28-first-blog-post.mdx +12 -0
  9. package/docs/blog/2019-05-29-long-blog-post.mdx +44 -0
  10. package/docs/blog/2021-08-01-mdx-blog-post.mdx +24 -0
  11. package/docs/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg +0 -0
  12. package/docs/blog/2021-08-26-welcome/index.mdx +29 -0
  13. package/docs/blog/authors.yml +25 -0
  14. package/docs/blog/tags.yml +19 -0
  15. package/docs/docs/api/agent.md +151 -0
  16. package/docs/docs/api/env.md +133 -0
  17. package/docs/docs/api/environments.md +102 -0
  18. package/docs/docs/api/qlearning.md +138 -0
  19. package/docs/docs/api/storage.md +168 -0
  20. package/docs/docs/architecture.md +155 -0
  21. package/docs/docs/cli.md +210 -0
  22. package/docs/docs/contributing.md +162 -0
  23. package/docs/docs/core-concepts.md +152 -0
  24. package/docs/docs/examples/advanced-training.md +244 -0
  25. package/docs/docs/examples/custom-environment.md +198 -0
  26. package/docs/docs/examples/custom-storage.md +251 -0
  27. package/docs/docs/getting-started.md +91 -0
  28. package/docs/docusaurus.config.ts +149 -0
  29. package/docs/package-lock.json +19522 -0
  30. package/docs/package.json +49 -0
  31. package/docs/sidebars.ts +33 -0
  32. package/docs/src/components/HomepageFeatures/index.tsx +71 -0
  33. package/docs/src/components/HomepageFeatures/styles.module.css +11 -0
  34. package/docs/src/css/custom.css +79 -0
  35. package/docs/src/pages/index.module.css +23 -0
  36. package/docs/src/pages/index.tsx +44 -0
  37. package/docs/src/pages/markdown-page.mdx +7 -0
  38. package/docs/static/.nojekyll +0 -0
  39. package/docs/static/img/docusaurus-social-card.jpg +0 -0
  40. package/docs/static/img/docusaurus.png +0 -0
  41. package/docs/static/img/favicon.ico +0 -0
  42. package/docs/static/img/logo.png +0 -0
  43. package/docs/static/img/undraw_docusaurus_mountain.svg +171 -0
  44. package/docs/static/img/undraw_docusaurus_react.svg +170 -0
  45. package/docs/static/img/undraw_docusaurus_tree.svg +40 -0
  46. package/docs/tsconfig.json +12 -0
  47. package/legacy/worker.js +166 -0
  48. package/legacy/wrangler.toml +11 -0
  49. package/package.json +26 -0
  50. package/src/cli.js +232 -0
  51. package/src/core/agent.js +239 -0
  52. package/src/core/env.js +86 -0
  53. package/src/core/qlearning.js +197 -0
  54. package/src/envs/rps.js +168 -0
  55. package/src/index.js +22 -0
  56. package/src/storage/better-sqlite.js +133 -0
  57. package/src/storage/index.js +146 -0
  58. package/src/storage/memory.js +98 -0
  59. package/src/storage/sqlite.js +123 -0
  60. package/test/core/qlearning.test.js +150 -0
  61. package/test/storage/memory.test.js +81 -0
@@ -0,0 +1,46 @@
1
+ name: Node.js CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ strategy:
14
+ matrix:
15
+ node-version: [22.x, 24.x]
16
+
17
+ steps:
18
+ - name: Checkout repository
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Setup Node.js ${{ matrix.node-version }}
22
+ uses: actions/setup-node@v4
23
+ with:
24
+ node-version: ${{ matrix.node-version }}
25
+ cache: 'npm'
26
+
27
+ - name: Install dependencies
28
+ run: npm ci
29
+
30
+ - name: Run tests
31
+ run: npm test
32
+
33
+ - name: Build check
34
+ run: npm run build
35
+
36
+ # Lint check (placeholder for future)
37
+ lint:
38
+ runs-on: ubuntu-latest
39
+ steps:
40
+ - uses: actions/checkout@v4
41
+ - uses: actions/setup-node@v4
42
+ with:
43
+ node-version: '22'
44
+ cache: 'npm'
45
+ - run: npm ci
46
+ - run: npm run lint
package/AGENTS.md ADDED
@@ -0,0 +1,143 @@
1
+ # AGENTS.md
2
+
3
+ ## Project Overview
4
+
5
+ **LSJI** (Learning System for JavaScript Intelligence) is a general-purpose Reinforcement Learning agent framework for Node.js. It provides a clean abstraction for building RL agents with pluggable storage backends, environments, and learning algorithms.
6
+
7
+ Originally migrated from a Cloudflare Workers implementation (Rock-Paper-Scissors AI), now redesigned as a standalone npm package with Apache 2.0 license, targeting Apache Incubator entry.
8
+
9
+ ## Architecture
10
+
11
+ ```
12
+ src/
13
+ ├── core/
14
+ │ ├── env.js # Environment interface (Env base class)
15
+ │ ├── qlearning.js # Q-Learning engine (TD learning, epsilon-greedy)
16
+ │ └── agent.js # High-level agent orchestration
17
+ ├── storage/
18
+ │ ├── index.js # Storage interface + factory
19
+ │ ├── sqlite.js # node:sqlite implementation (Node 22+)
20
+ │ ├── better-sqlite.js # better-sqlite3 implementation
21
+ │ └── memory.js # In-memory implementation
22
+ ├── cli.js # Command-line interface
23
+ └── index.js # Public API exports
24
+ ```
25
+
26
+ ## Core Components
27
+
28
+ ### Env (Environment Interface)
29
+ Base class that all environments must extend:
30
+ - `getState()` - Returns current state as string
31
+ - `step(action)` - Executes action, returns {state, reward, done, info}
32
+ - `actionSize()` - Number of possible actions
33
+ - `reset()` - Resets environment to initial state
34
+
35
+ ### QLearning
36
+ Tabular Q-Learning with configurable:
37
+ - `alpha` (learning rate, default 0.1)
38
+ - `gamma` (discount factor, default 0.9)
39
+ - `epsilon` (exploration rate, default 0.1)
40
+
41
+ Methods:
42
+ - `act(state, actionSize)` - Epsilon-greedy action selection
43
+ - `learn(state, action, reward, nextState, nextActionSize)` - Full TD update
44
+ - `learnSimple(state, action, reward)` - Simplified update (worker.js style)
45
+ - `getFullQTable()` - Returns entire Q-table for inspection
46
+
47
+ ### Agent
48
+ High-level orchestration combining QLearning + Storage + Env:
49
+ - `train({episodes, pattern, batchSize})` - Training with multiple patterns
50
+ - `play(userHand)` - Single play against agent
51
+ - `status()` - System status and statistics
52
+ - `start()` / `stop()` - Enable/disable system
53
+
54
+ ### Storage Interface
55
+ Pluggable backends:
56
+ - **SqliteStorage** - Uses Node.js built-in `node:sqlite` (recommended, zero deps)
57
+ - **BetterSqliteStorage** - Uses `better-sqlite3` (faster, synchronous)
58
+ - **MemoryStorage** - In-memory (testing only, doesn't persist across processes)
59
+
60
+ ## Usage
61
+
62
+ ### As Library
63
+ ```javascript
64
+ import { Agent, QLearning, createStorage, Env } from 'lsji';
65
+
66
+ // Create custom environment
67
+ class MyEnv extends Env {
68
+ // implement getState, step, actionSize, reset
69
+ }
70
+
71
+ const storage = await createStorage('sqlite', { path: './my-agent.db' });
72
+ const qlearning = new QLearning({ alpha: 0.1, gamma: 0.9, epsilon: 0.1, storage });
73
+ const env = new MyEnv();
74
+ const agent = new Agent({ qlearning, storage, env });
75
+
76
+ await agent.train({ episodes: 1000 });
77
+ const result = await agent.play(userAction);
78
+ ```
79
+
80
+ ### CLI
81
+ ```bash
82
+ # Install globally or use npx
83
+ npm link # for local development
84
+
85
+ # Train
86
+ lsji train --episodes 500 --pattern 0
87
+
88
+ # Play
89
+ lsji play --hand 0 # 0=Rock, 1=Scissors, 2=Paper
90
+
91
+ # Status
92
+ lsji status --json
93
+
94
+ # Control
95
+ lsji start
96
+ lsji stop
97
+ ```
98
+
99
+ ## Development
100
+
101
+ ### Commands
102
+ ```bash
103
+ npm test # Run tests (vitest)
104
+ npm run build # No build step (ESM)
105
+ ```
106
+
107
+ ### Testing
108
+ - Tests use `vitest` with `MemoryStorage` for isolation
109
+ - Run `npm test` to verify all functionality
110
+
111
+ ## Key Design Decisions
112
+
113
+ 1. **ESM only** - Uses `"type": "module"` in package.json
114
+ 2. **Node 22+** - Requires Node 22 for built-in `node:sqlite`
115
+ 3. **Apache 2.0** - License compatible with Apache Incubator
116
+ 4. **Single package** - All core functionality in one npm package
117
+ 5. **Storage abstraction** - Easy to swap backends
118
+ 6. **Worker.js compatibility** - Training patterns and reward logic match original
119
+
120
+ ## Common Tasks
121
+
122
+ ### Adding a New Environment
123
+ 1. Create `src/envs/my-env.js` extending `Env`
124
+ 2. Implement required methods
125
+ 3. Use with `Agent`
126
+
127
+ ### Adding a New Storage Backend
128
+ 1. Create `src/storage/new-backend.js` extending `Storage`
129
+ 2. Implement all abstract methods
130
+ 3. Add to `createStorage` factory
131
+
132
+ ### Modifying Learning Algorithm
133
+ - Extend `QLearning` class or create new algorithm in `src/core/`
134
+
135
+ ## Git Workflow
136
+
137
+ - Commit messages in English
138
+ - Format: `<type>: <subject>` (e.g., `feat: add new environment base class`)
139
+ - Types: feat, fix, docs, refactor, test, chore
140
+
141
+ ## License
142
+
143
+ Apache 2.0 - see LICENSE file
package/LICENSE ADDED
@@ -0,0 +1,185 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) the beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with other Contributions to which such Contribution(s) was submitted.
82
+ If You institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is instituted.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the form of any Derivative Works that
101
+ You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the NOTICE file contained within the
109
+ Work, along with any attribution notices contained within such
110
+ NOTICE file, excluding those notices that do not pertain to any
111
+ part of the Derivative Works.
112
+
113
+ You may add Your own attribution notices within Derivative Works
114
+ that You distribute, alongside the attribution notices from the
115
+ Source form of the Work, provided that such additional attribution
116
+ notices cannot be construed as modifying or changing the License
117
+ granted by the Licensor.
118
+
119
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
120
+ any Contribution intentionally submitted for inclusion in the Work
121
+ by You to the Licensor shall be under the terms and conditions of
122
+ this License, without any additional terms or conditions.
123
+ Notwithstanding the above, nothing herein shall supersede or modify
124
+ the terms of any separate license agreement you may have executed
125
+ with Licensor regarding such Contributions.
126
+
127
+ 6. Trademarks. This License does not grant permission to use the trade
128
+ names, trademarks, service marks, or product names of the Licensor,
129
+ except as required for reasonable and customary use in describing the
130
+ origin of the Work and reproducing the content of the NOTICE file.
131
+
132
+ 7. Disclaimer of Warranty. Unless required by applicable law or
133
+ agreed to in writing, Licensor provides the Work (and each
134
+ Contributor provides its Contributions) on an "AS IS" BASIS,
135
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
136
+ implied, including, without limitation, warranties or conditions
137
+ of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
138
+ NONINFRINGEMENT. The Licensor does not warrant that the Work will
139
+ operate uninterrupted or error-free, or that the Work will meet
140
+ Your specific requirements.
141
+
142
+ 8. Limitation of Liability. In no event and under no legal theory,
143
+ whether in tort (including negligence), contract, or otherwise,
144
+ unless required by applicable law or agreed to in writing,
145
+ shall any Contributor be liable to You for damages, including any
146
+ direct, indirect, special, incidental, or consequential damages
147
+ of any character arising as a result of this License or use of the
148
+ Work (including without limitation damages for loss of goodwill,
149
+ work stoppage, computer failure or malfunction, or any other
150
+ damages), even if such Contributor has been advised of the
151
+ possibility of such damages.
152
+
153
+ 9. Accepting Warranty or Additional Liability. While redistributing
154
+ the Work or Derivative Works thereof, You may choose to offer,
155
+ and charge a fee for, acceptance of support, warranty, or
156
+ liability obligations consistent with this License. However, in
157
+ accepting such obligations, You act solely on Your own behalf and
158
+ on Your own risk, and You accept full responsibility for any
159
+ consequences of such acceptance.
160
+
161
+ END OF TERMS AND CONDITIONS
162
+
163
+ APPENDIX: How to apply the Apache License to your work.
164
+
165
+ To apply the Apache License to your work, attach the following
166
+ boilerplate notice, with the fields enclosed by brackets "[]"
167
+ replaced with your own identifying information. (Don't include
168
+ the brackets!) The text should be wrapped in the appropriate
169
+ comment syntax for the file format. We also recommend that a
170
+ statement such as the above be included in the file header
171
+ comments.
172
+
173
+ Copyright 2026 ryopc org
174
+
175
+ Licensed under the Apache License, Version 2.0 (the "License");
176
+ you may not use this file except in compliance with the License.
177
+ You may obtain a copy of the License at
178
+
179
+ http://www.apache.org/licenses/LICENSE-2.0
180
+
181
+ Unless required by applicable law or agreed to in writing, software
182
+ distributed under the License is distributed on an "AS IS" BASIS,
183
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
184
+ See the License for the specific language governing permissions and
185
+ limitations under the License.
package/PROPOSAL.md ADDED
@@ -0,0 +1,18 @@
1
+ # Apache LSJI (Incubating) Proposal
2
+
3
+ ## Abstract
4
+ LSJI is an open-source, edge-native framework tailored for cost-optimized, high-frequency autonomous reinforcement learning. Operating completely stateless within micro-runtime edge environments (such as Cloudflare Workers), LSJI tracks user sequential decision-making processes under ultra-low latency constraints and dynamically performs continuous pattern analysis based on tens of thousands of data points.
5
+
6
+ ## Proposal
7
+ We propose donating LSJI to the Apache Software Foundation (ASF) as an incubating project. LSJI solves the critical challenge of heavy resource consumption in traditional AI model training by utilizing event-driven, distributed cron-triggers inside lightweight edge workers. By leveraging structured relational queries (SQL) for real-time style matching and processing decision paths (e.g., sequential gestures), LSJI provides an alternative, sustainable infrastructure for decentralized, cost-conscious AI deployment.
8
+
9
+ ## Initial Source
10
+ The project is currently hosted on GitHub under the organization name **ryopc** and developed by **game_ryo (ryotagtagtag-wq)**.
11
+ * Repository: https://github.com
12
+ * Digital Object Identifier (DOI): Registered via Zenodo
13
+
14
+ ## Initial Committers & PPMC Members
15
+ * **game_ryo (ryotagtagtag-wq)** - Project Founder / Lead Architect
16
+
17
+ ## License
18
+ LSJI is currently licensed under the **MIT License**. Upon acceptance into the Apache Incubator, the source code and all future contributions will be transitioned to the **Apache License, Version 2.0**.
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # LSJI
2
+
3
+ A general-purpose reinforcement learning agent framework implemented in Node.js.
4
+
5
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
6
+ [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D22-green.svg)](https://nodejs.org/)
7
+
8
+ ## Overview
9
+
10
+ LSJI (Learning System for Just-In-time Intelligence) is a lightweight, dependency-minimal reinforcement learning framework designed to run on Node.js. It provides:
11
+
12
+ - **Q-Learning Engine** with configurable learning rate, discount factor, and exploration rate
13
+ - **Pluggable Storage** abstraction supporting `node:sqlite` (built-in), `better-sqlite3`, and in-memory JSON
14
+ - **Environment Interface** for defining custom RL environments
15
+ - **CLI** for training, playing, and inspecting agents
16
+
17
+ Originally developed as a Cloudflare Workers-based Rock-Paper-Scissors AI, LSJI has been completely rearchitected as a platform-agnostic Node.js library suitable for ASF incubation.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install lsji
23
+ # or for local development
24
+ npm link
25
+ ```
26
+
27
+ ## Quick Start
28
+
29
+ ```bash
30
+ # Train an agent (200 episodes)
31
+ lsji train --episodes 200
32
+
33
+ # Play against the agent (0=Rock, 1=Scissors, 2=Paper)
34
+ lsji play --hand 0
35
+
36
+ # Check status
37
+ lsji status
38
+
39
+ # Start/stop the training loop
40
+ lsji start
41
+ lsji stop
42
+ ```
43
+
44
+ ## Programmatic Usage
45
+
46
+ ```javascript
47
+ import { Agent, QLearning, MemoryStorage } from 'lsji';
48
+ import { RockPaperScissorsEnv } from 'lsji/envs'; // Next phase
49
+
50
+ const storage = new MemoryStorage();
51
+ const qlearning = new QLearning({ alpha: 0.1, gamma: 0.9, epsilon: 0.1, storage });
52
+ const agent = new Agent(qlearning, storage);
53
+
54
+ // Train
55
+ await agent.train({ episodes: 200 });
56
+
57
+ // Play
58
+ const result = await agent.play(0); // 0 = Rock
59
+ console.log(result); // { aiHand: 1, outcome: 'AI_WIN', ... }
60
+ ```
61
+
62
+ ## Architecture
63
+
64
+ ```
65
+ src/
66
+ ├── core/
67
+ │ ├── env.js # Environment interface
68
+ │ ├── qlearning.js # Q-Learning (TD) engine
69
+ │ └── agent.js # High-level agent orchestration
70
+ ├── storage/
71
+ │ ├── index.js # Storage interface
72
+ │ ├── sqlite.js # node:sqlite implementation
73
+ │ ├── better-sqlite.js # better-sqlite3 implementation
74
+ │ └── memory.js # In-memory JSON implementation
75
+ ├── cli.js # CLI commands
76
+ └── index.js # Public API exports
77
+ ```
78
+
79
+ ## Storage Backends
80
+
81
+ | Backend | Package | Description |
82
+ |---------|---------|-------------|
83
+ | `sqlite` | `node:sqlite` | Built-in Node.js 22+, zero dependencies (recommended) |
84
+ | `better-sqlite` | `better-sqlite3` | High-performance synchronous API |
85
+ | `memory` | (built-in) | In-memory JSON, ideal for testing |
86
+
87
+ ```javascript
88
+ import { SqliteStorage } from 'lsji/storage';
89
+ const storage = new SqliteStorage('./data.db');
90
+ ```
91
+
92
+ ## Configuration
93
+
94
+ Environment variables:
95
+ - `LSJI_STORAGE` - Storage backend (`sqlite`, `better-sqlite`, `memory`, default: `sqlite`)
96
+ - `LSJI_DB_PATH` - Database file path (default: `./lsji.db`)
97
+
98
+ ## License
99
+
100
+ Apache License 2.0 - see [LICENSE](LICENSE) for details.
101
+
102
+ Copyright 2026 ryopc org
package/bin/lsji.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * LSJI CLI Entry Point
4
+ */
5
+
6
+ import { main } from '../src/cli.js';
7
+
8
+ main().catch(console.error);
package/docs/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Website
2
+
3
+ This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install
9
+ ```
10
+
11
+ **Note**: feel free to use the package manager of your choice.
12
+
13
+ ## Local Development
14
+
15
+ ```bash
16
+ npm run start
17
+ ```
18
+
19
+ This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
20
+
21
+ ## Build
22
+
23
+ ```bash
24
+ npm run build
25
+ ```
26
+
27
+ This command generates static content into the `build` directory and can be served using any static contents hosting service.
28
+
29
+ ## Deployment
30
+
31
+ Using SSH:
32
+
33
+ ```bash
34
+ USE_SSH=true npm run deploy
35
+ ```
36
+
37
+ Not using SSH:
38
+
39
+ ```bash
40
+ GIT_USER=<Your GitHub username> npm run deploy
41
+ ```
42
+
43
+ If you are using GitHub Pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
@@ -0,0 +1,12 @@
1
+ ---
2
+ slug: first-blog-post
3
+ title: First Blog Post
4
+ authors: [slorber, yangshun]
5
+ tags: [hola, docusaurus]
6
+ ---
7
+
8
+ Lorem ipsum dolor sit amet...
9
+
10
+ {/* truncate */}
11
+
12
+ ...consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
@@ -0,0 +1,44 @@
1
+ ---
2
+ slug: long-blog-post
3
+ title: Long Blog Post
4
+ authors: yangshun
5
+ tags: [hello, docusaurus]
6
+ ---
7
+
8
+ This is the summary of a very long blog post,
9
+
10
+ Use a `{/*` `truncate` `*/}` comment to limit blog post size in the list view.
11
+
12
+ {/* truncate */}
13
+
14
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
15
+
16
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
17
+
18
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
19
+
20
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
21
+
22
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
23
+
24
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
25
+
26
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
27
+
28
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
29
+
30
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
31
+
32
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
33
+
34
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
35
+
36
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
37
+
38
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
39
+
40
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
41
+
42
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
43
+
44
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
@@ -0,0 +1,24 @@
1
+ ---
2
+ slug: mdx-blog-post
3
+ title: MDX Blog Post
4
+ authors: [slorber]
5
+ tags: [docusaurus]
6
+ ---
7
+
8
+ Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/markdown-features), such as [MDX](https://mdxjs.com/).
9
+
10
+ :::tip
11
+
12
+ Use the power of React to create interactive blog posts.
13
+
14
+ :::
15
+
16
+ {/* truncate */}
17
+
18
+ For example, use JSX to create an interactive button:
19
+
20
+ ```js
21
+ <button onClick={() => alert('button clicked!')}>Click me!</button>
22
+ ```
23
+
24
+ <button onClick={() => alert('button clicked!')}>Click me!</button>
@@ -0,0 +1,29 @@
1
+ ---
2
+ slug: welcome
3
+ title: Welcome
4
+ authors: [slorber, yangshun]
5
+ tags: [facebook, hello, docusaurus]
6
+ ---
7
+
8
+ [Docusaurus blogging features](https://docusaurus.io/docs/blog) are powered by the [blog plugin](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog).
9
+
10
+ Here are a few tips you might find useful.
11
+
12
+ {/* truncate */}
13
+
14
+ Simply add Markdown files (or folders) to the `blog` directory.
15
+
16
+ Regular blog authors can be added to `authors.yml`.
17
+
18
+ The blog post date can be extracted from filenames, such as:
19
+
20
+ - `2019-05-30-welcome.md`
21
+ - `2019-05-30-welcome/index.md`
22
+
23
+ A blog post folder can be convenient to co-locate blog post images:
24
+
25
+ ![Docusaurus Plushie](./docusaurus-plushie-banner.jpeg)
26
+
27
+ The blog supports tags as well!
28
+
29
+ **And if you don't want a blog**: just delete this directory, and use `blog: false` in your Docusaurus config.