@codeyam/codeyam-cli 0.1.0-staging.a890816 → 0.1.0-staging.ae0de75
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/analyzer-template/.build-info.json +6 -6
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +6 -6
- package/analyzer-template/packages/ai/package.json +1 -1
- package/analyzer-template/packages/aws/package.json +1 -1
- package/analyzer-template/packages/database/package.json +3 -3
- package/analyzer-template/packages/github/package.json +1 -1
- package/codeyam-cli/src/commands/editor.js +892 -90
- package/codeyam-cli/src/commands/editor.js.map +1 -1
- package/codeyam-cli/src/commands/init.js +6 -1
- package/codeyam-cli/src/commands/init.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +246 -0
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +126 -0
- package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +295 -0
- package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
- package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +100 -0
- package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +147 -0
- package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +76 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
- package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
- package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
- package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
- package/codeyam-cli/src/utils/buildFlags.js +4 -0
- package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
- package/codeyam-cli/src/utils/editorAudit.js +82 -0
- package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
- package/codeyam-cli/src/utils/editorDevServer.js +98 -0
- package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
- package/codeyam-cli/src/utils/editorJournal.js +137 -0
- package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
- package/codeyam-cli/src/utils/editorMockState.js +248 -0
- package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
- package/codeyam-cli/src/utils/editorPreloadHelpers.js +64 -0
- package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
- package/codeyam-cli/src/utils/editorPreview.js +66 -0
- package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
- package/codeyam-cli/src/utils/editorScenarios.js +56 -0
- package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
- package/codeyam-cli/src/utils/git.js +51 -0
- package/codeyam-cli/src/utils/git.js.map +1 -1
- package/codeyam-cli/src/utils/install-skills.js +28 -17
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/project.js +15 -5
- package/codeyam-cli/src/utils/project.js.map +1 -1
- package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
- package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
- package/codeyam-cli/src/utils/testRunner.js +1 -1
- package/codeyam-cli/src/utils/testRunner.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/Terminal-wkqC0AQk.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor-CdjF_fX6.js +8 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-D8ILZMR0.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-B17TBSS6.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/manifest-b8fd6b07.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{root-DiRdBreB.js → root-DUKqhFlb.js} +7 -7
- package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
- package/codeyam-cli/src/webserver/build/server/assets/{index-BzAbACSx.js → index-BLhjL9Xi.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/server-build-DyMuI5mU.js +363 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/src/webserver/editorProxy.js +182 -14
- package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
- package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +175 -0
- package/codeyam-cli/src/webserver/server.js +61 -12
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/src/webserver/terminalServer.js +29 -103
- package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
- package/codeyam-cli/templates/editor-step-hook.py +6 -4
- package/codeyam-cli/templates/{codeyam-dev-mode.md → skills/codeyam-dev-mode/SKILL.md} +1 -1
- package/codeyam-cli/templates/{codeyam-editor.md → skills/codeyam-editor/SKILL.md} +5 -4
- package/codeyam-cli/templates/{codeyam-memory.md → skills/codeyam-memory/SKILL.md} +215 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.sh +108 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.sh +69 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.sh +12 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter.jq +45 -0
- package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.sh +139 -0
- package/package.json +2 -2
- package/scripts/npm-post-install.cjs +12 -0
- package/codeyam-cli/src/webserver/build/client/assets/Terminal-CcG8YTLx.js +0 -41
- package/codeyam-cli/src/webserver/build/client/assets/editor-W_IGJ2Kd.js +0 -7
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-D6SEzMCu.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/globals-BZB_H1w2.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-8daa4147.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/xterm-DMSzMhqy.js +0 -9
- package/codeyam-cli/src/webserver/build/server/assets/server-build-OdUocH6P.js +0 -362
- package/scripts/finalize-analyzer.cjs +0 -13
- /package/codeyam-cli/templates/{codeyam-diagnose.md → commands/codeyam-diagnose.md} +0 -0
- /package/codeyam-cli/templates/{codeyam-debug.md → skills/codeyam-debug/SKILL.md} +0 -0
- /package/codeyam-cli/templates/{codeyam-new-rule.md → skills/codeyam-new-rule/SKILL.md} +0 -0
- /package/codeyam-cli/templates/{codeyam-setup.md → skills/codeyam-setup/SKILL.md} +0 -0
- /package/codeyam-cli/templates/{codeyam-sim.md → skills/codeyam-sim/SKILL.md} +0 -0
- /package/codeyam-cli/templates/{codeyam-test.md → skills/codeyam-test/SKILL.md} +0 -0
- /package/codeyam-cli/templates/{codeyam-verify.md → skills/codeyam-verify/SKILL.md} +0 -0
package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Deprecated Pattern Analysis
|
|
2
|
+
|
|
3
|
+
You are analyzing a codebase for **deprecated patterns** — situations where two approaches to the same problem coexist, with one fading in favor of another. These create confusion because a coding agent reading locally may follow the old pattern.
|
|
4
|
+
|
|
5
|
+
## Input
|
|
6
|
+
|
|
7
|
+
Read the scan data from `/tmp/codeyam-memory/deprecated-scan.json`. It contains:
|
|
8
|
+
|
|
9
|
+
- `dependencies`: All npm dependency names from the project
|
|
10
|
+
- `explicit_markers`: Lines containing `@deprecated`, `// legacy`, etc., with file, line number, and text
|
|
11
|
+
- `git_recency`: Per-dependency counts of `recent_imports` (last 3 months) vs `old_imports` (3–12 months ago)
|
|
12
|
+
|
|
13
|
+
## Analysis Steps
|
|
14
|
+
|
|
15
|
+
### 1. Dependency Overlap Analysis
|
|
16
|
+
|
|
17
|
+
Review the full dependency list and identify pairs or groups that serve **overlapping purposes**. Use your domain knowledge of the npm ecosystem — don't rely on name similarity alone.
|
|
18
|
+
|
|
19
|
+
Common overlap categories:
|
|
20
|
+
|
|
21
|
+
- **ORMs / query builders**: knex, kysely, prisma, drizzle, typeorm, sequelize, supabase-js (when used for queries)
|
|
22
|
+
- **Date libraries**: moment, dayjs, date-fns, luxon
|
|
23
|
+
- **HTTP clients**: axios, got, node-fetch, ky, superagent, undici
|
|
24
|
+
- **State management**: redux, zustand, jotai, recoil, mobx, valtio
|
|
25
|
+
- **Schema validation**: zod, yup, joi, ajv, io-ts, superstruct, valibot
|
|
26
|
+
- **CSS-in-JS / styling**: styled-components, emotion, tailwind, vanilla-extract, stitches
|
|
27
|
+
- **Testing**: jest, vitest, mocha, ava
|
|
28
|
+
- **Bundlers**: webpack, vite, esbuild, rollup, parcel, turbopack
|
|
29
|
+
- **Logging**: winston, pino, bunyan, log4js
|
|
30
|
+
|
|
31
|
+
Also look for:
|
|
32
|
+
|
|
33
|
+
- Internal packages that wrap the same underlying library differently
|
|
34
|
+
- Old utility files alongside newer replacements
|
|
35
|
+
|
|
36
|
+
### 2. Cross-Reference with Git Recency
|
|
37
|
+
|
|
38
|
+
For each overlapping pair you identified, check the `git_recency` data:
|
|
39
|
+
|
|
40
|
+
- Is one dependency's import count **growing** (more recent than old) while the other is **fading** (fewer recent than old)?
|
|
41
|
+
- A clear growth-vs-fade pattern confirms a migration in progress.
|
|
42
|
+
- If both are stable or both are growing, it may be intentional coexistence rather than a migration.
|
|
43
|
+
|
|
44
|
+
### 3. Cross-Reference with Explicit Markers
|
|
45
|
+
|
|
46
|
+
Check if any `@deprecated` or `// legacy` markers corroborate your dependency findings:
|
|
47
|
+
|
|
48
|
+
- A marker on code that imports the fading dependency strengthens the signal
|
|
49
|
+
- A marker on a wrapper/utility that abstracts one of the approaches is strong evidence
|
|
50
|
+
|
|
51
|
+
### 4. Find Remaining Callsites
|
|
52
|
+
|
|
53
|
+
For each confirmed deprecated pattern, use Grep to find all files still importing or using the old dependency/pattern. Count the callsites to assess migration completeness.
|
|
54
|
+
|
|
55
|
+
Search patterns:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
from ['"]<old-dep>
|
|
59
|
+
require(['"]<old-dep>
|
|
60
|
+
import <old-dep>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 5. Assess Severity
|
|
64
|
+
|
|
65
|
+
- **high**: Active migration with significant remaining old callsites (>10 files), or explicit deprecation markers present
|
|
66
|
+
- **medium**: Clear trend in git recency but no explicit markers and fewer remaining callsites
|
|
67
|
+
- **low**: Slight trend, possibly intentional coexistence
|
|
68
|
+
|
|
69
|
+
## Output
|
|
70
|
+
|
|
71
|
+
Return your findings as a JSON code block in your response, using this format:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"findings": [
|
|
76
|
+
{
|
|
77
|
+
"type": "deprecated-pattern",
|
|
78
|
+
"old_pattern": "descriptive name of the old approach",
|
|
79
|
+
"new_pattern": "descriptive name of the new approach",
|
|
80
|
+
"evidence": "concise summary of the evidence (git recency numbers, markers found)",
|
|
81
|
+
"files_still_using_old": ["path/to/file1.ts", "path/to/file2.ts"],
|
|
82
|
+
"severity": "high|medium|low",
|
|
83
|
+
"suggested_rule_paths": ["src/relevant/**/*.ts"]
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"stats": {
|
|
87
|
+
"deps_analyzed": 0,
|
|
88
|
+
"overlapping_pairs_found": 0,
|
|
89
|
+
"confirmed_deprecated": 0
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
After the JSON block, return a **brief one-paragraph summary** of your findings. Include the number of confirmed deprecated patterns and the highest-severity finding.
|
|
95
|
+
|
|
96
|
+
## Important Notes
|
|
97
|
+
|
|
98
|
+
- Be conservative: only flag patterns where there is clear evidence of transition, not just the presence of two similar libraries
|
|
99
|
+
- Some projects intentionally use multiple tools in the same category (e.g., jest for unit tests and playwright for e2e) — that's not deprecation
|
|
100
|
+
- Focus on patterns that would **mislead a coding agent** — if both approaches are valid and documented, it may not need a rule
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Gathers deprecation signals from package.json, source markers, and git history.
|
|
3
|
+
# Outputs structured JSON to /tmp/codeyam-memory/deprecated-scan.json
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
OUTPUT_DIR="/tmp/codeyam-memory"
|
|
8
|
+
OUTPUT_FILE="$OUTPUT_DIR/deprecated-scan.json"
|
|
9
|
+
mkdir -p "$OUTPUT_DIR"
|
|
10
|
+
|
|
11
|
+
# --- Dependency scan ---
|
|
12
|
+
# Collect all dependency names from package.json files (root + workspace packages)
|
|
13
|
+
deps_json="[]"
|
|
14
|
+
while IFS= read -r pkg_file; do
|
|
15
|
+
# Extract dependency names from both dependencies and devDependencies
|
|
16
|
+
file_deps=$(jq -r '(.dependencies // {} | keys[]) , (.devDependencies // {} | keys[])' "$pkg_file" 2>/dev/null || true)
|
|
17
|
+
if [ -n "$file_deps" ]; then
|
|
18
|
+
deps_json=$(echo "$deps_json" | jq --arg d "$file_deps" '. + ($d | split("\n") | map(select(. != "")))')
|
|
19
|
+
fi
|
|
20
|
+
done < <(find . -name "package.json" -not -path "*/node_modules/*" -not -path "*/dist/*" -not -path "*/.next/*" 2>/dev/null)
|
|
21
|
+
|
|
22
|
+
# Deduplicate
|
|
23
|
+
deps_json=$(echo "$deps_json" | jq 'unique')
|
|
24
|
+
|
|
25
|
+
# --- Explicit marker scan ---
|
|
26
|
+
markers_json="[]"
|
|
27
|
+
marker_output=$(rg -n "@deprecated|// legacy|// deprecated|// old approach|TODO.*deprecat|FIXME.*deprecat" \
|
|
28
|
+
--type ts --type js \
|
|
29
|
+
--glob '!node_modules' --glob '!dist' --glob '!build' --glob '!.next' \
|
|
30
|
+
-C 2 2>/dev/null || true)
|
|
31
|
+
|
|
32
|
+
if [ -n "$marker_output" ]; then
|
|
33
|
+
# Parse ripgrep output into JSON entries
|
|
34
|
+
markers_json=$(echo "$marker_output" | awk -F: '
|
|
35
|
+
/^[^-].*:[0-9]+:/ {
|
|
36
|
+
file = $1
|
|
37
|
+
line = $2
|
|
38
|
+
# Rejoin the rest as text (handles colons in content)
|
|
39
|
+
text = ""
|
|
40
|
+
for (i = 3; i <= NF; i++) {
|
|
41
|
+
text = (text == "" ? $i : text ":" $i)
|
|
42
|
+
}
|
|
43
|
+
gsub(/^[ \t]+/, "", text)
|
|
44
|
+
gsub(/"/, "\\\"", text)
|
|
45
|
+
gsub(/\t/, " ", text)
|
|
46
|
+
printf "{\"file\":\"%s\",\"line\":%s,\"text\":\"%s\"},\n", file, line, text
|
|
47
|
+
}
|
|
48
|
+
' | sed '$ s/,$//' | awk 'BEGIN{print "["} {print} END{print "]"}')
|
|
49
|
+
|
|
50
|
+
# Validate JSON — fall back to empty array if malformed
|
|
51
|
+
if ! echo "$markers_json" | jq empty 2>/dev/null; then
|
|
52
|
+
markers_json="[]"
|
|
53
|
+
fi
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
# --- Git recency comparison ---
|
|
57
|
+
# Extract all import lines from git patches in two passes (recent + old), then count per-dep
|
|
58
|
+
recency_json="{}"
|
|
59
|
+
dep_count=$(echo "$deps_json" | jq length)
|
|
60
|
+
|
|
61
|
+
if [ "$dep_count" -gt 0 ]; then
|
|
62
|
+
RECENT_IMPORTS="$OUTPUT_DIR/recent-imports.txt"
|
|
63
|
+
OLD_IMPORTS="$OUTPUT_DIR/old-imports.txt"
|
|
64
|
+
|
|
65
|
+
# Single git log pass per time window — extract only import lines
|
|
66
|
+
git log --since="3 months ago" -p -- '*.ts' '*.tsx' '*.js' '*.jsx' 2>/dev/null \
|
|
67
|
+
| grep -oE "from ['\"][^'\"]+['\"]" > "$RECENT_IMPORTS" 2>/dev/null || true
|
|
68
|
+
git log --since="12 months ago" --until="3 months ago" -p -- '*.ts' '*.tsx' '*.js' '*.jsx' 2>/dev/null \
|
|
69
|
+
| grep -oE "from ['\"][^'\"]+['\"]" > "$OLD_IMPORTS" 2>/dev/null || true
|
|
70
|
+
|
|
71
|
+
for dep in $(echo "$deps_json" | jq -r '.[]'); do
|
|
72
|
+
# Skip short names that would match too broadly
|
|
73
|
+
if [ ${#dep} -lt 3 ]; then
|
|
74
|
+
continue
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
recent=$(grep -c "from ['\"]${dep}" "$RECENT_IMPORTS" 2>/dev/null || true)
|
|
78
|
+
recent=${recent:-0}
|
|
79
|
+
old=$(grep -c "from ['\"]${dep}" "$OLD_IMPORTS" 2>/dev/null || true)
|
|
80
|
+
old=${old:-0}
|
|
81
|
+
|
|
82
|
+
if [ "$recent" -gt 0 ] || [ "$old" -gt 0 ]; then
|
|
83
|
+
recency_json=$(echo "$recency_json" | jq \
|
|
84
|
+
--arg dep "$dep" \
|
|
85
|
+
--argjson recent "$recent" \
|
|
86
|
+
--argjson old "$old" \
|
|
87
|
+
'. + {($dep): {"recent_imports": $recent, "old_imports": $old}}')
|
|
88
|
+
fi
|
|
89
|
+
done
|
|
90
|
+
|
|
91
|
+
rm -f "$RECENT_IMPORTS" "$OLD_IMPORTS"
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
# --- Assemble final output ---
|
|
95
|
+
jq -n \
|
|
96
|
+
--argjson dependencies "$deps_json" \
|
|
97
|
+
--argjson explicit_markers "$markers_json" \
|
|
98
|
+
--argjson git_recency "$recency_json" \
|
|
99
|
+
'{
|
|
100
|
+
dependencies: $dependencies,
|
|
101
|
+
explicit_markers: $explicit_markers,
|
|
102
|
+
git_recency: $git_recency
|
|
103
|
+
}' > "$OUTPUT_FILE"
|
|
104
|
+
|
|
105
|
+
echo "Deprecated pattern scan complete: $OUTPUT_FILE"
|
|
106
|
+
echo " Dependencies found: $(echo "$deps_json" | jq length)"
|
|
107
|
+
echo " Explicit markers found: $(echo "$markers_json" | jq length)"
|
|
108
|
+
echo " Deps with git activity: $(echo "$recency_json" | jq 'length')"
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Indexes the project's public API surface by finding all exports.
|
|
3
|
+
# Outputs structured JSON to /tmp/codeyam-memory/exports-scan.json
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
OUTPUT_DIR="/tmp/codeyam-memory"
|
|
8
|
+
OUTPUT_FILE="$OUTPUT_DIR/exports-scan.json"
|
|
9
|
+
mkdir -p "$OUTPUT_DIR"
|
|
10
|
+
|
|
11
|
+
# Find all export declarations, excluding noise directories and .d.ts files
|
|
12
|
+
export_output=$(rg -n "^export (function|const|class|default|async function|type|interface|enum)" \
|
|
13
|
+
--type ts --type js \
|
|
14
|
+
--glob '!node_modules' --glob '!dist' --glob '!build' --glob '!.next' \
|
|
15
|
+
--glob '!*.d.ts' --glob '!*.map' \
|
|
16
|
+
2>/dev/null || true)
|
|
17
|
+
|
|
18
|
+
if [ -z "$export_output" ]; then
|
|
19
|
+
# No exports found — output empty structure
|
|
20
|
+
jq -n '{files: {}, stats: {total_files: 0, total_exports: 0}}' > "$OUTPUT_FILE"
|
|
21
|
+
echo "Export scan complete: $OUTPUT_FILE (no exports found)"
|
|
22
|
+
exit 0
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
# Parse ripgrep output into JSON grouped by file
|
|
26
|
+
# Format: file:line:text
|
|
27
|
+
files_json=$(echo "$export_output" | awk -F: '
|
|
28
|
+
{
|
|
29
|
+
file = $1
|
|
30
|
+
line = $2
|
|
31
|
+
# Rejoin rest as text
|
|
32
|
+
text = ""
|
|
33
|
+
for (i = 3; i <= NF; i++) {
|
|
34
|
+
text = (text == "" ? $i : text ":" $i)
|
|
35
|
+
}
|
|
36
|
+
# Trim leading whitespace
|
|
37
|
+
gsub(/^[ \t]+/, "", text)
|
|
38
|
+
# Escape quotes for JSON
|
|
39
|
+
gsub(/"/, "\\\"", text)
|
|
40
|
+
gsub(/\t/, " ", text)
|
|
41
|
+
printf "%s\t%s\t%s\n", file, line, text
|
|
42
|
+
}' | jq -Rsn '
|
|
43
|
+
[inputs | split("\n") | .[] | select(. != "") |
|
|
44
|
+
split("\t") | select(length >= 3) |
|
|
45
|
+
{file: .[0], line: (.[1] | tonumber), text: .[2]}
|
|
46
|
+
] |
|
|
47
|
+
group_by(.file) |
|
|
48
|
+
reduce .[] as $group ({};
|
|
49
|
+
. + {($group[0].file): [$group[] | {line: .line, text: .text}]}
|
|
50
|
+
)
|
|
51
|
+
')
|
|
52
|
+
|
|
53
|
+
# Compute stats
|
|
54
|
+
total_files=$(echo "$files_json" | jq 'length')
|
|
55
|
+
total_exports=$(echo "$files_json" | jq '[.[] | length] | add // 0')
|
|
56
|
+
|
|
57
|
+
# Assemble final output
|
|
58
|
+
jq -n \
|
|
59
|
+
--argjson files "$files_json" \
|
|
60
|
+
--argjson total_files "$total_files" \
|
|
61
|
+
--argjson total_exports "$total_exports" \
|
|
62
|
+
'{
|
|
63
|
+
files: $files,
|
|
64
|
+
stats: {total_files: $total_files, total_exports: $total_exports}
|
|
65
|
+
}' > "$OUTPUT_FILE"
|
|
66
|
+
|
|
67
|
+
echo "Export scan complete: $OUTPUT_FILE"
|
|
68
|
+
echo " Files with exports: $total_files"
|
|
69
|
+
echo " Total exports: $total_exports"
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Misleading API Analysis
|
|
2
|
+
|
|
3
|
+
You are analyzing a codebase for **misleading APIs** — exported functions whose names promise one thing but whose implementations do another. These are dangerous because a coding agent reading the function signature will make incorrect assumptions about behavior.
|
|
4
|
+
|
|
5
|
+
## Input
|
|
6
|
+
|
|
7
|
+
Read the export index from `/tmp/codeyam-memory/exports-scan.json`. It contains:
|
|
8
|
+
|
|
9
|
+
- `files`: Object keyed by file path, each containing an array of `{line, text}` export declarations
|
|
10
|
+
- `stats`: `total_files` and `total_exports` counts
|
|
11
|
+
|
|
12
|
+
## Analysis Steps
|
|
13
|
+
|
|
14
|
+
### 1. Triage by Name Pattern
|
|
15
|
+
|
|
16
|
+
Scan all export names and prioritize **pure-sounding** functions — names that imply no side effects or predictable behavior:
|
|
17
|
+
|
|
18
|
+
**Highest priority** (names suggesting pure computation):
|
|
19
|
+
|
|
20
|
+
- `get*`, `compute*`, `calculate*`, `derive*`, `extract*`
|
|
21
|
+
- `is*`, `has*`, `check*`, `can*`
|
|
22
|
+
- `parse*`, `format*`, `transform*`, `convert*`
|
|
23
|
+
- `to*`, `from*`, `create*` (when suggesting a factory)
|
|
24
|
+
- `validate*`, `verify*`
|
|
25
|
+
|
|
26
|
+
**Medium priority** (names suggesting single responsibility):
|
|
27
|
+
|
|
28
|
+
- `save*`, `update*`, `delete*`, `remove*` — check for hidden secondary effects
|
|
29
|
+
- `send*`, `notify*`, `emit*` — check for unexpected mutations
|
|
30
|
+
- `init*`, `setup*`, `configure*` — check for non-obvious global state changes
|
|
31
|
+
|
|
32
|
+
### 2. Deep Read Suspicious Exports
|
|
33
|
+
|
|
34
|
+
For each pure-sounding or single-responsibility export, use the Read tool to read the **full function implementation** (not just 30 lines — read until the function ends). Look for these red flags:
|
|
35
|
+
|
|
36
|
+
**Side effects in "pure" functions:**
|
|
37
|
+
|
|
38
|
+
- Writes to external state (database, cache, filesystem, global variables)
|
|
39
|
+
- Network calls (fetch, HTTP requests, WebSocket messages)
|
|
40
|
+
- Logging that includes sensitive data or business logic decisions
|
|
41
|
+
- Event emission or pub/sub publishing
|
|
42
|
+
|
|
43
|
+
**Input mutation:**
|
|
44
|
+
|
|
45
|
+
- Modifying objects/arrays passed as arguments (when the name doesn't suggest mutation)
|
|
46
|
+
- Reassigning properties on `this` in methods that sound like getters
|
|
47
|
+
|
|
48
|
+
**Silent error swallowing:**
|
|
49
|
+
|
|
50
|
+
- `catch` blocks that return default values instead of throwing or propagating
|
|
51
|
+
- `try/catch` around critical operations where the function signature suggests it will throw on failure
|
|
52
|
+
- Optional chaining (`?.`) chains that silently return `undefined` for important data
|
|
53
|
+
|
|
54
|
+
**Unexpected returns:**
|
|
55
|
+
|
|
56
|
+
- Function name suggests returning one type but actually returns something different
|
|
57
|
+
- `get*` functions that return `null` or `undefined` instead of throwing when the entity doesn't exist
|
|
58
|
+
- Boolean-named functions (`is*`, `has*`) that return non-boolean values
|
|
59
|
+
|
|
60
|
+
**Hidden coupling:**
|
|
61
|
+
|
|
62
|
+
- Functions that read from or write to module-level state
|
|
63
|
+
- Functions that depend on call order (must call A before B)
|
|
64
|
+
- Functions that modify shared caches or memoization stores
|
|
65
|
+
|
|
66
|
+
### 3. Scan Non-Pure Exports Too
|
|
67
|
+
|
|
68
|
+
Quickly scan action-oriented exports (`save*`, `update*`, etc.) at a glance for **hidden secondary effects**:
|
|
69
|
+
|
|
70
|
+
- `saveUser()` that also sends a welcome email
|
|
71
|
+
- `deleteProject()` that also archives data elsewhere
|
|
72
|
+
- `updateConfig()` that also restarts a service
|
|
73
|
+
|
|
74
|
+
### 4. Count Callsites
|
|
75
|
+
|
|
76
|
+
For each finding, use Grep to count how many files import or call the misleading function. More callsites = higher impact.
|
|
77
|
+
|
|
78
|
+
### 5. Assess Severity
|
|
79
|
+
|
|
80
|
+
- **high**: The mismatch could cause data corruption, silent failures, security issues, or affects >10 callsites
|
|
81
|
+
- **medium**: The mismatch leads to unexpected behavior that would cause bugs, or affects 3–10 callsites
|
|
82
|
+
- **low**: Minor naming inconsistency, affects few callsites, unlikely to cause bugs
|
|
83
|
+
|
|
84
|
+
## Output
|
|
85
|
+
|
|
86
|
+
Return your findings as a JSON code block in your response, using this format:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"findings": [
|
|
91
|
+
{
|
|
92
|
+
"type": "misleading-api",
|
|
93
|
+
"function": "functionName",
|
|
94
|
+
"file": "path/to/file.ts",
|
|
95
|
+
"name_implies": "what the name suggests the function does",
|
|
96
|
+
"actually_does": "what it actually does (with specific line numbers for the divergent behavior)",
|
|
97
|
+
"severity": "high|medium|low",
|
|
98
|
+
"callsite_count": 0
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"stats": {
|
|
102
|
+
"exports_scanned": 0,
|
|
103
|
+
"deep_reads": 0,
|
|
104
|
+
"findings_count": 0
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
After the JSON block, return a **brief one-paragraph summary** of your findings. Include the number of findings and the most notable misleading API discovered.
|
|
110
|
+
|
|
111
|
+
## Important Notes
|
|
112
|
+
|
|
113
|
+
- **Read full implementations** — don't just look at the first few lines. Side effects often live at the end of functions or in helper calls.
|
|
114
|
+
- Be conservative with "low" severity findings — only flag things that would actually mislead a coding agent into writing incorrect code
|
|
115
|
+
- **Skip type exports** (type, interface, enum) — these can't have behavioral mismatches
|
|
116
|
+
- **Skip trivial getters** that just return a property — focus on functions with actual logic
|
|
117
|
+
- When a function delegates to a helper, read the helper too if the function name implies purity but the helper name suggests side effects
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Session Log Analysis Prompt
|
|
2
|
+
|
|
3
|
+
You are analyzing a filtered Claude Code session transcript to find instances where Claude got confused about **this specific codebase**. The transcript has been preprocessed — each line is a JSON object with `type` ("user" or "assistant"), `ts` (timestamp), and `content`.
|
|
4
|
+
|
|
5
|
+
## Your Task
|
|
6
|
+
|
|
7
|
+
Read the session file provided and identify moments where Claude demonstrated confusion that a `.claude/rules/` rule could have prevented.
|
|
8
|
+
|
|
9
|
+
## Signal Types to Detect
|
|
10
|
+
|
|
11
|
+
1. **USER_CORRECTION** — The user corrects Claude's approach, code, or assumption. Look for: "no, that's not how...", "actually...", "you need to use X not Y", "that's wrong", explicit disagreement.
|
|
12
|
+
|
|
13
|
+
2. **RE_EDIT** — Claude edits the same file multiple times in quick succession, indicating the first attempt was wrong. Look for: multiple Edit/Write tool calls targeting the same file path with different content.
|
|
14
|
+
|
|
15
|
+
3. **FAILED_PIVOT** — A tool call fails (test failure, bash error, type error) and Claude switches to a different approach. Look for: error in tool result followed by a new strategy in the next assistant message.
|
|
16
|
+
|
|
17
|
+
4. **WRONG_ASSUMPTION** — Claude's thinking or text reveals an incorrect assumption about the codebase. Look for: statements that contradict later evidence, "I assumed...", reasoning that turns out wrong.
|
|
18
|
+
|
|
19
|
+
5. **TRIBAL_KNOWLEDGE** — The user provides context Claude didn't have but needed. Look for: the user explaining how something works, why something is the way it is, historical context, non-obvious conventions.
|
|
20
|
+
|
|
21
|
+
6. **APPROACH_PIVOT** — Claude abandons a call chain mid-stream and tries something completely different (without an explicit error triggering it). Look for: sudden topic/strategy shifts in assistant messages.
|
|
22
|
+
|
|
23
|
+
## Rules for Reporting
|
|
24
|
+
|
|
25
|
+
- **Only report codebase-specific confusion.** Generic programming mistakes (typos, syntax errors, forgetting imports for standard libraries) are NOT worth reporting.
|
|
26
|
+
- **Only report findings where a `.claude/rules/` rule would prevent the confusion.** If the confusion is situational or one-off, skip it.
|
|
27
|
+
- **Maximum 5 findings per session.** Prioritize the strongest, most rule-worthy signals.
|
|
28
|
+
- **Be precise about file paths.** If the confusion relates to specific files, include them.
|
|
29
|
+
|
|
30
|
+
## Output Format
|
|
31
|
+
|
|
32
|
+
Return a JSON array (no markdown fences, no explanation outside the array). Each element:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"signal": "USER_CORRECTION | RE_EDIT | FAILED_PIVOT | WRONG_ASSUMPTION | TRIBAL_KNOWLEDGE | APPROACH_PIVOT",
|
|
37
|
+
"summary": "One sentence describing what went wrong",
|
|
38
|
+
"evidence": "Brief quote or paraphrase from the session proving this happened",
|
|
39
|
+
"file_path": "path/to/relevant/file.ts or null if not file-specific",
|
|
40
|
+
"topic": "kebab-case-topic-label",
|
|
41
|
+
"rule_worthy": true,
|
|
42
|
+
"rule_worthy_reason": "Why a rule would prevent this from recurring"
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If the session contains no codebase-specific confusion worth documenting, return an empty array: `[]`
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Removes cached preprocessed session files.
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
OUTPUT_DIR="/tmp/cc-session-analysis"
|
|
6
|
+
|
|
7
|
+
if [ -d "$OUTPUT_DIR" ]; then
|
|
8
|
+
rm -rf "$OUTPUT_DIR"
|
|
9
|
+
echo "Cleaned up $OUTPUT_DIR"
|
|
10
|
+
else
|
|
11
|
+
echo "Nothing to clean up ($OUTPUT_DIR does not exist)"
|
|
12
|
+
fi
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Session log filter for codeyam-memory skill.
|
|
2
|
+
# Strips progress/system/queue records, compresses tool inputs to 300 chars,
|
|
3
|
+
# tool results to 500 chars, thinking to 1000 chars. Output is compact JSONL.
|
|
4
|
+
|
|
5
|
+
select(.type == "user" or .type == "assistant") |
|
|
6
|
+
if .type == "assistant" then
|
|
7
|
+
{
|
|
8
|
+
type: "assistant",
|
|
9
|
+
ts: .timestamp,
|
|
10
|
+
content: [
|
|
11
|
+
(.message.content[]? |
|
|
12
|
+
if .type == "text" then
|
|
13
|
+
{t: "text", text}
|
|
14
|
+
elif .type == "thinking" then
|
|
15
|
+
{t: "think", thinking: (.thinking // "" | if length > 1000 then (.[0:1000] + "...[truncated]") else . end)}
|
|
16
|
+
elif .type == "tool_use" then
|
|
17
|
+
{t: "tool", name, input: (.input | tostring | if length > 300 then .[0:300] + "..." else . end)}
|
|
18
|
+
else empty
|
|
19
|
+
end
|
|
20
|
+
)
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
elif .type == "user" then
|
|
24
|
+
{
|
|
25
|
+
type: "user",
|
|
26
|
+
ts: .timestamp,
|
|
27
|
+
content: (
|
|
28
|
+
if (.message.content | type) == "string" then
|
|
29
|
+
.message.content
|
|
30
|
+
elif (.message.content | type) == "array" then
|
|
31
|
+
[.message.content[]? |
|
|
32
|
+
if .type == "tool_result" then
|
|
33
|
+
{t: "result", id: .tool_use_id, err: (.is_error // false),
|
|
34
|
+
content: (.content | tostring | if length > 500 then .[0:500] + "...[truncated]" else . end)}
|
|
35
|
+
else
|
|
36
|
+
{t: "msg", text: (. | tostring | if length > 500 then .[0:500] + "...[truncated]" else . end)}
|
|
37
|
+
end
|
|
38
|
+
]
|
|
39
|
+
else
|
|
40
|
+
(.message.content | tostring | if length > 500 then .[0:500] + "...[truncated]" else . end)
|
|
41
|
+
end
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
else empty
|
|
45
|
+
end
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Preprocesses Claude Code session logs for the codeyam-memory skill.
|
|
3
|
+
#
|
|
4
|
+
# - Finds JSONL session files (>=10KB, last 30 days)
|
|
5
|
+
# - Excludes the current active session
|
|
6
|
+
# - Runs jq filter for 5-50x compression
|
|
7
|
+
# - Caches results in /tmp/cc-session-analysis/
|
|
8
|
+
# - Prints filtered file paths to stdout (one per line)
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
|
|
11
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
12
|
+
FILTER="$SCRIPT_DIR/filter.jq"
|
|
13
|
+
OUTPUT_DIR="/tmp/cc-session-analysis"
|
|
14
|
+
MIN_SIZE=10240 # 10KB
|
|
15
|
+
MAX_AGE_DAYS=30
|
|
16
|
+
MAX_SESSIONS=30 # Diminishing returns past this; keeps agent fleet manageable
|
|
17
|
+
JQ_TIMEOUT=30 # Seconds — skip files that take longer than this to filter
|
|
18
|
+
|
|
19
|
+
# --- Dependency check ---
|
|
20
|
+
if ! command -v jq &>/dev/null; then
|
|
21
|
+
echo "Error: jq is required but not installed." >&2
|
|
22
|
+
echo " macOS: brew install jq" >&2
|
|
23
|
+
echo " Ubuntu: sudo apt-get install jq" >&2
|
|
24
|
+
echo " Other: https://jqlang.github.io/jq/download/" >&2
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# --- Compute Claude project directory ---
|
|
29
|
+
PROJECT_DIR="$PWD"
|
|
30
|
+
# Claude Code replaces both / and . with - in the project hash
|
|
31
|
+
PROJECT_HASH=$(echo "$PROJECT_DIR" | sed 's|[/.]|-|g')
|
|
32
|
+
SESSION_DIR="$HOME/.claude/projects/$PROJECT_HASH"
|
|
33
|
+
|
|
34
|
+
if [ ! -d "$SESSION_DIR" ]; then
|
|
35
|
+
echo "No Claude session directory found at $SESSION_DIR" >&2
|
|
36
|
+
echo "This project may not have any Claude Code session history." >&2
|
|
37
|
+
exit 0
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
# --- Find session files ---
|
|
41
|
+
mkdir -p "$OUTPUT_DIR"
|
|
42
|
+
|
|
43
|
+
# Collect eligible session files: >=10KB, modified within last 30 days, .jsonl extension
|
|
44
|
+
# Sort by mtime (newest first) so the cap keeps the most recent sessions
|
|
45
|
+
ALL_SESSIONS=()
|
|
46
|
+
while IFS= read -r file; do
|
|
47
|
+
ALL_SESSIONS+=("$file")
|
|
48
|
+
done < <(find "$SESSION_DIR" -maxdepth 1 -name "*.jsonl" -size +"$MIN_SIZE"c -mtime -"$MAX_AGE_DAYS" -print0 2>/dev/null \
|
|
49
|
+
| xargs -0 stat -f "%m %N" 2>/dev/null \
|
|
50
|
+
| sort -rn \
|
|
51
|
+
| awk '{print $2}')
|
|
52
|
+
|
|
53
|
+
if [ ${#ALL_SESSIONS[@]} -eq 0 ]; then
|
|
54
|
+
exit 0
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# Cap to most recent N sessions
|
|
58
|
+
SESSIONS=("${ALL_SESSIONS[@]:0:$MAX_SESSIONS}")
|
|
59
|
+
if [ ${#ALL_SESSIONS[@]} -gt "$MAX_SESSIONS" ]; then
|
|
60
|
+
echo "Note: ${#ALL_SESSIONS[@]} sessions found, capping to $MAX_SESSIONS most recent" >&2
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
# --- Exclude current active session ---
|
|
64
|
+
# The newest file by mtime is likely the current session.
|
|
65
|
+
# If CLAUDE_SESSION_ID is set, use that for a more precise match.
|
|
66
|
+
NEWEST_FILE=""
|
|
67
|
+
NEWEST_MTIME=0
|
|
68
|
+
for file in "${SESSIONS[@]}"; do
|
|
69
|
+
mtime=$(stat -f "%m" "$file" 2>/dev/null || stat -c "%Y" "$file" 2>/dev/null || echo "0")
|
|
70
|
+
if [ "$mtime" -gt "$NEWEST_MTIME" ]; then
|
|
71
|
+
NEWEST_MTIME="$mtime"
|
|
72
|
+
NEWEST_FILE="$file"
|
|
73
|
+
fi
|
|
74
|
+
done
|
|
75
|
+
|
|
76
|
+
ACTIVE_SESSION=""
|
|
77
|
+
if [ -n "${CLAUDE_SESSION_ID:-}" ]; then
|
|
78
|
+
for file in "${SESSIONS[@]}"; do
|
|
79
|
+
if [[ "$(basename "$file" .jsonl)" == "$CLAUDE_SESSION_ID" ]]; then
|
|
80
|
+
ACTIVE_SESSION="$file"
|
|
81
|
+
break
|
|
82
|
+
fi
|
|
83
|
+
done
|
|
84
|
+
fi
|
|
85
|
+
# Fall back to newest file if no env var match
|
|
86
|
+
if [ -z "$ACTIVE_SESSION" ]; then
|
|
87
|
+
ACTIVE_SESSION="$NEWEST_FILE"
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
# --- Process each session ---
|
|
91
|
+
for file in "${SESSIONS[@]}"; do
|
|
92
|
+
# Skip active session
|
|
93
|
+
if [ "$file" = "$ACTIVE_SESSION" ]; then
|
|
94
|
+
continue
|
|
95
|
+
fi
|
|
96
|
+
|
|
97
|
+
uuid=$(basename "$file" .jsonl)
|
|
98
|
+
filtered="$OUTPUT_DIR/${uuid}.filtered.jsonl"
|
|
99
|
+
|
|
100
|
+
# Check cache: skip if filtered file exists and has a valid sentinel
|
|
101
|
+
if [ -f "$filtered" ]; then
|
|
102
|
+
first_line=$(head -1 "$filtered" 2>/dev/null || true)
|
|
103
|
+
if echo "$first_line" | jq -e '.processed_at' &>/dev/null; then
|
|
104
|
+
echo "$filtered"
|
|
105
|
+
continue
|
|
106
|
+
fi
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
# Run jq filter
|
|
110
|
+
source_size=$(stat -f "%z" "$file" 2>/dev/null || stat -c "%s" "$file" 2>/dev/null || echo "0")
|
|
111
|
+
sentinel=$(printf '{"processed_at":"%s","source_size":%s}' "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" "$source_size")
|
|
112
|
+
|
|
113
|
+
# Write sentinel as first line, then filtered content (with timeout)
|
|
114
|
+
jq_exit=0
|
|
115
|
+
{
|
|
116
|
+
echo "$sentinel"
|
|
117
|
+
if command -v timeout &>/dev/null; then
|
|
118
|
+
timeout "$JQ_TIMEOUT" jq -c -f "$FILTER" "$file" 2>/dev/null
|
|
119
|
+
elif command -v gtimeout &>/dev/null; then
|
|
120
|
+
gtimeout "$JQ_TIMEOUT" jq -c -f "$FILTER" "$file" 2>/dev/null
|
|
121
|
+
else
|
|
122
|
+
jq -c -f "$FILTER" "$file" 2>/dev/null
|
|
123
|
+
fi
|
|
124
|
+
} > "$filtered" || jq_exit=$?
|
|
125
|
+
|
|
126
|
+
if [ "$jq_exit" -eq 124 ]; then
|
|
127
|
+
echo "Warning: jq timed out after ${JQ_TIMEOUT}s on $(basename "$file") — skipping" >&2
|
|
128
|
+
rm -f "$filtered"
|
|
129
|
+
continue
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
# Only output if the file has content beyond the sentinel
|
|
133
|
+
line_count=$(wc -l < "$filtered" | tr -d ' ')
|
|
134
|
+
if [ "$line_count" -gt 1 ]; then
|
|
135
|
+
echo "$filtered"
|
|
136
|
+
else
|
|
137
|
+
rm -f "$filtered"
|
|
138
|
+
fi
|
|
139
|
+
done
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeyam/codeyam-cli",
|
|
3
|
-
"version": "0.1.0-staging.
|
|
3
|
+
"version": "0.1.0-staging.ae0de75",
|
|
4
4
|
"description": "Local development CLI for CodeYam analysis",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"codeyam": "./codeyam-cli/src/codeyam-cli.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"postinstall": "node ./scripts/
|
|
10
|
+
"postinstall": "node ./scripts/npm-post-install.cjs && [ -f ./node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper ] && chmod +x ./node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper; [ -f ./node_modules/node-pty/prebuilds/darwin-x64/spawn-helper ] && chmod +x ./node_modules/node-pty/prebuilds/darwin-x64/spawn-helper; true"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@anthropic-ai/claude-code": "^2.1.7",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Post-install script — we used to finalize the CodeYam analyzer here,
|
|
5
|
+
* but that is now deferred to the `codeyam setup-simulations` step.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
console.error('');
|
|
9
|
+
console.error(' CodeYam CLI installed successfully!');
|
|
10
|
+
console.error('');
|
|
11
|
+
console.error(" Type 'codeyam' in your project directory to get started.");
|
|
12
|
+
console.error('');
|