workflow-agent-cli 2.22.0 → 2.22.1
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 +44 -36
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -45,6 +45,9 @@ import {
|
|
|
45
45
|
// src/cli/index.ts
|
|
46
46
|
import { Command as Command7 } from "commander";
|
|
47
47
|
import chalk23 from "chalk";
|
|
48
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
49
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
50
|
+
import { dirname as dirname5, join as join12 } from "path";
|
|
48
51
|
|
|
49
52
|
// src/cli/commands/init.ts
|
|
50
53
|
import * as p from "@clack/prompts";
|
|
@@ -924,23 +927,23 @@ async function setupCommand() {
|
|
|
924
927
|
process.exit(1);
|
|
925
928
|
}
|
|
926
929
|
const packageJsonContent = readFileSync(packageJsonPath, "utf-8");
|
|
927
|
-
const
|
|
928
|
-
if (!
|
|
929
|
-
|
|
930
|
+
const packageJson2 = JSON.parse(packageJsonContent);
|
|
931
|
+
if (!packageJson2.scripts) {
|
|
932
|
+
packageJson2.scripts = {};
|
|
930
933
|
}
|
|
931
934
|
let scriptAdded = false;
|
|
932
935
|
let scriptUpdated = false;
|
|
933
936
|
const removedScripts = [];
|
|
934
937
|
for (const deprecatedScript of DEPRECATED_SCRIPTS) {
|
|
935
|
-
if (
|
|
936
|
-
delete
|
|
938
|
+
if (packageJson2.scripts[deprecatedScript] !== void 0) {
|
|
939
|
+
delete packageJson2.scripts[deprecatedScript];
|
|
937
940
|
removedScripts.push(deprecatedScript);
|
|
938
941
|
}
|
|
939
942
|
}
|
|
940
|
-
const oldScripts = validateAllScripts(
|
|
943
|
+
const oldScripts = validateAllScripts(packageJson2.scripts);
|
|
941
944
|
for (const oldScript of oldScripts) {
|
|
942
|
-
if (
|
|
943
|
-
delete
|
|
945
|
+
if (packageJson2.scripts[oldScript] !== void 0) {
|
|
946
|
+
delete packageJson2.scripts[oldScript];
|
|
944
947
|
if (!removedScripts.includes(oldScript)) {
|
|
945
948
|
removedScripts.push(oldScript);
|
|
946
949
|
}
|
|
@@ -948,11 +951,11 @@ async function setupCommand() {
|
|
|
948
951
|
}
|
|
949
952
|
const scriptName = "workflow";
|
|
950
953
|
const scriptCommand = WORKFLOW_SCRIPTS.workflow;
|
|
951
|
-
if (!
|
|
952
|
-
|
|
954
|
+
if (!packageJson2.scripts[scriptName]) {
|
|
955
|
+
packageJson2.scripts[scriptName] = scriptCommand;
|
|
953
956
|
scriptAdded = true;
|
|
954
|
-
} else if (
|
|
955
|
-
|
|
957
|
+
} else if (packageJson2.scripts[scriptName] !== scriptCommand) {
|
|
958
|
+
packageJson2.scripts[scriptName] = scriptCommand;
|
|
956
959
|
scriptUpdated = true;
|
|
957
960
|
}
|
|
958
961
|
const hasChanges = scriptAdded || scriptUpdated || removedScripts.length > 0;
|
|
@@ -964,7 +967,7 @@ async function setupCommand() {
|
|
|
964
967
|
}
|
|
965
968
|
writeFileSync(
|
|
966
969
|
packageJsonPath,
|
|
967
|
-
JSON.stringify(
|
|
970
|
+
JSON.stringify(packageJson2, null, 2) + "\n",
|
|
968
971
|
"utf-8"
|
|
969
972
|
);
|
|
970
973
|
console.log(
|
|
@@ -1373,7 +1376,7 @@ async function scopeCreateCommand(options) {
|
|
|
1373
1376
|
spinner10.start("Creating package structure...");
|
|
1374
1377
|
try {
|
|
1375
1378
|
await mkdir3(join5(outputDir, "src"), { recursive: true });
|
|
1376
|
-
const
|
|
1379
|
+
const packageJson2 = {
|
|
1377
1380
|
name: `@workflow/scopes-${packageName}`,
|
|
1378
1381
|
version: "1.0.0",
|
|
1379
1382
|
description: `Scope preset for ${presetName}`,
|
|
@@ -1414,7 +1417,7 @@ async function scopeCreateCommand(options) {
|
|
|
1414
1417
|
};
|
|
1415
1418
|
await writeFile3(
|
|
1416
1419
|
join5(outputDir, "package.json"),
|
|
1417
|
-
JSON.stringify(
|
|
1420
|
+
JSON.stringify(packageJson2, null, 2),
|
|
1418
1421
|
"utf-8"
|
|
1419
1422
|
);
|
|
1420
1423
|
const tsconfig = {
|
|
@@ -1685,7 +1688,7 @@ async function scopeMigrateCommand(options) {
|
|
|
1685
1688
|
spinner10.start("Migrating scopes to package...");
|
|
1686
1689
|
try {
|
|
1687
1690
|
await mkdir4(join6(outputDir, "src"), { recursive: true });
|
|
1688
|
-
const
|
|
1691
|
+
const packageJson2 = {
|
|
1689
1692
|
name: `@workflow/scopes-${packageName}`,
|
|
1690
1693
|
version: "1.0.0",
|
|
1691
1694
|
description: `Migrated scope preset for ${presetName}`,
|
|
@@ -1726,7 +1729,7 @@ async function scopeMigrateCommand(options) {
|
|
|
1726
1729
|
};
|
|
1727
1730
|
await writeFile4(
|
|
1728
1731
|
join6(outputDir, "package.json"),
|
|
1729
|
-
JSON.stringify(
|
|
1732
|
+
JSON.stringify(packageJson2, null, 2),
|
|
1730
1733
|
"utf-8"
|
|
1731
1734
|
);
|
|
1732
1735
|
const tsconfig = {
|
|
@@ -2377,9 +2380,9 @@ var AdvisoryAnalyzer = class {
|
|
|
2377
2380
|
* Executive depth: High-level business summary only
|
|
2378
2381
|
*/
|
|
2379
2382
|
async analyzeExecutive(timestamp, project) {
|
|
2380
|
-
const
|
|
2381
|
-
const deps =
|
|
2382
|
-
const devDeps =
|
|
2383
|
+
const packageJson2 = await this.readPackageJson();
|
|
2384
|
+
const deps = packageJson2.dependencies || {};
|
|
2385
|
+
const devDeps = packageJson2.devDependencies || {};
|
|
2383
2386
|
const techCategories = this.categorizeTechnologies(deps, devDeps);
|
|
2384
2387
|
const risks = this.calculateExecutiveRisks(project, techCategories);
|
|
2385
2388
|
const opportunities = this.calculateExecutiveOpportunities(
|
|
@@ -2413,18 +2416,18 @@ var AdvisoryAnalyzer = class {
|
|
|
2413
2416
|
* Analyze project overview
|
|
2414
2417
|
*/
|
|
2415
2418
|
async analyzeProject() {
|
|
2416
|
-
const
|
|
2419
|
+
const packageJson2 = await this.readPackageJson();
|
|
2417
2420
|
const isMonorepoProject = await isMonorepo(this.options.cwd);
|
|
2418
2421
|
const fileCount = await this.countFiles();
|
|
2419
2422
|
const totalLines = await this.countTotalLines();
|
|
2420
2423
|
let workspaceCount;
|
|
2421
|
-
if (isMonorepoProject &&
|
|
2422
|
-
workspaceCount = Array.isArray(
|
|
2424
|
+
if (isMonorepoProject && packageJson2.workspaces) {
|
|
2425
|
+
workspaceCount = Array.isArray(packageJson2.workspaces) ? packageJson2.workspaces.length : 0;
|
|
2423
2426
|
}
|
|
2424
2427
|
return {
|
|
2425
|
-
name:
|
|
2426
|
-
version:
|
|
2427
|
-
description:
|
|
2428
|
+
name: packageJson2.name || "Unknown Project",
|
|
2429
|
+
version: packageJson2.version || "0.0.0",
|
|
2430
|
+
description: packageJson2.description,
|
|
2428
2431
|
isMonorepo: isMonorepoProject,
|
|
2429
2432
|
packageManager: await detectPackageManager(this.options.cwd),
|
|
2430
2433
|
workspaceCount,
|
|
@@ -2436,9 +2439,9 @@ var AdvisoryAnalyzer = class {
|
|
|
2436
2439
|
* Analyze technology stack
|
|
2437
2440
|
*/
|
|
2438
2441
|
async analyzeTechnology() {
|
|
2439
|
-
const
|
|
2440
|
-
const deps =
|
|
2441
|
-
const devDeps =
|
|
2442
|
+
const packageJson2 = await this.readPackageJson();
|
|
2443
|
+
const deps = packageJson2.dependencies || {};
|
|
2444
|
+
const devDeps = packageJson2.devDependencies || {};
|
|
2442
2445
|
const projectAnalysis = await analyzeProject(this.options.cwd);
|
|
2443
2446
|
return {
|
|
2444
2447
|
framework: projectAnalysis.framework,
|
|
@@ -2454,9 +2457,9 @@ var AdvisoryAnalyzer = class {
|
|
|
2454
2457
|
* Analyze packages in detail
|
|
2455
2458
|
*/
|
|
2456
2459
|
async analyzePackages() {
|
|
2457
|
-
const
|
|
2458
|
-
const deps =
|
|
2459
|
-
const devDeps =
|
|
2460
|
+
const packageJson2 = await this.readPackageJson();
|
|
2461
|
+
const deps = packageJson2.dependencies || {};
|
|
2462
|
+
const devDeps = packageJson2.devDependencies || {};
|
|
2460
2463
|
const production = this.analyzeDependencies(deps, "production");
|
|
2461
2464
|
const development = this.analyzeDependencies(devDeps, "development");
|
|
2462
2465
|
const categories = this.categorizeTechnologies(deps, devDeps);
|
|
@@ -7267,10 +7270,10 @@ async function inferTagsFromDependencies(cwd) {
|
|
|
7267
7270
|
return tags;
|
|
7268
7271
|
}
|
|
7269
7272
|
try {
|
|
7270
|
-
const
|
|
7273
|
+
const packageJson2 = JSON.parse(fs2.readFileSync(packageJsonPath, "utf-8"));
|
|
7271
7274
|
const allDeps = {
|
|
7272
|
-
...
|
|
7273
|
-
...
|
|
7275
|
+
...packageJson2.dependencies,
|
|
7276
|
+
...packageJson2.devDependencies
|
|
7274
7277
|
};
|
|
7275
7278
|
for (const dep of Object.keys(allDeps)) {
|
|
7276
7279
|
const mappedTags = LIBRARY_TAG_MAP[dep];
|
|
@@ -8403,6 +8406,11 @@ ${chalk22.bold("Examples:")}
|
|
|
8403
8406
|
}
|
|
8404
8407
|
|
|
8405
8408
|
// src/cli/index.ts
|
|
8409
|
+
var __filename4 = fileURLToPath4(import.meta.url);
|
|
8410
|
+
var __dirname4 = dirname5(__filename4);
|
|
8411
|
+
var packageJson = JSON.parse(
|
|
8412
|
+
readFileSync3(join12(__dirname4, "../../package.json"), "utf-8")
|
|
8413
|
+
);
|
|
8406
8414
|
function deprecationWarning(oldCmd, newCmd) {
|
|
8407
8415
|
console.warn(chalk23.yellow(`\u26A0\uFE0F "${oldCmd}" is deprecated and will be removed in v2.0.`));
|
|
8408
8416
|
console.warn(chalk23.yellow(` Use: ${newCmd}
|
|
@@ -8411,7 +8419,7 @@ function deprecationWarning(oldCmd, newCmd) {
|
|
|
8411
8419
|
var program = new Command7();
|
|
8412
8420
|
program.name("workflow").description(
|
|
8413
8421
|
"A self-evolving workflow management system for AI agent development"
|
|
8414
|
-
).version(
|
|
8422
|
+
).version(packageJson.version);
|
|
8415
8423
|
program.addCommand(createDocsCommand());
|
|
8416
8424
|
program.addCommand(createSolutionCommand());
|
|
8417
8425
|
program.addCommand(createLearnCommand());
|