create-heresay 0.1.0 → 0.2.2

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.
@@ -3,6 +3,7 @@
3
3
  * projects/{project_id}
4
4
  * projects/{project_id}/reports/{report_id}
5
5
  * projects/{project_id}/tasks/{report_id} written only by accept(), read only by the prompt
6
+ * agent_tokens/{id} one per connected repo; secret stored hashed
6
7
  * rate/{bucket} has expire_at for a Firestore TTL policy
7
8
  *
8
9
  * Clients never touch Firestore directly (firestore.rules denies everything); all of it goes
@@ -42,6 +43,14 @@ export class FirestoreStore {
42
43
  const q = await this.projects().get();
43
44
  return q.docs.map((d) => d.data());
44
45
  }
46
+ async updateProject(id, patch) {
47
+ const { id: _ignored, ...rest } = patch;
48
+ await this.projects().doc(id).update(rest);
49
+ }
50
+ /** recursiveDelete, because deleting a document leaves its subcollections behind. */
51
+ async deleteProject(id) {
52
+ await this.db.recursiveDelete(this.projects().doc(id));
53
+ }
45
54
  async createReport(r) { await this.reports(r.project_id).doc(r.id).create(r); }
46
55
  async getReport(project_id, id) {
47
56
  const s = await this.reports(project_id).doc(id).get();
@@ -82,6 +91,7 @@ export class FirestoreStore {
82
91
  const next = {
83
92
  ...r, status: to, triaged_by: patch.triaged_by, updated_at: patch.updated_at,
84
93
  decline_reason: patch.decline_reason ?? r.decline_reason,
94
+ fix_note: patch.fix_note !== undefined ? patch.fix_note : (r.fix_note ?? null),
85
95
  };
86
96
  tx.set(ref, next);
87
97
  return { ok: true, report: next };
@@ -91,6 +101,35 @@ export class FirestoreStore {
91
101
  const s = await this.tasks(project_id).doc(report_id).get();
92
102
  return s.exists ? s.data() : null;
93
103
  }
104
+ async listTasks(project_id) {
105
+ const q = await this.tasks(project_id).limit(500).get();
106
+ return q.docs.map((d) => d.data());
107
+ }
108
+ async updateTask(project_id, report_id, fn) {
109
+ const ref = this.tasks(project_id).doc(report_id);
110
+ return this.db.runTransaction(async (tx) => {
111
+ const s = await tx.get(ref);
112
+ if (!s.exists)
113
+ return null;
114
+ const next = fn(s.data());
115
+ tx.set(ref, next);
116
+ return next;
117
+ });
118
+ }
119
+ tokens() { return this.db.collection('agent_tokens'); }
120
+ async createAgentToken(t) { await this.tokens().doc(t.id).create(t); }
121
+ async getAgentToken(id) {
122
+ const s = await this.tokens().doc(id).get();
123
+ return s.exists ? s.data() : null;
124
+ }
125
+ async listAgentTokens() {
126
+ const q = await this.tokens().get();
127
+ return q.docs.map((d) => d.data());
128
+ }
129
+ async updateAgentToken(id, patch) {
130
+ const { id: _ignored, ...rest } = patch;
131
+ await this.tokens().doc(id).update(rest);
132
+ }
94
133
  async hit(bucket, limit, expires_at) {
95
134
  const ref = this.db.collection('rate').doc(bucket.replaceAll('/', '_'));
96
135
  return this.db.runTransaction(async (tx) => {
@@ -9,7 +9,7 @@
9
9
  "scripts": {
10
10
  "build": "tsc -p tsconfig.json",
11
11
  "typecheck": "tsc -p tsconfig.json --noEmit",
12
- "test": "tsc -p tsconfig.test.json && node --test 'lib-test/test/handler.test.js' 'lib-test/test/store-memory.test.js'",
12
+ "test": "tsc -p tsconfig.test.json && node --test 'lib-test/test/handler.test.js' 'lib-test/test/agent.test.js' 'lib-test/test/store-memory.test.js'",
13
13
  "build:test": "tsc -p tsconfig.test.json"
14
14
  },
15
15
  "dependencies": {
@@ -150,3 +150,51 @@ a.platform:hover { border-color:var(--acc); box-shadow:0 0 0 3px var(--mist); }
150
150
  .who { display:none; }
151
151
  .top { gap:10px; padding:10px 14px; }
152
152
  }
153
+
154
+ /* agents */
155
+ .agent-steps { margin:4px 0 0; padding-left:20px; }
156
+ .agent-steps li { margin-bottom:16px; }
157
+ .agent-steps li::marker { font-weight:700; color:var(--deep); }
158
+ .repos-line { margin:-10px 0 18px; font-size:13px; color:var(--mute); }
159
+ .brief-line { margin-top:8px; font-size:13px; color:var(--deep); }
160
+ .notes { margin-top:8px; font-size:13px; }
161
+ .notes summary { cursor:pointer; color:var(--mute); }
162
+ .notes p { margin:6px 0 0; }
163
+ .checks { display:flex; flex-direction:column; gap:6px; margin-top:8px; font-weight:400; }
164
+ .check { display:flex; align-items:center; gap:6px; }
165
+ .token-out h2 { margin-bottom:6px; }
166
+ .actions select { padding:7px 10px; }
167
+
168
+ /* wizard: back links, live feed */
169
+ .steps a { display:flex; align-items:center; gap:8px; color:inherit; text-decoration:none; border-radius:6px; }
170
+ .steps a:hover { color:var(--deep); }
171
+ .steps a:hover span { border-color:var(--acc); }
172
+ .platform.current { border-color:var(--acc); box-shadow:0 0 0 3px var(--mist); }
173
+ .feed { list-style:none; margin:12px 0 0; padding:0; }
174
+ .feed:empty { display:none; }
175
+ .feed li { display:grid; grid-template-columns:auto 1fr; gap:2px 12px; padding:10px 0; border-top:1px solid var(--line); }
176
+ .feed li .mute { grid-column:2; }
177
+ .feed-text { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
178
+ .feed li.fresh { animation:arrive 1.2s ease-out; }
179
+ @keyframes arrive { from { background:var(--mist); } to { background:transparent; } }
180
+ @media (prefers-reduced-motion: reduce) { .feed li.fresh { animation:none; } }
181
+ .row.split { align-items:center; }
182
+ .row.split .hint { margin:0; }
183
+ .btn:disabled { opacity:.45; cursor:not-allowed; }
184
+ .count.todo { color:var(--confusing); font-weight:600; }
185
+
186
+ /* verify, delete */
187
+ .checks-list { list-style:none; margin:14px 0 0; padding:0; }
188
+ .checks-list li { display:flex; gap:12px; align-items:flex-start; padding:10px 0; }
189
+ .checks-list li + li { border-top:1px solid var(--line); }
190
+ .checks-list li > div { display:flex; flex-direction:column; }
191
+ .checks-list .mark { width:22px; height:22px; flex:none; border-radius:50%; border:2px solid var(--line); margin-top:1px; }
192
+ .checks-list li.skip .mark { border-style:dashed; }
193
+ .checks-list li:not(.ok):not(.skip) .mark { border-color:var(--acc); border-right-color:transparent; animation:spin 1s linear infinite; }
194
+ .checks-list li.ok .mark { border-color:var(--acc); background:var(--acc) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L19 7'/%3E%3C/svg%3E") center/14px no-repeat; }
195
+ @keyframes spin { to { transform:rotate(360deg); } }
196
+ @media (prefers-reduced-motion: reduce) { .checks-list .mark { animation:none !important; } }
197
+ .btn.danger { background:var(--broken); border-color:var(--broken); color:#fff; }
198
+ .btn.danger:disabled { opacity:.4; }
199
+ .row.tight { margin-top:0; }
200
+ .form label input[name=confirm] { margin-top:6px; }