@dotdotgod/pi 0.1.21
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/LICENSE +94 -0
- package/README.md +120 -0
- package/extensions/context-metrics/utils.ts +66 -0
- package/extensions/load-project/README.md +44 -0
- package/extensions/load-project/index.ts +76 -0
- package/extensions/load-project/utils.ts +338 -0
- package/extensions/plan-mode/README.md +65 -0
- package/extensions/plan-mode/index.ts +830 -0
- package/extensions/plan-mode/utils.ts +747 -0
- package/package.json +65 -0
- package/skills/project-initializer/SKILL.md +66 -0
- package/skills/project-initializer/agents/openai.yaml +4 -0
- package/skills/project-initializer/references/agent-docs.md +25 -0
- package/skills/project-initializer/scripts/init_project.sh +344 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Elastic License 2.0 (ELv2)
|
|
2
|
+
|
|
3
|
+
Copyright 2026 JooYoung Kim
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
8
|
+
|
|
9
|
+
## Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
12
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
13
|
+
available, and prepare derivative works of the software, in each case subject
|
|
14
|
+
to the limitations and conditions below.
|
|
15
|
+
|
|
16
|
+
## Limitations
|
|
17
|
+
|
|
18
|
+
You may not provide the software to third parties as a hosted or managed
|
|
19
|
+
service, where the service provides users with access to any substantial set
|
|
20
|
+
of the features or functionality of the software.
|
|
21
|
+
|
|
22
|
+
You may not move, change, disable, or circumvent the license key
|
|
23
|
+
functionality in the software, and you may not remove or obscure any
|
|
24
|
+
functionality in the software that is protected by the license key.
|
|
25
|
+
|
|
26
|
+
You may not alter, remove, or obscure any licensing, copyright, or other
|
|
27
|
+
notices of the licensor in the software. Any use of the licensor's trademarks
|
|
28
|
+
is subject to applicable law.
|
|
29
|
+
|
|
30
|
+
## Patents
|
|
31
|
+
|
|
32
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
33
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
34
|
+
sale, import and have imported the software, in each case subject to the
|
|
35
|
+
limitations and conditions in this license. This license does not cover any
|
|
36
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
37
|
+
the software. If you or your company make any written claim that the software
|
|
38
|
+
infringes or contributes to infringement of any patent, your patent license
|
|
39
|
+
for the software granted under these terms ends immediately. If your company
|
|
40
|
+
makes such a claim, your patent license ends immediately for work on behalf
|
|
41
|
+
of your company.
|
|
42
|
+
|
|
43
|
+
## Notices
|
|
44
|
+
|
|
45
|
+
You must ensure that anyone who gets a copy of any part of the software from
|
|
46
|
+
you also gets a copy of these terms.
|
|
47
|
+
|
|
48
|
+
If you modify the software, you must include in any modified copies of the
|
|
49
|
+
software prominent notices stating that you have modified the software.
|
|
50
|
+
|
|
51
|
+
## No Other Rights
|
|
52
|
+
|
|
53
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
54
|
+
these terms.
|
|
55
|
+
|
|
56
|
+
## Termination
|
|
57
|
+
|
|
58
|
+
If you use the software in violation of these terms, such use is not
|
|
59
|
+
licensed, and your licenses will automatically terminate. If the licensor
|
|
60
|
+
provides you with a notice of your violation, and you cease all violation of
|
|
61
|
+
this license no later than 30 days after you receive that notice, your
|
|
62
|
+
licenses will be reinstated retroactively. However, if you violate these
|
|
63
|
+
terms after such reinstatement, any additional violation of these terms will
|
|
64
|
+
cause your licenses to terminate automatically and permanently.
|
|
65
|
+
|
|
66
|
+
## No Liability
|
|
67
|
+
|
|
68
|
+
*As far as the law allows, the software comes as is, without any warranty or
|
|
69
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
70
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
71
|
+
legal claim.*
|
|
72
|
+
|
|
73
|
+
## Definitions
|
|
74
|
+
|
|
75
|
+
The **licensor** is the entity offering these terms, and the **software** is
|
|
76
|
+
the software the licensor makes available under these terms, including any
|
|
77
|
+
portion of it.
|
|
78
|
+
|
|
79
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
80
|
+
|
|
81
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
82
|
+
organization that you work for, plus all organizations that have control over,
|
|
83
|
+
are under the control of, or are under common control with that organization.
|
|
84
|
+
**control** means ownership of substantially all the assets of an entity, or
|
|
85
|
+
the power to direct its management and policies by vote, contract, or
|
|
86
|
+
otherwise. Control can be direct or indirect.
|
|
87
|
+
|
|
88
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
89
|
+
these terms.
|
|
90
|
+
|
|
91
|
+
**use** means anything you do with the software requiring one of your
|
|
92
|
+
licenses.
|
|
93
|
+
|
|
94
|
+
**trademark** means trademarks, service marks, and similar rights.
|
package/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# @dotdotgod/pi
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@dotdotgod/pi) [](https://github.com/dotdotgod/dotdotgod-kit/tree/main/packages/pi) [](../../LICENSE)
|
|
4
|
+
|
|
5
|
+
> **Change a file, know what else must be checked.**
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
$ dotdotgod graph impact . --changed packages/cli/src/core.mjs --compact
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
docs:
|
|
13
|
+
- docs/spec/REFERENCE_EXPANSION.md (91; incoming:implemented_by, semantic_similarity)
|
|
14
|
+
- docs/test/REFERENCE_EXPANSION.md (65.3; verified_by, semantic_similarity)
|
|
15
|
+
- docs/spec/LOAD_PROJECT.md (35.8; related_doc, semantic_similarity)
|
|
16
|
+
|
|
17
|
+
tests:
|
|
18
|
+
- packages/cli/test/core.test.mjs (78.6; semantic_similarity, incoming:semantic_similarity, verified_by)
|
|
19
|
+
- packages/cli/test/e2e.test.mjs (51.4; verified_by)
|
|
20
|
+
|
|
21
|
+
files:
|
|
22
|
+
- packages/cli/src/core.mjs (100; changed-file)
|
|
23
|
+
- packages/pi/extensions/plan-mode/index.ts (45; implemented_by, semantic_similarity)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`graph impact` ranks the specs, tests, architecture notes, config docs, and source files most likely to matter for a change. `--compact` keeps the result agent-facing: grouped by docs/tests/files and annotated with the reasons each item is likely relevant. It uses the project-memory graph built from Markdown links, README routes, headings, traceability blocks, package metadata, memory areas, and deterministic routing hints.
|
|
27
|
+
|
|
28
|
+
Pi adapter for dotdotgod's context curation workflow. It gives Pi the most complete dotdotgod loop: initialize the fixed load-context surface, use explicit maintained graph links for impact-aware planning, execute verified steps, and archive completed work as future project memory.
|
|
29
|
+
|
|
30
|
+
Use this package when you want Pi to make repository work start from stable specs, tests, architecture, active plans, archive maps, and graph/cache metadata instead of raw chat history. During the loop, agents help keep README routes, traceability, plans, and archives current so `graph impact` quality stays useful over time.
|
|
31
|
+
|
|
32
|
+
## Start Here: Run the Project Initializer Skill
|
|
33
|
+
|
|
34
|
+
After installing the package, open Pi in your repository and ask it to initialize or normalize the project memory scaffold. The bundled skill is named `project-initializer`; it uses `dotdotgod init` when the CLI is available, but it also includes a shell fallback.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pi install npm:@dotdotgod/pi
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Use natural language in Pi:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
Initialize this project with dotdotgod.
|
|
44
|
+
Set up AGENTS.md, CLAUDE.md, CODEX.md, and docs folders.
|
|
45
|
+
Create a doc-first project baseline for this repository.
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
A good first-run flow is:
|
|
49
|
+
|
|
50
|
+
1. Install the package.
|
|
51
|
+
2. Start Pi in the target repository.
|
|
52
|
+
3. Ask: `Initialize this project with dotdotgod.`
|
|
53
|
+
4. Review the files the skill plans to create or skip.
|
|
54
|
+
5. Let the skill create the scaffold.
|
|
55
|
+
6. Run `/dd:load` to load bounded project memory.
|
|
56
|
+
7. Use `/plan` before implementation work.
|
|
57
|
+
|
|
58
|
+
## What You Get
|
|
59
|
+
|
|
60
|
+
- **Project initializer skill:** create `AGENTS.md`, thin `CLAUDE.md`/`CODEX.md`, docs indexes, active-plan space, archive map, and local memory/cache ignores.
|
|
61
|
+
- **Task-directed loading:** `/dd:load` starts from `dotdotgod load-snapshot` when available, then reads only relevant docs from the fixed memory surface.
|
|
62
|
+
- **Safe planning:** `/plan` keeps source/config changes blocked while the agent writes or updates durable task intent under `docs/plan/`.
|
|
63
|
+
- **Impact-aware context shaping:** Plan Mode can use `dotdotgod expand --with-impact` for explicit `[[...]]` refs and `expand --fuzzy --with-impact` for high-signal natural references from the maintained graph.
|
|
64
|
+
- **Execution continuity:** completed plan steps are reported with explicit `[DONE:n]` markers so progress survives long sessions and compaction.
|
|
65
|
+
- **Reusable history:** completed work moves to `docs/archive/plan/`, while `docs/archive/README.md` remains the lightweight history map.
|
|
66
|
+
- **Cross-agent conventions:** the same `AGENTS.md`, docs, plan, and archive structure works with dotdotgod's CLI, Claude Code, and Codex packages.
|
|
67
|
+
|
|
68
|
+
## The Memory Shape Initialized by the Skill
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
AGENTS.md # canonical working rules for agents
|
|
72
|
+
CLAUDE.md # thin Claude Code pointer to AGENTS.md
|
|
73
|
+
CODEX.md # thin Codex pointer to AGENTS.md
|
|
74
|
+
docs/
|
|
75
|
+
README.md # project documentation map
|
|
76
|
+
spec/README.md # behavior, requirements, product truth
|
|
77
|
+
arch/README.md # architecture, conventions, boundaries
|
|
78
|
+
test/README.md # verification strategy and smoke tests
|
|
79
|
+
plan/README.md # active local plans, ignored by git
|
|
80
|
+
archive/README.md # completed-work history map, ignored by git
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
By default, `docs/spec/**` has two roles: it is stable shared/fresh project memory, and it is the traceability-enforced behavior-spec path. Those knobs are separate: projects can customize memory classification with `memory.areas` and traceability enforcement with `traceability.required` / `traceability.exclude`.
|
|
84
|
+
|
|
85
|
+
## Graph and Bounded Loading
|
|
86
|
+
|
|
87
|
+
The Pi adapter relies on the CLI graph when available but does not ask agents to read a giant graph report. `load-snapshot` returns bounded cache status, graph size, memory areas, communities, and archive policy. `graph impact` and reference expansion use explicit maintained links to surface related specs, tests, source, and config for a change before broad scanning.
|
|
88
|
+
|
|
89
|
+
The graph uses more than traceability blocks: Markdown links, README routes, headings, package metadata, memory-area membership, commands, tests, and deterministic routing hints all contribute. Archive bodies are excluded by default; `docs/archive/README.md` is the map.
|
|
90
|
+
|
|
91
|
+
## Commands
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
/plan Toggle safe planning mode.
|
|
95
|
+
/todos Show tracked plan progress during execution.
|
|
96
|
+
/load Load project memory for the current repository.
|
|
97
|
+
/dd:load Stable namespaced alias for project memory loading.
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Included
|
|
101
|
+
|
|
102
|
+
- `project-initializer` skill: the starting point for `AGENTS.md`, thin agent entrypoints, docs folders, README indexes, and local memory/cache ignores.
|
|
103
|
+
- `plan-mode` extension: read-first planning mode with restricted tools, optional `--plan-extra-tools`, docs/plan writes, execution tracking, tiered hidden prompts, and `/todos`.
|
|
104
|
+
- `load-project` extension: read-only project context loading through `/load` and `/dd:load`.
|
|
105
|
+
|
|
106
|
+
## Local Development
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pi install /Users/dotdot/Workspace/dotdotgod/packages/pi
|
|
110
|
+
pnpm --filter @dotdotgod/pi run verify
|
|
111
|
+
pnpm --filter @dotdotgod/pi run pack:dry-run
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Learn More
|
|
115
|
+
|
|
116
|
+
See the [root README](../../README.md), [GitHub repository](https://github.com/dotdotgod/dotdotgod-kit), [`docs/concept/CONTEXT_CURATION.md`](../../docs/concept/CONTEXT_CURATION.md), [`docs/concept/CONTEXT_MECHANICS.md`](../../docs/concept/CONTEXT_MECHANICS.md), [`docs/spec/MEMORY_AREA_CONFIG.md`](../../docs/spec/MEMORY_AREA_CONFIG.md), and [`docs/spec/TRACEABILITY_CONFIG.md`](../../docs/spec/TRACEABILITY_CONFIG.md).
|
|
117
|
+
|
|
118
|
+
## Compared with Graphify-Style Memory
|
|
119
|
+
|
|
120
|
+
The Pi adapter focuses on workflow: initialize the project memory scaffold, load a bounded snapshot, plan before source edits, and archive completed work for future sessions. Graph/cache output is a compact map; detail still comes from targeted file reads.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { mkdirSync, appendFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { execSync } from "node:child_process";
|
|
5
|
+
|
|
6
|
+
export interface ContextMetricEvent {
|
|
7
|
+
event: string;
|
|
8
|
+
cwd: string;
|
|
9
|
+
data?: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function git(cwd: string, command: string): string | undefined {
|
|
13
|
+
try {
|
|
14
|
+
return execSync(`git ${command}`, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
15
|
+
} catch {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function defaultMetricsPath(cwd: string): string {
|
|
21
|
+
const stamp = new Date().toISOString().slice(0, 10).replace(/-/g, "");
|
|
22
|
+
return join(cwd, "docs", "archive", "report", "context-metrics", `${stamp}.jsonl`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function isContextDebugEnabled(getFlag: (name: string) => unknown): boolean {
|
|
26
|
+
return getFlag("dd-context-debug") === true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function recordContextMetric(
|
|
30
|
+
ctx: ExtensionContext,
|
|
31
|
+
getFlag: (name: string) => unknown,
|
|
32
|
+
event: string,
|
|
33
|
+
data: Record<string, unknown> = {},
|
|
34
|
+
): void {
|
|
35
|
+
if (!isContextDebugEnabled(getFlag)) return;
|
|
36
|
+
|
|
37
|
+
const configuredPath = getFlag("dd-context-debug-output");
|
|
38
|
+
const outputPath = typeof configuredPath === "string" && configuredPath.trim()
|
|
39
|
+
? configuredPath.trim()
|
|
40
|
+
: defaultMetricsPath(ctx.cwd);
|
|
41
|
+
const absolutePath = outputPath.startsWith("/") ? outputPath : join(ctx.cwd, outputPath);
|
|
42
|
+
const usage = ctx.getContextUsage();
|
|
43
|
+
const entry = {
|
|
44
|
+
event,
|
|
45
|
+
timestamp: new Date().toISOString(),
|
|
46
|
+
cwd: ctx.cwd,
|
|
47
|
+
usage: usage
|
|
48
|
+
? { tokens: usage.tokens ?? null, contextWindow: usage.contextWindow ?? null, percent: usage.percent ?? null }
|
|
49
|
+
: null,
|
|
50
|
+
git: {
|
|
51
|
+
commit: git(ctx.cwd, "rev-parse --short HEAD") ?? null,
|
|
52
|
+
dirty: Boolean(git(ctx.cwd, "status --short")),
|
|
53
|
+
},
|
|
54
|
+
...data,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
mkdirSync(dirname(absolutePath), { recursive: true });
|
|
59
|
+
appendFileSync(absolutePath, `${JSON.stringify(entry)}\n`);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (ctx.hasUI) {
|
|
62
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
63
|
+
ctx.ui.notify(`Context metrics debug write failed: ${message}`, "warning");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Load Project Extension
|
|
2
|
+
|
|
3
|
+
Pi extension that starts a read-only project memory loading turn for the current working directory.
|
|
4
|
+
|
|
5
|
+
See the workspace behavior contract in `docs/spec/LOAD_PROJECT.md` and the extension boundary notes in `docs/arch/EXTENSION_ARCHITECTURE.md`.
|
|
6
|
+
|
|
7
|
+
## Commands
|
|
8
|
+
|
|
9
|
+
- `/load` — load current project memory.
|
|
10
|
+
- `/dd:load` — stable namespaced alias for command-conflict avoidance.
|
|
11
|
+
|
|
12
|
+
## Behavior
|
|
13
|
+
|
|
14
|
+
The command checks for the expected dotdotgod scaffold, then sends a read-only loader prompt to the agent.
|
|
15
|
+
|
|
16
|
+
Baseline files and directories include:
|
|
17
|
+
|
|
18
|
+
- `AGENTS.md`
|
|
19
|
+
- `CLAUDE.md`
|
|
20
|
+
- `CODEX.md`
|
|
21
|
+
- `README.md`
|
|
22
|
+
- `docs/README.md`
|
|
23
|
+
- `docs/spec/`
|
|
24
|
+
- `docs/test/`
|
|
25
|
+
- `docs/arch/`
|
|
26
|
+
- `docs/plan/`
|
|
27
|
+
- `docs/archive/`
|
|
28
|
+
|
|
29
|
+
The agent is instructed to:
|
|
30
|
+
|
|
31
|
+
- start with `AGENTS.md`, `README.md`, and `docs/README.md` when available
|
|
32
|
+
- follow local `README.md` indexes
|
|
33
|
+
- follow domain directories such as `docs/<area>/<domain>/README.md`
|
|
34
|
+
- follow expanded convention directories such as `docs/arch/conventions/README.md`
|
|
35
|
+
- list `docs/plan` first, then selectively read relevant active plan files
|
|
36
|
+
- use `docs/archive/README.md` as the archive history map and avoid scanning archive bodies by default
|
|
37
|
+
- distinguish completed plan archives under `docs/archive/plan/` from temporary reports under `docs/archive/report/` when targeted archive lookup is needed
|
|
38
|
+
- summarize project purpose, working rules, commands, docs map, architecture/code conventions, active plans, relevant archives, and TODO/TBD items
|
|
39
|
+
|
|
40
|
+
## Notes
|
|
41
|
+
|
|
42
|
+
- The command itself does not modify files.
|
|
43
|
+
- `/load` may conflict with other extensions, so `/dd:load` is always registered as the stable dotdotgod alias.
|
|
44
|
+
- Future indexing/search behavior should extend this runtime entrypoint.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project Memory Loader Extension
|
|
3
|
+
*
|
|
4
|
+
* Provides /load and /dd:load commands for loading dotdotgod docs.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
8
|
+
import { recordContextMetric } from "../context-metrics/utils.js";
|
|
9
|
+
import { buildLoadPrompt, collectSnapshot, estimateTextMetrics, hasOtherLoadCommand, runDotdotgodLoadSnapshot } from "./utils.js";
|
|
10
|
+
|
|
11
|
+
async function runLoadCommand(pi: ExtensionAPI, ctx: ExtensionCommandContext, args: string, commandName: "load" | "dd:load") {
|
|
12
|
+
const snapshot = collectSnapshot(ctx.cwd);
|
|
13
|
+
const loadSnapshot = runDotdotgodLoadSnapshot(ctx.cwd);
|
|
14
|
+
const conflict = hasOtherLoadCommand(pi.getCommands());
|
|
15
|
+
|
|
16
|
+
if (ctx.hasUI && conflict) {
|
|
17
|
+
ctx.ui.notify(
|
|
18
|
+
"Another /load command was detected. dotdotgod provides /dd:load as the stable alias.",
|
|
19
|
+
"info",
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const prompt = buildLoadPrompt(ctx.cwd, args, snapshot, loadSnapshot);
|
|
24
|
+
const promptMetrics = estimateTextMetrics(prompt);
|
|
25
|
+
recordContextMetric(ctx, (name) => pi.getFlag(name), "load-project:before-send", {
|
|
26
|
+
commandName,
|
|
27
|
+
promptMetrics,
|
|
28
|
+
directorySummaryPaths: snapshot.directories.map((directory) => directory.path),
|
|
29
|
+
loadSnapshot: {
|
|
30
|
+
ok: loadSnapshot.ok,
|
|
31
|
+
command: loadSnapshot.command,
|
|
32
|
+
error: loadSnapshot.error,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
const deliverAs = ctx.isIdle() ? undefined : "followUp";
|
|
36
|
+
pi.sendUserMessage(prompt, deliverAs ? { deliverAs } : undefined);
|
|
37
|
+
pi.appendEntry("project-memory-load", {
|
|
38
|
+
commandName,
|
|
39
|
+
entryCount: ctx.sessionManager.getEntries().length,
|
|
40
|
+
promptMetrics,
|
|
41
|
+
loadSnapshot: {
|
|
42
|
+
ok: loadSnapshot.ok,
|
|
43
|
+
command: loadSnapshot.command,
|
|
44
|
+
error: loadSnapshot.error,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
recordContextMetric(ctx, (name) => pi.getFlag(name), "load-project:after-send", { commandName, deliverAs: deliverAs ?? "immediate" });
|
|
48
|
+
|
|
49
|
+
if (ctx.hasUI) {
|
|
50
|
+
const queued = deliverAs === "followUp" ? " It will run as a follow-up after the current turn finishes." : "";
|
|
51
|
+
ctx.ui.notify(`Started project memory loading with /${commandName}.${queued}`, "info");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default function loadProjectExtension(pi: ExtensionAPI): void {
|
|
56
|
+
pi.registerFlag("dd-context-debug", {
|
|
57
|
+
description: "Record dotdotgod context measurement debug events to a local JSONL file",
|
|
58
|
+
type: "boolean",
|
|
59
|
+
default: false,
|
|
60
|
+
});
|
|
61
|
+
pi.registerFlag("dd-context-debug-output", {
|
|
62
|
+
description: "Path for dotdotgod context measurement debug JSONL output",
|
|
63
|
+
type: "string",
|
|
64
|
+
default: "",
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
pi.registerCommand("load", {
|
|
68
|
+
description: "Load dotdotgod docs for the current project",
|
|
69
|
+
handler: async (args, ctx) => runLoadCommand(pi, ctx, args, "load"),
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
pi.registerCommand("dd:load", {
|
|
73
|
+
description: "Load dotdotgod docs for the current project (namespaced alias)",
|
|
74
|
+
handler: async (args, ctx) => runLoadCommand(pi, ctx, args, "dd:load"),
|
|
75
|
+
});
|
|
76
|
+
}
|