@faces-sh/cli 1.2.0 → 1.3.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 (53) hide show
  1. package/README.md +51 -33
  2. package/dist/chat-command.d.ts +2 -0
  3. package/dist/chat.d.ts +2 -0
  4. package/dist/choices.d.ts +9 -0
  5. package/dist/choices.js +17 -1
  6. package/dist/client.d.ts +8 -0
  7. package/dist/client.js +37 -0
  8. package/dist/commands/chat/chat.d.ts +2 -0
  9. package/dist/commands/chat/messages.d.ts +2 -0
  10. package/dist/commands/chat/responses.d.ts +2 -0
  11. package/dist/commands/chat/thread.d.ts +2 -0
  12. package/dist/commands/choices.d.ts +3 -0
  13. package/dist/commands/choices.js +36 -0
  14. package/dist/commands/conversation/add.d.ts +2 -0
  15. package/dist/commands/conversation/add.js +5 -2
  16. package/dist/commands/conversation/create.d.ts +2 -0
  17. package/dist/commands/conversation/create.js +4 -2
  18. package/dist/commands/decide.d.ts +31 -0
  19. package/dist/commands/decide.js +84 -4
  20. package/dist/commands/face/list.d.ts +2 -0
  21. package/dist/commands/face/list.js +23 -1
  22. package/dist/commands/premise/add.d.ts +30 -0
  23. package/dist/commands/premise/add.js +86 -0
  24. package/dist/commands/premise/choices.d.ts +21 -0
  25. package/dist/commands/premise/choices.js +68 -0
  26. package/dist/commands/premise/claim.d.ts +20 -0
  27. package/dist/commands/premise/claim.js +38 -0
  28. package/dist/commands/premise/decide.d.ts +18 -0
  29. package/dist/commands/premise/decide.js +36 -0
  30. package/dist/commands/premise/delete.d.ts +17 -0
  31. package/dist/commands/premise/delete.js +17 -0
  32. package/dist/commands/premise/edit.d.ts +28 -0
  33. package/dist/commands/premise/edit.js +51 -0
  34. package/dist/commands/premise/get.d.ts +22 -0
  35. package/dist/commands/premise/get.js +37 -0
  36. package/dist/commands/premise/refine.d.ts +20 -0
  37. package/dist/commands/premise/refine.js +80 -0
  38. package/dist/commands/state/create.d.ts +13 -2
  39. package/dist/commands/state/create.js +55 -2
  40. package/dist/commands/state/get.d.ts +19 -2
  41. package/dist/commands/state/get.js +30 -2
  42. package/dist/commands/state/use.d.ts +16 -0
  43. package/dist/commands/state/use.js +25 -0
  44. package/dist/conversation.d.ts +30 -3
  45. package/dist/conversation.js +202 -18
  46. package/dist/foreman.d.ts +47 -0
  47. package/dist/foreman.js +115 -0
  48. package/dist/refine.d.ts +106 -0
  49. package/dist/refine.js +601 -0
  50. package/dist/synopsis.d.ts +49 -0
  51. package/dist/synopsis.js +43 -0
  52. package/oclif.manifest.json +1415 -109
  53. package/package.json +5 -2
@@ -0,0 +1,43 @@
1
+ function w(x) {
2
+ return typeof x === 'number' ? String(Math.round(x * 100) / 100) : '-';
3
+ }
4
+ export function synopsisLines(s, outline = true) {
5
+ const lines = (s.text ?? '').split('\n').filter((l) => l !== '');
6
+ if (outline && s.outline)
7
+ lines.push('', 'Outline:', ...s.outline.split('\n').map((l) => ` ${l}`));
8
+ return lines;
9
+ }
10
+ export function pickParallel(s, n) {
11
+ const ready = s.ready ?? [];
12
+ const out = [];
13
+ for (const g of s.groups ?? []) {
14
+ if (out.length >= n)
15
+ break;
16
+ const first = g.items[0];
17
+ const item = ready.find((r) => r.key === first.key && r.action === first.action);
18
+ if (item)
19
+ out.push(item);
20
+ }
21
+ return out;
22
+ }
23
+ export function nextLines(s, picked, claimed = []) {
24
+ if (s.done)
25
+ return ['Every goal is achieved: you can stop.'];
26
+ if (picked.length === 0) {
27
+ const held = (s.claims ?? []).map((c) => `${c.key} (${c.agent})`);
28
+ return [held.length > 0 ? `Nothing ready: every ready item is claimed: ${held.join(', ')}.` : 'Nothing ready.'];
29
+ }
30
+ const lines = [];
31
+ picked.forEach((f, i) => {
32
+ const c = claimed.find((x) => x.key === f.key);
33
+ lines.push(`${i + 1}. ${f.action} ${f.key} [weight ${w(f.weight)}]${c ? ` claimed ${c.id} until ${c.expires_at ?? '?'}` : ''}`);
34
+ if (f.reason)
35
+ lines.push(` ${f.reason}`);
36
+ if (f.path && f.path.length > 1)
37
+ lines.push(` for: ${f.path.slice(0, -1).reverse().join(' < ')}`);
38
+ });
39
+ const rest = (s.ready ?? []).length - picked.length;
40
+ if (rest > 0)
41
+ lines.push('', `${rest} more ready item(s); ${(s.groups ?? []).length} parallel group(s) in all.`);
42
+ return lines;
43
+ }