@toist/in 0.5.0 → 0.6.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to `@toist/in` are recorded here.
4
4
 
5
+ ## 0.6.0 — 2026-05-05
6
+
7
+ **`bunx @toist/in` now upgrades existing instances.** Running without
8
+ arguments in a directory that has a `package.json` with `@toist/*` deps
9
+ bumps them all to the latest version — the same behaviour as the now-removed
10
+ `@toist/up` package. `@toist/up` is deprecated; migrate to `bunx @toist/in`.
11
+
12
+ Scaffold template pins `@toist/aja` and `@toist/spec` to `^0.6.0`.
13
+
5
14
  ## 0.5.0 — 2026-05-05
6
15
 
7
16
  Lockstep version bump. Scaffold template pins `@toist/aja` and `@toist/spec` to `^0.5.0`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toist/in",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "Scaffold a new toist instance: bunx @toist/in <path>",
6
6
  "main": "./src/index.ts",
package/src/index.ts CHANGED
@@ -1,23 +1,38 @@
1
1
  #!/usr/bin/env bun
2
2
  // 2121 toist
3
- // @toist/in — scaffold a new toist instance.
3
+ // @toist/in — scaffold a new toist instance, or upgrade an existing one.
4
4
  //
5
- // Usage: bunx @toist/in <path>
6
- //
7
- // Writes a fresh instance directory at <path> with start.ts, kinds/,
8
- // pipelines/, resources/, data/, README.md, and .gitignore. Prints a
9
- // suggested package.json snippet to stdout for the host to merge.
5
+ // Usage:
6
+ // bunx @toist/in <path> scaffold a new instance at <path>
7
+ // bunx @toist/in upgrade @toist/* deps in the current directory
10
8
 
9
+ import { existsSync } from "node:fs"
10
+ import { resolve } from "node:path"
11
11
  import { scaffold } from "./scaffold.ts"
12
+ import { upgrade } from "./upgrade.ts"
12
13
 
13
14
  const args = process.argv.slice(2)
14
- const target = args[0]
15
+ const arg = args[0]
15
16
 
16
- if (!target || target === "--help" || target === "-h") {
17
- console.log("bunx @toist/in <path> scaffold a new toist instance at <path>")
17
+ if (arg === "--help" || arg === "-h") {
18
+ console.log("bunx @toist/in <path> scaffold a new toist instance at <path>")
19
+ console.log("bunx @toist/in upgrade @toist/* deps in the current directory")
18
20
  console.log("")
19
21
  console.log("Full docs: https://toist.in")
20
- process.exit(target ? 0 : 1)
22
+ process.exit(0)
21
23
  }
22
24
 
23
- await scaffold(target)
25
+ if (!arg) {
26
+ // No path given — upgrade if we're inside a toist instance, else error.
27
+ const pkgPath = resolve(process.cwd(), "package.json")
28
+ if (!existsSync(pkgPath)) {
29
+ console.error("No package.json found in the current directory.")
30
+ console.error("")
31
+ console.error("To scaffold a new instance: bunx @toist/in <path>")
32
+ console.error("To upgrade an existing one: run from the instance directory")
33
+ process.exit(1)
34
+ }
35
+ await upgrade()
36
+ } else {
37
+ await scaffold(arg)
38
+ }
package/src/upgrade.ts ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env bun
2
+ // 2121 toist
3
+ // Upgrade @toist/* deps in the nearest package.json to latest.
4
+ // Called by @toist/in when run without a path argument in an existing instance.
5
+
6
+ import { readFile } from "node:fs/promises"
7
+ import { existsSync } from "node:fs"
8
+ import { resolve } from "node:path"
9
+ import { spawnSync } from "node:child_process"
10
+
11
+ export async function upgrade(cwd = process.cwd()): Promise<void> {
12
+ const pkgPath = resolve(cwd, "package.json")
13
+ if (!existsSync(pkgPath)) {
14
+ console.error(`No package.json in ${cwd}.`)
15
+ console.error("Run from your toist instance directory.")
16
+ process.exit(1)
17
+ }
18
+
19
+ const pkg = JSON.parse(await readFile(pkgPath, "utf8")) as {
20
+ dependencies?: Record<string, string>
21
+ devDependencies?: Record<string, string>
22
+ }
23
+
24
+ const all: Record<string, string> = {
25
+ ...(pkg.dependencies ?? {}),
26
+ ...(pkg.devDependencies ?? {}),
27
+ }
28
+
29
+ // @toist/in itself is excluded — it runs via bunx, no local copy needed.
30
+ const targets = Object.keys(all)
31
+ .filter((n) => n.startsWith("@toist/") && n !== "@toist/in")
32
+ .sort()
33
+
34
+ if (targets.length === 0) {
35
+ console.log("No @toist/* deps in package.json — nothing to upgrade.")
36
+ process.exit(0)
37
+ }
38
+
39
+ console.log(`Upgrading: ${targets.join(", ")}\n`)
40
+ const result = spawnSync("bun", ["update", "--latest", ...targets], {
41
+ stdio: "inherit",
42
+ cwd,
43
+ })
44
+ process.exit(result.status ?? 0)
45
+ }
@@ -20,11 +20,11 @@ Open `http://localhost:3000` to use the UI.
20
20
  ## Upgrading
21
21
 
22
22
  ```sh
23
- bunx @toist/up
23
+ bunx @toist/in
24
24
  ```
25
25
 
26
- Auto-detects every `@toist/*` dep in this directory's `package.json`
27
- and bumps them to the latest published version.
26
+ Run without arguments from the instance directory. Auto-detects every
27
+ `@toist/*` dep in `package.json` and bumps them to the latest version.
28
28
 
29
29
  ## More
30
30
 
@@ -7,7 +7,7 @@
7
7
  "dev": "bun --watch start.ts"
8
8
  },
9
9
  "dependencies": {
10
- "@toist/aja": "^0.5.0",
11
- "@toist/spec": "^0.5.0"
10
+ "@toist/aja": "^0.6.0",
11
+ "@toist/spec": "^0.6.0"
12
12
  }
13
13
  }