@openagt/skill-branches 0.1.4 → 0.1.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/dist/command-link.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ import { type GitRunner } from '@openagt/agent-data';
|
|
|
14
14
|
* The package is linked only beside its own commands. Beside another tool that holds a command's
|
|
15
15
|
* name in the project, the full name would run that tool, so there it is left to npm.
|
|
16
16
|
*
|
|
17
|
-
* Hidden from the project's git through the repository's exclude file
|
|
18
|
-
*
|
|
17
|
+
* Hidden from the project's git through the repository's exclude file: a link is the package's
|
|
18
|
+
* state, not the agent's work, and `node_modules` is never a person's. Best-effort: an entry already there (the project's
|
|
19
19
|
* own copy) is left alone, a link of this package's that points nowhere is made again, and a link
|
|
20
20
|
* that cannot be made is a worse run, not a failed one.
|
|
21
21
|
*/
|
package/dist/skill-links.d.ts
CHANGED
|
@@ -37,11 +37,11 @@ export interface SkillLink {
|
|
|
37
37
|
export declare const OWN_SKILL: SkillLink;
|
|
38
38
|
/**
|
|
39
39
|
* Link the skill into `checkout` for every harness — this package's own, plus whatever `skills`
|
|
40
|
-
* the caller names (see {@link SkillLink}) — and hide the links from the project's git
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
40
|
+
* the caller names (see {@link SkillLink}) — and hide the links from the project's git (see
|
|
41
|
+
* {@link hideLink}): a symlink at the checkout root would otherwise ride any sweeping `git add -A`
|
|
42
|
+
* onto the agent's branch. Best-effort: an entry already at a link's path is left alone and is not
|
|
43
|
+
* hidden, a link of this package's that points nowhere is made again, and a link that cannot be
|
|
44
|
+
* made is a worse run, not a failed one.
|
|
45
45
|
*/
|
|
46
46
|
export declare function linkSkill(repo: string, checkout: string, fs?: LinkFs, git?: GitRunner, skills?: readonly SkillLink[]): Promise<void>;
|
|
47
47
|
/** The paths of a skill's links, relative to a checkout: its text for every harness, and its package's links when it has one. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-links.d.ts","sourceRoot":"","sources":["../src/skill-links.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skill-links.d.ts","sourceRoot":"","sources":["../src/skill-links.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,SAAS,EAAkB,MAAM,qBAAqB,CAAA;AACnF,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAA8C,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEhG;;;;;;;;GAQG;AAEH,6GAA6G;AAC7G,eAAO,MAAM,UAAU,aAAa,CAAA;AAEpC,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,YAAI,gBAAgB,EAAE,gBAAgB,CAAU,CAAA;AAE/E;;;GAGG;AACH,eAAO,MAAM,SAAS,QAAsD,CAAA;AAE5E;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,uIAAuI;IACvI,OAAO,CAAC,EAAE,WAAW,CAAA;CACtB;AAED,wDAAwD;AACxD,eAAO,MAAM,SAAS,EAAE,SAAgD,CAAA;AAExE;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,EAAE,GAAE,MAAqB,EACzB,GAAG,GAAE,SAA2B,EAChC,MAAM,GAAE,SAAS,SAAS,EAAO,GAChC,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED,iIAAiI;AACjI,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,EAAE,CAEzD"}
|
package/dist/skill-links.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
1
2
|
import { dirname, join } from 'node:path';
|
|
2
3
|
import { fileURLToPath } from 'node:url';
|
|
3
4
|
import { nodeGitRunner, excludeFromGit } from '@openagt/agent-data';
|
|
@@ -25,11 +26,11 @@ export const SKILL_DIR = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
|
25
26
|
export const OWN_SKILL = { name: SKILL_NAME, dir: SKILL_DIR };
|
|
26
27
|
/**
|
|
27
28
|
* Link the skill into `checkout` for every harness — this package's own, plus whatever `skills`
|
|
28
|
-
* the caller names (see {@link SkillLink}) — and hide the links from the project's git
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
29
|
+
* the caller names (see {@link SkillLink}) — and hide the links from the project's git (see
|
|
30
|
+
* {@link hideLink}): a symlink at the checkout root would otherwise ride any sweeping `git add -A`
|
|
31
|
+
* onto the agent's branch. Best-effort: an entry already at a link's path is left alone and is not
|
|
32
|
+
* hidden, a link of this package's that points nowhere is made again, and a link that cannot be
|
|
33
|
+
* made is a worse run, not a failed one.
|
|
33
34
|
*/
|
|
34
35
|
export async function linkSkill(repo, checkout, fs = nodeLinkFs(), git = nodeGitRunner(), skills = []) {
|
|
35
36
|
for (const skill of [OWN_SKILL, ...skills]) {
|
|
@@ -37,11 +38,11 @@ export async function linkSkill(repo, checkout, fs = nodeLinkFs(), git = nodeGit
|
|
|
37
38
|
const rel = `${dir}/${skill.name}`;
|
|
38
39
|
try {
|
|
39
40
|
const path = join(checkout, rel);
|
|
40
|
-
// The project's own copy, tracked or not, stays, and
|
|
41
|
+
// The project's own copy, tracked or not, stays, and is not hidden: that would hide what a person adds there.
|
|
41
42
|
if (await entryExists(path))
|
|
42
43
|
continue;
|
|
43
|
-
await excludeFromGit(repo, `/${rel}`, undefined, git).catch(() => { });
|
|
44
44
|
await fs.mkdir(join(checkout, dir));
|
|
45
|
+
await hideLink(repo, checkout, dir, skill.name, git).catch(() => { });
|
|
45
46
|
await fs.symlinkDir(skill.dir, path);
|
|
46
47
|
}
|
|
47
48
|
catch {
|
|
@@ -56,4 +57,24 @@ export async function linkSkill(repo, checkout, fs = nodeLinkFs(), git = nodeGit
|
|
|
56
57
|
export function skillLinkPaths(skill) {
|
|
57
58
|
return [...HARNESS_SKILL_DIRS.map(dir => `${dir}/${skill.name}`), ...(skill.package ? packageLinkPaths(skill.package) : [])];
|
|
58
59
|
}
|
|
60
|
+
/** The file a skill's link is hidden by, in the folder the link is in. */
|
|
61
|
+
const IGNORE_FILE = '.gitignore';
|
|
62
|
+
/**
|
|
63
|
+
* Hide the link `<dir>/<name>` by a line in `<dir>/.gitignore` of the agent's checkout, a file that
|
|
64
|
+
* names itself too, so it is hidden as well. The file is in that checkout only: a person who adds a
|
|
65
|
+
* skill of the same name in their own checkout sees it in git, where a rule in the repository's
|
|
66
|
+
* exclude file, read by every checkout of it, hid it from them too. A project that tracks its own
|
|
67
|
+
* `<dir>/.gitignore` gets no line in it, which would be work for the agent to commit: there the
|
|
68
|
+
* link is hidden by the repository's exclude file.
|
|
69
|
+
*/
|
|
70
|
+
async function hideLink(repo, checkout, dir, name, git) {
|
|
71
|
+
const tracked = (await git(['ls-files', '--', `${dir}/${IGNORE_FILE}`], checkout)).trim() !== '';
|
|
72
|
+
if (tracked)
|
|
73
|
+
return excludeFromGit(repo, `/${dir}/${name}`, undefined, git);
|
|
74
|
+
const file = join(checkout, dir, IGNORE_FILE);
|
|
75
|
+
const current = await readFile(file, 'utf8').catch(() => `/${IGNORE_FILE}\n`);
|
|
76
|
+
if (current.split('\n').includes(`/${name}`))
|
|
77
|
+
return;
|
|
78
|
+
await writeFile(file, (current.endsWith('\n') ? current : `${current}\n`) + `/${name}\n`);
|
|
79
|
+
}
|
|
59
80
|
//# sourceMappingURL=skill-links.js.map
|
package/dist/skill-links.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-links.js","sourceRoot":"","sources":["../src/skill-links.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAA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AE,CAAA;IAChG,IAAI,OAAO;QAAE,OAAO,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,CAAA;IAC3E,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,WAAW,CAAC,CAAA;IAC7C,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,WAAW,IAAI,CAAC,CAAA;IAC7E,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;QAAE,OAAM;IACpD,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,CAAA;AAC3F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openagt/skill-branches",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Branch management for coding agents: one git checkout per agent under .branches/, named as its branch, reclaimed once its work is on the remote.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|