stonecut 1.1.0 → 1.1.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stonecut",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "CLI that drives PRD-driven development with agentic coding CLIs",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/logger.ts CHANGED
@@ -5,24 +5,47 @@
5
5
  * .stonecut/logs/<prdIdentifier>-<timestamp>.log.
6
6
  */
7
7
 
8
- import { appendFileSync, mkdirSync } from "fs";
9
- import { join, resolve } from "path";
8
+ import { appendFileSync, existsSync, mkdirSync } from "fs";
9
+ import { dirname, join, resolve } from "path";
10
10
  import type { LogWriter } from "./types";
11
11
 
12
12
  export class Logger implements LogWriter {
13
13
  readonly filePath: string;
14
+ private warnedRecreated = false;
15
+ private warnedUnavailable = false;
14
16
 
15
17
  constructor(prdIdentifier: string) {
16
18
  const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
17
19
  const logDir = resolve(".stonecut", "logs");
18
- mkdirSync(logDir, { recursive: true });
19
20
  this.filePath = join(logDir, `${prdIdentifier}-${timestamp}.log`);
21
+ try {
22
+ mkdirSync(logDir, { recursive: true });
23
+ appendFileSync(this.filePath, "");
24
+ } catch {
25
+ console.error("Warning: session log is unavailable; continuing without file logging.");
26
+ this.warnedUnavailable = true;
27
+ }
20
28
  }
21
29
 
22
30
  log(message: string): void {
23
31
  console.log(message);
24
32
  const ts = new Date().toISOString();
25
- appendFileSync(this.filePath, `[${ts}] ${message}\n`);
33
+ const fileWasMissing = !existsSync(this.filePath);
34
+ try {
35
+ mkdirSync(dirname(this.filePath), { recursive: true });
36
+ appendFileSync(this.filePath, `[${ts}] ${message}\n`);
37
+ if (fileWasMissing && !this.warnedRecreated) {
38
+ console.error(
39
+ `Warning: session log was deleted during execution and recreated at ${this.filePath}. Earlier log entries may be missing.`,
40
+ );
41
+ this.warnedRecreated = true;
42
+ }
43
+ } catch {
44
+ if (!this.warnedUnavailable) {
45
+ console.error("Warning: session log is unavailable; continuing without file logging.");
46
+ this.warnedUnavailable = true;
47
+ }
48
+ }
26
49
  }
27
50
 
28
51
  close(): void {
@@ -12,6 +12,7 @@ IMPORTANT:
12
12
 
13
13
  - Do ONLY this one issue. Stop after verifying.
14
14
  - Do NOT commit — the orchestrator handles git operations.
15
+ - Do NOT modify or delete the `.stonecut/` directory — it contains runtime state and session logs.
15
16
  - Do NOT modify files outside the scope of this issue unless fixing an import path that changed.
16
17
  - Scope lint to specific files — do not run project-wide lint that auto-fixes unrelated files.
17
18