@spearwolf/backe 0.1.1 → 0.2.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.
Files changed (3) hide show
  1. package/README.md +11 -18
  2. package/dist/cli.js +88 -15
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -150,20 +150,6 @@ The technical direction is human — the spec, the architecture, the milestone c
150
150
  the reviews and every decision come from a long-time engineer (that's me).
151
151
  It is also a working experiment in how far that combination carries.
152
152
 
153
- ## Status
154
-
155
- | Milestone | Scope | State |
156
- | --------- | ---------------------------------------------------------------------- | ----- |
157
- | M1 | scaffold, `core`, `store` — entities, formats, canonical serialization | done |
158
- | M2 | operations, state model, dependency graph (`ops`) | done |
159
- | M3 | configs and context resolution | done |
160
- | M4 | Git layer, signed write path, verify, quarantine | done |
161
- | M5a | services and CLI core — issues, comments, projects, output formats | done |
162
- | M5b | attachments, repo checks, hand-edit commits, batch, doctor, config | done |
163
- | M6 | sync, replay, claim | done |
164
- | M7 | MCP server | done |
165
- | M8 | release | done |
166
-
167
153
  ## For contributors (and curious humans)
168
154
 
169
155
  - **The spec is binding:** [`docs/proposals/backe.md`](docs/proposals/backe.md).
@@ -195,10 +181,17 @@ Single steps: `pnpm run lint`, `pnpm run build`, `pnpm run test`,
195
181
 
196
182
  ## Releases
197
183
 
198
- Commits follow [Conventional Commits](https://www.conventionalcommits.org).
199
- [release-please](https://github.com/googleapis/release-please) turns them into a
200
- release PR with the changelog; merging it tags the release, and the workflow
201
- publishes to npm with provenance (trusted publishing, no long-lived token).
184
+ ```sh
185
+ mise run release
186
+ ```
187
+
188
+ That's it. Commits follow [Conventional Commits](https://www.conventionalcommits.org);
189
+ [release-please](https://github.com/googleapis/release-please) keeps one release PR
190
+ (version + changelog) up to date on its own whenever `main` has `feat`, `fix` or
191
+ `perf` commits since the last release. `mise run release` waits until that PR matches
192
+ the pushed `main` and turns on auto-merge: GitHub merges it once CI is green, and the
193
+ release workflow publishes to npm with provenance (trusted publishing, no token).
194
+ Pushing straight to `main` keeps working as before.
202
195
 
203
196
  ## License
204
197
 
package/dist/cli.js CHANGED
@@ -74,7 +74,7 @@ function checkNodeVersion(version, min = 26) {
74
74
  return `backe braucht Node.js ≥ ${min} (gefunden ${version})`;
75
75
  }
76
76
  // package.json
77
- var version = "0.1.1";
77
+ var version = "0.2.0";
78
78
  // src/core/errors.ts
79
79
  const EXIT_CODES = {
80
80
  usage: 2,
@@ -15325,7 +15325,13 @@ async function editInEditor(env, ref) {
15325
15325
  }
15326
15326
  function defineEdit(parent, rt) {
15327
15327
  const parentFlags = /* @__PURE__ */ new Set();
15328
- subcommand(parent, "edit <id>", "Felder eines Issues ändern").on("option:parent", () => parentFlags.add("--parent")).on("option:no-parent", () => parentFlags.add("--no-parent")).option("--title <titel>", "neuer Titel").option("--add-project <pfad>", "Projekt hinzufügen (wiederholbar)", collect).option("--rm-project <pfad>", "Projekt entfernen (wiederholbar)", collect).option("--add-sprint <slug>", "Sprint hinzufügen (wiederholbar)", collect).option("--rm-sprint <slug>", "Sprint entfernen (wiederholbar)", collect).option("--add-dep <id>", "Abhängigkeit hinzufügen (wiederholbar)", collect).option("--rm-dep <id>", "Abhängigkeit entfernen (wiederholbar)", collect).option("--parent <id>", "umhängen unter <id>").option("--no-parent", "vom Parent lösen").option("--prop <key=wert|key:=json>", "Property setzen (wiederholbar)", collect).option("--unset-prop <key>", "Property entfernen (wiederholbar)", collect).option("--body-file <pfad|->", "neuer Body aus Datei, eine leere Datei leert ihn; »-« liest stdin, das nicht leer sein darf").action(action(rt, async (env, ref, opts) => {
15328
+ subcommand(parent, "edit <id>", "Felder eines Issues ändern oder im Editor bearbeiten").on("option:parent", () => parentFlags.add("--parent")).on("option:no-parent", () => parentFlags.add("--no-parent")).option("--title <titel>", "neuer Titel").option("--add-project <pfad>", "Projekt hinzufügen (wiederholbar)", collect).option("--rm-project <pfad>", "Projekt entfernen (wiederholbar)", collect).option("--add-sprint <slug>", "Sprint hinzufügen (wiederholbar)", collect).option("--rm-sprint <slug>", "Sprint entfernen (wiederholbar)", collect).option("--add-dep <id>", "Abhängigkeit hinzufügen (wiederholbar)", collect).option("--rm-dep <id>", "Abhängigkeit entfernen (wiederholbar)", collect).option("--parent <id>", "umhängen unter <id>").option("--no-parent", "vom Parent lösen").option("--prop <key=wert|key:=json>", "Property setzen (wiederholbar)", collect).option("--unset-prop <key>", "Property entfernen (wiederholbar)", collect).option("--body-file <pfad|->", "neuer Body aus Datei, eine leere Datei leert ihn; »-« liest stdin, das nicht leer sein darf").addHelpText("after", [
15329
+ "",
15330
+ "Ohne Änderungs-Flags öffnet backe issue edit <id> die Issue-Datei (Frontmatter und",
15331
+ "Body) im Editor. Editor: BACKE_EDITOR, sonst VISUAL, dann EDITOR — die beiden letzten",
15332
+ "nur, wenn stdin und stdout ein Terminal sind.",
15333
+ ""
15334
+ ].join("\n")).action(action(rt, async (env, ref, opts) => {
15329
15335
  if (parentFlags.size > 1) throw new BackeError("usage", "--parent und --no-parent schließen sich aus");
15330
15336
  if (Object.entries(opts).filter(([key, v]) => v !== void 0 && !GLOBAL_KEYS.includes(key)).length === 0) {
15331
15337
  await editInEditor(env, ref);
@@ -15433,7 +15439,7 @@ function createProject(ctx, input, deps) {
15433
15439
  const op = {
15434
15440
  op: "project.create",
15435
15441
  path: input.path,
15436
- title: input.title
15442
+ title: input.title ?? input.path.split("/").at(-1) ?? input.path
15437
15443
  };
15438
15444
  if (input.lead !== void 0) op.lead = resolveHandle(ctx, input.lead);
15439
15445
  if (input.body !== void 0) op.body = input.body;
@@ -15657,7 +15663,7 @@ function createSprint(ctx, input, deps) {
15657
15663
  const op = {
15658
15664
  op: "sprint.create",
15659
15665
  slug: input.slug,
15660
- title: input.title
15666
+ title: input.title ?? input.slug
15661
15667
  };
15662
15668
  if (input.start !== void 0) op.start = input.start;
15663
15669
  if (input.end !== void 0) op.end = input.end;
@@ -16488,11 +16494,11 @@ function nextCommand(program, rt) {
16488
16494
  // src/cli/commands/project.ts
16489
16495
  function projectCommands(program, rt) {
16490
16496
  const project = subcommand(program, "project", "Projekte anlegen, listen, zeigen und ändern");
16491
- subcommand(project, "create <pfad>", "Projekt anlegen; ein Unterprojekt braucht sein Elternprojekt").requiredOption("-t, --title <titel>", "Titel").option("--lead <user|me>", "verantwortlicher User").option("-d, --description <md|->", "Beschreibung; »-« liest stdin, das nicht leer sein darf (ohne Text: -d '')").option("-F, --file <pfad>", "Beschreibung aus Datei (darf leer sein)").action(action(rt, async (env, path, opts) => {
16497
+ subcommand(project, "create <pfad>", "Projekt anlegen; ein Unterprojekt braucht sein Elternprojekt").option("-t, --title <titel>", "Titel (Default: letztes Pfadsegment)").option("--lead <user|me>", "verantwortlicher User").option("-d, --description <md|->", "Beschreibung; »-« liest stdin, das nicht leer sein darf (ohne Text: -d '')").option("-F, --file <pfad>", "Beschreibung aus Datei (darf leer sein)").action(action(rt, async (env, path, opts) => {
16492
16498
  const body = await bodyArg(env, opts);
16493
16499
  emitOutcome(env, await createProject(await env.context(), {
16494
16500
  path,
16495
- title: opts.title,
16501
+ ...opts.title === void 0 ? {} : { title: opts.title },
16496
16502
  ...opts.lead === void 0 ? {} : { lead: opts.lead },
16497
16503
  ...body === void 0 ? {} : { body }
16498
16504
  }), "other");
@@ -17034,11 +17040,11 @@ function renderSprintShow(slug, r, color) {
17034
17040
  }
17035
17041
  function sprintCommands(program, rt) {
17036
17042
  const sprint = subcommand(program, "sprint", "Sprints anlegen, listen, zeigen und abschließen");
17037
- subcommand(sprint, "create <slug>", "Sprint anlegen").requiredOption("-t, --title <titel>", "Titel").option("--start <datum>", "Beginn (JJJJ-MM-TT)").option("--end <datum>", "Ende (JJJJ-MM-TT)").option("-d, --description <md|->", "Sprint-Ziel; »-« liest stdin, das nicht leer sein darf (ohne Text: -d '')").option("-F, --file <pfad>", "Sprint-Ziel aus Datei (darf leer sein)").action(action(rt, async (env, slug, opts) => {
17043
+ subcommand(sprint, "create <slug>", "Sprint anlegen").option("-t, --title <titel>", "Titel (Default: Slug)").option("--start <datum>", "Beginn (JJJJ-MM-TT)").option("--end <datum>", "Ende (JJJJ-MM-TT)").option("-d, --description <md|->", "Sprint-Ziel; »-« liest stdin, das nicht leer sein darf (ohne Text: -d '')").option("-F, --file <pfad>", "Sprint-Ziel aus Datei (darf leer sein)").action(action(rt, async (env, slug, opts) => {
17038
17044
  const body = await bodyArg(env, opts);
17039
17045
  emitOutcome(env, await createSprint(await env.context(), {
17040
17046
  slug,
17041
- title: opts.title,
17047
+ ...opts.title === void 0 ? {} : { title: opts.title },
17042
17048
  ...opts.start === void 0 ? {} : { start: opts.start },
17043
17049
  ...opts.end === void 0 ? {} : { end: opts.end },
17044
17050
  ...body === void 0 ? {} : { body }
@@ -17722,6 +17728,23 @@ function verifyCommand(program, rt) {
17722
17728
  * Fehler eine Ausgabe auf stderr samt Exit-Code (backe.md §2.18). commander beendet nie selbst den
17723
17729
  * Prozess; seine Fehler werden `usage`, Hilfe und Version enden mit 0.
17724
17730
  */
17731
+ const QUICKSTART = [
17732
+ "",
17733
+ "Schnellstart:",
17734
+ " backe config set user <handle> eigenes Handle setzen",
17735
+ " backe init <verz> --name <n> --prefix <p> --remote <url>",
17736
+ " neues Backlog anlegen",
17737
+ " backe backlog clone <url> vorhandenes Backlog klonen",
17738
+ " backe project create web Projekt anlegen (-t für einen Titel)",
17739
+ " backe sprint create 2026-w48 Sprint anlegen",
17740
+ " backe new -t \"…\" -p web Issue anlegen (-s für den Sprint)",
17741
+ " backe ls offene Issues",
17742
+ " backe show <id> Issue anzeigen",
17743
+ " backe mv <id> in_progress State ändern",
17744
+ " backe next --claim nächstes Issue holen und übernehmen",
17745
+ "Mehr: backe <befehl> --help",
17746
+ ""
17747
+ ].join("\n");
17725
17748
  /**
17726
17749
  * Das Programm samt aller Befehle. Einstellungen (Fehlerbehandlung, Ausgabe, positionale Optionen)
17727
17750
  * müssen vor dem ersten Befehl stehen, weil Unterbefehle sie beim Anlegen erben.
@@ -17731,7 +17754,7 @@ function buildProgram(rt) {
17731
17754
  writeOut: (s) => rt.io.stdout(s),
17732
17755
  writeErr: () => {},
17733
17756
  outputError: () => {}
17734
- }).enablePositionalOptions();
17757
+ }).enablePositionalOptions().addHelpText("after", QUICKSTART);
17735
17758
  addGlobalOptions(trackDispatch(program));
17736
17759
  contextCommand(program, rt);
17737
17760
  initCommand(program, rt);
@@ -17755,15 +17778,55 @@ function buildProgram(rt) {
17755
17778
  return program;
17756
17779
  }
17757
17780
  /**
17781
+ * Hilfe eines Befehls samt `addHelpText`-Blöcken, als String statt auf stdout. Sie geht über den
17782
+ * Fehlerkanal (`outputHelp({ error: true })`), damit Breite und Farben dem Ziel stderr folgen.
17783
+ */
17784
+ function helpOf(cmd) {
17785
+ let text = "";
17786
+ const saved = cmd.configureOutput();
17787
+ cmd.configureOutput({
17788
+ ...saved,
17789
+ writeErr: (s) => text += s
17790
+ });
17791
+ try {
17792
+ cmd.outputHelp({ error: true });
17793
+ } finally {
17794
+ cmd.configureOutput(saved);
17795
+ }
17796
+ return text;
17797
+ }
17798
+ /**
17758
17799
  * commander-Fehler als `usage`. `commander.help` mit Exit 1 heißt: einer Gruppe fehlt der
17759
- * Unterbefehl; welcher, sagt der zuletzt betretene Befehl (`trackDispatch`).
17800
+ * Unterbefehl; welcher, sagt der zuletzt betretene Befehl (`trackDispatch`). Fehlt ein Befehl,
17801
+ * Unterbefehl, Pflichtargument oder eine Pflichtoption, kommt die Hilfe dieses Befehls als `help`
17802
+ * zurück (backe.md §2.18); im Text-Modus ersetzt sie den Hinweis, im JSON-Modus bleibt `hint`.
17803
+ * Argument- und Optionsname stammen vom gescheiterten Befehl, nicht aus commanders Meldung.
17760
17804
  */
17761
17805
  function fromCommander(err, program) {
17762
- if (err.code === "commander.help") {
17763
- const path = commandPath(lastDispatched(program));
17764
- return new BackeError("usage", path === "backe" ? "Befehl fehlt" : "Unterbefehl fehlt", { hint: `${path} --help` });
17806
+ const failed = lastDispatched(program);
17807
+ const path = commandPath(failed);
17808
+ const hint = `${path} --help`;
17809
+ const original = err.message.replace(/^error: /, "");
17810
+ if (err.code === "commander.help") return {
17811
+ error: new BackeError("usage", path === "backe" ? "Befehl fehlt" : "Unterbefehl fehlt", { hint }),
17812
+ help: helpOf(failed)
17813
+ };
17814
+ if (err.code === "commander.missingArgument") {
17815
+ const missing = failed.registeredArguments.find((a, i) => a.required && failed.args[i] == null);
17816
+ return {
17817
+ error: new BackeError("usage", missing === void 0 ? original : `Argument »${missing.name()}« fehlt`, { hint }),
17818
+ help: helpOf(failed)
17819
+ };
17765
17820
  }
17766
- return new BackeError("usage", err.message.replace(/^error: /, ""));
17821
+ if (err.code === "commander.missingMandatoryOptionValue") {
17822
+ let missing;
17823
+ for (let cmd = failed; cmd !== null && missing === void 0; cmd = cmd.parent) missing = cmd.options.find((o) => o.mandatory && cmd?.getOptionValue(o.attributeName()) === void 0)?.flags;
17824
+ return {
17825
+ error: new BackeError("usage", missing === void 0 ? original : `Option »${missing}« fehlt`, { hint }),
17826
+ help: helpOf(failed)
17827
+ };
17828
+ }
17829
+ return { error: new BackeError("usage", original) };
17767
17830
  }
17768
17831
  /**
17769
17832
  * Format für einen Fehler, der vor der Aktion eines Befehls entstand: dieselbe Rangfolge wie
@@ -17804,11 +17867,21 @@ async function run(io) {
17804
17867
  return 0;
17805
17868
  } catch (caught) {
17806
17869
  let err = caught;
17870
+ let helped;
17807
17871
  if (caught instanceof CommanderError && program !== void 0) {
17808
17872
  if (caught.exitCode === 0) return 0;
17809
- err = fromCommander(caught, program);
17873
+ const converted = fromCommander(caught, program);
17874
+ err = converted.error;
17875
+ if (converted.help !== void 0) helped = {
17876
+ message: converted.error.message,
17877
+ help: converted.help
17878
+ };
17810
17879
  }
17811
17880
  const format = rt.state.format ?? await fallbackFormat(io);
17881
+ if (format !== "json" && helped !== void 0) {
17882
+ io.stderr(`${safeText(`Fehler: ${helped.message}\n`)}\n${safeText(helped.help)}`);
17883
+ return exitCodeOf(err);
17884
+ }
17812
17885
  io.stderr(renderError(err, format === "json" ? "json" : "text"));
17813
17886
  return exitCodeOf(err);
17814
17887
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spearwolf/backe",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Git-based backlog CLI",
5
5
  "author": "Wolfger Schramm",
6
6
  "repository": {