waypoint-codex 0.1.7 → 0.1.8

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/README.md CHANGED
@@ -50,6 +50,7 @@ repo/
50
50
  - `waypoint init` — scaffold or refresh the repo
51
51
  - `waypoint doctor` — check for drift and missing pieces
52
52
  - `waypoint sync` — rebuild `.waypoint/DOCS_INDEX.md` and sync optional automations/rules
53
+ - `waypoint upgrade` — update the global Waypoint CLI and refresh the current repo with its existing config
53
54
  - `waypoint import-legacy` — import from an older repo layout
54
55
 
55
56
  ## Shipped skills
@@ -71,9 +72,13 @@ If you initialize with `--with-roles`, Waypoint scaffolds:
71
72
  ## Update
72
73
 
73
74
  ```bash
74
- npm install -g waypoint-codex@latest
75
- waypoint init --with-automations --with-roles
76
- waypoint doctor
75
+ waypoint upgrade
76
+ ```
77
+
78
+ If you only want to update the CLI without refreshing the repo:
79
+
80
+ ```bash
81
+ waypoint upgrade --skip-repo-refresh
77
82
  ```
78
83
 
79
84
  ## Learn more
package/dist/src/cli.js CHANGED
@@ -4,7 +4,8 @@ import { readFileSync } from "node:fs";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import path from "node:path";
6
6
  import process from "node:process";
7
- import { doctorRepository, importLegacyRepo, initRepository, syncRepository } from "./core.js";
7
+ import { doctorRepository, importLegacyRepo, initRepository, loadWaypointConfig, syncRepository } from "./core.js";
8
+ import { upgradeWaypoint } from "./upgrade.js";
8
9
  const VERSION = JSON.parse(readFileSync(path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../package.json"), "utf8")).version;
9
10
  function resolveRepo(input) {
10
11
  return path.resolve(input ?? ".");
@@ -29,6 +30,7 @@ Commands:
29
30
  init Initialize a repository with Waypoint scaffolding
30
31
  doctor Validate repository health and report drift
31
32
  sync Rebuild docs index and sync optional user-home artifacts
33
+ upgrade Update the global Waypoint CLI and refresh this repo using existing config
32
34
  import-legacy Analyze a legacy repository layout and produce a Waypoint adoption report
33
35
  `);
34
36
  }
@@ -128,6 +130,23 @@ async function main() {
128
130
  }
129
131
  return 0;
130
132
  }
133
+ if (command === "upgrade") {
134
+ const { values, positionals } = parseArgs({
135
+ args: argv.slice(1),
136
+ options: {
137
+ "skip-repo-refresh": { type: "boolean", default: false }
138
+ },
139
+ allowPositionals: true
140
+ });
141
+ const projectRoot = resolveRepo(positionals[0]);
142
+ const config = loadWaypointConfig(projectRoot);
143
+ return upgradeWaypoint({
144
+ projectRoot,
145
+ config,
146
+ cliEntry: process.argv[1] ? path.resolve(process.argv[1]) : fileURLToPath(import.meta.url),
147
+ skipRepoRefresh: values["skip-repo-refresh"],
148
+ });
149
+ }
131
150
  console.error(`Unknown command: ${command}`);
132
151
  printHelp();
133
152
  return 2;
@@ -0,0 +1,55 @@
1
+ import { existsSync } from "node:fs";
2
+ import { spawnSync } from "node:child_process";
3
+ import path from "node:path";
4
+ export function npmBinaryForPlatform(platform = process.platform) {
5
+ return platform === "win32" ? "npm.cmd" : "npm";
6
+ }
7
+ export function buildInitArgs(projectRoot, config) {
8
+ const args = ["init", projectRoot];
9
+ if (config.profile === "app-friendly") {
10
+ args.push("--app-friendly");
11
+ }
12
+ const featureMap = config.features ?? {};
13
+ if (featureMap.roles) {
14
+ args.push("--with-roles");
15
+ }
16
+ if (featureMap.rules) {
17
+ args.push("--with-rules");
18
+ }
19
+ if (featureMap.automations) {
20
+ args.push("--with-automations");
21
+ }
22
+ return args;
23
+ }
24
+ function hasWaypointConfig(projectRoot) {
25
+ return existsSync(path.join(projectRoot, ".waypoint/config.toml"));
26
+ }
27
+ export function upgradeWaypoint(options) {
28
+ const nodeBinary = options.nodeBinary ?? process.execPath;
29
+ const npmBinary = options.npmBinary ?? process.env.WAYPOINT_NPM_COMMAND ?? npmBinaryForPlatform();
30
+ const stdio = options.stdio ?? "inherit";
31
+ const update = spawnSync(npmBinary, ["install", "-g", "waypoint-codex@latest"], {
32
+ stdio,
33
+ });
34
+ if ((update.status ?? 1) !== 0) {
35
+ return update.status ?? 1;
36
+ }
37
+ if (options.skipRepoRefresh) {
38
+ console.log("Waypoint CLI updated. Skipped repo refresh.");
39
+ return 0;
40
+ }
41
+ if (!hasWaypointConfig(options.projectRoot)) {
42
+ console.log("Waypoint CLI updated. No repo-local Waypoint config found, so repo refresh was skipped.");
43
+ return 0;
44
+ }
45
+ const init = spawnSync(nodeBinary, [options.cliEntry, ...buildInitArgs(options.projectRoot, options.config)], {
46
+ stdio,
47
+ });
48
+ if ((init.status ?? 1) !== 0) {
49
+ return init.status ?? 1;
50
+ }
51
+ const doctor = spawnSync(nodeBinary, [options.cliEntry, "doctor", options.projectRoot], {
52
+ stdio,
53
+ });
54
+ return doctor.status ?? 1;
55
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waypoint-codex",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Codex-native repository operating system: scaffolding, docs routing, repo-local skills, doctor, and sync.",
5
5
  "license": "MIT",
6
6
  "type": "module",