@workflow-code/cli 0.1.3 → 0.1.4-20260814003

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/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  i18n,
4
4
  prepareCliInvocation,
5
5
  translateWorkflowCodeError
6
- } from "./chunk-ONAQ5F5R.js";
6
+ } from "./chunk-3ZXXRODP.js";
7
7
 
8
8
  // src/index.ts
9
9
  import path from "path";
@@ -12,7 +12,7 @@ async function main(argv = process.argv.slice(2)) {
12
12
  const prepared = prepareCliInvocation(argv);
13
13
  argv = prepared.argv;
14
14
  if (argv[0] === "workspace") {
15
- const workspaceCli = await import("./workspace-MLJHPOLS.js");
15
+ const workspaceCli = await import("./workspace-HHW34WVB.js");
16
16
  await workspaceCli.main(argv.slice(1), { localeInitialized: true });
17
17
  return typeof process.exitCode === "number" ? process.exitCode : 0;
18
18
  }
@@ -23,7 +23,7 @@ async function main(argv = process.argv.slice(2)) {
23
23
  }
24
24
  const { register } = await import("tsx/esm/api");
25
25
  register();
26
- const localCli = await import("./local-ZIUEP53J.js");
26
+ const localCli = await import("./local-K4KPED46.js");
27
27
  return localCli.main(argv, { localeInitialized: true });
28
28
  }
29
29
  function formatHelp() {
@@ -3,7 +3,7 @@ import {
3
3
  i18n,
4
4
  prepareCliInvocation,
5
5
  translateWorkflowCodeError
6
- } from "./chunk-ONAQ5F5R.js";
6
+ } from "./chunk-3ZXXRODP.js";
7
7
 
8
8
  // src/local.ts
9
9
  import path from "path";
@@ -18,8 +18,8 @@ import {
18
18
  resolveLocalWorkflowParams,
19
19
  runLocalWorkflowWithReport
20
20
  } from "workflow-code";
21
- var WORKFLOW_APP_RUNTIME_EVENTS_ENV = "WORKFLOW_APP_RUNTIME_EVENTS";
22
- var WORKFLOW_APP_RUNTIME_EVENT_PREFIX = "__WORKFLOW_CODE_RUNTIME_EVENT__";
21
+ var WORKFLOW_DESKTOP_RUNTIME_EVENTS_ENV = "WORKFLOW_DESKTOP_RUNTIME_EVENTS";
22
+ var WORKFLOW_DESKTOP_RUNTIME_EVENT_PREFIX = "__WORKFLOW_CODE_RUNTIME_EVENT__";
23
23
  var WORKFLOW_PARAM_ERROR_MARKER = "__WORKFLOW_CODE_PARAM_ERROR__";
24
24
  var RESUME_RUNTIME_EVENT_AFTER_REQUEST_ID = "__workflowResumeRuntimeEventAfterRequestId";
25
25
  async function main(argv = process.argv.slice(2), options = {}) {
@@ -57,7 +57,7 @@ async function main(argv = process.argv.slice(2), options = {}) {
57
57
  toolPermissionPolicies: parsed.toolPermissionPolicies,
58
58
  fileCreateStoreDir: process.env.WORKFLOW_FILE_CREATE_STORE_DIR,
59
59
  nodeHooks: parsed.json ? void 0 : createCliOutputStreamHooks(),
60
- onRuntimeEvent: parsed.json ? createAppRuntimeEventEmitter() : void 0,
60
+ onRuntimeEvent: parsed.json ? createDesktopRuntimeEventEmitter() : void 0,
61
61
  abortSignal: abortController.signal
62
62
  });
63
63
  if (parsed.json) {
@@ -225,13 +225,13 @@ function parseResolvedUserInputs(value) {
225
225
  };
226
226
  });
227
227
  }
228
- function createAppRuntimeEventEmitter() {
229
- if (process.env[WORKFLOW_APP_RUNTIME_EVENTS_ENV] !== "1") {
228
+ function createDesktopRuntimeEventEmitter() {
229
+ if (process.env[WORKFLOW_DESKTOP_RUNTIME_EVENTS_ENV] !== "1") {
230
230
  return void 0;
231
231
  }
232
232
  return (event) => {
233
233
  process.stdout.write(
234
- `${WORKFLOW_APP_RUNTIME_EVENT_PREFIX}${JSON.stringify(event, createRuntimeEventJsonReplacer())}
234
+ `${WORKFLOW_DESKTOP_RUNTIME_EVENT_PREFIX}${JSON.stringify(event, createRuntimeEventJsonReplacer())}
235
235
  `
236
236
  );
237
237
  };
@@ -343,7 +343,10 @@ function isCliEntrypoint() {
343
343
  return process.argv[1] !== void 0 && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href;
344
344
  }
345
345
  export {
346
+ WORKFLOW_DESKTOP_RUNTIME_EVENTS_ENV,
347
+ WORKFLOW_DESKTOP_RUNTIME_EVENT_PREFIX,
346
348
  WORKFLOW_PARAM_ERROR_MARKER,
349
+ createDesktopRuntimeEventEmitter,
347
350
  formatParamResolverFailure,
348
351
  main,
349
352
  parseWorkflowArgs
@@ -6,11 +6,11 @@ import {
6
6
  i18n,
7
7
  prepareCliInvocation,
8
8
  translateWorkflowCodeError
9
- } from "./chunk-ONAQ5F5R.js";
9
+ } from "./chunk-3ZXXRODP.js";
10
10
 
11
- // ../../node_modules/.pnpm/ignore@7.0.6/node_modules/ignore/index.js
11
+ // node_modules/.pnpm/ignore@7.0.6/node_modules/ignore/index.js
12
12
  var require_ignore = __commonJS({
13
- "../../node_modules/.pnpm/ignore@7.0.6/node_modules/ignore/index.js"(exports, module) {
13
+ "node_modules/.pnpm/ignore@7.0.6/node_modules/ignore/index.js"(exports, module) {
14
14
  "use strict";
15
15
  function makeArray(subject) {
16
16
  return Array.isArray(subject) ? subject : [subject];
@@ -475,7 +475,7 @@ import { copyFile as copyFile2, mkdir as mkdir3, readFile as readFile3, readdir
475
475
  import path4 from "path";
476
476
  import { fileURLToPath, pathToFileURL } from "url";
477
477
 
478
- // ../../shared/auth-config/index.ts
478
+ // .shared/auth-config/index.ts
479
479
  var WORKFLOW_AUTH_FILE_NAME = "workflow-auth.json";
480
480
  var DEFAULT_MAC_PLATFORM = "darwin";
481
481
  var DEFAULT_WINDOWS_PLATFORM = "win32";
@@ -491,7 +491,7 @@ function normalizeWorkflowAuthConfig(value) {
491
491
  return createEmptyWorkflowAuthConfig();
492
492
  }
493
493
  return {
494
- // issue #90 Accept legacy field names (remoteUrl, token) from pre-migration
494
+ // Accept legacy field names (remoteUrl, token) from pre-migration
495
495
  // config files so existing users don't lose their credentials on upgrade.
496
496
  serverUrl: readString(value.serverUrl) ?? readString(value.remoteUrl) ?? "",
497
497
  apiKey: readString(value.apiKey) ?? readString(value.token) ?? "",
@@ -580,21 +580,21 @@ function readGlobalProcess() {
580
580
  return processValue;
581
581
  }
582
582
 
583
- // ../../shared/workflow-ids/index.ts
583
+ // .shared/workflow-ids/index.ts
584
584
  import path from "path";
585
585
  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;
586
586
  function isWorkflowUuid(value) {
587
587
  return WORKFLOW_UUID_PATTERN.test(value.trim());
588
588
  }
589
589
 
590
- // ../../shared/project-upload/node.ts
590
+ // .shared/project-upload/node.ts
591
591
  import { copyFile, lstat, mkdir, readFile, readdir } from "fs/promises";
592
592
  import path2 from "path";
593
593
 
594
- // ../../shared/project-upload/index.ts
594
+ // .shared/project-upload/index.ts
595
595
  var import_ignore = __toESM(require_ignore(), 1);
596
596
 
597
- // ../../shared/kanban-project/index.ts
597
+ // .shared/kanban-project/index.ts
598
598
  var KANBAN_MANIFEST_FILE = "kanban.json";
599
599
  var KANBAN_ENTRY_FILE = "index.html";
600
600
  var KANBAN_ARTIFACT_DIR = ".";
@@ -726,7 +726,7 @@ function isRecord2(value) {
726
726
  return typeof value === "object" && value !== null && !Array.isArray(value);
727
727
  }
728
728
 
729
- // ../../shared/project-upload/index.ts
729
+ // .shared/project-upload/index.ts
730
730
  var WORKFLOW_IGNORE_FILE = ".workflowignore";
731
731
  function hasWorkflowIgnoreRules(content) {
732
732
  if (content === void 0) return false;
@@ -801,7 +801,7 @@ function findEffectiveWorkflowIgnoreRule(normalizedPath, ruleLines) {
801
801
  return ignored ? effectiveRule : void 0;
802
802
  }
803
803
 
804
- // ../../shared/project-upload/node.ts
804
+ // .shared/project-upload/node.ts
805
805
  async function createWorkflowUploadPlan(rootDir) {
806
806
  const projectRoot = path2.resolve(rootDir);
807
807
  const workflowIgnorePath = path2.join(projectRoot, WORKFLOW_IGNORE_FILE);
@@ -956,7 +956,7 @@ import path3 from "path";
956
956
  import { parse } from "dotenv";
957
957
  function loadCliEnv() {
958
958
  const cliRoot = process.cwd();
959
- const defaultRepoRoot = findRepoRoot(cliRoot) ?? cliRoot;
959
+ const defaultRepoRoot = findWorkspaceRepositoryRoot(cliRoot) ?? cliRoot;
960
960
  const initialRepoRoot = process.env.WORKFLOW_REPO_ROOT ? path3.resolve(process.env.WORKFLOW_REPO_ROOT) : defaultRepoRoot;
961
961
  loadEnvFiles([
962
962
  path3.join(cliRoot, ".env"),
@@ -967,10 +967,10 @@ function loadCliEnv() {
967
967
  loadEnvFiles([path3.join(resolvedRepoRoot, ".env")]);
968
968
  }
969
969
  }
970
- function findRepoRoot(startDir) {
970
+ function findWorkspaceRepositoryRoot(startDir) {
971
971
  let current = path3.resolve(startDir);
972
972
  while (true) {
973
- if (existsSync(path3.join(current, "pnpm-workspace.yaml")) && existsSync(path3.join(current, "packages", "cli", "package.json"))) {
973
+ if (existsSync(path3.join(current, "pnpm-workspace.yaml")) && existsSync(path3.join(current, "package.json")) && existsSync(path3.join(current, "workspace", "package.json")) && existsSync(path3.join(current, "workspace", "workflow"))) {
974
974
  return current;
975
975
  }
976
976
  const parent = path3.dirname(current);
@@ -1063,7 +1063,7 @@ async function commandLogin(parsed) {
1063
1063
  path: "/api/auth/device/start",
1064
1064
  method: "POST",
1065
1065
  body: {
1066
- // issue #93 phase 1 moves workspace login to device flow and stores a
1066
+ // phase 1 moves workspace login to device flow and stores a
1067
1067
  // dedicated CLI auth file instead of sharing the App config.
1068
1068
  clientName: DEFAULT_DEVICE_FLOW_CLIENT_NAME,
1069
1069
  source: "cli"
@@ -2381,29 +2381,13 @@ function resolveRepoRoot(startDir = process.cwd()) {
2381
2381
  return path4.resolve(process.env.WORKFLOW_REPO_ROOT);
2382
2382
  }
2383
2383
  for (const candidate of [startDir, CLI_MODULE_DIR]) {
2384
- const repoRoot = findRepoRoot2(candidate);
2384
+ const repoRoot = findWorkspaceRepositoryRoot(candidate);
2385
2385
  if (repoRoot !== void 0) {
2386
2386
  return repoRoot;
2387
2387
  }
2388
2388
  }
2389
2389
  return process.cwd();
2390
2390
  }
2391
- function findRepoRoot2(startDir) {
2392
- let current = path4.resolve(startDir);
2393
- while (true) {
2394
- if (isRepoRoot(current)) {
2395
- return current;
2396
- }
2397
- const parent = path4.dirname(current);
2398
- if (parent === current) {
2399
- return void 0;
2400
- }
2401
- current = parent;
2402
- }
2403
- }
2404
- function isRepoRoot(candidate) {
2405
- return existsSync2(path4.join(candidate, "pnpm-workspace.yaml")) && existsSync2(path4.join(candidate, "package.json")) && existsSync2(path4.join(candidate, "workspace", "package.json")) && existsSync2(path4.join(candidate, "packages", "cli", "package.json"));
2406
- }
2407
2391
  function trimTrailingSlash(value) {
2408
2392
  return value.replace(/\/+$/, "");
2409
2393
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workflow-code/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4-20260814003",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "workflow-code": "./dist/index.js"
@@ -13,26 +13,36 @@
13
13
  "publishConfig": {
14
14
  "access": "public"
15
15
  },
16
- "scripts": {
17
- "build": "tsup --config tsup.config.ts",
18
- "typecheck": "tsc --noEmit",
19
- "test": "cd ../.. && vitest run --config vitest.config.ts --project cli",
20
- "prepack": "pnpm build"
21
- },
22
16
  "dependencies": {
23
17
  "dotenv": "^17.4.2",
24
18
  "tsx": "^4.21.0"
25
19
  },
26
20
  "peerDependencies": {
27
- "workflow-code": ">=0.1.0 <0.2.0"
21
+ "workflow-code": "0.1.4-20260814004"
28
22
  },
29
23
  "devDependencies": {
30
24
  "@types/node": "^25.6.0",
31
- "@workflow-code/i18n": "workspace:*",
32
- "@workflow-code/auth-config": "workspace:*",
33
- "@workflow-code/workflow-ids": "workspace:*",
25
+ "@vitest/coverage-v8": "^4.1.7",
26
+ "semver": "^7.7.4",
34
27
  "tsup": "^8.5.1",
35
28
  "typescript": "^6.0.3",
36
- "workflow-code": "workspace:*"
29
+ "vitest": "^4.1.7",
30
+ "workflow-code": "0.1.4-20260814004",
31
+ "@workflow-code/i18n": "0.1.0",
32
+ "@workflow-code/auth-config": "0.1.0",
33
+ "@workflow-code/project-upload": "0.1.0",
34
+ "@workflow-code/workflow-ids": "0.1.0"
35
+ },
36
+ "scripts": {
37
+ "bootstrap": "node scripts/bootstrap.mjs",
38
+ "pnpm:devPreinstall": "node scripts/install-guard.mjs",
39
+ "check:boundaries": "node scripts/check-repository-boundaries.mjs",
40
+ "dev": "node scripts/dev.mjs",
41
+ "build": "tsup --config tsup.config.ts",
42
+ "typecheck": "tsc --noEmit",
43
+ "test": "pnpm build && vitest run",
44
+ "coverage": "pnpm build && vitest run --coverage",
45
+ "test:scripts": "node --test scripts/__tests__/*.test.mjs",
46
+ "release:prepare": "node scripts/prepare-release.mjs"
37
47
  }
38
- }
48
+ }