workflow-agent-cli 2.0.1 → 2.2.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,8 +1,13 @@
1
- import { W as WorkflowConfig } from '../schema-RkQ91pZW.js';
2
- export { B as BranchType, C as ConventionalType, S as Scope, a as WorkflowConfigSchema } from '../schema-RkQ91pZW.js';
1
+ import { W as WorkflowConfig } from '../schema-C1lmnd7L.js';
2
+ export { B as BranchType, C as ConventionalType, D as DEFAULT_RESERVED_SCOPE_NAMES, S as Scope, a as WorkflowConfigSchema, v as validateScopeName } from '../schema-C1lmnd7L.js';
3
3
  import 'zod';
4
4
 
5
5
  declare function loadConfig(cwd?: string): Promise<WorkflowConfig | null>;
6
+ declare function validateConfig(cwd?: string): Promise<{
7
+ valid: boolean;
8
+ errors: string[];
9
+ warnings: string[];
10
+ }>;
6
11
  declare function hasConfig(cwd?: string): boolean;
7
12
 
8
- export { WorkflowConfig, hasConfig, loadConfig };
13
+ export { WorkflowConfig, hasConfig, loadConfig, validateConfig };
@@ -1,11 +1,17 @@
1
1
  import {
2
+ DEFAULT_RESERVED_SCOPE_NAMES,
2
3
  WorkflowConfigSchema,
3
4
  hasConfig,
4
- loadConfig
5
- } from "../chunk-4BIDFDSR.js";
5
+ loadConfig,
6
+ validateConfig,
7
+ validateScopeName
8
+ } from "../chunk-IPMSSOXR.js";
6
9
  export {
10
+ DEFAULT_RESERVED_SCOPE_NAMES,
7
11
  WorkflowConfigSchema,
8
12
  hasConfig,
9
- loadConfig
13
+ loadConfig,
14
+ validateConfig,
15
+ validateScopeName
10
16
  };
11
17
  //# sourceMappingURL=index.js.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { hasConfig, loadConfig } from './config/index.js';
1
+ export { hasConfig, loadConfig, validateConfig } 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-RkQ91pZW.js';
3
+ export { B as BranchType, C as ConventionalType, D as DEFAULT_RESERVED_SCOPE_NAMES, S as Scope, W as WorkflowConfig, a as WorkflowConfigSchema, v as validateScopeName } from './schema-C1lmnd7L.js';
4
4
  import 'zod';
package/dist/index.js CHANGED
@@ -5,13 +5,17 @@ import {
5
5
  validateBranchName,
6
6
  validateCommitMessage,
7
7
  validatePRTitle
8
- } from "./chunk-X2NQJ2ZY.js";
8
+ } from "./chunk-NMHWD2GA.js";
9
9
  import {
10
+ DEFAULT_RESERVED_SCOPE_NAMES,
10
11
  WorkflowConfigSchema,
11
12
  hasConfig,
12
- loadConfig
13
- } from "./chunk-4BIDFDSR.js";
13
+ loadConfig,
14
+ validateConfig,
15
+ validateScopeName
16
+ } from "./chunk-IPMSSOXR.js";
14
17
  export {
18
+ DEFAULT_RESERVED_SCOPE_NAMES,
15
19
  WorkflowConfigSchema,
16
20
  discoverCustomScopes,
17
21
  getAllScopes,
@@ -20,6 +24,8 @@ export {
20
24
  loadConfig,
21
25
  validateBranchName,
22
26
  validateCommitMessage,
23
- validatePRTitle
27
+ validateConfig,
28
+ validatePRTitle,
29
+ validateScopeName
24
30
  };
25
31
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,256 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const DEFAULT_RESERVED_SCOPE_NAMES: string[];
4
+ declare function validateScopeName(name: string, reservedNames?: string[]): {
5
+ valid: boolean;
6
+ error?: string;
7
+ suggestion?: string;
8
+ };
9
+ declare const BranchTypeSchema: z.ZodEnum<["feature", "bugfix", "hotfix", "chore", "refactor", "docs", "test", "release"]>;
10
+ declare const ConventionalTypeSchema: z.ZodEnum<["feat", "fix", "refactor", "chore", "docs", "test", "perf", "style", "ci", "build", "revert"]>;
11
+ declare const ScopeSchema: z.ZodObject<{
12
+ name: z.ZodString;
13
+ description: z.ZodString;
14
+ allowedTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["feat", "fix", "refactor", "chore", "docs", "test", "perf", "style", "ci", "build", "revert"]>, "many">>;
15
+ mandatoryGuidelines: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
16
+ emoji: z.ZodOptional<z.ZodString>;
17
+ category: z.ZodOptional<z.ZodEnum<["auth", "features", "infrastructure", "documentation", "testing", "performance", "other"]>>;
18
+ }, "strip", z.ZodTypeAny, {
19
+ name: string;
20
+ description: string;
21
+ allowedTypes?: ("feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "perf" | "style" | "ci" | "build" | "revert")[] | undefined;
22
+ mandatoryGuidelines?: string[] | undefined;
23
+ emoji?: string | undefined;
24
+ category?: "auth" | "features" | "infrastructure" | "documentation" | "testing" | "performance" | "other" | undefined;
25
+ }, {
26
+ name: string;
27
+ description: string;
28
+ allowedTypes?: ("feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "perf" | "style" | "ci" | "build" | "revert")[] | undefined;
29
+ mandatoryGuidelines?: string[] | undefined;
30
+ emoji?: string | undefined;
31
+ category?: "auth" | "features" | "infrastructure" | "documentation" | "testing" | "performance" | "other" | undefined;
32
+ }>;
33
+ declare const WorkflowConfigSchema: z.ZodEffects<z.ZodObject<{
34
+ projectName: z.ZodString;
35
+ scopes: z.ZodArray<z.ZodObject<{
36
+ name: z.ZodString;
37
+ description: z.ZodString;
38
+ allowedTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["feat", "fix", "refactor", "chore", "docs", "test", "perf", "style", "ci", "build", "revert"]>, "many">>;
39
+ mandatoryGuidelines: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
40
+ emoji: z.ZodOptional<z.ZodString>;
41
+ category: z.ZodOptional<z.ZodEnum<["auth", "features", "infrastructure", "documentation", "testing", "performance", "other"]>>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ name: string;
44
+ description: string;
45
+ allowedTypes?: ("feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "perf" | "style" | "ci" | "build" | "revert")[] | undefined;
46
+ mandatoryGuidelines?: string[] | undefined;
47
+ emoji?: string | undefined;
48
+ category?: "auth" | "features" | "infrastructure" | "documentation" | "testing" | "performance" | "other" | undefined;
49
+ }, {
50
+ name: string;
51
+ description: string;
52
+ allowedTypes?: ("feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "perf" | "style" | "ci" | "build" | "revert")[] | undefined;
53
+ mandatoryGuidelines?: string[] | undefined;
54
+ emoji?: string | undefined;
55
+ category?: "auth" | "features" | "infrastructure" | "documentation" | "testing" | "performance" | "other" | undefined;
56
+ }>, "many">;
57
+ branchTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["feature", "bugfix", "hotfix", "chore", "refactor", "docs", "test", "release"]>, "many">>;
58
+ conventionalTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["feat", "fix", "refactor", "chore", "docs", "test", "perf", "style", "ci", "build", "revert"]>, "many">>;
59
+ enforcement: z.ZodDefault<z.ZodEnum<["strict", "advisory", "learning"]>>;
60
+ language: z.ZodDefault<z.ZodString>;
61
+ analytics: z.ZodOptional<z.ZodObject<{
62
+ enabled: z.ZodDefault<z.ZodBoolean>;
63
+ shareAnonymous: z.ZodDefault<z.ZodBoolean>;
64
+ }, "strip", z.ZodTypeAny, {
65
+ enabled: boolean;
66
+ shareAnonymous: boolean;
67
+ }, {
68
+ enabled?: boolean | undefined;
69
+ shareAnonymous?: boolean | undefined;
70
+ }>>;
71
+ adapter: z.ZodOptional<z.ZodString>;
72
+ syncRemote: z.ZodOptional<z.ZodString>;
73
+ hooks: z.ZodOptional<z.ZodObject<{
74
+ enabled: z.ZodDefault<z.ZodBoolean>;
75
+ preCommit: z.ZodDefault<z.ZodArray<z.ZodEnum<["validate-branch", "validate-commit", "check-guidelines", "validate-scopes"]>, "many">>;
76
+ commitMsg: z.ZodDefault<z.ZodArray<z.ZodEnum<["validate-branch", "validate-commit", "check-guidelines", "validate-scopes"]>, "many">>;
77
+ }, "strip", z.ZodTypeAny, {
78
+ enabled: boolean;
79
+ preCommit: ("validate-branch" | "validate-commit" | "check-guidelines" | "validate-scopes")[];
80
+ commitMsg: ("validate-branch" | "validate-commit" | "check-guidelines" | "validate-scopes")[];
81
+ }, {
82
+ enabled?: boolean | undefined;
83
+ preCommit?: ("validate-branch" | "validate-commit" | "check-guidelines" | "validate-scopes")[] | undefined;
84
+ commitMsg?: ("validate-branch" | "validate-commit" | "check-guidelines" | "validate-scopes")[] | undefined;
85
+ }>>;
86
+ guidelines: z.ZodOptional<z.ZodObject<{
87
+ additionalMandatory: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
88
+ optionalOverrides: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ additionalMandatory?: string[] | undefined;
91
+ optionalOverrides?: string[] | undefined;
92
+ }, {
93
+ additionalMandatory?: string[] | undefined;
94
+ optionalOverrides?: string[] | undefined;
95
+ }>>;
96
+ reservedScopeNames: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
97
+ ci: z.ZodOptional<z.ZodObject<{
98
+ enabled: z.ZodDefault<z.ZodBoolean>;
99
+ provider: z.ZodDefault<z.ZodEnum<["github", "gitlab", "bitbucket"]>>;
100
+ checks: z.ZodDefault<z.ZodArray<z.ZodEnum<["lint", "typecheck", "format", "test", "build"]>, "many">>;
101
+ }, "strip", z.ZodTypeAny, {
102
+ enabled: boolean;
103
+ provider: "github" | "gitlab" | "bitbucket";
104
+ checks: ("test" | "build" | "lint" | "typecheck" | "format")[];
105
+ }, {
106
+ enabled?: boolean | undefined;
107
+ provider?: "github" | "gitlab" | "bitbucket" | undefined;
108
+ checks?: ("test" | "build" | "lint" | "typecheck" | "format")[] | undefined;
109
+ }>>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ projectName: string;
112
+ scopes: {
113
+ name: string;
114
+ description: string;
115
+ allowedTypes?: ("feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "perf" | "style" | "ci" | "build" | "revert")[] | undefined;
116
+ mandatoryGuidelines?: string[] | undefined;
117
+ emoji?: string | undefined;
118
+ category?: "auth" | "features" | "infrastructure" | "documentation" | "testing" | "performance" | "other" | undefined;
119
+ }[];
120
+ enforcement: "strict" | "advisory" | "learning";
121
+ language: string;
122
+ reservedScopeNames: string[];
123
+ ci?: {
124
+ enabled: boolean;
125
+ provider: "github" | "gitlab" | "bitbucket";
126
+ checks: ("test" | "build" | "lint" | "typecheck" | "format")[];
127
+ } | undefined;
128
+ branchTypes?: ("refactor" | "chore" | "docs" | "test" | "feature" | "bugfix" | "hotfix" | "release")[] | undefined;
129
+ conventionalTypes?: ("feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "perf" | "style" | "ci" | "build" | "revert")[] | undefined;
130
+ analytics?: {
131
+ enabled: boolean;
132
+ shareAnonymous: boolean;
133
+ } | undefined;
134
+ adapter?: string | undefined;
135
+ syncRemote?: string | undefined;
136
+ hooks?: {
137
+ enabled: boolean;
138
+ preCommit: ("validate-branch" | "validate-commit" | "check-guidelines" | "validate-scopes")[];
139
+ commitMsg: ("validate-branch" | "validate-commit" | "check-guidelines" | "validate-scopes")[];
140
+ } | undefined;
141
+ guidelines?: {
142
+ additionalMandatory?: string[] | undefined;
143
+ optionalOverrides?: string[] | undefined;
144
+ } | undefined;
145
+ }, {
146
+ projectName: string;
147
+ scopes: {
148
+ name: string;
149
+ description: string;
150
+ allowedTypes?: ("feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "perf" | "style" | "ci" | "build" | "revert")[] | undefined;
151
+ mandatoryGuidelines?: string[] | undefined;
152
+ emoji?: string | undefined;
153
+ category?: "auth" | "features" | "infrastructure" | "documentation" | "testing" | "performance" | "other" | undefined;
154
+ }[];
155
+ ci?: {
156
+ enabled?: boolean | undefined;
157
+ provider?: "github" | "gitlab" | "bitbucket" | undefined;
158
+ checks?: ("test" | "build" | "lint" | "typecheck" | "format")[] | undefined;
159
+ } | undefined;
160
+ branchTypes?: ("refactor" | "chore" | "docs" | "test" | "feature" | "bugfix" | "hotfix" | "release")[] | undefined;
161
+ conventionalTypes?: ("feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "perf" | "style" | "ci" | "build" | "revert")[] | undefined;
162
+ enforcement?: "strict" | "advisory" | "learning" | undefined;
163
+ language?: string | undefined;
164
+ analytics?: {
165
+ enabled?: boolean | undefined;
166
+ shareAnonymous?: boolean | undefined;
167
+ } | undefined;
168
+ adapter?: string | undefined;
169
+ syncRemote?: string | undefined;
170
+ hooks?: {
171
+ enabled?: boolean | undefined;
172
+ preCommit?: ("validate-branch" | "validate-commit" | "check-guidelines" | "validate-scopes")[] | undefined;
173
+ commitMsg?: ("validate-branch" | "validate-commit" | "check-guidelines" | "validate-scopes")[] | undefined;
174
+ } | undefined;
175
+ guidelines?: {
176
+ additionalMandatory?: string[] | undefined;
177
+ optionalOverrides?: string[] | undefined;
178
+ } | undefined;
179
+ reservedScopeNames?: string[] | undefined;
180
+ }>, {
181
+ projectName: string;
182
+ scopes: {
183
+ name: string;
184
+ description: string;
185
+ allowedTypes?: ("feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "perf" | "style" | "ci" | "build" | "revert")[] | undefined;
186
+ mandatoryGuidelines?: string[] | undefined;
187
+ emoji?: string | undefined;
188
+ category?: "auth" | "features" | "infrastructure" | "documentation" | "testing" | "performance" | "other" | undefined;
189
+ }[];
190
+ enforcement: "strict" | "advisory" | "learning";
191
+ language: string;
192
+ reservedScopeNames: string[];
193
+ ci?: {
194
+ enabled: boolean;
195
+ provider: "github" | "gitlab" | "bitbucket";
196
+ checks: ("test" | "build" | "lint" | "typecheck" | "format")[];
197
+ } | undefined;
198
+ branchTypes?: ("refactor" | "chore" | "docs" | "test" | "feature" | "bugfix" | "hotfix" | "release")[] | undefined;
199
+ conventionalTypes?: ("feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "perf" | "style" | "ci" | "build" | "revert")[] | undefined;
200
+ analytics?: {
201
+ enabled: boolean;
202
+ shareAnonymous: boolean;
203
+ } | undefined;
204
+ adapter?: string | undefined;
205
+ syncRemote?: string | undefined;
206
+ hooks?: {
207
+ enabled: boolean;
208
+ preCommit: ("validate-branch" | "validate-commit" | "check-guidelines" | "validate-scopes")[];
209
+ commitMsg: ("validate-branch" | "validate-commit" | "check-guidelines" | "validate-scopes")[];
210
+ } | undefined;
211
+ guidelines?: {
212
+ additionalMandatory?: string[] | undefined;
213
+ optionalOverrides?: string[] | undefined;
214
+ } | undefined;
215
+ }, {
216
+ projectName: string;
217
+ scopes: {
218
+ name: string;
219
+ description: string;
220
+ allowedTypes?: ("feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "perf" | "style" | "ci" | "build" | "revert")[] | undefined;
221
+ mandatoryGuidelines?: string[] | undefined;
222
+ emoji?: string | undefined;
223
+ category?: "auth" | "features" | "infrastructure" | "documentation" | "testing" | "performance" | "other" | undefined;
224
+ }[];
225
+ ci?: {
226
+ enabled?: boolean | undefined;
227
+ provider?: "github" | "gitlab" | "bitbucket" | undefined;
228
+ checks?: ("test" | "build" | "lint" | "typecheck" | "format")[] | undefined;
229
+ } | undefined;
230
+ branchTypes?: ("refactor" | "chore" | "docs" | "test" | "feature" | "bugfix" | "hotfix" | "release")[] | undefined;
231
+ conventionalTypes?: ("feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "perf" | "style" | "ci" | "build" | "revert")[] | undefined;
232
+ enforcement?: "strict" | "advisory" | "learning" | undefined;
233
+ language?: string | undefined;
234
+ analytics?: {
235
+ enabled?: boolean | undefined;
236
+ shareAnonymous?: boolean | undefined;
237
+ } | undefined;
238
+ adapter?: string | undefined;
239
+ syncRemote?: string | undefined;
240
+ hooks?: {
241
+ enabled?: boolean | undefined;
242
+ preCommit?: ("validate-branch" | "validate-commit" | "check-guidelines" | "validate-scopes")[] | undefined;
243
+ commitMsg?: ("validate-branch" | "validate-commit" | "check-guidelines" | "validate-scopes")[] | undefined;
244
+ } | undefined;
245
+ guidelines?: {
246
+ additionalMandatory?: string[] | undefined;
247
+ optionalOverrides?: string[] | undefined;
248
+ } | undefined;
249
+ reservedScopeNames?: string[] | undefined;
250
+ }>;
251
+ type Scope = z.infer<typeof ScopeSchema>;
252
+ type BranchType = z.infer<typeof BranchTypeSchema>;
253
+ type ConventionalType = z.infer<typeof ConventionalTypeSchema>;
254
+ type WorkflowConfig = z.infer<typeof WorkflowConfigSchema>;
255
+
256
+ export { type BranchType as B, type ConventionalType as C, DEFAULT_RESERVED_SCOPE_NAMES as D, type Scope as S, type WorkflowConfig as W, WorkflowConfigSchema as a, validateScopeName as v };
@@ -48,7 +48,9 @@ function addScriptsToPackageJson() {
48
48
  return;
49
49
  }
50
50
  let addedCount = 0;
51
- for (const [scriptName, scriptCommand] of Object.entries(WORKFLOW_SCRIPTS)) {
51
+ for (const [scriptName, scriptCommand] of Object.entries(
52
+ WORKFLOW_SCRIPTS
53
+ )) {
52
54
  if (!packageJson.scripts[scriptName]) {
53
55
  packageJson.scripts[scriptName] = scriptCommand;
54
56
  addedCount++;
@@ -64,7 +66,9 @@ function addScriptsToPackageJson() {
64
66
  Object.keys(WORKFLOW_SCRIPTS).forEach((scriptName) => {
65
67
  console.log(` - ${scriptName}`);
66
68
  });
67
- console.log("\nRun them with: npm run workflow:init (or pnpm run workflow:init)\n");
69
+ console.log(
70
+ "\nRun them with: npm run workflow:init (or pnpm run workflow:init)\n"
71
+ );
68
72
  }
69
73
  } catch (error) {
70
74
  }
@@ -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(WORKFLOW_SCRIPTS)) {\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('\\nRun them with: npm run workflow:init (or pnpm run workflow:init)\\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,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;AAChE,UAAM,cAAc,KAAK,MAAM,kBAAkB;AAGjD,QAAI,CAAC,YAAY,SAAS;AACxB,kBAAY,UAAU,CAAC;AAAA,IACzB;AAGA,UAAM,qBAAqB,OAAO,KAAK,gBAAgB,EAAE;AAAA,MACvD,CAAC,eAAe,YAAY,QAAQ,UAAU;AAAA,IAChD;AAEA,QAAI,oBAAoB;AAEtB;AAAA,IACF;AAGA,QAAI,aAAa;AACjB,eAAW,CAAC,YAAY,aAAa,KAAK,OAAO,QAAQ,gBAAgB,GAAG;AAC1E,UAAI,CAAC,YAAY,QAAQ,UAAU,GAAG;AACpC,oBAAY,QAAQ,UAAU,IAAI;AAClC;AAAA,MACF;AAAA,IACF;AAEA,QAAI,aAAa,GAAG;AAElB;AAAA,QACE;AAAA,QACA,KAAK,UAAU,aAAa,MAAM,CAAC,IAAI;AAAA,QACvC;AAAA,MACF;AAEA,cAAQ,IAAI,kDAA6C;AACzD,aAAO,KAAK,gBAAgB,EAAE,QAAQ,CAAC,eAAe;AACpD,gBAAQ,IAAI,OAAO,UAAU,EAAE;AAAA,MACjC,CAAC;AACD,cAAQ,IAAI,sEAAsE;AAAA,IACpF;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\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,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;AAChE,UAAM,cAAc,KAAK,MAAM,kBAAkB;AAGjD,QAAI,CAAC,YAAY,SAAS;AACxB,kBAAY,UAAU,CAAC;AAAA,IACzB;AAGA,UAAM,qBAAqB,OAAO,KAAK,gBAAgB,EAAE;AAAA,MACvD,CAAC,eAAe,YAAY,QAAQ,UAAU;AAAA,IAChD;AAEA,QAAI,oBAAoB;AAEtB;AAAA,IACF;AAGA,QAAI,aAAa;AACjB,eAAW,CAAC,YAAY,aAAa,KAAK,OAAO;AAAA,MAC/C;AAAA,IACF,GAAG;AACD,UAAI,CAAC,YAAY,QAAQ,UAAU,GAAG;AACpC,oBAAY,QAAQ,UAAU,IAAI;AAClC;AAAA,MACF;AAAA,IACF;AAEA,QAAI,aAAa,GAAG;AAElB;AAAA,QACE;AAAA,QACA,KAAK,UAAU,aAAa,MAAM,CAAC,IAAI;AAAA,QACvC;AAAA,MACF;AAEA,cAAQ,IAAI,kDAA6C;AACzD,aAAO,KAAK,gBAAgB,EAAE,QAAQ,CAAC,eAAe;AACpD,gBAAQ,IAAI,OAAO,UAAU,EAAE;AAAA,MACjC,CAAC;AACD,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-RkQ91pZW.js';
1
+ import { S as Scope, W as WorkflowConfig } from '../schema-C1lmnd7L.js';
2
2
  import 'zod';
3
3
 
4
4
  interface ValidationResult {
@@ -5,7 +5,7 @@ import {
5
5
  validateBranchName,
6
6
  validateCommitMessage,
7
7
  validatePRTitle
8
- } from "../chunk-X2NQJ2ZY.js";
8
+ } from "../chunk-NMHWD2GA.js";
9
9
  export {
10
10
  discoverCustomScopes,
11
11
  getAllScopes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workflow-agent-cli",
3
- "version": "2.0.1",
3
+ "version": "2.2.0",
4
4
  "description": "A self-evolving workflow management system for AI agent development",
5
5
  "keywords": [
6
6
  "workflow",
@@ -41,6 +41,19 @@
41
41
  "templates",
42
42
  "README.md"
43
43
  ],
44
+ "scripts": {
45
+ "build": "tsup",
46
+ "dev": "tsup --watch",
47
+ "test": "vitest run",
48
+ "test:watch": "vitest",
49
+ "test:coverage": "vitest run --coverage",
50
+ "test:unit": "vitest run --exclude 'src/**/*.e2e.test.ts'",
51
+ "test:e2e": "vitest run 'src/**/*.e2e.test.ts'",
52
+ "lint": "exit 0",
53
+ "typecheck": "tsc --noEmit",
54
+ "clean": "rm -rf dist",
55
+ "postinstall": "node dist/scripts/postinstall.js || true"
56
+ },
44
57
  "dependencies": {
45
58
  "@clack/prompts": "^0.7.0",
46
59
  "@hawkinside_out/workflow-improvement-tracker": "^1.0.0",
@@ -52,11 +65,13 @@
52
65
  "fast-glob": "^3.3.2",
53
66
  "mustache": "^4.2.0",
54
67
  "picocolors": "^1.0.0",
68
+ "prompts": "^2.4.2",
55
69
  "zod": "^3.22.4"
56
70
  },
57
71
  "devDependencies": {
58
72
  "@types/mustache": "^4.2.5",
59
73
  "@types/node": "^20.11.5",
74
+ "@types/prompts": "^2.4.9",
60
75
  "eslint": "^8.56.0",
61
76
  "tsup": "^8.0.1",
62
77
  "typescript": "^5.3.3",
@@ -67,18 +82,5 @@
67
82
  },
68
83
  "publishConfig": {
69
84
  "access": "public"
70
- },
71
- "scripts": {
72
- "build": "tsup",
73
- "dev": "tsup --watch",
74
- "test": "vitest run",
75
- "test:watch": "vitest",
76
- "test:coverage": "vitest run --coverage",
77
- "test:unit": "vitest run --exclude 'src/**/*.e2e.test.ts'",
78
- "test:e2e": "vitest run 'src/**/*.e2e.test.ts'",
79
- "lint": "eslint src",
80
- "typecheck": "tsc --noEmit",
81
- "clean": "rm -rf dist",
82
- "postinstall": "node dist/scripts/postinstall.js || true"
83
85
  }
84
- }
86
+ }