@mod-computer/cli 0.1.1 → 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.
- package/README.md +98 -76
- package/dist/cli.bundle.js +23750 -12931
- package/dist/cli.bundle.js.map +4 -4
- package/dist/cli.js +23 -12
- package/dist/commands/add.js +245 -0
- package/dist/commands/auth.js +129 -21
- package/dist/commands/comment.js +568 -0
- package/dist/commands/diff.js +182 -0
- package/dist/commands/index.js +33 -3
- package/dist/commands/init.js +475 -221
- package/dist/commands/ls.js +135 -0
- package/dist/commands/members.js +687 -0
- package/dist/commands/mv.js +282 -0
- package/dist/commands/rm.js +257 -0
- package/dist/commands/status.js +273 -306
- package/dist/commands/sync.js +99 -75
- package/dist/commands/trace.js +1752 -0
- package/dist/commands/workspace.js +354 -330
- package/dist/config/features.js +18 -7
- package/dist/config/release-profiles/development.json +4 -1
- package/dist/config/release-profiles/mvp.json +4 -2
- package/dist/daemon/conflict-resolution.js +172 -0
- package/dist/daemon/content-hash.js +31 -0
- package/dist/daemon/file-sync.js +985 -0
- package/dist/daemon/index.js +203 -0
- package/dist/daemon/mime-types.js +166 -0
- package/dist/daemon/offline-queue.js +211 -0
- package/dist/daemon/path-utils.js +64 -0
- package/dist/daemon/share-policy.js +83 -0
- package/dist/daemon/wasm-errors.js +189 -0
- package/dist/daemon/worker.js +557 -0
- package/dist/daemon-worker.js +3 -2
- package/dist/errors/workspace-errors.js +48 -0
- package/dist/lib/auth-server.js +89 -26
- package/dist/lib/browser.js +1 -1
- package/dist/lib/diff.js +284 -0
- package/dist/lib/formatters.js +204 -0
- package/dist/lib/git.js +137 -0
- package/dist/lib/local-fs.js +201 -0
- package/dist/lib/prompts.js +23 -83
- package/dist/lib/storage.js +11 -1
- package/dist/lib/trace-formatters.js +314 -0
- package/dist/services/add-service.js +554 -0
- package/dist/services/add-validation.js +124 -0
- package/dist/services/mod-config.js +8 -2
- package/dist/services/modignore-service.js +2 -0
- package/dist/stores/use-workspaces-store.js +36 -14
- package/dist/types/add-types.js +99 -0
- package/dist/types/config.js +1 -1
- package/dist/types/workspace-connection.js +53 -2
- package/package.json +7 -5
- package/commands/execute.md +0 -156
- package/commands/overview.md +0 -233
- package/commands/review.md +0 -151
- package/commands/spec.md +0 -169
package/commands/review.md
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
version: 2.0.0
|
|
3
|
-
updated: 2026-01-03
|
|
4
|
-
description: Review specification and add traceability comments
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Specification Review & Traceability Agent
|
|
8
|
-
|
|
9
|
-
Given this specification file: ".mod/specs/<optional-folder>/$ARGUMENTS"
|
|
10
|
-
|
|
11
|
-
## Branch Context and Specification Setup
|
|
12
|
-
|
|
13
|
-
**Automatic Branch Detection and Context Gathering:**
|
|
14
|
-
|
|
15
|
-
**If no specification argument provided:**
|
|
16
|
-
1. **Check active branch** for linked specification:
|
|
17
|
-
```bash
|
|
18
|
-
mod branch status
|
|
19
|
-
# Should show active branch and linked specification
|
|
20
|
-
```
|
|
21
|
-
2. **Error handling** for lightweight branches:
|
|
22
|
-
```bash
|
|
23
|
-
# If current branch has no specification:
|
|
24
|
-
# > Current branch "fix-auth-timeout" is a lightweight branch with no specification
|
|
25
|
-
# > Options:
|
|
26
|
-
# > 1. Link specification: mod branch spec-link <spec-file>
|
|
27
|
-
# > 2. Create specification branch: mod branch create feature-<name> --spec <spec-file>
|
|
28
|
-
# > 3. Switch to specification branch: mod branch switch <spec-branch>
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
**If specification argument provided (e.g., `branching-cli.spec.md`):**
|
|
32
|
-
1. **Auto-switch to specification branch**:
|
|
33
|
-
```bash
|
|
34
|
-
# Check if corresponding branch exists
|
|
35
|
-
mod branch list | grep "feature-.*branching-cli"
|
|
36
|
-
|
|
37
|
-
# If exists, switch to it
|
|
38
|
-
mod branch switch feature-mod-cli-branching-cli
|
|
39
|
-
|
|
40
|
-
# If doesn't exist, create it
|
|
41
|
-
mod branch create feature-mod-cli-branching-cli --spec mod-cli/branching-cli.spec.md
|
|
42
|
-
```
|
|
43
|
-
2. **Verify branch setup**:
|
|
44
|
-
```bash
|
|
45
|
-
mod branch status
|
|
46
|
-
# Should confirm specification branch is active and linked
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
**Review Context Gathering (Automatic):**
|
|
50
|
-
1. **Implementation Progress**: `mod branch status` shows current implementation changes
|
|
51
|
-
2. **Specification Requirements**: `mod status <spec-name>.spec.md` shows requirements and traceability
|
|
52
|
-
3. **Coverage Analysis**: `glassware` shows detailed traceability information
|
|
53
|
-
4. **Code Structure**: Analyzes functions, classes, and existing glassware traces per file
|
|
54
|
-
|
|
55
|
-
### Trace Writing Instructions
|
|
56
|
-
- Use **glassware annotations** for all traceability
|
|
57
|
-
- Every implementation trace must use: `// glassware[type=implementation, id=unique-id, requirements=REQ-ID]`
|
|
58
|
-
- Add traces directly in the implementation files that satisfy the requirement
|
|
59
|
-
- Do **not** invent requirement IDs; only use ones defined in the provided spec
|
|
60
|
-
- Each implementation must have a unique `id` attribute
|
|
61
|
-
|
|
62
|
-
## Review Process
|
|
63
|
-
|
|
64
|
-
**Automated review agent that analyzes implementation against specification:**
|
|
65
|
-
|
|
66
|
-
1. **Read and parse the complete specification** including all requirements
|
|
67
|
-
2. **Run initial status check**: `glassware` to assess current traceability
|
|
68
|
-
3. **Understand branch changes**: Use `mod branch status` to see what code changes exist on this branch
|
|
69
|
-
4. **Scan all implementation files** in the codebase for related code
|
|
70
|
-
5. **Add missing glassware traces** where implementation matches requirements
|
|
71
|
-
6. **Update specification** where implementation has diverged but makes sense
|
|
72
|
-
7. **Verify progress**: Re-run `glassware` to confirm improvements
|
|
73
|
-
8. **Leave untraced code** that doesn't match any requirements (for IDE flagging)
|
|
74
|
-
|
|
75
|
-
## Primary Tasks
|
|
76
|
-
|
|
77
|
-
### 1. Audit Spec Coverage Granularity
|
|
78
|
-
- **Analyze function complexity** using automated detection (lines, conditionals, business logic patterns)
|
|
79
|
-
- **Flag under-specified complex functions** that need line-level traces but only have method-level
|
|
80
|
-
- **Flag over-specified simple functions** that have line-level traces when method-level is appropriate
|
|
81
|
-
- **Verify business logic traceability** - ensure all business logic has detailed line-level traces
|
|
82
|
-
|
|
83
|
-
### 2. Add Missing Traceability
|
|
84
|
-
- **Scan implementation files** for code that fulfills spec requirements but lacks glassware traces
|
|
85
|
-
- **Add appropriate glassware references** with correct granularity based on complexity analysis
|
|
86
|
-
- **Use confidence thresholds** - only add traces where match is ≥95% certain
|
|
87
|
-
|
|
88
|
-
### 3. Specification Updates
|
|
89
|
-
- **Identify implementation patterns** that extend beyond original requirements
|
|
90
|
-
- **Update specifications** to include discovered functionality that makes sense (including if implementation means parts of spec are no longer relevant)
|
|
91
|
-
- **Add new sub-requirements** (e.g., BEH-AUTH-1.1a) for legitimate extensions
|
|
92
|
-
- **Document rationale** for each specification update
|
|
93
|
-
|
|
94
|
-
### 4. Flag Non-Compliant Code
|
|
95
|
-
- **Leave code without glassware traces** when it doesn't match any requirement
|
|
96
|
-
- **Identify implementation gaps** where spec requirements have no code
|
|
97
|
-
- **Report architectural violations** where code contradicts spec patterns
|
|
98
|
-
|
|
99
|
-
## Output Actions
|
|
100
|
-
|
|
101
|
-
**File Updates:**
|
|
102
|
-
- **Implementation files**: Add glassware traces with appropriate granularity where code matches requirements
|
|
103
|
-
- **Specification files**: Update specs to reflect legitimate implementation extensions
|
|
104
|
-
- **Summary report**: List of granularity improvements, changes made, and issues flagged
|
|
105
|
-
|
|
106
|
-
**Quality Standards:**
|
|
107
|
-
- **Appropriate Granularity**: Apply method-level traces to simple functions, line-level to complex functions
|
|
108
|
-
- **Business Logic Priority**: Always ensure business logic has detailed line-level traceability
|
|
109
|
-
- **Conservative tracing**: Only add glassware traces with high confidence
|
|
110
|
-
- **Sensible spec updates**: Only update specs for logical extensions, not violations
|
|
111
|
-
- **Clear flagging**: Leave obvious gaps and violations untraced for developer attention
|
|
112
|
-
|
|
113
|
-
### Spec Granularity Review Rules
|
|
114
|
-
**For each function, assess current glassware traces:**
|
|
115
|
-
|
|
116
|
-
1. **Count Current Traces**:
|
|
117
|
-
- 1 glassware comment = method-level coverage
|
|
118
|
-
- 2+ glassware comments = line-level coverage
|
|
119
|
-
|
|
120
|
-
2. **Apply Complexity Rules**:
|
|
121
|
-
- **Business Logic** (validate/auth/pay/charge/encrypt/save/persist): MUST have line-level traces
|
|
122
|
-
- **Complex Functions** (>10 lines OR conditionals): SHOULD have line-level traces
|
|
123
|
-
- **Simple Functions** (≤10 lines, no conditionals): Method-level traces OK
|
|
124
|
-
|
|
125
|
-
3. **Review Actions**:
|
|
126
|
-
- **Under-specified**: Complex function with only method-level trace → Add line-level traces
|
|
127
|
-
- **Over-specified**: Simple function with line-level traces → Consider consolidating to method-level
|
|
128
|
-
- **Missing Business Logic**: Business function without detailed traces → Flag as critical gap
|
|
129
|
-
|
|
130
|
-
### Glassware Format Reference
|
|
131
|
-
|
|
132
|
-
**In Markdown specs (requirements):**
|
|
133
|
-
```markdown
|
|
134
|
-
The system must validate user credentials. <glassware type="requirement" id="REQ-AUTH-1" />
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**In TypeScript (implementations):**
|
|
138
|
-
```typescript
|
|
139
|
-
// glassware[type=implementation, id=auth-login, requirements=REQ-AUTH-1]
|
|
140
|
-
export function login(email: string, password: string) { ... }
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
## Review Completion Validation
|
|
144
|
-
|
|
145
|
-
**Before completing review, run final verification:**
|
|
146
|
-
- Execute `glassware` to verify improved traceability coverage
|
|
147
|
-
- Use `mod branch status` to verify what code changes exist on branch
|
|
148
|
-
- Ensure all requirements show as "implemented" when code is properly traced
|
|
149
|
-
- Document coverage improvements achieved
|
|
150
|
-
|
|
151
|
-
**Result**: Complete bidirectional traceability with updated specifications that reflect actual implementation while flagging non-compliant code.
|
package/commands/spec.md
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
version: 1.0.0
|
|
3
|
-
updated: 2025-12-13
|
|
4
|
-
checksum: d4e5f6g7h8i9j0k1
|
|
5
|
-
description: Create comprehensive spec from feature description
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# ModSpec Creation Guide
|
|
9
|
-
|
|
10
|
-
Given this high-level feature description: "$ARGUMENTS"
|
|
11
|
-
|
|
12
|
-
## Branch Creation and Setup
|
|
13
|
-
|
|
14
|
-
**BEFORE writing the specification:**
|
|
15
|
-
|
|
16
|
-
**Automatic Specification Branch Creation:**
|
|
17
|
-
1. **Extract spec title** from the feature description arguments
|
|
18
|
-
2. **Check for existing branch** that matches the specification:
|
|
19
|
-
```bash
|
|
20
|
-
# Check if specification branch already exists
|
|
21
|
-
mod branch list | grep "feature-[package-]spec-name"
|
|
22
|
-
```
|
|
23
|
-
3. **Create or switch to specification branch**:
|
|
24
|
-
```bash
|
|
25
|
-
# If branch exists, switch to it
|
|
26
|
-
mod branch switch feature-mod-cli-branching-cli
|
|
27
|
-
|
|
28
|
-
# If branch doesn't exist, create it with package prefix
|
|
29
|
-
mod branch create feature-mod-cli-branching-cli --spec mod-cli/branching-cli.spec.md
|
|
30
|
-
```
|
|
31
|
-
4. **Verify branch setup**:
|
|
32
|
-
```bash
|
|
33
|
-
mod branch status
|
|
34
|
-
# Should show: Active branch: feature-mod-cli-branching-cli [spec] (specification)
|
|
35
|
-
# Should show: ✓ Linked to specification: .mod/specs/mod-cli/branching-cli.spec.md
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
**Package-Prefixed Branch Naming:**
|
|
39
|
-
- **Pattern**: `feature-{package}-{spec-name}`
|
|
40
|
-
- **Examples**:
|
|
41
|
-
- `feature-mod-cli-branching-cli`
|
|
42
|
-
- `feature-mod-core-workspace-management`
|
|
43
|
-
- `feature-mod-ui-component-library`
|
|
44
|
-
- **Benefits**: Clear package ownership, avoids name collisions
|
|
45
|
-
|
|
46
|
-
**Background Sync Integration:**
|
|
47
|
-
- The mod sync daemon automatically tracks specification file changes
|
|
48
|
-
- Branch switching preserves working directory state
|
|
49
|
-
- Real-time change monitoring enables seamless development flow
|
|
50
|
-
|
|
51
|
-
## Pre-Specification Research
|
|
52
|
-
|
|
53
|
-
**BEFORE writing the specification:**
|
|
54
|
-
1. Research existing codebase for related functionality and patterns
|
|
55
|
-
2. Check `.mod/specs/` for similar specifications
|
|
56
|
-
3. Identify reusable code, services, and integration points
|
|
57
|
-
4. Understand the target package's architecture and conventions
|
|
58
|
-
|
|
59
|
-
## ModSpec Structure
|
|
60
|
-
|
|
61
|
-
Include:
|
|
62
|
-
|
|
63
|
-
**Required Header:**
|
|
64
|
-
```markdown
|
|
65
|
-
---
|
|
66
|
-
title: [feature-name]
|
|
67
|
-
type: specification
|
|
68
|
-
---
|
|
69
|
-
# [Feature Name] Specification
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
**Core Sections:**
|
|
73
|
-
1. **Abstract** - One concise sentence describing key capabilities
|
|
74
|
-
2. **Motivation** - Problems and impact in bullet points
|
|
75
|
-
3. **Approach** - Technical decisions and integration points
|
|
76
|
-
4. **UX Requirements (UX-*)** - UI components, user flows, and accessibility
|
|
77
|
-
5. **Business Logic Requirements (BUS-*)** - Business logic, workflows, and validation rules
|
|
78
|
-
6. **Data Model Requirements (DATA-*)** - TypeScript interfaces, data structures, and service extensions (be conservative - prefer extending existing over creating new)
|
|
79
|
-
7. **Integration Requirements (INT-*)** - APIs, external services, and data exchange
|
|
80
|
-
8. **Infrastructure Requirements (INFRA-*)** - System architecture, deployment, and scaling
|
|
81
|
-
9. **Quality Requirements (QUAL-*)** - Testing, performance, and security criteria
|
|
82
|
-
|
|
83
|
-
### Quality Requirements Playbook
|
|
84
|
-
Default to four numbered blocks so every spec documents the same test tiers; add REQ-QUAL-5+ if the feature needs specialty coverage (security, privacy, chaos, compliance, etc.). Keep every entry succinct and include the test type + success metric in the requirement text. Under each block, add sub-numbered requirements (REQ-QUAL-X.Y.Z) that describe the specific test case so it can be traced back to automation or manual checklists.
|
|
85
|
-
|
|
86
|
-
1. **REQ-QUAL-1: Unit Quality** — Core modules and invariants guarded by unit tests (coverage targets, fixtures, failure injection).
|
|
87
|
-
2. **REQ-QUAL-2: Integration Quality** — Extension/service interactions, persistence, external APIs validated through integration harnesses.
|
|
88
|
-
3. **REQ-QUAL-3: End-to-End / Scenario Quality** — Real workflows (happy + negative), manual UX steps, plus the evidence reviewers must archive.
|
|
89
|
-
4. **REQ-QUAL-4: Performance & Telemetry** — Bench methodology, latency/throughput budgets, soak expectations, telemetry metrics + alert thresholds.
|
|
90
|
-
5. **REQ-QUAL-5+: Optional Specialty** — Security, resilience, localization, etc., only when needed.
|
|
91
|
-
|
|
92
|
-
Reference `mod-ide-plugin/12-spec-branch-creation-and-change-tracking.spec.md` for tone and structure when in doubt.
|
|
93
|
-
|
|
94
|
-
**Critical Requirements for Agent Execution:**
|
|
95
|
-
- Use hierarchical numbered requirements with concise, clear descriptions:
|
|
96
|
-
- REQ-{CATEGORY}: Top-level category (REQ-UX, REQ-BUS, REQ-DATA, REQ-INT, REQ-INFRA, REQ-QUAL)
|
|
97
|
-
- REQ-{CATEGORY}-N: User story-level groupings (REQ-UX-1: Dashboard access with recent activity)
|
|
98
|
-
- REQ-{CATEGORY}-N.N: Feature sections within user story (REQ-UX-1.1: Default State)
|
|
99
|
-
- REQ-{CATEGORY}-N.N.N: Granular implementation details (REQ-UX-1.1.1: Available dashboard view)
|
|
100
|
-
- Write concisely: remove redundant words, use bullet points, avoid verbose descriptions
|
|
101
|
-
- Include exact implementation details (bcrypt cost=12, not "hash securely")
|
|
102
|
-
- Specify concrete behavior that agents can implement directly
|
|
103
|
-
- Be direct and scannable - eliminate wordy, repetitive language
|
|
104
|
-
|
|
105
|
-
## Specification Output Location and Chronological Ordering
|
|
106
|
-
|
|
107
|
-
**IMPORTANT**: Create the specification file at:
|
|
108
|
-
`.mod/specs/<appropriate-folder>/<feature-name>.spec.md`
|
|
109
|
-
|
|
110
|
-
**Chronological Ordering System:**
|
|
111
|
-
1. **Use Creation Date**: Specs are ordered by creation date for stable, conflict-free sequencing
|
|
112
|
-
2. **Add Created Frontmatter**: Include `created: YYYY-MM-DD` in the YAML frontmatter for explicit ordering
|
|
113
|
-
3. **Fallback to File Stats**: If no `created` field exists, use file system creation time as backup
|
|
114
|
-
4. **Display Numbers**: Show position numbers (1., 2., 3.) in navigation UI based on chronological order
|
|
115
|
-
|
|
116
|
-
**Directory Selection:**
|
|
117
|
-
Choose the appropriate folder based on the feature's primary domain. If unsure, use the package name that will contain the primary implementation.
|
|
118
|
-
|
|
119
|
-
**Frontmatter Template:**
|
|
120
|
-
```markdown
|
|
121
|
-
---
|
|
122
|
-
title: feature-name
|
|
123
|
-
type: specification
|
|
124
|
-
created: 2024-01-15
|
|
125
|
-
---
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
**Benefits of Date-Based Ordering:**
|
|
129
|
-
- **No file renaming**: New specs don't affect existing filenames
|
|
130
|
-
- **Merge conflict free**: Multiple developers can create specs simultaneously
|
|
131
|
-
- **Stable references**: Spec filenames never change after creation
|
|
132
|
-
- **Natural chronology**: Order reflects development timeline
|
|
133
|
-
|
|
134
|
-
## Quality Checklist
|
|
135
|
-
|
|
136
|
-
Before finalizing your specification, ensure:
|
|
137
|
-
|
|
138
|
-
✅ **Concise**: Abstract is one sentence, motivation uses bullet points, requirements are direct
|
|
139
|
-
✅ **Traceability**: Every requirement maps to specific implementation files
|
|
140
|
-
✅ **Testability**: Every requirement can be validated through testing
|
|
141
|
-
✅ **Measurability**: Performance targets include specific metrics
|
|
142
|
-
✅ **Completeness**: All user workflows are covered by requirements
|
|
143
|
-
✅ **Clarity**: Each requirement has unambiguous acceptance criteria
|
|
144
|
-
✅ **Implementation Ready**: Developers know exactly what to build and where
|
|
145
|
-
✅ **File Location**: Spec is saved to `.mod/specs/<appropriate-folder>/<feature-name>.spec.md`
|
|
146
|
-
|
|
147
|
-
## Examples
|
|
148
|
-
|
|
149
|
-
### Hierarchical Requirements Structure:
|
|
150
|
-
```markdown
|
|
151
|
-
## REQ-UX: User Experience Requirements
|
|
152
|
-
|
|
153
|
-
### REQ-UX-1: Real-time email validation feedback for error correction
|
|
154
|
-
|
|
155
|
-
**REQ-UX-1.1: Form Components**
|
|
156
|
-
- REQ-UX-1.1.1: Email input with real-time validation feedback
|
|
157
|
-
- REQ-UX-1.1.2: Password input with strength indicator
|
|
158
|
-
- REQ-UX-1.1.3: Submit button with loading/disabled states
|
|
159
|
-
- REQ-UX-1.1.4: Error display areas with ARIA attributes
|
|
160
|
-
|
|
161
|
-
**REQ-UX-1.2: Validation Logic**
|
|
162
|
-
- REQ-UX-1.2.1: Email format validation on blur event
|
|
163
|
-
- REQ-UX-1.2.2: Password strength calculation with visual feedback
|
|
164
|
-
- REQ-UX-1.2.3: Form submission validation with error handling
|
|
165
|
-
- REQ-UX-1.2.4: Success state with redirect to verification
|
|
166
|
-
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
Now generate your specification following this template, ensuring every requirement is traceable from business value to implementation code and can be validated through testing.
|