@phren/cli 0.2.1 → 0.2.2

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.
@@ -100,16 +100,37 @@ export function digestTopic(slug, file, bullets) {
100
100
  };
101
101
  }
102
102
  function plural(n, word) {
103
- if (word === "context")
104
- return `${n} context note${n === 1 ? "" : "s"}`;
105
103
  return `${n} ${word}${n === 1 ? "" : "s"}`;
106
104
  }
105
+ /** Tags are not all nouns that take an s: "18 architectures" and "8 code-qualitys" read as bugs. */
106
+ const TAG_PLURALS = {
107
+ bug: ["bug", "bugs"],
108
+ pitfall: ["pitfall", "pitfalls"],
109
+ pattern: ["pattern", "patterns"],
110
+ decision: ["decision", "decisions"],
111
+ tradeoff: ["tradeoff", "tradeoffs"],
112
+ context: ["context note", "context notes"],
113
+ architecture: ["architecture note", "architecture notes"],
114
+ "code-quality": ["code-quality note", "code-quality notes"],
115
+ competitive: ["competitive note", "competitive notes"],
116
+ security: ["security note", "security notes"],
117
+ performance: ["performance note", "performance notes"],
118
+ tooling: ["tooling note", "tooling notes"],
119
+ workflow: ["workflow note", "workflow notes"],
120
+ api: ["API note", "API notes"],
121
+ };
122
+ function tagCount(n, tag) {
123
+ const forms = TAG_PLURALS[tag];
124
+ if (forms)
125
+ return `${n} ${n === 1 ? forms[0] : forms[1]}`;
126
+ return `${n} ${tag}`;
127
+ }
107
128
  /** The paragraph that can always be written, no model required. */
108
129
  export function structuralNow(d) {
109
130
  if (!d.bullets)
110
131
  return "Nothing archived under this topic yet.";
111
132
  const span = d.first && d.last ? (d.first === d.last ? `archived on ${d.first}` : `archived between ${d.first} and ${d.last}`) : "";
112
- const tagLine = Object.entries(d.tags).filter(([t]) => t !== "untagged").sort((a, b) => b[1] - a[1]).slice(0, 4).map(([t, n]) => plural(n, t)).join(", ");
133
+ const tagLine = Object.entries(d.tags).filter(([t]) => t !== "untagged").sort((a, b) => b[1] - a[1]).slice(0, 4).map(([t, n]) => tagCount(n, t)).join(", ");
113
134
  const parts = [`${plural(d.bullets, "finding")}${span ? `, ${span}` : ""}${tagLine ? `: ${tagLine}` : ""}.`];
114
135
  if (d.mentioned.length)
115
136
  parts.push(`Keeps coming back to ${d.mentioned.join(", ")}.`);
@@ -1966,7 +1966,14 @@ export function detectProject(phrenPath, cwd, profile) {
1966
1966
  || getProjectSourcePath(phrenPath, projectName);
1967
1967
  if (!sourcePath)
1968
1968
  continue;
1969
- const matches = resolvedCwd === sourcePath || resolvedCwd.startsWith(sourcePath + path.sep);
1969
+ // Exact first. Then case-insensitive: a sourcePath written on a
1970
+ // case-insensitive filesystem (macOS) and synced here can differ from the
1971
+ // real directory only in case — "/home/me/projects/x" against
1972
+ // "/home/me/Projects/x" — and without this the project is invisible to the
1973
+ // hook on that machine, with nothing to say why.
1974
+ const matches = resolvedCwd === sourcePath || resolvedCwd.startsWith(sourcePath + path.sep)
1975
+ || resolvedCwd.toLowerCase() === sourcePath.toLowerCase()
1976
+ || resolvedCwd.toLowerCase().startsWith(sourcePath.toLowerCase() + path.sep);
1970
1977
  if (!matches)
1971
1978
  continue;
1972
1979
  if (!bestMatch || sourcePath.length > bestMatch.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Knowledge layer for AI agents — CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {