@codyswann/lisa 1.0.0 → 1.0.5
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/README.md +244 -36
- package/all/copy-overwrite/.claude/README.md +1 -3
- package/all/copy-overwrite/.claude/REFERENCE.md +519 -0
- package/all/copy-overwrite/.claude/agents/skill-evaluator.md +7 -7
- package/all/copy-overwrite/.claude/agents/test-coverage-agent.md +17 -0
- package/all/copy-overwrite/.claude/commands/git/commit.md +9 -5
- package/all/copy-overwrite/.claude/commands/git/submit-pr.md +1 -1
- package/all/copy-overwrite/.claude/commands/lisa/review-implementation.md +209 -0
- package/all/copy-overwrite/.claude/commands/project/add-test-coverage.md +58 -0
- package/all/copy-overwrite/.claude/commands/project/archive.md +1 -1
- package/all/copy-overwrite/.claude/commands/project/complete-task.md +53 -1
- package/all/copy-overwrite/.claude/commands/project/debrief.md +12 -23
- package/all/copy-overwrite/.claude/commands/project/execute.md +33 -77
- package/all/copy-overwrite/.claude/commands/project/fix-linter-error.md +87 -0
- package/all/copy-overwrite/.claude/commands/project/implement.md +24 -28
- package/all/copy-overwrite/.claude/commands/project/lower-code-complexity.md +30 -55
- package/all/copy-overwrite/.claude/commands/project/plan.md +87 -242
- package/all/copy-overwrite/.claude/commands/project/reduce-max-lines-per-function.md +76 -0
- package/all/copy-overwrite/.claude/commands/project/reduce-max-lines.md +75 -0
- package/all/copy-overwrite/.claude/commands/project/research.md +86 -188
- package/all/copy-overwrite/.claude/commands/project/review.md +19 -38
- package/all/copy-overwrite/.claude/commands/project/setup.md +1 -1
- package/all/copy-overwrite/.claude/commands/project/verify.md +62 -25
- package/all/copy-overwrite/.claude/commands/pull-request/review.md +25 -7
- package/all/copy-overwrite/.claude/commands/tasks/load.md +63 -0
- package/all/copy-overwrite/.claude/commands/tasks/sync.md +84 -0
- package/all/copy-overwrite/.claude/hooks/README.md +75 -0
- package/all/copy-overwrite/.claude/hooks/check-tired-boss.sh +61 -0
- package/all/copy-overwrite/.claude/hooks/debug-hook.sh +47 -0
- package/all/copy-overwrite/.claude/hooks/notify-ntfy.sh +2 -0
- package/all/copy-overwrite/.claude/hooks/sync-tasks.sh +95 -0
- package/all/copy-overwrite/.claude/{skills/coding-philosophy/SKILL.md → rules/coding-philosophy.md} +93 -70
- package/all/copy-overwrite/.claude/settings.json +35 -14
- package/all/copy-overwrite/.claude/skills/prompt-complexity-scorer/SKILL.md +41 -9
- package/all/copy-overwrite/.claude/skills/skill-creator/scripts/init_skill.py +2 -0
- package/all/copy-overwrite/.claude/skills/skill-creator/scripts/package_skill.py +2 -0
- package/all/copy-overwrite/.claude/skills/skill-creator/scripts/quick_validate.py +2 -0
- package/all/copy-overwrite/.safety-net.json +25 -0
- package/all/copy-overwrite/CLAUDE.md +8 -30
- package/all/copy-overwrite/HUMAN.md +517 -17
- package/all/create-only/.claude/rules/PROJECT_RULES.md +9 -0
- package/all/create-only/scripts/setup-deploy-key.sh +190 -0
- package/all/deletions.json +5 -0
- package/cdk/copy-overwrite/.github/workflows/ci.yml +142 -0
- package/cdk/copy-overwrite/.github/workflows/deploy.yml +59 -0
- package/cdk/copy-overwrite/eslint.cdk.ts +175 -0
- package/cdk/copy-overwrite/eslint.config.ts +51 -0
- package/cdk/copy-overwrite/eslint.slow.config.ts +80 -0
- package/cdk/copy-overwrite/knip.json +53 -0
- package/cdk/copy-overwrite/tsconfig.eslint.json +11 -0
- package/cdk/merge/package.json +17 -1
- package/dist/cli/index.d.ts +3 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +83 -64
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/prompts.d.ts +17 -3
- package/dist/cli/prompts.d.ts.map +1 -1
- package/dist/cli/prompts.js +52 -16
- package/dist/cli/prompts.js.map +1 -1
- package/dist/core/config.d.ts +13 -4
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +17 -9
- package/dist/core/config.js.map +1 -1
- package/dist/core/git-service.d.ts +40 -0
- package/dist/core/git-service.d.ts.map +1 -0
- package/dist/core/git-service.js +52 -0
- package/dist/core/git-service.js.map +1 -0
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +3 -3
- package/dist/core/lisa.d.ts +124 -7
- package/dist/core/lisa.d.ts.map +1 -1
- package/dist/core/lisa.js +423 -221
- package/dist/core/lisa.js.map +1 -1
- package/dist/core/manifest.d.ts +5 -1
- package/dist/core/manifest.d.ts.map +1 -1
- package/dist/core/manifest.js +22 -16
- package/dist/core/manifest.js.map +1 -1
- package/dist/detection/detector.interface.d.ts +1 -1
- package/dist/detection/detectors/cdk.d.ts +6 -1
- package/dist/detection/detectors/cdk.d.ts.map +1 -1
- package/dist/detection/detectors/cdk.js +16 -8
- package/dist/detection/detectors/cdk.js.map +1 -1
- package/dist/detection/detectors/expo.d.ts +6 -1
- package/dist/detection/detectors/expo.d.ts.map +1 -1
- package/dist/detection/detectors/expo.js +13 -8
- package/dist/detection/detectors/expo.js.map +1 -1
- package/dist/detection/detectors/nestjs.d.ts +7 -2
- package/dist/detection/detectors/nestjs.d.ts.map +1 -1
- package/dist/detection/detectors/nestjs.js +17 -9
- package/dist/detection/detectors/nestjs.js.map +1 -1
- package/dist/detection/detectors/npm-package.d.ts +6 -1
- package/dist/detection/detectors/npm-package.d.ts.map +1 -1
- package/dist/detection/detectors/npm-package.js +9 -4
- package/dist/detection/detectors/npm-package.js.map +1 -1
- package/dist/detection/detectors/typescript.d.ts +6 -1
- package/dist/detection/detectors/typescript.d.ts.map +1 -1
- package/dist/detection/detectors/typescript.js +12 -7
- package/dist/detection/detectors/typescript.js.map +1 -1
- package/dist/detection/index.d.ts +13 -3
- package/dist/detection/index.d.ts.map +1 -1
- package/dist/detection/index.js +17 -7
- package/dist/detection/index.js.map +1 -1
- package/dist/errors/index.d.ts +66 -2
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +89 -17
- package/dist/errors/index.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/logging/console-logger.d.ts +21 -1
- package/dist/logging/console-logger.d.ts.map +1 -1
- package/dist/logging/console-logger.js +26 -6
- package/dist/logging/console-logger.js.map +1 -1
- package/dist/logging/index.d.ts +3 -3
- package/dist/logging/index.js +2 -2
- package/dist/logging/logger.interface.d.ts +1 -1
- package/dist/logging/silent-logger.d.ts +21 -1
- package/dist/logging/silent-logger.d.ts.map +1 -1
- package/dist/logging/silent-logger.js +20 -0
- package/dist/logging/silent-logger.js.map +1 -1
- package/dist/strategies/copy-contents.d.ts +47 -6
- package/dist/strategies/copy-contents.d.ts.map +1 -1
- package/dist/strategies/copy-contents.js +99 -49
- package/dist/strategies/copy-contents.js.map +1 -1
- package/dist/strategies/copy-overwrite.d.ts +10 -2
- package/dist/strategies/copy-overwrite.d.ts.map +1 -1
- package/dist/strategies/copy-overwrite.js +17 -9
- package/dist/strategies/copy-overwrite.js.map +1 -1
- package/dist/strategies/create-only.d.ts +10 -2
- package/dist/strategies/create-only.d.ts.map +1 -1
- package/dist/strategies/create-only.js +14 -6
- package/dist/strategies/create-only.js.map +1 -1
- package/dist/strategies/index.d.ts +17 -7
- package/dist/strategies/index.d.ts.map +1 -1
- package/dist/strategies/index.js +19 -9
- package/dist/strategies/index.js.map +1 -1
- package/dist/strategies/merge.d.ts +10 -2
- package/dist/strategies/merge.d.ts.map +1 -1
- package/dist/strategies/merge.js +21 -21
- package/dist/strategies/merge.js.map +1 -1
- package/dist/strategies/strategy.interface.d.ts +1 -1
- package/dist/strategies/strategy.interface.d.ts.map +1 -1
- package/dist/transaction/backup.d.ts +15 -1
- package/dist/transaction/backup.d.ts.map +1 -1
- package/dist/transaction/backup.js +47 -12
- package/dist/transaction/backup.js.map +1 -1
- package/dist/transaction/index.d.ts +3 -3
- package/dist/transaction/index.js +2 -2
- package/dist/transaction/transaction.d.ts +25 -2
- package/dist/transaction/transaction.d.ts.map +1 -1
- package/dist/transaction/transaction.js +25 -2
- package/dist/transaction/transaction.js.map +1 -1
- package/dist/utils/file-operations.d.ts +21 -0
- package/dist/utils/file-operations.d.ts.map +1 -1
- package/dist/utils/file-operations.js +48 -12
- package/dist/utils/file-operations.js.map +1 -1
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js +3 -3
- package/dist/utils/json-utils.d.ts +12 -0
- package/dist/utils/json-utils.d.ts.map +1 -1
- package/dist/utils/json-utils.js +17 -5
- package/dist/utils/json-utils.js.map +1 -1
- package/dist/utils/path-utils.d.ts +11 -0
- package/dist/utils/path-utils.d.ts.map +1 -1
- package/dist/utils/path-utils.js +12 -1
- package/dist/utils/path-utils.js.map +1 -1
- package/eslint-plugin-code-organization/__tests__/enforce-statement-order.test.js +5 -0
- package/eslint-plugin-code-organization/index.js +5 -0
- package/eslint-plugin-code-organization/rules/enforce-statement-order.js +5 -0
- package/expo/copy-overwrite/.claude/skills/atomic-design-gluestack/scripts/validate_atomic_structure.py +2 -0
- package/expo/copy-overwrite/.claude/skills/container-view-pattern/scripts/create_component.py +2 -0
- package/expo/copy-overwrite/.claude/skills/container-view-pattern/scripts/validate_component.py +2 -0
- package/expo/copy-overwrite/.claude/skills/cross-platform-compatibility/scripts/validate_cross_platform.py +2 -0
- package/expo/copy-overwrite/.claude/skills/directory-structure/scripts/validate_structure.py +2 -0
- package/expo/copy-overwrite/.claude/skills/expo-router-best-practices/scripts/generate-route.py +2 -0
- package/expo/copy-overwrite/.claude/skills/gluestack-nativewind/scripts/validate_styling.py +2 -41
- package/{typescript → expo}/copy-overwrite/.github/workflows/build.yml +3 -0
- package/expo/copy-overwrite/.github/workflows/ci.yml +36 -0
- package/{typescript → expo}/copy-overwrite/.github/workflows/deploy.yml +22 -26
- package/{typescript → expo}/copy-overwrite/.github/workflows/lighthouse.yml +4 -1
- package/expo/copy-overwrite/eslint-plugin-component-structure/__tests__/plugin-index.test.js +5 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/__tests__/require-memo-in-view.test.js +5 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/__tests__/single-component-per-file.test.js +5 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/index.js +5 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/rules/enforce-component-structure.js +5 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/rules/no-return-in-view.js +6 -1
- package/expo/copy-overwrite/eslint-plugin-component-structure/rules/require-memo-in-view.js +5 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/rules/single-component-per-file.js +5 -0
- package/expo/copy-overwrite/eslint-plugin-ui-standards/README.md +0 -68
- package/expo/copy-overwrite/eslint-plugin-ui-standards/index.js +5 -3
- package/expo/copy-overwrite/eslint-plugin-ui-standards/rules/no-classname-outside-ui.js +5 -0
- package/expo/copy-overwrite/eslint-plugin-ui-standards/rules/no-direct-rn-imports.js +5 -0
- package/expo/copy-overwrite/eslint.config.ts +53 -0
- package/expo/copy-overwrite/eslint.expo.ts +330 -0
- package/expo/copy-overwrite/eslint.slow.config.ts +86 -0
- package/expo/copy-overwrite/knip.json +132 -0
- package/expo/copy-overwrite/lighthouserc.js +27 -0
- package/expo/copy-overwrite/tsconfig.eslint.json +25 -0
- package/expo/create-only/lighthouserc-config.json +6 -1
- package/expo/merge/package.json +16 -3
- package/nestjs/copy-overwrite/.claude/skills/nestjs-rules/SKILL.md +1 -1
- package/{typescript → nestjs}/copy-overwrite/.github/k6/README.md +2 -2
- package/{typescript → nestjs}/copy-overwrite/.github/k6/examples/customer-deploy-integration.yml +3 -0
- package/{typescript → nestjs}/copy-overwrite/.github/k6/examples/data-driven-test.js +5 -0
- package/{typescript → nestjs}/copy-overwrite/.github/k6/scenarios/load.js +6 -2
- package/{typescript → nestjs}/copy-overwrite/.github/k6/scenarios/smoke.js +5 -0
- package/{typescript → nestjs}/copy-overwrite/.github/k6/scenarios/soak.js +5 -0
- package/{typescript → nestjs}/copy-overwrite/.github/k6/scenarios/spike.js +5 -0
- package/{typescript → nestjs}/copy-overwrite/.github/k6/scenarios/stress.js +5 -0
- package/{typescript → nestjs}/copy-overwrite/.github/k6/scripts/api-test.js +5 -0
- package/{typescript → nestjs}/copy-overwrite/.github/k6/scripts/default-test.js +5 -0
- package/nestjs/copy-overwrite/.github/workflows/ci.yml +29 -0
- package/nestjs/copy-overwrite/.github/workflows/deploy.yml +291 -0
- package/{typescript → nestjs}/copy-overwrite/.github/workflows/load-test.yml +3 -0
- package/nestjs/copy-overwrite/eslint.config.ts +53 -0
- package/nestjs/copy-overwrite/eslint.nestjs.ts +178 -0
- package/nestjs/merge/package.json +11 -3
- package/package.json +34 -40
- package/typescript/copy-contents/.husky/pre-commit +1 -1
- package/typescript/copy-contents/.husky/pre-push +99 -118
- package/typescript/copy-overwrite/.claude/hooks/format-on-edit.sh +2 -0
- package/typescript/copy-overwrite/.claude/hooks/install_pkgs.sh +3 -11
- package/typescript/copy-overwrite/.claude/hooks/lint-on-edit.sh +2 -0
- package/typescript/copy-overwrite/.claude/hooks/sg-scan-on-edit.sh +68 -0
- package/typescript/copy-overwrite/.claude/settings.json +79 -0
- package/typescript/copy-overwrite/.claude/skills/jsdoc-best-practices/SKILL.md +44 -0
- package/typescript/copy-overwrite/.github/README.md +49 -1
- package/typescript/copy-overwrite/.github/dependabot.yml +3 -0
- package/typescript/copy-overwrite/.github/workflows/ci.yml +7 -29
- package/typescript/copy-overwrite/.github/workflows/claude.yml +3 -0
- package/typescript/copy-overwrite/.github/workflows/create-github-issue-on-failure.yml +6 -4
- package/typescript/copy-overwrite/.github/workflows/create-issue-on-failure.yml +176 -0
- package/typescript/copy-overwrite/.github/workflows/create-jira-issue-on-failure.yml +3 -1
- package/typescript/copy-overwrite/.github/workflows/create-sentry-issue-on-failure.yml +3 -1
- package/typescript/copy-overwrite/.github/workflows/lint-slow.yml +40 -0
- package/typescript/copy-overwrite/.github/workflows/quality.yml +151 -38
- package/typescript/copy-overwrite/.github/workflows/release.yml +3 -0
- package/typescript/copy-overwrite/.gitleaksignore +3 -0
- package/typescript/copy-overwrite/.lintstagedrc.json +6 -0
- package/typescript/copy-overwrite/.prettierignore +2 -1
- package/typescript/copy-overwrite/.yamllint +2 -0
- package/typescript/copy-overwrite/ast-grep/rule-tests/.gitkeep +3 -0
- package/typescript/copy-overwrite/ast-grep/rules/.gitkeep +3 -0
- package/typescript/copy-overwrite/ast-grep/utils/.gitkeep +3 -0
- package/typescript/copy-overwrite/{commitlint.config.js → commitlint.config.cjs} +5 -0
- package/typescript/copy-overwrite/eslint-plugin-code-organization/__tests__/enforce-statement-order.test.js +5 -0
- package/typescript/copy-overwrite/eslint-plugin-code-organization/index.js +5 -0
- package/typescript/copy-overwrite/eslint-plugin-code-organization/rules/enforce-statement-order.js +5 -0
- package/typescript/copy-overwrite/eslint.base.ts +430 -0
- package/typescript/copy-overwrite/eslint.config.ts +52 -0
- package/typescript/copy-overwrite/eslint.ignore.config.json +19 -2
- package/typescript/copy-overwrite/eslint.slow.config.ts +69 -0
- package/typescript/copy-overwrite/eslint.typescript.ts +142 -0
- package/typescript/copy-overwrite/knip.json +64 -0
- package/typescript/copy-overwrite/sgconfig.yml +11 -0
- package/typescript/copy-overwrite/tsconfig.eslint.json +9 -0
- package/typescript/create-only/eslint.config.local.ts +24 -0
- package/typescript/{copy-overwrite/eslint.thresholds.config.json → create-only/eslint.thresholds.json} +1 -1
- package/typescript/github-rulesets/base.json +2 -75
- package/typescript/merge/.claude/settings.json +160 -0
- package/typescript/merge/package.json +35 -34
- package/all/copy-overwrite/.claude/commands/rules/format-md.md +0 -72
- package/all/copy-overwrite/.claude/skills/coding-philosophy/references/function-structure.md +0 -416
- package/all/copy-overwrite/.claude/skills/coding-philosophy/references/immutable-patterns.md +0 -316
- package/expo/copy-overwrite/eslint-plugin-ui-standards/rules/no-inline-styles.js +0 -73
- package/expo/copy-overwrite/eslint.config.mjs +0 -560
- package/lisa.sh +0 -35
- package/typescript/copy-overwrite/eslint.config.mjs +0 -390
- /package/{all/create-only/PROJECT_RULES.md → cdk/copy-overwrite/.github/workflows/.keep} +0 -0
- /package/{typescript → nestjs}/copy-overwrite/.github/k6/BROWSER_TESTING_NOTE.md +0 -0
- /package/{typescript → nestjs}/copy-overwrite/.github/k6/INTEGRATION_GUIDE.md +0 -0
- /package/{typescript → nestjs}/copy-overwrite/.github/k6/SCENARIO_SELECTION_GUIDE.md +0 -0
- /package/{typescript → nestjs}/copy-overwrite/.github/k6/scenarios/load.json +0 -0
- /package/{typescript → nestjs}/copy-overwrite/.github/k6/scenarios/smoke.json +0 -0
- /package/{typescript → nestjs}/copy-overwrite/.github/k6/scenarios/soak.json +0 -0
- /package/{typescript → nestjs}/copy-overwrite/.github/k6/scenarios/spike.json +0 -0
- /package/{typescript → nestjs}/copy-overwrite/.github/k6/scenarios/stress.json +0 -0
- /package/{typescript → nestjs}/copy-overwrite/.github/k6/thresholds/normal.json +0 -0
- /package/{typescript → nestjs}/copy-overwrite/.github/k6/thresholds/relaxed.json +0 -0
- /package/{typescript → nestjs}/copy-overwrite/.github/k6/thresholds/strict.json +0 -0
- /package/{typescript → nestjs}/copy-overwrite/.github/workflows/k6-load-test-README.md +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FileOperationResult } from
|
|
2
|
-
import type { ICopyStrategy, StrategyContext } from
|
|
1
|
+
import type { FileOperationResult } from "../core/config.js";
|
|
2
|
+
import type { ICopyStrategy, StrategyContext } from "./strategy.interface.js";
|
|
3
3
|
/**
|
|
4
4
|
* Merge strategy: Deep merge JSON files (project values take precedence)
|
|
5
5
|
* - Lisa values serve as defaults
|
|
@@ -8,6 +8,14 @@ import type { ICopyStrategy, StrategyContext } from './strategy.interface.js';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class MergeStrategy implements ICopyStrategy {
|
|
10
10
|
readonly name: "merge";
|
|
11
|
+
/**
|
|
12
|
+
* Apply merge strategy: Deep merge JSON files with project values taking precedence
|
|
13
|
+
* @param sourcePath - Source JSON file path
|
|
14
|
+
* @param destPath - Destination JSON file path
|
|
15
|
+
* @param relativePath - Relative path for recording
|
|
16
|
+
* @param context - Strategy context with config and callbacks
|
|
17
|
+
* @returns Result of the merge operation
|
|
18
|
+
*/
|
|
11
19
|
apply(sourcePath: string, destPath: string, relativePath: string, context: StrategyContext): Promise<FileOperationResult>;
|
|
12
20
|
}
|
|
13
21
|
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/strategies/merge.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAK9E;;;;;GAKG;AACH,qBAAa,aAAc,YAAW,aAAa;IACjD,QAAQ,CAAC,IAAI,EAAG,OAAO,CAAU;
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/strategies/merge.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAK9E;;;;;GAKG;AACH,qBAAa,aAAc,YAAW,aAAa;IACjD,QAAQ,CAAC,IAAI,EAAG,OAAO,CAAU;IAEjC;;;;;;;OAOG;IACG,KAAK,CACT,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,mBAAmB,CAAC;CAmDhC"}
|
package/dist/strategies/merge.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as fse from
|
|
2
|
-
import { copyFile } from
|
|
3
|
-
import { ensureParentDir } from
|
|
4
|
-
import { readJson, writeJson, deepMerge } from
|
|
5
|
-
import { JsonMergeError } from
|
|
1
|
+
import * as fse from "fs-extra";
|
|
2
|
+
import { copyFile } from "node:fs/promises";
|
|
3
|
+
import { ensureParentDir } from "../utils/file-operations.js";
|
|
4
|
+
import { readJson, writeJson, deepMerge } from "../utils/json-utils.js";
|
|
5
|
+
import { JsonMergeError } from "../errors/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* Merge strategy: Deep merge JSON files (project values take precedence)
|
|
8
8
|
* - Lisa values serve as defaults
|
|
@@ -10,7 +10,15 @@ import { JsonMergeError } from '../errors/index.js';
|
|
|
10
10
|
* - Handle nested paths (.claude/settings.json)
|
|
11
11
|
*/
|
|
12
12
|
export class MergeStrategy {
|
|
13
|
-
name =
|
|
13
|
+
name = "merge";
|
|
14
|
+
/**
|
|
15
|
+
* Apply merge strategy: Deep merge JSON files with project values taking precedence
|
|
16
|
+
* @param sourcePath - Source JSON file path
|
|
17
|
+
* @param destPath - Destination JSON file path
|
|
18
|
+
* @param relativePath - Relative path for recording
|
|
19
|
+
* @param context - Strategy context with config and callbacks
|
|
20
|
+
* @returns Result of the merge operation
|
|
21
|
+
*/
|
|
14
22
|
async apply(sourcePath, destPath, relativePath, context) {
|
|
15
23
|
const { config, recordFile, backupFile } = context;
|
|
16
24
|
const destExists = await fse.pathExists(destPath);
|
|
@@ -21,23 +29,15 @@ export class MergeStrategy {
|
|
|
21
29
|
await copyFile(sourcePath, destPath);
|
|
22
30
|
recordFile(relativePath, this.name);
|
|
23
31
|
}
|
|
24
|
-
return { relativePath, strategy: this.name, action:
|
|
32
|
+
return { relativePath, strategy: this.name, action: "copied" };
|
|
25
33
|
}
|
|
26
34
|
// Both files exist - merge them
|
|
27
|
-
|
|
28
|
-
let destJson;
|
|
29
|
-
try {
|
|
30
|
-
sourceJson = await readJson(sourcePath);
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
35
|
+
const sourceJson = await readJson(sourcePath).catch(() => {
|
|
33
36
|
throw new JsonMergeError(relativePath, `Failed to parse source: ${sourcePath}`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
destJson = await readJson(destPath);
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
37
|
+
});
|
|
38
|
+
const destJson = await readJson(destPath).catch(() => {
|
|
39
39
|
throw new JsonMergeError(relativePath, `Failed to parse destination: ${destPath}`);
|
|
40
|
-
}
|
|
40
|
+
});
|
|
41
41
|
// Deep merge: Lisa (source) provides defaults, project (dest) values win
|
|
42
42
|
const merged = deepMerge(sourceJson, destJson);
|
|
43
43
|
// Normalize for comparison (parse and re-stringify both)
|
|
@@ -47,14 +47,14 @@ export class MergeStrategy {
|
|
|
47
47
|
if (!config.dryRun) {
|
|
48
48
|
recordFile(relativePath, this.name);
|
|
49
49
|
}
|
|
50
|
-
return { relativePath, strategy: this.name, action:
|
|
50
|
+
return { relativePath, strategy: this.name, action: "skipped" };
|
|
51
51
|
}
|
|
52
52
|
if (!config.dryRun) {
|
|
53
53
|
await backupFile(destPath);
|
|
54
54
|
await writeJson(destPath, merged);
|
|
55
55
|
recordFile(relativePath, this.name);
|
|
56
56
|
}
|
|
57
|
-
return { relativePath, strategy: this.name, action:
|
|
57
|
+
return { relativePath, strategy: this.name, action: "merged" };
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
//# sourceMappingURL=merge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/strategies/merge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IACf,IAAI,GAAG,OAAgB,CAAC;IAEjC,KAAK,CAAC,KAAK,CACT,UAAkB,EAClB,QAAgB,EAChB,Y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,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;QAClE,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAC;YAC3B,MAAM,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAClC,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC;QAED,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IACjE,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strategy.interface.d.ts","sourceRoot":"","sources":["../../src/strategies/strategy.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"strategy.interface.d.ts","sourceRoot":"","sources":["../../src/strategies/strategy.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,yBAAyB;IACzB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAE5B,oCAAoC;IACpC,QAAQ,CAAC,UAAU,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAC;IAE5E,wCAAwC;IACxC,QAAQ,CAAC,UAAU,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7D,yCAAyC;IACzC,QAAQ,CAAC,eAAe,EAAE,CACxB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC,OAAO,CAAC,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAE5B;;;;;;;OAOG;IACH,KAAK,CACH,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACjC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ILogger } from
|
|
1
|
+
import type { ILogger } from "../logging/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Interface for backup service
|
|
4
4
|
*/
|
|
@@ -7,6 +7,8 @@ export interface IBackupService {
|
|
|
7
7
|
init(destDir: string): Promise<void>;
|
|
8
8
|
/** Backup a file before modification */
|
|
9
9
|
backup(absolutePath: string): Promise<void>;
|
|
10
|
+
/** Create persistent timestamped backup in project */
|
|
11
|
+
persistentBackup(absolutePath: string): Promise<void>;
|
|
10
12
|
/** Rollback all changes from backup */
|
|
11
13
|
rollback(): Promise<void>;
|
|
12
14
|
/** Cleanup backup directory (on success) */
|
|
@@ -18,12 +20,23 @@ export interface IBackupService {
|
|
|
18
20
|
export declare class BackupService implements IBackupService {
|
|
19
21
|
private backupDir;
|
|
20
22
|
private destDir;
|
|
23
|
+
private persistentBackupDirname;
|
|
21
24
|
private readonly logger;
|
|
25
|
+
/**
|
|
26
|
+
* Initialize backup service with logger
|
|
27
|
+
* @param logger - Logger instance for backup operations
|
|
28
|
+
*/
|
|
22
29
|
constructor(logger: ILogger);
|
|
23
30
|
init(destDir: string): Promise<void>;
|
|
24
31
|
backup(absolutePath: string): Promise<void>;
|
|
32
|
+
persistentBackup(absolutePath: string): Promise<void>;
|
|
25
33
|
rollback(): Promise<void>;
|
|
26
34
|
cleanup(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Recursively list all files in a directory
|
|
37
|
+
* @param dir - Directory to scan recursively
|
|
38
|
+
* @returns Array of absolute file paths
|
|
39
|
+
*/
|
|
27
40
|
private listFilesRecursive;
|
|
28
41
|
}
|
|
29
42
|
/**
|
|
@@ -32,6 +45,7 @@ export declare class BackupService implements IBackupService {
|
|
|
32
45
|
export declare class DryRunBackupService implements IBackupService {
|
|
33
46
|
init(_destDir: string): Promise<void>;
|
|
34
47
|
backup(_absolutePath: string): Promise<void>;
|
|
48
|
+
persistentBackup(_absolutePath: string): Promise<void>;
|
|
35
49
|
rollback(): Promise<void>;
|
|
36
50
|
cleanup(): Promise<void>;
|
|
37
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backup.d.ts","sourceRoot":"","sources":["../../src/transaction/backup.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"backup.d.ts","sourceRoot":"","sources":["../../src/transaction/backup.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAGnD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErC,wCAAwC;IACxC,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5C,sDAAsD;IACtD,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD,uCAAuC;IACvC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B,4CAA4C;IAC5C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED;;GAEG;AACH,qBAAa,aAAc,YAAW,cAAc;IAClD,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,uBAAuB,CAAuB;IACtD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IAEjC;;;OAGG;gBACS,MAAM,EAAE,OAAO;IAIrB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMpC,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB3C,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiCrD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IA4BzB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAO9B;;;;OAIG;YACW,kBAAkB;CAkBjC;AAED;;GAEG;AACH,qBAAa,mBAAoB,YAAW,cAAc;IAClD,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrC,MAAM,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5C,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAIzB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
|
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
import * as fse from
|
|
2
|
-
import { readdir, mkdtemp } from
|
|
3
|
-
import * as path from
|
|
4
|
-
import * as os from
|
|
5
|
-
import { BackupError, RollbackError } from
|
|
1
|
+
import * as fse from "fs-extra";
|
|
2
|
+
import { readdir, mkdtemp } from "node:fs/promises";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import * as os from "node:os";
|
|
5
|
+
import { BackupError, RollbackError } from "../errors/index.js";
|
|
6
|
+
import { generateBackupDirname } from "../utils/file-operations.js";
|
|
6
7
|
/**
|
|
7
8
|
* Service for backing up and restoring files during operations
|
|
8
9
|
*/
|
|
9
10
|
export class BackupService {
|
|
10
11
|
backupDir = null;
|
|
11
|
-
destDir =
|
|
12
|
+
destDir = "";
|
|
13
|
+
persistentBackupDirname = null;
|
|
12
14
|
logger;
|
|
15
|
+
/**
|
|
16
|
+
* Initialize backup service with logger
|
|
17
|
+
* @param logger - Logger instance for backup operations
|
|
18
|
+
*/
|
|
13
19
|
constructor(logger) {
|
|
14
20
|
this.logger = logger;
|
|
15
21
|
}
|
|
16
22
|
async init(destDir) {
|
|
17
23
|
this.destDir = destDir;
|
|
18
|
-
this.backupDir = await mkdtemp(path.join(os.tmpdir(),
|
|
24
|
+
this.backupDir = await mkdtemp(path.join(os.tmpdir(), "lisa-backup-"));
|
|
19
25
|
this.logger.info(`Backup directory: ${this.backupDir}`);
|
|
20
26
|
}
|
|
21
27
|
async backup(absolutePath) {
|
|
22
28
|
if (!this.backupDir) {
|
|
23
|
-
throw new BackupError(
|
|
29
|
+
throw new BackupError("backup", "Backup service not initialized");
|
|
24
30
|
}
|
|
25
31
|
try {
|
|
26
32
|
if (await fse.pathExists(absolutePath)) {
|
|
@@ -31,14 +37,35 @@ export class BackupService {
|
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
39
|
catch (error) {
|
|
34
|
-
throw new BackupError(
|
|
40
|
+
throw new BackupError("backup", `Failed to backup ${absolutePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async persistentBackup(absolutePath) {
|
|
44
|
+
try {
|
|
45
|
+
if (await fse.pathExists(absolutePath)) {
|
|
46
|
+
// Generate backup directory name on first call
|
|
47
|
+
if (!this.persistentBackupDirname) {
|
|
48
|
+
this.persistentBackupDirname = generateBackupDirname();
|
|
49
|
+
}
|
|
50
|
+
// Get relative path from destination directory
|
|
51
|
+
const relativePath = path.relative(this.destDir, absolutePath);
|
|
52
|
+
// Create backup in .lisabak/{timestamp}/{relative-path}
|
|
53
|
+
const backupBaseDir = path.join(this.destDir, ".lisabak", this.persistentBackupDirname);
|
|
54
|
+
const backupPath = path.join(backupBaseDir, relativePath);
|
|
55
|
+
await fse.ensureDir(path.dirname(backupPath));
|
|
56
|
+
await fse.copy(absolutePath, backupPath);
|
|
57
|
+
this.logger.info(`Backup created: .lisabak/${this.persistentBackupDirname}/${relativePath}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
throw new BackupError("backup", `Failed to create persistent backup of ${absolutePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
35
62
|
}
|
|
36
63
|
}
|
|
37
64
|
async rollback() {
|
|
38
65
|
if (!this.backupDir || !(await fse.pathExists(this.backupDir))) {
|
|
39
|
-
throw new RollbackError(
|
|
66
|
+
throw new RollbackError("No backup directory available");
|
|
40
67
|
}
|
|
41
|
-
this.logger.warn(
|
|
68
|
+
this.logger.warn("Rolling back changes...");
|
|
42
69
|
try {
|
|
43
70
|
// Find all backed up files and restore them
|
|
44
71
|
const files = await this.listFilesRecursive(this.backupDir);
|
|
@@ -49,7 +76,7 @@ export class BackupService {
|
|
|
49
76
|
this.logger.info(`Restored: ${relativePath}`);
|
|
50
77
|
}
|
|
51
78
|
await this.cleanup();
|
|
52
|
-
this.logger.success(
|
|
79
|
+
this.logger.success("Rollback complete");
|
|
53
80
|
}
|
|
54
81
|
catch (error) {
|
|
55
82
|
throw new RollbackError(`Failed to rollback: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -61,6 +88,11 @@ export class BackupService {
|
|
|
61
88
|
this.backupDir = null;
|
|
62
89
|
}
|
|
63
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Recursively list all files in a directory
|
|
93
|
+
* @param dir - Directory to scan recursively
|
|
94
|
+
* @returns Array of absolute file paths
|
|
95
|
+
*/
|
|
64
96
|
async listFilesRecursive(dir) {
|
|
65
97
|
const files = [];
|
|
66
98
|
const entries = await readdir(dir, { withFileTypes: true });
|
|
@@ -87,6 +119,9 @@ export class DryRunBackupService {
|
|
|
87
119
|
async backup(_absolutePath) {
|
|
88
120
|
// No-op
|
|
89
121
|
}
|
|
122
|
+
async persistentBackup(_absolutePath) {
|
|
123
|
+
// No-op
|
|
124
|
+
}
|
|
90
125
|
async rollback() {
|
|
91
126
|
// No-op
|
|
92
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backup.js","sourceRoot":"","sources":["../../src/transaction/backup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"backup.js","sourceRoot":"","sources":["../../src/transaction/backup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAsBpE;;GAEG;AACH,MAAM,OAAO,aAAa;IAChB,SAAS,GAAkB,IAAI,CAAC;IAChC,OAAO,GAAW,EAAE,CAAC;IACrB,uBAAuB,GAAkB,IAAI,CAAC;IACrC,MAAM,CAAU;IAEjC;;;OAGG;IACH,YAAY,MAAe;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAe;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,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,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAE5C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;gBACzD,KAAK,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;YAC1B,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;gBAC1B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAC9B,KAAK,CAAC,IAAI,CAAC,QAAgB;QACzB,QAAQ;IACV,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,aAAqB;QAChC,QAAQ;IACV,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,aAAqB;QAC1C,QAAQ;IACV,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,QAAQ;IACV,CAAC;IAED,KAAK,CAAC,OAAO;QACX,QAAQ;IACV,CAAC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { IBackupService } from
|
|
2
|
-
export { BackupService, DryRunBackupService } from
|
|
3
|
-
export { Transaction, DryRunTransaction } from
|
|
1
|
+
export type { IBackupService } from "./backup.js";
|
|
2
|
+
export { BackupService, DryRunBackupService } from "./backup.js";
|
|
3
|
+
export { Transaction, DryRunTransaction } from "./transaction.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { BackupService, DryRunBackupService } from
|
|
2
|
-
export { Transaction, DryRunTransaction } from
|
|
1
|
+
export { BackupService, DryRunBackupService } from "./backup.js";
|
|
2
|
+
export { Transaction, DryRunTransaction } from "./transaction.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IBackupService } from
|
|
2
|
-
import type { ILogger } from
|
|
1
|
+
import type { IBackupService } from "./backup.js";
|
|
2
|
+
import type { ILogger } from "../logging/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Transaction wrapper for atomic operations
|
|
5
5
|
* Provides init → execute → cleanup/rollback pattern
|
|
@@ -8,18 +8,28 @@ export declare class Transaction {
|
|
|
8
8
|
private readonly backupService;
|
|
9
9
|
private readonly logger;
|
|
10
10
|
private initialized;
|
|
11
|
+
/**
|
|
12
|
+
* Initialize transaction with backup and logging services
|
|
13
|
+
* @param backupService - Service for backup operations
|
|
14
|
+
* @param logger - Logger instance for transaction events
|
|
15
|
+
*/
|
|
11
16
|
constructor(backupService: IBackupService, logger: ILogger);
|
|
12
17
|
/**
|
|
13
18
|
* Initialize the transaction
|
|
19
|
+
* @param destDir - Destination directory to protect during transaction
|
|
14
20
|
*/
|
|
15
21
|
init(destDir: string): Promise<void>;
|
|
16
22
|
/**
|
|
17
23
|
* Execute an operation within the transaction context
|
|
24
|
+
*
|
|
18
25
|
* Automatically rolls back on failure
|
|
26
|
+
* @param operation - Async operation to execute atomically
|
|
27
|
+
* @returns Promise resolving to operation result
|
|
19
28
|
*/
|
|
20
29
|
execute<T>(operation: () => Promise<T>): Promise<T>;
|
|
21
30
|
/**
|
|
22
31
|
* Create a backup of a file within this transaction
|
|
32
|
+
* @param absolutePath - Absolute path to file to backup
|
|
23
33
|
*/
|
|
24
34
|
backup(absolutePath: string): Promise<void>;
|
|
25
35
|
}
|
|
@@ -27,8 +37,21 @@ export declare class Transaction {
|
|
|
27
37
|
* No-op transaction for dry-run mode
|
|
28
38
|
*/
|
|
29
39
|
export declare class DryRunTransaction {
|
|
40
|
+
/**
|
|
41
|
+
* Initialize dry-run transaction (no-op)
|
|
42
|
+
* @param _destDir - Destination directory (unused)
|
|
43
|
+
*/
|
|
30
44
|
init(_destDir: string): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Execute operation without backup/rollback (no-op)
|
|
47
|
+
* @param operation - Operation to execute
|
|
48
|
+
* @returns Promise resolving to operation result
|
|
49
|
+
*/
|
|
31
50
|
execute<T>(operation: () => Promise<T>): Promise<T>;
|
|
51
|
+
/**
|
|
52
|
+
* Backup file (no-op)
|
|
53
|
+
* @param _absolutePath - Absolute path (unused)
|
|
54
|
+
*/
|
|
32
55
|
backup(_absolutePath: string): Promise<void>;
|
|
33
56
|
}
|
|
34
57
|
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/transaction/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;GAGG;AACH,qBAAa,WAAW;
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/transaction/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;GAGG;AACH,qBAAa,WAAW;IASpB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM;IATzB,OAAO,CAAC,WAAW,CAAS;IAE5B;;;;OAIG;gBAEgB,aAAa,EAAE,cAAc,EAC7B,MAAM,EAAE,OAAO;IAGlC;;;OAGG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1C;;;;;;OAMG;IACG,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IA0BzD;;;OAGG;IACG,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMlD;AAED;;GAEG;AACH,qBAAa,iBAAiB;IAC5B;;;OAGG;IACG,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3C;;;;OAIG;IACG,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAIzD;;;OAGG;IACG,MAAM,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnD"}
|
|
@@ -6,12 +6,18 @@ export class Transaction {
|
|
|
6
6
|
backupService;
|
|
7
7
|
logger;
|
|
8
8
|
initialized = false;
|
|
9
|
+
/**
|
|
10
|
+
* Initialize transaction with backup and logging services
|
|
11
|
+
* @param backupService - Service for backup operations
|
|
12
|
+
* @param logger - Logger instance for transaction events
|
|
13
|
+
*/
|
|
9
14
|
constructor(backupService, logger) {
|
|
10
15
|
this.backupService = backupService;
|
|
11
16
|
this.logger = logger;
|
|
12
17
|
}
|
|
13
18
|
/**
|
|
14
19
|
* Initialize the transaction
|
|
20
|
+
* @param destDir - Destination directory to protect during transaction
|
|
15
21
|
*/
|
|
16
22
|
async init(destDir) {
|
|
17
23
|
await this.backupService.init(destDir);
|
|
@@ -19,11 +25,14 @@ export class Transaction {
|
|
|
19
25
|
}
|
|
20
26
|
/**
|
|
21
27
|
* Execute an operation within the transaction context
|
|
28
|
+
*
|
|
22
29
|
* Automatically rolls back on failure
|
|
30
|
+
* @param operation - Async operation to execute atomically
|
|
31
|
+
* @returns Promise resolving to operation result
|
|
23
32
|
*/
|
|
24
33
|
async execute(operation) {
|
|
25
34
|
if (!this.initialized) {
|
|
26
|
-
throw new Error(
|
|
35
|
+
throw new Error("Transaction not initialized");
|
|
27
36
|
}
|
|
28
37
|
try {
|
|
29
38
|
const result = await operation();
|
|
@@ -43,10 +52,11 @@ export class Transaction {
|
|
|
43
52
|
}
|
|
44
53
|
/**
|
|
45
54
|
* Create a backup of a file within this transaction
|
|
55
|
+
* @param absolutePath - Absolute path to file to backup
|
|
46
56
|
*/
|
|
47
57
|
async backup(absolutePath) {
|
|
48
58
|
if (!this.initialized) {
|
|
49
|
-
throw new Error(
|
|
59
|
+
throw new Error("Transaction not initialized");
|
|
50
60
|
}
|
|
51
61
|
await this.backupService.backup(absolutePath);
|
|
52
62
|
}
|
|
@@ -55,12 +65,25 @@ export class Transaction {
|
|
|
55
65
|
* No-op transaction for dry-run mode
|
|
56
66
|
*/
|
|
57
67
|
export class DryRunTransaction {
|
|
68
|
+
/**
|
|
69
|
+
* Initialize dry-run transaction (no-op)
|
|
70
|
+
* @param _destDir - Destination directory (unused)
|
|
71
|
+
*/
|
|
58
72
|
async init(_destDir) {
|
|
59
73
|
// No-op
|
|
60
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Execute operation without backup/rollback (no-op)
|
|
77
|
+
* @param operation - Operation to execute
|
|
78
|
+
* @returns Promise resolving to operation result
|
|
79
|
+
*/
|
|
61
80
|
async execute(operation) {
|
|
62
81
|
return operation();
|
|
63
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Backup file (no-op)
|
|
85
|
+
* @param _absolutePath - Absolute path (unused)
|
|
86
|
+
*/
|
|
64
87
|
async backup(_absolutePath) {
|
|
65
88
|
// No-op
|
|
66
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/transaction/transaction.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,OAAO,WAAW;
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/transaction/transaction.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,OAAO,WAAW;IASH;IACA;IATX,WAAW,GAAG,KAAK,CAAC;IAE5B;;;;OAIG;IACH,YACmB,aAA6B,EAC7B,MAAe;QADf,kBAAa,GAAb,aAAa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AAC;QACD,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAC5B;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,QAAgB;QACzB,QAAQ;IACV,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAI,SAA2B;QAC1C,OAAO,SAAS,EAAE,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,aAAqB;QAChC,QAAQ;IACV,CAAC;CACF"}
|
|
@@ -1,29 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Check if two files have identical content
|
|
3
|
+
* @param path1 First file path
|
|
4
|
+
* @param path2 Second file path
|
|
5
|
+
* @returns True if files have identical content
|
|
3
6
|
*/
|
|
4
7
|
export declare function filesIdentical(path1: string, path2: string): Promise<boolean>;
|
|
5
8
|
/**
|
|
6
9
|
* Ensure the parent directory of a file exists
|
|
10
|
+
* @param filePath Path to ensure parent exists for
|
|
7
11
|
*/
|
|
8
12
|
export declare function ensureParentDir(filePath: string): Promise<void>;
|
|
9
13
|
/**
|
|
10
14
|
* Read file as UTF-8 string, returning null if file doesn't exist
|
|
15
|
+
* @param filePath Path to file to read
|
|
16
|
+
* @returns File contents or null if file doesn't exist
|
|
11
17
|
*/
|
|
12
18
|
export declare function readFileOrNull(filePath: string): Promise<string | null>;
|
|
13
19
|
/**
|
|
14
20
|
* Check if a path exists
|
|
21
|
+
* @param filePath Path to check
|
|
22
|
+
* @returns True if path exists
|
|
15
23
|
*/
|
|
16
24
|
export declare function pathExists(filePath: string): Promise<boolean>;
|
|
17
25
|
/**
|
|
18
26
|
* Check if a path is a file
|
|
27
|
+
* @param filePath Path to check
|
|
28
|
+
* @returns True if path is a file
|
|
19
29
|
*/
|
|
20
30
|
export declare function isFile(filePath: string): Promise<boolean>;
|
|
21
31
|
/**
|
|
22
32
|
* Check if a path is a directory
|
|
33
|
+
* @param filePath Path to check
|
|
34
|
+
* @returns True if path is a directory
|
|
23
35
|
*/
|
|
24
36
|
export declare function isDirectory(filePath: string): Promise<boolean>;
|
|
25
37
|
/**
|
|
26
38
|
* List all files in a directory recursively
|
|
39
|
+
* @param dir Directory to walk
|
|
40
|
+
* @returns Array of file paths
|
|
27
41
|
*/
|
|
28
42
|
export declare function listFilesRecursive(dir: string): Promise<string[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Generate timestamped backup directory name with date and time
|
|
45
|
+
* Format: <YYYY-MM-DD>-<HHmmss>
|
|
46
|
+
* Example: 2026-01-19-143056
|
|
47
|
+
* @returns Timestamped backup directory name
|
|
48
|
+
*/
|
|
49
|
+
export declare function generateBackupDirname(): string;
|
|
29
50
|
//# sourceMappingURL=file-operations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-operations.d.ts","sourceRoot":"","sources":["../../src/utils/file-operations.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"file-operations.d.ts","sourceRoot":"","sources":["../../src/utils/file-operations.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,OAAO,CAAC,CAUlB;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAErE;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAM7E;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEnE;AAED;;;;GAIG;AACH,wBAAsB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO/D;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOpE;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA8BvE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAO9C"}
|