@ggdna/dna-gg 1.3.0 → 1.4.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/README.md +7 -5
- package/dna/_generated.json +6 -6
- package/dna/doc/guides/develop-guide.md +5 -3
- package/dna/doc/guides/for-ai/ai-dev-guide.md +37 -22
- package/dna/dot-claude/hooks/pm-prompts.mjs +30 -24
- package/dna/dot-claude/skills/gg-review/SKILL.md +6 -10
- package/dna/dot-claude/skills/gg-ticket/SKILL.md +28 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ All skills of this layer are prefixed with `gg-`:
|
|
|
39
39
|
- `/gg-commit` — proposes a message and commits through `gg do commit`
|
|
40
40
|
- `/gg-push` — pushes the ticket branches
|
|
41
41
|
- `/gg-review` — checks the scope of every repo, writes the blog posts
|
|
42
|
-
and opens the pull requests
|
|
42
|
+
and opens the pull requests, printing their URLs
|
|
43
43
|
- `/gg-publish` — releases the ticket
|
|
44
44
|
- `/gg-cleanup` — removes what the ticket left behind
|
|
45
45
|
|
|
@@ -52,10 +52,12 @@ All skills of this layer are prefixed with `gg-`:
|
|
|
52
52
|
prompts wait in `~/.claude/pm-prompts/sessions/` and are committed to the
|
|
53
53
|
branch `prompts` of that repo when a session starts or ends, under
|
|
54
54
|
`doc/prompts/<first name>/<yyyy-mm>/<yyyy-mm-dd>_<repo>_<session>.md`.
|
|
55
|
-
The first name comes from
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
The first name comes from `doc/team/people.md` there, found by the git
|
|
56
|
+
user name: a first name equal to it or to its first word, or a `Git`
|
|
57
|
+
line listing it. An unknown name goes to `doc/prompts/_unknown/`. No
|
|
58
|
+
e-mail address is read or written; the commits carry the neutral author
|
|
59
|
+
`pm-prompts`. Only the prompts are kept, never the answers; tokens and
|
|
60
|
+
passwords are replaced by `[redacted]`. No working tree is touched: the commit is built in a bare
|
|
59
61
|
cache below `~/.claude/pm-prompts/repos/`. Needs `node` and `git`; a
|
|
60
62
|
failure never stops a prompt and ends up in
|
|
61
63
|
`~/.claude/pm-prompts/sync.log`.
|
package/dna/_generated.json
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"ecosystem": null,
|
|
40
40
|
"resolvedVersion": null,
|
|
41
41
|
"via": null,
|
|
42
|
-
"hash": "
|
|
42
|
+
"hash": "0x958d0143021b2328"
|
|
43
43
|
}
|
|
44
44
|
],
|
|
45
45
|
"claude": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
"path": ".claude/hooks/pm-prompts.mjs",
|
|
62
|
-
"hash": "
|
|
62
|
+
"hash": "0xf4266eea17b3b9c1"
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
"path": ".claude/settings.json",
|
|
@@ -83,11 +83,11 @@
|
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
"path": ".claude/skills/gg-review/SKILL.md",
|
|
86
|
-
"hash": "
|
|
86
|
+
"hash": "0x3a4506ccd5c8e1be"
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
"path": ".claude/skills/gg-ticket/SKILL.md",
|
|
90
|
-
"hash": "
|
|
90
|
+
"hash": "0xb1095b91b3531897"
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
"path": ".claude/skills/gg/SKILL.md",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
109
|
"path": "doc/guides/develop-guide.md",
|
|
110
|
-
"hash": "
|
|
110
|
+
"hash": "0xed4328d138fe76ef"
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
"path": "doc/guides/develop-without-ai-guide.md",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
"path": "doc/guides/for-ai/ai-dev-guide.md",
|
|
118
|
-
"hash": "
|
|
118
|
+
"hash": "0xe8182903f11a1766"
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
121
|
"path": "doc/guides/index-guide.md",
|
|
@@ -47,6 +47,8 @@ Use the following skills in Claude
|
|
|
47
47
|
When the repo belongs to a project management repo, every prompt you write
|
|
48
48
|
to Claude Code is kept there, under `doc/prompts/<your first name>/` on the
|
|
49
49
|
branch `prompts`. Only the prompts, not the answers. Tokens and passwords
|
|
50
|
-
are replaced by `[redacted]`. Your first name comes from
|
|
51
|
-
`doc/team/people.md` in the project management repo
|
|
52
|
-
|
|
50
|
+
are replaced by `[redacted]`. Your first name comes from
|
|
51
|
+
`doc/team/people.md` in the project management repo: the person whose
|
|
52
|
+
first name is your git user name or its first word, or whose `Git` line
|
|
53
|
+
lists your git user name. Otherwise your prompts land in
|
|
54
|
+
`doc/prompts/_unknown/`. Your e-mail address never goes there.
|
|
@@ -8,31 +8,43 @@ found in the LICENSE file in the root of this package.
|
|
|
8
8
|
|
|
9
9
|
# Development guide for AIs
|
|
10
10
|
|
|
11
|
-
## Ask the developer
|
|
11
|
+
## Ask the developer what the ticket should do
|
|
12
12
|
|
|
13
|
-
Ask
|
|
14
|
-
|
|
15
|
-
question and never as a plain prose question:
|
|
13
|
+
Ask a single question: what should the ticket do? One free-text answer is
|
|
14
|
+
enough — never ask for a ticket id, a title or a description separately.
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
- Ask for the ticket title
|
|
19
|
-
- Ask for the ticket description
|
|
20
|
-
|
|
21
|
-
## Replace in this document
|
|
16
|
+
## Create a ticket
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
- Ask for the workspace directory if none is known
|
|
25
|
-
- Replace `DnaJiraPrefix-145` by the ticket ID you asked for
|
|
26
|
-
- Replace `Fix issue abc` by the ticket title you asked for
|
|
18
|
+
Derive from the answer, without asking anything else:
|
|
27
19
|
|
|
28
|
-
|
|
20
|
+
- **id** — a short, descriptive slug in `snake_case`, 2-5 plain ASCII words
|
|
21
|
+
(transliterate non-ASCII, drop punctuation and emoji), e.g.
|
|
22
|
+
`fix_login_crash`. Never a sequential number: several tickets are usually
|
|
23
|
+
worked on in parallel, and a counter collides between them. List the
|
|
24
|
+
existing ticket folders of the workspace root and, if the slug is taken,
|
|
25
|
+
append `_2`, `_3`, … until it is free. If `gg do create ticket` still
|
|
26
|
+
rejects it as taken (e.g. another agent just created the same slug),
|
|
27
|
+
bump the suffix and retry.
|
|
28
|
+
- **message** — one imperative line to one short sentence describing the
|
|
29
|
+
change, for `-m`.
|
|
29
30
|
|
|
30
31
|
```bash
|
|
31
32
|
cd ~/dev/ # workspace
|
|
32
|
-
gg do create ticket
|
|
33
|
-
cd
|
|
33
|
+
gg do create ticket fix_login_crash -m"Fix issue abc"
|
|
34
|
+
cd fix_login_crash
|
|
34
35
|
```
|
|
35
36
|
|
|
37
|
+
Tell the developer the id and the message right after creating the ticket —
|
|
38
|
+
both can be changed any time, e.g. by renaming the folder before anything
|
|
39
|
+
else is added to it, or by editing `ticket.json`.
|
|
40
|
+
|
|
41
|
+
## Replace in this document
|
|
42
|
+
|
|
43
|
+
- Replace `~/dev/` by the workspace directory from the memory
|
|
44
|
+
- Ask for the workspace directory if none is known
|
|
45
|
+
- Replace `fix_login_crash` by the ticket id you derived
|
|
46
|
+
- Replace `Fix issue abc` by the ticket message you derived
|
|
47
|
+
|
|
36
48
|
## Choose the project management repo — or work without one
|
|
37
49
|
|
|
38
50
|
A ticket may belong to a project management repo. It holds the plans,
|
|
@@ -62,8 +74,9 @@ repositories. The ticket then carries no plan of its own.
|
|
|
62
74
|
|
|
63
75
|
## Add git repositories
|
|
64
76
|
|
|
65
|
-
Ask the user how the repos are chosen, as a single question with
|
|
66
|
-
options
|
|
77
|
+
Ask the user how the repos are chosen, as a single question with the
|
|
78
|
+
options below. Offer **only the project management repo** only when one was
|
|
79
|
+
added above — without one there is nothing to be "only" about.
|
|
67
80
|
|
|
68
81
|
Manually: ask in a second single input field which repos the ticket needs,
|
|
69
82
|
e.g. `repo1 repo2`. Check each name against the repos in .ocean and ask
|
|
@@ -80,8 +93,10 @@ Also explain to the user what you roughly want to change in which repo to
|
|
|
80
93
|
implement the ticket and let them confirm that the corresponding repos are
|
|
81
94
|
added to the ticket.
|
|
82
95
|
|
|
83
|
-
|
|
84
|
-
|
|
96
|
+
Only the project management repo: no code repo at all; the ticket stays
|
|
97
|
+
pure planning, and the project management repo added above is everything
|
|
98
|
+
it carries. If the ticket is only planned (see below), this is the way to
|
|
99
|
+
go — the project management repo may be the only repo of the ticket.
|
|
85
100
|
|
|
86
101
|
After the user's confirmation, add the repos to the ticket:
|
|
87
102
|
|
|
@@ -321,8 +336,8 @@ gg do review
|
|
|
321
336
|
```
|
|
322
337
|
|
|
323
338
|
gg creates pull requests for each repo and prints the URLs to the
|
|
324
|
-
terminal. Print every URL to the user, one line per repo
|
|
325
|
-
pull
|
|
339
|
+
terminal. Print every URL to the user, one line per repo. Do not open the
|
|
340
|
+
pull requests in the browser — leave that to the user.
|
|
326
341
|
|
|
327
342
|
Afterwards load the review-light skill and execute it.
|
|
328
343
|
|
|
@@ -238,7 +238,7 @@ export function onPrompt(input) {
|
|
|
238
238
|
started: new Date().toISOString(),
|
|
239
239
|
folder: path.basename(projectDir),
|
|
240
240
|
repos,
|
|
241
|
-
|
|
241
|
+
name: git(['-C', projectDir, 'config', 'user.name']).out,
|
|
242
242
|
targets,
|
|
243
243
|
});
|
|
244
244
|
}
|
|
@@ -299,28 +299,35 @@ export function slug(name) {
|
|
|
299
299
|
.replace(/^-+|-+$/g, '');
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
/**
|
|
303
|
-
|
|
304
|
-
|
|
302
|
+
/**
|
|
303
|
+
* The first name in [peopleMd] for the git user name [gitName]: the person
|
|
304
|
+
* whose `Git` line lists it, else the person whose first name is the git
|
|
305
|
+
* name or its first word. E-mail addresses play no part.
|
|
306
|
+
*/
|
|
307
|
+
export function personOf(gitName, peopleMd) {
|
|
308
|
+
const wanted = (gitName ?? '').trim().toLowerCase();
|
|
309
|
+
if (!wanted) return '';
|
|
310
|
+
const byFirstName = new Map();
|
|
305
311
|
let name = '';
|
|
306
312
|
for (const line of peopleMd.split(/\r?\n/)) {
|
|
307
313
|
const heading = line.match(/^##\s+(.+?)\s*$/);
|
|
308
314
|
if (heading) {
|
|
309
315
|
name = heading[1];
|
|
316
|
+
byFirstName.set(name.toLowerCase(), name);
|
|
310
317
|
continue;
|
|
311
318
|
}
|
|
312
|
-
const
|
|
319
|
+
const names = line.match(/^\s*-\s*Git:\s*(.+)$/i);
|
|
313
320
|
if (
|
|
314
321
|
name &&
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
.split(/[,;\s]+/)
|
|
318
|
-
.some((e) => e.toLowerCase() === email.toLowerCase())
|
|
322
|
+
names &&
|
|
323
|
+
names[1].split(/[,;]/).some((n) => n.trim().toLowerCase() === wanted)
|
|
319
324
|
) {
|
|
320
325
|
return name;
|
|
321
326
|
}
|
|
322
327
|
}
|
|
323
|
-
return
|
|
328
|
+
return (
|
|
329
|
+
byFirstName.get(wanted) ?? byFirstName.get(wanted.split(/\s+/)[0]) ?? ''
|
|
330
|
+
);
|
|
324
331
|
}
|
|
325
332
|
|
|
326
333
|
/** Where the prompts of a session go in the project management repo. */
|
|
@@ -336,7 +343,7 @@ export function renderHead(meta, person) {
|
|
|
336
343
|
const lines = [
|
|
337
344
|
`# ${localDate(meta.started)} · ${meta.folder} · ${String(meta.session).slice(0, 8)}`,
|
|
338
345
|
'',
|
|
339
|
-
`- Person: ${person || meta.
|
|
346
|
+
`- Person: ${person || meta.name || 'unknown'}`,
|
|
340
347
|
];
|
|
341
348
|
const repos = meta.repos ?? [];
|
|
342
349
|
if (repos.length === 1 && repos[0] === meta.folder) {
|
|
@@ -399,16 +406,15 @@ function fetchBranch(dir) {
|
|
|
399
406
|
return git(['-C', dir, 'rev-parse', ref]).out;
|
|
400
407
|
}
|
|
401
408
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
409
|
+
// The prompts are committed under a neutral identity, so the e-mail address
|
|
410
|
+
// of the developer never reaches the project management repo.
|
|
411
|
+
const identityEnv = {
|
|
412
|
+
...gitEnv,
|
|
413
|
+
GIT_AUTHOR_NAME: 'pm-prompts',
|
|
414
|
+
GIT_COMMITTER_NAME: 'pm-prompts',
|
|
415
|
+
GIT_AUTHOR_EMAIL: 'pm-prompts@localhost',
|
|
416
|
+
GIT_COMMITTER_EMAIL: 'pm-prompts@localhost',
|
|
417
|
+
};
|
|
412
418
|
|
|
413
419
|
// Commits the not yet pushed prompts of [sessions] to the prompts branch of
|
|
414
420
|
// [url]. Returns how many prompts of each session the branch now holds.
|
|
@@ -421,7 +427,7 @@ function pushTarget(url, sessions) {
|
|
|
421
427
|
os.tmpdir(),
|
|
422
428
|
`pm-prompts-${process.pid}-${Date.now()}.index`,
|
|
423
429
|
);
|
|
424
|
-
const env = { ...identityEnv
|
|
430
|
+
const env = { ...identityEnv, GIT_INDEX_FILE: index };
|
|
425
431
|
try {
|
|
426
432
|
const read = base
|
|
427
433
|
? git(['-C', dir, 'read-tree', base], { env })
|
|
@@ -433,8 +439,8 @@ function pushTarget(url, sessions) {
|
|
|
433
439
|
const fresh = session.prompts.slice(pushed);
|
|
434
440
|
done.set(file, session.prompts.length);
|
|
435
441
|
if (!fresh.length) continue;
|
|
436
|
-
const person = personOf(session.meta.
|
|
437
|
-
names.add(person || session.meta.
|
|
442
|
+
const person = personOf(session.meta.name, people);
|
|
443
|
+
names.add(person || session.meta.name || 'unknown');
|
|
438
444
|
const target = promptsPath(session.meta, person);
|
|
439
445
|
const existing = base
|
|
440
446
|
? git(['-C', dir, 'cat-file', '-p', `${base}:${target}`])
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: gg-review
|
|
3
|
-
description: Writes the blog posts of the ticket, opens the pull requests with `gg do review` and reviews the changes. Use when the user says "/gg-review" or asks to review the current ticket.
|
|
3
|
+
description: Writes the blog posts of the ticket, opens the pull requests with `gg do review` and prints their URLs, and reviews the changes. Use when the user says "/gg-review" or asks to review the current ticket.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Review
|
|
@@ -57,21 +57,16 @@ output, so pass the URLs on:
|
|
|
57
57
|
- Print every URL to the user, one line per repo: `<repo>: <url>`. Name
|
|
58
58
|
each repo that gg reports as `No pull request for <repo>`, with the
|
|
59
59
|
reason
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
- GitHub: `gh pr view <url> --json autoMergeRequest` — `null` means off
|
|
63
|
-
- Azure DevOps: `az repos pr show --id <id> --query autoCompleteSetBy`
|
|
64
|
-
— empty means off
|
|
65
|
-
- Open the URL with `start "" "<url>"` on Windows, `open "<url>"` on
|
|
66
|
-
macOS and `xdg-open "<url>"` on Linux
|
|
60
|
+
- Do not open the pull requests in the browser — print the URLs and leave
|
|
61
|
+
opening them to the user.
|
|
67
62
|
|
|
68
63
|
## 4. Review the changes
|
|
69
64
|
|
|
70
65
|
Load the `/review-light` skill and execute it.
|
|
71
66
|
|
|
72
67
|
A fix goes through `/gg-commit` and `/gg-push`, then run `gg do review`
|
|
73
|
-
again. Print
|
|
74
|
-
|
|
68
|
+
again. Print its pull request URLs as in step 3. Update the blog post of
|
|
69
|
+
the repo when the fix changes what it describes.
|
|
75
70
|
|
|
76
71
|
## Important
|
|
77
72
|
|
|
@@ -80,3 +75,4 @@ post of the repo when the fix changes what it describes.
|
|
|
80
75
|
the project management repo.
|
|
81
76
|
- Never start `gg do review` without the user's confirmation.
|
|
82
77
|
- Always print the pull request URLs after `gg do review`.
|
|
78
|
+
- Never open a pull request in the browser on your own.
|
|
@@ -8,24 +8,36 @@ description: Creates a gg ticket and adds the repos it needs. Use when the user
|
|
|
8
8
|
All `gg do` commands run inside the workspace. Ask for the workspace
|
|
9
9
|
directory if none is known.
|
|
10
10
|
|
|
11
|
-
## 1. Ask
|
|
11
|
+
## 1. Ask what the ticket should do
|
|
12
12
|
|
|
13
|
-
Ask
|
|
14
|
-
|
|
15
|
-
and never as a plain prose question:
|
|
16
|
-
|
|
17
|
-
- Ticket ID, e.g. `DnaJiraPrefix-145`
|
|
18
|
-
- Title, one imperative line, e.g. `Fix issue abc`
|
|
19
|
-
- Description, one or two sentences on what the ticket changes
|
|
13
|
+
Ask a single question: what should the ticket do? One free-text answer is
|
|
14
|
+
enough — never ask for a ticket id, a title or a description separately.
|
|
20
15
|
|
|
21
16
|
## 2. Create the ticket
|
|
22
17
|
|
|
18
|
+
Derive from the answer, without asking anything else:
|
|
19
|
+
|
|
20
|
+
- **id** — a short, descriptive slug in `snake_case`, 2-5 plain ASCII words
|
|
21
|
+
(transliterate non-ASCII, drop punctuation and emoji), e.g.
|
|
22
|
+
`fix_login_crash`. Never a sequential number: several tickets are usually
|
|
23
|
+
worked on in parallel, and a counter collides between them. List the
|
|
24
|
+
existing ticket folders of the workspace root and, if the slug is taken,
|
|
25
|
+
append `_2`, `_3`, … until it is free. If `gg do create ticket` still
|
|
26
|
+
rejects it as taken (e.g. another agent just created the same slug),
|
|
27
|
+
bump the suffix and retry.
|
|
28
|
+
- **message** — one imperative line to one short sentence describing the
|
|
29
|
+
change, for `-m`.
|
|
30
|
+
|
|
23
31
|
```bash
|
|
24
32
|
cd ~/dev/ # workspace
|
|
25
|
-
gg do create ticket
|
|
26
|
-
cd
|
|
33
|
+
gg do create ticket fix_login_crash -m"Fix issue abc"
|
|
34
|
+
cd fix_login_crash
|
|
27
35
|
```
|
|
28
36
|
|
|
37
|
+
Tell the user the id and the message right after creating the ticket — both
|
|
38
|
+
can be changed any time, e.g. by renaming the folder before anything else is
|
|
39
|
+
added to it, or by editing `ticket.json`.
|
|
40
|
+
|
|
29
41
|
## 3. Choose the project management repo — or work without one
|
|
30
42
|
|
|
31
43
|
A ticket may belong to a project management repo: plans, decisions and blog
|
|
@@ -52,8 +64,9 @@ Call it the "project management repo" whenever you write to the user, never
|
|
|
52
64
|
|
|
53
65
|
## 4. Choose the code repos
|
|
54
66
|
|
|
55
|
-
Ask the user how the code repos are chosen, as a single question with
|
|
56
|
-
options
|
|
67
|
+
Ask the user how the code repos are chosen, as a single question with the
|
|
68
|
+
options below. Offer **only the project management repo** only when one was
|
|
69
|
+
added in step 3 — without one there is nothing to be "only" about.
|
|
57
70
|
|
|
58
71
|
- **automatically** — Claude finds the repos. Read the `index.jsonc` of
|
|
59
72
|
the candidate repos in `.ocean`. Tell the user which repos the ticket
|
|
@@ -65,6 +78,9 @@ options:
|
|
|
65
78
|
field which repos the ticket needs, e.g. `repo1 repo2`. Check each name
|
|
66
79
|
against the repos in `.ocean` and ask again for names that do not exist
|
|
67
80
|
there. The entered list is the confirmation.
|
|
81
|
+
- **only the project management repo** — no code repo at all; the ticket
|
|
82
|
+
stays pure planning, and the project management repo added in step 3 is
|
|
83
|
+
everything it carries.
|
|
68
84
|
|
|
69
85
|
A ticket that is only planned may need no code repo at all.
|
|
70
86
|
|