@workflow-code/cli 0.2.0 → 0.2.3-20260901001

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.
@@ -0,0 +1,276 @@
1
+ #!/usr/bin/env node
2
+
3
+ // .shared/workflow-ids/index.ts
4
+ import path from "path";
5
+ var WORKFLOW_UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
6
+ function isWorkflowUuid(value) {
7
+ return WORKFLOW_UUID_PATTERN.test(value.trim());
8
+ }
9
+ function assertWorkflowUuid(value, label = "workflow id") {
10
+ const normalized = value.trim();
11
+ if (!isWorkflowUuid(normalized)) {
12
+ throw new Error(`Invalid ${label} "${value}".`);
13
+ }
14
+ return normalized;
15
+ }
16
+
17
+ // .shared/project-info/index.ts
18
+ var WORKFLOW_PROJECT_DATA_STORAGE_MODES = ["local", "server", "both"];
19
+ var WORKFLOW_RELATED_PROJECT_ALIAS_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
20
+ var WORKFLOW_RELATED_PROJECT_LIMIT = 32;
21
+ var WORKFLOW_RELATED_PROJECT_PREFIX_LIMIT = 32;
22
+ var WORKFLOW_RELATED_PROJECT_KEY_LIMIT = 1024;
23
+ var WORKFLOW_PROJECT_UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
24
+ var PROJECT_INFO_ID_PATTERN = /^[a-z][a-z0-9-]*$/;
25
+ function createUndeclaredWorkflowProjectInfo() {
26
+ return {
27
+ localizedNames: {},
28
+ declarations: [],
29
+ platformSupport: { mode: "agnostic" },
30
+ dataStorage: null,
31
+ relatedProjects: []
32
+ };
33
+ }
34
+ function normalizeWorkflowProjectInfo(value) {
35
+ if (!isRecord(value)) {
36
+ throw new Error("workflowCode.projectInfo must be an object.");
37
+ }
38
+ const localizedNames = normalizeLocalizedNames(value["localizedNames"]);
39
+ const declarations = normalizeIds(value["declarations"], "workflowCode.projectInfo.declarations");
40
+ const platformSupport = normalizePlatformSupport(value["platformSupport"]);
41
+ const dataStorage = normalizeDataStorage(value["dataStorage"]);
42
+ const relatedProjects = normalizeRelatedProjects(value["relatedProjects"]);
43
+ return { localizedNames, declarations, platformSupport, dataStorage, relatedProjects };
44
+ }
45
+ function readWorkflowProjectInfo(packageJson) {
46
+ if (!isRecord(packageJson)) return createUndeclaredWorkflowProjectInfo();
47
+ const workflowCode = packageJson["workflowCode"];
48
+ if (!isRecord(workflowCode) || workflowCode["projectInfo"] === void 0) {
49
+ return createUndeclaredWorkflowProjectInfo();
50
+ }
51
+ const projectInfo = normalizeWorkflowProjectInfo(workflowCode["projectInfo"]);
52
+ const projectId = typeof packageJson["id"] === "string" ? packageJson["id"].trim() : void 0;
53
+ if (projectId !== void 0 && projectId !== "") {
54
+ assertWorkflowRelatedProjects(projectInfo, projectId);
55
+ }
56
+ return projectInfo;
57
+ }
58
+ function assertWorkflowRelatedProjects(projectInfo, currentProjectId) {
59
+ if (projectInfo.relatedProjects.length === 0) return;
60
+ const normalizedProjectId = currentProjectId.trim();
61
+ if (!WORKFLOW_PROJECT_UUID_PATTERN.test(normalizedProjectId)) {
62
+ throw new Error("package.json.id must be a UUID before related projects can be declared.");
63
+ }
64
+ if (projectInfo.relatedProjects.some(
65
+ (relation) => relation.projectId.toLowerCase() === normalizedProjectId.toLowerCase()
66
+ )) {
67
+ throw new Error("workflowCode.projectInfo.relatedProjects cannot reference the current project.");
68
+ }
69
+ }
70
+ function findWorkflowRelatedProject(projectInfo, alias) {
71
+ const normalizedAlias = alias.trim();
72
+ return projectInfo.relatedProjects.find((relation) => relation.alias === normalizedAlias);
73
+ }
74
+ function resolveWorkflowRelatedProjectAccess(input) {
75
+ const consumer = findWorkflowRelatedProject(input.consumerProjectInfo, input.alias);
76
+ if (consumer?.projectId.toLowerCase() !== input.targetProjectId.trim().toLowerCase()) {
77
+ return void 0;
78
+ }
79
+ const target = input.targetProjectInfo.relatedProjects.find(
80
+ (relation) => relation.projectId.toLowerCase() === input.consumerProjectId.trim().toLowerCase()
81
+ );
82
+ if (target === void 0) return void 0;
83
+ return { consumer, target, grant: target.grantToRelatedProject };
84
+ }
85
+ function isWorkflowProjectDataStorageLocationAllowed(projectInfo, location) {
86
+ const mode = projectInfo.dataStorage?.mode;
87
+ return mode === "both" || mode === location;
88
+ }
89
+ function normalizeLocalizedNames(value) {
90
+ if (value === void 0) return {};
91
+ if (!isRecord(value)) {
92
+ throw new Error("workflowCode.projectInfo.localizedNames must be an object.");
93
+ }
94
+ const entries = [];
95
+ for (const [rawLocale, rawName] of Object.entries(value)) {
96
+ const locale = rawLocale.trim();
97
+ if (locale === "") {
98
+ throw new Error("workflowCode.projectInfo.localizedNames contains an empty locale.");
99
+ }
100
+ if (typeof rawName !== "string") {
101
+ throw new Error(`workflowCode.projectInfo.localizedNames.${locale} must be a string.`);
102
+ }
103
+ const name = rawName.trim();
104
+ if (name !== "") entries.push([locale, name]);
105
+ }
106
+ return Object.fromEntries(entries);
107
+ }
108
+ function normalizePlatformSupport(value) {
109
+ if (value === void 0) return { mode: "agnostic" };
110
+ if (!isRecord(value)) {
111
+ throw new Error("workflowCode.projectInfo.platformSupport must be an object.");
112
+ }
113
+ if (value["mode"] === "agnostic") {
114
+ if (value["platforms"] !== void 0) {
115
+ throw new Error("workflowCode.projectInfo.platformSupport.platforms is not allowed in agnostic mode.");
116
+ }
117
+ return { mode: "agnostic" };
118
+ }
119
+ if (value["mode"] !== "specific") {
120
+ throw new Error('workflowCode.projectInfo.platformSupport.mode must be "agnostic" or "specific".');
121
+ }
122
+ const platforms = normalizeIds(
123
+ value["platforms"],
124
+ "workflowCode.projectInfo.platformSupport.platforms"
125
+ );
126
+ if (platforms.length === 0) {
127
+ throw new Error("workflowCode.projectInfo.platformSupport.platforms must contain at least one platform.");
128
+ }
129
+ return { mode: "specific", platforms };
130
+ }
131
+ function normalizeDataStorage(value) {
132
+ if (value === void 0 || value === null) return null;
133
+ if (!isRecord(value)) {
134
+ throw new Error("workflowCode.projectInfo.dataStorage must be an object.");
135
+ }
136
+ const mode = value["mode"];
137
+ if (typeof mode !== "string" || !WORKFLOW_PROJECT_DATA_STORAGE_MODES.includes(
138
+ mode
139
+ )) {
140
+ throw new Error(
141
+ 'workflowCode.projectInfo.dataStorage.mode must be "local", "server", or "both".'
142
+ );
143
+ }
144
+ return { mode };
145
+ }
146
+ function normalizeRelatedProjects(value) {
147
+ if (value === void 0) return [];
148
+ if (!Array.isArray(value)) {
149
+ throw new Error("workflowCode.projectInfo.relatedProjects must be an array.");
150
+ }
151
+ if (value.length > WORKFLOW_RELATED_PROJECT_LIMIT) {
152
+ throw new Error(
153
+ `workflowCode.projectInfo.relatedProjects supports at most ${WORKFLOW_RELATED_PROJECT_LIMIT} items.`
154
+ );
155
+ }
156
+ const aliases = /* @__PURE__ */ new Set();
157
+ const projectIds = /* @__PURE__ */ new Set();
158
+ return value.map((item, index) => {
159
+ const field = `workflowCode.projectInfo.relatedProjects[${index}]`;
160
+ if (!isRecord(item)) throw new Error(`${field} must be an object.`);
161
+ const supportedFields = /* @__PURE__ */ new Set(["alias", "projectId", "grantToRelatedProject"]);
162
+ if (Object.keys(item).some((key) => !supportedFields.has(key))) {
163
+ throw new Error(`${field} contains unsupported fields.`);
164
+ }
165
+ const alias = readRelatedProjectString(item["alias"], `${field}.alias`);
166
+ if (!WORKFLOW_RELATED_PROJECT_ALIAS_PATTERN.test(alias)) {
167
+ throw new Error(`${field}.alias is invalid.`);
168
+ }
169
+ if (aliases.has(alias)) {
170
+ throw new Error(`workflowCode.projectInfo.relatedProjects contains duplicate alias "${alias}".`);
171
+ }
172
+ aliases.add(alias);
173
+ const projectId = readRelatedProjectString(item["projectId"], `${field}.projectId`);
174
+ if (!WORKFLOW_PROJECT_UUID_PATTERN.test(projectId)) {
175
+ throw new Error(`${field}.projectId must be a UUID.`);
176
+ }
177
+ const normalizedProjectId = projectId.toLowerCase();
178
+ if (projectIds.has(normalizedProjectId)) {
179
+ throw new Error(`workflowCode.projectInfo.relatedProjects contains duplicate projectId "${projectId}".`);
180
+ }
181
+ projectIds.add(normalizedProjectId);
182
+ return {
183
+ alias,
184
+ projectId,
185
+ grantToRelatedProject: normalizeRelatedProjectGrant(
186
+ item["grantToRelatedProject"],
187
+ `${field}.grantToRelatedProject`
188
+ )
189
+ };
190
+ });
191
+ }
192
+ function normalizeRelatedProjectGrant(value, field) {
193
+ if (!isRecord(value)) throw new Error(`${field} must be an object.`);
194
+ if (Object.keys(value).some((key) => key !== "read" && key !== "write")) {
195
+ throw new Error(`${field} contains unsupported fields.`);
196
+ }
197
+ return {
198
+ read: normalizeProjectKVAccessRule(value["read"], `${field}.read`),
199
+ write: normalizeProjectKVAccessRule(value["write"], `${field}.write`)
200
+ };
201
+ }
202
+ function normalizeProjectKVAccessRule(value, field) {
203
+ if (!isRecord(value)) throw new Error(`${field} must be an object.`);
204
+ const mode = value["mode"];
205
+ if (mode === "none" || mode === "all") {
206
+ if (Object.keys(value).some((key) => key !== "mode")) {
207
+ throw new Error(`${field} contains unsupported fields.`);
208
+ }
209
+ return { mode };
210
+ }
211
+ if (mode !== "prefixes") {
212
+ throw new Error(`${field}.mode must be "none", "all", or "prefixes".`);
213
+ }
214
+ if (Object.keys(value).some((key) => key !== "mode" && key !== "prefixes")) {
215
+ throw new Error(`${field} contains unsupported fields.`);
216
+ }
217
+ const rawPrefixes = value["prefixes"];
218
+ if (!Array.isArray(rawPrefixes) || rawPrefixes.length === 0 || rawPrefixes.length > WORKFLOW_RELATED_PROJECT_PREFIX_LIMIT) {
219
+ throw new Error(
220
+ `${field}.prefixes must contain 1 to ${WORKFLOW_RELATED_PROJECT_PREFIX_LIMIT} items.`
221
+ );
222
+ }
223
+ const prefixes = rawPrefixes.map((prefix, index) => {
224
+ const normalized = readRelatedProjectString(prefix, `${field}.prefixes[${index}]`);
225
+ if (normalized.length > WORKFLOW_RELATED_PROJECT_KEY_LIMIT || normalized.includes("\0")) {
226
+ throw new Error(`${field}.prefixes[${index}] is invalid.`);
227
+ }
228
+ return normalized;
229
+ });
230
+ if (new Set(prefixes).size !== prefixes.length) {
231
+ throw new Error(`${field}.prefixes contains duplicates.`);
232
+ }
233
+ return { mode: "prefixes", prefixes };
234
+ }
235
+ function readRelatedProjectString(value, field) {
236
+ if (typeof value !== "string" || value.trim() === "") {
237
+ throw new Error(`${field} must be a non-empty string.`);
238
+ }
239
+ return value.trim();
240
+ }
241
+ function normalizeIds(value, field) {
242
+ if (value === void 0) return [];
243
+ if (!Array.isArray(value)) throw new Error(`${field} must be an array.`);
244
+ const values = value.map((item, index) => {
245
+ if (typeof item !== "string" || !PROJECT_INFO_ID_PATTERN.test(item.trim())) {
246
+ throw new Error(`${field}[${index}] must be a lowercase identifier.`);
247
+ }
248
+ return item.trim();
249
+ });
250
+ return uniqueStrings(values, true);
251
+ }
252
+ function uniqueStrings(values, caseSensitive) {
253
+ const seen = /* @__PURE__ */ new Set();
254
+ const result = [];
255
+ for (const rawValue of values) {
256
+ const value = rawValue.trim();
257
+ if (value === "") continue;
258
+ const key = caseSensitive ? value : value.toLocaleLowerCase();
259
+ if (seen.has(key)) continue;
260
+ seen.add(key);
261
+ result.push(value);
262
+ }
263
+ return result;
264
+ }
265
+ function isRecord(value) {
266
+ return typeof value === "object" && value !== null && !Array.isArray(value);
267
+ }
268
+
269
+ export {
270
+ isWorkflowUuid,
271
+ assertWorkflowUuid,
272
+ WORKFLOW_RELATED_PROJECT_ALIAS_PATTERN,
273
+ readWorkflowProjectInfo,
274
+ resolveWorkflowRelatedProjectAccess,
275
+ isWorkflowProjectDataStorageLocationAllowed
276
+ };
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ i18n,
4
+ initI18n,
5
+ isSupportedLocale,
6
+ normalizeLocale
7
+ } from "./chunk-TCYG46PO.js";
8
+
9
+ // src/locale.ts
10
+ import { WORKFLOW_RUNTIME_LOCALE_ENV } from "workflow-code";
11
+ function prepareCliInvocation(argv) {
12
+ initI18n({ preference: resolveSystemLocalePreference() });
13
+ const extracted = extractLocaleOption(argv);
14
+ const requestedLocale = extracted.locale ?? readEnvironmentLocale();
15
+ if (requestedLocale !== void 0) {
16
+ if (!isSupportedLocale(requestedLocale)) {
17
+ throw new Error(i18n.t("invalidLocale", {
18
+ ns: "cli",
19
+ value: requestedLocale
20
+ }));
21
+ }
22
+ initI18n({ preference: requestedLocale });
23
+ }
24
+ const locale = normalizeLocale(i18n.language);
25
+ process.env[WORKFLOW_RUNTIME_LOCALE_ENV] = locale;
26
+ return {
27
+ argv: extracted.argv,
28
+ locale
29
+ };
30
+ }
31
+ function extractLocaleOption(argv) {
32
+ const filtered = [];
33
+ let locale;
34
+ for (let index = 0; index < argv.length; index += 1) {
35
+ const arg = argv[index];
36
+ if (arg === "--") {
37
+ filtered.push(...argv.slice(index));
38
+ break;
39
+ }
40
+ if (arg === "--locale" || arg.startsWith("--locale=")) {
41
+ if (locale !== void 0) {
42
+ throw new Error(i18n.t("duplicateLocale", { ns: "cli" }));
43
+ }
44
+ const value = arg === "--locale" ? argv[++index] : arg.slice("--locale=".length);
45
+ if (value === void 0 || value.trim() === "") {
46
+ throw new Error(i18n.t("missingOptionValue", { ns: "cli", name: "--locale" }));
47
+ }
48
+ locale = value;
49
+ continue;
50
+ }
51
+ filtered.push(arg);
52
+ }
53
+ return { argv: filtered, locale };
54
+ }
55
+ function readEnvironmentLocale() {
56
+ const value = process.env.WORKFLOW_CODE_LOCALE?.trim();
57
+ return value === "" ? void 0 : value;
58
+ }
59
+ function resolveSystemLocalePreference() {
60
+ const systemLocale = process.env.LC_ALL ?? process.env.LANG;
61
+ return systemLocale?.trim() ? normalizeLocale(systemLocale) : "system";
62
+ }
63
+
64
+ export {
65
+ prepareCliInvocation
66
+ };
@@ -0,0 +1,169 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ WORKFLOW_RELATED_PROJECT_ALIAS_PATTERN,
4
+ assertWorkflowUuid,
5
+ isWorkflowProjectDataStorageLocationAllowed,
6
+ readWorkflowProjectInfo,
7
+ resolveWorkflowRelatedProjectAccess
8
+ } from "./chunk-27OW6OJ3.js";
9
+
10
+ // src/related-projects.ts
11
+ import os from "os";
12
+ import path from "path";
13
+ import { readFileSync, realpathSync, statSync } from "fs";
14
+ import * as workflowCode from "workflow-code";
15
+ var targetStorageApi = workflowCode;
16
+ function parseCliRelatedProjectSpec(value) {
17
+ const separatorIndex = value.indexOf("=");
18
+ if (separatorIndex <= 0 || separatorIndex === value.length - 1) {
19
+ throw new Error('--related-project must use the form "alias=/absolute/project/path".');
20
+ }
21
+ const alias = value.slice(0, separatorIndex).trim();
22
+ const projectDir = value.slice(separatorIndex + 1).trim();
23
+ if (!WORKFLOW_RELATED_PROJECT_ALIAS_PATTERN.test(alias)) {
24
+ throw new Error(`Invalid related project alias "${alias}".`);
25
+ }
26
+ if (!path.isAbsolute(projectDir)) {
27
+ throw new Error(`Related project "${alias}" must use an absolute directory path.`);
28
+ }
29
+ return { alias, projectDir };
30
+ }
31
+ function createCliRelatedProjectRuntime(options) {
32
+ if (options.relatedProjects.length === 0) return {};
33
+ const consumer = readProjectSnapshot(options.consumerProjectDir, "Current project");
34
+ const configuredByAlias = /* @__PURE__ */ new Map();
35
+ const configuredProjectIds = /* @__PURE__ */ new Set();
36
+ const configuredPaths = /* @__PURE__ */ new Set();
37
+ for (const spec of options.relatedProjects) {
38
+ if (configuredByAlias.has(spec.alias)) {
39
+ throw new Error(`Related project alias "${spec.alias}" was specified more than once.`);
40
+ }
41
+ const target = readProjectSnapshot(spec.projectDir, `Related project "${spec.alias}"`);
42
+ const targetProjectId = target.projectId.toLowerCase();
43
+ if (configuredProjectIds.has(targetProjectId)) {
44
+ throw new Error(`Related project UUID "${target.projectId}" was specified more than once.`);
45
+ }
46
+ if (configuredPaths.has(target.projectDir)) {
47
+ throw new Error(`Related project directory "${target.projectDir}" was specified more than once.`);
48
+ }
49
+ assertConfirmedRelationship(consumer, target, spec.alias);
50
+ configuredByAlias.set(spec.alias, target);
51
+ configuredProjectIds.add(targetProjectId);
52
+ configuredPaths.add(target.projectDir);
53
+ }
54
+ const localKvStore = targetStorageApi.createLocalWorkflowKVStore({
55
+ rootDir: options.localKvStoreDir ?? path.join(os.tmpdir(), "workflow-code-kv"),
56
+ storageKind: "kv"
57
+ });
58
+ return {
59
+ localKvStore,
60
+ localResolver: createResolver("local", localKvStore),
61
+ serverResolver: createResolver("server")
62
+ };
63
+ function createResolver(location, fixedStore) {
64
+ return {
65
+ resolve(alias) {
66
+ const configured = configuredByAlias.get(alias);
67
+ if (configured === void 0) return void 0;
68
+ const currentConsumer = readProjectSnapshot(consumer.projectDir, "Current project");
69
+ const currentTarget = readProjectSnapshot(
70
+ configured.projectDir,
71
+ `Related project "${alias}"`
72
+ );
73
+ if (currentTarget.projectId.toLowerCase() !== configured.projectId.toLowerCase()) {
74
+ return void 0;
75
+ }
76
+ const access = resolveWorkflowRelatedProjectAccess({
77
+ consumerProjectId: currentConsumer.projectId,
78
+ consumerProjectInfo: currentConsumer.projectInfo,
79
+ targetProjectId: currentTarget.projectId,
80
+ targetProjectInfo: currentTarget.projectInfo,
81
+ alias
82
+ });
83
+ if (access === void 0 || !isWorkflowProjectDataStorageLocationAllowed(currentTarget.projectInfo, location)) {
84
+ return void 0;
85
+ }
86
+ const createRemoteStore = targetStorageApi.createRemoteWorkflowRelatedProjectKVStoreFromEnv;
87
+ if (fixedStore === void 0 && typeof createRemoteStore !== "function") {
88
+ throw new Error("Installed workflow-code does not support related project storage.");
89
+ }
90
+ const store = fixedStore ?? createRemoteStore({
91
+ consumerProjectId: currentConsumer.projectId,
92
+ targetProjectId: currentTarget.projectId,
93
+ alias,
94
+ env: options.env
95
+ });
96
+ if (store === void 0) return void 0;
97
+ return {
98
+ projectId: currentTarget.projectId,
99
+ grant: access.grant,
100
+ kv: targetStorageApi.createWorkflowKVContext({
101
+ store,
102
+ projectId: currentTarget.projectId,
103
+ source: {
104
+ projectId: currentConsumer.projectId,
105
+ runId: options.runId,
106
+ conversationId: options.conversationId
107
+ }
108
+ })
109
+ };
110
+ }
111
+ };
112
+ }
113
+ }
114
+ function assertConfirmedRelationship(consumer, target, alias) {
115
+ const consumerRelation = consumer.projectInfo.relatedProjects.find(
116
+ (relation) => relation.alias === alias
117
+ );
118
+ if (consumerRelation?.projectId.toLowerCase() !== target.projectId.toLowerCase()) {
119
+ throw new Error(
120
+ `Current project does not declare related project "${alias}" with UUID "${target.projectId}".`
121
+ );
122
+ }
123
+ if (resolveWorkflowRelatedProjectAccess({
124
+ consumerProjectId: consumer.projectId,
125
+ consumerProjectInfo: consumer.projectInfo,
126
+ targetProjectId: target.projectId,
127
+ targetProjectInfo: target.projectInfo,
128
+ alias
129
+ }) === void 0) {
130
+ throw new Error(`Related project "${alias}" is not confirmed by both project manifests.`);
131
+ }
132
+ }
133
+ function readProjectSnapshot(projectDir, label) {
134
+ let canonicalDir;
135
+ try {
136
+ canonicalDir = realpathSync(projectDir);
137
+ if (!statSync(canonicalDir).isDirectory()) {
138
+ throw new Error("not a directory");
139
+ }
140
+ } catch (error) {
141
+ throw new Error(`${label} directory is unavailable: ${projectDir}`, { cause: error });
142
+ }
143
+ const packagePath = path.join(canonicalDir, "package.json");
144
+ let packageJson;
145
+ try {
146
+ packageJson = JSON.parse(readFileSync(packagePath, "utf8"));
147
+ } catch (error) {
148
+ throw new Error(`${label} must contain a readable package.json: ${canonicalDir}`, {
149
+ cause: error
150
+ });
151
+ }
152
+ if (!isRecord(packageJson) || typeof packageJson["id"] !== "string") {
153
+ throw new Error(`${label} package.json.id must be a UUID.`);
154
+ }
155
+ const projectId = assertWorkflowUuid(packageJson["id"], `${label} package.json.id`);
156
+ const projectInfo = readWorkflowProjectInfo(packageJson);
157
+ if (projectInfo.dataStorage === null) {
158
+ throw new Error(`${label} must declare workflowCode.projectInfo.dataStorage.mode.`);
159
+ }
160
+ return { projectDir: canonicalDir, projectId, projectInfo };
161
+ }
162
+ function isRecord(value) {
163
+ return typeof value === "object" && value !== null && !Array.isArray(value);
164
+ }
165
+
166
+ export {
167
+ parseCliRelatedProjectSpec,
168
+ createCliRelatedProjectRuntime
169
+ };
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+
32
+ export {
33
+ __commonJS,
34
+ __export,
35
+ __toESM
36
+ };
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/openai-runner-stdio.ts
4
+ function isolateOpenAIRunnerStdout(stdout = process.stdout, stderr = process.stderr) {
5
+ const protocolWrite = stdout.write.bind(stdout);
6
+ stdout.write = (...args) => stderr.write(...args);
7
+ return (line) => {
8
+ protocolWrite(line);
9
+ };
10
+ }
11
+
12
+ export {
13
+ isolateOpenAIRunnerStdout
14
+ };