@able-autonomy/able 0.0.10 → 0.0.12
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 +23 -1
- package/package.json +1 -1
package/able.ts
CHANGED
|
@@ -101,6 +101,28 @@ if (command === 'config') {
|
|
|
101
101
|
console.log(JSON.stringify(await loadConfig(hostRoot()), null, args.includes('--json') ? undefined : 2))
|
|
102
102
|
process.exit(0)
|
|
103
103
|
}
|
|
104
|
+
// `bunx` keeps the copy it fetched first; asking for @latest once refreshes it. A host that pins Able runs its pin instead.
|
|
105
|
+
if (command === 'upgrade') {
|
|
106
|
+
const { version: current } = await Bun.file(join(import.meta.dir, 'package.json')).json()
|
|
107
|
+
const { version: latest } = await (await fetch('https://registry.npmjs.org/@able-autonomy/able/latest')).json()
|
|
108
|
+
const pinned = Bun.file('node_modules/@able-autonomy/able/package.json')
|
|
109
|
+
if (await pinned.exists()) {
|
|
110
|
+
const pin = (await pinned.json()).version
|
|
111
|
+
console.log(
|
|
112
|
+
pin === latest
|
|
113
|
+
? `Congrats! This folder already pins the latest able (v${latest})`
|
|
114
|
+
: `This folder pins able v${pin}; the latest is v${latest}. Set @able-autonomy/able to ${latest} in package.json, then bun install`,
|
|
115
|
+
)
|
|
116
|
+
process.exit(0)
|
|
117
|
+
}
|
|
118
|
+
if (Bun.semver.order(current, latest) >= 0) {
|
|
119
|
+
console.log(`Congrats! You're already on the latest version of able (which is v${current})`)
|
|
120
|
+
process.exit(0)
|
|
121
|
+
}
|
|
122
|
+
if (Bun.spawnSync(['bunx', '@able-autonomy/able@latest'], { stdout: 'ignore', stderr: 'ignore' }).exitCode !== 0) fail('bunx @able-autonomy/able@latest failed')
|
|
123
|
+
console.log(`Upgraded able v${current} → v${latest}`)
|
|
124
|
+
process.exit(0)
|
|
125
|
+
}
|
|
104
126
|
const modules: Record<string, string> = { commit: './src/commit.ts', push: './src/push.ts', ws: './src/workspaces/index.ts' }
|
|
105
127
|
if (command && modules[command]) {
|
|
106
128
|
await import(modules[command])
|
|
@@ -120,7 +142,7 @@ if (delegate) {
|
|
|
120
142
|
}
|
|
121
143
|
if (command !== 'gh') {
|
|
122
144
|
console.error(
|
|
123
|
-
"usage: able gh <gh arguments> run gh as Able's GitHub App\n able sync [--dry-run] file follow-ups and write ended weeks' records\n able config [--json] print the host's able.config.ts\n able commit \"<message>\" [<path>…] a pathspec commit after the touched folders' checks\n able push pushes this branch with its tags\n able ws <new|ls|current|refresh|merge|rm|start|stop|status|take> workspaces",
|
|
145
|
+
"usage: able gh <gh arguments> run gh as Able's GitHub App\n able sync [--dry-run] file follow-ups and write ended weeks' records\n able config [--json] print the host's able.config.ts\n able commit \"<message>\" [<path>…] a pathspec commit after the touched folders' checks\n able push pushes this branch with its tags\n able upgrade makes bunx run the latest published able\n able ws <new|ls|current|refresh|merge|rm|start|stop|status|take> workspaces",
|
|
124
146
|
)
|
|
125
147
|
process.exit(command ? 1 : 0)
|
|
126
148
|
}
|