file-brief 2.0.0

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/install.ps1 ADDED
@@ -0,0 +1,59 @@
1
+ # =============================================================================
2
+ # install.ps1 — Install the file-brief skill into one or more agent
3
+ # skill homes (OpenAI Codex, Claude Code, DeepSeek Harness, shared ~/.agents).
4
+ #
5
+ # Usage (from the repository root):
6
+ # powershell -ExecutionPolicy Bypass -File .\install.ps1 # all homes
7
+ # powershell -ExecutionPolicy Bypass -File .\install.ps1 -Target codex
8
+ # powershell -ExecutionPolicy Bypass -File .\install.ps1 -Target claude
9
+ # powershell -ExecutionPolicy Bypass -File .\install.ps1 -Target dsh,agents
10
+ #
11
+ # Targets: codex | claude | dsh | agents | all
12
+ # =============================================================================
13
+ param(
14
+ [ValidateSet("codex", "claude", "dsh", "agents", "all")]
15
+ [string]$Target = "all"
16
+ )
17
+
18
+ $ErrorActionPreference = "Stop"
19
+
20
+ $repositoryRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
21
+ $source = Join-Path $repositoryRoot "skills\file-brief"
22
+ if (-not (Test-Path -LiteralPath (Join-Path $source "SKILL.md"))) {
23
+ Write-Error "Skill source not found at $source. Run this script from the repository root."
24
+ exit 1
25
+ }
26
+
27
+ function Install-Skill($destinationRoot, [string]$label) {
28
+ $destination = Join-Path $destinationRoot "file-brief"
29
+ New-Item -ItemType Directory -Path $destinationRoot -Force | Out-Null
30
+ if (Test-Path -LiteralPath $destination) {
31
+ Remove-Item -LiteralPath $destination -Recurse -Force
32
+ }
33
+ Copy-Item -LiteralPath $source -Destination $destination -Recurse
34
+ Write-Host "installed -> $destination ($label)"
35
+ }
36
+
37
+ $targets = @()
38
+ if ($Target -eq "all") {
39
+ $targets = @("codex", "claude", "dsh", "agents")
40
+ } else {
41
+ $targets = $Target -split ","
42
+ }
43
+
44
+ $codexHome = if ($env:CODEX_HOME) { $env:CODEX_HOME } else { Join-Path $HOME ".codex" }
45
+ $claudeHome = Join-Path $HOME ".claude"
46
+ $dshHome = if ($env:DSH_HOME) { $env:DSH_HOME } else { Join-Path $HOME ".dsh" }
47
+ $agentsHome = if ($env:DSH_AGENTS_HOME) { $env:DSH_AGENTS_HOME } else { Join-Path $HOME ".agents" }
48
+
49
+ foreach ($target in $targets) {
50
+ switch ($target) {
51
+ "codex" { Install-Skill (Join-Path $codexHome "skills") "OpenAI Codex" }
52
+ "claude" { Install-Skill (Join-Path $claudeHome "skills") "Claude Code" }
53
+ "dsh" { Install-Skill (Join-Path $dshHome "skills") "DeepSeek Harness" }
54
+ "agents" { Install-Skill (Join-Path $agentsHome "skills") "shared ~/.agents" }
55
+ }
56
+ }
57
+
58
+ Write-Host ""
59
+ Write-Host "Done. Start a new agent session so the skill list reloads."
package/install.sh ADDED
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env bash
2
+ # =============================================================================
3
+ # install.sh — Install the file-brief skill into one or more agent
4
+ # skill homes (OpenAI Codex, Claude Code, DeepSeek Harness, shared ~/.agents).
5
+ #
6
+ # Usage (from the repository root):
7
+ # ./install.sh # all homes
8
+ # ./install.sh codex # one target
9
+ # ./install.sh dsh agents # multiple targets
10
+ #
11
+ # Targets: codex | claude | dsh | agents | all
12
+ # =============================================================================
13
+ set -euo pipefail
14
+
15
+ repository_root="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
+ source_dir="$repository_root/skills/file-brief"
17
+
18
+ if [[ ! -f "$source_dir/SKILL.md" ]]; then
19
+ echo "error: skill source not found at $source_dir" >&2
20
+ echo "run this script from the repository root" >&2
21
+ exit 1
22
+ fi
23
+
24
+ targets=("$@")
25
+ if [[ ${#targets[@]} -eq 0 ]] || [[ "${targets[0]}" == "all" ]]; then
26
+ targets=(codex claude dsh agents)
27
+ fi
28
+
29
+ codex_home="${CODEX_HOME:-$HOME/.codex}"
30
+ claude_home="$HOME/.claude"
31
+ dsh_home="${DSH_HOME:-$HOME/.dsh}"
32
+ agents_home="${DSH_AGENTS_HOME:-$HOME/.agents}"
33
+
34
+ install_skill() {
35
+ local destination_root="$1"
36
+ local label="$2"
37
+ local destination="$destination_root/file-brief"
38
+ mkdir -p "$destination_root"
39
+ rm -rf "$destination"
40
+ cp -R "$source_dir" "$destination"
41
+ echo "installed -> $destination ($label)"
42
+ }
43
+
44
+ for target in "${targets[@]}"; do
45
+ case "$target" in
46
+ codex) install_skill "$codex_home/skills" "OpenAI Codex" ;;
47
+ claude) install_skill "$claude_home/skills" "Claude Code" ;;
48
+ dsh) install_skill "$dsh_home/skills" "DeepSeek Harness" ;;
49
+ agents) install_skill "$agents_home/skills" "shared ~/.agents" ;;
50
+ *)
51
+ echo "error: unknown target '$target' (codex | claude | dsh | agents | all)" >&2
52
+ exit 1
53
+ ;;
54
+ esac
55
+ done
56
+
57
+ echo ""
58
+ echo "Done. Start a new agent session so the skill list reloads."
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "file-brief",
3
+ "version": "2.0.0",
4
+ "description": "Agent-agnostic skill that turns task input files into reusable structural briefs and a per-task searchable index (OpenAI Codex, Claude Code, DeepSeek Harness)",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Zhiyi Zhao <zhiyi1.zhao@wur.nl>",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Zhiyi-Zhao/file-brief.git"
11
+ },
12
+ "homepage": "https://github.com/Zhiyi-Zhao/file-brief",
13
+ "bugs": {
14
+ "url": "https://github.com/Zhiyi-Zhao/file-brief/issues"
15
+ },
16
+ "keywords": [
17
+ "dsh-plugin",
18
+ "deepseek-harness",
19
+ "skill",
20
+ "codex",
21
+ "claude-code",
22
+ "file-catalog",
23
+ "data-analysis",
24
+ "preflight"
25
+ ],
26
+ "files": [
27
+ "skills/",
28
+ "cordis.patch.yml",
29
+ "install.ps1",
30
+ "install.sh"
31
+ ],
32
+ "engines": {
33
+ "node": ">=18"
34
+ },
35
+ "dsh": {
36
+ "bundle": {
37
+ "patch": "./cordis.patch.yml"
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: file-brief
3
+ description: Catalog local task-folder input files into reusable Markdown explanations and a searchable per-task index. Use whenever a task involves reading, inspecting, analyzing, transforming, or writing code against one or more local files or directories in any language or format — delimited tables (CSV/TSV with delimiter auto-detection), Excel, Parquet/Feather, JSON/JSONL/YAML/TOML, SQLite databases, ZIP/TAR/GZIP archives, XML/HTML documents, Jupyter notebooks, Stata datasets, RDS/RData, source code in common languages, text, Markdown, PDF, DOCX, images, or unknown binary files. Check the task-local catalog before probing source files, and refresh only missing or stale entries.
4
+ ---
5
+
6
+ # Catalog Input Files
7
+
8
+ Create and reuse structural explanations under the current large task folder. The skill is agent-platform agnostic: it works with any agent (OpenAI Codex, Claude Code, DeepSeek Harness, or any CLI-capable agent) that can run the Python entrypoint. Keep the skill code in the agent skill home, but never place generated catalogs under any agent home — they belong to the task folder.
9
+
10
+ ## Workflow
11
+
12
+ 1. Determine the large task root explicitly from the user's task or workspace. Use the current working directory only when no more specific root is available. Do not infer a Git root.
13
+ 2. Identify the local input files or directories involved in the task. When the task spans many formats or languages, catalog the whole task root once and reuse the explanations.
14
+ 3. Run `lookup` before writing ad-hoc inspection code:
15
+
16
+ ```bash
17
+ python "<skill-dir>/scripts/file_catalog.py" lookup --task-root "<task-root>" "<input-path>"
18
+ ```
19
+
20
+ 4. Read the returned Markdown explanation when the status is `fresh`, `unsupported`, or `error`. Treat `unsupported` and `error` documents as useful metadata with recorded limitations.
21
+ 5. Run `catalog` for `missing` or `stale` entries. Omit paths to catalog the entire task recursively:
22
+
23
+ ```bash
24
+ python "<skill-dir>/scripts/file_catalog.py" catalog --task-root "<task-root>" "<input-path>"
25
+ python "<skill-dir>/scripts/file_catalog.py" catalog --task-root "<task-root>"
26
+ ```
27
+
28
+ 6. Read only the generated explanation documents needed for the current task. Do not load the entire SQLite database or all source files into context.
29
+ 7. Use `search` for cross-folder discovery inside the same large task:
30
+
31
+ ```bash
32
+ python "<skill-dir>/scripts/file_catalog.py" search --task-root "<task-root>" "column-or-file-name"
33
+ ```
34
+
35
+ 8. Use `info` to check what is already cataloged before scanning:
36
+
37
+ ```bash
38
+ python "<skill-dir>/scripts/file_catalog.py" info --task-root "<task-root>"
39
+ ```
40
+
41
+ 9. Inspect a raw source file only when the catalog explicitly lacks information required by the task. Do not copy one-off probing logic into the task's production scripts.
42
+
43
+ For deterministic machine-readable results, add `--json` to any command. To skip specific names during scans, add `--exclude "name1,name2"` to `catalog` or `lookup`.
44
+
45
+ ## Catalog Location and Portability
46
+
47
+ Write generated content only under `<task-root>\.file-catalog`:
48
+
49
+ - `INDEX.md`: compact, human-readable file list.
50
+ - `documents\<relative-path-hash>.md`: one current explanation per task-relative path.
51
+ - `catalog.sqlite3`: searchable machine index.
52
+ - `.gitignore`: ignore SQLite, lock, and temporary files while leaving Markdown trackable.
53
+
54
+ Store both the task-relative path and the absolute path at scan time. Use the task-relative path as the stable identity so the task folder can move without losing matches.
55
+
56
+ ## Interpretation Rules
57
+
58
+ - Trust a `fresh` explanation instead of re-reading the source merely to rediscover its shape.
59
+ - Refresh `stale` entries before relying on them.
60
+ - Preserve structural names such as columns, keys, sheet names, headings, functions, classes, tables, and object names.
61
+ - Do not store raw rows, cell samples, paragraph excerpts, top categorical values, or source-code snippets.
62
+ - Treat statistics as sample-based unless the document explicitly says they are exact.
63
+ - Keep unknown or unavailable formats useful through generic metadata and explicit warnings.
64
+ - Follow the input language for generated explanations; use Chinese when language cannot be inferred.
65
+
66
+ ## Command Behavior
67
+
68
+ - `catalog --task-root ROOT [PATH...]`: recursively catalog the whole task when no paths are supplied; otherwise update only the specified in-root files/directories.
69
+ - `lookup --task-root ROOT PATH...`: report `fresh`, `stale`, `missing`, `unsupported`, or `error` without dumping source content.
70
+ - `search --task-root ROOT QUERY`: search paths, names, formats, summaries, fields, and structural identifiers.
71
+ - `info --task-root ROOT`: summarize cataloged entries by status and format.
72
+ - Add `--limit N` to cap printed result rows. Defaults are deliberately small to protect context.
73
+ - Add `--json` for machine-readable output; add `--exclude "a,b"` to skip names during scans.
74
+
75
+ ## Platform Installation
76
+
77
+ - OpenAI Codex: copy this folder to `<CODEX_HOME or ~/.codex>/skills/file-brief`.
78
+ - Claude Code: copy this folder to `~/.claude/skills/file-brief`.
79
+ - DeepSeek Harness: copy this folder to `~/.dsh/skills/file-brief` or `~/.agents/skills/file-brief` (project roots `.dsh/skills` and `.agents/skills` also work).
80
+ - Or run the repository's `install.ps1` / `install.sh` which installs to all configured agent homes.
81
+
82
+ The Python entrypoint resolves its companion `inspect_r_data.R` automatically. It checks `R_SCRIPT_EXE`, then `Rscript` on `PATH`, then common Windows R installation directories.
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "Catalog Input Files"
3
+ short_description: "Catalog task files into reusable structural explanations"
4
+ default_prompt: "Use $file-brief to catalog this task folder before analyzing its input files."
5
+
6
+ policy:
7
+ allow_implicit_invocation: true