@able-autonomy/able 0.0.21 → 0.2.1
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/able.ts +10 -2
- package/config.ts +11 -0
- package/package.json +1 -1
- package/src/audit/bloat/apply.test.ts +81 -0
- package/src/audit/bloat/apply.ts +49 -0
- package/src/{agents → audit/bloat}/blocks.ts +2 -2
- package/src/{agents → audit/bloat}/checks.ts +3 -3
- package/src/audit/bloat/compare.ts +63 -0
- package/src/{agents → audit/bloat}/findings.ts +11 -7
- package/src/{agents → audit/bloat}/grid.ts +6 -6
- package/src/audit/bloat/index.ts +258 -0
- package/src/{agents → audit/bloat}/load.ts +2 -2
- package/src/{agents → audit/bloat}/picker.ts +4 -4
- package/src/audit/bloat/report.ts +286 -0
- package/src/{agents → audit/bloat}/scan.ts +3 -3
- package/src/audit/bloat/show.ts +79 -0
- package/src/audit/bloat/steps.ts +32 -0
- package/src/{agents → audit/bloat}/types.ts +48 -3
- package/src/audit/index.ts +19 -0
- package/src/commit.ts +2 -1
- package/src/git.ts +43 -2
- package/src/push.ts +2 -1
- package/src/ui.ts +3 -0
- package/src/workspaces/fixture.ts +49 -0
- package/src/workspaces/index.ts +3 -1
- package/src/workspaces/ls.ts +56 -11
- package/src/workspaces/merge.ts +31 -15
- package/src/workspaces/new.ts +17 -15
- package/src/workspaces/overlap.test.ts +53 -0
- package/src/workspaces/overlap.ts +86 -0
- package/src/workspaces/preview.test.ts +81 -0
- package/src/workspaces/preview.ts +162 -0
- package/src/workspaces/refresh.ts +26 -24
- package/src/workspaces/rm.ts +6 -1
- package/src/workspaces/services.ts +2 -2
- package/src/workspaces/state.ts +56 -9
- package/src/workspaces/trunk.test.ts +88 -0
- package/sync.ts +5 -2
- package/src/agents/index.ts +0 -198
- package/src/agents/report.ts +0 -211
- package/src/agents/show.ts +0 -73
- package/src/agents/steps.ts +0 -32
- /package/src/{agents → audit/bloat}/kinds.ts +0 -0
package/src/agents/show.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// Step 8, show: a run read back from its file and printed as plain text, narrow enough for a terminal and a chat.
|
|
2
|
-
// `--step <n>` prints one step's full view from the same file, so any step can be looked at again later.
|
|
3
|
-
|
|
4
|
-
import { relative } from 'node:path'
|
|
5
|
-
import { dim } from '../ui.ts'
|
|
6
|
-
import * as blocks from './blocks.ts'
|
|
7
|
-
import * as checks from './checks.ts'
|
|
8
|
-
import * as grid from './grid.ts'
|
|
9
|
-
import { kinds, pickOrder } from './kinds.ts'
|
|
10
|
-
import * as load from './load.ts'
|
|
11
|
-
import { runName, tally, type Run } from './report.ts'
|
|
12
|
-
import { who } from './steps.ts'
|
|
13
|
-
import { clip, fit, n, render as renderScan } from './scan.ts'
|
|
14
|
-
|
|
15
|
-
/** One step's full view, from the run file. */
|
|
16
|
-
export function step(run: Run, id: string) {
|
|
17
|
-
// In reading order, as the file has them; the run stores them in pick order.
|
|
18
|
-
const checked = { rules: [...run.rules].sort((a, b) => a.span[0] - b.span[0]), missing: [], errors: [] }
|
|
19
|
-
const views: Record<string, () => string> = {
|
|
20
|
-
scan: () => renderScan(run.scan),
|
|
21
|
-
load: () => load.render(run.load),
|
|
22
|
-
blocks: () => blocks.render(run.blocks),
|
|
23
|
-
checks: () => checks.render(run.checks),
|
|
24
|
-
classify: () => grid.byKind(run.blocks, checked),
|
|
25
|
-
}
|
|
26
|
-
return views[id]?.() ?? ` Step ${id} has no view of its own: its result is in the findings below.\n\n${findings(run)}`
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function findings(run: Run) {
|
|
30
|
-
const out: string[] = []
|
|
31
|
-
const numbered = run.rules.filter((r) => r.n)
|
|
32
|
-
for (const kind of pickOrder) {
|
|
33
|
-
const list = numbered.filter((r) => r.kind === kind)
|
|
34
|
-
if (!list.length) continue
|
|
35
|
-
out.push(` ${kinds[kind].letter} ${kind.toUpperCase()} ${list.length} ${dim(`→ ${kinds[kind].becomes}`)}`)
|
|
36
|
-
for (const r of list) {
|
|
37
|
-
const pick = r.pick === 'yes' ? '[y]' : r.pick === 'no' ? '[n]' : '[ ]'
|
|
38
|
-
const rec = r.recommend ? dim(` rec ${r.recommend}`) : ''
|
|
39
|
-
out.push(` ${pick} ${String(r.n).padStart(2)} ${r.confidence.padEnd(4)} ${fit(`${r.path}:${r.line}`, 34).padEnd(34)} "${clip(r.text.replace(/\s+/g, ' '), 46)}"${rec}`)
|
|
40
|
-
out.push(` ${dim(clip(r.reason, 92))}`)
|
|
41
|
-
if (r.proposal) out.push(` → ${clip(r.proposal.target, 40)}: ${clip(r.proposal.change, 64)}`)
|
|
42
|
-
}
|
|
43
|
-
out.push('')
|
|
44
|
-
}
|
|
45
|
-
return out.join('\n')
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function render(run: Run, path: string, root: string) {
|
|
49
|
-
const out: string[] = []
|
|
50
|
-
const { numbered } = tally(run)
|
|
51
|
-
out.push(
|
|
52
|
-
` RUN ${runName(new Date(run.at))
|
|
53
|
-
.replace(/\.json$/, '')
|
|
54
|
-
.replace(/-(\d\d)(\d\d)$/, ' $1:$2')} ${relative(root, path)} ${run.format}`,
|
|
55
|
-
'',
|
|
56
|
-
)
|
|
57
|
-
out.push(' STEPS')
|
|
58
|
-
for (const s of run.steps) out.push(` ${String(s.n).padStart(2)} ${who[s.kind as keyof typeof who]} ${s.id.padEnd(10)} ${s.summary}`)
|
|
59
|
-
|
|
60
|
-
out.push('', ` WORDS AT START, BY FOLDER (host files; tokens are about 1.3 x words)`)
|
|
61
|
-
out.push(` ${'folder'.padEnd(24)} ${'now'.padStart(6)} ${'after'.padStart(6)} ${'saved'.padStart(6)}`)
|
|
62
|
-
for (const f of run.impact.folders)
|
|
63
|
-
out.push(` ${clip(f.folder === '.' ? '(root)' : f.folder, 24).padEnd(24)} ${n(f.before).padStart(6)} ${n(f.after).padStart(6)} ${`-${n(f.before - f.after)}`.padStart(6)}`)
|
|
64
|
-
|
|
65
|
-
const kept = run.impact.byKind.keep
|
|
66
|
-
out.push('', ` FINDINGS ${numbered} to pick${kept ? `, ${kept.rules} rules kept` : ''} [y] yes [n] no [ ] not picked yet`, '')
|
|
67
|
-
out.push(findings(run))
|
|
68
|
-
|
|
69
|
-
out.push(' AGENTS.md (vendor-neutral; converting is version 2)')
|
|
70
|
-
for (const a of run.agentsMd) out.push(` ${a.path.padEnd(24)} ${a.blockers.length ? a.blockers.join('; ') : 'would convert: AGENTS.md, plus a CLAUDE.md of one line, @AGENTS.md'}`)
|
|
71
|
-
if (!run.agentsMd.length) out.push(' no CLAUDE.md files')
|
|
72
|
-
return out.join('\n')
|
|
73
|
-
}
|
package/src/agents/steps.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// The steps of a run, as data: `able agents run` walks them, the skill follows them, a dashboard page will show them.
|
|
2
|
-
|
|
3
|
-
export type StepKind = 'mechanical' | 'agent' | 'operator'
|
|
4
|
-
|
|
5
|
-
export interface Step {
|
|
6
|
-
n: number
|
|
7
|
-
/** The step's one name, also its command: `able agents <id>`. */
|
|
8
|
-
id: string
|
|
9
|
-
kind: StepKind
|
|
10
|
-
/** False for the steps that come after version 1. */
|
|
11
|
-
v1: boolean
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/** The letter each kind of step shows as in `run` and `show`. */
|
|
15
|
-
export const who: Record<StepKind, string> = { mechanical: 'M', agent: 'A', operator: 'O' }
|
|
16
|
-
|
|
17
|
-
export const steps: Step[] = [
|
|
18
|
-
{ n: 1, id: 'scan', kind: 'mechanical', v1: true },
|
|
19
|
-
{ n: 2, id: 'load', kind: 'mechanical', v1: true },
|
|
20
|
-
{ n: 3, id: 'blocks', kind: 'mechanical', v1: true },
|
|
21
|
-
{ n: 4, id: 'checks', kind: 'mechanical', v1: true },
|
|
22
|
-
{ n: 5, id: 'classify', kind: 'agent', v1: true },
|
|
23
|
-
{ n: 6, id: 'propose', kind: 'agent', v1: true },
|
|
24
|
-
{ n: 7, id: 'report', kind: 'mechanical', v1: true },
|
|
25
|
-
{ n: 8, id: 'show', kind: 'mechanical', v1: true },
|
|
26
|
-
{ n: 9, id: 'pick', kind: 'operator', v1: true },
|
|
27
|
-
{ n: 10, id: 'apply', kind: 'agent', v1: false },
|
|
28
|
-
{ n: 11, id: 'compare', kind: 'mechanical', v1: false },
|
|
29
|
-
]
|
|
30
|
-
|
|
31
|
-
/** The folder runs are written to, under the host's journal. One name, so renaming the skill is one line. */
|
|
32
|
-
export const runsDir = 'agents'
|
|
File without changes
|