@treeseed/sdk 0.6.36 → 0.6.38
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/operations/services/git-workflow.js +5 -5
- package/dist/operations/services/github-actions-verification.d.ts +4 -0
- package/dist/operations/services/github-actions-verification.js +5 -3
- package/dist/operations/services/github-automation.d.ts +6 -98
- package/dist/operations/services/github-automation.js +1 -74
- package/dist/operations/services/release-candidate.js +5 -11
- package/dist/operations/services/release-history.d.ts +59 -0
- package/dist/operations/services/release-history.js +159 -0
- package/dist/operations/services/repository-save-orchestrator.js +7 -8
- package/dist/operations/services/save-deploy-preflight.d.ts +0 -5
- package/dist/operations/services/save-deploy-preflight.js +1 -9
- package/dist/scripts/tenant-build.js +31 -2
- package/dist/scripts/workspace-command-e2e.js +3 -3
- package/dist/verification.js +0 -1
- package/dist/workflow/operations.d.ts +14 -2
- package/dist/workflow/operations.js +293 -131
- package/package.json +1 -1
- package/templates/github/deploy.workflow.yml +12 -9
|
@@ -2,7 +2,6 @@ import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "no
|
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { basename, resolve, relative } from "node:path";
|
|
4
4
|
import { spawn, spawnSync } from "node:child_process";
|
|
5
|
-
import { getGitHubAutomationMode } from "./github-automation.js";
|
|
6
5
|
import {
|
|
7
6
|
ensureSshPushUrlForOrigin,
|
|
8
7
|
remoteWriteUrl,
|
|
@@ -578,7 +577,7 @@ function applyPackageVersion(node, version) {
|
|
|
578
577
|
return true;
|
|
579
578
|
}
|
|
580
579
|
function shouldSkipNetworkInstall() {
|
|
581
|
-
return
|
|
580
|
+
return process.env.TREESEED_SAVE_NPM_INSTALL_MODE === "skip";
|
|
582
581
|
}
|
|
583
582
|
function shouldSkipGitDependencySmoke(options) {
|
|
584
583
|
return shouldSkipNetworkInstall() || process.env.TREESEED_GIT_DEPENDENCY_SMOKE === "skip" || options?.verifyMode === "skip";
|
|
@@ -628,7 +627,7 @@ async function runGitDependencySmoke(node, options, reference) {
|
|
|
628
627
|
async function runNpmInstallWithRetry(node, options, gitDependencyRefreshSpecs = []) {
|
|
629
628
|
if (shouldSkipNetworkInstall()) {
|
|
630
629
|
emitProgress(options, node, "install", "Skipped npm install because network install mode is disabled.");
|
|
631
|
-
return { status: "skipped", attempts: 0, reason: "
|
|
630
|
+
return { status: "skipped", attempts: 0, reason: "disabled" };
|
|
632
631
|
}
|
|
633
632
|
let lastError = null;
|
|
634
633
|
const packageJson = node.packageJson ?? (existsSync(resolve(node.path, "package.json")) ? readJson(resolve(node.path, "package.json")) : null);
|
|
@@ -678,7 +677,7 @@ async function validateRepositoryLockfile(node, options) {
|
|
|
678
677
|
const commandText = `${command} ${args.join(" ")}`;
|
|
679
678
|
if (shouldSkipNetworkInstall()) {
|
|
680
679
|
emitProgress(options, node, "lockfile", `Skipped ${commandText} because network install mode is disabled.`);
|
|
681
|
-
return { status: "skipped", command: commandText, issues: [], error: "
|
|
680
|
+
return { status: "skipped", command: commandText, issues: [], error: "disabled" };
|
|
682
681
|
}
|
|
683
682
|
try {
|
|
684
683
|
runCapturedCommand(node, options, "lockfile", command, args, { timeoutMs: 12e4, emitOutputOnSuccess: false });
|
|
@@ -710,9 +709,9 @@ async function runScript(node, options, scriptName) {
|
|
|
710
709
|
await runStreamingCommand(node, options, "verify", "npm", ["run", scriptName]);
|
|
711
710
|
}
|
|
712
711
|
async function runRepoVerification(node, options, verifyMode) {
|
|
713
|
-
if (verifyMode === "skip"
|
|
714
|
-
emitProgress(options, node, "verify",
|
|
715
|
-
return { mode: verifyMode, status: "skipped", primary: null, fallbackUsed: false, error:
|
|
712
|
+
if (verifyMode === "skip") {
|
|
713
|
+
emitProgress(options, node, "verify", "Skipped verification by request.");
|
|
714
|
+
return { mode: verifyMode, status: "skipped", primary: null, fallbackUsed: false, error: null };
|
|
716
715
|
}
|
|
717
716
|
if (node.kind !== "package") {
|
|
718
717
|
emitProgress(options, node, "verify", "Skipped package verification for project repository.");
|
|
@@ -897,7 +896,7 @@ function ensureRemoteAccessBeforeVerification(node, options, state) {
|
|
|
897
896
|
}
|
|
898
897
|
}
|
|
899
898
|
function shouldSkipRemoteAccessPreflight() {
|
|
900
|
-
return
|
|
899
|
+
return process.env.TREESEED_SAVE_REMOTE_PREFLIGHT === "skip";
|
|
901
900
|
}
|
|
902
901
|
function localTreeseedTagWasCreatedByThisRun(node, tagName, workflowRunId) {
|
|
903
902
|
const message = localTagMessage(node.path, tagName);
|
|
@@ -2,7 +2,7 @@ import { spawnSync } from "node:child_process";
|
|
|
2
2
|
import { packageScriptPath } from "./runtime-tools.js";
|
|
3
3
|
import { applyTreeseedEnvironmentToProcess, assertTreeseedCommandEnvironment } from "./config-runtime.js";
|
|
4
4
|
import { collectCliPreflight } from "./workspace-preflight.js";
|
|
5
|
-
import {
|
|
5
|
+
import { requiredGitHubEnvironment } from "./github-automation.js";
|
|
6
6
|
function runStep(label, scriptName, { cwd, env } = {}) {
|
|
7
7
|
const result = spawnSync(process.execPath, [packageScriptPath(scriptName)], {
|
|
8
8
|
cwd,
|
|
@@ -25,14 +25,6 @@ function missingRequiredEnv(requiredKeys) {
|
|
|
25
25
|
function validateSaveAutomationPrerequisites({ cwd }) {
|
|
26
26
|
applyTreeseedEnvironmentToProcess({ tenantRoot: cwd, scope: "prod", override: true });
|
|
27
27
|
assertTreeseedCommandEnvironment({ tenantRoot: cwd, scope: "prod", purpose: "save" });
|
|
28
|
-
if (getGitHubAutomationMode() !== "real") {
|
|
29
|
-
return {
|
|
30
|
-
ok: true,
|
|
31
|
-
mode: "stub",
|
|
32
|
-
missingEnv: [],
|
|
33
|
-
preflight: null
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
28
|
const preflight = collectCliPreflight({ cwd, requireAuth: true });
|
|
37
29
|
if (!preflight.ok) {
|
|
38
30
|
const error = new Error("Treeseed save prerequisites failed: required GitHub, Cloudflare, or Railway tokens are missing.");
|
|
@@ -1,11 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { createBuildWarningSummary, formatAllowedBuildWarnings } from '../operations/services/build-warning-policy.js';
|
|
3
|
+
import { resolveAstroBin, createProductionBuildEnv, packageScriptPath, runNodeScript } from '../operations/services/runtime-tools.js';
|
|
4
|
+
function runFilteredNodeBinary(binPath, args, options) {
|
|
5
|
+
const result = spawnSync(process.execPath, [binPath, ...args], {
|
|
6
|
+
cwd: options.cwd,
|
|
7
|
+
env: { ...process.env, ...options.env },
|
|
8
|
+
stdio: 'pipe',
|
|
9
|
+
encoding: 'utf8',
|
|
10
|
+
});
|
|
11
|
+
const warningSummary = createBuildWarningSummary();
|
|
12
|
+
const emitFiltered = (text, stream) => {
|
|
13
|
+
for (const line of text.split(/\r?\n/u)) {
|
|
14
|
+
if (!line)
|
|
15
|
+
continue;
|
|
16
|
+
const classified = warningSummary.record(line);
|
|
17
|
+
if (classified.kind === 'allowed')
|
|
18
|
+
continue;
|
|
19
|
+
stream.write(`${line}\n`);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
emitFiltered(result.stdout ?? '', process.stdout);
|
|
23
|
+
emitFiltered(result.stderr ?? '', process.stderr);
|
|
24
|
+
for (const line of formatAllowedBuildWarnings(warningSummary.allowedWarnings)) {
|
|
25
|
+
process.stdout.write(`${line}\n`);
|
|
26
|
+
}
|
|
27
|
+
if (result.status !== 0) {
|
|
28
|
+
process.exit(result.status ?? 1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
2
31
|
process.env.TREESEED_LOCAL_DEV_MODE = process.env.TREESEED_LOCAL_DEV_MODE ?? 'cloudflare';
|
|
3
32
|
const publishedRuntime = process.env.TREESEED_CONTENT_SERVING_MODE === 'published_runtime';
|
|
4
33
|
runNodeScript(packageScriptPath('patch-starlight-content-path'), [], { cwd: process.cwd() });
|
|
5
34
|
if (!publishedRuntime) {
|
|
6
35
|
runNodeScript(packageScriptPath('aggregate-book'), [], { cwd: process.cwd() });
|
|
7
36
|
}
|
|
8
|
-
|
|
37
|
+
runFilteredNodeBinary(resolveAstroBin(), ['build'], {
|
|
9
38
|
cwd: process.cwd(),
|
|
10
39
|
env: createProductionBuildEnv({
|
|
11
40
|
TREESEED_LOCAL_DEV_MODE: process.env.TREESEED_LOCAL_DEV_MODE,
|
|
@@ -346,7 +346,7 @@ function appendSaveMarker(filePath, marker) {
|
|
|
346
346
|
}
|
|
347
347
|
function writeWorkspaceStub(repoDir) {
|
|
348
348
|
writeFileSync(resolve(repoDir, 'package.json'), `${JSON.stringify({
|
|
349
|
-
name: 'treeseed-save-
|
|
349
|
+
name: 'treeseed-save-local',
|
|
350
350
|
private: true,
|
|
351
351
|
workspaces: ['packages/*'],
|
|
352
352
|
}, null, 2)}\n`, 'utf8');
|
|
@@ -556,7 +556,7 @@ async function runLocalSuite() {
|
|
|
556
556
|
rmSync(clonedWorkspace.cloneRoot, { recursive: true, force: true });
|
|
557
557
|
}
|
|
558
558
|
});
|
|
559
|
-
await withStep('save success: local bare origin with
|
|
559
|
+
await withStep('save success: local bare origin with local-only install checks', async () => {
|
|
560
560
|
const clonedWorkspace = cloneLocalWorkspaceWithBareOrigin();
|
|
561
561
|
try {
|
|
562
562
|
const notePath = resolve(clonedWorkspace.workingRoot, 'src/content/notes/first-note.mdx');
|
|
@@ -566,7 +566,7 @@ async function runLocalSuite() {
|
|
|
566
566
|
cwd: clonedWorkspace.workingRoot,
|
|
567
567
|
env: {
|
|
568
568
|
...cacheEnv(),
|
|
569
|
-
|
|
569
|
+
TREESEED_SAVE_NPM_INSTALL_MODE: 'skip',
|
|
570
570
|
TREESEED_SAVE_REPORT_PATH: saveReportPath,
|
|
571
571
|
},
|
|
572
572
|
timeoutMs: 1800000,
|
package/dist/verification.js
CHANGED
|
@@ -44,6 +44,8 @@ type WorkflowRepoReport = {
|
|
|
44
44
|
publishWait: Record<string, unknown> | null;
|
|
45
45
|
workflowGates: Array<Record<string, unknown>>;
|
|
46
46
|
backMerge: Record<string, unknown> | null;
|
|
47
|
+
changelog?: Record<string, unknown> | null;
|
|
48
|
+
adminCommitSummary?: Record<string, unknown> | null;
|
|
47
49
|
};
|
|
48
50
|
export declare function workflowStatus(helpers: WorkflowOperationHelpers, input?: TreeseedWorkflowStatusOptions): Promise<TreeseedWorkflowResult<import("../workflow-state.ts").TreeseedWorkflowState>>;
|
|
49
51
|
export declare function workflowCi(helpers: WorkflowOperationHelpers, input?: TreeseedCiInput): Promise<TreeseedWorkflowResult<TreeseedCiResult>>;
|
|
@@ -417,6 +419,8 @@ export declare function workflowSave(helpers: WorkflowOperationHelpers, input: T
|
|
|
417
419
|
url: null;
|
|
418
420
|
createdAt: null;
|
|
419
421
|
updatedAt: null;
|
|
422
|
+
timeoutSeconds: number | null;
|
|
423
|
+
cached: boolean;
|
|
420
424
|
}[];
|
|
421
425
|
releaseCandidate: ReleaseCandidateReport | null;
|
|
422
426
|
} & {
|
|
@@ -557,6 +561,8 @@ export declare function workflowClose(helpers: WorkflowOperationHelpers, input:
|
|
|
557
561
|
url: null;
|
|
558
562
|
createdAt: null;
|
|
559
563
|
updatedAt: null;
|
|
564
|
+
timeoutSeconds: number | null;
|
|
565
|
+
cached: boolean;
|
|
560
566
|
}[];
|
|
561
567
|
releaseCandidate: ReleaseCandidateReport | null;
|
|
562
568
|
} & {
|
|
@@ -738,6 +744,8 @@ export declare function workflowStage(helpers: WorkflowOperationHelpers, input:
|
|
|
738
744
|
url: null;
|
|
739
745
|
createdAt: null;
|
|
740
746
|
updatedAt: null;
|
|
747
|
+
timeoutSeconds: number | null;
|
|
748
|
+
cached: boolean;
|
|
741
749
|
}[];
|
|
742
750
|
releaseCandidate: ReleaseCandidateReport | null;
|
|
743
751
|
} & {
|
|
@@ -874,7 +882,7 @@ export declare function workflowRelease(helpers: WorkflowOperationHelpers, input
|
|
|
874
882
|
publishWait: never[];
|
|
875
883
|
repos: never[];
|
|
876
884
|
rootRepo: WorkflowRepoReport;
|
|
877
|
-
releaseCandidate: ReleaseCandidateReport;
|
|
885
|
+
releaseCandidate: ReleaseCandidateReport | null;
|
|
878
886
|
releaseBackMerge: {
|
|
879
887
|
status: string;
|
|
880
888
|
merged: boolean;
|
|
@@ -914,6 +922,8 @@ export declare function workflowRelease(helpers: WorkflowOperationHelpers, input
|
|
|
914
922
|
url: null;
|
|
915
923
|
createdAt: null;
|
|
916
924
|
updatedAt: null;
|
|
925
|
+
timeoutSeconds: number | null;
|
|
926
|
+
cached: boolean;
|
|
917
927
|
}[];
|
|
918
928
|
} & {
|
|
919
929
|
finalState?: WorkflowStatePayload;
|
|
@@ -959,7 +969,7 @@ export declare function workflowRelease(helpers: WorkflowOperationHelpers, input
|
|
|
959
969
|
publishWait: Record<string, unknown>[];
|
|
960
970
|
repos: WorkflowRepoReport[];
|
|
961
971
|
rootRepo: WorkflowRepoReport;
|
|
962
|
-
releaseCandidate: ReleaseCandidateReport;
|
|
972
|
+
releaseCandidate: ReleaseCandidateReport | null;
|
|
963
973
|
releaseBackMerge: {
|
|
964
974
|
status: string;
|
|
965
975
|
merged: boolean;
|
|
@@ -999,6 +1009,8 @@ export declare function workflowRelease(helpers: WorkflowOperationHelpers, input
|
|
|
999
1009
|
url: null;
|
|
1000
1010
|
createdAt: null;
|
|
1001
1011
|
updatedAt: null;
|
|
1012
|
+
timeoutSeconds: number | null;
|
|
1013
|
+
cached: boolean;
|
|
1002
1014
|
})[];
|
|
1003
1015
|
} & {
|
|
1004
1016
|
finalState?: WorkflowStatePayload;
|