project-memory-cli 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.
Files changed (56) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +153 -0
  3. package/SPEC.md +445 -0
  4. package/dist/commands/init.d.ts +8 -0
  5. package/dist/commands/init.d.ts.map +1 -0
  6. package/dist/commands/init.js +163 -0
  7. package/dist/commands/init.js.map +1 -0
  8. package/dist/commands/new-task.d.ts +2 -0
  9. package/dist/commands/new-task.d.ts.map +1 -0
  10. package/dist/commands/new-task.js +54 -0
  11. package/dist/commands/new-task.js.map +1 -0
  12. package/dist/commands/new-workflow.d.ts +2 -0
  13. package/dist/commands/new-workflow.d.ts.map +1 -0
  14. package/dist/commands/new-workflow.js +29 -0
  15. package/dist/commands/new-workflow.js.map +1 -0
  16. package/dist/commands/tree.d.ts +2 -0
  17. package/dist/commands/tree.d.ts.map +1 -0
  18. package/dist/commands/tree.js +55 -0
  19. package/dist/commands/tree.js.map +1 -0
  20. package/dist/commands/validate.d.ts +2 -0
  21. package/dist/commands/validate.d.ts.map +1 -0
  22. package/dist/commands/validate.js +36 -0
  23. package/dist/commands/validate.js.map +1 -0
  24. package/dist/index.d.ts +3 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +68 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/lib/detector.d.ts +12 -0
  29. package/dist/lib/detector.d.ts.map +1 -0
  30. package/dist/lib/detector.js +131 -0
  31. package/dist/lib/detector.js.map +1 -0
  32. package/dist/lib/fs.d.ts +7 -0
  33. package/dist/lib/fs.d.ts.map +1 -0
  34. package/dist/lib/fs.js +27 -0
  35. package/dist/lib/fs.js.map +1 -0
  36. package/dist/lib/ids.d.ts +8 -0
  37. package/dist/lib/ids.d.ts.map +1 -0
  38. package/dist/lib/ids.js +19 -0
  39. package/dist/lib/ids.js.map +1 -0
  40. package/dist/lib/planner.d.ts +23 -0
  41. package/dist/lib/planner.d.ts.map +1 -0
  42. package/dist/lib/planner.js +44 -0
  43. package/dist/lib/planner.js.map +1 -0
  44. package/dist/lib/rules.d.ts +18 -0
  45. package/dist/lib/rules.d.ts.map +1 -0
  46. package/dist/lib/rules.js +97 -0
  47. package/dist/lib/rules.js.map +1 -0
  48. package/dist/lib/templates.d.ts +24 -0
  49. package/dist/lib/templates.d.ts.map +1 -0
  50. package/dist/lib/templates.js +391 -0
  51. package/dist/lib/templates.js.map +1 -0
  52. package/dist/lib/validator.d.ts +8 -0
  53. package/dist/lib/validator.d.ts.map +1 -0
  54. package/dist/lib/validator.js +77 -0
  55. package/dist/lib/validator.js.map +1 -0
  56. package/package.json +57 -0
@@ -0,0 +1,391 @@
1
+ // ─── Templates ───────────────────────────────────────────────────────────────
2
+ //
3
+ // One function per generated file. All templates return plain strings.
4
+ // Template keys must match the `template` field in rules.ts BASE_LAYER
5
+ // and DYNAMIC_RULES.
6
+ // ── Utility ──────────────────────────────────────────────────────────────────
7
+ export const gitkeep = () => '';
8
+ // ── AI.md (repo root) ─────────────────────────────────────────────────────────
9
+ export const aiMd = () => `# AI Project Entry
10
+
11
+ This project uses the project-memory framework.
12
+
13
+ Start here:
14
+ - project-memory/README.md
15
+ - project-memory/project/overview.md
16
+ - project-memory/tasks/active.md
17
+ `;
18
+ // ── project-memory/README.md ──────────────────────────────────────────────────
19
+ export const frameworkReadme = (projectName) => `# Project Memory
20
+
21
+ This directory contains the structured project intelligence layer.
22
+ It allows any AI tool to understand and continue this project.
23
+ All context, tasks, and workflows are defined here.
24
+
25
+ **Project:** ${projectName}
26
+ **Framework:** project-memory v1.0.0
27
+
28
+ ---
29
+
30
+ ## Recommended Read Order
31
+
32
+ ### Cold Start
33
+ *Agent enters project with no prior context.*
34
+
35
+ 1. \`project/overview.md\` — what this project is and its primary goal
36
+ 2. \`context/current-state.md\` — where things stand right now (if present)
37
+ 3. \`tasks/active.md\` — what is being worked on
38
+
39
+ ### Assigned Task
40
+ *Agent has been directed to a specific task.*
41
+
42
+ 1. \`tasks/TASK-XXX/instructions.md\` — what to do
43
+ 2. \`tasks/TASK-XXX/context.md\` — background and relevant files
44
+ 3. \`tasks/TASK-XXX/tools.md\` — tooling notes (if present)
45
+
46
+ ---
47
+
48
+ ## Structure
49
+
50
+ | Folder | Purpose |
51
+ |--------------|----------------------------------------------------------|
52
+ | \`project/\` | Stable project definition: overview, architecture |
53
+ | \`context/\` | Dynamic operational state: decisions, current state |
54
+ | \`tasks/\` | Active work, task folders, completed log |
55
+ | \`workflows/\` | Named sequences of tasks |
56
+ | \`tools/\` | Environment setup and global commands |
57
+ | \`data/\` | Shared data assets |
58
+
59
+ ---
60
+
61
+ ## Global Context Files
62
+
63
+ - \`project/overview.md\` — project identity and goal
64
+ - \`project/architecture.md\` — system design and tech stack
65
+ - \`context/decisions.md\` — key decisions and rationale
66
+ - \`context/current-state.md\` — current operational state
67
+ - \`tools/global-tools.md\` — environment and commands
68
+ `;
69
+ // ── project/overview.md ───────────────────────────────────────────────────────
70
+ export const projectOverview = (projectName) => `# ${projectName}
71
+
72
+ ## Purpose
73
+ [What this project does and why it exists]
74
+
75
+ ## Current State
76
+ [Where things stand right now — what works, what is in progress]
77
+
78
+ ## Primary Goal
79
+ [The main thing we are trying to achieve]
80
+
81
+ ## Tech Stack
82
+ - [Language / Runtime]
83
+ - [Framework]
84
+ - [Database]
85
+ - [Key services]
86
+
87
+ ## Repository Structure
88
+ \`\`\`
89
+ /src — [description]
90
+ /tests — [description]
91
+ \`\`\`
92
+
93
+ ---
94
+ *Keep this file concise. It is the first thing any agent reads when entering this project.*
95
+ `;
96
+ // ── project/architecture.md ───────────────────────────────────────────────────
97
+ export const projectArchitecture = () => `# Architecture
98
+
99
+ ## System Overview
100
+ [High-level description of how the system works]
101
+
102
+ ## Key Components
103
+
104
+ | Component | Responsibility |
105
+ |-----------|----------------|
106
+ | [Name] | [What it does] |
107
+
108
+ ## Data Flow
109
+ [Describe how data moves through the system]
110
+
111
+ ## External Dependencies
112
+ - [Service / API] — [why it is used]
113
+
114
+ ## Design Patterns
115
+ [Notable patterns used in this codebase]
116
+
117
+ ## Known Constraints
118
+ [Performance limits, third-party restrictions, technical debt]
119
+ `;
120
+ // ── project/brief.md ─────────────────────────────────────────────────────────
121
+ export const projectBrief = () => `# Project Brief
122
+
123
+ ## What
124
+ [What are we building? One clear paragraph.]
125
+
126
+ ## Why
127
+ [Why does this need to exist? What problem does it solve?]
128
+
129
+ ## Who
130
+ [Who is this for? Who are the primary users or stakeholders?]
131
+
132
+ ## Success Criteria
133
+ [How do we know this is done and working?]
134
+
135
+ ## Out of Scope
136
+ [What are we explicitly not building in this phase?]
137
+ `;
138
+ // ── project/plan.md ───────────────────────────────────────────────────────────
139
+ export const projectPlan = () => `# Plan
140
+
141
+ ## Phases
142
+
143
+ ### Phase 1 — [Name]
144
+ **Goal:** [What this phase achieves]
145
+ **Tasks:** [List key tasks or link to TASK-NNN]
146
+ **Done when:** [Completion criteria]
147
+
148
+ ### Phase 2 — [Name]
149
+ **Goal:** [What this phase achieves]
150
+ **Tasks:** [List key tasks or link to TASK-NNN]
151
+ **Done when:** [Completion criteria]
152
+
153
+ ## Timeline
154
+ [Rough dates or milestones if known]
155
+
156
+ ## Open Questions
157
+ [Decisions still to be made that affect the plan]
158
+ `;
159
+ // ── context/decisions.md ─────────────────────────────────────────────────────
160
+ export const contextDecisions = () => `# Decisions
161
+
162
+ A running log of key architectural and product decisions.
163
+ New entries go at the top.
164
+
165
+ ---
166
+
167
+ ## [Date] — [Decision Title]
168
+
169
+ **Decision:** [What was decided]
170
+
171
+ **Rationale:** [Why this choice was made]
172
+
173
+ **Alternatives rejected:** [What else was considered and why it was not chosen]
174
+
175
+ **Status:** active
176
+
177
+ ---
178
+ `;
179
+ // ── context/current-state.md ─────────────────────────────────────────────────
180
+ export const contextCurrentState = () => `# Current State
181
+
182
+ *Last updated: [date]*
183
+
184
+ ## What is working
185
+ [What is stable and functional right now]
186
+
187
+ ## What is in progress
188
+ [What is actively being worked on — link to active tasks]
189
+
190
+ ## What is blocked
191
+ [What cannot proceed and why]
192
+
193
+ ## Immediate next priority
194
+ [The single most important thing to do next]
195
+
196
+ ---
197
+ *Keep this file to one page. Update it whenever the project state changes significantly.*
198
+ `;
199
+ // ── context/constraints.md ───────────────────────────────────────────────────
200
+ export const contextConstraints = () => `# Constraints
201
+
202
+ ## Technical Constraints
203
+ - [Constraint] — [reason]
204
+
205
+ ## Business Constraints
206
+ - [Constraint] — [reason]
207
+
208
+ ## Performance Requirements
209
+ - [Requirement] — [target metric]
210
+
211
+ ## Security Requirements
212
+ - [Requirement]
213
+
214
+ ## Notes
215
+ [Anything else that shapes how we build]
216
+ `;
217
+ // ── context/dependencies.md ──────────────────────────────────────────────────
218
+ export const contextDependencies = () => `# Dependencies
219
+
220
+ ## External Services
221
+
222
+ | Service | Purpose | Owner / Docs |
223
+ |---------|---------|--------------|
224
+ | [Name] | [What it does] | [link] |
225
+
226
+ ## Infrastructure
227
+
228
+ | Component | Purpose | Notes |
229
+ |-----------|---------|-------|
230
+ | [Name] | [What it does] | |
231
+
232
+ ## Third-Party Integrations
233
+ - [Service] — [how it is used]
234
+
235
+ ## Notes
236
+ [Anything important about managing or updating these dependencies]
237
+ `;
238
+ // ── tasks/active.md ──────────────────────────────────────────────────────────
239
+ export const tasksActive = () => `# Active Tasks
240
+
241
+ The master task tracker. Update this file whenever a task is created, started, completed, or blocked.
242
+ Any agent entering this project should read this file early.
243
+
244
+ | ID | Title | Status | Affected Files |
245
+ |----|-------|--------|----------------|
246
+
247
+ ---
248
+
249
+ **Status values:** \`planned\` \| \`in-progress\` \| \`done\` \| \`blocked\`
250
+ `;
251
+ // ── tasks/completed.md ───────────────────────────────────────────────────────
252
+ export const tasksCompleted = () => `# Completed Tasks
253
+
254
+ A log of all tasks that have reached \`done\` status.
255
+ Rows are moved here from \`active.md\` on completion.
256
+
257
+ | ID | Title | Completed | Notes |
258
+ |----|-------|-----------|-------|
259
+
260
+ `;
261
+ // ── tools/global-tools.md ────────────────────────────────────────────────────
262
+ export const globalTools = (projectName) => `# Global Tools — ${projectName}
263
+
264
+ ## Environment Setup
265
+ \`\`\`bash
266
+ # Install dependencies
267
+ # [command]
268
+
269
+ # Copy environment config
270
+ # cp .env.example .env
271
+ \`\`\`
272
+
273
+ ## Common Commands
274
+ \`\`\`bash
275
+ # Development
276
+ # [dev command]
277
+
278
+ # Tests
279
+ # [test command]
280
+
281
+ # Build
282
+ # [build command]
283
+ \`\`\`
284
+
285
+ ## Database
286
+ \`\`\`bash
287
+ # [Migration command]
288
+ # [Seed command]
289
+ \`\`\`
290
+
291
+ ## Notes
292
+ [Anything an agent needs to know to operate this project at the system level]
293
+ `;
294
+ // ── tasks/TASK-NNN/instructions.md ───────────────────────────────────────────
295
+ export const taskInstructions = (id, title) => `# ${id}: ${title}
296
+
297
+ ## Objective
298
+ [One sentence: what must be done]
299
+
300
+ ## Steps
301
+ 1. [Step one]
302
+ 2. [Step two]
303
+ 3. [Step three]
304
+
305
+ ## Acceptance Criteria
306
+ - [ ] [Criterion one]
307
+ - [ ] [Criterion two]
308
+
309
+ ## Notes
310
+ [Anything important that does not fit above]
311
+ `;
312
+ // ── tasks/TASK-NNN/context.md ─────────────────────────────────────────────────
313
+ export const taskContext = (id) => `# Context: ${id}
314
+
315
+ ## Background
316
+ [Why this task exists and what problem it solves]
317
+
318
+ ## Relevant Files
319
+ - \`path/to/file.ts\` — [what it does]
320
+
321
+ ## Dependencies
322
+ [Tasks, services, or systems this task depends on]
323
+
324
+ ## Constraints
325
+ [Technical or business constraints to be aware of]
326
+ `;
327
+ // ── tasks/TASK-NNN/output.md ──────────────────────────────────────────────────
328
+ export const taskOutput = (id) => `# Output: ${id}
329
+
330
+ *Fill this in when the task is complete.*
331
+
332
+ ## Summary
333
+ [What was done in 2–3 sentences]
334
+
335
+ ## Changes Made
336
+ - \`path/to/file.ts\` — [what changed and why]
337
+
338
+ ## Outcomes
339
+ [Did it meet the acceptance criteria? Any issues encountered?]
340
+
341
+ ## Follow-up
342
+ [New tasks created or recommended as a result of this work]
343
+ `;
344
+ // ── tasks/TASK-NNN/tools.md ───────────────────────────────────────────────────
345
+ export const taskTools = (id) => `# Tools: ${id}
346
+
347
+ ## Commands
348
+ \`\`\`bash
349
+ # [command]
350
+ \`\`\`
351
+
352
+ ## Notes
353
+ [Tool-specific notes for this task only]
354
+ `;
355
+ // ── workflows/WORKFLOW-NNN/overview.md ───────────────────────────────────────
356
+ export const workflowOverview = (id, title) => `# Workflow: ${title}
357
+ *${id}*
358
+
359
+ ## Goal
360
+ [What this workflow achieves when complete]
361
+
362
+ ## Tasks
363
+ - [ ] [TASK-NNN — task title]
364
+
365
+ ## Completion Criteria
366
+ [How we know this workflow is done]
367
+
368
+ ## Notes
369
+ [Coordination notes, sequencing constraints, or dependencies]
370
+ `;
371
+ export function renderTemplate(key, context = {}) {
372
+ const name = context.name ?? 'My Project';
373
+ switch (key) {
374
+ case 'gitkeep': return gitkeep();
375
+ case 'aiMd': return aiMd();
376
+ case 'frameworkReadme': return frameworkReadme(name);
377
+ case 'projectOverview': return projectOverview(name);
378
+ case 'projectArchitecture': return projectArchitecture();
379
+ case 'projectBrief': return projectBrief();
380
+ case 'projectPlan': return projectPlan();
381
+ case 'contextDecisions': return contextDecisions();
382
+ case 'contextCurrentState': return contextCurrentState();
383
+ case 'contextConstraints': return contextConstraints();
384
+ case 'contextDependencies': return contextDependencies();
385
+ case 'tasksActive': return tasksActive();
386
+ case 'tasksCompleted': return tasksCompleted();
387
+ case 'globalTools': return globalTools(name);
388
+ default: return '';
389
+ }
390
+ }
391
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/lib/templates.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,qBAAqB;AAErB,gFAAgF;AAEhF,MAAM,CAAC,MAAM,OAAO,GAAG,GAAW,EAAE,CAAC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,CAAC;QACvD,KAAK,iBAAiB,CAAC,CAAG,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;QACvD,KAAK,qBAAqB,CAAC,CAAC,OAAO,mBAAmB,EAAE,CAAC;QACzD,KAAK,cAAc,CAAC,CAAM,OAAO,YAAY,EAAE,CAAC;QAChD,KAAK,aAAa,CAAC,CAAO,OAAO,WAAW,EAAE,CAAC;QAC/C,KAAK,kBAAkB,CAAC,CAAE,OAAO,gBAAgB,EAAE,CAAC;QACpD,KAAK,qBAAqB,CAAC,CAAC,OAAO,mBAAmB,EAAE,CAAC;QACzD,KAAK,oBAAoB,CAAC,CAAC,OAAO,kBAAkB,EAAE,CAAC;QACvD,KAAK,qBAAqB,CAAC,CAAC,OAAO,mBAAmB,EAAE,CAAC;QACzD,KAAK,aAAa,CAAC,CAAO,OAAO,WAAW,EAAE,CAAC;QAC/C,KAAK,gBAAgB,CAAC,CAAI,OAAO,cAAc,EAAE,CAAC;QAClD,KAAK,aAAa,CAAC,CAAO,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;QACnD,OAAO,CAAC,CAAkB,OAAO,EAAE,CAAC;IACtC,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface ValidationResult {
2
+ valid: boolean;
3
+ errors: string[];
4
+ warnings: string[];
5
+ info: string[];
6
+ }
7
+ export declare function validateProject(cwd: string): ValidationResult;
8
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/lib/validator.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAaD,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CA8E7D"}
@@ -0,0 +1,77 @@
1
+ import path from 'path';
2
+ import { fileExists, listDirs } from './fs.js';
3
+ // Base layer files required under project-memory/
4
+ // Paths are relative to project-memory/ root.
5
+ const REQUIRED_BASE_FILES = [
6
+ 'README.md',
7
+ 'project/overview.md',
8
+ 'project/architecture.md',
9
+ 'context/decisions.md',
10
+ 'tasks/active.md',
11
+ 'tools/global-tools.md',
12
+ ];
13
+ export function validateProject(cwd) {
14
+ const errors = [];
15
+ const warnings = [];
16
+ const info = [];
17
+ const pmDir = path.join(cwd, 'project-memory');
18
+ // ── Check project-memory/ folder exists ────────────────────────────────────
19
+ if (!fileExists(pmDir)) {
20
+ errors.push('project-memory/ folder not found. Run `project-memory init` to initialize.');
21
+ return { valid: false, errors, warnings, info };
22
+ }
23
+ // ── Check required base files ──────────────────────────────────────────────
24
+ for (const relPath of REQUIRED_BASE_FILES) {
25
+ const fullPath = path.join(pmDir, relPath);
26
+ if (!fileExists(fullPath)) {
27
+ errors.push(`Missing required file: project-memory/${relPath}`);
28
+ }
29
+ }
30
+ // ── Check task folders ─────────────────────────────────────────────────────
31
+ const tasksDir = path.join(pmDir, 'tasks');
32
+ if (fileExists(tasksDir)) {
33
+ const taskFolders = listDirs(tasksDir).filter(d => /^TASK-\d{3}$/.test(d));
34
+ const nonStandard = listDirs(tasksDir).filter(d => !/^TASK-\d{3}$/.test(d));
35
+ for (const taskFolder of taskFolders) {
36
+ const taskPath = path.join(tasksDir, taskFolder);
37
+ if (!fileExists(path.join(taskPath, 'instructions.md'))) {
38
+ errors.push(`${taskFolder}/: missing instructions.md`);
39
+ }
40
+ if (!fileExists(path.join(taskPath, 'context.md'))) {
41
+ errors.push(`${taskFolder}/: missing context.md`);
42
+ }
43
+ if (!fileExists(path.join(taskPath, 'output.md'))) {
44
+ warnings.push(`${taskFolder}/: missing output.md (fill in when task is complete)`);
45
+ }
46
+ }
47
+ for (const d of nonStandard) {
48
+ warnings.push(`tasks/${d}: non-standard folder name (expected TASK-NNN format)`);
49
+ }
50
+ }
51
+ // ── Check workflow folders ─────────────────────────────────────────────────
52
+ const workflowsDir = path.join(pmDir, 'workflows');
53
+ if (fileExists(workflowsDir)) {
54
+ const nonStandardWf = listDirs(workflowsDir).filter(d => !/^WORKFLOW-\d{3}$/.test(d));
55
+ for (const d of nonStandardWf) {
56
+ warnings.push(`workflows/${d}: non-standard folder name (expected WORKFLOW-NNN format)`);
57
+ }
58
+ const workflowFolders = listDirs(workflowsDir).filter(d => /^WORKFLOW-\d{3}$/.test(d));
59
+ for (const wf of workflowFolders) {
60
+ if (!fileExists(path.join(workflowsDir, wf, 'overview.md'))) {
61
+ errors.push(`${wf}/: missing overview.md`);
62
+ }
63
+ }
64
+ }
65
+ // ── AI.md informational note ───────────────────────────────────────────────
66
+ // Never an error. Never a warning. Informational only.
67
+ if (!fileExists(path.join(cwd, 'AI.md'))) {
68
+ info.push('AI.md not found at repo root — optional but recommended for AI tool discoverability');
69
+ }
70
+ return {
71
+ valid: errors.length === 0,
72
+ errors,
73
+ warnings,
74
+ info,
75
+ };
76
+ }
77
+ //# sourceMappingURL=validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/lib/validator.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAc/C,kDAAkD;AAClD,8CAA8C;AAC9C,MAAM,mBAAmB,GAAG;IAC1B,WAAW;IACX,qBAAqB;IACrB,yBAAyB;IACzB,sBAAsB;IACtB,iBAAiB;IACjB,uBAAuB;CACxB,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAa,EAAE,CAAC;IAE1B,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAA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MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,wBAAwB,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;IACH,CAAC;IAED,8EAA8E;IAC9E,uDAAuD;IACvD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;QACzC,IAAI,CAAC,IAAI,CAAC,qFAAqF,CAAC,CAAC;IACnG,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC1B,MAAM;QACN,QAAQ;QACR,IAAI;KACL,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "project-memory-cli",
3
+ "version": "0.1.0",
4
+ "description": "A file-tree standard and CLI that makes any AI coding tool more effective.",
5
+ "keywords": [
6
+ "ai",
7
+ "cli",
8
+ "project-structure",
9
+ "agent",
10
+ "scaffold",
11
+ "claude",
12
+ "cursor",
13
+ "codex",
14
+ "context",
15
+ "tasks",
16
+ "developer-tools"
17
+ ],
18
+ "homepage": "https://github.com/JoelHayward/project-memory-cli",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/JoelHayward/project-memory-cli.git"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/JoelHayward/project-memory-cli/issues"
25
+ },
26
+ "author": "Joel Hayward",
27
+ "license": "MIT",
28
+ "type": "module",
29
+ "bin": {
30
+ "project-memory": "./dist/index.js"
31
+ },
32
+ "main": "./dist/index.js",
33
+ "files": [
34
+ "dist",
35
+ "SPEC.md",
36
+ "README.md",
37
+ "LICENSE"
38
+ ],
39
+ "scripts": {
40
+ "build": "tsc",
41
+ "dev": "tsc --watch",
42
+ "start": "node dist/index.js",
43
+ "prepublishOnly": "npm run build"
44
+ },
45
+ "dependencies": {
46
+ "chalk": "^5.3.0",
47
+ "commander": "^12.0.0",
48
+ "ora": "^8.0.1"
49
+ },
50
+ "devDependencies": {
51
+ "@types/node": "^20.0.0",
52
+ "typescript": "^5.4.0"
53
+ },
54
+ "engines": {
55
+ "node": ">=18.0.0"
56
+ }
57
+ }