@iiiokojiadbi/shift 0.38.0 → 0.38.2
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/core/sizes.ts +31 -27
- package/package.json +1 -1
package/core/sizes.ts
CHANGED
|
@@ -21,28 +21,21 @@ import { sessionDoctrine } from './tools'
|
|
|
21
21
|
export async function sizeReport(project: Project, counter?: (text: string) => number): Promise<string> {
|
|
22
22
|
if (!project.settings.enabled) return 'Shift is disabled in this project.'
|
|
23
23
|
const count = counter ?? ((text: string) => Math.ceil(text.length / 4))
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
'',
|
|
28
|
-
'| Delivery | Entity | Tokens |',
|
|
29
|
-
'|---|---|---:|',
|
|
30
|
-
]
|
|
31
|
-
const row = (group: string, label: string, tokens: number) =>
|
|
32
|
-
lines.push(`| ${group} | ${label.replaceAll('|', '\\|').replace(/[\r\n]/g, ' ')} | ${tokens} |`)
|
|
24
|
+
const sessionRows: string[] = []
|
|
25
|
+
const continueRows: string[] = []
|
|
26
|
+
const row = (label: string, tokens: number) => `${String(tokens).padStart(7)} ${label.replace(/[\r\n]/g, ' ')}`
|
|
33
27
|
const files = await sessionFiles(project, { refresh: false })
|
|
34
28
|
const doctrine = sessionDoctrine(project.settings).doctrine
|
|
35
|
-
row('
|
|
29
|
+
sessionRows.push(row('Doctrine', count(doctrine)))
|
|
36
30
|
for (const file of files) {
|
|
37
|
-
row(
|
|
31
|
+
sessionRows.push(row(file.path, count(fileBlock(file.path, file.text))))
|
|
38
32
|
if (file.path === project.settings.files.shift) {
|
|
39
33
|
const parts = file.text.split('\n')
|
|
40
34
|
const { start, end } = mapBounds(parts)
|
|
41
|
-
if (end >= 0) row('
|
|
35
|
+
if (end >= 0) sessionRows.push(row(' of which: documentation map', count(parts.slice(start, end + 1).join('\n'))))
|
|
42
36
|
}
|
|
43
37
|
}
|
|
44
38
|
const session = count([doctrine, renderSessionFiles(files)].filter(Boolean).join('\n\n'))
|
|
45
|
-
row('Total', 'Session', session)
|
|
46
39
|
const folders = (await shiftNames(project)).reverse()
|
|
47
40
|
const saved: { name: string; letter: string }[] = []
|
|
48
41
|
for (const name of folders) {
|
|
@@ -53,25 +46,36 @@ export async function sizeReport(project: Project, counter?: (text: string) => n
|
|
|
53
46
|
const dir = `${project.root}/${SHIFTS}/${saved[0]?.name ?? '<next-shift>'}`
|
|
54
47
|
const back = await handBack(project, dir)
|
|
55
48
|
if (back.work) {
|
|
56
|
-
row(
|
|
49
|
+
continueRows.push(row(BOARD, count(back.work.board)))
|
|
57
50
|
for (const task of inProgress(back.work)) {
|
|
58
51
|
const folder = `${TASKS}/${task.name}`
|
|
59
|
-
row(
|
|
60
|
-
row(
|
|
61
|
-
if (task.notes.length) row(
|
|
52
|
+
continueRows.push(row(`${folder}/${NAMES.task}`, count(task.task ?? 'missing')))
|
|
53
|
+
continueRows.push(row(`${folder}/${NAMES.track}`, count(trackPreview(task.track ?? 'missing'))))
|
|
54
|
+
if (task.notes.length) continueRows.push(row(`${folder}/notes (descriptions)`, count(notesList(task.name, task.notes))))
|
|
62
55
|
}
|
|
63
|
-
row('
|
|
56
|
+
continueRows.push(row('Knowledge index', count(knowledgeMap(back.work.knowledge))))
|
|
64
57
|
}
|
|
65
|
-
row('
|
|
66
|
-
if (back.stuck.length) row('
|
|
67
|
-
if (back.remarks) row('
|
|
58
|
+
continueRows.push(row('Recent shifts', count(renderRecent(back.recent))))
|
|
59
|
+
if (back.stuck.length) continueRows.push(row('Unchanged tasks', count(renderStuck(back.stuck))))
|
|
60
|
+
if (back.remarks) continueRows.push(row('Document remarks', count(back.remarks)))
|
|
68
61
|
const draft = await project.store.read(`${project.root}/${LETTER}`)
|
|
69
62
|
const letter = draft ?? saved[0]?.letter ?? ''
|
|
70
|
-
row(
|
|
63
|
+
continueRows.push(row(draft !== null ? 'Working letter' : saved.length ? 'Latest saved letter' : 'Letter (missing)', count(letter)))
|
|
71
64
|
const continuation = count(continuePrompt(letter, back))
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
return [
|
|
66
|
+
counter ? 'Text tokens (o200k_base).' : 'Estimated text tokens (4 characters per token).',
|
|
67
|
+
row('Session + continue', session + continuation),
|
|
68
|
+
'',
|
|
69
|
+
row('Session', session),
|
|
70
|
+
...sessionRows,
|
|
71
|
+
'',
|
|
72
|
+
row('Continue message', continuation),
|
|
73
|
+
...continueRows,
|
|
74
|
+
'',
|
|
75
|
+
'Totals include message framing.',
|
|
76
|
+
'',
|
|
77
|
+
...(saved.length
|
|
78
|
+
? [`Saved letters in ${SHIFTS}/ (outside total)`, ...saved.map(entry => row(entry.name, count(entry.letter)))]
|
|
79
|
+
: ['No saved letters.']),
|
|
80
|
+
].join('\n')
|
|
77
81
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iiiokojiadbi/shift",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.2",
|
|
4
4
|
"description": "The agent decides by itself when to shift: it keeps a work board and task folders, writes a letter to itself, and continues from where it stopped.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|