@ramon-sg/issue-flow 0.3.1 → 0.3.2
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 +2 -2
- package/dist/cli-flags.d.ts +94 -0
- package/dist/cli-flags.js +64 -0
- package/dist/cli-setup.d.ts +1 -1
- package/dist/cli-worktree.d.ts +1 -1
- package/dist/cli.d.ts +14 -94
- package/dist/cli.js +41 -72
- package/dist/package-edits.js +10 -1
- package/dist/usage.d.ts +10 -1
- package/dist/usage.js +50 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -75,7 +75,7 @@ Qué hace, en orden:
|
|
|
75
75
|
- Si el PR se mergeó y no queda trabajo sin pushear, ofrece borrar el worktree y la rama.
|
|
76
76
|
- Si no, dice cómo retomar.
|
|
77
77
|
|
|
78
|
-
**Permisos:** si el repo tiene [`claude-repo-guard`](https://github.com/ramon-sg/claude-repo-guard), Claude se abre en modo auto con su contexto (lo mismo que `claude:auto`). Con `--ask-permissions` se abre con tus settings, y con `--free` sin sandbox ni preguntas (como `claude:free`). Sin `claude-repo-guard`, se abre con tus settings. `--plan` devuelve esos mismos argumentos en `claudeArgs`.
|
|
78
|
+
**Permisos:** si el repo tiene [`claude-repo-guard`](https://github.com/ramon-sg/claude-repo-guard), Claude se abre en modo auto con su contexto (lo mismo que `claude:auto`). Con `--ask-permissions` se abre con tus settings, y con `--free` sin sandbox ni preguntas (como `claude:free`). Sin `claude-repo-guard`, se abre con tus settings. `--plan` devuelve esos mismos argumentos en `claudeArgs`. El atajo es `npm run issue:start:free 42`. Con npm, las opciones van después de `--` (`npm run issue:start -- 42 --free`); con pnpm, bun o yarn no hace falta. La tabla de cada administrador está en [Flujos](docs/flujos.md#administradores). `issue-flow issue start --help` explica cada opción.
|
|
79
79
|
|
|
80
80
|
### Con la nube y con otras herramientas
|
|
81
81
|
|
|
@@ -196,7 +196,7 @@ npx @ramon-sg/issue-flow doctor # revisa que el repo esté com
|
|
|
196
196
|
`apply` deja el repo como lo pide la versión que corre, y correrlo otra vez no cambia nada. La versión la elige quien actualiza, al elegir cuál correr: `apply` no cambia la versión de ningún otro paquete.
|
|
197
197
|
|
|
198
198
|
1. **`.agents/flow.json`:** si no existe, lo crea con el `$schema` de esta versión y, si el repo tiene `paseo.json`, con su plantilla de rama y sus tipos. Esa primera vez propone las recetas que sugieren los archivos del repo (con `--yes`, todas; sin terminal y sin `--yes`, no escribe nada y lo dice). Si ya existe, no pregunta: corre las migraciones de esta versión, mueve el `$schema` y suma las recetas de `--recipe`.
|
|
199
|
-
2. **`package.json`:** `@ramon-sg/issue-flow` en esta versión, exacta. `@ramon-sg/github-rest` y los scripts `issue:start`, `worktree:prune` y `pr:worktree` solo si faltan: un `github-rest` que el repo ya tiene se queda, con un aviso si no llega a la versión que necesitan las skills.
|
|
199
|
+
2. **`package.json`:** `@ramon-sg/issue-flow` en esta versión, exacta. `@ramon-sg/github-rest` y los scripts `issue:start`, `issue:start:free`, `worktree:prune` y `pr:worktree` solo si faltan (`issue:start:free` no se agrega si el repo tiene su propio `issue:start`, que se saltaría): un `github-rest` que el repo ya tiene se queda, con un aviso si no llega a la versión que necesitan las skills.
|
|
200
200
|
3. **`.claude/settings.json`:** los hooks `SessionStart`, `WorktreeCreate` y `WorktreeRemove`, fijados a esta versión y con 600 segundos. El de `SessionStart` corre `claude-cloud session` en la nube, así que un hook propio de `claude-cloud` se quita para que no corra dos veces.
|
|
201
201
|
|
|
202
202
|
No consulta npm, y nunca baja de versión: si el repo ya tiene una issue-flow más nueva (por ejemplo, `package.json` subido a mano antes del `install`), o un rango como `^0.2.6`, se detiene y dice qué correr. `--json` da `{ version, changes, kept, written, next }`. Sale con 0 si aplicó o no había nada que hacer, y con 1 si se negó o tenía que preguntar y no pudo.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The CLI's flags and which command takes each one, apart from cli.ts (which runs on
|
|
3
|
+
* import) so the tests can check the usage text against them.
|
|
4
|
+
*/
|
|
5
|
+
import type { parseArgs } from "node:util";
|
|
6
|
+
/** Options of the CLI. */
|
|
7
|
+
export declare const OPTIONS: {
|
|
8
|
+
readonly repo: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
readonly short: "R";
|
|
11
|
+
};
|
|
12
|
+
readonly json: {
|
|
13
|
+
readonly type: "boolean";
|
|
14
|
+
};
|
|
15
|
+
readonly help: {
|
|
16
|
+
readonly type: "boolean";
|
|
17
|
+
readonly short: "h";
|
|
18
|
+
};
|
|
19
|
+
readonly missing: {
|
|
20
|
+
readonly type: "boolean";
|
|
21
|
+
};
|
|
22
|
+
readonly limit: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
};
|
|
25
|
+
readonly namer: {
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
};
|
|
28
|
+
readonly yes: {
|
|
29
|
+
readonly type: "boolean";
|
|
30
|
+
readonly short: "y";
|
|
31
|
+
};
|
|
32
|
+
readonly "dry-run": {
|
|
33
|
+
readonly type: "boolean";
|
|
34
|
+
};
|
|
35
|
+
readonly branch: {
|
|
36
|
+
readonly type: "boolean";
|
|
37
|
+
};
|
|
38
|
+
readonly resume: {
|
|
39
|
+
readonly type: "string";
|
|
40
|
+
};
|
|
41
|
+
readonly new: {
|
|
42
|
+
readonly type: "boolean";
|
|
43
|
+
};
|
|
44
|
+
readonly "no-launch": {
|
|
45
|
+
readonly type: "boolean";
|
|
46
|
+
};
|
|
47
|
+
readonly "ask-permissions": {
|
|
48
|
+
readonly type: "boolean";
|
|
49
|
+
};
|
|
50
|
+
readonly free: {
|
|
51
|
+
readonly type: "boolean";
|
|
52
|
+
};
|
|
53
|
+
readonly plan: {
|
|
54
|
+
readonly type: "boolean";
|
|
55
|
+
};
|
|
56
|
+
readonly cloud: {
|
|
57
|
+
readonly type: "boolean";
|
|
58
|
+
};
|
|
59
|
+
readonly here: {
|
|
60
|
+
readonly type: "boolean";
|
|
61
|
+
};
|
|
62
|
+
readonly teleport: {
|
|
63
|
+
readonly type: "boolean";
|
|
64
|
+
};
|
|
65
|
+
readonly adopt: {
|
|
66
|
+
readonly type: "boolean";
|
|
67
|
+
};
|
|
68
|
+
readonly only: {
|
|
69
|
+
readonly type: "string";
|
|
70
|
+
};
|
|
71
|
+
readonly path: {
|
|
72
|
+
readonly type: "string";
|
|
73
|
+
};
|
|
74
|
+
readonly next: {
|
|
75
|
+
readonly type: "boolean";
|
|
76
|
+
};
|
|
77
|
+
readonly "no-setup": {
|
|
78
|
+
readonly type: "boolean";
|
|
79
|
+
};
|
|
80
|
+
readonly recipe: {
|
|
81
|
+
readonly type: "string";
|
|
82
|
+
};
|
|
83
|
+
readonly update: {
|
|
84
|
+
readonly type: "boolean";
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
/** The parsed flags. */
|
|
88
|
+
export type Flags = ReturnType<typeof parseArgs<{
|
|
89
|
+
options: typeof OPTIONS;
|
|
90
|
+
allowPositionals: true;
|
|
91
|
+
strict: true;
|
|
92
|
+
}>>["values"];
|
|
93
|
+
/** Flags each command takes, besides `--repo`, `--help` and `--namer`. */
|
|
94
|
+
export declare const COMMAND_FLAGS: Record<string, (keyof Flags)[]>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** Options of the CLI. */
|
|
2
|
+
export const OPTIONS = {
|
|
3
|
+
repo: { type: "string", short: "R" },
|
|
4
|
+
json: { type: "boolean" },
|
|
5
|
+
help: { type: "boolean", short: "h" },
|
|
6
|
+
missing: { type: "boolean" },
|
|
7
|
+
limit: { type: "string" },
|
|
8
|
+
namer: { type: "string" },
|
|
9
|
+
yes: { type: "boolean", short: "y" },
|
|
10
|
+
"dry-run": { type: "boolean" },
|
|
11
|
+
branch: { type: "boolean" },
|
|
12
|
+
resume: { type: "string" },
|
|
13
|
+
new: { type: "boolean" },
|
|
14
|
+
"no-launch": { type: "boolean" },
|
|
15
|
+
"ask-permissions": { type: "boolean" },
|
|
16
|
+
free: { type: "boolean" },
|
|
17
|
+
plan: { type: "boolean" },
|
|
18
|
+
cloud: { type: "boolean" },
|
|
19
|
+
here: { type: "boolean" },
|
|
20
|
+
teleport: { type: "boolean" },
|
|
21
|
+
adopt: { type: "boolean" },
|
|
22
|
+
only: { type: "string" },
|
|
23
|
+
path: { type: "string" },
|
|
24
|
+
next: { type: "boolean" },
|
|
25
|
+
"no-setup": { type: "boolean" },
|
|
26
|
+
recipe: { type: "string" },
|
|
27
|
+
update: { type: "boolean" },
|
|
28
|
+
};
|
|
29
|
+
/** Flags each command takes, besides `--repo`, `--help` and `--namer`. */
|
|
30
|
+
export const COMMAND_FLAGS = {
|
|
31
|
+
branch: ["json", "missing", "limit", "yes", "dry-run"],
|
|
32
|
+
start: [
|
|
33
|
+
"yes",
|
|
34
|
+
"dry-run",
|
|
35
|
+
"branch",
|
|
36
|
+
"resume",
|
|
37
|
+
"new",
|
|
38
|
+
"no-launch",
|
|
39
|
+
"ask-permissions",
|
|
40
|
+
"free",
|
|
41
|
+
"plan",
|
|
42
|
+
"cloud",
|
|
43
|
+
"here",
|
|
44
|
+
"teleport",
|
|
45
|
+
"adopt",
|
|
46
|
+
],
|
|
47
|
+
"worktree setup": ["only"],
|
|
48
|
+
"worktree teardown": ["path"],
|
|
49
|
+
"worktree ports": ["next"],
|
|
50
|
+
"worktree cleanup": ["path"],
|
|
51
|
+
"worktree prune": ["only", "yes"],
|
|
52
|
+
session: [],
|
|
53
|
+
"pr worktree": ["no-setup"],
|
|
54
|
+
"adapter setup": ["only"],
|
|
55
|
+
"adapter issue": [],
|
|
56
|
+
"adapter archive": [],
|
|
57
|
+
"hook worktree-create": [],
|
|
58
|
+
"hook worktree-remove": [],
|
|
59
|
+
apply: ["yes", "dry-run", "json", "recipe"],
|
|
60
|
+
init: ["yes", "recipe"],
|
|
61
|
+
doctor: ["json"],
|
|
62
|
+
upgrade: ["dry-run"],
|
|
63
|
+
"labels sync": ["update", "dry-run", "json"],
|
|
64
|
+
};
|
package/dist/cli-setup.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file The `apply` and `doctor` commands of the CLI, and `init` and `upgrade`, which run
|
|
3
3
|
* `apply` now and say so: their flags turned into options.
|
|
4
4
|
*/
|
|
5
|
-
import type { Flags } from "./cli.js";
|
|
5
|
+
import type { Flags } from "./cli-flags.js";
|
|
6
6
|
import { type Output } from "./output.js";
|
|
7
7
|
/** The setup commands. */
|
|
8
8
|
export declare const SETUP_COMMANDS: string[];
|
package/dist/cli-worktree.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file The `worktree`, `session`, `adapter` and `hook` commands of the CLI: their flags
|
|
3
3
|
* turned into options.
|
|
4
4
|
*/
|
|
5
|
-
import type { Flags } from "./cli.js";
|
|
5
|
+
import type { Flags } from "./cli-flags.js";
|
|
6
6
|
import { type FlowConfig } from "./config.js";
|
|
7
7
|
import { type Output } from "./output.js";
|
|
8
8
|
/** The commands of `issue-flow worktree`. */
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,99 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
* @file `issue-flow` CLI. Warnings on stderr; exits 0 on success, 1 if GitHub, an edit or
|
|
4
|
-
* the start of an issue failed (or was declined) and 2 on bad usage or a bad
|
|
5
|
-
* `.agents/flow.json`.
|
|
6
|
-
*/
|
|
7
|
-
import { parseArgs } from "node:util";
|
|
2
|
+
import { type Flags } from "./cli-flags.js";
|
|
8
3
|
import { type FlowConfig } from "./config.js";
|
|
9
4
|
import { type Output } from "./output.js";
|
|
10
|
-
/** Options of the CLI. */
|
|
11
|
-
declare const OPTIONS: {
|
|
12
|
-
readonly repo: {
|
|
13
|
-
readonly type: "string";
|
|
14
|
-
readonly short: "R";
|
|
15
|
-
};
|
|
16
|
-
readonly json: {
|
|
17
|
-
readonly type: "boolean";
|
|
18
|
-
};
|
|
19
|
-
readonly help: {
|
|
20
|
-
readonly type: "boolean";
|
|
21
|
-
readonly short: "h";
|
|
22
|
-
};
|
|
23
|
-
readonly missing: {
|
|
24
|
-
readonly type: "boolean";
|
|
25
|
-
};
|
|
26
|
-
readonly limit: {
|
|
27
|
-
readonly type: "string";
|
|
28
|
-
};
|
|
29
|
-
readonly namer: {
|
|
30
|
-
readonly type: "string";
|
|
31
|
-
};
|
|
32
|
-
readonly yes: {
|
|
33
|
-
readonly type: "boolean";
|
|
34
|
-
readonly short: "y";
|
|
35
|
-
};
|
|
36
|
-
readonly "dry-run": {
|
|
37
|
-
readonly type: "boolean";
|
|
38
|
-
};
|
|
39
|
-
readonly branch: {
|
|
40
|
-
readonly type: "boolean";
|
|
41
|
-
};
|
|
42
|
-
readonly resume: {
|
|
43
|
-
readonly type: "string";
|
|
44
|
-
};
|
|
45
|
-
readonly new: {
|
|
46
|
-
readonly type: "boolean";
|
|
47
|
-
};
|
|
48
|
-
readonly "no-launch": {
|
|
49
|
-
readonly type: "boolean";
|
|
50
|
-
};
|
|
51
|
-
readonly "ask-permissions": {
|
|
52
|
-
readonly type: "boolean";
|
|
53
|
-
};
|
|
54
|
-
readonly free: {
|
|
55
|
-
readonly type: "boolean";
|
|
56
|
-
};
|
|
57
|
-
readonly plan: {
|
|
58
|
-
readonly type: "boolean";
|
|
59
|
-
};
|
|
60
|
-
readonly cloud: {
|
|
61
|
-
readonly type: "boolean";
|
|
62
|
-
};
|
|
63
|
-
readonly here: {
|
|
64
|
-
readonly type: "boolean";
|
|
65
|
-
};
|
|
66
|
-
readonly teleport: {
|
|
67
|
-
readonly type: "boolean";
|
|
68
|
-
};
|
|
69
|
-
readonly adopt: {
|
|
70
|
-
readonly type: "boolean";
|
|
71
|
-
};
|
|
72
|
-
readonly only: {
|
|
73
|
-
readonly type: "string";
|
|
74
|
-
};
|
|
75
|
-
readonly path: {
|
|
76
|
-
readonly type: "string";
|
|
77
|
-
};
|
|
78
|
-
readonly next: {
|
|
79
|
-
readonly type: "boolean";
|
|
80
|
-
};
|
|
81
|
-
readonly "no-setup": {
|
|
82
|
-
readonly type: "boolean";
|
|
83
|
-
};
|
|
84
|
-
readonly recipe: {
|
|
85
|
-
readonly type: "string";
|
|
86
|
-
};
|
|
87
|
-
readonly update: {
|
|
88
|
-
readonly type: "boolean";
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
/** The parsed flags. */
|
|
92
|
-
export type Flags = ReturnType<typeof parseArgs<{
|
|
93
|
-
options: typeof OPTIONS;
|
|
94
|
-
allowPositionals: true;
|
|
95
|
-
strict: true;
|
|
96
|
-
}>>["values"];
|
|
97
5
|
/**
|
|
98
6
|
* The repo of the command: `-R`, then the config's `repo`, then `GH_REPO`, then origin.
|
|
99
7
|
* @param flag - The `-R` value.
|
|
@@ -111,6 +19,19 @@ export declare function repoOf(flag: string | undefined, config: FlowConfig, cwd
|
|
|
111
19
|
* @example ownFlags("worktree ports", { next: true })
|
|
112
20
|
*/
|
|
113
21
|
export declare function ownFlags(command: string, flags: Flags): void;
|
|
22
|
+
/**
|
|
23
|
+
* Splits the arguments from the command that `pr worktree` runs after `--`. Anywhere else
|
|
24
|
+
* a `--` is dropped, since pnpm passes it on as it is (`pnpm issue:start -- 42` runs
|
|
25
|
+
* `issue start -- 42`), and so is one right after `pr worktree` with no PR number before it
|
|
26
|
+
* (`pnpm pr:worktree -- 5`).
|
|
27
|
+
* @param argv - The arguments.
|
|
28
|
+
* @returns The arguments for issue-flow, and the command, or null if there is none.
|
|
29
|
+
* @example splitArgs(["pr", "worktree", "5", "--", "npm", "test"]) // { args: ["pr", "worktree", "5"], command: ["npm", "test"] }
|
|
30
|
+
*/
|
|
31
|
+
export declare function splitArgs(argv: string[]): {
|
|
32
|
+
args: string[];
|
|
33
|
+
command: string[] | null;
|
|
34
|
+
};
|
|
114
35
|
/**
|
|
115
36
|
* Runs the CLI.
|
|
116
37
|
* @param argv - Arguments without `node` or the script.
|
|
@@ -120,4 +41,3 @@ export declare function ownFlags(command: string, flags: Flags): void;
|
|
|
120
41
|
* @throws UsageError, ConfigError or GitHubError, which the entry point handles.
|
|
121
42
|
*/
|
|
122
43
|
export declare function main(argv: string[], out: Output, cwd: string): Promise<number>;
|
|
123
|
-
export {};
|
package/dist/cli.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* `.agents/flow.json`.
|
|
6
6
|
*/
|
|
7
7
|
import { parseArgs } from "node:util";
|
|
8
|
+
import { COMMAND_FLAGS, OPTIONS } from "./cli-flags.js";
|
|
8
9
|
import { GitHubError, InvalidRepoEnvError, resolveRepo } from "@ramon-sg/github-rest";
|
|
9
10
|
import { branchMissing, branchOf } from "./commands/issue-branch.js";
|
|
10
11
|
import { issueStart } from "./commands/issue-start.js";
|
|
@@ -15,71 +16,7 @@ import { prWorktree } from "./commands/pr-worktree.js";
|
|
|
15
16
|
import { ConfigError } from "./config-base.js";
|
|
16
17
|
import { loadConfig } from "./config.js";
|
|
17
18
|
import { processOutput, UsageError } from "./output.js";
|
|
18
|
-
import {
|
|
19
|
-
/** Options of the CLI. */
|
|
20
|
-
const OPTIONS = {
|
|
21
|
-
repo: { type: "string", short: "R" },
|
|
22
|
-
json: { type: "boolean" },
|
|
23
|
-
help: { type: "boolean", short: "h" },
|
|
24
|
-
missing: { type: "boolean" },
|
|
25
|
-
limit: { type: "string" },
|
|
26
|
-
namer: { type: "string" },
|
|
27
|
-
yes: { type: "boolean", short: "y" },
|
|
28
|
-
"dry-run": { type: "boolean" },
|
|
29
|
-
branch: { type: "boolean" },
|
|
30
|
-
resume: { type: "string" },
|
|
31
|
-
new: { type: "boolean" },
|
|
32
|
-
"no-launch": { type: "boolean" },
|
|
33
|
-
"ask-permissions": { type: "boolean" },
|
|
34
|
-
free: { type: "boolean" },
|
|
35
|
-
plan: { type: "boolean" },
|
|
36
|
-
cloud: { type: "boolean" },
|
|
37
|
-
here: { type: "boolean" },
|
|
38
|
-
teleport: { type: "boolean" },
|
|
39
|
-
adopt: { type: "boolean" },
|
|
40
|
-
only: { type: "string" },
|
|
41
|
-
path: { type: "string" },
|
|
42
|
-
next: { type: "boolean" },
|
|
43
|
-
"no-setup": { type: "boolean" },
|
|
44
|
-
recipe: { type: "string" },
|
|
45
|
-
update: { type: "boolean" },
|
|
46
|
-
};
|
|
47
|
-
/** Flags each command takes, besides `--repo`, `--help` and `--namer`. */
|
|
48
|
-
const COMMAND_FLAGS = {
|
|
49
|
-
branch: ["json", "missing", "limit", "yes", "dry-run"],
|
|
50
|
-
start: [
|
|
51
|
-
"yes",
|
|
52
|
-
"dry-run",
|
|
53
|
-
"branch",
|
|
54
|
-
"resume",
|
|
55
|
-
"new",
|
|
56
|
-
"no-launch",
|
|
57
|
-
"ask-permissions",
|
|
58
|
-
"free",
|
|
59
|
-
"plan",
|
|
60
|
-
"cloud",
|
|
61
|
-
"here",
|
|
62
|
-
"teleport",
|
|
63
|
-
"adopt",
|
|
64
|
-
],
|
|
65
|
-
"worktree setup": ["only"],
|
|
66
|
-
"worktree teardown": ["path"],
|
|
67
|
-
"worktree ports": ["next"],
|
|
68
|
-
"worktree cleanup": ["path"],
|
|
69
|
-
"worktree prune": ["only", "yes"],
|
|
70
|
-
session: [],
|
|
71
|
-
"pr worktree": ["no-setup"],
|
|
72
|
-
"adapter setup": ["only"],
|
|
73
|
-
"adapter issue": [],
|
|
74
|
-
"adapter archive": [],
|
|
75
|
-
"hook worktree-create": [],
|
|
76
|
-
"hook worktree-remove": [],
|
|
77
|
-
apply: ["yes", "dry-run", "json", "recipe"],
|
|
78
|
-
init: ["yes", "recipe"],
|
|
79
|
-
doctor: ["json"],
|
|
80
|
-
upgrade: ["dry-run"],
|
|
81
|
-
"labels sync": ["update", "dry-run", "json"],
|
|
82
|
-
};
|
|
19
|
+
import { usageOf } from "./usage.js";
|
|
83
20
|
/** An issue number: digits only. */
|
|
84
21
|
const NUMBER = /^\d+$/;
|
|
85
22
|
/** A positive whole number. */
|
|
@@ -192,6 +129,41 @@ function cloudArgs(flags) {
|
|
|
192
129
|
if (other !== undefined)
|
|
193
130
|
throw new UsageError(`--${way} does not go with --${other}.`);
|
|
194
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* The positionals of some arguments, with each flag's value left out (`-R o/r` is a flag).
|
|
134
|
+
* @param args - The arguments.
|
|
135
|
+
* @returns The positionals.
|
|
136
|
+
*/
|
|
137
|
+
function positionalsOf(args) {
|
|
138
|
+
return parseArgs({ args, options: OPTIONS, allowPositionals: true, strict: false }).positionals;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Splits the arguments from the command that `pr worktree` runs after `--`. Anywhere else
|
|
142
|
+
* a `--` is dropped, since pnpm passes it on as it is (`pnpm issue:start -- 42` runs
|
|
143
|
+
* `issue start -- 42`), and so is one right after `pr worktree` with no PR number before it
|
|
144
|
+
* (`pnpm pr:worktree -- 5`).
|
|
145
|
+
* @param argv - The arguments.
|
|
146
|
+
* @returns The arguments for issue-flow, and the command, or null if there is none.
|
|
147
|
+
* @example splitArgs(["pr", "worktree", "5", "--", "npm", "test"]) // { args: ["pr", "worktree", "5"], command: ["npm", "test"] }
|
|
148
|
+
*/
|
|
149
|
+
export function splitArgs(argv) {
|
|
150
|
+
let args = argv;
|
|
151
|
+
for (let dashes = args.indexOf("--"); dashes !== -1; dashes = args.indexOf("--")) {
|
|
152
|
+
const words = positionalsOf(args.slice(0, dashes));
|
|
153
|
+
if (words[0] === "pr" && words[1] === "worktree" && words.length > 2)
|
|
154
|
+
return { args: args.slice(0, dashes), command: args.slice(dashes + 1) };
|
|
155
|
+
args = args.filter((_, index) => index !== dashes);
|
|
156
|
+
}
|
|
157
|
+
return { args, command: null };
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The command's words, as `usageOf` takes them.
|
|
161
|
+
* @param argv - The arguments.
|
|
162
|
+
* @returns The positionals, without the flags nor their values.
|
|
163
|
+
*/
|
|
164
|
+
function commandWords(argv) {
|
|
165
|
+
return positionalsOf(splitArgs(argv).args);
|
|
166
|
+
}
|
|
195
167
|
/**
|
|
196
168
|
* Runs the CLI.
|
|
197
169
|
* @param argv - Arguments without `node` or the script.
|
|
@@ -201,23 +173,20 @@ function cloudArgs(flags) {
|
|
|
201
173
|
* @throws UsageError, ConfigError or GitHubError, which the entry point handles.
|
|
202
174
|
*/
|
|
203
175
|
export async function main(argv, out, cwd) {
|
|
204
|
-
const
|
|
205
|
-
const command = dashes === -1 ? null : argv.slice(dashes + 1);
|
|
176
|
+
const { args, command } = splitArgs(argv);
|
|
206
177
|
let parsed;
|
|
207
178
|
try {
|
|
208
|
-
parsed = parseArgs({ args
|
|
179
|
+
parsed = parseArgs({ args, options: OPTIONS, allowPositionals: true, strict: true });
|
|
209
180
|
}
|
|
210
181
|
catch (error) {
|
|
211
182
|
throw new UsageError(error instanceof Error ? error.message : String(error));
|
|
212
183
|
}
|
|
213
184
|
const { values: flags, positionals } = parsed;
|
|
214
185
|
if (flags.help) {
|
|
215
|
-
out.stdout(`${
|
|
186
|
+
out.stdout(`${usageOf(positionals)}\n`);
|
|
216
187
|
return 0;
|
|
217
188
|
}
|
|
218
189
|
const [group, sub, ...rest] = positionals;
|
|
219
|
-
if (command !== null && (group !== "pr" || sub !== "worktree"))
|
|
220
|
-
throw new UsageError("-- only goes with pr worktree.");
|
|
221
190
|
if (group === "pr")
|
|
222
191
|
return runPr(sub, rest, flags, { out, cwd, command });
|
|
223
192
|
if (group === "labels")
|
|
@@ -363,6 +332,6 @@ main(process.argv.slice(2), out, process.cwd()).then((code) => {
|
|
|
363
332
|
}, (error) => {
|
|
364
333
|
const usage = error instanceof UsageError;
|
|
365
334
|
const config = error instanceof ConfigError;
|
|
366
|
-
out.stderr(`issue-flow: ${error instanceof Error ? error.message : String(error)}\n${usage ? `${
|
|
335
|
+
out.stderr(`issue-flow: ${error instanceof Error ? error.message : String(error)}\n${usage ? `${usageOf(commandWords(process.argv.slice(2)))}\n` : ""}`);
|
|
367
336
|
process.exitCode = usage || config ? 2 : 1;
|
|
368
337
|
});
|
package/dist/package-edits.js
CHANGED
|
@@ -100,9 +100,13 @@ export function reaches(current, tested) {
|
|
|
100
100
|
export const KEPT = "kept ";
|
|
101
101
|
/** The package the skills call, which the repo gets if it lacks it. */
|
|
102
102
|
export const GITHUB_REST = "@ramon-sg/github-rest";
|
|
103
|
+
/** The script that starts an issue, and its shortcut with `--free`. */
|
|
104
|
+
const START_SCRIPT = "issue:start";
|
|
105
|
+
const FREE_SCRIPT = "issue:start:free";
|
|
103
106
|
/** The scripts `apply` adds. */
|
|
104
107
|
const FLOW_SCRIPTS = {
|
|
105
108
|
"issue:start": "issue-flow issue start",
|
|
109
|
+
"issue:start:free": "issue-flow issue start --free",
|
|
106
110
|
"worktree:prune": "issue-flow worktree prune",
|
|
107
111
|
"pr:worktree": "issue-flow pr worktree",
|
|
108
112
|
};
|
|
@@ -156,8 +160,13 @@ export function withFlowPackages(pkg, versions) {
|
|
|
156
160
|
pin(GITHUB_REST, versions.githubRest, "devDependencies", null);
|
|
157
161
|
else if (!reaches(rest.version, versions.githubRest))
|
|
158
162
|
changes.push(`${KEPT}${GITHUB_REST} ${rest.version} (the skills need ${versions.githubRest} or newer: raise it)`);
|
|
163
|
+
// NOTE: with its own issue:start (a wrapper), issue:start:free would skip it: it is not
|
|
164
|
+
// added, and the flow's one gets a note.
|
|
165
|
+
const ownStart = scripts[START_SCRIPT] !== undefined && scripts[START_SCRIPT] !== FLOW_SCRIPTS[START_SCRIPT];
|
|
166
|
+
if (ownStart && scripts[FREE_SCRIPT] === FLOW_SCRIPTS[FREE_SCRIPT])
|
|
167
|
+
changes.push(`${KEPT}scripts: ${FREE_SCRIPT}, which skips the repo's own ${START_SCRIPT}: make it run that one with --free, or delete it`);
|
|
159
168
|
for (const [name, command] of Object.entries(FLOW_SCRIPTS)) {
|
|
160
|
-
if (scripts[name] !== undefined)
|
|
169
|
+
if (scripts[name] !== undefined || (name === FREE_SCRIPT && ownStart))
|
|
161
170
|
continue;
|
|
162
171
|
scripts[name] = command;
|
|
163
172
|
changes.push(`scripts: ${name}`);
|
package/dist/usage.d.ts
CHANGED
|
@@ -2,4 +2,13 @@
|
|
|
2
2
|
* @file The usage text of the CLI, printed with `--help` and after a usage error.
|
|
3
3
|
*/
|
|
4
4
|
/** Usage text. */
|
|
5
|
-
export declare const USAGE = "Usage:\n issue-flow issue branch <n>... [--namer claude|title] [--json] [-R owner/repo]\n issue-flow issue branch --missing [--limit <n>] [--namer claude|title] [--dry-run | --yes] [--json] [-R owner/repo]\n issue-flow issue start <n> [--branch] [--dry-run | --yes] [--resume <branch> | --new] [--no-launch]\n [--ask-permissions | --free] [--namer claude|title] [-R owner/repo]\n issue-flow issue start <n> --plan [--ask-permissions | --free] [--namer claude|title] [-R owner/repo]\n issue-flow issue start <n> --cloud | --here | --teleport | --adopt [...]\n issue-flow worktree setup [--only <step>]\n issue-flow worktree teardown [--path <dir>]\n issue-flow worktree ports [--next]\n issue-flow worktree cleanup [--path <dir>]\n issue-flow worktree prune [--only <dir>] [--yes] [-R owner/repo]\n issue-flow pr worktree <n> [--no-setup] [-R owner/repo] [-- [<command>...]]\n issue-flow adapter setup [--only <step>] | issue [<url>] | archive [-R owner/repo]\n issue-flow session\n issue-flow hook worktree-create | worktree-remove\n issue-flow apply [--yes] [--dry-run] [--json] [--recipe <name>,...]\n issue-flow doctor [--json]\n issue-flow labels sync [--update] [--dry-run] [--json] [-R owner/repo]\n\nThe slug comes from the issue's \"Slug de rama\" block, then from Claude, then from the title,\nand the branch from the repo's template (an older \"Rama sugerida\" block is used if it fits).\n--missing adds the slug block to every open issue without a block, after confirming.\n\nissue start makes the branch in a worktree (or, with --branch, in this checkout), the\nstart commit, the push, the draft PR and the assignment, after confirming, and opens\nClaude: in auto mode if the repo has claude-repo-guard, with your settings with\n--ask-permissions, and with no sandbox nor questions with --free. --plan prints the branch\nand the prompt as JSON and changes nothing.\n\n--cloud confirms here and opens a Claude cloud session that starts the issue there.\n--here, inside a cloud session, starts it in this checkout and opens nothing. --teleport\nbrings the cloud session noted in the PR to the worktree. --adopt starts it in the\nworktree another tool (Orca, Paseo) just made, without asking nor opening Claude.\n\nworktree runs the steps of \"worktrees\" in .agents/flow.json: setup prepares this worktree,\nteardown cleans it before it goes (steps, ports, Docker), ports prints or moves its block\nof ports, cleanup deletes the Docker of deleted worktrees, and prune deletes the worktrees\nwhose PR was merged or closed. session is the SessionStart hook of Claude Code.\n\npr worktree makes (or reuses) a worktree on a PR's own branch, to review and fix it; with\n--, it runs the command there (Claude if none). adapter is what Orca and Paseo run: setup\nwhen they make a worktree (its steps and, if it came from an issue, issue start --adopt),\nissue to start one by hand, and archive before they delete it. hook implements Claude\nCode's WorktreeCreate and WorktreeRemove for claude --worktree.\n\napply leaves the repo as this version needs it: .agents/flow.json (the first time, with\nthe recipes its files suggest), issue-flow at this version and github-rest and the scripts\nif missing in package.json, and the hooks; it changes no other version, and refuses a newer\nissue-flow or a range. doctor checks them. npx agent-kitchen apply runs apply at the version\nit picks, along with the skills, claude-cloud and claude-repo-guard. init and upgrade still\nrun apply, with a warning, until 0.4.0.\n\nlabels sync makes in GitHub the labels the flow wants (\"labels\" in .agents/flow.json: the\nissue types and P1 to P4 by default) that the repo lacks. Names ignore case and are never\nrenamed nor deleted; --update also fixes the color and description of those that differ.";
|
|
5
|
+
export declare const USAGE = "Usage:\n issue-flow issue branch <n>... [--namer claude|title] [--json] [-R owner/repo]\n issue-flow issue branch --missing [--limit <n>] [--namer claude|title] [--dry-run | --yes] [--json] [-R owner/repo]\n issue-flow issue start <n> [--branch] [--dry-run | --yes] [--resume <branch> | --new] [--no-launch]\n [--ask-permissions | --free] [--namer claude|title] [-R owner/repo]\n issue-flow issue start <n> --plan [--ask-permissions | --free] [--namer claude|title] [-R owner/repo]\n issue-flow issue start <n> --cloud | --here | --teleport | --adopt [...]\n issue-flow worktree setup [--only <step>]\n issue-flow worktree teardown [--path <dir>]\n issue-flow worktree ports [--next]\n issue-flow worktree cleanup [--path <dir>]\n issue-flow worktree prune [--only <dir>] [--yes] [-R owner/repo]\n issue-flow pr worktree <n> [--no-setup] [-R owner/repo] [-- [<command>...]]\n issue-flow adapter setup [--only <step>] | issue [<url>] | archive [-R owner/repo]\n issue-flow session\n issue-flow hook worktree-create | worktree-remove\n issue-flow apply [--yes] [--dry-run] [--json] [--recipe <name>,...]\n issue-flow doctor [--json]\n issue-flow labels sync [--update] [--dry-run] [--json] [-R owner/repo]\n\nThe slug comes from the issue's \"Slug de rama\" block, then from Claude, then from the title,\nand the branch from the repo's template (an older \"Rama sugerida\" block is used if it fits).\n--missing adds the slug block to every open issue without a block, after confirming.\n\nissue start makes the branch in a worktree (or, with --branch, in this checkout), the\nstart commit, the push, the draft PR and the assignment, after confirming, and opens\nClaude: in auto mode if the repo has claude-repo-guard, with your settings with\n--ask-permissions, and with no sandbox nor questions with --free. --plan prints the branch\nand the prompt as JSON and changes nothing. issue start --help explains each flag.\n\n--cloud confirms here and opens a Claude cloud session that starts the issue there.\n--here, inside a cloud session, starts it in this checkout and opens nothing. --teleport\nbrings the cloud session noted in the PR to the worktree. --adopt starts it in the\nworktree another tool (Orca, Paseo) just made, without asking nor opening Claude.\n\nworktree runs the steps of \"worktrees\" in .agents/flow.json: setup prepares this worktree,\nteardown cleans it before it goes (steps, ports, Docker), ports prints or moves its block\nof ports, cleanup deletes the Docker of deleted worktrees, and prune deletes the worktrees\nwhose PR was merged or closed. session is the SessionStart hook of Claude Code.\n\npr worktree makes (or reuses) a worktree on a PR's own branch, to review and fix it; with\n--, it runs the command there (Claude if none). adapter is what Orca and Paseo run: setup\nwhen they make a worktree (its steps and, if it came from an issue, issue start --adopt),\nissue to start one by hand, and archive before they delete it. hook implements Claude\nCode's WorktreeCreate and WorktreeRemove for claude --worktree.\n\napply leaves the repo as this version needs it: .agents/flow.json (the first time, with\nthe recipes its files suggest), issue-flow at this version and github-rest and the scripts\nif missing in package.json, and the hooks; it changes no other version, and refuses a newer\nissue-flow or a range. doctor checks them. npx agent-kitchen apply runs apply at the version\nit picks, along with the skills, claude-cloud and claude-repo-guard. init and upgrade still\nrun apply, with a warning, until 0.4.0.\n\nlabels sync makes in GitHub the labels the flow wants (\"labels\" in .agents/flow.json: the\nissue types and P1 to P4 by default) that the repo lacks. Names ignore case and are never\nrenamed nor deleted; --update also fixes the color and description of those that differ.";
|
|
6
|
+
/** Usage text of `issue start`, printed with `issue start --help`. */
|
|
7
|
+
export declare const START_USAGE = "Usage: issue-flow issue start <n> [flags]\n\nStarts issue <n>: the branch (in a worktree, or in this checkout with --branch), the empty\nstart commit, the push, the draft PR and the assignment, after confirming; then it opens\nClaude there.\n\nFlags:\n --dry-run show what it would do and change nothing\n -y, --yes do it without asking\n --branch in this checkout instead of a worktree\n --resume <branch> take that branch of the issue\n --new make another branch, even if the issue has one\n --no-launch leave everything ready and do not open Claude\n --namer claude|title who names the branch when the issue has no slug block\n -R owner/repo another repo than the checkout's\n --plan print the branch and the prompt as JSON, and change nothing\n --cloud open a Claude cloud session that starts the issue there\n --here inside a cloud session, start it in this checkout\n --teleport bring the cloud session noted in the PR to the worktree\n --adopt start it in the worktree Orca or Paseo just made\n -h, --help this help\n\nPermissions of the Claude it opens (one at most):\n (none) auto mode if the repo has claude-repo-guard, else your settings\n --ask-permissions your settings: Claude asks before what they do not allow\n --free no sandbox and no questions, as claude:free\n\nFrom the repo's scripts (issue:start, and issue:start:free, which adds --free):\n npm run issue:start:free 42 npm passes a number on as it is\n npm run issue:start -- 42 --free but keeps the flags for itself, unless after --\n pnpm issue:start 42 --free pnpm, bun and yarn pass everything on\n bun run issue:start 42 --free\n yarn issue:start 42 --free\nA -- does no harm with any of them: issue-flow drops it.\n\nissue:start:free does not go with --ask-permissions, --cloud, --here nor --adopt: use\nissue:start for those.";
|
|
8
|
+
/**
|
|
9
|
+
* The usage text for a command: its own if it has one, else the whole CLI's.
|
|
10
|
+
* @param words - The command's words, as given (`["issue", "start", "42"]`).
|
|
11
|
+
* @returns The text.
|
|
12
|
+
* @example usageOf(["issue", "start"]) === START_USAGE
|
|
13
|
+
*/
|
|
14
|
+
export declare function usageOf(words: string[]): string;
|
package/dist/usage.js
CHANGED
|
@@ -30,7 +30,7 @@ issue start makes the branch in a worktree (or, with --branch, in this checkout)
|
|
|
30
30
|
start commit, the push, the draft PR and the assignment, after confirming, and opens
|
|
31
31
|
Claude: in auto mode if the repo has claude-repo-guard, with your settings with
|
|
32
32
|
--ask-permissions, and with no sandbox nor questions with --free. --plan prints the branch
|
|
33
|
-
and the prompt as JSON and changes nothing.
|
|
33
|
+
and the prompt as JSON and changes nothing. issue start --help explains each flag.
|
|
34
34
|
|
|
35
35
|
--cloud confirms here and opens a Claude cloud session that starts the issue there.
|
|
36
36
|
--here, inside a cloud session, starts it in this checkout and opens nothing. --teleport
|
|
@@ -58,3 +58,52 @@ run apply, with a warning, until 0.4.0.
|
|
|
58
58
|
labels sync makes in GitHub the labels the flow wants ("labels" in .agents/flow.json: the
|
|
59
59
|
issue types and P1 to P4 by default) that the repo lacks. Names ignore case and are never
|
|
60
60
|
renamed nor deleted; --update also fixes the color and description of those that differ.`;
|
|
61
|
+
/** Usage text of `issue start`, printed with `issue start --help`. */
|
|
62
|
+
export const START_USAGE = `Usage: issue-flow issue start <n> [flags]
|
|
63
|
+
|
|
64
|
+
Starts issue <n>: the branch (in a worktree, or in this checkout with --branch), the empty
|
|
65
|
+
start commit, the push, the draft PR and the assignment, after confirming; then it opens
|
|
66
|
+
Claude there.
|
|
67
|
+
|
|
68
|
+
Flags:
|
|
69
|
+
--dry-run show what it would do and change nothing
|
|
70
|
+
-y, --yes do it without asking
|
|
71
|
+
--branch in this checkout instead of a worktree
|
|
72
|
+
--resume <branch> take that branch of the issue
|
|
73
|
+
--new make another branch, even if the issue has one
|
|
74
|
+
--no-launch leave everything ready and do not open Claude
|
|
75
|
+
--namer claude|title who names the branch when the issue has no slug block
|
|
76
|
+
-R owner/repo another repo than the checkout's
|
|
77
|
+
--plan print the branch and the prompt as JSON, and change nothing
|
|
78
|
+
--cloud open a Claude cloud session that starts the issue there
|
|
79
|
+
--here inside a cloud session, start it in this checkout
|
|
80
|
+
--teleport bring the cloud session noted in the PR to the worktree
|
|
81
|
+
--adopt start it in the worktree Orca or Paseo just made
|
|
82
|
+
-h, --help this help
|
|
83
|
+
|
|
84
|
+
Permissions of the Claude it opens (one at most):
|
|
85
|
+
(none) auto mode if the repo has claude-repo-guard, else your settings
|
|
86
|
+
--ask-permissions your settings: Claude asks before what they do not allow
|
|
87
|
+
--free no sandbox and no questions, as claude:free
|
|
88
|
+
|
|
89
|
+
From the repo's scripts (issue:start, and issue:start:free, which adds --free):
|
|
90
|
+
npm run issue:start:free 42 npm passes a number on as it is
|
|
91
|
+
npm run issue:start -- 42 --free but keeps the flags for itself, unless after --
|
|
92
|
+
pnpm issue:start 42 --free pnpm, bun and yarn pass everything on
|
|
93
|
+
bun run issue:start 42 --free
|
|
94
|
+
yarn issue:start 42 --free
|
|
95
|
+
A -- does no harm with any of them: issue-flow drops it.
|
|
96
|
+
|
|
97
|
+
issue:start:free does not go with --ask-permissions, --cloud, --here nor --adopt: use
|
|
98
|
+
issue:start for those.`;
|
|
99
|
+
/** The usage text of each command that has its own, by its words. */
|
|
100
|
+
const OWN_USAGE = { "issue start": START_USAGE };
|
|
101
|
+
/**
|
|
102
|
+
* The usage text for a command: its own if it has one, else the whole CLI's.
|
|
103
|
+
* @param words - The command's words, as given (`["issue", "start", "42"]`).
|
|
104
|
+
* @returns The text.
|
|
105
|
+
* @example usageOf(["issue", "start"]) === START_USAGE
|
|
106
|
+
*/
|
|
107
|
+
export function usageOf(words) {
|
|
108
|
+
return OWN_USAGE[words.slice(0, 2).join(" ")] ?? USAGE;
|
|
109
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ramon-sg/issue-flow",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Issue-to-PR workflow for any repo: names each issue's branch, creates its worktree, opens the draft PR and launches Claude Code, locally and in Claude's cloud.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|