deepline 0.1.106 → 0.1.108
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/cli/index.js +499 -55
- package/dist/cli/index.mjs +495 -51
- package/dist/index.d.mts +21 -5
- package/dist/index.d.ts +21 -5
- package/dist/index.js +20 -4
- package/dist/index.mjs +20 -4
- package/dist/repo/apps/play-runner-workers/src/entry.ts +55 -44
- package/dist/repo/sdk/src/play.ts +21 -4
- package/dist/repo/sdk/src/release.ts +49 -7
- package/dist/repo/sdk/src/worker-play-entry.ts +4 -0
- package/dist/repo/shared_libs/play-runtime/cell-staleness.ts +64 -5
- package/dist/repo/shared_libs/play-runtime/run-ledger.ts +6 -0
- package/dist/repo/shared_libs/play-runtime/step-program-dataset-builder.ts +8 -0
- package/dist/repo/shared_libs/plays/static-pipeline.ts +87 -3
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -219,12 +219,24 @@ var SDK_RELEASE = {
|
|
|
219
219
|
// 0.1.105 ships the billing catalog surface: billing plans, subscribe,
|
|
220
220
|
// subscription status/cancel, invoices, and the client.billing namespace.
|
|
221
221
|
// 0.1.106 ships play cell provenance metadata and v2 preview retry hardening.
|
|
222
|
-
|
|
222
|
+
// 0.1.107 ships the v2 quickstart command, the deepline-plays-quickstart
|
|
223
|
+
// skill on the sdk sync surface, and the people-search-to-email prebuilt.
|
|
224
|
+
// 0.1.108 ships explicit dataset column/tool recompute policy and removes
|
|
225
|
+
// the SDK enrich generator's one-second stale policy.
|
|
226
|
+
version: "0.1.108",
|
|
223
227
|
apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
|
|
224
228
|
supportPolicy: {
|
|
225
|
-
latest: "0.1.
|
|
229
|
+
latest: "0.1.108",
|
|
226
230
|
minimumSupported: "0.1.53",
|
|
227
|
-
deprecatedBelow: "0.1.53"
|
|
231
|
+
deprecatedBelow: "0.1.53",
|
|
232
|
+
commandMinimumSupported: [
|
|
233
|
+
{
|
|
234
|
+
command: "enrich",
|
|
235
|
+
minimumSupported: "0.1.108",
|
|
236
|
+
reason: "Older SDK CLI enrich generated stale play source for the current dataset API."
|
|
237
|
+
}
|
|
238
|
+
],
|
|
239
|
+
autoUpdatePatchLag: 2
|
|
228
240
|
}
|
|
229
241
|
};
|
|
230
242
|
|
|
@@ -824,6 +836,8 @@ function normalizeStepProgress(value) {
|
|
|
824
836
|
value.artifactTableNamespace
|
|
825
837
|
)
|
|
826
838
|
} : {},
|
|
839
|
+
...finiteNumber(value.startedAt) !== null ? { startedAt: finiteNumber(value.startedAt) } : {},
|
|
840
|
+
...finiteNumber(value.completedAt) !== null ? { completedAt: finiteNumber(value.completedAt) } : {},
|
|
827
841
|
...finiteNumber(value.updatedAt) !== null ? { updatedAt: finiteNumber(value.updatedAt) } : {}
|
|
828
842
|
};
|
|
829
843
|
}
|
|
@@ -3146,7 +3160,7 @@ function shouldSkipCompatibilityCheck() {
|
|
|
3146
3160
|
const value = process.env.DEEPLINE_SKIP_SDK_COMPAT_CHECK?.trim().toLowerCase();
|
|
3147
3161
|
return value === "1" || value === "true" || value === "yes";
|
|
3148
3162
|
}
|
|
3149
|
-
async function checkSdkCompatibility(baseUrl) {
|
|
3163
|
+
async function checkSdkCompatibility(baseUrl, options = {}) {
|
|
3150
3164
|
if (shouldSkipCompatibilityCheck()) {
|
|
3151
3165
|
return { response: null, error: null };
|
|
3152
3166
|
}
|
|
@@ -3155,6 +3169,9 @@ async function checkSdkCompatibility(baseUrl) {
|
|
|
3155
3169
|
try {
|
|
3156
3170
|
const url = new URL("/api/v2/sdk/compat", baseUrl);
|
|
3157
3171
|
url.searchParams.set("version", SDK_VERSION);
|
|
3172
|
+
if (options.command?.trim()) {
|
|
3173
|
+
url.searchParams.set("command", options.command.trim());
|
|
3174
|
+
}
|
|
3158
3175
|
const response = await fetch(url, {
|
|
3159
3176
|
method: "GET",
|
|
3160
3177
|
headers: {
|
|
@@ -3175,9 +3192,8 @@ async function checkSdkCompatibility(baseUrl) {
|
|
|
3175
3192
|
clearTimeout(timeout);
|
|
3176
3193
|
}
|
|
3177
3194
|
}
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
if (error || !response) {
|
|
3195
|
+
function enforceSdkCompatibilityResponse(response) {
|
|
3196
|
+
if (!response) {
|
|
3181
3197
|
return;
|
|
3182
3198
|
}
|
|
3183
3199
|
if (response.update_required) {
|
|
@@ -15496,7 +15512,7 @@ function renderIdiomaticExecuteStep(command, options) {
|
|
|
15496
15512
|
` tool: ${tool},`,
|
|
15497
15513
|
` input: ${input2} as any,`,
|
|
15498
15514
|
` description: ${stringLiteral((command.description ?? "").trim() || `Run ${command.alias} via ${command.tool}.`)},`,
|
|
15499
|
-
...options.force ? [`
|
|
15515
|
+
...options.force ? [` force: true,`] : [],
|
|
15500
15516
|
` });`,
|
|
15501
15517
|
` return ${extraction};`,
|
|
15502
15518
|
`}`
|
|
@@ -15528,17 +15544,13 @@ function renderPlayStep(command, options) {
|
|
|
15528
15544
|
${indent(renderJavascriptBody(command.run_if_js), 6)}
|
|
15529
15545
|
}` : "null";
|
|
15530
15546
|
const runIfLines = command.run_if_js ? [` const __dlRunIf = ${runIfJs};`, ` if (!__dlRunIf(row)) return null;`] : [];
|
|
15531
|
-
const playOptions = [
|
|
15532
|
-
` description: ${stringLiteral(command.description ?? command.alias)}`,
|
|
15533
|
-
...options.force ? [` staleAfterSeconds: 1`] : []
|
|
15534
|
-
].join(",\n");
|
|
15535
15547
|
return [
|
|
15536
15548
|
`async (row, stepCtx) => {`,
|
|
15537
15549
|
...options.precheck ? [` if (${options.precheck}) return null;`] : [],
|
|
15538
15550
|
...runIfLines,
|
|
15539
15551
|
` const payload = __dlTemplate(${payload}, row) as Record<string, unknown>;`,
|
|
15540
15552
|
` const result = await stepCtx.runPlay(${callId}, ${playRef}, payload, {`,
|
|
15541
|
-
|
|
15553
|
+
` description: ${stringLiteral(command.description ?? command.alias)}`,
|
|
15542
15554
|
` });`,
|
|
15543
15555
|
` return __dlPlayResultValue(${alias}, result);`,
|
|
15544
15556
|
`}`
|
|
@@ -15555,12 +15567,17 @@ function renderJavascriptBody(source) {
|
|
|
15555
15567
|
}
|
|
15556
15568
|
return source;
|
|
15557
15569
|
}
|
|
15558
|
-
function renderColumnStep(alias, resolverSource,
|
|
15570
|
+
function renderColumnStep(alias, resolverSource, options = {}) {
|
|
15559
15571
|
const resolver = indent(resolverSource, 8);
|
|
15572
|
+
const optionFields = [
|
|
15573
|
+
...options.recompute === true ? ["recompute: true"] : [],
|
|
15574
|
+
...options.recomputeOnError === true ? ["recomputeOnError: true"] : []
|
|
15575
|
+
];
|
|
15576
|
+
const optionSource = optionFields.length > 0 ? `{ ${optionFields.join(", ")} }` : null;
|
|
15560
15577
|
return [
|
|
15561
15578
|
` .withColumn(${stringLiteral(alias)},`,
|
|
15562
|
-
|
|
15563
|
-
...
|
|
15579
|
+
`${resolver}${optionSource ? "," : ""}`,
|
|
15580
|
+
...optionSource ? [` ${optionSource},`] : [],
|
|
15564
15581
|
` )`
|
|
15565
15582
|
].join("\n");
|
|
15566
15583
|
}
|
|
@@ -15609,6 +15626,29 @@ function collectMetadataColumns(commands, waterfallGroupId) {
|
|
|
15609
15626
|
}
|
|
15610
15627
|
return columns;
|
|
15611
15628
|
}
|
|
15629
|
+
function collectGeneratedAliases(commands) {
|
|
15630
|
+
const aliases = [];
|
|
15631
|
+
const addAlias = (alias) => {
|
|
15632
|
+
if (alias && !aliases.includes(alias)) {
|
|
15633
|
+
aliases.push(alias);
|
|
15634
|
+
}
|
|
15635
|
+
};
|
|
15636
|
+
for (const command of commands) {
|
|
15637
|
+
if (isWaterfall(command)) {
|
|
15638
|
+
const before = aliases.length;
|
|
15639
|
+
collectGeneratedAliases(command.commands).forEach(addAlias);
|
|
15640
|
+
if (aliases.length > before) {
|
|
15641
|
+
addAlias(command.with_waterfall);
|
|
15642
|
+
addAlias(`${command.with_waterfall}_source`);
|
|
15643
|
+
}
|
|
15644
|
+
continue;
|
|
15645
|
+
}
|
|
15646
|
+
if (!command.disabled) {
|
|
15647
|
+
addAlias(command.alias);
|
|
15648
|
+
}
|
|
15649
|
+
}
|
|
15650
|
+
return aliases;
|
|
15651
|
+
}
|
|
15612
15652
|
function renderMetadataColumnStep(config) {
|
|
15613
15653
|
const columns = collectMetadataColumns(config.commands);
|
|
15614
15654
|
if (Object.keys(columns).length === 0) {
|
|
@@ -15616,8 +15656,8 @@ function renderMetadataColumnStep(config) {
|
|
|
15616
15656
|
}
|
|
15617
15657
|
return [
|
|
15618
15658
|
` .withColumn('_metadata',`,
|
|
15619
|
-
` (row) => __dlMergeMetadata(row
|
|
15620
|
-
` {
|
|
15659
|
+
` (row) => __dlMergeMetadata(__dlMetadataFromRow(row), ${stableJson({ columns })}),`,
|
|
15660
|
+
` { recompute: true },`,
|
|
15621
15661
|
` )`
|
|
15622
15662
|
].join("\n");
|
|
15623
15663
|
}
|
|
@@ -15644,7 +15684,7 @@ function renderWaterfallColumns(command, forceAliases, inlineRunJavascript, idio
|
|
|
15644
15684
|
inlineRunJavascript,
|
|
15645
15685
|
idiomaticGetters
|
|
15646
15686
|
}),
|
|
15647
|
-
force
|
|
15687
|
+
{ recompute: force, recomputeOnError: true }
|
|
15648
15688
|
);
|
|
15649
15689
|
}).filter((line) => line !== null);
|
|
15650
15690
|
const aliases = activeChildren.map((nested) => nested.alias);
|
|
@@ -15660,15 +15700,13 @@ function renderWaterfallColumns(command, forceAliases, inlineRunJavascript, idio
|
|
|
15660
15700
|
}
|
|
15661
15701
|
return [
|
|
15662
15702
|
...columnSteps,
|
|
15663
|
-
renderColumnStep(
|
|
15664
|
-
|
|
15665
|
-
|
|
15666
|
-
forceParent
|
|
15667
|
-
),
|
|
15703
|
+
renderColumnStep(command.with_waterfall, `(row) => ${returnExpr}`, {
|
|
15704
|
+
recompute: forceParent
|
|
15705
|
+
}),
|
|
15668
15706
|
renderColumnStep(
|
|
15669
15707
|
`${command.with_waterfall}_source`,
|
|
15670
15708
|
typeof command.min_results === "number" ? `(row) => __dlContributingAliases(row, ${stableJson(aliases)})` : `(row) => __dlFirstMeaningfulAlias(row, ${stableJson(aliases)})`,
|
|
15671
|
-
forceParent
|
|
15709
|
+
{ recompute: forceParent }
|
|
15672
15710
|
)
|
|
15673
15711
|
];
|
|
15674
15712
|
}
|
|
@@ -15705,18 +15743,20 @@ function compileEnrichConfigToPlaySource(config, options = {}) {
|
|
|
15705
15743
|
inlineRunJavascript,
|
|
15706
15744
|
idiomaticGetters
|
|
15707
15745
|
}),
|
|
15708
|
-
force
|
|
15746
|
+
{ recompute: force, recomputeOnError: true }
|
|
15709
15747
|
)
|
|
15710
15748
|
);
|
|
15711
15749
|
});
|
|
15712
15750
|
const columnStepSource = columnSteps.length > 0 ? columnSteps.join("\n") : ` .withColumn('noop', () => null)`;
|
|
15713
15751
|
const metadataColumnSource = renderMetadataColumnStep(config);
|
|
15752
|
+
const generatedAliases = collectGeneratedAliases(config.commands);
|
|
15714
15753
|
const body = [
|
|
15715
15754
|
`export default definePlay(${stringLiteral(playName)}, async (ctx, input: EnrichInput) => {`,
|
|
15716
15755
|
` const sourceRows = await ctx.csv<Record<string, unknown>>(input.file);`,
|
|
15717
15756
|
` const rowStart = __dlNonNegativeInteger(input.rowStart, 0);`,
|
|
15718
15757
|
` const rowEndExclusive = Number.isFinite(input.rowEnd) ? Math.max(rowStart, __dlWholeNumber(input.rowEnd, rowStart) + 1) : undefined;`,
|
|
15719
|
-
` const
|
|
15758
|
+
` const selectedRows = sourceRows.slice(rowStart, rowEndExclusive, { key: 'deepline_enrich_selected_rows', sourceLabel: 'Selected enrich rows' });`,
|
|
15759
|
+
` const rows = selectedRows.map((row) => __dlStripErroredGeneratedColumns(row, ${stableJson(generatedAliases)}), { key: 'deepline_enrich_repair_rows', sourceLabel: 'Selected enrich rows' });`,
|
|
15720
15760
|
` const enriched = await ctx`,
|
|
15721
15761
|
` .dataset(${stringLiteral(mapName)}, rows)`,
|
|
15722
15762
|
columnStepSource,
|
|
@@ -15802,6 +15842,18 @@ function helperSource() {
|
|
|
15802
15842
|
` return null;`,
|
|
15803
15843
|
`}`,
|
|
15804
15844
|
``,
|
|
15845
|
+
`function __dlMetadataFromRow(row: Record<string, unknown>): unknown {`,
|
|
15846
|
+
` const direct = __dlParseMetadata(row._metadata);`,
|
|
15847
|
+
` if (direct) return direct;`,
|
|
15848
|
+
` const relocated = __dlParseMetadata(row.metadata);`,
|
|
15849
|
+
` if (relocated) return relocated;`,
|
|
15850
|
+
` const dotted = __dlParseMetadata(row['metadata.columns']);`,
|
|
15851
|
+
` if (dotted) return { columns: dotted };`,
|
|
15852
|
+
` const underscored = __dlParseMetadata(row.metadata__columns);`,
|
|
15853
|
+
` if (underscored) return { columns: underscored };`,
|
|
15854
|
+
` return row._metadata;`,
|
|
15855
|
+
`}`,
|
|
15856
|
+
``,
|
|
15805
15857
|
`function __dlMergeMetadata(existing: unknown, patch: Record<string, unknown>): Record<string, unknown> {`,
|
|
15806
15858
|
` const base = __dlParseMetadata(existing) ?? {};`,
|
|
15807
15859
|
` const baseColumns = __dlRecord(base.columns) ? base.columns : {};`,
|
|
@@ -15876,6 +15928,40 @@ function helperSource() {
|
|
|
15876
15928
|
` return status === 'error' || status === 'failed' || (typeof record.error === 'string' && record.error.trim() !== '') || (typeof resultError === 'string' && resultError.trim() !== '');`,
|
|
15877
15929
|
`}`,
|
|
15878
15930
|
``,
|
|
15931
|
+
`function __dlGeneratedCellError(value: unknown): boolean {`,
|
|
15932
|
+
` if (typeof value === 'string') {`,
|
|
15933
|
+
` const lower = value.trim().toLowerCase();`,
|
|
15934
|
+
` if (!lower) return false;`,
|
|
15935
|
+
` if (lower.startsWith('error:') || lower.includes(': error:') || lower.includes('"error"')) return true;`,
|
|
15936
|
+
` try {`,
|
|
15937
|
+
` return __dlGeneratedCellError(JSON.parse(value));`,
|
|
15938
|
+
` } catch {`,
|
|
15939
|
+
` return false;`,
|
|
15940
|
+
` }`,
|
|
15941
|
+
` }`,
|
|
15942
|
+
` if (!__dlRecord(value)) return false;`,
|
|
15943
|
+
` const status = typeof value.status === 'string' ? value.status.toLowerCase() : '';`,
|
|
15944
|
+
` if (status === 'error' || status === 'failed') return true;`,
|
|
15945
|
+
` if (typeof value.error === 'string' && value.error.trim() !== '') return true;`,
|
|
15946
|
+
` const raw = __dlGetByPath(value, 'toolResponse.raw') ?? __dlGetByPath(value, 'toolOutput.raw');`,
|
|
15947
|
+
` if (raw !== undefined && raw !== value && __dlGeneratedCellError(raw)) return true;`,
|
|
15948
|
+
` const result = value.result;`,
|
|
15949
|
+
` return result !== undefined && result !== value && __dlGeneratedCellError(result);`,
|
|
15950
|
+
`}`,
|
|
15951
|
+
``,
|
|
15952
|
+
`function __dlStripErroredGeneratedColumns(row: Record<string, unknown>, aliases: string[]): Record<string, unknown> {`,
|
|
15953
|
+
` let next: Record<string, unknown> | null = null;`,
|
|
15954
|
+
` for (const alias of aliases) {`,
|
|
15955
|
+
` for (const key of __dlAliasCandidates(alias)) {`,
|
|
15956
|
+
` if (key in row && __dlGeneratedCellError(row[key])) {`,
|
|
15957
|
+
` if (next === null) next = { ...row };`,
|
|
15958
|
+
` delete next[key];`,
|
|
15959
|
+
` }`,
|
|
15960
|
+
` }`,
|
|
15961
|
+
` }`,
|
|
15962
|
+
` return next ?? row;`,
|
|
15963
|
+
`}`,
|
|
15964
|
+
``,
|
|
15879
15965
|
`function __dlRawToolOutput(result: unknown): unknown {`,
|
|
15880
15966
|
` if (!result || typeof result !== 'object') return result;`,
|
|
15881
15967
|
` const record = result as Record<string, unknown>;`,
|
|
@@ -16286,7 +16372,7 @@ function helperSource() {
|
|
|
16286
16372
|
` tool: input.tool,`,
|
|
16287
16373
|
` input: payload,`,
|
|
16288
16374
|
` ...(input.description ? { description: input.description } : {}),`,
|
|
16289
|
-
` ...(input.force ? {
|
|
16375
|
+
` ...(input.force ? { force: true } : {}),`,
|
|
16290
16376
|
` });`,
|
|
16291
16377
|
` return __dlExtract(input.alias, result, input.row, input.extract, Boolean(input.legacyEnvelope));`,
|
|
16292
16378
|
`}`
|
|
@@ -17968,6 +18054,244 @@ Examples:
|
|
|
17968
18054
|
).option("--org-id <id>", "Switch using an explicit organization id").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleOrgSwitch);
|
|
17969
18055
|
}
|
|
17970
18056
|
|
|
18057
|
+
// src/cli/commands/quickstart.ts
|
|
18058
|
+
import { spawn, spawnSync } from "child_process";
|
|
18059
|
+
import { randomBytes } from "crypto";
|
|
18060
|
+
import { createServer } from "http";
|
|
18061
|
+
var EXIT_OK2 = 0;
|
|
18062
|
+
var EXIT_AUTH2 = 1;
|
|
18063
|
+
var EXIT_SERVER3 = 2;
|
|
18064
|
+
var MAX_PROMPT_LENGTH = 8e3;
|
|
18065
|
+
var MAX_BODY_BYTES = 64 * 1024;
|
|
18066
|
+
function shellQuote(arg) {
|
|
18067
|
+
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
18068
|
+
}
|
|
18069
|
+
function hasClaudeBinary() {
|
|
18070
|
+
try {
|
|
18071
|
+
const result = spawnSync("claude", ["--version"], {
|
|
18072
|
+
stdio: "ignore",
|
|
18073
|
+
shell: process.platform === "win32"
|
|
18074
|
+
});
|
|
18075
|
+
return result.status === 0;
|
|
18076
|
+
} catch {
|
|
18077
|
+
return false;
|
|
18078
|
+
}
|
|
18079
|
+
}
|
|
18080
|
+
function launchClaude(prompt) {
|
|
18081
|
+
return new Promise((resolve16) => {
|
|
18082
|
+
const child = spawn("claude", [prompt], {
|
|
18083
|
+
stdio: "inherit",
|
|
18084
|
+
shell: process.platform === "win32"
|
|
18085
|
+
});
|
|
18086
|
+
child.on("error", () => resolve16(EXIT_SERVER3));
|
|
18087
|
+
child.on("close", (status) => resolve16(status ?? EXIT_OK2));
|
|
18088
|
+
});
|
|
18089
|
+
}
|
|
18090
|
+
function readBody(req) {
|
|
18091
|
+
return new Promise((resolve16, reject) => {
|
|
18092
|
+
let raw = "";
|
|
18093
|
+
req.setEncoding("utf8");
|
|
18094
|
+
req.on("data", (chunk) => {
|
|
18095
|
+
raw += chunk;
|
|
18096
|
+
if (raw.length > MAX_BODY_BYTES) {
|
|
18097
|
+
reject(new Error("Request body too large."));
|
|
18098
|
+
req.destroy();
|
|
18099
|
+
}
|
|
18100
|
+
});
|
|
18101
|
+
req.on("end", () => resolve16(raw));
|
|
18102
|
+
req.on("error", reject);
|
|
18103
|
+
});
|
|
18104
|
+
}
|
|
18105
|
+
function writeJson(res, status, payload) {
|
|
18106
|
+
res.writeHead(status, { "content-type": "application/json" });
|
|
18107
|
+
res.end(JSON.stringify(payload));
|
|
18108
|
+
}
|
|
18109
|
+
function startCallbackServer(input2) {
|
|
18110
|
+
const server = createServer((req, res) => {
|
|
18111
|
+
res.setHeader("Access-Control-Allow-Origin", req.headers.origin ?? "*");
|
|
18112
|
+
res.setHeader("Vary", "Origin");
|
|
18113
|
+
res.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
|
18114
|
+
res.setHeader("Access-Control-Allow-Headers", "content-type");
|
|
18115
|
+
res.setHeader("Access-Control-Allow-Private-Network", "true");
|
|
18116
|
+
res.setHeader("Access-Control-Max-Age", "600");
|
|
18117
|
+
if (req.method === "OPTIONS") {
|
|
18118
|
+
res.writeHead(204);
|
|
18119
|
+
res.end();
|
|
18120
|
+
return;
|
|
18121
|
+
}
|
|
18122
|
+
if (req.method !== "POST" || req.url !== "/submit") {
|
|
18123
|
+
writeJson(res, 404, { error: "Not found." });
|
|
18124
|
+
return;
|
|
18125
|
+
}
|
|
18126
|
+
void readBody(req).then((raw) => {
|
|
18127
|
+
let body = null;
|
|
18128
|
+
try {
|
|
18129
|
+
body = JSON.parse(raw);
|
|
18130
|
+
} catch {
|
|
18131
|
+
body = null;
|
|
18132
|
+
}
|
|
18133
|
+
const state = typeof body?.state === "string" ? body.state : "";
|
|
18134
|
+
const prompt = typeof body?.prompt === "string" ? body.prompt.trim() : "";
|
|
18135
|
+
const workflowId = typeof body?.workflow_id === "string" && body.workflow_id.trim() ? body.workflow_id.trim() : null;
|
|
18136
|
+
if (!state || state !== input2.state) {
|
|
18137
|
+
writeJson(res, 403, { error: "Invalid quickstart state token." });
|
|
18138
|
+
return;
|
|
18139
|
+
}
|
|
18140
|
+
if (!prompt) {
|
|
18141
|
+
writeJson(res, 400, { error: "prompt is required." });
|
|
18142
|
+
return;
|
|
18143
|
+
}
|
|
18144
|
+
if (prompt.length > MAX_PROMPT_LENGTH) {
|
|
18145
|
+
writeJson(res, 400, {
|
|
18146
|
+
error: `prompt exceeds ${MAX_PROMPT_LENGTH} characters.`
|
|
18147
|
+
});
|
|
18148
|
+
return;
|
|
18149
|
+
}
|
|
18150
|
+
writeJson(res, 200, { ok: true });
|
|
18151
|
+
setImmediate(() => input2.onSelection({ prompt, workflowId }));
|
|
18152
|
+
}).catch(() => {
|
|
18153
|
+
writeJson(res, 400, { error: "Invalid request body." });
|
|
18154
|
+
});
|
|
18155
|
+
});
|
|
18156
|
+
return new Promise((resolve16, reject) => {
|
|
18157
|
+
server.once("error", reject);
|
|
18158
|
+
server.listen(0, "127.0.0.1", () => {
|
|
18159
|
+
const address = server.address();
|
|
18160
|
+
if (!address || typeof address === "string") {
|
|
18161
|
+
reject(new Error("Failed to bind quickstart callback server."));
|
|
18162
|
+
return;
|
|
18163
|
+
}
|
|
18164
|
+
resolve16({ server, port: address.port });
|
|
18165
|
+
});
|
|
18166
|
+
});
|
|
18167
|
+
}
|
|
18168
|
+
async function handleQuickstart(options) {
|
|
18169
|
+
const jsonOutput = shouldEmitJson(options.json === true);
|
|
18170
|
+
const baseUrl = autoDetectBaseUrl().replace(/\/$/, "");
|
|
18171
|
+
const interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
18172
|
+
let apiKey = resolveApiKeyForBaseUrl(baseUrl);
|
|
18173
|
+
if (!apiKey) {
|
|
18174
|
+
if (interactive) {
|
|
18175
|
+
console.error("Not connected yet \u2014 registering this device first.");
|
|
18176
|
+
const registerExit = await handleRegister([]);
|
|
18177
|
+
if (registerExit !== EXIT_OK2) return registerExit;
|
|
18178
|
+
apiKey = resolveApiKeyForBaseUrl(baseUrl);
|
|
18179
|
+
}
|
|
18180
|
+
if (!apiKey) {
|
|
18181
|
+
console.error("Not connected. Run: deepline auth register");
|
|
18182
|
+
return EXIT_AUTH2;
|
|
18183
|
+
}
|
|
18184
|
+
}
|
|
18185
|
+
const state = randomBytes(32).toString("hex");
|
|
18186
|
+
let resolveSelection;
|
|
18187
|
+
const selectionPromise = new Promise((resolve16) => {
|
|
18188
|
+
resolveSelection = resolve16;
|
|
18189
|
+
});
|
|
18190
|
+
let callback;
|
|
18191
|
+
try {
|
|
18192
|
+
callback = await startCallbackServer({
|
|
18193
|
+
state,
|
|
18194
|
+
onSelection: (selection) => resolveSelection(selection)
|
|
18195
|
+
});
|
|
18196
|
+
} catch (error) {
|
|
18197
|
+
console.error(
|
|
18198
|
+
`Could not start the local quickstart listener: ${error instanceof Error ? error.message : String(error)}`
|
|
18199
|
+
);
|
|
18200
|
+
return EXIT_SERVER3;
|
|
18201
|
+
}
|
|
18202
|
+
const quickstartUrl = `${baseUrl}/cli/quickstart?cb=${callback.port}&state=${state}`;
|
|
18203
|
+
console.error(" Opening the recipe picker in your browser.");
|
|
18204
|
+
console.error(` If it didn't open, cmd+click: ${quickstartUrl}`);
|
|
18205
|
+
if (options.open !== false) {
|
|
18206
|
+
openInBrowser(quickstartUrl);
|
|
18207
|
+
}
|
|
18208
|
+
const timeoutSeconds = Number.parseInt(options.timeout ?? "300", 10);
|
|
18209
|
+
const timeoutMs = (Number.isFinite(timeoutSeconds) && timeoutSeconds > 0 ? timeoutSeconds : 300) * 1e3;
|
|
18210
|
+
const timeoutHandle = setTimeout(
|
|
18211
|
+
() => resolveSelection("timeout"),
|
|
18212
|
+
timeoutMs
|
|
18213
|
+
);
|
|
18214
|
+
const progress = createCliProgress(!jsonOutput);
|
|
18215
|
+
progress.phase("waiting for your pick in the browser (Ctrl+C to skip)");
|
|
18216
|
+
const onSigint = () => resolveSelection("sigint");
|
|
18217
|
+
process.once("SIGINT", onSigint);
|
|
18218
|
+
const outcome = await selectionPromise;
|
|
18219
|
+
clearTimeout(timeoutHandle);
|
|
18220
|
+
process.removeListener("SIGINT", onSigint);
|
|
18221
|
+
callback.server.close();
|
|
18222
|
+
if (outcome === "sigint") {
|
|
18223
|
+
progress.fail();
|
|
18224
|
+
console.error("\nSkipped \u2014 run `deepline quickstart` anytime.");
|
|
18225
|
+
return EXIT_OK2;
|
|
18226
|
+
}
|
|
18227
|
+
if (outcome === "timeout") {
|
|
18228
|
+
progress.fail();
|
|
18229
|
+
console.error(
|
|
18230
|
+
"Timed out waiting for a selection. Run: deepline quickstart"
|
|
18231
|
+
);
|
|
18232
|
+
return EXIT_AUTH2;
|
|
18233
|
+
}
|
|
18234
|
+
progress.complete();
|
|
18235
|
+
const { prompt, workflowId } = outcome;
|
|
18236
|
+
const claudeCommand = `claude ${shellQuote(prompt)}`;
|
|
18237
|
+
const claudeAvailable = hasClaudeBinary();
|
|
18238
|
+
const willLaunch = options.launch !== false && !jsonOutput && interactive && claudeAvailable;
|
|
18239
|
+
printCommandEnvelope(
|
|
18240
|
+
{
|
|
18241
|
+
status: "submitted",
|
|
18242
|
+
workflowId,
|
|
18243
|
+
prompt,
|
|
18244
|
+
claudeCommand,
|
|
18245
|
+
url: quickstartUrl,
|
|
18246
|
+
launched: willLaunch,
|
|
18247
|
+
render: {
|
|
18248
|
+
sections: [
|
|
18249
|
+
{
|
|
18250
|
+
title: "quickstart",
|
|
18251
|
+
lines: [
|
|
18252
|
+
...workflowId ? [`Recipe: ${workflowId}`] : [],
|
|
18253
|
+
willLaunch ? "Launching Claude Code with your recipe..." : claudeAvailable ? "Run the command below to start your recipe." : "Claude Code not found. Install it (https://code.claude.com/docs/en/overview), then run the command below."
|
|
18254
|
+
]
|
|
18255
|
+
}
|
|
18256
|
+
],
|
|
18257
|
+
actions: [{ label: "Run", command: claudeCommand }]
|
|
18258
|
+
}
|
|
18259
|
+
},
|
|
18260
|
+
{ json: jsonOutput }
|
|
18261
|
+
);
|
|
18262
|
+
if (willLaunch) {
|
|
18263
|
+
return launchClaude(prompt);
|
|
18264
|
+
}
|
|
18265
|
+
return EXIT_OK2;
|
|
18266
|
+
}
|
|
18267
|
+
function registerQuickstartCommands(program) {
|
|
18268
|
+
program.command("quickstart").description(
|
|
18269
|
+
"Pick a starter recipe in the browser and launch it with Claude Code."
|
|
18270
|
+
).addHelpText(
|
|
18271
|
+
"after",
|
|
18272
|
+
`
|
|
18273
|
+
Notes:
|
|
18274
|
+
Opens the hosted recipe picker in your browser. The picker sends your
|
|
18275
|
+
selection back to a temporary listener on 127.0.0.1, so the browser must run
|
|
18276
|
+
on the same machine as the CLI. Once a recipe arrives, the CLI prints the
|
|
18277
|
+
matching claude command and, when Claude Code is installed and the shell is
|
|
18278
|
+
interactive, launches it directly. Press Ctrl+C while waiting to skip.
|
|
18279
|
+
|
|
18280
|
+
Examples:
|
|
18281
|
+
deepline quickstart
|
|
18282
|
+
deepline quickstart --no-open
|
|
18283
|
+
deepline quickstart --no-launch --json
|
|
18284
|
+
deepline quickstart --timeout 120
|
|
18285
|
+
`
|
|
18286
|
+
).option("--json", "Emit JSON output. Also automatic when stdout is piped").option("--no-open", "Do not open the browser; print the URL only").option("--no-launch", "Print the claude command instead of launching it").option(
|
|
18287
|
+
"--timeout <seconds>",
|
|
18288
|
+
"Maximum seconds to wait for a selection",
|
|
18289
|
+
"300"
|
|
18290
|
+
).action(async (options) => {
|
|
18291
|
+
process.exitCode = await handleQuickstart(options);
|
|
18292
|
+
});
|
|
18293
|
+
}
|
|
18294
|
+
|
|
17971
18295
|
// src/cli/commands/secrets.ts
|
|
17972
18296
|
import { stdin as input, stdout as output } from "process";
|
|
17973
18297
|
var hiddenInputBuffer = "";
|
|
@@ -19985,7 +20309,7 @@ function parseExecuteOptions(args) {
|
|
|
19985
20309
|
function safeFileStem(value) {
|
|
19986
20310
|
return value.trim().replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64) || "tool";
|
|
19987
20311
|
}
|
|
19988
|
-
function
|
|
20312
|
+
function shellQuote2(value) {
|
|
19989
20313
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
19990
20314
|
}
|
|
19991
20315
|
function powerShellQuote(value) {
|
|
@@ -20037,7 +20361,7 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
|
|
|
20037
20361
|
path: scriptPath,
|
|
20038
20362
|
sourceCode: script,
|
|
20039
20363
|
projectDir,
|
|
20040
|
-
macCopyCommand: `mkdir -p ${
|
|
20364
|
+
macCopyCommand: `mkdir -p ${shellQuote2(projectDir)} && cp ${shellQuote2(scriptPath)} ${shellQuote2(`${projectDir}/${fileName}`)}`,
|
|
20041
20365
|
windowsCopyCommand: `New-Item -ItemType Directory -Force -Path ${powerShellQuote(projectDir.replace(/\//g, "\\"))} | Out-Null; Copy-Item -LiteralPath ${powerShellQuote(scriptPath)} -Destination ${powerShellQuote(`${projectDir.replace(/\//g, "\\")}\\${fileName}`)}`
|
|
20042
20366
|
};
|
|
20043
20367
|
}
|
|
@@ -20056,7 +20380,7 @@ function buildToolExecuteBaseEnvelope(input2) {
|
|
|
20056
20380
|
summary: input2.summary
|
|
20057
20381
|
};
|
|
20058
20382
|
const envelopeHasCanonicalOutput = isRecord7(envelope.toolResponse) && Object.prototype.hasOwnProperty.call(envelope.toolResponse, "raw");
|
|
20059
|
-
const inspectCommand = `deepline tools execute ${input2.toolId} --input ${
|
|
20383
|
+
const inspectCommand = `deepline tools execute ${input2.toolId} --input ${shellQuote2(JSON.stringify(input2.params))} --json`;
|
|
20060
20384
|
const actions = input2.listConversion ? [
|
|
20061
20385
|
{
|
|
20062
20386
|
label: "next",
|
|
@@ -20775,7 +21099,7 @@ Notes:
|
|
|
20775
21099
|
}
|
|
20776
21100
|
|
|
20777
21101
|
// src/cli/commands/update.ts
|
|
20778
|
-
import { spawn } from "child_process";
|
|
21102
|
+
import { spawn as spawn2 } from "child_process";
|
|
20779
21103
|
import { existsSync as existsSync10 } from "fs";
|
|
20780
21104
|
import { dirname as dirname11, join as join13, resolve as resolve15 } from "path";
|
|
20781
21105
|
function posixShellQuote(value) {
|
|
@@ -20784,14 +21108,14 @@ function posixShellQuote(value) {
|
|
|
20784
21108
|
function windowsCmdQuote(value) {
|
|
20785
21109
|
return `"${value.replace(/"/g, '""')}"`;
|
|
20786
21110
|
}
|
|
20787
|
-
function
|
|
21111
|
+
function shellQuote3(value) {
|
|
20788
21112
|
if (process.platform === "win32") {
|
|
20789
21113
|
return /^[A-Za-z0-9_./:@%+=,-]+$/.test(value) ? value : windowsCmdQuote(value);
|
|
20790
21114
|
}
|
|
20791
21115
|
return posixShellQuote(value);
|
|
20792
21116
|
}
|
|
20793
21117
|
function buildSourceUpdateCommand(sourceRoot) {
|
|
20794
|
-
const quotedRoot =
|
|
21118
|
+
const quotedRoot = shellQuote3(sourceRoot);
|
|
20795
21119
|
const cdCommand = process.platform === "win32" ? `cd /d ${quotedRoot}` : `cd ${quotedRoot}`;
|
|
20796
21120
|
return `${cdCommand} && git fetch origin main --tags && git merge --ff-only origin/main`;
|
|
20797
21121
|
}
|
|
@@ -20822,12 +21146,12 @@ function resolveUpdatePlan() {
|
|
|
20822
21146
|
kind: "npm-global",
|
|
20823
21147
|
command,
|
|
20824
21148
|
args,
|
|
20825
|
-
manualCommand: `${command} ${args.map(
|
|
21149
|
+
manualCommand: `${command} ${args.map(shellQuote3).join(" ")}`
|
|
20826
21150
|
};
|
|
20827
21151
|
}
|
|
20828
21152
|
function runCommand(command, args) {
|
|
20829
21153
|
return new Promise((resolveExitCode) => {
|
|
20830
|
-
const child =
|
|
21154
|
+
const child = spawn2(command, args, {
|
|
20831
21155
|
stdio: "inherit",
|
|
20832
21156
|
shell: process.platform === "win32",
|
|
20833
21157
|
env: process.env
|
|
@@ -20842,6 +21166,12 @@ function runCommand(command, args) {
|
|
|
20842
21166
|
});
|
|
20843
21167
|
});
|
|
20844
21168
|
}
|
|
21169
|
+
async function runNpmGlobalUpdatePlan(plan) {
|
|
21170
|
+
if (plan.kind !== "npm-global") {
|
|
21171
|
+
return 1;
|
|
21172
|
+
}
|
|
21173
|
+
return runCommand(plan.command, plan.args);
|
|
21174
|
+
}
|
|
20845
21175
|
async function handleUpdate(options) {
|
|
20846
21176
|
const plan = resolveUpdatePlan();
|
|
20847
21177
|
const render = {
|
|
@@ -20988,16 +21318,27 @@ function skillsIndexUrl(baseUrl) {
|
|
|
20988
21318
|
return `${normalizeBaseUrl2(baseUrl)}${INSTALL_COMMANDS.skills.index_path}`;
|
|
20989
21319
|
}
|
|
20990
21320
|
function buildSkillsAddArgs(baseUrl, skillName, options = {}) {
|
|
21321
|
+
const skillNames = Array.isArray(skillName) ? skillName : [skillName];
|
|
21322
|
+
const [firstSkillName, ...extraSkillNames] = skillNames;
|
|
20991
21323
|
const values = {
|
|
20992
21324
|
skills_index_url: skillsIndexUrl(baseUrl),
|
|
20993
21325
|
agents: INSTALL_COMMANDS.skills.default_agents.join(" "),
|
|
20994
|
-
skill_name:
|
|
21326
|
+
skill_name: firstSkillName ?? ""
|
|
20995
21327
|
};
|
|
20996
21328
|
const rendered = INSTALL_COMMANDS.skills.npx_add_args_template.flatMap(
|
|
20997
21329
|
(arg, index) => {
|
|
20998
21330
|
const next = index === 0 && options.firstArg ? options.firstArg : arg;
|
|
20999
21331
|
const value = renderTemplate(next, values);
|
|
21000
|
-
|
|
21332
|
+
if (arg === "{agents}") {
|
|
21333
|
+
return INSTALL_COMMANDS.skills.default_agents;
|
|
21334
|
+
}
|
|
21335
|
+
if (arg === "{skill_name}") {
|
|
21336
|
+
return [
|
|
21337
|
+
value,
|
|
21338
|
+
...extraSkillNames.flatMap((name) => ["--skill", name])
|
|
21339
|
+
];
|
|
21340
|
+
}
|
|
21341
|
+
return value;
|
|
21001
21342
|
}
|
|
21002
21343
|
);
|
|
21003
21344
|
return rendered;
|
|
@@ -21068,8 +21409,72 @@ function unknownCommandNameFromMessage(message) {
|
|
|
21068
21409
|
return command ? command : null;
|
|
21069
21410
|
}
|
|
21070
21411
|
|
|
21412
|
+
// src/cli/self-update.ts
|
|
21413
|
+
import { spawn as spawn3 } from "child_process";
|
|
21414
|
+
function envTruthy(name) {
|
|
21415
|
+
const value = process.env[name]?.trim().toLowerCase();
|
|
21416
|
+
return value === "1" || value === "true" || value === "yes";
|
|
21417
|
+
}
|
|
21418
|
+
function isCi() {
|
|
21419
|
+
return envTruthy("CI") || envTruthy("GITHUB_ACTIONS");
|
|
21420
|
+
}
|
|
21421
|
+
function shouldSkipSelfUpdate() {
|
|
21422
|
+
return envTruthy("DEEPLINE_SKIP_SELF_UPDATE") || envTruthy("DEEPLINE_NO_AUTO_UPDATE") || envTruthy("DEEPLINE_SKIP_SDK_AUTO_UPDATE") || envTruthy("DEEPLINE_DISABLE_AUTO_UPDATE") || isCi();
|
|
21423
|
+
}
|
|
21424
|
+
function relaunchCurrentCommand() {
|
|
21425
|
+
return new Promise((resolve16) => {
|
|
21426
|
+
const child = spawn3(process.execPath, process.argv.slice(1), {
|
|
21427
|
+
stdio: "inherit",
|
|
21428
|
+
env: {
|
|
21429
|
+
...process.env,
|
|
21430
|
+
DEEPLINE_NO_AUTO_UPDATE: "1"
|
|
21431
|
+
}
|
|
21432
|
+
});
|
|
21433
|
+
child.on("error", (error) => {
|
|
21434
|
+
process.stderr.write(
|
|
21435
|
+
`Deepline SDK/CLI updated, but relaunch failed: ${error.message}
|
|
21436
|
+
`
|
|
21437
|
+
);
|
|
21438
|
+
resolve16(1);
|
|
21439
|
+
});
|
|
21440
|
+
child.on("close", (code) => resolve16(code ?? 1));
|
|
21441
|
+
});
|
|
21442
|
+
}
|
|
21443
|
+
async function maybeAutoUpdateAndRelaunch(response) {
|
|
21444
|
+
const autoUpdate = response?.auto_update;
|
|
21445
|
+
if (!response || !autoUpdate?.should_auto_update || shouldSkipSelfUpdate()) {
|
|
21446
|
+
return false;
|
|
21447
|
+
}
|
|
21448
|
+
const plan = resolveUpdatePlan();
|
|
21449
|
+
if (plan.kind !== "npm-global") {
|
|
21450
|
+
return false;
|
|
21451
|
+
}
|
|
21452
|
+
const label = autoUpdate.required ? "requires an update" : "is more than the supported auto-update lag behind";
|
|
21453
|
+
process.stderr.write(
|
|
21454
|
+
`Deepline SDK/CLI ${label}; running ${plan.manualCommand}
|
|
21455
|
+
`
|
|
21456
|
+
);
|
|
21457
|
+
const updateExitCode = await runNpmGlobalUpdatePlan(plan);
|
|
21458
|
+
if (updateExitCode !== 0) {
|
|
21459
|
+
if (autoUpdate.required) {
|
|
21460
|
+
throw new Error(
|
|
21461
|
+
`Automatic Deepline SDK/CLI update failed with exit code ${updateExitCode}. ${response.message}`
|
|
21462
|
+
);
|
|
21463
|
+
}
|
|
21464
|
+
process.stderr.write(
|
|
21465
|
+
`Deepline SDK/CLI auto-update failed with exit code ${updateExitCode}; continuing with ${response.current ?? "current version"}.
|
|
21466
|
+
`
|
|
21467
|
+
);
|
|
21468
|
+
return false;
|
|
21469
|
+
}
|
|
21470
|
+
process.stderr.write("Deepline SDK/CLI updated; rerunning command.\n");
|
|
21471
|
+
const exitCode = await relaunchCurrentCommand();
|
|
21472
|
+
process.exit(exitCode);
|
|
21473
|
+
return true;
|
|
21474
|
+
}
|
|
21475
|
+
|
|
21071
21476
|
// src/cli/skills-sync.ts
|
|
21072
|
-
import { spawn as
|
|
21477
|
+
import { spawn as spawn4, spawnSync as spawnSync2 } from "child_process";
|
|
21073
21478
|
import {
|
|
21074
21479
|
existsSync as existsSync11,
|
|
21075
21480
|
mkdirSync as mkdirSync6,
|
|
@@ -21082,6 +21487,7 @@ import { homedir as homedir7 } from "os";
|
|
|
21082
21487
|
import { dirname as dirname12, join as join14 } from "path";
|
|
21083
21488
|
var CHECK_TIMEOUT_MS2 = 3e3;
|
|
21084
21489
|
var SDK_SKILL_NAME = "deepline-plays";
|
|
21490
|
+
var SDK_SKILL_NAMES = [SDK_SKILL_NAME, "deepline-plays-quickstart"];
|
|
21085
21491
|
var attemptedSync = false;
|
|
21086
21492
|
function shouldSkipSkillsSync() {
|
|
21087
21493
|
const value = process.env.DEEPLINE_SKIP_SKILLS_SYNC?.trim().toLowerCase();
|
|
@@ -21198,19 +21604,19 @@ async function fetchSkillsUpdate(baseUrl, localVersion) {
|
|
|
21198
21604
|
}
|
|
21199
21605
|
}
|
|
21200
21606
|
function buildSkillsInstallArgs(baseUrl) {
|
|
21201
|
-
return buildSkillsAddArgs(baseUrl,
|
|
21607
|
+
return buildSkillsAddArgs(baseUrl, SDK_SKILL_NAMES);
|
|
21202
21608
|
}
|
|
21203
21609
|
function buildBunxSkillsInstallArgs(baseUrl) {
|
|
21204
|
-
return buildSkillsAddArgs(baseUrl,
|
|
21610
|
+
return buildSkillsAddArgs(baseUrl, SDK_SKILL_NAMES, { firstArg: "--bun" });
|
|
21205
21611
|
}
|
|
21206
21612
|
function hasCommand(command) {
|
|
21207
|
-
const result =
|
|
21613
|
+
const result = spawnSync2(command, ["--version"], {
|
|
21208
21614
|
stdio: "ignore",
|
|
21209
21615
|
shell: process.platform === "win32"
|
|
21210
21616
|
});
|
|
21211
21617
|
return result.status === 0;
|
|
21212
21618
|
}
|
|
21213
|
-
function
|
|
21619
|
+
function shellQuote4(arg) {
|
|
21214
21620
|
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
21215
21621
|
}
|
|
21216
21622
|
function resolveSkillsInstallCommands(baseUrl) {
|
|
@@ -21218,7 +21624,7 @@ function resolveSkillsInstallCommands(baseUrl) {
|
|
|
21218
21624
|
const npxInstall = {
|
|
21219
21625
|
command: "npx",
|
|
21220
21626
|
args: npxArgs,
|
|
21221
|
-
manualCommand: `npx ${npxArgs.map(
|
|
21627
|
+
manualCommand: `npx ${npxArgs.map(shellQuote4).join(" ")}`
|
|
21222
21628
|
};
|
|
21223
21629
|
if (hasCommand("bunx")) {
|
|
21224
21630
|
const bunxArgs = buildBunxSkillsInstallArgs(baseUrl);
|
|
@@ -21226,7 +21632,7 @@ function resolveSkillsInstallCommands(baseUrl) {
|
|
|
21226
21632
|
{
|
|
21227
21633
|
command: "bunx",
|
|
21228
21634
|
args: bunxArgs,
|
|
21229
|
-
manualCommand: `bunx ${bunxArgs.map(
|
|
21635
|
+
manualCommand: `bunx ${bunxArgs.map(shellQuote4).join(" ")}`
|
|
21230
21636
|
},
|
|
21231
21637
|
npxInstall
|
|
21232
21638
|
];
|
|
@@ -21235,7 +21641,7 @@ function resolveSkillsInstallCommands(baseUrl) {
|
|
|
21235
21641
|
}
|
|
21236
21642
|
function runOneSkillsInstall(install) {
|
|
21237
21643
|
return new Promise((resolve16) => {
|
|
21238
|
-
const child =
|
|
21644
|
+
const child = spawn4(install.command, install.args, {
|
|
21239
21645
|
stdio: ["ignore", "ignore", "pipe"],
|
|
21240
21646
|
env: process.env
|
|
21241
21647
|
});
|
|
@@ -21303,7 +21709,7 @@ async function syncSdkSkillsIfNeeded(baseUrl) {
|
|
|
21303
21709
|
if (!update?.needsUpdate && !hasStaleInstalledSkill || !update?.remoteVersion) {
|
|
21304
21710
|
return;
|
|
21305
21711
|
}
|
|
21306
|
-
writeSdkSkillsStatusLine("SDK skills changed; syncing
|
|
21712
|
+
writeSdkSkillsStatusLine("SDK skills changed; syncing Deepline SDK skills...");
|
|
21307
21713
|
const installed = await runSkillsInstall(baseUrl);
|
|
21308
21714
|
if (!installed) return;
|
|
21309
21715
|
if (installedSdkSkillHasStalePositionalExecuteExamples()) {
|
|
@@ -21526,7 +21932,9 @@ async function main() {
|
|
|
21526
21932
|
progress?.phase("loading deepline cli");
|
|
21527
21933
|
}
|
|
21528
21934
|
const program = new Command3();
|
|
21529
|
-
program.name("deepline").description(
|
|
21935
|
+
program.name("deepline").description(
|
|
21936
|
+
"Deepline CLI \u2014 GTM enrichment tools, plays, and runs from your terminal."
|
|
21937
|
+
).version(SDK_VERSION, "-v, --version", "Show version").exitOverride().showHelpAfterError().showSuggestionAfterError(true).addHelpText(
|
|
21530
21938
|
"after",
|
|
21531
21939
|
`
|
|
21532
21940
|
Common commands:
|
|
@@ -21567,11 +21975,23 @@ Exit codes:
|
|
|
21567
21975
|
progress?.phase("checking sdk compatibility");
|
|
21568
21976
|
}
|
|
21569
21977
|
const baseUrl = autoDetectBaseUrl().replace(/\/$/, "");
|
|
21570
|
-
await traceCliSpan(
|
|
21978
|
+
const compatibility = await traceCliSpan(
|
|
21571
21979
|
"cli.sdk_compatibility",
|
|
21572
|
-
{ baseUrl },
|
|
21573
|
-
() =>
|
|
21980
|
+
{ baseUrl, command: actionCommand.name() },
|
|
21981
|
+
() => checkSdkCompatibility(baseUrl, {
|
|
21982
|
+
command: actionCommand.name()
|
|
21983
|
+
})
|
|
21984
|
+
);
|
|
21985
|
+
if (compatibility.error) {
|
|
21986
|
+
return;
|
|
21987
|
+
}
|
|
21988
|
+
const relaunched = await maybeAutoUpdateAndRelaunch(
|
|
21989
|
+
compatibility.response
|
|
21574
21990
|
);
|
|
21991
|
+
if (relaunched) {
|
|
21992
|
+
return;
|
|
21993
|
+
}
|
|
21994
|
+
enforceSdkCompatibilityResponse(compatibility.response);
|
|
21575
21995
|
if (printStartupPhase) {
|
|
21576
21996
|
progress?.phase("checking sdk skills");
|
|
21577
21997
|
}
|
|
@@ -21596,6 +22016,7 @@ Exit codes:
|
|
|
21596
22016
|
registerDbCommands(program);
|
|
21597
22017
|
registerFeedbackCommands(program);
|
|
21598
22018
|
registerUpdateCommand(program);
|
|
22019
|
+
registerQuickstartCommands(program);
|
|
21599
22020
|
program.command("preflight").description("Run compact health, auth, and Deepline billing checks.").option("--json", "Force JSON output.").addHelpText(
|
|
21600
22021
|
"after",
|
|
21601
22022
|
`
|
|
@@ -21671,6 +22092,29 @@ Examples:
|
|
|
21671
22092
|
process.stdout.write(`deepline ${SDK_VERSION}
|
|
21672
22093
|
`);
|
|
21673
22094
|
});
|
|
22095
|
+
if (process.argv.slice(2).length === 0) {
|
|
22096
|
+
if (!process.stdout.isTTY) {
|
|
22097
|
+
printJson({
|
|
22098
|
+
ok: false,
|
|
22099
|
+
exitCode: 2,
|
|
22100
|
+
code: "MISSING_COMMAND",
|
|
22101
|
+
message: "No command provided.",
|
|
22102
|
+
next: "deepline --help"
|
|
22103
|
+
});
|
|
22104
|
+
console.error("error: missing command (see: deepline --help)");
|
|
22105
|
+
} else {
|
|
22106
|
+
program.outputHelp({ error: true });
|
|
22107
|
+
console.error("\nerror: missing command (see usage above)");
|
|
22108
|
+
}
|
|
22109
|
+
recordCliTrace({
|
|
22110
|
+
phase: "cli.main_total",
|
|
22111
|
+
ms: Date.now() - mainStartedAt,
|
|
22112
|
+
ok: false,
|
|
22113
|
+
error: "missing command"
|
|
22114
|
+
});
|
|
22115
|
+
process.exitCode = 2;
|
|
22116
|
+
return;
|
|
22117
|
+
}
|
|
21674
22118
|
try {
|
|
21675
22119
|
await program.parseAsync(process.argv);
|
|
21676
22120
|
recordCliTrace({
|