workflow-agent-cli 2.4.2 → 2.6.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,20 +1,19 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ SCRIPT_CATEGORIES,
4
+ TOTAL_SCRIPTS,
5
+ WORKFLOW_SCRIPTS
6
+ } from "../chunk-LN5OAWEQ.js";
2
7
 
3
8
  // src/scripts/postinstall.ts
4
9
  import { readFileSync, writeFileSync, existsSync } from "fs";
5
10
  import { join } from "path";
6
- var WORKFLOW_SCRIPTS = {
7
- "workflow:init": "workflow-agent init",
8
- "workflow:validate": "workflow-agent validate",
9
- "workflow:suggest": "workflow-agent suggest",
10
- "workflow:doctor": "workflow-agent doctor"
11
- };
12
11
  function isGlobalInstall() {
13
12
  const installPath = process.env.npm_config_global;
14
13
  return installPath === "true";
15
14
  }
16
15
  function findProjectRoot() {
17
- let currentDir = process.cwd();
16
+ const currentDir = process.cwd();
18
17
  if (currentDir.includes("node_modules")) {
19
18
  const parts = currentDir.split("node_modules");
20
19
  if (parts.length > 0 && parts[0]) {
@@ -41,31 +40,49 @@ function addScriptsToPackageJson() {
41
40
  if (!packageJson.scripts) {
42
41
  packageJson.scripts = {};
43
42
  }
44
- const hasWorkflowScripts = Object.keys(WORKFLOW_SCRIPTS).some(
45
- (scriptName) => packageJson.scripts[scriptName]
46
- );
47
- if (hasWorkflowScripts) {
48
- return;
49
- }
50
- let addedCount = 0;
43
+ const addedScripts = [];
44
+ const updatedScripts = [];
51
45
  for (const [scriptName, scriptCommand] of Object.entries(
52
46
  WORKFLOW_SCRIPTS
53
47
  )) {
54
48
  if (!packageJson.scripts[scriptName]) {
55
49
  packageJson.scripts[scriptName] = scriptCommand;
56
- addedCount++;
50
+ addedScripts.push(scriptName);
51
+ } else if (packageJson.scripts[scriptName] !== scriptCommand) {
52
+ packageJson.scripts[scriptName] = scriptCommand;
53
+ updatedScripts.push(scriptName);
57
54
  }
58
55
  }
59
- if (addedCount > 0) {
56
+ const totalChanges = addedScripts.length + updatedScripts.length;
57
+ if (totalChanges > 0) {
60
58
  writeFileSync(
61
59
  packageJsonPath,
62
60
  JSON.stringify(packageJson, null, 2) + "\n",
63
61
  "utf-8"
64
62
  );
65
- console.log("\n\u2713 Added workflow scripts to package.json:");
66
- Object.keys(WORKFLOW_SCRIPTS).forEach((scriptName) => {
67
- console.log(` - ${scriptName}`);
68
- });
63
+ const summaryParts = [];
64
+ if (addedScripts.length > 0) {
65
+ summaryParts.push(`${addedScripts.length} new`);
66
+ }
67
+ if (updatedScripts.length > 0) {
68
+ summaryParts.push(`${updatedScripts.length} updated`);
69
+ }
70
+ console.log(
71
+ `
72
+ \u2713 Workflow scripts configured in package.json (${summaryParts.join(", ")}):`
73
+ );
74
+ for (const [category, scripts] of Object.entries(SCRIPT_CATEGORIES)) {
75
+ console.log(`
76
+ ${category}:`);
77
+ for (const script of scripts) {
78
+ const isNew = addedScripts.includes(script);
79
+ const isUpdated = updatedScripts.includes(script);
80
+ const marker = isNew ? " (new)" : isUpdated ? " (updated)" : "";
81
+ console.log(` - ${script}${marker}`);
82
+ }
83
+ }
84
+ console.log(`
85
+ Total: ${TOTAL_SCRIPTS} scripts available`);
69
86
  console.log(
70
87
  "\nRun them with: npm run workflow:init (or pnpm run workflow:init)\n"
71
88
  );
@@ -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 \"workflow:init\": \"workflow-agent init\",\n \"workflow:validate\": \"workflow-agent validate\",\n \"workflow:suggest\": \"workflow-agent suggest\",\n \"workflow:doctor\": \"workflow-agent doctor\",\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 Object.keys(WORKFLOW_SCRIPTS).forEach((scriptName) => {\n console.log(` - ${scriptName}`);\n });\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,EACvB,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,mBAAmB;AACrB;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,cAA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../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\";\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 `\\nWorkflow 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 } 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;AAOrB,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,W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;AAAA,MACtD;AAEA,cAAQ;AAAA,QACN;AAAA,sDAAoD,aAAa,KAAK,IAAI,CAAC;AAAA,MAC7E;AAGA,iBAAW,CAAC,UAAU,OAAO,KAAK,OAAO,QAAQ,iBAAiB,GAAG;AACnE,gBAAQ,IAAI;AAAA,IAAO,QAAQ,GAAG;AAC9B,mBAAW,UAAU,SAAS;AAC5B,gBAAM,QAAQ,aAAa,SAAS,MAAM;AAC1C,gBAAM,YAAY,eAAe,SAAS,MAAM;AAChD,gBAAM,SAAS,QAAQ,WAAW,YAAY,eAAe;AAC7D,kBAAQ,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE;AAAA,QACxC;AAAA,MACF;AAEA,cAAQ,IAAI;AAAA,WAAc,aAAa,oBAAoB;AAC3D,cAAQ;AAAA,QACN;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.2",
3
+ "version": "2.6.0",
4
4
  "description": "A self-evolving workflow management system for AI agent development",
5
5
  "keywords": [
6
6
  "workflow",
@@ -49,11 +49,44 @@
49
49
  "lint": "echo \"ESLint not configured - skipping\"",
50
50
  "typecheck": "tsc --noEmit",
51
51
  "clean": "rm -rf dist",
52
- "postinstall": "node dist/scripts/postinstall.js || true"
52
+ "postinstall": "node dist/scripts/postinstall.js || true",
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"
53
86
  },
54
87
  "dependencies": {
55
88
  "@clack/prompts": "^0.7.0",
56
- "@hawkinside_out/workflow-improvement-tracker": "^1.0.0",
89
+ "@hawkinside_out/workflow-improvement-tracker": "^1.1.1",
57
90
  "chalk": "^5.3.0",
58
91
  "commander": "^11.1.0",
59
92
  "cosmiconfig": "^9.0.0",
@@ -22,28 +22,30 @@
22
22
 
23
23
  Initiate pattern analysis when:
24
24
 
25
- | Trigger | Description |
26
- |---------|-------------|
27
- | **Post-fix success** | A quality issue was detected and auto-fixed successfully |
28
- | **User request** | User explicitly asks to "analyze patterns" or "record what we learned" |
29
- | **Project setup complete** | A new project was scaffolded and configured successfully |
30
- | **Migration complete** | A framework upgrade or refactor was completed without issues |
31
- | **CI/CD passing** | All quality checks pass after non-trivial changes |
25
+ | Trigger | Description |
26
+ | -------------------------- | ---------------------------------------------------------------------- |
27
+ | **Post-fix success** | A quality issue was detected and auto-fixed successfully |
28
+ | **User request** | User explicitly asks to "analyze patterns" or "record what we learned" |
29
+ | **Project setup complete** | A new project was scaffolded and configured successfully |
30
+ | **Migration complete** | A framework upgrade or refactor was completed without issues |
31
+ | **CI/CD passing** | All quality checks pass after non-trivial changes |
32
32
 
33
33
  ---
34
34
 
35
35
  ## Phase 1: Discovery
36
36
 
37
37
  ### Objective
38
+
38
39
  Identify candidate patterns worth capturing from the current work session.
39
40
 
40
41
  ### Steps
41
42
 
42
43
  1. **Review Recent Changes**
44
+
43
45
  ```bash
44
46
  # Check what was modified
45
47
  git diff HEAD~5 --name-only
46
-
48
+
47
49
  # Review specific fix patterns
48
50
  git log --oneline -10 --grep="fix"
49
51
  ```
@@ -58,6 +60,7 @@ Identify candidate patterns worth capturing from the current work session.
58
60
  - ✅ Framework-specific workarounds
59
61
 
60
62
  3. **Check Existing Patterns**
63
+
61
64
  ```bash
62
65
  # List current patterns to avoid duplicates
63
66
  workflow learn:list --framework <current-framework>
@@ -77,29 +80,30 @@ Identify candidate patterns worth capturing from the current work session.
77
80
  ## Phase 2: Categorization
78
81
 
79
82
  ### Objective
83
+
80
84
  Classify each pattern candidate into the appropriate type and category.
81
85
 
82
86
  ### Pattern Types
83
87
 
84
- | Type | Use When | Example |
85
- |------|----------|---------|
86
- | **Fix Pattern** | Solves a specific, repeatable error | ESLint rule violation fix |
87
- | **Blueprint** | Represents complete project/feature setup | Next.js 14 TypeScript starter |
88
+ | Type | Use When | Example |
89
+ | --------------- | ----------------------------------------- | ----------------------------- |
90
+ | **Fix Pattern** | Solves a specific, repeatable error | ESLint rule violation fix |
91
+ | **Blueprint** | Represents complete project/feature setup | Next.js 14 TypeScript starter |
88
92
 
89
93
  ### Fix Pattern Categories
90
94
 
91
95
  Choose the most specific category:
92
96
 
93
- | Category | Description | Examples |
94
- |----------|-------------|----------|
95
- | `lint` | Linting rule violations | ESLint, Prettier, Stylelint |
96
- | `type-error` | TypeScript/type system errors | Missing types, inference issues |
97
- | `dependency` | Package/module resolution | Missing deps, version conflicts |
98
- | `config` | Configuration file issues | tsconfig, next.config, vite.config |
99
- | `runtime` | Runtime errors | Null refs, async issues |
100
- | `build` | Build/compilation failures | Bundler errors, missing exports |
101
- | `test` | Test failures | Jest, Vitest, Playwright |
102
- | `security` | Security vulnerabilities | Dependency audits, secrets |
97
+ | Category | Description | Examples |
98
+ | ------------ | ----------------------------- | ---------------------------------- |
99
+ | `lint` | Linting rule violations | ESLint, Prettier, Stylelint |
100
+ | `type-error` | TypeScript/type system errors | Missing types, inference issues |
101
+ | `dependency` | Package/module resolution | Missing deps, version conflicts |
102
+ | `config` | Configuration file issues | tsconfig, next.config, vite.config |
103
+ | `runtime` | Runtime errors | Null refs, async issues |
104
+ | `build` | Build/compilation failures | Bundler errors, missing exports |
105
+ | `test` | Test failures | Jest, Vitest, Playwright |
106
+ | `security` | Security vulnerabilities | Dependency audits, secrets |
103
107
 
104
108
  ### Tag Schema
105
109
 
@@ -118,6 +122,7 @@ custom:<value> → custom:app-router, custom:server-component
118
122
  ## Phase 3: Pattern Extraction
119
123
 
120
124
  ### Objective
125
+
121
126
  Convert the identified fixes into structured pattern definitions.
122
127
 
123
128
  ### For Fix Patterns
@@ -130,14 +135,14 @@ Extract these components:
130
135
  name: string, // "ESLint prefer-const fix"
131
136
  description: string, // "Replace let with const for variables that are never reassigned"
132
137
  category: string, // "lint"
133
-
138
+
134
139
  // TRIGGER (when does this apply?)
135
140
  trigger: {
136
141
  errorPattern: string, // Regex: "Prefer const over let"
137
142
  errorMessage: string, // Example: "'x' is never reassigned"
138
143
  filePattern: string, // Glob: "*.ts,*.tsx"
139
144
  },
140
-
145
+
141
146
  // SOLUTION (how to fix it)
142
147
  solution: {
143
148
  type: string, // "file-change" | "command" | "config-update"
@@ -148,7 +153,7 @@ Extract these components:
148
153
  description: string, // Human-readable step
149
154
  }]
150
155
  },
151
-
156
+
152
157
  // COMPATIBILITY (where does this work?)
153
158
  compatibility: {
154
159
  framework: string, // "next" | "react" | "vue" | ...
@@ -156,7 +161,7 @@ Extract these components:
156
161
  runtime: string, // "node"
157
162
  runtimeVersion: string, // ">=18.0.0"
158
163
  },
159
-
164
+
160
165
  // METADATA
161
166
  tags: [{ name: string, category: string }],
162
167
  source: "manual" | "auto-heal" | "verify-fix" | "imported",
@@ -173,7 +178,7 @@ Extract these components:
173
178
  // IDENTIFICATION
174
179
  name: string, // "Next.js 14 TypeScript Starter"
175
180
  description: string, // "Complete setup with App Router, Tailwind, and testing"
176
-
181
+
177
182
  // STACK DEFINITION
178
183
  stack: {
179
184
  framework: string, // "next"
@@ -183,20 +188,20 @@ Extract these components:
183
188
  dependencies: [{ name: string, version: string }],
184
189
  devDependencies: [{ name: string, version: string }],
185
190
  },
186
-
191
+
187
192
  // PROJECT STRUCTURE
188
193
  structure: {
189
194
  directories: [{ path: string, purpose: string }],
190
195
  keyFiles: [{ path: string, purpose: string, template?: string }],
191
196
  },
192
-
197
+
193
198
  // SETUP STEPS
194
199
  setup: {
195
200
  prerequisites: string[],
196
201
  steps: [{ order: number, command: string, description: string }],
197
202
  configs: [{ file: string, content: string, description: string }],
198
203
  },
199
-
204
+
200
205
  // METADATA
201
206
  tags: [{ name: string, category: string }],
202
207
  relatedPatterns: string[], // UUIDs of related fix patterns
@@ -209,6 +214,7 @@ Extract these components:
209
214
  ## Phase 4: Validation
210
215
 
211
216
  ### Objective
217
+
212
218
  Ensure patterns are high-quality before storing.
213
219
 
214
220
  ### Quality Checklist
@@ -236,19 +242,20 @@ workflow learn:record --type fix --name "..." --dry-run
236
242
 
237
243
  Ensure these are NOT in the pattern:
238
244
 
239
- | Data Type | Example | Action |
240
- |-----------|---------|--------|
241
- | Absolute paths | `/home/user/project` | Remove or use `<PATH>` |
242
- | Email addresses | `dev@company.com` | Remove entirely |
243
- | API keys | `sk_live_...` | Never include |
244
- | IP addresses | `192.168.1.100` | Remove or use `<IP>` |
245
- | Repo-specific names | `my-company-app` | Generalize |
245
+ | Data Type | Example | Action |
246
+ | ------------------- | -------------------- | ---------------------- |
247
+ | Absolute paths | `/home/user/project` | Remove or use `<PATH>` |
248
+ | Email addresses | `dev@company.com` | Remove entirely |
249
+ | API keys | `sk_live_...` | Never include |
250
+ | IP addresses | `192.168.1.100` | Remove or use `<IP>` |
251
+ | Repo-specific names | `my-company-app` | Generalize |
246
252
 
247
253
  ---
248
254
 
249
255
  ## Phase 5: Store Update
250
256
 
251
257
  ### Objective
258
+
252
259
  Persist validated patterns to the central store.
253
260
 
254
261
  ### Recording Fix Patterns
@@ -280,7 +287,10 @@ workflow learn:record \
280
287
  When automating pattern capture:
281
288
 
282
289
  ```typescript
283
- import { PatternStore, type FixPattern } from "@hawkinside_out/workflow-improvement-tracker";
290
+ import {
291
+ PatternStore,
292
+ type FixPattern,
293
+ } from "@hawkinside_out/workflow-improvement-tracker";
284
294
 
285
295
  const store = new PatternStore(process.cwd());
286
296
  await store.initialize();
@@ -300,12 +310,14 @@ const pattern: FixPattern = {
300
310
  },
301
311
  solution: {
302
312
  type: "file-change",
303
- steps: [{
304
- order: 1,
305
- action: "modify",
306
- target: "<file>",
307
- description: "Change 'let' to 'const' for the flagged variable",
308
- }],
313
+ steps: [
314
+ {
315
+ order: 1,
316
+ action: "modify",
317
+ target: "<file>",
318
+ description: "Change 'let' to 'const' for the flagged variable",
319
+ },
320
+ ],
309
321
  },
310
322
  compatibility: {
311
323
  framework: "node",
@@ -350,6 +362,7 @@ await store.saveFixPattern(existing);
350
362
  ## Phase 6: Reporting
351
363
 
352
364
  ### Objective
365
+
353
366
  Communicate what patterns were captured and their status.
354
367
 
355
368
  ### Post-Analysis Report Template
@@ -360,18 +373,21 @@ After completing pattern analysis, report:
360
373
  ## 📚 Pattern Analysis Complete
361
374
 
362
375
  ### Patterns Recorded
363
- | Type | Name | Category | Status |
364
- |------|------|----------|--------|
365
- | Fix | ESLint prefer-const | lint | Saved |
366
- | Fix | TS null assertion | type-error | ✅ Saved |
367
- | Blueprint | Next.js 14 Starter | - | Skipped (duplicate) |
376
+
377
+ | Type | Name | Category | Status |
378
+ | --------- | ------------------- | ---------- | ---------------------- |
379
+ | Fix | ESLint prefer-const | lint | ✅ Saved |
380
+ | Fix | TS null assertion | type-error | Saved |
381
+ | Blueprint | Next.js 14 Starter | - | ⏭ Skipped (duplicate) |
368
382
 
369
383
  ### Store Statistics
384
+
370
385
  - Total Fix Patterns: 45
371
386
  - Total Blueprints: 7
372
387
  - This Session: +2 fixes
373
388
 
374
389
  ### Next Steps
390
+
375
391
  - Run `workflow learn:list` to view all patterns
376
392
  - Run `workflow learn:sync --push` to share with community
377
393
  ```
@@ -388,12 +404,12 @@ workflow learn:stats
388
404
 
389
405
  ### Good Pattern Characteristics
390
406
 
391
- | Criteria | Good Example | Bad Example |
392
- |----------|--------------|-------------|
393
- | **Specificity** | `errorPattern: "Cannot find module '@/.*'"` | `errorPattern: "error"` |
394
- | **Reusability** | Works across similar projects | Only works in one specific repo |
395
- | **Documentation** | Clear description with context | "Fixes the thing" |
396
- | **Versioning** | `frameworkVersion: "^14.0.0"` | No version specified |
407
+ | Criteria | Good Example | Bad Example |
408
+ | ----------------- | ------------------------------------------- | ------------------------------- |
409
+ | **Specificity** | `errorPattern: "Cannot find module '@/.*'"` | `errorPattern: "error"` |
410
+ | **Reusability** | Works across similar projects | Only works in one specific repo |
411
+ | **Documentation** | Clear description with context | "Fixes the thing" |
412
+ | **Versioning** | `frameworkVersion: "^14.0.0"` | No version specified |
397
413
 
398
414
  ### Pattern Red Flags
399
415
 
@@ -502,6 +518,7 @@ workflow verify --fix --learn
502
518
  ```
503
519
 
504
520
  This automatically:
521
+
505
522
  1. Runs all quality checks
506
523
  2. Applies auto-fixes
507
524
  3. Re-validates