workflow-agent-cli 2.4.3 → 2.7.0

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.
@@ -1,5 +1,5 @@
1
- import { W as WorkflowConfig } from '../schema-OJg7YAI_.js';
2
- export { B as BranchType, C as ConventionalType, S as Scope, a as WorkflowConfigSchema } from '../schema-OJg7YAI_.js';
1
+ import { W as WorkflowConfig } from '../schema-D0zTM83x.js';
2
+ export { B as BranchType, C as ConventionalType, S as Scope, a as WorkflowConfigSchema } from '../schema-D0zTM83x.js';
3
3
  import 'zod';
4
4
 
5
5
  declare function loadConfig(cwd?: string): Promise<WorkflowConfig | null>;
@@ -2,7 +2,7 @@ import {
2
2
  WorkflowConfigSchema,
3
3
  hasConfig,
4
4
  loadConfig
5
- } from "../chunk-RDVTKGQV.js";
5
+ } from "../chunk-DEAF7P4L.js";
6
6
  export {
7
7
  WorkflowConfigSchema,
8
8
  hasConfig,
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { hasConfig, loadConfig } from './config/index.js';
2
2
  export { ValidationResult, discoverCustomScopes, getAllScopes, invalidateCustomScopesCache, validateBranchName, validateCommitMessage, validatePRTitle } from './validators/index.js';
3
- export { B as BranchType, C as ConventionalType, S as Scope, W as WorkflowConfig, a as WorkflowConfigSchema } from './schema-OJg7YAI_.js';
3
+ export { B as BranchType, C as ConventionalType, S as Scope, W as WorkflowConfig, a as WorkflowConfigSchema } from './schema-D0zTM83x.js';
4
4
  import 'zod';
5
5
 
6
6
  interface CheckDefinition {
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  runAllSetups,
10
10
  runCheck,
11
11
  stageAllChanges
12
- } from "./chunk-WXXFUPYO.js";
12
+ } from "./chunk-6NWQLGHI.js";
13
13
  import {
14
14
  discoverCustomScopes,
15
15
  getAllScopes,
@@ -22,7 +22,7 @@ import {
22
22
  WorkflowConfigSchema,
23
23
  hasConfig,
24
24
  loadConfig
25
- } from "./chunk-RDVTKGQV.js";
25
+ } from "./chunk-DEAF7P4L.js";
26
26
  export {
27
27
  QUALITY_CHECKS,
28
28
  WorkflowConfigSchema,
@@ -100,6 +100,79 @@ declare const WorkflowConfigSchema: z.ZodObject<{
100
100
  additionalMandatory?: string[] | undefined;
101
101
  optionalOverrides?: string[] | undefined;
102
102
  }>>;
103
+ advisory: z.ZodOptional<z.ZodObject<{
104
+ enabled: z.ZodDefault<z.ZodBoolean>;
105
+ defaultDepth: z.ZodDefault<z.ZodEnum<["executive", "quick", "standard", "comprehensive"]>>;
106
+ outputDir: z.ZodDefault<z.ZodString>;
107
+ customQuestions: z.ZodOptional<z.ZodArray<z.ZodObject<{
108
+ category: z.ZodString;
109
+ question: z.ZodString;
110
+ context: z.ZodOptional<z.ZodString>;
111
+ priority: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
112
+ }, "strip", z.ZodTypeAny, {
113
+ category: string;
114
+ question: string;
115
+ context?: string | undefined;
116
+ priority?: "high" | "medium" | "low" | undefined;
117
+ }, {
118
+ category: string;
119
+ question: string;
120
+ context?: string | undefined;
121
+ priority?: "high" | "medium" | "low" | undefined;
122
+ }>, "many">>;
123
+ riskThresholds: z.ZodOptional<z.ZodObject<{
124
+ high: z.ZodDefault<z.ZodNumber>;
125
+ medium: z.ZodDefault<z.ZodNumber>;
126
+ low: z.ZodDefault<z.ZodNumber>;
127
+ }, "strip", z.ZodTypeAny, {
128
+ high: number;
129
+ medium: number;
130
+ low: number;
131
+ }, {
132
+ high?: number | undefined;
133
+ medium?: number | undefined;
134
+ low?: number | undefined;
135
+ }>>;
136
+ categories: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
137
+ excludePatterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
138
+ includeHealthMetrics: z.ZodDefault<z.ZodBoolean>;
139
+ }, "strip", z.ZodTypeAny, {
140
+ enabled: boolean;
141
+ defaultDepth: "executive" | "quick" | "standard" | "comprehensive";
142
+ outputDir: string;
143
+ categories: string[];
144
+ includeHealthMetrics: boolean;
145
+ customQuestions?: {
146
+ category: string;
147
+ question: string;
148
+ context?: string | undefined;
149
+ priority?: "high" | "medium" | "low" | undefined;
150
+ }[] | undefined;
151
+ riskThresholds?: {
152
+ high: number;
153
+ medium: number;
154
+ low: number;
155
+ } | undefined;
156
+ excludePatterns?: string[] | undefined;
157
+ }, {
158
+ enabled?: boolean | undefined;
159
+ defaultDepth?: "executive" | "quick" | "standard" | "comprehensive" | undefined;
160
+ outputDir?: string | undefined;
161
+ customQuestions?: {
162
+ category: string;
163
+ question: string;
164
+ context?: string | undefined;
165
+ priority?: "high" | "medium" | "low" | undefined;
166
+ }[] | undefined;
167
+ riskThresholds?: {
168
+ high?: number | undefined;
169
+ medium?: number | undefined;
170
+ low?: number | undefined;
171
+ } | undefined;
172
+ categories?: string[] | undefined;
173
+ excludePatterns?: string[] | undefined;
174
+ includeHealthMetrics?: boolean | undefined;
175
+ }>>;
103
176
  }, "strip", z.ZodTypeAny, {
104
177
  projectName: string;
105
178
  scopes: {
@@ -116,6 +189,25 @@ declare const WorkflowConfigSchema: z.ZodObject<{
116
189
  nodeVersions?: string[] | undefined;
117
190
  checks?: ("build" | "test" | "lint" | "typecheck" | "format")[] | undefined;
118
191
  } | undefined;
192
+ advisory?: {
193
+ enabled: boolean;
194
+ defaultDepth: "executive" | "quick" | "standard" | "comprehensive";
195
+ outputDir: string;
196
+ categories: string[];
197
+ includeHealthMetrics: boolean;
198
+ customQuestions?: {
199
+ category: string;
200
+ question: string;
201
+ context?: string | undefined;
202
+ priority?: "high" | "medium" | "low" | undefined;
203
+ }[] | undefined;
204
+ riskThresholds?: {
205
+ high: number;
206
+ medium: number;
207
+ low: number;
208
+ } | undefined;
209
+ excludePatterns?: string[] | undefined;
210
+ } | undefined;
119
211
  branchTypes?: ("test" | "docs" | "feature" | "bugfix" | "hotfix" | "chore" | "refactor" | "release")[] | undefined;
120
212
  conventionalTypes?: ("build" | "test" | "docs" | "ci" | "chore" | "refactor" | "feat" | "fix" | "perf" | "style" | "revert")[] | undefined;
121
213
  analytics?: {
@@ -150,6 +242,25 @@ declare const WorkflowConfigSchema: z.ZodObject<{
150
242
  defaultBranch?: string | undefined;
151
243
  checks?: ("build" | "test" | "lint" | "typecheck" | "format")[] | undefined;
152
244
  } | undefined;
245
+ advisory?: {
246
+ enabled?: boolean | undefined;
247
+ defaultDepth?: "executive" | "quick" | "standard" | "comprehensive" | undefined;
248
+ outputDir?: string | undefined;
249
+ customQuestions?: {
250
+ category: string;
251
+ question: string;
252
+ context?: string | undefined;
253
+ priority?: "high" | "medium" | "low" | undefined;
254
+ }[] | undefined;
255
+ riskThresholds?: {
256
+ high?: number | undefined;
257
+ medium?: number | undefined;
258
+ low?: number | undefined;
259
+ } | undefined;
260
+ categories?: string[] | undefined;
261
+ excludePatterns?: string[] | undefined;
262
+ includeHealthMetrics?: boolean | undefined;
263
+ } | undefined;
153
264
  branchTypes?: ("test" | "docs" | "feature" | "bugfix" | "hotfix" | "chore" | "refactor" | "release")[] | undefined;
154
265
  conventionalTypes?: ("build" | "test" | "docs" | "ci" | "chore" | "refactor" | "feat" | "fix" | "perf" | "style" | "revert")[] | undefined;
155
266
  enforcement?: "strict" | "advisory" | "learning" | undefined;
@@ -1,45 +1,20 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ SCRIPT_CATEGORIES,
4
+ TOTAL_SCRIPTS,
5
+ WORKFLOW_SCRIPTS,
6
+ generateCopilotInstructions
7
+ } from "../chunk-HKRWHFVI.js";
2
8
 
3
9
  // src/scripts/postinstall.ts
4
10
  import { readFileSync, writeFileSync, existsSync } from "fs";
5
11
  import { join } from "path";
6
- var WORKFLOW_SCRIPTS = {
7
- // Core Commands
8
- "workflow:init": "workflow-agent init",
9
- "workflow:validate": "workflow-agent validate",
10
- "workflow:config": "workflow-agent config",
11
- "workflow:suggest": "workflow-agent suggest",
12
- "workflow:setup": "workflow-agent setup",
13
- "workflow:doctor": "workflow-agent doctor",
14
- // Scope Commands
15
- "workflow:scope:create": "workflow-agent scope:create",
16
- "workflow:scope:migrate": "workflow-agent scope:migrate",
17
- // Verification & Auto-Setup
18
- "workflow:verify": "workflow-agent verify",
19
- "workflow:verify:fix": "workflow-agent verify --fix",
20
- "workflow:auto-setup": "workflow-agent auto-setup",
21
- // Learning System Commands
22
- "workflow:learn:record": "workflow-agent learn:record",
23
- "workflow:learn:list": "workflow-agent learn:list",
24
- "workflow:learn:apply": "workflow-agent learn:apply",
25
- "workflow:learn:sync": "workflow-agent learn:sync",
26
- "workflow:learn:config": "workflow-agent learn:config",
27
- "workflow:learn:deprecate": "workflow-agent learn:deprecate",
28
- "workflow:learn:stats": "workflow-agent learn:stats",
29
- // Solution Pattern Commands
30
- "workflow:solution:capture": "workflow-agent solution:capture",
31
- "workflow:solution:search": "workflow-agent solution:search",
32
- "workflow:solution:list": "workflow-agent solution:list",
33
- "workflow:solution:apply": "workflow-agent solution:apply",
34
- "workflow:solution:deprecate": "workflow-agent solution:deprecate",
35
- "workflow:solution:stats": "workflow-agent solution:stats"
36
- };
37
12
  function isGlobalInstall() {
38
13
  const installPath = process.env.npm_config_global;
39
14
  return installPath === "true";
40
15
  }
41
16
  function findProjectRoot() {
42
- let currentDir = process.cwd();
17
+ const currentDir = process.cwd();
43
18
  if (currentDir.includes("node_modules")) {
44
19
  const parts = currentDir.split("node_modules");
45
20
  if (parts.length > 0 && parts[0]) {
@@ -66,61 +41,66 @@ function addScriptsToPackageJson() {
66
41
  if (!packageJson.scripts) {
67
42
  packageJson.scripts = {};
68
43
  }
69
- const hasWorkflowScripts = Object.keys(WORKFLOW_SCRIPTS).some(
70
- (scriptName) => packageJson.scripts[scriptName]
71
- );
72
- if (hasWorkflowScripts) {
73
- return;
74
- }
75
- let addedCount = 0;
44
+ const addedScripts = [];
45
+ const updatedScripts = [];
76
46
  for (const [scriptName, scriptCommand] of Object.entries(
77
47
  WORKFLOW_SCRIPTS
78
48
  )) {
79
49
  if (!packageJson.scripts[scriptName]) {
80
50
  packageJson.scripts[scriptName] = scriptCommand;
81
- addedCount++;
51
+ addedScripts.push(scriptName);
52
+ } else if (packageJson.scripts[scriptName] !== scriptCommand) {
53
+ packageJson.scripts[scriptName] = scriptCommand;
54
+ updatedScripts.push(scriptName);
82
55
  }
83
56
  }
84
- if (addedCount > 0) {
57
+ const totalChanges = addedScripts.length + updatedScripts.length;
58
+ if (totalChanges > 0) {
85
59
  writeFileSync(
86
60
  packageJsonPath,
87
61
  JSON.stringify(packageJson, null, 2) + "\n",
88
62
  "utf-8"
89
63
  );
90
- console.log("\n\u2713 Added workflow scripts to package.json:");
91
- console.log("\n Core Commands:");
92
- console.log(" - workflow:init");
93
- console.log(" - workflow:validate");
94
- console.log(" - workflow:config");
95
- console.log(" - workflow:suggest");
96
- console.log(" - workflow:setup");
97
- console.log(" - workflow:doctor");
98
- console.log("\n Scope Commands:");
99
- console.log(" - workflow:scope:create");
100
- console.log(" - workflow:scope:migrate");
101
- console.log("\n Verification:");
102
- console.log(" - workflow:verify");
103
- console.log(" - workflow:verify:fix");
104
- console.log(" - workflow:auto-setup");
105
- console.log("\n Learning System:");
106
- console.log(" - workflow:learn:record");
107
- console.log(" - workflow:learn:list");
108
- console.log(" - workflow:learn:apply");
109
- console.log(" - workflow:learn:sync");
110
- console.log(" - workflow:learn:config");
111
- console.log(" - workflow:learn:deprecate");
112
- console.log(" - workflow:learn:stats");
113
- console.log("\n Solution Patterns:");
114
- console.log(" - workflow:solution:capture");
115
- console.log(" - workflow:solution:search");
116
- console.log(" - workflow:solution:list");
117
- console.log(" - workflow:solution:apply");
118
- console.log(" - workflow:solution:deprecate");
119
- console.log(" - workflow:solution:stats");
64
+ const summaryParts = [];
65
+ if (addedScripts.length > 0) {
66
+ summaryParts.push(`${addedScripts.length} new`);
67
+ }
68
+ if (updatedScripts.length > 0) {
69
+ summaryParts.push(`${updatedScripts.length} updated`);
70
+ }
71
+ console.log(
72
+ `
73
+ \u2713 Workflow scripts configured in package.json (${summaryParts.join(", ")}):`
74
+ );
75
+ for (const [category, scripts] of Object.entries(SCRIPT_CATEGORIES)) {
76
+ console.log(`
77
+ ${category}:`);
78
+ for (const script of scripts) {
79
+ const isNew = addedScripts.includes(script);
80
+ const isUpdated = updatedScripts.includes(script);
81
+ const marker = isNew ? " (new)" : isUpdated ? " (updated)" : "";
82
+ console.log(` - ${script}${marker}`);
83
+ }
84
+ }
85
+ console.log(`
86
+ Total: ${TOTAL_SCRIPTS} scripts available`);
120
87
  console.log(
121
88
  "\nRun them with: npm run workflow:init (or pnpm run workflow:init)\n"
122
89
  );
123
90
  }
91
+ const guidelinesDir = join(projectRoot, "guidelines");
92
+ if (existsSync(guidelinesDir)) {
93
+ const result = generateCopilotInstructions(projectRoot, { silent: true });
94
+ if (result.success) {
95
+ const status = result.isNew ? "Generated" : "Updated";
96
+ console.log(
97
+ `\u2713 ${status} .github/copilot-instructions.md from ${result.guidelinesCount} guidelines`
98
+ );
99
+ if (result.preservedCustomContent) {
100
+ console.log(" (Custom content preserved)");
101
+ }
102
+ }
103
+ }
124
104
  } catch (error) {
125
105
  }
126
106
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/scripts/postinstall.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * Post-install script that automatically adds workflow scripts to package.json\n * when installed as a local dependency (not global)\n */\n\nimport { readFileSync, writeFileSync, existsSync } from \"fs\";\nimport { join } from \"path\";\n\nconst WORKFLOW_SCRIPTS = {\n // Core Commands\n \"workflow:init\": \"workflow-agent init\",\n \"workflow:validate\": \"workflow-agent validate\",\n \"workflow:config\": \"workflow-agent config\",\n \"workflow:suggest\": \"workflow-agent suggest\",\n \"workflow:setup\": \"workflow-agent setup\",\n \"workflow:doctor\": \"workflow-agent doctor\",\n\n // Scope Commands\n \"workflow:scope:create\": \"workflow-agent scope:create\",\n \"workflow:scope:migrate\": \"workflow-agent scope:migrate\",\n\n // Verification & Auto-Setup\n \"workflow:verify\": \"workflow-agent verify\",\n \"workflow:verify:fix\": \"workflow-agent verify --fix\",\n \"workflow:auto-setup\": \"workflow-agent auto-setup\",\n\n // Learning System Commands\n \"workflow:learn:record\": \"workflow-agent learn:record\",\n \"workflow:learn:list\": \"workflow-agent learn:list\",\n \"workflow:learn:apply\": \"workflow-agent learn:apply\",\n \"workflow:learn:sync\": \"workflow-agent learn:sync\",\n \"workflow:learn:config\": \"workflow-agent learn:config\",\n \"workflow:learn:deprecate\": \"workflow-agent learn:deprecate\",\n \"workflow:learn:stats\": \"workflow-agent learn:stats\",\n\n // Solution Pattern Commands\n \"workflow:solution:capture\": \"workflow-agent solution:capture\",\n \"workflow:solution:search\": \"workflow-agent solution:search\",\n \"workflow:solution:list\": \"workflow-agent solution:list\",\n \"workflow:solution:apply\": \"workflow-agent solution:apply\",\n \"workflow:solution:deprecate\": \"workflow-agent solution:deprecate\",\n \"workflow:solution:stats\": \"workflow-agent solution:stats\",\n};\n\nfunction isGlobalInstall(): boolean {\n // Check if we're being installed globally\n const installPath = process.env.npm_config_global;\n return installPath === \"true\";\n}\n\nfunction findProjectRoot(): string | null {\n // When installed as a dependency, npm/pnpm runs postinstall from the package directory\n // which is inside node_modules/@hawkinside_out/workflow-agent\n // We need to find the project root (the directory containing node_modules)\n\n let currentDir = process.cwd();\n\n // Check if we're inside node_modules\n if (currentDir.includes(\"node_modules\")) {\n // Split on 'node_modules' and take everything before it\n // This handles both node_modules/@scope/package and node_modules/package\n const parts = currentDir.split(\"node_modules\");\n if (parts.length > 0 && parts[0]) {\n // Remove trailing slash\n return parts[0].replace(/\\/$/, \"\");\n }\n }\n\n // If not in node_modules, we're probably in a monorepo workspace during development\n // Don't modify package.json in this case\n return null;\n}\n\nfunction addScriptsToPackageJson(): void {\n try {\n // Don't run for global installs\n if (isGlobalInstall()) {\n return;\n }\n\n const projectRoot = findProjectRoot();\n if (!projectRoot) {\n return;\n }\n\n const packageJsonPath = join(projectRoot, \"package.json\");\n\n if (!existsSync(packageJsonPath)) {\n return;\n }\n\n // Read existing package.json\n const packageJsonContent = readFileSync(packageJsonPath, \"utf-8\");\n const packageJson = JSON.parse(packageJsonContent);\n\n // Initialize scripts object if it doesn't exist\n if (!packageJson.scripts) {\n packageJson.scripts = {};\n }\n\n // Check if any workflow scripts already exist\n const hasWorkflowScripts = Object.keys(WORKFLOW_SCRIPTS).some(\n (scriptName) => packageJson.scripts[scriptName],\n );\n\n if (hasWorkflowScripts) {\n // Scripts already exist, don't overwrite\n return;\n }\n\n // Add workflow scripts\n let addedCount = 0;\n for (const [scriptName, scriptCommand] of Object.entries(\n WORKFLOW_SCRIPTS,\n )) {\n if (!packageJson.scripts[scriptName]) {\n packageJson.scripts[scriptName] = scriptCommand;\n addedCount++;\n }\n }\n\n if (addedCount > 0) {\n // Write back to package.json with proper formatting\n writeFileSync(\n packageJsonPath,\n JSON.stringify(packageJson, null, 2) + \"\\n\",\n \"utf-8\",\n );\n\n console.log(\"\\n Added workflow scripts to package.json:\");\n console.log(\"\\n Core Commands:\");\n console.log(\" - workflow:init\");\n console.log(\" - workflow:validate\");\n console.log(\" - workflow:config\");\n console.log(\" - workflow:suggest\");\n console.log(\" - workflow:setup\");\n console.log(\" - workflow:doctor\");\n console.log(\"\\n Scope Commands:\");\n console.log(\" - workflow:scope:create\");\n console.log(\" - workflow:scope:migrate\");\n console.log(\"\\n Verification:\");\n console.log(\" - workflow:verify\");\n console.log(\" - workflow:verify:fix\");\n console.log(\" - workflow:auto-setup\");\n console.log(\"\\n Learning System:\");\n console.log(\" - workflow:learn:record\");\n console.log(\" - workflow:learn:list\");\n console.log(\" - workflow:learn:apply\");\n console.log(\" - workflow:learn:sync\");\n console.log(\" - workflow:learn:config\");\n console.log(\" - workflow:learn:deprecate\");\n console.log(\" - workflow:learn:stats\");\n console.log(\"\\n Solution Patterns:\");\n console.log(\" - workflow:solution:capture\");\n console.log(\" - workflow:solution:search\");\n console.log(\" - workflow:solution:list\");\n console.log(\" - workflow:solution:apply\");\n console.log(\" - workflow:solution:deprecate\");\n console.log(\" - workflow:solution:stats\");\n console.log(\n \"\\nRun them with: npm run workflow:init (or pnpm run workflow:init)\\n\",\n );\n }\n } catch (error) {\n // Silently fail - this is a nice-to-have feature\n // We don't want to break the installation if something goes wrong\n }\n}\n\n// Run the script\naddScriptsToPackageJson();\n"],"mappings":";;;AAOA,SAAS,cAAc,eAAe,kBAAkB;AACxD,SAAS,YAAY;AAErB,IAAM,mBAAmB;AAAA;AAAA,EAEvB,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA;AAAA,EAGnB,yBAAyB;AAAA,EACzB,0BAA0B;AAAA;AAAA,EAG1B,mBAAmB;AAAA,EACnB,uBAAuB;AAAA,EACvB,uBAAuB;AAAA;AAAA,EAGvB,yBAAyB;AAAA,EACzB,uBAAuB;AAAA,EACvB,wBAAwB;AAAA,EACxB,uBAAuB;AAAA,EACvB,yBAAyB;AAAA,EACzB,4BAA4B;AAAA,EAC5B,wBAAwB;AAAA;AAAA,EAGxB,6BAA6B;AAAA,EAC7B,4BAA4B;AAAA,EAC5B,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,+BAA+B;AAAA,EAC/B,2BAA2B;AAC7B;AAEA,SAAS,kBAA2B;AAElC,QAAM,cAAc,QAAQ,IAAI;AAChC,SAAO,gBAAgB;AACzB;AAEA,SAAS,kBAAiC;AAKxC,MAAI,aAAa,QAAQ,IAAI;AAG7B,MAAI,WAAW,SAAS,cAAc,GAAG;AAGvC,UAAM,QAAQ,WAAW,MAAM,cAAc;AAC7C,QAAI,MAAM,SAAS,KAAK,MAAM,CAAC,GAAG;AAEhC,aAAO,MAAM,CAAC,EAAE,QAAQ,OAAO,EAAE;AAAA,IACnC;AAAA,EACF;AAIA,SAAO;AACT;AAEA,SAAS,0BAAgC;AACvC,MAAI;AAEF,QAAI,gBAAgB,GAAG;AACrB;AAAA,IACF;AAEA,UAAM,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BAA2B;AACvC,cAAQ,IAAI,4BAA4B;AACxC,cAAQ,IAAI,2BAA2B;AACvC,cAAQ,IAAI,6BAA6B;AACzC,cAAQ,IAAI,gCAAgC;AAC5C,cAAQ,IAAI,4BAA4B;AACxC,cAAQ,IAAI,wBAAwB;AACpC,cAAQ,IAAI,iCAAiC;AAC7C,cAAQ,IAAI,gCAAgC;AAC5C,cAAQ,IAAI,8BAA8B;AAC1C,cAAQ,IAAI,+BAA+B;AAC3C,cAAQ,IAAI,mCAAmC;AAC/C,cAAQ,IAAI,+BAA+B;AAC3C,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AAAA,EAGhB;AACF;AAGA,wBAAwB;","names":[]}
1
+ {"version":3,"sources":["../../src/scripts/postinstall.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * Post-install script that automatically adds workflow scripts to package.json\n * when installed as a local dependency (not global).\n *\n * On package update, this will also add any new scripts that were added in newer versions.\n */\n\nimport { readFileSync, writeFileSync, existsSync } from \"fs\";\nimport { join } from \"path\";\nimport {\n WORKFLOW_SCRIPTS,\n SCRIPT_CATEGORIES,\n TOTAL_SCRIPTS,\n} from \"./workflow-scripts.js\";\nimport { generateCopilotInstructions } from \"./copilot-instructions-generator.js\";\n\nfunction isGlobalInstall(): boolean {\n // Check if we're being installed globally\n const installPath = process.env.npm_config_global;\n return installPath === \"true\";\n}\n\nfunction findProjectRoot(): string | null {\n // When installed as a dependency, npm/pnpm runs postinstall from the package directory\n // which is inside node_modules/@hawkinside_out/workflow-agent\n // We need to find the project root (the directory containing node_modules)\n\n const currentDir = process.cwd();\n\n // Check if we're inside node_modules\n if (currentDir.includes(\"node_modules\")) {\n // Split on 'node_modules' and take everything before it\n // This handles both node_modules/@scope/package and node_modules/package\n const parts = currentDir.split(\"node_modules\");\n if (parts.length > 0 && parts[0]) {\n // Remove trailing slash\n return parts[0].replace(/\\/$/, \"\");\n }\n }\n\n // If not in node_modules, we're probably in a monorepo workspace during development\n // Don't modify package.json in this case\n return null;\n}\n\nfunction addScriptsToPackageJson(): void {\n try {\n // Don't run for global installs\n if (isGlobalInstall()) {\n return;\n }\n\n const projectRoot = findProjectRoot();\n if (!projectRoot) {\n return;\n }\n\n const packageJsonPath = join(projectRoot, \"package.json\");\n\n if (!existsSync(packageJsonPath)) {\n return;\n }\n\n // Read existing package.json\n const packageJsonContent = readFileSync(packageJsonPath, \"utf-8\");\n const packageJson = JSON.parse(packageJsonContent);\n\n // Initialize scripts object if it doesn't exist\n if (!packageJson.scripts) {\n packageJson.scripts = {};\n }\n\n // Track added and updated scripts separately\n const addedScripts: string[] = [];\n const updatedScripts: string[] = [];\n\n // Always add/update all workflow scripts (ensures updates get new scripts)\n for (const [scriptName, scriptCommand] of Object.entries(\n WORKFLOW_SCRIPTS,\n )) {\n if (!packageJson.scripts[scriptName]) {\n // Script doesn't exist - add it\n packageJson.scripts[scriptName] = scriptCommand;\n addedScripts.push(scriptName);\n } else if (packageJson.scripts[scriptName] !== scriptCommand) {\n // Script exists but has different value - update it\n packageJson.scripts[scriptName] = scriptCommand;\n updatedScripts.push(scriptName);\n }\n // If script exists with same value, do nothing (already up to date)\n }\n\n const totalChanges = addedScripts.length + updatedScripts.length;\n\n if (totalChanges > 0) {\n // Write back to package.json with proper formatting\n writeFileSync(\n packageJsonPath,\n JSON.stringify(packageJson, null, 2) + \"\\n\",\n \"utf-8\",\n );\n\n // Build summary message\n const summaryParts: string[] = [];\n if (addedScripts.length > 0) {\n summaryParts.push(`${addedScripts.length} new`);\n }\n if (updatedScripts.length > 0) {\n summaryParts.push(`${updatedScripts.length} updated`);\n }\n\n console.log(\n `\\n✓ Workflow scripts configured in package.json (${summaryParts.join(\", \")}):`,\n );\n\n // Display scripts by category\n for (const [category, scripts] of Object.entries(SCRIPT_CATEGORIES)) {\n console.log(`\\n ${category}:`);\n for (const script of scripts) {\n const isNew = addedScripts.includes(script);\n const isUpdated = updatedScripts.includes(script);\n const marker = isNew ? \" (new)\" : isUpdated ? \" (updated)\" : \"\";\n console.log(` - ${script}${marker}`);\n }\n }\n\n console.log(`\\n Total: ${TOTAL_SCRIPTS} scripts available`);\n console.log(\n \"\\nRun them with: npm run workflow:init (or pnpm run workflow:init)\\n\",\n );\n }\n\n // Generate .github/copilot-instructions.md if guidelines exist\n const guidelinesDir = join(projectRoot, \"guidelines\");\n if (existsSync(guidelinesDir)) {\n const result = generateCopilotInstructions(projectRoot, { silent: true });\n if (result.success) {\n const status = result.isNew ? \"Generated\" : \"Updated\";\n console.log(\n `✓ ${status} .github/copilot-instructions.md from ${result.guidelinesCount} guidelines`,\n );\n if (result.preservedCustomContent) {\n console.log(\" (Custom content preserved)\");\n }\n }\n }\n } catch (error) {\n // Silently fail - this is a nice-to-have feature\n // We don't want to break the installation if something goes wrong\n }\n}\n\n// Run the script\naddScriptsToPackageJson();\n"],"mappings":";;;;;;;;;AASA,SAAS,cAAc,eAAe,kBAAkB;AACxD,SAAS,YAAY;AAQrB,SAAS,kBAA2B;AAElC,QAAM,cAAc,QAAQ,IAAI;AAChC,SAAO,gBAAgB;AACzB;AAEA,SAAS,kBAAiC;AAKxC,QAAM,aAAa,QAAQ,IAAI;AAG/B,MAAI,WAAW,SAAS,cAAc,GAAG;AAGvC,UAAM,QAAQ,WAAW,MAAM,cAAc;AAC7C,QAAI,MAAM,SAAS,KAAK,MAAM,CAAC,GAAG;AAEhC,aAAO,MAAM,CAAC,EAAE,QAAQ,OAAO,EAAE;AAAA,IACnC;AAAA,EACF;AAIA,SAAO;AACT;AAEA,SAAS,0BAAgC;AACvC,MAAI;AAEF,QAAI,gBAAgB,GAAG;AACrB;AAAA,IACF;AAEA,UAAM,cAAc,gBAAgB;AACpC,QAAI,CAAC,aAAa;AAChB;AAAA,IACF;AAEA,UAAM,kBAAkB,KAAK,aAAa,cAAc;AAExD,QAAI,CAAC,WAAW,eAAe,GAAG;AAChC;AAAA,IACF;AAGA,UAAM,qBAAqB,aAAa,iBAAiB,OAAO;A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Q,IAAI;AAAA,WAAc,aAAa,oBAAoB;AAC3D,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAGA,UAAM,gBAAgB,KAAK,aAAa,YAAY;AACpD,QAAI,WAAW,aAAa,GAAG;AAC7B,YAAM,SAAS,4BAA4B,aAAa,EAAE,QAAQ,KAAK,CAAC;AACxE,UAAI,OAAO,SAAS;AAClB,cAAM,SAAS,OAAO,QAAQ,cAAc;AAC5C,gBAAQ;AAAA,UACN,UAAK,MAAM,yCAAyC,OAAO,eAAe;AAAA,QAC5E;AACA,YAAI,OAAO,wBAAwB;AACjC,kBAAQ,IAAI,8BAA8B;AAAA,QAC5C;AAAA,MACF;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AAAA,EAGhB;AACF;AAGA,wBAAwB;","names":[]}
@@ -1,4 +1,4 @@
1
- import { S as Scope, W as WorkflowConfig } from '../schema-OJg7YAI_.js';
1
+ import { S as Scope, W as WorkflowConfig } from '../schema-D0zTM83x.js';
2
2
  import 'zod';
3
3
 
4
4
  interface ValidationResult {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workflow-agent-cli",
3
- "version": "2.4.3",
3
+ "version": "2.7.0",
4
4
  "description": "A self-evolving workflow management system for AI agent development",
5
5
  "keywords": [
6
6
  "workflow",
@@ -50,7 +50,39 @@
50
50
  "typecheck": "tsc --noEmit",
51
51
  "clean": "rm -rf dist",
52
52
  "postinstall": "node dist/scripts/postinstall.js || true",
53
- "prepublishOnly": "pnpm build && pnpm test"
53
+ "prepublishOnly": "pnpm build && pnpm test",
54
+ "workflow": "node dist/cli/index.js",
55
+ "workflow:init": "node dist/cli/index.js init",
56
+ "workflow:validate": "node dist/cli/index.js validate",
57
+ "workflow:doctor": "node dist/cli/index.js doctor",
58
+ "workflow:verify": "node dist/cli/index.js verify",
59
+ "workflow:setup": "node dist/cli/index.js setup",
60
+ "workflow:suggest": "node dist/cli/index.js suggest",
61
+ "workflow:config": "node dist/cli/index.js config",
62
+ "workflow:auto-setup": "node dist/cli/index.js auto-setup",
63
+ "advisory": "node dist/cli/index.js advisory",
64
+ "advisory:quick": "node dist/cli/index.js advisory --depth quick",
65
+ "advisory:standard": "node dist/cli/index.js advisory --depth standard",
66
+ "advisory:comprehensive": "node dist/cli/index.js advisory --depth comprehensive",
67
+ "advisory:executive": "node dist/cli/index.js advisory --depth executive",
68
+ "advisory:ci": "node dist/cli/index.js advisory --ci",
69
+ "learn": "node dist/cli/index.js learn:list",
70
+ "learn:record": "node dist/cli/index.js learn:record",
71
+ "learn:list": "node dist/cli/index.js learn:list",
72
+ "learn:apply": "node dist/cli/index.js learn:apply",
73
+ "learn:sync": "node dist/cli/index.js learn:sync",
74
+ "learn:config": "node dist/cli/index.js learn:config",
75
+ "learn:deprecate": "node dist/cli/index.js learn:deprecate",
76
+ "learn:stats": "node dist/cli/index.js learn:stats",
77
+ "solution": "node dist/cli/index.js solution:list",
78
+ "solution:capture": "node dist/cli/index.js solution:capture",
79
+ "solution:search": "node dist/cli/index.js solution:search",
80
+ "solution:list": "node dist/cli/index.js solution:list",
81
+ "solution:apply": "node dist/cli/index.js solution:apply",
82
+ "solution:deprecate": "node dist/cli/index.js solution:deprecate",
83
+ "solution:stats": "node dist/cli/index.js solution:stats",
84
+ "scope:create": "node dist/cli/index.js scope:create",
85
+ "scope:migrate": "node dist/cli/index.js scope:migrate"
54
86
  },
55
87
  "dependencies": {
56
88
  "@clack/prompts": "^0.7.0",