@tenonhq/dovetail-core 0.0.124 → 0.0.126
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 +8 -2
- package/dist/MultiScopeWatcher.js +89 -0
- package/dist/allScopesCommands.js +12 -3
- package/dist/appUtils.js +12 -2
- package/dist/claudeSession.js +50 -5
- package/dist/commander.js +113 -5
- package/dist/createRecordCommand.js +23 -2
- package/dist/envArg.js +64 -15
- package/dist/gitHead.js +36 -0
- package/dist/pullRecord.js +684 -0
- package/dist/pullRecordCommand.js +161 -0
- package/dist/reconcileCommand.js +2 -0
- package/dist/snClient.js +78 -3
- package/dist/tests/claudeSession.test.js +22 -0
- package/dist/tests/commanderStrict.test.js +68 -0
- package/dist/tests/createRecordUpdateSet.test.js +40 -0
- package/dist/tests/dovetailUtilsMSTableOptions.test.js +109 -2
- package/dist/tests/envArg.test.js +90 -7
- package/dist/tests/gitHead.test.js +65 -0
- package/dist/tests/multi-scope-watcher.test.js +77 -0
- package/dist/tests/pullRecord.test.js +690 -0
- package/dist/tests/reconcileCreateGuard.test.js +60 -0
- package/dist/tests/snClient.createRecordGuards.test.js +35 -0
- package/dist/tests/snClient.getScopeId.test.js +67 -0
- package/dist/tests/switchUpdateSetSysId.test.js +83 -0
- package/dist/tests/watchClaudeGuard.test.js +132 -0
- package/dist/updateSetCommands.js +19 -2
- package/package.json +1 -1
- package/release-manifest.json +356 -308
- package/skills/dove-setup-project.md +1 -1
- package/skills/dove-troubleshoot-sync.md +1 -1
package/dist/gitHead.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readGitHead = readGitHead;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
// A full object id: SHA-1 (40 hex) or SHA-256 (64 hex) repositories.
|
|
6
|
+
var OBJECT_ID_PATTERN = /^[0-9a-f]{40}([0-9a-f]{24})?$/i;
|
|
7
|
+
/**
|
|
8
|
+
* @description Resolves the commit HEAD points at for the git work tree that
|
|
9
|
+
* contains `dir` (`git rev-parse HEAD`, so linked worktrees and submodules
|
|
10
|
+
* resolve correctly). Never throws: resolves `null` when `dir` is not inside a
|
|
11
|
+
* git work tree, the repo has no commits yet, git is not installed, or the
|
|
12
|
+
* output is not an object id.
|
|
13
|
+
* @param {string} dir - Any directory inside the work tree.
|
|
14
|
+
* @returns {Promise<string | null>} The HEAD commit id, or null when unknown.
|
|
15
|
+
*/
|
|
16
|
+
function readGitHead(dir) {
|
|
17
|
+
return new Promise(function (resolve) {
|
|
18
|
+
if (typeof dir !== "string" || dir.trim() === "") {
|
|
19
|
+
resolve(null);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
(0, child_process_1.execFile)("git", ["rev-parse", "HEAD"], { cwd: dir, timeout: 5000, windowsHide: true }, function (error, stdout) {
|
|
24
|
+
if (error) {
|
|
25
|
+
resolve(null);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
var head = String(stdout || "").trim();
|
|
29
|
+
resolve(OBJECT_ID_PATTERN.test(head) ? head : null);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
resolve(null);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|