deepline 0.2.71 → 0.2.73
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/bundling-sources/sdk/src/client.ts +8 -2
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +67 -14
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +55 -14
- package/dist/cli/index.js +311 -29
- package/dist/cli/index.mjs +348 -58
- package/dist/index.d.mts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +43 -16
- package/dist/index.mjs +43 -16
- package/dist/plays/bundle-play-file.mjs +35 -14
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -1030,7 +1030,7 @@ var SDK_RELEASE = {
|
|
|
1030
1030
|
// 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
|
|
1031
1031
|
// exposed storage-dependent synchronous access. This deliberate minor
|
|
1032
1032
|
// release keeps lazy paging semantics independent of row residency.
|
|
1033
|
-
version: "0.2.
|
|
1033
|
+
version: "0.2.73",
|
|
1034
1034
|
contracts: {
|
|
1035
1035
|
api: {
|
|
1036
1036
|
name: "sdk-http-api",
|
|
@@ -5978,9 +5978,10 @@ var DeeplineClient = class {
|
|
|
5978
5978
|
* console.log(`Total runs: ${detail.play.runCount}`);
|
|
5979
5979
|
* ```
|
|
5980
5980
|
*/
|
|
5981
|
-
async getPlay(name) {
|
|
5981
|
+
async getPlay(name, options) {
|
|
5982
5982
|
const encodedName = encodeURIComponent(name);
|
|
5983
|
-
|
|
5983
|
+
const query = options?.source ? `?include=source&revision=${encodeURIComponent(options.source)}` : "";
|
|
5984
|
+
return this.http.get(`/api/v2/plays/${encodedName}${query}`);
|
|
5984
5985
|
}
|
|
5985
5986
|
/**
|
|
5986
5987
|
* Get a normalized play description suitable for agents and CLIs.
|
|
@@ -11023,6 +11024,7 @@ import { Option } from "commander";
|
|
|
11023
11024
|
import { createHash as createHash4, randomUUID as randomUUID3 } from "crypto";
|
|
11024
11025
|
import {
|
|
11025
11026
|
existsSync as existsSync9,
|
|
11027
|
+
mkdirSync as mkdirSync6,
|
|
11026
11028
|
readFileSync as readFileSync8,
|
|
11027
11029
|
readdirSync as readdirSync2,
|
|
11028
11030
|
realpathSync as realpathSync2,
|
|
@@ -11036,7 +11038,14 @@ import {
|
|
|
11036
11038
|
readFile as readFileAsync,
|
|
11037
11039
|
unlink
|
|
11038
11040
|
} from "fs/promises";
|
|
11039
|
-
import {
|
|
11041
|
+
import {
|
|
11042
|
+
basename as basename3,
|
|
11043
|
+
dirname as dirname9,
|
|
11044
|
+
isAbsolute as isAbsolute5,
|
|
11045
|
+
join as join10,
|
|
11046
|
+
relative as relative4,
|
|
11047
|
+
resolve as resolve11
|
|
11048
|
+
} from "path";
|
|
11040
11049
|
import { parse as parseCsvSync2 } from "csv-parse/sync";
|
|
11041
11050
|
|
|
11042
11051
|
// src/cli/commands/plays/bootstrap.ts
|
|
@@ -18643,7 +18652,10 @@ async function assertCanonicalNamedPlayReference(client2, target, options = {})
|
|
|
18643
18652
|
const parsed = parseReferencedPlayTarget2(target);
|
|
18644
18653
|
let detail;
|
|
18645
18654
|
try {
|
|
18646
|
-
detail = await client2.getPlay(
|
|
18655
|
+
detail = await client2.getPlay(
|
|
18656
|
+
parsed.playName,
|
|
18657
|
+
options.source ? { source: options.source } : void 0
|
|
18658
|
+
);
|
|
18647
18659
|
} catch (error) {
|
|
18648
18660
|
if (isPlayNotFoundError(error)) {
|
|
18649
18661
|
throw await buildPlayReferenceNotFoundError({
|
|
@@ -18696,19 +18708,54 @@ function materializeRemotePlaySource(input2) {
|
|
|
18696
18708
|
if (isFileTarget(input2.target)) {
|
|
18697
18709
|
return null;
|
|
18698
18710
|
}
|
|
18699
|
-
|
|
18711
|
+
const entrySource = input2.source.files[input2.source.entryFile];
|
|
18712
|
+
if (!entrySource?.trim()) {
|
|
18700
18713
|
return null;
|
|
18701
18714
|
}
|
|
18715
|
+
const files = Object.entries(input2.source.files);
|
|
18716
|
+
if (files.length > 1) {
|
|
18717
|
+
if (!input2.outPath) {
|
|
18718
|
+
throw new Error(
|
|
18719
|
+
`Play ${input2.playName} has ${files.length} source files. Use --out <directory> to write the complete bundle.`
|
|
18720
|
+
);
|
|
18721
|
+
}
|
|
18722
|
+
const outputDirectory = resolve11(input2.outPath);
|
|
18723
|
+
let created = 0;
|
|
18724
|
+
let updated = 0;
|
|
18725
|
+
for (const [logicalPath, sourceCode] of files) {
|
|
18726
|
+
const outputPath2 = resolve11(outputDirectory, logicalPath);
|
|
18727
|
+
const outputRelativePath = relative4(outputDirectory, outputPath2);
|
|
18728
|
+
if (!outputRelativePath || outputRelativePath.startsWith("..") || isAbsolute5(outputRelativePath)) {
|
|
18729
|
+
throw new Error(
|
|
18730
|
+
`Refusing to materialize unsafe Play source path ${JSON.stringify(logicalPath)}.`
|
|
18731
|
+
);
|
|
18732
|
+
}
|
|
18733
|
+
mkdirSync6(dirname9(outputPath2), { recursive: true });
|
|
18734
|
+
if (!existsSync9(outputPath2)) {
|
|
18735
|
+
writeFileSync9(outputPath2, sourceCode, "utf-8");
|
|
18736
|
+
created += 1;
|
|
18737
|
+
} else if (readFileSync8(outputPath2, "utf-8") !== sourceCode) {
|
|
18738
|
+
writeFileSync9(outputPath2, sourceCode, "utf-8");
|
|
18739
|
+
updated += 1;
|
|
18740
|
+
}
|
|
18741
|
+
}
|
|
18742
|
+
return {
|
|
18743
|
+
path: outputDirectory,
|
|
18744
|
+
status: created > 0 ? "created" : updated > 0 ? "updated" : "unchanged",
|
|
18745
|
+
created: created > 0,
|
|
18746
|
+
fileCount: files.length
|
|
18747
|
+
};
|
|
18748
|
+
}
|
|
18702
18749
|
const outputPath = input2.outPath ?? defaultMaterializedPlayPath(input2.playName);
|
|
18703
18750
|
if (existsSync9(outputPath)) {
|
|
18704
18751
|
const existingSource = readFileSync8(outputPath, "utf-8");
|
|
18705
|
-
if (existingSource ===
|
|
18752
|
+
if (existingSource === entrySource) {
|
|
18706
18753
|
return { path: outputPath, status: "unchanged", created: false };
|
|
18707
18754
|
}
|
|
18708
|
-
writeFileSync9(outputPath,
|
|
18755
|
+
writeFileSync9(outputPath, entrySource, "utf-8");
|
|
18709
18756
|
return { path: outputPath, status: "updated", created: false };
|
|
18710
18757
|
}
|
|
18711
|
-
writeFileSync9(outputPath,
|
|
18758
|
+
writeFileSync9(outputPath, entrySource, "utf-8");
|
|
18712
18759
|
return { path: outputPath, status: "created", created: true };
|
|
18713
18760
|
}
|
|
18714
18761
|
function formatLoadedPlayMessage(materializedFile) {
|
|
@@ -22581,6 +22628,47 @@ ${PLAY_PUBLISH_USAGE}`
|
|
|
22581
22628
|
jsonOutput: argsWantJson(args)
|
|
22582
22629
|
};
|
|
22583
22630
|
}
|
|
22631
|
+
var PLAY_SAVE_USAGE = "Usage: deepline plays save <play-file.ts> [--expected-artifact <hash>] [--dry-run] [--json]";
|
|
22632
|
+
function parsePlaySaveOptions(args) {
|
|
22633
|
+
const target = args[0];
|
|
22634
|
+
if (!target) throw new Error(PLAY_SAVE_USAGE);
|
|
22635
|
+
if (target.startsWith("-")) {
|
|
22636
|
+
throw new Error(`${PLAY_SAVE_USAGE}
|
|
22637
|
+
The Play file is positional.`);
|
|
22638
|
+
}
|
|
22639
|
+
let expectedArtifactHash;
|
|
22640
|
+
let dryRun = false;
|
|
22641
|
+
for (let index = 1; index < args.length; index += 1) {
|
|
22642
|
+
const arg = args[index];
|
|
22643
|
+
if (arg === "--expected-artifact") {
|
|
22644
|
+
expectedArtifactHash = args[++index];
|
|
22645
|
+
if (!expectedArtifactHash) {
|
|
22646
|
+
throw new Error("--expected-artifact requires an artifact hash.");
|
|
22647
|
+
}
|
|
22648
|
+
continue;
|
|
22649
|
+
}
|
|
22650
|
+
if (arg.startsWith("--expected-artifact=")) {
|
|
22651
|
+
expectedArtifactHash = arg.slice("--expected-artifact=".length);
|
|
22652
|
+
if (!expectedArtifactHash) {
|
|
22653
|
+
throw new Error("--expected-artifact requires an artifact hash.");
|
|
22654
|
+
}
|
|
22655
|
+
continue;
|
|
22656
|
+
}
|
|
22657
|
+
if (arg === "--dry-run") {
|
|
22658
|
+
dryRun = true;
|
|
22659
|
+
continue;
|
|
22660
|
+
}
|
|
22661
|
+
if (arg === "--json") continue;
|
|
22662
|
+
throw new Error(`Unknown option: ${arg}
|
|
22663
|
+
${PLAY_SAVE_USAGE}`);
|
|
22664
|
+
}
|
|
22665
|
+
return {
|
|
22666
|
+
target,
|
|
22667
|
+
expectedArtifactHash,
|
|
22668
|
+
dryRun,
|
|
22669
|
+
jsonOutput: argsWantJson(args)
|
|
22670
|
+
};
|
|
22671
|
+
}
|
|
22584
22672
|
function formatByteBudget(usedBytes, limitBytes) {
|
|
22585
22673
|
return `${usedBytes.toLocaleString()} B / ${limitBytes.toLocaleString()} B`;
|
|
22586
22674
|
}
|
|
@@ -24044,24 +24132,63 @@ async function handlePlayGet(args) {
|
|
|
24044
24132
|
const explicitJson = args.includes("--json");
|
|
24045
24133
|
const sourceOutput = args.includes("--source");
|
|
24046
24134
|
const jsonOutput = sourceOutput ? explicitJson : argsWantJson(args);
|
|
24135
|
+
const requestedRevisionFlags = [
|
|
24136
|
+
args.includes("--working"),
|
|
24137
|
+
args.includes("--live"),
|
|
24138
|
+
args.includes("--revision")
|
|
24139
|
+
].filter(Boolean).length;
|
|
24140
|
+
if (requestedRevisionFlags > 1) {
|
|
24141
|
+
console.error("Use only one of --working, --live, or --revision <number>.");
|
|
24142
|
+
return 2;
|
|
24143
|
+
}
|
|
24144
|
+
let sourceSelector = "working";
|
|
24145
|
+
if (args.includes("--live")) {
|
|
24146
|
+
sourceSelector = "live";
|
|
24147
|
+
}
|
|
24047
24148
|
let outPath = null;
|
|
24149
|
+
let requestedVersion = null;
|
|
24048
24150
|
for (let index = 1; index < args.length; index += 1) {
|
|
24049
24151
|
const arg = args[index];
|
|
24050
24152
|
if (arg === "--out" && args[index + 1]) {
|
|
24051
24153
|
outPath = resolve11(args[++index]);
|
|
24052
24154
|
}
|
|
24155
|
+
if (arg === "--revision") {
|
|
24156
|
+
const rawVersion = args[++index];
|
|
24157
|
+
const version = Number(rawVersion);
|
|
24158
|
+
if (!rawVersion || !Number.isInteger(version) || version < 1) {
|
|
24159
|
+
console.error("--revision must be a positive integer.");
|
|
24160
|
+
return 2;
|
|
24161
|
+
}
|
|
24162
|
+
requestedVersion = version;
|
|
24163
|
+
}
|
|
24164
|
+
}
|
|
24165
|
+
if (requestedVersion !== null) {
|
|
24166
|
+
sourceSelector = `version:${requestedVersion}`;
|
|
24167
|
+
}
|
|
24168
|
+
if (requestedRevisionFlags > 0 && !sourceOutput && !outPath) {
|
|
24169
|
+
console.error(
|
|
24170
|
+
"--working, --live, and --revision only apply when reading source with --source or --out."
|
|
24171
|
+
);
|
|
24172
|
+
return 2;
|
|
24053
24173
|
}
|
|
24054
24174
|
const playName = isFileTarget(target) ? extractPlayName(readFileSync8(resolve11(target), "utf-8"), resolve11(target)) : parseReferencedPlayTarget2(target).playName;
|
|
24055
|
-
const
|
|
24056
|
-
|
|
24057
|
-
});
|
|
24058
|
-
const resolvedSource = detail.play.workingRevision?.sourceCode ?? detail.play.liveRevision?.sourceCode ?? detail.play.currentRevision?.sourceCode ?? detail.play.sourceCode ?? "";
|
|
24059
|
-
const materializedFile = outPath ? materializeRemotePlaySource({
|
|
24060
|
-
target,
|
|
24175
|
+
const includeSource = sourceOutput || outPath !== null;
|
|
24176
|
+
const detail = isFileTarget(target) ? await client2.getPlay(
|
|
24061
24177
|
playName,
|
|
24062
|
-
|
|
24063
|
-
|
|
24064
|
-
|
|
24178
|
+
includeSource ? { source: sourceSelector } : void 0
|
|
24179
|
+
) : await assertCanonicalNamedPlayReference(client2, target, {
|
|
24180
|
+
command: "get",
|
|
24181
|
+
...includeSource ? { source: sourceSelector } : {}
|
|
24182
|
+
});
|
|
24183
|
+
const source = detail.source;
|
|
24184
|
+
const resolvedSource = source?.files[source.entryFile] ?? "";
|
|
24185
|
+
let materializedFile = null;
|
|
24186
|
+
try {
|
|
24187
|
+
materializedFile = outPath && source ? materializeRemotePlaySource({ target, playName, source, outPath }) : null;
|
|
24188
|
+
} catch (error) {
|
|
24189
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
24190
|
+
return 2;
|
|
24191
|
+
}
|
|
24065
24192
|
const loadedMessage = materializedFile ? formatLoadedPlayMessage(materializedFile) : null;
|
|
24066
24193
|
if (jsonOutput) {
|
|
24067
24194
|
process.stdout.write(
|
|
@@ -24082,14 +24209,20 @@ async function handlePlayGet(args) {
|
|
|
24082
24209
|
return 0;
|
|
24083
24210
|
}
|
|
24084
24211
|
if (sourceOutput) {
|
|
24085
|
-
if (!resolvedSource.trim()) {
|
|
24212
|
+
if (!source || !resolvedSource.trim()) {
|
|
24086
24213
|
console.error(`No source code available for ${playName}.`);
|
|
24087
|
-
return
|
|
24214
|
+
return 4;
|
|
24088
24215
|
}
|
|
24089
24216
|
if (materializedFile) {
|
|
24090
24217
|
console.log(loadedMessage);
|
|
24091
24218
|
return 0;
|
|
24092
24219
|
}
|
|
24220
|
+
if (Object.keys(source.files).length > 1) {
|
|
24221
|
+
console.error(
|
|
24222
|
+
`Play ${playName} has ${Object.keys(source.files).length} source files. Use --out <directory> to write the complete bundle.`
|
|
24223
|
+
);
|
|
24224
|
+
return 2;
|
|
24225
|
+
}
|
|
24093
24226
|
process.stdout.write(resolvedSource);
|
|
24094
24227
|
if (!resolvedSource.endsWith("\n")) {
|
|
24095
24228
|
process.stdout.write("\n");
|
|
@@ -24611,6 +24744,128 @@ async function handlePlayDescribe(args) {
|
|
|
24611
24744
|
printPlayDescription(play);
|
|
24612
24745
|
return 0;
|
|
24613
24746
|
}
|
|
24747
|
+
async function handlePlaySave(args) {
|
|
24748
|
+
let options;
|
|
24749
|
+
try {
|
|
24750
|
+
options = parsePlaySaveOptions(args);
|
|
24751
|
+
} catch (error) {
|
|
24752
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
24753
|
+
return 2;
|
|
24754
|
+
}
|
|
24755
|
+
if (!isFileTarget(options.target)) {
|
|
24756
|
+
console.error(
|
|
24757
|
+
"plays save requires a local .play.ts file. Use plays publish <play-name> to promote an existing saved revision."
|
|
24758
|
+
);
|
|
24759
|
+
return 2;
|
|
24760
|
+
}
|
|
24761
|
+
let graph;
|
|
24762
|
+
try {
|
|
24763
|
+
graph = await traceCliSpan(
|
|
24764
|
+
"cli.play_save_bundle_graph",
|
|
24765
|
+
{ targetKind: "file" },
|
|
24766
|
+
() => collectBundledPlayGraph(resolve11(options.target))
|
|
24767
|
+
);
|
|
24768
|
+
assertBundledPlayGraphDescriptions(graph);
|
|
24769
|
+
} catch (error) {
|
|
24770
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
24771
|
+
return 7;
|
|
24772
|
+
}
|
|
24773
|
+
const playName = graph.root.playName ?? extractPlayName(graph.root.sourceCode, graph.root.filePath);
|
|
24774
|
+
const artifactHash = graph.root.artifact.artifactHash;
|
|
24775
|
+
if (options.expectedArtifactHash && options.expectedArtifactHash !== artifactHash) {
|
|
24776
|
+
const result = {
|
|
24777
|
+
ok: false,
|
|
24778
|
+
code: "PLAY_ARTIFACT_HASH_MISMATCH",
|
|
24779
|
+
message: "Refusing to save: the local file no longer produces the artifact checked earlier.",
|
|
24780
|
+
expectedArtifactHash: options.expectedArtifactHash,
|
|
24781
|
+
currentArtifactHash: artifactHash,
|
|
24782
|
+
next: `deepline plays check ${shellQuote2(options.target)}`
|
|
24783
|
+
};
|
|
24784
|
+
if (options.jsonOutput) {
|
|
24785
|
+
process.stdout.write(`${JSON.stringify(result)}
|
|
24786
|
+
`);
|
|
24787
|
+
} else {
|
|
24788
|
+
console.error(result.message);
|
|
24789
|
+
console.error(` checked artifact: ${result.expectedArtifactHash}`);
|
|
24790
|
+
console.error(` current artifact: ${result.currentArtifactHash}`);
|
|
24791
|
+
console.error(` run: ${result.next}`);
|
|
24792
|
+
}
|
|
24793
|
+
return 7;
|
|
24794
|
+
}
|
|
24795
|
+
const dryRun = {
|
|
24796
|
+
ok: true,
|
|
24797
|
+
dryRun: true,
|
|
24798
|
+
name: playName,
|
|
24799
|
+
sourcePath: graph.root.filePath,
|
|
24800
|
+
sourceHash: graph.root.artifact.sourceHash,
|
|
24801
|
+
artifactHash,
|
|
24802
|
+
graphHash: graph.root.artifact.graphHash,
|
|
24803
|
+
sourceFileCount: Object.keys(graph.root.sourceFiles).length,
|
|
24804
|
+
plannedMutation: "save or update the mutable working draft; does not change the live revision"
|
|
24805
|
+
};
|
|
24806
|
+
if (options.dryRun) {
|
|
24807
|
+
if (options.jsonOutput) {
|
|
24808
|
+
process.stdout.write(`${JSON.stringify(dryRun)}
|
|
24809
|
+
`);
|
|
24810
|
+
} else {
|
|
24811
|
+
console.log(`Dry run: ${playName}`);
|
|
24812
|
+
console.log(` source: ${dryRun.sourceHash}`);
|
|
24813
|
+
console.log(` artifact: ${dryRun.artifactHash}`);
|
|
24814
|
+
console.log(` would: ${dryRun.plannedMutation}`);
|
|
24815
|
+
}
|
|
24816
|
+
return 0;
|
|
24817
|
+
}
|
|
24818
|
+
const client2 = new DeeplineClient();
|
|
24819
|
+
try {
|
|
24820
|
+
await traceCliSpan(
|
|
24821
|
+
"cli.play_save_compile_manifests",
|
|
24822
|
+
{ targetKind: "file", nodeCount: graph.nodes.size },
|
|
24823
|
+
() => compileBundledPlayGraphManifests(client2, graph)
|
|
24824
|
+
);
|
|
24825
|
+
const saved = await traceCliSpan(
|
|
24826
|
+
"cli.play_save_register_draft",
|
|
24827
|
+
{ targetKind: "file", playName, artifactHash },
|
|
24828
|
+
() => client2.registerPlayArtifact({
|
|
24829
|
+
name: playName,
|
|
24830
|
+
sourceCode: graph.root.sourceCode,
|
|
24831
|
+
sourceFiles: graph.root.sourceFiles,
|
|
24832
|
+
description: graph.root.playDescription ?? void 0,
|
|
24833
|
+
artifact: graph.root.artifact,
|
|
24834
|
+
compilerManifest: requireCompilerManifest(graph.root),
|
|
24835
|
+
publish: false
|
|
24836
|
+
})
|
|
24837
|
+
);
|
|
24838
|
+
const result = {
|
|
24839
|
+
success: true,
|
|
24840
|
+
name: playName,
|
|
24841
|
+
draft: true,
|
|
24842
|
+
revisionId: saved.revisionId ?? null,
|
|
24843
|
+
version: saved.version ?? null,
|
|
24844
|
+
sourceHash: graph.root.artifact.sourceHash,
|
|
24845
|
+
artifactHash,
|
|
24846
|
+
graphHash: graph.root.artifact.graphHash,
|
|
24847
|
+
artifactStorageKey: saved.artifactStorageKey,
|
|
24848
|
+
next: {
|
|
24849
|
+
publish: `deepline plays publish ${shellQuote2(options.target)} --expected-artifact ${artifactHash}`,
|
|
24850
|
+
get: `deepline plays get ${playName} --source --out ./${playName}/ --working`
|
|
24851
|
+
}
|
|
24852
|
+
};
|
|
24853
|
+
if (options.jsonOutput) {
|
|
24854
|
+
process.stdout.write(`${JSON.stringify(result)}
|
|
24855
|
+
`);
|
|
24856
|
+
} else {
|
|
24857
|
+
console.log(
|
|
24858
|
+
`\u2713 Saved ${playName} working draft as v${result.version ?? "?"}`
|
|
24859
|
+
);
|
|
24860
|
+
console.log(" Live revision unchanged.");
|
|
24861
|
+
console.log(` publish: ${result.next.publish}`);
|
|
24862
|
+
}
|
|
24863
|
+
return 0;
|
|
24864
|
+
} catch (error) {
|
|
24865
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
24866
|
+
return 5;
|
|
24867
|
+
}
|
|
24868
|
+
}
|
|
24614
24869
|
async function handlePlayPublish(args) {
|
|
24615
24870
|
let options;
|
|
24616
24871
|
try {
|
|
@@ -25141,7 +25396,9 @@ Pass-through input flags:
|
|
|
25141
25396
|
]);
|
|
25142
25397
|
});
|
|
25143
25398
|
registerPlayBootstrapCommand(play);
|
|
25144
|
-
play.command("get <target>").description(
|
|
25399
|
+
play.command("get <target>").description(
|
|
25400
|
+
"Fetch full play details or materialize a saved source bundle."
|
|
25401
|
+
).addHelpText(
|
|
25145
25402
|
"after",
|
|
25146
25403
|
`
|
|
25147
25404
|
Notes:
|
|
@@ -25153,17 +25410,24 @@ Examples:
|
|
|
25153
25410
|
deepline plays get prebuilt/person-linkedin-to-email
|
|
25154
25411
|
deepline plays get prebuilt/person-linkedin-to-email --json | jq '.play.liveRevision'
|
|
25155
25412
|
deepline plays get prebuilt/name-and-domain-to-email-waterfall-batch --source > email-waterfall.play.ts
|
|
25156
|
-
deepline plays get
|
|
25413
|
+
deepline plays get my-play --source --out ./my-play/ --working
|
|
25414
|
+
deepline plays get my-play --source --out ./my-play-v3/ --revision 3
|
|
25157
25415
|
`
|
|
25158
25416
|
).option("--json", "Emit JSON output. Also automatic when stdout is piped").option(
|
|
25159
25417
|
"--source",
|
|
25160
|
-
"
|
|
25161
|
-
).option(
|
|
25418
|
+
"Read source; prints single-file Plays or combines with --out to write the full bundle"
|
|
25419
|
+
).option(
|
|
25420
|
+
"--out <path>",
|
|
25421
|
+
"Write source to a file or, for multi-file Plays, a directory"
|
|
25422
|
+
).option("--working", "Read the current working draft source (default)").option("--live", "Read the live revision source").option("--revision <number>", "Read a specific revision source").action(async (target, options) => {
|
|
25162
25423
|
process.exitCode = await handlePlayGet([
|
|
25163
25424
|
target,
|
|
25164
25425
|
...options.json ? ["--json"] : [],
|
|
25165
25426
|
...options.source ? ["--source"] : [],
|
|
25166
|
-
...options.out ? ["--out", options.out] : []
|
|
25427
|
+
...options.out ? ["--out", options.out] : [],
|
|
25428
|
+
...options.working ? ["--working"] : [],
|
|
25429
|
+
...options.live ? ["--live"] : [],
|
|
25430
|
+
...options.revision ? ["--revision", options.revision] : []
|
|
25167
25431
|
]);
|
|
25168
25432
|
});
|
|
25169
25433
|
play.command("list").description("List saved and prebuilt plays.").addHelpText(
|
|
@@ -25298,6 +25562,32 @@ Examples:
|
|
|
25298
25562
|
...options.json ? ["--json"] : []
|
|
25299
25563
|
]);
|
|
25300
25564
|
});
|
|
25565
|
+
play.command("save <file>").description(
|
|
25566
|
+
"Save or update a local Play working draft without publishing it."
|
|
25567
|
+
).addHelpText(
|
|
25568
|
+
"after",
|
|
25569
|
+
`
|
|
25570
|
+
Notes:
|
|
25571
|
+
Mutates cloud state, but does not change the live revision or active triggers.
|
|
25572
|
+
Repeated saves update one working draft. Publishing it, or running a named
|
|
25573
|
+
draft revision, freezes it; the next save starts a new revision.
|
|
25574
|
+
|
|
25575
|
+
Examples:
|
|
25576
|
+
deepline plays save ./company-research.play.ts
|
|
25577
|
+
deepline plays save ./company-research.play.ts --dry-run --json
|
|
25578
|
+
deepline plays publish ./company-research.play.ts
|
|
25579
|
+
`
|
|
25580
|
+
).option("--expected-artifact <hash>", "Require the checked artifact hash").option(
|
|
25581
|
+
"--dry-run",
|
|
25582
|
+
"Bundle and show the planned draft save without mutation"
|
|
25583
|
+
).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (file, options) => {
|
|
25584
|
+
process.exitCode = await handlePlaySave([
|
|
25585
|
+
file,
|
|
25586
|
+
...options.expectedArtifact ? ["--expected-artifact", options.expectedArtifact] : [],
|
|
25587
|
+
...options.dryRun ? ["--dry-run"] : [],
|
|
25588
|
+
...options.json ? ["--json"] : []
|
|
25589
|
+
]);
|
|
25590
|
+
});
|
|
25301
25591
|
const addPublishHelp = (command) => command.addHelpText(
|
|
25302
25592
|
"after",
|
|
25303
25593
|
`
|
|
@@ -31258,7 +31548,7 @@ Examples:
|
|
|
31258
31548
|
// src/cli/commands/sessions.ts
|
|
31259
31549
|
import {
|
|
31260
31550
|
existsSync as existsSync10,
|
|
31261
|
-
mkdirSync as
|
|
31551
|
+
mkdirSync as mkdirSync7,
|
|
31262
31552
|
readdirSync as readdirSync3,
|
|
31263
31553
|
readFileSync as readFileSync9,
|
|
31264
31554
|
statSync as statSync4,
|
|
@@ -31859,13 +32149,13 @@ async function handleSessionsRender(options) {
|
|
|
31859
32149
|
let outputPath = options.output ? resolve13(options.output) : "";
|
|
31860
32150
|
if (!outputPath) {
|
|
31861
32151
|
const outputDir = join12(process.cwd(), "deepline", "data");
|
|
31862
|
-
|
|
32152
|
+
mkdirSync7(outputDir, { recursive: true });
|
|
31863
32153
|
outputPath = join12(
|
|
31864
32154
|
outputDir,
|
|
31865
32155
|
targets.length > 1 ? "session-viewer.html" : `session-${targets[0]?.sessionId}.html`
|
|
31866
32156
|
);
|
|
31867
32157
|
} else {
|
|
31868
|
-
|
|
32158
|
+
mkdirSync7(dirname11(outputPath), { recursive: true });
|
|
31869
32159
|
}
|
|
31870
32160
|
const sessions = targets.map((target) => ({
|
|
31871
32161
|
label: target.label,
|
|
@@ -33816,16 +34106,16 @@ Examples:
|
|
|
33816
34106
|
// src/cli/getting-started.ts
|
|
33817
34107
|
var DEEPLINE_GTM_SKILL = "/deepline-gtm";
|
|
33818
34108
|
var DEEPLINE_GTM_STARTER_PROMPTS = [
|
|
34109
|
+
{
|
|
34110
|
+
id: "competitor-tracking",
|
|
34111
|
+
title: "Competitor tracking",
|
|
34112
|
+
prompt: "/deepline-gtm Track competitors of my company. Use my business email domain when available; otherwise ask for my company name."
|
|
34113
|
+
},
|
|
33819
34114
|
{
|
|
33820
34115
|
id: "contact-email-enrichment",
|
|
33821
34116
|
title: "Contact email enrichment",
|
|
33822
34117
|
prompt: "/deepline-gtm Find 10 CTOs at B2B SaaS companies and enrich them with email addresses."
|
|
33823
34118
|
},
|
|
33824
|
-
{
|
|
33825
|
-
id: "company-signal-enrichment",
|
|
33826
|
-
title: "Company signal enrichment",
|
|
33827
|
-
prompt: "/deepline-gtm Enrich these company domains with employee count, funding, and recent hiring signals."
|
|
33828
|
-
},
|
|
33829
34119
|
{
|
|
33830
34120
|
id: "decision-maker-discovery",
|
|
33831
34121
|
title: "Decision-maker discovery",
|
|
@@ -34119,18 +34409,18 @@ import { spawnSync } from "child_process";
|
|
|
34119
34409
|
import {
|
|
34120
34410
|
existsSync as existsSync12,
|
|
34121
34411
|
lstatSync,
|
|
34122
|
-
mkdirSync as
|
|
34412
|
+
mkdirSync as mkdirSync9,
|
|
34123
34413
|
readFileSync as readFileSync12,
|
|
34124
34414
|
realpathSync as realpathSync3,
|
|
34125
34415
|
rmSync as rmSync4,
|
|
34126
34416
|
writeFileSync as writeFileSync12
|
|
34127
34417
|
} from "fs";
|
|
34128
34418
|
import { homedir as homedir10 } from "os";
|
|
34129
|
-
import { basename as basename6, dirname as dirname13, join as join14, relative as
|
|
34419
|
+
import { basename as basename6, dirname as dirname13, join as join14, relative as relative5, resolve as resolve14 } from "path";
|
|
34130
34420
|
|
|
34131
34421
|
// src/cli/commands/skills.ts
|
|
34132
34422
|
import { spawn as spawn2 } from "child_process";
|
|
34133
|
-
import { existsSync as existsSync11, mkdirSync as
|
|
34423
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync8, readFileSync as readFileSync11, writeFileSync as writeFileSync11 } from "fs";
|
|
34134
34424
|
import { homedir as homedir9 } from "os";
|
|
34135
34425
|
import { dirname as dirname12, join as join13 } from "path";
|
|
34136
34426
|
|
|
@@ -34556,7 +34846,7 @@ async function runSkillsCommand(options, dependencies = {}) {
|
|
|
34556
34846
|
);
|
|
34557
34847
|
return 5;
|
|
34558
34848
|
}
|
|
34559
|
-
|
|
34849
|
+
mkdirSync8(dirname12(plan.statePath), { recursive: true });
|
|
34560
34850
|
writeFileSync11(
|
|
34561
34851
|
plan.statePath,
|
|
34562
34852
|
`${JSON.stringify(
|
|
@@ -34819,7 +35109,7 @@ function removeKnownLegacyPaths(baseUrl) {
|
|
|
34819
35109
|
const installerCommandPath = safeRead(
|
|
34820
35110
|
join14(hostDir, "sdk", ".command-path")
|
|
34821
35111
|
).trim();
|
|
34822
|
-
const relativeInstallerCommandPath = installerCommandPath ?
|
|
35112
|
+
const relativeInstallerCommandPath = installerCommandPath ? relative5(resolve14(hostDir), resolve14(installerCommandPath)) : "";
|
|
34823
35113
|
const isOwnedInstallerCommand = Boolean(installerCommandPath) && relativeInstallerCommandPath !== "" && !relativeInstallerCommandPath.startsWith(
|
|
34824
35114
|
`..${process.platform === "win32" ? "\\" : "/"}`
|
|
34825
35115
|
) && relativeInstallerCommandPath !== ".." && basename6(installerCommandPath) === "deepline";
|
|
@@ -34933,7 +35223,7 @@ function inspectPathConflict() {
|
|
|
34933
35223
|
}
|
|
34934
35224
|
function writeSetupState(input2) {
|
|
34935
35225
|
const path = setupStatePath(input2.baseUrl, input2.scope, input2.root);
|
|
34936
|
-
|
|
35226
|
+
mkdirSync9(dirname13(path), { recursive: true });
|
|
34937
35227
|
writeFileSync12(
|
|
34938
35228
|
path,
|
|
34939
35229
|
`${JSON.stringify(
|
|
@@ -36175,7 +36465,7 @@ chooses the connected Slack channel and the events it receives.
|
|
|
36175
36465
|
}
|
|
36176
36466
|
|
|
36177
36467
|
// src/cli/commands/switch.ts
|
|
36178
|
-
import { existsSync as existsSync13, mkdirSync as
|
|
36468
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync10, readFileSync as readFileSync13, writeFileSync as writeFileSync13 } from "fs";
|
|
36179
36469
|
import { homedir as homedir11 } from "os";
|
|
36180
36470
|
import { dirname as dirname14, join as join15 } from "path";
|
|
36181
36471
|
function hostSlugFromBaseUrl(baseUrl) {
|
|
@@ -36217,7 +36507,7 @@ function readActiveFamily() {
|
|
|
36217
36507
|
}
|
|
36218
36508
|
function writeActiveFamily(family) {
|
|
36219
36509
|
const path = activeFamilyPath();
|
|
36220
|
-
|
|
36510
|
+
mkdirSync10(dirname14(path), { recursive: true });
|
|
36221
36511
|
writeFileSync13(path, `${family}
|
|
36222
36512
|
`, "utf-8");
|
|
36223
36513
|
return path;
|
|
@@ -36348,7 +36638,7 @@ import { join as join17, resolve as resolve15 } from "path";
|
|
|
36348
36638
|
// src/tool-output.ts
|
|
36349
36639
|
import {
|
|
36350
36640
|
closeSync as closeSync3,
|
|
36351
|
-
mkdirSync as
|
|
36641
|
+
mkdirSync as mkdirSync11,
|
|
36352
36642
|
openSync as openSync3,
|
|
36353
36643
|
writeFileSync as writeFileSync14,
|
|
36354
36644
|
writeSync
|
|
@@ -36482,7 +36772,7 @@ function projectRowOutput(conversion) {
|
|
|
36482
36772
|
}
|
|
36483
36773
|
function ensureOutputDir() {
|
|
36484
36774
|
const outputDir = join16(homedir12(), ".local", "share", "deepline", "data");
|
|
36485
|
-
|
|
36775
|
+
mkdirSync11(outputDir, { recursive: true });
|
|
36486
36776
|
return outputDir;
|
|
36487
36777
|
}
|
|
36488
36778
|
function writeJsonOutputFile(payload, stem) {
|
|
@@ -36493,7 +36783,7 @@ function writeJsonOutputFile(payload, stem) {
|
|
|
36493
36783
|
}
|
|
36494
36784
|
function writeCsvOutputFile(rows, stem, options) {
|
|
36495
36785
|
const outputPath = options?.outPath ? options.outPath : join16(ensureOutputDir(), `${stem}_${Date.now()}.csv`);
|
|
36496
|
-
|
|
36786
|
+
mkdirSync11(dirname15(outputPath), { recursive: true });
|
|
36497
36787
|
const columns = columnsForRows(rows);
|
|
36498
36788
|
const escapeCell = (value) => {
|
|
36499
36789
|
const normalized = value == null ? "" : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : JSON.stringify(value);
|
|
@@ -38971,7 +39261,7 @@ Examples:
|
|
|
38971
39261
|
import { spawn as spawn3 } from "child_process";
|
|
38972
39262
|
import {
|
|
38973
39263
|
existsSync as existsSync16,
|
|
38974
|
-
mkdirSync as
|
|
39264
|
+
mkdirSync as mkdirSync12,
|
|
38975
39265
|
realpathSync as realpathSync4,
|
|
38976
39266
|
readFileSync as readFileSync16,
|
|
38977
39267
|
renameSync,
|
|
@@ -38980,12 +39270,12 @@ import {
|
|
|
38980
39270
|
writeFileSync as writeFileSync16
|
|
38981
39271
|
} from "fs";
|
|
38982
39272
|
import { homedir as homedir13 } from "os";
|
|
38983
|
-
import { dirname as dirname16, isAbsolute as
|
|
39273
|
+
import { dirname as dirname16, isAbsolute as isAbsolute7, join as join19, relative as relative7, resolve as resolve17 } from "path";
|
|
38984
39274
|
|
|
38985
39275
|
// src/cli/install-integrity.ts
|
|
38986
39276
|
import { createRequire } from "module";
|
|
38987
39277
|
import { existsSync as existsSync15, readFileSync as readFileSync15, statSync as statSync5 } from "fs";
|
|
38988
|
-
import { isAbsolute as
|
|
39278
|
+
import { isAbsolute as isAbsolute6, join as join18, relative as relative6, resolve as resolve16 } from "path";
|
|
38989
39279
|
var SDK_SIDECAR_CRITICAL_PACKAGE_FILES = [
|
|
38990
39280
|
"dist/cli/index.mjs",
|
|
38991
39281
|
"dist/index.mjs",
|
|
@@ -39002,7 +39292,7 @@ var SDK_SIDECAR_CRITICAL_DEPENDENCY_FILES = [
|
|
|
39002
39292
|
"esbuild/lib/main.js"
|
|
39003
39293
|
];
|
|
39004
39294
|
function safeRelativePath(value) {
|
|
39005
|
-
if (typeof value !== "string" || !value ||
|
|
39295
|
+
if (typeof value !== "string" || !value || isAbsolute6(value)) return false;
|
|
39006
39296
|
const segments = value.split(/[\\/]+/);
|
|
39007
39297
|
return segments.every(
|
|
39008
39298
|
(segment) => Boolean(segment) && segment !== "." && segment !== ".."
|
|
@@ -39011,8 +39301,8 @@ function safeRelativePath(value) {
|
|
|
39011
39301
|
function resolveContainedPath(root, value) {
|
|
39012
39302
|
if (!safeRelativePath(value)) return null;
|
|
39013
39303
|
const target = resolve16(root, value);
|
|
39014
|
-
const relativeTarget =
|
|
39015
|
-
if (!relativeTarget || relativeTarget.startsWith("..") ||
|
|
39304
|
+
const relativeTarget = relative6(resolve16(root), target);
|
|
39305
|
+
if (!relativeTarget || relativeTarget.startsWith("..") || isAbsolute6(relativeTarget)) {
|
|
39016
39306
|
return null;
|
|
39017
39307
|
}
|
|
39018
39308
|
return target;
|
|
@@ -39233,11 +39523,11 @@ function readOptionalText(path) {
|
|
|
39233
39523
|
function resolvePythonSidecarUpdatePlan(options) {
|
|
39234
39524
|
const stateDir = sidecarStateDir(options);
|
|
39235
39525
|
if (!stateDir) return null;
|
|
39236
|
-
const relativeEntrypoint =
|
|
39526
|
+
const relativeEntrypoint = relative7(
|
|
39237
39527
|
resolve17(stateDir),
|
|
39238
39528
|
resolve17(options.entrypoint)
|
|
39239
39529
|
);
|
|
39240
|
-
if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") ||
|
|
39530
|
+
if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") || isAbsolute7(relativeEntrypoint)) {
|
|
39241
39531
|
return null;
|
|
39242
39532
|
}
|
|
39243
39533
|
const installMethod = readOptionalText(join19(stateDir, ".install-method"));
|
|
@@ -39404,7 +39694,7 @@ function writeAutoUpdateFailure(plan, exitCode) {
|
|
|
39404
39694
|
manualCommand: plan.manualCommand
|
|
39405
39695
|
};
|
|
39406
39696
|
try {
|
|
39407
|
-
|
|
39697
|
+
mkdirSync12(dirname16(path), { recursive: true });
|
|
39408
39698
|
writeFileSync16(path, `${JSON.stringify(marker, null, 2)}
|
|
39409
39699
|
`, "utf8");
|
|
39410
39700
|
} catch {
|
|
@@ -39584,7 +39874,7 @@ async function runNpmInstallWithRegistryFallback(input2) {
|
|
|
39584
39874
|
return first.exitCode;
|
|
39585
39875
|
}
|
|
39586
39876
|
function writeSidecarLauncher(input2) {
|
|
39587
|
-
|
|
39877
|
+
mkdirSync12(dirname16(input2.path), { recursive: true });
|
|
39588
39878
|
const packageRoot = dirname16(dirname16(dirname16(input2.entryPath)));
|
|
39589
39879
|
const versionDir = dirname16(dirname16(packageRoot));
|
|
39590
39880
|
const esbuildProbe = "const {createRequire}=require('node:module');const path=require('node:path');const req=createRequire(path.join(process.argv[1],'package.json'));const result=req('esbuild').transformSync('const value: number = 1;',{loader:'ts'});if(!result||typeof result.code!=='string')process.exit(3);";
|
|
@@ -39653,7 +39943,7 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
39653
39943
|
`.tmp-sdk-update-${process.pid}-${Date.now()}`
|
|
39654
39944
|
);
|
|
39655
39945
|
rmSync5(tempDir, { recursive: true, force: true });
|
|
39656
|
-
|
|
39946
|
+
mkdirSync12(tempDir, { recursive: true });
|
|
39657
39947
|
writeFileSync16(join19(tempDir, "package.json"), NPM_SDK_SIDECAR_PACKAGE_JSON);
|
|
39658
39948
|
const env = {
|
|
39659
39949
|
...process.env,
|
|
@@ -40662,7 +40952,7 @@ async function maybeAutoUpdateAndRelaunch(response) {
|
|
|
40662
40952
|
import { spawn as spawn5, spawnSync as spawnSync2 } from "child_process";
|
|
40663
40953
|
import {
|
|
40664
40954
|
existsSync as existsSync17,
|
|
40665
|
-
mkdirSync as
|
|
40955
|
+
mkdirSync as mkdirSync13,
|
|
40666
40956
|
readFileSync as readFileSync17,
|
|
40667
40957
|
unlinkSync as unlinkSync2,
|
|
40668
40958
|
writeFileSync as writeFileSync17
|
|
@@ -40715,7 +41005,7 @@ function readSdkSkillsLocalVersion(baseUrl) {
|
|
|
40715
41005
|
}
|
|
40716
41006
|
function writeLocalSkillsVersion(baseUrl, version) {
|
|
40717
41007
|
const path = sdkSkillsVersionPath(baseUrl);
|
|
40718
|
-
|
|
41008
|
+
mkdirSync13(dirname18(path), { recursive: true });
|
|
40719
41009
|
writeFileSync17(path, `${version}
|
|
40720
41010
|
`, "utf-8");
|
|
40721
41011
|
}
|
|
@@ -40725,7 +41015,7 @@ function writeUnavailableSkillsNotice(baseUrl, remoteVersion, skillNames) {
|
|
|
40725
41015
|
if (existsSync17(path) && readFileSync17(path, "utf-8").trim() === remoteVersion) {
|
|
40726
41016
|
return;
|
|
40727
41017
|
}
|
|
40728
|
-
|
|
41018
|
+
mkdirSync13(dirname18(path), { recursive: true });
|
|
40729
41019
|
writeFileSync17(path, `${remoteVersion}
|
|
40730
41020
|
`, "utf-8");
|
|
40731
41021
|
} catch {
|