skejj 0.0.5

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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +379 -0
  3. package/dist/index.js +4078 -0
  4. package/package.json +68 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Sunny Amrat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,379 @@
1
+ # skejj
2
+
3
+ Constraint-based schedule solver -- define tasks, dependencies, and resources; get a timed plan.
4
+
5
+ ```
6
+ $ npx skejj make examples/roast-chicken.json
7
+
8
+ Roast Chicken Dinner
9
+ A classic Sunday roast with oven-constrained cooking steps. The oven (capacity 1) forces chicken and potatoes to roast sequentially.
10
+
11
+ 17:00 17:30 18:00 18:30 19:00
12
+ ─ Mains ───────────────────────────────────────────────────────────────────────
13
+ Prep chicken ████████ │ │ │
14
+ Roast chicken │ █████████████████████████████████████████████
15
+ Make gravy │ │ │ │ █████
16
+ Plate up │ │ │ │ ███
17
+ ─ Sides ───────────────────────────────────────────────────────────────────────
18
+ Prep potatoes ░░░░░░░░░░ │ │ │
19
+ Steam vegetables ░░░░░░░░ │ │ │
20
+ Roast potatoes │ │ │ ░░░░░░░░░░░░░░░░░░░░
21
+ ─ Setup ───────────────────────────────────────────────────────────────────────
22
+ Set table ░░░░░ │ │ │
23
+ Preheat Oven │ ░░░ │ │ │
24
+
25
+ --- Summary ---
26
+ Total time: 2h
27
+ Steps: 9
28
+ Critical path: 2h (4 steps)
29
+ Resources used: Oven
30
+
31
+ --- Critical Path ---
32
+ Prep chicken -> Roast chicken -> Make gravy -> Plate up
33
+
34
+ Float per step:
35
+ Prep chicken: 17:00 -> 17:15 [0m (critical)]
36
+ Prep potatoes: 17:00 -> 17:20 [55m slack]
37
+ Steam vegetables: 17:00 -> 17:15 [100m slack]
38
+ Set table: 17:00 -> 17:10 [105m slack]
39
+ Preheat Oven: 17:10 -> 17:15 [10m slack]
40
+ Roast chicken: 17:15 -> 18:45 [0m (critical)]
41
+ Roast potatoes: 18:15 -> 18:55 [55m slack]
42
+ Make gravy: 18:45 -> 18:55 [0m (critical)]
43
+ Plate up: 18:55 -> 19:00 [0m (critical)]
44
+ ```
45
+
46
+ ## Quick Start
47
+
48
+ ```bash
49
+ npx skejj make examples/roast-chicken.json
50
+ ```
51
+
52
+ No install needed -- `npx` downloads and runs skejj directly.
53
+
54
+ To install globally:
55
+
56
+ ```bash
57
+ npm install -g skejj
58
+ ```
59
+
60
+ Then use `skejj` instead of `npx skejj` everywhere.
61
+
62
+ **Start from scratch with the interactive wizard:**
63
+
64
+ ```bash
65
+ skejj new
66
+ ```
67
+
68
+ **Generate a schedule from a description using AI:**
69
+
70
+ ```bash
71
+ skejj generate "plan a birthday party for 20 kids"
72
+ ```
73
+
74
+ ## Commands
75
+
76
+ ### `skejj make <file>`
77
+
78
+ Solve a schedule file and display the timed plan as an ASCII Gantt chart.
79
+
80
+ Critical-path steps are shown with solid blocks (█). Non-critical steps with lighter blocks (░). The summary includes total time, step count, critical path length, and float per step.
81
+
82
+ | Flag | Default | Description |
83
+ | --------------------- | -------------- | --------------------------------------------------------------------------------- |
84
+ | `-o, --output <file>` | stdout | Write output to file instead of stdout |
85
+ | `-q, --quiet` | false | Suppress summary stats, show only the schedule |
86
+ | `-f, --format <type>` | -- | Export format: `gantt`, `csv`, `json` (writes a file in addition to ASCII output) |
87
+ | `--width <cols>` | terminal width | Chart width in columns (default: terminal width or 80) |
88
+
89
+ ```bash
90
+ # Solve and display in the terminal
91
+ skejj make examples/roast-chicken.json
92
+
93
+ # Export to CSV alongside ASCII output
94
+ skejj make myplan.json --format csv
95
+
96
+ # Write ASCII output to a file, suppress summary
97
+ skejj make myplan.json --quiet --output schedule.txt
98
+
99
+ # Export JSON data with a fixed chart width
100
+ skejj make myplan.json --format json --width 120
101
+ ```
102
+
103
+ ---
104
+
105
+ ### `skejj check <file>`
106
+
107
+ Validate a schedule file without solving it. Reports schema errors and constraint warnings.
108
+
109
+ | Flag | Default | Description |
110
+ | ------------- | ------- | ----------------------------------- |
111
+ | `-q, --quiet` | false | Show only errors, suppress warnings |
112
+
113
+ ```bash
114
+ # Validate and show all errors and warnings
115
+ skejj check myplan.json
116
+
117
+ # Show errors only (useful in CI)
118
+ skejj check myplan.json --quiet
119
+ ```
120
+
121
+ ---
122
+
123
+ ### `skejj new`
124
+
125
+ Guided interactive wizard to create a new schedule from scratch. Prompts for schedule name, steps, durations, dependencies, and resources. Requires an interactive terminal (TTY).
126
+
127
+ ```bash
128
+ skejj new
129
+ ```
130
+
131
+ ---
132
+
133
+ ### `skejj generate <description>`
134
+
135
+ Generate a schedule JSON file from a natural language description using an LLM. Requires an API key configured via `skejj config set`.
136
+
137
+ | Flag | Default | Description |
138
+ | --------------------- | -------------------------- | -------------------------------------------------------------------------- |
139
+ | `-o, --output <file>` | derived from schedule name | Override output filename |
140
+ | `-f, --format <type>` | -- | Export format in addition to ASCII Gantt: `gantt` (Mermaid), `csv`, `json` |
141
+
142
+ ```bash
143
+ # Generate and display a birthday party schedule
144
+ skejj generate "plan a kids birthday party for 20 children"
145
+
146
+ # Generate and save to a specific file
147
+ skejj generate "weekend trip to Paris" --output paris-trip.json
148
+
149
+ # Generate and export a CSV
150
+ skejj generate "home renovation project" --format csv
151
+ ```
152
+
153
+ ---
154
+
155
+ ### `skejj config`
156
+
157
+ Manage LLM provider configuration for the `generate` command.
158
+
159
+ **Subcommands:**
160
+
161
+ #### `skejj config set <key> <value>`
162
+
163
+ Set a configuration value. Supported keys: `provider` (e.g. `openai`, `anthropic`), `apiKey`, `model`.
164
+
165
+ #### `skejj config show`
166
+
167
+ Display current configuration.
168
+
169
+ ```bash
170
+ # Set your LLM provider and API key
171
+ skejj config set provider openai
172
+ skejj config set apiKey sk-...
173
+
174
+ # Use Anthropic instead
175
+ skejj config set provider anthropic
176
+ skejj config set apiKey sk-ant-...
177
+
178
+ # Show current config
179
+ skejj config show
180
+ ```
181
+
182
+ ---
183
+
184
+ ### `skejj adjust <file>`
185
+
186
+ Interactively adjust a solved schedule in a re-solve loop. Opens an interactive editor (requires TTY) where you can modify step durations, dependencies, and resources, and see the Gantt chart update live.
187
+
188
+ ```bash
189
+ skejj adjust examples/roast-chicken.json
190
+
191
+ # Or adjust a schedule you created
192
+ skejj adjust myplan.json
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Examples
198
+
199
+ ### Roast Chicken Dinner
200
+
201
+ Demonstrates: equipment resource constraint (Oven, capacity 1 -- chicken and potatoes cannot roast simultaneously), backward scheduling from a target dinner time, and a linear dependency chain (prep -> roast -> gravy -> plate).
202
+
203
+ ```
204
+ $ npx skejj make examples/roast-chicken.json
205
+
206
+ Roast Chicken Dinner
207
+ A classic Sunday roast with oven-constrained cooking steps. The oven (capacity 1) forces chicken and potatoes to roast sequentially.
208
+
209
+ 17:00 17:30 18:00 18:30 19:00
210
+ ─ Mains ───────────────────────────────────────────────────────────────────────
211
+ Prep chicken ████████ │ │ │
212
+ Roast chicken │ █████████████████████████████████████████████
213
+ Make gravy │ │ │ │ █████
214
+ Plate up │ │ │ │ ███
215
+ ─ Sides ───────────────────────────────────────────────────────────────────────
216
+ Prep potatoes ░░░░░░░░░░ │ │ │
217
+ Steam vegetables ░░░░░░░░ │ │ │
218
+ Roast potatoes │ │ │ ░░░░░░░░░░░░░░░░░░░░
219
+ ─ Setup ───────────────────────────────────────────────────────────────────────
220
+ Set table ░░░░░ │ │ │
221
+ Preheat Oven │ ░░░ │ │ │
222
+
223
+ --- Summary ---
224
+ Total time: 2h
225
+ Steps: 9
226
+ Critical path: 2h (4 steps)
227
+ Resources used: Oven
228
+
229
+ --- Critical Path ---
230
+ Prep chicken -> Roast chicken -> Make gravy -> Plate up
231
+
232
+ Float per step:
233
+ Prep chicken: 17:00 -> 17:15 [0m (critical)]
234
+ Prep potatoes: 17:00 -> 17:20 [55m slack]
235
+ Steam vegetables: 17:00 -> 17:15 [100m slack]
236
+ Set table: 17:00 -> 17:10 [105m slack]
237
+ Preheat Oven: 17:10 -> 17:15 [10m slack]
238
+ Roast chicken: 17:15 -> 18:45 [0m (critical)]
239
+ Roast potatoes: 18:15 -> 18:55 [55m slack]
240
+ Make gravy: 18:45 -> 18:55 [0m (critical)]
241
+ Plate up: 18:55 -> 19:00 [0m (critical)]
242
+ ```
243
+
244
+ ---
245
+
246
+ ### Kids Birthday Party
247
+
248
+ Demonstrates: people resource constraint (4 helpers shared across parallel tasks), forward scheduling from a party start time, and parallel tracks running simultaneously (food, venue setup, activities).
249
+
250
+ ```
251
+ $ npx skejj make examples/birthday-party.json
252
+
253
+ Kids Birthday Party
254
+ Planning a kids birthday party with a team of helpers. People resource allocation ensures we never exceed 4 helpers simultaneously.
255
+
256
+ 10:00 10:30 11:00 11:30 12:00 12:30 13:00 13:3013:40
257
+ ─ Food ────────────────────────────────────────────────────────────────────────
258
+ Bake cake ░░░░░░░░░░░░░░░░░│ │ │ │ │ │
259
+ Ice cake │ │ ░░░░░ │ │ │ │ │
260
+ Serve cake │ │ │ │ │ │ ████ │
261
+ ─ Venue ───────────────────────────────────────────────────────────────────────
262
+ Buy supplies █████████████████│ │ │ │ │ │
263
+ Decorate venue │ │ ████████████ │ │ │ │
264
+ Blow up balloons │ │ │ │ ░░░░░░░░ │ │ │
265
+ Clean up │ │ │ │ │ │ │ ████████
266
+ ─ Activities ──────────────────────────────────────────────────────────────────
267
+ Welcome guests │ │ │ │ ███ │ │ │ │
268
+ Party games │ │ │ │ █████████████████ │ │
269
+ Set up games │ │ │ │ │ ░░░░░░ │ │
270
+
271
+ --- Summary ---
272
+ Total time: 3h 40m
273
+ Steps: 10
274
+ Critical path: 3h 40m (6 steps)
275
+ Resources used: Helpers
276
+
277
+ --- Critical Path ---
278
+ Buy supplies -> Decorate venue -> Welcome guests -> Party games -> Serve cake -> Clean up
279
+
280
+ Float per step:
281
+ Buy supplies: 10:00 -> 11:00 [0m (critical)]
282
+ Bake cake: 10:00 -> 11:00 [95m slack]
283
+ Decorate venue: 11:00 -> 11:45 [0m (critical)]
284
+ Ice cake: 11:00 -> 11:20 [95m slack]
285
+ Welcome guests: 11:45 -> 11:55 [0m (critical)]
286
+ Blow up balloons: 11:00 -> 11:30 [15m slack]
287
+ Party games: 11:55 -> 12:55 [0m (critical)]
288
+ Set up games: 11:00 -> 11:20 [25m slack]
289
+ Serve cake: 12:55 -> 13:10 [0m (critical)]
290
+ Clean up: 13:10 -> 13:40 [0m (critical)]
291
+
292
+ --- Warnings ---
293
+ - Step 'Blow up balloons' was delayed beyond its available slack due to resource conflict with 'Helpers'
294
+ - Step 'Set up games' was delayed beyond its available slack due to resource conflict with 'Helpers'
295
+ ```
296
+
297
+ ---
298
+
299
+ ### London Weekend Sightseeing
300
+
301
+ Demonstrates: ALAP (As Late As Possible) timing for dinner steps, multi-day multi-track scheduling, and a long planning horizon across two days with no resource constraints.
302
+
303
+ ```
304
+ $ npx skejj make examples/london-sightseeing.json
305
+
306
+ London Weekend Sightseeing
307
+ A two-day London itinerary covering major landmarks and cultural highlights. Dinner steps use ALAP timing to push them as late in the day as possible.
308
+
309
+ 09:0010:0011:0012:0013:0014:0015:0016:0017:0018:0019:0020:0021:00
310
+ ─ Day 1 ───────────────────────────────────────────────────────────────────────
311
+ Tower of London █████████│ │ │ │ │ │ │ │ │ │
312
+ Borough Market lunch │ │ █████│ │ │ │ │ │ │ │ │
313
+ Thames Southbank walk │ │ │ ████ │ │ │ │ │ │ │ │
314
+ Tate Modern │ │ │ │ ███████ │ │ │ │ │ │
315
+ Day 1 dinner │ │ │ │ │ │ ████ │ │ │ │ │
316
+ ─ Day 2 ───────────────────────────────────────────────────────────────────────
317
+ British Museum │ │ │ │ │ │ │████████████ │ │ │
318
+ Covent Garden lunch │ │ │ │ │ │ │ │ │ ███ │ │
319
+ Westminster walk │ │ │ │ │ │ │ │ │ │ █████ │
320
+ London Eye │ │ │ │ │ │ │ │ │ │ │ ██│
321
+ Day 2 dinner │ │ │ │ │ │ │ │ │ │ │ █████
322
+
323
+ --- Summary ---
324
+ Total time: 12h
325
+ Steps: 10
326
+ Critical path: 12h (10 steps)
327
+
328
+ --- Critical Path ---
329
+ Tower of London -> Borough Market lunch -> Thames Southbank walk -> Tate Modern -> Day 1 dinner -> British Museum -> Covent Garden lunch -> Westminster walk -> London Eye -> Day 2 dinner
330
+
331
+ Float per step:
332
+ Tower of London: 09:00 -> 11:00 [0m (critical)]
333
+ Borough Market lunch: 11:00 -> 12:00 [0m (critical)]
334
+ Thames Southbank walk: 12:00 -> 12:45 [0m (critical)]
335
+ Tate Modern: 12:45 -> 14:15 [0m (critical)]
336
+ Day 1 dinner: 14:15 -> 15:15 [0m (critical)]
337
+ British Museum: 15:15 -> 17:45 [0m (critical)]
338
+ Covent Garden lunch: 17:45 -> 18:30 [0m (critical)]
339
+ Westminster walk: 18:30 -> 19:30 [0m (critical)]
340
+ London Eye: 19:30 -> 20:00 [0m (critical)]
341
+ Day 2 dinner: 20:00 -> 21:00 [0m (critical)]
342
+ ```
343
+
344
+ ---
345
+
346
+ See [Schedule Template Schema Reference](docs/SCHEMA.md) for the full field reference, or add a `$schema` key to your JSON file for editor autocomplete.
347
+
348
+ ## Writing Your Own Schedule
349
+
350
+ Schedules are JSON (or YAML) files. The fastest way to start:
351
+
352
+ ```bash
353
+ # Interactive wizard -- no schema knowledge required
354
+ skejj new
355
+
356
+ # Or write JSON directly and validate as you go
357
+ skejj check myplan.json
358
+ ```
359
+
360
+ **Editor autocomplete:** Add a `$schema` field to your JSON file to get inline validation and autocomplete in VS Code and other editors:
361
+
362
+ ```json
363
+ {
364
+ "$schema": "./docs/schema.json",
365
+ "id": "my-schedule",
366
+ "name": "My Schedule",
367
+ "steps": [
368
+ {
369
+ "id": "step-1",
370
+ "title": "First step",
371
+ "durationMins": 30
372
+ }
373
+ ]
374
+ }
375
+ ```
376
+
377
+ Full field reference: [docs/SCHEMA.md](docs/SCHEMA.md)
378
+
379
+ The schema covers: steps, tracks, resources (Equipment, People, Consumable), dependency types (FinishToStart, StartToStart, FinishToFinish, StartToFinish), timing policies (Asap, Alap), and time constraints (forward from `startTime`, backward from `endTime`).