@hasna/project 0.1.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.
Files changed (57) hide show
  1. package/README.md +172 -0
  2. package/dist/cli/commands/completion.d.ts +3 -0
  3. package/dist/cli/commands/completion.d.ts.map +1 -0
  4. package/dist/cli/commands/projects.d.ts +3 -0
  5. package/dist/cli/commands/projects.d.ts.map +1 -0
  6. package/dist/cli/index.d.ts +3 -0
  7. package/dist/cli/index.d.ts.map +1 -0
  8. package/dist/cli/index.js +47129 -0
  9. package/dist/db/database.d.ts +7 -0
  10. package/dist/db/database.d.ts.map +1 -0
  11. package/dist/db/pg-migrations.d.ts +7 -0
  12. package/dist/db/pg-migrations.d.ts.map +1 -0
  13. package/dist/db/projects.d.ts +22 -0
  14. package/dist/db/projects.d.ts.map +1 -0
  15. package/dist/db/projects.test.d.ts +2 -0
  16. package/dist/db/projects.test.d.ts.map +1 -0
  17. package/dist/db/schema.d.ts +4 -0
  18. package/dist/db/schema.d.ts.map +1 -0
  19. package/dist/db/workdirs.d.ts +10 -0
  20. package/dist/db/workdirs.d.ts.map +1 -0
  21. package/dist/index.d.ts +8 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +32158 -0
  24. package/dist/lib/detect.d.ts +3 -0
  25. package/dist/lib/detect.d.ts.map +1 -0
  26. package/dist/lib/doctor.d.ts +16 -0
  27. package/dist/lib/doctor.d.ts.map +1 -0
  28. package/dist/lib/env.d.ts +5 -0
  29. package/dist/lib/env.d.ts.map +1 -0
  30. package/dist/lib/generate.d.ts +16 -0
  31. package/dist/lib/generate.d.ts.map +1 -0
  32. package/dist/lib/git.d.ts +5 -0
  33. package/dist/lib/git.d.ts.map +1 -0
  34. package/dist/lib/github.d.ts +14 -0
  35. package/dist/lib/github.d.ts.map +1 -0
  36. package/dist/lib/import.d.ts +26 -0
  37. package/dist/lib/import.d.ts.map +1 -0
  38. package/dist/lib/import.test.d.ts +2 -0
  39. package/dist/lib/import.test.d.ts.map +1 -0
  40. package/dist/lib/scheduler.d.ts +21 -0
  41. package/dist/lib/scheduler.d.ts.map +1 -0
  42. package/dist/lib/stats.d.ts +23 -0
  43. package/dist/lib/stats.d.ts.map +1 -0
  44. package/dist/lib/status.d.ts +14 -0
  45. package/dist/lib/status.d.ts.map +1 -0
  46. package/dist/lib/sync.d.ts +20 -0
  47. package/dist/lib/sync.d.ts.map +1 -0
  48. package/dist/lib/watch.d.ts +6 -0
  49. package/dist/lib/watch.d.ts.map +1 -0
  50. package/dist/mcp/index.d.ts +3 -0
  51. package/dist/mcp/index.d.ts.map +1 -0
  52. package/dist/mcp/index.js +47904 -0
  53. package/dist/mcp/tools/cloud.d.ts +3 -0
  54. package/dist/mcp/tools/cloud.d.ts.map +1 -0
  55. package/dist/types/index.d.ts +149 -0
  56. package/dist/types/index.d.ts.map +1 -0
  57. package/package.json +72 -0
package/README.md ADDED
@@ -0,0 +1,172 @@
1
+ # open-projects
2
+
3
+ Project management CLI + MCP server for AI agents. Register projects once, open them anywhere, sync to S3, auto-init git, and wire into the `hasna` ecosystem (todos, mementos, conversations).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ bun install -g @hasna/open-projects
9
+ ```
10
+
11
+ ## CLI
12
+
13
+ ```bash
14
+ # Register a project
15
+ projects create --name my-app --path /path/to/my-app
16
+
17
+ # List projects
18
+ projects list
19
+ projects list --status archived
20
+
21
+ # Get details
22
+ projects get my-app
23
+
24
+ # Open a project (cd into it)
25
+ cd $(projects open my-app)
26
+
27
+ # Update metadata
28
+ projects update my-app --description "My app" --tags "web,ts"
29
+
30
+ # Archive / unarchive
31
+ projects archive my-app
32
+ projects unarchive my-app
33
+
34
+ # Import existing directories
35
+ projects import /path/to/existing-project
36
+ projects import-bulk /path/to/workspace # imports all subdirs
37
+
38
+ # Sync to/from S3
39
+ projects update my-app --s3-bucket my-bucket
40
+ projects sync my-app
41
+ projects sync my-app --direction push
42
+ projects sync-all # sync all projects with S3 configured
43
+
44
+ # Schedule auto-sync
45
+ projects schedule set --interval daily --direction both
46
+ projects schedule status
47
+ projects schedule remove
48
+
49
+ # Publish to GitHub
50
+ projects publish my-app --org hasnaxyz
51
+ projects unpublish my-app
52
+
53
+ # Git passthrough
54
+ projects git my-app status
55
+ projects git my-app log --oneline -10
56
+
57
+ # Shell completion
58
+ eval "$(projects completion)" # bash
59
+ eval "$(projects completion --shell zsh)" # zsh
60
+ ```
61
+
62
+ ## MCP Server
63
+
64
+ Add to your Claude config:
65
+
66
+ ```json
67
+ {
68
+ "mcpServers": {
69
+ "open-projects": {
70
+ "command": "projects-mcp"
71
+ }
72
+ }
73
+ }
74
+ ```
75
+
76
+ ### Available tools
77
+
78
+ | Tool | Description |
79
+ |------|-------------|
80
+ | `projects_create` | Register a new project. Returns `workingDirectory` + `post_create_actions` |
81
+ | `projects_list` | List projects, filter by status |
82
+ | `projects_get` | Get project by ID or slug. Returns `workingDirectory` |
83
+ | `projects_update` | Update project metadata |
84
+ | `projects_archive` | Archive a project |
85
+ | `projects_open` | Get `workingDirectory` for a project |
86
+ | `projects_sync` | Sync to/from S3 (incremental, by file hash) |
87
+ | `projects_sync_all` | Sync all active projects with S3 configured |
88
+ | `projects_link` | Store integration IDs (todos, mementos, conversations, files) |
89
+ | `projects_import` | Import an existing directory as a project |
90
+ | `projects_import_bulk` | Import all subdirectories of a path |
91
+ | `projects_publish` | Create GitHub repo, add remote, push |
92
+ | `projects_schedule_set` | Enable cron-based auto-sync |
93
+ | `projects_schedule_status` | Get current schedule config |
94
+ | `projects_sync_log` | List recent sync history |
95
+
96
+ ### projects_create response
97
+
98
+ ```json
99
+ {
100
+ "id": "prj_abc123",
101
+ "name": "my-app",
102
+ "path": "/path/to/my-app",
103
+ "workingDirectory": "/path/to/my-app",
104
+ "instruction": "Project created. workingDirectory: /path/to/my-app",
105
+ "post_create_actions": [
106
+ {
107
+ "description": "Register with open-todos for task tracking",
108
+ "tool": "mcp__todos__create_project",
109
+ "args": { "name": "my-app", "path": "/path/to/my-app" },
110
+ "on_complete": "Call projects_link with todos_project_id=<returned id>"
111
+ }
112
+ ]
113
+ }
114
+ ```
115
+
116
+ ## Architecture
117
+
118
+ ```
119
+ src/
120
+ ├── cli/
121
+ │ ├── index.ts # CLI entry point (commander)
122
+ │ └── commands/
123
+ │ ├── projects.ts # All project commands
124
+ │ └── completion.ts # Shell completion
125
+ ├── db/
126
+ │ ├── database.ts # SQLite init, path resolution
127
+ │ ├── schema.ts # Migrations
128
+ │ └── projects.ts # CRUD + sync log
129
+ ├── lib/
130
+ │ ├── git.ts # git init, .gitignore, passthrough
131
+ │ ├── sync.ts # S3 incremental sync
132
+ │ ├── import.ts # Import existing projects
133
+ │ ├── github.ts # GitHub publish via gh CLI
134
+ │ └── scheduler.ts # Cron auto-sync
135
+ ├── mcp/
136
+ │ └── index.ts # MCP server (all tools)
137
+ ├── types/
138
+ │ └── index.ts # Types + error classes
139
+ └── index.ts # SDK exports
140
+ ```
141
+
142
+ ## Data model
143
+
144
+ **projects** — `id` (`prj_` + nanoid12), `slug`, `name`, `description`, `status`, `path`, `s3_bucket`, `s3_prefix`, `git_remote`, `tags`, `integrations`, `created_at`, `updated_at`, `synced_at`
145
+
146
+ **project_files** — `project_id`, `relative_path`, `size`, `hash`, `synced_at`
147
+
148
+ **sync_log** — `project_id`, `direction`, `status`, `files_synced`, `bytes`, `error`, `started_at`, `completed_at`
149
+
150
+ DB path: `~/.hasna/projects/projects.db` (override: `HASNA_PROJECTS_DB_PATH`)
151
+
152
+ ## Ecosystem integration
153
+
154
+ `projects_create` returns `post_create_actions` — an array of MCP calls the agent should make to register the project with:
155
+
156
+ - **open-todos** (`mcp__todos__create_project`) — task tracking
157
+ - **open-mementos** (`mcp__mementos__register_project`) — persistent memory
158
+ - **open-conversations** (`mcp__conversations__create_space`) — team coordination (optional)
159
+
160
+ After each call, use `projects_link` to store the returned IDs in the project record and `.project.json`.
161
+
162
+ ## S3 sync
163
+
164
+ - S3 path: `s3://{bucket}/{prefix}/projects/{project-id}/{relative-path}`
165
+ - Incremental: compares local MD5 vs S3 ETag, skips unchanged files
166
+ - Skips files >100MB
167
+ - Includes `.git/` for full restorability
168
+ - Writes sync history to `sync_log` table
169
+
170
+ ## License
171
+
172
+ Apache-2.0
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ export declare function registerCompletionCommand(program: Command): void;
3
+ //# sourceMappingURL=completion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/completion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoGzC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgBhE"}
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ export declare function registerProjectCommands(program: Command): void;
3
+ //# sourceMappingURL=projects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/projects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0DzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwrB9D"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bun
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}