@sppg2001/atomize 3.0.1 → 3.0.2

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +21 -10
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -14138,6 +14138,10 @@ var init_zod = __esm(() => {
14138
14138
  });
14139
14139
 
14140
14140
  // ../atomize-schema/src/schema.ts
14141
+ function ownPercentRange(task) {
14142
+ const candidates = [task.estimationPercent ?? 0, ...task.estimationPercentCondition?.map((rule) => rule.percent) ?? []];
14143
+ return [Math.min(...candidates), Math.max(...candidates)];
14144
+ }
14141
14145
  function validateTaskConstraints(v, tasks, ctx) {
14142
14146
  if (v?.minTasks !== undefined && tasks.length < v.minTasks) {
14143
14147
  const needed = v.minTasks - tasks.length;
@@ -14176,9 +14180,9 @@ function validateUniqueTaskIds(tasks, ctx) {
14176
14180
  });
14177
14181
  });
14178
14182
  }
14179
- function validateEstimationConstraints(v, totalPercent, ctx) {
14183
+ function validateEstimationConstraints(v, totalPercent, maxTotalPercent, ctx) {
14180
14184
  if (v?.totalEstimationMustBe !== undefined) {
14181
- if (totalPercent !== v.totalEstimationMustBe) {
14185
+ if (v.totalEstimationMustBe < totalPercent || v.totalEstimationMustBe > maxTotalPercent) {
14182
14186
  ctx.addIssue({
14183
14187
  code: "custom",
14184
14188
  path: ["tasks"],
@@ -14188,7 +14192,7 @@ function validateEstimationConstraints(v, totalPercent, ctx) {
14188
14192
  }
14189
14193
  } else if (v?.totalEstimationRange) {
14190
14194
  const { min, max } = v.totalEstimationRange;
14191
- if (totalPercent < min || totalPercent > max) {
14195
+ if (maxTotalPercent < min || totalPercent > max) {
14192
14196
  ctx.addIssue({
14193
14197
  code: "custom",
14194
14198
  path: ["tasks"],
@@ -14412,11 +14416,16 @@ var init_schema = __esm(() => {
14412
14416
  });
14413
14417
  TaskTemplateSchema = TaskTemplateBaseSchema.superRefine((data, ctx) => {
14414
14418
  const { tasks, validation: v } = data;
14415
- const nonConditionalTasks = tasks.filter((t) => !t.condition);
14416
- const totalPercent = nonConditionalTasks.reduce((sum, t) => sum + (t.estimationPercent ?? 0), 0);
14419
+ let totalPercent = 0;
14420
+ let maxTotalPercent = 0;
14421
+ for (const task of tasks) {
14422
+ const [ownMin, ownMax] = ownPercentRange(task);
14423
+ totalPercent += task.condition ? 0 : ownMin;
14424
+ maxTotalPercent += ownMax;
14425
+ }
14417
14426
  const taskIds = new Set(tasks.map((t) => t.id).filter(Boolean));
14418
14427
  validateUniqueTaskIds(tasks, ctx);
14419
- validateEstimationConstraints(v, totalPercent, ctx);
14428
+ validateEstimationConstraints(v, totalPercent, maxTotalPercent, ctx);
14420
14429
  validateTaskConstraints(v, tasks, ctx);
14421
14430
  validateRequiredTasks(v, tasks, ctx);
14422
14431
  const availableIds = Array.from(taskIds);
@@ -91399,7 +91408,7 @@ var program = new Command;
91399
91408
 
91400
91409
  // package.json
91401
91410
  var name = "@sppg2001/atomize";
91402
- var version2 = "3.0.1";
91411
+ var version2 = "3.0.2";
91403
91412
 
91404
91413
  // src/cli/commands/auth/auth-add.command.ts
91405
91414
  init_dist6();
@@ -96112,8 +96121,10 @@ tasks: # required, minimum 1 item
96112
96121
  id: string # optional, required if this task is referenced in dependsOn
96113
96122
  dependsOn: string[] # optional, references other task ids
96114
96123
  condition: # optional — skip this task entirely when condition is false
96115
- # Standard ADO fields (tags, Priority, State, etc.):
96116
- field: string # e.g. "tags", "Priority", "State"
96124
+ # Standard fields (case-sensitive, always lowercase camelCase — NOT the ADO REST field
96125
+ # names like "System.State" or "Microsoft.VSTS.Common.Priority"):
96126
+ # tags, title, state, estimation, priority, description, assignedTo, type, areaPath, iteration
96127
+ field: string # e.g. "tags", "priority", "state", "estimation"
96117
96128
  operator: string # equals | not-equals | contains | not-contains | gt | lt | gte | lte
96118
96129
  value: string | number
96119
96130
  # Custom ADO fields in "Namespace.FieldName" format — use customField, NOT field:
@@ -96154,7 +96165,7 @@ CONSTRAINTS (you must follow these):
96154
96165
  2. If a task uses dependsOn, all referenced IDs must exist on other tasks in the same template.
96155
96166
  3. workItemTypes values are case-sensitive strings matching ADO work item types.
96156
96167
  4. condition operators must be one of: equals, not-equals, contains, not-contains, gt, lt, gte, lte.
96157
- Use field for standard ADO fields (tags, Priority, State, AssignedTo, etc.).
96168
+ Use field for the standard fields — tags, title, state, estimation, priority, description, assignedTo, type, areaPath, iteration — spelled exactly as shown (lowercase camelCase); a different casing or an unlisted name will silently never match at runtime.
96158
96169
  Use customField for any field in "Namespace.FieldName" format (e.g. "Custom.DataClassification"). NEVER use field for these — it will silently fail at runtime.
96159
96170
  5. Do not invent fields not listed above.
96160
96171
  6. A task that uses dependsOn MUST also have an id field set.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sppg2001/atomize",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "Automatically generate tasks from user stories with smart templates",
5
5
  "type": "module",
6
6
  "main": "./dist/cli/index.js",