@tailor-platform/sdk 1.67.1 → 1.68.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.
- package/CHANGELOG.md +23 -1
- package/dist/application-WpWwTyk9.mjs.map +1 -1
- package/dist/cli/index.mjs +135 -23
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +63 -4
- package/dist/cli/lib.mjs +2 -2
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/completion/zsh-worker.zsh +105 -26
- package/dist/{runtime-BU6KtCvk.mjs → runtime-DxaBq6U8.mjs} +720 -193
- package/dist/runtime-DxaBq6U8.mjs.map +1 -0
- package/docs/cli/executor.md +53 -0
- package/docs/cli/setup.md +35 -33
- package/docs/cli/workflow.md +157 -20
- package/docs/cli-reference.md +4 -3
- package/docs/github-actions.md +27 -14
- package/package.json +1 -1
- package/dist/runtime-BU6KtCvk.mjs.map +0 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { A as loadMachineUserName, B as fetchPlatformMachineUserToken, C as hashContent$1, D as fetchLatestToken, Dt as FunctionExecution_Type, E as deleteUserTokens, F as writePlatformConfig, H as initOAuth2Client, I as closeConnectionPool, L as fetchAll, M as readPlatformConfig, N as resolveTokens, O as loadAccessToken, P as saveUserTokens, S as getDistDir, T as loadConfig, U as initOperatorClient, V as fetchUserInfo, _ as createLogLevelTreeshakeOptions, a as WorkflowJobSchema, c as INVOKER_EXPR, cn as PATScope, ft as CustomDomainStatus, g as composeFunctionTreeshakeOptions, h as platformBundleDefinePlugin, i as resolveInlineSourcemap, j as loadWorkspaceId, o as ResolverSchema, t as defineApplication, tn as AuthInvokerSchema, v as resolveBundleLogLevel, z as fetchPaged } from "../application-WpWwTyk9.mjs";
|
|
4
4
|
import { t as assertDefined } from "../assert-CKfwrmCV.mjs";
|
|
5
5
|
import { n as logger, r as styles } from "../logger-DpJyJvNz.mjs";
|
|
6
|
-
import { $ as
|
|
6
|
+
import { $ as updateCommand$2, $t as protoGqlPermission, A as listCommand$12, At as jobsCommand, Bn as toPageDirection, Bt as functionExecutionStatusToString, C as listCommand$13, Cn as ensureConfigId, Ct as webhookCommand, Dn as generateUserTypes, E as waitCommand, En as PluginManager, Et as listCommand$6, F as generateCommand$1, Fn as confirmationArgs, Ft as getCommand$6, G as updateCommand$3, Gt as executeScript, H as logBetaWarning, Ht as getCommand$1, I as generateMigrationScript, In as deploymentArgs, J as treeCommand, Jt as MIGRATION_LABEL_KEY, L as writeDbTypesFile, Ln as isVerbose, Lt as executionsCommand, Mn as defineAppCommand, N as truncateCommand, Nn as commonArgs, Nt as startCommand, O as resumeCommand, On as prompt, Pn as configArg, Qt as generateAllTypeManifestsFromSnapshot, R as getConfiguredEditorCommand, Rn as pagedLogArgs, Sn as getNamespacesWithMigrations, T as healthCommand, Tn as sdkNameLabelKey, V as showCommand, Vn as workspaceArgs, Vt as formatKeyValueTable, W as removeCommand$1, Wt as deploy, Xt as parseMigrationLabelNumber, Y as listCommand$11, Yt as handleOptionalToRequiredError, Z as getCommand$5, Zt as compareSnapshotWithRemote, _n as formatMigrationNumber, _t as generate, an as assertValidMigrationFiles, at as deleteCommand$3, b as createCommand$4, bn as formatMigrationDiff, bt as getCommand$2, c as listCommand$14, cn as createSnapshotFromLocalTypes, dn as getMigrationFilePath, dt as getCommand$3, f as restoreCommand, fn as getMigrationFiles, g as getCommand$7, gn as reconstructSnapshotFromMigrations, hn as loadDiff, ht as listCommand$8, i as updateCommand$4, jn as assertWritable, kn as apiCommand, ln as getLatestMigrationNumber, lt as listCommand$9, m as listCommand$15, mn as isValidMigrationNumber, mt as tokenCommand, nn as INITIAL_SCHEMA_NUMBER, o as removeCommand, on as compareLocalTypesWithSnapshot, r as queryCommand, rt as getCommand$4, st as createCommand$3, t as isNativeTypeScriptRuntime, tt as listCommand$10, u as inviteCommand, v as deleteCommand$4, vn as parseMigrationNumberArg, vt as listCommand$7, wn as resourceTrn, wt as triggerCommand, xn as hasChanges, z as openInConfiguredEditor, zn as paginationArgs } from "../runtime-DxaBq6U8.mjs";
|
|
7
7
|
import { n as ExecutorSchema } from "../service-wI3Hvrgx.mjs";
|
|
8
8
|
import { t as multiline } from "../multiline-Cf9ODpr1.mjs";
|
|
9
9
|
import { r as isPluginGeneratedType } from "../seed-YAbtMy65.mjs";
|
|
@@ -31,12 +31,12 @@ import open from "open";
|
|
|
31
31
|
import * as rolldown from "rolldown";
|
|
32
32
|
import * as fsPromises from "node:fs/promises";
|
|
33
33
|
import { glob } from "node:fs/promises";
|
|
34
|
+
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
34
35
|
import { TraceMap, generatedPositionFor, originalPositionFor } from "@jridgewell/trace-mapping";
|
|
35
36
|
import { spawn, spawnSync } from "node:child_process";
|
|
36
37
|
import { watch } from "chokidar";
|
|
37
38
|
import * as fs from "fs";
|
|
38
39
|
import { lookup } from "mime-types";
|
|
39
|
-
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
40
40
|
|
|
41
41
|
//#region src/cli/commands/authconnection/args.ts
|
|
42
42
|
/**
|
|
@@ -2609,7 +2609,7 @@ const secretCommand = defineCommand({
|
|
|
2609
2609
|
});
|
|
2610
2610
|
|
|
2611
2611
|
//#endregion
|
|
2612
|
-
//#region src/cli/commands/setup/
|
|
2612
|
+
//#region src/cli/commands/setup/git.ts
|
|
2613
2613
|
const defaultGitRunner = (args, cwd) => {
|
|
2614
2614
|
const result = spawnSync("git", args, {
|
|
2615
2615
|
cwd,
|
|
@@ -2640,7 +2640,7 @@ function detectDefaultBranch(cwd, run = defaultGitRunner) {
|
|
|
2640
2640
|
}
|
|
2641
2641
|
|
|
2642
2642
|
//#endregion
|
|
2643
|
-
//#region src/cli/commands/setup/
|
|
2643
|
+
//#region src/cli/commands/setup/lock.ts
|
|
2644
2644
|
/** Current lock schema version. Bumped only on breaking lock-format changes. */
|
|
2645
2645
|
const LOCK_VERSION = 1;
|
|
2646
2646
|
/** Lock file path, relative to the repository root. */
|
|
@@ -2706,21 +2706,21 @@ function findTarget(lock, kind, workspaceName) {
|
|
|
2706
2706
|
}
|
|
2707
2707
|
|
|
2708
2708
|
//#endregion
|
|
2709
|
-
//#region src/cli/commands/setup/
|
|
2709
|
+
//#region src/cli/commands/setup/branch.workflow.yml
|
|
2710
2710
|
var branch_workflow_default = "# __HEADER__\nname: Tailor (__WORKSPACE_NAME__)\n\non:\n # __PULL_REQUEST_START__\n pull_request:\n branches: [\"__BRANCH__\"]\n # __PATHS__\n # __PULL_REQUEST_END__\n push:\n branches: [\"__BRANCH__\"]\n # __PATHS__\n workflow_dispatch:\n # __DISPATCH_INPUTS_START__\n inputs:\n dry-run:\n description: Preview changes without deploying\n type: boolean\n default: false\n # __DISPATCH_INPUTS_END__\n\npermissions:\n contents: read\n\njobs:\n # __PLAN_JOB_START__\n tailor-plan:\n if: >-\n github.event_name == 'pull_request' ||\n (github.event_name == 'workflow_dispatch' && inputs['dry-run'])\n runs-on: ubuntu-latest\n timeout-minutes: 30\n environment: __ENVIRONMENT__\n permissions:\n contents: read\n pull-requests: write\n concurrency:\n group: tailor-plan-__WORKSPACE_NAME__-${{ github.event.pull_request.number || github.run_id }}\n cancel-in-progress: true\n steps:\n - id: tailor-checkout\n uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3\n - id: tailor-setup\n uses: tailor-platform/actions/setup@7817f37adf2891fbb2ebbe0a3b222a5fa2ed0c1f # v1.3.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-generate-check\n uses: tailor-platform/actions/generate-check@7817f37adf2891fbb2ebbe0a3b222a5fa2ed0c1f # v1.3.0\n with:\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n - id: tailor-plan\n # Fork PRs cannot read secrets; the checks above still run for them.\n if: github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork\n uses: tailor-platform/actions/plan@7817f37adf2891fbb2ebbe0a3b222a5fa2ed0c1f # v1.3.0\n with:\n workspace-id: ${{ vars.TAILOR_PLATFORM_WORKSPACE_ID }}\n package-manager: __PACKAGE_MANAGER__\n label: __WORKSPACE_NAME__\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n github-token: ${{ secrets.GITHUB_TOKEN }}\n # __PLAN_JOB_END__\n tailor-deploy:\n # __DEPLOY_IF__\n runs-on: ubuntu-latest\n timeout-minutes: 30\n permissions:\n contents: read\n environment: __ENVIRONMENT__\n concurrency:\n group: tailor-deploy-__WORKSPACE_NAME__\n cancel-in-progress: false\n steps:\n - id: tailor-checkout\n uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3\n - id: tailor-setup\n uses: tailor-platform/actions/setup@7817f37adf2891fbb2ebbe0a3b222a5fa2ed0c1f # v1.3.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-apply\n uses: tailor-platform/actions/deploy@7817f37adf2891fbb2ebbe0a3b222a5fa2ed0c1f # v1.3.0\n with:\n workspace-id: ${{ vars.TAILOR_PLATFORM_WORKSPACE_ID }}\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n";
|
|
2711
2711
|
|
|
2712
2712
|
//#endregion
|
|
2713
|
-
//#region src/cli/commands/setup/
|
|
2713
|
+
//#region src/cli/commands/setup/tag.workflow.yml
|
|
2714
2714
|
var tag_workflow_default = "# __HEADER__\nname: Tailor (__WORKSPACE_NAME__)\n\non:\n push:\n tags: [\"__TAG_PATTERN__\"]\n workflow_dispatch:\n inputs:\n dry-run:\n description: Preview changes without deploying\n type: boolean\n default: false\n\npermissions:\n contents: read\n\njobs:\n # __TAG_GUARD_JOB_START__\n tailor-tag-guard:\n runs-on: ubuntu-latest\n timeout-minutes: 10\n permissions:\n contents: read\n outputs:\n on-branch: ${{ steps.tailor-tag-guard.outputs.on-branch }}\n steps:\n - id: tailor-checkout\n uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3\n with:\n fetch-depth: 0\n - id: tailor-tag-guard\n uses: tailor-platform/actions/tag-guard@7817f37adf2891fbb2ebbe0a3b222a5fa2ed0c1f # v1.3.0\n with:\n target-branch: \"__BRANCH__\"\n # __TAG_GUARD_JOB_END__\n tailor-plan:\n # __PLAN_NEEDS__\n # __PLAN_IF__\n runs-on: ubuntu-latest\n timeout-minutes: 30\n environment: __ENVIRONMENT__\n permissions:\n contents: read\n steps:\n - id: tailor-checkout\n uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3\n - id: tailor-setup\n uses: tailor-platform/actions/setup@7817f37adf2891fbb2ebbe0a3b222a5fa2ed0c1f # v1.3.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-generate-check\n uses: tailor-platform/actions/generate-check@7817f37adf2891fbb2ebbe0a3b222a5fa2ed0c1f # v1.3.0\n with:\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n - id: tailor-plan\n uses: tailor-platform/actions/plan@7817f37adf2891fbb2ebbe0a3b222a5fa2ed0c1f # v1.3.0\n with:\n workspace-id: ${{ vars.TAILOR_PLATFORM_WORKSPACE_ID }}\n package-manager: __PACKAGE_MANAGER__\n label: __WORKSPACE_NAME__\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n\n tailor-deploy:\n needs: tailor-plan\n if: ${{ !(github.event_name == 'workflow_dispatch' && inputs['dry-run']) }}\n environment: __ENVIRONMENT__\n runs-on: ubuntu-latest\n timeout-minutes: 30\n permissions:\n contents: read\n concurrency:\n group: tailor-deploy-__WORKSPACE_NAME__\n cancel-in-progress: false\n steps:\n - id: tailor-checkout\n uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3\n - id: tailor-setup\n uses: tailor-platform/actions/setup@7817f37adf2891fbb2ebbe0a3b222a5fa2ed0c1f # v1.3.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-apply\n uses: tailor-platform/actions/deploy@7817f37adf2891fbb2ebbe0a3b222a5fa2ed0c1f # v1.3.0\n with:\n workspace-id: ${{ vars.TAILOR_PLATFORM_WORKSPACE_ID }}\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n";
|
|
2715
2715
|
|
|
2716
2716
|
//#endregion
|
|
2717
|
-
//#region src/cli/commands/setup/
|
|
2718
|
-
const HEADER = `# Generated by \`tailor-sdk setup
|
|
2717
|
+
//#region src/cli/commands/setup/templates.ts
|
|
2718
|
+
const HEADER = `# Generated by \`tailor-sdk setup\` — managed by the Tailor SDK.
|
|
2719
2719
|
#
|
|
2720
2720
|
# - Jobs and steps whose id starts with \`tailor-\` are managed by the SDK.
|
|
2721
2721
|
# Do not edit or rename them.
|
|
2722
2722
|
# - State is tracked in .github/tailor-sdk.lock (machine-owned: commit it, never edit it).
|
|
2723
|
-
# - Re-running \`tailor-sdk setup
|
|
2723
|
+
# - Re-running \`tailor-sdk setup\` regenerates this file. If you have
|
|
2724
2724
|
# edited it by hand, regeneration stops and asks for --force (which discards
|
|
2725
2725
|
# your edits), so prefer keeping customizations in your own jobs/steps and
|
|
2726
2726
|
# re-running setup after SDK updates.`;
|
|
@@ -2806,7 +2806,110 @@ function renderTagWorkflow(params) {
|
|
|
2806
2806
|
}
|
|
2807
2807
|
|
|
2808
2808
|
//#endregion
|
|
2809
|
-
//#region src/cli/commands/setup/
|
|
2809
|
+
//#region src/cli/commands/setup/check.ts
|
|
2810
|
+
/**
|
|
2811
|
+
* Compute drift findings for one target by comparing its recorded lock state
|
|
2812
|
+
* against the current repository/config state.
|
|
2813
|
+
* @param target - The lock target being audited
|
|
2814
|
+
* @param state - Current repository/config state for this target
|
|
2815
|
+
* @returns Drift findings (empty when the target is in sync)
|
|
2816
|
+
*/
|
|
2817
|
+
function findTargetDrift(target, state) {
|
|
2818
|
+
const id = `${target.kind} ${target.workspaceName}`;
|
|
2819
|
+
const findings = [];
|
|
2820
|
+
if (!state.fileExists) findings.push({
|
|
2821
|
+
target: id,
|
|
2822
|
+
rule: "missing-file",
|
|
2823
|
+
message: `${target.file} is missing or unreadable. Re-run setup to restore it.`
|
|
2824
|
+
});
|
|
2825
|
+
else if (state.currentHash !== null && state.currentHash !== target.contentHash) findings.push({
|
|
2826
|
+
target: id,
|
|
2827
|
+
rule: "hand-edit",
|
|
2828
|
+
message: `${target.file} was edited by hand since it was generated. Re-run setup with --force to regenerate, or keep customizations in your own jobs/steps.`
|
|
2829
|
+
});
|
|
2830
|
+
if (target.templateVersion < state.templateVersion) findings.push({
|
|
2831
|
+
target: id,
|
|
2832
|
+
rule: "template-version",
|
|
2833
|
+
message: `A newer workflow template is available (generated with v${String(target.templateVersion)}, current v${String(state.templateVersion)}). Re-run setup to update.`
|
|
2834
|
+
});
|
|
2835
|
+
if (!state.configExists) findings.push({
|
|
2836
|
+
target: id,
|
|
2837
|
+
rule: "config-dir",
|
|
2838
|
+
message: `tailor.config.ts not found under "${target.inputs.dir}". The app directory may have moved; re-run setup with the correct --dir.`
|
|
2839
|
+
});
|
|
2840
|
+
if (target.kind === "branch" && target.inputs.branchAutoDetected !== false && state.defaultBranch !== null && target.inputs.branch !== null && target.inputs.branch !== state.defaultBranch) findings.push({
|
|
2841
|
+
target: id,
|
|
2842
|
+
rule: "default-branch",
|
|
2843
|
+
message: `The workflow triggers on "${target.inputs.branch}" but the repository default branch is now "${state.defaultBranch}". If this is intentional, ignore this; otherwise re-run setup so the trigger matches the default branch.`
|
|
2844
|
+
});
|
|
2845
|
+
return findings;
|
|
2846
|
+
}
|
|
2847
|
+
function detectDefaultBranchSafe(cwd, run) {
|
|
2848
|
+
try {
|
|
2849
|
+
return detectDefaultBranch(cwd, run);
|
|
2850
|
+
} catch {
|
|
2851
|
+
return null;
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
function escapesRoot$1(rel) {
|
|
2855
|
+
return path.isAbsolute(rel) || rel === ".." || rel.startsWith(`..${path.sep}`) || rel.startsWith("../");
|
|
2856
|
+
}
|
|
2857
|
+
function resolveWithinRoot(outputDir, relPath) {
|
|
2858
|
+
if (path.isAbsolute(relPath)) return null;
|
|
2859
|
+
const abs = path.join(outputDir, relPath);
|
|
2860
|
+
if (escapesRoot$1(path.relative(outputDir, abs))) return null;
|
|
2861
|
+
try {
|
|
2862
|
+
if (escapesRoot$1(path.relative(fs$1.realpathSync(outputDir), fs$1.realpathSync(abs)))) return null;
|
|
2863
|
+
} catch {}
|
|
2864
|
+
return abs;
|
|
2865
|
+
}
|
|
2866
|
+
function readHash(absFile) {
|
|
2867
|
+
try {
|
|
2868
|
+
return hashContent(fs$1.readFileSync(absFile, "utf-8"));
|
|
2869
|
+
} catch {
|
|
2870
|
+
return null;
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
/**
|
|
2874
|
+
* Audit the generated workflows for drift against the current config/repo
|
|
2875
|
+
* state. Read-only: never writes files, the lock, or the config.
|
|
2876
|
+
*
|
|
2877
|
+
* Throws when drift is found (so it composes like the other `:check`
|
|
2878
|
+
* commands). The workflow drift-check step layers advisory behaviour on top
|
|
2879
|
+
* (per-rule ignore / continue-on-error); the CLI itself reports via exit code.
|
|
2880
|
+
* @param options - Check options
|
|
2881
|
+
*/
|
|
2882
|
+
function checkGitHub(options) {
|
|
2883
|
+
logBetaWarning("setup");
|
|
2884
|
+
const { outputDir } = options;
|
|
2885
|
+
const lock = readLock(outputDir);
|
|
2886
|
+
if (!lock || lock.targets.length === 0) throw new Error("No managed workflows found (.github/tailor-sdk.lock is missing or empty). Run `tailor-sdk setup` first.");
|
|
2887
|
+
const exists = options.configExistsAt ?? ((p) => fs$1.existsSync(p));
|
|
2888
|
+
const defaultBranch = detectDefaultBranchSafe(outputDir, options.gitRunner);
|
|
2889
|
+
const findings = [];
|
|
2890
|
+
for (const target of lock.targets) {
|
|
2891
|
+
const absFile = resolveWithinRoot(outputDir, target.file);
|
|
2892
|
+
const currentHash = absFile === null ? null : readHash(absFile);
|
|
2893
|
+
const configAbs = resolveWithinRoot(outputDir, path.join(target.inputs.dir, "tailor.config.ts"));
|
|
2894
|
+
findings.push(...findTargetDrift(target, {
|
|
2895
|
+
fileExists: currentHash !== null,
|
|
2896
|
+
currentHash,
|
|
2897
|
+
configExists: configAbs !== null && exists(configAbs),
|
|
2898
|
+
defaultBranch,
|
|
2899
|
+
templateVersion: 2
|
|
2900
|
+
}));
|
|
2901
|
+
}
|
|
2902
|
+
const count = lock.targets.length;
|
|
2903
|
+
if (findings.length === 0) {
|
|
2904
|
+
logger.success(`No drift detected across ${String(count)} target(s).`);
|
|
2905
|
+
return;
|
|
2906
|
+
}
|
|
2907
|
+
for (const finding of findings) logger.warn(`[${finding.target}] ${finding.message} (ignore key: ${finding.rule})`);
|
|
2908
|
+
throw new Error(`Detected ${String(findings.length)} drift finding(s) across ${String(count)} target(s). Re-run \`tailor-sdk setup\` to regenerate, or address each finding above.`);
|
|
2909
|
+
}
|
|
2910
|
+
|
|
2911
|
+
//#endregion
|
|
2912
|
+
//#region src/cli/commands/setup/generate.ts
|
|
2810
2913
|
async function defaultLoadConfigName(configPath) {
|
|
2811
2914
|
const { config } = await loadConfig(configPath);
|
|
2812
2915
|
return config.name;
|
|
@@ -2878,8 +2981,10 @@ async function resolve$1(options) {
|
|
|
2878
2981
|
validateEnvironment(environment);
|
|
2879
2982
|
if (kind === "tag") validateTagPattern(options.tagPattern);
|
|
2880
2983
|
let branch = null;
|
|
2984
|
+
let branchAutoDetected = false;
|
|
2881
2985
|
let render;
|
|
2882
2986
|
if (kind === "branch") {
|
|
2987
|
+
branchAutoDetected = options.branch === void 0;
|
|
2883
2988
|
branch = options.branch ?? detectDefaultBranch(options.outputDir, options.gitRunner);
|
|
2884
2989
|
validateBranch(branch);
|
|
2885
2990
|
render = renderBranchWorkflow({
|
|
@@ -2905,6 +3010,7 @@ async function resolve$1(options) {
|
|
|
2905
3010
|
const file = `.github/workflows/tailor-${workspaceName}.yml`;
|
|
2906
3011
|
const inputs = {
|
|
2907
3012
|
branch,
|
|
3013
|
+
branchAutoDetected: kind === "branch" ? branchAutoDetected : void 0,
|
|
2908
3014
|
tagPattern: kind === "tag" ? options.tagPattern : null,
|
|
2909
3015
|
environment,
|
|
2910
3016
|
dir,
|
|
@@ -2993,7 +3099,7 @@ function printNextSteps(obj) {
|
|
|
2993
3099
|
* @param options - Setup options
|
|
2994
3100
|
*/
|
|
2995
3101
|
async function setupGitHub(options) {
|
|
2996
|
-
logBetaWarning("setup
|
|
3102
|
+
logBetaWarning("setup");
|
|
2997
3103
|
const resolved = await resolve$1(options);
|
|
2998
3104
|
const lock = readLock(options.outputDir);
|
|
2999
3105
|
const absFile = path.join(options.outputDir, resolved.file);
|
|
@@ -3045,11 +3151,23 @@ async function setupGitHub(options) {
|
|
|
3045
3151
|
}
|
|
3046
3152
|
|
|
3047
3153
|
//#endregion
|
|
3048
|
-
//#region src/cli/commands/setup/
|
|
3049
|
-
const
|
|
3050
|
-
name: "
|
|
3051
|
-
description: "
|
|
3154
|
+
//#region src/cli/commands/setup/index.ts
|
|
3155
|
+
const checkCommand = defineAppCommand({
|
|
3156
|
+
name: "check",
|
|
3157
|
+
description: "Audit generated workflows for drift against the current config/repo (read-only).",
|
|
3158
|
+
args: z.object({}).strict(),
|
|
3159
|
+
run: () => {
|
|
3160
|
+
checkGitHub({ outputDir: process.cwd() });
|
|
3161
|
+
}
|
|
3162
|
+
});
|
|
3163
|
+
const setupCommand = defineAppCommand({
|
|
3164
|
+
name: "setup",
|
|
3165
|
+
description: "Generate a CI deploy workflow for your project. (beta)",
|
|
3052
3166
|
args: z.object({
|
|
3167
|
+
provider: arg(z.enum(["github"], { message: "Only the 'github' provider is supported." }).default("github"), {
|
|
3168
|
+
alias: "p",
|
|
3169
|
+
description: "CI provider to generate for (only 'github' is supported)"
|
|
3170
|
+
}),
|
|
3053
3171
|
"workspace-name": arg(z.string().min(1).optional(), {
|
|
3054
3172
|
alias: "n",
|
|
3055
3173
|
description: "Workspace name (defaults to the config 'name')"
|
|
@@ -3065,6 +3183,7 @@ const githubCommand = defineAppCommand({
|
|
|
3065
3183
|
}),
|
|
3066
3184
|
force: arg(z.boolean().default(false), { description: "Discard hand edits / take over unmanaged files and regenerate" })
|
|
3067
3185
|
}).strict(),
|
|
3186
|
+
subCommands: { check: checkCommand },
|
|
3068
3187
|
run: async (args) => {
|
|
3069
3188
|
if (args["tag-pattern"] !== void 0 && !args.tag) throw new Error("--tag-pattern requires --tag.");
|
|
3070
3189
|
if (args["no-plan"] && args.tag) throw new Error("--no-plan cannot be combined with --tag.");
|
|
@@ -3082,14 +3201,6 @@ const githubCommand = defineAppCommand({
|
|
|
3082
3201
|
}
|
|
3083
3202
|
});
|
|
3084
3203
|
|
|
3085
|
-
//#endregion
|
|
3086
|
-
//#region src/cli/commands/setup/index.ts
|
|
3087
|
-
const setupCommand = defineCommand({
|
|
3088
|
-
name: "setup",
|
|
3089
|
-
description: "Set up project infrastructure.",
|
|
3090
|
-
subCommands: { github: githubCommand }
|
|
3091
|
-
});
|
|
3092
|
-
|
|
3093
3204
|
//#endregion
|
|
3094
3205
|
//#region src/cli/shared/skills-installer.ts
|
|
3095
3206
|
const SKILL_NAME = "tailor-sdk";
|
|
@@ -5363,6 +5474,7 @@ const workflowCommand = defineCommand({
|
|
|
5363
5474
|
list: listCommand$12,
|
|
5364
5475
|
get: getCommand$6,
|
|
5365
5476
|
start: startCommand,
|
|
5477
|
+
wait: waitCommand,
|
|
5366
5478
|
executions: executionsCommand,
|
|
5367
5479
|
resume: resumeCommand
|
|
5368
5480
|
},
|