@dougharness/cli 1.0.1
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/dist/ablate.d.ts +96 -0
- package/dist/ablate.js +440 -0
- package/dist/ablate.js.map +1 -0
- package/dist/apply.d.ts +2 -0
- package/dist/apply.js +19 -0
- package/dist/apply.js.map +1 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +80 -0
- package/dist/bin.js.map +1 -0
- package/dist/board-page.d.ts +15 -0
- package/dist/board-page.js +27 -0
- package/dist/board-page.js.map +1 -0
- package/dist/board-serve-process.d.ts +24 -0
- package/dist/board-serve-process.js +227 -0
- package/dist/board-serve-process.js.map +1 -0
- package/dist/board-serve.d.ts +9 -0
- package/dist/board-serve.js +302 -0
- package/dist/board-serve.js.map +1 -0
- package/dist/board.d.ts +6 -0
- package/dist/board.js +515 -0
- package/dist/board.js.map +1 -0
- package/dist/detect/fs.d.ts +6 -0
- package/dist/detect/fs.js +50 -0
- package/dist/detect/fs.js.map +1 -0
- package/dist/detect/index.d.ts +3 -0
- package/dist/detect/index.js +13 -0
- package/dist/detect/index.js.map +1 -0
- package/dist/detect/node.d.ts +3 -0
- package/dist/detect/node.js +179 -0
- package/dist/detect/node.js.map +1 -0
- package/dist/detect/python.d.ts +2 -0
- package/dist/detect/python.js +388 -0
- package/dist/detect/python.js.map +1 -0
- package/dist/detect/repo.d.ts +2 -0
- package/dist/detect/repo.js +102 -0
- package/dist/detect/repo.js.map +1 -0
- package/dist/detect/types.d.ts +98 -0
- package/dist/detect/types.js +2 -0
- package/dist/detect/types.js.map +1 -0
- package/dist/diff.d.ts +12 -0
- package/dist/diff.js +105 -0
- package/dist/diff.js.map +1 -0
- package/dist/generate/agents.d.ts +19 -0
- package/dist/generate/agents.js +184 -0
- package/dist/generate/agents.js.map +1 -0
- package/dist/generate/claude-md.d.ts +9 -0
- package/dist/generate/claude-md.js +111 -0
- package/dist/generate/claude-md.js.map +1 -0
- package/dist/generate/config.d.ts +51 -0
- package/dist/generate/config.js +155 -0
- package/dist/generate/config.js.map +1 -0
- package/dist/generate/proposal.d.ts +11 -0
- package/dist/generate/proposal.js +175 -0
- package/dist/generate/proposal.js.map +1 -0
- package/dist/generate/settings.d.ts +35 -0
- package/dist/generate/settings.js +213 -0
- package/dist/generate/settings.js.map +1 -0
- package/dist/generate/skills.d.ts +8 -0
- package/dist/generate/skills.js +264 -0
- package/dist/generate/skills.js.map +1 -0
- package/dist/init.d.ts +10 -0
- package/dist/init.js +69 -0
- package/dist/init.js.map +1 -0
- package/dist/trace.d.ts +9 -0
- package/dist/trace.js +106 -0
- package/dist/trace.js.map +1 -0
- package/node_modules/@dougharness/flow/.claude-plugin/plugin.json +10 -0
- package/node_modules/@dougharness/flow/LICENSE +21 -0
- package/node_modules/@dougharness/flow/agents/adversary-claude.md +33 -0
- package/node_modules/@dougharness/flow/agents/adversary.md +29 -0
- package/node_modules/@dougharness/flow/agents/implementer.md +23 -0
- package/node_modules/@dougharness/flow/agents/lead.md +35 -0
- package/node_modules/@dougharness/flow/agents/planner.md +70 -0
- package/node_modules/@dougharness/flow/agents/researcher.md +31 -0
- package/node_modules/@dougharness/flow/agents/reviewer.md +26 -0
- package/node_modules/@dougharness/flow/agents/verifier.md +24 -0
- package/node_modules/@dougharness/flow/lib/board.mjs +840 -0
- package/node_modules/@dougharness/flow/lib/code-index.mjs +629 -0
- package/node_modules/@dougharness/flow/lib/cost.mjs +392 -0
- package/node_modules/@dougharness/flow/lib/decisions.mjs +314 -0
- package/node_modules/@dougharness/flow/lib/embeddings.mjs +539 -0
- package/node_modules/@dougharness/flow/lib/land.mjs +219 -0
- package/node_modules/@dougharness/flow/lib/learn.mjs +742 -0
- package/node_modules/@dougharness/flow/lib/memory-import.mjs +145 -0
- package/node_modules/@dougharness/flow/lib/memory.mjs +1641 -0
- package/node_modules/@dougharness/flow/lib/models.mjs +148 -0
- package/node_modules/@dougharness/flow/lib/plan.mjs +773 -0
- package/node_modules/@dougharness/flow/lib/rehearse.mjs +825 -0
- package/node_modules/@dougharness/flow/lib/worktrees.mjs +215 -0
- package/node_modules/@dougharness/flow/package.json +19 -0
- package/node_modules/@dougharness/flow/scripts/board.mjs +260 -0
- package/node_modules/@dougharness/flow/scripts/cost.mjs +66 -0
- package/node_modules/@dougharness/flow/scripts/learn.mjs +161 -0
- package/node_modules/@dougharness/flow/scripts/memory.mjs +1274 -0
- package/node_modules/@dougharness/flow/scripts/plan.mjs +547 -0
- package/node_modules/@dougharness/flow/scripts/rehearse.mjs +129 -0
- package/node_modules/@dougharness/flow/skills/core-next/SKILL.md +92 -0
- package/node_modules/@dougharness/flow/skills/doug-approve/SKILL.md +15 -0
- package/node_modules/@dougharness/flow/skills/doug-decide/SKILL.md +26 -0
- package/node_modules/@dougharness/flow/skills/doug-implement/SKILL.md +22 -0
- package/node_modules/@dougharness/flow/skills/doug-learn/SKILL.md +20 -0
- package/node_modules/@dougharness/flow/skills/doug-next/SKILL.md +87 -0
- package/node_modules/@dougharness/flow/skills/doug-plan/SKILL.md +22 -0
- package/node_modules/@dougharness/flow/skills/doug-swarm/SKILL.md +55 -0
- package/node_modules/@dougharness/flow/skills/harness-fix/SKILL.md +85 -0
- package/node_modules/@dougharness/flow/skills/research/SKILL.md +41 -0
- package/node_modules/@dougharness/flow/skills/run-report/SKILL.md +51 -0
- package/node_modules/@dougharness/flow/skills/swarm-launch/SKILL.md +27 -0
- package/node_modules/@dougharness/flow/workflows/doug-implement.js +2687 -0
- package/node_modules/@dougharness/gates/.claude-plugin/plugin.json +10 -0
- package/node_modules/@dougharness/gates/LICENSE +21 -0
- package/node_modules/@dougharness/gates/hooks/hooks.json +184 -0
- package/node_modules/@dougharness/gates/lib/agent-context.mjs +111 -0
- package/node_modules/@dougharness/gates/lib/anchor.mjs +110 -0
- package/node_modules/@dougharness/gates/lib/baseline.mjs +160 -0
- package/node_modules/@dougharness/gates/lib/bash-rules.mjs +1522 -0
- package/node_modules/@dougharness/gates/lib/block-ledger.mjs +127 -0
- package/node_modules/@dougharness/gates/lib/checkpoint.mjs +97 -0
- package/node_modules/@dougharness/gates/lib/config.mjs +168 -0
- package/node_modules/@dougharness/gates/lib/evidence.mjs +59 -0
- package/node_modules/@dougharness/gates/lib/glob.mjs +86 -0
- package/node_modules/@dougharness/gates/lib/io.mjs +91 -0
- package/node_modules/@dougharness/gates/lib/paths.mjs +101 -0
- package/node_modules/@dougharness/gates/lib/proposals.mjs +201 -0
- package/node_modules/@dougharness/gates/lib/run.mjs +147 -0
- package/node_modules/@dougharness/gates/lib/scope.mjs +117 -0
- package/node_modules/@dougharness/gates/lib/secret-rules.mjs +268 -0
- package/node_modules/@dougharness/gates/lib/state.mjs +114 -0
- package/node_modules/@dougharness/gates/lib/trace.mjs +196 -0
- package/node_modules/@dougharness/gates/package.json +17 -0
- package/node_modules/@dougharness/gates/scripts/edit-loop.mjs +39 -0
- package/node_modules/@dougharness/gates/scripts/format-on-edit.mjs +45 -0
- package/node_modules/@dougharness/gates/scripts/guard-bash.mjs +32 -0
- package/node_modules/@dougharness/gates/scripts/protect-paths.mjs +49 -0
- package/node_modules/@dougharness/gates/scripts/reanchor.mjs +81 -0
- package/node_modules/@dougharness/gates/scripts/research-cap.mjs +295 -0
- package/node_modules/@dougharness/gates/scripts/secret-scan.mjs +26 -0
- package/node_modules/@dougharness/gates/scripts/session-start-baseline.mjs +57 -0
- package/node_modules/@dougharness/gates/scripts/statusline.mjs +133 -0
- package/node_modules/@dougharness/gates/scripts/stop-gate.mjs +1422 -0
- package/node_modules/@dougharness/gates/scripts/trace.mjs +75 -0
- package/package.json +33 -0
- package/templates/board-app.js +533 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// One-way import of Claude Code auto memory (~/.claude/projects/<slug>/memory/*.md) into the lessons table
|
|
2
|
+
// (card memory-lib, task memory-import). This module only ever reads under the auto-memory directory: it never
|
|
3
|
+
// creates, writes, renames, or touches a file there, and it never writes MEMORY.md (the auto-memory index).
|
|
4
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
5
|
+
import { basename, join, resolve } from "node:path";
|
|
6
|
+
import { homedir } from "node:os";
|
|
7
|
+
import { createHash } from "node:crypto";
|
|
8
|
+
import { projectSlug } from "./cost.mjs";
|
|
9
|
+
import { addLesson, getLesson, listLessons, supersedeLesson } from "./memory.mjs";
|
|
10
|
+
|
|
11
|
+
export function autoMemoryDir(projectDir, claudeDir = join(homedir(), ".claude")) {
|
|
12
|
+
return join(claudeDir, "projects", projectSlug(projectDir), "memory");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function stripQuotes(value) {
|
|
16
|
+
if (value.length >= 2) {
|
|
17
|
+
const first = value[0];
|
|
18
|
+
const last = value[value.length - 1];
|
|
19
|
+
if ((first === '"' && last === '"') || (first === "'" && last === "'")) {
|
|
20
|
+
return value.slice(1, -1);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Frontmatter is a leading `---` line, top-level `key: value` lines up to a closing `---` line, plus the
|
|
27
|
+
// children of a `metadata:` block (a `metadata:` line, optionally trailing whitespace, followed by lines
|
|
28
|
+
// indented by two or more spaces of the same `key: value` form). A nested key never overrides a top-level key
|
|
29
|
+
// of the same name. A file with no leading `---` line has data = {} and the whole text as body.
|
|
30
|
+
export function parseFrontmatter(text) {
|
|
31
|
+
const lines = text.split(/\r?\n/);
|
|
32
|
+
if (lines[0] !== "---") {
|
|
33
|
+
return { data: {}, body: text };
|
|
34
|
+
}
|
|
35
|
+
let end = -1;
|
|
36
|
+
for (let i = 1; i < lines.length; i++) {
|
|
37
|
+
if (lines[i] === "---") {
|
|
38
|
+
end = i;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (end === -1) {
|
|
43
|
+
return { data: {}, body: text };
|
|
44
|
+
}
|
|
45
|
+
const data = {};
|
|
46
|
+
const nested = {};
|
|
47
|
+
let inMetadata = false;
|
|
48
|
+
for (let i = 1; i < end; i++) {
|
|
49
|
+
const line = lines[i];
|
|
50
|
+
if (/^metadata:\s*$/.test(line)) {
|
|
51
|
+
inMetadata = true;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const indented = line.match(/^(\s+)(.*)$/);
|
|
55
|
+
if (inMetadata && indented && indented[1].length >= 2) {
|
|
56
|
+
const kv = indented[2].match(/^([^:]+):\s*(.*)$/);
|
|
57
|
+
if (kv) {
|
|
58
|
+
const key = kv[1].trim();
|
|
59
|
+
if (!(key in nested)) nested[key] = stripQuotes(kv[2].trim());
|
|
60
|
+
}
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
inMetadata = false;
|
|
64
|
+
if (indented) continue;
|
|
65
|
+
const kv = line.match(/^([^:]+):\s*(.*)$/);
|
|
66
|
+
if (kv) {
|
|
67
|
+
const key = kv[1].trim();
|
|
68
|
+
data[key] = stripQuotes(kv[2].trim());
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
for (const key of Object.keys(nested)) {
|
|
72
|
+
if (!(key in data)) data[key] = nested[key];
|
|
73
|
+
}
|
|
74
|
+
const body = lines.slice(end + 1).join("\n");
|
|
75
|
+
return { data, body };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function importAutoMemory(m, opts = {}) {
|
|
79
|
+
const { projectDir, claudeDir, now } = opts;
|
|
80
|
+
void now; // accepted for interface consistency; every timestamp here is measured (data.modified or file mtime)
|
|
81
|
+
const dir = autoMemoryDir(projectDir, claudeDir);
|
|
82
|
+
if (!existsSync(dir)) {
|
|
83
|
+
return { dir, found: false, added: 0, updated: 0, unchanged: 0, skipped: 0, files: [] };
|
|
84
|
+
}
|
|
85
|
+
const names = readdirSync(dir, { withFileTypes: true })
|
|
86
|
+
.filter((e) => e.isFile() && e.name.endsWith(".md") && e.name !== "MEMORY.md")
|
|
87
|
+
.map((e) => e.name)
|
|
88
|
+
.sort();
|
|
89
|
+
let added = 0;
|
|
90
|
+
let updated = 0;
|
|
91
|
+
let unchanged = 0;
|
|
92
|
+
let skipped = 0;
|
|
93
|
+
const files = [];
|
|
94
|
+
for (const name of names) {
|
|
95
|
+
const filePath = resolve(join(dir, name));
|
|
96
|
+
const raw = readFileSync(filePath, "utf8");
|
|
97
|
+
const { data, body } = parseFrontmatter(raw);
|
|
98
|
+
const text = body.trim();
|
|
99
|
+
if (!text) {
|
|
100
|
+
skipped++;
|
|
101
|
+
files.push({ file: name, id: null, action: "skipped" });
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const kind = data.type === "feedback" ? "feedback" : "project";
|
|
105
|
+
const id = createHash("sha256").update(`auto-memory\n${name}\n${text}`).digest("hex").slice(0, 16);
|
|
106
|
+
const existing = getLesson(m, id);
|
|
107
|
+
if (existing) {
|
|
108
|
+
unchanged++;
|
|
109
|
+
files.push({ file: name, id, action: "unchanged" });
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const created =
|
|
113
|
+
typeof data.modified === "string" && Number.isFinite(Date.parse(data.modified))
|
|
114
|
+
? data.modified
|
|
115
|
+
: statSync(filePath).mtime.toISOString();
|
|
116
|
+
const citation = filePath;
|
|
117
|
+
// Keyed on the file's basename (card memory-docs-drift #3), not the absolute citation path: a rewritten
|
|
118
|
+
// auto-memory file supersedes the row it wrote before regardless of where the auto-memory dir lives (a
|
|
119
|
+
// different --claude-dir, a moved home). source_agent "auto-memory" still guards a hand-authored lesson
|
|
120
|
+
// that happens to share the name from ever being superseded here (memory.mjs refuses that source-agent on
|
|
121
|
+
// `lesson add`, so only this importer's own prior rows can ever match). A file is identified by its name:
|
|
122
|
+
// the same name seen from a second auto-memory directory supersedes the earlier row rather than adding a
|
|
123
|
+
// second one. `names` above comes from one flat readdirSync of a single auto-memory dir per run, so names
|
|
124
|
+
// are already unique within the set this loop iterates.
|
|
125
|
+
const prior = listLessons(m).find((l) => l.source_agent === "auto-memory" && basename(l.citation) === name);
|
|
126
|
+
addLesson(m, {
|
|
127
|
+
id,
|
|
128
|
+
text,
|
|
129
|
+
kind,
|
|
130
|
+
scope: [],
|
|
131
|
+
citation,
|
|
132
|
+
source: { agent: "auto-memory", model: null },
|
|
133
|
+
created,
|
|
134
|
+
});
|
|
135
|
+
if (prior) {
|
|
136
|
+
supersedeLesson(m, prior.id, id);
|
|
137
|
+
updated++;
|
|
138
|
+
files.push({ file: name, id, action: "updated" });
|
|
139
|
+
} else {
|
|
140
|
+
added++;
|
|
141
|
+
files.push({ file: name, id, action: "added" });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return { dir, found: true, added, updated, unchanged, skipped, files };
|
|
145
|
+
}
|