@piex-dev/init 0.1.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/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # init
2
+
3
+ 引导式 `AGENTS.md` 生成 — 纯 prompt 包,安装后提供 `/init`。
4
+
5
+ ## 深度解读
6
+
7
+ - 博客:https://piex.dev/zh/blogs/init/
8
+ - 源稿:[`docs/notes/init.md`](../../docs/notes/init.md)
9
+
10
+ ## 功能
11
+
12
+ - **/init 命令**:扫描仓库高信号源,创建或就地改进项目根 `AGENTS.md`
13
+ - **可选参数**:`/init focus on testing` 等,约束生成重点
14
+ - **零运行时**:无 extension、无工具覆盖,只分发 `prompts/init.md`
15
+
16
+ ```
17
+ init/
18
+ ├── package.json # pi.prompts → ./prompts
19
+ ├── README.md
20
+ └── prompts/
21
+ └── init.md # → /init
22
+ ```
23
+
24
+ ## 安装
25
+
26
+ ```bash
27
+ pi install npm:@piex-dev/init
28
+ # 本地开发
29
+ pi install -l packages/init
30
+ ```
31
+
32
+ ## 用法
33
+
34
+ ```bash
35
+ # 交互
36
+ /init
37
+ /init focus on monorepo packages and test commands
38
+
39
+ # 非交互
40
+ pi -p "/init" --no-session
41
+ ```
42
+
43
+ 写完后执行 `/reload`(或新开 session),pi 才会把新的 `AGENTS.md` 注入上下文。
44
+
45
+ ## 与 opencode / omp 的差异
46
+
47
+ | 能力 | opencode | oh-my-pi | @piex-dev/init |
48
+ |------|----------|----------|----------------|
49
+ | `/init` 生成 AGENTS.md | 内置 slash + prompt | 无 | pi prompt 包 |
50
+ | 多格式 context 发现 | AGENTS / CLAUDE 等 | 多 provider 加载 | 依赖 pi 原生加载 |
51
+ | 实现形态 | 内核 command 模板 | — | `prompts/init.md` only |
52
+ | 运行时依赖 | 内置 | — | 无 |
53
+
54
+ ## 来源
55
+
56
+ Prompt 结构借鉴 [OpenCode](https://github.com/anomalyco/opencode) 内置 `/init`(`initialize.txt`),改写为 pi 语境(`.pi/settings.json`、`/reload`、不提 `opencode.json`)。oh-my-pi 强化的是 context **加载**,不生成规则文件。
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@piex-dev/init",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "Guided AGENTS.md setup for pi — /init prompt template that scans the repo and creates or improves project agent rules",
6
+ "license": "MIT",
7
+ "author": "debugtalk",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/piex-dev/piex.git",
14
+ "directory": "packages/init"
15
+ },
16
+ "keywords": [
17
+ "pi",
18
+ "pi-package",
19
+ "pi-prompt",
20
+ "init",
21
+ "agents-md",
22
+ "AGENTS.md"
23
+ ],
24
+ "pi": {
25
+ "prompts": ["./prompts"]
26
+ },
27
+ "files": [
28
+ "prompts",
29
+ "README.md"
30
+ ]
31
+ }
@@ -0,0 +1,71 @@
1
+ ---
2
+ description: Guided AGENTS.md setup — scan the repo and create or improve project agent rules
3
+ argument-hint: "[focus or constraints]"
4
+ ---
5
+ Create or update `AGENTS.md` for this repository (project root / current working directory).
6
+
7
+ The goal is a compact instruction file that helps future pi sessions avoid mistakes and ramp up quickly. Every line should answer: "Would an agent likely miss this without help?" If not, leave it out.
8
+
9
+ User-provided focus or constraints (honor these):
10
+ $ARGUMENTS
11
+
12
+ ## How to investigate
13
+
14
+ Read the highest-value sources first:
15
+ - `README*`, root manifests, workspace config, lockfiles
16
+ - build, test, lint, formatter, typecheck, and codegen config
17
+ - CI workflows and pre-commit / task runner config
18
+ - existing instruction files (`AGENTS.md`, `CLAUDE.md`, `.cursor/rules/`, `.cursorrules`, `.github/copilot-instructions.md`, `.omp/AGENTS.md`)
19
+ - repo-local pi config such as `.pi/settings.json` and installed pi packages
20
+
21
+ If architecture is still unclear after reading config and docs, inspect a small number of representative code files to find the real entrypoints, package boundaries, and execution flow. Prefer reading the files that explain how the system is wired together over random leaf files.
22
+
23
+ Prefer executable sources of truth over prose. If docs conflict with config or scripts, trust the executable source and only keep what you can verify.
24
+
25
+ ## What to extract
26
+
27
+ Look for the highest-signal facts for an agent working in this repo:
28
+ - exact developer commands, especially non-obvious ones
29
+ - how to run a single test, a single package, or a focused verification step
30
+ - required command order when it matters, such as `lint -> typecheck -> test`
31
+ - monorepo or multi-package boundaries, ownership of major directories, and the real app/library entrypoints
32
+ - framework or toolchain quirks: generated code, migrations, codegen, build artifacts, special env loading, dev servers, infra deploy flow
33
+ - repo-specific style or workflow conventions that differ from defaults
34
+ - testing quirks: fixtures, integration test prerequisites, snapshot workflows, required services, flaky or expensive suites
35
+ - important constraints from existing instruction files worth preserving
36
+
37
+ Good `AGENTS.md` content is usually hard-earned context that took reading multiple files to infer.
38
+
39
+ ## Questions
40
+
41
+ Only ask the user questions if the repo cannot answer something important. Prefer one short batch at most.
42
+
43
+ Good questions:
44
+ - undocumented team conventions
45
+ - branch / PR / release expectations
46
+ - missing setup or test prerequisites that are known but not written down
47
+
48
+ Do not ask about anything the repo already makes clear.
49
+
50
+ ## Writing rules
51
+
52
+ Include only high-signal, repo-specific guidance such as:
53
+ - exact commands and shortcuts the agent would otherwise guess wrong
54
+ - architecture notes that are not obvious from filenames
55
+ - conventions that differ from language or framework defaults
56
+ - setup requirements, environment quirks, and operational gotchas
57
+ - references to existing instruction sources that matter
58
+
59
+ Exclude:
60
+ - generic software advice
61
+ - long tutorials or exhaustive file trees
62
+ - obvious language conventions
63
+ - speculative claims or anything you could not verify
64
+
65
+ When in doubt, omit.
66
+
67
+ Prefer short sections and bullets. If the repo is simple, keep the file simple. If the repo is large, summarize the few structural facts that actually change how an agent should work.
68
+
69
+ If `AGENTS.md` already exists, improve it in place rather than rewriting blindly. Preserve verified useful guidance, delete fluff or stale claims, and reconcile it with the current codebase.
70
+
71
+ Write the file with the `write` or `edit` tool. After writing, tell the user to run `/reload` (or start a new session) so pi picks up the updated context file.