@codyswann/lisa 1.31.1 → 1.32.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.
@@ -9,6 +9,8 @@ Implement the requirements in $ARGUMENTS.
9
9
 
10
10
  If no argument provided, search for plan files in the `plans/` directory and present them to the user for selection.
11
11
 
12
+ Critical: you must create an agent team to implement the plan. Do not try to skip this!
13
+
12
14
  ## Step 1: Parse Plan
13
15
 
14
16
  1. **Read the plan file** specified in `$ARGUMENTS`
@@ -1,32 +1,56 @@
1
1
  /**
2
- * Fibonacci sequence utilities providing safe, validated computation
3
- * within JavaScript's integer precision limits.
4
- *
5
- * Caps at fibonacci(78) / sequence length 79 because fibonacci(79)
6
- * exceeds Number.MAX_SAFE_INTEGER, which would silently corrupt results.
7
- *
2
+ * @file fibonacci.ts
3
+ * @description BigInt Fibonacci utilities using a lazy generator pattern.
4
+ * Uses BigInt instead of Number to eliminate the precision ceiling at
5
+ * fibonacci(78) BigInt supports arbitrarily large integers, so callers
6
+ * can compute fibonacci(1000) or beyond without silent corruption.
7
+ * The generator pattern enables lazy evaluation, letting consumers pull
8
+ * only the values they need without allocating the full sequence upfront.
8
9
  * @module fibonacci
9
10
  */
10
11
  /**
11
- * Compute the nth Fibonacci number (0-indexed).
12
+ * Infinite lazy generator yielding Fibonacci numbers as BigInt.
12
13
  *
13
- * Uses an iterative tuple-reduce approach to avoid stack overflow
14
- * and keep computation O(n) time, O(1) space.
14
+ * @returns Generator that yields successive Fibonacci numbers (0n, 1n, 1n, 2n, 3n, ...)
15
+ * @remarks The generator never terminates do not spread or collect without a length limit.
16
+ * Each call creates an independent generator instance — safe for concurrent iteration.
17
+ * @example
18
+ * ```typescript
19
+ * const gen = fibonacciGenerator();
20
+ * gen.next().value; // 0n
21
+ * gen.next().value; // 1n
15
22
  *
16
- * @param n - The zero-based index in the Fibonacci sequence
17
- * @returns The nth Fibonacci number
18
- * @throws {RangeError} If n is negative, non-integer, NaN, Infinity, or greater than 78
23
+ * // Collect first 5 values:
24
+ * const first5 = Array.from({ length: 5 }, () => gen.next().value);
25
+ * ```
19
26
  */
20
- export declare function fibonacci(n: number): number;
27
+ export declare function fibonacciGenerator(): Generator<bigint, never, unknown>;
21
28
  /**
22
- * Generate the first `length` Fibonacci numbers as a readonly array.
29
+ * Compute the nth Fibonacci number (0-indexed) using BigInt.
23
30
  *
24
- * Builds the sequence incrementally with reduce so each element derives
25
- * from its two predecessors without recomputing from scratch.
31
+ * @param n - Zero-based index in the Fibonacci sequence (must be a non-negative integer)
32
+ * @returns The nth Fibonacci number as a BigInt — compare with `===` against bigint literals (e.g. `55n`), not numbers
33
+ * @throws {RangeError} If n is negative, non-integer, NaN, or Infinity
34
+ * @remarks Delegates to fibonacciGenerator — O(n) time, consistent with the lazy generator approach
35
+ * @example
36
+ * ```typescript
37
+ * fibonacci(10); // 55n (bigint, not number)
38
+ * fibonacci(10) === 55n; // true
39
+ * fibonacci(10) === 55; // false — bigint !== number
40
+ * ```
41
+ */
42
+ export declare function fibonacci(n: number): bigint;
43
+ /**
44
+ * Generate the first `length` Fibonacci numbers as a readonly BigInt array.
26
45
  *
27
- * @param length - How many Fibonacci numbers to generate
28
- * @returns A readonly array of Fibonacci numbers
29
- * @throws {RangeError} If length is negative, non-integer, NaN, Infinity, or greater than 79
46
+ * @param length - How many Fibonacci numbers to generate (must be a non-negative integer)
47
+ * @returns A readonly array of the first `length` Fibonacci numbers as BigInt
48
+ * @throws {RangeError} If length is negative, non-integer, NaN, or Infinity
49
+ * @remarks Wraps fibonacciGenerator so the sequence is computed once, not per-element
50
+ * @example
51
+ * ```typescript
52
+ * fibonacciSequence(5); // [0n, 1n, 1n, 2n, 3n]
53
+ * ```
30
54
  */
31
- export declare function fibonacciSequence(length: number): readonly number[];
55
+ export declare function fibonacciSequence(length: number): readonly bigint[];
32
56
  //# sourceMappingURL=fibonacci.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fibonacci.d.ts","sourceRoot":"","sources":["../../src/utils/fibonacci.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAsB3C;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAiBnE"}
1
+ {"version":3,"file":"fibonacci.d.ts","sourceRoot":"","sources":["../../src/utils/fibonacci.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,wBAAiB,kBAAkB,IAAI,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CASvE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAY3C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAUnE"}
@@ -1,56 +1,78 @@
1
1
  /**
2
- * Fibonacci sequence utilities providing safe, validated computation
3
- * within JavaScript's integer precision limits.
4
- *
5
- * Caps at fibonacci(78) / sequence length 79 because fibonacci(79)
6
- * exceeds Number.MAX_SAFE_INTEGER, which would silently corrupt results.
7
- *
2
+ * @file fibonacci.ts
3
+ * @description BigInt Fibonacci utilities using a lazy generator pattern.
4
+ * Uses BigInt instead of Number to eliminate the precision ceiling at
5
+ * fibonacci(78) BigInt supports arbitrarily large integers, so callers
6
+ * can compute fibonacci(1000) or beyond without silent corruption.
7
+ * The generator pattern enables lazy evaluation, letting consumers pull
8
+ * only the values they need without allocating the full sequence upfront.
8
9
  * @module fibonacci
9
10
  */
10
- /** Largest n for which fibonacci(n) fits in a safe JS integer. */
11
- const MAX_SAFE_N = 78;
12
- /** Largest sequence length where all elements remain safe JS integers. */
13
- const MAX_SAFE_LENGTH = 79;
14
11
  /**
15
- * Compute the nth Fibonacci number (0-indexed).
12
+ * Infinite lazy generator yielding Fibonacci numbers as BigInt.
16
13
  *
17
- * Uses an iterative tuple-reduce approach to avoid stack overflow
18
- * and keep computation O(n) time, O(1) space.
14
+ * @returns Generator that yields successive Fibonacci numbers (0n, 1n, 1n, 2n, 3n, ...)
15
+ * @remarks The generator never terminates do not spread or collect without a length limit.
16
+ * Each call creates an independent generator instance — safe for concurrent iteration.
17
+ * @example
18
+ * ```typescript
19
+ * const gen = fibonacciGenerator();
20
+ * gen.next().value; // 0n
21
+ * gen.next().value; // 1n
19
22
  *
20
- * @param n - The zero-based index in the Fibonacci sequence
21
- * @returns The nth Fibonacci number
22
- * @throws {RangeError} If n is negative, non-integer, NaN, Infinity, or greater than 78
23
+ * // Collect first 5 values:
24
+ * const first5 = Array.from({ length: 5 }, () => gen.next().value);
25
+ * ```
26
+ */
27
+ export function* fibonacciGenerator() {
28
+ /* eslint-disable functional/no-let -- generator requires mutable state for iterative Fibonacci computation */
29
+ let a = 0n;
30
+ let b = 1n;
31
+ /* eslint-enable functional/no-let -- re-enable after generator state declarations */
32
+ while (true) {
33
+ yield a;
34
+ [a, b] = [b, a + b];
35
+ }
36
+ }
37
+ /**
38
+ * Compute the nth Fibonacci number (0-indexed) using BigInt.
39
+ *
40
+ * @param n - Zero-based index in the Fibonacci sequence (must be a non-negative integer)
41
+ * @returns The nth Fibonacci number as a BigInt — compare with `===` against bigint literals (e.g. `55n`), not numbers
42
+ * @throws {RangeError} If n is negative, non-integer, NaN, or Infinity
43
+ * @remarks Delegates to fibonacciGenerator — O(n) time, consistent with the lazy generator approach
44
+ * @example
45
+ * ```typescript
46
+ * fibonacci(10); // 55n (bigint, not number)
47
+ * fibonacci(10) === 55n; // true
48
+ * fibonacci(10) === 55; // false — bigint !== number
49
+ * ```
23
50
  */
24
51
  export function fibonacci(n) {
25
52
  if (!Number.isInteger(n) || n < 0) {
26
53
  throw new RangeError(`Expected a non-negative integer for n, got ${String(n)}`);
27
54
  }
28
- if (n > MAX_SAFE_N) {
29
- throw new RangeError("fibonacci(n) exceeds Number.MAX_SAFE_INTEGER for n > 78");
30
- }
31
- if (n <= 1) {
32
- return n;
33
- }
34
- const [, result] = Array.from({ length: n - 1 }).reduce(([prev, curr]) => [curr, prev + curr], [0, 1]);
35
- return result;
55
+ const gen = fibonacciGenerator();
56
+ Array.from({ length: n }, () => gen.next());
57
+ return gen.next().value;
36
58
  }
37
59
  /**
38
- * Generate the first `length` Fibonacci numbers as a readonly array.
60
+ * Generate the first `length` Fibonacci numbers as a readonly BigInt array.
39
61
  *
40
- * Builds the sequence incrementally with reduce so each element derives
41
- * from its two predecessors without recomputing from scratch.
42
- *
43
- * @param length - How many Fibonacci numbers to generate
44
- * @returns A readonly array of Fibonacci numbers
45
- * @throws {RangeError} If length is negative, non-integer, NaN, Infinity, or greater than 79
62
+ * @param length - How many Fibonacci numbers to generate (must be a non-negative integer)
63
+ * @returns A readonly array of the first `length` Fibonacci numbers as BigInt
64
+ * @throws {RangeError} If length is negative, non-integer, NaN, or Infinity
65
+ * @remarks Wraps fibonacciGenerator so the sequence is computed once, not per-element
66
+ * @example
67
+ * ```typescript
68
+ * fibonacciSequence(5); // [0n, 1n, 1n, 2n, 3n]
69
+ * ```
46
70
  */
47
71
  export function fibonacciSequence(length) {
48
72
  if (!Number.isInteger(length) || length < 0) {
49
73
  throw new RangeError(`Expected a non-negative integer for length, got ${String(length)}`);
50
74
  }
51
- if (length > MAX_SAFE_LENGTH) {
52
- throw new RangeError("fibonacciSequence(length) exceeds Number.MAX_SAFE_INTEGER for length > 79");
53
- }
54
- return Array.from({ length }).reduce((acc, _, i) => [...acc, i < 2 ? i : (acc[i - 1] ?? 0) + (acc[i - 2] ?? 0)], []);
75
+ const gen = fibonacciGenerator();
76
+ return Array.from({ length }, () => gen.next().value);
55
77
  }
56
78
  //# sourceMappingURL=fibonacci.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fibonacci.js","sourceRoot":"","sources":["../../src/utils/fibonacci.ts"],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C,IAAI,EAAE,CAAC,KAAK,CAAC;AAC1B,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,UAAU,CAClB,mDAAmD,MAAM,CAAC,MAAM,CAAC,EAAE,CACpE,CAAC;IACJ,CAAC;IAED,MAAM,GAAG,GAAG,kBAAkB,EAAE,CAAC;IAEjC,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC"}
package/package.json CHANGED
@@ -88,7 +88,7 @@
88
88
  "@isaacs/brace-expansion": "^5.0.1"
89
89
  },
90
90
  "name": "@codyswann/lisa",
91
- "version": "1.31.1",
91
+ "version": "1.32.0",
92
92
  "description": "Claude Code governance framework that applies guardrails, guidance, and automated enforcement to projects",
93
93
  "main": "dist/index.js",
94
94
  "bin": {