@phren/cli 0.1.28 → 0.1.29

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.
@@ -12,5 +12,8 @@ interface AddedProjectData {
12
12
  task: string;
13
13
  };
14
14
  }
15
- export declare function addProjectFromPath(phrenPath: string, targetPath: string | undefined, requestedProfile?: string, ownership?: ProjectOwnershipMode): PhrenResult<AddedProjectData>;
15
+ interface AddProjectFromPathOptions {
16
+ writeToPath?: string;
17
+ }
18
+ export declare function addProjectFromPath(phrenPath: string, targetPath: string | undefined, requestedProfile?: string, ownership?: ProjectOwnershipMode, options?: AddProjectFromPathOptions): PhrenResult<AddedProjectData>;
16
19
  export {};
@@ -4,13 +4,14 @@ import { bootstrapFromExisting } from "../init/setup.js";
4
4
  import { resolveActiveProfile } from "../profile-store.js";
5
5
  import { TASKS_FILENAME } from "../data/tasks.js";
6
6
  import { FINDINGS_FILENAME } from "../data/access.js";
7
- export function addProjectFromPath(phrenPath, targetPath, requestedProfile, ownership) {
7
+ export function addProjectFromPath(phrenPath, targetPath, requestedProfile, ownership, options = {}) {
8
8
  if (!targetPath) {
9
9
  return phrenErr("Path is required. Pass the current project directory explicitly to avoid adding the wrong working directory.");
10
10
  }
11
11
  const activeProfile = resolveActiveProfile(phrenPath, requestedProfile);
12
12
  if (!activeProfile.ok)
13
13
  return activeProfile;
14
+ const writePhrenPath = options.writeToPath ?? phrenPath;
14
15
  const manifest = readRootManifest(phrenPath);
15
16
  const resolvedPath = path.resolve(targetPath);
16
17
  if (manifest?.installMode === "project-local") {
@@ -21,7 +22,11 @@ export function addProjectFromPath(phrenPath, targetPath, requestedProfile, owne
21
22
  }
22
23
  }
23
24
  const selectedProfile = activeProfile.data;
24
- const added = bootstrapFromExisting(phrenPath, resolvedPath, { profile: selectedProfile, ownership });
25
+ const added = bootstrapFromExisting(writePhrenPath, resolvedPath, {
26
+ profile: selectedProfile,
27
+ profilePhrenPath: phrenPath,
28
+ ownership,
29
+ });
25
30
  return phrenOk({
26
31
  project: added.project,
27
32
  path: resolvedPath,
@@ -29,9 +34,9 @@ export function addProjectFromPath(phrenPath, targetPath, requestedProfile, owne
29
34
  ownership: added.ownership,
30
35
  files: {
31
36
  claude: added.claudePath,
32
- summary: path.join(phrenPath, added.project, "summary.md"),
33
- findings: path.join(phrenPath, added.project, FINDINGS_FILENAME),
34
- task: path.join(phrenPath, added.project, TASKS_FILENAME),
37
+ summary: path.join(writePhrenPath, added.project, "summary.md"),
38
+ findings: path.join(writePhrenPath, added.project, FINDINGS_FILENAME),
39
+ task: path.join(writePhrenPath, added.project, TASKS_FILENAME),
35
40
  },
36
41
  });
37
42
  }
@@ -13,6 +13,7 @@ export interface PostInitCheck {
13
13
  }
14
14
  interface BootstrapProjectOptions {
15
15
  profile?: string;
16
+ profilePhrenPath?: string;
16
17
  ownership?: ProjectOwnershipMode;
17
18
  }
18
19
  interface BootstrapProjectResult {
@@ -1036,6 +1036,7 @@ export function ensureLocalGitRepo(phrenPath) {
1036
1036
  */
1037
1037
  export function bootstrapFromExisting(phrenPath, projectPath, opts = {}) {
1038
1038
  const profile = typeof opts === "string" ? opts : opts.profile;
1039
+ const profilePhrenPath = typeof opts === "string" ? phrenPath : (opts.profilePhrenPath ?? phrenPath);
1039
1040
  const resolvedPath = path.resolve(projectPath);
1040
1041
  if (!fs.existsSync(resolvedPath)) {
1041
1042
  throw new Error(`Path does not exist: ${resolvedPath}`);
@@ -1127,9 +1128,9 @@ export function bootstrapFromExisting(phrenPath, projectPath, opts = {}) {
1127
1128
  : getBuiltinTopicConfig(inferredDomain);
1128
1129
  atomicWriteText(path.join(projDir, "topic-config.json"), JSON.stringify({ version: 1, domain: inferredDomain, topics: inferredTopics }, null, 2) + "\n");
1129
1130
  }
1130
- const activeProfile = resolveActiveProfile(phrenPath, profile);
1131
+ const activeProfile = resolveActiveProfile(profilePhrenPath, profile);
1131
1132
  if (activeProfile.ok && activeProfile.data) {
1132
- const addResult = addProjectToProfile(phrenPath, activeProfile.data, projectName);
1133
+ const addResult = addProjectToProfile(profilePhrenPath, activeProfile.data, projectName);
1133
1134
  if (!addResult.ok) {
1134
1135
  throw new Error(addResult.error);
1135
1136
  }
package/dist/tools/ops.js CHANGED
@@ -51,7 +51,7 @@ async function handleAddProject(ctx, { path: targetPath, profile: requestedProfi
51
51
  }
52
52
  }
53
53
  }
54
- const added = addProjectFromPath(targetPhrenPath, targetPath, requestedProfile || profile || undefined, parseProjectOwnershipMode(ownership) ?? undefined);
54
+ const added = addProjectFromPath(phrenPath, targetPath, requestedProfile || profile || undefined, parseProjectOwnershipMode(ownership) ?? undefined, { writeToPath: targetPhrenPath });
55
55
  if (!added.ok) {
56
56
  return mcpResponse({
57
57
  ok: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "Knowledge layer for AI agents — CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {