totopo 0.1.1 → 0.1.3
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/ai.sh +8 -1
- package/package.json +3 -2
- package/scripts/onboard.ts +2 -5
- package/scripts/rc.ts +64 -0
package/ai.sh
CHANGED
|
@@ -18,7 +18,14 @@ if [ "$(whoami)" = "devuser" ]; then
|
|
|
18
18
|
fi
|
|
19
19
|
|
|
20
20
|
# ─── Paths ───────────────────────────────────────────────────────────────────
|
|
21
|
-
PACKAGE_DIR
|
|
21
|
+
# Resolve symlinks so PACKAGE_DIR points to the real package root, not .bin/
|
|
22
|
+
SOURCE="$0"
|
|
23
|
+
while [ -L "$SOURCE" ]; do
|
|
24
|
+
DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
|
25
|
+
SOURCE="$(readlink "$SOURCE")"
|
|
26
|
+
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE"
|
|
27
|
+
done
|
|
28
|
+
PACKAGE_DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
|
22
29
|
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || true)"
|
|
23
30
|
|
|
24
31
|
if [ -z "$REPO_ROOT" ]; then
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "totopo",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Secure AI Box — isolated dev environments for AI coding assistants",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"typecheck": "tsc --noEmit",
|
|
46
46
|
"lint": "biome check .",
|
|
47
47
|
"format": "biome format --write .",
|
|
48
|
-
"fix:all": "biome check --write ."
|
|
48
|
+
"fix:all": "biome check --write .",
|
|
49
|
+
"rc": "tsx scripts/rc.ts"
|
|
49
50
|
}
|
|
50
51
|
}
|
package/scripts/onboard.ts
CHANGED
|
@@ -55,17 +55,14 @@ mkdirSync(totopoDir, { recursive: true });
|
|
|
55
55
|
cpSync(join(templatesDir, "Dockerfile"), join(totopoDir, "Dockerfile"));
|
|
56
56
|
cpSync(join(templatesDir, "post-start.mjs"), join(totopoDir, "post-start.mjs"));
|
|
57
57
|
|
|
58
|
-
// Substitute project name in devcontainer.json
|
|
58
|
+
// Substitute project name in devcontainer.json (plain string replace — file has // comments)
|
|
59
59
|
const dcTemplate = readFileSync(
|
|
60
60
|
join(templatesDir, "devcontainer.json"),
|
|
61
61
|
"utf8",
|
|
62
62
|
);
|
|
63
|
-
const dcJson: unknown = JSON.parse(
|
|
64
|
-
dcTemplate.replace(/TOTOPO_PROJECT_NAME/g, projectName),
|
|
65
|
-
);
|
|
66
63
|
writeFileSync(
|
|
67
64
|
join(totopoDir, "devcontainer.json"),
|
|
68
|
-
|
|
65
|
+
dcTemplate.replace(/TOTOPO_PROJECT_NAME/g, projectName),
|
|
69
66
|
);
|
|
70
67
|
|
|
71
68
|
log.success("Copied config templates to .totopo/");
|
package/scripts/rc.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// rc.ts — publish a release candidate
|
|
3
|
+
// Usage: pnpm rc (run from host, not inside container)
|
|
4
|
+
// =============================================================================
|
|
5
|
+
|
|
6
|
+
import { execSync, spawnSync } from "node:child_process";
|
|
7
|
+
import { readFileSync } from "node:fs";
|
|
8
|
+
import { cancel, confirm, intro, log, outro } from "@clack/prompts";
|
|
9
|
+
|
|
10
|
+
const pkg = JSON.parse(readFileSync("package.json", "utf8")) as {
|
|
11
|
+
name: string;
|
|
12
|
+
version: string;
|
|
13
|
+
};
|
|
14
|
+
const { name, version } = pkg;
|
|
15
|
+
const tag = `v${version}`;
|
|
16
|
+
|
|
17
|
+
intro(`${name} — release candidate`);
|
|
18
|
+
|
|
19
|
+
// ─── Check registry ──────────────────────────────────────────────────────────
|
|
20
|
+
log.step(`Checking npm registry for ${name}@${version}...`);
|
|
21
|
+
|
|
22
|
+
const probe = spawnSync("npm", ["view", `${name}@${version}`, "version"], {
|
|
23
|
+
encoding: "utf8",
|
|
24
|
+
stdio: "pipe",
|
|
25
|
+
});
|
|
26
|
+
const published = probe.stdout.trim();
|
|
27
|
+
|
|
28
|
+
if (published === version) {
|
|
29
|
+
log.error(`${name}@${version} is already published on npm.`);
|
|
30
|
+
log.message("Bump the version in package.json before publishing.");
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
log.success(`${name}@${version} not yet published — good to go`);
|
|
35
|
+
|
|
36
|
+
// ─── Confirm ─────────────────────────────────────────────────────────────────
|
|
37
|
+
const ok = await confirm({
|
|
38
|
+
message: `Push + tag ${tag} + publish as rc?`,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
if (!ok || ok === Symbol.for("cancel")) {
|
|
42
|
+
cancel("Aborted.");
|
|
43
|
+
process.exit(0);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// ─── Release steps ───────────────────────────────────────────────────────────
|
|
47
|
+
log.step("git push");
|
|
48
|
+
execSync("git push", { stdio: "inherit" });
|
|
49
|
+
|
|
50
|
+
log.step(`git tag ${tag}`);
|
|
51
|
+
execSync(`git tag ${tag}`, { stdio: "inherit" });
|
|
52
|
+
|
|
53
|
+
log.step("git push --tags");
|
|
54
|
+
execSync("git push --tags", { stdio: "inherit" });
|
|
55
|
+
|
|
56
|
+
log.step("pnpm publish --access public --tag rc");
|
|
57
|
+
execSync("pnpm publish --access public --tag rc", { stdio: "inherit" });
|
|
58
|
+
|
|
59
|
+
// ─── Done ────────────────────────────────────────────────────────────────────
|
|
60
|
+
outro(`${name}@${version} published as rc`);
|
|
61
|
+
|
|
62
|
+
console.log(" Test: npx totopo@rc");
|
|
63
|
+
console.log(` Promote to latest: npm dist-tag add ${name}@${version} latest`);
|
|
64
|
+
console.log("");
|