waypoint-codex 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/LICENSE +21 -0
- package/README.md +156 -0
- package/bin/waypoint.js +3 -0
- package/dist/src/cli.js +140 -0
- package/dist/src/core.js +605 -0
- package/dist/src/docs-index.js +95 -0
- package/dist/src/templates.js +34 -0
- package/dist/src/types.js +1 -0
- package/package.json +47 -0
- package/templates/.agents/skills/error-audit/SKILL.md +69 -0
- package/templates/.agents/skills/error-audit/references/error-patterns.md +37 -0
- package/templates/.agents/skills/observability-audit/SKILL.md +67 -0
- package/templates/.agents/skills/observability-audit/references/observability-patterns.md +35 -0
- package/templates/.agents/skills/planning/SKILL.md +133 -0
- package/templates/.agents/skills/ux-states-audit/SKILL.md +63 -0
- package/templates/.agents/skills/ux-states-audit/references/ux-patterns.md +34 -0
- package/templates/.codex/agents/code-health-reviewer.toml +14 -0
- package/templates/.codex/agents/code-reviewer.toml +14 -0
- package/templates/.codex/agents/docs-researcher.toml +14 -0
- package/templates/.codex/agents/plan-reviewer.toml +14 -0
- package/templates/.codex/config.toml +19 -0
- package/templates/.gitignore.snippet +3 -0
- package/templates/.waypoint/README.md +13 -0
- package/templates/.waypoint/SOUL.md +54 -0
- package/templates/.waypoint/agent-operating-manual.md +79 -0
- package/templates/.waypoint/agents/code-health-reviewer.md +87 -0
- package/templates/.waypoint/agents/code-reviewer.md +102 -0
- package/templates/.waypoint/agents/docs-researcher.md +73 -0
- package/templates/.waypoint/agents/plan-reviewer.md +86 -0
- package/templates/.waypoint/automations/README.md +18 -0
- package/templates/.waypoint/automations/docs-garden.toml +7 -0
- package/templates/.waypoint/automations/repo-health.toml +8 -0
- package/templates/.waypoint/config.toml +13 -0
- package/templates/.waypoint/rules/README.md +6 -0
- package/templates/.waypoint/scripts/build-docs-index.mjs +153 -0
- package/templates/.waypoint/scripts/prepare-context.mjs +174 -0
- package/templates/WORKSPACE.md +26 -0
- package/templates/docs/README.md +16 -0
- package/templates/docs/code-guide.md +31 -0
- package/templates/managed-agents-block.md +21 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { execSync } from "node:child_process";
|
|
5
|
+
import os from "node:os";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
import { findProjectRoot, writeDocsIndex } from "./build-docs-index.mjs";
|
|
10
|
+
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = path.dirname(__filename);
|
|
13
|
+
|
|
14
|
+
function detectProjectRoot() {
|
|
15
|
+
const scriptBasedRoot = findProjectRoot(path.resolve(__dirname, "../.."));
|
|
16
|
+
if (existsSync(path.join(scriptBasedRoot, ".waypoint", "config.toml"))) {
|
|
17
|
+
return scriptBasedRoot;
|
|
18
|
+
}
|
|
19
|
+
return findProjectRoot(process.cwd());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function ensureDir(dirPath) {
|
|
23
|
+
mkdirSync(dirPath, { recursive: true });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function safeExec(command, cwd) {
|
|
27
|
+
try {
|
|
28
|
+
return execSync(command, {
|
|
29
|
+
cwd,
|
|
30
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
31
|
+
encoding: "utf8",
|
|
32
|
+
}).trim();
|
|
33
|
+
} catch {
|
|
34
|
+
return "";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function collectNestedGitRepos(projectRoot) {
|
|
39
|
+
const repos = [];
|
|
40
|
+
|
|
41
|
+
function walk(currentDir) {
|
|
42
|
+
for (const entry of readdirSync(currentDir)) {
|
|
43
|
+
const fullPath = path.join(currentDir, entry);
|
|
44
|
+
let stats;
|
|
45
|
+
try {
|
|
46
|
+
stats = statSync(fullPath);
|
|
47
|
+
} catch {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (!stats.isDirectory()) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (entry === ".git") {
|
|
54
|
+
repos.push(path.dirname(fullPath));
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (["node_modules", ".next", "dist", "build", "__pycache__", ".waypoint"].includes(entry)) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
walk(fullPath);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
walk(projectRoot);
|
|
65
|
+
return repos.filter((repoPath) => path.resolve(repoPath) !== path.resolve(projectRoot));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function writeContextFile(contextDir, name, title, body) {
|
|
69
|
+
const filePath = path.join(contextDir, name);
|
|
70
|
+
const content = `# ${title}\n\n${body && body.trim().length > 0 ? body.trim() : "None."}\n`;
|
|
71
|
+
writeFileSync(filePath, content, "utf8");
|
|
72
|
+
return filePath;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function main() {
|
|
76
|
+
const projectRoot = detectProjectRoot();
|
|
77
|
+
const contextDir = path.join(projectRoot, ".waypoint", "context");
|
|
78
|
+
ensureDir(contextDir);
|
|
79
|
+
|
|
80
|
+
const docsIndexPath = writeDocsIndex(projectRoot);
|
|
81
|
+
|
|
82
|
+
const currentDatetimePath = writeContextFile(
|
|
83
|
+
contextDir,
|
|
84
|
+
"CURRENT_DATETIME.md",
|
|
85
|
+
"Current Datetime",
|
|
86
|
+
`Local timezone: ${Intl.DateTimeFormat().resolvedOptions().timeZone}\n\nCurrent local datetime: ${new Date().toString()}`
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const uncommittedChangesPath = writeContextFile(
|
|
90
|
+
contextDir,
|
|
91
|
+
"UNCOMMITTED_CHANGES.md",
|
|
92
|
+
"Uncommitted Changes",
|
|
93
|
+
`\`\`\`\n${safeExec("git diff --stat", projectRoot) || "No uncommitted changes."}\n\`\`\``
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const recentCommitsPath = writeContextFile(
|
|
97
|
+
contextDir,
|
|
98
|
+
"RECENT_COMMITS.md",
|
|
99
|
+
"Recent Commits",
|
|
100
|
+
`\`\`\`\n${safeExec("git log --format=%h%d %s (%cr) -20 --all", projectRoot) || "No recent commits found."}\n\`\`\``
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const nestedRepos = collectNestedGitRepos(projectRoot);
|
|
104
|
+
const nestedRepoSections = nestedRepos.map((repoPath) => {
|
|
105
|
+
const rel = path.relative(projectRoot, repoPath) || ".";
|
|
106
|
+
const branch = safeExec("git branch --show-current", repoPath) || "unknown";
|
|
107
|
+
const commits = safeExec("git log --format=%h %s (%cr) -10", repoPath) || "No recent commits found.";
|
|
108
|
+
return `## ${rel}\n\nBranch: ${branch}\n\n\`\`\`\n${commits}\n\`\`\``;
|
|
109
|
+
});
|
|
110
|
+
const nestedReposPath = writeContextFile(
|
|
111
|
+
contextDir,
|
|
112
|
+
"NESTED_REPOS.md",
|
|
113
|
+
"Nested Repositories",
|
|
114
|
+
nestedRepoSections.join("\n\n") || "No nested repositories found."
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const openPrs = safeExec(
|
|
118
|
+
"gh pr list --state open --author @me --limit 5 --json number,title,author,headRefName --template '{{range .}}#{{.number}} {{.title}} ({{.author.login}}) [{{.headRefName}}]\\n{{end}}'",
|
|
119
|
+
projectRoot
|
|
120
|
+
);
|
|
121
|
+
const mergedPrs = safeExec(
|
|
122
|
+
"gh pr list --state merged --author @me --limit 5 --json number,title,author,mergedAt --template '{{range .}}#{{.number}} {{.title}} ({{.author.login}}) merged {{timeago .mergedAt}}\\n{{end}}'",
|
|
123
|
+
projectRoot
|
|
124
|
+
);
|
|
125
|
+
const prsPath = writeContextFile(
|
|
126
|
+
contextDir,
|
|
127
|
+
"PULL_REQUESTS.md",
|
|
128
|
+
"Pull Requests",
|
|
129
|
+
[
|
|
130
|
+
"## Open PRs",
|
|
131
|
+
"",
|
|
132
|
+
"```",
|
|
133
|
+
openPrs || "No open PRs found.",
|
|
134
|
+
"```",
|
|
135
|
+
"",
|
|
136
|
+
"## Recently Merged PRs",
|
|
137
|
+
"",
|
|
138
|
+
"```",
|
|
139
|
+
mergedPrs || "No recently merged PRs found.",
|
|
140
|
+
"```",
|
|
141
|
+
].join("\n")
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
const manifestPath = path.join(contextDir, "MANIFEST.md");
|
|
145
|
+
const manifestLines = [
|
|
146
|
+
"# Waypoint Context Manifest",
|
|
147
|
+
"",
|
|
148
|
+
"Read every file listed below. This manifest is a required session-start context bundle.",
|
|
149
|
+
"",
|
|
150
|
+
"## Required generated files",
|
|
151
|
+
"",
|
|
152
|
+
`- \`${path.relative(projectRoot, currentDatetimePath)}\` — local datetime and timezone`,
|
|
153
|
+
`- \`${path.relative(projectRoot, uncommittedChangesPath)}\` — uncommitted change summary`,
|
|
154
|
+
`- \`${path.relative(projectRoot, recentCommitsPath)}\` — recent commits`,
|
|
155
|
+
`- \`${path.relative(projectRoot, nestedReposPath)}\` — recent commits in nested repositories`,
|
|
156
|
+
`- \`${path.relative(projectRoot, prsPath)}\` — open and recently merged pull requests`,
|
|
157
|
+
`- \`${path.relative(projectRoot, docsIndexPath)}\` — current docs index`,
|
|
158
|
+
"",
|
|
159
|
+
"## Stable source-of-truth files to read before this manifest",
|
|
160
|
+
"",
|
|
161
|
+
"- `.waypoint/SOUL.md`",
|
|
162
|
+
"- `.waypoint/agent-operating-manual.md`",
|
|
163
|
+
"- `WORKSPACE.md`",
|
|
164
|
+
"",
|
|
165
|
+
`Generated by: \`${path.relative(projectRoot, fileURLToPath(import.meta.url))}\``,
|
|
166
|
+
"",
|
|
167
|
+
];
|
|
168
|
+
writeFileSync(manifestPath, `${manifestLines.join("\n")}`, "utf8");
|
|
169
|
+
|
|
170
|
+
console.log(`Prepared Waypoint context in ${contextDir}`);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
main();
|
|
174
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Workspace
|
|
2
|
+
|
|
3
|
+
## Active Goal
|
|
4
|
+
|
|
5
|
+
Describe the main thing currently being built or changed.
|
|
6
|
+
|
|
7
|
+
## Current State
|
|
8
|
+
|
|
9
|
+
What is already true right now?
|
|
10
|
+
|
|
11
|
+
## In Progress
|
|
12
|
+
|
|
13
|
+
What is actively being worked on?
|
|
14
|
+
|
|
15
|
+
## Next
|
|
16
|
+
|
|
17
|
+
What are the next concrete steps?
|
|
18
|
+
|
|
19
|
+
## Parked
|
|
20
|
+
|
|
21
|
+
What is intentionally deferred?
|
|
22
|
+
|
|
23
|
+
## Done Recently
|
|
24
|
+
|
|
25
|
+
What meaningful progress just landed?
|
|
26
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Docs
|
|
2
|
+
|
|
3
|
+
Store durable project knowledge here.
|
|
4
|
+
|
|
5
|
+
Each document that should be routable by Codex needs YAML frontmatter:
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
---
|
|
9
|
+
summary: One-line description
|
|
10
|
+
read_when:
|
|
11
|
+
- keyword or task cue
|
|
12
|
+
---
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`DOCS_INDEX.md` is generated from the docs that include this frontmatter.
|
|
16
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: Repository coding conventions — correctness, explicit error handling, maintainability, and testing discipline
|
|
3
|
+
read_when:
|
|
4
|
+
- writing code
|
|
5
|
+
- implementing a feature
|
|
6
|
+
- fixing a bug
|
|
7
|
+
- updating tests
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Code Guide
|
|
11
|
+
|
|
12
|
+
## Core rules
|
|
13
|
+
|
|
14
|
+
- Prefer explicit behavior over clever shortcuts.
|
|
15
|
+
- Keep changes scoped and reviewable.
|
|
16
|
+
- Update docs when durable behavior changes.
|
|
17
|
+
- Validate external data at boundaries.
|
|
18
|
+
- Do not swallow errors silently.
|
|
19
|
+
|
|
20
|
+
## Testing
|
|
21
|
+
|
|
22
|
+
- Run the smallest relevant verification first.
|
|
23
|
+
- Add or update tests when behavior changes.
|
|
24
|
+
- If tests cannot be run, say exactly why.
|
|
25
|
+
|
|
26
|
+
## Maintainability
|
|
27
|
+
|
|
28
|
+
- Reuse existing patterns where they are healthy.
|
|
29
|
+
- Do not introduce hidden fallback behavior without making it visible.
|
|
30
|
+
- Prefer clear names and clear module boundaries over compact code.
|
|
31
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!-- waypoint:start -->
|
|
2
|
+
# Waypoint
|
|
3
|
+
|
|
4
|
+
This repository uses Waypoint as its Codex operating system.
|
|
5
|
+
|
|
6
|
+
Before doing substantial work:
|
|
7
|
+
1. Run `node .waypoint/scripts/prepare-context.mjs`
|
|
8
|
+
2. Read `.waypoint/SOUL.md`
|
|
9
|
+
3. Read `.waypoint/agent-operating-manual.md`
|
|
10
|
+
4. Read `WORKSPACE.md`
|
|
11
|
+
5. Read `.waypoint/context/MANIFEST.md`
|
|
12
|
+
6. Read every file listed in the manifest
|
|
13
|
+
|
|
14
|
+
This is mandatory, not optional. Do not skip the context refresh or skip files in the manifest.
|
|
15
|
+
|
|
16
|
+
Working rules:
|
|
17
|
+
- Keep `WORKSPACE.md` current as the live execution state
|
|
18
|
+
- Update `docs/` when behavior or durable project knowledge changes
|
|
19
|
+
- Use the repo-local skills Waypoint ships for structured workflows when relevant
|
|
20
|
+
- Treat the generated context bundle as required session bootstrap, not optional reference material
|
|
21
|
+
<!-- waypoint:end -->
|