@pixelfactoryio/theway 0.13.0 → 0.14.1

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/dist/theway.js CHANGED
@@ -9128,66 +9128,71 @@ function isFile(path2) {
9128
9128
  // src/core/list.ts
9129
9129
  import { readdirSync, readFileSync as readFileSync2 } from "node:fs";
9130
9130
 
9131
- // src/core/path.ts
9132
- import { join as join2, resolve as resolve2 } from "node:path";
9133
- var CHANGE_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
9134
- var PROJECT = /^[A-Za-z0-9_][A-Za-z0-9._-]*$/;
9135
- function changeIdReason(v) {
9136
- if (v === "")
9137
- return "must not be empty";
9138
- if (v.length > 200)
9139
- return "must be at most 200 characters";
9140
- if (!CHANGE_ID.test(v))
9141
- return "must be lowercase letters and digits in words separated by single hyphens";
9142
- return "";
9143
- }
9131
+ // src/core/project.ts
9132
+ import { spawnSync } from "node:child_process";
9133
+ import { realpathSync } from "node:fs";
9134
+ import { basename, dirname, join as join2, resolve as resolve2 } from "node:path";
9135
+ var KEY = /^[A-Za-z0-9-]{1,200}$/;
9144
9136
  function projectReason(v) {
9145
- if (v === "")
9146
- return "must not be empty";
9147
- if (v.length > 200)
9148
- return "must be at most 200 characters";
9149
- if (!PROJECT.test(v))
9150
- return 'must be letters, digits, ".", "_" or "-", not starting with "." or "-"';
9151
- return "";
9137
+ return KEY.test(v) ? "" : 'must be letters, digits and "-", at most 200 characters';
9152
9138
  }
9153
- function invalidSegments(segments) {
9154
- for (const [label, value] of segments) {
9155
- if (value === undefined)
9156
- continue;
9157
- const reason = label === "project" ? projectReason(value) : changeIdReason(value);
9158
- if (reason !== "") {
9159
- const shown = value.replaceAll(`
9160
- `, "\\n").replaceAll("\r", "\\r");
9161
- process.stderr.write(`theway: invalid ${label} '${shown}': ${reason}
9162
- `);
9163
- return true;
9139
+ function revParse(flag) {
9140
+ const res = spawnSync("git", ["rev-parse", flag], {
9141
+ cwd: process.cwd(),
9142
+ encoding: "utf-8",
9143
+ stdio: ["ignore", "pipe", "pipe"]
9144
+ });
9145
+ if (res.error !== undefined || res.status !== 0)
9146
+ return null;
9147
+ return res.stdout.trim();
9148
+ }
9149
+ function projectRoot() {
9150
+ const cwd = process.cwd();
9151
+ let root = cwd;
9152
+ const common = revParse("--git-common-dir");
9153
+ if (common !== null) {
9154
+ const dir = resolve2(cwd, common);
9155
+ if (basename(dir) === ".git")
9156
+ root = dirname(dir);
9157
+ else {
9158
+ const top = revParse("--show-toplevel");
9159
+ root = top !== null && top !== "" ? resolve2(cwd, top) : cwd;
9164
9160
  }
9165
9161
  }
9166
- return false;
9162
+ try {
9163
+ return realpathSync(root);
9164
+ } catch {
9165
+ return root;
9166
+ }
9167
9167
  }
9168
- function cmdPath(project, changeId, verbose) {
9169
- if (invalidSegments([
9170
- ["project", project],
9171
- ["change id", changeId]
9172
- ]))
9173
- return 1;
9174
- const { home, source } = resolveHome();
9175
- if (verbose)
9176
- process.stderr.write(`theway: home ${home} (from ${source})
9168
+ var keyOf = (root) => root.replace(/[^A-Za-z0-9]/g, "-");
9169
+ var projectDir = (home, key) => join2(home, "projects", key);
9170
+ function resolveKey(override) {
9171
+ if (override !== undefined) {
9172
+ const reason = projectReason(override);
9173
+ if (reason === "")
9174
+ return override;
9175
+ const shown = override.replaceAll(`
9176
+ `, "\\n").replaceAll("\r", "\\r");
9177
+ process.stderr.write(`theway: invalid project '${shown}': ${reason}
9177
9178
  `);
9178
- if (source === "env") {
9179
- const pointer = readPointer();
9180
- if (pointer !== "" && resolve2(pointer) !== home) {
9181
- process.stderr.write(`theway: warning: THEWAY_HOME is ${home} (from env) but ${pointerPath()} holds ${resolve2(pointer)} (from pointer); using ${home}
9179
+ return null;
9180
+ }
9181
+ const root = projectRoot();
9182
+ const key = keyOf(root);
9183
+ if (key.length > 200) {
9184
+ process.stderr.write(`theway: project key for ${root} is longer than 200 characters; pass --project <key>
9182
9185
  `);
9183
- }
9186
+ return null;
9184
9187
  }
9185
- let out = home;
9186
- if (project !== undefined)
9187
- out = join2(home, project);
9188
- if (project !== undefined && changeId !== undefined)
9189
- out = join2(home, project, "changes", changeId);
9190
- process.stdout.write(`${out}
9188
+ return key;
9189
+ }
9190
+ function cmdProject(override) {
9191
+ const key = resolveKey(override);
9192
+ if (key === null)
9193
+ return 1;
9194
+ process.stdout.write(`key: ${key}
9195
+ dir: ${projectDir(thewayHome(), key)}
9191
9196
  `);
9192
9197
  return 0;
9193
9198
  }
@@ -9208,11 +9213,11 @@ function subdirs(dir) {
9208
9213
  function filesEndingWith(dir, suffix) {
9209
9214
  return visibleNames(dir).filter((n) => n.endsWith(suffix) && isFile(`${dir}/${n}`));
9210
9215
  }
9211
- function activeIds(home, project) {
9212
- return subdirs(`${home}/${project}/changes`).filter((n) => n !== "archive");
9216
+ function activeIds(dir) {
9217
+ return subdirs(`${dir}/changes`).filter((n) => n !== "archive");
9213
9218
  }
9214
- function archiveDirs(home, project) {
9215
- return subdirs(`${home}/${project}/changes/archive`);
9219
+ function archiveDirs(dir) {
9220
+ return subdirs(`${dir}/changes/archive`);
9216
9221
  }
9217
9222
  function taskCounts(dir) {
9218
9223
  let checked = 0;
@@ -9230,21 +9235,22 @@ function taskCounts(dir) {
9230
9235
  }
9231
9236
  return [checked, total];
9232
9237
  }
9233
- function cmdList(project) {
9234
- if (invalidSegments([["project", project]]))
9238
+ function cmdList(override) {
9239
+ const key = resolveKey(override);
9240
+ if (key === null)
9235
9241
  return 1;
9236
- const home = thewayHome();
9237
- const base = `${home}/${project}/changes`;
9238
- let text = `theway changes — ${project}
9242
+ const dir = projectDir(thewayHome(), key);
9243
+ const base = `${dir}/changes`;
9244
+ let text = `theway changes — ${key}
9239
9245
 
9240
9246
  Active changes
9241
9247
 
9242
9248
  `;
9243
- const active = activeIds(home, project);
9249
+ const active = activeIds(dir);
9244
9250
  for (const name of active) {
9245
- const dir = `${base}/${name}`;
9246
- const files = filesEndingWith(dir, ".md").length;
9247
- const [checked, total] = taskCounts(dir);
9251
+ const change = `${base}/${name}`;
9252
+ const files = filesEndingWith(change, ".md").length;
9253
+ const [checked, total] = taskCounts(change);
9248
9254
  text += ` ${name.padEnd(20)} ${files} files ${checked}/${total} tasks done
9249
9255
  `;
9250
9256
  }
@@ -9253,7 +9259,7 @@ Active changes
9253
9259
  `;
9254
9260
  text += `
9255
9261
  `;
9256
- const archived = archiveDirs(home, project);
9262
+ const archived = archiveDirs(dir);
9257
9263
  text += `Archived changes (${archived.length})
9258
9264
 
9259
9265
  `;
@@ -9272,6 +9278,55 @@ Summary: ${active.length} active change(s), ${archived.length} archived.
9272
9278
  return 0;
9273
9279
  }
9274
9280
 
9281
+ // src/core/path.ts
9282
+ import { join as join3, resolve as resolve3 } from "node:path";
9283
+ var CHANGE_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
9284
+ function changeIdReason(v) {
9285
+ if (v === "")
9286
+ return "must not be empty";
9287
+ if (v.length > 200)
9288
+ return "must be at most 200 characters";
9289
+ if (!CHANGE_ID.test(v))
9290
+ return "must be lowercase letters and digits in words separated by single hyphens";
9291
+ return "";
9292
+ }
9293
+ function invalidChangeId(changeId) {
9294
+ if (changeId === undefined)
9295
+ return false;
9296
+ const reason = changeIdReason(changeId);
9297
+ if (reason === "")
9298
+ return false;
9299
+ const shown = changeId.replaceAll(`
9300
+ `, "\\n").replaceAll("\r", "\\r");
9301
+ process.stderr.write(`theway: invalid change id '${shown}': ${reason}
9302
+ `);
9303
+ return true;
9304
+ }
9305
+ function cmdPath(changeId, override, verbose) {
9306
+ if (changeId === undefined && override !== undefined && resolveKey(override) === null)
9307
+ return 1;
9308
+ const key = changeId === undefined ? null : resolveKey(override);
9309
+ if (changeId !== undefined && key === null)
9310
+ return 1;
9311
+ if (invalidChangeId(changeId))
9312
+ return 1;
9313
+ const { home, source } = resolveHome();
9314
+ if (verbose)
9315
+ process.stderr.write(`theway: home ${home} (from ${source})
9316
+ `);
9317
+ if (source === "env") {
9318
+ const pointer = readPointer();
9319
+ if (pointer !== "" && resolve3(pointer) !== home) {
9320
+ process.stderr.write(`theway: warning: THEWAY_HOME is ${home} (from env) but ${pointerPath()} holds ${resolve3(pointer)} (from pointer); using ${home}
9321
+ `);
9322
+ }
9323
+ }
9324
+ const out = changeId !== undefined && key !== null ? join3(projectDir(home, key), "changes", changeId) : home;
9325
+ process.stdout.write(`${out}
9326
+ `);
9327
+ return 0;
9328
+ }
9329
+
9275
9330
  // src/core/archive.ts
9276
9331
  function localDate() {
9277
9332
  const d = new Date;
@@ -9282,15 +9337,15 @@ function uncheckedLines(path2) {
9282
9337
  return readFileSync3(path2, "utf-8").split(`
9283
9338
  `).flatMap((line, i) => UNCHECKED.test(line) ? [`${i + 1}:${line}`] : []);
9284
9339
  }
9285
- function cmdArchive(project, changeId, force) {
9286
- if (invalidSegments([
9287
- ["project", project],
9288
- ["change id", changeId]
9289
- ]))
9340
+ function cmdArchive(changeId, override, force) {
9341
+ const key = resolveKey(override);
9342
+ if (key === null)
9290
9343
  return 1;
9291
- const home = thewayHome();
9292
- const src = `${home}/${project}/changes/${changeId}`;
9293
- const dst = `${home}/${project}/changes/archive/${localDate()}-${changeId}`;
9344
+ if (invalidChangeId(changeId))
9345
+ return 1;
9346
+ const dir = projectDir(thewayHome(), key);
9347
+ const src = `${dir}/changes/${changeId}`;
9348
+ const dst = `${dir}/changes/archive/${localDate()}-${changeId}`;
9294
9349
  if (!isDir(src)) {
9295
9350
  process.stderr.write(`Error: ${src} not found
9296
9351
  `);
@@ -9320,7 +9375,7 @@ ${list}`);
9320
9375
  }
9321
9376
  }
9322
9377
  try {
9323
- mkdirSync(`${home}/${project}/changes/archive`, { recursive: true });
9378
+ mkdirSync(`${dir}/changes/archive`, { recursive: true });
9324
9379
  renameSync(src, dst);
9325
9380
  } catch (e) {
9326
9381
  process.stderr.write(`mv: ${e.message}
@@ -9334,7 +9389,7 @@ ${list}`);
9334
9389
 
9335
9390
  // src/core/authority.ts
9336
9391
  import { readFileSync as readFileSync4 } from "node:fs";
9337
- import { join as join3 } from "node:path";
9392
+ import { join as join4 } from "node:path";
9338
9393
  function authoritySection(path2) {
9339
9394
  let text;
9340
9395
  try {
@@ -9356,10 +9411,10 @@ function authoritySection(path2) {
9356
9411
  `;
9357
9412
  }
9358
9413
  function cmdAuthority() {
9359
- const dir = join3(thewayHome(), "standards");
9360
- const section = authoritySection(join3(dir, "interaction.md")) ?? authoritySection(join3(dir, "interaction.default.md"));
9414
+ const dir = join4(thewayHome(), "standards");
9415
+ const section = authoritySection(join4(dir, "interaction.md")) ?? authoritySection(join4(dir, "interaction.default.md"));
9361
9416
  if (section === null) {
9362
- process.stderr.write(`theway: no ## Authority section in ${join3(dir, "interaction.md")} or interaction.default.md; run npx --yes @pixelfactoryio/theway@latest install, then /reload-plugins
9417
+ process.stderr.write(`theway: no ## Authority section in ${join4(dir, "interaction.md")} or interaction.default.md; run npx --yes @pixelfactoryio/theway@latest install, then /reload-plugins
9363
9418
  `);
9364
9419
  return 1;
9365
9420
  }
@@ -9369,7 +9424,7 @@ function cmdAuthority() {
9369
9424
 
9370
9425
  // src/core/config.ts
9371
9426
  import { readdirSync as readdirSync3, readFileSync as readFileSync6 } from "node:fs";
9372
- import { join as join4 } from "node:path";
9427
+ import { join as join5 } from "node:path";
9373
9428
 
9374
9429
  // node_modules/yaml/dist/index.js
9375
9430
  var composer = require_composer();
@@ -9645,13 +9700,11 @@ var model = (d) => ({ rule: "model", default: d });
9645
9700
  var OPT_IN = ["core-principles.md", "sre.md", "web-development.md", "quality.md"];
9646
9701
  var CORE = ["interaction.md", "develop.md", "tamm-framework.md", "spec-review.md", "spec-investigation.md"];
9647
9702
  var CONVENTIONS = ["commits.md", "git-host.md"];
9648
- var SHARED = new Set(["data", "templates", "standards", "workflows", "lenses"]);
9649
- var isShared = (project) => SHARED.has(project);
9650
9703
  var NAME = /^[a-z0-9]+(-[a-z0-9]+)*$/;
9651
9704
  var isLensList = (v) => Array.isArray(v) && v.length > 0 && v.every((n) => typeof n === "string" && NAME.test(n)) && new Set(v).size === v.length;
9652
- var keyOf = (name) => name.slice(0, -".md".length).replaceAll("-", "_");
9653
- var OPT_IN_KEYS = OPT_IN.map(keyOf);
9654
- var FIXED_KEYS = new Set([...CORE, ...CONVENTIONS].map(keyOf));
9705
+ var keyOf2 = (name) => name.slice(0, -".md".length).replaceAll("-", "_");
9706
+ var OPT_IN_KEYS = OPT_IN.map(keyOf2);
9707
+ var FIXED_KEYS = new Set([...CORE, ...CONVENTIONS].map(keyOf2));
9655
9708
  function mdFiles(dir) {
9656
9709
  let names;
9657
9710
  try {
@@ -9659,12 +9712,12 @@ function mdFiles(dir) {
9659
9712
  } catch {
9660
9713
  return [];
9661
9714
  }
9662
- return names.filter((n) => n.endsWith(".md") && isFile(join4(dir, n))).sort();
9715
+ return names.filter((n) => n.endsWith(".md") && isFile(join5(dir, n))).sort();
9663
9716
  }
9664
- function standardsOf(home, project) {
9665
- const globalDir = join4(home, "standards");
9666
- const projectDir = join4(home, project, "standards");
9667
- const projectNames = isShared(project) ? [] : mdFiles(projectDir).filter((n) => !CONVENTIONS.includes(n));
9717
+ function standardsOf(home, key) {
9718
+ const globalDir = join5(home, "standards");
9719
+ const ownDir = join5(projectDir(home, key), "standards");
9720
+ const projectNames = mdFiles(ownDir).filter((n) => !CONVENTIONS.includes(n));
9668
9721
  const shipped = readManifest(home) ?? {};
9669
9722
  const out = [];
9670
9723
  for (const name of mdFiles(globalDir)) {
@@ -9673,13 +9726,13 @@ function standardsOf(home, project) {
9673
9726
  const optIn = OPT_IN.includes(name);
9674
9727
  if (!optIn && ((`standards/${name}` in shipped) || name.endsWith(".default.md")))
9675
9728
  continue;
9676
- const global = { path: join4(globalDir, name), key: keyOf(name), optIn };
9729
+ const global = { path: join5(globalDir, name), key: keyOf2(name), optIn };
9677
9730
  if (projectNames.includes(name))
9678
- global.shadowedBy = join4(projectDir, name);
9731
+ global.shadowedBy = join5(ownDir, name);
9679
9732
  out.push(global);
9680
9733
  }
9681
9734
  for (const name of projectNames)
9682
- out.push({ path: join4(projectDir, name), key: keyOf(name), optIn: false });
9735
+ out.push({ path: join5(ownDir, name), key: keyOf2(name), optIn: false });
9683
9736
  return out;
9684
9737
  }
9685
9738
  function standardsSchema(standards) {
@@ -9774,7 +9827,7 @@ function apply(file, schema, layer, into, prefix, warn) {
9774
9827
  function load(home, file) {
9775
9828
  let text;
9776
9829
  try {
9777
- text = readFileSync6(join4(home, file), "utf-8");
9830
+ text = readFileSync6(join5(home, file), "utf-8");
9778
9831
  } catch {
9779
9832
  return { error: `theway: ${file}: cannot be read` };
9780
9833
  }
@@ -9786,12 +9839,13 @@ function load(home, file) {
9786
9839
  return { error: `theway: ${file}: invalid YAML: ${first.replace(/:$/, "")}` };
9787
9840
  }
9788
9841
  }
9789
- function effectiveConfig(home, project, loud) {
9842
+ function effectiveConfig(home, key, loud) {
9790
9843
  const files = [];
9791
- if (isFile(join4(home, "config.yaml")))
9844
+ const own = join5("projects", key, "config.yaml");
9845
+ if (isFile(join5(home, "config.yaml")))
9792
9846
  files.push("config.yaml");
9793
- if (isFile(join4(home, project, "config.yaml")))
9794
- files.push(join4(project, "config.yaml"));
9847
+ if (isFile(join5(home, own)))
9848
+ files.push(own);
9795
9849
  const roots = [];
9796
9850
  for (const file of files) {
9797
9851
  const loaded = load(home, file);
@@ -9799,7 +9853,7 @@ function effectiveConfig(home, project, loud) {
9799
9853
  return { error: loaded.error };
9800
9854
  roots.push([file, loaded.root]);
9801
9855
  }
9802
- const standards = standardsOf(home, project);
9856
+ const standards = standardsOf(home, key);
9803
9857
  const schema = Object.assign(dict(), SCHEMA, { standards: standardsSchema(standards) });
9804
9858
  const warn = loud ? warnLoud : warnQuiet;
9805
9859
  const config = defaults(schema);
@@ -9817,13 +9871,13 @@ function enabled(config, key) {
9817
9871
  const all = config.standards;
9818
9872
  return !Object.hasOwn(all, key) || all[key].enabled === true;
9819
9873
  }
9820
- function loadConfig(home, project) {
9821
- if (!isFile(join4(home, "config.yaml"))) {
9874
+ function loadConfig(home, key) {
9875
+ if (!isFile(join5(home, "config.yaml"))) {
9822
9876
  process.stderr.write(`theway: config.yaml not found in ${home}; run npx --yes @pixelfactoryio/theway@latest install, then /reload-plugins
9823
9877
  `);
9824
9878
  return null;
9825
9879
  }
9826
- const result = effectiveConfig(home, project, true);
9880
+ const result = effectiveConfig(home, key, true);
9827
9881
  if ("error" in result) {
9828
9882
  process.stderr.write(`${result.error}
9829
9883
  `);
@@ -9831,10 +9885,11 @@ function loadConfig(home, project) {
9831
9885
  }
9832
9886
  return result;
9833
9887
  }
9834
- function cmdConfig(project) {
9835
- if (invalidSegments([["project", project]]))
9888
+ function cmdConfig(override) {
9889
+ const key = resolveKey(override);
9890
+ if (key === null)
9836
9891
  return 1;
9837
- const loaded = loadConfig(thewayHome(), project);
9892
+ const loaded = loadConfig(thewayHome(), key);
9838
9893
  if (loaded === null)
9839
9894
  return 1;
9840
9895
  process.stdout.write($stringify(loaded.config));
@@ -9842,7 +9897,7 @@ function cmdConfig(project) {
9842
9897
  }
9843
9898
 
9844
9899
  // src/core/context.ts
9845
- import { join as join5 } from "node:path";
9900
+ import { join as join6 } from "node:path";
9846
9901
 
9847
9902
  // src/core/standards.ts
9848
9903
  import { readFileSync as readFileSync7 } from "node:fs";
@@ -9917,12 +9972,13 @@ function selectStandards(loaded, phase) {
9917
9972
  };
9918
9973
  return loaded.standards.filter((s) => enabled(loaded.config, s.key)).filter((s) => of(s.path).includes(phase) && (s.shadowedBy === undefined || !of(s.shadowedBy).includes(phase))).map((s) => s.path);
9919
9974
  }
9920
- function cmdStandards(project, phase) {
9921
- if (invalidSegments([["project", project]]))
9975
+ function cmdStandards(phase, override) {
9976
+ const key = resolveKey(override);
9977
+ if (key === null)
9922
9978
  return 1;
9923
9979
  if (!checkPhase(phase))
9924
9980
  return 1;
9925
- const result = effectiveConfig(thewayHome(), project, false);
9981
+ const result = effectiveConfig(thewayHome(), key, false);
9926
9982
  if ("error" in result) {
9927
9983
  process.stderr.write(`${result.error}
9928
9984
  `);
@@ -9934,20 +9990,22 @@ function cmdStandards(project, phase) {
9934
9990
  }
9935
9991
 
9936
9992
  // src/core/context.ts
9937
- function cmdContext(project, phase, changeId) {
9938
- if (invalidSegments([["project", project]]))
9993
+ function cmdContext(phase, changeId, override) {
9994
+ const key = resolveKey(override);
9995
+ if (key === null)
9939
9996
  return 1;
9940
9997
  if (!checkPhase(phase))
9941
9998
  return 1;
9942
- if (invalidSegments([["change id", changeId]]))
9999
+ if (invalidChangeId(changeId))
9943
10000
  return 1;
9944
10001
  const home = thewayHome();
9945
- const loaded = loadConfig(home, project);
10002
+ const loaded = loadConfig(home, key);
9946
10003
  if (loaded === null)
9947
10004
  return 1;
9948
- const doc = { home };
10005
+ const dir = projectDir(home, key);
10006
+ const doc = { home, project: key, project_dir: dir };
9949
10007
  if (changeId !== undefined)
9950
- doc.change_dir = join5(home, project, "changes", changeId);
10008
+ doc.change_dir = join6(dir, "changes", changeId);
9951
10009
  doc.standards = selectStandards(loaded, phase);
9952
10010
  doc.config = loaded.config;
9953
10011
  process.stdout.write($stringify(doc));
@@ -9956,7 +10014,7 @@ function cmdContext(project, phase, changeId) {
9956
10014
 
9957
10015
  // src/core/next-id.ts
9958
10016
  import { readdirSync as readdirSync4 } from "node:fs";
9959
- import { join as join6 } from "node:path";
10017
+ import { join as join7 } from "node:path";
9960
10018
 
9961
10019
  // src/core/validate-id.ts
9962
10020
  var VERB = /^(add|update|refactor|remove|fix)-/;
@@ -10019,7 +10077,7 @@ function cmdValidateId(id, series) {
10019
10077
  // src/core/next-id.ts
10020
10078
  function dirs(dir) {
10021
10079
  try {
10022
- return readdirSync4(dir).filter((n) => isDir(join6(dir, n)));
10080
+ return readdirSync4(dir).filter((n) => isDir(join7(dir, n)));
10023
10081
  } catch {
10024
10082
  return [];
10025
10083
  }
@@ -10033,8 +10091,9 @@ function seriesIdReason(id) {
10033
10091
  return `ends in a number (-${tail}); a series id cannot end in a number`;
10034
10092
  return "";
10035
10093
  }
10036
- function cmdNextId(project, seriesId, count) {
10037
- if (invalidSegments([["project", project]]))
10094
+ function cmdNextId(seriesId, count, override) {
10095
+ const key = resolveKey(override);
10096
+ if (key === null)
10038
10097
  return 1;
10039
10098
  const rest = seriesId.replace(/-[0-9]{2}$/, "");
10040
10099
  const reason = seriesIdReason(rest);
@@ -10045,13 +10104,13 @@ function cmdNextId(project, seriesId, count) {
10045
10104
  `);
10046
10105
  return 1;
10047
10106
  }
10048
- const changes = join6(thewayHome(), project, "changes");
10107
+ const changes = join7(projectDir(thewayHome(), key), "changes");
10049
10108
  const active = new RegExp(`^${rest}-([0-9]{2})$`);
10050
10109
  const archived = new RegExp(`^[0-9]{4}-[0-9]{2}-[0-9]{2}-${rest}-([0-9]{2})$`);
10051
10110
  let max = 0;
10052
10111
  for (const [dir, pattern] of [
10053
10112
  [changes, active],
10054
- [join6(changes, "archive"), archived]
10113
+ [join7(changes, "archive"), archived]
10055
10114
  ]) {
10056
10115
  for (const name of dirs(dir)) {
10057
10116
  const m = pattern.exec(name);
@@ -10074,7 +10133,7 @@ function cmdNextId(project, seriesId, count) {
10074
10133
 
10075
10134
  // src/core/workflow.ts
10076
10135
  import { readdirSync as readdirSync5 } from "node:fs";
10077
- import { basename, join as join7, relative } from "node:path";
10136
+ import { basename as basename2, join as join8, relative } from "node:path";
10078
10137
  var TYPES = ["implement", "review", "agent", "pr"];
10079
10138
  var positive = {
10080
10139
  test: (v) => typeof v === "number" && Number.isInteger(v) && v >= 1,
@@ -10109,14 +10168,14 @@ var FIELDS = {
10109
10168
  };
10110
10169
  var REQUIRED = ["name", "prompt"];
10111
10170
  var MODELS = ["model", "fix_model"];
10112
- var projectDir = (d, kind) => join7(d.home, d.project, kind);
10113
- var globalDir = (d, kind) => join7(d.home, kind);
10114
- var searched = (d, kind) => d.own ? `${projectDir(d, kind)} or ${globalDir(d, kind)}` : globalDir(d, kind);
10171
+ var projectDir2 = (d, kind) => join8(projectDir(d.home, d.key), kind);
10172
+ var globalDir = (d, kind) => join8(d.home, kind);
10173
+ var searched = (d, kind) => `${projectDir2(d, kind)} or ${globalDir(d, kind)}`;
10115
10174
  function lensPath(d, lens) {
10116
- const own = join7(projectDir(d, "lenses"), `${lens}.md`);
10117
- if (d.own && isFile(own))
10175
+ const own = join8(projectDir2(d, "lenses"), `${lens}.md`);
10176
+ if (isFile(own))
10118
10177
  return own;
10119
- const global = join7(globalDir(d, "lenses"), `${lens}.md`);
10178
+ const global = join8(globalDir(d, "lenses"), `${lens}.md`);
10120
10179
  return isFile(global) ? global : null;
10121
10180
  }
10122
10181
  function validate(d, path2, defaults2) {
@@ -10201,7 +10260,7 @@ function validate(d, path2, defaults2) {
10201
10260
  }
10202
10261
  steps.push(step);
10203
10262
  }
10204
- return { workflow: { name: basename(path2, ".yaml"), file: path2, steps }, isDefault: root.get("default") === true };
10263
+ return { workflow: { name: basename2(path2, ".yaml"), file: path2, steps }, isDefault: root.get("default") === true };
10205
10264
  }
10206
10265
  function scan(d, dir) {
10207
10266
  let names;
@@ -10212,10 +10271,10 @@ function scan(d, dir) {
10212
10271
  }
10213
10272
  const out = [];
10214
10273
  for (const n of names.sort()) {
10215
- if (!n.endsWith(".yaml") || n.endsWith(".default.yaml") || !isFile(join7(dir, n)))
10274
+ if (!n.endsWith(".yaml") || n.endsWith(".default.yaml") || !isFile(join8(dir, n)))
10216
10275
  continue;
10217
10276
  if (!NAME.test(n.slice(0, -".yaml".length))) {
10218
- process.stderr.write(`theway: warning: ${relative(d.home, join7(dir, n))}: not a valid workflow name; ignored
10277
+ process.stderr.write(`theway: warning: ${relative(d.home, join8(dir, n))}: not a valid workflow name; ignored
10219
10278
  `);
10220
10279
  continue;
10221
10280
  }
@@ -10239,27 +10298,28 @@ function defaultOf(d, paths, defaults2) {
10239
10298
  return marked.length === 1 ? { workflow: marked[0] } : null;
10240
10299
  }
10241
10300
  function byName(d, wanted, defaults2) {
10242
- const own = join7(projectDir(d, "workflows"), `${wanted}.yaml`);
10243
- const global = join7(globalDir(d, "workflows"), `${wanted}.yaml`);
10244
- const path2 = d.own && isFile(own) ? own : isFile(global) ? global : null;
10301
+ const own = join8(projectDir2(d, "workflows"), `${wanted}.yaml`);
10302
+ const global = join8(globalDir(d, "workflows"), `${wanted}.yaml`);
10303
+ const path2 = isFile(own) ? own : isFile(global) ? global : null;
10245
10304
  if (path2 === null) {
10246
10305
  return { error: `theway: no workflow '${wanted}' in ${searched(d, "workflows")}` };
10247
10306
  }
10248
10307
  return validate(d, path2, defaults2);
10249
10308
  }
10250
10309
  function byDefault(d, defaults2) {
10251
- const ownNames = d.own ? scan(d, projectDir(d, "workflows")) : [];
10252
- const own = defaultOf(d, ownNames.map((n) => join7(projectDir(d, "workflows"), n)), defaults2);
10310
+ const ownNames = scan(d, projectDir2(d, "workflows"));
10311
+ const own = defaultOf(d, ownNames.map((n) => join8(projectDir2(d, "workflows"), n)), defaults2);
10253
10312
  if (own !== null)
10254
10313
  return own;
10255
10314
  const globalNames = scan(d, globalDir(d, "workflows")).filter((n) => !ownNames.includes(n));
10256
- const global = defaultOf(d, globalNames.map((n) => join7(globalDir(d, "workflows"), n)), defaults2);
10315
+ const global = defaultOf(d, globalNames.map((n) => join8(globalDir(d, "workflows"), n)), defaults2);
10257
10316
  if (global !== null)
10258
10317
  return global;
10259
10318
  return byName(d, "develop", defaults2);
10260
10319
  }
10261
- function cmdWorkflow(project, wanted) {
10262
- if (invalidSegments([["project", project]]))
10320
+ function cmdWorkflow(wanted, override) {
10321
+ const key = resolveKey(override);
10322
+ if (key === null)
10263
10323
  return 1;
10264
10324
  if (wanted !== undefined && !NAME.test(wanted)) {
10265
10325
  const shown = wanted.replaceAll(`
@@ -10269,11 +10329,11 @@ function cmdWorkflow(project, wanted) {
10269
10329
  return 1;
10270
10330
  }
10271
10331
  const home = thewayHome();
10272
- const loaded = loadConfig(home, project);
10332
+ const loaded = loadConfig(home, key);
10273
10333
  if (loaded === null)
10274
10334
  return 1;
10275
10335
  const defaults2 = loaded.config.workflow.defaults;
10276
- const d = { home, project, own: !isShared(project) };
10336
+ const d = { home, key };
10277
10337
  const result = wanted === undefined ? byDefault(d, defaults2) : byName(d, wanted, defaults2);
10278
10338
  if ("error" in result) {
10279
10339
  process.stderr.write(`${result.error}
@@ -10282,14 +10342,14 @@ function cmdWorkflow(project, wanted) {
10282
10342
  }
10283
10343
  const conventions = [];
10284
10344
  for (const file2 of CONVENTIONS) {
10285
- const global = join7(home, "standards", file2);
10345
+ const global = join8(home, "standards", file2);
10286
10346
  if (!isFile(global)) {
10287
10347
  process.stderr.write(`theway: ${global} not found; run npx --yes @pixelfactoryio/theway@latest install, then /reload-plugins
10288
10348
  `);
10289
10349
  return 1;
10290
10350
  }
10291
- const own = join7(home, project, "standards", file2);
10292
- conventions.push(d.own && isFile(own) ? own : global);
10351
+ const own = join8(projectDir(home, key), "standards", file2);
10352
+ conventions.push(isFile(own) ? own : global);
10293
10353
  }
10294
10354
  const { name: name2, file, steps } = result.workflow;
10295
10355
  const doc = { name: name2, file, commits: conventions[0], git_host: conventions[1], steps };
@@ -10310,7 +10370,7 @@ import {
10310
10370
  mkdirSync as mkdirSync3,
10311
10371
  readFileSync as readFileSync8,
10312
10372
  readlinkSync,
10313
- realpathSync,
10373
+ realpathSync as realpathSync2,
10314
10374
  renameSync as renameSync3,
10315
10375
  rmdirSync,
10316
10376
  rmSync as rmSync2,
@@ -10318,7 +10378,7 @@ import {
10318
10378
  writeFileSync as writeFileSync2
10319
10379
  } from "node:fs";
10320
10380
  import { homedir as homedir2 } from "node:os";
10321
- import { delimiter, dirname, isAbsolute, join as join8, resolve as resolve3, sep } from "node:path";
10381
+ import { delimiter, dirname as dirname2, isAbsolute, join as join9, resolve as resolve4, sep } from "node:path";
10322
10382
  import { fileURLToPath } from "node:url";
10323
10383
 
10324
10384
  // node_modules/@clack/core/dist/index.mjs
@@ -11728,20 +11788,20 @@ ${i2}
11728
11788
 
11729
11789
  // src/install.ts
11730
11790
  var self = fileURLToPath(import.meta.url);
11731
- var pkgRoot = dirname(dirname(self));
11732
- var plugin = join8(pkgRoot, "plugin");
11791
+ var pkgRoot = dirname2(dirname2(self));
11792
+ var plugin = join9(pkgRoot, "plugin");
11733
11793
  var PLUGIN_DIRS = [".claude-plugin", "commands", "workflows"];
11734
11794
  var BINARY_MARKER = "theway-cli-binary:pixelfactoryio/theway";
11735
11795
  function claudeHome() {
11736
11796
  const dir = (process.env.CLAUDE_CONFIG_DIR ?? "").trim();
11737
- return dir !== "" ? dir : join8(homedir2(), ".claude");
11797
+ return dir !== "" ? dir : join9(homedir2(), ".claude");
11738
11798
  }
11739
11799
  function installDir() {
11740
11800
  const dir = process.env.THEWAY_INSTALL_DIR ?? "";
11741
- return dir !== "" ? resolve3(dir) : join8(homedir2(), ".local", "bin");
11801
+ return dir !== "" ? resolve4(dir) : join9(homedir2(), ".local", "bin");
11742
11802
  }
11743
11803
  function shownHome(home) {
11744
- return resolve3(home) === resolve3(defaultHome()) ? "~/.theway" : resolve3(home);
11804
+ return resolve4(home) === resolve4(defaultHome()) ? "~/.theway" : resolve4(home);
11745
11805
  }
11746
11806
  function ruleRoot(home) {
11747
11807
  const at = shownHome(home);
@@ -11758,7 +11818,7 @@ function rules(home) {
11758
11818
  }
11759
11819
  function recordedHome() {
11760
11820
  const pointer = readPointer();
11761
- return pointer !== "" ? resolve3(pointer) : defaultHome();
11821
+ return pointer !== "" ? resolve4(pointer) : defaultHome();
11762
11822
  }
11763
11823
  function legacyRules(home) {
11764
11824
  return [...new Set(["Bash(~/.theway/bin/theway:*)", `Bash(${shownHome(home)}/bin/theway:*)`])];
@@ -11806,11 +11866,11 @@ function settingsTarget(path2) {
11806
11866
  if (seen.has(target) || seen.size >= 40)
11807
11867
  return { error: "it is a symlink loop" };
11808
11868
  seen.add(target);
11809
- target = resolve3(dirname(target), readlinkSync(target));
11869
+ target = resolve4(dirname2(target), readlinkSync(target));
11810
11870
  }
11811
- let dir = dirname(target);
11812
- while (!existsSync3(dir) && dirname(dir) !== dir)
11813
- dir = dirname(dir);
11871
+ let dir = dirname2(target);
11872
+ while (!existsSync3(dir) && dirname2(dir) !== dir)
11873
+ dir = dirname2(dir);
11814
11874
  try {
11815
11875
  accessSync(dir, constants.W_OK);
11816
11876
  } catch {
@@ -11822,7 +11882,7 @@ function unwritableSettings(path2, reason) {
11822
11882
  return fail(`theway: cannot write ${path2}: ${reason}; nothing was changed`);
11823
11883
  }
11824
11884
  function writeSettings(target, settings2) {
11825
- mkdirSync3(dirname(target), { recursive: true });
11885
+ mkdirSync3(dirname2(target), { recursive: true });
11826
11886
  const mode = existsSync3(target) ? statSync3(target).mode & 511 : 384;
11827
11887
  const tmp = `${target}.tmp-${process.pid}`;
11828
11888
  try {
@@ -11838,15 +11898,15 @@ function invalidSettings(path2) {
11838
11898
  return fail(`theway: ${path2} is not valid settings JSON; nothing was changed`);
11839
11899
  }
11840
11900
  function copyPlugin(home) {
11841
- const tmp = join8(home, `.theway-install-${process.pid}`);
11842
- const old = join8(home, `.theway-old-${process.pid}`);
11843
- const dest = join8(home, "skills", "theway");
11901
+ const tmp = join9(home, `.theway-install-${process.pid}`);
11902
+ const old = join9(home, `.theway-old-${process.pid}`);
11903
+ const dest = join9(home, "skills", "theway");
11844
11904
  rmSync2(tmp, { recursive: true, force: true });
11845
11905
  try {
11846
11906
  for (const dir of PLUGIN_DIRS) {
11847
- cpSync(join8(plugin, dir), join8(tmp, dir), { recursive: true });
11907
+ cpSync(join9(plugin, dir), join9(tmp, dir), { recursive: true });
11848
11908
  }
11849
- mkdirSync3(join8(home, "skills"), { recursive: true });
11909
+ mkdirSync3(join9(home, "skills"), { recursive: true });
11850
11910
  if (existsSync3(dest))
11851
11911
  renameSync3(dest, old);
11852
11912
  renameSync3(tmp, dest);
@@ -11869,23 +11929,23 @@ function legacyText(path2, match) {
11869
11929
  }
11870
11930
  }
11871
11931
  function removeLegacyBin(home) {
11872
- for (const h2 of new Set([defaultHome(), resolve3(home)])) {
11873
- const bin = join8(h2, "bin");
11874
- if (legacyText(join8(bin, "theway"), (t2) => t2.startsWith(`#!/bin/sh
11932
+ for (const h2 of new Set([defaultHome(), resolve4(home)])) {
11933
+ const bin = join9(h2, "bin");
11934
+ if (legacyText(join9(bin, "theway"), (t2) => t2.startsWith(`#!/bin/sh
11875
11935
  exec node `) && t2.endsWith(`theway.js' "$@"
11876
11936
  `))) {
11877
- rmSync2(join8(bin, "theway"), { force: true });
11937
+ rmSync2(join9(bin, "theway"), { force: true });
11878
11938
  }
11879
- if (legacyText(join8(bin, "theway.js"), (t2) => t2.startsWith(`#!/usr/bin/env node
11939
+ if (legacyText(join9(bin, "theway.js"), (t2) => t2.startsWith(`#!/usr/bin/env node
11880
11940
  `))) {
11881
- rmSync2(join8(bin, "theway.js"), { force: true });
11941
+ rmSync2(join9(bin, "theway.js"), { force: true });
11882
11942
  }
11883
11943
  removeIfEmpty2(bin);
11884
11944
  }
11885
11945
  }
11886
11946
  function writeBinary(dir) {
11887
- const dest = join8(dir, "theway");
11888
- const tmp = join8(dir, `.theway-${process.pid}`);
11947
+ const dest = join9(dir, "theway");
11948
+ const tmp = join9(dir, `.theway-${process.pid}`);
11889
11949
  mkdirSync3(dir, { recursive: true });
11890
11950
  try {
11891
11951
  copyFileSync2(self, tmp);
@@ -11917,7 +11977,7 @@ function isThewayBinary(path2) {
11917
11977
  function writePointer(home, custom) {
11918
11978
  const path2 = pointerPath();
11919
11979
  if (custom) {
11920
- mkdirSync3(dirname(path2), { recursive: true });
11980
+ mkdirSync3(dirname2(path2), { recursive: true });
11921
11981
  writeFileSync2(path2, `${home}
11922
11982
  `);
11923
11983
  } else {
@@ -11926,13 +11986,13 @@ function writePointer(home, custom) {
11926
11986
  }
11927
11987
  function realpathOr(path2) {
11928
11988
  try {
11929
- return realpathSync(path2);
11989
+ return realpathSync2(path2);
11930
11990
  } catch {
11931
- return resolve3(path2);
11991
+ return resolve4(path2);
11932
11992
  }
11933
11993
  }
11934
11994
  function unsafeHomeReason(tHome, custom) {
11935
- const home = resolve3(tHome);
11995
+ const home = resolve4(tHome);
11936
11996
  const real = realpathOr(home);
11937
11997
  const user = realpathOr(homedir2());
11938
11998
  if (real === user || user.startsWith(real + sep) || real === "/") {
@@ -11949,7 +12009,7 @@ function copiesOnPath() {
11949
12009
  for (const dir of (process.env.PATH ?? "").split(delimiter)) {
11950
12010
  if (dir === "")
11951
12011
  continue;
11952
- const candidate = join8(dir, "theway");
12012
+ const candidate = join9(dir, "theway");
11953
12013
  if (!isFile(candidate))
11954
12014
  continue;
11955
12015
  try {
@@ -11967,7 +12027,7 @@ function copiesOnPath() {
11967
12027
  }
11968
12028
  function checkPath(dir, binary) {
11969
12029
  const dirs2 = (process.env.PATH ?? "").split(delimiter).filter((d) => d !== "");
11970
- if (!dirs2.some((d) => resolve3(d) === dir)) {
12030
+ if (!dirs2.some((d) => resolve4(d) === dir)) {
11971
12031
  process.stdout.write(`Add ${dir} to your PATH, e.g.: export PATH="${dir}:$PATH"
11972
12032
  `);
11973
12033
  }
@@ -11991,9 +12051,9 @@ function expandHome(value) {
11991
12051
  if (v === "~")
11992
12052
  return homedir2();
11993
12053
  if (v.startsWith("~/"))
11994
- return resolve3(homedir2(), v.slice(2));
12054
+ return resolve4(homedir2(), v.slice(2));
11995
12055
  if (isAbsolute(v))
11996
- return resolve3(v);
12056
+ return resolve4(v);
11997
12057
  return { error: "must be an absolute path or start with ~/" };
11998
12058
  }
11999
12059
  function parseStandards(value) {
@@ -12027,7 +12087,7 @@ async function askHome() {
12027
12087
  const home2 = expandHome(value);
12028
12088
  if (typeof home2 !== "string")
12029
12089
  return home2.error;
12030
- const reason = unsafeHomeReason(home2, home2 !== resolve3(defaultHome()));
12090
+ const reason = unsafeHomeReason(home2, home2 !== resolve4(defaultHome()));
12031
12091
  return reason !== "" ? `refusing ${home2}: ${reason}` : undefined;
12032
12092
  }
12033
12093
  });
@@ -12045,7 +12105,7 @@ async function askStandards() {
12045
12105
  return isCancel(answer) ? null : answer;
12046
12106
  }
12047
12107
  async function install(opts) {
12048
- if (!existsSync3(join8(plugin, ".claude-plugin"))) {
12108
+ if (!existsSync3(join9(plugin, ".claude-plugin"))) {
12049
12109
  return fail("theway: run `npx --yes @pixelfactoryio/theway@latest install` to install or update theway");
12050
12110
  }
12051
12111
  let enabled2 = [];
@@ -12062,13 +12122,13 @@ async function install(opts) {
12062
12122
  if (typeof home !== "string")
12063
12123
  return fail(`theway: invalid --home '${opts.home}': ${home.error}; nothing was changed`);
12064
12124
  const env = process.env.THEWAY_HOME ?? "";
12065
- if (env !== "" && resolve3(env) !== home) {
12066
- return fail(`theway: --home ${home} and THEWAY_HOME ${resolve3(env)} differ; unset THEWAY_HOME or drop --home; nothing was changed`);
12125
+ if (env !== "" && resolve4(env) !== home) {
12126
+ return fail(`theway: --home ${home} and THEWAY_HOME ${resolve4(env)} differ; unset THEWAY_HOME or drop --home; nothing was changed`);
12067
12127
  }
12068
12128
  tHome = home;
12069
12129
  } else {
12070
12130
  const found = resolveHome();
12071
- const neverInstalled = found.source === "default" && !existsSync3(join8(defaultHome(), "config.yaml"));
12131
+ const neverInstalled = found.source === "default" && !existsSync3(join9(defaultHome(), "config.yaml"));
12072
12132
  if (neverInstalled && interactive()) {
12073
12133
  const home = await askHome();
12074
12134
  if (home === null)
@@ -12079,12 +12139,12 @@ async function install(opts) {
12079
12139
  }
12080
12140
  }
12081
12141
  const previous = recordedHome();
12082
- const custom = tHome !== resolve3(defaultHome());
12142
+ const custom = tHome !== resolve4(defaultHome());
12083
12143
  const dir = installDir();
12084
- const settingsPath = join8(cHome, "settings.json");
12144
+ const settingsPath = join9(cHome, "settings.json");
12085
12145
  const unsafe = unsafeHomeReason(tHome, custom);
12086
12146
  if (unsafe !== "") {
12087
- return fail(`theway: refusing data home ${resolve3(tHome)}: ${unsafe}; set THEWAY_HOME or --home to a dedicated folder`);
12147
+ return fail(`theway: refusing data home ${resolve4(tHome)}: ${unsafe}; set THEWAY_HOME or --home to a dedicated folder`);
12088
12148
  }
12089
12149
  const resolved = settingsTarget(settingsPath);
12090
12150
  if ("error" in resolved)
@@ -12092,11 +12152,11 @@ async function install(opts) {
12092
12152
  const settings2 = readSettings(resolved.target);
12093
12153
  if (settings2 === null)
12094
12154
  return invalidSettings(settingsPath);
12095
- const target = join8(dir, "theway");
12155
+ const target = join9(dir, "theway");
12096
12156
  if (occupied(target) && !isThewayBinary(target)) {
12097
12157
  return fail(`theway: ${target} exists and is not a theway binary; nothing was changed. Remove it, or set THEWAY_INSTALL_DIR to another folder`);
12098
12158
  }
12099
- const config = join8(resolve3(tHome), "config.yaml");
12159
+ const config = join9(resolve4(tHome), "config.yaml");
12100
12160
  const firstInstall = !existsSync3(config);
12101
12161
  if (opts.standards !== undefined && !firstInstall) {
12102
12162
  return fail(`theway: --standards applies only to a first install; ${config} exists, so set standards.<key>.enabled there instead; nothing was changed`);
@@ -12116,7 +12176,7 @@ async function install(opts) {
12116
12176
  } catch (e) {
12117
12177
  return fail(`theway: ${e.message}`);
12118
12178
  }
12119
- const status = init(join8(plugin, "home"), tHome, enabled2);
12179
+ const status = init(join9(plugin, "home"), tHome, enabled2);
12120
12180
  if (status !== 0)
12121
12181
  return status;
12122
12182
  if (firstInstall && opts.standards === undefined && !asked) {
@@ -12145,7 +12205,7 @@ async function install(opts) {
12145
12205
  writeSettings(resolved.target, settings2);
12146
12206
  }
12147
12207
  checkPath(dir, binary);
12148
- const version = JSON.parse(readFileSync8(join8(pkgRoot, "package.json"), "utf-8")).version;
12208
+ const version = JSON.parse(readFileSync8(join9(pkgRoot, "package.json"), "utf-8")).version;
12149
12209
  process.stdout.write(`Installed theway ${version} to ${dest} (theway@skills-dir), ${binary} and ${tHome}. Start a new Claude Code session or run /reload-plugins.
12150
12210
  `);
12151
12211
  return 0;
@@ -12154,7 +12214,7 @@ function uninstall() {
12154
12214
  const cHome = claudeHome();
12155
12215
  const tHome = resolveHome().home;
12156
12216
  const homes = [...new Set([tHome, recordedHome(), defaultHome()])];
12157
- const settingsPath = join8(cHome, "settings.json");
12217
+ const settingsPath = join9(cHome, "settings.json");
12158
12218
  let settingsFile = settingsPath;
12159
12219
  if (occupied(settingsPath)) {
12160
12220
  const resolved = settingsTarget(settingsPath);
@@ -12162,13 +12222,13 @@ function uninstall() {
12162
12222
  return unwritableSettings(settingsPath, resolved.error);
12163
12223
  settingsFile = resolved.target;
12164
12224
  }
12165
- rmSync2(join8(cHome, "skills", "theway"), { recursive: true, force: true });
12166
- const binary = join8(installDir(), "theway");
12225
+ rmSync2(join9(cHome, "skills", "theway"), { recursive: true, force: true });
12226
+ const binary = join9(installDir(), "theway");
12167
12227
  const removed = isThewayBinary(binary);
12168
12228
  if (removed)
12169
12229
  rmSync2(binary, { force: true });
12170
12230
  rmSync2(pointerPath(), { force: true });
12171
- removeIfEmpty2(dirname(pointerPath()));
12231
+ removeIfEmpty2(dirname2(pointerPath()));
12172
12232
  if (existsSync3(settingsPath)) {
12173
12233
  const settings2 = readSettings(settingsFile);
12174
12234
  if (settings2 === null)
@@ -12207,15 +12267,16 @@ function buildProgram() {
12207
12267
  const program2 = new Command("theway");
12208
12268
  program2.command("install").option("--home <path>", "", nonEmpty2).option("--standards <keys>").action(async (o2) => exit(await install({ home: o2.home, standards: o2.standards })));
12209
12269
  program2.command("uninstall").action(() => exit(uninstall()));
12210
- program2.command("list").argument("<project>", "", nonEmpty2).action((project) => exit(cmdList(project)));
12211
- program2.command("archive").argument("<project>", "", nonEmpty2).argument("<change-id>", "", nonEmpty2).option("--force").action((project, change, o2) => exit(cmdArchive(project, change, o2.force === true)));
12212
- program2.command("path").argument("[project]").argument("[change-id]").option("--verbose").action((project, change, o2) => exit(cmdPath(project, change, o2.verbose === true)));
12213
- program2.command("config").argument("<project>").action((project) => exit(cmdConfig(project)));
12214
- program2.command("standards").argument("<project>").argument("<phase>").action((project, phase) => exit(cmdStandards(project, phase)));
12215
- program2.command("context").argument("<project>").argument("<phase>").argument("[change-id]").action((project, phase, change) => exit(cmdContext(project, phase, change)));
12216
- program2.command("workflow").argument("<project>").argument("[name]").action((project, name2) => exit(cmdWorkflow(project, name2)));
12270
+ program2.command("list").option("--project <key>").action((o2) => exit(cmdList(o2.project)));
12271
+ program2.command("archive").argument("<change-id>", "", nonEmpty2).option("--project <key>").option("--force").action((change, o2) => exit(cmdArchive(change, o2.project, o2.force === true)));
12272
+ program2.command("path").argument("[change-id]").option("--project <key>").option("--verbose").action((change, o2) => exit(cmdPath(change, o2.project, o2.verbose === true)));
12273
+ program2.command("project").option("--project <key>").action((o2) => exit(cmdProject(o2.project)));
12274
+ program2.command("config").option("--project <key>").action((o2) => exit(cmdConfig(o2.project)));
12275
+ program2.command("standards").argument("<phase>").option("--project <key>").action((phase, o2) => exit(cmdStandards(phase, o2.project)));
12276
+ program2.command("context").argument("<phase>").argument("[change-id]").option("--project <key>").action((phase, change, o2) => exit(cmdContext(phase, change, o2.project)));
12277
+ program2.command("workflow").argument("[name]").option("--project <key>").action((name2, o2) => exit(cmdWorkflow(name2, o2.project)));
12217
12278
  program2.command("authority").action(() => exit(cmdAuthority()));
12218
- program2.command("next-id").argument("<project>").argument("<series-id>").option("--count <n>", "", positive2, 1).action((project, series, o2) => exit(cmdNextId(project, series, o2.count)));
12279
+ program2.command("next-id").argument("<series-id>").option("--project <key>").option("--count <n>", "", positive2, 1).action((series, o2) => exit(cmdNextId(series, o2.count, o2.project)));
12219
12280
  program2.command("validate-id").argument("<id>").option("--series").action((id, o2) => exit(cmdValidateId(id, o2.series === true)));
12220
12281
  return program2;
12221
12282
  }