@able-autonomy/able 0.0.5 → 0.0.7
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/package.json +1 -1
- package/src/workspaces/merge.ts +7 -1
package/package.json
CHANGED
package/src/workspaces/merge.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// able ws merge ["message"] [--yes]: merges this workspace into the trunk, from inside it.
|
|
2
2
|
//
|
|
3
|
-
// Merges origin's trunk into `feat/<slug>`, runs the commit checks of every folder the branch changed and then the
|
|
3
|
+
// Refuses while the workspace's brief has no `## Ledger` (its close). Merges origin's trunk into `feat/<slug>`, runs the commit checks of every folder the branch changed and then the
|
|
4
4
|
// merge checks (decisions 73, 100), pushes `feat/<slug>` and merges it into origin's trunk as one merge commit,
|
|
5
5
|
// `Merge feat/<slug>`, which is how `able sync` finds it. A message commits what is still dirty first. The main checkout takes no part; afterwards it is
|
|
6
6
|
// fast-forwarded when it is on the trunk and nothing of its own is in the way.
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
// A conflict stops it with the files named: resolve them here, commit, and run it again. A push refused because the
|
|
9
9
|
// trunk moved meanwhile is the same: run it again, and it merges the newer trunk in.
|
|
10
10
|
|
|
11
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
12
|
+
import { join, relative } from 'node:path'
|
|
11
13
|
import { runChecks, runMergeChecks } from '../checks.ts'
|
|
12
14
|
import { count, dirtyCount, fetchTrunk, git, gitLoud, gitQuiet, lines, mergeOrFail } from '../git.ts'
|
|
13
15
|
import { bold, confirm, dim, fail, green, yellow } from '../ui.ts'
|
|
@@ -21,6 +23,10 @@ const { trunk } = config
|
|
|
21
23
|
const dirty = dirtyCount(ws.path)
|
|
22
24
|
if (dirty && !msg) fail(`${dirty} uncommitted file(s); commit them (able commit), or pass a message to commit them all at once`)
|
|
23
25
|
|
|
26
|
+
// The close goes in with the branch: a brief without its ledger is never merged (`able sync` reads that ledger).
|
|
27
|
+
const brief = join(ws.path, config.journal, 'workspaces', `${ws.slug}.md`)
|
|
28
|
+
if (existsSync(brief) && !readFileSync(brief, 'utf8').includes('\n## Ledger\n')) fail(`${relative(ws.path, brief)} has no ## Ledger; close the workspace first (the able-close-ws skill), then merge`)
|
|
29
|
+
|
|
24
30
|
fetchTrunk(ws.path, trunk)
|
|
25
31
|
const ahead = count(ws.path, `origin/${trunk}..HEAD`)
|
|
26
32
|
const behind = count(ws.path, `HEAD..origin/${trunk}`)
|