documinty 0.2.0 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcd92454896ed0ffc0ab3f3e86a064d71a62e2da5430fa1b7920aecac854ce6b
4
- data.tar.gz: 740b56dd5581065c39d6cc09ff67c420867803d47c5420a5dfd4f8c682474616
3
+ metadata.gz: 0f47f710104e3d97dbf8afa35333f6c5559acfae0b9920b88a371d8e4ac2e17f
4
+ data.tar.gz: 3ac6cf1da6b1582176be4b7b1120c415dd859b1acf602942462c0f49f8980a66
5
5
  SHA512:
6
- metadata.gz: 47a1af0117416167328b171df5a3869adf2847f928a4d76f9a6c4c0c99661650929a42ded453e970760d1cee05d9bb1c8d22eeec65e48725e393865a24d73351
7
- data.tar.gz: abdf028bb0da059b527b81198e4d7c00a6cc7fb71a4e6f31c5a97abecf059f69a4cb40216a8336377abc4650478f8270fc20bd96af8642defa8fc923b5d84aea
6
+ metadata.gz: 5181bcec104b0441f59681e3e4dc792dcca156581bbb7b2da7b66d0a1a88d470de55faa22f223cbbbae1bd117dbce39f129af7373429874e96832867469897b6
7
+ data.tar.gz: 460d9755b0baf1155a66f2e30d7d50c73063b01cb1cfbf47c0090cadbcb2c126bd9dcf24770c2c5e1d314bed381dbd2b67e0e77095ac218dc7cb853f67e5924e
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2025 TODO: Write your name
3
+ Copyright (c) 2025 Marcel Carrero Pedre
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,43 +1,129 @@
1
1
  # Documinty
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
3
+ ![Alt text describing image](assets/logo.png)
4
+
5
+ **Documinty** (alias `dty`) is a lightweight CLI tool to help you document your Ruby codebase as you build features. It lets you:
6
+
7
+ - Create and manage **features**
8
+ - Tag files with a **node type**, **description**, and **methods**
9
+ - Query documentation by file or by feature
10
+ - Visualize which files belong to a feature (grouped by directory)
11
+ - Search for features by substring
12
+
13
+ Everything you record lives under a `.documinty/` folder in your project. You can version it alongside your code, making documentation part of your workflow.
4
14
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/documinty`. To experiment with that code, run `bin/console` for an interactive prompt.
6
15
 
7
16
  ## Installation
8
17
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
18
+ ### Prerequisites
19
+
20
+ - Ruby ≥ 3.1
21
+ - Bundler (optional, but recommended)
10
22
 
11
- Install the gem and add to the application's Gemfile by executing:
23
+ ### From RubyGems
12
24
 
13
25
  ```bash
14
- bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
26
+ gem install documinty
27
+ # or, if you prefer the short alias:
28
+ # gem install dty
29
+
15
30
  ```
16
31
 
17
- If bundler is not being used to manage dependencies, install the gem by executing:
32
+ ### From Git(development version)
18
33
 
19
- ```bash
20
- gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
34
+ ```
35
+ git clone git@github.com:yourusername/documinty.git
36
+ cd documinty
37
+ ```
38
+
39
+ Build and install locally
40
+ ```
41
+ bundle install
42
+ bundle exec rake build
43
+ gem install pkg/documinty-<VERSION>.gem
21
44
  ```
22
45
 
23
46
  ## Usage
24
47
 
25
- TODO: Write usage instructions here
26
48
 
27
- ## Development
49
+ ### 1. Go into your existing codebase
50
+ ```
51
+ cd path/to/your-app
52
+ ```
28
53
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
54
+ ### 2. Initialize Documinty (creates .documinty/)
55
+ ```
56
+ dty init --codebase your-app
57
+ ```
58
+ ### 3. Create a feature called "user-auth"
59
+ ```
60
+ dty feat user-auth
61
+ ```
62
+ ### 4. Tag a file under "user-auth" as a controller, prompt for description & methods
63
+ ```
64
+ dty doc app/controllers/sessions_controller.rb -f user-auth -n controller
65
+
66
+ # • You’ll be prompted:
67
+ # Enter a brief description for this node⚙️:
68
+ # (e.g.) "Handles login/logout flows"
69
+ #
70
+ # Enter comma-separated methods for this node🛠️:
71
+ # (e.g.) :new, :create, :destroy
72
+ ```
73
+ ### 5. View documentation for that file
74
+ ```
75
+ dty show app/controllers/sessions_controller.rb
76
+ ```
77
+ ### 6. List all defined features
78
+ ```
79
+ dty features
80
+ ```
81
+ ### 7. Show all files under "user-auth"
82
+ ```
83
+ dty list_f user-auth
84
+ ```
85
+ ### 8. Show file structure under "user-auth"
86
+ ```
87
+ dty involved_f user-auth
88
+ ```
89
+ ### 9. Search for features that contain "user"
90
+ ```
91
+ dty search_f user
92
+ ```
30
93
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
94
+ ### Project layout
95
+ ```
96
+ .
97
+ ├── exe/
98
+ │ ├── documinty # primary executable stub
99
+ │ └── dty # short alias stub
100
+ ├── lib/
101
+ │ └── documinty/
102
+ │ ├── cli.rb # Thor CLI definitions
103
+ │ └── store.rb # YAML-backed storage logic
104
+ │ └── documinty.rb # loads version and CLI
105
+ │ └── documinty/version.rb
106
+ ├── .documinty/ # created once you run `dty init`
107
+ │ ├── config.yml
108
+ │ └── features/ # per-feature YAML files live here
109
+ ├── Rakefile # builds the gem
110
+ ├── documinty.gemspec # gemspec (metadata + dependencies)
111
+ ├── LICENSE.txt
112
+ └── README.md
113
+ ```
32
114
 
33
- ## Contributing
115
+ ### Contributing
116
+ 1 - Fork the repository
34
117
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/documinty. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/documinty/blob/main/CODE_OF_CONDUCT.md).
118
+ 2 - Create a new branch (git checkout -b my-feature)
36
119
 
37
- ## License
120
+ 3 - Make your changes and add tests if applicable
38
121
 
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
122
+ 4 - Commit, push, and open a Pull Request
40
123
 
41
- ## Code of Conduct
124
+ 5 - We’ll review and merge!
42
125
 
43
- Everyone interacting in the Documinty project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/documinty/blob/main/CODE_OF_CONDUCT.md).
126
+ ### License
127
+ License
128
+ This project is licensed under the MIT License.
129
+ See LICENSE.txt for details.
data/exe/dty ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "documinty"
5
+ Documinty::CLI.start(ARGV)
data/lib/documinty/cli.rb CHANGED
@@ -15,7 +15,7 @@ module Documinty
15
15
  end
16
16
 
17
17
  desc "feature NAME", "Create a new feature for tagging"
18
- def feature(name)
18
+ def feat(name)
19
19
  begin
20
20
  store.add_feature(name)
21
21
  say "✅ Created feature '#{name}'", :green
@@ -38,14 +38,23 @@ module Documinty
38
38
  desc "document FILE", "Tag FILE under an existing feature"
39
39
  option :feature, aliases: '-f', required: true, desc: 'Feature name to group under'
40
40
  option :node, aliases: '-n', required: true, desc: 'Node/type label'
41
- def document(path)
41
+ def doc(path)
42
42
  begin
43
+ description = ask("Enter a brief description for this node⚙️:")
44
+ methods_input = ask("Enter comma-separated methods for this node (or leave blank if none)🛠️:")
45
+ method_syms = methods_input
46
+ .split(",")
47
+ .map(&:strip)
48
+ .reject(&:empty?)
49
+ .map(&:to_sym)
50
+
43
51
  entry = store.add_entry(
44
- path: path,
45
- node: options[:node],
46
- feature: options[:feature],
47
- timestamp: Time.now.iso8601,
48
- description: options[:description] || ask("Enter a brief description for this node:")
52
+ path: path,
53
+ node: options[:node],
54
+ feature: options[:feature],
55
+ methods: method_syms,
56
+ timestamp: Time.now.iso8601,
57
+ description: description,
49
58
  )
50
59
  say "✅ Documented #{entry['path']} as #{entry['node']} under '#{entry['feature']}'", :green
51
60
  rescue Error => e
@@ -55,26 +64,81 @@ module Documinty
55
64
  end
56
65
 
57
66
  desc "show FILE", "Display documentation for FILE (node & feature)"
58
- def show_documented(path)
67
+ option :feature, aliases: '-f', desc: 'Only show documentation under this feature'
68
+ def show(path)
59
69
  entries = store.entries_for(path)
70
+
71
+ # If a specific feature is requested, filter to those entries
72
+ if options[:feature]
73
+ entries = entries.select { |e| Array(e['features'] || e['feature']).include?(options[:feature]) }
74
+ end
75
+
60
76
  if entries.empty?
61
- say "❌ No documentation found for '#{path}'", :red
77
+ if options[:feature]
78
+ say "❌ No documentation found for '#{path}' under feature '#{options[:feature]}'", :red
79
+ else
80
+ say "❌ No documentation found for '#{path}'", :red
81
+ end
62
82
  exit(1)
63
83
  end
64
84
 
65
85
  entries.each do |e|
66
- say "File: #{e['path']}", :magenta
67
- say "Node type: #{e['node']}", :magenta
68
- say "Feature: #{e['feature']}", :magenta
69
- say "Description: #{e['description']}", :magenta unless e['description'].to_s.empty?
70
- say "Tagged at: #{e['timestamp']}", :magenta
71
- say "-" * 40, :magenta
86
+ label_color = :cyan
87
+ value_color = :magenta
88
+
89
+ # File
90
+ say(
91
+ set_color("File📄", label_color) +
92
+ ": " +
93
+ set_color(e['path'], value_color)
94
+ )
95
+
96
+ # Node type
97
+ say(
98
+ set_color("Node type⚙️", label_color) +
99
+ ": " +
100
+ set_color(e['node'], value_color)
101
+ )
102
+
103
+ # Features
104
+ say(
105
+ set_color("Features🏷️", label_color) +
106
+ ": " +
107
+ set_color(Array(e['features'] || e['feature']).join(", "), value_color)
108
+ )
109
+
110
+ # Description (only if present)
111
+ unless e['description'].to_s.empty?
112
+ say(
113
+ set_color("Description📝", label_color) +
114
+ ": " +
115
+ set_color(e['description'], value_color)
116
+ )
117
+ end
118
+
119
+ # Methods (only if present)
120
+ if e['methods'] && !e['methods'].empty?
121
+ say(
122
+ set_color("Methods🛠️", label_color) +
123
+ ": " +
124
+ set_color(Array(e['methods']).join(", "), value_color)
125
+ )
126
+ end
127
+
128
+ # Timestamp
129
+ say(
130
+ set_color("Tagged at⏰", label_color) +
131
+ ": " +
132
+ set_color(e['timestamp'], value_color)
133
+ )
134
+
135
+ say "-" * 40
72
136
  end
73
137
  end
74
138
 
75
139
  desc "untag FILE", "Remove FILE’s tag from an existing feature"
76
140
  option :feature, aliases: '-f', required: true, desc: "Feature name"
77
- def undocument(path)
141
+ def untag(path)
78
142
  begin
79
143
  removed = store.remove_entry(path: path, feature: options[:feature])
80
144
  removed.each do |e|
@@ -87,7 +151,7 @@ module Documinty
87
151
  end
88
152
 
89
153
  desc "show-feature FEATURE", "List all files documented under FEATURE"
90
- def show_feature(feature)
154
+ def list_f(feature)
91
155
  begin
92
156
  entries = store.entries_for_feature(feature)
93
157
  rescue Error => e
@@ -106,7 +170,7 @@ module Documinty
106
170
  end
107
171
 
108
172
  desc "show_feature_involved FEATURE", "Display files under FEATURE grouped by directory"
109
- def show_feature_involved(feature)
173
+ def involved_f(feature)
110
174
  begin
111
175
  entries = store.entries_for_feature(feature)
112
176
  rescue Error => e
@@ -131,11 +195,23 @@ module Documinty
131
195
 
132
196
  entries_in_dir.each do |e|
133
197
  # Print each filename line with a file emoji, indented, in green
134
- say " 📄 #{File.basename(e['path'])}", :green
198
+ say " 📄 #{File.basename(e['path'])}", :green
135
199
  end
136
200
  end
137
201
  end
138
202
 
203
+
204
+ desc "search_f QUERY", "List all features containing QUERY"
205
+ def search_f(query)
206
+ matches = store.features.select { |f| f.include?(query) }
207
+ if matches.empty?
208
+ say "❌ No features match '#{query}'", :red
209
+ else
210
+ say "Matching features:", :cyan
211
+ matches.each { |f| say "• #{f}", :green }
212
+ end
213
+ end
214
+
139
215
  private
140
216
 
141
217
  def store
@@ -43,7 +43,7 @@ module Documinty
43
43
 
44
44
  # ─── Entries API ──────────────────────────────────────────────────────────
45
45
  # Tag a file under a specific feature
46
- def add_entry(path:, node:, feature:, timestamp:, description: '')
46
+ def add_entry(path:, node:, feature:, methods: [], timestamp:, description: '')
47
47
  file = feature_file(feature)
48
48
  raise Error, "Feature '#{feature}' does not exist" unless File.exist?(file)
49
49
 
@@ -53,6 +53,7 @@ module Documinty
53
53
  'path' => path,
54
54
  'node' => node.to_s,
55
55
  'feature' => feature,
56
+ 'methods' => Array(methods).map(&:to_s),
56
57
  'description' => description.to_s.strip,
57
58
  'timestamp' => timestamp
58
59
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Documinty
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: documinty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcel Carrero Pedre
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-05-31 00:00:00.000000000 Z
10
+ date: 2025-06-03 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: thor
@@ -42,6 +42,7 @@ email:
42
42
  - marcel.pedre001@outlook.com
43
43
  executables:
44
44
  - documinty
45
+ - dty
45
46
  extensions: []
46
47
  extra_rdoc_files: []
47
48
  files:
@@ -50,17 +51,18 @@ files:
50
51
  - LICENSE.txt
51
52
  - README.md
52
53
  - exe/documinty
54
+ - exe/dty
53
55
  - lib/documinty.rb
54
56
  - lib/documinty/cli.rb
55
57
  - lib/documinty/store.rb
56
58
  - lib/documinty/version.rb
57
- homepage: https://github.com/yourusername/carreromarcel
59
+ homepage: https://github.com/BatouGlitch/documinty
58
60
  licenses:
59
61
  - MIT
60
62
  metadata:
61
- homepage_uri: https://github.com/yourusername/carreromarcel
62
- source_code_uri: https://github.com/yourusername/carreromarcel
63
- changelog_uri: https://github.com/yourusername/carreromarcel/blob/main/CHANGELOG.md
63
+ homepage_uri: https://github.com/BatouGlitch/documinty
64
+ source_code_uri: https://github.com/BatouGlitch/documinty
65
+ changelog_uri: https://github.com/BatouGlitch/documinty/blob/main/CHANGELOG.md
64
66
  rdoc_options: []
65
67
  require_paths:
66
68
  - lib