@sppg2001/atomize 1.2.2 → 1.2.4

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 +108 -14
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -13258,19 +13258,110 @@ var require_winston = __commonJS((exports) => {
13258
13258
  warn.forProperties(exports, "deprecated", ["emitErrs", "levelLength"]);
13259
13259
  });
13260
13260
 
13261
+ // src/cli/utilities/terminal-output.ts
13262
+ function normalizeMessage(message) {
13263
+ return message.endsWith(`
13264
+ `) ? message : `${message}
13265
+ `;
13266
+ }
13267
+ function writeToStream(stream, message) {
13268
+ const normalized = normalizeMessage(message);
13269
+ if (stream === "stderr") {
13270
+ process.stderr.write(normalized);
13271
+ return;
13272
+ }
13273
+ process.stdout.write(normalized);
13274
+ }
13275
+ function beginPromptOutput() {
13276
+ promptOutputDepth += 1;
13277
+ }
13278
+ function endPromptOutput() {
13279
+ if (promptOutputDepth === 0) {
13280
+ return;
13281
+ }
13282
+ promptOutputDepth -= 1;
13283
+ if (promptOutputDepth === 0) {
13284
+ flushBufferedOutput();
13285
+ }
13286
+ }
13287
+ function writeManagedOutput(stream, message) {
13288
+ if (promptOutputDepth > 0) {
13289
+ bufferedLines.push({ stream, message });
13290
+ return;
13291
+ }
13292
+ writeToStream(stream, message);
13293
+ }
13294
+ function flushBufferedOutput() {
13295
+ while (bufferedLines.length > 0) {
13296
+ const next = bufferedLines.shift();
13297
+ if (!next) {
13298
+ return;
13299
+ }
13300
+ writeToStream(next.stream, next.message);
13301
+ }
13302
+ }
13303
+ function createManagedSpinner(factory = be) {
13304
+ const baseSpinner = factory();
13305
+ let active = false;
13306
+ function ensureActive() {
13307
+ if (active) {
13308
+ return;
13309
+ }
13310
+ beginPromptOutput();
13311
+ active = true;
13312
+ }
13313
+ return {
13314
+ start(message) {
13315
+ ensureActive();
13316
+ baseSpinner.start(message);
13317
+ },
13318
+ message(message) {
13319
+ ensureActive();
13320
+ baseSpinner.message(message);
13321
+ },
13322
+ stop(message) {
13323
+ try {
13324
+ baseSpinner.stop(message);
13325
+ } finally {
13326
+ if (active) {
13327
+ active = false;
13328
+ endPromptOutput();
13329
+ }
13330
+ }
13331
+ }
13332
+ };
13333
+ }
13334
+ var promptOutputDepth = 0, bufferedLines;
13335
+ var init_terminal_output = __esm(() => {
13336
+ init_dist2();
13337
+ bufferedLines = [];
13338
+ });
13339
+
13261
13340
  // src/config/logger.ts
13262
- var import_winston, combine, timestamp, printf, colorize, consoleFormat, logger;
13341
+ var import_winston, import_winston_transport, combine, timestamp, printf, colorize, consoleFormat, ManagedConsoleTransport, logger;
13263
13342
  var init_logger = __esm(() => {
13343
+ init_terminal_output();
13264
13344
  import_winston = __toESM(require_winston(), 1);
13345
+ import_winston_transport = __toESM(require_winston_transport(), 1);
13265
13346
  ({ combine, timestamp, printf, colorize } = import_winston.default.format);
13266
13347
  consoleFormat = printf(({ level, message, timestamp: timestamp2 }) => {
13267
13348
  return `${timestamp2} [${level}]: ${message}`;
13268
13349
  });
13350
+ ManagedConsoleTransport = class ManagedConsoleTransport extends import_winston_transport.default {
13351
+ log(info, callback) {
13352
+ queueMicrotask(() => this.emit("logged", info));
13353
+ const renderedMessage = info[Symbol.for("message")];
13354
+ const message = typeof renderedMessage === "string" ? renderedMessage : `${String(info.message)}`;
13355
+ const stream = info.level === "error" || info.level === "warn" ? "stderr" : "stdout";
13356
+ writeManagedOutput(stream, message);
13357
+ callback();
13358
+ }
13359
+ };
13269
13360
  logger = import_winston.default.createLogger({
13270
13361
  level: process.env.ATOMIZE_DEBUG === "1" ? "debug" : process.env.LOG_LEVEL || "warn",
13271
13362
  format: combine(timestamp({ format: "HH:mm:ss" }), consoleFormat),
13272
13363
  transports: [
13273
- new import_winston.default.transports.Console({
13364
+ new ManagedConsoleTransport({
13274
13365
  format: combine(colorize(), timestamp({ format: "HH:mm:ss" }), consoleFormat)
13275
13366
  })
13276
13367
  ]
@@ -27475,6 +27566,7 @@ var init_prompt_utilities = __esm(() => {
27475
27566
  init_dist2();
27476
27567
  init_zod();
27477
27568
  init_exit_codes();
27569
+ init_terminal_output();
27478
27570
  emailSchema = zod_default.string().email();
27479
27571
  Validators = {
27480
27572
  required: (fieldName) => (input) => {
@@ -98488,7 +98580,7 @@ var {
98488
98580
 
98489
98581
  // package.json
98490
98582
  var name = "@sppg2001/atomize";
98491
- var version = "1.2.2";
98583
+ var version = "1.2.4";
98492
98584
 
98493
98585
  // src/cli/commands/auth/auth-add.command.ts
98494
98586
  init_dist2();
@@ -98597,7 +98689,7 @@ Re-run with --insecure-storage to accept the insecure local file fallback.`);
98597
98689
  }
98598
98690
  }
98599
98691
  }
98600
- const savingSpinner = ci ? null : be();
98692
+ const savingSpinner = ci ? null : createManagedSpinner();
98601
98693
  savingSpinner?.start("Saving profile...");
98602
98694
  try {
98603
98695
  const { useKeychain } = await persistProfile(inputs, { allowKeyfileStorage });
@@ -98723,7 +98815,7 @@ var authRemoveCommand = new Command("remove").alias("rm").description("Remove a
98723
98815
  Gt("Cancelled.");
98724
98816
  return;
98725
98817
  }
98726
- const operationSpinner = be();
98818
+ const operationSpinner = createManagedSpinner();
98727
98819
  operationSpinner.start(`Deleting profile and token for "${name2}"...`);
98728
98820
  try {
98729
98821
  const { wasDefault } = await deleteProfile(name2, profile);
@@ -98822,7 +98914,7 @@ var authRotateCommand = new Command("rotate").description("Replace the access to
98822
98914
  process.exit(ExitCode.Failure);
98823
98915
  }
98824
98916
  }
98825
- const rotationSpinner = be();
98917
+ const rotationSpinner = createManagedSpinner();
98826
98918
  rotationSpinner.start("Rotating token...");
98827
98919
  try {
98828
98920
  const { useKeychain } = await rotateToken(profile, newPat, { allowKeyfileStorage });
@@ -98839,6 +98931,7 @@ var authRotateCommand = new Command("rotate").description("Replace the access to
98839
98931
  init_dist2();
98840
98932
  init_connections_config();
98841
98933
  init_exit_codes();
98934
+ init_prompt_utilities();
98842
98935
 
98843
98936
  // src/cli/commands/auth/helpers/auth-test.helper.ts
98844
98937
  init_dist2();
@@ -99430,7 +99523,6 @@ class AzureDevOpsAdapter {
99430
99523
  if (!this.witApi) {
99431
99524
  return false;
99432
99525
  }
99433
- console.log("Testing connection to Azure DevOps...");
99434
99526
  await this.witApi.queryByWiql({
99435
99527
  query: "SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject] = @project"
99436
99528
  }, { project: this.config.project }, false, 1);
@@ -100086,7 +100178,7 @@ var authTestCommand = new Command("test").description("Test connectivity for a p
100086
100178
  process.exit(ExitCode.Failure);
100087
100179
  }
100088
100180
  const profileName = await promptProfileToTest(nameArg);
100089
- const s = be();
100181
+ const s = createManagedSpinner();
100090
100182
  s.start("Resolving configuration...");
100091
100183
  try {
100092
100184
  const platform2 = await buildPlatform(profileName);
@@ -101651,7 +101743,9 @@ async function writeReportFile(outputPath, report, includeSensitiveReportData) {
101651
101743
  encoding: "utf-8",
101652
101744
  mode: 384
101653
101745
  });
101654
- await chmod4(outputPath, 384);
101746
+ if (process.platform !== "win32") {
101747
+ await chmod4(outputPath, 384);
101748
+ }
101655
101749
  }
101656
101750
  function getNonInteractiveLiveExecutionError(options) {
101657
101751
  if (options.dryRun || options.isTTYSession || options.autoApprove) {
@@ -101929,7 +102023,7 @@ var generateCommand = new Command("generate").alias("gen").description("Generate
101929
102023
  const template = await loadAndValidateTemplate(templatePath, print);
101930
102024
  const { storyConcurrency, taskConcurrency, dependencyConcurrency } = parseConcurrency(options, print);
101931
102025
  const platform_ = await initPlatform({ platform: platform2, profile: options.profile }, taskConcurrency);
101932
- const authSpinner = be();
102026
+ const authSpinner = createManagedSpinner();
101933
102027
  if (isTTYSession)
101934
102028
  authSpinner.start("Authenticating...");
101935
102029
  const AUTH_TIMEOUT_MS = 15000;
@@ -101971,7 +102065,7 @@ var generateCommand = new Command("generate").alias("gen").description("Generate
101971
102065
  R2.warn("Live mode — acknowledged for non-interactive execution");
101972
102066
  }
101973
102067
  logger.info("Starting atomization...");
101974
- const querySpinner = be();
102068
+ const querySpinner = createManagedSpinner();
101975
102069
  const storyProgressRef = { current: undefined };
101976
102070
  if (isTTYSession)
101977
102071
  querySpinner.start("Querying work items...");
@@ -105064,7 +105158,7 @@ Loaded preset: ${template.name}`));
105064
105158
  async function validateStoryIds(platform2, storyIds) {
105065
105159
  if (!platform2.getWorkItem)
105066
105160
  return storyIds;
105067
- const validateSpinner = be();
105161
+ const validateSpinner = createManagedSpinner();
105068
105162
  validateSpinner.start(`Validating ${storyIds.length} story ID(s)...`);
105069
105163
  const results = await Promise.all(storyIds.map(async (id) => ({
105070
105164
  id,
@@ -105116,7 +105210,7 @@ async function createFromStories(options) {
105116
105210
  }));
105117
105211
  }
105118
105212
  const shouldNormalize = options.normalize !== false;
105119
- const connectSpinner = be();
105213
+ const connectSpinner = createManagedSpinner();
105120
105214
  connectSpinner.start(`Connecting to ${platformType}...`);
105121
105215
  let platform2 = null;
105122
105216
  if (platformType === "azure-devops") {
@@ -105130,7 +105224,7 @@ async function createFromStories(options) {
105130
105224
  connectSpinner.stop("Connected ✓");
105131
105225
  storyIds = await validateStoryIds(platform2, storyIds);
105132
105226
  const learner = new StoryLearner(platform2);
105133
- const learnSpinner = be();
105227
+ const learnSpinner = createManagedSpinner();
105134
105228
  learnSpinner.start(`Learning from ${storyIds.length} stories...`);
105135
105229
  const result = await learner.learnFromStories(storyIds, {
105136
105230
  normalizePercentages: shouldNormalize
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sppg2001/atomize",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Automatically generate tasks from user stories with smart templates",
5
5
  "type": "module",
6
6
  "main": "./dist/cli/index.js",