@chief-clancy/terminal 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/installer/brief-content/brief-content.d.ts +62 -0
- package/dist/installer/brief-content/brief-content.d.ts.map +1 -0
- package/dist/installer/brief-content/brief-content.js +95 -0
- package/dist/installer/brief-content/brief-content.js.map +1 -0
- package/dist/installer/brief-content/index.d.ts +2 -0
- package/dist/installer/brief-content/index.d.ts.map +1 -0
- package/dist/installer/brief-content/index.js +2 -0
- package/dist/installer/brief-content/index.js.map +1 -0
- package/dist/installer/install/install.d.ts +8 -7
- package/dist/installer/install/install.d.ts.map +1 -1
- package/dist/installer/install/install.js +17 -18
- package/dist/installer/install/install.js.map +1 -1
- package/dist/installer/plan-content/index.d.ts +2 -0
- package/dist/installer/plan-content/index.d.ts.map +1 -0
- package/dist/installer/plan-content/index.js +2 -0
- package/dist/installer/plan-content/index.js.map +1 -0
- package/dist/installer/plan-content/plan-content.d.ts +55 -0
- package/dist/installer/plan-content/plan-content.d.ts.map +1 -0
- package/dist/installer/plan-content/plan-content.js +87 -0
- package/dist/installer/plan-content/plan-content.js.map +1 -0
- package/dist/installer/shared/fs-guards/fs-guards.d.ts +4 -0
- package/dist/installer/shared/fs-guards/fs-guards.d.ts.map +1 -1
- package/dist/installer/shared/fs-guards/fs-guards.js +13 -0
- package/dist/installer/shared/fs-guards/fs-guards.js.map +1 -1
- package/dist/installer/shared/fs-guards/index.d.ts +1 -1
- package/dist/installer/shared/fs-guards/index.d.ts.map +1 -1
- package/dist/installer/shared/fs-guards/index.js +1 -1
- package/dist/installer/shared/fs-guards/index.js.map +1 -1
- package/package.json +1 -1
- package/src/roles/planner/commands/plan.md +0 -22
- package/src/roles/planner/workflows/plan.md +0 -868
- package/src/roles/strategist/commands/brief.md +0 -29
- package/src/roles/strategist/workflows/brief.md +0 -1330
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** File system operations for brief content copying. */
|
|
2
|
+
type BriefCopyFs = {
|
|
3
|
+
readonly mkdir: (path: string) => void;
|
|
4
|
+
readonly copyFile: (src: string, dest: string) => void;
|
|
5
|
+
};
|
|
6
|
+
type CopyBriefContentOptions = {
|
|
7
|
+
readonly briefCommandsDir: string;
|
|
8
|
+
readonly briefWorkflowsDir: string;
|
|
9
|
+
readonly briefAgentsDir: string;
|
|
10
|
+
readonly commandsDest: string;
|
|
11
|
+
readonly workflowsDest: string;
|
|
12
|
+
readonly agentsDest: string;
|
|
13
|
+
readonly fs: BriefCopyFs;
|
|
14
|
+
};
|
|
15
|
+
type BriefCleanFs = {
|
|
16
|
+
readonly unlink: (path: string) => void;
|
|
17
|
+
};
|
|
18
|
+
type CleanBriefContentOptions = {
|
|
19
|
+
readonly commandsDest: string;
|
|
20
|
+
readonly workflowsDest: string;
|
|
21
|
+
readonly agentsDest: string;
|
|
22
|
+
readonly fs: BriefCleanFs;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Copy brief command, workflow, and agent files to the install destination.
|
|
26
|
+
*
|
|
27
|
+
* Validates that all source directories exist before copying. Creates the
|
|
28
|
+
* agents destination directory if needed.
|
|
29
|
+
*/
|
|
30
|
+
export declare const copyBriefContent: (options: CopyBriefContentOptions) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Remove brief files from a prior installation.
|
|
33
|
+
*
|
|
34
|
+
* Called when the strategist role is disabled to prevent orphaned files.
|
|
35
|
+
* Best-effort — silently ignores missing files.
|
|
36
|
+
*/
|
|
37
|
+
export declare const cleanBriefContent: (options: CleanBriefContentOptions) => void;
|
|
38
|
+
type BriefSources = {
|
|
39
|
+
readonly briefCommandsDir?: string;
|
|
40
|
+
readonly briefWorkflowsDir?: string;
|
|
41
|
+
readonly briefAgentsDir?: string;
|
|
42
|
+
};
|
|
43
|
+
type BriefDests = {
|
|
44
|
+
readonly commandsDest: string;
|
|
45
|
+
readonly workflowsDest: string;
|
|
46
|
+
readonly agentsDest: string;
|
|
47
|
+
};
|
|
48
|
+
type HandleBriefContentOptions = {
|
|
49
|
+
readonly sources: BriefSources;
|
|
50
|
+
readonly dests: BriefDests;
|
|
51
|
+
readonly enabledRoles: ReadonlySet<string> | null;
|
|
52
|
+
readonly fs: BriefCopyFs & BriefCleanFs;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Install or clean brief content based on available sources and role state.
|
|
56
|
+
*
|
|
57
|
+
* No-op when brief source dirs are absent (direct terminal usage).
|
|
58
|
+
* When present: copies files if strategist is enabled, cleans orphans if disabled.
|
|
59
|
+
*/
|
|
60
|
+
export declare const handleBriefContent: (options: HandleBriefContentOptions) => void;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=brief-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brief-content.d.ts","sourceRoot":"","sources":["../../../src/installer/brief-content/brief-content.ts"],"names":[],"mappings":"AAgBA,wDAAwD;AACxD,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACxD,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,M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the install destination.
|
|
4
|
+
*
|
|
5
|
+
* Separate from the role-filter system because brief is a standalone
|
|
6
|
+
* package, not a terminal role directory.
|
|
7
|
+
*/
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
import { hasErrorCode } from '../../installer/shared/fs-errors/index.js';
|
|
10
|
+
import { rejectSymlink } from '../../installer/shared/fs-guards/index.js';
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Constants
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
const BRIEF_COMMAND = 'brief.md';
|
|
15
|
+
const BRIEF_WORKFLOW = 'brief.md';
|
|
16
|
+
const BRIEF_AGENT = 'devils-advocate.md';
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Helpers
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
/** Copy a single file with symlink protection. */
|
|
21
|
+
const copyChecked = (src, dest, fs) => {
|
|
22
|
+
rejectSymlink(dest);
|
|
23
|
+
fs.copyFile(src, dest);
|
|
24
|
+
};
|
|
25
|
+
/** Remove a file, ignoring ENOENT. Rethrows other errors. */
|
|
26
|
+
const unlinkSafe = (path, fs) => {
|
|
27
|
+
try {
|
|
28
|
+
fs.unlink(path);
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
if (!hasErrorCode(err, 'ENOENT'))
|
|
32
|
+
throw err;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
// Public API
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
/**
|
|
39
|
+
* Copy brief command, workflow, and agent files to the install destination.
|
|
40
|
+
*
|
|
41
|
+
* Validates that all source directories exist before copying. Creates the
|
|
42
|
+
* agents destination directory if needed.
|
|
43
|
+
*/
|
|
44
|
+
export const copyBriefContent = (options) => {
|
|
45
|
+
const { briefCommandsDir, briefWorkflowsDir, briefAgentsDir, fs } = options;
|
|
46
|
+
const { commandsDest, workflowsDest, agentsDest } = options;
|
|
47
|
+
rejectSymlink(commandsDest);
|
|
48
|
+
rejectSymlink(workflowsDest);
|
|
49
|
+
rejectSymlink(agentsDest);
|
|
50
|
+
fs.mkdir(agentsDest);
|
|
51
|
+
copyChecked(join(briefCommandsDir, BRIEF_COMMAND), join(commandsDest, BRIEF_COMMAND), fs);
|
|
52
|
+
copyChecked(join(briefWorkflowsDir, BRIEF_WORKFLOW), join(workflowsDest, BRIEF_WORKFLOW), fs);
|
|
53
|
+
copyChecked(join(briefAgentsDir, BRIEF_AGENT), join(agentsDest, BRIEF_AGENT), fs);
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Remove brief files from a prior installation.
|
|
57
|
+
*
|
|
58
|
+
* Called when the strategist role is disabled to prevent orphaned files.
|
|
59
|
+
* Best-effort — silently ignores missing files.
|
|
60
|
+
*/
|
|
61
|
+
export const cleanBriefContent = (options) => {
|
|
62
|
+
const { commandsDest, workflowsDest, agentsDest, fs } = options;
|
|
63
|
+
rejectSymlink(commandsDest);
|
|
64
|
+
rejectSymlink(workflowsDest);
|
|
65
|
+
rejectSymlink(agentsDest);
|
|
66
|
+
unlinkSafe(join(commandsDest, BRIEF_COMMAND), fs);
|
|
67
|
+
unlinkSafe(join(workflowsDest, BRIEF_WORKFLOW), fs);
|
|
68
|
+
unlinkSafe(join(agentsDest, BRIEF_AGENT), fs);
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Install or clean brief content based on available sources and role state.
|
|
72
|
+
*
|
|
73
|
+
* No-op when brief source dirs are absent (direct terminal usage).
|
|
74
|
+
* When present: copies files if strategist is enabled, cleans orphans if disabled.
|
|
75
|
+
*/
|
|
76
|
+
export const handleBriefContent = (options) => {
|
|
77
|
+
const { sources, dests, enabledRoles, fs } = options;
|
|
78
|
+
const { briefCommandsDir, briefWorkflowsDir, briefAgentsDir } = sources;
|
|
79
|
+
if (!briefCommandsDir || !briefWorkflowsDir || !briefAgentsDir)
|
|
80
|
+
return;
|
|
81
|
+
const enabled = enabledRoles === null || enabledRoles.has('strategist');
|
|
82
|
+
if (enabled) {
|
|
83
|
+
copyBriefContent({
|
|
84
|
+
briefCommandsDir,
|
|
85
|
+
briefWorkflowsDir,
|
|
86
|
+
briefAgentsDir,
|
|
87
|
+
...dests,
|
|
88
|
+
fs,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
cleanBriefContent({ ...dests, fs });
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=brief-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brief-content.js","sourceRoot":"","sources":["../../../src/installer/brief-content/brief-content.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAiCxE,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,MAAM,aAAa,GAAG,UAAU,CAAC;AACjC,MAAM,cAAc,GAAG,UAAU,CAAC;AAClC,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAEzC,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,kDAAkD;AAClD,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,IAAY,EAAE,EAAe,EAAQ,EAAE;IACvE,aAAa,CAAC,IAAI,CAAC,CAAC;IACpB,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACzB,CAAC,CAAC;AAEF,6DAA6D;AAC7D,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAgB,EAAQ,EAAE;IAC1D,IAAI,CAAC;QACH,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,IAAI,CAAC,Y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,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC;IAClD,UAAU,CAAC,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,EAAE,EAAE,CAAC,CAAC;IACpD,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;AAChD,CAAC,CAAC;AAqBF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,OAAkC,EAC5B,EAAE;IACR,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC;IACrD,MAAM,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAExE,IAAI,CAAC,gBAAgB,IAAI,CAAC,iBAAiB,IAAI,CAAC,cAAc;QAAE,OAAO;IAEvE,MAAM,OAAO,GAAG,YAAY,KAAK,IAAI,IAAI,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAExE,IAAI,OAAO,EAAE,CAAC;QACZ,gBAAgB,CAAC;YACf,gBAAgB;YAChB,iBAAiB;YACjB,cAAc;YACd,GAAG,KAAK;YACR,EAAE;SACH,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,iBAAiB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IACtC,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/installer/brief-content/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/installer/brief-content/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -14,11 +14,17 @@ type InstallSources = {
|
|
|
14
14
|
readonly hooksDir: string;
|
|
15
15
|
readonly bundleDir: string;
|
|
16
16
|
readonly agentsDir: string;
|
|
17
|
+
readonly briefCommandsDir?: string;
|
|
18
|
+
readonly briefWorkflowsDir?: string;
|
|
19
|
+
readonly briefAgentsDir?: string;
|
|
20
|
+
readonly planCommandsDir?: string;
|
|
21
|
+
readonly planWorkflowsDir?: string;
|
|
17
22
|
};
|
|
18
23
|
/** All resolved destination paths for an installation. */
|
|
19
24
|
export type InstallPaths = {
|
|
20
25
|
readonly commandsDest: string;
|
|
21
26
|
readonly workflowsDest: string;
|
|
27
|
+
readonly agentsDest: string;
|
|
22
28
|
readonly claudeConfigDir: string;
|
|
23
29
|
readonly manifestPath: string;
|
|
24
30
|
readonly workflowsManifestPath: string;
|
|
@@ -38,15 +44,11 @@ type InstallerFs = {
|
|
|
38
44
|
/** Create a directory recursively (must not throw on existing dirs). */
|
|
39
45
|
readonly mkdir: (path: string) => void;
|
|
40
46
|
readonly copyFile: (src: string, dest: string) => void;
|
|
47
|
+
/** Remove a file. May throw on missing files — callers handle ENOENT. */
|
|
48
|
+
readonly unlink: (path: string) => void;
|
|
41
49
|
/** Throw if the given path is a symlink. Swallow ENOENT. */
|
|
42
50
|
readonly rejectSymlink: (path: string) => void;
|
|
43
51
|
};
|
|
44
|
-
/**
|
|
45
|
-
* Prompt API used by the orchestrator.
|
|
46
|
-
*
|
|
47
|
-
* Only `ask` is called by {@link runInstall}. The caller owns the prompt
|
|
48
|
-
* lifecycle — create before calling `runInstall`, close after it returns.
|
|
49
|
-
*/
|
|
50
52
|
type InstallerPrompts = {
|
|
51
53
|
readonly ask: (label: string) => Promise<string>;
|
|
52
54
|
};
|
|
@@ -106,7 +108,6 @@ export declare function parseEnabledRoles(projectRoot: string, fs: EnvFileSystem
|
|
|
106
108
|
*
|
|
107
109
|
* @param sources - The source directories to check.
|
|
108
110
|
* @param exists - File existence check (injected for testability).
|
|
109
|
-
* @returns Nothing — throws on the first missing path.
|
|
110
111
|
*/
|
|
111
112
|
export declare function validateSources(sources: InstallSources, exists: (path: string) => boolean): void;
|
|
112
113
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/installer/install/install.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/installer/install/install.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AA2BxD,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE7C,iDAAiD;AACjD,KAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,0DAA0D;AAC1D,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,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AAC,OAAO,EAAE,gBAAgB,CAAC;IACnC,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CAC7B,CAAC;AAYF;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,WAAW,GAAG,IAAI,CAK5E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,GACV,YAAY,CAcd;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,EAAE,EAAE,aAAa,GAChB,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAa5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAChC,IAAI,CAwBN;AAkMD;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8B1E"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { dirname, join } from 'node:path';
|
|
2
|
+
import { handleBriefContent } from '../../installer/brief-content/index.js';
|
|
2
3
|
import { inlineWorkflows } from '../../installer/file-ops/file-ops.js';
|
|
3
4
|
import { installHooks } from '../../installer/hook-installer/hook-installer.js';
|
|
4
5
|
import { backupModifiedFiles, buildManifest, detectModifiedFiles, } from '../../installer/manifest/manifest.js';
|
|
6
|
+
import { handlePlanContent } from '../../installer/plan-content/index.js';
|
|
5
7
|
import { copyRoleFiles } from '../../installer/role-filter/role-filter.js';
|
|
8
|
+
import { requirePath, validateOptionalDirs, } from '../../installer/shared/fs-guards/index.js';
|
|
6
9
|
import { printSuccess } from '../../installer/ui/ui.js';
|
|
7
10
|
import { blue, dim, green } from '../../shared/ansi/index.js';
|
|
8
11
|
import { loadClancyEnv } from '@chief-clancy/core';
|
|
9
12
|
// ---------------------------------------------------------------------------
|
|
10
13
|
// Constants
|
|
11
14
|
// ---------------------------------------------------------------------------
|
|
12
|
-
/** Bundled runtime scripts that are copied to `.clancy/` in the project. */
|
|
13
15
|
const BUNDLE_SCRIPTS = ['clancy-implement.js', 'clancy-autopilot.js'];
|
|
14
16
|
// ---------------------------------------------------------------------------
|
|
15
17
|
// Pure functions
|
|
@@ -47,6 +49,7 @@ export function resolveInstallPaths(mode, homeDir, cwd) {
|
|
|
47
49
|
return {
|
|
48
50
|
commandsDest: join(baseDir, 'commands', 'clancy'),
|
|
49
51
|
workflowsDest: join(baseDir, 'clancy', 'workflows'),
|
|
52
|
+
agentsDest: join(baseDir, 'clancy', 'agents'),
|
|
50
53
|
claudeConfigDir: baseDir,
|
|
51
54
|
manifestPath: join(baseDir, 'clancy', 'manifest.json'),
|
|
52
55
|
workflowsManifestPath: join(baseDir, 'clancy', 'workflows-manifest.json'),
|
|
@@ -78,12 +81,6 @@ export function parseEnabledRoles(projectRoot, fs) {
|
|
|
78
81
|
.filter(Boolean);
|
|
79
82
|
return new Set(normalised);
|
|
80
83
|
}
|
|
81
|
-
/** Throw if a required path does not exist. */
|
|
82
|
-
function requirePath(label, path, exists) {
|
|
83
|
-
if (!exists(path)) {
|
|
84
|
-
throw new Error(`${label} not found: ${path}`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
84
|
/**
|
|
88
85
|
* Validate that all required source directories and files exist.
|
|
89
86
|
*
|
|
@@ -93,7 +90,6 @@ function requirePath(label, path, exists) {
|
|
|
93
90
|
*
|
|
94
91
|
* @param sources - The source directories to check.
|
|
95
92
|
* @param exists - File existence check (injected for testability).
|
|
96
|
-
* @returns Nothing — throws on the first missing path.
|
|
97
93
|
*/
|
|
98
94
|
export function validateSources(sources, exists) {
|
|
99
95
|
requirePath('Roles source', sources.rolesDir, exists);
|
|
@@ -102,6 +98,9 @@ export function validateSources(sources, exists) {
|
|
|
102
98
|
BUNDLE_SCRIPTS.forEach((script) => {
|
|
103
99
|
requirePath(`Bundled script ${script}`, join(sources.bundleDir, script), exists);
|
|
104
100
|
});
|
|
101
|
+
const { briefCommandsDir, briefWorkflowsDir, briefAgentsDir } = sources;
|
|
102
|
+
validateOptionalDirs('Brief', [briefCommandsDir, briefWorkflowsDir, briefAgentsDir], exists);
|
|
103
|
+
validateOptionalDirs('Plan', [sources.planCommandsDir, sources.planWorkflowsDir], exists);
|
|
105
104
|
}
|
|
106
105
|
// ---------------------------------------------------------------------------
|
|
107
106
|
// Pipeline steps
|
|
@@ -164,19 +163,23 @@ function installContent(options) {
|
|
|
164
163
|
dest: paths.workflowsDest,
|
|
165
164
|
enabledRoles,
|
|
166
165
|
});
|
|
166
|
+
handleBriefContent({ sources, dests: paths, enabledRoles, fs });
|
|
167
|
+
handlePlanContent({ sources, dests: paths, enabledRoles, fs });
|
|
167
168
|
if (mode === 'global') {
|
|
168
169
|
inlineWorkflows(paths.commandsDest, paths.workflowsDest);
|
|
169
170
|
}
|
|
171
|
+
writeVersionAndManifests(paths, version, fs);
|
|
172
|
+
}
|
|
173
|
+
/** Write VERSION file and SHA-256 manifests for commands and workflows. */
|
|
174
|
+
function writeVersionAndManifests(paths, version, fs) {
|
|
170
175
|
const versionPath = join(paths.commandsDest, 'VERSION');
|
|
171
176
|
fs.rejectSymlink(versionPath);
|
|
172
177
|
fs.writeFile(versionPath, version);
|
|
173
178
|
fs.mkdir(dirname(paths.manifestPath));
|
|
174
|
-
const cmdManifest = JSON.stringify(buildManifest(paths.commandsDest), null, 2);
|
|
175
|
-
const wfManifest = JSON.stringify(buildManifest(paths.workflowsDest), null, 2);
|
|
176
179
|
fs.rejectSymlink(paths.manifestPath);
|
|
177
180
|
fs.rejectSymlink(paths.workflowsManifestPath);
|
|
178
|
-
fs.writeFile(paths.manifestPath,
|
|
179
|
-
fs.writeFile(paths.workflowsManifestPath,
|
|
181
|
+
fs.writeFile(paths.manifestPath, JSON.stringify(buildManifest(paths.commandsDest), null, 2));
|
|
182
|
+
fs.writeFile(paths.workflowsManifestPath, JSON.stringify(buildManifest(paths.workflowsDest), null, 2));
|
|
180
183
|
}
|
|
181
184
|
/** Copy runtime bundles and write project-level metadata. */
|
|
182
185
|
function setupProjectRuntime(options) {
|
|
@@ -241,12 +244,8 @@ export async function runInstall(options) {
|
|
|
241
244
|
console.log('\n Aborted. No files changed.');
|
|
242
245
|
return;
|
|
243
246
|
}
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
: parseEnabledRoles(cwd, {
|
|
247
|
-
exists: fs.exists,
|
|
248
|
-
readFile: fs.readFile,
|
|
249
|
-
});
|
|
247
|
+
const envFs = { exists: fs.exists, readFile: fs.readFile };
|
|
248
|
+
const enabledRoles = mode === 'global' ? null : parseEnabledRoles(cwd, envFs);
|
|
250
249
|
installContent({ mode, paths, sources, version, enabledRoles, fs });
|
|
251
250
|
setupProjectRuntime({ paths, sources, version, fs, now });
|
|
252
251
|
registerHooks({ paths, sources, fs });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/installer/install/install.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,mBAAmB,GACpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,0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D,MAAM,YAAY,GAAG,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAE9E,cAAc,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;IACpE,mBAAmB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1D,aAAa,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IAEtC,YAAY,CAAC,YAAY,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/installer/plan-content/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/installer/plan-content/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** File system operations for plan content copying. */
|
|
2
|
+
type PlanCopyFs = {
|
|
3
|
+
readonly copyFile: (src: string, dest: string) => void;
|
|
4
|
+
};
|
|
5
|
+
type CopyPlanContentOptions = {
|
|
6
|
+
readonly planCommandsDir: string;
|
|
7
|
+
readonly planWorkflowsDir: string;
|
|
8
|
+
readonly commandsDest: string;
|
|
9
|
+
readonly workflowsDest: string;
|
|
10
|
+
readonly fs: PlanCopyFs;
|
|
11
|
+
};
|
|
12
|
+
type PlanCleanFs = {
|
|
13
|
+
readonly unlink: (path: string) => void;
|
|
14
|
+
};
|
|
15
|
+
type CleanPlanContentOptions = {
|
|
16
|
+
readonly commandsDest: string;
|
|
17
|
+
readonly workflowsDest: string;
|
|
18
|
+
readonly fs: PlanCleanFs;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Copy plan command and workflow files to the install destination.
|
|
22
|
+
*
|
|
23
|
+
* No agents directory needed — plan has no agent files.
|
|
24
|
+
*/
|
|
25
|
+
export declare const copyPlanContent: (options: CopyPlanContentOptions) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Remove plan files from a prior installation.
|
|
28
|
+
*
|
|
29
|
+
* Called when the planner role is disabled to prevent orphaned files.
|
|
30
|
+
* Best-effort — silently ignores missing files.
|
|
31
|
+
*/
|
|
32
|
+
export declare const cleanPlanContent: (options: CleanPlanContentOptions) => void;
|
|
33
|
+
type PlanSources = {
|
|
34
|
+
readonly planCommandsDir?: string;
|
|
35
|
+
readonly planWorkflowsDir?: string;
|
|
36
|
+
};
|
|
37
|
+
type PlanDests = {
|
|
38
|
+
readonly commandsDest: string;
|
|
39
|
+
readonly workflowsDest: string;
|
|
40
|
+
};
|
|
41
|
+
type HandlePlanContentOptions = {
|
|
42
|
+
readonly sources: PlanSources;
|
|
43
|
+
readonly dests: PlanDests;
|
|
44
|
+
readonly enabledRoles: ReadonlySet<string> | null;
|
|
45
|
+
readonly fs: PlanCopyFs & PlanCleanFs;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Install or clean plan content based on available sources and role state.
|
|
49
|
+
*
|
|
50
|
+
* No-op when plan source dirs are absent (direct terminal usage).
|
|
51
|
+
* When present: copies files if planner is enabled, cleans orphans if disabled.
|
|
52
|
+
*/
|
|
53
|
+
export declare const handlePlanContent: (options: HandlePlanContentOptions) => void;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=plan-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-content.d.ts","sourceRoot":"","sources":["../../../src/installer/plan-content/plan-content.ts"],"names":[],"mappings":"AAgBA,uDAAuD;AACvD,KAAK,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AAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,EAAE,EAAE,UAAU,GAAG,WAAW,CAAC;CACvC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,wBAAwB,KAAG,IAkBrE,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan content installer — copies plan command and workflow files from
|
|
3
|
+
* the @chief-clancy/plan package into the install destination.
|
|
4
|
+
*
|
|
5
|
+
* Separate from the role-filter system because plan is a standalone
|
|
6
|
+
* package, not a terminal role directory.
|
|
7
|
+
*/
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
import { hasErrorCode } from '../../installer/shared/fs-errors/index.js';
|
|
10
|
+
import { rejectSymlink } from '../../installer/shared/fs-guards/index.js';
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Constants
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
const PLAN_COMMAND = 'plan.md';
|
|
15
|
+
const PLAN_WORKFLOW = 'plan.md';
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Helpers
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
/** Copy a single file with symlink protection. */
|
|
20
|
+
const copyChecked = (src, dest, fs) => {
|
|
21
|
+
rejectSymlink(dest);
|
|
22
|
+
fs.copyFile(src, dest);
|
|
23
|
+
};
|
|
24
|
+
/** Remove a file, ignoring ENOENT. Rethrows other errors. */
|
|
25
|
+
const unlinkSafe = (path, fs) => {
|
|
26
|
+
try {
|
|
27
|
+
fs.unlink(path);
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
if (!hasErrorCode(err, 'ENOENT'))
|
|
31
|
+
throw err;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
// Public API
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
/**
|
|
38
|
+
* Copy plan command and workflow files to the install destination.
|
|
39
|
+
*
|
|
40
|
+
* No agents directory needed — plan has no agent files.
|
|
41
|
+
*/
|
|
42
|
+
export const copyPlanContent = (options) => {
|
|
43
|
+
const { planCommandsDir, planWorkflowsDir, fs } = options;
|
|
44
|
+
const { commandsDest, workflowsDest } = options;
|
|
45
|
+
rejectSymlink(commandsDest);
|
|
46
|
+
rejectSymlink(workflowsDest);
|
|
47
|
+
copyChecked(join(planCommandsDir, PLAN_COMMAND), join(commandsDest, PLAN_COMMAND), fs);
|
|
48
|
+
copyChecked(join(planWorkflowsDir, PLAN_WORKFLOW), join(workflowsDest, PLAN_WORKFLOW), fs);
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Remove plan files from a prior installation.
|
|
52
|
+
*
|
|
53
|
+
* Called when the planner role is disabled to prevent orphaned files.
|
|
54
|
+
* Best-effort — silently ignores missing files.
|
|
55
|
+
*/
|
|
56
|
+
export const cleanPlanContent = (options) => {
|
|
57
|
+
const { commandsDest, workflowsDest, fs } = options;
|
|
58
|
+
rejectSymlink(commandsDest);
|
|
59
|
+
rejectSymlink(workflowsDest);
|
|
60
|
+
unlinkSafe(join(commandsDest, PLAN_COMMAND), fs);
|
|
61
|
+
unlinkSafe(join(workflowsDest, PLAN_WORKFLOW), fs);
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Install or clean plan content based on available sources and role state.
|
|
65
|
+
*
|
|
66
|
+
* No-op when plan source dirs are absent (direct terminal usage).
|
|
67
|
+
* When present: copies files if planner is enabled, cleans orphans if disabled.
|
|
68
|
+
*/
|
|
69
|
+
export const handlePlanContent = (options) => {
|
|
70
|
+
const { sources, dests, enabledRoles, fs } = options;
|
|
71
|
+
const { planCommandsDir, planWorkflowsDir } = sources;
|
|
72
|
+
if (!planCommandsDir || !planWorkflowsDir)
|
|
73
|
+
return;
|
|
74
|
+
const enabled = enabledRoles === null || enabledRoles.has('planner');
|
|
75
|
+
if (enabled) {
|
|
76
|
+
copyPlanContent({
|
|
77
|
+
planCommandsDir,
|
|
78
|
+
planWorkflowsDir,
|
|
79
|
+
...dests,
|
|
80
|
+
fs,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
cleanPlanContent({ ...dests, fs });
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=plan-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-content.js","sourceRoot":"","sources":["../../../src/installer/plan-content/plan-content.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AA6BxE,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,MAAM,YAAY,GAAG,SAAS,CAAC;AAC/B,MAAM,aAAa,GAAG,SAAS,CAAC;AAEhC,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,kDAAkD;AAClD,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,IAAY,EAAE,EAAc,EAAQ,EAAE;IACtE,aAAa,CAAC,IAAI,CAAC,CAAC;IACpB,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACzB,CAAC,CAAC;AAEF,6DAA6D;AAC7D,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAe,EAAQ,EAAE;IACzD,IAAI,CAAC;QACH,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,QAAQ,CAAC;YAAE,MAAM,GAAG,CAAC;IAC9C,CAAC;AACH,CAAC,CAAC;AAEF,8EAA8E;AAC9E,aAAa;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AgB;QAAE,OAAO;IAElD,MAAM,OAAO,GAAG,YAAY,KAAK,IAAI,IAAI,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAErE,IAAI,OAAO,EAAE,CAAC;QACZ,eAAe,CAAC;YACd,eAAe;YACf,gBAAgB;YAChB,GAAG,KAAK;YACR,EAAE;SACH,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,gBAAgB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IACrC,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/** Throw if `path` does not exist (checked via the injected `exists`). */
|
|
2
|
+
export declare const requirePath: (label: string, path: string, exists: (p: string) => boolean) => void;
|
|
3
|
+
/** Validate all-or-none optional source dirs and require each path if present. */
|
|
4
|
+
export declare const validateOptionalDirs: (label: string, dirs: readonly (string | undefined)[], exists: (path: string) => boolean) => void;
|
|
1
5
|
/** Throw if the given path is a symlink. Only swallows ENOENT. */
|
|
2
6
|
export declare function rejectSymlink(path: string): void;
|
|
3
7
|
//# sourceMappingURL=fs-guards.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs-guards.d.ts","sourceRoot":"","sources":["../../../../src/installer/shared/fs-guards/fs-guards.ts"],"names":[],"mappings":"AAOA,kEAAkE;AAClE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAQhD"}
|
|
1
|
+
{"version":3,"file":"fs-guards.d.ts","sourceRoot":"","sources":["../../../../src/installer/shared/fs-guards/fs-guards.ts"],"names":[],"mappings":"AAOA,0EAA0E;AAC1E,eAAO,MAAM,WAAW,GACtB,OAAO,MAAM,EACb,MAAM,MAAM,EACZ,QAAQ,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,KAC7B,IAEF,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,EACb,MAAM,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,EACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,KAChC,IAUF,CAAC;AAEF,kEAAkE;AAClE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAQhD"}
|
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { lstatSync } from 'node:fs';
|
|
5
5
|
import { hasErrorCode } from '../fs-errors/fs-errors.js';
|
|
6
|
+
/** Throw if `path` does not exist (checked via the injected `exists`). */
|
|
7
|
+
export const requirePath = (label, path, exists) => {
|
|
8
|
+
if (!exists(path))
|
|
9
|
+
throw new Error(`${label} not found: ${path}`);
|
|
10
|
+
};
|
|
11
|
+
/** Validate all-or-none optional source dirs and require each path if present. */
|
|
12
|
+
export const validateOptionalDirs = (label, dirs, exists) => {
|
|
13
|
+
const defined = dirs.filter(Boolean);
|
|
14
|
+
if (defined.length > 0 && defined.length < dirs.length) {
|
|
15
|
+
throw new Error(`${label} source dirs must be all-or-none — some are missing.`);
|
|
16
|
+
}
|
|
17
|
+
defined.forEach((dir) => requirePath(`${label} source`, dir, exists));
|
|
18
|
+
};
|
|
6
19
|
/** Throw if the given path is a symlink. Only swallows ENOENT. */
|
|
7
20
|
export function rejectSymlink(path) {
|
|
8
21
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs-guards.js","sourceRoot":"","sources":["../../../../src/installer/shared/fs-guards/fs-guards.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,kEAAkE;AAClE,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,IAAI,CAAC;QACH,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,GAAG,IA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c,EAAE,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,6CAA6C,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,QAAQ,CAAC;YAAE,MAAM,GAAG,CAAC;IAC9C,CAAC;AACH,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { rejectSymlink } from './fs-guards.js';
|
|
1
|
+
export { rejectSymlink, requirePath, validateOptionalDirs, } from './fs-guards.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/installer/shared/fs-guards/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/installer/shared/fs-guards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,oBAAoB,GACrB,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { rejectSymlink } from './fs-guards.js';
|
|
1
|
+
export { rejectSymlink, requirePath, validateOptionalDirs, } from './fs-guards.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/installer/shared/fs-guards/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/installer/shared/fs-guards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,oBAAoB,GACrB,MAAM,gBAAgB,CAAC"}
|