specatlas 0.1.13 → 0.1.14

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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  signApproval
4
- } from "./chunk-X4FIHYOJ.js";
4
+ } from "./chunk-N3AY2VXJ.js";
5
5
  import "./chunk-DKFIPJ74.js";
6
6
  export {
7
7
  signApproval
package/dist/bin.js CHANGED
@@ -3,12 +3,15 @@ import {
3
3
  artifactHash,
4
4
  countBySeverity,
5
5
  diag,
6
+ localDate,
7
+ localIso,
8
+ localMonth,
6
9
  parseApprovals,
7
10
  parseChangeMeta,
8
11
  sha256,
9
12
  shortHash,
10
13
  signApproval
11
- } from "./chunk-X4FIHYOJ.js";
14
+ } from "./chunk-N3AY2VXJ.js";
12
15
  import {
13
16
  __commonJS,
14
17
  __toESM,
@@ -10837,7 +10840,7 @@ async function approveFromGithub(opts) {
10837
10840
  if (!by) {
10838
10841
  return { approved: false, label, issueNumber: number, diagnostics: [diag("ATLAS-GH-011", "error", "No se pudo determinar qui\xE9n aprueba (--by ni `gh api user`)")] };
10839
10842
  }
10840
- const { signApproval: signApproval2 } = await import("./approvals-4QHIT7F6-JAI5IHNX.js");
10843
+ const { signApproval: signApproval2 } = await import("./approvals-XPI466UK-HLB4NIVC.js");
10841
10844
  const signed = await signApproval2({
10842
10845
  root: opts.root,
10843
10846
  artifact: path5.posix.join("changes", opts.slug, "spec.md"),
@@ -10987,7 +10990,7 @@ ${exec.stderr}`);
10987
10990
  scenario,
10988
10991
  method,
10989
10992
  result,
10990
- date: (opts.now ?? /* @__PURE__ */ new Date()).toISOString(),
10993
+ date: localIso(opts.now),
10991
10994
  by: opts.by.trim(),
10992
10995
  line: 0
10993
10996
  };
@@ -11024,7 +11027,7 @@ ${yaml2}
11024
11027
  return returned;
11025
11028
  }
11026
11029
  function generateRunId(now = /* @__PURE__ */ new Date()) {
11027
- const iso = now.toISOString().replace(/[-:T]/g, "").slice(0, 14);
11030
+ const iso = localIso(now).replace(/[-+:.Z]/g, "").slice(0, 15);
11028
11031
  return `${iso.slice(0, 8)}-${iso.slice(8, 14)}-${randomBytes(3).toString("hex")}`;
11029
11032
  }
11030
11033
  function runsDir(root) {
@@ -11037,8 +11040,8 @@ async function createRun(root, slug, phase, inputs, now = /* @__PURE__ */ new Da
11037
11040
  slug,
11038
11041
  phase,
11039
11042
  status: "active",
11040
- startedAt: now.toISOString(),
11041
- updatedAt: now.toISOString()
11043
+ startedAt: localIso(now),
11044
+ updatedAt: localIso(now)
11042
11045
  };
11043
11046
  if (inputs) state.inputs = inputs;
11044
11047
  const dir = path7.join(runsDir(root), runId);
@@ -11050,7 +11053,7 @@ async function createRun(root, slug, phase, inputs, now = /* @__PURE__ */ new Da
11050
11053
  return state;
11051
11054
  }
11052
11055
  async function appendRunEvent(root, runId, type, data, now = /* @__PURE__ */ new Date()) {
11053
- const event = { eventId: randomBytes(4).toString("hex"), at: now.toISOString(), type };
11056
+ const event = { eventId: randomBytes(4).toString("hex"), at: localIso(now), type };
11054
11057
  if (data) event.data = data;
11055
11058
  const file = path7.join(runsDir(root), runId, "events.jsonl");
11056
11059
  const previous = await readTextIfExists(file) ?? "";
@@ -11064,7 +11067,7 @@ async function updateRunStatus(root, runId, status, now = /* @__PURE__ */ new Da
11064
11067
  if (raw === void 0) return;
11065
11068
  const state = JSON.parse(raw);
11066
11069
  state.status = status;
11067
- state.updatedAt = now.toISOString();
11070
+ state.updatedAt = localIso(now);
11068
11071
  await writeText(file, `${JSON.stringify(state, null, 2)}
11069
11072
  `);
11070
11073
  }
@@ -11289,7 +11292,7 @@ async function writeMockupPlan(root, slug, plan, now = /* @__PURE__ */ new Date(
11289
11292
  if (await exists(file)) return file;
11290
11293
  const doc = {
11291
11294
  schema_version: 1,
11292
- generated_at: now.toISOString(),
11295
+ generated_at: localIso(now),
11293
11296
  platform: plan.platform,
11294
11297
  screens: plan.screens.map((s) => ({ id: s.id, title: s.title, file: s.file, illustrates: s.illustrates, states: s.states, breakpoints: s.breakpoints }))
11295
11298
  };
@@ -11305,7 +11308,7 @@ async function writeMockupManifest(root, slug, plan, inputsHash, now = /* @__PUR
11305
11308
  level: "hifi",
11306
11309
  platform: plan.platform,
11307
11310
  inputs_hash: inputsHash,
11308
- generated_at: now.toISOString(),
11311
+ generated_at: localIso(now),
11309
11312
  screens: plan.screens.map((s) => ({ id: s.id, title: s.title, file: s.file, illustrates: s.illustrates, states: s.states, breakpoints: s.breakpoints })),
11310
11313
  screenshots: []
11311
11314
  };
@@ -11747,7 +11750,7 @@ async function runAnalyze(opts) {
11747
11750
  if (packs) result.packs = packs;
11748
11751
  if (opts.write !== false) {
11749
11752
  const file = path10.join(change.dir, "analyze.md");
11750
- await writeText(file, renderAnalyze(change, result, (opts.now ?? /* @__PURE__ */ new Date()).toISOString()));
11753
+ await writeText(file, renderAnalyze(change, result, localIso(opts.now)));
11751
11754
  result.path = file;
11752
11755
  }
11753
11756
  return result;
@@ -11886,7 +11889,7 @@ async function collectMetrics(root, now = /* @__PURE__ */ new Date()) {
11886
11889
  archived: archivedEntries.length
11887
11890
  };
11888
11891
  return {
11889
- generatedAt: now.toISOString(),
11892
+ generatedAt: localIso(now),
11890
11893
  project: config.project.name,
11891
11894
  root: resolved,
11892
11895
  changes,
@@ -11941,7 +11944,7 @@ async function generatePresentation(opts) {
11941
11944
  project: config.project.name,
11942
11945
  version: change.delta.sectionsFound.length,
11943
11946
  hash,
11944
- generatedAt: now.toISOString(),
11947
+ generatedAt: localIso(now),
11945
11948
  proposalHtml: proposalBody ? renderMarkdown2(proposalBody) : `<p><em>${labels.noProposal}</em></p>`,
11946
11949
  requirements: change.delta ? [...change.delta.added.map((r) => ({ req: r, kind: "added" })), ...change.delta.modified.map((r) => ({ req: r, kind: "modified" }))] : [],
11947
11950
  evidence: new Map((change.verify?.evidence ?? []).map((e) => [e.scenario, e.result])),
@@ -12320,7 +12323,7 @@ function baselineSpec(domain, files) {
12320
12323
  lines.push(`domain: ${domain}`);
12321
12324
  lines.push(`title: ${title}`);
12322
12325
  lines.push("version: 1");
12323
- lines.push(`updated: ${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}`);
12326
+ lines.push(`updated: ${localDate()}`);
12324
12327
  lines.push("---");
12325
12328
  lines.push("");
12326
12329
  lines.push(`# ${title}`);
@@ -12341,7 +12344,7 @@ function adoptReport(input) {
12341
12344
  lines.push(es ? "# Adopci\xF3n (brownfield)" : "# Adoption (brownfield)");
12342
12345
  lines.push("");
12343
12346
  lines.push(es ? `- Proyecto: ${input.config.project.name}` : `- Project: ${input.config.project.name}`);
12344
- lines.push(es ? `- Generado: ${input.now.toISOString()}` : `- Generated: ${input.now.toISOString()}`);
12347
+ lines.push(es ? `- Generado: ${localIso(input.now)}` : `- Generated: ${localIso(input.now)}`);
12345
12348
  lines.push(es ? `- Archivos de c\xF3digo inventariados: ${input.files} (de ${input.inventoried} archivos totales)` : `- Inventoried source files: ${input.files} (of ${input.inventoried} total files)`);
12346
12349
  if (input.detection) lines.push(es ? `- Stack detectado: ${input.detection.name} (${input.detection.score} puntos)` : `- Detected stack: ${input.detection.name} (${input.detection.score})`);
12347
12350
  lines.push("");
@@ -12393,7 +12396,7 @@ async function initWorkspace(opts) {
12393
12396
  created.push(path14.join(sddDir, "glossary.md"));
12394
12397
  const detected = await detectIfPossible(root, opts.profilesDir);
12395
12398
  if (detected) {
12396
- const yaml2 = detectionToYaml(detected, (opts.now ?? /* @__PURE__ */ new Date()).toISOString());
12399
+ const yaml2 = detectionToYaml(detected, localIso(opts.now));
12397
12400
  await writeText(path14.join(sddDir, "profiles", "detected.yaml"), yaml2);
12398
12401
  created.push(path14.join(sddDir, "profiles", "detected.yaml"));
12399
12402
  if (detected.best) {
@@ -12469,7 +12472,7 @@ async function createChange(opts) {
12469
12472
  title,
12470
12473
  domain,
12471
12474
  lane,
12472
- created: (opts.now ?? /* @__PURE__ */ new Date()).toISOString().slice(0, 10)
12475
+ created: localDate(opts.now)
12473
12476
  };
12474
12477
  await ensureDir(dir);
12475
12478
  const templates = templatesFor(language);
@@ -12576,7 +12579,7 @@ async function archiveChange(opts) {
12576
12579
  return { slug: opts.slug, fold: emptyFold, diagnostics, dryRun: opts.dryRun ?? false };
12577
12580
  }
12578
12581
  const nowFix = opts.now ?? /* @__PURE__ */ new Date();
12579
- const targetFix = path16.join(root, ".sdd", "changes", "archive", `${nowFix.toISOString().slice(0, 7)}-${opts.slug}`);
12582
+ const targetFix = path16.join(root, ".sdd", "changes", "archive", `${localMonth(nowFix)}-${opts.slug}`);
12580
12583
  if (await exists(targetFix)) {
12581
12584
  diagnostics.push(diag("ATLAS-ARCH-002", "error", `Ya existe un cambio archivado en ${targetFix}`, { path: targetFix }));
12582
12585
  return { slug: opts.slug, fold: emptyFold, diagnostics, dryRun: opts.dryRun ?? false };
@@ -12617,7 +12620,7 @@ version: 0
12617
12620
  title: fm.data["title"] ?? change.meta.title ?? domain,
12618
12621
  owner: fm.data["owner"],
12619
12622
  version: version + 1,
12620
- updated: now.toISOString().slice(0, 10)
12623
+ updated: localDate(now)
12621
12624
  };
12622
12625
  for (const key of Object.keys(nextFm)) if (nextFm[key] === void 0) delete nextFm[key];
12623
12626
  const body = fold.content.replace(/^[\r\n]+/, "").trimEnd() + "\n";
@@ -12626,7 +12629,7 @@ ${Object.entries(nextFm).map(([k, v]) => `${k}: ${String(v)}`).join("\n")}
12626
12629
  ---
12627
12630
 
12628
12631
  ${body}`;
12629
- const month = now.toISOString().slice(0, 7);
12632
+ const month = localMonth(now);
12630
12633
  const archiveDir = path16.join(root, ".sdd", "changes", "archive");
12631
12634
  const target = path16.join(archiveDir, `${month}-${opts.slug}`);
12632
12635
  if (await exists(target)) {
@@ -5,12 +5,28 @@ import {
5
5
  writeText
6
6
  } from "./chunk-DKFIPJ74.js";
7
7
 
8
- // ../core/dist/chunk-LMJURGRU.js
8
+ // ../core/dist/chunk-CTT5JQA5.js
9
9
  import path from "path";
10
10
  import { stringify as stringifyYaml } from "yaml";
11
11
  import { createHash } from "crypto";
12
12
  import { parse as parseYaml } from "yaml";
13
13
  import { z } from "zod";
14
+ function pad(value, length = 2) {
15
+ return String(value).padStart(length, "0");
16
+ }
17
+ function localDate(date = /* @__PURE__ */ new Date()) {
18
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
19
+ }
20
+ function localMonth(date = /* @__PURE__ */ new Date()) {
21
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}`;
22
+ }
23
+ function localIso(date = /* @__PURE__ */ new Date()) {
24
+ const offset = -date.getTimezoneOffset();
25
+ const sign = offset >= 0 ? "+" : "-";
26
+ const absolute = Math.abs(offset);
27
+ const time = `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}.${pad(date.getMilliseconds(), 3)}`;
28
+ return `${localDate(date)}T${time}${sign}${pad(Math.floor(absolute / 60))}:${pad(absolute % 60)}`;
29
+ }
14
30
  function diag(code, severity, message, opts = {}) {
15
31
  const d = { code, severity, message };
16
32
  if (opts.path !== void 0) d.path = opts.path;
@@ -189,7 +205,7 @@ async function signApproval(opts) {
189
205
  artifact: rel,
190
206
  artifactHash: artifactHash(content),
191
207
  approvedBy: opts.by.trim(),
192
- approvedAt: now.toISOString(),
208
+ approvedAt: localIso(now),
193
209
  channel: opts.channel ?? "cli"
194
210
  };
195
211
  if (opts.note) approval.note = opts.note;
@@ -216,6 +232,9 @@ async function signApproval(opts) {
216
232
  }
217
233
 
218
234
  export {
235
+ localDate,
236
+ localMonth,
237
+ localIso,
219
238
  diag,
220
239
  countBySeverity,
221
240
  sha256,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specatlas",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "SpecAtlas: kernel determinista de Spec-Driven Development (CLI)",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@specatlas/adapters": "0.1.1",
43
- "@specatlas/core": "0.1.10"
43
+ "@specatlas/core": "0.1.11"
44
44
  },
45
45
  "scripts": {
46
46
  "typecheck": "tsc --noEmit",