@preapexis/pi-kit 1.0.10 → 1.0.12

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.
@@ -4,7 +4,8 @@ export default function (pi: ExtensionAPI): void {
4
4
  const prompts = [
5
5
  {
6
6
  name: "init",
7
- description: "Inspect the repository and create an onboarding report",
7
+ description:
8
+ "Inspect the repository and create or update AGENTS.md for future Pi sessions",
8
9
  usage: "/init"
9
10
  },
10
11
  {
@@ -1,4 +1,4 @@
1
- // cSpell:words Varun Gaikwad preapexis npm PowerShell
1
+ // cSpell:words preapexis npm PowerShell
2
2
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
3
3
 
4
4
  type EventContext = Parameters<Parameters<ExtensionAPI["on"]>[1]>[1];
@@ -31,11 +31,6 @@ export default function (pi: ExtensionAPI): void {
31
31
  label: "Update installed Pi packages/extensions",
32
32
  shell: "pi update --extensions"
33
33
  },
34
- {
35
- id: "kit-local",
36
- label: "Re-link this local PreApeXis kit",
37
- shell: "pi install -l ."
38
- },
39
34
  {
40
35
  id: "kit-npm",
41
36
  label: "Update PreApeXis Pi Kit from npm",
@@ -63,18 +58,19 @@ export default function (pi: ExtensionAPI): void {
63
58
  }
64
59
 
65
60
  function startUpdateStatus(ctx: EventContext, label: string): () => void {
61
+ const frames = ["◐", "◓", "◑", "◒"];
66
62
  let seconds = 0;
67
- let dots = 0;
63
+ let frame = 0;
68
64
 
69
- ctx.ui.setStatus(UPDATE_STATUS_KEY, `update: ${label}...`);
65
+ ctx.ui.setStatus(UPDATE_STATUS_KEY, `updating: ${label} ${frames[0]} 0s`);
70
66
 
71
67
  const timer = setInterval(() => {
72
68
  seconds += 1;
73
- dots = (dots + 1) % 4;
69
+ frame = (frame + 1) % frames.length;
74
70
 
75
71
  ctx.ui.setStatus(
76
72
  UPDATE_STATUS_KEY,
77
- `update: ${label}${".".repeat(dots)} ${seconds}s`
73
+ `updating: ${label} ${frames[frame]} ${seconds}s`
78
74
  );
79
75
  }, 1000);
80
76
 
@@ -176,15 +172,13 @@ export default function (pi: ExtensionAPI): void {
176
172
  const shell = shellCommand(option.shell);
177
173
  const stopStatus = startUpdateStatus(ctx, option.label);
178
174
 
179
- let result: Awaited<ReturnType<typeof pi.exec>>;
175
+ let result: Awaited<ReturnType<typeof pi.exec>> | undefined;
180
176
 
181
177
  try {
182
178
  result = await pi.exec(shell.command, shell.args, {
183
179
  cwd: ctx.cwd
184
180
  });
185
181
  } catch (error) {
186
- stopStatus();
187
-
188
182
  ctx.ui.notify(
189
183
  [
190
184
  `Update failed: ${option.label}`,
@@ -197,9 +191,14 @@ export default function (pi: ExtensionAPI): void {
197
191
  );
198
192
 
199
193
  return false;
194
+ } finally {
195
+ stopStatus();
200
196
  }
201
197
 
202
- stopStatus();
198
+ if (!result) {
199
+ ctx.ui.notify(`Update failed: ${option.label}`, "error");
200
+ return false;
201
+ }
203
202
 
204
203
  const stdout = result.stdout?.trim() ?? "";
205
204
  const stderr = result.stderr?.trim() ?? "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@preapexis/pi-kit",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "Personal Pi coding-agent kit with safety extensions, status UI, prompt workflows, skills, and themes.",
5
5
  "keywords": [
6
6
  "pi-package",
package/prompts/init.md CHANGED
@@ -1,43 +1,88 @@
1
1
  # Initialize Repository Understanding
2
2
 
3
- Initialize your understanding of this repository.
3
+ Your job is to deeply inspect this repository and create or update an `AGENTS.md` file that captures everything Pi needs to know to work effectively in this codebase.
4
4
 
5
- Do not edit files.
5
+ If the repository is large, inspect the most important files first and clearly mention what was not inspected.
6
6
 
7
- Your job is to inspect the project and produce a clear onboarding report for future work.
7
+ ## Goal
8
8
 
9
- If the repository is large, inspect the most important files first and clearly mention what was not inspected.
9
+ Create a useful `AGENTS.md` file so future Pi sessions can quickly understand:
10
+
11
+ - what this project does
12
+ - where important files live
13
+ - which commands to run
14
+ - which files are risky
15
+ - which files to inspect for common tasks
16
+ - what rules agents should follow
10
17
 
11
18
  ## Steps
12
19
 
13
- 1. Read the most important project files first:
14
- - README.md
15
- - AGENTS.md
16
- - package.json / pyproject.toml / go.mod / Cargo.toml / pom.xml / build.gradle
17
- - CONTRIBUTING.md
18
- - docs/
19
- - .github/workflows/
20
- - docker-compose.yml / Dockerfile
21
- - existing test configuration
22
-
23
- 2. Identify the project structure:
24
- - main application entry points
25
- - important directories
26
- - test locations
20
+ 1. **Check for an existing `AGENTS.md`**
21
+ - If it exists, read it first.
22
+ - Preserve anything that is still accurate and relevant.
23
+ - Do not remove existing project-specific rules unless they are clearly outdated.
24
+ - Merge new findings with the existing content.
25
+
26
+ 2. **Read the codebase thoroughly**
27
+
28
+ Read important files such as:
29
+ - `README.md`
30
+ - `package.json`
31
+ - `pyproject.toml`
32
+ - `go.mod`
33
+ - `Cargo.toml`
34
+ - `pom.xml`
35
+ - `build.gradle`
36
+ - `CONTRIBUTING.md`
37
+ - `docs/`
38
+ - `.github/workflows/`
39
+ - `docker-compose.yml`
40
+ - `Dockerfile`
41
+ - config files such as:
42
+ - `tsconfig.json`
43
+ - `vite.config.*`
44
+ - `next.config.*`
45
+ - `webpack.config.*`
46
+ - `eslint.config.*`
47
+ - `prettier.config.*`
48
+ - main source directories such as:
49
+ - `src/`
50
+ - `app/`
51
+ - `lib/`
52
+ - `packages/`
53
+ - `extensions/`
54
+ - `prompts/`
55
+ - `skills/`
56
+ - `themes/`
57
+ - test files and test configuration
58
+ - `.env.example` files only
59
+
60
+ Do not read actual `.env` files.
61
+
62
+ 3. **Identify the project structure**
63
+
64
+ Find:
65
+ - main entry points
66
+ - important directories and their purposes
27
67
  - config files
28
68
  - generated/build output directories
29
69
  - files that should be treated carefully
30
70
 
31
- 3. Detect the development workflow:
32
- - install command
33
- - dev command
34
- - build command
35
- - test command
36
- - lint command
37
- - typecheck command
38
- - formatting command
71
+ 4. **Detect the development workflow**
72
+
73
+ Find commands for:
74
+ - install
75
+ - dev
76
+ - build
77
+ - test
78
+ - lint
79
+ - typecheck
80
+ - format
81
+ - reload or local development, if applicable
82
+
83
+ 5. **Identify safety risks**
39
84
 
40
- 4. Identify safety risks:
85
+ Look for:
41
86
  - secrets or env files
42
87
  - deployment files
43
88
  - database migrations
@@ -47,52 +92,103 @@ If the repository is large, inspect the most important files first and clearly m
47
92
  - destructive scripts
48
93
  - commands that should require confirmation
49
94
 
50
- 5. Infer coding conventions:
95
+ 6. **Infer coding conventions**
96
+
97
+ Look for:
51
98
  - language/framework
52
99
  - naming style
53
100
  - error handling style
54
101
  - testing style
55
102
  - API conventions
56
103
  - dependency management
104
+ - state management and data flow, if applicable
105
+
106
+ 7. **Create a task-focused project map inside `AGENTS.md`**
107
+
108
+ Add a section that tells future agents where to look first for common tasks.
109
+
110
+ Example:
111
+ - For branding/UI changes, read `extensions/brand-ui.ts`.
112
+ - For update behavior, read `extensions/update.ts`.
113
+ - For safety behavior, read `extensions/safety.ts` and `extensions/git-guard.ts`.
114
+ - For prompt workflows, read `prompts/`.
115
+ - For skills, read `skills/<skill-name>/SKILL.md`.
57
116
 
58
117
  ## Output
59
118
 
60
- Return a repository onboarding report with these sections:
119
+ Create or update `AGENTS.md` in the repository root with this structure:
120
+
121
+ ```markdown
122
+ # Agent Guidelines: <project name>
123
+
124
+ ## Project Summary
125
+
126
+ Briefly explain what this project does.
127
+
128
+ ## Tech Stack
129
+
130
+ Languages, frameworks, libraries, and tools.
131
+
132
+ ## Project Map
133
+
134
+ | Path | Purpose |
135
+ | ------ | ---------------- |
136
+ | `src/` | Main source code |
137
+
138
+ ## Common Task Map
61
139
 
62
- # Repository Summary
140
+ | Task | Read These Files First |
141
+ | ---------------------- | ------------------------------------------------- |
142
+ | Change branding/UI | `extensions/brand-ui.ts`, `themes/` |
143
+ | Change update behavior | `extensions/update.ts` |
144
+ | Change safety behavior | `extensions/safety.ts`, `extensions/git-guard.ts` |
63
145
 
64
- Briefly explain what this project appears to do.
146
+ ## Development Commands
65
147
 
66
- # Tech Stack
148
+ | Command | Purpose |
149
+ | ---------- | --------- |
150
+ | `npm test` | Run tests |
67
151
 
68
- List the detected languages, frameworks, libraries, and tools.
152
+ ## Coding Conventions
69
153
 
70
- # Project Map
154
+ Naming, error handling, testing, API patterns, state management.
71
155
 
72
- Explain the important folders and files.
156
+ ## Safety Rules
73
157
 
74
- # Common Commands
158
+ Files, directories, and commands to treat carefully.
75
159
 
76
- List install, dev, build, test, lint, typecheck, and format commands if found.
160
+ ## Architecture Notes
77
161
 
78
- # Safety Notes
162
+ Key patterns, data flow, important abstractions.
79
163
 
80
- List files, directories, and commands that should be treated carefully.
164
+ ## Agent Rules
81
165
 
82
- # Coding Conventions
166
+ Repo-specific rules for AI agents working in this codebase.
83
167
 
84
- Summarize the project’s apparent patterns.
168
+ ## Open Questions
85
169
 
86
- # Recommended Agent Rules
170
+ Anything unclear or missing.
87
171
 
88
- Suggest repo-specific rules that should be added to AGENTS.md or team instructions.
172
+ ## Inspection Notes
89
173
 
90
- # Open Questions
174
+ Mention important areas that were not inspected.
175
+ ```
176
+ ````
91
177
 
92
- List anything unclear or missing.
178
+ ## Rules
93
179
 
94
- # Inspection Notes
180
+ - Be thorough but concise.
181
+ - `AGENTS.md` should be scannable.
182
+ - Do not include secrets, API keys, tokens, passwords, or sensitive data.
183
+ - Do not read actual `.env` files.
184
+ - If `AGENTS.md` already exists, merge with it instead of blindly replacing it.
185
+ - Focus on information that helps an AI agent write better code.
186
+ - Prefer specific file paths over vague explanations.
187
+ - Do not modify source code during initialization.
188
+ - Only create or update `AGENTS.md`.
189
+ - After creating or updating `AGENTS.md`, report:
190
+ - file path
191
+ - what sections were added or updated
192
+ - anything that was unclear
95
193
 
96
- Mention important files or areas that were not inspected.
97
194
 
98
- Do not modify the repository unless I explicitly ask.
@@ -0,0 +1,163 @@
1
+ # Repository Map Generator
2
+
3
+ Create or update a repository map for this project.
4
+
5
+ You may create or edit only this file:
6
+
7
+ ```txt
8
+ docs/PROJECT_MAP.md
9
+ ```
10
+
11
+ Do not edit source code, config files, prompts, skills, themes, or extensions.
12
+
13
+ ## Goal
14
+
15
+ Generate a useful project map so future agent sessions know which files to inspect for common tasks.
16
+
17
+ ## Steps
18
+
19
+ 1. Read existing project guidance:
20
+ - `AGENTS.md`
21
+ - `README.md`
22
+ - `package.json`
23
+ - existing `docs/PROJECT_MAP.md` if it exists
24
+
25
+ 2. Inspect the repository structure:
26
+ - top-level files
27
+ - `extensions/`
28
+ - `prompts/`
29
+ - `skills/`
30
+ - `themes/`
31
+ - `docs/`
32
+ - config files
33
+ - test files
34
+
35
+ 3. Identify important files and responsibilities.
36
+
37
+ 4. Create or update:
38
+
39
+ ```txt
40
+ docs/PROJECT_MAP.md
41
+ ```
42
+
43
+ 5. Keep the map practical and easy to scan.
44
+
45
+ ## Output file structure
46
+
47
+ Write `docs/PROJECT_MAP.md` using this structure:
48
+
49
+ ```md
50
+ # Project Map
51
+
52
+ ## Purpose
53
+
54
+ Short explanation of what this repository does.
55
+
56
+ ## Important Files
57
+
58
+ List important root files and what they are for.
59
+
60
+ ## Directory Map
61
+
62
+ Explain each important directory.
63
+
64
+ ## Extension Map
65
+
66
+ For each extension, explain:
67
+
68
+ - file path
69
+ - slash commands added, if any
70
+ - UI/status changes, if any
71
+ - safety behavior, if any
72
+ - when to edit this file
73
+
74
+ ## Prompt Map
75
+
76
+ For each prompt, explain:
77
+
78
+ - slash command
79
+ - file path
80
+ - purpose
81
+ - when to use it
82
+
83
+ ## Skill Map
84
+
85
+ For each skill, explain:
86
+
87
+ - skill name
88
+ - file path
89
+ - purpose
90
+ - when it should activate
91
+
92
+ ## Theme Map
93
+
94
+ List available themes and where they live.
95
+
96
+ ## Common Tasks
97
+
98
+ For each common task, list which files to read first.
99
+
100
+ Examples:
101
+
102
+ ### Change branding/UI
103
+
104
+ Read:
105
+
106
+ - `extensions/brand-ui.ts`
107
+ - `themes/`
108
+
109
+ ### Change update behavior
110
+
111
+ Read:
112
+
113
+ - `extensions/update.ts`
114
+
115
+ ### Change safety behavior
116
+
117
+ Read:
118
+
119
+ - `extensions/safety.ts`
120
+ - `extensions/git-guard.ts`
121
+
122
+ ### Change footer/status
123
+
124
+ Read:
125
+
126
+ - `extensions/status.ts`
127
+ - `extensions/usage-tracker.ts`
128
+
129
+ ### Change prompt workflows
130
+
131
+ Read:
132
+
133
+ - `extensions/prompts.ts`
134
+ - `prompts/`
135
+
136
+ ## Common Commands
137
+
138
+ List useful commands for development, testing, install, update, and reload.
139
+
140
+ ## Safety Notes
141
+
142
+ List files and commands that should be handled carefully.
143
+
144
+ ## Agent Rules
145
+
146
+ Add repo-specific rules future agents should follow.
147
+ ```
148
+
149
+ ## Rules
150
+
151
+ - Be specific.
152
+ - Prefer file paths over vague descriptions.
153
+ - Do not guess if a file was not inspected.
154
+ - If something is unclear, add it under `Open Questions`.
155
+ - Do not modify anything except `docs/PROJECT_MAP.md`.
156
+
157
+ ## Final response
158
+
159
+ After writing the file, summarize:
160
+
161
+ - whether the file was created or updated
162
+ - important sections added
163
+ - any open questions