@starterculture/devkeep-actions 0.4.0 → 0.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/dist/consolidate-release.js +20 -20
- package/dist/draft-log-entry.js +13 -13
- package/dist/sync-onboarding.js +12 -12
- package/package.json +1 -1
|
@@ -190,22 +190,22 @@ function isNotFound(error) {
|
|
|
190
190
|
return typeof error === "object" && error !== null && "status" in error && error.status === 404;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
// ../../modules/devlore/dist/
|
|
194
|
-
function
|
|
195
|
-
return `projects/${projectName}/
|
|
193
|
+
// ../../modules/devlore/dist/canonicalDocs.js
|
|
194
|
+
function canonicalDocsPath(projectName) {
|
|
195
|
+
return `projects/${projectName}/canonical/README.md`;
|
|
196
196
|
}
|
|
197
|
-
async function
|
|
198
|
-
return (await
|
|
197
|
+
async function getCanonicalDocs(octokit, params) {
|
|
198
|
+
return (await getCanonicalDocsFile(octokit, params)).content;
|
|
199
199
|
}
|
|
200
|
-
async function
|
|
201
|
-
return (await
|
|
200
|
+
async function getCanonicalDocsSha(octokit, params) {
|
|
201
|
+
return (await getCanonicalDocsFile(octokit, params)).sha;
|
|
202
202
|
}
|
|
203
|
-
async function
|
|
203
|
+
async function getCanonicalDocsFile(octokit, { owner, repo, projectName }) {
|
|
204
204
|
try {
|
|
205
205
|
const { data } = await octokit.rest.repos.getContent({
|
|
206
206
|
owner,
|
|
207
207
|
repo,
|
|
208
|
-
path:
|
|
208
|
+
path: canonicalDocsPath(projectName)
|
|
209
209
|
});
|
|
210
210
|
if (Array.isArray(data) || data.type !== "file") {
|
|
211
211
|
return { content: "" };
|
|
@@ -232,13 +232,13 @@ ${entry.content}`).join("\n\n");
|
|
|
232
232
|
`Previous release: ${input.previousTag ?? "(none \u2014 this is the first release)"}`,
|
|
233
233
|
`Date: ${input.date}`,
|
|
234
234
|
"",
|
|
235
|
-
"Current
|
|
236
|
-
input.
|
|
235
|
+
"Current canonical docs (may be empty if none exist yet):",
|
|
236
|
+
input.canonicalDocs || "(none yet)",
|
|
237
237
|
"",
|
|
238
238
|
"Log entries since the previous release:",
|
|
239
239
|
entriesText || "(none)",
|
|
240
240
|
"",
|
|
241
|
-
`Draft the updated
|
|
241
|
+
`Draft the updated canonical docs for ${input.projectName} as of ${input.tag}, folding in what changed across the log entries above into the current canonical docs. This is the official record, reviewed by a human before merging, so write it as durable reference documentation, not a changelog.`
|
|
242
242
|
].join("\n");
|
|
243
243
|
}
|
|
244
244
|
|
|
@@ -351,7 +351,7 @@ function releaseBranchName(projectName, tag) {
|
|
|
351
351
|
return `devkeep/${projectName}/${tag}`;
|
|
352
352
|
}
|
|
353
353
|
async function consolidateRelease({ projectOctokit, vaultOctokit, claude, projectOwner, projectRepoName, vaultOwner, vaultRepoName, projectName, tag }) {
|
|
354
|
-
const [{ logEntries, previousTag },
|
|
354
|
+
const [{ logEntries, previousTag }, canonicalDocs, canonicalDocsSha] = await Promise.all([
|
|
355
355
|
selectLogEntriesSincePreviousRelease({
|
|
356
356
|
vaultOctokit,
|
|
357
357
|
projectOctokit,
|
|
@@ -362,8 +362,8 @@ async function consolidateRelease({ projectOctokit, vaultOctokit, claude, projec
|
|
|
362
362
|
projectRepoName,
|
|
363
363
|
tag
|
|
364
364
|
}),
|
|
365
|
-
|
|
366
|
-
|
|
365
|
+
getCanonicalDocs(vaultOctokit, { owner: vaultOwner, repo: vaultRepoName, projectName }),
|
|
366
|
+
getCanonicalDocsSha(vaultOctokit, { owner: vaultOwner, repo: vaultRepoName, projectName })
|
|
367
367
|
]);
|
|
368
368
|
const prompt = buildConsolidationPrompt({
|
|
369
369
|
projectName,
|
|
@@ -371,7 +371,7 @@ async function consolidateRelease({ projectOctokit, vaultOctokit, claude, projec
|
|
|
371
371
|
previousTag,
|
|
372
372
|
date: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
373
373
|
logEntries,
|
|
374
|
-
|
|
374
|
+
canonicalDocs
|
|
375
375
|
});
|
|
376
376
|
const { text: draftedDocs, usage } = await createCompleteMessage(claude, {
|
|
377
377
|
model: defaultModelFor(MODEL_TIER),
|
|
@@ -399,13 +399,13 @@ async function consolidateRelease({ projectOctokit, vaultOctokit, claude, projec
|
|
|
399
399
|
await vaultOctokit.rest.repos.createOrUpdateFileContents({
|
|
400
400
|
owner: vaultOwner,
|
|
401
401
|
repo: vaultRepoName,
|
|
402
|
-
path:
|
|
402
|
+
path: canonicalDocsPath(projectName),
|
|
403
403
|
message: `Consolidate release: ${projectName}@${tag}`,
|
|
404
404
|
content: Buffer.from(draftedDocs, "utf-8").toString("base64"),
|
|
405
405
|
branch,
|
|
406
|
-
sha:
|
|
406
|
+
sha: canonicalDocsSha
|
|
407
407
|
});
|
|
408
|
-
await recordUsage(vaultOctokit, { owner: vaultOwner, repo: vaultRepoName, projectName, branch }, "consolidateRelease", usage);
|
|
408
|
+
await recordUsage(vaultOctokit, { owner: vaultOwner, repo: vaultRepoName, projectName, branch: VAULT_BASE_BRANCH }, "consolidateRelease", usage);
|
|
409
409
|
const openPrs = await vaultOctokit.rest.pulls.list({ owner: vaultOwner, repo: vaultRepoName, state: "open", head: `${vaultOwner}:${branch}` }).catch(() => ({ data: [] }));
|
|
410
410
|
if (openPrs.data.length > 0) {
|
|
411
411
|
return { branch, prNumber: openPrs.data[0].number, prUrl: openPrs.data[0].html_url, usage };
|
|
@@ -416,7 +416,7 @@ async function consolidateRelease({ projectOctokit, vaultOctokit, claude, projec
|
|
|
416
416
|
title: `Consolidate release: ${projectName}@${tag}`,
|
|
417
417
|
head: branch,
|
|
418
418
|
base: VAULT_BASE_BRANCH,
|
|
419
|
-
body: `Drafted
|
|
419
|
+
body: `Drafted canonical doc update for \`${projectName}\` at \`${tag}\`, generated from the log entries since the last release. Review before merging \u2014 this updates the official docs.`
|
|
420
420
|
});
|
|
421
421
|
return { branch, prNumber: pr.data.number, prUrl: pr.data.html_url, usage };
|
|
422
422
|
}
|
package/dist/draft-log-entry.js
CHANGED
|
@@ -237,19 +237,19 @@ async function getProjectDiff(octokit, { owner, repo, base, head }) {
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
// ../../modules/devlore/dist/
|
|
241
|
-
function
|
|
242
|
-
return `projects/${projectName}/
|
|
240
|
+
// ../../modules/devlore/dist/canonicalDocs.js
|
|
241
|
+
function canonicalDocsPath(projectName) {
|
|
242
|
+
return `projects/${projectName}/canonical/README.md`;
|
|
243
243
|
}
|
|
244
|
-
async function
|
|
245
|
-
return (await
|
|
244
|
+
async function getCanonicalDocs(octokit, params) {
|
|
245
|
+
return (await getCanonicalDocsFile(octokit, params)).content;
|
|
246
246
|
}
|
|
247
|
-
async function
|
|
247
|
+
async function getCanonicalDocsFile(octokit, { owner, repo, projectName }) {
|
|
248
248
|
try {
|
|
249
249
|
const { data } = await octokit.rest.repos.getContent({
|
|
250
250
|
owner,
|
|
251
251
|
repo,
|
|
252
|
-
path:
|
|
252
|
+
path: canonicalDocsPath(projectName)
|
|
253
253
|
});
|
|
254
254
|
if (Array.isArray(data) || data.type !== "file") {
|
|
255
255
|
return { content: "" };
|
|
@@ -367,8 +367,8 @@ ${file.patch}`).join("\n\n");
|
|
|
367
367
|
"Commit messages:",
|
|
368
368
|
input.commitMessages.map((message) => `- ${message}`).join("\n"),
|
|
369
369
|
"",
|
|
370
|
-
"Current
|
|
371
|
-
input.
|
|
370
|
+
"Current canonical docs (may be empty if none exist yet):",
|
|
371
|
+
input.canonicalDocs || "(none yet)",
|
|
372
372
|
"",
|
|
373
373
|
"Diff:",
|
|
374
374
|
diff,
|
|
@@ -572,13 +572,13 @@ async function syncProductDoc(projectOctokit, vaultOctokit, { projectOwner, proj
|
|
|
572
572
|
});
|
|
573
573
|
});
|
|
574
574
|
}
|
|
575
|
-
async function draftBucketLogEntry({ vaultOctokit, claude, vaultOwner, vaultRepoName, projectName, headSha, date, commitMessages, files,
|
|
575
|
+
async function draftBucketLogEntry({ vaultOctokit, claude, vaultOwner, vaultRepoName, projectName, headSha, date, commitMessages, files, canonicalDocs, moduleId, moduleName }) {
|
|
576
576
|
const prompt = buildLogEntryPrompt({
|
|
577
577
|
projectName,
|
|
578
578
|
date,
|
|
579
579
|
commitMessages,
|
|
580
580
|
files,
|
|
581
|
-
|
|
581
|
+
canonicalDocs,
|
|
582
582
|
moduleName: moduleName ?? void 0
|
|
583
583
|
});
|
|
584
584
|
const { text, usage } = await createCompleteMessage(claude, {
|
|
@@ -633,7 +633,7 @@ async function draftLogEntry({ projectOctokit, vaultOctokit, claude, projectOwne
|
|
|
633
633
|
ref: headSha
|
|
634
634
|
});
|
|
635
635
|
const buckets = routeDiffByModule(diff.files, manifest);
|
|
636
|
-
const
|
|
636
|
+
const canonicalDocs = await getCanonicalDocs(vaultOctokit, {
|
|
637
637
|
owner: vaultOwner,
|
|
638
638
|
repo: vaultRepoName,
|
|
639
639
|
projectName
|
|
@@ -651,7 +651,7 @@ async function draftLogEntry({ projectOctokit, vaultOctokit, claude, projectOwne
|
|
|
651
651
|
date,
|
|
652
652
|
commitMessages: diff.commitMessages,
|
|
653
653
|
files: bucket.files,
|
|
654
|
-
|
|
654
|
+
canonicalDocs,
|
|
655
655
|
moduleId: bucket.moduleId,
|
|
656
656
|
moduleName: bucket.moduleName
|
|
657
657
|
});
|
package/dist/sync-onboarding.js
CHANGED
|
@@ -168,8 +168,8 @@ function buildOnboardingGuidePrompt(input) {
|
|
|
168
168
|
"",
|
|
169
169
|
input.currentState ? `--- Current state ---
|
|
170
170
|
${input.currentState}` : "",
|
|
171
|
-
input.
|
|
172
|
-
${input.
|
|
171
|
+
input.canonicalDocs ? `--- Canonical docs ---
|
|
172
|
+
${input.canonicalDocs}` : "",
|
|
173
173
|
input.decisions.length > 0 ? `--- Decisions ---
|
|
174
174
|
${input.decisions.join("\n\n")}` : "",
|
|
175
175
|
"",
|
|
@@ -272,19 +272,19 @@ function isNotFound2(error) {
|
|
|
272
272
|
return typeof error === "object" && error !== null && "status" in error && error.status === 404;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
// ../../modules/devlore/dist/
|
|
276
|
-
function
|
|
277
|
-
return `projects/${projectName}/
|
|
275
|
+
// ../../modules/devlore/dist/canonicalDocs.js
|
|
276
|
+
function canonicalDocsPath(projectName) {
|
|
277
|
+
return `projects/${projectName}/canonical/README.md`;
|
|
278
278
|
}
|
|
279
|
-
async function
|
|
280
|
-
return (await
|
|
279
|
+
async function getCanonicalDocs(octokit, params) {
|
|
280
|
+
return (await getCanonicalDocsFile(octokit, params)).content;
|
|
281
281
|
}
|
|
282
|
-
async function
|
|
282
|
+
async function getCanonicalDocsFile(octokit, { owner, repo, projectName }) {
|
|
283
283
|
try {
|
|
284
284
|
const { data } = await octokit.rest.repos.getContent({
|
|
285
285
|
owner,
|
|
286
286
|
repo,
|
|
287
|
-
path:
|
|
287
|
+
path: canonicalDocsPath(projectName)
|
|
288
288
|
});
|
|
289
289
|
if (Array.isArray(data) || data.type !== "file") {
|
|
290
290
|
return { content: "" };
|
|
@@ -364,15 +364,15 @@ async function readVaultFile(octokit, owner, repo, path) {
|
|
|
364
364
|
return data && !Array.isArray(data) && data.type === "file" ? Buffer.from(data.content, "base64").toString("utf-8") : "";
|
|
365
365
|
}
|
|
366
366
|
async function syncOnboarding({ projectOctokit, vaultOctokit, claude, projectOwner, projectRepoName, vaultOwner, vaultRepoName, projectName }) {
|
|
367
|
-
const [currentState,
|
|
367
|
+
const [currentState, canonicalDocs, entries] = await Promise.all([
|
|
368
368
|
readVaultFile(vaultOctokit, vaultOwner, vaultRepoName, currentStatePath(projectName)),
|
|
369
|
-
|
|
369
|
+
getCanonicalDocs(vaultOctokit, { owner: vaultOwner, repo: vaultRepoName, projectName }).catch(() => ""),
|
|
370
370
|
listDecisionEntries(vaultOctokit, { owner: vaultOwner, repo: vaultRepoName, projectName }).catch(() => [])
|
|
371
371
|
]);
|
|
372
372
|
const prompt = buildOnboardingGuidePrompt({
|
|
373
373
|
projectName,
|
|
374
374
|
currentState: redactText(currentState),
|
|
375
|
-
|
|
375
|
+
canonicalDocs: redactText(canonicalDocs),
|
|
376
376
|
decisions: entries.map((entry) => redactText(entry.content))
|
|
377
377
|
});
|
|
378
378
|
const { text, usage } = await createCompleteMessage(claude, { model: defaultModelFor(MODEL_TIER), max_tokens: MAX_TOKENS, messages: [{ role: "user", content: prompt }] }, { maxContinuations: MAX_CONTINUATIONS });
|